[mwd] Patching nv.d3 trusted types violations
Change-Id: I4494ae477e28f70eff7ac8922dc8844a6351b0ca
diff --git a/nv.d3.js b/nv.d3.js
index 69063b0..dc6f4e9 100644
--- a/nv.d3.js
+++ b/nv.d3.js
@@ -14345,1627 +14345,4 @@
return chart;
}
-})();'use strict';
-
-var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
-
-/*! @license DOMPurify 3.0.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.5/LICENSE */
-
-(function (global, factory) {
- (typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.DOMPurify = factory());
-})(undefined, function () {
- 'use strict';
-
- var entries = Object.entries,
- setPrototypeOf = Object.setPrototypeOf,
- isFrozen = Object.isFrozen,
- getPrototypeOf = Object.getPrototypeOf,
- getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
- var freeze = Object.freeze,
- seal = Object.seal,
- create = Object.create; // eslint-disable-line import/no-mutable-exports
-
- var _ref = typeof Reflect !== 'undefined' && Reflect,
- apply = _ref.apply,
- construct = _ref.construct;
-
- if (!freeze) {
- freeze = function freeze(x) {
- return x;
- };
- }
-
- if (!seal) {
- seal = function seal(x) {
- return x;
- };
- }
-
- if (!apply) {
- apply = function apply(fun, thisValue, args) {
- return fun.apply(thisValue, args);
- };
- }
-
- if (!construct) {
- construct = function construct(Func, args) {
- return new (Function.prototype.bind.apply(Func, [null].concat(_toConsumableArray(args))))();
- };
- }
-
- var arrayForEach = unapply(Array.prototype.forEach);
- var arrayPop = unapply(Array.prototype.pop);
- var arrayPush = unapply(Array.prototype.push);
- var stringToLowerCase = unapply(String.prototype.toLowerCase);
- var stringToString = unapply(String.prototype.toString);
- var stringMatch = unapply(String.prototype.match);
- var stringReplace = unapply(String.prototype.replace);
- var stringIndexOf = unapply(String.prototype.indexOf);
- var stringTrim = unapply(String.prototype.trim);
- var regExpTest = unapply(RegExp.prototype.test);
- var typeErrorCreate = unconstruct(TypeError);
- /**
- * Creates a new function that calls the given function with a specified thisArg and arguments.
- *
- * @param {Function} func - The function to be wrapped and called.
- * @returns {Function} A new function that calls the given function with a specified thisArg and arguments.
- */
-
- function unapply(func) {
- return function (thisArg) {
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
- }
-
- return apply(func, thisArg, args);
- };
- }
- /**
- * Creates a new function that constructs an instance of the given constructor function with the provided arguments.
- *
- * @param {Function} func - The constructor function to be wrapped and called.
- * @returns {Function} A new function that constructs an instance of the given constructor function with the provided arguments.
- */
-
- function unconstruct(func) {
- return function () {
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
- args[_key2] = arguments[_key2];
- }
-
- return construct(func, args);
- };
- }
- /**
- * Add properties to a lookup table
- *
- * @param {Object} set - The set to which elements will be added.
- * @param {Array} array - The array containing elements to be added to the set.
- * @param {Function} transformCaseFunc - An optional function to transform the case of each element before adding to the set.
- * @returns {Object} The modified set with added elements.
- */
-
- function addToSet(set, array) {
- var transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase;
-
- if (setPrototypeOf) {
- // Make 'in' and truthy checks like Boolean(set.constructor)
- // independent of any properties defined on Object.prototype.
- // Prevent prototype setters from intercepting set as a this value.
- setPrototypeOf(set, null);
- }
-
- var l = array.length;
-
- while (l--) {
- var element = array[l];
-
- if (typeof element === 'string') {
- var lcElement = transformCaseFunc(element);
-
- if (lcElement !== element) {
- // Config presets (e.g. tags.js, attrs.js) are immutable.
- if (!isFrozen(array)) {
- array[l] = lcElement;
- }
-
- element = lcElement;
- }
- }
-
- set[element] = true;
- }
-
- return set;
- }
- /**
- * Shallow clone an object
- *
- * @param {Object} object - The object to be cloned.
- * @returns {Object} A new object that copies the original.
- */
-
- function clone(object) {
- var newObject = create(null);
-
- var _iteratorNormalCompletion = true;
- var _didIteratorError = false;
- var _iteratorError = undefined;
-
- try {
- for (var _iterator = entries(object)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
- var _ref2 = _step.value;
-
- var _ref3 = _slicedToArray(_ref2, 2);
-
- var property = _ref3[0];
- var value = _ref3[1];
-
- newObject[property] = value;
- }
- } catch (err) {
- _didIteratorError = true;
- _iteratorError = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion && _iterator.return) {
- _iterator.return();
- }
- } finally {
- if (_didIteratorError) {
- throw _iteratorError;
- }
- }
- }
-
- return newObject;
- }
- /**
- * This method automatically checks if the prop is function or getter and behaves accordingly.
- *
- * @param {Object} object - The object to look up the getter function in its prototype chain.
- * @param {String} prop - The property name for which to find the getter function.
- * @returns {Function} The getter function found in the prototype chain or a fallback function.
- */
-
- function lookupGetter(object, prop) {
- while (object !== null) {
- var desc = getOwnPropertyDescriptor(object, prop);
-
- if (desc) {
- if (desc.get) {
- return unapply(desc.get);
- }
-
- if (typeof desc.value === 'function') {
- return unapply(desc.value);
- }
- }
-
- object = getPrototypeOf(object);
- }
-
- function fallbackValue(element) {
- console.warn('fallback value for', element);
- return null;
- }
-
- return fallbackValue;
- }
-
- var html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']); // SVG
-
- var svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
- var svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']); // List of SVG elements that are disallowed by default.
- // We still need to know them so that we can do namespace
- // checks properly in case one wants to add them to
- // allow-list.
-
- var svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);
- var mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover', 'mprescripts']); // Similarly to SVG, we want to know all MathML elements,
- // even those that we disallow by default.
-
- var mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
- var text = freeze(['#text']);
-
- var html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns', 'slot']);
- var svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
- var mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
- var xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
-
- var MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
-
- var ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
- var TMPLIT_EXPR = seal(/\${[\w\W]*}/gm);
- var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape
-
- var ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
-
- var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
- );
- var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
- var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
- );
- var DOCTYPE_NAME = seal(/^html$/i);
-
- var EXPRESSIONS = /*#__PURE__*/Object.freeze({
- __proto__: null,
- MUSTACHE_EXPR: MUSTACHE_EXPR,
- ERB_EXPR: ERB_EXPR,
- TMPLIT_EXPR: TMPLIT_EXPR,
- DATA_ATTR: DATA_ATTR,
- ARIA_ATTR: ARIA_ATTR,
- IS_ALLOWED_URI: IS_ALLOWED_URI,
- IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,
- ATTR_WHITESPACE: ATTR_WHITESPACE,
- DOCTYPE_NAME: DOCTYPE_NAME
- });
-
- var getGlobal = function getGlobal() {
- return typeof window === 'undefined' ? null : window;
- };
- /**
- * Creates a no-op policy for internal use only.
- * Don't export this function outside this module!
- * @param {?TrustedTypePolicyFactory} trustedTypes The policy factory.
- * @param {HTMLScriptElement} purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).
- * @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types
- * are not supported or creating the policy failed).
- */
-
- var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
- if ((typeof trustedTypes === 'undefined' ? 'undefined' : _typeof(trustedTypes)) !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
- return null;
- } // Allow the callers to control the unique policy name
- // by adding a data-tt-policy-suffix to the script element with the DOMPurify.
- // Policy creation with duplicate names throws in Trusted Types.
-
-
- var suffix = null;
- var ATTR_NAME = 'data-tt-policy-suffix';
-
- if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
- suffix = purifyHostElement.getAttribute(ATTR_NAME);
- }
-
- var policyName = 'dompurify' + (suffix ? '#' + suffix : '');
-
- try {
- return trustedTypes.createPolicy(policyName, {
- createHTML: function createHTML(html) {
- return html;
- },
- createScriptURL: function createScriptURL(scriptUrl) {
- return scriptUrl;
- }
- });
- } catch (_) {
- // Policy creation failed (most likely another DOMPurify script has
- // already run). Skip creating the policy, as this will only cause errors
- // if TT are enforced.
- console.warn('TrustedTypes policy ' + policyName + ' could not be created.');
- return null;
- }
- };
-
- function createDOMPurify() {
- var window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
-
- var DOMPurify = function DOMPurify(root) {
- return createDOMPurify(root);
- };
- /**
- * Version label, exposed for easier checks
- * if DOMPurify is up to date or not
- */
-
- DOMPurify.version = '3.0.5';
- /**
- * Array of elements that DOMPurify removed during sanitation.
- * Empty if nothing was removed.
- */
-
- DOMPurify.removed = [];
-
- if (!window || !window.document || window.document.nodeType !== 9) {
- // Not running in a browser, provide a factory function
- // so that you can pass your own Window
- DOMPurify.isSupported = false;
- return DOMPurify;
- }
-
- var document = window.document;
-
- var originalDocument = document;
- var currentScript = originalDocument.currentScript;
- var DocumentFragment = window.DocumentFragment,
- HTMLTemplateElement = window.HTMLTemplateElement,
- Node = window.Node,
- Element = window.Element,
- NodeFilter = window.NodeFilter,
- _window$NamedNodeMap = window.NamedNodeMap,
- NamedNodeMap = _window$NamedNodeMap === undefined ? window.NamedNodeMap || window.MozNamedAttrMap : _window$NamedNodeMap,
- HTMLFormElement = window.HTMLFormElement,
- DOMParser = window.DOMParser,
- trustedTypes = window.trustedTypes;
-
- var ElementPrototype = Element.prototype;
- var cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
- var getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
- var getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
- var getParentNode = lookupGetter(ElementPrototype, 'parentNode'); // As per issue #47, the web-components registry is inherited by a
- // new document created via createHTMLDocument. As per the spec
- // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
- // a new empty registry is used when creating a template contents owner
- // document, so we use that as our parent document to ensure nothing
- // is inherited.
-
- if (typeof HTMLTemplateElement === 'function') {
- var template = document.createElement('template');
-
- if (template.content && template.content.ownerDocument) {
- document = template.content.ownerDocument;
- }
- }
-
- var trustedTypesPolicy = void 0;
- var emptyHTML = '';
- var _document = document,
- implementation = _document.implementation,
- createNodeIterator = _document.createNodeIterator,
- createDocumentFragment = _document.createDocumentFragment,
- getElementsByTagName = _document.getElementsByTagName;
- var importNode = originalDocument.importNode;
-
- var hooks = {};
- /**
- * Expose whether this browser supports running the full DOMPurify.
- */
-
- DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;
- var MUSTACHE_EXPR = EXPRESSIONS.MUSTACHE_EXPR,
- ERB_EXPR = EXPRESSIONS.ERB_EXPR,
- TMPLIT_EXPR = EXPRESSIONS.TMPLIT_EXPR,
- DATA_ATTR = EXPRESSIONS.DATA_ATTR,
- ARIA_ATTR = EXPRESSIONS.ARIA_ATTR,
- IS_SCRIPT_OR_DATA = EXPRESSIONS.IS_SCRIPT_OR_DATA,
- ATTR_WHITESPACE = EXPRESSIONS.ATTR_WHITESPACE;
- var IS_ALLOWED_URI$1 = EXPRESSIONS.IS_ALLOWED_URI;
- /**
- * We consider the elements and attributes below to be safe. Ideally
- * don't add any new ones but feel free to remove unwanted ones.
- */
-
- /* allowed element names */
-
- var ALLOWED_TAGS = null;
- var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray(html$1), _toConsumableArray(svg$1), _toConsumableArray(svgFilters), _toConsumableArray(mathMl$1), _toConsumableArray(text)));
- /* Allowed attribute names */
-
- var ALLOWED_ATTR = null;
- var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray(html), _toConsumableArray(svg), _toConsumableArray(mathMl), _toConsumableArray(xml)));
- /*
- * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements.
- * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
- * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
- * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
- */
-
- var CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
- tagNameCheck: {
- writable: true,
- configurable: false,
- enumerable: true,
- value: null
- },
- attributeNameCheck: {
- writable: true,
- configurable: false,
- enumerable: true,
- value: null
- },
- allowCustomizedBuiltInElements: {
- writable: true,
- configurable: false,
- enumerable: true,
- value: false
- }
- }));
- /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
-
- var FORBID_TAGS = null;
- /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
-
- var FORBID_ATTR = null;
- /* Decide if ARIA attributes are okay */
-
- var ALLOW_ARIA_ATTR = true;
- /* Decide if custom data attributes are okay */
-
- var ALLOW_DATA_ATTR = true;
- /* Decide if unknown protocols are okay */
-
- var ALLOW_UNKNOWN_PROTOCOLS = false;
- /* Decide if self-closing tags in attributes are allowed.
- * Usually removed due to a mXSS issue in jQuery 3.0 */
-
- var ALLOW_SELF_CLOSE_IN_ATTR = true;
- /* Output should be safe for common template engines.
- * This means, DOMPurify removes data attributes, mustaches and ERB
- */
-
- var SAFE_FOR_TEMPLATES = false;
- /* Decide if document with <html>... should be returned */
-
- var WHOLE_DOCUMENT = false;
- /* Track whether config is already set on this instance of DOMPurify. */
-
- var SET_CONFIG = false;
- /* Decide if all elements (e.g. style, script) must be children of
- * document.body. By default, browsers might move them to document.head */
-
- var FORCE_BODY = false;
- /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
- * string (or a TrustedHTML object if Trusted Types are supported).
- * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
- */
-
- var RETURN_DOM = false;
- /* Decide if a DOM `DocumentFragment` should be returned, instead of a html
- * string (or a TrustedHTML object if Trusted Types are supported) */
-
- var RETURN_DOM_FRAGMENT = false;
- /* Try to return a Trusted Type object instead of a string, return a string in
- * case Trusted Types are not supported */
-
- var RETURN_TRUSTED_TYPE = false;
- /* Output should be free from DOM clobbering attacks?
- * This sanitizes markups named with colliding, clobberable built-in DOM APIs.
- */
-
- var SANITIZE_DOM = true;
- /* Achieve full DOM Clobbering protection by isolating the namespace of named
- * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.
- *
- * HTML/DOM spec rules that enable DOM Clobbering:
- * - Named Access on Window (§7.3.3)
- * - DOM Tree Accessors (§3.1.5)
- * - Form Element Parent-Child Relations (§4.10.3)
- * - Iframe srcdoc / Nested WindowProxies (§4.8.5)
- * - HTMLCollection (§4.2.10.2)
- *
- * Namespace isolation is implemented by prefixing `id` and `name` attributes
- * with a constant string, i.e., `user-content-`
- */
-
- var SANITIZE_NAMED_PROPS = false;
- var SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';
- /* Keep element content when removing element? */
-
- var KEEP_CONTENT = true;
- /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
- * of importing it into a new Document and returning a sanitized copy */
-
- var IN_PLACE = false;
- /* Allow usage of profiles like html, svg and mathMl */
-
- var USE_PROFILES = {};
- /* Tags to ignore content of when KEEP_CONTENT is true */
-
- var FORBID_CONTENTS = null;
- var DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);
- /* Tags that are safe for data: URIs */
-
- var DATA_URI_TAGS = null;
- var DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
- /* Attributes safe for values like "javascript:" */
-
- var URI_SAFE_ATTRIBUTES = null;
- var DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);
- var MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
- var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
- var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
- /* Document namespace */
-
- var NAMESPACE = HTML_NAMESPACE;
- var IS_EMPTY_INPUT = false;
- /* Allowed XHTML+XML namespaces */
-
- var ALLOWED_NAMESPACES = null;
- var DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
- /* Parsing of strict XHTML documents */
-
- var PARSER_MEDIA_TYPE = null;
- var SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];
- var DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
- var transformCaseFunc = null;
- /* Keep a reference to config to pass to hooks */
-
- var CONFIG = null;
- /* Ideally, do not touch anything below this line */
-
- /* ______________________________________________ */
-
- var formElement = document.createElement('form');
-
- var isRegexOrFunction = function isRegexOrFunction(testValue) {
- return testValue instanceof RegExp || testValue instanceof Function;
- };
- /**
- * _parseConfig
- *
- * @param {Object} cfg optional config literal
- */
- // eslint-disable-next-line complexity
-
-
- var _parseConfig = function _parseConfig() {
- var cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
-
- if (CONFIG && CONFIG === cfg) {
- return;
- }
- /* Shield configuration object from tampering */
-
- if (!cfg || (typeof cfg === 'undefined' ? 'undefined' : _typeof(cfg)) !== 'object') {
- cfg = {};
- }
- /* Shield configuration object from prototype pollution */
-
- cfg = clone(cfg);
- PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
- SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE; // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
-
- transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;
- /* Set configuration parameters */
-
- ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
- ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
- ALLOWED_NAMESPACES = 'ALLOWED_NAMESPACES' in cfg ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
- URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), // eslint-disable-line indent
- cfg.ADD_URI_SAFE_ATTR, // eslint-disable-line indent
- transformCaseFunc // eslint-disable-line indent
- ) // eslint-disable-line indent
- : DEFAULT_URI_SAFE_ATTRIBUTES;
- DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), // eslint-disable-line indent
- cfg.ADD_DATA_URI_TAGS, // eslint-disable-line indent
- transformCaseFunc // eslint-disable-line indent
- ) // eslint-disable-line indent
- : DEFAULT_DATA_URI_TAGS;
- FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
- FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
- FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
- USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false;
- ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
-
- ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
-
- ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
-
- ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true
-
- SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false
-
- WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false
-
- RETURN_DOM = cfg.RETURN_DOM || false; // Default false
-
- RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false
-
- RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false
-
- FORCE_BODY = cfg.FORCE_BODY || false; // Default false
-
- SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
-
- SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false
-
- KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
-
- IN_PLACE = cfg.IN_PLACE || false; // Default false
-
- IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
- NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
- CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
-
- if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
- CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
- }
-
- if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
- CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
- }
-
- if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {
- CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
- }
-
- if (SAFE_FOR_TEMPLATES) {
- ALLOW_DATA_ATTR = false;
- }
-
- if (RETURN_DOM_FRAGMENT) {
- RETURN_DOM = true;
- }
- /* Parse profile info */
-
- if (USE_PROFILES) {
- ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray(text)));
- ALLOWED_ATTR = [];
-
- if (USE_PROFILES.html === true) {
- addToSet(ALLOWED_TAGS, html$1);
- addToSet(ALLOWED_ATTR, html);
- }
-
- if (USE_PROFILES.svg === true) {
- addToSet(ALLOWED_TAGS, svg$1);
- addToSet(ALLOWED_ATTR, svg);
- addToSet(ALLOWED_ATTR, xml);
- }
-
- if (USE_PROFILES.svgFilters === true) {
- addToSet(ALLOWED_TAGS, svgFilters);
- addToSet(ALLOWED_ATTR, svg);
- addToSet(ALLOWED_ATTR, xml);
- }
-
- if (USE_PROFILES.mathMl === true) {
- addToSet(ALLOWED_TAGS, mathMl$1);
- addToSet(ALLOWED_ATTR, mathMl);
- addToSet(ALLOWED_ATTR, xml);
- }
- }
- /* Merge configuration parameters */
-
- if (cfg.ADD_TAGS) {
- if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
- ALLOWED_TAGS = clone(ALLOWED_TAGS);
- }
-
- addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
- }
-
- if (cfg.ADD_ATTR) {
- if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
- ALLOWED_ATTR = clone(ALLOWED_ATTR);
- }
-
- addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
- }
-
- if (cfg.ADD_URI_SAFE_ATTR) {
- addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
- }
-
- if (cfg.FORBID_CONTENTS) {
- if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
- FORBID_CONTENTS = clone(FORBID_CONTENTS);
- }
-
- addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
- }
- /* Add #text in case KEEP_CONTENT is set to true */
-
- if (KEEP_CONTENT) {
- ALLOWED_TAGS['#text'] = true;
- }
- /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
-
- if (WHOLE_DOCUMENT) {
- addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
- }
- /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */
-
- if (ALLOWED_TAGS.table) {
- addToSet(ALLOWED_TAGS, ['tbody']);
- delete FORBID_TAGS.tbody;
- }
-
- if (cfg.TRUSTED_TYPES_POLICY) {
- if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') {
- throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
- }
-
- if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {
- throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
- } // Overwrite existing TrustedTypes policy.
-
-
- trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY; // Sign local variables required by `sanitize`.
-
- emptyHTML = trustedTypesPolicy.createHTML('');
- } else {
- // Uninitialized policy, attempt to initialize the internal dompurify policy.
- if (trustedTypesPolicy === undefined) {
- trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
- } // If creating the internal policy succeeded sign internal variables.
-
-
- if (trustedTypesPolicy !== null && typeof emptyHTML === 'string') {
- emptyHTML = trustedTypesPolicy.createHTML('');
- }
- } // Prevent further manipulation of configuration.
- // Not available in IE8, Safari 5, etc.
-
-
- if (freeze) {
- freeze(cfg);
- }
-
- CONFIG = cfg;
- };
-
- var MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
- var HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']); // Certain elements are allowed in both SVG and HTML
- // namespace. We need to specify them explicitly
- // so that they don't get erroneously deleted from
- // HTML namespace.
-
- var COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
- /* Keep track of all possible SVG and MathML tags
- * so that we can perform the namespace checks
- * correctly. */
-
- var ALL_SVG_TAGS = addToSet({}, svg$1);
- addToSet(ALL_SVG_TAGS, svgFilters);
- addToSet(ALL_SVG_TAGS, svgDisallowed);
- var ALL_MATHML_TAGS = addToSet({}, mathMl$1);
- addToSet(ALL_MATHML_TAGS, mathMlDisallowed);
- /**
- * @param {Element} element a DOM element whose namespace is being checked
- * @returns {boolean} Return false if the element has a
- * namespace that a spec-compliant parser would never
- * return. Return true otherwise.
- */
-
- var _checkValidNamespace = function _checkValidNamespace(element) {
- var parent = getParentNode(element); // In JSDOM, if we're inside shadow DOM, then parentNode
- // can be null. We just simulate parent in this case.
-
- if (!parent || !parent.tagName) {
- parent = {
- namespaceURI: NAMESPACE,
- tagName: 'template'
- };
- }
-
- var tagName = stringToLowerCase(element.tagName);
- var parentTagName = stringToLowerCase(parent.tagName);
-
- if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
- return false;
- }
-
- if (element.namespaceURI === SVG_NAMESPACE) {
- // The only way to switch from HTML namespace to SVG
- // is via <svg>. If it happens via any other tag, then
- // it should be killed.
- if (parent.namespaceURI === HTML_NAMESPACE) {
- return tagName === 'svg';
- } // The only way to switch from MathML to SVG is via`
- // svg if parent is either <annotation-xml> or MathML
- // text integration points.
-
-
- if (parent.namespaceURI === MATHML_NAMESPACE) {
- return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
- } // We only allow elements that are defined in SVG
- // spec. All others are disallowed in SVG namespace.
-
-
- return Boolean(ALL_SVG_TAGS[tagName]);
- }
-
- if (element.namespaceURI === MATHML_NAMESPACE) {
- // The only way to switch from HTML namespace to MathML
- // is via <math>. If it happens via any other tag, then
- // it should be killed.
- if (parent.namespaceURI === HTML_NAMESPACE) {
- return tagName === 'math';
- } // The only way to switch from SVG to MathML is via
- // <math> and HTML integration points
-
-
- if (parent.namespaceURI === SVG_NAMESPACE) {
- return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
- } // We only allow elements that are defined in MathML
- // spec. All others are disallowed in MathML namespace.
-
-
- return Boolean(ALL_MATHML_TAGS[tagName]);
- }
-
- if (element.namespaceURI === HTML_NAMESPACE) {
- // The only way to switch from SVG to HTML is via
- // HTML integration points, and from MathML to HTML
- // is via MathML text integration points
- if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
- return false;
- }
-
- if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
- return false;
- } // We disallow tags that are specific for MathML
- // or SVG and should never appear in HTML namespace
-
-
- return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
- } // For XHTML and XML documents that support custom namespaces
-
-
- if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {
- return true;
- } // The code should never reach this place (this means
- // that the element somehow got namespace that is not
- // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).
- // Return false just in case.
-
-
- return false;
- };
- /**
- * _forceRemove
- *
- * @param {Node} node a DOM node
- */
-
- var _forceRemove = function _forceRemove(node) {
- arrayPush(DOMPurify.removed, {
- element: node
- });
-
- try {
- // eslint-disable-next-line unicorn/prefer-dom-node-remove
- node.parentNode.removeChild(node);
- } catch (_) {
- node.remove();
- }
- };
- /**
- * _removeAttribute
- *
- * @param {String} name an Attribute name
- * @param {Node} node a DOM node
- */
-
- var _removeAttribute = function _removeAttribute(name, node) {
- try {
- arrayPush(DOMPurify.removed, {
- attribute: node.getAttributeNode(name),
- from: node
- });
- } catch (_) {
- arrayPush(DOMPurify.removed, {
- attribute: null,
- from: node
- });
- }
-
- node.removeAttribute(name); // We void attribute values for unremovable "is"" attributes
-
- if (name === 'is' && !ALLOWED_ATTR[name]) {
- if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
- try {
- _forceRemove(node);
- } catch (_) {}
- } else {
- try {
- node.setAttribute(name, '');
- } catch (_) {}
- }
- }
- };
- /**
- * _initDocument
- *
- * @param {String} dirty a string of dirty markup
- * @return {Document} a DOM, filled with the dirty markup
- */
-
- var _initDocument = function _initDocument(dirty) {
- /* Create a HTML document */
- var doc = null;
- var leadingWhitespace = null;
-
- if (FORCE_BODY) {
- dirty = '<remove></remove>' + dirty;
- } else {
- /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
- var matches = stringMatch(dirty, /^[\r\n\t ]+/);
- leadingWhitespace = matches && matches[0];
- }
-
- if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {
- // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
- dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
- }
-
- var dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
- /*
- * Use the DOMParser API by default, fallback later if needs be
- * DOMParser not work for svg when has multiple root element.
- */
-
- if (NAMESPACE === HTML_NAMESPACE) {
- try {
- doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
- } catch (_) {}
- }
- /* Use createHTMLDocument in case DOMParser is not available */
-
- if (!doc || !doc.documentElement) {
- doc = implementation.createDocument(NAMESPACE, 'template', null);
-
- try {
- doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
- } catch (_) {// Syntax error if dirtyPayload is invalid xml
- }
- }
-
- var body = doc.body || doc.documentElement;
-
- if (dirty && leadingWhitespace) {
- body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
- }
- /* Work on whole document or just its body */
-
- if (NAMESPACE === HTML_NAMESPACE) {
- return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
- }
-
- return WHOLE_DOCUMENT ? doc.documentElement : body;
- };
- /**
- * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
- *
- * @param {Node} root The root element or node to start traversing on.
- * @return {NodeIterator} The created NodeIterator
- */
-
- var _createNodeIterator = function _createNodeIterator(root) {
- return createNodeIterator.call(root.ownerDocument || root, root, // eslint-disable-next-line no-bitwise
- NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null);
- };
- /**
- * _isClobbered
- *
- * @param {Node} elm element to check for clobbering attacks
- * @return {Boolean} true if clobbered, false if safe
- */
-
- var _isClobbered = function _isClobbered(elm) {
- return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function' || typeof elm.hasChildNodes !== 'function');
- };
- /**
- * Checks whether the given object is a DOM node.
- *
- * @param {Node} object object to check whether it's a DOM node
- * @return {Boolean} true is object is a DOM node
- */
-
- var _isNode = function _isNode(object) {
- return typeof Node === 'function' && object instanceof Node;
- };
- /**
- * _executeHook
- * Execute user configurable hooks
- *
- * @param {String} entryPoint Name of the hook's entry point
- * @param {Node} currentNode node to work on with the hook
- * @param {Object} data additional hook parameters
- */
-
- var _executeHook = function _executeHook(entryPoint, currentNode, data) {
- if (!hooks[entryPoint]) {
- return;
- }
-
- arrayForEach(hooks[entryPoint], function (hook) {
- hook.call(DOMPurify, currentNode, data, CONFIG);
- });
- };
- /**
- * _sanitizeElements
- *
- * @protect nodeName
- * @protect textContent
- * @protect removeChild
- *
- * @param {Node} currentNode to check for permission to exist
- * @return {Boolean} true if node was killed, false if left alive
- */
-
- var _sanitizeElements = function _sanitizeElements(currentNode) {
- var content = null;
- /* Execute a hook if present */
-
- _executeHook('beforeSanitizeElements', currentNode, null);
- /* Check if element is clobbered or can clobber */
-
- if (_isClobbered(currentNode)) {
- _forceRemove(currentNode);
-
- return true;
- }
- /* Now let's check the element's type and name */
-
- var tagName = transformCaseFunc(currentNode.nodeName);
- /* Execute a hook if present */
-
- _executeHook('uponSanitizeElement', currentNode, {
- tagName: tagName,
- allowedTags: ALLOWED_TAGS
- });
- /* Detect mXSS attempts abusing namespace confusion */
-
- if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
- _forceRemove(currentNode);
-
- return true;
- }
- /* Remove element if anything forbids its presence */
-
- if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
- /* Check if we have a custom element to handle */
- if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
- if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
- return false;
- }
-
- if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
- return false;
- }
- }
- /* Keep content except for bad-listed elements */
-
- if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
- var parentNode = getParentNode(currentNode) || currentNode.parentNode;
- var childNodes = getChildNodes(currentNode) || currentNode.childNodes;
-
- if (childNodes && parentNode) {
- var childCount = childNodes.length;
-
- for (var i = childCount - 1; i >= 0; --i) {
- parentNode.insertBefore(cloneNode(childNodes[i], true), getNextSibling(currentNode));
- }
- }
- }
-
- _forceRemove(currentNode);
-
- return true;
- }
- /* Check whether element has a valid namespace */
-
- if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
- _forceRemove(currentNode);
-
- return true;
- }
- /* Make sure that older browsers don't get fallback-tag mXSS */
-
- if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
- _forceRemove(currentNode);
-
- return true;
- }
- /* Sanitize element content to be template-safe */
-
- if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {
- /* Get the element's text content */
- content = currentNode.textContent;
- arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], function (expr) {
- content = stringReplace(content, expr, ' ');
- });
-
- if (currentNode.textContent !== content) {
- arrayPush(DOMPurify.removed, {
- element: currentNode.cloneNode()
- });
- currentNode.textContent = content;
- }
- }
- /* Execute a hook if present */
-
- _executeHook('afterSanitizeElements', currentNode, null);
-
- return false;
- };
- /**
- * _isValidAttribute
- *
- * @param {string} lcTag Lowercase tag name of containing element.
- * @param {string} lcName Lowercase attribute name.
- * @param {string} value Attribute value.
- * @return {Boolean} Returns true if `value` is valid, otherwise false.
- */
- // eslint-disable-next-line complexity
-
-
- var _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
- /* Make sure attribute cannot clobber */
- if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
- return false;
- }
- /* Allow valid data-* attributes: At least one character after "-"
- (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
- XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
- We don't need to check the value; it's always URI safe. */
-
- if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ;else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ;else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
- if ( // First condition does a very basic check if a) it's basically a valid custom element tagname AND
- // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
- // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
- _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) || // Alternative, second condition checks if it's an `is`-attribute, AND
- // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
- lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))) ;else {
- return false;
- }
- /* Check value is safe. First, is attr inert? If so, is safe */
- } else if (URI_SAFE_ATTRIBUTES[lcName]) ;else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, ''))) ;else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ;else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, ''))) ;else if (value) {
- return false;
- } else ;
-
- return true;
- };
- /**
- * _isBasicCustomElement
- * checks if at least one dash is included in tagName, and it's not the first char
- * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
- *
- * @param {string} tagName name of the tag of the node to sanitize
- * @returns {boolean} Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
- */
-
- var _isBasicCustomElement = function _isBasicCustomElement(tagName) {
- return tagName.indexOf('-') > 0;
- };
- /**
- * _sanitizeAttributes
- *
- * @protect attributes
- * @protect nodeName
- * @protect removeAttribute
- * @protect setAttribute
- *
- * @param {Node} currentNode to sanitize
- */
-
- var _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
- /* Execute a hook if present */
- _executeHook('beforeSanitizeAttributes', currentNode, null);
-
- var attributes = currentNode.attributes;
- /* Check if we have attributes; if not we might have a text node */
-
- if (!attributes) {
- return;
- }
-
- var hookEvent = {
- attrName: '',
- attrValue: '',
- keepAttr: true,
- allowedAttributes: ALLOWED_ATTR
- };
- var l = attributes.length;
- /* Go backwards over all attributes; safely remove bad ones */
-
- var _loop = function _loop() {
- var attr = attributes[l];
- var name = attr.name,
- namespaceURI = attr.namespaceURI,
- attrValue = attr.value;
-
- var lcName = transformCaseFunc(name);
- var value = name === 'value' ? attrValue : stringTrim(attrValue);
- /* Execute a hook if present */
-
- hookEvent.attrName = lcName;
- hookEvent.attrValue = value;
- hookEvent.keepAttr = true;
- hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set
-
- _executeHook('uponSanitizeAttribute', currentNode, hookEvent);
-
- value = hookEvent.attrValue;
- /* Did the hooks approve of the attribute? */
-
- if (hookEvent.forceKeepAttr) {
- return 'continue';
- }
- /* Remove attribute */
-
- _removeAttribute(name, currentNode);
- /* Did the hooks approve of the attribute? */
-
- if (!hookEvent.keepAttr) {
- return 'continue';
- }
- /* Work around a security issue in jQuery 3.0 */
-
- if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
- _removeAttribute(name, currentNode);
-
- return 'continue';
- }
- /* Sanitize attribute content to be template-safe */
-
- if (SAFE_FOR_TEMPLATES) {
- arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], function (expr) {
- value = stringReplace(value, expr, ' ');
- });
- }
- /* Is `value` valid for this attribute? */
-
- var lcTag = transformCaseFunc(currentNode.nodeName);
-
- if (!_isValidAttribute(lcTag, lcName, value)) {
- return 'continue';
- }
- /* Full DOM Clobbering protection via namespace isolation,
- * Prefix id and name attributes with `user-content-`
- */
-
- if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {
- // Remove the attribute with this value
- _removeAttribute(name, currentNode); // Prefix the value and later re-create the attribute with the sanitized value
-
-
- value = SANITIZE_NAMED_PROPS_PREFIX + value;
- }
- /* Handle attributes that require Trusted Types */
-
- if (trustedTypesPolicy && (typeof trustedTypes === 'undefined' ? 'undefined' : _typeof(trustedTypes)) === 'object' && typeof trustedTypes.getAttributeType === 'function') {
- if (namespaceURI) ;else {
- switch (trustedTypes.getAttributeType(lcTag, lcName)) {
- case 'TrustedHTML':
- {
- value = trustedTypesPolicy.createHTML(value);
- break;
- }
-
- case 'TrustedScriptURL':
- {
- value = trustedTypesPolicy.createScriptURL(value);
- break;
- }
- }
- }
- }
- /* Handle invalid data-* attribute set by try-catching it */
-
- try {
- if (namespaceURI) {
- currentNode.setAttributeNS(namespaceURI, name, value);
- } else {
- /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
- currentNode.setAttribute(name, value);
- }
-
- arrayPop(DOMPurify.removed);
- } catch (_) {}
- };
-
- while (l--) {
- var _ret = _loop();
-
- if (_ret === 'continue') continue;
- }
- /* Execute a hook if present */
-
- _executeHook('afterSanitizeAttributes', currentNode, null);
- };
- /**
- * _sanitizeShadowDOM
- *
- * @param {DocumentFragment} fragment to iterate over recursively
- */
-
- var _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
- var shadowNode = null;
-
- var shadowIterator = _createNodeIterator(fragment);
- /* Execute a hook if present */
-
- _executeHook('beforeSanitizeShadowDOM', fragment, null);
-
- while (shadowNode = shadowIterator.nextNode()) {
- /* Execute a hook if present */
- _executeHook('uponSanitizeShadowNode', shadowNode, null);
- /* Sanitize tags and elements */
-
- if (_sanitizeElements(shadowNode)) {
- continue;
- }
- /* Deep shadow DOM detected */
-
- if (shadowNode.content instanceof DocumentFragment) {
- _sanitizeShadowDOM(shadowNode.content);
- }
- /* Check attributes, sanitize if necessary */
-
- _sanitizeAttributes(shadowNode);
- }
- /* Execute a hook if present */
-
- _executeHook('afterSanitizeShadowDOM', fragment, null);
- };
- /**
- * Sanitize
- * Public method providing core sanitation functionality
- *
- * @param {String|Node} dirty string or DOM node
- * @param {Object} cfg object
- */
- // eslint-disable-next-line complexity
-
-
- DOMPurify.sanitize = function (dirty) {
- var cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var body = null;
- var importedNode = null;
- var currentNode = null;
- var returnNode = null;
- /* Make sure we have a string to sanitize.
- DO NOT return early, as this will return the wrong type if
- the user has requested a DOM object rather than a string */
-
- IS_EMPTY_INPUT = !dirty;
-
- if (IS_EMPTY_INPUT) {
- dirty = '<!-->';
- }
- /* Stringify, in case dirty is an object */
-
- if (typeof dirty !== 'string' && !_isNode(dirty)) {
- if (typeof dirty.toString === 'function') {
- dirty = dirty.toString();
-
- if (typeof dirty !== 'string') {
- throw typeErrorCreate('dirty is not a string, aborting');
- }
- } else {
- throw typeErrorCreate('toString is not a function');
- }
- }
- /* Return dirty HTML if DOMPurify cannot run */
-
- if (!DOMPurify.isSupported) {
- return dirty;
- }
- /* Assign config vars */
-
- if (!SET_CONFIG) {
- _parseConfig(cfg);
- }
- /* Clean up removed elements */
-
- DOMPurify.removed = [];
- /* Check if dirty is correctly typed for IN_PLACE */
-
- if (typeof dirty === 'string') {
- IN_PLACE = false;
- }
-
- if (IN_PLACE) {
- /* Do some early pre-sanitization to avoid unsafe root nodes */
- if (dirty.nodeName) {
- var tagName = transformCaseFunc(dirty.nodeName);
-
- if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
- throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
- }
- }
- } else if (dirty instanceof Node) {
- /* If dirty is a DOM element, append to an empty document to avoid
- elements being stripped by the parser */
- body = _initDocument('<!---->');
- importedNode = body.ownerDocument.importNode(dirty, true);
-
- if (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') {
- /* Node is already a body, use as is */
- body = importedNode;
- } else if (importedNode.nodeName === 'HTML') {
- body = importedNode;
- } else {
- // eslint-disable-next-line unicorn/prefer-dom-node-append
- body.appendChild(importedNode);
- }
- } else {
- /* Exit directly if we have nothing to do */
- if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes
- dirty.indexOf('<') === -1) {
- return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
- }
- /* Initialize the document to work on */
-
- body = _initDocument(dirty);
- /* Check we have a DOM node from the data */
-
- if (!body) {
- return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';
- }
- }
- /* Remove first element node (ours) if FORCE_BODY is set */
-
- if (body && FORCE_BODY) {
- _forceRemove(body.firstChild);
- }
- /* Get node iterator */
-
- var nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
- /* Now start iterating over the created document */
-
- while (currentNode = nodeIterator.nextNode()) {
- /* Sanitize tags and elements */
- if (_sanitizeElements(currentNode)) {
- continue;
- }
- /* Shadow DOM detected, sanitize it */
-
- if (currentNode.content instanceof DocumentFragment) {
- _sanitizeShadowDOM(currentNode.content);
- }
- /* Check attributes, sanitize if necessary */
-
- _sanitizeAttributes(currentNode);
- }
- /* If we sanitized `dirty` in-place, return it. */
-
- if (IN_PLACE) {
- return dirty;
- }
- /* Return sanitized string or DOM */
-
- if (RETURN_DOM) {
- if (RETURN_DOM_FRAGMENT) {
- returnNode = createDocumentFragment.call(body.ownerDocument);
-
- while (body.firstChild) {
- // eslint-disable-next-line unicorn/prefer-dom-node-append
- returnNode.appendChild(body.firstChild);
- }
- } else {
- returnNode = body;
- }
-
- if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
- /*
- AdoptNode() is not used because internal state is not reset
- (e.g. the past names map of a HTMLFormElement), this is safe
- in theory but we would rather not risk another attack vector.
- The state that is cloned by importNode() is explicitly defined
- by the specs.
- */
- returnNode = importNode.call(originalDocument, returnNode, true);
- }
-
- return returnNode;
- }
-
- var serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
- /* Serialize doctype if allowed */
-
- if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
- serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\n' + serializedHTML;
- }
- /* Sanitize final string template-safe */
-
- if (SAFE_FOR_TEMPLATES) {
- arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], function (expr) {
- serializedHTML = stringReplace(serializedHTML, expr, ' ');
- });
- }
-
- return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
- };
- /**
- * Public method to set the configuration once
- * setConfig
- *
- * @param {Object} cfg configuration object
- */
-
- DOMPurify.setConfig = function () {
- var cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
-
- _parseConfig(cfg);
-
- SET_CONFIG = true;
- };
- /**
- * Public method to remove the configuration
- * clearConfig
- *
- */
-
- DOMPurify.clearConfig = function () {
- CONFIG = null;
- SET_CONFIG = false;
- };
- /**
- * Public method to check if an attribute value is valid.
- * Uses last set config, if any. Otherwise, uses config defaults.
- * isValidAttribute
- *
- * @param {String} tag Tag name of containing element.
- * @param {String} attr Attribute name.
- * @param {String} value Attribute value.
- * @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.
- */
-
- DOMPurify.isValidAttribute = function (tag, attr, value) {
- /* Initialize shared config vars if necessary. */
- if (!CONFIG) {
- _parseConfig({});
- }
-
- var lcTag = transformCaseFunc(tag);
- var lcName = transformCaseFunc(attr);
- return _isValidAttribute(lcTag, lcName, value);
- };
- /**
- * AddHook
- * Public method to add DOMPurify hooks
- *
- * @param {String} entryPoint entry point for the hook to add
- * @param {Function} hookFunction function to execute
- */
-
- DOMPurify.addHook = function (entryPoint, hookFunction) {
- if (typeof hookFunction !== 'function') {
- return;
- }
-
- hooks[entryPoint] = hooks[entryPoint] || [];
- arrayPush(hooks[entryPoint], hookFunction);
- };
- /**
- * RemoveHook
- * Public method to remove a DOMPurify hook at a given entryPoint
- * (pops it from the stack of hooks if more are present)
- *
- * @param {String} entryPoint entry point for the hook to remove
- * @return {Function} removed(popped) hook
- */
-
- DOMPurify.removeHook = function (entryPoint) {
- if (hooks[entryPoint]) {
- return arrayPop(hooks[entryPoint]);
- }
- };
- /**
- * RemoveHooks
- * Public method to remove all DOMPurify hooks at a given entryPoint
- *
- * @param {String} entryPoint entry point for the hooks to remove
- */
-
- DOMPurify.removeHooks = function (entryPoint) {
- if (hooks[entryPoint]) {
- hooks[entryPoint] = [];
- }
- };
- /**
- * RemoveAllHooks
- * Public method to remove all DOMPurify hooks
- */
-
- DOMPurify.removeAllHooks = function () {
- hooks = {};
- };
-
- return DOMPurify;
- }
-
- var purify = createDOMPurify();
-
- return purify;
-});
-//# sourceMappingURL=purify.js.map
\ No newline at end of file
+})();
\ No newline at end of file
diff --git a/nv.d3.min.js b/nv.d3.min.js
index 1f23d22..d6b8815 100644
--- a/nv.d3.min.js
+++ b/nv.d3.min.js
@@ -1,7 +1,6 @@
-/*! nvd3 - v0.0.1 - 2023-08-16 */function _toConsumableArray(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}return Array.from(a)}!function(){function a(a,b){return new Date(b,a+1,0).getDate()}function b(a,b,c){return function(d,e,f){var g=a(d),h=[];if(d>g&&b(g),f>1)for(;e>g;){var i=new Date(+g);c(i)%f===0&&h.push(i),b(g)}else for(;e>g;)h.push(new Date(+g)),b(g);return h}}var c=window.nv||{};c.version="1.1.15b",c.dev=!0,window.nv=c,c.tooltip=c.tooltip||{},c.utils=c.utils||{},c.models=c.models||{},c.charts={},c.graphs=[],c.logs={},c.dispatch=d3.dispatch("render_start","render_end"),c.dev&&(c.dispatch.on("render_start",function(a){c.logs.startTime=+new Date}),c.dispatch.on("render_end",function(a){c.logs.endTime=+new Date,c.logs.totalTime=c.logs.endTime-c.logs.startTime,c.log("total",c.logs.totalTime)})),c.log=function(){if(c.dev&&console.log&&console.log.apply)console.log.apply(console,arguments);else if(c.dev&&"function"==typeof console.log&&Function.prototype.bind){var a=Function.prototype.bind.call(console.log,console);a.apply(console,arguments)}return arguments[arguments.length-1]},c.render=function(a){a=a||1,c.render.active=!0,c.dispatch.render_start(),setTimeout(function(){for(var b,d,e=0;a>e&&(d=c.render.queue[e]);e++)b=d.generate(),typeof d.callback==typeof Function&&d.callback(b),c.graphs.push(b);c.render.queue.splice(0,e),c.render.queue.length?setTimeout(arguments.callee,0):(c.dispatch.render_end(),c.render.active=!1)},0)},c.render.active=!1,c.render.queue=[],c.addGraph=function(a){typeof arguments[0]==typeof Function&&(a={generate:arguments[0],callback:arguments[1]}),c.render.queue.push(a),c.render.active||c.render()},c.identity=function(a){return a},c.strip=function(a){return a.replace(/(\s|&)/g,"")},d3.time.monthEnd=function(a){return new Date(a.getFullYear(),a.getMonth(),0)},d3.time.monthEnds=b(d3.time.monthEnd,function(b){b.setUTCDate(b.getUTCDate()+1),b.setDate(a(b.getMonth()+1,b.getFullYear()))},function(a){return a.getMonth()}),c.interactiveGuideline=function(){"use strict";function a(l){l.each(function(l){function m(){var c=d3.mouse(this),d=c[0],e=c[1],i=!0,j=!1;if(k&&(d=d3.event.offsetX,e=d3.event.offsetY,"svg"!==d3.event.target.tagName&&(i=!1),d3.event.target.className.baseVal.match("nv-legend")&&(j=!0)),i&&(d-=f.left,e-=f.top),0>d||0>e||d>o||e>p||d3.event.relatedTarget&&void 0===d3.event.relatedTarget.ownerSVGElement||j){if(k&&d3.event.relatedTarget&&void 0===d3.event.relatedTarget.ownerSVGElement&&d3.event.relatedTarget.className.match(b.nvPointerEventsClass))return;return h.elementMouseout({mouseX:d,mouseY:e}),void a.renderGuideLine(null)}var l=g.invert(d);h.elementMousemove({mouseX:d,mouseY:e,pointXValue:l}),"dblclick"===d3.event.type&&h.elementDblclick({mouseX:d,mouseY:e,pointXValue:l})}var n=d3.select(this),o=d||960,p=e||400,q=n.selectAll("g.nv-wrap.nv-interactiveLineLayer").data([l]),r=q.enter().append("g").attr("class"," nv-wrap nv-interactiveLineLayer");r.append("g").attr("class","nv-interactiveGuideLine"),j&&(j.on("mousemove",m,!0).on("mouseout",m,!0).on("dblclick",m),a.renderGuideLine=function(a){if(i){var b=q.select(".nv-interactiveGuideLine").selectAll("line").data(null!=a?[c.utils.NaNtoZero(a)]:[],String);b.enter().append("line").attr("class","nv-guideline").attr("x1",function(a){return a}).attr("x2",function(a){return a}).attr("y1",p).attr("y2",0),b.exit().remove()}})})}var b=c.models.tooltip(),d=null,e=null,f={left:0,top:0},g=d3.scale.linear(),h=(d3.scale.linear(),d3.dispatch("elementMousemove","elementMouseout","elementDblclick")),i=!0,j=null,k=-1!==navigator.userAgent.indexOf("MSIE");return a.dispatch=h,a.tooltip=b,a.margin=function(b){return arguments.length?(f.top="undefined"!=typeof b.top?b.top:f.top,f.left="undefined"!=typeof b.left?b.left:f.left,a):f},a.width=function(b){return arguments.length?(d=b,a):d},a.height=function(b){return arguments.length?(e=b,a):e},a.xScale=function(b){return arguments.length?(g=b,a):g},a.showGuideLine=function(b){return arguments.length?(i=b,a):i},a.svgContainer=function(b){return arguments.length?(j=b,a):j},a},c.interactiveBisect=function(a,b,c){"use strict";if(!a instanceof Array)return null;"function"!=typeof c&&(c=function(a,b){return a.x});var d=d3.bisector(c).left,e=d3.max([0,d(a,b)-1]),f=c(a[e],e);if("undefined"==typeof f&&(f=e),f===b)return e;var g=d3.min([e+1,a.length-1]),h=c(a[g],g);return"undefined"==typeof h&&(h=g),Math.abs(h-b)>=Math.abs(f-b)?e:g},c.nearestValueIndex=function(a,b,c){"use strict";var d=1/0,e=null;return a.forEach(function(a,f){var g=Math.abs(b-a);d>=g&&c>g&&(d=g,e=f)}),e},function(){"use strict";window.nv.tooltip={},window.nv.models.tooltip=function(){function a(){if(l){var a=d3.select(l);"svg"!==a.node().tagName&&(a=a.select("svg"));var b=a.node()?a.attr("viewBox"):null;if(b){b=b.split(" ");var c=parseInt(a.style("width"))/b[2];n.left=n.left*c,n.top=n.top*c}}}function b(a){var b;b=l?d3.select(l):d3.select("body");var c=b.select(".nvtooltip");return null===c.node()&&(c=b.append("div").attr("class","nvtooltip "+(k?k:"xy-tooltip")).attr("id",p)),c.node().innerHTML=a,c.style("top",0).style("left",0).style("opacity",0),c.selectAll("div, table, td, tr").classed(q,!0),c.classed(q,!0),c.node()}function d(){if(o&&u(f)){a();var e=n.left,k=null!=j?j:n.top,p=b(t(f));if(m=p,l){var q=l.getElementsByTagName("svg")[0],r=(q?q.getBoundingClientRect():l.getBoundingClientRect(),{left:0,top:0});if(q){var s=q.getBoundingClientRect(),v=l.getBoundingClientRect(),w=s.top;if(0>w){var x=l.getBoundingClientRect();w=Math.abs(w)>x.height?0:w}r.top=Math.abs(w-v.top),r.left=Math.abs(s.left-v.left)}e+=l.offsetLeft+r.left-2*l.scrollLeft,k+=l.offsetTop+r.top-2*l.scrollTop}return i&&i>0&&(k=Math.floor(k/i)*i),c.tooltip.calcTooltipPosition([e,k],g,h,p),d}}var e=null,f=null,g="w",h=50,i=25,j=null,k=null,l=null,m=null,n={left:null,top:null},o=!0,p="nvtooltip-"+Math.floor(1e5*Math.random()),q="nv-pointer-events-none",r=function(a,b){return a},s=function(a){return a},t=function(a){if(null!=e)return e;if(null==a)return"";var b=d3.select(document.createElement("table")),c=b.selectAll("thead").data([a]).enter().append("thead");c.append("tr").append("td").attr("colspan",3).append("strong").classed("x-value",!0).html(s(a.value));var d=b.selectAll("tbody").data([a]).enter().append("tbody"),f=d.selectAll("tr").data(function(a){return a.series}).enter().append("tr").classed("highlight",function(a){return a.highlight});f.append("td").classed("legend-color-guide",!0).append("div").style("background-color",function(a){return a.color}),f.append("td").classed("key",!0).html(function(a){return a.key}),f.append("td").classed("value",!0).html(function(a,b){return r(a.value,b)}),f.selectAll("td").each(function(a){if(a.highlight){var b=d3.scale.linear().domain([0,1]).range(["#fff",a.color]),c=.6;d3.select(this).style("border-bottom-color",b(c)).style("border-top-color",b(c))}});var g=b.node().outerHTML;return void 0!==a.footer&&(g+="<div class='footer'>"+a.footer+"</div>"),g},u=function(a){return a&&a.series&&a.series.length>0?!0:!1};return d.nvPointerEventsClass=q,d.content=function(a){return arguments.length?(e=a,d):e},d.tooltipElem=function(){return m},d.contentGenerator=function(a){return arguments.length?("function"==typeof a&&(t=a),d):t},d.data=function(a){return arguments.length?(f=a,d):f},d.gravity=function(a){return arguments.length?(g=a,d):g},d.distance=function(a){return arguments.length?(h=a,d):h},d.snapDistance=function(a){return arguments.length?(i=a,d):i},d.classes=function(a){return arguments.length?(k=a,d):k},d.chartContainer=function(a){return arguments.length?(l=a,d):l},d.position=function(a){return arguments.length?(n.left="undefined"!=typeof a.left?a.left:n.left,n.top="undefined"!=typeof a.top?a.top:n.top,d):n},d.fixedTop=function(a){return arguments.length?(j=a,d):j},d.enabled=function(a){return arguments.length?(o=a,d):o},d.valueFormatter=function(a){return arguments.length?("function"==typeof a&&(r=a),d):r},d.headerFormatter=function(a){return arguments.length?("function"==typeof a&&(s=a),d):s},d.id=function(){return p},d},c.tooltip.show=function(a,b,d,e,f,g){var h=document.createElement("div");h.className="nvtooltip "+(g?g:"xy-tooltip");var i=f;(!f||f.tagName.match(/g|svg/i))&&(i=document.getElementsByTagName("body")[0]),h.style.left=0,h.style.top=0,h.style.opacity=0;var j=DOMPurify.sanitize(b,{RETURN_TRUSTED_TYPE:!0});h.innerHTML=j,i.appendChild(h),f&&(a[0]=a[0]-f.scrollLeft,a[1]=a[1]-f.scrollTop),c.tooltip.calcTooltipPosition(a,d,e,h)},c.tooltip.findFirstNonSVGParent=function(a){for(;null!==a.tagName.match(/^g|svg$/i);)a=a.parentNode;return a},c.tooltip.findTotalOffsetTop=function(a,b){var c=b;do isNaN(a.offsetTop)||(c+=a.offsetTop);while(a=a.offsetParent);return c},c.tooltip.findTotalOffsetLeft=function(a,b){var c=b;do isNaN(a.offsetLeft)||(c+=a.offsetLeft);while(a=a.offsetParent);return c},c.tooltip.calcTooltipPosition=function(a,b,d,e){var f,g,h=parseInt(e.offsetHeight),i=parseInt(e.offsetWidth),j=c.utils.windowSize().width,k=c.utils.windowSize().height,l=window.pageYOffset,m=window.pageXOffset;k=window.innerWidth>=document.body.scrollWidth?k:k-16,j=window.innerHeight>=document.body.scrollHeight?j:j-16,b=b||"s",d=d||20;var n=function(a){return c.tooltip.findTotalOffsetTop(a,g)},o=function(a){return c.tooltip.findTotalOffsetLeft(a,f)};switch(b){case"e":f=a[0]-i-d,g=a[1]-h/2;var p=o(e),q=n(e);m>p&&(f=a[0]+d>m?a[0]+d:m-p+f),l>q&&(g=l-q+g),q+h>l+k&&(g=l+k-q+g-h);break;case"w":f=a[0]+d,g=a[1]-h/2;var p=o(e),q=n(e);p+i>j&&(f=a[0]-i-d),l>q&&(g=l+5),q+h>l+k&&(g=l+k-q+g-h);break;case"n":f=a[0]-i/2-5,g=a[1]+d;var p=o(e),q=n(e);m>p&&(f=m+5),p+i>j&&(f=f-i/2+5),q+h>l+k&&(g=l+k-q+g-h);break;case"s":f=a[0]-i/2,g=a[1]-h-d;var p=o(e),q=n(e);m>p&&(f=m+5),p+i>j&&(f=f-i/2+5),l>q&&(g=l);break;case"none":f=a[0],g=a[1]-d;var p=o(e),q=n(e)}return e.style.left=f+"px",e.style.top=g+"px",e.style.opacity=1,e.style.position="absolute",e},c.tooltip.cleanup=function(){for(var a=document.getElementsByClassName("nvtooltip"),b=[];a.length;)b.push(a[0]),a[0].style.transitionDelay="0 !important",a[0].style.opacity=0,a[0].className="nvtooltip-pending-removal";setTimeout(function(){for(;b.length;){var a=b.pop();a.parentNode.removeChild(a)}},500)}}(),c.utils.windowSize=function(){var a={width:640,height:480};return document.body&&document.body.offsetWidth&&(a.width=document.body.offsetWidth,a.height=document.body.offsetHeight),"CSS1Compat"==document.compatMode&&document.documentElement&&document.documentElement.offsetWidth&&(a.width=document.documentElement.offsetWidth,a.height=document.documentElement.offsetHeight),window.innerWidth&&window.innerHeight&&(a.width=window.innerWidth,a.height=window.innerHeight),a},c.utils.windowResize=function(a){if(void 0!==a){var b=window.onresize;window.onresize=function(c){"function"==typeof b&&b(c),a(c)}}},c.utils.getColor=function(a){return arguments.length?"[object Array]"===Object.prototype.toString.call(a)?function(b,c){return b.color||a[c%a.length]}:a:c.utils.defaultColor()},c.utils.defaultColor=function(){var a=d3.scale.category20().range();return function(b,c){return b.color||a[c%a.length]}},c.utils.customTheme=function(a,b,c){b=b||function(a){return a.key},c=c||d3.scale.category20().range();var d=c.length;return function(e,f){var g=b(e);return d||(d=c.length),"undefined"!=typeof a[g]?"function"==typeof a[g]?a[g]():a[g]:c[--d]}},c.utils.pjax=function(a,b){function d(d){d3.html(d,function(d){var e=d3.select(b).node();e.parentNode.replaceChild(d3.select(d).select(b).node(),e),c.utils.pjax(a,b)})}d3.selectAll(a).on("click",function(){history.pushState(this.href,this.textContent,this.href),d(this.href),d3.event.preventDefault()}),d3.select(window).on("popstate",function(){d3.event.state&&d(d3.event.state)})},c.utils.calcApproxTextWidth=function(a){if("function"==typeof a.style&&"function"==typeof a.text){var b=parseInt(a.style("font-size").replace("px","")),c=a.text().length;return c*b*.5}return 0},c.utils.NaNtoZero=function(a){return"number"!=typeof a||isNaN(a)||null===a||a===1/0?0:a},c.utils.optionsFunc=function(a){return a&&d3.map(a).forEach(function(a,b){"function"==typeof this[a]&&this[a](b)}.bind(this)),this},c.models.axis=function(){"use strict";function a(c){return c.each(function(a){var c=d3.select(this),f=c.selectAll("g.nv-wrap.nv-axis").data([a]),r=f.enter().append("g").attr("class","nvd3 nv-wrap nv-axis"),s=(r.append("g"),f.select("g"));null!==o?b.ticks(o):("top"==b.orient()||"bottom"==b.orient())&&b.ticks(Math.abs(g.range()[1]-g.range()[0])/100),s.transition().call(b),q=q||b.scale();var t=b.tickFormat();null==t&&(t=q.tickFormat());var u=s.selectAll("text.nv-axislabel").data([h||null]);switch(u.exit().remove(),b.orient()){case"top":u.enter().append("text").attr("class","nv-axislabel");var v=2==g.range().length?g.range()[1]:g.range()[g.range().length-1]+(g.range()[1]-g.range()[0]);if(u.attr("text-anchor","middle").attr("y",0).attr("x",v/2),i){var w=f.selectAll("g.nv-axisMaxMin").data(g.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text"),w.exit().remove(),w.attr("transform",function(a,b){return"translate("+g(a)+",0)"}).select("text").attr("dy","-0.5em").attr("y",-b.tickPadding()).attr("text-anchor","middle").text(function(a,b){var c=t(a);return(""+c).match("NaN")?"":c}),w.transition().attr("transform",function(a,b){return"translate("+g.range()[b]+",0)"})}break;case"bottom":var x=36,y=30,z=s.selectAll("g").select("text");if(k%360){z.each(function(a,b){var c=this.getBBox().width;c>y&&(y=c)});var A=Math.abs(Math.sin(k*Math.PI/180)),x=(A?A*y:y)+30;z.attr("transform",function(a,b,c){return"rotate("+k+" 0,0)"}).style("text-anchor",k%360>0?"start":"end")}u.enter().append("text").attr("class","nv-axislabel");var v=2==g.range().length?g.range()[1]:g.range()[g.range().length-1]+(g.range()[1]-g.range()[0]);if(u.attr("text-anchor","middle").attr("y",x).attr("x",v/2),i){var w=f.selectAll("g.nv-axisMaxMin").data([g.domain()[0],g.domain()[g.domain().length-1]]);w.enter().append("g").attr("class","nv-axisMaxMin").append("text"),w.exit().remove(),w.attr("transform",function(a,b){return"translate("+(g(a)+(n?g.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",b.tickPadding()).attr("transform",function(a,b,c){return"rotate("+k+" 0,0)"}).style("text-anchor",k?k%360>0?"start":"end":"middle").text(function(a,b){var c=t(a);return(""+c).match("NaN")?"":c}),w.transition().attr("transform",function(a,b){return"translate("+(g(a)+(n?g.rangeBand()/2:0))+",0)"})}m&&z.attr("transform",function(a,b){return"translate(0,"+(b%2==0?"0":"12")+")"});break;case"right":if(u.enter().append("text").attr("class","nv-axislabel"),u.style("text-anchor",l?"middle":"begin").attr("transform",l?"rotate(90)":"").attr("y",l?-Math.max(d.right,e)+12:-10).attr("x",l?g.range()[0]/2:b.tickPadding()),i){var w=f.selectAll("g.nv-axisMaxMin").data(g.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),w.exit().remove(),w.attr("transform",function(a,b){return"translate(0,"+g(a)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",b.tickPadding()).style("text-anchor","start").text(function(a,b){var c=t(a);return(""+c).match("NaN")?"":c}),w.transition().attr("transform",function(a,b){return"translate(0,"+g.range()[b]+")"}).select("text").style("opacity",1)}break;case"left":if(u.enter().append("text").attr("class","nv-axislabel"),u.style("text-anchor",l?"middle":"end").attr("transform",l?"rotate(-90)":"").attr("y",l?-Math.max(d.left,e)+p:-10).attr("x",l?-g.range()[0]/2:-b.tickPadding()),i){var w=f.selectAll("g.nv-axisMaxMin").data(g.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),w.exit().remove(),w.attr("transform",function(a,b){return"translate(0,"+q(a)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-b.tickPadding()).attr("text-anchor","end").text(function(a,b){var c=t(a);return(""+c).match("NaN")?"":c}),w.transition().attr("transform",function(a,b){return"translate(0,"+g.range()[b]+")"}).select("text").style("opacity",1)}}if(u.text(function(a){return a}),!i||"left"!==b.orient()&&"right"!==b.orient()||(s.selectAll("g").each(function(a,b){d3.select(this).select("text").attr("opacity",1),(g(a)<g.range()[1]+10||g(a)>g.range()[0]-10)&&((a>1e-10||-1e-10>a)&&d3.select(this).attr("opacity",0),d3.select(this).select("text").attr("opacity",0))}),g.domain()[0]==g.domain()[1]&&0==g.domain()[0]&&f.selectAll("g.nv-axisMaxMin").style("opacity",function(a,b){return b?0:1})),i&&("top"===b.orient()||"bottom"===b.orient())){var B=[];f.selectAll("g.nv-axisMaxMin").each(function(a,b){try{b?B.push(g(a)-this.getBBox().width-4):B.push(g(a)+this.getBBox().width+4)}catch(c){b?B.push(g(a)-4):B.push(g(a)+4)}}),s.selectAll("g").each(function(a,b){(g(a)<B[0]||g(a)>B[1])&&(a>1e-10||-1e-10>a?d3.select(this).remove():d3.select(this).select("text").remove())})}j&&s.selectAll(".tick").filter(function(a){return!parseFloat(Math.round(1e5*a.__data__)/1e6)&&void 0!==a.__data__}).classed("zero",!0),q=g.copy()}),a}var b=d3.svg.axis(),d={top:0,right:0,bottom:0,left:0},e=75,f=60,g=d3.scale.linear(),h=null,i=!0,j=!0,k=0,l=!0,m=!1,n=!1,o=null,p=12;b.scale(g).orient("bottom").tickFormat(function(a){return a});var q;return a.axis=b,d3.rebind(a,b,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat"),d3.rebind(a,g,"domain","range","rangeBand","rangeBands"),a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(d.top="undefined"!=typeof b.top?b.top:d.top,d.right="undefined"!=typeof b.right?b.right:d.right,d.bottom="undefined"!=typeof b.bottom?b.bottom:d.bottom,d.left="undefined"!=typeof b.left?b.left:d.left,a):d},a.width=function(b){return arguments.length?(e=b,a):e},a.ticks=function(b){return arguments.length?(o=b,a):o},a.height=function(b){return arguments.length?(f=b,a):f},a.axisLabel=function(b){return arguments.length?(h=b,a):h},a.showMaxMin=function(b){return arguments.length?(i=b,a):i},a.highlightZero=function(b){return arguments.length?(j=b,a):j},a.scale=function(c){return arguments.length?(g=c,b.scale(g),n="function"==typeof g.rangeBands,d3.rebind(a,g,"domain","range","rangeBand","rangeBands"),a):g},a.rotateYLabel=function(b){return arguments.length?(l=b,a):l},a.rotateLabels=function(b){return arguments.length?(k=b,a):k},a.staggerLabels=function(b){return arguments.length?(m=b,a):m},a.axisLabelDistance=function(b){return arguments.length?(p=b,a):p},a},c.models.historicalBar=function(){"use strict";function a(v){return v.each(function(a){var v=h-g.left-g.right,w=i-g.top-g.bottom,x=d3.select(this);k.domain(b||d3.extent(a[0].values.map(m).concat(o))),q?k.range(e||[.5*v/a[0].values.length,v*(a[0].values.length-.5)/a[0].values.length]):k.range(e||[0,v]),l.domain(d||d3.extent(a[0].values.map(n).concat(p))).range(f||[w,0]),k.domain()[0]===k.domain()[1]&&(k.domain()[0]?k.domain([k.domain()[0]-.01*k.domain()[0],k.domain()[1]+.01*k.domain()[1]]):k.domain([-1,1])),l.domain()[0]===l.domain()[1]&&(l.domain()[0]?l.domain([l.domain()[0]+.01*l.domain()[0],l.domain()[1]-.01*l.domain()[1]]):l.domain([-1,1]));var y=x.selectAll("g.nv-wrap.nv-historicalBar-"+j).data([a[0].values]),z=y.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBar-"+j),A=z.append("defs"),B=z.append("g"),C=y.select("g");B.append("g").attr("class","nv-bars"),y.attr("transform","translate("+g.left+","+g.top+")"),x.on("click",function(a,b){t.chartClick({data:a,index:b,pos:d3.event,id:j})}),A.append("clipPath").attr("id","nv-chart-clip-path-"+j).append("rect"),y.select("#nv-chart-clip-path-"+j+" rect").attr("width",v).attr("height",w),C.attr("clip-path",r?"url(#nv-chart-clip-path-"+j+")":"");var D=y.select(".nv-bars").selectAll(".nv-bar").data(function(a){return a},function(a,b){return m(a,b)});D.exit().remove();D.enter().append("rect").attr("x",0).attr("y",function(a,b){return c.utils.NaNtoZero(l(Math.max(0,n(a,b))))}).attr("height",function(a,b){return c.utils.NaNtoZero(Math.abs(l(n(a,b))-l(0)))}).attr("transform",function(b,c){return"translate("+(k(m(b,c))-v/a[0].values.length*.45)+",0)"}).on("mouseover",function(b,c){u&&(d3.select(this).classed("hover",!0),t.elementMouseover({point:b,series:a[0],pos:[k(m(b,c)),l(n(b,c))],pointIndex:c,seriesIndex:0,e:d3.event}))}).on("mouseout",function(b,c){u&&(d3.select(this).classed("hover",!1),t.elementMouseout({point:b,series:a[0],pointIndex:c,seriesIndex:0,e:d3.event}))}).on("click",function(a,b){u&&(t.elementClick({value:n(a,b),data:a,index:b,pos:[k(m(a,b)),l(n(a,b))],e:d3.event,id:j}),d3.event.stopPropagation())}).on("dblclick",function(a,b){u&&(t.elementDblClick({value:n(a,b),data:a,index:b,pos:[k(m(a,b)),l(n(a,b))],e:d3.event,id:j}),d3.event.stopPropagation())});D.attr("fill",function(a,b){return s(a,b)}).attr("class",function(a,b,c){return(n(a,b)<0?"nv-bar negative":"nv-bar positive")+" nv-bar-"+c+"-"+b}).transition().attr("transform",function(b,c){return"translate("+(k(m(b,c))-v/a[0].values.length*.45)+",0)"}).attr("width",v/a[0].values.length*.9),D.transition().attr("y",function(a,b){var d=n(a,b)<0?l(0):l(0)-l(n(a,b))<1?l(0)-1:l(n(a,b));return c.utils.NaNtoZero(d)}).attr("height",function(a,b){return c.utils.NaNtoZero(Math.max(Math.abs(l(n(a,b))-l(0)),1))})}),a}var b,d,e,f,g={top:0,right:0,bottom:0,left:0},h=960,i=500,j=Math.floor(1e4*Math.random()),k=d3.scale.linear(),l=d3.scale.linear(),m=function(a){return a.x},n=function(a){return a.y},o=[],p=[0],q=!1,r=!0,s=c.utils.defaultColor(),t=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),u=!0;return a.highlightPoint=function(a,b){d3.select(".nv-historicalBar-"+j).select(".nv-bars .nv-bar-0-"+a).classed("hover",b)},a.clearHighlights=function(){d3.select(".nv-historicalBar-"+j).select(".nv-bars .nv-bar.hover").classed("hover",!1)},a.dispatch=t,a.options=c.utils.optionsFunc.bind(a),a.x=function(b){return arguments.length?(m=b,a):m},a.y=function(b){return arguments.length?(n=b,a):n},a.margin=function(b){return arguments.length?(g.top="undefined"!=typeof b.top?b.top:g.top,g.right="undefined"!=typeof b.right?b.right:g.right,g.bottom="undefined"!=typeof b.bottom?b.bottom:g.bottom,g.left="undefined"!=typeof b.left?b.left:g.left,a):g},a.width=function(b){return arguments.length?(h=b,a):h},a.height=function(b){return arguments.length?(i=b,a):i},a.xScale=function(b){return arguments.length?(k=b,a):k},a.yScale=function(b){return arguments.length?(l=b,a):l},a.xDomain=function(c){return arguments.length?(b=c,a):b},a.yDomain=function(b){return arguments.length?(d=b,a):d},a.xRange=function(b){return arguments.length?(e=b,a):e},a.yRange=function(b){return arguments.length?(f=b,a):f},a.forceX=function(b){return arguments.length?(o=b,a):o},a.forceY=function(b){return arguments.length?(p=b,a):p},a.padData=function(b){return arguments.length?(q=b,a):q},a.clipEdge=function(b){return arguments.length?(r=b,a):r},a.color=function(b){return arguments.length?(s=c.utils.getColor(b),a):s},a.id=function(b){return arguments.length?(j=b,a):j},a.interactive=function(b){return arguments.length?(u=!1,a):u},a},c.models.bullet=function(){"use strict";function a(c){return c.each(function(a,c){var d=m-b.left-b.right,o=n-b.top-b.bottom,r=d3.select(this),s=f.call(this,a,c).slice().sort(d3.descending),t=g.call(this,a,c).slice().sort(d3.descending),u=h.call(this,a,c).slice().sort(d3.descending),v=i.call(this,a,c).slice(),w=j.call(this,a,c).slice(),x=k.call(this,a,c).slice(),y=d3.scale.linear().domain(d3.extent(d3.merge([l,s]))).range(e?[d,0]:[0,d]);this.__chart__||d3.scale.linear().domain([0,1/0]).range(y.range());this.__chart__=y;var z=d3.min(s),A=d3.max(s),B=s[1],C=r.selectAll("g.nv-wrap.nv-bullet").data([a]),D=C.enter().append("g").attr("class","nvd3 nv-wrap nv-bullet"),E=D.append("g"),F=C.select("g");E.append("rect").attr("class","nv-range nv-rangeMax"),E.append("rect").attr("class","nv-range nv-rangeAvg"),E.append("rect").attr("class","nv-range nv-rangeMin"),E.append("rect").attr("class","nv-measure"),E.append("path").attr("class","nv-markerTriangle"),C.attr("transform","translate("+b.left+","+b.top+")");var G=function(a){return Math.abs(y(a)-y(0))},H=function(a){return y(0>a?a:0)};F.select("rect.nv-rangeMax").attr("height",o).attr("width",G(A>0?A:z)).attr("x",H(A>0?A:z)).datum(A>0?A:z),F.select("rect.nv-rangeAvg").attr("height",o).attr("width",G(B)).attr("x",H(B)).datum(B),F.select("rect.nv-rangeMin").attr("height",o).attr("width",G(A)).attr("x",H(A)).attr("width",G(A>0?z:A)).attr("x",H(A>0?z:A)).datum(A>0?z:A),F.select("rect.nv-measure").style("fill",p).attr("height",o/3).attr("y",o/3).attr("width",0>u?y(0)-y(u[0]):y(u[0])-y(0)).attr("x",H(u)).on("mouseover",function(){q.elementMouseover({value:u[0],label:x[0]||"Current",pos:[y(u[0]),o/2]})}).on("mouseout",function(){q.elementMouseout({value:u[0],label:x[0]||"Current"})});var I=o/6;t[0]?F.selectAll("path.nv-markerTriangle").attr("transform",function(a){return"translate("+y(t[0])+","+o/2+")"}).attr("d","M0,"+I+"L"+I+","+-I+" "+-I+","+-I+"Z").on("mouseover",function(){q.elementMouseover({value:t[0],label:w[0]||"Previous",pos:[y(t[0]),o/2]})}).on("mouseout",function(){q.elementMouseout({value:t[0],label:w[0]||"Previous"})}):F.selectAll("path.nv-markerTriangle").remove(),C.selectAll(".nv-range").on("mouseover",function(a,b){var c=v[b]||(b?1==b?"Mean":"Minimum":"Maximum");q.elementMouseover({value:a,label:c,pos:[y(a),o/2]})}).on("mouseout",function(a,b){var c=v[b]||(b?1==b?"Mean":"Minimum":"Maximum");q.elementMouseout({value:a,label:c})})}),a}var b={top:0,right:0,bottom:0,left:0},d="left",e=!1,f=function(a){return a.ranges},g=function(a){return a.markers},h=function(a){return a.measures},i=function(a){return a.rangeLabels?a.rangeLabels:[]},j=function(a){return a.markerLabels?a.markerLabels:[]},k=function(a){return a.measureLabels?a.measureLabels:[]},l=[0],m=380,n=30,o=null,p=c.utils.getColor(["#1f77b4"]),q=d3.dispatch("elementMouseover","elementMouseout");return a.dispatch=q,a.options=c.utils.optionsFunc.bind(a),a.orient=function(b){return arguments.length?(d=b,e="right"==d||"bottom"==d,a):d},a.ranges=function(b){return arguments.length?(f=b,a):f},a.markers=function(b){return arguments.length?(g=b,a):g},a.measures=function(b){return arguments.length?(h=b,a):h},a.forceX=function(b){return arguments.length?(l=b,a):l},a.width=function(b){return arguments.length?(m=b,a):m},a.height=function(b){return arguments.length?(n=b,a):n},a.margin=function(c){return arguments.length?(b.top="undefined"!=typeof c.top?c.top:b.top,b.right="undefined"!=typeof c.right?c.right:b.right,b.bottom="undefined"!=typeof c.bottom?c.bottom:b.bottom,b.left="undefined"!=typeof c.left?c.left:b.left,a):b},a.tickFormat=function(b){return arguments.length?(o=b,a):o},a.color=function(b){return arguments.length?(p=c.utils.getColor(b),a):p},a},c.models.bulletChart=function(){"use strict";function a(c){return c.each(function(d,n){var r=d3.select(this),s=(j||parseInt(r.style("width"))||960)-f.left-f.right,t=k-f.top-f.bottom,u=this;if(a.update=function(){a(c)},a.container=this,!d||!g.call(this,d,n)){var v=r.selectAll(".nv-noData").data([o]);return v.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),v.attr("x",f.left+s/2).attr("y",18+f.top+t/2).text(function(a){return a}),a}r.selectAll(".nv-noData").remove();var w=g.call(this,d,n).slice().sort(d3.descending),x=h.call(this,d,n).slice().sort(d3.descending),y=i.call(this,d,n).slice().sort(d3.descending),z=r.selectAll("g.nv-wrap.nv-bulletChart").data([d]),A=z.enter().append("g").attr("class","nvd3 nv-wrap nv-bulletChart"),B=A.append("g"),C=z.select("g");B.append("g").attr("class","nv-bulletWrap"),B.append("g").attr("class","nv-titles"),z.attr("transform","translate("+f.left+","+f.top+")");var D=d3.scale.linear().domain([0,Math.max(w[0],x[0],y[0])]).range(e?[s,0]:[0,s]),E=this.__chart__||d3.scale.linear().domain([0,1/0]).range(D.range());this.__chart__=D;var F=B.select(".nv-titles").append("g").attr("text-anchor","end").attr("transform","translate(-6,"+(k-f.top-f.bottom)/2+")");F.append("text").attr("class","nv-title").text(function(a){return a.title}),F.append("text").attr("class","nv-subtitle").attr("dy","1em").text(function(a){return a.subtitle}),b.width(s).height(t);var G=C.select(".nv-bulletWrap");d3.transition(G).call(b);var H=l||D.tickFormat(s/100),I=C.selectAll("g.nv-tick").data(D.ticks(s/50),function(a){return this.textContent||H(a)}),J=I.enter().append("g").attr("class","nv-tick").attr("transform",function(a){return"translate("+E(a)+",0)"}).style("opacity",1e-6);J.append("line").attr("y1",t).attr("y2",7*t/6),J.append("text").attr("text-anchor","middle").attr("dy","1em").attr("y",7*t/6).text(H);var K=d3.transition(I).attr("transform",function(a){return"translate("+D(a)+",0)"}).style("opacity",1);K.select("line").attr("y1",t).attr("y2",7*t/6),K.select("text").attr("y",7*t/6),d3.transition(I.exit()).attr("transform",function(a){return"translate("+D(a)+",0)"}).style("opacity",1e-6).remove(),p.on("tooltipShow",function(a){a.key=d.title,m&&q(a,u.parentNode)})}),d3.timer.flush(),a}var b=c.models.bullet(),d="left",e=!1,f={top:5,right:40,bottom:20,left:120},g=function(a){return a.ranges},h=function(a){return a.markers},i=function(a){return a.measures},j=null,k=55,l=null,m=!0,n=function(a,b,c,d,e){return"<h3>"+b+"</h3><p>"+c+"</p>"},o="No Data Available.",p=d3.dispatch("tooltipShow","tooltipHide"),q=function(b,d){var e=b.pos[0]+(d.offsetLeft||0)+f.left,g=b.pos[1]+(d.offsetTop||0)+f.top,h=n(b.key,b.label,b.value,b,a);c.tooltip.show([e,g],h,b.value<0?"e":"w",null,d)};return b.dispatch.on("elementMouseover.tooltip",function(a){p.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){p.tooltipHide(a)}),p.on("tooltipHide",function(){m&&c.tooltip.cleanup()}),a.dispatch=p,a.bullet=b,d3.rebind(a,b,"color"),a.options=c.utils.optionsFunc.bind(a),a.orient=function(b){return arguments.length?(d=b,e="right"==d||"bottom"==d,a):d},a.ranges=function(b){return arguments.length?(g=b,a):g},a.markers=function(b){return arguments.length?(h=b,a):h},a.measures=function(b){return arguments.length?(i=b,a):i},a.width=function(b){return arguments.length?(j=b,a):j},a.height=function(b){return arguments.length?(k=b,a):k},a.margin=function(b){return arguments.length?(f.top="undefined"!=typeof b.top?b.top:f.top,f.right="undefined"!=typeof b.right?b.right:f.right,f.bottom="undefined"!=typeof b.bottom?b.bottom:f.bottom,f.left="undefined"!=typeof b.left?b.left:f.left,a):f},a.tickFormat=function(b){return arguments.length?(l=b,a):l},a.tooltips=function(b){return arguments.length?(m=b,a):m},a.tooltipContent=function(b){return arguments.length?(n=b,a):n},a.noData=function(b){return arguments.length?(o=b,a):o},a},c.models.cumulativeLineChart=function(){"use strict";function a(x){return x.each(function(x){function I(b,c){d3.select(a.container).style("cursor","ew-resize")}function J(a,b){G.x=d3.event.x,G.i=Math.round(F.invert(G.x)),L()}function K(b,c){d3.select(a.container).style("cursor","auto"),z.index=G.i,D.stateChange(z)}function L(){da.data([G]);var b=a.transitionDuration();a.transitionDuration(0),a.update(),a.transitionDuration(b)}var M=d3.select(this).classed("nv-chart-"+y,!0),N=this,O=(n||parseInt(M.style("width"))||960)-l.left-l.right,P=(o||parseInt(M.style("height"))||400)-l.top-l.bottom;if(a.update=function(){M.transition().duration(E).call(a)},a.container=this,z.disabled=x.map(function(a){return!!a.disabled}),!A){var Q;A={};for(Q in z)z[Q]instanceof Array?A[Q]=z[Q].slice(0):A[Q]=z[Q]}var R=d3.behavior.drag().on("dragstart",I).on("drag",J).on("dragend",K);if(!(x&&x.length&&x.filter(function(a){return a.values.length}).length)){var S=M.selectAll(".nv-noData").data([B]);return S.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),S.attr("x",l.left+O/2).attr("y",l.top+P/2).text(function(a){return a}),a}if(M.selectAll(".nv-noData").remove(),d=f.xScale(),e=f.yScale(),w)f.yDomain(null);else{var T=x.filter(function(a){return!a.disabled}).map(function(a,b){var c=d3.extent(a.values,f.y());return c[0]<-.95&&(c[0]=-.95),
-[(c[0]-c[1])/(1+c[1]),(c[1]-c[0])/(1+c[0])]}),U=[d3.min(T,function(a){return a[0]}),d3.max(T,function(a){return a[1]})];f.yDomain(U)}F.domain([0,x[0].values.length-1]).range([0,O]).clamp(!0);var x=b(G.i,x),V=v?"none":"all",W=M.selectAll("g.nv-wrap.nv-cumulativeLine").data([x]),X=W.enter().append("g").attr("class","nvd3 nv-wrap nv-cumulativeLine").append("g"),Y=W.select("g");if(X.append("g").attr("class","nv-interactive"),X.append("g").attr("class","nv-x nv-axis").style("pointer-events","none"),X.append("g").attr("class","nv-y nv-axis"),X.append("g").attr("class","nv-background"),X.append("g").attr("class","nv-linesWrap").style("pointer-events",V),X.append("g").attr("class","nv-avgLinesWrap").style("pointer-events","none"),X.append("g").attr("class","nv-legendWrap"),X.append("g").attr("class","nv-controlsWrap"),p&&(i.width(O),Y.select(".nv-legendWrap").datum(x).call(i),l.top!=i.height()&&(l.top=i.height(),P=(o||parseInt(M.style("height"))||400)-l.top-l.bottom),Y.select(".nv-legendWrap").attr("transform","translate(0,"+-l.top+")")),u){var Z=[{key:"Re-scale y-axis",disabled:!w}];j.width(140).color(["#444","#444","#444"]),Y.select(".nv-controlsWrap").datum(Z).attr("transform","translate(0,"+-l.top+")").call(j)}W.attr("transform","translate("+l.left+","+l.top+")"),s&&Y.select(".nv-y.nv-axis").attr("transform","translate("+O+",0)");var $=x.filter(function(a){return a.tempDisabled});W.select(".tempDisabled").remove(),$.length&&W.append("text").attr("class","tempDisabled").attr("x",O/2).attr("y","-.71em").style("text-anchor","end").text($.map(function(a){return a.key}).join(", ")+" values cannot be calculated for this time period."),v&&(k.width(O).height(P).margin({left:l.left,top:l.top}).svgContainer(M).xScale(d),W.select(".nv-interactive").call(k)),X.select(".nv-background").append("rect"),Y.select(".nv-background rect").attr("width",O).attr("height",P),f.y(function(a){return a.display.y}).width(O).height(P).color(x.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!x[b].disabled&&!x[b].tempDisabled}));var _=Y.select(".nv-linesWrap").datum(x.filter(function(a){return!a.disabled&&!a.tempDisabled}));_.call(f),x.forEach(function(a,b){a.seriesIndex=b});var aa=x.filter(function(a){return!a.disabled&&!!C(a)}),ba=Y.select(".nv-avgLinesWrap").selectAll("line").data(aa,function(a){return a.key}),ca=function(a){var b=e(C(a));return 0>b?0:b>P?P:b};ba.enter().append("line").style("stroke-width",2).style("stroke-dasharray","10,10").style("stroke",function(a,b){return f.color()(a,a.seriesIndex)}).attr("x1",0).attr("x2",O).attr("y1",ca).attr("y2",ca),ba.style("stroke-opacity",function(a){var b=e(C(a));return 0>b||b>P?0:1}).attr("x1",0).attr("x2",O).attr("y1",ca).attr("y2",ca),ba.exit().remove();var da=_.selectAll(".nv-indexLine").data([G]);da.enter().append("rect").attr("class","nv-indexLine").attr("width",3).attr("x",-2).attr("fill","red").attr("fill-opacity",.5).style("pointer-events","all").call(R),da.attr("transform",function(a){return"translate("+F(a.i)+",0)"}).attr("height",P),q&&(g.scale(d).ticks(Math.min(x[0].values.length,O/70)).tickSize(-P,0),Y.select(".nv-x.nv-axis").attr("transform","translate(0,"+e.range()[0]+")"),d3.transition(Y.select(".nv-x.nv-axis")).call(g)),r&&(h.scale(e).ticks(P/36).tickSize(-O,0),d3.transition(Y.select(".nv-y.nv-axis")).call(h)),Y.select(".nv-background rect").on("click",function(){G.x=d3.mouse(this)[0],G.i=Math.round(F.invert(G.x)),z.index=G.i,D.stateChange(z),L()}),f.dispatch.on("elementClick",function(a){G.i=a.pointIndex,G.x=F(G.i),z.index=G.i,D.stateChange(z),L()}),j.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,w=!b.disabled,z.rescaleY=w,D.stateChange(z),a.update()}),i.dispatch.on("stateChange",function(b){z.disabled=b.disabled,D.stateChange(z),a.update()}),k.dispatch.on("elementMousemove",function(b){f.clearHighlights();var d,e,i,j=[];if(x.filter(function(a,b){return a.seriesIndex=b,!a.disabled}).forEach(function(g,h){e=c.interactiveBisect(g.values,b.pointXValue,a.x()),f.highlightPoint(h,e,!0);var k=g.values[e];"undefined"!=typeof k&&("undefined"==typeof d&&(d=k),"undefined"==typeof i&&(i=a.xScale()(a.x()(k,e))),j.push({key:g.key,value:a.y()(k,e),color:m(g,g.seriesIndex)}))}),j.length>2){var n=a.yScale().invert(b.mouseY),o=Math.abs(a.yScale().domain()[0]-a.yScale().domain()[1]),p=.03*o,q=c.nearestValueIndex(j.map(function(a){return a.value}),n,p);null!==q&&(j[q].highlight=!0)}var r=g.tickFormat()(a.x()(d,e),e);k.tooltip.position({left:i+l.left,top:b.mouseY+l.top}).chartContainer(N.parentNode).enabled(t).valueFormatter(function(a,b){return h.tickFormat()(a)}).data({value:r,series:j})(),k.renderGuideLine(i)}),k.dispatch.on("elementMouseout",function(a){D.tooltipHide(),f.clearHighlights()}),D.on("tooltipShow",function(a){t&&H(a,N.parentNode)}),D.on("changeState",function(b){"undefined"!=typeof b.disabled&&(x.forEach(function(a,c){a.disabled=b.disabled[c]}),z.disabled=b.disabled),"undefined"!=typeof b.index&&(G.i=b.index,G.x=F(G.i),z.index=b.index,da.data([G])),"undefined"!=typeof b.rescaleY&&(w=b.rescaleY),a.update()})}),a}function b(a,b){return b.map(function(b,c){if(!b.values)return b;var d=f.y()(b.values[a],a);return-.95>d?(b.tempDisabled=!0,b):(b.tempDisabled=!1,b.values=b.values.map(function(a,b){return a.display={y:(f.y()(a,b)-d)/(1+d)},a}),b)})}var d,e,f=c.models.line(),g=c.models.axis(),h=c.models.axis(),i=c.models.legend(),j=c.models.legend(),k=c.interactiveGuideline(),l={top:30,right:30,bottom:50,left:60},m=c.utils.defaultColor(),n=null,o=null,p=!0,q=!0,r=!0,s=!1,t=!0,u=!0,v=!1,w=!0,x=function(a,b,c,d,e){return"<h3>"+a+"</h3><p>"+c+" at "+b+"</p>"},y=f.id(),z={index:0,rescaleY:w},A=null,B="No Data Available.",C=function(a){return a.average},D=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),E=250;g.orient("bottom").tickPadding(7),h.orient(s?"right":"left"),j.updateState(!1);var F=d3.scale.linear(),G={i:0,x:0},H=function(b,d){var e=b.pos[0]+(d.offsetLeft||0),i=b.pos[1]+(d.offsetTop||0),j=g.tickFormat()(f.x()(b.point,b.pointIndex)),k=h.tickFormat()(f.y()(b.point,b.pointIndex)),l=x(b.series.key,j,k,b,a);c.tooltip.show([e,i],l,null,null,d)};return f.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+l.left,a.pos[1]+l.top],D.tooltipShow(a)}),f.dispatch.on("elementMouseout.tooltip",function(a){D.tooltipHide(a)}),D.on("tooltipHide",function(){t&&c.tooltip.cleanup()}),a.dispatch=D,a.lines=f,a.legend=i,a.xAxis=g,a.yAxis=h,a.interactiveLayer=k,d3.rebind(a,f,"defined","isArea","x","y","xScale","yScale","size","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","useVoronoi","id"),a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(l.top="undefined"!=typeof b.top?b.top:l.top,l.right="undefined"!=typeof b.right?b.right:l.right,l.bottom="undefined"!=typeof b.bottom?b.bottom:l.bottom,l.left="undefined"!=typeof b.left?b.left:l.left,a):l},a.width=function(b){return arguments.length?(n=b,a):n},a.height=function(b){return arguments.length?(o=b,a):o},a.color=function(b){return arguments.length?(m=c.utils.getColor(b),i.color(m),a):m},a.rescaleY=function(b){return arguments.length?(w=b,a):w},a.showControls=function(b){return arguments.length?(u=b,a):u},a.useInteractiveGuideline=function(b){return arguments.length?(v=b,b===!0&&(a.interactive(!1),a.useVoronoi(!1)),a):v},a.showLegend=function(b){return arguments.length?(p=b,a):p},a.showXAxis=function(b){return arguments.length?(q=b,a):q},a.showYAxis=function(b){return arguments.length?(r=b,a):r},a.rightAlignYAxis=function(b){return arguments.length?(s=b,h.orient(b?"right":"left"),a):s},a.tooltips=function(b){return arguments.length?(t=b,a):t},a.tooltipContent=function(b){return arguments.length?(x=b,a):x},a.state=function(b){return arguments.length?(z=b,a):z},a.defaultState=function(b){return arguments.length?(A=b,a):A},a.noData=function(b){return arguments.length?(B=b,a):B},a.average=function(b){return arguments.length?(C=b,a):C},a.transitionDuration=function(b){return arguments.length?(E=b,a):E},a},c.models.discreteBar=function(){"use strict";function a(c){return c.each(function(a){var c=j-i.left-i.right,l=k-i.top-i.bottom,w=d3.select(this);a.forEach(function(a,b){a.values.forEach(function(a){a.series=b})});var x=b&&d?[]:a.map(function(a){return a.values.map(function(a,b){return{x:o(a,b),y:p(a,b),y0:a.y0}})});m.domain(b||d3.merge(x).map(function(a){return a.x})).rangeBands(e||[0,c],.1),n.domain(d||d3.extent(d3.merge(x).map(function(a){return a.y}).concat(q))),s?n.range(f||[l-(n.domain()[0]<0?12:0),n.domain()[1]>0?12:0]):n.range(f||[l,0]),g=g||m,h=h||n.copy().range([n(0),n(0)]);var y=w.selectAll("g.nv-wrap.nv-discretebar").data([a]),z=y.enter().append("g").attr("class","nvd3 nv-wrap nv-discretebar"),A=z.append("g");y.select("g");A.append("g").attr("class","nv-groups"),y.attr("transform","translate("+i.left+","+i.top+")");var B=y.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});B.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),B.exit().transition().style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),B.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}),B.transition().style("stroke-opacity",1).style("fill-opacity",.75);var C=B.selectAll("g.nv-bar").data(function(a){return a.values});C.exit().remove();var D=C.enter().append("g").attr("transform",function(a,b,c){return"translate("+(m(o(a,b))+.05*m.rangeBand())+", "+n(0)+")"}).on("mouseover",function(b,c){d3.select(this).classed("hover",!0),u.elementMouseover({value:p(b,c),point:b,series:a[b.series],pos:[m(o(b,c))+m.rangeBand()*(b.series+.5)/a.length,n(p(b,c))],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),u.elementMouseout({value:p(b,c),point:b,series:a[b.series],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("click",function(b,c){u.elementClick({value:p(b,c),point:b,series:a[b.series],pos:[m(o(b,c))+m.rangeBand()*(b.series+.5)/a.length,n(p(b,c))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(b,c){u.elementDblClick({value:p(b,c),point:b,series:a[b.series],pos:[m(o(b,c))+m.rangeBand()*(b.series+.5)/a.length,n(p(b,c))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()});D.append("rect").attr("height",0).attr("width",.9*m.rangeBand()/a.length),s?(D.append("text").attr("text-anchor","middle"),C.select("text").text(function(a,b){return t(p(a,b))}).transition().attr("x",.9*m.rangeBand()/2).attr("y",function(a,b){return p(a,b)<0?n(p(a,b))-n(0)+12:-4})):C.selectAll("text").remove(),C.attr("class",function(a,b){return p(a,b)<0?"nv-bar negative":"nv-bar positive"}).style("fill",function(a,b){return a.color||r(a,b)}).style("stroke",function(a,b){return a.color||r(a,b)}).select("rect").attr("class",v).transition().attr("width",.9*m.rangeBand()/a.length),C.transition().attr("transform",function(a,b){var c=m(o(a,b))+.05*m.rangeBand(),d=p(a,b)<0?n(0):n(0)-n(p(a,b))<1?n(0)-1:n(p(a,b));return"translate("+c+", "+d+")"}).select("rect").attr("height",function(a,b){return Math.max(Math.abs(n(p(a,b))-n(d&&d[0]||0))||1)}),g=m.copy(),h=n.copy()}),a}var b,d,e,f,g,h,i={top:0,right:0,bottom:0,left:0},j=960,k=500,l=Math.floor(1e4*Math.random()),m=d3.scale.ordinal(),n=d3.scale.linear(),o=function(a){return a.x},p=function(a){return a.y},q=[0],r=c.utils.defaultColor(),s=!1,t=d3.format(",.2f"),u=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),v="discreteBar";return a.dispatch=u,a.options=c.utils.optionsFunc.bind(a),a.x=function(b){return arguments.length?(o=b,a):o},a.y=function(b){return arguments.length?(p=b,a):p},a.margin=function(b){return arguments.length?(i.top="undefined"!=typeof b.top?b.top:i.top,i.right="undefined"!=typeof b.right?b.right:i.right,i.bottom="undefined"!=typeof b.bottom?b.bottom:i.bottom,i.left="undefined"!=typeof b.left?b.left:i.left,a):i},a.width=function(b){return arguments.length?(j=b,a):j},a.height=function(b){return arguments.length?(k=b,a):k},a.xScale=function(b){return arguments.length?(m=b,a):m},a.yScale=function(b){return arguments.length?(n=b,a):n},a.xDomain=function(c){return arguments.length?(b=c,a):b},a.yDomain=function(b){return arguments.length?(d=b,a):d},a.xRange=function(b){return arguments.length?(e=b,a):e},a.yRange=function(b){return arguments.length?(f=b,a):f},a.forceY=function(b){return arguments.length?(q=b,a):q},a.color=function(b){return arguments.length?(r=c.utils.getColor(b),a):r},a.id=function(b){return arguments.length?(l=b,a):l},a.showValues=function(b){return arguments.length?(s=b,a):s},a.valueFormat=function(b){return arguments.length?(t=b,a):t},a.rectClass=function(b){return arguments.length?(v=b,a):v},a},c.models.discreteBarChart=function(){"use strict";function a(c){return c.each(function(c){var k=d3.select(this),q=this,v=(i||parseInt(k.style("width"))||960)-h.left-h.right,w=(j||parseInt(k.style("height"))||400)-h.top-h.bottom;if(a.update=function(){s.beforeUpdate(),k.transition().duration(t).call(a)},a.container=this,!(c&&c.length&&c.filter(function(a){return a.values.length}).length)){var x=k.selectAll(".nv-noData").data([r]);return x.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),x.attr("x",h.left+v/2).attr("y",h.top+w/2).text(function(a){return a}),a}k.selectAll(".nv-noData").remove(),b=e.xScale(),d=e.yScale().clamp(!0);var y=k.selectAll("g.nv-wrap.nv-discreteBarWithAxes").data([c]),z=y.enter().append("g").attr("class","nvd3 nv-wrap nv-discreteBarWithAxes").append("g"),A=z.append("defs"),B=y.select("g");z.append("g").attr("class","nv-x nv-axis"),z.append("g").attr("class","nv-y nv-axis").append("g").attr("class","nv-zeroLine").append("line"),z.append("g").attr("class","nv-barsWrap"),B.attr("transform","translate("+h.left+","+h.top+")"),n&&B.select(".nv-y.nv-axis").attr("transform","translate("+v+",0)"),e.width(v).height(w);var C=B.select(".nv-barsWrap").datum(c.filter(function(a){return!a.disabled}));if(C.transition().call(e),A.append("clipPath").attr("id","nv-x-label-clip-"+e.id()).append("rect"),B.select("#nv-x-label-clip-"+e.id()+" rect").attr("width",b.rangeBand()*(o?2:1)).attr("height",16).attr("x",-b.rangeBand()/(o?1:2)),l){f.scale(b).ticks(v/100).tickSize(-w,0),B.select(".nv-x.nv-axis").attr("transform","translate(0,"+(d.range()[0]+(e.showValues()&&d.domain()[0]<0?16:0))+")"),B.select(".nv-x.nv-axis").transition().call(f);var D=B.select(".nv-x.nv-axis").selectAll("g");o&&D.selectAll("text").attr("transform",function(a,b,c){return"translate(0,"+(c%2==0?"5":"17")+")"})}m&&(g.scale(d).ticks(w/36).tickSize(-v,0),B.select(".nv-y.nv-axis").transition().call(g)),B.select(".nv-zeroLine line").attr("x1",0).attr("x2",v).attr("y1",d(0)).attr("y2",d(0)),s.on("tooltipShow",function(a){p&&u(a,q.parentNode)})}),a}var b,d,e=c.models.discreteBar(),f=c.models.axis(),g=c.models.axis(),h={top:15,right:10,bottom:50,left:60},i=null,j=null,k=c.utils.getColor(),l=!0,m=!0,n=!1,o=!1,p=!0,q=function(a,b,c,d,e){return"<h3>"+b+"</h3><p>"+c+"</p>"},r="No Data Available.",s=d3.dispatch("tooltipShow","tooltipHide","beforeUpdate"),t=250;f.orient("bottom").highlightZero(!1).showMaxMin(!1).tickFormat(function(a){return a}),g.orient(n?"right":"left").tickFormat(d3.format(",.1f"));var u=function(b,d){var h=b.pos[0]+(d.offsetLeft||0),i=b.pos[1]+(d.offsetTop||0),j=f.tickFormat()(e.x()(b.point,b.pointIndex)),k=g.tickFormat()(e.y()(b.point,b.pointIndex)),l=q(b.series.key,j,k,b,a);c.tooltip.show([h,i],l,b.value<0?"n":"s",null,d)};return e.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+h.left,a.pos[1]+h.top],s.tooltipShow(a)}),e.dispatch.on("elementMouseout.tooltip",function(a){s.tooltipHide(a)}),s.on("tooltipHide",function(){p&&c.tooltip.cleanup()}),a.dispatch=s,a.discretebar=e,a.xAxis=f,a.yAxis=g,d3.rebind(a,e,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","id","showValues","valueFormat"),a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(h.top="undefined"!=typeof b.top?b.top:h.top,h.right="undefined"!=typeof b.right?b.right:h.right,h.bottom="undefined"!=typeof b.bottom?b.bottom:h.bottom,h.left="undefined"!=typeof b.left?b.left:h.left,a):h},a.width=function(b){return arguments.length?(i=b,a):i},a.height=function(b){return arguments.length?(j=b,a):j},a.color=function(b){return arguments.length?(k=c.utils.getColor(b),e.color(k),a):k},a.showXAxis=function(b){return arguments.length?(l=b,a):l},a.showYAxis=function(b){return arguments.length?(m=b,a):m},a.rightAlignYAxis=function(b){return arguments.length?(n=b,g.orient(b?"right":"left"),a):n},a.staggerLabels=function(b){return arguments.length?(o=b,a):o},a.tooltips=function(b){return arguments.length?(p=b,a):p},a.tooltipContent=function(b){return arguments.length?(q=b,a):q},a.noData=function(b){return arguments.length?(r=b,a):r},a.transitionDuration=function(b){return arguments.length?(t=b,a):t},a},c.models.distribution=function(){"use strict";function a(c){return c.each(function(a){var c=(e-("x"===g?d.left+d.right:d.top+d.bottom),"x"==g?"y":"x"),k=d3.select(this);b=b||j;var l=k.selectAll("g.nv-distribution").data([a]),m=l.enter().append("g").attr("class","nvd3 nv-distribution"),n=(m.append("g"),l.select("g"));l.attr("transform","translate("+d.left+","+d.top+")");var o=n.selectAll("g.nv-dist").data(function(a){return a},function(a){return a.key});o.enter().append("g"),o.attr("class",function(a,b){return"nv-dist nv-series-"+b}).style("stroke",function(a,b){return i(a,b)});var p=o.selectAll("line.nv-dist"+g).data(function(a){return a.values});p.enter().append("line").attr(g+"1",function(a,c){return b(h(a,c))}).attr(g+"2",function(a,c){return b(h(a,c))}),o.exit().selectAll("line.nv-dist"+g).transition().attr(g+"1",function(a,b){return j(h(a,b))}).attr(g+"2",function(a,b){return j(h(a,b))}).style("stroke-opacity",0).remove(),p.attr("class",function(a,b){return"nv-dist"+g+" nv-dist"+g+"-"+b}).attr(c+"1",0).attr(c+"2",f),p.transition().attr(g+"1",function(a,b){return j(h(a,b))}).attr(g+"2",function(a,b){return j(h(a,b))}),b=j.copy()}),a}var b,d={top:0,right:0,bottom:0,left:0},e=400,f=8,g="x",h=function(a){return a[g]},i=c.utils.defaultColor(),j=d3.scale.linear();return a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(d.top="undefined"!=typeof b.top?b.top:d.top,d.right="undefined"!=typeof b.right?b.right:d.right,d.bottom="undefined"!=typeof b.bottom?b.bottom:d.bottom,d.left="undefined"!=typeof b.left?b.left:d.left,a):d},a.width=function(b){return arguments.length?(e=b,a):e},a.axis=function(b){return arguments.length?(g=b,a):g},a.size=function(b){return arguments.length?(f=b,a):f},a.getData=function(b){return arguments.length?(h=d3.functor(b),a):h},a.scale=function(b){return arguments.length?(j=b,a):j},a.color=function(b){return arguments.length?(i=c.utils.getColor(b),a):i},a},c.models.historicalBarChart=function(){"use strict";function a(c){return c.each(function(r){var y=d3.select(this),z=this,A=(k||parseInt(y.style("width"))||960)-i.left-i.right,B=(l||parseInt(y.style("height"))||400)-i.top-i.bottom;if(a.update=function(){y.transition().duration(w).call(a)},a.container=this,s.disabled=r.map(function(a){return!!a.disabled}),!t){var C;t={};for(C in s)s[C]instanceof Array?t[C]=s[C].slice(0):t[C]=s[C]}if(!(r&&r.length&&r.filter(function(a){return a.values.length}).length)){var D=y.selectAll(".nv-noData").data([u]);return D.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),D.attr("x",i.left+A/2).attr("y",i.top+B/2).text(function(a){return a}),a}y.selectAll(".nv-noData").remove(),b=e.xScale(),d=e.yScale();var E=y.selectAll("g.nv-wrap.nv-historicalBarChart").data([r]),F=E.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBarChart").append("g"),G=E.select("g");F.append("g").attr("class","nv-x nv-axis"),F.append("g").attr("class","nv-y nv-axis"),F.append("g").attr("class","nv-barsWrap"),F.append("g").attr("class","nv-legendWrap"),m&&(h.width(A),G.select(".nv-legendWrap").datum(r).call(h),i.top!=h.height()&&(i.top=h.height(),B=(l||parseInt(y.style("height"))||400)-i.top-i.bottom),E.select(".nv-legendWrap").attr("transform","translate(0,"+-i.top+")")),E.attr("transform","translate("+i.left+","+i.top+")"),p&&G.select(".nv-y.nv-axis").attr("transform","translate("+A+",0)"),e.width(A).height(B).color(r.map(function(a,b){return a.color||j(a,b)}).filter(function(a,b){return!r[b].disabled}));var H=G.select(".nv-barsWrap").datum(r.filter(function(a){return!a.disabled}));H.transition().call(e),n&&(f.scale(b).tickSize(-B,0),G.select(".nv-x.nv-axis").attr("transform","translate(0,"+d.range()[0]+")"),G.select(".nv-x.nv-axis").transition().call(f)),o&&(g.scale(d).ticks(B/36).tickSize(-A,0),G.select(".nv-y.nv-axis").transition().call(g)),h.dispatch.on("legendClick",function(b,d){b.disabled=!b.disabled,r.filter(function(a){return!a.disabled}).length||r.map(function(a){return a.disabled=!1,E.selectAll(".nv-series").classed("disabled",!1),a}),s.disabled=r.map(function(a){return!!a.disabled}),v.stateChange(s),c.transition().call(a)}),h.dispatch.on("legendDblclick",function(b){r.forEach(function(a){a.disabled=!0}),b.disabled=!1,s.disabled=r.map(function(a){return!!a.disabled}),v.stateChange(s),a.update()}),v.on("tooltipShow",function(a){q&&x(a,z.parentNode)}),v.on("changeState",function(b){"undefined"!=typeof b.disabled&&(r.forEach(function(a,c){a.disabled=b.disabled[c]}),s.disabled=b.disabled),a.update()})}),a}var b,d,e=c.models.historicalBar(),f=c.models.axis(),g=c.models.axis(),h=c.models.legend(),i={top:30,right:90,bottom:50,left:90},j=c.utils.defaultColor(),k=null,l=null,m=!1,n=!0,o=!0,p=!1,q=!0,r=function(a,b,c,d,e){return"<h3>"+a+"</h3><p>"+c+" at "+b+"</p>"},s={},t=null,u="No Data Available.",v=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),w=250;f.orient("bottom").tickPadding(7),g.orient(p?"right":"left");var x=function(b,d){if(d){var h=d3.select(d).select("svg"),i=h.node()?h.attr("viewBox"):null;if(i){i=i.split(" ");var j=parseInt(h.style("width"))/i[2];b.pos[0]=b.pos[0]*j,b.pos[1]=b.pos[1]*j}}var k=b.pos[0]+(d.offsetLeft||0),l=b.pos[1]+(d.offsetTop||0),m=f.tickFormat()(e.x()(b.point,b.pointIndex)),n=g.tickFormat()(e.y()(b.point,b.pointIndex)),o=r(b.series.key,m,n,b,a);c.tooltip.show([k,l],o,null,null,d)};return e.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+i.left,a.pos[1]+i.top],v.tooltipShow(a)}),e.dispatch.on("elementMouseout.tooltip",function(a){v.tooltipHide(a)}),v.on("tooltipHide",function(){q&&c.tooltip.cleanup()}),a.dispatch=v,a.bars=e,a.legend=h,a.xAxis=f,a.yAxis=g,d3.rebind(a,e,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","id","interpolate","highlightPoint","clearHighlights","interactive"),a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(i.top="undefined"!=typeof b.top?b.top:i.top,i.right="undefined"!=typeof b.right?b.right:i.right,i.bottom="undefined"!=typeof b.bottom?b.bottom:i.bottom,i.left="undefined"!=typeof b.left?b.left:i.left,a):i},a.width=function(b){return arguments.length?(k=b,a):k},a.height=function(b){return arguments.length?(l=b,a):l},a.color=function(b){return arguments.length?(j=c.utils.getColor(b),h.color(j),a):j},a.showLegend=function(b){return arguments.length?(m=b,a):m},a.showXAxis=function(b){return arguments.length?(n=b,a):n},a.showYAxis=function(b){return arguments.length?(o=b,a):o},a.rightAlignYAxis=function(b){return arguments.length?(p=b,g.orient(b?"right":"left"),a):p},a.tooltips=function(b){return arguments.length?(q=b,a):q},a.tooltipContent=function(b){return arguments.length?(r=b,a):r},a.state=function(b){return arguments.length?(s=b,a):s},a.defaultState=function(b){return arguments.length?(t=b,a):t},a.noData=function(b){return arguments.length?(u=b,a):u},a.transitionDuration=function(b){return arguments.length?(w=b,a):w},a},c.models.indentedTree=function(){"use strict";function a(b){return b.each(function(b){function c(b,d,e){return d3.event.stopPropagation(),d3.event.shiftKey&&!e?(d3.event.shiftKey=!1,b.values&&b.values.forEach(function(a){(a.values||a._values)&&c(a,0,!0)}),!0):g(b)?(b.values?(b._values=b.values,b.values=null):(b.values=b._values,b._values=null),void a.update()):!0}function d(a){return a._values&&a._values.length?n:a.values&&a.values.length?o:""}function f(a){return a._values&&a._values.length}function g(a){var b=a.values||a._values;return b&&b.length}var s=1,t=d3.select(this),u=d3.layout.tree().children(function(a){return a.values}).size([e,k]);a.update=function(){t.transition().duration(600).call(a)},b[0]||(b[0]={key:j});var v=u.nodes(b[0]),w=d3.select(this).selectAll("div").data([[v]]),x=w.enter().append("div").attr("class","nvd3 nv-wrap nv-indentedtree"),y=x.append("table"),z=w.select("table").attr("width","100%").attr("class",m);if(h){var A=y.append("thead"),B=A.append("tr");l.forEach(function(a){B.append("th").attr("width",a.width?a.width:"10%").style("text-align","numeric"==a.type?"right":"left").append("span").text(a.label)})}var C=z.selectAll("tbody").data(function(a){return a});C.enter().append("tbody"),s=d3.max(v,function(a){return a.depth}),u.size([e,s*k]);var D=C.selectAll("tr").data(function(a){return a.filter(function(a){return i&&!a.children?i(a):!0})},function(a,b){return a.id||a.id||++r});D.exit().remove(),D.select("img.nv-treeicon").attr("src",d).classed("folded",f);var E=D.enter().append("tr");l.forEach(function(a,b){var e=E.append("td").style("padding-left",function(a){return(b?0:a.depth*k+12+(d(a)?0:16))+"px"},"important").style("text-align","numeric"==a.type?"right":"left");0==b&&e.append("img").classed("nv-treeicon",!0).classed("nv-folded",f).attr("src",d).style("width","14px").style("height","14px").style("padding","0 1px").style("display",function(a){return d(a)?"inline-block":"none"}).on("click",c),e.each(function(c){!b&&q(c)?d3.select(this).append("a").attr("href",q).attr("class",d3.functor(a.classes)).append("span"):d3.select(this).append("span"),d3.select(this).select("span").attr("class",d3.functor(a.classes)).text(function(b){return a.format?a.format(b):b[a.key]||"-"})}),a.showCount&&(e.append("span").attr("class","nv-childrenCount"),D.selectAll("span.nv-childrenCount").text(function(a){return a.values&&a.values.length||a._values&&a._values.length?"("+(a.values&&a.values.filter(function(a){return i?i(a):!0}).length||a._values&&a._values.filter(function(a){return i?i(a):!0}).length||0)+")":""}))}),D.order().on("click",function(a){p.elementClick({row:this,data:a,pos:[a.x,a.y]})}).on("dblclick",function(a){p.elementDblclick({row:this,data:a,pos:[a.x,a.y]})}).on("mouseover",function(a){p.elementMouseover({row:this,data:a,pos:[a.x,a.y]})}).on("mouseout",function(a){p.elementMouseout({row:this,data:a,pos:[a.x,a.y]})})}),a}var b={top:0,right:0,bottom:0,left:0},d=960,e=500,f=c.utils.defaultColor(),g=Math.floor(1e4*Math.random()),h=!0,i=!1,j="No Data Available.",k=20,l=[{key:"key",label:"Name",type:"text"}],m=null,n="images/grey-plus.png",o="images/grey-minus.png",p=d3.dispatch("elementClick","elementDblclick","elementMouseover","elementMouseout"),q=function(a){return a.url},r=0;return a.options=c.utils.optionsFunc.bind(a),a.margin=function(c){return arguments.length?(b.top="undefined"!=typeof c.top?c.top:b.top,b.right="undefined"!=typeof c.right?c.right:b.right,b.bottom="undefined"!=typeof c.bottom?c.bottom:b.bottom,b.left="undefined"!=typeof c.left?c.left:b.left,a):b},a.width=function(b){return arguments.length?(d=b,a):d},a.height=function(b){return arguments.length?(e=b,a):e},a.color=function(b){return arguments.length?(f=c.utils.getColor(b),scatter.color(f),a):f},a.id=function(b){return arguments.length?(g=b,a):g},a.header=function(b){return arguments.length?(h=b,a):h},a.noData=function(b){return arguments.length?(j=b,a):j},a.filterZero=function(b){return arguments.length?(i=b,a):i},a.columns=function(b){return arguments.length?(l=b,a):l},a.tableClass=function(b){return arguments.length?(m=b,a):m},a.iconOpen=function(b){return arguments.length?(n=b,a):n},a.iconClose=function(b){return arguments.length?(o=b,a):o},a.getUrl=function(b){return arguments.length?(q=b,a):q},a},c.models.legend=function(){"use strict";function a(m){return m.each(function(a){var m=d-b.left-b.right,n=d3.select(this),o=n.selectAll("g.nv-legend").data([a]),p=(o.enter().append("g").attr("class","nvd3 nv-legend").append("g"),o.select("g"));o.attr("transform","translate("+b.left+","+b.top+")");var q=p.selectAll(".nv-series").data(function(a){return a}),r=q.enter().append("g").attr("class","nv-series").on("mouseover",function(a,b){l.legendMouseover(a,b)}).on("mouseout",function(a,b){l.legendMouseout(a,b)}).on("click",function(b,c){l.legendClick(b,c),j&&(k?(a.forEach(function(a){a.disabled=!0}),b.disabled=!1):(b.disabled=!b.disabled,a.every(function(a){return a.disabled})&&a.forEach(function(a){a.disabled=!1})),l.stateChange({disabled:a.map(function(a){return!!a.disabled})}))}).on("dblclick",function(b,c){l.legendDblclick(b,c),j&&(a.forEach(function(a){a.disabled=!0}),b.disabled=!1,l.stateChange({disabled:a.map(function(a){return!!a.disabled})}))});if(r.append("circle").style("stroke-width",2).attr("class","nv-legend-symbol").attr("r",5),r.append("text").attr("text-anchor","start").attr("class","nv-legend-text").attr("dy",".32em").attr("dx","8"),q.classed("disabled",function(a){return a.disabled}),q.exit().remove(),q.select("circle").style("fill",function(a,b){return a.color||g(a,b)}).style("stroke",function(a,b){return a.color||g(a,b)}),q.select("text").text(f),h){var s=[];q.each(function(a,b){var d,e=d3.select(this).select("text");try{d=e.node().getComputedTextLength()}catch(f){d=c.utils.calcApproxTextWidth(e)}s.push(d+28)});for(var t=0,u=0,v=[];m>u&&t<s.length;)v[t]=s[t],u+=s[t++];for(0===t&&(t=1);u>m&&t>1;){v=[],t--;for(var w=0;w<s.length;w++)s[w]>(v[w%t]||0)&&(v[w%t]=s[w]);u=v.reduce(function(a,b,c,d){return a+b})}for(var x=[],y=0,z=0;t>y;y++)x[y]=z,z+=v[y];q.attr("transform",function(a,b){return"translate("+x[b%t]+","+(5+20*Math.floor(b/t))+")"}),i?p.attr("transform","translate("+(d-b.right-u)+","+b.top+")"):p.attr("transform","translate(0,"+b.top+")"),e=b.top+b.bottom+20*Math.ceil(s.length/t)}else{var A,B=5,C=5,D=0;q.attr("transform",function(a,c){var e=d3.select(this).select("text").node().getComputedTextLength()+28;return A=C,d<b.left+b.right+A+e&&(C=A=5,B+=20),C+=e,C>D&&(D=C),"translate("+A+","+B+")"}),p.attr("transform","translate("+(d-b.right-D)+","+b.top+")"),e=b.top+b.bottom+B+15}}),a}var b={top:5,right:0,bottom:5,left:0},d=400,e=20,f=function(a){return a.key},g=c.utils.defaultColor(),h=!0,i=!0,j=!0,k=!1,l=d3.dispatch("legendClick","legendDblclick","legendMouseover","legendMouseout","stateChange");return a.dispatch=l,a.options=c.utils.optionsFunc.bind(a),a.margin=function(c){return arguments.length?(b.top="undefined"!=typeof c.top?c.top:b.top,b.right="undefined"!=typeof c.right?c.right:b.right,b.bottom="undefined"!=typeof c.bottom?c.bottom:b.bottom,b.left="undefined"!=typeof c.left?c.left:b.left,a):b},a.width=function(b){return arguments.length?(d=b,a):d},a.height=function(b){return arguments.length?(e=b,a):e},a.key=function(b){return arguments.length?(f=b,a):f},a.color=function(b){return arguments.length?(g=c.utils.getColor(b),a):g},a.align=function(b){return arguments.length?(h=b,a):h},a.rightAlign=function(b){return arguments.length?(i=b,a):i},a.updateState=function(b){return arguments.length?(j=b,a):j},a.radioButtonMode=function(b){return arguments.length?(k=b,a):k},a},c.models.line=function(){"use strict";function a(r){return r.each(function(a){var r=g-f.left-f.right,s=h-f.top-f.bottom,t=d3.select(this);b=e.xScale(),d=e.yScale(),p=p||b,q=q||d;var u=t.selectAll("g.nv-wrap.nv-line").data([a]),v=u.enter().append("g").attr("class","nvd3 nv-wrap nv-line"),w=v.append("defs"),x=v.append("g"),y=u.select("g");
-x.append("g").attr("class","nv-groups"),x.append("g").attr("class","nv-scatterWrap"),u.attr("transform","translate("+f.left+","+f.top+")"),e.width(r).height(s);var z=u.select(".nv-scatterWrap");z.transition().call(e),w.append("clipPath").attr("id","nv-edge-clip-"+e.id()).append("rect"),u.select("#nv-edge-clip-"+e.id()+" rect").attr("width",r).attr("height",s),y.attr("clip-path",n?"url(#nv-edge-clip-"+e.id()+")":""),z.attr("clip-path",n?"url(#nv-edge-clip-"+e.id()+")":"");var A=u.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});A.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),A.exit().remove(),A.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return i(a,b)}).style("stroke",function(a,b){return i(a,b)}),A.transition().style("stroke-opacity",1).style("fill-opacity",.5);var B=A.selectAll("path.nv-area").data(function(a){return m(a)?[a]:[]});B.enter().append("path").attr("class","nv-area").attr("d",function(a){return d3.svg.area().interpolate(o).defined(l).x(function(a,b){return c.utils.NaNtoZero(p(j(a,b)))}).y0(function(a,b){return c.utils.NaNtoZero(q(k(a,b)))}).y1(function(a,b){return q(d.domain()[0]<=0?d.domain()[1]>=0?0:d.domain()[1]:d.domain()[0])}).apply(this,[a.values])}),A.exit().selectAll("path.nv-area").remove(),B.transition().attr("d",function(a){return d3.svg.area().interpolate(o).defined(l).x(function(a,d){return c.utils.NaNtoZero(b(j(a,d)))}).y0(function(a,b){return c.utils.NaNtoZero(d(k(a,b)))}).y1(function(a,b){return d(d.domain()[0]<=0?d.domain()[1]>=0?0:d.domain()[1]:d.domain()[0])}).apply(this,[a.values])});var C=A.selectAll("path.nv-line").data(function(a){return[a.values]});C.enter().append("path").attr("class","nv-line").attr("d",d3.svg.line().interpolate(o).defined(l).x(function(a,b){return c.utils.NaNtoZero(p(j(a,b)))}).y(function(a,b){return c.utils.NaNtoZero(q(k(a,b)))})),C.transition().attr("d",d3.svg.line().interpolate(o).defined(l).x(function(a,d){return c.utils.NaNtoZero(b(j(a,d)))}).y(function(a,b){return c.utils.NaNtoZero(d(k(a,b)))})),p=b.copy(),q=d.copy()}),a}var b,d,e=c.models.scatter(),f={top:0,right:0,bottom:0,left:0},g=960,h=500,i=c.utils.defaultColor(),j=function(a){return a.x},k=function(a){return a.y},l=function(a,b){return!isNaN(k(a,b))&&null!==k(a,b)},m=function(a){return a.area},n=!1,o="linear";e.size(16).sizeDomain([16,256]);var p,q;return a.dispatch=e.dispatch,a.scatter=e,d3.rebind(a,e,"id","interactive","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","forceX","forceY","forceSize","clipVoronoi","useVoronoi","clipRadius","padData","highlightPoint","clearHighlights"),a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(f.top="undefined"!=typeof b.top?b.top:f.top,f.right="undefined"!=typeof b.right?b.right:f.right,f.bottom="undefined"!=typeof b.bottom?b.bottom:f.bottom,f.left="undefined"!=typeof b.left?b.left:f.left,a):f},a.width=function(b){return arguments.length?(g=b,a):g},a.height=function(b){return arguments.length?(h=b,a):h},a.x=function(b){return arguments.length?(j=b,e.x(b),a):j},a.y=function(b){return arguments.length?(k=b,e.y(b),a):k},a.clipEdge=function(b){return arguments.length?(n=b,a):n},a.color=function(b){return arguments.length?(i=c.utils.getColor(b),e.color(i),a):i},a.interpolate=function(b){return arguments.length?(o=b,a):o},a.defined=function(b){return arguments.length?(l=b,a):l},a.isArea=function(b){return arguments.length?(m=d3.functor(b),a):m},a},c.models.lineChart=function(){"use strict";function a(t){return t.each(function(t){var A=d3.select(this),B=this,C=(l||parseInt(A.style("width"))||960)-j.left-j.right,D=(m||parseInt(A.style("height"))||400)-j.top-j.bottom;if(a.update=function(){A.transition().duration(y).call(a)},a.container=this,u.disabled=t.map(function(a){return!!a.disabled}),!v){var E;v={};for(E in u)u[E]instanceof Array?v[E]=u[E].slice(0):v[E]=u[E]}if(!(t&&t.length&&t.filter(function(a){return a.values.length}).length)){var F=A.selectAll(".nv-noData").data([w]);return F.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),F.attr("x",j.left+C/2).attr("y",j.top+D/2).text(function(a){return a}),a}A.selectAll(".nv-noData").remove(),b=e.xScale(),d=e.yScale();var G=A.selectAll("g.nv-wrap.nv-lineChart").data([t]),H=G.enter().append("g").attr("class","nvd3 nv-wrap nv-lineChart").append("g"),I=G.select("g");H.append("rect").style("opacity",0),H.append("g").attr("class","nv-x nv-axis"),H.append("g").attr("class","nv-y nv-axis"),H.append("g").attr("class","nv-linesWrap"),H.append("g").attr("class","nv-legendWrap"),H.append("g").attr("class","nv-interactive"),I.select("rect").attr("width",C).attr("height",D),n&&(h.width(C),I.select(".nv-legendWrap").datum(t).call(h),j.top!=h.height()&&(j.top=h.height(),D=(m||parseInt(A.style("height"))||400)-j.top-j.bottom),G.select(".nv-legendWrap").attr("transform","translate(0,"+-j.top+")")),G.attr("transform","translate("+j.left+","+j.top+")"),q&&I.select(".nv-y.nv-axis").attr("transform","translate("+C+",0)"),r&&(i.width(C).height(D).margin({left:j.left,top:j.top}).svgContainer(A).xScale(b),G.select(".nv-interactive").call(i)),e.width(C).height(D).color(t.map(function(a,b){return a.color||k(a,b)}).filter(function(a,b){return!t[b].disabled}));var J=I.select(".nv-linesWrap").datum(t.filter(function(a){return!a.disabled}));J.transition().call(e),o&&(f.scale(b).ticks(C/100).tickSize(-D,0),I.select(".nv-x.nv-axis").attr("transform","translate(0,"+d.range()[0]+")"),I.select(".nv-x.nv-axis").transition().call(f)),p&&(g.scale(d).ticks(D/36).tickSize(-C,0),I.select(".nv-y.nv-axis").transition().call(g)),h.dispatch.on("stateChange",function(b){u=b,x.stateChange(u),a.update()}),i.dispatch.on("elementMousemove",function(b){e.clearHighlights();var d,h,l,m=[];if(t.filter(function(a,b){return a.seriesIndex=b,!a.disabled}).forEach(function(f,g){h=c.interactiveBisect(f.values,b.pointXValue,a.x()),e.highlightPoint(g,h,!0);var i=f.values[h];"undefined"!=typeof i&&("undefined"==typeof d&&(d=i),"undefined"==typeof l&&(l=a.xScale()(a.x()(i,h))),m.push({key:f.key,value:a.y()(i,h),color:k(f,f.seriesIndex)}))}),m.length>2){var n=a.yScale().invert(b.mouseY),o=Math.abs(a.yScale().domain()[0]-a.yScale().domain()[1]),p=.03*o,q=c.nearestValueIndex(m.map(function(a){return a.value}),n,p);null!==q&&(m[q].highlight=!0)}var r=f.tickFormat()(a.x()(d,h));i.tooltip.position({left:l+j.left,top:b.mouseY+j.top}).chartContainer(B.parentNode).enabled(s).valueFormatter(function(a,b){return g.tickFormat()(a)}).data({value:r,series:m})(),i.renderGuideLine(l)}),i.dispatch.on("elementMouseout",function(a){x.tooltipHide(),e.clearHighlights()}),x.on("tooltipShow",function(a){s&&z(a,B.parentNode)}),x.on("changeState",function(b){"undefined"!=typeof b.disabled&&(t.forEach(function(a,c){a.disabled=b.disabled[c]}),u.disabled=b.disabled),a.update()})}),a}var b,d,e=c.models.line(),f=c.models.axis(),g=c.models.axis(),h=c.models.legend(),i=c.interactiveGuideline(),j={top:30,right:20,bottom:50,left:60},k=c.utils.defaultColor(),l=null,m=null,n=!0,o=!0,p=!0,q=!1,r=!1,s=!0,t=function(a,b,c,d,e){return"<h3>"+a+"</h3><p>"+c+" at "+b+"</p>"},u={},v=null,w="No Data Available.",x=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),y=250;f.orient("bottom").tickPadding(7),g.orient(q?"right":"left");var z=function(b,d){var h=b.pos[0]+(d.offsetLeft||0),i=b.pos[1]+(d.offsetTop||0),j=f.tickFormat()(e.x()(b.point,b.pointIndex)),k=g.tickFormat()(e.y()(b.point,b.pointIndex)),l=t(b.series.key,j,k,b,a);c.tooltip.show([h,i],l,null,null,d)};return e.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+j.left,a.pos[1]+j.top],x.tooltipShow(a)}),e.dispatch.on("elementMouseout.tooltip",function(a){x.tooltipHide(a)}),x.on("tooltipHide",function(){s&&c.tooltip.cleanup()}),a.dispatch=x,a.lines=e,a.legend=h,a.xAxis=f,a.yAxis=g,a.interactiveLayer=i,d3.rebind(a,e,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","useVoronoi","id","interpolate"),a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(j.top="undefined"!=typeof b.top?b.top:j.top,j.right="undefined"!=typeof b.right?b.right:j.right,j.bottom="undefined"!=typeof b.bottom?b.bottom:j.bottom,j.left="undefined"!=typeof b.left?b.left:j.left,a):j},a.width=function(b){return arguments.length?(l=b,a):l},a.height=function(b){return arguments.length?(m=b,a):m},a.color=function(b){return arguments.length?(k=c.utils.getColor(b),h.color(k),a):k},a.showLegend=function(b){return arguments.length?(n=b,a):n},a.showXAxis=function(b){return arguments.length?(o=b,a):o},a.showYAxis=function(b){return arguments.length?(p=b,a):p},a.rightAlignYAxis=function(b){return arguments.length?(q=b,g.orient(b?"right":"left"),a):q},a.useInteractiveGuideline=function(b){return arguments.length?(r=b,b===!0&&(a.interactive(!1),a.useVoronoi(!1)),a):r},a.tooltips=function(b){return arguments.length?(s=b,a):s},a.tooltipContent=function(b){return arguments.length?(t=b,a):t},a.state=function(b){return arguments.length?(u=b,a):u},a.defaultState=function(b){return arguments.length?(v=b,a):v},a.noData=function(b){return arguments.length?(w=b,a):w},a.transitionDuration=function(b){return arguments.length?(y=b,a):y},a},c.models.linePlusBarChart=function(){"use strict";function a(c){return c.each(function(c){var o=d3.select(this),p=this,t=(m||parseInt(o.style("width"))||960)-l.left-l.right,z=(n||parseInt(o.style("height"))||400)-l.top-l.bottom;if(a.update=function(){o.transition().call(a)},u.disabled=c.map(function(a){return!!a.disabled}),!v){var A;v={};for(A in u)u[A]instanceof Array?v[A]=u[A].slice(0):v[A]=u[A]}if(!(c&&c.length&&c.filter(function(a){return a.values.length}).length)){var B=o.selectAll(".nv-noData").data([w]);return B.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),B.attr("x",l.left+t/2).attr("y",l.top+z/2).text(function(a){return a}),a}o.selectAll(".nv-noData").remove();var C=c.filter(function(a){return!a.disabled&&a.bar}),D=c.filter(function(a){return!a.bar});b=D.filter(function(a){return!a.disabled}).length&&D.filter(function(a){return!a.disabled})[0].values.length?f.xScale():g.xScale(),d=g.yScale(),e=f.yScale();var E=d3.select(this).selectAll("g.nv-wrap.nv-linePlusBar").data([c]),F=E.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g"),G=E.select("g");F.append("g").attr("class","nv-x nv-axis"),F.append("g").attr("class","nv-y1 nv-axis"),F.append("g").attr("class","nv-y2 nv-axis"),F.append("g").attr("class","nv-barsWrap"),F.append("g").attr("class","nv-linesWrap"),F.append("g").attr("class","nv-legendWrap"),r&&(k.width(t/2),G.select(".nv-legendWrap").datum(c.map(function(a){return a.originalKey=void 0===a.originalKey?a.key:a.originalKey,a.key=a.originalKey+(a.bar?" (left axis)":" (right axis)"),a})).call(k),l.top!=k.height()&&(l.top=k.height(),z=(n||parseInt(o.style("height"))||400)-l.top-l.bottom),G.select(".nv-legendWrap").attr("transform","translate("+t/2+","+-l.top+")")),E.attr("transform","translate("+l.left+","+l.top+")"),f.width(t).height(z).color(c.map(function(a,b){return a.color||q(a,b)}).filter(function(a,b){return!c[b].disabled&&!c[b].bar})),g.width(t).height(z).color(c.map(function(a,b){return a.color||q(a,b)}).filter(function(a,b){return!c[b].disabled&&c[b].bar}));var H=G.select(".nv-barsWrap").datum(C.length?C:[{values:[]}]),I=G.select(".nv-linesWrap").datum(D[0]&&!D[0].disabled?D:[{values:[]}]);d3.transition(H).call(g),d3.transition(I).call(f),h.scale(b).ticks(t/100).tickSize(-z,0),G.select(".nv-x.nv-axis").attr("transform","translate(0,"+d.range()[0]+")"),d3.transition(G.select(".nv-x.nv-axis")).call(h),i.scale(d).ticks(z/36).tickSize(-t,0),d3.transition(G.select(".nv-y1.nv-axis")).style("opacity",C.length?1:0).call(i),j.scale(e).ticks(z/36).tickSize(C.length?0:-t,0),G.select(".nv-y2.nv-axis").style("opacity",D.length?1:0).attr("transform","translate("+t+",0)"),d3.transition(G.select(".nv-y2.nv-axis")).call(j),k.dispatch.on("stateChange",function(b){u=b,x.stateChange(u),a.update()}),x.on("tooltipShow",function(a){s&&y(a,p.parentNode)}),x.on("changeState",function(b){"undefined"!=typeof b.disabled&&(c.forEach(function(a,c){a.disabled=b.disabled[c]}),u.disabled=b.disabled),a.update()})}),a}var b,d,e,f=c.models.line(),g=c.models.historicalBar(),h=c.models.axis(),i=c.models.axis(),j=c.models.axis(),k=c.models.legend(),l={top:30,right:60,bottom:50,left:60},m=null,n=null,o=function(a){return a.x},p=function(a){return a.y},q=c.utils.defaultColor(),r=!0,s=!0,t=function(a,b,c,d,e){return"<h3>"+a+"</h3><p>"+c+" at "+b+"</p>"},u={},v=null,w="No Data Available.",x=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState");g.padData(!0),f.clipEdge(!1).padData(!0),h.orient("bottom").tickPadding(7).highlightZero(!1),i.orient("left"),j.orient("right");var y=function(b,d){var e=b.pos[0]+(d.offsetLeft||0),g=b.pos[1]+(d.offsetTop||0),k=h.tickFormat()(f.x()(b.point,b.pointIndex)),l=(b.series.bar?i:j).tickFormat()(f.y()(b.point,b.pointIndex)),m=t(b.series.key,k,l,b,a);c.tooltip.show([e,g],m,b.value<0?"n":"s",null,d)};return f.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+l.left,a.pos[1]+l.top],x.tooltipShow(a)}),f.dispatch.on("elementMouseout.tooltip",function(a){x.tooltipHide(a)}),g.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+l.left,a.pos[1]+l.top],x.tooltipShow(a)}),g.dispatch.on("elementMouseout.tooltip",function(a){x.tooltipHide(a)}),x.on("tooltipHide",function(){s&&c.tooltip.cleanup()}),a.dispatch=x,a.legend=k,a.lines=f,a.bars=g,a.xAxis=h,a.y1Axis=i,a.y2Axis=j,d3.rebind(a,f,"defined","size","clipVoronoi","interpolate"),a.options=c.utils.optionsFunc.bind(a),a.x=function(b){return arguments.length?(o=b,f.x(b),g.x(b),a):o},a.y=function(b){return arguments.length?(p=b,f.y(b),g.y(b),a):p},a.margin=function(b){return arguments.length?(l.top="undefined"!=typeof b.top?b.top:l.top,l.right="undefined"!=typeof b.right?b.right:l.right,l.bottom="undefined"!=typeof b.bottom?b.bottom:l.bottom,l.left="undefined"!=typeof b.left?b.left:l.left,a):l},a.width=function(b){return arguments.length?(m=b,a):m},a.height=function(b){return arguments.length?(n=b,a):n},a.color=function(b){return arguments.length?(q=c.utils.getColor(b),k.color(q),a):q},a.showLegend=function(b){return arguments.length?(r=b,a):r},a.tooltips=function(b){return arguments.length?(s=b,a):s},a.tooltipContent=function(b){return arguments.length?(t=b,a):t},a.state=function(b){return arguments.length?(u=b,a):u},a.defaultState=function(b){return arguments.length?(v=b,a):v},a.noData=function(b){return arguments.length?(w=b,a):w},a},c.models.lineWithFocusChart=function(){"use strict";function a(c){return c.each(function(c){function x(a){var b=+("e"==a),c=b?1:-1,d=I/3;return"M"+.5*c+","+d+"A6,6 0 0 "+b+" "+6.5*c+","+(d+6)+"V"+(2*d-6)+"A6,6 0 0 "+b+" "+.5*c+","+2*d+"ZM"+2.5*c+","+(d+8)+"V"+(2*d-8)+"M"+4.5*c+","+(d+8)+"V"+(2*d-8)}function C(){n.empty()||n.extent(v),Q.data([n.empty()?e.domain():v]).each(function(a,c){var d=e(a[0])-b.range()[0],f=b.range()[1]-e(a[1]);d3.select(this).select(".left").attr("width",0>d?0:d),d3.select(this).select(".right").attr("x",e(a[1])).attr("width",0>f?0:f)})}function D(){v=n.empty()?null:n.extent();var a=n.empty()?e.domain():n.extent();if(!(Math.abs(a[0]-a[1])<=1)){z.brush({extent:a,brush:n}),C();var b=M.select(".nv-focus .nv-linesWrap").datum(c.filter(function(a){return!a.disabled}).map(function(b,c){return{key:b.key,values:b.values.filter(function(b,c){return g.x()(b,c)>=a[0]&&g.x()(b,c)<=a[1]})}}));b.transition().duration(A).call(g),M.select(".nv-focus .nv-x.nv-axis").transition().duration(A).call(i),M.select(".nv-focus .nv-y.nv-axis").transition().duration(A).call(j)}}var E=d3.select(this),F=this,G=(r||parseInt(E.style("width"))||960)-o.left-o.right,H=(s||parseInt(E.style("height"))||400)-o.top-o.bottom-t,I=t-p.top-p.bottom;if(a.update=function(){E.transition().duration(A).call(a)},a.container=this,!(c&&c.length&&c.filter(function(a){return a.values.length}).length)){var J=E.selectAll(".nv-noData").data([y]);return J.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),J.attr("x",o.left+G/2).attr("y",o.top+H/2).text(function(a){return a}),a}E.selectAll(".nv-noData").remove(),b=g.xScale(),d=g.yScale(),e=h.xScale(),f=h.yScale();var K=E.selectAll("g.nv-wrap.nv-lineWithFocusChart").data([c]),L=K.enter().append("g").attr("class","nvd3 nv-wrap nv-lineWithFocusChart").append("g"),M=K.select("g");L.append("g").attr("class","nv-legendWrap");var N=L.append("g").attr("class","nv-focus");N.append("g").attr("class","nv-x nv-axis"),N.append("g").attr("class","nv-y nv-axis"),N.append("g").attr("class","nv-linesWrap");var O=L.append("g").attr("class","nv-context");O.append("g").attr("class","nv-x nv-axis"),O.append("g").attr("class","nv-y nv-axis"),O.append("g").attr("class","nv-linesWrap"),O.append("g").attr("class","nv-brushBackground"),O.append("g").attr("class","nv-x nv-brush"),u&&(m.width(G),M.select(".nv-legendWrap").datum(c).call(m),o.top!=m.height()&&(o.top=m.height(),H=(s||parseInt(E.style("height"))||400)-o.top-o.bottom-t),M.select(".nv-legendWrap").attr("transform","translate(0,"+-o.top+")")),K.attr("transform","translate("+o.left+","+o.top+")"),g.width(G).height(H).color(c.map(function(a,b){return a.color||q(a,b)}).filter(function(a,b){return!c[b].disabled})),h.defined(g.defined()).width(G).height(I).color(c.map(function(a,b){return a.color||q(a,b)}).filter(function(a,b){return!c[b].disabled})),M.select(".nv-context").attr("transform","translate(0,"+(H+o.bottom+p.top)+")");var P=M.select(".nv-context .nv-linesWrap").datum(c.filter(function(a){return!a.disabled}));d3.transition(P).call(h),i.scale(b).ticks(G/100).tickSize(-H,0),j.scale(d).ticks(H/36).tickSize(-G,0),M.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+H+")"),n.x(e).on("brush",function(){var b=a.transitionDuration();a.transitionDuration(0),D(),a.transitionDuration(b)}),v&&n.extent(v);var Q=M.select(".nv-brushBackground").selectAll("g").data([v||n.extent()]),R=Q.enter().append("g");R.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",I),R.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",I);var S=M.select(".nv-x.nv-brush").call(n);S.selectAll("rect").attr("height",I),S.selectAll(".resize").append("path").attr("d",x),D(),k.scale(e).ticks(G/100).tickSize(-I,0),M.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+f.range()[0]+")"),d3.transition(M.select(".nv-context .nv-x.nv-axis")).call(k),l.scale(f).ticks(I/36).tickSize(-G,0),d3.transition(M.select(".nv-context .nv-y.nv-axis")).call(l),M.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+f.range()[0]+")"),m.dispatch.on("stateChange",function(b){a.update()}),z.on("tooltipShow",function(a){w&&B(a,F.parentNode)})}),a}var b,d,e,f,g=c.models.line(),h=c.models.line(),i=c.models.axis(),j=c.models.axis(),k=c.models.axis(),l=c.models.axis(),m=c.models.legend(),n=d3.svg.brush(),o={top:30,right:30,bottom:30,left:60},p={top:0,right:30,bottom:20,left:60},q=c.utils.defaultColor(),r=null,s=null,t=100,u=!0,v=null,w=!0,x=function(a,b,c,d,e){return"<h3>"+a+"</h3><p>"+c+" at "+b+"</p>"},y="No Data Available.",z=d3.dispatch("tooltipShow","tooltipHide","brush"),A=250;g.clipEdge(!0),h.interactive(!1),i.orient("bottom").tickPadding(5),j.orient("left"),k.orient("bottom").tickPadding(5),l.orient("left");var B=function(b,d){var e=b.pos[0]+(d.offsetLeft||0),f=b.pos[1]+(d.offsetTop||0),h=i.tickFormat()(g.x()(b.point,b.pointIndex)),k=j.tickFormat()(g.y()(b.point,b.pointIndex)),l=x(b.series.key,h,k,b,a);c.tooltip.show([e,f],l,null,null,d)};return g.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+o.left,a.pos[1]+o.top],z.tooltipShow(a)}),g.dispatch.on("elementMouseout.tooltip",function(a){z.tooltipHide(a)}),z.on("tooltipHide",function(){w&&c.tooltip.cleanup()}),a.dispatch=z,a.legend=m,a.lines=g,a.lines2=h,a.xAxis=i,a.yAxis=j,a.x2Axis=k,a.y2Axis=l,d3.rebind(a,g,"defined","isArea","size","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","id"),a.options=c.utils.optionsFunc.bind(a),a.x=function(b){return arguments.length?(g.x(b),h.x(b),a):g.x},a.y=function(b){return arguments.length?(g.y(b),h.y(b),a):g.y},a.margin=function(b){return arguments.length?(o.top="undefined"!=typeof b.top?b.top:o.top,o.right="undefined"!=typeof b.right?b.right:o.right,o.bottom="undefined"!=typeof b.bottom?b.bottom:o.bottom,o.left="undefined"!=typeof b.left?b.left:o.left,a):o},a.margin2=function(b){return arguments.length?(p=b,a):p},a.width=function(b){return arguments.length?(r=b,a):r},a.height=function(b){return arguments.length?(s=b,a):s},a.height2=function(b){return arguments.length?(t=b,a):t},a.color=function(b){return arguments.length?(q=c.utils.getColor(b),m.color(q),a):q},a.showLegend=function(b){return arguments.length?(u=b,a):u},a.tooltips=function(b){return arguments.length?(w=b,a):w},a.tooltipContent=function(b){return arguments.length?(x=b,a):x},a.interpolate=function(b){return arguments.length?(g.interpolate(b),h.interpolate(b),a):g.interpolate()},a.noData=function(b){return arguments.length?(y=b,a):y},a.xTickFormat=function(b){return arguments.length?(i.tickFormat(b),k.tickFormat(b),a):i.tickFormat()},a.yTickFormat=function(b){return arguments.length?(j.tickFormat(b),l.tickFormat(b),a):j.tickFormat()},a.brushExtent=function(b){return arguments.length?(v=b,a):v},a.transitionDuration=function(b){return arguments.length?(A=b,a):A},a},c.models.linePlusBarWithFocusChart=function(){"use strict";function a(c){return c.each(function(c){function G(a){var b=+("e"==a),c=b?1:-1,d=R/3;return"M"+.5*c+","+d+"A6,6 0 0 "+b+" "+6.5*c+","+(d+6)+"V"+(2*d-6)+"A6,6 0 0 "+b+" "+.5*c+","+2*d+"ZM"+2.5*c+","+(d+8)+"V"+(2*d-8)+"M"+4.5*c+","+(d+8)+"V"+(2*d-8)}function L(){u.empty()||u.extent(E),ca.data([u.empty()?e.domain():E]).each(function(a,b){var c=e(a[0])-e.range()[0],d=e.range()[1]-e(a[1]);d3.select(this).select(".left").attr("width",0>c?0:c),d3.select(this).select(".right").attr("x",e(a[1])).attr("width",0>d?0:d)})}function M(){E=u.empty()?null:u.extent(),b=u.empty()?e.domain():u.extent(),I.brush({extent:b,brush:u}),L(),l.width(P).height(Q).color(c.map(function(a,b){return a.color||C(a,b)}).filter(function(a,b){return!c[b].disabled&&c[b].bar})),j.width(P).height(Q).color(c.map(function(a,b){return a.color||C(a,b)}).filter(function(a,b){return!c[b].disabled&&!c[b].bar}));var a=Z.select(".nv-focus .nv-barsWrap").datum(T.length?T.map(function(a,c){return{key:a.key,values:a.values.filter(function(a,c){return l.x()(a,c)>=b[0]&&l.x()(a,c)<=b[1]})}}):[{values:[]}]),h=Z.select(".nv-focus .nv-linesWrap").datum(U[0].disabled?[{values:[]}]:U.map(function(a,c){return{key:a.key,values:a.values.filter(function(a,c){return j.x()(a,c)>=b[0]&&j.x()(a,c)<=b[1]})}}));d=T.length?l.xScale():j.xScale(),n.scale(d).ticks(P/100).tickSize(-Q,0),n.domain([Math.ceil(b[0]),Math.floor(b[1])]),Z.select(".nv-x.nv-axis").transition().duration(J).call(n),a.transition().duration(J).call(l),h.transition().duration(J).call(j),Z.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+f.range()[0]+")"),p.scale(f).ticks(Q/36).tickSize(-P,0),Z.select(".nv-focus .nv-y1.nv-axis").style("opacity",T.length?1:0),q.scale(g).ticks(Q/36).tickSize(T.length?0:-P,0),Z.select(".nv-focus .nv-y2.nv-axis").style("opacity",U.length?1:0).attr("transform","translate("+d.range()[1]+",0)"),Z.select(".nv-focus .nv-y1.nv-axis").transition().duration(J).call(p),Z.select(".nv-focus .nv-y2.nv-axis").transition().duration(J).call(q)}var N=d3.select(this),O=this,P=(x||parseInt(N.style("width"))||960)-v.left-v.right,Q=(y||parseInt(N.style("height"))||400)-v.top-v.bottom-z,R=z-w.top-w.bottom;if(a.update=function(){N.transition().duration(J).call(a)},a.container=this,!(c&&c.length&&c.filter(function(a){return a.values.length}).length)){var S=N.selectAll(".nv-noData").data([H]);return S.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),S.attr("x",v.left+P/2).attr("y",v.top+Q/2).text(function(a){return a}),a}N.selectAll(".nv-noData").remove();var T=c.filter(function(a){return!a.disabled&&a.bar}),U=c.filter(function(a){return!a.bar});d=l.xScale(),e=o.scale(),f=l.yScale(),g=j.yScale(),h=m.yScale(),i=k.yScale();var V=c.filter(function(a){return!a.disabled&&a.bar}).map(function(a){return a.values.map(function(a,b){return{x:A(a,b),y:B(a,b)}})}),W=c.filter(function(a){return!a.disabled&&!a.bar}).map(function(a){return a.values.map(function(a,b){return{x:A(a,b),y:B(a,b)}})});d.range([0,P]),e.domain(d3.extent(d3.merge(V.concat(W)),function(a){return a.x})).range([0,P]);var X=N.selectAll("g.nv-wrap.nv-linePlusBar").data([c]),Y=X.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g"),Z=X.select("g");Y.append("g").attr("class","nv-legendWrap");var $=Y.append("g").attr("class","nv-focus");$.append("g").attr("class","nv-x nv-axis"),$.append("g").attr("class","nv-y1 nv-axis"),$.append("g").attr("class","nv-y2 nv-axis"),$.append("g").attr("class","nv-barsWrap"),$.append("g").attr("class","nv-linesWrap");var _=Y.append("g").attr("class","nv-context");_.append("g").attr("class","nv-x nv-axis"),_.append("g").attr("class","nv-y1 nv-axis"),_.append("g").attr("class","nv-y2 nv-axis"),_.append("g").attr("class","nv-barsWrap"),_.append("g").attr("class","nv-linesWrap"),_.append("g").attr("class","nv-brushBackground"),_.append("g").attr("class","nv-x nv-brush"),D&&(t.width(P/2),Z.select(".nv-legendWrap").datum(c.map(function(a){return a.originalKey=void 0===a.originalKey?a.key:a.originalKey,a.key=a.originalKey+(a.bar?" (left axis)":" (right axis)"),a})).call(t),v.top!=t.height()&&(v.top=t.height(),Q=(y||parseInt(N.style("height"))||400)-v.top-v.bottom-z),Z.select(".nv-legendWrap").attr("transform","translate("+P/2+","+-v.top+")")),X.attr("transform","translate("+v.left+","+v.top+")"),m.width(P).height(R).color(c.map(function(a,b){return a.color||C(a,b)}).filter(function(a,b){return!c[b].disabled&&c[b].bar})),k.width(P).height(R).color(c.map(function(a,b){return a.color||C(a,b)}).filter(function(a,b){return!c[b].disabled&&!c[b].bar}));var aa=Z.select(".nv-context .nv-barsWrap").datum(T.length?T:[{values:[]}]),ba=Z.select(".nv-context .nv-linesWrap").datum(U[0].disabled?[{values:[]}]:U);Z.select(".nv-context").attr("transform","translate(0,"+(Q+v.bottom+w.top)+")"),aa.transition().call(m),ba.transition().call(k),u.x(e).on("brush",M),E&&u.extent(E);var ca=Z.select(".nv-brushBackground").selectAll("g").data([E||u.extent()]),da=ca.enter().append("g");da.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",R),da.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",R);var ea=Z.select(".nv-x.nv-brush").call(u);ea.selectAll("rect").attr("height",R),ea.selectAll(".resize").append("path").attr("d",G),o.ticks(P/100).tickSize(-R,0),Z.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+h.range()[0]+")"),Z.select(".nv-context .nv-x.nv-axis").transition().call(o),r.scale(h).ticks(R/36).tickSize(-P,0),Z.select(".nv-context .nv-y1.nv-axis").style("opacity",T.length?1:0).attr("transform","translate(0,"+e.range()[0]+")"),Z.select(".nv-context .nv-y1.nv-axis").transition().call(r),s.scale(i).ticks(R/36).tickSize(T.length?0:-P,0),Z.select(".nv-context .nv-y2.nv-axis").style("opacity",U.length?1:0).attr("transform","translate("+e.range()[1]+",0)"),Z.select(".nv-context .nv-y2.nv-axis").transition().call(s),t.dispatch.on("stateChange",function(b){a.update()}),I.on("tooltipShow",function(a){F&&K(a,O.parentNode)}),M()}),a}var b,d,e,f,g,h,i,j=c.models.line(),k=c.models.line(),l=c.models.historicalBar(),m=c.models.historicalBar(),n=c.models.axis(),o=c.models.axis(),p=c.models.axis(),q=c.models.axis(),r=c.models.axis(),s=c.models.axis(),t=c.models.legend(),u=d3.svg.brush(),v={top:30,right:30,bottom:30,left:60},w={top:0,right:30,bottom:20,left:60},x=null,y=null,z=100,A=function(a){return a.x},B=function(a){return a.y},C=c.utils.defaultColor(),D=!0,E=null,F=!0,G=function(a,b,c,d,e){return"<h3>"+a+"</h3><p>"+c+" at "+b+"</p>"},H="No Data Available.",I=d3.dispatch("tooltipShow","tooltipHide","brush"),J=0;j.clipEdge(!0),k.interactive(!1),n.orient("bottom").tickPadding(5),p.orient("left"),q.orient("right"),o.orient("bottom").tickPadding(5),r.orient("left"),s.orient("right");var K=function(d,e){b&&(d.pointIndex+=Math.ceil(b[0]));var f=d.pos[0]+(e.offsetLeft||0),g=d.pos[1]+(e.offsetTop||0),h=n.tickFormat()(j.x()(d.point,d.pointIndex)),i=(d.series.bar?p:q).tickFormat()(j.y()(d.point,d.pointIndex)),k=G(d.series.key,h,i,d,a);c.tooltip.show([f,g],k,d.value<0?"n":"s",null,e)};return j.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+v.left,a.pos[1]+v.top],I.tooltipShow(a)}),j.dispatch.on("elementMouseout.tooltip",function(a){I.tooltipHide(a)}),l.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+v.left,a.pos[1]+v.top],I.tooltipShow(a)}),l.dispatch.on("elementMouseout.tooltip",function(a){I.tooltipHide(a)}),I.on("tooltipHide",function(){F&&c.tooltip.cleanup()}),a.dispatch=I,a.legend=t,a.lines=j,a.lines2=k,a.bars=l,a.bars2=m,a.xAxis=n,a.x2Axis=o,a.y1Axis=p,a.y2Axis=q,a.y3Axis=r,a.y4Axis=s,d3.rebind(a,j,"defined","size","clipVoronoi","interpolate"),a.options=c.utils.optionsFunc.bind(a),a.x=function(b){return arguments.length?(A=b,j.x(b),l.x(b),a):A},a.y=function(b){return arguments.length?(B=b,j.y(b),l.y(b),a):B},a.margin=function(b){return arguments.length?(v.top="undefined"!=typeof b.top?b.top:v.top,v.right="undefined"!=typeof b.right?b.right:v.right,v.bottom="undefined"!=typeof b.bottom?b.bottom:v.bottom,v.left="undefined"!=typeof b.left?b.left:v.left,a):v},a.width=function(b){return arguments.length?(x=b,a):x},a.height=function(b){return arguments.length?(y=b,a):y},a.color=function(b){return arguments.length?(C=c.utils.getColor(b),t.color(C),a):C},a.showLegend=function(b){return arguments.length?(D=b,a):D},a.tooltips=function(b){return arguments.length?(F=b,a):F},a.tooltipContent=function(b){return arguments.length?(G=b,a):G},a.noData=function(b){return arguments.length?(H=b,a):H},a.brushExtent=function(b){return arguments.length?(E=b,a):E},a},c.models.multiBar=function(){"use strict";function a(c){return c.each(function(a){var c=k-j.left-j.right,B=l-j.top-j.bottom,C=d3.select(this);w&&a.length&&(w=[{values:a[0].values.map(function(a){return{x:a.x,y:0,series:a.series,size:.01}})}]),t&&(a=d3.layout.stack().offset(u).values(function(a){return a.values}).y(q)(!a.length&&w?w:a)),a.forEach(function(a,b){a.values.forEach(function(a){a.series=b})}),t&&a[0].values.map(function(b,c){var d=0,e=0;a.map(function(a){var b=a.values[c];b.size=Math.abs(b.y),b.y<0?(b.y1=e,e-=b.size):(b.y1=b.size+d,d+=b.size)})});var D=d&&e?[]:a.map(function(a){return a.values.map(function(a,b){return{x:p(a,b),y:q(a,b),y0:a.y0,y1:a.y1}})});m.domain(d||d3.merge(D).map(function(a){return a.x})).rangeBands(f||[0,c],z),n.domain(e||d3.extent(d3.merge(D).map(function(a){return t?a.y>0?a.y1:a.y1+a.y:a.y}).concat(r))).range(g||[B,0]),m.domain()[0]===m.domain()[1]&&(m.domain()[0]?m.domain([m.domain()[0]-.01*m.domain()[0],m.domain()[1]+.01*m.domain()[1]]):m.domain([-1,1])),n.domain()[0]===n.domain()[1]&&(n.domain()[0]?n.domain([n.domain()[0]+.01*n.domain()[0],n.domain()[1]-.01*n.domain()[1]]):n.domain([-1,1])),h=h||m,i=i||n;var E=C.selectAll("g.nv-wrap.nv-multibar").data([a]),F=E.enter().append("g").attr("class","nvd3 nv-wrap nv-multibar"),G=F.append("defs"),H=F.append("g"),I=E.select("g");H.append("g").attr("class","nv-groups"),E.attr("transform","translate("+j.left+","+j.top+")"),G.append("clipPath").attr("id","nv-edge-clip-"+o).append("rect"),E.select("#nv-edge-clip-"+o+" rect").attr("width",c).attr("height",B),
+/*! nvd3 - v0.0.1 - 2023-08-17 */!function(){function a(a,b){return new Date(b,a+1,0).getDate()}function b(a,b,c){return function(d,e,f){var g=a(d),h=[];if(d>g&&b(g),f>1)for(;e>g;){var i=new Date(+g);c(i)%f===0&&h.push(i),b(g)}else for(;e>g;)h.push(new Date(+g)),b(g);return h}}var c=window.nv||{};c.version="1.1.15b",c.dev=!0,window.nv=c,c.tooltip=c.tooltip||{},c.utils=c.utils||{},c.models=c.models||{},c.charts={},c.graphs=[],c.logs={},c.dispatch=d3.dispatch("render_start","render_end"),c.dev&&(c.dispatch.on("render_start",function(a){c.logs.startTime=+new Date}),c.dispatch.on("render_end",function(a){c.logs.endTime=+new Date,c.logs.totalTime=c.logs.endTime-c.logs.startTime,c.log("total",c.logs.totalTime)})),c.log=function(){if(c.dev&&console.log&&console.log.apply)console.log.apply(console,arguments);else if(c.dev&&"function"==typeof console.log&&Function.prototype.bind){var a=Function.prototype.bind.call(console.log,console);a.apply(console,arguments)}return arguments[arguments.length-1]},c.render=function(a){a=a||1,c.render.active=!0,c.dispatch.render_start(),setTimeout(function(){for(var b,d,e=0;a>e&&(d=c.render.queue[e]);e++)b=d.generate(),typeof d.callback==typeof Function&&d.callback(b),c.graphs.push(b);c.render.queue.splice(0,e),c.render.queue.length?setTimeout(arguments.callee,0):(c.dispatch.render_end(),c.render.active=!1)},0)},c.render.active=!1,c.render.queue=[],c.addGraph=function(a){typeof arguments[0]==typeof Function&&(a={generate:arguments[0],callback:arguments[1]}),c.render.queue.push(a),c.render.active||c.render()},c.identity=function(a){return a},c.strip=function(a){return a.replace(/(\s|&)/g,"")},d3.time.monthEnd=function(a){return new Date(a.getFullYear(),a.getMonth(),0)},d3.time.monthEnds=b(d3.time.monthEnd,function(b){b.setUTCDate(b.getUTCDate()+1),b.setDate(a(b.getMonth()+1,b.getFullYear()))},function(a){return a.getMonth()}),c.interactiveGuideline=function(){"use strict";function a(l){l.each(function(l){function m(){var c=d3.mouse(this),d=c[0],e=c[1],i=!0,j=!1;if(k&&(d=d3.event.offsetX,e=d3.event.offsetY,"svg"!==d3.event.target.tagName&&(i=!1),d3.event.target.className.baseVal.match("nv-legend")&&(j=!0)),i&&(d-=f.left,e-=f.top),0>d||0>e||d>o||e>p||d3.event.relatedTarget&&void 0===d3.event.relatedTarget.ownerSVGElement||j){if(k&&d3.event.relatedTarget&&void 0===d3.event.relatedTarget.ownerSVGElement&&d3.event.relatedTarget.className.match(b.nvPointerEventsClass))return;return h.elementMouseout({mouseX:d,mouseY:e}),void a.renderGuideLine(null)}var l=g.invert(d);h.elementMousemove({mouseX:d,mouseY:e,pointXValue:l}),"dblclick"===d3.event.type&&h.elementDblclick({mouseX:d,mouseY:e,pointXValue:l})}var n=d3.select(this),o=d||960,p=e||400,q=n.selectAll("g.nv-wrap.nv-interactiveLineLayer").data([l]),r=q.enter().append("g").attr("class"," nv-wrap nv-interactiveLineLayer");r.append("g").attr("class","nv-interactiveGuideLine"),j&&(j.on("mousemove",m,!0).on("mouseout",m,!0).on("dblclick",m),a.renderGuideLine=function(a){if(i){var b=q.select(".nv-interactiveGuideLine").selectAll("line").data(null!=a?[c.utils.NaNtoZero(a)]:[],String);b.enter().append("line").attr("class","nv-guideline").attr("x1",function(a){return a}).attr("x2",function(a){return a}).attr("y1",p).attr("y2",0),b.exit().remove()}})})}var b=c.models.tooltip(),d=null,e=null,f={left:0,top:0},g=d3.scale.linear(),h=(d3.scale.linear(),d3.dispatch("elementMousemove","elementMouseout","elementDblclick")),i=!0,j=null,k=-1!==navigator.userAgent.indexOf("MSIE");return a.dispatch=h,a.tooltip=b,a.margin=function(b){return arguments.length?(f.top="undefined"!=typeof b.top?b.top:f.top,f.left="undefined"!=typeof b.left?b.left:f.left,a):f},a.width=function(b){return arguments.length?(d=b,a):d},a.height=function(b){return arguments.length?(e=b,a):e},a.xScale=function(b){return arguments.length?(g=b,a):g},a.showGuideLine=function(b){return arguments.length?(i=b,a):i},a.svgContainer=function(b){return arguments.length?(j=b,a):j},a},c.interactiveBisect=function(a,b,c){"use strict";if(!a instanceof Array)return null;"function"!=typeof c&&(c=function(a,b){return a.x});var d=d3.bisector(c).left,e=d3.max([0,d(a,b)-1]),f=c(a[e],e);if("undefined"==typeof f&&(f=e),f===b)return e;var g=d3.min([e+1,a.length-1]),h=c(a[g],g);return"undefined"==typeof h&&(h=g),Math.abs(h-b)>=Math.abs(f-b)?e:g},c.nearestValueIndex=function(a,b,c){"use strict";var d=1/0,e=null;return a.forEach(function(a,f){var g=Math.abs(b-a);d>=g&&c>g&&(d=g,e=f)}),e},function(){"use strict";window.nv.tooltip={},window.nv.models.tooltip=function(){function a(){if(l){var a=d3.select(l);"svg"!==a.node().tagName&&(a=a.select("svg"));var b=a.node()?a.attr("viewBox"):null;if(b){b=b.split(" ");var c=parseInt(a.style("width"))/b[2];n.left=n.left*c,n.top=n.top*c}}}function b(a){var b;b=l?d3.select(l):d3.select("body");var c=b.select(".nvtooltip");return null===c.node()&&(c=b.append("div").attr("class","nvtooltip "+(k?k:"xy-tooltip")).attr("id",p)),c.node().innerHTML=a,c.style("top",0).style("left",0).style("opacity",0),c.selectAll("div, table, td, tr").classed(q,!0),c.classed(q,!0),c.node()}function d(){if(o&&u(f)){a();var e=n.left,k=null!=j?j:n.top,p=b(t(f));if(m=p,l){var q=l.getElementsByTagName("svg")[0],r=(q?q.getBoundingClientRect():l.getBoundingClientRect(),{left:0,top:0});if(q){var s=q.getBoundingClientRect(),v=l.getBoundingClientRect(),w=s.top;if(0>w){var x=l.getBoundingClientRect();w=Math.abs(w)>x.height?0:w}r.top=Math.abs(w-v.top),r.left=Math.abs(s.left-v.left)}e+=l.offsetLeft+r.left-2*l.scrollLeft,k+=l.offsetTop+r.top-2*l.scrollTop}return i&&i>0&&(k=Math.floor(k/i)*i),c.tooltip.calcTooltipPosition([e,k],g,h,p),d}}var e=null,f=null,g="w",h=50,i=25,j=null,k=null,l=null,m=null,n={left:null,top:null},o=!0,p="nvtooltip-"+Math.floor(1e5*Math.random()),q="nv-pointer-events-none",r=function(a,b){return a},s=function(a){return a},t=function(a){if(null!=e)return e;if(null==a)return"";var b=d3.select(document.createElement("table")),c=b.selectAll("thead").data([a]).enter().append("thead");c.append("tr").append("td").attr("colspan",3).append("strong").classed("x-value",!0).html(s(a.value));var d=b.selectAll("tbody").data([a]).enter().append("tbody"),f=d.selectAll("tr").data(function(a){return a.series}).enter().append("tr").classed("highlight",function(a){return a.highlight});f.append("td").classed("legend-color-guide",!0).append("div").style("background-color",function(a){return a.color}),f.append("td").classed("key",!0).html(function(a){return a.key}),f.append("td").classed("value",!0).html(function(a,b){return r(a.value,b)}),f.selectAll("td").each(function(a){if(a.highlight){var b=d3.scale.linear().domain([0,1]).range(["#fff",a.color]),c=.6;d3.select(this).style("border-bottom-color",b(c)).style("border-top-color",b(c))}});var g=b.node().outerHTML;return void 0!==a.footer&&(g+="<div class='footer'>"+a.footer+"</div>"),g},u=function(a){return a&&a.series&&a.series.length>0?!0:!1};return d.nvPointerEventsClass=q,d.content=function(a){return arguments.length?(e=a,d):e},d.tooltipElem=function(){return m},d.contentGenerator=function(a){return arguments.length?("function"==typeof a&&(t=a),d):t},d.data=function(a){return arguments.length?(f=a,d):f},d.gravity=function(a){return arguments.length?(g=a,d):g},d.distance=function(a){return arguments.length?(h=a,d):h},d.snapDistance=function(a){return arguments.length?(i=a,d):i},d.classes=function(a){return arguments.length?(k=a,d):k},d.chartContainer=function(a){return arguments.length?(l=a,d):l},d.position=function(a){return arguments.length?(n.left="undefined"!=typeof a.left?a.left:n.left,n.top="undefined"!=typeof a.top?a.top:n.top,d):n},d.fixedTop=function(a){return arguments.length?(j=a,d):j},d.enabled=function(a){return arguments.length?(o=a,d):o},d.valueFormatter=function(a){return arguments.length?("function"==typeof a&&(r=a),d):r},d.headerFormatter=function(a){return arguments.length?("function"==typeof a&&(s=a),d):s},d.id=function(){return p},d},c.tooltip.show=function(a,b,d,e,f,g){var h=document.createElement("div");h.className="nvtooltip "+(g?g:"xy-tooltip");var i=f;(!f||f.tagName.match(/g|svg/i))&&(i=document.getElementsByTagName("body")[0]),h.style.left=0,h.style.top=0,h.style.opacity=0;var j=DOMPurify.sanitize(b,{RETURN_TRUSTED_TYPE:!0});h.innerHTML=j,i.appendChild(h),f&&(a[0]=a[0]-f.scrollLeft,a[1]=a[1]-f.scrollTop),c.tooltip.calcTooltipPosition(a,d,e,h)},c.tooltip.findFirstNonSVGParent=function(a){for(;null!==a.tagName.match(/^g|svg$/i);)a=a.parentNode;return a},c.tooltip.findTotalOffsetTop=function(a,b){var c=b;do isNaN(a.offsetTop)||(c+=a.offsetTop);while(a=a.offsetParent);return c},c.tooltip.findTotalOffsetLeft=function(a,b){var c=b;do isNaN(a.offsetLeft)||(c+=a.offsetLeft);while(a=a.offsetParent);return c},c.tooltip.calcTooltipPosition=function(a,b,d,e){var f,g,h=parseInt(e.offsetHeight),i=parseInt(e.offsetWidth),j=c.utils.windowSize().width,k=c.utils.windowSize().height,l=window.pageYOffset,m=window.pageXOffset;k=window.innerWidth>=document.body.scrollWidth?k:k-16,j=window.innerHeight>=document.body.scrollHeight?j:j-16,b=b||"s",d=d||20;var n=function(a){return c.tooltip.findTotalOffsetTop(a,g)},o=function(a){return c.tooltip.findTotalOffsetLeft(a,f)};switch(b){case"e":f=a[0]-i-d,g=a[1]-h/2;var p=o(e),q=n(e);m>p&&(f=a[0]+d>m?a[0]+d:m-p+f),l>q&&(g=l-q+g),q+h>l+k&&(g=l+k-q+g-h);break;case"w":f=a[0]+d,g=a[1]-h/2;var p=o(e),q=n(e);p+i>j&&(f=a[0]-i-d),l>q&&(g=l+5),q+h>l+k&&(g=l+k-q+g-h);break;case"n":f=a[0]-i/2-5,g=a[1]+d;var p=o(e),q=n(e);m>p&&(f=m+5),p+i>j&&(f=f-i/2+5),q+h>l+k&&(g=l+k-q+g-h);break;case"s":f=a[0]-i/2,g=a[1]-h-d;var p=o(e),q=n(e);m>p&&(f=m+5),p+i>j&&(f=f-i/2+5),l>q&&(g=l);break;case"none":f=a[0],g=a[1]-d;var p=o(e),q=n(e)}return e.style.left=f+"px",e.style.top=g+"px",e.style.opacity=1,e.style.position="absolute",e},c.tooltip.cleanup=function(){for(var a=document.getElementsByClassName("nvtooltip"),b=[];a.length;)b.push(a[0]),a[0].style.transitionDelay="0 !important",a[0].style.opacity=0,a[0].className="nvtooltip-pending-removal";setTimeout(function(){for(;b.length;){var a=b.pop();a.parentNode.removeChild(a)}},500)}}(),c.utils.windowSize=function(){var a={width:640,height:480};return document.body&&document.body.offsetWidth&&(a.width=document.body.offsetWidth,a.height=document.body.offsetHeight),"CSS1Compat"==document.compatMode&&document.documentElement&&document.documentElement.offsetWidth&&(a.width=document.documentElement.offsetWidth,a.height=document.documentElement.offsetHeight),window.innerWidth&&window.innerHeight&&(a.width=window.innerWidth,a.height=window.innerHeight),a},c.utils.windowResize=function(a){if(void 0!==a){var b=window.onresize;window.onresize=function(c){"function"==typeof b&&b(c),a(c)}}},c.utils.getColor=function(a){return arguments.length?"[object Array]"===Object.prototype.toString.call(a)?function(b,c){return b.color||a[c%a.length]}:a:c.utils.defaultColor()},c.utils.defaultColor=function(){var a=d3.scale.category20().range();return function(b,c){return b.color||a[c%a.length]}},c.utils.customTheme=function(a,b,c){b=b||function(a){return a.key},c=c||d3.scale.category20().range();var d=c.length;return function(e,f){var g=b(e);return d||(d=c.length),"undefined"!=typeof a[g]?"function"==typeof a[g]?a[g]():a[g]:c[--d]}},c.utils.pjax=function(a,b){function d(d){d3.html(d,function(d){var e=d3.select(b).node();e.parentNode.replaceChild(d3.select(d).select(b).node(),e),c.utils.pjax(a,b)})}d3.selectAll(a).on("click",function(){history.pushState(this.href,this.textContent,this.href),d(this.href),d3.event.preventDefault()}),d3.select(window).on("popstate",function(){d3.event.state&&d(d3.event.state)})},c.utils.calcApproxTextWidth=function(a){if("function"==typeof a.style&&"function"==typeof a.text){var b=parseInt(a.style("font-size").replace("px","")),c=a.text().length;return c*b*.5}return 0},c.utils.NaNtoZero=function(a){return"number"!=typeof a||isNaN(a)||null===a||a===1/0?0:a},c.utils.optionsFunc=function(a){return a&&d3.map(a).forEach(function(a,b){"function"==typeof this[a]&&this[a](b)}.bind(this)),this},c.models.axis=function(){"use strict";function a(c){return c.each(function(a){var c=d3.select(this),f=c.selectAll("g.nv-wrap.nv-axis").data([a]),r=f.enter().append("g").attr("class","nvd3 nv-wrap nv-axis"),s=(r.append("g"),f.select("g"));null!==o?b.ticks(o):("top"==b.orient()||"bottom"==b.orient())&&b.ticks(Math.abs(g.range()[1]-g.range()[0])/100),s.transition().call(b),q=q||b.scale();var t=b.tickFormat();null==t&&(t=q.tickFormat());var u=s.selectAll("text.nv-axislabel").data([h||null]);switch(u.exit().remove(),b.orient()){case"top":u.enter().append("text").attr("class","nv-axislabel");var v=2==g.range().length?g.range()[1]:g.range()[g.range().length-1]+(g.range()[1]-g.range()[0]);if(u.attr("text-anchor","middle").attr("y",0).attr("x",v/2),i){var w=f.selectAll("g.nv-axisMaxMin").data(g.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text"),w.exit().remove(),w.attr("transform",function(a,b){return"translate("+g(a)+",0)"}).select("text").attr("dy","-0.5em").attr("y",-b.tickPadding()).attr("text-anchor","middle").text(function(a,b){var c=t(a);return(""+c).match("NaN")?"":c}),w.transition().attr("transform",function(a,b){return"translate("+g.range()[b]+",0)"})}break;case"bottom":var x=36,y=30,z=s.selectAll("g").select("text");if(k%360){z.each(function(a,b){var c=this.getBBox().width;c>y&&(y=c)});var A=Math.abs(Math.sin(k*Math.PI/180)),x=(A?A*y:y)+30;z.attr("transform",function(a,b,c){return"rotate("+k+" 0,0)"}).style("text-anchor",k%360>0?"start":"end")}u.enter().append("text").attr("class","nv-axislabel");var v=2==g.range().length?g.range()[1]:g.range()[g.range().length-1]+(g.range()[1]-g.range()[0]);if(u.attr("text-anchor","middle").attr("y",x).attr("x",v/2),i){var w=f.selectAll("g.nv-axisMaxMin").data([g.domain()[0],g.domain()[g.domain().length-1]]);w.enter().append("g").attr("class","nv-axisMaxMin").append("text"),w.exit().remove(),w.attr("transform",function(a,b){return"translate("+(g(a)+(n?g.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",b.tickPadding()).attr("transform",function(a,b,c){return"rotate("+k+" 0,0)"}).style("text-anchor",k?k%360>0?"start":"end":"middle").text(function(a,b){var c=t(a);return(""+c).match("NaN")?"":c}),w.transition().attr("transform",function(a,b){return"translate("+(g(a)+(n?g.rangeBand()/2:0))+",0)"})}m&&z.attr("transform",function(a,b){return"translate(0,"+(b%2==0?"0":"12")+")"});break;case"right":if(u.enter().append("text").attr("class","nv-axislabel"),u.style("text-anchor",l?"middle":"begin").attr("transform",l?"rotate(90)":"").attr("y",l?-Math.max(d.right,e)+12:-10).attr("x",l?g.range()[0]/2:b.tickPadding()),i){var w=f.selectAll("g.nv-axisMaxMin").data(g.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),w.exit().remove(),w.attr("transform",function(a,b){return"translate(0,"+g(a)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",b.tickPadding()).style("text-anchor","start").text(function(a,b){var c=t(a);return(""+c).match("NaN")?"":c}),w.transition().attr("transform",function(a,b){return"translate(0,"+g.range()[b]+")"}).select("text").style("opacity",1)}break;case"left":if(u.enter().append("text").attr("class","nv-axislabel"),u.style("text-anchor",l?"middle":"end").attr("transform",l?"rotate(-90)":"").attr("y",l?-Math.max(d.left,e)+p:-10).attr("x",l?-g.range()[0]/2:-b.tickPadding()),i){var w=f.selectAll("g.nv-axisMaxMin").data(g.domain());w.enter().append("g").attr("class","nv-axisMaxMin").append("text").style("opacity",0),w.exit().remove(),w.attr("transform",function(a,b){return"translate(0,"+q(a)+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-b.tickPadding()).attr("text-anchor","end").text(function(a,b){var c=t(a);return(""+c).match("NaN")?"":c}),w.transition().attr("transform",function(a,b){return"translate(0,"+g.range()[b]+")"}).select("text").style("opacity",1)}}if(u.text(function(a){return a}),!i||"left"!==b.orient()&&"right"!==b.orient()||(s.selectAll("g").each(function(a,b){d3.select(this).select("text").attr("opacity",1),(g(a)<g.range()[1]+10||g(a)>g.range()[0]-10)&&((a>1e-10||-1e-10>a)&&d3.select(this).attr("opacity",0),d3.select(this).select("text").attr("opacity",0))}),g.domain()[0]==g.domain()[1]&&0==g.domain()[0]&&f.selectAll("g.nv-axisMaxMin").style("opacity",function(a,b){return b?0:1})),i&&("top"===b.orient()||"bottom"===b.orient())){var B=[];f.selectAll("g.nv-axisMaxMin").each(function(a,b){try{b?B.push(g(a)-this.getBBox().width-4):B.push(g(a)+this.getBBox().width+4)}catch(c){b?B.push(g(a)-4):B.push(g(a)+4)}}),s.selectAll("g").each(function(a,b){(g(a)<B[0]||g(a)>B[1])&&(a>1e-10||-1e-10>a?d3.select(this).remove():d3.select(this).select("text").remove())})}j&&s.selectAll(".tick").filter(function(a){return!parseFloat(Math.round(1e5*a.__data__)/1e6)&&void 0!==a.__data__}).classed("zero",!0),q=g.copy()}),a}var b=d3.svg.axis(),d={top:0,right:0,bottom:0,left:0},e=75,f=60,g=d3.scale.linear(),h=null,i=!0,j=!0,k=0,l=!0,m=!1,n=!1,o=null,p=12;b.scale(g).orient("bottom").tickFormat(function(a){return a});var q;return a.axis=b,d3.rebind(a,b,"orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat"),d3.rebind(a,g,"domain","range","rangeBand","rangeBands"),a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(d.top="undefined"!=typeof b.top?b.top:d.top,d.right="undefined"!=typeof b.right?b.right:d.right,d.bottom="undefined"!=typeof b.bottom?b.bottom:d.bottom,d.left="undefined"!=typeof b.left?b.left:d.left,a):d},a.width=function(b){return arguments.length?(e=b,a):e},a.ticks=function(b){return arguments.length?(o=b,a):o},a.height=function(b){return arguments.length?(f=b,a):f},a.axisLabel=function(b){return arguments.length?(h=b,a):h},a.showMaxMin=function(b){return arguments.length?(i=b,a):i},a.highlightZero=function(b){return arguments.length?(j=b,a):j},a.scale=function(c){return arguments.length?(g=c,b.scale(g),n="function"==typeof g.rangeBands,d3.rebind(a,g,"domain","range","rangeBand","rangeBands"),a):g},a.rotateYLabel=function(b){return arguments.length?(l=b,a):l},a.rotateLabels=function(b){return arguments.length?(k=b,a):k},a.staggerLabels=function(b){return arguments.length?(m=b,a):m},a.axisLabelDistance=function(b){return arguments.length?(p=b,a):p},a},c.models.historicalBar=function(){"use strict";function a(v){return v.each(function(a){var v=h-g.left-g.right,w=i-g.top-g.bottom,x=d3.select(this);k.domain(b||d3.extent(a[0].values.map(m).concat(o))),q?k.range(e||[.5*v/a[0].values.length,v*(a[0].values.length-.5)/a[0].values.length]):k.range(e||[0,v]),l.domain(d||d3.extent(a[0].values.map(n).concat(p))).range(f||[w,0]),k.domain()[0]===k.domain()[1]&&(k.domain()[0]?k.domain([k.domain()[0]-.01*k.domain()[0],k.domain()[1]+.01*k.domain()[1]]):k.domain([-1,1])),l.domain()[0]===l.domain()[1]&&(l.domain()[0]?l.domain([l.domain()[0]+.01*l.domain()[0],l.domain()[1]-.01*l.domain()[1]]):l.domain([-1,1]));var y=x.selectAll("g.nv-wrap.nv-historicalBar-"+j).data([a[0].values]),z=y.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBar-"+j),A=z.append("defs"),B=z.append("g"),C=y.select("g");B.append("g").attr("class","nv-bars"),y.attr("transform","translate("+g.left+","+g.top+")"),x.on("click",function(a,b){t.chartClick({data:a,index:b,pos:d3.event,id:j})}),A.append("clipPath").attr("id","nv-chart-clip-path-"+j).append("rect"),y.select("#nv-chart-clip-path-"+j+" rect").attr("width",v).attr("height",w),C.attr("clip-path",r?"url(#nv-chart-clip-path-"+j+")":"");var D=y.select(".nv-bars").selectAll(".nv-bar").data(function(a){return a},function(a,b){return m(a,b)});D.exit().remove();D.enter().append("rect").attr("x",0).attr("y",function(a,b){return c.utils.NaNtoZero(l(Math.max(0,n(a,b))))}).attr("height",function(a,b){return c.utils.NaNtoZero(Math.abs(l(n(a,b))-l(0)))}).attr("transform",function(b,c){return"translate("+(k(m(b,c))-v/a[0].values.length*.45)+",0)"}).on("mouseover",function(b,c){u&&(d3.select(this).classed("hover",!0),t.elementMouseover({point:b,series:a[0],pos:[k(m(b,c)),l(n(b,c))],pointIndex:c,seriesIndex:0,e:d3.event}))}).on("mouseout",function(b,c){u&&(d3.select(this).classed("hover",!1),t.elementMouseout({point:b,series:a[0],pointIndex:c,seriesIndex:0,e:d3.event}))}).on("click",function(a,b){u&&(t.elementClick({value:n(a,b),data:a,index:b,pos:[k(m(a,b)),l(n(a,b))],e:d3.event,id:j}),d3.event.stopPropagation())}).on("dblclick",function(a,b){u&&(t.elementDblClick({value:n(a,b),data:a,index:b,pos:[k(m(a,b)),l(n(a,b))],e:d3.event,id:j}),d3.event.stopPropagation())});D.attr("fill",function(a,b){return s(a,b)}).attr("class",function(a,b,c){return(n(a,b)<0?"nv-bar negative":"nv-bar positive")+" nv-bar-"+c+"-"+b}).transition().attr("transform",function(b,c){return"translate("+(k(m(b,c))-v/a[0].values.length*.45)+",0)"}).attr("width",v/a[0].values.length*.9),D.transition().attr("y",function(a,b){var d=n(a,b)<0?l(0):l(0)-l(n(a,b))<1?l(0)-1:l(n(a,b));return c.utils.NaNtoZero(d)}).attr("height",function(a,b){return c.utils.NaNtoZero(Math.max(Math.abs(l(n(a,b))-l(0)),1))})}),a}var b,d,e,f,g={top:0,right:0,bottom:0,left:0},h=960,i=500,j=Math.floor(1e4*Math.random()),k=d3.scale.linear(),l=d3.scale.linear(),m=function(a){return a.x},n=function(a){return a.y},o=[],p=[0],q=!1,r=!0,s=c.utils.defaultColor(),t=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),u=!0;return a.highlightPoint=function(a,b){d3.select(".nv-historicalBar-"+j).select(".nv-bars .nv-bar-0-"+a).classed("hover",b)},a.clearHighlights=function(){d3.select(".nv-historicalBar-"+j).select(".nv-bars .nv-bar.hover").classed("hover",!1)},a.dispatch=t,a.options=c.utils.optionsFunc.bind(a),a.x=function(b){return arguments.length?(m=b,a):m},a.y=function(b){return arguments.length?(n=b,a):n},a.margin=function(b){return arguments.length?(g.top="undefined"!=typeof b.top?b.top:g.top,g.right="undefined"!=typeof b.right?b.right:g.right,g.bottom="undefined"!=typeof b.bottom?b.bottom:g.bottom,g.left="undefined"!=typeof b.left?b.left:g.left,a):g},a.width=function(b){return arguments.length?(h=b,a):h},a.height=function(b){return arguments.length?(i=b,a):i},a.xScale=function(b){return arguments.length?(k=b,a):k},a.yScale=function(b){return arguments.length?(l=b,a):l},a.xDomain=function(c){return arguments.length?(b=c,a):b},a.yDomain=function(b){return arguments.length?(d=b,a):d},a.xRange=function(b){return arguments.length?(e=b,a):e},a.yRange=function(b){return arguments.length?(f=b,a):f},a.forceX=function(b){return arguments.length?(o=b,a):o},a.forceY=function(b){return arguments.length?(p=b,a):p},a.padData=function(b){return arguments.length?(q=b,a):q},a.clipEdge=function(b){return arguments.length?(r=b,a):r},a.color=function(b){return arguments.length?(s=c.utils.getColor(b),a):s},a.id=function(b){return arguments.length?(j=b,a):j},a.interactive=function(b){return arguments.length?(u=!1,a):u},a},c.models.bullet=function(){"use strict";function a(c){return c.each(function(a,c){var d=m-b.left-b.right,o=n-b.top-b.bottom,r=d3.select(this),s=f.call(this,a,c).slice().sort(d3.descending),t=g.call(this,a,c).slice().sort(d3.descending),u=h.call(this,a,c).slice().sort(d3.descending),v=i.call(this,a,c).slice(),w=j.call(this,a,c).slice(),x=k.call(this,a,c).slice(),y=d3.scale.linear().domain(d3.extent(d3.merge([l,s]))).range(e?[d,0]:[0,d]);this.__chart__||d3.scale.linear().domain([0,1/0]).range(y.range());this.__chart__=y;var z=d3.min(s),A=d3.max(s),B=s[1],C=r.selectAll("g.nv-wrap.nv-bullet").data([a]),D=C.enter().append("g").attr("class","nvd3 nv-wrap nv-bullet"),E=D.append("g"),F=C.select("g");E.append("rect").attr("class","nv-range nv-rangeMax"),E.append("rect").attr("class","nv-range nv-rangeAvg"),E.append("rect").attr("class","nv-range nv-rangeMin"),E.append("rect").attr("class","nv-measure"),E.append("path").attr("class","nv-markerTriangle"),C.attr("transform","translate("+b.left+","+b.top+")");var G=function(a){return Math.abs(y(a)-y(0))},H=function(a){return y(0>a?a:0)};F.select("rect.nv-rangeMax").attr("height",o).attr("width",G(A>0?A:z)).attr("x",H(A>0?A:z)).datum(A>0?A:z),F.select("rect.nv-rangeAvg").attr("height",o).attr("width",G(B)).attr("x",H(B)).datum(B),F.select("rect.nv-rangeMin").attr("height",o).attr("width",G(A)).attr("x",H(A)).attr("width",G(A>0?z:A)).attr("x",H(A>0?z:A)).datum(A>0?z:A),F.select("rect.nv-measure").style("fill",p).attr("height",o/3).attr("y",o/3).attr("width",0>u?y(0)-y(u[0]):y(u[0])-y(0)).attr("x",H(u)).on("mouseover",function(){q.elementMouseover({value:u[0],label:x[0]||"Current",pos:[y(u[0]),o/2]})}).on("mouseout",function(){q.elementMouseout({value:u[0],label:x[0]||"Current"})});var I=o/6;t[0]?F.selectAll("path.nv-markerTriangle").attr("transform",function(a){return"translate("+y(t[0])+","+o/2+")"}).attr("d","M0,"+I+"L"+I+","+-I+" "+-I+","+-I+"Z").on("mouseover",function(){q.elementMouseover({value:t[0],label:w[0]||"Previous",pos:[y(t[0]),o/2]})}).on("mouseout",function(){q.elementMouseout({value:t[0],label:w[0]||"Previous"})}):F.selectAll("path.nv-markerTriangle").remove(),C.selectAll(".nv-range").on("mouseover",function(a,b){var c=v[b]||(b?1==b?"Mean":"Minimum":"Maximum");q.elementMouseover({value:a,label:c,pos:[y(a),o/2]})}).on("mouseout",function(a,b){var c=v[b]||(b?1==b?"Mean":"Minimum":"Maximum");q.elementMouseout({value:a,label:c})})}),a}var b={top:0,right:0,bottom:0,left:0},d="left",e=!1,f=function(a){return a.ranges},g=function(a){return a.markers},h=function(a){return a.measures},i=function(a){return a.rangeLabels?a.rangeLabels:[]},j=function(a){return a.markerLabels?a.markerLabels:[]},k=function(a){return a.measureLabels?a.measureLabels:[]},l=[0],m=380,n=30,o=null,p=c.utils.getColor(["#1f77b4"]),q=d3.dispatch("elementMouseover","elementMouseout");return a.dispatch=q,a.options=c.utils.optionsFunc.bind(a),a.orient=function(b){return arguments.length?(d=b,e="right"==d||"bottom"==d,a):d},a.ranges=function(b){return arguments.length?(f=b,a):f},a.markers=function(b){return arguments.length?(g=b,a):g},a.measures=function(b){return arguments.length?(h=b,a):h},a.forceX=function(b){return arguments.length?(l=b,a):l},a.width=function(b){return arguments.length?(m=b,a):m},a.height=function(b){return arguments.length?(n=b,a):n},a.margin=function(c){return arguments.length?(b.top="undefined"!=typeof c.top?c.top:b.top,b.right="undefined"!=typeof c.right?c.right:b.right,b.bottom="undefined"!=typeof c.bottom?c.bottom:b.bottom,b.left="undefined"!=typeof c.left?c.left:b.left,a):b},a.tickFormat=function(b){return arguments.length?(o=b,a):o},a.color=function(b){return arguments.length?(p=c.utils.getColor(b),a):p},a},c.models.bulletChart=function(){"use strict";function a(c){return c.each(function(d,n){var r=d3.select(this),s=(j||parseInt(r.style("width"))||960)-f.left-f.right,t=k-f.top-f.bottom,u=this;if(a.update=function(){a(c)},a.container=this,!d||!g.call(this,d,n)){var v=r.selectAll(".nv-noData").data([o]);return v.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),v.attr("x",f.left+s/2).attr("y",18+f.top+t/2).text(function(a){return a}),a}r.selectAll(".nv-noData").remove();var w=g.call(this,d,n).slice().sort(d3.descending),x=h.call(this,d,n).slice().sort(d3.descending),y=i.call(this,d,n).slice().sort(d3.descending),z=r.selectAll("g.nv-wrap.nv-bulletChart").data([d]),A=z.enter().append("g").attr("class","nvd3 nv-wrap nv-bulletChart"),B=A.append("g"),C=z.select("g");B.append("g").attr("class","nv-bulletWrap"),B.append("g").attr("class","nv-titles"),z.attr("transform","translate("+f.left+","+f.top+")");var D=d3.scale.linear().domain([0,Math.max(w[0],x[0],y[0])]).range(e?[s,0]:[0,s]),E=this.__chart__||d3.scale.linear().domain([0,1/0]).range(D.range());this.__chart__=D;var F=B.select(".nv-titles").append("g").attr("text-anchor","end").attr("transform","translate(-6,"+(k-f.top-f.bottom)/2+")");F.append("text").attr("class","nv-title").text(function(a){return a.title}),F.append("text").attr("class","nv-subtitle").attr("dy","1em").text(function(a){return a.subtitle}),b.width(s).height(t);var G=C.select(".nv-bulletWrap");d3.transition(G).call(b);var H=l||D.tickFormat(s/100),I=C.selectAll("g.nv-tick").data(D.ticks(s/50),function(a){return this.textContent||H(a)}),J=I.enter().append("g").attr("class","nv-tick").attr("transform",function(a){return"translate("+E(a)+",0)"}).style("opacity",1e-6);J.append("line").attr("y1",t).attr("y2",7*t/6),J.append("text").attr("text-anchor","middle").attr("dy","1em").attr("y",7*t/6).text(H);var K=d3.transition(I).attr("transform",function(a){return"translate("+D(a)+",0)"}).style("opacity",1);K.select("line").attr("y1",t).attr("y2",7*t/6),K.select("text").attr("y",7*t/6),d3.transition(I.exit()).attr("transform",function(a){return"translate("+D(a)+",0)"}).style("opacity",1e-6).remove(),p.on("tooltipShow",function(a){a.key=d.title,m&&q(a,u.parentNode)})}),d3.timer.flush(),a}var b=c.models.bullet(),d="left",e=!1,f={top:5,right:40,bottom:20,left:120},g=function(a){return a.ranges},h=function(a){return a.markers},i=function(a){return a.measures},j=null,k=55,l=null,m=!0,n=function(a,b,c,d,e){return"<h3>"+b+"</h3><p>"+c+"</p>"},o="No Data Available.",p=d3.dispatch("tooltipShow","tooltipHide"),q=function(b,d){var e=b.pos[0]+(d.offsetLeft||0)+f.left,g=b.pos[1]+(d.offsetTop||0)+f.top,h=n(b.key,b.label,b.value,b,a);c.tooltip.show([e,g],h,b.value<0?"e":"w",null,d)};return b.dispatch.on("elementMouseover.tooltip",function(a){p.tooltipShow(a)}),b.dispatch.on("elementMouseout.tooltip",function(a){p.tooltipHide(a)}),p.on("tooltipHide",function(){m&&c.tooltip.cleanup()}),a.dispatch=p,a.bullet=b,d3.rebind(a,b,"color"),a.options=c.utils.optionsFunc.bind(a),a.orient=function(b){return arguments.length?(d=b,e="right"==d||"bottom"==d,a):d},a.ranges=function(b){return arguments.length?(g=b,a):g},a.markers=function(b){return arguments.length?(h=b,a):h},a.measures=function(b){return arguments.length?(i=b,a):i},a.width=function(b){return arguments.length?(j=b,a):j},a.height=function(b){return arguments.length?(k=b,a):k},a.margin=function(b){return arguments.length?(f.top="undefined"!=typeof b.top?b.top:f.top,f.right="undefined"!=typeof b.right?b.right:f.right,f.bottom="undefined"!=typeof b.bottom?b.bottom:f.bottom,f.left="undefined"!=typeof b.left?b.left:f.left,a):f},a.tickFormat=function(b){return arguments.length?(l=b,a):l},a.tooltips=function(b){return arguments.length?(m=b,a):m},a.tooltipContent=function(b){return arguments.length?(n=b,a):n},a.noData=function(b){return arguments.length?(o=b,a):o},a},c.models.cumulativeLineChart=function(){"use strict";function a(x){return x.each(function(x){function I(b,c){d3.select(a.container).style("cursor","ew-resize")}function J(a,b){G.x=d3.event.x,G.i=Math.round(F.invert(G.x)),L()}function K(b,c){d3.select(a.container).style("cursor","auto"),z.index=G.i,D.stateChange(z)}function L(){da.data([G]);var b=a.transitionDuration();a.transitionDuration(0),a.update(),a.transitionDuration(b)}var M=d3.select(this).classed("nv-chart-"+y,!0),N=this,O=(n||parseInt(M.style("width"))||960)-l.left-l.right,P=(o||parseInt(M.style("height"))||400)-l.top-l.bottom;if(a.update=function(){M.transition().duration(E).call(a)},a.container=this,z.disabled=x.map(function(a){return!!a.disabled}),!A){var Q;A={};for(Q in z)z[Q]instanceof Array?A[Q]=z[Q].slice(0):A[Q]=z[Q]}var R=d3.behavior.drag().on("dragstart",I).on("drag",J).on("dragend",K);if(!(x&&x.length&&x.filter(function(a){return a.values.length}).length)){var S=M.selectAll(".nv-noData").data([B]);return S.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),S.attr("x",l.left+O/2).attr("y",l.top+P/2).text(function(a){return a}),a}if(M.selectAll(".nv-noData").remove(),d=f.xScale(),e=f.yScale(),w)f.yDomain(null);else{var T=x.filter(function(a){return!a.disabled}).map(function(a,b){var c=d3.extent(a.values,f.y());return c[0]<-.95&&(c[0]=-.95),[(c[0]-c[1])/(1+c[1]),(c[1]-c[0])/(1+c[0])]}),U=[d3.min(T,function(a){return a[0]}),d3.max(T,function(a){return a[1];
+})];f.yDomain(U)}F.domain([0,x[0].values.length-1]).range([0,O]).clamp(!0);var x=b(G.i,x),V=v?"none":"all",W=M.selectAll("g.nv-wrap.nv-cumulativeLine").data([x]),X=W.enter().append("g").attr("class","nvd3 nv-wrap nv-cumulativeLine").append("g"),Y=W.select("g");if(X.append("g").attr("class","nv-interactive"),X.append("g").attr("class","nv-x nv-axis").style("pointer-events","none"),X.append("g").attr("class","nv-y nv-axis"),X.append("g").attr("class","nv-background"),X.append("g").attr("class","nv-linesWrap").style("pointer-events",V),X.append("g").attr("class","nv-avgLinesWrap").style("pointer-events","none"),X.append("g").attr("class","nv-legendWrap"),X.append("g").attr("class","nv-controlsWrap"),p&&(i.width(O),Y.select(".nv-legendWrap").datum(x).call(i),l.top!=i.height()&&(l.top=i.height(),P=(o||parseInt(M.style("height"))||400)-l.top-l.bottom),Y.select(".nv-legendWrap").attr("transform","translate(0,"+-l.top+")")),u){var Z=[{key:"Re-scale y-axis",disabled:!w}];j.width(140).color(["#444","#444","#444"]),Y.select(".nv-controlsWrap").datum(Z).attr("transform","translate(0,"+-l.top+")").call(j)}W.attr("transform","translate("+l.left+","+l.top+")"),s&&Y.select(".nv-y.nv-axis").attr("transform","translate("+O+",0)");var $=x.filter(function(a){return a.tempDisabled});W.select(".tempDisabled").remove(),$.length&&W.append("text").attr("class","tempDisabled").attr("x",O/2).attr("y","-.71em").style("text-anchor","end").text($.map(function(a){return a.key}).join(", ")+" values cannot be calculated for this time period."),v&&(k.width(O).height(P).margin({left:l.left,top:l.top}).svgContainer(M).xScale(d),W.select(".nv-interactive").call(k)),X.select(".nv-background").append("rect"),Y.select(".nv-background rect").attr("width",O).attr("height",P),f.y(function(a){return a.display.y}).width(O).height(P).color(x.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!x[b].disabled&&!x[b].tempDisabled}));var _=Y.select(".nv-linesWrap").datum(x.filter(function(a){return!a.disabled&&!a.tempDisabled}));_.call(f),x.forEach(function(a,b){a.seriesIndex=b});var aa=x.filter(function(a){return!a.disabled&&!!C(a)}),ba=Y.select(".nv-avgLinesWrap").selectAll("line").data(aa,function(a){return a.key}),ca=function(a){var b=e(C(a));return 0>b?0:b>P?P:b};ba.enter().append("line").style("stroke-width",2).style("stroke-dasharray","10,10").style("stroke",function(a,b){return f.color()(a,a.seriesIndex)}).attr("x1",0).attr("x2",O).attr("y1",ca).attr("y2",ca),ba.style("stroke-opacity",function(a){var b=e(C(a));return 0>b||b>P?0:1}).attr("x1",0).attr("x2",O).attr("y1",ca).attr("y2",ca),ba.exit().remove();var da=_.selectAll(".nv-indexLine").data([G]);da.enter().append("rect").attr("class","nv-indexLine").attr("width",3).attr("x",-2).attr("fill","red").attr("fill-opacity",.5).style("pointer-events","all").call(R),da.attr("transform",function(a){return"translate("+F(a.i)+",0)"}).attr("height",P),q&&(g.scale(d).ticks(Math.min(x[0].values.length,O/70)).tickSize(-P,0),Y.select(".nv-x.nv-axis").attr("transform","translate(0,"+e.range()[0]+")"),d3.transition(Y.select(".nv-x.nv-axis")).call(g)),r&&(h.scale(e).ticks(P/36).tickSize(-O,0),d3.transition(Y.select(".nv-y.nv-axis")).call(h)),Y.select(".nv-background rect").on("click",function(){G.x=d3.mouse(this)[0],G.i=Math.round(F.invert(G.x)),z.index=G.i,D.stateChange(z),L()}),f.dispatch.on("elementClick",function(a){G.i=a.pointIndex,G.x=F(G.i),z.index=G.i,D.stateChange(z),L()}),j.dispatch.on("legendClick",function(b,c){b.disabled=!b.disabled,w=!b.disabled,z.rescaleY=w,D.stateChange(z),a.update()}),i.dispatch.on("stateChange",function(b){z.disabled=b.disabled,D.stateChange(z),a.update()}),k.dispatch.on("elementMousemove",function(b){f.clearHighlights();var d,e,i,j=[];if(x.filter(function(a,b){return a.seriesIndex=b,!a.disabled}).forEach(function(g,h){e=c.interactiveBisect(g.values,b.pointXValue,a.x()),f.highlightPoint(h,e,!0);var k=g.values[e];"undefined"!=typeof k&&("undefined"==typeof d&&(d=k),"undefined"==typeof i&&(i=a.xScale()(a.x()(k,e))),j.push({key:g.key,value:a.y()(k,e),color:m(g,g.seriesIndex)}))}),j.length>2){var n=a.yScale().invert(b.mouseY),o=Math.abs(a.yScale().domain()[0]-a.yScale().domain()[1]),p=.03*o,q=c.nearestValueIndex(j.map(function(a){return a.value}),n,p);null!==q&&(j[q].highlight=!0)}var r=g.tickFormat()(a.x()(d,e),e);k.tooltip.position({left:i+l.left,top:b.mouseY+l.top}).chartContainer(N.parentNode).enabled(t).valueFormatter(function(a,b){return h.tickFormat()(a)}).data({value:r,series:j})(),k.renderGuideLine(i)}),k.dispatch.on("elementMouseout",function(a){D.tooltipHide(),f.clearHighlights()}),D.on("tooltipShow",function(a){t&&H(a,N.parentNode)}),D.on("changeState",function(b){"undefined"!=typeof b.disabled&&(x.forEach(function(a,c){a.disabled=b.disabled[c]}),z.disabled=b.disabled),"undefined"!=typeof b.index&&(G.i=b.index,G.x=F(G.i),z.index=b.index,da.data([G])),"undefined"!=typeof b.rescaleY&&(w=b.rescaleY),a.update()})}),a}function b(a,b){return b.map(function(b,c){if(!b.values)return b;var d=f.y()(b.values[a],a);return-.95>d?(b.tempDisabled=!0,b):(b.tempDisabled=!1,b.values=b.values.map(function(a,b){return a.display={y:(f.y()(a,b)-d)/(1+d)},a}),b)})}var d,e,f=c.models.line(),g=c.models.axis(),h=c.models.axis(),i=c.models.legend(),j=c.models.legend(),k=c.interactiveGuideline(),l={top:30,right:30,bottom:50,left:60},m=c.utils.defaultColor(),n=null,o=null,p=!0,q=!0,r=!0,s=!1,t=!0,u=!0,v=!1,w=!0,x=function(a,b,c,d,e){return"<h3>"+a+"</h3><p>"+c+" at "+b+"</p>"},y=f.id(),z={index:0,rescaleY:w},A=null,B="No Data Available.",C=function(a){return a.average},D=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),E=250;g.orient("bottom").tickPadding(7),h.orient(s?"right":"left"),j.updateState(!1);var F=d3.scale.linear(),G={i:0,x:0},H=function(b,d){var e=b.pos[0]+(d.offsetLeft||0),i=b.pos[1]+(d.offsetTop||0),j=g.tickFormat()(f.x()(b.point,b.pointIndex)),k=h.tickFormat()(f.y()(b.point,b.pointIndex)),l=x(b.series.key,j,k,b,a);c.tooltip.show([e,i],l,null,null,d)};return f.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+l.left,a.pos[1]+l.top],D.tooltipShow(a)}),f.dispatch.on("elementMouseout.tooltip",function(a){D.tooltipHide(a)}),D.on("tooltipHide",function(){t&&c.tooltip.cleanup()}),a.dispatch=D,a.lines=f,a.legend=i,a.xAxis=g,a.yAxis=h,a.interactiveLayer=k,d3.rebind(a,f,"defined","isArea","x","y","xScale","yScale","size","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","useVoronoi","id"),a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(l.top="undefined"!=typeof b.top?b.top:l.top,l.right="undefined"!=typeof b.right?b.right:l.right,l.bottom="undefined"!=typeof b.bottom?b.bottom:l.bottom,l.left="undefined"!=typeof b.left?b.left:l.left,a):l},a.width=function(b){return arguments.length?(n=b,a):n},a.height=function(b){return arguments.length?(o=b,a):o},a.color=function(b){return arguments.length?(m=c.utils.getColor(b),i.color(m),a):m},a.rescaleY=function(b){return arguments.length?(w=b,a):w},a.showControls=function(b){return arguments.length?(u=b,a):u},a.useInteractiveGuideline=function(b){return arguments.length?(v=b,b===!0&&(a.interactive(!1),a.useVoronoi(!1)),a):v},a.showLegend=function(b){return arguments.length?(p=b,a):p},a.showXAxis=function(b){return arguments.length?(q=b,a):q},a.showYAxis=function(b){return arguments.length?(r=b,a):r},a.rightAlignYAxis=function(b){return arguments.length?(s=b,h.orient(b?"right":"left"),a):s},a.tooltips=function(b){return arguments.length?(t=b,a):t},a.tooltipContent=function(b){return arguments.length?(x=b,a):x},a.state=function(b){return arguments.length?(z=b,a):z},a.defaultState=function(b){return arguments.length?(A=b,a):A},a.noData=function(b){return arguments.length?(B=b,a):B},a.average=function(b){return arguments.length?(C=b,a):C},a.transitionDuration=function(b){return arguments.length?(E=b,a):E},a},c.models.discreteBar=function(){"use strict";function a(c){return c.each(function(a){var c=j-i.left-i.right,l=k-i.top-i.bottom,w=d3.select(this);a.forEach(function(a,b){a.values.forEach(function(a){a.series=b})});var x=b&&d?[]:a.map(function(a){return a.values.map(function(a,b){return{x:o(a,b),y:p(a,b),y0:a.y0}})});m.domain(b||d3.merge(x).map(function(a){return a.x})).rangeBands(e||[0,c],.1),n.domain(d||d3.extent(d3.merge(x).map(function(a){return a.y}).concat(q))),s?n.range(f||[l-(n.domain()[0]<0?12:0),n.domain()[1]>0?12:0]):n.range(f||[l,0]),g=g||m,h=h||n.copy().range([n(0),n(0)]);var y=w.selectAll("g.nv-wrap.nv-discretebar").data([a]),z=y.enter().append("g").attr("class","nvd3 nv-wrap nv-discretebar"),A=z.append("g");y.select("g");A.append("g").attr("class","nv-groups"),y.attr("transform","translate("+i.left+","+i.top+")");var B=y.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});B.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),B.exit().transition().style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),B.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}),B.transition().style("stroke-opacity",1).style("fill-opacity",.75);var C=B.selectAll("g.nv-bar").data(function(a){return a.values});C.exit().remove();var D=C.enter().append("g").attr("transform",function(a,b,c){return"translate("+(m(o(a,b))+.05*m.rangeBand())+", "+n(0)+")"}).on("mouseover",function(b,c){d3.select(this).classed("hover",!0),u.elementMouseover({value:p(b,c),point:b,series:a[b.series],pos:[m(o(b,c))+m.rangeBand()*(b.series+.5)/a.length,n(p(b,c))],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),u.elementMouseout({value:p(b,c),point:b,series:a[b.series],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("click",function(b,c){u.elementClick({value:p(b,c),point:b,series:a[b.series],pos:[m(o(b,c))+m.rangeBand()*(b.series+.5)/a.length,n(p(b,c))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(b,c){u.elementDblClick({value:p(b,c),point:b,series:a[b.series],pos:[m(o(b,c))+m.rangeBand()*(b.series+.5)/a.length,n(p(b,c))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()});D.append("rect").attr("height",0).attr("width",.9*m.rangeBand()/a.length),s?(D.append("text").attr("text-anchor","middle"),C.select("text").text(function(a,b){return t(p(a,b))}).transition().attr("x",.9*m.rangeBand()/2).attr("y",function(a,b){return p(a,b)<0?n(p(a,b))-n(0)+12:-4})):C.selectAll("text").remove(),C.attr("class",function(a,b){return p(a,b)<0?"nv-bar negative":"nv-bar positive"}).style("fill",function(a,b){return a.color||r(a,b)}).style("stroke",function(a,b){return a.color||r(a,b)}).select("rect").attr("class",v).transition().attr("width",.9*m.rangeBand()/a.length),C.transition().attr("transform",function(a,b){var c=m(o(a,b))+.05*m.rangeBand(),d=p(a,b)<0?n(0):n(0)-n(p(a,b))<1?n(0)-1:n(p(a,b));return"translate("+c+", "+d+")"}).select("rect").attr("height",function(a,b){return Math.max(Math.abs(n(p(a,b))-n(d&&d[0]||0))||1)}),g=m.copy(),h=n.copy()}),a}var b,d,e,f,g,h,i={top:0,right:0,bottom:0,left:0},j=960,k=500,l=Math.floor(1e4*Math.random()),m=d3.scale.ordinal(),n=d3.scale.linear(),o=function(a){return a.x},p=function(a){return a.y},q=[0],r=c.utils.defaultColor(),s=!1,t=d3.format(",.2f"),u=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout"),v="discreteBar";return a.dispatch=u,a.options=c.utils.optionsFunc.bind(a),a.x=function(b){return arguments.length?(o=b,a):o},a.y=function(b){return arguments.length?(p=b,a):p},a.margin=function(b){return arguments.length?(i.top="undefined"!=typeof b.top?b.top:i.top,i.right="undefined"!=typeof b.right?b.right:i.right,i.bottom="undefined"!=typeof b.bottom?b.bottom:i.bottom,i.left="undefined"!=typeof b.left?b.left:i.left,a):i},a.width=function(b){return arguments.length?(j=b,a):j},a.height=function(b){return arguments.length?(k=b,a):k},a.xScale=function(b){return arguments.length?(m=b,a):m},a.yScale=function(b){return arguments.length?(n=b,a):n},a.xDomain=function(c){return arguments.length?(b=c,a):b},a.yDomain=function(b){return arguments.length?(d=b,a):d},a.xRange=function(b){return arguments.length?(e=b,a):e},a.yRange=function(b){return arguments.length?(f=b,a):f},a.forceY=function(b){return arguments.length?(q=b,a):q},a.color=function(b){return arguments.length?(r=c.utils.getColor(b),a):r},a.id=function(b){return arguments.length?(l=b,a):l},a.showValues=function(b){return arguments.length?(s=b,a):s},a.valueFormat=function(b){return arguments.length?(t=b,a):t},a.rectClass=function(b){return arguments.length?(v=b,a):v},a},c.models.discreteBarChart=function(){"use strict";function a(c){return c.each(function(c){var k=d3.select(this),q=this,v=(i||parseInt(k.style("width"))||960)-h.left-h.right,w=(j||parseInt(k.style("height"))||400)-h.top-h.bottom;if(a.update=function(){s.beforeUpdate(),k.transition().duration(t).call(a)},a.container=this,!(c&&c.length&&c.filter(function(a){return a.values.length}).length)){var x=k.selectAll(".nv-noData").data([r]);return x.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),x.attr("x",h.left+v/2).attr("y",h.top+w/2).text(function(a){return a}),a}k.selectAll(".nv-noData").remove(),b=e.xScale(),d=e.yScale().clamp(!0);var y=k.selectAll("g.nv-wrap.nv-discreteBarWithAxes").data([c]),z=y.enter().append("g").attr("class","nvd3 nv-wrap nv-discreteBarWithAxes").append("g"),A=z.append("defs"),B=y.select("g");z.append("g").attr("class","nv-x nv-axis"),z.append("g").attr("class","nv-y nv-axis").append("g").attr("class","nv-zeroLine").append("line"),z.append("g").attr("class","nv-barsWrap"),B.attr("transform","translate("+h.left+","+h.top+")"),n&&B.select(".nv-y.nv-axis").attr("transform","translate("+v+",0)"),e.width(v).height(w);var C=B.select(".nv-barsWrap").datum(c.filter(function(a){return!a.disabled}));if(C.transition().call(e),A.append("clipPath").attr("id","nv-x-label-clip-"+e.id()).append("rect"),B.select("#nv-x-label-clip-"+e.id()+" rect").attr("width",b.rangeBand()*(o?2:1)).attr("height",16).attr("x",-b.rangeBand()/(o?1:2)),l){f.scale(b).ticks(v/100).tickSize(-w,0),B.select(".nv-x.nv-axis").attr("transform","translate(0,"+(d.range()[0]+(e.showValues()&&d.domain()[0]<0?16:0))+")"),B.select(".nv-x.nv-axis").transition().call(f);var D=B.select(".nv-x.nv-axis").selectAll("g");o&&D.selectAll("text").attr("transform",function(a,b,c){return"translate(0,"+(c%2==0?"5":"17")+")"})}m&&(g.scale(d).ticks(w/36).tickSize(-v,0),B.select(".nv-y.nv-axis").transition().call(g)),B.select(".nv-zeroLine line").attr("x1",0).attr("x2",v).attr("y1",d(0)).attr("y2",d(0)),s.on("tooltipShow",function(a){p&&u(a,q.parentNode)})}),a}var b,d,e=c.models.discreteBar(),f=c.models.axis(),g=c.models.axis(),h={top:15,right:10,bottom:50,left:60},i=null,j=null,k=c.utils.getColor(),l=!0,m=!0,n=!1,o=!1,p=!0,q=function(a,b,c,d,e){return"<h3>"+b+"</h3><p>"+c+"</p>"},r="No Data Available.",s=d3.dispatch("tooltipShow","tooltipHide","beforeUpdate"),t=250;f.orient("bottom").highlightZero(!1).showMaxMin(!1).tickFormat(function(a){return a}),g.orient(n?"right":"left").tickFormat(d3.format(",.1f"));var u=function(b,d){var h=b.pos[0]+(d.offsetLeft||0),i=b.pos[1]+(d.offsetTop||0),j=f.tickFormat()(e.x()(b.point,b.pointIndex)),k=g.tickFormat()(e.y()(b.point,b.pointIndex)),l=q(b.series.key,j,k,b,a);c.tooltip.show([h,i],l,b.value<0?"n":"s",null,d)};return e.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+h.left,a.pos[1]+h.top],s.tooltipShow(a)}),e.dispatch.on("elementMouseout.tooltip",function(a){s.tooltipHide(a)}),s.on("tooltipHide",function(){p&&c.tooltip.cleanup()}),a.dispatch=s,a.discretebar=e,a.xAxis=f,a.yAxis=g,d3.rebind(a,e,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","id","showValues","valueFormat"),a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(h.top="undefined"!=typeof b.top?b.top:h.top,h.right="undefined"!=typeof b.right?b.right:h.right,h.bottom="undefined"!=typeof b.bottom?b.bottom:h.bottom,h.left="undefined"!=typeof b.left?b.left:h.left,a):h},a.width=function(b){return arguments.length?(i=b,a):i},a.height=function(b){return arguments.length?(j=b,a):j},a.color=function(b){return arguments.length?(k=c.utils.getColor(b),e.color(k),a):k},a.showXAxis=function(b){return arguments.length?(l=b,a):l},a.showYAxis=function(b){return arguments.length?(m=b,a):m},a.rightAlignYAxis=function(b){return arguments.length?(n=b,g.orient(b?"right":"left"),a):n},a.staggerLabels=function(b){return arguments.length?(o=b,a):o},a.tooltips=function(b){return arguments.length?(p=b,a):p},a.tooltipContent=function(b){return arguments.length?(q=b,a):q},a.noData=function(b){return arguments.length?(r=b,a):r},a.transitionDuration=function(b){return arguments.length?(t=b,a):t},a},c.models.distribution=function(){"use strict";function a(c){return c.each(function(a){var c=(e-("x"===g?d.left+d.right:d.top+d.bottom),"x"==g?"y":"x"),k=d3.select(this);b=b||j;var l=k.selectAll("g.nv-distribution").data([a]),m=l.enter().append("g").attr("class","nvd3 nv-distribution"),n=(m.append("g"),l.select("g"));l.attr("transform","translate("+d.left+","+d.top+")");var o=n.selectAll("g.nv-dist").data(function(a){return a},function(a){return a.key});o.enter().append("g"),o.attr("class",function(a,b){return"nv-dist nv-series-"+b}).style("stroke",function(a,b){return i(a,b)});var p=o.selectAll("line.nv-dist"+g).data(function(a){return a.values});p.enter().append("line").attr(g+"1",function(a,c){return b(h(a,c))}).attr(g+"2",function(a,c){return b(h(a,c))}),o.exit().selectAll("line.nv-dist"+g).transition().attr(g+"1",function(a,b){return j(h(a,b))}).attr(g+"2",function(a,b){return j(h(a,b))}).style("stroke-opacity",0).remove(),p.attr("class",function(a,b){return"nv-dist"+g+" nv-dist"+g+"-"+b}).attr(c+"1",0).attr(c+"2",f),p.transition().attr(g+"1",function(a,b){return j(h(a,b))}).attr(g+"2",function(a,b){return j(h(a,b))}),b=j.copy()}),a}var b,d={top:0,right:0,bottom:0,left:0},e=400,f=8,g="x",h=function(a){return a[g]},i=c.utils.defaultColor(),j=d3.scale.linear();return a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(d.top="undefined"!=typeof b.top?b.top:d.top,d.right="undefined"!=typeof b.right?b.right:d.right,d.bottom="undefined"!=typeof b.bottom?b.bottom:d.bottom,d.left="undefined"!=typeof b.left?b.left:d.left,a):d},a.width=function(b){return arguments.length?(e=b,a):e},a.axis=function(b){return arguments.length?(g=b,a):g},a.size=function(b){return arguments.length?(f=b,a):f},a.getData=function(b){return arguments.length?(h=d3.functor(b),a):h},a.scale=function(b){return arguments.length?(j=b,a):j},a.color=function(b){return arguments.length?(i=c.utils.getColor(b),a):i},a},c.models.historicalBarChart=function(){"use strict";function a(c){return c.each(function(r){var y=d3.select(this),z=this,A=(k||parseInt(y.style("width"))||960)-i.left-i.right,B=(l||parseInt(y.style("height"))||400)-i.top-i.bottom;if(a.update=function(){y.transition().duration(w).call(a)},a.container=this,s.disabled=r.map(function(a){return!!a.disabled}),!t){var C;t={};for(C in s)s[C]instanceof Array?t[C]=s[C].slice(0):t[C]=s[C]}if(!(r&&r.length&&r.filter(function(a){return a.values.length}).length)){var D=y.selectAll(".nv-noData").data([u]);return D.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),D.attr("x",i.left+A/2).attr("y",i.top+B/2).text(function(a){return a}),a}y.selectAll(".nv-noData").remove(),b=e.xScale(),d=e.yScale();var E=y.selectAll("g.nv-wrap.nv-historicalBarChart").data([r]),F=E.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBarChart").append("g"),G=E.select("g");F.append("g").attr("class","nv-x nv-axis"),F.append("g").attr("class","nv-y nv-axis"),F.append("g").attr("class","nv-barsWrap"),F.append("g").attr("class","nv-legendWrap"),m&&(h.width(A),G.select(".nv-legendWrap").datum(r).call(h),i.top!=h.height()&&(i.top=h.height(),B=(l||parseInt(y.style("height"))||400)-i.top-i.bottom),E.select(".nv-legendWrap").attr("transform","translate(0,"+-i.top+")")),E.attr("transform","translate("+i.left+","+i.top+")"),p&&G.select(".nv-y.nv-axis").attr("transform","translate("+A+",0)"),e.width(A).height(B).color(r.map(function(a,b){return a.color||j(a,b)}).filter(function(a,b){return!r[b].disabled}));var H=G.select(".nv-barsWrap").datum(r.filter(function(a){return!a.disabled}));H.transition().call(e),n&&(f.scale(b).tickSize(-B,0),G.select(".nv-x.nv-axis").attr("transform","translate(0,"+d.range()[0]+")"),G.select(".nv-x.nv-axis").transition().call(f)),o&&(g.scale(d).ticks(B/36).tickSize(-A,0),G.select(".nv-y.nv-axis").transition().call(g)),h.dispatch.on("legendClick",function(b,d){b.disabled=!b.disabled,r.filter(function(a){return!a.disabled}).length||r.map(function(a){return a.disabled=!1,E.selectAll(".nv-series").classed("disabled",!1),a}),s.disabled=r.map(function(a){return!!a.disabled}),v.stateChange(s),c.transition().call(a)}),h.dispatch.on("legendDblclick",function(b){r.forEach(function(a){a.disabled=!0}),b.disabled=!1,s.disabled=r.map(function(a){return!!a.disabled}),v.stateChange(s),a.update()}),v.on("tooltipShow",function(a){q&&x(a,z.parentNode)}),v.on("changeState",function(b){"undefined"!=typeof b.disabled&&(r.forEach(function(a,c){a.disabled=b.disabled[c]}),s.disabled=b.disabled),a.update()})}),a}var b,d,e=c.models.historicalBar(),f=c.models.axis(),g=c.models.axis(),h=c.models.legend(),i={top:30,right:90,bottom:50,left:90},j=c.utils.defaultColor(),k=null,l=null,m=!1,n=!0,o=!0,p=!1,q=!0,r=function(a,b,c,d,e){return"<h3>"+a+"</h3><p>"+c+" at "+b+"</p>"},s={},t=null,u="No Data Available.",v=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),w=250;f.orient("bottom").tickPadding(7),g.orient(p?"right":"left");var x=function(b,d){if(d){var h=d3.select(d).select("svg"),i=h.node()?h.attr("viewBox"):null;if(i){i=i.split(" ");var j=parseInt(h.style("width"))/i[2];b.pos[0]=b.pos[0]*j,b.pos[1]=b.pos[1]*j}}var k=b.pos[0]+(d.offsetLeft||0),l=b.pos[1]+(d.offsetTop||0),m=f.tickFormat()(e.x()(b.point,b.pointIndex)),n=g.tickFormat()(e.y()(b.point,b.pointIndex)),o=r(b.series.key,m,n,b,a);c.tooltip.show([k,l],o,null,null,d)};return e.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+i.left,a.pos[1]+i.top],v.tooltipShow(a)}),e.dispatch.on("elementMouseout.tooltip",function(a){v.tooltipHide(a)}),v.on("tooltipHide",function(){q&&c.tooltip.cleanup()}),a.dispatch=v,a.bars=e,a.legend=h,a.xAxis=f,a.yAxis=g,d3.rebind(a,e,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","id","interpolate","highlightPoint","clearHighlights","interactive"),a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(i.top="undefined"!=typeof b.top?b.top:i.top,i.right="undefined"!=typeof b.right?b.right:i.right,i.bottom="undefined"!=typeof b.bottom?b.bottom:i.bottom,i.left="undefined"!=typeof b.left?b.left:i.left,a):i},a.width=function(b){return arguments.length?(k=b,a):k},a.height=function(b){return arguments.length?(l=b,a):l},a.color=function(b){return arguments.length?(j=c.utils.getColor(b),h.color(j),a):j},a.showLegend=function(b){return arguments.length?(m=b,a):m},a.showXAxis=function(b){return arguments.length?(n=b,a):n},a.showYAxis=function(b){return arguments.length?(o=b,a):o},a.rightAlignYAxis=function(b){return arguments.length?(p=b,g.orient(b?"right":"left"),a):p},a.tooltips=function(b){return arguments.length?(q=b,a):q},a.tooltipContent=function(b){return arguments.length?(r=b,a):r},a.state=function(b){return arguments.length?(s=b,a):s},a.defaultState=function(b){return arguments.length?(t=b,a):t},a.noData=function(b){return arguments.length?(u=b,a):u},a.transitionDuration=function(b){return arguments.length?(w=b,a):w},a},c.models.indentedTree=function(){"use strict";function a(b){return b.each(function(b){function c(b,d,e){return d3.event.stopPropagation(),d3.event.shiftKey&&!e?(d3.event.shiftKey=!1,b.values&&b.values.forEach(function(a){(a.values||a._values)&&c(a,0,!0)}),!0):g(b)?(b.values?(b._values=b.values,b.values=null):(b.values=b._values,b._values=null),void a.update()):!0}function d(a){return a._values&&a._values.length?n:a.values&&a.values.length?o:""}function f(a){return a._values&&a._values.length}function g(a){var b=a.values||a._values;return b&&b.length}var s=1,t=d3.select(this),u=d3.layout.tree().children(function(a){return a.values}).size([e,k]);a.update=function(){t.transition().duration(600).call(a)},b[0]||(b[0]={key:j});var v=u.nodes(b[0]),w=d3.select(this).selectAll("div").data([[v]]),x=w.enter().append("div").attr("class","nvd3 nv-wrap nv-indentedtree"),y=x.append("table"),z=w.select("table").attr("width","100%").attr("class",m);if(h){var A=y.append("thead"),B=A.append("tr");l.forEach(function(a){B.append("th").attr("width",a.width?a.width:"10%").style("text-align","numeric"==a.type?"right":"left").append("span").text(a.label)})}var C=z.selectAll("tbody").data(function(a){return a});C.enter().append("tbody"),s=d3.max(v,function(a){return a.depth}),u.size([e,s*k]);var D=C.selectAll("tr").data(function(a){return a.filter(function(a){return i&&!a.children?i(a):!0})},function(a,b){return a.id||a.id||++r});D.exit().remove(),D.select("img.nv-treeicon").attr("src",d).classed("folded",f);var E=D.enter().append("tr");l.forEach(function(a,b){var e=E.append("td").style("padding-left",function(a){return(b?0:a.depth*k+12+(d(a)?0:16))+"px"},"important").style("text-align","numeric"==a.type?"right":"left");0==b&&e.append("img").classed("nv-treeicon",!0).classed("nv-folded",f).attr("src",d).style("width","14px").style("height","14px").style("padding","0 1px").style("display",function(a){return d(a)?"inline-block":"none"}).on("click",c),e.each(function(c){!b&&q(c)?d3.select(this).append("a").attr("href",q).attr("class",d3.functor(a.classes)).append("span"):d3.select(this).append("span"),d3.select(this).select("span").attr("class",d3.functor(a.classes)).text(function(b){return a.format?a.format(b):b[a.key]||"-"})}),a.showCount&&(e.append("span").attr("class","nv-childrenCount"),D.selectAll("span.nv-childrenCount").text(function(a){return a.values&&a.values.length||a._values&&a._values.length?"("+(a.values&&a.values.filter(function(a){return i?i(a):!0}).length||a._values&&a._values.filter(function(a){return i?i(a):!0}).length||0)+")":""}))}),D.order().on("click",function(a){p.elementClick({row:this,data:a,pos:[a.x,a.y]})}).on("dblclick",function(a){p.elementDblclick({row:this,data:a,pos:[a.x,a.y]})}).on("mouseover",function(a){p.elementMouseover({row:this,data:a,pos:[a.x,a.y]})}).on("mouseout",function(a){p.elementMouseout({row:this,data:a,pos:[a.x,a.y]})})}),a}var b={top:0,right:0,bottom:0,left:0},d=960,e=500,f=c.utils.defaultColor(),g=Math.floor(1e4*Math.random()),h=!0,i=!1,j="No Data Available.",k=20,l=[{key:"key",label:"Name",type:"text"}],m=null,n="images/grey-plus.png",o="images/grey-minus.png",p=d3.dispatch("elementClick","elementDblclick","elementMouseover","elementMouseout"),q=function(a){return a.url},r=0;return a.options=c.utils.optionsFunc.bind(a),a.margin=function(c){return arguments.length?(b.top="undefined"!=typeof c.top?c.top:b.top,b.right="undefined"!=typeof c.right?c.right:b.right,b.bottom="undefined"!=typeof c.bottom?c.bottom:b.bottom,b.left="undefined"!=typeof c.left?c.left:b.left,a):b},a.width=function(b){return arguments.length?(d=b,a):d},a.height=function(b){return arguments.length?(e=b,a):e},a.color=function(b){return arguments.length?(f=c.utils.getColor(b),scatter.color(f),a):f},a.id=function(b){return arguments.length?(g=b,a):g},a.header=function(b){return arguments.length?(h=b,a):h},a.noData=function(b){return arguments.length?(j=b,a):j},a.filterZero=function(b){return arguments.length?(i=b,a):i},a.columns=function(b){return arguments.length?(l=b,a):l},a.tableClass=function(b){return arguments.length?(m=b,a):m},a.iconOpen=function(b){return arguments.length?(n=b,a):n},a.iconClose=function(b){return arguments.length?(o=b,a):o},a.getUrl=function(b){return arguments.length?(q=b,a):q},a},c.models.legend=function(){"use strict";function a(m){return m.each(function(a){var m=d-b.left-b.right,n=d3.select(this),o=n.selectAll("g.nv-legend").data([a]),p=(o.enter().append("g").attr("class","nvd3 nv-legend").append("g"),o.select("g"));o.attr("transform","translate("+b.left+","+b.top+")");var q=p.selectAll(".nv-series").data(function(a){return a}),r=q.enter().append("g").attr("class","nv-series").on("mouseover",function(a,b){l.legendMouseover(a,b)}).on("mouseout",function(a,b){l.legendMouseout(a,b)}).on("click",function(b,c){l.legendClick(b,c),j&&(k?(a.forEach(function(a){a.disabled=!0}),b.disabled=!1):(b.disabled=!b.disabled,a.every(function(a){return a.disabled})&&a.forEach(function(a){a.disabled=!1})),l.stateChange({disabled:a.map(function(a){return!!a.disabled})}))}).on("dblclick",function(b,c){l.legendDblclick(b,c),j&&(a.forEach(function(a){a.disabled=!0}),b.disabled=!1,l.stateChange({disabled:a.map(function(a){return!!a.disabled})}))});if(r.append("circle").style("stroke-width",2).attr("class","nv-legend-symbol").attr("r",5),r.append("text").attr("text-anchor","start").attr("class","nv-legend-text").attr("dy",".32em").attr("dx","8"),q.classed("disabled",function(a){return a.disabled}),q.exit().remove(),q.select("circle").style("fill",function(a,b){return a.color||g(a,b)}).style("stroke",function(a,b){return a.color||g(a,b)}),q.select("text").text(f),h){var s=[];q.each(function(a,b){var d,e=d3.select(this).select("text");try{d=e.node().getComputedTextLength()}catch(f){d=c.utils.calcApproxTextWidth(e)}s.push(d+28)});for(var t=0,u=0,v=[];m>u&&t<s.length;)v[t]=s[t],u+=s[t++];for(0===t&&(t=1);u>m&&t>1;){v=[],t--;for(var w=0;w<s.length;w++)s[w]>(v[w%t]||0)&&(v[w%t]=s[w]);u=v.reduce(function(a,b,c,d){return a+b})}for(var x=[],y=0,z=0;t>y;y++)x[y]=z,z+=v[y];q.attr("transform",function(a,b){return"translate("+x[b%t]+","+(5+20*Math.floor(b/t))+")"}),i?p.attr("transform","translate("+(d-b.right-u)+","+b.top+")"):p.attr("transform","translate(0,"+b.top+")"),e=b.top+b.bottom+20*Math.ceil(s.length/t)}else{var A,B=5,C=5,D=0;q.attr("transform",function(a,c){var e=d3.select(this).select("text").node().getComputedTextLength()+28;return A=C,d<b.left+b.right+A+e&&(C=A=5,B+=20),C+=e,C>D&&(D=C),"translate("+A+","+B+")"}),p.attr("transform","translate("+(d-b.right-D)+","+b.top+")"),e=b.top+b.bottom+B+15}}),a}var b={top:5,right:0,bottom:5,left:0},d=400,e=20,f=function(a){return a.key},g=c.utils.defaultColor(),h=!0,i=!0,j=!0,k=!1,l=d3.dispatch("legendClick","legendDblclick","legendMouseover","legendMouseout","stateChange");return a.dispatch=l,a.options=c.utils.optionsFunc.bind(a),a.margin=function(c){return arguments.length?(b.top="undefined"!=typeof c.top?c.top:b.top,b.right="undefined"!=typeof c.right?c.right:b.right,b.bottom="undefined"!=typeof c.bottom?c.bottom:b.bottom,b.left="undefined"!=typeof c.left?c.left:b.left,a):b},a.width=function(b){return arguments.length?(d=b,a):d},a.height=function(b){return arguments.length?(e=b,a):e},a.key=function(b){return arguments.length?(f=b,a):f},a.color=function(b){return arguments.length?(g=c.utils.getColor(b),a):g},a.align=function(b){return arguments.length?(h=b,a):h},a.rightAlign=function(b){return arguments.length?(i=b,a):i},a.updateState=function(b){return arguments.length?(j=b,a):j},a.radioButtonMode=function(b){return arguments.length?(k=b,a):k},a},c.models.line=function(){"use strict";function a(r){return r.each(function(a){var r=g-f.left-f.right,s=h-f.top-f.bottom,t=d3.select(this);b=e.xScale(),d=e.yScale(),p=p||b,q=q||d;var u=t.selectAll("g.nv-wrap.nv-line").data([a]),v=u.enter().append("g").attr("class","nvd3 nv-wrap nv-line"),w=v.append("defs"),x=v.append("g"),y=u.select("g");x.append("g").attr("class","nv-groups"),
+x.append("g").attr("class","nv-scatterWrap"),u.attr("transform","translate("+f.left+","+f.top+")"),e.width(r).height(s);var z=u.select(".nv-scatterWrap");z.transition().call(e),w.append("clipPath").attr("id","nv-edge-clip-"+e.id()).append("rect"),u.select("#nv-edge-clip-"+e.id()+" rect").attr("width",r).attr("height",s),y.attr("clip-path",n?"url(#nv-edge-clip-"+e.id()+")":""),z.attr("clip-path",n?"url(#nv-edge-clip-"+e.id()+")":"");var A=u.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});A.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),A.exit().remove(),A.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return i(a,b)}).style("stroke",function(a,b){return i(a,b)}),A.transition().style("stroke-opacity",1).style("fill-opacity",.5);var B=A.selectAll("path.nv-area").data(function(a){return m(a)?[a]:[]});B.enter().append("path").attr("class","nv-area").attr("d",function(a){return d3.svg.area().interpolate(o).defined(l).x(function(a,b){return c.utils.NaNtoZero(p(j(a,b)))}).y0(function(a,b){return c.utils.NaNtoZero(q(k(a,b)))}).y1(function(a,b){return q(d.domain()[0]<=0?d.domain()[1]>=0?0:d.domain()[1]:d.domain()[0])}).apply(this,[a.values])}),A.exit().selectAll("path.nv-area").remove(),B.transition().attr("d",function(a){return d3.svg.area().interpolate(o).defined(l).x(function(a,d){return c.utils.NaNtoZero(b(j(a,d)))}).y0(function(a,b){return c.utils.NaNtoZero(d(k(a,b)))}).y1(function(a,b){return d(d.domain()[0]<=0?d.domain()[1]>=0?0:d.domain()[1]:d.domain()[0])}).apply(this,[a.values])});var C=A.selectAll("path.nv-line").data(function(a){return[a.values]});C.enter().append("path").attr("class","nv-line").attr("d",d3.svg.line().interpolate(o).defined(l).x(function(a,b){return c.utils.NaNtoZero(p(j(a,b)))}).y(function(a,b){return c.utils.NaNtoZero(q(k(a,b)))})),C.transition().attr("d",d3.svg.line().interpolate(o).defined(l).x(function(a,d){return c.utils.NaNtoZero(b(j(a,d)))}).y(function(a,b){return c.utils.NaNtoZero(d(k(a,b)))})),p=b.copy(),q=d.copy()}),a}var b,d,e=c.models.scatter(),f={top:0,right:0,bottom:0,left:0},g=960,h=500,i=c.utils.defaultColor(),j=function(a){return a.x},k=function(a){return a.y},l=function(a,b){return!isNaN(k(a,b))&&null!==k(a,b)},m=function(a){return a.area},n=!1,o="linear";e.size(16).sizeDomain([16,256]);var p,q;return a.dispatch=e.dispatch,a.scatter=e,d3.rebind(a,e,"id","interactive","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","forceX","forceY","forceSize","clipVoronoi","useVoronoi","clipRadius","padData","highlightPoint","clearHighlights"),a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(f.top="undefined"!=typeof b.top?b.top:f.top,f.right="undefined"!=typeof b.right?b.right:f.right,f.bottom="undefined"!=typeof b.bottom?b.bottom:f.bottom,f.left="undefined"!=typeof b.left?b.left:f.left,a):f},a.width=function(b){return arguments.length?(g=b,a):g},a.height=function(b){return arguments.length?(h=b,a):h},a.x=function(b){return arguments.length?(j=b,e.x(b),a):j},a.y=function(b){return arguments.length?(k=b,e.y(b),a):k},a.clipEdge=function(b){return arguments.length?(n=b,a):n},a.color=function(b){return arguments.length?(i=c.utils.getColor(b),e.color(i),a):i},a.interpolate=function(b){return arguments.length?(o=b,a):o},a.defined=function(b){return arguments.length?(l=b,a):l},a.isArea=function(b){return arguments.length?(m=d3.functor(b),a):m},a},c.models.lineChart=function(){"use strict";function a(t){return t.each(function(t){var A=d3.select(this),B=this,C=(l||parseInt(A.style("width"))||960)-j.left-j.right,D=(m||parseInt(A.style("height"))||400)-j.top-j.bottom;if(a.update=function(){A.transition().duration(y).call(a)},a.container=this,u.disabled=t.map(function(a){return!!a.disabled}),!v){var E;v={};for(E in u)u[E]instanceof Array?v[E]=u[E].slice(0):v[E]=u[E]}if(!(t&&t.length&&t.filter(function(a){return a.values.length}).length)){var F=A.selectAll(".nv-noData").data([w]);return F.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),F.attr("x",j.left+C/2).attr("y",j.top+D/2).text(function(a){return a}),a}A.selectAll(".nv-noData").remove(),b=e.xScale(),d=e.yScale();var G=A.selectAll("g.nv-wrap.nv-lineChart").data([t]),H=G.enter().append("g").attr("class","nvd3 nv-wrap nv-lineChart").append("g"),I=G.select("g");H.append("rect").style("opacity",0),H.append("g").attr("class","nv-x nv-axis"),H.append("g").attr("class","nv-y nv-axis"),H.append("g").attr("class","nv-linesWrap"),H.append("g").attr("class","nv-legendWrap"),H.append("g").attr("class","nv-interactive"),I.select("rect").attr("width",C).attr("height",D),n&&(h.width(C),I.select(".nv-legendWrap").datum(t).call(h),j.top!=h.height()&&(j.top=h.height(),D=(m||parseInt(A.style("height"))||400)-j.top-j.bottom),G.select(".nv-legendWrap").attr("transform","translate(0,"+-j.top+")")),G.attr("transform","translate("+j.left+","+j.top+")"),q&&I.select(".nv-y.nv-axis").attr("transform","translate("+C+",0)"),r&&(i.width(C).height(D).margin({left:j.left,top:j.top}).svgContainer(A).xScale(b),G.select(".nv-interactive").call(i)),e.width(C).height(D).color(t.map(function(a,b){return a.color||k(a,b)}).filter(function(a,b){return!t[b].disabled}));var J=I.select(".nv-linesWrap").datum(t.filter(function(a){return!a.disabled}));J.transition().call(e),o&&(f.scale(b).ticks(C/100).tickSize(-D,0),I.select(".nv-x.nv-axis").attr("transform","translate(0,"+d.range()[0]+")"),I.select(".nv-x.nv-axis").transition().call(f)),p&&(g.scale(d).ticks(D/36).tickSize(-C,0),I.select(".nv-y.nv-axis").transition().call(g)),h.dispatch.on("stateChange",function(b){u=b,x.stateChange(u),a.update()}),i.dispatch.on("elementMousemove",function(b){e.clearHighlights();var d,h,l,m=[];if(t.filter(function(a,b){return a.seriesIndex=b,!a.disabled}).forEach(function(f,g){h=c.interactiveBisect(f.values,b.pointXValue,a.x()),e.highlightPoint(g,h,!0);var i=f.values[h];"undefined"!=typeof i&&("undefined"==typeof d&&(d=i),"undefined"==typeof l&&(l=a.xScale()(a.x()(i,h))),m.push({key:f.key,value:a.y()(i,h),color:k(f,f.seriesIndex)}))}),m.length>2){var n=a.yScale().invert(b.mouseY),o=Math.abs(a.yScale().domain()[0]-a.yScale().domain()[1]),p=.03*o,q=c.nearestValueIndex(m.map(function(a){return a.value}),n,p);null!==q&&(m[q].highlight=!0)}var r=f.tickFormat()(a.x()(d,h));i.tooltip.position({left:l+j.left,top:b.mouseY+j.top}).chartContainer(B.parentNode).enabled(s).valueFormatter(function(a,b){return g.tickFormat()(a)}).data({value:r,series:m})(),i.renderGuideLine(l)}),i.dispatch.on("elementMouseout",function(a){x.tooltipHide(),e.clearHighlights()}),x.on("tooltipShow",function(a){s&&z(a,B.parentNode)}),x.on("changeState",function(b){"undefined"!=typeof b.disabled&&(t.forEach(function(a,c){a.disabled=b.disabled[c]}),u.disabled=b.disabled),a.update()})}),a}var b,d,e=c.models.line(),f=c.models.axis(),g=c.models.axis(),h=c.models.legend(),i=c.interactiveGuideline(),j={top:30,right:20,bottom:50,left:60},k=c.utils.defaultColor(),l=null,m=null,n=!0,o=!0,p=!0,q=!1,r=!1,s=!0,t=function(a,b,c,d,e){return"<h3>"+a+"</h3><p>"+c+" at "+b+"</p>"},u={},v=null,w="No Data Available.",x=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),y=250;f.orient("bottom").tickPadding(7),g.orient(q?"right":"left");var z=function(b,d){var h=b.pos[0]+(d.offsetLeft||0),i=b.pos[1]+(d.offsetTop||0),j=f.tickFormat()(e.x()(b.point,b.pointIndex)),k=g.tickFormat()(e.y()(b.point,b.pointIndex)),l=t(b.series.key,j,k,b,a);c.tooltip.show([h,i],l,null,null,d)};return e.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+j.left,a.pos[1]+j.top],x.tooltipShow(a)}),e.dispatch.on("elementMouseout.tooltip",function(a){x.tooltipHide(a)}),x.on("tooltipHide",function(){s&&c.tooltip.cleanup()}),a.dispatch=x,a.lines=e,a.legend=h,a.xAxis=f,a.yAxis=g,a.interactiveLayer=i,d3.rebind(a,e,"defined","isArea","x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","useVoronoi","id","interpolate"),a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(j.top="undefined"!=typeof b.top?b.top:j.top,j.right="undefined"!=typeof b.right?b.right:j.right,j.bottom="undefined"!=typeof b.bottom?b.bottom:j.bottom,j.left="undefined"!=typeof b.left?b.left:j.left,a):j},a.width=function(b){return arguments.length?(l=b,a):l},a.height=function(b){return arguments.length?(m=b,a):m},a.color=function(b){return arguments.length?(k=c.utils.getColor(b),h.color(k),a):k},a.showLegend=function(b){return arguments.length?(n=b,a):n},a.showXAxis=function(b){return arguments.length?(o=b,a):o},a.showYAxis=function(b){return arguments.length?(p=b,a):p},a.rightAlignYAxis=function(b){return arguments.length?(q=b,g.orient(b?"right":"left"),a):q},a.useInteractiveGuideline=function(b){return arguments.length?(r=b,b===!0&&(a.interactive(!1),a.useVoronoi(!1)),a):r},a.tooltips=function(b){return arguments.length?(s=b,a):s},a.tooltipContent=function(b){return arguments.length?(t=b,a):t},a.state=function(b){return arguments.length?(u=b,a):u},a.defaultState=function(b){return arguments.length?(v=b,a):v},a.noData=function(b){return arguments.length?(w=b,a):w},a.transitionDuration=function(b){return arguments.length?(y=b,a):y},a},c.models.linePlusBarChart=function(){"use strict";function a(c){return c.each(function(c){var o=d3.select(this),p=this,t=(m||parseInt(o.style("width"))||960)-l.left-l.right,z=(n||parseInt(o.style("height"))||400)-l.top-l.bottom;if(a.update=function(){o.transition().call(a)},u.disabled=c.map(function(a){return!!a.disabled}),!v){var A;v={};for(A in u)u[A]instanceof Array?v[A]=u[A].slice(0):v[A]=u[A]}if(!(c&&c.length&&c.filter(function(a){return a.values.length}).length)){var B=o.selectAll(".nv-noData").data([w]);return B.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),B.attr("x",l.left+t/2).attr("y",l.top+z/2).text(function(a){return a}),a}o.selectAll(".nv-noData").remove();var C=c.filter(function(a){return!a.disabled&&a.bar}),D=c.filter(function(a){return!a.bar});b=D.filter(function(a){return!a.disabled}).length&&D.filter(function(a){return!a.disabled})[0].values.length?f.xScale():g.xScale(),d=g.yScale(),e=f.yScale();var E=d3.select(this).selectAll("g.nv-wrap.nv-linePlusBar").data([c]),F=E.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g"),G=E.select("g");F.append("g").attr("class","nv-x nv-axis"),F.append("g").attr("class","nv-y1 nv-axis"),F.append("g").attr("class","nv-y2 nv-axis"),F.append("g").attr("class","nv-barsWrap"),F.append("g").attr("class","nv-linesWrap"),F.append("g").attr("class","nv-legendWrap"),r&&(k.width(t/2),G.select(".nv-legendWrap").datum(c.map(function(a){return a.originalKey=void 0===a.originalKey?a.key:a.originalKey,a.key=a.originalKey+(a.bar?" (left axis)":" (right axis)"),a})).call(k),l.top!=k.height()&&(l.top=k.height(),z=(n||parseInt(o.style("height"))||400)-l.top-l.bottom),G.select(".nv-legendWrap").attr("transform","translate("+t/2+","+-l.top+")")),E.attr("transform","translate("+l.left+","+l.top+")"),f.width(t).height(z).color(c.map(function(a,b){return a.color||q(a,b)}).filter(function(a,b){return!c[b].disabled&&!c[b].bar})),g.width(t).height(z).color(c.map(function(a,b){return a.color||q(a,b)}).filter(function(a,b){return!c[b].disabled&&c[b].bar}));var H=G.select(".nv-barsWrap").datum(C.length?C:[{values:[]}]),I=G.select(".nv-linesWrap").datum(D[0]&&!D[0].disabled?D:[{values:[]}]);d3.transition(H).call(g),d3.transition(I).call(f),h.scale(b).ticks(t/100).tickSize(-z,0),G.select(".nv-x.nv-axis").attr("transform","translate(0,"+d.range()[0]+")"),d3.transition(G.select(".nv-x.nv-axis")).call(h),i.scale(d).ticks(z/36).tickSize(-t,0),d3.transition(G.select(".nv-y1.nv-axis")).style("opacity",C.length?1:0).call(i),j.scale(e).ticks(z/36).tickSize(C.length?0:-t,0),G.select(".nv-y2.nv-axis").style("opacity",D.length?1:0).attr("transform","translate("+t+",0)"),d3.transition(G.select(".nv-y2.nv-axis")).call(j),k.dispatch.on("stateChange",function(b){u=b,x.stateChange(u),a.update()}),x.on("tooltipShow",function(a){s&&y(a,p.parentNode)}),x.on("changeState",function(b){"undefined"!=typeof b.disabled&&(c.forEach(function(a,c){a.disabled=b.disabled[c]}),u.disabled=b.disabled),a.update()})}),a}var b,d,e,f=c.models.line(),g=c.models.historicalBar(),h=c.models.axis(),i=c.models.axis(),j=c.models.axis(),k=c.models.legend(),l={top:30,right:60,bottom:50,left:60},m=null,n=null,o=function(a){return a.x},p=function(a){return a.y},q=c.utils.defaultColor(),r=!0,s=!0,t=function(a,b,c,d,e){return"<h3>"+a+"</h3><p>"+c+" at "+b+"</p>"},u={},v=null,w="No Data Available.",x=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState");g.padData(!0),f.clipEdge(!1).padData(!0),h.orient("bottom").tickPadding(7).highlightZero(!1),i.orient("left"),j.orient("right");var y=function(b,d){var e=b.pos[0]+(d.offsetLeft||0),g=b.pos[1]+(d.offsetTop||0),k=h.tickFormat()(f.x()(b.point,b.pointIndex)),l=(b.series.bar?i:j).tickFormat()(f.y()(b.point,b.pointIndex)),m=t(b.series.key,k,l,b,a);c.tooltip.show([e,g],m,b.value<0?"n":"s",null,d)};return f.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+l.left,a.pos[1]+l.top],x.tooltipShow(a)}),f.dispatch.on("elementMouseout.tooltip",function(a){x.tooltipHide(a)}),g.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+l.left,a.pos[1]+l.top],x.tooltipShow(a)}),g.dispatch.on("elementMouseout.tooltip",function(a){x.tooltipHide(a)}),x.on("tooltipHide",function(){s&&c.tooltip.cleanup()}),a.dispatch=x,a.legend=k,a.lines=f,a.bars=g,a.xAxis=h,a.y1Axis=i,a.y2Axis=j,d3.rebind(a,f,"defined","size","clipVoronoi","interpolate"),a.options=c.utils.optionsFunc.bind(a),a.x=function(b){return arguments.length?(o=b,f.x(b),g.x(b),a):o},a.y=function(b){return arguments.length?(p=b,f.y(b),g.y(b),a):p},a.margin=function(b){return arguments.length?(l.top="undefined"!=typeof b.top?b.top:l.top,l.right="undefined"!=typeof b.right?b.right:l.right,l.bottom="undefined"!=typeof b.bottom?b.bottom:l.bottom,l.left="undefined"!=typeof b.left?b.left:l.left,a):l},a.width=function(b){return arguments.length?(m=b,a):m},a.height=function(b){return arguments.length?(n=b,a):n},a.color=function(b){return arguments.length?(q=c.utils.getColor(b),k.color(q),a):q},a.showLegend=function(b){return arguments.length?(r=b,a):r},a.tooltips=function(b){return arguments.length?(s=b,a):s},a.tooltipContent=function(b){return arguments.length?(t=b,a):t},a.state=function(b){return arguments.length?(u=b,a):u},a.defaultState=function(b){return arguments.length?(v=b,a):v},a.noData=function(b){return arguments.length?(w=b,a):w},a},c.models.lineWithFocusChart=function(){"use strict";function a(c){return c.each(function(c){function x(a){var b=+("e"==a),c=b?1:-1,d=I/3;return"M"+.5*c+","+d+"A6,6 0 0 "+b+" "+6.5*c+","+(d+6)+"V"+(2*d-6)+"A6,6 0 0 "+b+" "+.5*c+","+2*d+"ZM"+2.5*c+","+(d+8)+"V"+(2*d-8)+"M"+4.5*c+","+(d+8)+"V"+(2*d-8)}function C(){n.empty()||n.extent(v),Q.data([n.empty()?e.domain():v]).each(function(a,c){var d=e(a[0])-b.range()[0],f=b.range()[1]-e(a[1]);d3.select(this).select(".left").attr("width",0>d?0:d),d3.select(this).select(".right").attr("x",e(a[1])).attr("width",0>f?0:f)})}function D(){v=n.empty()?null:n.extent();var a=n.empty()?e.domain():n.extent();if(!(Math.abs(a[0]-a[1])<=1)){z.brush({extent:a,brush:n}),C();var b=M.select(".nv-focus .nv-linesWrap").datum(c.filter(function(a){return!a.disabled}).map(function(b,c){return{key:b.key,values:b.values.filter(function(b,c){return g.x()(b,c)>=a[0]&&g.x()(b,c)<=a[1]})}}));b.transition().duration(A).call(g),M.select(".nv-focus .nv-x.nv-axis").transition().duration(A).call(i),M.select(".nv-focus .nv-y.nv-axis").transition().duration(A).call(j)}}var E=d3.select(this),F=this,G=(r||parseInt(E.style("width"))||960)-o.left-o.right,H=(s||parseInt(E.style("height"))||400)-o.top-o.bottom-t,I=t-p.top-p.bottom;if(a.update=function(){E.transition().duration(A).call(a)},a.container=this,!(c&&c.length&&c.filter(function(a){return a.values.length}).length)){var J=E.selectAll(".nv-noData").data([y]);return J.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),J.attr("x",o.left+G/2).attr("y",o.top+H/2).text(function(a){return a}),a}E.selectAll(".nv-noData").remove(),b=g.xScale(),d=g.yScale(),e=h.xScale(),f=h.yScale();var K=E.selectAll("g.nv-wrap.nv-lineWithFocusChart").data([c]),L=K.enter().append("g").attr("class","nvd3 nv-wrap nv-lineWithFocusChart").append("g"),M=K.select("g");L.append("g").attr("class","nv-legendWrap");var N=L.append("g").attr("class","nv-focus");N.append("g").attr("class","nv-x nv-axis"),N.append("g").attr("class","nv-y nv-axis"),N.append("g").attr("class","nv-linesWrap");var O=L.append("g").attr("class","nv-context");O.append("g").attr("class","nv-x nv-axis"),O.append("g").attr("class","nv-y nv-axis"),O.append("g").attr("class","nv-linesWrap"),O.append("g").attr("class","nv-brushBackground"),O.append("g").attr("class","nv-x nv-brush"),u&&(m.width(G),M.select(".nv-legendWrap").datum(c).call(m),o.top!=m.height()&&(o.top=m.height(),H=(s||parseInt(E.style("height"))||400)-o.top-o.bottom-t),M.select(".nv-legendWrap").attr("transform","translate(0,"+-o.top+")")),K.attr("transform","translate("+o.left+","+o.top+")"),g.width(G).height(H).color(c.map(function(a,b){return a.color||q(a,b)}).filter(function(a,b){return!c[b].disabled})),h.defined(g.defined()).width(G).height(I).color(c.map(function(a,b){return a.color||q(a,b)}).filter(function(a,b){return!c[b].disabled})),M.select(".nv-context").attr("transform","translate(0,"+(H+o.bottom+p.top)+")");var P=M.select(".nv-context .nv-linesWrap").datum(c.filter(function(a){return!a.disabled}));d3.transition(P).call(h),i.scale(b).ticks(G/100).tickSize(-H,0),j.scale(d).ticks(H/36).tickSize(-G,0),M.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+H+")"),n.x(e).on("brush",function(){var b=a.transitionDuration();a.transitionDuration(0),D(),a.transitionDuration(b)}),v&&n.extent(v);var Q=M.select(".nv-brushBackground").selectAll("g").data([v||n.extent()]),R=Q.enter().append("g");R.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",I),R.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",I);var S=M.select(".nv-x.nv-brush").call(n);S.selectAll("rect").attr("height",I),S.selectAll(".resize").append("path").attr("d",x),D(),k.scale(e).ticks(G/100).tickSize(-I,0),M.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+f.range()[0]+")"),d3.transition(M.select(".nv-context .nv-x.nv-axis")).call(k),l.scale(f).ticks(I/36).tickSize(-G,0),d3.transition(M.select(".nv-context .nv-y.nv-axis")).call(l),M.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+f.range()[0]+")"),m.dispatch.on("stateChange",function(b){a.update()}),z.on("tooltipShow",function(a){w&&B(a,F.parentNode)})}),a}var b,d,e,f,g=c.models.line(),h=c.models.line(),i=c.models.axis(),j=c.models.axis(),k=c.models.axis(),l=c.models.axis(),m=c.models.legend(),n=d3.svg.brush(),o={top:30,right:30,bottom:30,left:60},p={top:0,right:30,bottom:20,left:60},q=c.utils.defaultColor(),r=null,s=null,t=100,u=!0,v=null,w=!0,x=function(a,b,c,d,e){return"<h3>"+a+"</h3><p>"+c+" at "+b+"</p>"},y="No Data Available.",z=d3.dispatch("tooltipShow","tooltipHide","brush"),A=250;g.clipEdge(!0),h.interactive(!1),i.orient("bottom").tickPadding(5),j.orient("left"),k.orient("bottom").tickPadding(5),l.orient("left");var B=function(b,d){var e=b.pos[0]+(d.offsetLeft||0),f=b.pos[1]+(d.offsetTop||0),h=i.tickFormat()(g.x()(b.point,b.pointIndex)),k=j.tickFormat()(g.y()(b.point,b.pointIndex)),l=x(b.series.key,h,k,b,a);c.tooltip.show([e,f],l,null,null,d)};return g.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+o.left,a.pos[1]+o.top],z.tooltipShow(a)}),g.dispatch.on("elementMouseout.tooltip",function(a){z.tooltipHide(a)}),z.on("tooltipHide",function(){w&&c.tooltip.cleanup()}),a.dispatch=z,a.legend=m,a.lines=g,a.lines2=h,a.xAxis=i,a.yAxis=j,a.x2Axis=k,a.y2Axis=l,d3.rebind(a,g,"defined","isArea","size","xDomain","yDomain","xRange","yRange","forceX","forceY","interactive","clipEdge","clipVoronoi","id"),a.options=c.utils.optionsFunc.bind(a),a.x=function(b){return arguments.length?(g.x(b),h.x(b),a):g.x},a.y=function(b){return arguments.length?(g.y(b),h.y(b),a):g.y},a.margin=function(b){return arguments.length?(o.top="undefined"!=typeof b.top?b.top:o.top,o.right="undefined"!=typeof b.right?b.right:o.right,o.bottom="undefined"!=typeof b.bottom?b.bottom:o.bottom,o.left="undefined"!=typeof b.left?b.left:o.left,a):o},a.margin2=function(b){return arguments.length?(p=b,a):p},a.width=function(b){return arguments.length?(r=b,a):r},a.height=function(b){return arguments.length?(s=b,a):s},a.height2=function(b){return arguments.length?(t=b,a):t},a.color=function(b){return arguments.length?(q=c.utils.getColor(b),m.color(q),a):q},a.showLegend=function(b){return arguments.length?(u=b,a):u},a.tooltips=function(b){return arguments.length?(w=b,a):w},a.tooltipContent=function(b){return arguments.length?(x=b,a):x},a.interpolate=function(b){return arguments.length?(g.interpolate(b),h.interpolate(b),a):g.interpolate()},a.noData=function(b){return arguments.length?(y=b,a):y},a.xTickFormat=function(b){return arguments.length?(i.tickFormat(b),k.tickFormat(b),a):i.tickFormat()},a.yTickFormat=function(b){return arguments.length?(j.tickFormat(b),l.tickFormat(b),a):j.tickFormat()},a.brushExtent=function(b){return arguments.length?(v=b,a):v},a.transitionDuration=function(b){return arguments.length?(A=b,a):A},a},c.models.linePlusBarWithFocusChart=function(){"use strict";function a(c){return c.each(function(c){function G(a){var b=+("e"==a),c=b?1:-1,d=R/3;return"M"+.5*c+","+d+"A6,6 0 0 "+b+" "+6.5*c+","+(d+6)+"V"+(2*d-6)+"A6,6 0 0 "+b+" "+.5*c+","+2*d+"ZM"+2.5*c+","+(d+8)+"V"+(2*d-8)+"M"+4.5*c+","+(d+8)+"V"+(2*d-8)}function L(){u.empty()||u.extent(E),ca.data([u.empty()?e.domain():E]).each(function(a,b){var c=e(a[0])-e.range()[0],d=e.range()[1]-e(a[1]);d3.select(this).select(".left").attr("width",0>c?0:c),d3.select(this).select(".right").attr("x",e(a[1])).attr("width",0>d?0:d)})}function M(){E=u.empty()?null:u.extent(),b=u.empty()?e.domain():u.extent(),I.brush({extent:b,brush:u}),L(),l.width(P).height(Q).color(c.map(function(a,b){return a.color||C(a,b)}).filter(function(a,b){return!c[b].disabled&&c[b].bar})),j.width(P).height(Q).color(c.map(function(a,b){return a.color||C(a,b)}).filter(function(a,b){return!c[b].disabled&&!c[b].bar}));var a=Z.select(".nv-focus .nv-barsWrap").datum(T.length?T.map(function(a,c){return{key:a.key,values:a.values.filter(function(a,c){return l.x()(a,c)>=b[0]&&l.x()(a,c)<=b[1]})}}):[{values:[]}]),h=Z.select(".nv-focus .nv-linesWrap").datum(U[0].disabled?[{values:[]}]:U.map(function(a,c){return{key:a.key,values:a.values.filter(function(a,c){return j.x()(a,c)>=b[0]&&j.x()(a,c)<=b[1]})}}));d=T.length?l.xScale():j.xScale(),n.scale(d).ticks(P/100).tickSize(-Q,0),n.domain([Math.ceil(b[0]),Math.floor(b[1])]),Z.select(".nv-x.nv-axis").transition().duration(J).call(n),a.transition().duration(J).call(l),h.transition().duration(J).call(j),Z.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+f.range()[0]+")"),p.scale(f).ticks(Q/36).tickSize(-P,0),Z.select(".nv-focus .nv-y1.nv-axis").style("opacity",T.length?1:0),q.scale(g).ticks(Q/36).tickSize(T.length?0:-P,0),Z.select(".nv-focus .nv-y2.nv-axis").style("opacity",U.length?1:0).attr("transform","translate("+d.range()[1]+",0)"),Z.select(".nv-focus .nv-y1.nv-axis").transition().duration(J).call(p),Z.select(".nv-focus .nv-y2.nv-axis").transition().duration(J).call(q)}var N=d3.select(this),O=this,P=(x||parseInt(N.style("width"))||960)-v.left-v.right,Q=(y||parseInt(N.style("height"))||400)-v.top-v.bottom-z,R=z-w.top-w.bottom;if(a.update=function(){N.transition().duration(J).call(a)},a.container=this,!(c&&c.length&&c.filter(function(a){return a.values.length}).length)){var S=N.selectAll(".nv-noData").data([H]);return S.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),S.attr("x",v.left+P/2).attr("y",v.top+Q/2).text(function(a){return a}),a}N.selectAll(".nv-noData").remove();var T=c.filter(function(a){return!a.disabled&&a.bar}),U=c.filter(function(a){return!a.bar});d=l.xScale(),e=o.scale(),f=l.yScale(),g=j.yScale(),h=m.yScale(),i=k.yScale();var V=c.filter(function(a){return!a.disabled&&a.bar}).map(function(a){return a.values.map(function(a,b){return{x:A(a,b),y:B(a,b)}})}),W=c.filter(function(a){return!a.disabled&&!a.bar}).map(function(a){return a.values.map(function(a,b){return{x:A(a,b),y:B(a,b)}})});d.range([0,P]),e.domain(d3.extent(d3.merge(V.concat(W)),function(a){return a.x})).range([0,P]);var X=N.selectAll("g.nv-wrap.nv-linePlusBar").data([c]),Y=X.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g"),Z=X.select("g");Y.append("g").attr("class","nv-legendWrap");var $=Y.append("g").attr("class","nv-focus");$.append("g").attr("class","nv-x nv-axis"),$.append("g").attr("class","nv-y1 nv-axis"),$.append("g").attr("class","nv-y2 nv-axis"),$.append("g").attr("class","nv-barsWrap"),$.append("g").attr("class","nv-linesWrap");var _=Y.append("g").attr("class","nv-context");_.append("g").attr("class","nv-x nv-axis"),_.append("g").attr("class","nv-y1 nv-axis"),_.append("g").attr("class","nv-y2 nv-axis"),_.append("g").attr("class","nv-barsWrap"),_.append("g").attr("class","nv-linesWrap"),_.append("g").attr("class","nv-brushBackground"),_.append("g").attr("class","nv-x nv-brush"),D&&(t.width(P/2),Z.select(".nv-legendWrap").datum(c.map(function(a){return a.originalKey=void 0===a.originalKey?a.key:a.originalKey,a.key=a.originalKey+(a.bar?" (left axis)":" (right axis)"),a})).call(t),v.top!=t.height()&&(v.top=t.height(),Q=(y||parseInt(N.style("height"))||400)-v.top-v.bottom-z),Z.select(".nv-legendWrap").attr("transform","translate("+P/2+","+-v.top+")")),X.attr("transform","translate("+v.left+","+v.top+")"),m.width(P).height(R).color(c.map(function(a,b){return a.color||C(a,b)}).filter(function(a,b){return!c[b].disabled&&c[b].bar})),k.width(P).height(R).color(c.map(function(a,b){return a.color||C(a,b)}).filter(function(a,b){return!c[b].disabled&&!c[b].bar}));var aa=Z.select(".nv-context .nv-barsWrap").datum(T.length?T:[{values:[]}]),ba=Z.select(".nv-context .nv-linesWrap").datum(U[0].disabled?[{values:[]}]:U);Z.select(".nv-context").attr("transform","translate(0,"+(Q+v.bottom+w.top)+")"),aa.transition().call(m),ba.transition().call(k),u.x(e).on("brush",M),E&&u.extent(E);var ca=Z.select(".nv-brushBackground").selectAll("g").data([E||u.extent()]),da=ca.enter().append("g");da.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",R),da.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",R);var ea=Z.select(".nv-x.nv-brush").call(u);ea.selectAll("rect").attr("height",R),ea.selectAll(".resize").append("path").attr("d",G),o.ticks(P/100).tickSize(-R,0),Z.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+h.range()[0]+")"),Z.select(".nv-context .nv-x.nv-axis").transition().call(o),r.scale(h).ticks(R/36).tickSize(-P,0),Z.select(".nv-context .nv-y1.nv-axis").style("opacity",T.length?1:0).attr("transform","translate(0,"+e.range()[0]+")"),Z.select(".nv-context .nv-y1.nv-axis").transition().call(r),s.scale(i).ticks(R/36).tickSize(T.length?0:-P,0),Z.select(".nv-context .nv-y2.nv-axis").style("opacity",U.length?1:0).attr("transform","translate("+e.range()[1]+",0)"),Z.select(".nv-context .nv-y2.nv-axis").transition().call(s),t.dispatch.on("stateChange",function(b){a.update()}),I.on("tooltipShow",function(a){F&&K(a,O.parentNode)}),M()}),a}var b,d,e,f,g,h,i,j=c.models.line(),k=c.models.line(),l=c.models.historicalBar(),m=c.models.historicalBar(),n=c.models.axis(),o=c.models.axis(),p=c.models.axis(),q=c.models.axis(),r=c.models.axis(),s=c.models.axis(),t=c.models.legend(),u=d3.svg.brush(),v={top:30,right:30,bottom:30,left:60},w={top:0,right:30,bottom:20,left:60},x=null,y=null,z=100,A=function(a){return a.x},B=function(a){return a.y},C=c.utils.defaultColor(),D=!0,E=null,F=!0,G=function(a,b,c,d,e){return"<h3>"+a+"</h3><p>"+c+" at "+b+"</p>"},H="No Data Available.",I=d3.dispatch("tooltipShow","tooltipHide","brush"),J=0;j.clipEdge(!0),k.interactive(!1),n.orient("bottom").tickPadding(5),p.orient("left"),q.orient("right"),o.orient("bottom").tickPadding(5),r.orient("left"),s.orient("right");var K=function(d,e){b&&(d.pointIndex+=Math.ceil(b[0]));var f=d.pos[0]+(e.offsetLeft||0),g=d.pos[1]+(e.offsetTop||0),h=n.tickFormat()(j.x()(d.point,d.pointIndex)),i=(d.series.bar?p:q).tickFormat()(j.y()(d.point,d.pointIndex)),k=G(d.series.key,h,i,d,a);c.tooltip.show([f,g],k,d.value<0?"n":"s",null,e)};return j.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+v.left,a.pos[1]+v.top],I.tooltipShow(a)}),j.dispatch.on("elementMouseout.tooltip",function(a){I.tooltipHide(a)}),l.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+v.left,a.pos[1]+v.top],I.tooltipShow(a)}),l.dispatch.on("elementMouseout.tooltip",function(a){I.tooltipHide(a)}),I.on("tooltipHide",function(){F&&c.tooltip.cleanup()}),a.dispatch=I,a.legend=t,a.lines=j,a.lines2=k,a.bars=l,a.bars2=m,a.xAxis=n,a.x2Axis=o,a.y1Axis=p,a.y2Axis=q,a.y3Axis=r,a.y4Axis=s,d3.rebind(a,j,"defined","size","clipVoronoi","interpolate"),a.options=c.utils.optionsFunc.bind(a),a.x=function(b){return arguments.length?(A=b,j.x(b),l.x(b),a):A},a.y=function(b){return arguments.length?(B=b,j.y(b),l.y(b),a):B},a.margin=function(b){return arguments.length?(v.top="undefined"!=typeof b.top?b.top:v.top,v.right="undefined"!=typeof b.right?b.right:v.right,v.bottom="undefined"!=typeof b.bottom?b.bottom:v.bottom,v.left="undefined"!=typeof b.left?b.left:v.left,a):v},a.width=function(b){return arguments.length?(x=b,a):x},a.height=function(b){return arguments.length?(y=b,a):y},a.color=function(b){return arguments.length?(C=c.utils.getColor(b),t.color(C),a):C},a.showLegend=function(b){return arguments.length?(D=b,a):D},a.tooltips=function(b){return arguments.length?(F=b,a):F},a.tooltipContent=function(b){return arguments.length?(G=b,a):G},a.noData=function(b){return arguments.length?(H=b,a):H},a.brushExtent=function(b){return arguments.length?(E=b,a):E},a},c.models.multiBar=function(){"use strict";function a(c){return c.each(function(a){var c=k-j.left-j.right,B=l-j.top-j.bottom,C=d3.select(this);w&&a.length&&(w=[{values:a[0].values.map(function(a){return{x:a.x,y:0,series:a.series,size:.01}})}]),t&&(a=d3.layout.stack().offset(u).values(function(a){return a.values}).y(q)(!a.length&&w?w:a)),a.forEach(function(a,b){a.values.forEach(function(a){a.series=b})}),t&&a[0].values.map(function(b,c){var d=0,e=0;a.map(function(a){var b=a.values[c];b.size=Math.abs(b.y),b.y<0?(b.y1=e,e-=b.size):(b.y1=b.size+d,d+=b.size)})});var D=d&&e?[]:a.map(function(a){return a.values.map(function(a,b){return{x:p(a,b),y:q(a,b),y0:a.y0,y1:a.y1}})});m.domain(d||d3.merge(D).map(function(a){return a.x})).rangeBands(f||[0,c],z),n.domain(e||d3.extent(d3.merge(D).map(function(a){return t?a.y>0?a.y1:a.y1+a.y:a.y}).concat(r))).range(g||[B,0]),m.domain()[0]===m.domain()[1]&&(m.domain()[0]?m.domain([m.domain()[0]-.01*m.domain()[0],m.domain()[1]+.01*m.domain()[1]]):m.domain([-1,1])),n.domain()[0]===n.domain()[1]&&(n.domain()[0]?n.domain([n.domain()[0]+.01*n.domain()[0],n.domain()[1]-.01*n.domain()[1]]):n.domain([-1,1])),h=h||m,i=i||n;var E=C.selectAll("g.nv-wrap.nv-multibar").data([a]),F=E.enter().append("g").attr("class","nvd3 nv-wrap nv-multibar"),G=F.append("defs"),H=F.append("g"),I=E.select("g");H.append("g").attr("class","nv-groups"),E.attr("transform","translate("+j.left+","+j.top+")"),G.append("clipPath").attr("id","nv-edge-clip-"+o).append("rect"),E.select("#nv-edge-clip-"+o+" rect").attr("width",c).attr("height",B),
I.attr("clip-path",s?"url(#nv-edge-clip-"+o+")":"");var J=E.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a,b){return b});J.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),J.exit().transition().selectAll("rect.nv-bar").delay(function(b,c){return c*y/a[0].values.length}).attr("y",function(a){return i(t?a.y0:0)}).attr("height",0).remove(),J.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return v(a,b)}).style("stroke",function(a,b){return v(a,b)}),J.transition().style("stroke-opacity",1).style("fill-opacity",.75);var K=J.selectAll("rect.nv-bar").data(function(b){return w&&!a.length?w.values:b.values});K.exit().remove();K.enter().append("rect").attr("class",function(a,b){return q(a,b)<0?"nv-bar negative":"nv-bar positive"}).attr("x",function(b,c,d){return t?0:d*m.rangeBand()/a.length}).attr("y",function(a){return i(t?a.y0:0)}).attr("height",0).attr("width",m.rangeBand()/(t?1:a.length)).attr("transform",function(a,b){return"translate("+m(p(a,b))+",0)"});K.style("fill",function(a,b,c){return v(a,c,b)}).style("stroke",function(a,b,c){return v(a,c,b)}).on("mouseover",function(b,c){d3.select(this).classed("hover",!0),A.elementMouseover({value:q(b,c),point:b,series:a[b.series],pos:[m(p(b,c))+m.rangeBand()*(t?a.length/2:b.series+.5)/a.length,n(q(b,c)+(t?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),A.elementMouseout({value:q(b,c),point:b,series:a[b.series],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("click",function(b,c){A.elementClick({value:q(b,c),point:b,series:a[b.series],pos:[m(p(b,c))+m.rangeBand()*(t?a.length/2:b.series+.5)/a.length,n(q(b,c)+(t?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(b,c){A.elementDblClick({value:q(b,c),point:b,series:a[b.series],pos:[m(p(b,c))+m.rangeBand()*(t?a.length/2:b.series+.5)/a.length,n(q(b,c)+(t?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}),K.attr("class",function(a,b){return q(a,b)<0?"nv-bar negative":"nv-bar positive"}).transition().attr("transform",function(a,b){return"translate("+m(p(a,b))+",0)"}),x&&(b||(b=a.map(function(){return!0})),K.style("fill",function(a,c,d){return d3.rgb(x(a,c)).darker(b.map(function(a,b){return b}).filter(function(a,c){return!b[c]})[d]).toString()}).style("stroke",function(a,c,d){return d3.rgb(x(a,c)).darker(b.map(function(a,b){return b}).filter(function(a,c){return!b[c]})[d]).toString()})),t?K.transition().delay(function(b,c){return c*y/a[0].values.length}).attr("y",function(a,b){return n(t?a.y1:0)}).attr("height",function(a,b){return Math.max(Math.abs(n(a.y+(t?a.y0:0))-n(t?a.y0:0)),1)}).attr("x",function(b,c){return t?0:b.series*m.rangeBand()/a.length}).attr("width",m.rangeBand()/(t?1:a.length)):K.transition().delay(function(b,c){return c*y/a[0].values.length}).attr("x",function(b,c){return b.series*m.rangeBand()/a.length}).attr("width",m.rangeBand()/a.length).attr("y",function(a,b){return q(a,b)<0?n(0):n(0)-n(q(a,b))<1?n(0)-1:n(q(a,b))||0}).attr("height",function(a,b){return Math.max(Math.abs(n(q(a,b))-n(0)),1)||0}),h=m.copy(),i=n.copy()}),a}var b,d,e,f,g,h,i,j={top:0,right:0,bottom:0,left:0},k=960,l=500,m=d3.scale.ordinal(),n=d3.scale.linear(),o=Math.floor(1e4*Math.random()),p=function(a){return a.x},q=function(a){return a.y},r=[0],s=!0,t=!1,u="zero",v=c.utils.defaultColor(),w=!1,x=null,y=1200,z=.1,A=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return a.dispatch=A,a.options=c.utils.optionsFunc.bind(a),a.x=function(b){return arguments.length?(p=b,a):p},a.y=function(b){return arguments.length?(q=b,a):q},a.margin=function(b){return arguments.length?(j.top="undefined"!=typeof b.top?b.top:j.top,j.right="undefined"!=typeof b.right?b.right:j.right,j.bottom="undefined"!=typeof b.bottom?b.bottom:j.bottom,j.left="undefined"!=typeof b.left?b.left:j.left,a):j},a.width=function(b){return arguments.length?(k=b,a):k},a.height=function(b){return arguments.length?(l=b,a):l},a.xScale=function(b){return arguments.length?(m=b,a):m},a.yScale=function(b){return arguments.length?(n=b,a):n},a.xDomain=function(b){return arguments.length?(d=b,a):d},a.yDomain=function(b){return arguments.length?(e=b,a):e},a.xRange=function(b){return arguments.length?(f=b,a):f},a.yRange=function(b){return arguments.length?(g=b,a):g},a.forceY=function(b){return arguments.length?(r=b,a):r},a.stacked=function(b){return arguments.length?(t=b,a):t},a.stackOffset=function(b){return arguments.length?(u=b,a):u},a.clipEdge=function(b){return arguments.length?(s=b,a):s},a.color=function(b){return arguments.length?(v=c.utils.getColor(b),a):v},a.barColor=function(b){return arguments.length?(x=c.utils.getColor(b),a):x},a.disabled=function(c){return arguments.length?(b=c,a):b},a.id=function(b){return arguments.length?(o=b,a):o},a.hideable=function(b){return arguments.length?(w=b,a):w},a.delay=function(b){return arguments.length?(y=b,a):y},a.groupSpacing=function(b){return arguments.length?(z=b,a):z},a},c.models.multiBarChart=function(){"use strict";function a(c){return c.each(function(c){var w=d3.select(this),E=this,F=(k||parseInt(w.style("width"))||960)-j.left-j.right,G=(l||parseInt(w.style("height"))||400)-j.top-j.bottom;if(a.update=function(){w.transition().duration(C).call(a)},a.container=this,x.disabled=c.map(function(a){return!!a.disabled}),!y){var H;y={};for(H in x)x[H]instanceof Array?y[H]=x[H].slice(0):y[H]=x[H]}if(!(c&&c.length&&c.filter(function(a){return a.values.length}).length)){var I=w.selectAll(".nv-noData").data([z]);return I.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),I.attr("x",j.left+F/2).attr("y",j.top+G/2).text(function(a){return a}),a}w.selectAll(".nv-noData").remove(),b=e.xScale(),d=e.yScale();var J=w.selectAll("g.nv-wrap.nv-multiBarWithLegend").data([c]),K=J.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarWithLegend").append("g"),L=J.select("g");if(K.append("g").attr("class","nv-x nv-axis"),K.append("g").attr("class","nv-y nv-axis"),K.append("g").attr("class","nv-barsWrap"),K.append("g").attr("class","nv-legendWrap"),K.append("g").attr("class","nv-controlsWrap"),o&&(h.width(F-B()),e.barColor()&&c.forEach(function(a,b){a.color=d3.rgb("#ccc").darker(1.5*b).toString()}),L.select(".nv-legendWrap").datum(c).call(h),j.top!=h.height()&&(j.top=h.height(),G=(l||parseInt(w.style("height"))||400)-j.top-j.bottom),L.select(".nv-legendWrap").attr("transform","translate("+B()+","+-j.top+")")),n){var M=[{key:"Grouped",disabled:e.stacked()},{key:"Stacked",disabled:!e.stacked()}];i.width(B()).color(["#444","#444","#444"]),L.select(".nv-controlsWrap").datum(M).attr("transform","translate(0,"+-j.top+")").call(i)}J.attr("transform","translate("+j.left+","+j.top+")"),r&&L.select(".nv-y.nv-axis").attr("transform","translate("+F+",0)"),e.disabled(c.map(function(a){return a.disabled})).width(F).height(G).color(c.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!c[b].disabled}));var N=L.select(".nv-barsWrap").datum(c.filter(function(a){return!a.disabled}));if(N.transition().call(e),p){f.scale(b).ticks(F/100).tickSize(-G,0),L.select(".nv-x.nv-axis").attr("transform","translate(0,"+d.range()[0]+")"),L.select(".nv-x.nv-axis").transition().call(f);var O=L.select(".nv-x.nv-axis > g").selectAll("g");if(O.selectAll("line, text").style("opacity",1),t){var P=function(a,b){return"translate("+a+","+b+")"},Q=5,R=17;O.selectAll("text").attr("transform",function(a,b,c){return P(0,c%2==0?Q:R)});var S=d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length;L.selectAll(".nv-x.nv-axis .nv-axisMaxMin text").attr("transform",function(a,b){return P(0,0===b||S%2!==0?R:Q)})}s&&O.filter(function(a,b){return b%Math.ceil(c[0].values.length/(F/100))!==0}).selectAll("text, line").style("opacity",0),u&&O.selectAll(".tick text").attr("transform","rotate("+u+" 0,0)").style("text-anchor",u>0?"start":"end"),L.select(".nv-x.nv-axis").selectAll("g.nv-axisMaxMin text").style("opacity",1)}q&&(g.scale(d).ticks(G/36).tickSize(-F,0),L.select(".nv-y.nv-axis").transition().call(g)),h.dispatch.on("stateChange",function(b){x=b,A.stateChange(x),a.update()}),i.dispatch.on("legendClick",function(b,c){if(b.disabled){switch(M=M.map(function(a){return a.disabled=!0,a}),b.disabled=!1,b.key){case"Grouped":e.stacked(!1);break;case"Stacked":e.stacked(!0)}x.stacked=e.stacked(),A.stateChange(x),a.update()}}),A.on("tooltipShow",function(a){v&&D(a,E.parentNode)}),A.on("changeState",function(b){"undefined"!=typeof b.disabled&&(c.forEach(function(a,c){a.disabled=b.disabled[c]}),x.disabled=b.disabled),"undefined"!=typeof b.stacked&&(e.stacked(b.stacked),x.stacked=b.stacked),a.update()})}),a}var b,d,e=c.models.multiBar(),f=c.models.axis(),g=c.models.axis(),h=c.models.legend(),i=c.models.legend(),j={top:30,right:20,bottom:50,left:60},k=null,l=null,m=c.utils.defaultColor(),n=!0,o=!0,p=!0,q=!0,r=!1,s=!0,t=!1,u=0,v=!0,w=function(a,b,c,d,e){return"<h3>"+a+"</h3><p>"+c+" on "+b+"</p>"},x={stacked:!1},y=null,z="No Data Available.",A=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),B=function(){return n?180:0},C=250;e.stacked(!1),f.orient("bottom").tickPadding(7).highlightZero(!0).showMaxMin(!1).tickFormat(function(a){return a}),g.orient(r?"right":"left").tickFormat(d3.format(",.1f")),i.updateState(!1);var D=function(b,d){var h=b.pos[0]+(d.offsetLeft||0),i=b.pos[1]+(d.offsetTop||0),j=f.tickFormat()(e.x()(b.point,b.pointIndex)),k=g.tickFormat()(e.y()(b.point,b.pointIndex)),l=w(b.series.key,j,k,b,a);c.tooltip.show([h,i],l,b.value<0?"n":"s",null,d)};return e.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+j.left,a.pos[1]+j.top],A.tooltipShow(a)}),e.dispatch.on("elementMouseout.tooltip",function(a){A.tooltipHide(a)}),A.on("tooltipHide",function(){v&&c.tooltip.cleanup()}),a.dispatch=A,a.multibar=e,a.legend=h,a.xAxis=f,a.yAxis=g,d3.rebind(a,e,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","clipEdge","id","stacked","stackOffset","delay","barColor","groupSpacing"),a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(j.top="undefined"!=typeof b.top?b.top:j.top,j.right="undefined"!=typeof b.right?b.right:j.right,j.bottom="undefined"!=typeof b.bottom?b.bottom:j.bottom,j.left="undefined"!=typeof b.left?b.left:j.left,a):j},a.width=function(b){return arguments.length?(k=b,a):k},a.height=function(b){return arguments.length?(l=b,a):l},a.color=function(b){return arguments.length?(m=c.utils.getColor(b),h.color(m),a):m},a.showControls=function(b){return arguments.length?(n=b,a):n},a.showLegend=function(b){return arguments.length?(o=b,a):o},a.showXAxis=function(b){return arguments.length?(p=b,a):p},a.showYAxis=function(b){return arguments.length?(q=b,a):q},a.rightAlignYAxis=function(b){return arguments.length?(r=b,g.orient(b?"right":"left"),a):r},a.reduceXTicks=function(b){return arguments.length?(s=b,a):s},a.rotateLabels=function(b){return arguments.length?(u=b,a):u},a.staggerLabels=function(b){return arguments.length?(t=b,a):t},a.tooltip=function(b){return arguments.length?(w=b,a):w},a.tooltips=function(b){return arguments.length?(v=b,a):v},a.tooltipContent=function(b){return arguments.length?(w=b,a):w},a.state=function(b){return arguments.length?(x=b,a):x},a.defaultState=function(b){return arguments.length?(y=b,a):y},a.noData=function(b){return arguments.length?(z=b,a):z},a.transitionDuration=function(b){return arguments.length?(C=b,a):C},a},c.models.multiBarHorizontal=function(){"use strict";function a(c){return c.each(function(a){var c=k-j.left-j.right,m=l-j.top-j.bottom;d3.select(this);u&&(a=d3.layout.stack().offset("zero").values(function(a){return a.values}).y(q)(a)),a.forEach(function(a,b){a.values.forEach(function(a){a.series=b})}),u&&a[0].values.map(function(b,c){var d=0,e=0;a.map(function(a){var b=a.values[c];b.size=Math.abs(b.y),b.y<0?(b.y1=e-b.size,e-=b.size):(b.y1=d,d+=b.size)})});var z=d&&e?[]:a.map(function(a){return a.values.map(function(a,b){return{x:p(a,b),y:q(a,b),y0:a.y0,y1:a.y1}})});n.domain(d||d3.merge(z).map(function(a){return a.x})).rangeBands(f||[0,m],.1),o.domain(e||d3.extent(d3.merge(z).map(function(a){return u?a.y>0?a.y1+a.y:a.y1:a.y}).concat(r))),v&&!u?o.range(g||[o.domain()[0]<0?x:0,c-(o.domain()[1]>0?x:0)]):o.range(g||[0,c]),h=h||n,i=i||d3.scale.linear().domain(o.domain()).range([o(0),o(0)]);var B=d3.select(this).selectAll("g.nv-wrap.nv-multibarHorizontal").data([a]),C=B.enter().append("g").attr("class","nvd3 nv-wrap nv-multibarHorizontal"),D=(C.append("defs"),C.append("g"));B.select("g");D.append("g").attr("class","nv-groups"),B.attr("transform","translate("+j.left+","+j.top+")");var E=B.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a,b){return b});E.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),E.exit().transition().style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),E.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}).style("fill",function(a,b){return s(a,b)}).style("stroke",function(a,b){return s(a,b)}),E.transition().style("stroke-opacity",1).style("fill-opacity",.75);var F=E.selectAll("g.nv-bar").data(function(a){return a.values});F.exit().remove();var G=F.enter().append("g").attr("transform",function(b,c,d){return"translate("+i(u?b.y0:0)+","+(u?0:d*n.rangeBand()/a.length+n(p(b,c)))+")"});G.append("rect").attr("width",0).attr("height",n.rangeBand()/(u?1:a.length)),F.on("mouseover",function(b,c){d3.select(this).classed("hover",!0),A.elementMouseover({value:q(b,c),point:b,series:a[b.series],pos:[o(q(b,c)+(u?b.y0:0)),n(p(b,c))+n.rangeBand()*(u?a.length/2:b.series+.5)/a.length],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),A.elementMouseout({value:q(b,c),point:b,series:a[b.series],pointIndex:c,seriesIndex:b.series,e:d3.event})}).on("click",function(b,c){A.elementClick({value:q(b,c),point:b,series:a[b.series],pos:[n(p(b,c))+n.rangeBand()*(u?a.length/2:b.series+.5)/a.length,o(q(b,c)+(u?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}).on("dblclick",function(b,c){A.elementDblClick({value:q(b,c),point:b,series:a[b.series],pos:[n(p(b,c))+n.rangeBand()*(u?a.length/2:b.series+.5)/a.length,o(q(b,c)+(u?b.y0:0))],pointIndex:c,seriesIndex:b.series,e:d3.event}),d3.event.stopPropagation()}),G.append("text"),v&&!u?(F.select("text").attr("text-anchor",function(a,b){return q(a,b)<0?"end":"start"}).attr("y",n.rangeBand()/(2*a.length)).attr("dy",".32em").text(function(a,b){return y(q(a,b))}),F.transition().select("text").attr("x",function(a,b){return q(a,b)<0?-4:o(q(a,b))-o(0)+4})):F.selectAll("text").text(""),w&&!u?(G.append("text").classed("nv-bar-label",!0),F.select("text.nv-bar-label").attr("text-anchor",function(a,b){return q(a,b)<0?"start":"end"}).attr("y",n.rangeBand()/(2*a.length)).attr("dy",".32em").text(function(a,b){return p(a,b)}),F.transition().select("text.nv-bar-label").attr("x",function(a,b){return q(a,b)<0?o(0)-o(q(a,b))+4:-4})):F.selectAll("text.nv-bar-label").text(""),F.attr("class",function(a,b){return q(a,b)<0?"nv-bar negative":"nv-bar positive"}),t&&(b||(b=a.map(function(){return!0})),F.style("fill",function(a,c,d){return d3.rgb(t(a,c)).darker(b.map(function(a,b){return b}).filter(function(a,c){return!b[c]})[d]).toString()}).style("stroke",function(a,c,d){return d3.rgb(t(a,c)).darker(b.map(function(a,b){return b}).filter(function(a,c){return!b[c]})[d]).toString()})),u?F.transition().attr("transform",function(a,b){return"translate("+o(a.y1)+","+n(p(a,b))+")"}).select("rect").attr("width",function(a,b){return Math.abs(o(q(a,b)+a.y0)-o(a.y0))}).attr("height",n.rangeBand()):F.transition().attr("transform",function(b,c){return"translate("+o(q(b,c)<0?q(b,c):0)+","+(b.series*n.rangeBand()/a.length+n(p(b,c)))+")"}).select("rect").attr("height",n.rangeBand()/a.length).attr("width",function(a,b){return Math.max(Math.abs(o(q(a,b))-o(0)),1)}),h=n.copy(),i=o.copy()}),a}var b,d,e,f,g,h,i,j={top:0,right:0,bottom:0,left:0},k=960,l=500,m=Math.floor(1e4*Math.random()),n=d3.scale.ordinal(),o=d3.scale.linear(),p=function(a){return a.x},q=function(a){return a.y},r=[0],s=c.utils.defaultColor(),t=null,u=!1,v=!1,w=!1,x=60,y=d3.format(",.2f"),z=1200,A=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return a.dispatch=A,a.options=c.utils.optionsFunc.bind(a),a.x=function(b){return arguments.length?(p=b,a):p},a.y=function(b){return arguments.length?(q=b,a):q},a.margin=function(b){return arguments.length?(j.top="undefined"!=typeof b.top?b.top:j.top,j.right="undefined"!=typeof b.right?b.right:j.right,j.bottom="undefined"!=typeof b.bottom?b.bottom:j.bottom,j.left="undefined"!=typeof b.left?b.left:j.left,a):j},a.width=function(b){return arguments.length?(k=b,a):k},a.height=function(b){return arguments.length?(l=b,a):l},a.xScale=function(b){return arguments.length?(n=b,a):n},a.yScale=function(b){return arguments.length?(o=b,a):o},a.xDomain=function(b){return arguments.length?(d=b,a):d},a.yDomain=function(b){return arguments.length?(e=b,a):e},a.xRange=function(b){return arguments.length?(f=b,a):f},a.yRange=function(b){return arguments.length?(g=b,a):g},a.forceY=function(b){return arguments.length?(r=b,a):r},a.stacked=function(b){return arguments.length?(u=b,a):u},a.color=function(b){return arguments.length?(s=c.utils.getColor(b),a):s},a.barColor=function(b){return arguments.length?(t=c.utils.getColor(b),a):t},a.disabled=function(c){return arguments.length?(b=c,a):b},a.id=function(b){return arguments.length?(m=b,a):m},a.delay=function(b){return arguments.length?(z=b,a):z},a.showValues=function(b){return arguments.length?(v=b,a):v},a.showBarLabels=function(b){return arguments.length?(w=b,a):w},a.valueFormat=function(b){return arguments.length?(y=b,a):y},a.valuePadding=function(b){return arguments.length?(x=b,a):x},a},c.models.multiBarHorizontalChart=function(){"use strict";function a(c){return c.each(function(c){var r=d3.select(this),t=this,B=(k||parseInt(r.style("width"))||960)-j.left-j.right,C=(l||parseInt(r.style("height"))||400)-j.top-j.bottom;if(a.update=function(){r.transition().duration(z).call(a)},a.container=this,u.disabled=c.map(function(a){return!!a.disabled}),!v){var D;v={};for(D in u)u[D]instanceof Array?v[D]=u[D].slice(0):v[D]=u[D]}if(!(c&&c.length&&c.filter(function(a){return a.values.length}).length)){var E=r.selectAll(".nv-noData").data([w]);return E.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),E.attr("x",j.left+B/2).attr("y",j.top+C/2).text(function(a){return a}),a}r.selectAll(".nv-noData").remove(),b=e.xScale(),d=e.yScale();var F=r.selectAll("g.nv-wrap.nv-multiBarHorizontalChart").data([c]),G=F.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarHorizontalChart").append("g"),H=F.select("g");if(G.append("g").attr("class","nv-x nv-axis"),G.append("g").attr("class","nv-y nv-axis").append("g").attr("class","nv-zeroLine").append("line"),G.append("g").attr("class","nv-barsWrap"),G.append("g").attr("class","nv-legendWrap"),G.append("g").attr("class","nv-controlsWrap"),o&&(h.width(B-y()),e.barColor()&&c.forEach(function(a,b){a.color=d3.rgb("#ccc").darker(1.5*b).toString()}),H.select(".nv-legendWrap").datum(c).call(h),j.top!=h.height()&&(j.top=h.height(),C=(l||parseInt(r.style("height"))||400)-j.top-j.bottom),H.select(".nv-legendWrap").attr("transform","translate("+y()+","+-j.top+")")),n){var I=[{key:"Grouped",disabled:e.stacked()},{key:"Stacked",disabled:!e.stacked()}];i.width(y()).color(["#444","#444","#444"]),H.select(".nv-controlsWrap").datum(I).attr("transform","translate(0,"+-j.top+")").call(i)}F.attr("transform","translate("+j.left+","+j.top+")"),e.disabled(c.map(function(a){return a.disabled})).width(B).height(C).color(c.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!c[b].disabled}));var J=H.select(".nv-barsWrap").datum(c.filter(function(a){return!a.disabled}));if(J.transition().call(e),p){f.scale(b).ticks(C/24).tickSize(-B,0),H.select(".nv-x.nv-axis").transition().call(f);var K=H.select(".nv-x.nv-axis").selectAll("g");K.selectAll("line, text")}q&&(g.scale(d).ticks(B/100).tickSize(-C,0),H.select(".nv-y.nv-axis").attr("transform","translate(0,"+C+")"),H.select(".nv-y.nv-axis").transition().call(g)),H.select(".nv-zeroLine line").attr("x1",d(0)).attr("x2",d(0)).attr("y1",0).attr("y2",-C),h.dispatch.on("stateChange",function(b){u=b,x.stateChange(u),a.update()}),i.dispatch.on("legendClick",function(b,c){if(b.disabled){switch(I=I.map(function(a){return a.disabled=!0,a}),b.disabled=!1,b.key){case"Grouped":e.stacked(!1);break;case"Stacked":e.stacked(!0)}u.stacked=e.stacked(),x.stateChange(u),a.update()}}),x.on("tooltipShow",function(a){s&&A(a,t.parentNode)}),x.on("changeState",function(b){"undefined"!=typeof b.disabled&&(c.forEach(function(a,c){a.disabled=b.disabled[c]}),u.disabled=b.disabled),"undefined"!=typeof b.stacked&&(e.stacked(b.stacked),u.stacked=b.stacked),a.update()})}),a}var b,d,e=c.models.multiBarHorizontal(),f=c.models.axis(),g=c.models.axis(),h=c.models.legend().height(30),i=c.models.legend().height(30),j={top:30,right:20,bottom:50,left:60},k=null,l=null,m=c.utils.defaultColor(),n=!0,o=!0,p=!0,q=!0,r=!1,s=!0,t=function(a,b,c,d,e){return"<h3>"+a+" - "+b+"</h3><p>"+c+"</p>"},u={stacked:r},v=null,w="No Data Available.",x=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),y=function(){return n?180:0},z=250;e.stacked(r),f.orient("left").tickPadding(5).highlightZero(!1).showMaxMin(!1).tickFormat(function(a){return a}),g.orient("bottom").tickFormat(d3.format(",.1f")),i.updateState(!1);var A=function(b,d){var h=b.pos[0]+(d.offsetLeft||0),i=b.pos[1]+(d.offsetTop||0),j=f.tickFormat()(e.x()(b.point,b.pointIndex)),k=g.tickFormat()(e.y()(b.point,b.pointIndex)),l=t(b.series.key,j,k,b,a);c.tooltip.show([h,i],l,b.value<0?"e":"w",null,d)};return e.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+j.left,a.pos[1]+j.top],x.tooltipShow(a)}),e.dispatch.on("elementMouseout.tooltip",function(a){x.tooltipHide(a)}),x.on("tooltipHide",function(){s&&c.tooltip.cleanup()}),a.dispatch=x,a.multibar=e,a.legend=h,a.xAxis=f,a.yAxis=g,d3.rebind(a,e,"x","y","xDomain","yDomain","xRange","yRange","forceX","forceY","clipEdge","id","delay","showValues","showBarLabels","valueFormat","stacked","barColor"),a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(j.top="undefined"!=typeof b.top?b.top:j.top,j.right="undefined"!=typeof b.right?b.right:j.right,j.bottom="undefined"!=typeof b.bottom?b.bottom:j.bottom,j.left="undefined"!=typeof b.left?b.left:j.left,a):j},a.width=function(b){return arguments.length?(k=b,a):k},a.height=function(b){return arguments.length?(l=b,a):l},a.color=function(b){return arguments.length?(m=c.utils.getColor(b),h.color(m),a):m},a.showControls=function(b){return arguments.length?(n=b,a):n},a.showLegend=function(b){return arguments.length?(o=b,a):o},a.showXAxis=function(b){return arguments.length?(p=b,a):p},a.showYAxis=function(b){return arguments.length?(q=b,a):q},a.tooltip=function(b){return arguments.length?(t=b,a):t},a.tooltips=function(b){return arguments.length?(s=b,a):s},a.tooltipContent=function(b){return arguments.length?(t=b,a):t},a.state=function(b){return arguments.length?(u=b,a):u},a.defaultState=function(b){return arguments.length?(v=b,a):v},a.noData=function(b){return arguments.length?(w=b,a):w},a.transitionDuration=function(b){return arguments.length?(z=b,a):z},a},c.models.multiChart=function(){"use strict";function a(c){return c.each(function(c){var l=d3.select(this),A=this;a.update=function(){l.transition().call(a)},a.container=this;var B=(h||parseInt(l.style("width"))||960)-f.left-f.right,C=(i||parseInt(l.style("height"))||400)-f.top-f.bottom,D=c.filter(function(a){return!a.disabled&&"line"==a.type&&1==a.yAxis}),E=c.filter(function(a){return!a.disabled&&"line"==a.type&&2==a.yAxis}),F=c.filter(function(a){return!a.disabled&&"bar"==a.type&&1==a.yAxis}),G=c.filter(function(a){return!a.disabled&&"bar"==a.type&&2==a.yAxis}),H=c.filter(function(a){return!a.disabled&&"area"==a.type&&1==a.yAxis}),I=c.filter(function(a){return!a.disabled&&"area"==a.type&&2==a.yAxis}),J=c.filter(function(a){return!a.disabled&&1==a.yAxis}).map(function(a){return a.values.map(function(a,b){return{x:a.x,y:a.y}})}),K=c.filter(function(a){return!a.disabled&&2==a.yAxis}).map(function(a){return a.values.map(function(a,b){return{x:a.x,y:a.y}})});b.domain(d3.extent(d3.merge(J.concat(K)),function(a){return a.x})).range([0,B]);var L=l.selectAll("g.wrap.multiChart").data([c]),M=L.enter().append("g").attr("class","wrap nvd3 multiChart").append("g");M.append("g").attr("class","x axis"),M.append("g").attr("class","y1 axis"),M.append("g").attr("class","y2 axis"),M.append("g").attr("class","lines1Wrap"),M.append("g").attr("class","lines2Wrap"),M.append("g").attr("class","bars1Wrap"),M.append("g").attr("class","bars2Wrap"),M.append("g").attr("class","stack1Wrap"),M.append("g").attr("class","stack2Wrap"),M.append("g").attr("class","legendWrap");var N=L.select("g");j&&(x.width(B/2),N.select(".legendWrap").datum(c.map(function(a){return a.originalKey=void 0===a.originalKey?a.key:a.originalKey,a.key=a.originalKey+(1==a.yAxis?"":" (right axis)"),a})).call(x),f.top!=x.height()&&(f.top=x.height(),C=(i||parseInt(l.style("height"))||400)-f.top-f.bottom),N.select(".legendWrap").attr("transform","translate("+B/2+","+-f.top+")")),o.width(B).height(C).interpolate("monotone").color(c.map(function(a,b){return a.color||g[b%g.length]}).filter(function(a,b){return!c[b].disabled&&1==c[b].yAxis&&"line"==c[b].type})),p.width(B).height(C).interpolate("monotone").color(c.map(function(a,b){return a.color||g[b%g.length]}).filter(function(a,b){return!c[b].disabled&&2==c[b].yAxis&&"line"==c[b].type})),q.width(B).height(C).color(c.map(function(a,b){return a.color||g[b%g.length]}).filter(function(a,b){return!c[b].disabled&&1==c[b].yAxis&&"bar"==c[b].type})),r.width(B).height(C).color(c.map(function(a,b){return a.color||g[b%g.length]}).filter(function(a,b){return!c[b].disabled&&2==c[b].yAxis&&"bar"==c[b].type})),s.width(B).height(C).color(c.map(function(a,b){return a.color||g[b%g.length]}).filter(function(a,b){return!c[b].disabled&&1==c[b].yAxis&&"area"==c[b].type})),t.width(B).height(C).color(c.map(function(a,b){return a.color||g[b%g.length]}).filter(function(a,b){return!c[b].disabled&&2==c[b].yAxis&&"area"==c[b].type})),N.attr("transform","translate("+f.left+","+f.top+")");var O=N.select(".lines1Wrap").datum(D),P=N.select(".bars1Wrap").datum(F),Q=N.select(".stack1Wrap").datum(H),R=N.select(".lines2Wrap").datum(E),S=N.select(".bars2Wrap").datum(G),T=N.select(".stack2Wrap").datum(I),U=H.length?H.map(function(a){return a.values}).reduce(function(a,b){return a.map(function(a,c){return{x:a.x,y:a.y+b[c].y}})}).concat([{x:0,y:0}]):[],V=I.length?I.map(function(a){return a.values}).reduce(function(a,b){return a.map(function(a,c){return{x:a.x,y:a.y+b[c].y}})}).concat([{x:0,y:0}]):[];m.domain(d||d3.extent(d3.merge(J).concat(U),function(a){return a.y})).range([0,C]),n.domain(e||d3.extent(d3.merge(K).concat(V),function(a){return a.y})).range([0,C]),o.yDomain(m.domain()),q.yDomain(m.domain()),s.yDomain(m.domain()),p.yDomain(n.domain()),r.yDomain(n.domain()),t.yDomain(n.domain()),H.length&&d3.transition(Q).call(s),I.length&&d3.transition(T).call(t),F.length&&d3.transition(P).call(q),G.length&&d3.transition(S).call(r),D.length&&d3.transition(O).call(o),E.length&&d3.transition(R).call(p),u.ticks(B/100).tickSize(-C,0),N.select(".x.axis").attr("transform","translate(0,"+C+")"),d3.transition(N.select(".x.axis")).call(u),v.ticks(C/36).tickSize(-B,0),d3.transition(N.select(".y1.axis")).call(v),w.ticks(C/36).tickSize(-B,0),d3.transition(N.select(".y2.axis")).call(w),N.select(".y2.axis").style("opacity",K.length?1:0).attr("transform","translate("+b.range()[1]+",0)"),x.dispatch.on("stateChange",function(b){a.update()}),y.on("tooltipShow",function(a){k&&z(a,A.parentNode)})}),a}var b,d,e,f={top:30,right:20,bottom:50,left:60},g=d3.scale.category20().range(),h=null,i=null,j=!0,k=!0,l=function(a,b,c,d,e){return"<h3>"+a+"</h3><p>"+c+" at "+b+"</p>"},b=d3.scale.linear(),m=d3.scale.linear(),n=d3.scale.linear(),o=c.models.line().yScale(m),p=c.models.line().yScale(n),q=c.models.multiBar().stacked(!1).yScale(m),r=c.models.multiBar().stacked(!1).yScale(n),s=c.models.stackedArea().yScale(m),t=c.models.stackedArea().yScale(n),u=c.models.axis().scale(b).orient("bottom").tickPadding(5),v=c.models.axis().scale(m).orient("left"),w=c.models.axis().scale(n).orient("right"),x=c.models.legend().height(30),y=d3.dispatch("tooltipShow","tooltipHide"),z=function(b,d){var e=b.pos[0]+(d.offsetLeft||0),f=b.pos[1]+(d.offsetTop||0),g=u.tickFormat()(o.x()(b.point,b.pointIndex)),h=(2==b.series.yAxis?w:v).tickFormat()(o.y()(b.point,b.pointIndex)),i=l(b.series.key,g,h,b,a);c.tooltip.show([e,f],i,void 0,void 0,d.offsetParent)};return o.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+f.left,a.pos[1]+f.top],y.tooltipShow(a)}),o.dispatch.on("elementMouseout.tooltip",function(a){y.tooltipHide(a)}),p.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+f.left,a.pos[1]+f.top],y.tooltipShow(a)}),p.dispatch.on("elementMouseout.tooltip",function(a){y.tooltipHide(a)}),q.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+f.left,a.pos[1]+f.top],y.tooltipShow(a)}),q.dispatch.on("elementMouseout.tooltip",function(a){y.tooltipHide(a)}),r.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+f.left,a.pos[1]+f.top],y.tooltipShow(a)}),r.dispatch.on("elementMouseout.tooltip",function(a){y.tooltipHide(a)}),s.dispatch.on("tooltipShow",function(a){return Math.round(100*s.y()(a.point))?(a.pos=[a.pos[0]+f.left,a.pos[1]+f.top],void y.tooltipShow(a)):(setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0),!1)}),s.dispatch.on("tooltipHide",function(a){y.tooltipHide(a)}),t.dispatch.on("tooltipShow",function(a){return Math.round(100*t.y()(a.point))?(a.pos=[a.pos[0]+f.left,a.pos[1]+f.top],void y.tooltipShow(a)):(setTimeout(function(){d3.selectAll(".point.hover").classed("hover",!1)},0),!1)}),t.dispatch.on("tooltipHide",function(a){y.tooltipHide(a)}),o.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+f.left,a.pos[1]+f.top],y.tooltipShow(a)}),o.dispatch.on("elementMouseout.tooltip",function(a){y.tooltipHide(a)}),p.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+f.left,a.pos[1]+f.top],y.tooltipShow(a)}),p.dispatch.on("elementMouseout.tooltip",function(a){y.tooltipHide(a)}),y.on("tooltipHide",function(){k&&c.tooltip.cleanup()}),a.dispatch=y,a.lines1=o,a.lines2=p,a.bars1=q,a.bars2=r,a.stack1=s,a.stack2=t,a.xAxis=u,a.yAxis1=v,a.yAxis2=w,a.options=c.utils.optionsFunc.bind(a),a.x=function(b){return arguments.length?(getX=b,o.x(b),q.x(b),a):getX},a.y=function(b){return arguments.length?(getY=b,o.y(b),q.y(b),a):getY},a.yDomain1=function(b){return arguments.length?(d=b,a):d},a.yDomain2=function(b){return arguments.length?(e=b,a):e},a.margin=function(b){return arguments.length?(f=b,a):f},a.width=function(b){return arguments.length?(h=b,a):h},a.height=function(b){return arguments.length?(i=b,a):i},a.color=function(b){return arguments.length?(g=b,x.color(b),a):g},a.showLegend=function(b){return arguments.length?(j=b,a):j},a.tooltips=function(b){return arguments.length?(k=b,a):k},a.tooltipContent=function(b){return arguments.length?(l=b,a):l},a},c.models.ohlcBar=function(){"use strict";function a(c){return c.each(function(a){var c=h-g.left-g.right,w=i-g.top-g.bottom,y=d3.select(this);k.domain(b||d3.extent(a[0].values.map(m).concat(s))),u?k.range(e||[.5*c/a[0].values.length,c*(a[0].values.length-.5)/a[0].values.length]):k.range(e||[0,c]),
l.domain(d||[d3.min(a[0].values.map(r).concat(t)),d3.max(a[0].values.map(q).concat(t))]).range(f||[w,0]),k.domain()[0]===k.domain()[1]&&(k.domain()[0]?k.domain([k.domain()[0]-.01*k.domain()[0],k.domain()[1]+.01*k.domain()[1]]):k.domain([-1,1])),l.domain()[0]===l.domain()[1]&&(l.domain()[0]?l.domain([l.domain()[0]+.01*l.domain()[0],l.domain()[1]-.01*l.domain()[1]]):l.domain([-1,1]));var z=d3.select(this).selectAll("g.nv-wrap.nv-ohlcBar").data([a[0].values]),A=z.enter().append("g").attr("class","nvd3 nv-wrap nv-ohlcBar"),B=A.append("defs"),C=A.append("g"),D=z.select("g");C.append("g").attr("class","nv-ticks"),z.attr("transform","translate("+g.left+","+g.top+")"),y.on("click",function(a,b){x.chartClick({data:a,index:b,pos:d3.event,id:j})}),B.append("clipPath").attr("id","nv-chart-clip-path-"+j).append("rect"),z.select("#nv-chart-clip-path-"+j+" rect").attr("width",c).attr("height",w),D.attr("clip-path",v?"url(#nv-chart-clip-path-"+j+")":"");var E=z.select(".nv-ticks").selectAll(".nv-tick").data(function(a){return a});E.exit().remove();E.enter().append("path").attr("class",function(a,b,c){return(o(a,b)>p(a,b)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+c+"-"+b}).attr("d",function(b,d){var e=c/a[0].values.length*.9;return"m0,0l0,"+(l(o(b,d))-l(q(b,d)))+"l"+-e/2+",0l"+e/2+",0l0,"+(l(r(b,d))-l(o(b,d)))+"l0,"+(l(p(b,d))-l(r(b,d)))+"l"+e/2+",0l"+-e/2+",0z"}).attr("transform",function(a,b){return"translate("+k(m(a,b))+","+l(q(a,b))+")"}).on("mouseover",function(b,c){d3.select(this).classed("hover",!0),x.elementMouseover({point:b,series:a[0],pos:[k(m(b,c)),l(n(b,c))],pointIndex:c,seriesIndex:0,e:d3.event})}).on("mouseout",function(b,c){d3.select(this).classed("hover",!1),x.elementMouseout({point:b,series:a[0],pointIndex:c,seriesIndex:0,e:d3.event})}).on("click",function(a,b){x.elementClick({value:n(a,b),data:a,index:b,pos:[k(m(a,b)),l(n(a,b))],e:d3.event,id:j}),d3.event.stopPropagation()}).on("dblclick",function(a,b){x.elementDblClick({value:n(a,b),data:a,index:b,pos:[k(m(a,b)),l(n(a,b))],e:d3.event,id:j}),d3.event.stopPropagation()});E.attr("class",function(a,b,c){return(o(a,b)>p(a,b)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+c+"-"+b}),d3.transition(E).attr("transform",function(a,b){return"translate("+k(m(a,b))+","+l(q(a,b))+")"}).attr("d",function(b,d){var e=c/a[0].values.length*.9;return"m0,0l0,"+(l(o(b,d))-l(q(b,d)))+"l"+-e/2+",0l"+e/2+",0l0,"+(l(r(b,d))-l(o(b,d)))+"l0,"+(l(p(b,d))-l(r(b,d)))+"l"+e/2+",0l"+-e/2+",0z"})}),a}var b,d,e,f,g={top:0,right:0,bottom:0,left:0},h=960,i=500,j=Math.floor(1e4*Math.random()),k=d3.scale.linear(),l=d3.scale.linear(),m=function(a){return a.x},n=function(a){return a.y},o=function(a){return a.open},p=function(a){return a.close},q=function(a){return a.high},r=function(a){return a.low},s=[],t=[],u=!1,v=!0,w=c.utils.defaultColor(),x=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return a.dispatch=x,a.options=c.utils.optionsFunc.bind(a),a.x=function(b){return arguments.length?(m=b,a):m},a.y=function(b){return arguments.length?(n=b,a):n},a.open=function(b){return arguments.length?(o=b,a):o},a.close=function(b){return arguments.length?(p=b,a):p},a.high=function(b){return arguments.length?(q=b,a):q},a.low=function(b){return arguments.length?(r=b,a):r},a.margin=function(b){return arguments.length?(g.top="undefined"!=typeof b.top?b.top:g.top,g.right="undefined"!=typeof b.right?b.right:g.right,g.bottom="undefined"!=typeof b.bottom?b.bottom:g.bottom,g.left="undefined"!=typeof b.left?b.left:g.left,a):g},a.width=function(b){return arguments.length?(h=b,a):h},a.height=function(b){return arguments.length?(i=b,a):i},a.xScale=function(b){return arguments.length?(k=b,a):k},a.yScale=function(b){return arguments.length?(l=b,a):l},a.xDomain=function(c){return arguments.length?(b=c,a):b},a.yDomain=function(b){return arguments.length?(d=b,a):d},a.xRange=function(b){return arguments.length?(e=b,a):e},a.yRange=function(b){return arguments.length?(f=b,a):f},a.forceX=function(b){return arguments.length?(s=b,a):s},a.forceY=function(b){return arguments.length?(t=b,a):t},a.padData=function(b){return arguments.length?(u=b,a):u},a.clipEdge=function(b){return arguments.length?(v=b,a):v},a.color=function(b){return arguments.length?(w=c.utils.getColor(b),a):w},a.id=function(b){return arguments.length?(j=b,a):j},a},c.models.pie=function(){"use strict";function a(c){return c.each(function(a){function c(a){a.endAngle=isNaN(a.endAngle)?0:a.endAngle,a.startAngle=isNaN(a.startAngle)?0:a.startAngle,r||(a.innerRadius=0);var b=d3.interpolate(this._current,a);return this._current=b(0),function(a){return E(b(a))}}var i=e-b.left-b.right,l=f-b.top-b.bottom,x=Math.min(i,l)/2,y=x-x/5,z=d3.select(this),A=z.selectAll(".nv-wrap.nv-pie").data(a),B=A.enter().append("g").attr("class","nvd3 nv-wrap nv-pie nv-chart-"+j),C=B.append("g"),D=A.select("g");C.append("g").attr("class","nv-pie"),C.append("g").attr("class","nv-pieLabels"),A.attr("transform","translate("+b.left+","+b.top+")"),D.select(".nv-pie").attr("transform","translate("+i/2+","+l/2+")"),D.select(".nv-pieLabels").attr("transform","translate("+i/2+","+l/2+")"),z.on("click",function(a,b){w.chartClick({data:a,index:b,pos:d3.event,id:j})});var E=d3.svg.arc().outerRadius(y);t&&E.startAngle(t),u&&E.endAngle(u),r&&E.innerRadius(x*v);var F=d3.layout.pie().sort(null).value(function(a){return a.disabled?0:h(a)}),G=A.select(".nv-pie").selectAll(".nv-slice").data(F),H=A.select(".nv-pieLabels").selectAll(".nv-label").data(F);G.exit().remove(),H.exit().remove();var I=G.enter().append("g").attr("class","nv-slice").on("mouseover",function(a,b){d3.select(this).classed("hover",!0),w.elementMouseover({label:g(a.data),value:h(a.data),point:a.data,pointIndex:b,pos:[d3.event.pageX,d3.event.pageY],id:j})}).on("mouseout",function(a,b){d3.select(this).classed("hover",!1),w.elementMouseout({label:g(a.data),value:h(a.data),point:a.data,index:b,id:j})}).on("click",function(a,b){w.elementClick({label:g(a.data),value:h(a.data),point:a.data,index:b,pos:d3.event,id:j}),d3.event.stopPropagation()}).on("dblclick",function(a,b){w.elementDblClick({label:g(a.data),value:h(a.data),point:a.data,index:b,pos:d3.event,id:j}),d3.event.stopPropagation()});G.attr("fill",function(a,b){return k(a,b)}).attr("stroke",function(a,b){return k(a,b)});I.append("path").each(function(a){this._current=a});if(G.select("path").transition().attr("d",E).attrTween("d",c),m){var J=d3.svg.arc().innerRadius(0);n&&(J=E),o&&(J=d3.svg.arc().outerRadius(E.outerRadius())),H.enter().append("g").classed("nv-label",!0).each(function(a,b){var c=d3.select(this);c.attr("transform",function(a){if(s){a.outerRadius=y+10,a.innerRadius=y+15;var b=(a.startAngle+a.endAngle)/2*(180/Math.PI);return(a.startAngle+a.endAngle)/2<Math.PI?b-=90:b+=90,"translate("+J.centroid(a)+") rotate("+b+")"}return a.outerRadius=x+10,a.innerRadius=x+15,"translate("+J.centroid(a)+")"}),c.append("rect").style("stroke","#fff").style("fill","#fff").attr("rx",3).attr("ry",3),c.append("text").style("text-anchor",s?(a.startAngle+a.endAngle)/2<Math.PI?"start":"end":"middle").style("fill","#000")});var K={},L=14,M=140,N=function(a){return Math.floor(a[0]/M)*M+","+Math.floor(a[1]/L)*L};H.transition().attr("transform",function(a){if(s){a.outerRadius=y+10,a.innerRadius=y+15;var b=(a.startAngle+a.endAngle)/2*(180/Math.PI);return(a.startAngle+a.endAngle)/2<Math.PI?b-=90:b+=90,"translate("+J.centroid(a)+") rotate("+b+")"}a.outerRadius=x+10,a.innerRadius=x+15;var c=J.centroid(a),d=N(c);return K[d]&&(c[1]-=L),K[N(c)]=!0,"translate("+c+")"}),H.select(".nv-label text").style("text-anchor",s?(d.startAngle+d.endAngle)/2<Math.PI?"start":"end":"middle").text(function(a,b){var c=(a.endAngle-a.startAngle)/(2*Math.PI),d={key:g(a.data),value:h(a.data),percent:d3.format("%")(c)};return a.value&&c>q?d[p]:""})}}),a}var b={top:0,right:0,bottom:0,left:0},e=500,f=500,g=function(a){return a.x},h=function(a){return a.y},i=function(a){return a.description},j=Math.floor(1e4*Math.random()),k=c.utils.defaultColor(),l=d3.format(",.2f"),m=!0,n=!0,o=!1,p="key",q=.02,r=!1,s=!1,t=!1,u=!1,v=.5,w=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout");return a.dispatch=w,a.options=c.utils.optionsFunc.bind(a),a.margin=function(c){return arguments.length?(b.top="undefined"!=typeof c.top?c.top:b.top,b.right="undefined"!=typeof c.right?c.right:b.right,b.bottom="undefined"!=typeof c.bottom?c.bottom:b.bottom,b.left="undefined"!=typeof c.left?c.left:b.left,a):b},a.width=function(b){return arguments.length?(e=b,a):e},a.height=function(b){return arguments.length?(f=b,a):f},a.values=function(b){return c.log("pie.values() is no longer supported."),a},a.x=function(b){return arguments.length?(g=b,a):g},a.y=function(b){return arguments.length?(h=d3.functor(b),a):h},a.description=function(b){return arguments.length?(i=b,a):i},a.showLabels=function(b){return arguments.length?(m=b,a):m},a.labelSunbeamLayout=function(b){return arguments.length?(s=b,a):s},a.donutLabelsOutside=function(b){return arguments.length?(o=b,a):o},a.pieLabelsOutside=function(b){return arguments.length?(n=b,a):n},a.labelType=function(b){return arguments.length?(p=b,p=p||"key",a):p},a.donut=function(b){return arguments.length?(r=b,a):r},a.donutRatio=function(b){return arguments.length?(v=b,a):v},a.startAngle=function(b){return arguments.length?(t=b,a):t},a.endAngle=function(b){return arguments.length?(u=b,a):u},a.id=function(b){return arguments.length?(j=b,a):j},a.color=function(b){return arguments.length?(k=c.utils.getColor(b),a):k},a.valueFormat=function(b){return arguments.length?(l=b,a):l},a.labelThreshold=function(b){return arguments.length?(q=b,a):q},a},c.models.pieChart=function(){"use strict";function a(c){return c.each(function(c){var i=d3.select(this),j=(f||parseInt(i.style("width"))||960)-e.left-e.right,k=(g||parseInt(i.style("height"))||400)-e.top-e.bottom;if(a.update=function(){i.transition().call(a)},a.container=this,l.disabled=c.map(function(a){return!!a.disabled}),!m){var p;m={};for(p in l)l[p]instanceof Array?m[p]=l[p].slice(0):m[p]=l[p]}if(!c||!c.length){var q=i.selectAll(".nv-noData").data([n]);return q.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),q.attr("x",e.left+j/2).attr("y",e.top+k/2).text(function(a){return a}),a}i.selectAll(".nv-noData").remove();var r=i.selectAll("g.nv-wrap.nv-pieChart").data([c]),s=r.enter().append("g").attr("class","nvd3 nv-wrap nv-pieChart").append("g"),t=r.select("g");s.append("g").attr("class","nv-pieWrap"),s.append("g").attr("class","nv-legendWrap"),h&&(d.width(j).key(b.x()),r.select(".nv-legendWrap").datum(c).call(d),e.top!=d.height()&&(e.top=d.height(),k=(g||parseInt(i.style("height"))||400)-e.top-e.bottom),r.select(".nv-legendWrap").attr("transform","translate(0,"+-e.top+")")),r.attr("transform","translate("+e.left+","+e.top+")"),b.width(j).height(k);var u=t.select(".nv-pieWrap").datum([c]);d3.transition(u).call(b),d.dispatch.on("stateChange",function(b){l=b,o.stateChange(l),a.update()}),b.dispatch.on("elementMouseout.tooltip",function(a){o.tooltipHide(a)}),o.on("changeState",function(b){"undefined"!=typeof b.disabled&&(c.forEach(function(a,c){a.disabled=b.disabled[c]}),l.disabled=b.disabled),a.update()})}),a}var b=c.models.pie(),d=c.models.legend(),e={top:30,right:20,bottom:20,left:20},f=null,g=null,h=!0,i=c.utils.defaultColor(),j=!0,k=function(a,b,c,d){return"<h3>"+a+"</h3><p>"+b+"</p>"},l={},m=null,n="No Data Available.",o=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),p=function(d,e){var f=b.description()(d.point)||b.x()(d.point),g=d.pos[0]+(e&&e.offsetLeft||0),h=d.pos[1]+(e&&e.offsetTop||0),i=b.valueFormat()(b.y()(d.point)),j=k(f,i,d,a);c.tooltip.show([g,h],j,d.value<0?"n":"s",null,e)};return b.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+e.left,a.pos[1]+e.top],o.tooltipShow(a)}),o.on("tooltipShow",function(a){j&&p(a)}),o.on("tooltipHide",function(){j&&c.tooltip.cleanup()}),a.legend=d,a.dispatch=o,a.pie=b,d3.rebind(a,b,"valueFormat","values","x","y","description","id","showLabels","donutLabelsOutside","pieLabelsOutside","labelType","donut","donutRatio","labelThreshold"),a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(e.top="undefined"!=typeof b.top?b.top:e.top,e.right="undefined"!=typeof b.right?b.right:e.right,e.bottom="undefined"!=typeof b.bottom?b.bottom:e.bottom,e.left="undefined"!=typeof b.left?b.left:e.left,a):e},a.width=function(b){return arguments.length?(f=b,a):f},a.height=function(b){return arguments.length?(g=b,a):g},a.color=function(e){return arguments.length?(i=c.utils.getColor(e),d.color(i),b.color(i),a):i},a.showLegend=function(b){return arguments.length?(h=b,a):h},a.tooltips=function(b){return arguments.length?(j=b,a):j},a.tooltipContent=function(b){return arguments.length?(k=b,a):k},a.state=function(b){return arguments.length?(l=b,a):l},a.defaultState=function(b){return arguments.length?(m=b,a):m},a.noData=function(b){return arguments.length?(n=b,a):n},a},c.models.scatter=function(){"use strict";function a(O){return O.each(function(a){function O(){if(!w)return!1;var b=d3.merge(a.map(function(a,b){return a.values.map(function(a,c){var d=o(a,c),e=p(a,c);return[l(d)+1e-7*Math.random(),m(e)+1e-7*Math.random(),b,c,a]}).filter(function(a,b){return y(a[4],b)})}));if(M===!0){if(C){var c=T.select("defs").selectAll(".nv-point-clips").data([k]).enter();c.append("clipPath").attr("class","nv-point-clips").attr("id","nv-points-clip-"+k);var d=T.select("#nv-points-clip-"+k).selectAll("circle").data(b);d.enter().append("circle").attr("r",D),d.exit().remove(),d.attr("cx",function(a){return a[0]}).attr("cy",function(a){return a[1]}),T.select(".nv-point-paths").attr("clip-path","url(#nv-points-clip-"+k+")")}b.length&&(b.push([l.range()[0]-20,m.range()[0]-20,null,null]),b.push([l.range()[1]+20,m.range()[1]+20,null,null]),b.push([l.range()[0]-20,m.range()[0]+20,null,null]),b.push([l.range()[1]+20,m.range()[1]-20,null,null]));var e=d3.geom.polygon([[-10,-10],[-10,i+10],[h+10,i+10],[h+10,-10]]),f=d3.geom.voronoi(b).map(function(a,c){return{data:e.clip(a),series:b[c][2],point:b[c][3]}}),j=T.select(".nv-point-paths").selectAll("path").data(f);j.enter().append("path").attr("class",function(a,b){return"nv-path-"+b}),j.exit().remove(),j.attr("d",function(a){return 0===a.data.length?"M 0 0":"M"+a.data.join("L")+"Z"});var n=function(b,c){if(N)return 0;var d=a[b.series];if("undefined"!=typeof d){var e=d.values[b.point];c({point:e,series:d,pos:[l(o(e,b.point))+g.left,m(p(e,b.point))+g.top],seriesIndex:b.series,pointIndex:b.point})}};j.on("click",function(a){n(a,L.elementClick)}).on("mouseover",function(a){n(a,L.elementMouseover)}).on("mouseout",function(a,b){n(a,L.elementMouseout)})}else T.select(".nv-groups").selectAll(".nv-group").selectAll(".nv-point").on("click",function(b,c){if(N||!a[b.series])return 0;var d=a[b.series],e=d.values[c];L.elementClick({point:e,series:d,pos:[l(o(e,c))+g.left,m(p(e,c))+g.top],seriesIndex:b.series,pointIndex:c})}).on("mouseover",function(b,c){if(N||!a[b.series])return 0;var d=a[b.series],e=d.values[c];L.elementMouseover({point:e,series:d,pos:[l(o(e,c))+g.left,m(p(e,c))+g.top],seriesIndex:b.series,pointIndex:c})}).on("mouseout",function(b,c){if(N||!a[b.series])return 0;var d=a[b.series],e=d.values[c];L.elementMouseout({point:e,series:d,seriesIndex:b.series,pointIndex:c})});N=!1}var P=h-g.left-g.right,Q=i-g.top-g.bottom,R=d3.select(this);a.forEach(function(a,b){a.values.forEach(function(a){a.series=b})});var S=E&&F&&I?[]:d3.merge(a.map(function(a){return a.values.map(function(a,b){return{x:o(a,b),y:p(a,b),size:q(a,b)}})}));l.domain(E||d3.extent(S.map(function(a){return a.x}).concat(t))),z&&a[0]?l.range(G||[(P*A+P)/(2*a[0].values.length),P-P*(1+A)/(2*a[0].values.length)]):l.range(G||[0,P]),m.domain(F||d3.extent(S.map(function(a){return a.y}).concat(u))).range(H||[Q,0]),n.domain(I||d3.extent(S.map(function(a){return a.size}).concat(v))).range(J||[16,256]),(l.domain()[0]===l.domain()[1]||m.domain()[0]===m.domain()[1])&&(K=!0),l.domain()[0]===l.domain()[1]&&(l.domain()[0]?l.domain([l.domain()[0]-.01*l.domain()[0],l.domain()[1]+.01*l.domain()[1]]):l.domain([-1,1])),m.domain()[0]===m.domain()[1]&&(m.domain()[0]?m.domain([m.domain()[0]-.01*m.domain()[0],m.domain()[1]+.01*m.domain()[1]]):m.domain([-1,1])),isNaN(l.domain()[0])&&l.domain([-1,1]),isNaN(m.domain()[0])&&m.domain([-1,1]),b=b||l,d=d||m,e=e||n;var T=R.selectAll("g.nv-wrap.nv-scatter").data([a]),U=T.enter().append("g").attr("class","nvd3 nv-wrap nv-scatter nv-chart-"+k+(K?" nv-single-point":"")),V=U.append("defs"),W=U.append("g"),X=T.select("g");W.append("g").attr("class","nv-groups"),W.append("g").attr("class","nv-point-paths"),T.attr("transform","translate("+g.left+","+g.top+")"),V.append("clipPath").attr("id","nv-edge-clip-"+k).append("rect"),T.select("#nv-edge-clip-"+k+" rect").attr("width",P).attr("height",Q),X.attr("clip-path",B?"url(#nv-edge-clip-"+k+")":""),N=!0;var Y=T.select(".nv-groups").selectAll(".nv-group").data(function(a){return a},function(a){return a.key});if(Y.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),Y.exit().remove(),Y.attr("class",function(a,b){return"nv-group nv-series-"+b}).classed("hover",function(a){return a.hover}),Y.transition().style("fill",function(a,b){return j(a,b)}).style("stroke",function(a,b){return j(a,b)}).style("stroke-opacity",1).style("fill-opacity",.5),s){var Z=Y.selectAll("circle.nv-point").data(function(a){return a.values},x);Z.enter().append("circle").style("fill",function(a,b){return a.color}).style("stroke",function(a,b){return a.color}).attr("cx",function(a,d){return c.utils.NaNtoZero(b(o(a,d)))}).attr("cy",function(a,b){return c.utils.NaNtoZero(d(p(a,b)))}).attr("r",function(a,b){return Math.sqrt(n(q(a,b))/Math.PI)}),Z.exit().remove(),Y.exit().selectAll("path.nv-point").transition().attr("cx",function(a,b){return c.utils.NaNtoZero(l(o(a,b)))}).attr("cy",function(a,b){return c.utils.NaNtoZero(m(p(a,b)))}).remove(),Z.each(function(a,b){d3.select(this).classed("nv-point",!0).classed("nv-point-"+b,!0).classed("hover",!1)}),Z.transition().attr("cx",function(a,b){return c.utils.NaNtoZero(l(o(a,b)))}).attr("cy",function(a,b){return c.utils.NaNtoZero(m(p(a,b)))}).attr("r",function(a,b){return Math.sqrt(n(q(a,b))/Math.PI)})}else{var Z=Y.selectAll("path.nv-point").data(function(a){return a.values});Z.enter().append("path").style("fill",function(a,b){return a.color}).style("stroke",function(a,b){return a.color}).attr("transform",function(a,c){return"translate("+b(o(a,c))+","+d(p(a,c))+")"}).attr("d",d3.svg.symbol().type(r).size(function(a,b){return n(q(a,b))})),Z.exit().remove(),Y.exit().selectAll("path.nv-point").transition().attr("transform",function(a,b){return"translate("+l(o(a,b))+","+m(p(a,b))+")"}).remove(),Z.each(function(a,b){d3.select(this).classed("nv-point",!0).classed("nv-point-"+b,!0).classed("hover",!1)}),Z.transition().attr("transform",function(a,b){return"translate("+l(o(a,b))+","+m(p(a,b))+")"}).attr("d",d3.svg.symbol().type(r).size(function(a,b){return n(q(a,b))}))}clearTimeout(f),f=setTimeout(O,300),b=l.copy(),d=m.copy(),e=n.copy()}),a}var b,d,e,f,g={top:0,right:0,bottom:0,left:0},h=960,i=500,j=c.utils.defaultColor(),k=Math.floor(1e5*Math.random()),l=d3.scale.linear(),m=d3.scale.linear(),n=d3.scale.linear(),o=function(a){return a.x},p=function(a){return a.y},q=function(a){return a.size||1},r=function(a){return a.shape||"circle"},s=!0,t=[],u=[],v=[],w=!0,x=null,y=function(a){return!a.notActive},z=!1,A=.1,B=!1,C=!0,D=function(){return 25},E=null,F=null,G=null,H=null,I=null,J=null,K=!1,L=d3.dispatch("elementClick","elementMouseover","elementMouseout"),M=!0,N=!1;return a.clearHighlights=function(){d3.selectAll(".nv-chart-"+k+" .nv-point.hover").classed("hover",!1)},a.highlightPoint=function(a,b,c){d3.select(".nv-chart-"+k+" .nv-series-"+a+" .nv-point-"+b).classed("hover",c)},L.on("elementMouseover.point",function(b){w&&a.highlightPoint(b.seriesIndex,b.pointIndex,!0)}),L.on("elementMouseout.point",function(b){w&&a.highlightPoint(b.seriesIndex,b.pointIndex,!1)}),a.dispatch=L,a.options=c.utils.optionsFunc.bind(a),a.x=function(b){return arguments.length?(o=d3.functor(b),a):o},a.y=function(b){return arguments.length?(p=d3.functor(b),a):p},a.size=function(b){return arguments.length?(q=d3.functor(b),a):q},a.margin=function(b){return arguments.length?(g.top="undefined"!=typeof b.top?b.top:g.top,g.right="undefined"!=typeof b.right?b.right:g.right,g.bottom="undefined"!=typeof b.bottom?b.bottom:g.bottom,g.left="undefined"!=typeof b.left?b.left:g.left,a):g},a.width=function(b){return arguments.length?(h=b,a):h},a.height=function(b){return arguments.length?(i=b,a):i},a.xScale=function(b){return arguments.length?(l=b,a):l},a.yScale=function(b){return arguments.length?(m=b,a):m},a.zScale=function(b){return arguments.length?(n=b,a):n},a.xDomain=function(b){return arguments.length?(E=b,a):E},a.yDomain=function(b){return arguments.length?(F=b,a):F},a.sizeDomain=function(b){return arguments.length?(I=b,a):I},a.xRange=function(b){return arguments.length?(G=b,a):G},a.yRange=function(b){return arguments.length?(H=b,a):H},a.sizeRange=function(b){return arguments.length?(J=b,a):J},a.forceX=function(b){return arguments.length?(t=b,a):t},a.forceY=function(b){return arguments.length?(u=b,a):u},a.forceSize=function(b){return arguments.length?(v=b,a):v},a.interactive=function(b){return arguments.length?(w=b,a):w},a.pointKey=function(b){return arguments.length?(x=b,a):x},a.pointActive=function(b){return arguments.length?(y=b,a):y},a.padData=function(b){return arguments.length?(z=b,a):z},a.padDataOuter=function(b){return arguments.length?(A=b,a):A},a.clipEdge=function(b){return arguments.length?(B=b,a):B},a.clipVoronoi=function(b){return arguments.length?(C=b,a):C},a.useVoronoi=function(b){return arguments.length?(M=b,M===!1&&(C=!1),a):M},a.clipRadius=function(b){return arguments.length?(D=b,a):D},a.color=function(b){return arguments.length?(j=c.utils.getColor(b),a):j},a.shape=function(b){return arguments.length?(r=b,a):r},a.onlyCircles=function(b){return arguments.length?(s=b,a):s},a.id=function(b){return arguments.length?(k=b,a):k},a.singlePoint=function(b){return arguments.length?(K=b,a):K},a},c.models.scatterChart=function(){"use strict";function a(c){return c.each(function(c){function B(){if(z)return U.select(".nv-point-paths").style("pointer-events","all"),!1;U.select(".nv-point-paths").style("pointer-events","none");var a=d3.mouse(this);n.distortion(y).focus(a[0]),o.distortion(y).focus(a[1]),U.select(".nv-scatterWrap").call(b),u&&U.select(".nv-x.nv-axis").call(d),v&&U.select(".nv-y.nv-axis").call(e),U.select(".nv-distributionX").datum(c.filter(function(a){return!a.disabled})).call(h),U.select(".nv-distributionY").datum(c.filter(function(a){return!a.disabled})).call(i)}var C=d3.select(this),D=this,N=(k||parseInt(C.style("width"))||960)-j.left-j.right,O=(l||parseInt(C.style("height"))||400)-j.top-j.bottom;if(a.update=function(){C.transition().duration(I).call(a)},a.container=this,E.disabled=c.map(function(a){return!!a.disabled}),!F){var P;F={};for(P in E)E[P]instanceof Array?F[P]=E[P].slice(0):F[P]=E[P]}if(!(c&&c.length&&c.filter(function(a){return a.values.length}).length)){var Q=C.selectAll(".nv-noData").data([H]);return Q.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),Q.attr("x",j.left+N/2).attr("y",j.top+O/2).text(function(a){return a}),a}C.selectAll(".nv-noData").remove(),J=J||n,K=K||o;var R=C.selectAll("g.nv-wrap.nv-scatterChart").data([c]),S=R.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+b.id()),T=S.append("g"),U=R.select("g");if(T.append("rect").attr("class","nvd3 nv-background"),T.append("g").attr("class","nv-x nv-axis"),T.append("g").attr("class","nv-y nv-axis"),T.append("g").attr("class","nv-scatterWrap"),T.append("g").attr("class","nv-distWrap"),T.append("g").attr("class","nv-legendWrap"),T.append("g").attr("class","nv-controlsWrap"),t){var V=x?N/2:N;f.width(V),R.select(".nv-legendWrap").datum(c).call(f),j.top!=f.height()&&(j.top=f.height(),O=(l||parseInt(C.style("height"))||400)-j.top-j.bottom),R.select(".nv-legendWrap").attr("transform","translate("+(N-V)+","+-j.top+")")}if(x&&(g.width(180).color(["#444"]),U.select(".nv-controlsWrap").datum(M).attr("transform","translate(0,"+-j.top+")").call(g)),R.attr("transform","translate("+j.left+","+j.top+")"),w&&U.select(".nv-y.nv-axis").attr("transform","translate("+N+",0)"),b.width(N).height(O).color(c.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!c[b].disabled})),0!==p&&b.xDomain(null),0!==q&&b.yDomain(null),R.select(".nv-scatterWrap").datum(c.filter(function(a){return!a.disabled})).call(b),0!==p){var W=n.domain()[1]-n.domain()[0];b.xDomain([n.domain()[0]-p*W,n.domain()[1]+p*W])}if(0!==q){var X=o.domain()[1]-o.domain()[0];b.yDomain([o.domain()[0]-q*X,o.domain()[1]+q*X])}(0!==q||0!==p)&&R.select(".nv-scatterWrap").datum(c.filter(function(a){return!a.disabled})).call(b),u&&(d.scale(n).ticks(d.ticks()&&d.ticks().length?d.ticks():N/100).tickSize(-O,0),U.select(".nv-x.nv-axis").attr("transform","translate(0,"+o.range()[0]+")").call(d)),v&&(e.scale(o).ticks(e.ticks()&&e.ticks().length?e.ticks():O/36).tickSize(-N,0),U.select(".nv-y.nv-axis").call(e)),r&&(h.getData(b.x()).scale(n).width(N).color(c.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!c[b].disabled})),T.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),U.select(".nv-distributionX").attr("transform","translate(0,"+o.range()[0]+")").datum(c.filter(function(a){return!a.disabled})).call(h)),s&&(i.getData(b.y()).scale(o).width(O).color(c.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!c[b].disabled})),T.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),U.select(".nv-distributionY").attr("transform","translate("+(w?N:-i.size())+",0)").datum(c.filter(function(a){return!a.disabled})).call(i)),d3.fisheye&&(U.select(".nv-background").attr("width",N).attr("height",O),U.select(".nv-background").on("mousemove",B),U.select(".nv-background").on("click",function(){z=!z}),b.dispatch.on("elementClick.freezeFisheye",function(){z=!z})),g.dispatch.on("legendClick",function(c,f){c.disabled=!c.disabled,y=c.disabled?0:2.5,U.select(".nv-background").style("pointer-events",c.disabled?"none":"all"),U.select(".nv-point-paths").style("pointer-events",c.disabled?"all":"none"),c.disabled?(n.distortion(y).focus(0),o.distortion(y).focus(0),U.select(".nv-scatterWrap").call(b),U.select(".nv-x.nv-axis").call(d),U.select(".nv-y.nv-axis").call(e)):z=!1,a.update()}),f.dispatch.on("stateChange",function(b){E.disabled=b.disabled,G.stateChange(E),a.update()}),b.dispatch.on("elementMouseover.tooltip",function(a){d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",function(b,c){return a.pos[1]-O}),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",a.pos[0]+h.size()),a.pos=[a.pos[0]+j.left,a.pos[1]+j.top],G.tooltipShow(a)}),G.on("tooltipShow",function(a){A&&L(a,D.parentNode)}),G.on("changeState",function(b){"undefined"!=typeof b.disabled&&(c.forEach(function(a,c){a.disabled=b.disabled[c]}),E.disabled=b.disabled),a.update()}),J=n.copy(),K=o.copy()}),a}var b=c.models.scatter(),d=c.models.axis(),e=c.models.axis(),f=c.models.legend(),g=c.models.legend(),h=c.models.distribution(),i=c.models.distribution(),j={top:30,right:20,bottom:50,left:75},k=null,l=null,m=c.utils.defaultColor(),n=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.xScale(),o=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.yScale(),p=0,q=0,r=!1,s=!1,t=!0,u=!0,v=!0,w=!1,x=!!d3.fisheye,y=0,z=!1,A=!0,B=function(a,b,c){return"<strong>"+b+"</strong>"},C=function(a,b,c){return"<strong>"+c+"</strong>"},D=null,E={},F=null,G=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),H="No Data Available.",I=250;b.xScale(n).yScale(o),d.orient("bottom").tickPadding(10),e.orient(w?"right":"left").tickPadding(10),h.axis("x"),i.axis("y"),g.updateState(!1);var J,K,L=function(f,g){var h=f.pos[0]+(g.offsetLeft||0),i=f.pos[1]+(g.offsetTop||0),k=f.pos[0]+(g.offsetLeft||0),l=o.range()[0]+j.top+(g.offsetTop||0),m=n.range()[0]+j.left+(g.offsetLeft||0),p=f.pos[1]+(g.offsetTop||0),q=d.tickFormat()(b.x()(f.point,f.pointIndex)),r=e.tickFormat()(b.y()(f.point,f.pointIndex));null!=B&&c.tooltip.show([k,l],B(f.series.key,q,r,f,a),"n",1,g,"x-nvtooltip"),null!=C&&c.tooltip.show([m,p],C(f.series.key,q,r,f,a),"e",1,g,"y-nvtooltip"),null!=D&&c.tooltip.show([h,i],D(f.series.key,q,r,f,a),f.value<0?"n":"s",null,g)},M=[{key:"Magnify",disabled:!0}];return b.dispatch.on("elementMouseout.tooltip",function(a){G.tooltipHide(a),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",0),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",i.size())}),G.on("tooltipHide",function(){A&&c.tooltip.cleanup()}),a.dispatch=G,a.scatter=b,a.legend=f,a.controls=g,a.xAxis=d,a.yAxis=e,a.distX=h,a.distY=i,d3.rebind(a,b,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(j.top="undefined"!=typeof b.top?b.top:j.top,j.right="undefined"!=typeof b.right?b.right:j.right,j.bottom="undefined"!=typeof b.bottom?b.bottom:j.bottom,j.left="undefined"!=typeof b.left?b.left:j.left,a):j},a.width=function(b){return arguments.length?(k=b,a):k},a.height=function(b){return arguments.length?(l=b,a):l},a.color=function(b){return arguments.length?(m=c.utils.getColor(b),f.color(m),h.color(m),i.color(m),a):m},a.showDistX=function(b){return arguments.length?(r=b,a):r},a.showDistY=function(b){return arguments.length?(s=b,a):s},a.showControls=function(b){return arguments.length?(x=b,a):x},a.showLegend=function(b){return arguments.length?(t=b,a):t},a.showXAxis=function(b){return arguments.length?(u=b,a):u},a.showYAxis=function(b){return arguments.length?(v=b,a):v},a.rightAlignYAxis=function(b){return arguments.length?(w=b,e.orient(b?"right":"left"),a):w},a.fisheye=function(b){return arguments.length?(y=b,a):y},a.xPadding=function(b){return arguments.length?(p=b,a):p},a.yPadding=function(b){return arguments.length?(q=b,a):q},a.tooltips=function(b){return arguments.length?(A=b,a):A},a.tooltipContent=function(b){return arguments.length?(D=b,a):D},a.tooltipXContent=function(b){return arguments.length?(B=b,a):B},a.tooltipYContent=function(b){return arguments.length?(C=b,a):C},a.state=function(b){return arguments.length?(E=b,a):E},a.defaultState=function(b){return arguments.length?(F=b,a):F},a.noData=function(b){return arguments.length?(H=b,a):H},a.transitionDuration=function(b){return arguments.length?(I=b,a):I},a},c.models.scatterPlusLineChart=function(){"use strict";function a(c){return c.each(function(c){function z(){if(x)return S.select(".nv-point-paths").style("pointer-events","all"),!1;S.select(".nv-point-paths").style("pointer-events","none");var a=d3.mouse(this);n.distortion(w).focus(a[0]),o.distortion(w).focus(a[1]),S.select(".nv-scatterWrap").datum(c.filter(function(a){return!a.disabled})).call(b),s&&S.select(".nv-x.nv-axis").call(d),t&&S.select(".nv-y.nv-axis").call(e),S.select(".nv-distributionX").datum(c.filter(function(a){return!a.disabled})).call(h),S.select(".nv-distributionY").datum(c.filter(function(a){return!a.disabled})).call(i)}var A=d3.select(this),B=this,L=(k||parseInt(A.style("width"))||960)-j.left-j.right,M=(l||parseInt(A.style("height"))||400)-j.top-j.bottom;if(a.update=function(){A.transition().duration(G).call(a)},a.container=this,C.disabled=c.map(function(a){return!!a.disabled}),!D){var N;D={};for(N in C)C[N]instanceof Array?D[N]=C[N].slice(0):D[N]=C[N];
-}if(!(c&&c.length&&c.filter(function(a){return a.values.length}).length)){var O=A.selectAll(".nv-noData").data([F]);return O.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),O.attr("x",j.left+L/2).attr("y",j.top+M/2).text(function(a){return a}),a}A.selectAll(".nv-noData").remove(),n=b.xScale(),o=b.yScale(),H=H||n,I=I||o;var P=A.selectAll("g.nv-wrap.nv-scatterChart").data([c]),Q=P.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+b.id()),R=Q.append("g"),S=P.select("g");R.append("rect").attr("class","nvd3 nv-background").style("pointer-events","none"),R.append("g").attr("class","nv-x nv-axis"),R.append("g").attr("class","nv-y nv-axis"),R.append("g").attr("class","nv-scatterWrap"),R.append("g").attr("class","nv-regressionLinesWrap"),R.append("g").attr("class","nv-distWrap"),R.append("g").attr("class","nv-legendWrap"),R.append("g").attr("class","nv-controlsWrap"),P.attr("transform","translate("+j.left+","+j.top+")"),u&&S.select(".nv-y.nv-axis").attr("transform","translate("+L+",0)"),r&&(f.width(L/2),P.select(".nv-legendWrap").datum(c).call(f),j.top!=f.height()&&(j.top=f.height(),M=(l||parseInt(A.style("height"))||400)-j.top-j.bottom),P.select(".nv-legendWrap").attr("transform","translate("+L/2+","+-j.top+")")),v&&(g.width(180).color(["#444"]),S.select(".nv-controlsWrap").datum(K).attr("transform","translate(0,"+-j.top+")").call(g)),b.width(L).height(M).color(c.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!c[b].disabled})),P.select(".nv-scatterWrap").datum(c.filter(function(a){return!a.disabled})).call(b),P.select(".nv-regressionLinesWrap").attr("clip-path","url(#nv-edge-clip-"+b.id()+")");var T=P.select(".nv-regressionLinesWrap").selectAll(".nv-regLines").data(function(a){return a});T.enter().append("g").attr("class","nv-regLines");var U=T.selectAll(".nv-regLine").data(function(a){return[a]});U.enter().append("line").attr("class","nv-regLine").style("stroke-opacity",0);U.transition().attr("x1",n.range()[0]).attr("x2",n.range()[1]).attr("y1",function(a,b){return o(n.domain()[0]*a.slope+a.intercept)}).attr("y2",function(a,b){return o(n.domain()[1]*a.slope+a.intercept)}).style("stroke",function(a,b,c){return m(a,c)}).style("stroke-opacity",function(a,b){return a.disabled||"undefined"==typeof a.slope||"undefined"==typeof a.intercept?0:1}),s&&(d.scale(n).ticks(d.ticks()?d.ticks():L/100).tickSize(-M,0),S.select(".nv-x.nv-axis").attr("transform","translate(0,"+o.range()[0]+")").call(d)),t&&(e.scale(o).ticks(e.ticks()?e.ticks():M/36).tickSize(-L,0),S.select(".nv-y.nv-axis").call(e)),p&&(h.getData(b.x()).scale(n).width(L).color(c.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!c[b].disabled})),R.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),S.select(".nv-distributionX").attr("transform","translate(0,"+o.range()[0]+")").datum(c.filter(function(a){return!a.disabled})).call(h)),q&&(i.getData(b.y()).scale(o).width(M).color(c.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!c[b].disabled})),R.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),S.select(".nv-distributionY").attr("transform","translate("+(u?L:-i.size())+",0)").datum(c.filter(function(a){return!a.disabled})).call(i)),d3.fisheye&&(S.select(".nv-background").attr("width",L).attr("height",M),S.select(".nv-background").on("mousemove",z),S.select(".nv-background").on("click",function(){x=!x}),b.dispatch.on("elementClick.freezeFisheye",function(){x=!x})),g.dispatch.on("legendClick",function(c,f){c.disabled=!c.disabled,w=c.disabled?0:2.5,S.select(".nv-background").style("pointer-events",c.disabled?"none":"all"),S.select(".nv-point-paths").style("pointer-events",c.disabled?"all":"none"),c.disabled?(n.distortion(w).focus(0),o.distortion(w).focus(0),S.select(".nv-scatterWrap").call(b),S.select(".nv-x.nv-axis").call(d),S.select(".nv-y.nv-axis").call(e)):x=!1,a.update()}),f.dispatch.on("stateChange",function(b){C=b,E.stateChange(C),a.update()}),b.dispatch.on("elementMouseover.tooltip",function(a){d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",a.pos[1]-M),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",a.pos[0]+h.size()),a.pos=[a.pos[0]+j.left,a.pos[1]+j.top],E.tooltipShow(a)}),E.on("tooltipShow",function(a){y&&J(a,B.parentNode)}),E.on("changeState",function(b){"undefined"!=typeof b.disabled&&(c.forEach(function(a,c){a.disabled=b.disabled[c]}),C.disabled=b.disabled),a.update()}),H=n.copy(),I=o.copy()}),a}var b=c.models.scatter(),d=c.models.axis(),e=c.models.axis(),f=c.models.legend(),g=c.models.legend(),h=c.models.distribution(),i=c.models.distribution(),j={top:30,right:20,bottom:50,left:75},k=null,l=null,m=c.utils.defaultColor(),n=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.xScale(),o=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.yScale(),p=!1,q=!1,r=!0,s=!0,t=!0,u=!1,v=!!d3.fisheye,w=0,x=!1,y=!0,z=function(a,b,c){return"<strong>"+b+"</strong>"},A=function(a,b,c){return"<strong>"+c+"</strong>"},B=function(a,b,c,d){return"<h3>"+a+"</h3><p>"+d+"</p>"},C={},D=null,E=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),F="No Data Available.",G=250;b.xScale(n).yScale(o),d.orient("bottom").tickPadding(10),e.orient(u?"right":"left").tickPadding(10),h.axis("x"),i.axis("y"),g.updateState(!1);var H,I,J=function(f,g){var h=f.pos[0]+(g.offsetLeft||0),i=f.pos[1]+(g.offsetTop||0),k=f.pos[0]+(g.offsetLeft||0),l=o.range()[0]+j.top+(g.offsetTop||0),m=n.range()[0]+j.left+(g.offsetLeft||0),p=f.pos[1]+(g.offsetTop||0),q=d.tickFormat()(b.x()(f.point,f.pointIndex)),r=e.tickFormat()(b.y()(f.point,f.pointIndex));null!=z&&c.tooltip.show([k,l],z(f.series.key,q,r,f,a),"n",1,g,"x-nvtooltip"),null!=A&&c.tooltip.show([m,p],A(f.series.key,q,r,f,a),"e",1,g,"y-nvtooltip"),null!=B&&c.tooltip.show([h,i],B(f.series.key,q,r,f.point.tooltip,f,a),f.value<0?"n":"s",null,g)},K=[{key:"Magnify",disabled:!0}];return b.dispatch.on("elementMouseout.tooltip",function(a){E.tooltipHide(a),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",0),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",i.size())}),E.on("tooltipHide",function(){y&&c.tooltip.cleanup()}),a.dispatch=E,a.scatter=b,a.legend=f,a.controls=g,a.xAxis=d,a.yAxis=e,a.distX=h,a.distY=i,d3.rebind(a,b,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(j.top="undefined"!=typeof b.top?b.top:j.top,j.right="undefined"!=typeof b.right?b.right:j.right,j.bottom="undefined"!=typeof b.bottom?b.bottom:j.bottom,j.left="undefined"!=typeof b.left?b.left:j.left,a):j},a.width=function(b){return arguments.length?(k=b,a):k},a.height=function(b){return arguments.length?(l=b,a):l},a.color=function(b){return arguments.length?(m=c.utils.getColor(b),f.color(m),h.color(m),i.color(m),a):m},a.showDistX=function(b){return arguments.length?(p=b,a):p},a.showDistY=function(b){return arguments.length?(q=b,a):q},a.showControls=function(b){return arguments.length?(v=b,a):v},a.showLegend=function(b){return arguments.length?(r=b,a):r},a.showXAxis=function(b){return arguments.length?(s=b,a):s},a.showYAxis=function(b){return arguments.length?(t=b,a):t},a.rightAlignYAxis=function(b){return arguments.length?(u=b,e.orient(b?"right":"left"),a):u},a.fisheye=function(b){return arguments.length?(w=b,a):w},a.tooltips=function(b){return arguments.length?(y=b,a):y},a.tooltipContent=function(b){return arguments.length?(B=b,a):B},a.tooltipXContent=function(b){return arguments.length?(z=b,a):z},a.tooltipYContent=function(b){return arguments.length?(A=b,a):A},a.state=function(b){return arguments.length?(C=b,a):C},a.defaultState=function(b){return arguments.length?(D=b,a):D},a.noData=function(b){return arguments.length?(F=b,a):F},a.transitionDuration=function(b){return arguments.length?(G=b,a):G},a},c.models.sparkline=function(){"use strict";function a(c){return c.each(function(a){var c=h-g.left-g.right,j=i-g.top-g.bottom,p=d3.select(this);k.domain(b||d3.extent(a,m)).range(e||[0,c]),l.domain(d||d3.extent(a,n)).range(f||[j,0]);var q=p.selectAll("g.nv-wrap.nv-sparkline").data([a]),r=q.enter().append("g").attr("class","nvd3 nv-wrap nv-sparkline");r.append("g"),q.select("g");q.attr("transform","translate("+g.left+","+g.top+")");var s=q.selectAll("path").data(function(a){return[a]});s.enter().append("path"),s.exit().remove(),s.style("stroke",function(a,b){return a.color||o(a,b)}).attr("d",d3.svg.line().x(function(a,b){return k(m(a,b))}).y(function(a,b){return l(n(a,b))}));var t=q.selectAll("circle.nv-point").data(function(a){function b(b){if(-1!=b){var c=a[b];return c.pointIndex=b,c}return null}var c=a.map(function(a,b){return n(a,b)}),d=b(c.lastIndexOf(l.domain()[1])),e=b(c.indexOf(l.domain()[0])),f=b(c.length-1);return[e,d,f].filter(function(a){return null!=a})});t.enter().append("circle"),t.exit().remove(),t.attr("cx",function(a,b){return k(m(a,a.pointIndex))}).attr("cy",function(a,b){return l(n(a,a.pointIndex))}).attr("r",2).attr("class",function(a,b){return m(a,a.pointIndex)==k.domain()[1]?"nv-point nv-currentValue":n(a,a.pointIndex)==l.domain()[0]?"nv-point nv-minValue":"nv-point nv-maxValue"})}),a}var b,d,e,f,g={top:2,right:0,bottom:2,left:0},h=400,i=32,j=!0,k=d3.scale.linear(),l=d3.scale.linear(),m=function(a){return a.x},n=function(a){return a.y},o=c.utils.getColor(["#000"]);return a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(g.top="undefined"!=typeof b.top?b.top:g.top,g.right="undefined"!=typeof b.right?b.right:g.right,g.bottom="undefined"!=typeof b.bottom?b.bottom:g.bottom,g.left="undefined"!=typeof b.left?b.left:g.left,a):g},a.width=function(b){return arguments.length?(h=b,a):h},a.height=function(b){return arguments.length?(i=b,a):i},a.x=function(b){return arguments.length?(m=d3.functor(b),a):m},a.y=function(b){return arguments.length?(n=d3.functor(b),a):n},a.xScale=function(b){return arguments.length?(k=b,a):k},a.yScale=function(b){return arguments.length?(l=b,a):l},a.xDomain=function(c){return arguments.length?(b=c,a):b},a.yDomain=function(b){return arguments.length?(d=b,a):d},a.xRange=function(b){return arguments.length?(e=b,a):e},a.yRange=function(b){return arguments.length?(f=b,a):f},a.animate=function(b){return arguments.length?(j=b,a):j},a.color=function(b){return arguments.length?(o=c.utils.getColor(b),a):o},a},c.models.sparklinePlus=function(){"use strict";function a(c){return c.each(function(m){function q(){if(!j){var a=A.selectAll(".nv-hoverValue").data(i),c=a.enter().append("g").attr("class","nv-hoverValue").style("stroke-opacity",0).style("fill-opacity",0);a.exit().transition().duration(250).style("stroke-opacity",0).style("fill-opacity",0).remove(),a.attr("transform",function(a){return"translate("+b(e.x()(m[a],a))+",0)"}).transition().duration(250).style("stroke-opacity",1).style("fill-opacity",1),i.length&&(c.append("line").attr("x1",0).attr("y1",-f.top).attr("x2",0).attr("y2",u),c.append("text").attr("class","nv-xValue").attr("x",-6).attr("y",-f.top).attr("text-anchor","end").attr("dy",".9em"),A.select(".nv-hoverValue .nv-xValue").text(k(e.x()(m[i[0]],i[0]))),c.append("text").attr("class","nv-yValue").attr("x",6).attr("y",-f.top).attr("text-anchor","start").attr("dy",".9em"),A.select(".nv-hoverValue .nv-yValue").text(l(e.y()(m[i[0]],i[0]))))}}function r(){function a(a,b){for(var c=Math.abs(e.x()(a[0],0)-b),d=0,f=0;f<a.length;f++)Math.abs(e.x()(a[f],f)-b)<c&&(c=Math.abs(e.x()(a[f],f)-b),d=f);return d}if(!j){var c=d3.mouse(this)[0]-f.left;i=[a(m,Math.round(b.invert(c)))],q()}}var s=d3.select(this),t=(g||parseInt(s.style("width"))||960)-f.left-f.right,u=(h||parseInt(s.style("height"))||400)-f.top-f.bottom;if(a.update=function(){a(c)},a.container=this,!m||!m.length){var v=s.selectAll(".nv-noData").data([p]);return v.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),v.attr("x",f.left+t/2).attr("y",f.top+u/2).text(function(a){return a}),a}s.selectAll(".nv-noData").remove();var w=e.y()(m[m.length-1],m.length-1);b=e.xScale(),d=e.yScale();var x=s.selectAll("g.nv-wrap.nv-sparklineplus").data([m]),y=x.enter().append("g").attr("class","nvd3 nv-wrap nv-sparklineplus"),z=y.append("g"),A=x.select("g");z.append("g").attr("class","nv-sparklineWrap"),z.append("g").attr("class","nv-valueWrap"),z.append("g").attr("class","nv-hoverArea"),x.attr("transform","translate("+f.left+","+f.top+")");var B=A.select(".nv-sparklineWrap");e.width(t).height(u),B.call(e);var C=A.select(".nv-valueWrap"),D=C.selectAll(".nv-currentValue").data([w]);D.enter().append("text").attr("class","nv-currentValue").attr("dx",o?-8:8).attr("dy",".9em").style("text-anchor",o?"end":"start"),D.attr("x",t+(o?f.right:0)).attr("y",n?function(a){return d(a)}:0).style("fill",e.color()(m[m.length-1],m.length-1)).text(l(w)),z.select(".nv-hoverArea").append("rect").on("mousemove",r).on("click",function(){j=!j}).on("mouseout",function(){i=[],q()}),A.select(".nv-hoverArea rect").attr("transform",function(a){return"translate("+-f.left+","+-f.top+")"}).attr("width",t+f.left+f.right).attr("height",u+f.top)}),a}var b,d,e=c.models.sparkline(),f={top:15,right:100,bottom:10,left:50},g=null,h=null,i=[],j=!1,k=d3.format(",r"),l=d3.format(",.2f"),m=!0,n=!0,o=!1,p="No Data Available.";return a.sparkline=e,d3.rebind(a,e,"x","y","xScale","yScale","color"),a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(f.top="undefined"!=typeof b.top?b.top:f.top,f.right="undefined"!=typeof b.right?b.right:f.right,f.bottom="undefined"!=typeof b.bottom?b.bottom:f.bottom,f.left="undefined"!=typeof b.left?b.left:f.left,a):f},a.width=function(b){return arguments.length?(g=b,a):g},a.height=function(b){return arguments.length?(h=b,a):h},a.xTickFormat=function(b){return arguments.length?(k=b,a):k},a.yTickFormat=function(b){return arguments.length?(l=b,a):l},a.showValue=function(b){return arguments.length?(m=b,a):m},a.alignValue=function(b){return arguments.length?(n=b,a):n},a.rightAlignValue=function(b){return arguments.length?(o=b,a):o},a.noData=function(b){return arguments.length?(p=b,a):p},a},c.models.stackedArea=function(){"use strict";function a(c){return c.each(function(c){var l=f-e.left-e.right,s=g-e.top-e.bottom,t=d3.select(this);b=q.xScale(),d=q.yScale();var u=c;c.forEach(function(a,b){a.seriesIndex=b,a.values=a.values.map(function(a,c){return a.index=c,a.seriesIndex=b,a})});var v=c.filter(function(a){return!a.disabled});c=d3.layout.stack().order(n).offset(m).values(function(a){return a.values}).x(j).y(k).out(function(a,b,c){var d=0===k(a)?0:c;a.display={y:d,y0:b}})(v);var w=t.selectAll("g.nv-wrap.nv-stackedarea").data([c]),x=w.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedarea"),y=x.append("defs"),z=x.append("g"),A=w.select("g");z.append("g").attr("class","nv-areaWrap"),z.append("g").attr("class","nv-scatterWrap"),w.attr("transform","translate("+e.left+","+e.top+")"),q.width(l).height(s).x(j).y(function(a){return a.display.y+a.display.y0}).forceY([0]).color(c.map(function(a,b){return a.color||h(a,a.seriesIndex)}));var B=A.select(".nv-scatterWrap").datum(c);B.call(q),y.append("clipPath").attr("id","nv-edge-clip-"+i).append("rect"),w.select("#nv-edge-clip-"+i+" rect").attr("width",l).attr("height",s),A.attr("clip-path",p?"url(#nv-edge-clip-"+i+")":"");var C=d3.svg.area().x(function(a,c){return b(j(a,c))}).y0(function(a){return d(a.display.y0)}).y1(function(a){return d(a.display.y+a.display.y0)}).interpolate(o),D=d3.svg.area().x(function(a,c){return b(j(a,c))}).y0(function(a){return d(a.display.y0)}).y1(function(a){return d(a.display.y0)}),E=A.select(".nv-areaWrap").selectAll("path.nv-area").data(function(a){return a});E.enter().append("path").attr("class",function(a,b){return"nv-area nv-area-"+b}).attr("d",function(a,b){return D(a.values,a.seriesIndex)}).on("mouseover",function(a,b){d3.select(this).classed("hover",!0),r.areaMouseover({point:a,series:a.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:a.seriesIndex})}).on("mouseout",function(a,b){d3.select(this).classed("hover",!1),r.areaMouseout({point:a,series:a.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:a.seriesIndex})}).on("click",function(a,b){d3.select(this).classed("hover",!1),r.areaClick({point:a,series:a.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:a.seriesIndex})}),E.exit().remove(),E.style("fill",function(a,b){return a.color||h(a,a.seriesIndex)}).style("stroke",function(a,b){return a.color||h(a,a.seriesIndex)}),E.transition().attr("d",function(a,b){return C(a.values,b)}),q.dispatch.on("elementMouseover.area",function(a){A.select(".nv-chart-"+i+" .nv-area-"+a.seriesIndex).classed("hover",!0)}),q.dispatch.on("elementMouseout.area",function(a){A.select(".nv-chart-"+i+" .nv-area-"+a.seriesIndex).classed("hover",!1)}),a.d3_stackedOffset_stackPercent=function(a){var b,c,d,e=a.length,f=a[0].length,g=1/e,h=[];for(c=0;f>c;++c){for(b=0,d=0;b<u.length;b++)d+=k(u[b].values[c]);if(d)for(b=0;e>b;b++)a[b][c][1]/=d;else for(b=0;e>b;b++)a[b][c][1]=g}for(c=0;f>c;++c)h[c]=0;return h}}),a}var b,d,e={top:0,right:0,bottom:0,left:0},f=960,g=500,h=c.utils.defaultColor(),i=Math.floor(1e5*Math.random()),j=function(a){return a.x},k=function(a){return a.y},l="stack",m="zero",n="default",o="linear",p=!1,q=c.models.scatter(),r=d3.dispatch("tooltipShow","tooltipHide","areaClick","areaMouseover","areaMouseout");return q.size(2.2).sizeDomain([2.2,2.2]),q.dispatch.on("elementClick.area",function(a){r.areaClick(a)}),q.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+e.left,a.pos[1]+e.top],r.tooltipShow(a)}),q.dispatch.on("elementMouseout.tooltip",function(a){r.tooltipHide(a)}),a.dispatch=r,a.scatter=q,d3.rebind(a,q,"interactive","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","forceX","forceY","forceSize","clipVoronoi","useVoronoi","clipRadius","highlightPoint","clearHighlights"),a.options=c.utils.optionsFunc.bind(a),a.x=function(b){return arguments.length?(j=d3.functor(b),a):j},a.y=function(b){return arguments.length?(k=d3.functor(b),a):k},a.margin=function(b){return arguments.length?(e.top="undefined"!=typeof b.top?b.top:e.top,e.right="undefined"!=typeof b.right?b.right:e.right,e.bottom="undefined"!=typeof b.bottom?b.bottom:e.bottom,e.left="undefined"!=typeof b.left?b.left:e.left,a):e},a.width=function(b){return arguments.length?(f=b,a):f},a.height=function(b){return arguments.length?(g=b,a):g},a.clipEdge=function(b){return arguments.length?(p=b,a):p},a.color=function(b){return arguments.length?(h=c.utils.getColor(b),a):h},a.offset=function(b){return arguments.length?(m=b,a):m},a.order=function(b){return arguments.length?(n=b,a):n},a.style=function(b){if(!arguments.length)return l;switch(l=b){case"stack":a.offset("zero"),a.order("default");break;case"stream":a.offset("wiggle"),a.order("inside-out");break;case"stream-center":a.offset("silhouette"),a.order("inside-out");break;case"expand":a.offset("expand"),a.order("default");break;case"stack_percent":a.offset(a.d3_stackedOffset_stackPercent),a.order("default")}return a},a.interpolate=function(b){return arguments.length?(o=b,a):o},a},c.models.stackedAreaChart=function(){"use strict";function a(v){return v.each(function(v){var G=d3.select(this),H=this,I=(l||parseInt(G.style("width"))||960)-k.left-k.right,J=(m||parseInt(G.style("height"))||400)-k.top-k.bottom;if(a.update=function(){G.transition().duration(E).call(a)},a.container=this,x.disabled=v.map(function(a){return!!a.disabled}),!y){var K;y={};for(K in x)x[K]instanceof Array?y[K]=x[K].slice(0):y[K]=x[K]}if(!(v&&v.length&&v.filter(function(a){return a.values.length}).length)){var L=G.selectAll(".nv-noData").data([z]);return L.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),L.attr("x",k.left+I/2).attr("y",k.top+J/2).text(function(a){return a}),a}G.selectAll(".nv-noData").remove(),b=e.xScale(),d=e.yScale();var M=G.selectAll("g.nv-wrap.nv-stackedAreaChart").data([v]),N=M.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedAreaChart").append("g"),O=M.select("g");if(N.append("rect").style("opacity",0),N.append("g").attr("class","nv-x nv-axis"),N.append("g").attr("class","nv-y nv-axis"),N.append("g").attr("class","nv-stackedWrap"),N.append("g").attr("class","nv-legendWrap"),N.append("g").attr("class","nv-controlsWrap"),N.append("g").attr("class","nv-interactive"),O.select("rect").attr("width",I).attr("height",J),p){var P=o?I-B:I;h.width(P),O.select(".nv-legendWrap").datum(v).call(h),k.top!=h.height()&&(k.top=h.height(),J=(m||parseInt(G.style("height"))||400)-k.top-k.bottom),O.select(".nv-legendWrap").attr("transform","translate("+(I-P)+","+-k.top+")")}if(o){var Q=[{key:D.stacked||"Stacked",metaKey:"Stacked",disabled:"stack"!=e.style(),style:"stack"},{key:D.stream||"Stream",metaKey:"Stream",disabled:"stream"!=e.style(),style:"stream"},{key:D.expanded||"Expanded",metaKey:"Expanded",disabled:"expand"!=e.style(),style:"expand"},{key:D.stack_percent||"Stack %",metaKey:"Stack_Percent",disabled:"stack_percent"!=e.style(),style:"stack_percent"}];B=C.length/3*260,Q=Q.filter(function(a){return-1!==C.indexOf(a.metaKey)}),i.width(B).color(["#444","#444","#444"]),O.select(".nv-controlsWrap").datum(Q).call(i),k.top!=Math.max(i.height(),h.height())&&(k.top=Math.max(i.height(),h.height()),J=(m||parseInt(G.style("height"))||400)-k.top-k.bottom),O.select(".nv-controlsWrap").attr("transform","translate(0,"+-k.top+")")}M.attr("transform","translate("+k.left+","+k.top+")"),s&&O.select(".nv-y.nv-axis").attr("transform","translate("+I+",0)"),t&&(j.width(I).height(J).margin({left:k.left,top:k.top}).svgContainer(G).xScale(b),M.select(".nv-interactive").call(j)),e.width(I).height(J);var R=O.select(".nv-stackedWrap").datum(v);R.transition().call(e),q&&(f.scale(b).ticks(I/100).tickSize(-J,0),O.select(".nv-x.nv-axis").attr("transform","translate(0,"+J+")"),O.select(".nv-x.nv-axis").transition().duration(0).call(f)),r&&(g.scale(d).ticks("wiggle"==e.offset()?0:J/36).tickSize(-I,0).setTickFormat("expand"==e.style()||"stack_percent"==e.style()?d3.format("%"):w),O.select(".nv-y.nv-axis").transition().duration(0).call(g)),e.dispatch.on("areaClick.toggle",function(b){1===v.filter(function(a){return!a.disabled}).length?v.forEach(function(a){a.disabled=!1}):v.forEach(function(a,c){a.disabled=c!=b.seriesIndex}),x.disabled=v.map(function(a){return!!a.disabled}),A.stateChange(x),a.update()}),h.dispatch.on("stateChange",function(b){x.disabled=b.disabled,A.stateChange(x),a.update()}),i.dispatch.on("legendClick",function(b,c){b.disabled&&(Q=Q.map(function(a){return a.disabled=!0,a}),b.disabled=!1,e.style(b.style),x.style=e.style(),A.stateChange(x),a.update())}),j.dispatch.on("elementMousemove",function(b){e.clearHighlights();var d,h,i,l=[];if(v.filter(function(a,b){return a.seriesIndex=b,!a.disabled}).forEach(function(f,g){h=c.interactiveBisect(f.values,b.pointXValue,a.x()),e.highlightPoint(g,h,!0);var j=f.values[h];if("undefined"!=typeof j){"undefined"==typeof d&&(d=j),"undefined"==typeof i&&(i=a.xScale()(a.x()(j,h)));var k="expand"==e.style()?j.display.y:a.y()(j,h);l.push({key:f.key,value:k,color:n(f,f.seriesIndex),stackedValue:j.display})}}),l.reverse(),l.length>2){var m=a.yScale().invert(b.mouseY),o=null;l.forEach(function(a,b){m=Math.abs(m);var c=Math.abs(a.stackedValue.y0),d=Math.abs(a.stackedValue.y);return m>=c&&d+c>=m?void(o=b):void 0}),null!=o&&(l[o].highlight=!0)}var p=f.tickFormat()(a.x()(d,h)),q="expand"==e.style()?function(a,b){return d3.format(".1%")(a)}:function(a,b){return g.tickFormat()(a)};j.tooltip.position({left:i+k.left,top:b.mouseY+k.top}).chartContainer(H.parentNode).enabled(u).valueFormatter(q).data({value:p,series:l})(),j.renderGuideLine(i)}),j.dispatch.on("elementMouseout",function(a){A.tooltipHide(),e.clearHighlights()}),A.on("tooltipShow",function(a){u&&F(a,H.parentNode)}),A.on("changeState",function(b){"undefined"!=typeof b.disabled&&(v.forEach(function(a,c){a.disabled=b.disabled[c]}),x.disabled=b.disabled),"undefined"!=typeof b.style&&e.style(b.style),a.update()})}),a}var b,d,e=c.models.stackedArea(),f=c.models.axis(),g=c.models.axis(),h=c.models.legend(),i=c.models.legend(),j=c.interactiveGuideline(),k={top:30,right:25,bottom:50,left:60},l=null,m=null,n=c.utils.defaultColor(),o=!0,p=!0,q=!0,r=!0,s=!1,t=!1,u=!0,v=function(a,b,c,d,e){return"<h3>"+a+"</h3><p>"+c+" on "+b+"</p>"},w=d3.format(",.2f"),x={style:e.style()},y=null,z="No Data Available.",A=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),B=250,C=["Stacked","Stream","Expanded"],D={},E=250;f.orient("bottom").tickPadding(7),g.orient(s?"right":"left"),i.updateState(!1);var F=function(b,d){var h=b.pos[0]+(d.offsetLeft||0),i=b.pos[1]+(d.offsetTop||0),j=f.tickFormat()(e.x()(b.point,b.pointIndex)),k=g.tickFormat()(e.y()(b.point,b.pointIndex)),l=v(b.series.key,j,k,b,a);c.tooltip.show([h,i],l,b.value<0?"n":"s",null,d)};return e.dispatch.on("tooltipShow",function(a){a.pos=[a.pos[0]+k.left,a.pos[1]+k.top],A.tooltipShow(a)}),e.dispatch.on("tooltipHide",function(a){A.tooltipHide(a)}),A.on("tooltipHide",function(){u&&c.tooltip.cleanup()}),a.dispatch=A,a.stacked=e,a.legend=h,a.controls=i,a.xAxis=f,a.yAxis=g,a.interactiveLayer=j,d3.rebind(a,e,"x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","sizeDomain","interactive","useVoronoi","offset","order","style","clipEdge","forceX","forceY","forceSize","interpolate"),a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(k.top="undefined"!=typeof b.top?b.top:k.top,k.right="undefined"!=typeof b.right?b.right:k.right,k.bottom="undefined"!=typeof b.bottom?b.bottom:k.bottom,k.left="undefined"!=typeof b.left?b.left:k.left,a):k},a.width=function(b){return arguments.length?(l=b,a):l},a.height=function(b){return arguments.length?(m=b,a):m},a.color=function(b){return arguments.length?(n=c.utils.getColor(b),h.color(n),e.color(n),a):n},a.showControls=function(b){return arguments.length?(o=b,a):o},a.showLegend=function(b){return arguments.length?(p=b,a):p},a.showXAxis=function(b){return arguments.length?(q=b,a):q},a.showYAxis=function(b){return arguments.length?(r=b,a):r},a.rightAlignYAxis=function(b){return arguments.length?(s=b,g.orient(b?"right":"left"),a):s},a.useInteractiveGuideline=function(b){return arguments.length?(t=b,b===!0&&(a.interactive(!1),a.useVoronoi(!1)),a):t},a.tooltip=function(b){return arguments.length?(v=b,a):v},a.tooltips=function(b){return arguments.length?(u=b,a):u},a.tooltipContent=function(b){return arguments.length?(v=b,a):v},a.state=function(b){return arguments.length?(x=b,a):x},a.defaultState=function(b){return arguments.length?(y=b,a):y},a.noData=function(b){return arguments.length?(z=b,a):z},a.transitionDuration=function(b){return arguments.length?(E=b,a):E},a.controlsData=function(b){return arguments.length?(C=b,a):C},a.controlLabels=function(b){return arguments.length?"object"!=typeof b?D:(D=b,a):D},g.setTickFormat=g.tickFormat,g.tickFormat=function(a){return arguments.length?(w=a,g):w},a}}();var _slicedToArray=function(){function a(a,b){var c=[],d=!0,e=!1,f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!b||c.length!==b);d=!0);}catch(i){e=!0,f=i}finally{try{!d&&h["return"]&&h["return"]()}finally{if(e)throw f}}return c}return function(b,c){if(Array.isArray(b))return b;if(Symbol.iterator in Object(b))return a(b,c);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a};!function(a,b){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):(a="undefined"!=typeof globalThis?globalThis:a||self,a.DOMPurify=b())}(void 0,function(){"use strict";function a(a){return function(b){for(var c=arguments.length,d=new Array(c>1?c-1:0),e=1;c>e;e++)d[e-1]=arguments[e];return p(a,b,d)}}function b(a){return function(){for(var b=arguments.length,c=new Array(b),d=0;b>d;d++)c[d]=arguments[d];return q(a,c)}}function c(a,b){var c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:u;h&&h(a,null);for(var d=b.length;d--;){var e=b[d];if("string"==typeof e){var f=c(e);f!==e&&(i(b)||(b[d]=f),e=f)}a[e]=!0}return a}function d(a){var b=n(null),c=!0,d=!1,e=void 0;try{for(var f,h=g(a)[Symbol.iterator]();!(c=(f=h.next()).done);c=!0){var i=f.value,j=_slicedToArray(i,2),k=j[0],l=j[1];b[k]=l}}catch(m){d=!0,e=m}finally{try{!c&&h["return"]&&h["return"]()}finally{if(d)throw e}}return b}function e(b,c){function d(a){return console.warn("fallback value for",a),null}for(;null!==b;){var e=k(b,c);if(e){if(e.get)return a(e.get);if("function"==typeof e.value)return a(e.value)}b=j(b)}return d}function f(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:X(),b=function(a){return f(a)};if(b.version="3.0.5",b.removed=[],!a||!a.document||9!==a.document.nodeType)return b.isSupported=!1,b;var h=a.document,i=h,j=i.currentScript,k=a.DocumentFragment,m=a.HTMLTemplateElement,o=a.Node,p=a.Element,q=a.NodeFilter,N=a.NamedNodeMap,O=void 0===N?a.NamedNodeMap||a.MozNamedAttrMap:N,P=a.HTMLFormElement,Q=a.DOMParser,R=a.trustedTypes,T=p.prototype,U=e(T,"cloneNode"),Z=e(T,"nextSibling"),$=e(T,"childNodes"),_=e(T,"parentNode");if("function"==typeof m){var aa=h.createElement("template");aa.content&&aa.content.ownerDocument&&(h=aa.content.ownerDocument)}var ba=void 0,ca="",da=h,ea=da.implementation,fa=da.createNodeIterator,ga=da.createDocumentFragment,ha=da.getElementsByTagName,ia=i.importNode,ja={};b.isSupported="function"==typeof g&&"function"==typeof _&&ea&&void 0!==ea.createHTMLDocument;var ka=W.MUSTACHE_EXPR,la=W.ERB_EXPR,ma=W.TMPLIT_EXPR,na=W.DATA_ATTR,oa=W.ARIA_ATTR,pa=W.IS_SCRIPT_OR_DATA,qa=W.ATTR_WHITESPACE,ra=W.IS_ALLOWED_URI,sa=null,ta=c({},[].concat(_toConsumableArray(C),_toConsumableArray(D),_toConsumableArray(E),_toConsumableArray(G),_toConsumableArray(I))),ua=null,va=c({},[].concat(_toConsumableArray(J),_toConsumableArray(K),_toConsumableArray(L),_toConsumableArray(M))),wa=Object.seal(n(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),xa=null,ya=null,za=!0,Aa=!0,Ba=!1,Ca=!0,Da=!1,Ea=!1,Fa=!1,Ga=!1,Ha=!1,Ia=!1,Ja=!1,Ka=!0,La=!1,Ma="user-content-",Na=!0,Oa=!1,Pa={},Qa=null,Ra=c({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Sa=null,Ta=c({},["audio","video","img","source","image","track"]),Ua=null,Va=c({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Wa="http://www.w3.org/1998/Math/MathML",Xa="http://www.w3.org/2000/svg",Ya="http://www.w3.org/1999/xhtml",Za=Ya,$a=!1,_a=null,ab=c({},[Wa,Xa,Ya],v),bb=null,cb=["application/xhtml+xml","text/html"],db="text/html",eb=null,fb=null,gb=h.createElement("form"),hb=function(a){return a instanceof RegExp||a instanceof Function},ib=function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!fb||fb!==a){if(a&&"object"===("undefined"==typeof a?"undefined":_typeof(a))||(a={}),a=d(a),bb=bb=-1===cb.indexOf(a.PARSER_MEDIA_TYPE)?db:a.PARSER_MEDIA_TYPE,eb="application/xhtml+xml"===bb?v:u,sa="ALLOWED_TAGS"in a?c({},a.ALLOWED_TAGS,eb):ta,ua="ALLOWED_ATTR"in a?c({},a.ALLOWED_ATTR,eb):va,
-_a="ALLOWED_NAMESPACES"in a?c({},a.ALLOWED_NAMESPACES,v):ab,Ua="ADD_URI_SAFE_ATTR"in a?c(d(Va),a.ADD_URI_SAFE_ATTR,eb):Va,Sa="ADD_DATA_URI_TAGS"in a?c(d(Ta),a.ADD_DATA_URI_TAGS,eb):Ta,Qa="FORBID_CONTENTS"in a?c({},a.FORBID_CONTENTS,eb):Ra,xa="FORBID_TAGS"in a?c({},a.FORBID_TAGS,eb):{},ya="FORBID_ATTR"in a?c({},a.FORBID_ATTR,eb):{},Pa="USE_PROFILES"in a?a.USE_PROFILES:!1,za=a.ALLOW_ARIA_ATTR!==!1,Aa=a.ALLOW_DATA_ATTR!==!1,Ba=a.ALLOW_UNKNOWN_PROTOCOLS||!1,Ca=a.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Da=a.SAFE_FOR_TEMPLATES||!1,Ea=a.WHOLE_DOCUMENT||!1,Ha=a.RETURN_DOM||!1,Ia=a.RETURN_DOM_FRAGMENT||!1,Ja=a.RETURN_TRUSTED_TYPE||!1,Ga=a.FORCE_BODY||!1,Ka=a.SANITIZE_DOM!==!1,La=a.SANITIZE_NAMED_PROPS||!1,Na=a.KEEP_CONTENT!==!1,Oa=a.IN_PLACE||!1,ra=a.ALLOWED_URI_REGEXP||S,Za=a.NAMESPACE||Ya,wa=a.CUSTOM_ELEMENT_HANDLING||{},a.CUSTOM_ELEMENT_HANDLING&&hb(a.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(wa.tagNameCheck=a.CUSTOM_ELEMENT_HANDLING.tagNameCheck),a.CUSTOM_ELEMENT_HANDLING&&hb(a.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(wa.attributeNameCheck=a.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),a.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof a.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(wa.allowCustomizedBuiltInElements=a.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Da&&(Aa=!1),Ia&&(Ha=!0),Pa&&(sa=c({},[].concat(_toConsumableArray(I))),ua=[],Pa.html===!0&&(c(sa,C),c(ua,J)),Pa.svg===!0&&(c(sa,D),c(ua,K),c(ua,M)),Pa.svgFilters===!0&&(c(sa,E),c(ua,K),c(ua,M)),Pa.mathMl===!0&&(c(sa,G),c(ua,L),c(ua,M))),a.ADD_TAGS&&(sa===ta&&(sa=d(sa)),c(sa,a.ADD_TAGS,eb)),a.ADD_ATTR&&(ua===va&&(ua=d(ua)),c(ua,a.ADD_ATTR,eb)),a.ADD_URI_SAFE_ATTR&&c(Ua,a.ADD_URI_SAFE_ATTR,eb),a.FORBID_CONTENTS&&(Qa===Ra&&(Qa=d(Qa)),c(Qa,a.FORBID_CONTENTS,eb)),Na&&(sa["#text"]=!0),Ea&&c(sa,["html","head","body"]),sa.table&&(c(sa,["tbody"]),delete xa.tbody),a.TRUSTED_TYPES_POLICY){if("function"!=typeof a.TRUSTED_TYPES_POLICY.createHTML)throw B('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof a.TRUSTED_TYPES_POLICY.createScriptURL)throw B('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');ba=a.TRUSTED_TYPES_POLICY,ca=ba.createHTML("")}else void 0===ba&&(ba=Y(R,j)),null!==ba&&"string"==typeof ca&&(ca=ba.createHTML(""));l&&l(a),fb=a}},jb=c({},["mi","mo","mn","ms","mtext"]),kb=c({},["foreignobject","desc","title","annotation-xml"]),lb=c({},["title","style","font","a","script"]),mb=c({},D);c(mb,E),c(mb,F);var nb=c({},G);c(nb,H);var ob=function(a){var b=_(a);b&&b.tagName||(b={namespaceURI:Za,tagName:"template"});var c=u(a.tagName),d=u(b.tagName);return _a[a.namespaceURI]?a.namespaceURI===Xa?b.namespaceURI===Ya?"svg"===c:b.namespaceURI===Wa?"svg"===c&&("annotation-xml"===d||jb[d]):Boolean(mb[c]):a.namespaceURI===Wa?b.namespaceURI===Ya?"math"===c:b.namespaceURI===Xa?"math"===c&&kb[d]:Boolean(nb[c]):a.namespaceURI===Ya?(b.namespaceURI!==Xa||kb[d])&&(b.namespaceURI!==Wa||jb[d])?!nb[c]&&(lb[c]||!mb[c]):!1:"application/xhtml+xml"===bb&&_a[a.namespaceURI]?!0:!1:!1},pb=function(a){t(b.removed,{element:a});try{a.parentNode.removeChild(a)}catch(c){a.remove()}},qb=function(a,c){try{t(b.removed,{attribute:c.getAttributeNode(a),from:c})}catch(d){t(b.removed,{attribute:null,from:c})}if(c.removeAttribute(a),"is"===a&&!ua[a])if(Ha||Ia)try{pb(c)}catch(d){}else try{c.setAttribute(a,"")}catch(d){}},rb=function(a){var b=null,c=null;if(Ga)a="<remove></remove>"+a;else{var d=w(a,/^[\r\n\t ]+/);c=d&&d[0]}"application/xhtml+xml"===bb&&Za===Ya&&(a='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+a+"</body></html>");var e=ba?ba.createHTML(a):a;if(Za===Ya)try{b=(new Q).parseFromString(e,bb)}catch(f){}if(!b||!b.documentElement){b=ea.createDocument(Za,"template",null);try{b.documentElement.innerHTML=$a?ca:e}catch(f){}}var g=b.body||b.documentElement;return a&&c&&g.insertBefore(h.createTextNode(c),g.childNodes[0]||null),Za===Ya?ha.call(b,Ea?"html":"body")[0]:Ea?b.documentElement:g},sb=function(a){return fa.call(a.ownerDocument||a,a,q.SHOW_ELEMENT|q.SHOW_COMMENT|q.SHOW_TEXT,null)},tb=function(a){return a instanceof P&&("string"!=typeof a.nodeName||"string"!=typeof a.textContent||"function"!=typeof a.removeChild||!(a.attributes instanceof O)||"function"!=typeof a.removeAttribute||"function"!=typeof a.setAttribute||"string"!=typeof a.namespaceURI||"function"!=typeof a.insertBefore||"function"!=typeof a.hasChildNodes)},ub=function(a){return"function"==typeof o&&a instanceof o},vb=function(a,c,d){ja[a]&&r(ja[a],function(a){a.call(b,c,d,fb)})},wb=function(a){var c=null;if(vb("beforeSanitizeElements",a,null),tb(a))return pb(a),!0;var d=eb(a.nodeName);if(vb("uponSanitizeElement",a,{tagName:d,allowedTags:sa}),a.hasChildNodes()&&!ub(a.firstElementChild)&&A(/<[/\w]/g,a.innerHTML)&&A(/<[/\w]/g,a.textContent))return pb(a),!0;if(!sa[d]||xa[d]){if(!xa[d]&&yb(d)){if(wa.tagNameCheck instanceof RegExp&&A(wa.tagNameCheck,d))return!1;if(wa.tagNameCheck instanceof Function&&wa.tagNameCheck(d))return!1}if(Na&&!Qa[d]){var e=_(a)||a.parentNode,f=$(a)||a.childNodes;if(f&&e)for(var g=f.length,h=g-1;h>=0;--h)e.insertBefore(U(f[h],!0),Z(a))}return pb(a),!0}return a instanceof p&&!ob(a)?(pb(a),!0):"noscript"!==d&&"noembed"!==d&&"noframes"!==d||!A(/<\/no(script|embed|frames)/i,a.innerHTML)?(Da&&3===a.nodeType&&(c=a.textContent,r([ka,la,ma],function(a){c=x(c,a," ")}),a.textContent!==c&&(t(b.removed,{element:a.cloneNode()}),a.textContent=c)),vb("afterSanitizeElements",a,null),!1):(pb(a),!0)},xb=function(a,b,c){if(Ka&&("id"===b||"name"===b)&&(c in h||c in gb))return!1;if(Aa&&!ya[b]&&A(na,b));else if(za&&A(oa,b));else if(!ua[b]||ya[b]){if(!(yb(a)&&(wa.tagNameCheck instanceof RegExp&&A(wa.tagNameCheck,a)||wa.tagNameCheck instanceof Function&&wa.tagNameCheck(a))&&(wa.attributeNameCheck instanceof RegExp&&A(wa.attributeNameCheck,b)||wa.attributeNameCheck instanceof Function&&wa.attributeNameCheck(b))||"is"===b&&wa.allowCustomizedBuiltInElements&&(wa.tagNameCheck instanceof RegExp&&A(wa.tagNameCheck,c)||wa.tagNameCheck instanceof Function&&wa.tagNameCheck(c))))return!1}else if(Ua[b]);else if(A(ra,x(c,qa,"")));else if("src"!==b&&"xlink:href"!==b&&"href"!==b||"script"===a||0!==y(c,"data:")||!Sa[a]){if(Ba&&!A(pa,x(c,qa,"")));else if(c)return!1}else;return!0},yb=function(a){return a.indexOf("-")>0},zb=function(a){vb("beforeSanitizeAttributes",a,null);var c=a.attributes;if(c){for(var d={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ua},e=c.length,f=function(){var f=c[e],g=f.name,h=f.namespaceURI,i=f.value,j=eb(g),k="value"===g?i:z(i);if(d.attrName=j,d.attrValue=k,d.keepAttr=!0,d.forceKeepAttr=void 0,vb("uponSanitizeAttribute",a,d),k=d.attrValue,d.forceKeepAttr)return"continue";if(qb(g,a),!d.keepAttr)return"continue";if(!Ca&&A(/\/>/i,k))return qb(g,a),"continue";Da&&r([ka,la,ma],function(a){k=x(k,a," ")});var l=eb(a.nodeName);if(!xb(l,j,k))return"continue";if(!La||"id"!==j&&"name"!==j||(qb(g,a),k=Ma+k),ba&&"object"===("undefined"==typeof R?"undefined":_typeof(R))&&"function"==typeof R.getAttributeType)if(h);else switch(R.getAttributeType(l,j)){case"TrustedHTML":k=ba.createHTML(k);break;case"TrustedScriptURL":k=ba.createScriptURL(k)}try{h?a.setAttributeNS(h,g,k):a.setAttribute(g,k),s(b.removed)}catch(m){}};e--;){f()}vb("afterSanitizeAttributes",a,null)}},Ab=function Bb(a){var b=null,c=sb(a);for(vb("beforeSanitizeShadowDOM",a,null);b=c.nextNode();)vb("uponSanitizeShadowNode",b,null),wb(b)||(b.content instanceof k&&Bb(b.content),zb(b));vb("afterSanitizeShadowDOM",a,null)};return b.sanitize=function(a){var c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},d=null,e=null,f=null,g=null;if($a=!a,$a&&(a="<!-->"),"string"!=typeof a&&!ub(a)){if("function"!=typeof a.toString)throw B("toString is not a function");if(a=a.toString(),"string"!=typeof a)throw B("dirty is not a string, aborting")}if(!b.isSupported)return a;if(Fa||ib(c),b.removed=[],"string"==typeof a&&(Oa=!1),Oa){if(a.nodeName){var h=eb(a.nodeName);if(!sa[h]||xa[h])throw B("root node is forbidden and cannot be sanitized in-place")}}else if(a instanceof o)d=rb("<!---->"),e=d.ownerDocument.importNode(a,!0),1===e.nodeType&&"BODY"===e.nodeName?d=e:"HTML"===e.nodeName?d=e:d.appendChild(e);else{if(!Ha&&!Da&&!Ea&&-1===a.indexOf("<"))return ba&&Ja?ba.createHTML(a):a;if(d=rb(a),!d)return Ha?null:Ja?ca:""}d&&Ga&&pb(d.firstChild);for(var j=sb(Oa?a:d);f=j.nextNode();)wb(f)||(f.content instanceof k&&Ab(f.content),zb(f));if(Oa)return a;if(Ha){if(Ia)for(g=ga.call(d.ownerDocument);d.firstChild;)g.appendChild(d.firstChild);else g=d;return(ua.shadowroot||ua.shadowrootmode)&&(g=ia.call(i,g,!0)),g}var l=Ea?d.outerHTML:d.innerHTML;return Ea&&sa["!doctype"]&&d.ownerDocument&&d.ownerDocument.doctype&&d.ownerDocument.doctype.name&&A(V,d.ownerDocument.doctype.name)&&(l="<!DOCTYPE "+d.ownerDocument.doctype.name+">\n"+l),Da&&r([ka,la,ma],function(a){l=x(l,a," ")}),ba&&Ja?ba.createHTML(l):l},b.setConfig=function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ib(a),Fa=!0},b.clearConfig=function(){fb=null,Fa=!1},b.isValidAttribute=function(a,b,c){fb||ib({});var d=eb(a),e=eb(b);return xb(d,e,c)},b.addHook=function(a,b){"function"==typeof b&&(ja[a]=ja[a]||[],t(ja[a],b))},b.removeHook=function(a){return ja[a]?s(ja[a]):void 0},b.removeHooks=function(a){ja[a]&&(ja[a]=[])},b.removeAllHooks=function(){ja={}},b}var g=Object.entries,h=Object.setPrototypeOf,i=Object.isFrozen,j=Object.getPrototypeOf,k=Object.getOwnPropertyDescriptor,l=Object.freeze,m=Object.seal,n=Object.create,o="undefined"!=typeof Reflect&&Reflect,p=o.apply,q=o.construct;l||(l=function(a){return a}),m||(m=function(a){return a}),p||(p=function(a,b,c){return a.apply(b,c)}),q||(q=function(a,b){return new(Function.prototype.bind.apply(a,[null].concat(_toConsumableArray(b))))});var r=a(Array.prototype.forEach),s=a(Array.prototype.pop),t=a(Array.prototype.push),u=a(String.prototype.toLowerCase),v=a(String.prototype.toString),w=a(String.prototype.match),x=a(String.prototype.replace),y=a(String.prototype.indexOf),z=a(String.prototype.trim),A=a(RegExp.prototype.test),B=b(TypeError),C=l(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),D=l(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),E=l(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),F=l(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),G=l(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),H=l(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),I=l(["#text"]),J=l(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),K=l(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),L=l(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),M=l(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),N=m(/\{\{[\w\W]*|[\w\W]*\}\}/gm),O=m(/<%[\w\W]*|[\w\W]*%>/gm),P=m(/\${[\w\W]*}/gm),Q=m(/^data-[\-\w.\u00B7-\uFFFF]/),R=m(/^aria-[\-\w]+$/),S=m(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),T=m(/^(?:\w+script|data):/i),U=m(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),V=m(/^html$/i),W=Object.freeze({__proto__:null,MUSTACHE_EXPR:N,ERB_EXPR:O,TMPLIT_EXPR:P,DATA_ATTR:Q,ARIA_ATTR:R,IS_ALLOWED_URI:S,IS_SCRIPT_OR_DATA:T,ATTR_WHITESPACE:U,DOCTYPE_NAME:V}),X=function(){return"undefined"==typeof window?null:window},Y=function(a,b){if("object"!==("undefined"==typeof a?"undefined":_typeof(a))||"function"!=typeof a.createPolicy)return null;var c=null,d="data-tt-policy-suffix";b&&b.hasAttribute(d)&&(c=b.getAttribute(d));var e="dompurify"+(c?"#"+c:"");try{return a.createPolicy(e,{createHTML:function(a){return a},createScriptURL:function(a){return a}})}catch(f){return console.warn("TrustedTypes policy "+e+" could not be created."),null}},Z=f();return Z});
\ No newline at end of file
+}if(!(c&&c.length&&c.filter(function(a){return a.values.length}).length)){var O=A.selectAll(".nv-noData").data([F]);return O.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),O.attr("x",j.left+L/2).attr("y",j.top+M/2).text(function(a){return a}),a}A.selectAll(".nv-noData").remove(),n=b.xScale(),o=b.yScale(),H=H||n,I=I||o;var P=A.selectAll("g.nv-wrap.nv-scatterChart").data([c]),Q=P.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+b.id()),R=Q.append("g"),S=P.select("g");R.append("rect").attr("class","nvd3 nv-background").style("pointer-events","none"),R.append("g").attr("class","nv-x nv-axis"),R.append("g").attr("class","nv-y nv-axis"),R.append("g").attr("class","nv-scatterWrap"),R.append("g").attr("class","nv-regressionLinesWrap"),R.append("g").attr("class","nv-distWrap"),R.append("g").attr("class","nv-legendWrap"),R.append("g").attr("class","nv-controlsWrap"),P.attr("transform","translate("+j.left+","+j.top+")"),u&&S.select(".nv-y.nv-axis").attr("transform","translate("+L+",0)"),r&&(f.width(L/2),P.select(".nv-legendWrap").datum(c).call(f),j.top!=f.height()&&(j.top=f.height(),M=(l||parseInt(A.style("height"))||400)-j.top-j.bottom),P.select(".nv-legendWrap").attr("transform","translate("+L/2+","+-j.top+")")),v&&(g.width(180).color(["#444"]),S.select(".nv-controlsWrap").datum(K).attr("transform","translate(0,"+-j.top+")").call(g)),b.width(L).height(M).color(c.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!c[b].disabled})),P.select(".nv-scatterWrap").datum(c.filter(function(a){return!a.disabled})).call(b),P.select(".nv-regressionLinesWrap").attr("clip-path","url(#nv-edge-clip-"+b.id()+")");var T=P.select(".nv-regressionLinesWrap").selectAll(".nv-regLines").data(function(a){return a});T.enter().append("g").attr("class","nv-regLines");var U=T.selectAll(".nv-regLine").data(function(a){return[a]});U.enter().append("line").attr("class","nv-regLine").style("stroke-opacity",0);U.transition().attr("x1",n.range()[0]).attr("x2",n.range()[1]).attr("y1",function(a,b){return o(n.domain()[0]*a.slope+a.intercept)}).attr("y2",function(a,b){return o(n.domain()[1]*a.slope+a.intercept)}).style("stroke",function(a,b,c){return m(a,c)}).style("stroke-opacity",function(a,b){return a.disabled||"undefined"==typeof a.slope||"undefined"==typeof a.intercept?0:1}),s&&(d.scale(n).ticks(d.ticks()?d.ticks():L/100).tickSize(-M,0),S.select(".nv-x.nv-axis").attr("transform","translate(0,"+o.range()[0]+")").call(d)),t&&(e.scale(o).ticks(e.ticks()?e.ticks():M/36).tickSize(-L,0),S.select(".nv-y.nv-axis").call(e)),p&&(h.getData(b.x()).scale(n).width(L).color(c.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!c[b].disabled})),R.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),S.select(".nv-distributionX").attr("transform","translate(0,"+o.range()[0]+")").datum(c.filter(function(a){return!a.disabled})).call(h)),q&&(i.getData(b.y()).scale(o).width(M).color(c.map(function(a,b){return a.color||m(a,b)}).filter(function(a,b){return!c[b].disabled})),R.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),S.select(".nv-distributionY").attr("transform","translate("+(u?L:-i.size())+",0)").datum(c.filter(function(a){return!a.disabled})).call(i)),d3.fisheye&&(S.select(".nv-background").attr("width",L).attr("height",M),S.select(".nv-background").on("mousemove",z),S.select(".nv-background").on("click",function(){x=!x}),b.dispatch.on("elementClick.freezeFisheye",function(){x=!x})),g.dispatch.on("legendClick",function(c,f){c.disabled=!c.disabled,w=c.disabled?0:2.5,S.select(".nv-background").style("pointer-events",c.disabled?"none":"all"),S.select(".nv-point-paths").style("pointer-events",c.disabled?"all":"none"),c.disabled?(n.distortion(w).focus(0),o.distortion(w).focus(0),S.select(".nv-scatterWrap").call(b),S.select(".nv-x.nv-axis").call(d),S.select(".nv-y.nv-axis").call(e)):x=!1,a.update()}),f.dispatch.on("stateChange",function(b){C=b,E.stateChange(C),a.update()}),b.dispatch.on("elementMouseover.tooltip",function(a){d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",a.pos[1]-M),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",a.pos[0]+h.size()),a.pos=[a.pos[0]+j.left,a.pos[1]+j.top],E.tooltipShow(a)}),E.on("tooltipShow",function(a){y&&J(a,B.parentNode)}),E.on("changeState",function(b){"undefined"!=typeof b.disabled&&(c.forEach(function(a,c){a.disabled=b.disabled[c]}),C.disabled=b.disabled),a.update()}),H=n.copy(),I=o.copy()}),a}var b=c.models.scatter(),d=c.models.axis(),e=c.models.axis(),f=c.models.legend(),g=c.models.legend(),h=c.models.distribution(),i=c.models.distribution(),j={top:30,right:20,bottom:50,left:75},k=null,l=null,m=c.utils.defaultColor(),n=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.xScale(),o=d3.fisheye?d3.fisheye.scale(d3.scale.linear).distortion(0):b.yScale(),p=!1,q=!1,r=!0,s=!0,t=!0,u=!1,v=!!d3.fisheye,w=0,x=!1,y=!0,z=function(a,b,c){return"<strong>"+b+"</strong>"},A=function(a,b,c){return"<strong>"+c+"</strong>"},B=function(a,b,c,d){return"<h3>"+a+"</h3><p>"+d+"</p>"},C={},D=null,E=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),F="No Data Available.",G=250;b.xScale(n).yScale(o),d.orient("bottom").tickPadding(10),e.orient(u?"right":"left").tickPadding(10),h.axis("x"),i.axis("y"),g.updateState(!1);var H,I,J=function(f,g){var h=f.pos[0]+(g.offsetLeft||0),i=f.pos[1]+(g.offsetTop||0),k=f.pos[0]+(g.offsetLeft||0),l=o.range()[0]+j.top+(g.offsetTop||0),m=n.range()[0]+j.left+(g.offsetLeft||0),p=f.pos[1]+(g.offsetTop||0),q=d.tickFormat()(b.x()(f.point,f.pointIndex)),r=e.tickFormat()(b.y()(f.point,f.pointIndex));null!=z&&c.tooltip.show([k,l],z(f.series.key,q,r,f,a),"n",1,g,"x-nvtooltip"),null!=A&&c.tooltip.show([m,p],A(f.series.key,q,r,f,a),"e",1,g,"y-nvtooltip"),null!=B&&c.tooltip.show([h,i],B(f.series.key,q,r,f.point.tooltip,f,a),f.value<0?"n":"s",null,g)},K=[{key:"Magnify",disabled:!0}];return b.dispatch.on("elementMouseout.tooltip",function(a){E.tooltipHide(a),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-distx-"+a.pointIndex).attr("y1",0),d3.select(".nv-chart-"+b.id()+" .nv-series-"+a.seriesIndex+" .nv-disty-"+a.pointIndex).attr("x2",i.size())}),E.on("tooltipHide",function(){y&&c.tooltip.cleanup()}),a.dispatch=E,a.scatter=b,a.legend=f,a.controls=g,a.xAxis=d,a.yAxis=e,a.distX=h,a.distY=i,d3.rebind(a,b,"id","interactive","pointActive","x","y","shape","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","sizeRange","forceX","forceY","forceSize","clipVoronoi","clipRadius","useVoronoi"),a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(j.top="undefined"!=typeof b.top?b.top:j.top,j.right="undefined"!=typeof b.right?b.right:j.right,j.bottom="undefined"!=typeof b.bottom?b.bottom:j.bottom,j.left="undefined"!=typeof b.left?b.left:j.left,a):j},a.width=function(b){return arguments.length?(k=b,a):k},a.height=function(b){return arguments.length?(l=b,a):l},a.color=function(b){return arguments.length?(m=c.utils.getColor(b),f.color(m),h.color(m),i.color(m),a):m},a.showDistX=function(b){return arguments.length?(p=b,a):p},a.showDistY=function(b){return arguments.length?(q=b,a):q},a.showControls=function(b){return arguments.length?(v=b,a):v},a.showLegend=function(b){return arguments.length?(r=b,a):r},a.showXAxis=function(b){return arguments.length?(s=b,a):s},a.showYAxis=function(b){return arguments.length?(t=b,a):t},a.rightAlignYAxis=function(b){return arguments.length?(u=b,e.orient(b?"right":"left"),a):u},a.fisheye=function(b){return arguments.length?(w=b,a):w},a.tooltips=function(b){return arguments.length?(y=b,a):y},a.tooltipContent=function(b){return arguments.length?(B=b,a):B},a.tooltipXContent=function(b){return arguments.length?(z=b,a):z},a.tooltipYContent=function(b){return arguments.length?(A=b,a):A},a.state=function(b){return arguments.length?(C=b,a):C},a.defaultState=function(b){return arguments.length?(D=b,a):D},a.noData=function(b){return arguments.length?(F=b,a):F},a.transitionDuration=function(b){return arguments.length?(G=b,a):G},a},c.models.sparkline=function(){"use strict";function a(c){return c.each(function(a){var c=h-g.left-g.right,j=i-g.top-g.bottom,p=d3.select(this);k.domain(b||d3.extent(a,m)).range(e||[0,c]),l.domain(d||d3.extent(a,n)).range(f||[j,0]);var q=p.selectAll("g.nv-wrap.nv-sparkline").data([a]),r=q.enter().append("g").attr("class","nvd3 nv-wrap nv-sparkline");r.append("g"),q.select("g");q.attr("transform","translate("+g.left+","+g.top+")");var s=q.selectAll("path").data(function(a){return[a]});s.enter().append("path"),s.exit().remove(),s.style("stroke",function(a,b){return a.color||o(a,b)}).attr("d",d3.svg.line().x(function(a,b){return k(m(a,b))}).y(function(a,b){return l(n(a,b))}));var t=q.selectAll("circle.nv-point").data(function(a){function b(b){if(-1!=b){var c=a[b];return c.pointIndex=b,c}return null}var c=a.map(function(a,b){return n(a,b)}),d=b(c.lastIndexOf(l.domain()[1])),e=b(c.indexOf(l.domain()[0])),f=b(c.length-1);return[e,d,f].filter(function(a){return null!=a})});t.enter().append("circle"),t.exit().remove(),t.attr("cx",function(a,b){return k(m(a,a.pointIndex))}).attr("cy",function(a,b){return l(n(a,a.pointIndex))}).attr("r",2).attr("class",function(a,b){return m(a,a.pointIndex)==k.domain()[1]?"nv-point nv-currentValue":n(a,a.pointIndex)==l.domain()[0]?"nv-point nv-minValue":"nv-point nv-maxValue"})}),a}var b,d,e,f,g={top:2,right:0,bottom:2,left:0},h=400,i=32,j=!0,k=d3.scale.linear(),l=d3.scale.linear(),m=function(a){return a.x},n=function(a){return a.y},o=c.utils.getColor(["#000"]);return a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(g.top="undefined"!=typeof b.top?b.top:g.top,g.right="undefined"!=typeof b.right?b.right:g.right,g.bottom="undefined"!=typeof b.bottom?b.bottom:g.bottom,g.left="undefined"!=typeof b.left?b.left:g.left,a):g},a.width=function(b){return arguments.length?(h=b,a):h},a.height=function(b){return arguments.length?(i=b,a):i},a.x=function(b){return arguments.length?(m=d3.functor(b),a):m},a.y=function(b){return arguments.length?(n=d3.functor(b),a):n},a.xScale=function(b){return arguments.length?(k=b,a):k},a.yScale=function(b){return arguments.length?(l=b,a):l},a.xDomain=function(c){return arguments.length?(b=c,a):b},a.yDomain=function(b){return arguments.length?(d=b,a):d},a.xRange=function(b){return arguments.length?(e=b,a):e},a.yRange=function(b){return arguments.length?(f=b,a):f},a.animate=function(b){return arguments.length?(j=b,a):j},a.color=function(b){return arguments.length?(o=c.utils.getColor(b),a):o},a},c.models.sparklinePlus=function(){"use strict";function a(c){return c.each(function(m){function q(){if(!j){var a=A.selectAll(".nv-hoverValue").data(i),c=a.enter().append("g").attr("class","nv-hoverValue").style("stroke-opacity",0).style("fill-opacity",0);a.exit().transition().duration(250).style("stroke-opacity",0).style("fill-opacity",0).remove(),a.attr("transform",function(a){return"translate("+b(e.x()(m[a],a))+",0)"}).transition().duration(250).style("stroke-opacity",1).style("fill-opacity",1),i.length&&(c.append("line").attr("x1",0).attr("y1",-f.top).attr("x2",0).attr("y2",u),c.append("text").attr("class","nv-xValue").attr("x",-6).attr("y",-f.top).attr("text-anchor","end").attr("dy",".9em"),A.select(".nv-hoverValue .nv-xValue").text(k(e.x()(m[i[0]],i[0]))),c.append("text").attr("class","nv-yValue").attr("x",6).attr("y",-f.top).attr("text-anchor","start").attr("dy",".9em"),A.select(".nv-hoverValue .nv-yValue").text(l(e.y()(m[i[0]],i[0]))))}}function r(){function a(a,b){for(var c=Math.abs(e.x()(a[0],0)-b),d=0,f=0;f<a.length;f++)Math.abs(e.x()(a[f],f)-b)<c&&(c=Math.abs(e.x()(a[f],f)-b),d=f);return d}if(!j){var c=d3.mouse(this)[0]-f.left;i=[a(m,Math.round(b.invert(c)))],q()}}var s=d3.select(this),t=(g||parseInt(s.style("width"))||960)-f.left-f.right,u=(h||parseInt(s.style("height"))||400)-f.top-f.bottom;if(a.update=function(){a(c)},a.container=this,!m||!m.length){var v=s.selectAll(".nv-noData").data([p]);return v.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),v.attr("x",f.left+t/2).attr("y",f.top+u/2).text(function(a){return a}),a}s.selectAll(".nv-noData").remove();var w=e.y()(m[m.length-1],m.length-1);b=e.xScale(),d=e.yScale();var x=s.selectAll("g.nv-wrap.nv-sparklineplus").data([m]),y=x.enter().append("g").attr("class","nvd3 nv-wrap nv-sparklineplus"),z=y.append("g"),A=x.select("g");z.append("g").attr("class","nv-sparklineWrap"),z.append("g").attr("class","nv-valueWrap"),z.append("g").attr("class","nv-hoverArea"),x.attr("transform","translate("+f.left+","+f.top+")");var B=A.select(".nv-sparklineWrap");e.width(t).height(u),B.call(e);var C=A.select(".nv-valueWrap"),D=C.selectAll(".nv-currentValue").data([w]);D.enter().append("text").attr("class","nv-currentValue").attr("dx",o?-8:8).attr("dy",".9em").style("text-anchor",o?"end":"start"),D.attr("x",t+(o?f.right:0)).attr("y",n?function(a){return d(a)}:0).style("fill",e.color()(m[m.length-1],m.length-1)).text(l(w)),z.select(".nv-hoverArea").append("rect").on("mousemove",r).on("click",function(){j=!j}).on("mouseout",function(){i=[],q()}),A.select(".nv-hoverArea rect").attr("transform",function(a){return"translate("+-f.left+","+-f.top+")"}).attr("width",t+f.left+f.right).attr("height",u+f.top)}),a}var b,d,e=c.models.sparkline(),f={top:15,right:100,bottom:10,left:50},g=null,h=null,i=[],j=!1,k=d3.format(",r"),l=d3.format(",.2f"),m=!0,n=!0,o=!1,p="No Data Available.";return a.sparkline=e,d3.rebind(a,e,"x","y","xScale","yScale","color"),a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(f.top="undefined"!=typeof b.top?b.top:f.top,f.right="undefined"!=typeof b.right?b.right:f.right,f.bottom="undefined"!=typeof b.bottom?b.bottom:f.bottom,f.left="undefined"!=typeof b.left?b.left:f.left,a):f},a.width=function(b){return arguments.length?(g=b,a):g},a.height=function(b){return arguments.length?(h=b,a):h},a.xTickFormat=function(b){return arguments.length?(k=b,a):k},a.yTickFormat=function(b){return arguments.length?(l=b,a):l},a.showValue=function(b){return arguments.length?(m=b,a):m},a.alignValue=function(b){return arguments.length?(n=b,a):n},a.rightAlignValue=function(b){return arguments.length?(o=b,a):o},a.noData=function(b){return arguments.length?(p=b,a):p},a},c.models.stackedArea=function(){"use strict";function a(c){return c.each(function(c){var l=f-e.left-e.right,s=g-e.top-e.bottom,t=d3.select(this);b=q.xScale(),d=q.yScale();var u=c;c.forEach(function(a,b){a.seriesIndex=b,a.values=a.values.map(function(a,c){return a.index=c,a.seriesIndex=b,a})});var v=c.filter(function(a){return!a.disabled});c=d3.layout.stack().order(n).offset(m).values(function(a){return a.values}).x(j).y(k).out(function(a,b,c){var d=0===k(a)?0:c;a.display={y:d,y0:b}})(v);var w=t.selectAll("g.nv-wrap.nv-stackedarea").data([c]),x=w.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedarea"),y=x.append("defs"),z=x.append("g"),A=w.select("g");z.append("g").attr("class","nv-areaWrap"),z.append("g").attr("class","nv-scatterWrap"),w.attr("transform","translate("+e.left+","+e.top+")"),q.width(l).height(s).x(j).y(function(a){return a.display.y+a.display.y0}).forceY([0]).color(c.map(function(a,b){return a.color||h(a,a.seriesIndex)}));var B=A.select(".nv-scatterWrap").datum(c);B.call(q),y.append("clipPath").attr("id","nv-edge-clip-"+i).append("rect"),w.select("#nv-edge-clip-"+i+" rect").attr("width",l).attr("height",s),A.attr("clip-path",p?"url(#nv-edge-clip-"+i+")":"");var C=d3.svg.area().x(function(a,c){return b(j(a,c))}).y0(function(a){return d(a.display.y0)}).y1(function(a){return d(a.display.y+a.display.y0)}).interpolate(o),D=d3.svg.area().x(function(a,c){return b(j(a,c))}).y0(function(a){return d(a.display.y0)}).y1(function(a){return d(a.display.y0)}),E=A.select(".nv-areaWrap").selectAll("path.nv-area").data(function(a){return a});E.enter().append("path").attr("class",function(a,b){return"nv-area nv-area-"+b}).attr("d",function(a,b){return D(a.values,a.seriesIndex)}).on("mouseover",function(a,b){d3.select(this).classed("hover",!0),r.areaMouseover({point:a,series:a.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:a.seriesIndex})}).on("mouseout",function(a,b){d3.select(this).classed("hover",!1),r.areaMouseout({point:a,series:a.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:a.seriesIndex})}).on("click",function(a,b){d3.select(this).classed("hover",!1),r.areaClick({point:a,series:a.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:a.seriesIndex})}),E.exit().remove(),E.style("fill",function(a,b){return a.color||h(a,a.seriesIndex)}).style("stroke",function(a,b){return a.color||h(a,a.seriesIndex)}),E.transition().attr("d",function(a,b){return C(a.values,b)}),q.dispatch.on("elementMouseover.area",function(a){A.select(".nv-chart-"+i+" .nv-area-"+a.seriesIndex).classed("hover",!0)}),q.dispatch.on("elementMouseout.area",function(a){A.select(".nv-chart-"+i+" .nv-area-"+a.seriesIndex).classed("hover",!1)}),a.d3_stackedOffset_stackPercent=function(a){var b,c,d,e=a.length,f=a[0].length,g=1/e,h=[];for(c=0;f>c;++c){for(b=0,d=0;b<u.length;b++)d+=k(u[b].values[c]);if(d)for(b=0;e>b;b++)a[b][c][1]/=d;else for(b=0;e>b;b++)a[b][c][1]=g}for(c=0;f>c;++c)h[c]=0;return h}}),a}var b,d,e={top:0,right:0,bottom:0,left:0},f=960,g=500,h=c.utils.defaultColor(),i=Math.floor(1e5*Math.random()),j=function(a){return a.x},k=function(a){return a.y},l="stack",m="zero",n="default",o="linear",p=!1,q=c.models.scatter(),r=d3.dispatch("tooltipShow","tooltipHide","areaClick","areaMouseover","areaMouseout");return q.size(2.2).sizeDomain([2.2,2.2]),q.dispatch.on("elementClick.area",function(a){r.areaClick(a)}),q.dispatch.on("elementMouseover.tooltip",function(a){a.pos=[a.pos[0]+e.left,a.pos[1]+e.top],r.tooltipShow(a)}),q.dispatch.on("elementMouseout.tooltip",function(a){r.tooltipHide(a)}),a.dispatch=r,a.scatter=q,d3.rebind(a,q,"interactive","size","xScale","yScale","zScale","xDomain","yDomain","xRange","yRange","sizeDomain","forceX","forceY","forceSize","clipVoronoi","useVoronoi","clipRadius","highlightPoint","clearHighlights"),a.options=c.utils.optionsFunc.bind(a),a.x=function(b){return arguments.length?(j=d3.functor(b),a):j},a.y=function(b){return arguments.length?(k=d3.functor(b),a):k},a.margin=function(b){return arguments.length?(e.top="undefined"!=typeof b.top?b.top:e.top,e.right="undefined"!=typeof b.right?b.right:e.right,e.bottom="undefined"!=typeof b.bottom?b.bottom:e.bottom,e.left="undefined"!=typeof b.left?b.left:e.left,a):e},a.width=function(b){return arguments.length?(f=b,a):f},a.height=function(b){return arguments.length?(g=b,a):g},a.clipEdge=function(b){return arguments.length?(p=b,a):p},a.color=function(b){return arguments.length?(h=c.utils.getColor(b),a):h},a.offset=function(b){return arguments.length?(m=b,a):m},a.order=function(b){return arguments.length?(n=b,a):n},a.style=function(b){if(!arguments.length)return l;switch(l=b){case"stack":a.offset("zero"),a.order("default");break;case"stream":a.offset("wiggle"),a.order("inside-out");break;case"stream-center":a.offset("silhouette"),a.order("inside-out");break;case"expand":a.offset("expand"),a.order("default");break;case"stack_percent":a.offset(a.d3_stackedOffset_stackPercent),a.order("default")}return a},a.interpolate=function(b){return arguments.length?(o=b,a):o},a},c.models.stackedAreaChart=function(){"use strict";function a(v){return v.each(function(v){var G=d3.select(this),H=this,I=(l||parseInt(G.style("width"))||960)-k.left-k.right,J=(m||parseInt(G.style("height"))||400)-k.top-k.bottom;if(a.update=function(){G.transition().duration(E).call(a)},a.container=this,x.disabled=v.map(function(a){return!!a.disabled}),!y){var K;y={};for(K in x)x[K]instanceof Array?y[K]=x[K].slice(0):y[K]=x[K]}if(!(v&&v.length&&v.filter(function(a){return a.values.length}).length)){var L=G.selectAll(".nv-noData").data([z]);return L.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),L.attr("x",k.left+I/2).attr("y",k.top+J/2).text(function(a){return a}),a}G.selectAll(".nv-noData").remove(),b=e.xScale(),d=e.yScale();var M=G.selectAll("g.nv-wrap.nv-stackedAreaChart").data([v]),N=M.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedAreaChart").append("g"),O=M.select("g");if(N.append("rect").style("opacity",0),N.append("g").attr("class","nv-x nv-axis"),N.append("g").attr("class","nv-y nv-axis"),N.append("g").attr("class","nv-stackedWrap"),N.append("g").attr("class","nv-legendWrap"),N.append("g").attr("class","nv-controlsWrap"),N.append("g").attr("class","nv-interactive"),O.select("rect").attr("width",I).attr("height",J),p){var P=o?I-B:I;h.width(P),O.select(".nv-legendWrap").datum(v).call(h),k.top!=h.height()&&(k.top=h.height(),J=(m||parseInt(G.style("height"))||400)-k.top-k.bottom),O.select(".nv-legendWrap").attr("transform","translate("+(I-P)+","+-k.top+")")}if(o){var Q=[{key:D.stacked||"Stacked",metaKey:"Stacked",disabled:"stack"!=e.style(),style:"stack"},{key:D.stream||"Stream",metaKey:"Stream",disabled:"stream"!=e.style(),style:"stream"},{key:D.expanded||"Expanded",metaKey:"Expanded",disabled:"expand"!=e.style(),style:"expand"},{key:D.stack_percent||"Stack %",metaKey:"Stack_Percent",disabled:"stack_percent"!=e.style(),style:"stack_percent"}];B=C.length/3*260,Q=Q.filter(function(a){return-1!==C.indexOf(a.metaKey)}),i.width(B).color(["#444","#444","#444"]),O.select(".nv-controlsWrap").datum(Q).call(i),k.top!=Math.max(i.height(),h.height())&&(k.top=Math.max(i.height(),h.height()),J=(m||parseInt(G.style("height"))||400)-k.top-k.bottom),O.select(".nv-controlsWrap").attr("transform","translate(0,"+-k.top+")")}M.attr("transform","translate("+k.left+","+k.top+")"),s&&O.select(".nv-y.nv-axis").attr("transform","translate("+I+",0)"),t&&(j.width(I).height(J).margin({left:k.left,top:k.top}).svgContainer(G).xScale(b),M.select(".nv-interactive").call(j)),e.width(I).height(J);var R=O.select(".nv-stackedWrap").datum(v);R.transition().call(e),q&&(f.scale(b).ticks(I/100).tickSize(-J,0),O.select(".nv-x.nv-axis").attr("transform","translate(0,"+J+")"),O.select(".nv-x.nv-axis").transition().duration(0).call(f)),r&&(g.scale(d).ticks("wiggle"==e.offset()?0:J/36).tickSize(-I,0).setTickFormat("expand"==e.style()||"stack_percent"==e.style()?d3.format("%"):w),O.select(".nv-y.nv-axis").transition().duration(0).call(g)),e.dispatch.on("areaClick.toggle",function(b){1===v.filter(function(a){return!a.disabled}).length?v.forEach(function(a){a.disabled=!1}):v.forEach(function(a,c){a.disabled=c!=b.seriesIndex}),x.disabled=v.map(function(a){return!!a.disabled}),A.stateChange(x),a.update()}),h.dispatch.on("stateChange",function(b){x.disabled=b.disabled,A.stateChange(x),a.update()}),i.dispatch.on("legendClick",function(b,c){b.disabled&&(Q=Q.map(function(a){return a.disabled=!0,a}),b.disabled=!1,e.style(b.style),x.style=e.style(),A.stateChange(x),a.update())}),j.dispatch.on("elementMousemove",function(b){e.clearHighlights();var d,h,i,l=[];if(v.filter(function(a,b){return a.seriesIndex=b,!a.disabled}).forEach(function(f,g){h=c.interactiveBisect(f.values,b.pointXValue,a.x()),e.highlightPoint(g,h,!0);var j=f.values[h];if("undefined"!=typeof j){"undefined"==typeof d&&(d=j),"undefined"==typeof i&&(i=a.xScale()(a.x()(j,h)));var k="expand"==e.style()?j.display.y:a.y()(j,h);l.push({key:f.key,value:k,color:n(f,f.seriesIndex),stackedValue:j.display})}}),l.reverse(),l.length>2){var m=a.yScale().invert(b.mouseY),o=null;l.forEach(function(a,b){m=Math.abs(m);var c=Math.abs(a.stackedValue.y0),d=Math.abs(a.stackedValue.y);return m>=c&&d+c>=m?void(o=b):void 0}),null!=o&&(l[o].highlight=!0)}var p=f.tickFormat()(a.x()(d,h)),q="expand"==e.style()?function(a,b){return d3.format(".1%")(a)}:function(a,b){return g.tickFormat()(a)};j.tooltip.position({left:i+k.left,top:b.mouseY+k.top}).chartContainer(H.parentNode).enabled(u).valueFormatter(q).data({value:p,series:l})(),j.renderGuideLine(i)}),j.dispatch.on("elementMouseout",function(a){A.tooltipHide(),e.clearHighlights()}),A.on("tooltipShow",function(a){u&&F(a,H.parentNode)}),A.on("changeState",function(b){"undefined"!=typeof b.disabled&&(v.forEach(function(a,c){a.disabled=b.disabled[c]}),x.disabled=b.disabled),"undefined"!=typeof b.style&&e.style(b.style),a.update()})}),a}var b,d,e=c.models.stackedArea(),f=c.models.axis(),g=c.models.axis(),h=c.models.legend(),i=c.models.legend(),j=c.interactiveGuideline(),k={top:30,right:25,bottom:50,left:60},l=null,m=null,n=c.utils.defaultColor(),o=!0,p=!0,q=!0,r=!0,s=!1,t=!1,u=!0,v=function(a,b,c,d,e){return"<h3>"+a+"</h3><p>"+c+" on "+b+"</p>"},w=d3.format(",.2f"),x={style:e.style()},y=null,z="No Data Available.",A=d3.dispatch("tooltipShow","tooltipHide","stateChange","changeState"),B=250,C=["Stacked","Stream","Expanded"],D={},E=250;f.orient("bottom").tickPadding(7),g.orient(s?"right":"left"),i.updateState(!1);var F=function(b,d){var h=b.pos[0]+(d.offsetLeft||0),i=b.pos[1]+(d.offsetTop||0),j=f.tickFormat()(e.x()(b.point,b.pointIndex)),k=g.tickFormat()(e.y()(b.point,b.pointIndex)),l=v(b.series.key,j,k,b,a);c.tooltip.show([h,i],l,b.value<0?"n":"s",null,d)};return e.dispatch.on("tooltipShow",function(a){a.pos=[a.pos[0]+k.left,a.pos[1]+k.top],A.tooltipShow(a)}),e.dispatch.on("tooltipHide",function(a){A.tooltipHide(a)}),A.on("tooltipHide",function(){u&&c.tooltip.cleanup()}),a.dispatch=A,a.stacked=e,a.legend=h,a.controls=i,a.xAxis=f,a.yAxis=g,a.interactiveLayer=j,d3.rebind(a,e,"x","y","size","xScale","yScale","xDomain","yDomain","xRange","yRange","sizeDomain","interactive","useVoronoi","offset","order","style","clipEdge","forceX","forceY","forceSize","interpolate"),a.options=c.utils.optionsFunc.bind(a),a.margin=function(b){return arguments.length?(k.top="undefined"!=typeof b.top?b.top:k.top,k.right="undefined"!=typeof b.right?b.right:k.right,k.bottom="undefined"!=typeof b.bottom?b.bottom:k.bottom,k.left="undefined"!=typeof b.left?b.left:k.left,a):k},a.width=function(b){return arguments.length?(l=b,a):l},a.height=function(b){return arguments.length?(m=b,a):m},a.color=function(b){return arguments.length?(n=c.utils.getColor(b),h.color(n),e.color(n),a):n},a.showControls=function(b){return arguments.length?(o=b,a):o},a.showLegend=function(b){return arguments.length?(p=b,a):p},a.showXAxis=function(b){return arguments.length?(q=b,a):q},a.showYAxis=function(b){return arguments.length?(r=b,a):r},a.rightAlignYAxis=function(b){return arguments.length?(s=b,g.orient(b?"right":"left"),a):s},a.useInteractiveGuideline=function(b){return arguments.length?(t=b,b===!0&&(a.interactive(!1),a.useVoronoi(!1)),a):t},a.tooltip=function(b){return arguments.length?(v=b,a):v},a.tooltips=function(b){return arguments.length?(u=b,a):u},a.tooltipContent=function(b){return arguments.length?(v=b,a):v},a.state=function(b){return arguments.length?(x=b,a):x},a.defaultState=function(b){return arguments.length?(y=b,a):y},a.noData=function(b){return arguments.length?(z=b,a):z},a.transitionDuration=function(b){return arguments.length?(E=b,a):E},a.controlsData=function(b){return arguments.length?(C=b,a):C},a.controlLabels=function(b){return arguments.length?"object"!=typeof b?D:(D=b,a):D},g.setTickFormat=g.tickFormat,g.tickFormat=function(a){return arguments.length?(w=a,g):w},a}}();
\ No newline at end of file
diff --git a/src/purify.js b/src/purify.js
new file mode 100644
index 0000000..3be9c8d
--- /dev/null
+++ b/src/purify.js
@@ -0,0 +1,1624 @@
+'use strict';
+
+var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
+
+var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
+
+function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
+
+/*! @license DOMPurify 3.0.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.5/LICENSE */
+
+(function (global, factory) {
+ (typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.DOMPurify = factory());
+})(undefined, function () {
+ 'use strict';
+
+ var entries = Object.entries,
+ setPrototypeOf = Object.setPrototypeOf,
+ isFrozen = Object.isFrozen,
+ getPrototypeOf = Object.getPrototypeOf,
+ getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
+ var freeze = Object.freeze,
+ seal = Object.seal,
+ create = Object.create; // eslint-disable-line import/no-mutable-exports
+
+ var _ref = typeof Reflect !== 'undefined' && Reflect,
+ apply = _ref.apply,
+ construct = _ref.construct;
+
+ if (!freeze) {
+ freeze = function freeze(x) {
+ return x;
+ };
+ }
+
+ if (!seal) {
+ seal = function seal(x) {
+ return x;
+ };
+ }
+
+ if (!apply) {
+ apply = function apply(fun, thisValue, args) {
+ return fun.apply(thisValue, args);
+ };
+ }
+
+ if (!construct) {
+ construct = function construct(Func, args) {
+ return new (Function.prototype.bind.apply(Func, [null].concat(_toConsumableArray(args))))();
+ };
+ }
+
+ var arrayForEach = unapply(Array.prototype.forEach);
+ var arrayPop = unapply(Array.prototype.pop);
+ var arrayPush = unapply(Array.prototype.push);
+ var stringToLowerCase = unapply(String.prototype.toLowerCase);
+ var stringToString = unapply(String.prototype.toString);
+ var stringMatch = unapply(String.prototype.match);
+ var stringReplace = unapply(String.prototype.replace);
+ var stringIndexOf = unapply(String.prototype.indexOf);
+ var stringTrim = unapply(String.prototype.trim);
+ var regExpTest = unapply(RegExp.prototype.test);
+ var typeErrorCreate = unconstruct(TypeError);
+ /**
+ * Creates a new function that calls the given function with a specified thisArg and arguments.
+ *
+ * @param {Function} func - The function to be wrapped and called.
+ * @returns {Function} A new function that calls the given function with a specified thisArg and arguments.
+ */
+
+ function unapply(func) {
+ return function (thisArg) {
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+
+ return apply(func, thisArg, args);
+ };
+ }
+ /**
+ * Creates a new function that constructs an instance of the given constructor function with the provided arguments.
+ *
+ * @param {Function} func - The constructor function to be wrapped and called.
+ * @returns {Function} A new function that constructs an instance of the given constructor function with the provided arguments.
+ */
+
+ function unconstruct(func) {
+ return function () {
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
+ args[_key2] = arguments[_key2];
+ }
+
+ return construct(func, args);
+ };
+ }
+ /**
+ * Add properties to a lookup table
+ *
+ * @param {Object} set - The set to which elements will be added.
+ * @param {Array} array - The array containing elements to be added to the set.
+ * @param {Function} transformCaseFunc - An optional function to transform the case of each element before adding to the set.
+ * @returns {Object} The modified set with added elements.
+ */
+
+ function addToSet(set, array) {
+ var transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase;
+
+ if (setPrototypeOf) {
+ // Make 'in' and truthy checks like Boolean(set.constructor)
+ // independent of any properties defined on Object.prototype.
+ // Prevent prototype setters from intercepting set as a this value.
+ setPrototypeOf(set, null);
+ }
+
+ var l = array.length;
+
+ while (l--) {
+ var element = array[l];
+
+ if (typeof element === 'string') {
+ var lcElement = transformCaseFunc(element);
+
+ if (lcElement !== element) {
+ // Config presets (e.g. tags.js, attrs.js) are immutable.
+ if (!isFrozen(array)) {
+ array[l] = lcElement;
+ }
+
+ element = lcElement;
+ }
+ }
+
+ set[element] = true;
+ }
+
+ return set;
+ }
+ /**
+ * Shallow clone an object
+ *
+ * @param {Object} object - The object to be cloned.
+ * @returns {Object} A new object that copies the original.
+ */
+
+ function clone(object) {
+ var newObject = create(null);
+
+ var _iteratorNormalCompletion = true;
+ var _didIteratorError = false;
+ var _iteratorError = undefined;
+
+ try {
+ for (var _iterator = entries(object)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
+ var _ref2 = _step.value;
+
+ var _ref3 = _slicedToArray(_ref2, 2);
+
+ var property = _ref3[0];
+ var value = _ref3[1];
+
+ newObject[property] = value;
+ }
+ } catch (err) {
+ _didIteratorError = true;
+ _iteratorError = err;
+ } finally {
+ try {
+ if (!_iteratorNormalCompletion && _iterator.return) {
+ _iterator.return();
+ }
+ } finally {
+ if (_didIteratorError) {
+ throw _iteratorError;
+ }
+ }
+ }
+
+ return newObject;
+ }
+ /**
+ * This method automatically checks if the prop is function or getter and behaves accordingly.
+ *
+ * @param {Object} object - The object to look up the getter function in its prototype chain.
+ * @param {String} prop - The property name for which to find the getter function.
+ * @returns {Function} The getter function found in the prototype chain or a fallback function.
+ */
+
+ function lookupGetter(object, prop) {
+ while (object !== null) {
+ var desc = getOwnPropertyDescriptor(object, prop);
+
+ if (desc) {
+ if (desc.get) {
+ return unapply(desc.get);
+ }
+
+ if (typeof desc.value === 'function') {
+ return unapply(desc.value);
+ }
+ }
+
+ object = getPrototypeOf(object);
+ }
+
+ function fallbackValue(element) {
+ console.warn('fallback value for', element);
+ return null;
+ }
+
+ return fallbackValue;
+ }
+
+ var html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']); // SVG
+
+ var svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
+ var svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']); // List of SVG elements that are disallowed by default.
+ // We still need to know them so that we can do namespace
+ // checks properly in case one wants to add them to
+ // allow-list.
+
+ var svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);
+ var mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover', 'mprescripts']); // Similarly to SVG, we want to know all MathML elements,
+ // even those that we disallow by default.
+
+ var mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
+ var text = freeze(['#text']);
+
+ var html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns', 'slot']);
+ var svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
+ var mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
+ var xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
+
+ var MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
+
+ var ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
+ var TMPLIT_EXPR = seal(/\${[\w\W]*}/gm);
+ var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape
+
+ var ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
+
+ var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
+ );
+ var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
+ var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
+ );
+ var DOCTYPE_NAME = seal(/^html$/i);
+
+ var EXPRESSIONS = /*#__PURE__*/Object.freeze({
+ __proto__: null,
+ MUSTACHE_EXPR: MUSTACHE_EXPR,
+ ERB_EXPR: ERB_EXPR,
+ TMPLIT_EXPR: TMPLIT_EXPR,
+ DATA_ATTR: DATA_ATTR,
+ ARIA_ATTR: ARIA_ATTR,
+ IS_ALLOWED_URI: IS_ALLOWED_URI,
+ IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,
+ ATTR_WHITESPACE: ATTR_WHITESPACE,
+ DOCTYPE_NAME: DOCTYPE_NAME
+ });
+
+ var getGlobal = function getGlobal() {
+ return typeof window === 'undefined' ? null : window;
+ };
+ /**
+ * Creates a no-op policy for internal use only.
+ * Don't export this function outside this module!
+ * @param {?TrustedTypePolicyFactory} trustedTypes The policy factory.
+ * @param {HTMLScriptElement} purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).
+ * @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types
+ * are not supported or creating the policy failed).
+ */
+
+ var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
+ if ((typeof trustedTypes === 'undefined' ? 'undefined' : _typeof(trustedTypes)) !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
+ return null;
+ } // Allow the callers to control the unique policy name
+ // by adding a data-tt-policy-suffix to the script element with the DOMPurify.
+ // Policy creation with duplicate names throws in Trusted Types.
+
+
+ var suffix = null;
+ var ATTR_NAME = 'data-tt-policy-suffix';
+
+ if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
+ suffix = purifyHostElement.getAttribute(ATTR_NAME);
+ }
+
+ var policyName = 'dompurify' + (suffix ? '#' + suffix : '');
+
+ try {
+ return trustedTypes.createPolicy(policyName, {
+ createHTML: function createHTML(html) {
+ return html;
+ },
+ createScriptURL: function createScriptURL(scriptUrl) {
+ return scriptUrl;
+ }
+ });
+ } catch (_) {
+ // Policy creation failed (most likely another DOMPurify script has
+ // already run). Skip creating the policy, as this will only cause errors
+ // if TT are enforced.
+ console.warn('TrustedTypes policy ' + policyName + ' could not be created.');
+ return null;
+ }
+ };
+
+ function createDOMPurify() {
+ var window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
+
+ var DOMPurify = function DOMPurify(root) {
+ return createDOMPurify(root);
+ };
+ /**
+ * Version label, exposed for easier checks
+ * if DOMPurify is up to date or not
+ */
+
+ DOMPurify.version = '3.0.5';
+ /**
+ * Array of elements that DOMPurify removed during sanitation.
+ * Empty if nothing was removed.
+ */
+
+ DOMPurify.removed = [];
+
+ if (!window || !window.document || window.document.nodeType !== 9) {
+ // Not running in a browser, provide a factory function
+ // so that you can pass your own Window
+ DOMPurify.isSupported = false;
+ return DOMPurify;
+ }
+
+ var document = window.document;
+
+ var originalDocument = document;
+ var currentScript = originalDocument.currentScript;
+ var DocumentFragment = window.DocumentFragment,
+ HTMLTemplateElement = window.HTMLTemplateElement,
+ Node = window.Node,
+ Element = window.Element,
+ NodeFilter = window.NodeFilter,
+ _window$NamedNodeMap = window.NamedNodeMap,
+ NamedNodeMap = _window$NamedNodeMap === undefined ? window.NamedNodeMap || window.MozNamedAttrMap : _window$NamedNodeMap,
+ HTMLFormElement = window.HTMLFormElement,
+ DOMParser = window.DOMParser,
+ trustedTypes = window.trustedTypes;
+
+ var ElementPrototype = Element.prototype;
+ var cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
+ var getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
+ var getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
+ var getParentNode = lookupGetter(ElementPrototype, 'parentNode'); // As per issue #47, the web-components registry is inherited by a
+ // new document created via createHTMLDocument. As per the spec
+ // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
+ // a new empty registry is used when creating a template contents owner
+ // document, so we use that as our parent document to ensure nothing
+ // is inherited.
+
+ if (typeof HTMLTemplateElement === 'function') {
+ var template = document.createElement('template');
+
+ if (template.content && template.content.ownerDocument) {
+ document = template.content.ownerDocument;
+ }
+ }
+
+ var trustedTypesPolicy = void 0;
+ var emptyHTML = '';
+ var _document = document,
+ implementation = _document.implementation,
+ createNodeIterator = _document.createNodeIterator,
+ createDocumentFragment = _document.createDocumentFragment,
+ getElementsByTagName = _document.getElementsByTagName;
+ var importNode = originalDocument.importNode;
+
+ var hooks = {};
+ /**
+ * Expose whether this browser supports running the full DOMPurify.
+ */
+
+ DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;
+ var MUSTACHE_EXPR = EXPRESSIONS.MUSTACHE_EXPR,
+ ERB_EXPR = EXPRESSIONS.ERB_EXPR,
+ TMPLIT_EXPR = EXPRESSIONS.TMPLIT_EXPR,
+ DATA_ATTR = EXPRESSIONS.DATA_ATTR,
+ ARIA_ATTR = EXPRESSIONS.ARIA_ATTR,
+ IS_SCRIPT_OR_DATA = EXPRESSIONS.IS_SCRIPT_OR_DATA,
+ ATTR_WHITESPACE = EXPRESSIONS.ATTR_WHITESPACE;
+ var IS_ALLOWED_URI$1 = EXPRESSIONS.IS_ALLOWED_URI;
+ /**
+ * We consider the elements and attributes below to be safe. Ideally
+ * don't add any new ones but feel free to remove unwanted ones.
+ */
+
+ /* allowed element names */
+
+ var ALLOWED_TAGS = null;
+ var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray(html$1), _toConsumableArray(svg$1), _toConsumableArray(svgFilters), _toConsumableArray(mathMl$1), _toConsumableArray(text)));
+ /* Allowed attribute names */
+
+ var ALLOWED_ATTR = null;
+ var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray(html), _toConsumableArray(svg), _toConsumableArray(mathMl), _toConsumableArray(xml)));
+ /*
+ * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements.
+ * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
+ * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
+ * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
+ */
+
+ var CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
+ tagNameCheck: {
+ writable: true,
+ configurable: false,
+ enumerable: true,
+ value: null
+ },
+ attributeNameCheck: {
+ writable: true,
+ configurable: false,
+ enumerable: true,
+ value: null
+ },
+ allowCustomizedBuiltInElements: {
+ writable: true,
+ configurable: false,
+ enumerable: true,
+ value: false
+ }
+ }));
+ /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
+
+ var FORBID_TAGS = null;
+ /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
+
+ var FORBID_ATTR = null;
+ /* Decide if ARIA attributes are okay */
+
+ var ALLOW_ARIA_ATTR = true;
+ /* Decide if custom data attributes are okay */
+
+ var ALLOW_DATA_ATTR = true;
+ /* Decide if unknown protocols are okay */
+
+ var ALLOW_UNKNOWN_PROTOCOLS = false;
+ /* Decide if self-closing tags in attributes are allowed.
+ * Usually removed due to a mXSS issue in jQuery 3.0 */
+
+ var ALLOW_SELF_CLOSE_IN_ATTR = true;
+ /* Output should be safe for common template engines.
+ * This means, DOMPurify removes data attributes, mustaches and ERB
+ */
+
+ var SAFE_FOR_TEMPLATES = false;
+ /* Decide if document with <html>... should be returned */
+
+ var WHOLE_DOCUMENT = false;
+ /* Track whether config is already set on this instance of DOMPurify. */
+
+ var SET_CONFIG = false;
+ /* Decide if all elements (e.g. style, script) must be children of
+ * document.body. By default, browsers might move them to document.head */
+
+ var FORCE_BODY = false;
+ /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
+ * string (or a TrustedHTML object if Trusted Types are supported).
+ * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
+ */
+
+ var RETURN_DOM = false;
+ /* Decide if a DOM `DocumentFragment` should be returned, instead of a html
+ * string (or a TrustedHTML object if Trusted Types are supported) */
+
+ var RETURN_DOM_FRAGMENT = false;
+ /* Try to return a Trusted Type object instead of a string, return a string in
+ * case Trusted Types are not supported */
+
+ var RETURN_TRUSTED_TYPE = false;
+ /* Output should be free from DOM clobbering attacks?
+ * This sanitizes markups named with colliding, clobberable built-in DOM APIs.
+ */
+
+ var SANITIZE_DOM = true;
+ /* Achieve full DOM Clobbering protection by isolating the namespace of named
+ * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.
+ *
+ * HTML/DOM spec rules that enable DOM Clobbering:
+ * - Named Access on Window (§7.3.3)
+ * - DOM Tree Accessors (§3.1.5)
+ * - Form Element Parent-Child Relations (§4.10.3)
+ * - Iframe srcdoc / Nested WindowProxies (§4.8.5)
+ * - HTMLCollection (§4.2.10.2)
+ *
+ * Namespace isolation is implemented by prefixing `id` and `name` attributes
+ * with a constant string, i.e., `user-content-`
+ */
+
+ var SANITIZE_NAMED_PROPS = false;
+ var SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';
+ /* Keep element content when removing element? */
+
+ var KEEP_CONTENT = true;
+ /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
+ * of importing it into a new Document and returning a sanitized copy */
+
+ var IN_PLACE = false;
+ /* Allow usage of profiles like html, svg and mathMl */
+
+ var USE_PROFILES = {};
+ /* Tags to ignore content of when KEEP_CONTENT is true */
+
+ var FORBID_CONTENTS = null;
+ var DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);
+ /* Tags that are safe for data: URIs */
+
+ var DATA_URI_TAGS = null;
+ var DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
+ /* Attributes safe for values like "javascript:" */
+
+ var URI_SAFE_ATTRIBUTES = null;
+ var DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);
+ var MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
+ var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
+ var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
+ /* Document namespace */
+
+ var NAMESPACE = HTML_NAMESPACE;
+ var IS_EMPTY_INPUT = false;
+ /* Allowed XHTML+XML namespaces */
+
+ var ALLOWED_NAMESPACES = null;
+ var DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
+ /* Parsing of strict XHTML documents */
+
+ var PARSER_MEDIA_TYPE = null;
+ var SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];
+ var DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
+ var transformCaseFunc = null;
+ /* Keep a reference to config to pass to hooks */
+
+ var CONFIG = null;
+ /* Ideally, do not touch anything below this line */
+
+ /* ______________________________________________ */
+
+ var formElement = document.createElement('form');
+
+ var isRegexOrFunction = function isRegexOrFunction(testValue) {
+ return testValue instanceof RegExp || testValue instanceof Function;
+ };
+ /**
+ * _parseConfig
+ *
+ * @param {Object} cfg optional config literal
+ */
+ // eslint-disable-next-line complexity
+
+
+ var _parseConfig = function _parseConfig() {
+ var cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+
+ if (CONFIG && CONFIG === cfg) {
+ return;
+ }
+ /* Shield configuration object from tampering */
+
+ if (!cfg || (typeof cfg === 'undefined' ? 'undefined' : _typeof(cfg)) !== 'object') {
+ cfg = {};
+ }
+ /* Shield configuration object from prototype pollution */
+
+ cfg = clone(cfg);
+ PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
+ SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE; // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
+
+ transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;
+ /* Set configuration parameters */
+
+ ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
+ ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
+ ALLOWED_NAMESPACES = 'ALLOWED_NAMESPACES' in cfg ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
+ URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), // eslint-disable-line indent
+ cfg.ADD_URI_SAFE_ATTR, // eslint-disable-line indent
+ transformCaseFunc // eslint-disable-line indent
+ ) // eslint-disable-line indent
+ : DEFAULT_URI_SAFE_ATTRIBUTES;
+ DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), // eslint-disable-line indent
+ cfg.ADD_DATA_URI_TAGS, // eslint-disable-line indent
+ transformCaseFunc // eslint-disable-line indent
+ ) // eslint-disable-line indent
+ : DEFAULT_DATA_URI_TAGS;
+ FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
+ FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
+ FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
+ USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false;
+ ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
+
+ ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
+
+ ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
+
+ ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true
+
+ SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false
+
+ WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false
+
+ RETURN_DOM = cfg.RETURN_DOM || false; // Default false
+
+ RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false
+
+ RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false
+
+ FORCE_BODY = cfg.FORCE_BODY || false; // Default false
+
+ SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
+
+ SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false
+
+ KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
+
+ IN_PLACE = cfg.IN_PLACE || false; // Default false
+
+ IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
+ NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
+ CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
+
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
+ CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
+ }
+
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
+ CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
+ }
+
+ if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {
+ CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
+ }
+
+ if (SAFE_FOR_TEMPLATES) {
+ ALLOW_DATA_ATTR = false;
+ }
+
+ if (RETURN_DOM_FRAGMENT) {
+ RETURN_DOM = true;
+ }
+ /* Parse profile info */
+
+ if (USE_PROFILES) {
+ ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray(text)));
+ ALLOWED_ATTR = [];
+
+ if (USE_PROFILES.html === true) {
+ addToSet(ALLOWED_TAGS, html$1);
+ addToSet(ALLOWED_ATTR, html);
+ }
+
+ if (USE_PROFILES.svg === true) {
+ addToSet(ALLOWED_TAGS, svg$1);
+ addToSet(ALLOWED_ATTR, svg);
+ addToSet(ALLOWED_ATTR, xml);
+ }
+
+ if (USE_PROFILES.svgFilters === true) {
+ addToSet(ALLOWED_TAGS, svgFilters);
+ addToSet(ALLOWED_ATTR, svg);
+ addToSet(ALLOWED_ATTR, xml);
+ }
+
+ if (USE_PROFILES.mathMl === true) {
+ addToSet(ALLOWED_TAGS, mathMl$1);
+ addToSet(ALLOWED_ATTR, mathMl);
+ addToSet(ALLOWED_ATTR, xml);
+ }
+ }
+ /* Merge configuration parameters */
+
+ if (cfg.ADD_TAGS) {
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
+ }
+
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
+ }
+
+ if (cfg.ADD_ATTR) {
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
+ }
+
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
+ }
+
+ if (cfg.ADD_URI_SAFE_ATTR) {
+ addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
+ }
+
+ if (cfg.FORBID_CONTENTS) {
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
+ }
+
+ addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
+ }
+ /* Add #text in case KEEP_CONTENT is set to true */
+
+ if (KEEP_CONTENT) {
+ ALLOWED_TAGS['#text'] = true;
+ }
+ /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
+
+ if (WHOLE_DOCUMENT) {
+ addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
+ }
+ /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */
+
+ if (ALLOWED_TAGS.table) {
+ addToSet(ALLOWED_TAGS, ['tbody']);
+ delete FORBID_TAGS.tbody;
+ }
+
+ if (cfg.TRUSTED_TYPES_POLICY) {
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') {
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
+ }
+
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
+ } // Overwrite existing TrustedTypes policy.
+
+
+ trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY; // Sign local variables required by `sanitize`.
+
+ emptyHTML = trustedTypesPolicy.createHTML('');
+ } else {
+ // Uninitialized policy, attempt to initialize the internal dompurify policy.
+ if (trustedTypesPolicy === undefined) {
+ trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
+ } // If creating the internal policy succeeded sign internal variables.
+
+
+ if (trustedTypesPolicy !== null && typeof emptyHTML === 'string') {
+ emptyHTML = trustedTypesPolicy.createHTML('');
+ }
+ } // Prevent further manipulation of configuration.
+ // Not available in IE8, Safari 5, etc.
+
+
+ if (freeze) {
+ freeze(cfg);
+ }
+
+ CONFIG = cfg;
+ };
+
+ var MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
+ var HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']); // Certain elements are allowed in both SVG and HTML
+ // namespace. We need to specify them explicitly
+ // so that they don't get erroneously deleted from
+ // HTML namespace.
+
+ var COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
+ /* Keep track of all possible SVG and MathML tags
+ * so that we can perform the namespace checks
+ * correctly. */
+
+ var ALL_SVG_TAGS = addToSet({}, svg$1);
+ addToSet(ALL_SVG_TAGS, svgFilters);
+ addToSet(ALL_SVG_TAGS, svgDisallowed);
+ var ALL_MATHML_TAGS = addToSet({}, mathMl$1);
+ addToSet(ALL_MATHML_TAGS, mathMlDisallowed);
+ /**
+ * @param {Element} element a DOM element whose namespace is being checked
+ * @returns {boolean} Return false if the element has a
+ * namespace that a spec-compliant parser would never
+ * return. Return true otherwise.
+ */
+
+ var _checkValidNamespace = function _checkValidNamespace(element) {
+ var parent = getParentNode(element); // In JSDOM, if we're inside shadow DOM, then parentNode
+ // can be null. We just simulate parent in this case.
+
+ if (!parent || !parent.tagName) {
+ parent = {
+ namespaceURI: NAMESPACE,
+ tagName: 'template'
+ };
+ }
+
+ var tagName = stringToLowerCase(element.tagName);
+ var parentTagName = stringToLowerCase(parent.tagName);
+
+ if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
+ return false;
+ }
+
+ if (element.namespaceURI === SVG_NAMESPACE) {
+ // The only way to switch from HTML namespace to SVG
+ // is via <svg>. If it happens via any other tag, then
+ // it should be killed.
+ if (parent.namespaceURI === HTML_NAMESPACE) {
+ return tagName === 'svg';
+ } // The only way to switch from MathML to SVG is via`
+ // svg if parent is either <annotation-xml> or MathML
+ // text integration points.
+
+
+ if (parent.namespaceURI === MATHML_NAMESPACE) {
+ return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
+ } // We only allow elements that are defined in SVG
+ // spec. All others are disallowed in SVG namespace.
+
+
+ return Boolean(ALL_SVG_TAGS[tagName]);
+ }
+
+ if (element.namespaceURI === MATHML_NAMESPACE) {
+ // The only way to switch from HTML namespace to MathML
+ // is via <math>. If it happens via any other tag, then
+ // it should be killed.
+ if (parent.namespaceURI === HTML_NAMESPACE) {
+ return tagName === 'math';
+ } // The only way to switch from SVG to MathML is via
+ // <math> and HTML integration points
+
+
+ if (parent.namespaceURI === SVG_NAMESPACE) {
+ return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
+ } // We only allow elements that are defined in MathML
+ // spec. All others are disallowed in MathML namespace.
+
+
+ return Boolean(ALL_MATHML_TAGS[tagName]);
+ }
+
+ if (element.namespaceURI === HTML_NAMESPACE) {
+ // The only way to switch from SVG to HTML is via
+ // HTML integration points, and from MathML to HTML
+ // is via MathML text integration points
+ if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
+ return false;
+ }
+
+ if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
+ return false;
+ } // We disallow tags that are specific for MathML
+ // or SVG and should never appear in HTML namespace
+
+
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
+ } // For XHTML and XML documents that support custom namespaces
+
+
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {
+ return true;
+ } // The code should never reach this place (this means
+ // that the element somehow got namespace that is not
+ // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).
+ // Return false just in case.
+
+
+ return false;
+ };
+ /**
+ * _forceRemove
+ *
+ * @param {Node} node a DOM node
+ */
+
+ var _forceRemove = function _forceRemove(node) {
+ arrayPush(DOMPurify.removed, {
+ element: node
+ });
+
+ try {
+ // eslint-disable-next-line unicorn/prefer-dom-node-remove
+ node.parentNode.removeChild(node);
+ } catch (_) {
+ node.remove();
+ }
+ };
+ /**
+ * _removeAttribute
+ *
+ * @param {String} name an Attribute name
+ * @param {Node} node a DOM node
+ */
+
+ var _removeAttribute = function _removeAttribute(name, node) {
+ try {
+ arrayPush(DOMPurify.removed, {
+ attribute: node.getAttributeNode(name),
+ from: node
+ });
+ } catch (_) {
+ arrayPush(DOMPurify.removed, {
+ attribute: null,
+ from: node
+ });
+ }
+
+ node.removeAttribute(name); // We void attribute values for unremovable "is"" attributes
+
+ if (name === 'is' && !ALLOWED_ATTR[name]) {
+ if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
+ try {
+ _forceRemove(node);
+ } catch (_) {}
+ } else {
+ try {
+ node.setAttribute(name, '');
+ } catch (_) {}
+ }
+ }
+ };
+ /**
+ * _initDocument
+ *
+ * @param {String} dirty a string of dirty markup
+ * @return {Document} a DOM, filled with the dirty markup
+ */
+
+ var _initDocument = function _initDocument(dirty) {
+ /* Create a HTML document */
+ var doc = null;
+ var leadingWhitespace = null;
+
+ if (FORCE_BODY) {
+ dirty = '<remove></remove>' + dirty;
+ } else {
+ /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
+ var matches = stringMatch(dirty, /^[\r\n\t ]+/);
+ leadingWhitespace = matches && matches[0];
+ }
+
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {
+ // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
+ dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
+ }
+
+ var dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
+ /*
+ * Use the DOMParser API by default, fallback later if needs be
+ * DOMParser not work for svg when has multiple root element.
+ */
+
+ if (NAMESPACE === HTML_NAMESPACE) {
+ try {
+ doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
+ } catch (_) {}
+ }
+ /* Use createHTMLDocument in case DOMParser is not available */
+
+ if (!doc || !doc.documentElement) {
+ doc = implementation.createDocument(NAMESPACE, 'template', null);
+
+ try {
+ doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
+ } catch (_) {// Syntax error if dirtyPayload is invalid xml
+ }
+ }
+
+ var body = doc.body || doc.documentElement;
+
+ if (dirty && leadingWhitespace) {
+ body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
+ }
+ /* Work on whole document or just its body */
+
+ if (NAMESPACE === HTML_NAMESPACE) {
+ return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
+ }
+
+ return WHOLE_DOCUMENT ? doc.documentElement : body;
+ };
+ /**
+ * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
+ *
+ * @param {Node} root The root element or node to start traversing on.
+ * @return {NodeIterator} The created NodeIterator
+ */
+
+ var _createNodeIterator = function _createNodeIterator(root) {
+ return createNodeIterator.call(root.ownerDocument || root, root, // eslint-disable-next-line no-bitwise
+ NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null);
+ };
+ /**
+ * _isClobbered
+ *
+ * @param {Node} elm element to check for clobbering attacks
+ * @return {Boolean} true if clobbered, false if safe
+ */
+
+ var _isClobbered = function _isClobbered(elm) {
+ return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function' || typeof elm.hasChildNodes !== 'function');
+ };
+ /**
+ * Checks whether the given object is a DOM node.
+ *
+ * @param {Node} object object to check whether it's a DOM node
+ * @return {Boolean} true is object is a DOM node
+ */
+
+ var _isNode = function _isNode(object) {
+ return typeof Node === 'function' && object instanceof Node;
+ };
+ /**
+ * _executeHook
+ * Execute user configurable hooks
+ *
+ * @param {String} entryPoint Name of the hook's entry point
+ * @param {Node} currentNode node to work on with the hook
+ * @param {Object} data additional hook parameters
+ */
+
+ var _executeHook = function _executeHook(entryPoint, currentNode, data) {
+ if (!hooks[entryPoint]) {
+ return;
+ }
+
+ arrayForEach(hooks[entryPoint], function (hook) {
+ hook.call(DOMPurify, currentNode, data, CONFIG);
+ });
+ };
+ /**
+ * _sanitizeElements
+ *
+ * @protect nodeName
+ * @protect textContent
+ * @protect removeChild
+ *
+ * @param {Node} currentNode to check for permission to exist
+ * @return {Boolean} true if node was killed, false if left alive
+ */
+
+ var _sanitizeElements = function _sanitizeElements(currentNode) {
+ var content = null;
+ /* Execute a hook if present */
+
+ _executeHook('beforeSanitizeElements', currentNode, null);
+ /* Check if element is clobbered or can clobber */
+
+ if (_isClobbered(currentNode)) {
+ _forceRemove(currentNode);
+
+ return true;
+ }
+ /* Now let's check the element's type and name */
+
+ var tagName = transformCaseFunc(currentNode.nodeName);
+ /* Execute a hook if present */
+
+ _executeHook('uponSanitizeElement', currentNode, {
+ tagName: tagName,
+ allowedTags: ALLOWED_TAGS
+ });
+ /* Detect mXSS attempts abusing namespace confusion */
+
+ if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
+ _forceRemove(currentNode);
+
+ return true;
+ }
+ /* Remove element if anything forbids its presence */
+
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
+ /* Check if we have a custom element to handle */
+ if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
+ return false;
+ }
+
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
+ return false;
+ }
+ }
+ /* Keep content except for bad-listed elements */
+
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
+ var parentNode = getParentNode(currentNode) || currentNode.parentNode;
+ var childNodes = getChildNodes(currentNode) || currentNode.childNodes;
+
+ if (childNodes && parentNode) {
+ var childCount = childNodes.length;
+
+ for (var i = childCount - 1; i >= 0; --i) {
+ parentNode.insertBefore(cloneNode(childNodes[i], true), getNextSibling(currentNode));
+ }
+ }
+ }
+
+ _forceRemove(currentNode);
+
+ return true;
+ }
+ /* Check whether element has a valid namespace */
+
+ if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
+ _forceRemove(currentNode);
+
+ return true;
+ }
+ /* Make sure that older browsers don't get fallback-tag mXSS */
+
+ if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
+ _forceRemove(currentNode);
+
+ return true;
+ }
+ /* Sanitize element content to be template-safe */
+
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {
+ /* Get the element's text content */
+ content = currentNode.textContent;
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], function (expr) {
+ content = stringReplace(content, expr, ' ');
+ });
+
+ if (currentNode.textContent !== content) {
+ arrayPush(DOMPurify.removed, {
+ element: currentNode.cloneNode()
+ });
+ currentNode.textContent = content;
+ }
+ }
+ /* Execute a hook if present */
+
+ _executeHook('afterSanitizeElements', currentNode, null);
+
+ return false;
+ };
+ /**
+ * _isValidAttribute
+ *
+ * @param {string} lcTag Lowercase tag name of containing element.
+ * @param {string} lcName Lowercase attribute name.
+ * @param {string} value Attribute value.
+ * @return {Boolean} Returns true if `value` is valid, otherwise false.
+ */
+ // eslint-disable-next-line complexity
+
+
+ var _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
+ /* Make sure attribute cannot clobber */
+ if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
+ return false;
+ }
+ /* Allow valid data-* attributes: At least one character after "-"
+ (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
+ XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
+ We don't need to check the value; it's always URI safe. */
+
+ if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ;else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ;else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
+ if ( // First condition does a very basic check if a) it's basically a valid custom element tagname AND
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
+ _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) || // Alternative, second condition checks if it's an `is`-attribute, AND
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
+ lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))) ;else {
+ return false;
+ }
+ /* Check value is safe. First, is attr inert? If so, is safe */
+ } else if (URI_SAFE_ATTRIBUTES[lcName]) ;else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, ''))) ;else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ;else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, ''))) ;else if (value) {
+ return false;
+ } else ;
+
+ return true;
+ };
+ /**
+ * _isBasicCustomElement
+ * checks if at least one dash is included in tagName, and it's not the first char
+ * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
+ *
+ * @param {string} tagName name of the tag of the node to sanitize
+ * @returns {boolean} Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
+ */
+
+ var _isBasicCustomElement = function _isBasicCustomElement(tagName) {
+ return tagName.indexOf('-') > 0;
+ };
+ /**
+ * _sanitizeAttributes
+ *
+ * @protect attributes
+ * @protect nodeName
+ * @protect removeAttribute
+ * @protect setAttribute
+ *
+ * @param {Node} currentNode to sanitize
+ */
+
+ var _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
+ /* Execute a hook if present */
+ _executeHook('beforeSanitizeAttributes', currentNode, null);
+
+ var attributes = currentNode.attributes;
+ /* Check if we have attributes; if not we might have a text node */
+
+ if (!attributes) {
+ return;
+ }
+
+ var hookEvent = {
+ attrName: '',
+ attrValue: '',
+ keepAttr: true,
+ allowedAttributes: ALLOWED_ATTR
+ };
+ var l = attributes.length;
+ /* Go backwards over all attributes; safely remove bad ones */
+
+ var _loop = function _loop() {
+ var attr = attributes[l];
+ var name = attr.name,
+ namespaceURI = attr.namespaceURI,
+ attrValue = attr.value;
+
+ var lcName = transformCaseFunc(name);
+ var value = name === 'value' ? attrValue : stringTrim(attrValue);
+ /* Execute a hook if present */
+
+ hookEvent.attrName = lcName;
+ hookEvent.attrValue = value;
+ hookEvent.keepAttr = true;
+ hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set
+
+ _executeHook('uponSanitizeAttribute', currentNode, hookEvent);
+
+ value = hookEvent.attrValue;
+ /* Did the hooks approve of the attribute? */
+
+ if (hookEvent.forceKeepAttr) {
+ return 'continue';
+ }
+ /* Remove attribute */
+
+ _removeAttribute(name, currentNode);
+ /* Did the hooks approve of the attribute? */
+
+ if (!hookEvent.keepAttr) {
+ return 'continue';
+ }
+ /* Work around a security issue in jQuery 3.0 */
+
+ if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
+ _removeAttribute(name, currentNode);
+
+ return 'continue';
+ }
+ /* Sanitize attribute content to be template-safe */
+
+ if (SAFE_FOR_TEMPLATES) {
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], function (expr) {
+ value = stringReplace(value, expr, ' ');
+ });
+ }
+ /* Is `value` valid for this attribute? */
+
+ var lcTag = transformCaseFunc(currentNode.nodeName);
+
+ if (!_isValidAttribute(lcTag, lcName, value)) {
+ return 'continue';
+ }
+ /* Full DOM Clobbering protection via namespace isolation,
+ * Prefix id and name attributes with `user-content-`
+ */
+
+ if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {
+ // Remove the attribute with this value
+ _removeAttribute(name, currentNode); // Prefix the value and later re-create the attribute with the sanitized value
+
+
+ value = SANITIZE_NAMED_PROPS_PREFIX + value;
+ }
+ /* Handle attributes that require Trusted Types */
+
+ if (trustedTypesPolicy && (typeof trustedTypes === 'undefined' ? 'undefined' : _typeof(trustedTypes)) === 'object' && typeof trustedTypes.getAttributeType === 'function') {
+ if (namespaceURI) ;else {
+ switch (trustedTypes.getAttributeType(lcTag, lcName)) {
+ case 'TrustedHTML':
+ {
+ value = trustedTypesPolicy.createHTML(value);
+ break;
+ }
+
+ case 'TrustedScriptURL':
+ {
+ value = trustedTypesPolicy.createScriptURL(value);
+ break;
+ }
+ }
+ }
+ }
+ /* Handle invalid data-* attribute set by try-catching it */
+
+ try {
+ if (namespaceURI) {
+ currentNode.setAttributeNS(namespaceURI, name, value);
+ } else {
+ /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
+ currentNode.setAttribute(name, value);
+ }
+
+ arrayPop(DOMPurify.removed);
+ } catch (_) {}
+ };
+
+ while (l--) {
+ var _ret = _loop();
+
+ if (_ret === 'continue') continue;
+ }
+ /* Execute a hook if present */
+
+ _executeHook('afterSanitizeAttributes', currentNode, null);
+ };
+ /**
+ * _sanitizeShadowDOM
+ *
+ * @param {DocumentFragment} fragment to iterate over recursively
+ */
+
+ var _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
+ var shadowNode = null;
+
+ var shadowIterator = _createNodeIterator(fragment);
+ /* Execute a hook if present */
+
+ _executeHook('beforeSanitizeShadowDOM', fragment, null);
+
+ while (shadowNode = shadowIterator.nextNode()) {
+ /* Execute a hook if present */
+ _executeHook('uponSanitizeShadowNode', shadowNode, null);
+ /* Sanitize tags and elements */
+
+ if (_sanitizeElements(shadowNode)) {
+ continue;
+ }
+ /* Deep shadow DOM detected */
+
+ if (shadowNode.content instanceof DocumentFragment) {
+ _sanitizeShadowDOM(shadowNode.content);
+ }
+ /* Check attributes, sanitize if necessary */
+
+ _sanitizeAttributes(shadowNode);
+ }
+ /* Execute a hook if present */
+
+ _executeHook('afterSanitizeShadowDOM', fragment, null);
+ };
+ /**
+ * Sanitize
+ * Public method providing core sanitation functionality
+ *
+ * @param {String|Node} dirty string or DOM node
+ * @param {Object} cfg object
+ */
+ // eslint-disable-next-line complexity
+
+
+ DOMPurify.sanitize = function (dirty) {
+ var cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+ var body = null;
+ var importedNode = null;
+ var currentNode = null;
+ var returnNode = null;
+ /* Make sure we have a string to sanitize.
+ DO NOT return early, as this will return the wrong type if
+ the user has requested a DOM object rather than a string */
+
+ IS_EMPTY_INPUT = !dirty;
+
+ if (IS_EMPTY_INPUT) {
+ dirty = '<!-->';
+ }
+ /* Stringify, in case dirty is an object */
+
+ if (typeof dirty !== 'string' && !_isNode(dirty)) {
+ if (typeof dirty.toString === 'function') {
+ dirty = dirty.toString();
+
+ if (typeof dirty !== 'string') {
+ throw typeErrorCreate('dirty is not a string, aborting');
+ }
+ } else {
+ throw typeErrorCreate('toString is not a function');
+ }
+ }
+ /* Return dirty HTML if DOMPurify cannot run */
+
+ if (!DOMPurify.isSupported) {
+ return dirty;
+ }
+ /* Assign config vars */
+
+ if (!SET_CONFIG) {
+ _parseConfig(cfg);
+ }
+ /* Clean up removed elements */
+
+ DOMPurify.removed = [];
+ /* Check if dirty is correctly typed for IN_PLACE */
+
+ if (typeof dirty === 'string') {
+ IN_PLACE = false;
+ }
+
+ if (IN_PLACE) {
+ /* Do some early pre-sanitization to avoid unsafe root nodes */
+ if (dirty.nodeName) {
+ var tagName = transformCaseFunc(dirty.nodeName);
+
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
+ throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
+ }
+ }
+ } else if (dirty instanceof Node) {
+ /* If dirty is a DOM element, append to an empty document to avoid
+ elements being stripped by the parser */
+ body = _initDocument('<!---->');
+ importedNode = body.ownerDocument.importNode(dirty, true);
+
+ if (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') {
+ /* Node is already a body, use as is */
+ body = importedNode;
+ } else if (importedNode.nodeName === 'HTML') {
+ body = importedNode;
+ } else {
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
+ body.appendChild(importedNode);
+ }
+ } else {
+ /* Exit directly if we have nothing to do */
+ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes
+ dirty.indexOf('<') === -1) {
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
+ }
+ /* Initialize the document to work on */
+
+ body = _initDocument(dirty);
+ /* Check we have a DOM node from the data */
+
+ if (!body) {
+ return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';
+ }
+ }
+ /* Remove first element node (ours) if FORCE_BODY is set */
+
+ if (body && FORCE_BODY) {
+ _forceRemove(body.firstChild);
+ }
+ /* Get node iterator */
+
+ var nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
+ /* Now start iterating over the created document */
+
+ while (currentNode = nodeIterator.nextNode()) {
+ /* Sanitize tags and elements */
+ if (_sanitizeElements(currentNode)) {
+ continue;
+ }
+ /* Shadow DOM detected, sanitize it */
+
+ if (currentNode.content instanceof DocumentFragment) {
+ _sanitizeShadowDOM(currentNode.content);
+ }
+ /* Check attributes, sanitize if necessary */
+
+ _sanitizeAttributes(currentNode);
+ }
+ /* If we sanitized `dirty` in-place, return it. */
+
+ if (IN_PLACE) {
+ return dirty;
+ }
+ /* Return sanitized string or DOM */
+
+ if (RETURN_DOM) {
+ if (RETURN_DOM_FRAGMENT) {
+ returnNode = createDocumentFragment.call(body.ownerDocument);
+
+ while (body.firstChild) {
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
+ returnNode.appendChild(body.firstChild);
+ }
+ } else {
+ returnNode = body;
+ }
+
+ if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
+ /*
+ AdoptNode() is not used because internal state is not reset
+ (e.g. the past names map of a HTMLFormElement), this is safe
+ in theory but we would rather not risk another attack vector.
+ The state that is cloned by importNode() is explicitly defined
+ by the specs.
+ */
+ returnNode = importNode.call(originalDocument, returnNode, true);
+ }
+
+ return returnNode;
+ }
+
+ var serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
+ /* Serialize doctype if allowed */
+
+ if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
+ serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\n' + serializedHTML;
+ }
+ /* Sanitize final string template-safe */
+
+ if (SAFE_FOR_TEMPLATES) {
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], function (expr) {
+ serializedHTML = stringReplace(serializedHTML, expr, ' ');
+ });
+ }
+
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
+ };
+ /**
+ * Public method to set the configuration once
+ * setConfig
+ *
+ * @param {Object} cfg configuration object
+ */
+
+ DOMPurify.setConfig = function () {
+ var cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+
+ _parseConfig(cfg);
+
+ SET_CONFIG = true;
+ };
+ /**
+ * Public method to remove the configuration
+ * clearConfig
+ *
+ */
+
+ DOMPurify.clearConfig = function () {
+ CONFIG = null;
+ SET_CONFIG = false;
+ };
+ /**
+ * Public method to check if an attribute value is valid.
+ * Uses last set config, if any. Otherwise, uses config defaults.
+ * isValidAttribute
+ *
+ * @param {String} tag Tag name of containing element.
+ * @param {String} attr Attribute name.
+ * @param {String} value Attribute value.
+ * @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.
+ */
+
+ DOMPurify.isValidAttribute = function (tag, attr, value) {
+ /* Initialize shared config vars if necessary. */
+ if (!CONFIG) {
+ _parseConfig({});
+ }
+
+ var lcTag = transformCaseFunc(tag);
+ var lcName = transformCaseFunc(attr);
+ return _isValidAttribute(lcTag, lcName, value);
+ };
+ /**
+ * AddHook
+ * Public method to add DOMPurify hooks
+ *
+ * @param {String} entryPoint entry point for the hook to add
+ * @param {Function} hookFunction function to execute
+ */
+
+ DOMPurify.addHook = function (entryPoint, hookFunction) {
+ if (typeof hookFunction !== 'function') {
+ return;
+ }
+
+ hooks[entryPoint] = hooks[entryPoint] || [];
+ arrayPush(hooks[entryPoint], hookFunction);
+ };
+ /**
+ * RemoveHook
+ * Public method to remove a DOMPurify hook at a given entryPoint
+ * (pops it from the stack of hooks if more are present)
+ *
+ * @param {String} entryPoint entry point for the hook to remove
+ * @return {Function} removed(popped) hook
+ */
+
+ DOMPurify.removeHook = function (entryPoint) {
+ if (hooks[entryPoint]) {
+ return arrayPop(hooks[entryPoint]);
+ }
+ };
+ /**
+ * RemoveHooks
+ * Public method to remove all DOMPurify hooks at a given entryPoint
+ *
+ * @param {String} entryPoint entry point for the hooks to remove
+ */
+
+ DOMPurify.removeHooks = function (entryPoint) {
+ if (hooks[entryPoint]) {
+ hooks[entryPoint] = [];
+ }
+ };
+ /**
+ * RemoveAllHooks
+ * Public method to remove all DOMPurify hooks
+ */
+
+ DOMPurify.removeAllHooks = function () {
+ hooks = {};
+ };
+
+ return DOMPurify;
+ }
+
+ var purify = createDOMPurify();
+
+ return purify;
+});
+//# sourceMappingURL=purify.js.map
\ No newline at end of file
diff --git a/src/tooltip.js b/src/tooltip.js
index 46e5a81..2c8811e 100644
--- a/src/tooltip.js
+++ b/src/tooltip.js
@@ -337,7 +337,8 @@
container.style.left = 0;
container.style.top = 0;
container.style.opacity = 0;
- container.innerHTML = content;
+ var safeContent = DOMPurify.sanitize(content, {RETURN_TRUSTED_TYPE: true});
+ container.innerHTML = safeContent;
body.appendChild(container);
//If the parent container is an overflow <div> with scrollbars, subtract the scroll offsets.