\n * @param {object} opts (see Plotly.toImage in ../plot_api/to_image)\n * @return {promise}\n */\nfunction downloadImage(gd, opts) {\n var _gd;\n if(!Lib.isPlainObject(gd)) _gd = Lib.getGraphDiv(gd);\n\n opts = opts || {};\n opts.format = opts.format || 'png';\n opts.width = opts.width || null;\n opts.height = opts.height || null;\n opts.imageDataOnly = true;\n\n return new Promise(function(resolve, reject) {\n if(_gd && _gd._snapshotInProgress) {\n reject(new Error('Snapshotting already in progress.'));\n }\n\n // see comments within svgtoimg for additional\n // discussion of problems with IE\n // can now draw to canvas, but CORS tainted canvas\n // does not allow toDataURL\n // svg format will work though\n if(Lib.isIE() && opts.format !== 'svg') {\n reject(new Error(helpers.MSG_IE_BAD_FORMAT));\n }\n\n if(_gd) _gd._snapshotInProgress = true;\n var promise = toImage(gd, opts);\n\n var filename = opts.filename || gd.fn || 'newplot';\n filename += '.' + opts.format.replace('-', '.');\n\n promise.then(function(result) {\n if(_gd) _gd._snapshotInProgress = false;\n return fileSaver(result, filename, opts.format);\n }).then(function(name) {\n resolve(name);\n }).catch(function(err) {\n if(_gd) _gd._snapshotInProgress = false;\n reject(err);\n });\n });\n}\n\nmodule.exports = downloadImage;\n\n},{\"../lib\":202,\"../plot_api/to_image\":240,\"./filesaver\":293,\"./helpers\":294}],293:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar Lib = _dereq_('../lib');\nvar helpers = _dereq_('./helpers');\n\n/*\n* substantial portions of this code from FileSaver.js\n* https://github.com/eligrey/FileSaver.js\n* License: https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md\n* FileSaver.js\n* A saveAs() FileSaver implementation.\n* 1.1.20160328\n*\n* By Eli Grey, http://eligrey.com\n* License: MIT\n* See https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md\n*/\nfunction fileSaver(url, name, format) {\n var saveLink = document.createElement('a');\n var canUseSaveLink = 'download' in saveLink;\n\n var promise = new Promise(function(resolve, reject) {\n var blob;\n var objectUrl;\n\n if(Lib.isIE9orBelow()) {\n reject(new Error('IE < 10 unsupported'));\n }\n\n // Safari doesn't allow downloading of blob urls\n if(Lib.isSafari()) {\n var prefix = format === 'svg' ? ',' : ';base64,';\n helpers.octetStream(prefix + encodeURIComponent(url));\n return resolve(name);\n }\n\n // IE 10+ (native saveAs)\n if(Lib.isIE()) {\n // At this point we are only dealing with a decoded SVG as\n // a data URL (since IE only supports SVG)\n blob = helpers.createBlob(url, 'svg');\n window.navigator.msSaveBlob(blob, name);\n blob = null;\n return resolve(name);\n }\n\n if(canUseSaveLink) {\n blob = helpers.createBlob(url, format);\n objectUrl = helpers.createObjectURL(blob);\n\n saveLink.href = objectUrl;\n saveLink.download = name;\n document.body.appendChild(saveLink);\n saveLink.click();\n\n document.body.removeChild(saveLink);\n helpers.revokeObjectURL(objectUrl);\n blob = null;\n\n return resolve(name);\n }\n\n reject(new Error('download error'));\n });\n\n return promise;\n}\n\n\nmodule.exports = fileSaver;\n\n},{\"../lib\":202,\"./helpers\":294}],294:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar Registry = _dereq_('../registry');\n\nexports.getDelay = function(fullLayout) {\n if(!fullLayout._has) return 0;\n\n return (\n fullLayout._has('gl3d') ||\n fullLayout._has('gl2d') ||\n fullLayout._has('mapbox')\n ) ? 500 : 0;\n};\n\nexports.getRedrawFunc = function(gd) {\n return function() {\n var fullLayout = gd._fullLayout || {};\n var hasPolar = fullLayout._has && fullLayout._has('polar');\n var hasLegacyPolar = !hasPolar && gd.data && gd.data[0] && gd.data[0].r;\n\n if(!hasLegacyPolar) {\n Registry.getComponentMethod('colorbar', 'draw')(gd);\n }\n };\n};\n\nexports.encodeSVG = function(svg) {\n return 'data:image/svg+xml,' + encodeURIComponent(svg);\n};\n\nexports.encodeJSON = function(json) {\n return 'data:application/json,' + encodeURIComponent(json);\n};\n\nvar DOM_URL = window.URL || window.webkitURL;\n\nexports.createObjectURL = function(blob) {\n return DOM_URL.createObjectURL(blob);\n};\n\nexports.revokeObjectURL = function(url) {\n return DOM_URL.revokeObjectURL(url);\n};\n\nexports.createBlob = function(url, format) {\n if(format === 'svg') {\n return new window.Blob([url], {type: 'image/svg+xml;charset=utf-8'});\n } else if(format === 'full-json') {\n return new window.Blob([url], {type: 'application/json;charset=utf-8'});\n } else {\n var binary = fixBinary(window.atob(url));\n return new window.Blob([binary], {type: 'image/' + format});\n }\n};\n\nexports.octetStream = function(s) {\n document.location.href = 'data:application/octet-stream' + s;\n};\n\n// Taken from https://bl.ocks.org/nolanlawson/0eac306e4dac2114c752\nfunction fixBinary(b) {\n var len = b.length;\n var buf = new ArrayBuffer(len);\n var arr = new Uint8Array(buf);\n for(var i = 0; i < len; i++) {\n arr[i] = b.charCodeAt(i);\n }\n return buf;\n}\n\nexports.IMAGE_URL_PREFIX = /^data:image\\/\\w+;base64,/;\n\nexports.MSG_IE_BAD_FORMAT = 'Sorry IE does not support downloading from canvas. Try {format:\\'svg\\'} instead.';\n\n},{\"../registry\":290}],295:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n\n'use strict';\n\nvar helpers = _dereq_('./helpers');\n\nvar Snapshot = {\n getDelay: helpers.getDelay,\n getRedrawFunc: helpers.getRedrawFunc,\n clone: _dereq_('./cloneplot'),\n toSVG: _dereq_('./tosvg'),\n svgToImg: _dereq_('./svgtoimg'),\n toImage: _dereq_('./toimage'),\n downloadImage: _dereq_('./download')\n};\n\nmodule.exports = Snapshot;\n\n},{\"./cloneplot\":291,\"./download\":292,\"./helpers\":294,\"./svgtoimg\":296,\"./toimage\":297,\"./tosvg\":298}],296:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar Lib = _dereq_('../lib');\nvar EventEmitter = _dereq_('events').EventEmitter;\n\nvar helpers = _dereq_('./helpers');\n\nfunction svgToImg(opts) {\n var ev = opts.emitter || new EventEmitter();\n\n var promise = new Promise(function(resolve, reject) {\n var Image = window.Image;\n var svg = opts.svg;\n var format = opts.format || 'png';\n\n // IE only support svg\n if(Lib.isIE() && format !== 'svg') {\n var ieSvgError = new Error(helpers.MSG_IE_BAD_FORMAT);\n reject(ieSvgError);\n // eventually remove the ev\n // in favor of promises\n if(!opts.promise) {\n return ev.emit('error', ieSvgError);\n } else {\n return promise;\n }\n }\n\n var canvas = opts.canvas;\n var scale = opts.scale || 1;\n var w0 = opts.width || 300;\n var h0 = opts.height || 150;\n var w1 = scale * w0;\n var h1 = scale * h0;\n\n var ctx = canvas.getContext('2d');\n var img = new Image();\n var svgBlob, url;\n\n if(format === 'svg' || Lib.isIE9orBelow() || Lib.isSafari()) {\n url = helpers.encodeSVG(svg);\n } else {\n svgBlob = helpers.createBlob(svg, 'svg');\n url = helpers.createObjectURL(svgBlob);\n }\n\n canvas.width = w1;\n canvas.height = h1;\n\n img.onload = function() {\n var imgData;\n\n svgBlob = null;\n helpers.revokeObjectURL(url);\n\n // don't need to draw to canvas if svg\n // save some time and also avoid failure on IE\n if(format !== 'svg') {\n ctx.drawImage(img, 0, 0, w1, h1);\n }\n\n switch(format) {\n case 'jpeg':\n imgData = canvas.toDataURL('image/jpeg');\n break;\n case 'png':\n imgData = canvas.toDataURL('image/png');\n break;\n case 'webp':\n imgData = canvas.toDataURL('image/webp');\n break;\n case 'svg':\n imgData = url;\n break;\n default:\n var errorMsg = 'Image format is not jpeg, png, svg or webp.';\n reject(new Error(errorMsg));\n // eventually remove the ev\n // in favor of promises\n if(!opts.promise) {\n return ev.emit('error', errorMsg);\n }\n }\n resolve(imgData);\n // eventually remove the ev\n // in favor of promises\n if(!opts.promise) {\n ev.emit('success', imgData);\n }\n };\n\n img.onerror = function(err) {\n svgBlob = null;\n helpers.revokeObjectURL(url);\n\n reject(err);\n // eventually remove the ev\n // in favor of promises\n if(!opts.promise) {\n return ev.emit('error', err);\n }\n };\n\n img.src = url;\n });\n\n // temporary for backward compatibility\n // move to only Promise in 2.0.0\n // and eliminate the EventEmitter\n if(opts.promise) {\n return promise;\n }\n\n return ev;\n}\n\nmodule.exports = svgToImg;\n\n},{\"../lib\":202,\"./helpers\":294,\"events\":6}],297:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar EventEmitter = _dereq_('events').EventEmitter;\n\nvar Registry = _dereq_('../registry');\nvar Lib = _dereq_('../lib');\n\nvar helpers = _dereq_('./helpers');\nvar clonePlot = _dereq_('./cloneplot');\nvar toSVG = _dereq_('./tosvg');\nvar svgToImg = _dereq_('./svgtoimg');\n\n/**\n * @param {object} gd figure Object\n * @param {object} opts option object\n * @param opts.format 'jpeg' | 'png' | 'webp' | 'svg'\n */\nfunction toImage(gd, opts) {\n // first clone the GD so we can operate in a clean environment\n var ev = new EventEmitter();\n\n var clone = clonePlot(gd, {format: 'png'});\n var clonedGd = clone.gd;\n\n // put the cloned div somewhere off screen before attaching to DOM\n clonedGd.style.position = 'absolute';\n clonedGd.style.left = '-5000px';\n document.body.appendChild(clonedGd);\n\n function wait() {\n var delay = helpers.getDelay(clonedGd._fullLayout);\n\n setTimeout(function() {\n var svg = toSVG(clonedGd);\n\n var canvas = document.createElement('canvas');\n canvas.id = Lib.randstr();\n\n ev = svgToImg({\n format: opts.format,\n width: clonedGd._fullLayout.width,\n height: clonedGd._fullLayout.height,\n canvas: canvas,\n emitter: ev,\n svg: svg\n });\n\n ev.clean = function() {\n if(clonedGd) document.body.removeChild(clonedGd);\n };\n }, delay);\n }\n\n var redrawFunc = helpers.getRedrawFunc(clonedGd);\n\n Registry.call('plot', clonedGd, clone.data, clone.layout, clone.config)\n .then(redrawFunc)\n .then(wait)\n .catch(function(err) {\n ev.emit('error', err);\n });\n\n\n return ev;\n}\n\nmodule.exports = toImage;\n\n},{\"../lib\":202,\"../registry\":290,\"./cloneplot\":291,\"./helpers\":294,\"./svgtoimg\":296,\"./tosvg\":298,\"events\":6}],298:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n\n'use strict';\n\nvar d3 = _dereq_('d3');\n\nvar Lib = _dereq_('../lib');\nvar Drawing = _dereq_('../components/drawing');\nvar Color = _dereq_('../components/color');\n\nvar xmlnsNamespaces = _dereq_('../constants/xmlns_namespaces');\nvar DOUBLEQUOTE_REGEX = /\"/g;\nvar DUMMY_SUB = 'TOBESTRIPPED';\nvar DUMMY_REGEX = new RegExp('(\"' + DUMMY_SUB + ')|(' + DUMMY_SUB + '\")', 'g');\n\nfunction htmlEntityDecode(s) {\n var hiddenDiv = d3.select('body').append('div').style({display: 'none'}).html('');\n var replaced = s.replace(/(&[^;]*;)/gi, function(d) {\n if(d === '<') { return '<'; } // special handling for brackets\n if(d === '&rt;') { return '>'; }\n if(d.indexOf('<') !== -1 || d.indexOf('>') !== -1) { return ''; }\n return hiddenDiv.html(d).text(); // everything else, let the browser decode it to unicode\n });\n hiddenDiv.remove();\n return replaced;\n}\n\nfunction xmlEntityEncode(str) {\n return str.replace(/&(?!\\w+;|\\#[0-9]+;| \\#x[0-9A-F]+;)/g, '&');\n}\n\nmodule.exports = function toSVG(gd, format, scale) {\n var fullLayout = gd._fullLayout;\n var svg = fullLayout._paper;\n var toppaper = fullLayout._toppaper;\n var width = fullLayout.width;\n var height = fullLayout.height;\n var i;\n\n // make background color a rect in the svg, then revert after scraping\n // all other alterations have been dealt with by properly preparing the svg\n // in the first place... like setting cursors with css classes so we don't\n // have to remove them, and providing the right namespaces in the svg to\n // begin with\n svg.insert('rect', ':first-child')\n .call(Drawing.setRect, 0, 0, width, height)\n .call(Color.fill, fullLayout.paper_bgcolor);\n\n // subplot-specific to-SVG methods\n // which notably add the contents of the gl-container\n // into the main svg node\n var basePlotModules = fullLayout._basePlotModules || [];\n for(i = 0; i < basePlotModules.length; i++) {\n var _module = basePlotModules[i];\n\n if(_module.toSVG) _module.toSVG(gd);\n }\n\n // add top items above them assumes everything in toppaper is either\n // a group or a defs, and if it's empty (like hoverlayer) we can ignore it.\n if(toppaper) {\n var nodes = toppaper.node().childNodes;\n\n // make copy of nodes as childNodes prop gets mutated in loop below\n var topGroups = Array.prototype.slice.call(nodes);\n\n for(i = 0; i < topGroups.length; i++) {\n var topGroup = topGroups[i];\n\n if(topGroup.childNodes.length) svg.node().appendChild(topGroup);\n }\n }\n\n // remove draglayer for Adobe Illustrator compatibility\n if(fullLayout._draggers) {\n fullLayout._draggers.remove();\n }\n\n // in case the svg element had an explicit background color, remove this\n // we want the rect to get the color so it's the right size; svg bg will\n // fill whatever container it's displayed in regardless of plot size.\n svg.node().style.background = '';\n\n svg.selectAll('text')\n .attr({'data-unformatted': null, 'data-math': null})\n .each(function() {\n var txt = d3.select(this);\n\n // hidden text is pre-formatting mathjax, the browser ignores it\n // but in a static plot it's useless and it can confuse batik\n // we've tried to standardize on display:none but make sure we still\n // catch visibility:hidden if it ever arises\n if(this.style.visibility === 'hidden' || this.style.display === 'none') {\n txt.remove();\n return;\n } else {\n // clear other visibility/display values to default\n // to not potentially confuse non-browser SVG implementations\n txt.style({visibility: null, display: null});\n }\n\n // Font family styles break things because of quotation marks,\n // so we must remove them *after* the SVG DOM has been serialized\n // to a string (browsers convert singles back)\n var ff = this.style.fontFamily;\n if(ff && ff.indexOf('\"') !== -1) {\n txt.style('font-family', ff.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB));\n }\n });\n\n\n if(fullLayout._gradientUrlQueryParts) {\n var queryParts = [];\n for(var k in fullLayout._gradientUrlQueryParts) queryParts.push(k);\n\n if(queryParts.length) {\n svg.selectAll(queryParts.join(',')).each(function() {\n var pt = d3.select(this);\n\n // similar to font family styles above,\n // we must remove \" after the SVG DOM has been serialized\n var fill = this.style.fill;\n if(fill && fill.indexOf('url(') !== -1) {\n pt.style('fill', fill.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB));\n }\n\n var stroke = this.style.stroke;\n if(stroke && stroke.indexOf('url(') !== -1) {\n pt.style('stroke', stroke.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB));\n }\n });\n }\n }\n\n if(format === 'pdf' || format === 'eps') {\n // these formats make the extra line MathJax adds around symbols look super thick in some cases\n // it looks better if this is removed entirely.\n svg.selectAll('#MathJax_SVG_glyphs path')\n .attr('stroke-width', 0);\n }\n\n // fix for IE namespacing quirk?\n // http://stackoverflow.com/questions/19610089/unwanted-namespaces-on-svg-markup-when-using-xmlserializer-in-javascript-with-ie\n svg.node().setAttributeNS(xmlnsNamespaces.xmlns, 'xmlns', xmlnsNamespaces.svg);\n svg.node().setAttributeNS(xmlnsNamespaces.xmlns, 'xmlns:xlink', xmlnsNamespaces.xlink);\n\n if(format === 'svg' && scale) {\n svg.attr('width', scale * width);\n svg.attr('height', scale * height);\n svg.attr('viewBox', '0 0 ' + width + ' ' + height);\n }\n\n var s = new window.XMLSerializer().serializeToString(svg.node());\n s = htmlEntityDecode(s);\n s = xmlEntityEncode(s);\n\n // Fix quotations around font strings and gradient URLs\n s = s.replace(DUMMY_REGEX, '\\'');\n\n // IE is very strict, so we will need to clean\n // svg with the following regex\n // yes this is messy, but do not know a better way\n // Even with this IE will not work due to tainted canvas\n // see https://github.com/kangax/fabric.js/issues/1957\n // http://stackoverflow.com/questions/18112047/canvas-todataurl-working-in-all-browsers-except-ie10\n // Leave here just in case the CORS/tainted IE issue gets resolved\n if(Lib.isIE()) {\n // replace double quote with single quote\n s = s.replace(/\"/gi, '\\'');\n // url in svg are single quoted\n // since we changed double to single\n // we'll need to change these to double-quoted\n s = s.replace(/(\\('#)([^']*)('\\))/gi, '(\\\"#$2\\\")');\n // font names with spaces will be escaped single-quoted\n // we'll need to change these to double-quoted\n s = s.replace(/(\\\\')/gi, '\\\"');\n }\n\n return s;\n};\n\n},{\"../components/color\":75,\"../components/drawing\":97,\"../constants/xmlns_namespaces\":182,\"../lib\":202,\"d3\":9}],299:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar Lib = _dereq_('../../lib');\n\n// arrayOk attributes, merge them into calcdata array\nmodule.exports = function arraysToCalcdata(cd, trace) {\n for(var i = 0; i < cd.length; i++) cd[i].i = i;\n\n Lib.mergeArray(trace.text, cd, 'tx');\n Lib.mergeArray(trace.hovertext, cd, 'htx');\n\n var marker = trace.marker;\n if(marker) {\n Lib.mergeArray(marker.opacity, cd, 'mo', true);\n Lib.mergeArray(marker.color, cd, 'mc');\n\n var markerLine = marker.line;\n if(markerLine) {\n Lib.mergeArray(markerLine.color, cd, 'mlc');\n Lib.mergeArrayCastPositive(markerLine.width, cd, 'mlw');\n }\n }\n};\n\n},{\"../../lib\":202}],300:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar scatterAttrs = _dereq_('../scatter/attributes');\nvar hovertemplateAttrs = _dereq_('../../plots/template_attributes').hovertemplateAttrs;\nvar texttemplateAttrs = _dereq_('../../plots/template_attributes').texttemplateAttrs;\nvar colorScaleAttrs = _dereq_('../../components/colorscale/attributes');\nvar fontAttrs = _dereq_('../../plots/font_attributes');\nvar constants = _dereq_('./constants');\n\nvar extendFlat = _dereq_('../../lib/extend').extendFlat;\n\nvar textFontAttrs = fontAttrs({\n editType: 'calc',\n arrayOk: true,\n colorEditType: 'style',\n \n});\n\nvar scatterMarkerAttrs = scatterAttrs.marker;\nvar scatterMarkerLineAttrs = scatterMarkerAttrs.line;\n\nvar markerLineWidth = extendFlat({},\n scatterMarkerLineAttrs.width, { dflt: 0 });\n\nvar markerLine = extendFlat({\n width: markerLineWidth,\n editType: 'calc'\n}, colorScaleAttrs('marker.line'));\n\nvar marker = extendFlat({\n line: markerLine,\n editType: 'calc'\n}, colorScaleAttrs('marker'), {\n opacity: {\n valType: 'number',\n arrayOk: true,\n dflt: 1,\n min: 0,\n max: 1,\n \n editType: 'style',\n \n }\n});\n\nmodule.exports = {\n x: scatterAttrs.x,\n x0: scatterAttrs.x0,\n dx: scatterAttrs.dx,\n y: scatterAttrs.y,\n y0: scatterAttrs.y0,\n dy: scatterAttrs.dy,\n\n xperiod: scatterAttrs.xperiod,\n yperiod: scatterAttrs.yperiod,\n xperiod0: scatterAttrs.xperiod0,\n yperiod0: scatterAttrs.yperiod0,\n xperiodalignment: scatterAttrs.xperiodalignment,\n yperiodalignment: scatterAttrs.yperiodalignment,\n\n text: scatterAttrs.text,\n texttemplate: texttemplateAttrs({editType: 'plot'}, {\n keys: constants.eventDataKeys\n }),\n hovertext: scatterAttrs.hovertext,\n hovertemplate: hovertemplateAttrs({}, {\n keys: constants.eventDataKeys\n }),\n\n textposition: {\n valType: 'enumerated',\n \n values: ['inside', 'outside', 'auto', 'none'],\n dflt: 'none',\n arrayOk: true,\n editType: 'calc',\n \n },\n\n insidetextanchor: {\n valType: 'enumerated',\n values: ['end', 'middle', 'start'],\n dflt: 'end',\n \n editType: 'plot',\n \n },\n\n textangle: {\n valType: 'angle',\n dflt: 'auto',\n \n editType: 'plot',\n \n },\n\n textfont: extendFlat({}, textFontAttrs, {\n \n }),\n\n insidetextfont: extendFlat({}, textFontAttrs, {\n \n }),\n\n outsidetextfont: extendFlat({}, textFontAttrs, {\n \n }),\n\n constraintext: {\n valType: 'enumerated',\n values: ['inside', 'outside', 'both', 'none'],\n \n dflt: 'both',\n editType: 'calc',\n \n },\n\n cliponaxis: extendFlat({}, scatterAttrs.cliponaxis, {\n \n }),\n\n orientation: {\n valType: 'enumerated',\n \n values: ['v', 'h'],\n editType: 'calc+clearAxisTypes',\n \n },\n\n base: {\n valType: 'any',\n dflt: null,\n arrayOk: true,\n \n editType: 'calc',\n \n },\n\n offset: {\n valType: 'number',\n dflt: null,\n arrayOk: true,\n \n editType: 'calc',\n \n },\n\n width: {\n valType: 'number',\n dflt: null,\n min: 0,\n arrayOk: true,\n \n editType: 'calc',\n \n },\n\n marker: marker,\n\n offsetgroup: {\n valType: 'string',\n \n dflt: '',\n editType: 'calc',\n \n },\n alignmentgroup: {\n valType: 'string',\n \n dflt: '',\n editType: 'calc',\n \n },\n\n selected: {\n marker: {\n opacity: scatterAttrs.selected.marker.opacity,\n color: scatterAttrs.selected.marker.color,\n editType: 'style'\n },\n textfont: scatterAttrs.selected.textfont,\n editType: 'style'\n },\n unselected: {\n marker: {\n opacity: scatterAttrs.unselected.marker.opacity,\n color: scatterAttrs.unselected.marker.color,\n editType: 'style'\n },\n textfont: scatterAttrs.unselected.textfont,\n editType: 'style'\n },\n\n r: scatterAttrs.r,\n t: scatterAttrs.t,\n\n _deprecated: {\n bardir: {\n valType: 'enumerated',\n \n editType: 'calc',\n values: ['v', 'h'],\n \n }\n }\n};\n\n},{\"../../components/colorscale/attributes\":82,\"../../lib/extend\":196,\"../../plots/font_attributes\":276,\"../../plots/template_attributes\":289,\"../scatter/attributes\":330,\"./constants\":302}],301:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar Axes = _dereq_('../../plots/cartesian/axes');\nvar alignPeriod = _dereq_('../../plots/cartesian/align_period');\nvar hasColorscale = _dereq_('../../components/colorscale/helpers').hasColorscale;\nvar colorscaleCalc = _dereq_('../../components/colorscale/calc');\nvar arraysToCalcdata = _dereq_('./arrays_to_calcdata');\nvar calcSelection = _dereq_('../scatter/calc_selection');\n\nmodule.exports = function calc(gd, trace) {\n var xa = Axes.getFromId(gd, trace.xaxis || 'x');\n var ya = Axes.getFromId(gd, trace.yaxis || 'y');\n var size, pos, origPos;\n\n var sizeOpts = {\n msUTC: !!(trace.base || trace.base === 0)\n };\n\n var hasPeriod;\n if(trace.orientation === 'h') {\n size = xa.makeCalcdata(trace, 'x', sizeOpts);\n origPos = ya.makeCalcdata(trace, 'y');\n pos = alignPeriod(trace, ya, 'y', origPos);\n hasPeriod = !!trace.yperiodalignment;\n } else {\n size = ya.makeCalcdata(trace, 'y', sizeOpts);\n origPos = xa.makeCalcdata(trace, 'x');\n pos = alignPeriod(trace, xa, 'x', origPos);\n hasPeriod = !!trace.xperiodalignment;\n }\n\n // create the \"calculated data\" to plot\n var serieslen = Math.min(pos.length, size.length);\n var cd = new Array(serieslen);\n\n // set position and size\n for(var i = 0; i < serieslen; i++) {\n cd[i] = { p: pos[i], s: size[i] };\n\n if(hasPeriod) {\n cd[i].orig_p = origPos[i]; // used by hover\n }\n\n if(trace.ids) {\n cd[i].id = String(trace.ids[i]);\n }\n }\n\n // auto-z and autocolorscale if applicable\n if(hasColorscale(trace, 'marker')) {\n colorscaleCalc(gd, trace, {\n vals: trace.marker.color,\n containerStr: 'marker',\n cLetter: 'c'\n });\n }\n if(hasColorscale(trace, 'marker.line')) {\n colorscaleCalc(gd, trace, {\n vals: trace.marker.line.color,\n containerStr: 'marker.line',\n cLetter: 'c'\n });\n }\n\n arraysToCalcdata(cd, trace);\n calcSelection(cd, trace);\n\n return cd;\n};\n\n},{\"../../components/colorscale/calc\":83,\"../../components/colorscale/helpers\":86,\"../../plots/cartesian/align_period\":245,\"../../plots/cartesian/axes\":248,\"../scatter/calc_selection\":332,\"./arrays_to_calcdata\":299}],302:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n\n'use strict';\n\nmodule.exports = {\n // padding in pixels around text\n TEXTPAD: 3,\n // 'value' and 'label' are not really necessary for bar traces,\n // but they were made available to `texttemplate` (maybe by accident)\n // via tokens `%{value}` and `%{label}` starting in 1.50.0,\n // so let's include them in the event data also.\n eventDataKeys: ['value', 'label']\n};\n\n},{}],303:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar isNumeric = _dereq_('fast-isnumeric');\nvar isArrayOrTypedArray = _dereq_('../../lib').isArrayOrTypedArray;\nvar BADNUM = _dereq_('../../constants/numerical').BADNUM;\n\nvar Registry = _dereq_('../../registry');\nvar Axes = _dereq_('../../plots/cartesian/axes');\nvar getAxisGroup = _dereq_('../../plots/cartesian/constraints').getAxisGroup;\nvar Sieve = _dereq_('./sieve.js');\n\n/*\n * Bar chart stacking/grouping positioning and autoscaling calculations\n * for each direction separately calculate the ranges and positions\n * note that this handles histograms too\n * now doing this one subplot at a time\n */\n\nfunction crossTraceCalc(gd, plotinfo) {\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n\n var fullLayout = gd._fullLayout;\n var fullTraces = gd._fullData;\n var calcTraces = gd.calcdata;\n var calcTracesHorz = [];\n var calcTracesVert = [];\n\n for(var i = 0; i < fullTraces.length; i++) {\n var fullTrace = fullTraces[i];\n if(\n fullTrace.visible === true &&\n Registry.traceIs(fullTrace, 'bar') &&\n fullTrace.xaxis === xa._id &&\n fullTrace.yaxis === ya._id\n ) {\n if(fullTrace.orientation === 'h') {\n calcTracesHorz.push(calcTraces[i]);\n } else {\n calcTracesVert.push(calcTraces[i]);\n }\n\n if(fullTrace._computePh) {\n var cd = gd.calcdata[i];\n for(var j = 0; j < cd.length; j++) {\n if(typeof cd[j].ph0 === 'function') cd[j].ph0 = cd[j].ph0();\n if(typeof cd[j].ph1 === 'function') cd[j].ph1 = cd[j].ph1();\n }\n }\n }\n }\n\n var opts = {\n xCat: xa.type === 'category' || xa.type === 'multicategory',\n yCat: ya.type === 'category' || ya.type === 'multicategory',\n\n mode: fullLayout.barmode,\n norm: fullLayout.barnorm,\n gap: fullLayout.bargap,\n groupgap: fullLayout.bargroupgap\n };\n\n setGroupPositions(gd, xa, ya, calcTracesVert, opts);\n setGroupPositions(gd, ya, xa, calcTracesHorz, opts);\n}\n\nfunction setGroupPositions(gd, pa, sa, calcTraces, opts) {\n if(!calcTraces.length) return;\n\n var excluded;\n var included;\n var i, calcTrace, fullTrace;\n\n initBase(sa, calcTraces);\n\n switch(opts.mode) {\n case 'overlay':\n setGroupPositionsInOverlayMode(pa, sa, calcTraces, opts);\n break;\n\n case 'group':\n // exclude from the group those traces for which the user set an offset\n excluded = [];\n included = [];\n for(i = 0; i < calcTraces.length; i++) {\n calcTrace = calcTraces[i];\n fullTrace = calcTrace[0].trace;\n\n if(fullTrace.offset === undefined) included.push(calcTrace);\n else excluded.push(calcTrace);\n }\n\n if(included.length) {\n setGroupPositionsInGroupMode(gd, pa, sa, included, opts);\n }\n if(excluded.length) {\n setGroupPositionsInOverlayMode(pa, sa, excluded, opts);\n }\n break;\n\n case 'stack':\n case 'relative':\n // exclude from the stack those traces for which the user set a base\n excluded = [];\n included = [];\n for(i = 0; i < calcTraces.length; i++) {\n calcTrace = calcTraces[i];\n fullTrace = calcTrace[0].trace;\n\n if(fullTrace.base === undefined) included.push(calcTrace);\n else excluded.push(calcTrace);\n }\n\n if(included.length) {\n setGroupPositionsInStackOrRelativeMode(gd, pa, sa, included, opts);\n }\n if(excluded.length) {\n setGroupPositionsInOverlayMode(pa, sa, excluded, opts);\n }\n break;\n }\n\n collectExtents(calcTraces, pa);\n}\n\nfunction initBase(sa, calcTraces) {\n var i, j;\n\n for(i = 0; i < calcTraces.length; i++) {\n var cd = calcTraces[i];\n var trace = cd[0].trace;\n var base = (trace.type === 'funnel') ? trace._base : trace.base;\n var b;\n\n // not sure if it really makes sense to have dates for bar size data...\n // ideally if we want to make gantt charts or something we'd treat\n // the actual size (trace.x or y) as time delta but base as absolute\n // time. But included here for completeness.\n var scalendar = trace.orientation === 'h' ? trace.xcalendar : trace.ycalendar;\n\n // 'base' on categorical axes makes no sense\n var d2c = sa.type === 'category' || sa.type === 'multicategory' ?\n function() { return null; } :\n sa.d2c;\n\n if(isArrayOrTypedArray(base)) {\n for(j = 0; j < Math.min(base.length, cd.length); j++) {\n b = d2c(base[j], 0, scalendar);\n if(isNumeric(b)) {\n cd[j].b = +b;\n cd[j].hasB = 1;\n } else cd[j].b = 0;\n }\n for(; j < cd.length; j++) {\n cd[j].b = 0;\n }\n } else {\n b = d2c(base, 0, scalendar);\n var hasBase = isNumeric(b);\n b = hasBase ? b : 0;\n for(j = 0; j < cd.length; j++) {\n cd[j].b = b;\n if(hasBase) cd[j].hasB = 1;\n }\n }\n }\n}\n\nfunction setGroupPositionsInOverlayMode(pa, sa, calcTraces, opts) {\n // update position axis and set bar offsets and widths\n for(var i = 0; i < calcTraces.length; i++) {\n var calcTrace = calcTraces[i];\n\n var sieve = new Sieve([calcTrace], {\n unitMinDiff: opts.xCat || opts.yCat,\n sepNegVal: false,\n overlapNoMerge: !opts.norm\n });\n\n // set bar offsets and widths, and update position axis\n setOffsetAndWidth(pa, sieve, opts);\n\n // set bar bases and sizes, and update size axis\n //\n // (note that `setGroupPositionsInOverlayMode` handles the case barnorm\n // is defined, because this function is also invoked for traces that\n // can't be grouped or stacked)\n if(opts.norm) {\n sieveBars(sieve);\n normalizeBars(sa, sieve, opts);\n } else {\n setBaseAndTop(sa, sieve);\n }\n }\n}\n\nfunction setGroupPositionsInGroupMode(gd, pa, sa, calcTraces, opts) {\n var sieve = new Sieve(calcTraces, {\n sepNegVal: false,\n overlapNoMerge: !opts.norm\n });\n\n // set bar offsets and widths, and update position axis\n setOffsetAndWidthInGroupMode(gd, pa, sieve, opts);\n\n // relative-stack bars within the same trace that would otherwise\n // be hidden\n unhideBarsWithinTrace(sieve);\n\n // set bar bases and sizes, and update size axis\n if(opts.norm) {\n sieveBars(sieve);\n normalizeBars(sa, sieve, opts);\n } else {\n setBaseAndTop(sa, sieve);\n }\n}\n\nfunction setGroupPositionsInStackOrRelativeMode(gd, pa, sa, calcTraces, opts) {\n var sieve = new Sieve(calcTraces, {\n sepNegVal: opts.mode === 'relative',\n overlapNoMerge: !(opts.norm || opts.mode === 'stack' || opts.mode === 'relative')\n });\n\n // set bar offsets and widths, and update position axis\n setOffsetAndWidth(pa, sieve, opts);\n\n // set bar bases and sizes, and update size axis\n stackBars(sa, sieve, opts);\n\n // flag the outmost bar (for text display purposes)\n for(var i = 0; i < calcTraces.length; i++) {\n var calcTrace = calcTraces[i];\n\n for(var j = 0; j < calcTrace.length; j++) {\n var bar = calcTrace[j];\n\n if(bar.s !== BADNUM) {\n var isOutmostBar = ((bar.b + bar.s) === sieve.get(bar.p, bar.s));\n if(isOutmostBar) bar._outmost = true;\n }\n }\n }\n\n // Note that marking the outmost bars has to be done\n // before `normalizeBars` changes `bar.b` and `bar.s`.\n if(opts.norm) normalizeBars(sa, sieve, opts);\n}\n\nfunction setOffsetAndWidth(pa, sieve, opts) {\n var minDiff = sieve.minDiff;\n var calcTraces = sieve.traces;\n\n // set bar offsets and widths\n var barGroupWidth = minDiff * (1 - opts.gap);\n var barWidthPlusGap = barGroupWidth;\n var barWidth = barWidthPlusGap * (1 - (opts.groupgap || 0));\n\n // computer bar group center and bar offset\n var offsetFromCenter = -barWidth / 2;\n\n for(var i = 0; i < calcTraces.length; i++) {\n var calcTrace = calcTraces[i];\n var t = calcTrace[0].t;\n\n // store bar width and offset for this trace\n t.barwidth = barWidth;\n t.poffset = offsetFromCenter;\n t.bargroupwidth = barGroupWidth;\n t.bardelta = minDiff;\n }\n\n // stack bars that only differ by rounding\n sieve.binWidth = calcTraces[0][0].t.barwidth / 100;\n\n // if defined, apply trace offset and width\n applyAttributes(sieve);\n\n // store the bar center in each calcdata item\n setBarCenterAndWidth(pa, sieve);\n\n // update position axes\n updatePositionAxis(pa, sieve);\n}\n\nfunction setOffsetAndWidthInGroupMode(gd, pa, sieve, opts) {\n var fullLayout = gd._fullLayout;\n var positions = sieve.positions;\n var distinctPositions = sieve.distinctPositions;\n var minDiff = sieve.minDiff;\n var calcTraces = sieve.traces;\n var nTraces = calcTraces.length;\n\n // if there aren't any overlapping positions,\n // let them have full width even if mode is group\n var overlap = (positions.length !== distinctPositions.length);\n var barGroupWidth = minDiff * (1 - opts.gap);\n\n var groupId = getAxisGroup(fullLayout, pa._id) + calcTraces[0][0].trace.orientation;\n var alignmentGroups = fullLayout._alignmentOpts[groupId] || {};\n\n for(var i = 0; i < nTraces; i++) {\n var calcTrace = calcTraces[i];\n var trace = calcTrace[0].trace;\n\n var alignmentGroupOpts = alignmentGroups[trace.alignmentgroup] || {};\n var nOffsetGroups = Object.keys(alignmentGroupOpts.offsetGroups || {}).length;\n\n var barWidthPlusGap;\n if(nOffsetGroups) {\n barWidthPlusGap = barGroupWidth / nOffsetGroups;\n } else {\n barWidthPlusGap = overlap ? barGroupWidth / nTraces : barGroupWidth;\n }\n\n var barWidth = barWidthPlusGap * (1 - (opts.groupgap || 0));\n\n var offsetFromCenter;\n if(nOffsetGroups) {\n offsetFromCenter = ((2 * trace._offsetIndex + 1 - nOffsetGroups) * barWidthPlusGap - barWidth) / 2;\n } else {\n offsetFromCenter = overlap ?\n ((2 * i + 1 - nTraces) * barWidthPlusGap - barWidth) / 2 :\n -barWidth / 2;\n }\n\n var t = calcTrace[0].t;\n t.barwidth = barWidth;\n t.poffset = offsetFromCenter;\n t.bargroupwidth = barGroupWidth;\n t.bardelta = minDiff;\n }\n\n // stack bars that only differ by rounding\n sieve.binWidth = calcTraces[0][0].t.barwidth / 100;\n\n // if defined, apply trace width\n applyAttributes(sieve);\n\n // store the bar center in each calcdata item\n setBarCenterAndWidth(pa, sieve);\n\n // update position axes\n updatePositionAxis(pa, sieve, overlap);\n}\n\nfunction applyAttributes(sieve) {\n var calcTraces = sieve.traces;\n var i, j;\n\n for(i = 0; i < calcTraces.length; i++) {\n var calcTrace = calcTraces[i];\n var calcTrace0 = calcTrace[0];\n var fullTrace = calcTrace0.trace;\n var t = calcTrace0.t;\n var offset = fullTrace._offset || fullTrace.offset;\n var initialPoffset = t.poffset;\n var newPoffset;\n\n if(isArrayOrTypedArray(offset)) {\n // if offset is an array, then clone it into t.poffset.\n newPoffset = Array.prototype.slice.call(offset, 0, calcTrace.length);\n\n // guard against non-numeric items\n for(j = 0; j < newPoffset.length; j++) {\n if(!isNumeric(newPoffset[j])) {\n newPoffset[j] = initialPoffset;\n }\n }\n\n // if the length of the array is too short,\n // then extend it with the initial value of t.poffset\n for(j = newPoffset.length; j < calcTrace.length; j++) {\n newPoffset.push(initialPoffset);\n }\n\n t.poffset = newPoffset;\n } else if(offset !== undefined) {\n t.poffset = offset;\n }\n\n var width = fullTrace._width || fullTrace.width;\n var initialBarwidth = t.barwidth;\n\n if(isArrayOrTypedArray(width)) {\n // if width is an array, then clone it into t.barwidth.\n var newBarwidth = Array.prototype.slice.call(width, 0, calcTrace.length);\n\n // guard against non-numeric items\n for(j = 0; j < newBarwidth.length; j++) {\n if(!isNumeric(newBarwidth[j])) newBarwidth[j] = initialBarwidth;\n }\n\n // if the length of the array is too short,\n // then extend it with the initial value of t.barwidth\n for(j = newBarwidth.length; j < calcTrace.length; j++) {\n newBarwidth.push(initialBarwidth);\n }\n\n t.barwidth = newBarwidth;\n\n // if user didn't set offset,\n // then correct t.poffset to ensure bars remain centered\n if(offset === undefined) {\n newPoffset = [];\n for(j = 0; j < calcTrace.length; j++) {\n newPoffset.push(\n initialPoffset + (initialBarwidth - newBarwidth[j]) / 2\n );\n }\n t.poffset = newPoffset;\n }\n } else if(width !== undefined) {\n t.barwidth = width;\n\n // if user didn't set offset,\n // then correct t.poffset to ensure bars remain centered\n if(offset === undefined) {\n t.poffset = initialPoffset + (initialBarwidth - width) / 2;\n }\n }\n }\n}\n\nfunction setBarCenterAndWidth(pa, sieve) {\n var calcTraces = sieve.traces;\n var pLetter = getAxisLetter(pa);\n\n for(var i = 0; i < calcTraces.length; i++) {\n var calcTrace = calcTraces[i];\n var t = calcTrace[0].t;\n var poffset = t.poffset;\n var poffsetIsArray = Array.isArray(poffset);\n var barwidth = t.barwidth;\n var barwidthIsArray = Array.isArray(barwidth);\n\n for(var j = 0; j < calcTrace.length; j++) {\n var calcBar = calcTrace[j];\n\n // store the actual bar width and position, for use by hover\n var width = calcBar.w = barwidthIsArray ? barwidth[j] : barwidth;\n calcBar[pLetter] = calcBar.p + (poffsetIsArray ? poffset[j] : poffset) + width / 2;\n }\n }\n}\n\nfunction updatePositionAxis(pa, sieve, allowMinDtick) {\n var calcTraces = sieve.traces;\n var minDiff = sieve.minDiff;\n var vpad = minDiff / 2;\n\n Axes.minDtick(pa, sieve.minDiff, sieve.distinctPositions[0], allowMinDtick);\n\n for(var i = 0; i < calcTraces.length; i++) {\n var calcTrace = calcTraces[i];\n var calcTrace0 = calcTrace[0];\n var fullTrace = calcTrace0.trace;\n var pts = [];\n var bar, l, r, j;\n\n for(j = 0; j < calcTrace.length; j++) {\n bar = calcTrace[j];\n l = bar.p - vpad;\n r = bar.p + vpad;\n pts.push(l, r);\n }\n\n if(fullTrace.width || fullTrace.offset) {\n var t = calcTrace0.t;\n var poffset = t.poffset;\n var barwidth = t.barwidth;\n var poffsetIsArray = Array.isArray(poffset);\n var barwidthIsArray = Array.isArray(barwidth);\n\n for(j = 0; j < calcTrace.length; j++) {\n bar = calcTrace[j];\n var calcBarOffset = poffsetIsArray ? poffset[j] : poffset;\n var calcBarWidth = barwidthIsArray ? barwidth[j] : barwidth;\n l = bar.p + calcBarOffset;\n r = l + calcBarWidth;\n pts.push(l, r);\n }\n }\n\n fullTrace._extremes[pa._id] = Axes.findExtremes(pa, pts, {padded: false});\n }\n}\n\n// store these bar bases and tops in calcdata\n// and make sure the size axis includes zero,\n// along with the bases and tops of each bar.\nfunction setBaseAndTop(sa, sieve) {\n var calcTraces = sieve.traces;\n var sLetter = getAxisLetter(sa);\n\n for(var i = 0; i < calcTraces.length; i++) {\n var calcTrace = calcTraces[i];\n var fullTrace = calcTrace[0].trace;\n var pts = [];\n var tozero = false;\n\n for(var j = 0; j < calcTrace.length; j++) {\n var bar = calcTrace[j];\n var base = bar.b;\n var top = base + bar.s;\n\n bar[sLetter] = top;\n pts.push(top);\n if(bar.hasB) pts.push(base);\n\n if(!bar.hasB || !bar.b) {\n tozero = true;\n }\n }\n\n fullTrace._extremes[sa._id] = Axes.findExtremes(sa, pts, {\n tozero: tozero,\n padded: true\n });\n }\n}\n\nfunction stackBars(sa, sieve, opts) {\n var sLetter = getAxisLetter(sa);\n var calcTraces = sieve.traces;\n var calcTrace;\n var fullTrace;\n var isFunnel;\n var i, j;\n var bar;\n\n for(i = 0; i < calcTraces.length; i++) {\n calcTrace = calcTraces[i];\n fullTrace = calcTrace[0].trace;\n\n if(fullTrace.type === 'funnel') {\n for(j = 0; j < calcTrace.length; j++) {\n bar = calcTrace[j];\n\n if(bar.s !== BADNUM) {\n // create base of funnels\n sieve.put(bar.p, -0.5 * bar.s);\n }\n }\n }\n }\n\n for(i = 0; i < calcTraces.length; i++) {\n calcTrace = calcTraces[i];\n fullTrace = calcTrace[0].trace;\n\n isFunnel = (fullTrace.type === 'funnel');\n\n var pts = [];\n\n for(j = 0; j < calcTrace.length; j++) {\n bar = calcTrace[j];\n\n if(bar.s !== BADNUM) {\n // stack current bar and get previous sum\n var value;\n if(isFunnel) {\n value = bar.s;\n } else {\n value = bar.s + bar.b;\n }\n\n var base = sieve.put(bar.p, value);\n\n var top = base + value;\n\n // store the bar base and top in each calcdata item\n bar.b = base;\n bar[sLetter] = top;\n\n if(!opts.norm) {\n pts.push(top);\n if(bar.hasB) {\n pts.push(base);\n }\n }\n }\n }\n\n // if barnorm is set, let normalizeBars update the axis range\n if(!opts.norm) {\n fullTrace._extremes[sa._id] = Axes.findExtremes(sa, pts, {\n // N.B. we don't stack base with 'base',\n // so set tozero:true always!\n tozero: true,\n padded: true\n });\n }\n }\n}\n\nfunction sieveBars(sieve) {\n var calcTraces = sieve.traces;\n\n for(var i = 0; i < calcTraces.length; i++) {\n var calcTrace = calcTraces[i];\n\n for(var j = 0; j < calcTrace.length; j++) {\n var bar = calcTrace[j];\n\n if(bar.s !== BADNUM) {\n sieve.put(bar.p, bar.b + bar.s);\n }\n }\n }\n}\n\nfunction unhideBarsWithinTrace(sieve) {\n var calcTraces = sieve.traces;\n\n for(var i = 0; i < calcTraces.length; i++) {\n var calcTrace = calcTraces[i];\n var fullTrace = calcTrace[0].trace;\n\n if(fullTrace.base === undefined) {\n var inTraceSieve = new Sieve([calcTrace], {\n sepNegVal: true,\n overlapNoMerge: true\n });\n\n for(var j = 0; j < calcTrace.length; j++) {\n var bar = calcTrace[j];\n\n if(bar.p !== BADNUM) {\n // stack current bar and get previous sum\n var base = inTraceSieve.put(bar.p, bar.b + bar.s);\n\n // if previous sum if non-zero, this means:\n // multiple bars have same starting point are potentially hidden,\n // shift them vertically so that all bars are visible by default\n if(base) bar.b = base;\n }\n }\n }\n }\n}\n\n// Note:\n//\n// normalizeBars requires that either sieveBars or stackBars has been\n// previously invoked.\nfunction normalizeBars(sa, sieve, opts) {\n var calcTraces = sieve.traces;\n var sLetter = getAxisLetter(sa);\n var sTop = opts.norm === 'fraction' ? 1 : 100;\n var sTiny = sTop / 1e9; // in case of rounding error in sum\n var sMin = sa.l2c(sa.c2l(0));\n var sMax = opts.mode === 'stack' ? sTop : sMin;\n\n function needsPadding(v) {\n return (\n isNumeric(sa.c2l(v)) &&\n ((v < sMin - sTiny) || (v > sMax + sTiny) || !isNumeric(sMin))\n );\n }\n\n for(var i = 0; i < calcTraces.length; i++) {\n var calcTrace = calcTraces[i];\n var fullTrace = calcTrace[0].trace;\n var pts = [];\n var tozero = false;\n var padded = false;\n\n for(var j = 0; j < calcTrace.length; j++) {\n var bar = calcTrace[j];\n\n if(bar.s !== BADNUM) {\n var scale = Math.abs(sTop / sieve.get(bar.p, bar.s));\n bar.b *= scale;\n bar.s *= scale;\n\n var base = bar.b;\n var top = base + bar.s;\n\n bar[sLetter] = top;\n pts.push(top);\n padded = padded || needsPadding(top);\n\n if(bar.hasB) {\n pts.push(base);\n padded = padded || needsPadding(base);\n }\n\n if(!bar.hasB || !bar.b) {\n tozero = true;\n }\n }\n }\n\n fullTrace._extremes[sa._id] = Axes.findExtremes(sa, pts, {\n tozero: tozero,\n padded: padded\n });\n }\n}\n\n// find the full position span of bars at each position\n// for use by hover, to ensure labels move in if bars are\n// narrower than the space they're in.\n// run once per trace group (subplot & direction) and\n// the same mapping is attached to all calcdata traces\nfunction collectExtents(calcTraces, pa) {\n var pLetter = getAxisLetter(pa);\n var extents = {};\n var i, j, cd;\n\n var pMin = Infinity;\n var pMax = -Infinity;\n\n for(i = 0; i < calcTraces.length; i++) {\n cd = calcTraces[i];\n for(j = 0; j < cd.length; j++) {\n var p = cd[j].p;\n if(isNumeric(p)) {\n pMin = Math.min(pMin, p);\n pMax = Math.max(pMax, p);\n }\n }\n }\n\n // this is just for positioning of hover labels, and nobody will care if\n // the label is 1px too far out; so round positions to 1/10K in case\n // position values don't exactly match from trace to trace\n var roundFactor = 10000 / (pMax - pMin);\n var round = extents.round = function(p) {\n return String(Math.round(roundFactor * (p - pMin)));\n };\n\n for(i = 0; i < calcTraces.length; i++) {\n cd = calcTraces[i];\n cd[0].t.extents = extents;\n\n var poffset = cd[0].t.poffset;\n var poffsetIsArray = Array.isArray(poffset);\n\n for(j = 0; j < cd.length; j++) {\n var di = cd[j];\n var p0 = di[pLetter] - di.w / 2;\n\n if(isNumeric(p0)) {\n var p1 = di[pLetter] + di.w / 2;\n var pVal = round(di.p);\n if(extents[pVal]) {\n extents[pVal] = [Math.min(p0, extents[pVal][0]), Math.max(p1, extents[pVal][1])];\n } else {\n extents[pVal] = [p0, p1];\n }\n }\n\n di.p0 = di.p + (poffsetIsArray ? poffset[j] : poffset);\n di.p1 = di.p0 + di.w;\n di.s0 = di.b;\n di.s1 = di.s0 + di.s;\n }\n }\n}\n\nfunction getAxisLetter(ax) {\n return ax._id.charAt(0);\n}\n\nmodule.exports = {\n crossTraceCalc: crossTraceCalc,\n setGroupPositions: setGroupPositions\n};\n\n},{\"../../constants/numerical\":181,\"../../lib\":202,\"../../plots/cartesian/axes\":248,\"../../plots/cartesian/constraints\":255,\"../../registry\":290,\"./sieve.js\":313,\"fast-isnumeric\":11}],304:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar Lib = _dereq_('../../lib');\nvar Color = _dereq_('../../components/color');\nvar Registry = _dereq_('../../registry');\n\nvar handleXYDefaults = _dereq_('../scatter/xy_defaults');\nvar handlePeriodDefaults = _dereq_('../scatter/period_defaults');\nvar handleStyleDefaults = _dereq_('./style_defaults');\nvar getAxisGroup = _dereq_('../../plots/cartesian/constraints').getAxisGroup;\nvar attributes = _dereq_('./attributes');\n\nvar coerceFont = Lib.coerceFont;\n\nfunction supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n\n var len = handleXYDefaults(traceIn, traceOut, layout, coerce);\n if(!len) {\n traceOut.visible = false;\n return;\n }\n\n handlePeriodDefaults(traceIn, traceOut, layout, coerce);\n\n coerce('orientation', (traceOut.x && !traceOut.y) ? 'h' : 'v');\n coerce('base');\n coerce('offset');\n coerce('width');\n\n coerce('text');\n coerce('hovertext');\n coerce('hovertemplate');\n\n var textposition = coerce('textposition');\n handleText(traceIn, traceOut, layout, coerce, textposition, {\n moduleHasSelected: true,\n moduleHasUnselected: true,\n moduleHasConstrain: true,\n moduleHasCliponaxis: true,\n moduleHasTextangle: true,\n moduleHasInsideanchor: true\n });\n\n handleStyleDefaults(traceIn, traceOut, coerce, defaultColor, layout);\n\n var lineColor = (traceOut.marker.line || {}).color;\n\n // override defaultColor for error bars with defaultLine\n var errorBarsSupplyDefaults = Registry.getComponentMethod('errorbars', 'supplyDefaults');\n errorBarsSupplyDefaults(traceIn, traceOut, lineColor || Color.defaultLine, {axis: 'y'});\n errorBarsSupplyDefaults(traceIn, traceOut, lineColor || Color.defaultLine, {axis: 'x', inherit: 'y'});\n\n Lib.coerceSelectionMarkerOpacity(traceOut, coerce);\n}\n\nfunction handleGroupingDefaults(traceIn, traceOut, fullLayout, coerce) {\n var orientation = traceOut.orientation;\n // N.B. grouping is done across all trace types that support it\n var posAxId = traceOut[{v: 'x', h: 'y'}[orientation] + 'axis'];\n var groupId = getAxisGroup(fullLayout, posAxId) + orientation;\n\n var alignmentOpts = fullLayout._alignmentOpts || {};\n var alignmentgroup = coerce('alignmentgroup');\n\n var alignmentGroups = alignmentOpts[groupId];\n if(!alignmentGroups) alignmentGroups = alignmentOpts[groupId] = {};\n\n var alignmentGroupOpts = alignmentGroups[alignmentgroup];\n\n if(alignmentGroupOpts) {\n alignmentGroupOpts.traces.push(traceOut);\n } else {\n alignmentGroupOpts = alignmentGroups[alignmentgroup] = {\n traces: [traceOut],\n alignmentIndex: Object.keys(alignmentGroups).length,\n offsetGroups: {}\n };\n }\n\n var offsetgroup = coerce('offsetgroup');\n var offsetGroups = alignmentGroupOpts.offsetGroups;\n var offsetGroupOpts = offsetGroups[offsetgroup];\n\n if(offsetgroup) {\n if(!offsetGroupOpts) {\n offsetGroupOpts = offsetGroups[offsetgroup] = {\n offsetIndex: Object.keys(offsetGroups).length\n };\n }\n\n traceOut._offsetIndex = offsetGroupOpts.offsetIndex;\n }\n}\n\nfunction crossTraceDefaults(fullData, fullLayout) {\n var traceIn, traceOut;\n\n function coerce(attr) {\n return Lib.coerce(traceOut._input, traceOut, attributes, attr);\n }\n\n if(fullLayout.barmode === 'group') {\n for(var i = 0; i < fullData.length; i++) {\n traceOut = fullData[i];\n\n if(traceOut.type === 'bar') {\n traceIn = traceOut._input;\n handleGroupingDefaults(traceIn, traceOut, fullLayout, coerce);\n }\n }\n }\n}\n\nfunction handleText(traceIn, traceOut, layout, coerce, textposition, opts) {\n opts = opts || {};\n var moduleHasSelected = !(opts.moduleHasSelected === false);\n var moduleHasUnselected = !(opts.moduleHasUnselected === false);\n var moduleHasConstrain = !(opts.moduleHasConstrain === false);\n var moduleHasCliponaxis = !(opts.moduleHasCliponaxis === false);\n var moduleHasTextangle = !(opts.moduleHasTextangle === false);\n var moduleHasInsideanchor = !(opts.moduleHasInsideanchor === false);\n var hasPathbar = !!opts.hasPathbar;\n\n var hasBoth = Array.isArray(textposition) || textposition === 'auto';\n var hasInside = hasBoth || textposition === 'inside';\n var hasOutside = hasBoth || textposition === 'outside';\n\n if(hasInside || hasOutside) {\n var dfltFont = coerceFont(coerce, 'textfont', layout.font);\n\n // Note that coercing `insidetextfont` is always needed –\n // even if `textposition` is `outside` for each trace – since\n // an outside label can become an inside one, for example because\n // of a bar being stacked on top of it.\n var insideTextFontDefault = Lib.extendFlat({}, dfltFont);\n var isTraceTextfontColorSet = traceIn.textfont && traceIn.textfont.color;\n var isColorInheritedFromLayoutFont = !isTraceTextfontColorSet;\n if(isColorInheritedFromLayoutFont) {\n delete insideTextFontDefault.color;\n }\n coerceFont(coerce, 'insidetextfont', insideTextFontDefault);\n\n if(hasPathbar) {\n var pathbarTextFontDefault = Lib.extendFlat({}, dfltFont);\n if(isColorInheritedFromLayoutFont) {\n delete pathbarTextFontDefault.color;\n }\n coerceFont(coerce, 'pathbar.textfont', pathbarTextFontDefault);\n }\n\n if(hasOutside) coerceFont(coerce, 'outsidetextfont', dfltFont);\n\n if(moduleHasSelected) coerce('selected.textfont.color');\n if(moduleHasUnselected) coerce('unselected.textfont.color');\n if(moduleHasConstrain) coerce('constraintext');\n if(moduleHasCliponaxis) coerce('cliponaxis');\n if(moduleHasTextangle) coerce('textangle');\n\n coerce('texttemplate');\n }\n\n if(hasInside) {\n if(moduleHasInsideanchor) coerce('insidetextanchor');\n }\n}\n\nmodule.exports = {\n supplyDefaults: supplyDefaults,\n crossTraceDefaults: crossTraceDefaults,\n handleGroupingDefaults: handleGroupingDefaults,\n handleText: handleText\n};\n\n},{\"../../components/color\":75,\"../../lib\":202,\"../../plots/cartesian/constraints\":255,\"../../registry\":290,\"../scatter/period_defaults\":350,\"../scatter/xy_defaults\":357,\"./attributes\":300,\"./style_defaults\":315}],305:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nmodule.exports = function eventData(out, pt, trace) {\n // standard cartesian event data\n out.x = 'xVal' in pt ? pt.xVal : pt.x;\n out.y = 'yVal' in pt ? pt.yVal : pt.y;\n if(pt.xa) out.xaxis = pt.xa;\n if(pt.ya) out.yaxis = pt.ya;\n\n if(trace.orientation === 'h') {\n out.label = out.y;\n out.value = out.x;\n } else {\n out.label = out.x;\n out.value = out.y;\n }\n\n return out;\n};\n\n},{}],306:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar isNumeric = _dereq_('fast-isnumeric');\nvar tinycolor = _dereq_('tinycolor2');\nvar isArrayOrTypedArray = _dereq_('../../lib').isArrayOrTypedArray;\n\nexports.coerceString = function(attributeDefinition, value, defaultValue) {\n if(typeof value === 'string') {\n if(value || !attributeDefinition.noBlank) return value;\n } else if(typeof value === 'number' || value === true) {\n if(!attributeDefinition.strict) return String(value);\n }\n\n return (defaultValue !== undefined) ?\n defaultValue :\n attributeDefinition.dflt;\n};\n\nexports.coerceNumber = function(attributeDefinition, value, defaultValue) {\n if(isNumeric(value)) {\n value = +value;\n\n var min = attributeDefinition.min;\n var max = attributeDefinition.max;\n var isOutOfBounds = (min !== undefined && value < min) ||\n (max !== undefined && value > max);\n\n if(!isOutOfBounds) return value;\n }\n\n return (defaultValue !== undefined) ?\n defaultValue :\n attributeDefinition.dflt;\n};\n\nexports.coerceColor = function(attributeDefinition, value, defaultValue) {\n if(tinycolor(value).isValid()) return value;\n\n return (defaultValue !== undefined) ?\n defaultValue :\n attributeDefinition.dflt;\n};\n\nexports.coerceEnumerated = function(attributeDefinition, value, defaultValue) {\n if(attributeDefinition.coerceNumber) value = +value;\n\n if(attributeDefinition.values.indexOf(value) !== -1) return value;\n\n return (defaultValue !== undefined) ?\n defaultValue :\n attributeDefinition.dflt;\n};\n\nexports.getValue = function(arrayOrScalar, index) {\n var value;\n if(!Array.isArray(arrayOrScalar)) value = arrayOrScalar;\n else if(index < arrayOrScalar.length) value = arrayOrScalar[index];\n return value;\n};\n\nexports.getLineWidth = function(trace, di) {\n var w =\n (0 < di.mlw) ? di.mlw :\n !isArrayOrTypedArray(trace.marker.line.width) ? trace.marker.line.width :\n 0;\n\n return w;\n};\n\n},{\"../../lib\":202,\"fast-isnumeric\":11,\"tinycolor2\":58}],307:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n\n'use strict';\n\nvar Fx = _dereq_('../../components/fx');\nvar Registry = _dereq_('../../registry');\nvar Color = _dereq_('../../components/color');\n\nvar fillText = _dereq_('../../lib').fillText;\nvar getLineWidth = _dereq_('./helpers').getLineWidth;\nvar hoverLabelText = _dereq_('../../plots/cartesian/axes').hoverLabelText;\nvar BADNUM = _dereq_('../../constants/numerical').BADNUM;\n\nfunction hoverPoints(pointData, xval, yval, hovermode) {\n var barPointData = hoverOnBars(pointData, xval, yval, hovermode);\n\n if(barPointData) {\n var cd = barPointData.cd;\n var trace = cd[0].trace;\n var di = cd[barPointData.index];\n\n barPointData.color = getTraceColor(trace, di);\n Registry.getComponentMethod('errorbars', 'hoverInfo')(di, trace, barPointData);\n\n return [barPointData];\n }\n}\n\nfunction hoverOnBars(pointData, xval, yval, hovermode) {\n var cd = pointData.cd;\n var trace = cd[0].trace;\n var t = cd[0].t;\n var isClosest = (hovermode === 'closest');\n var isWaterfall = (trace.type === 'waterfall');\n var maxHoverDistance = pointData.maxHoverDistance;\n\n var posVal, sizeVal, posLetter, sizeLetter, dx, dy, pRangeCalc;\n\n function thisBarMinPos(di) { return di[posLetter] - di.w / 2; }\n function thisBarMaxPos(di) { return di[posLetter] + di.w / 2; }\n\n var minPos = isClosest ?\n thisBarMinPos :\n function(di) {\n /*\n * In compare mode, accept a bar if you're on it *or* its group.\n * Nearly always it's the group that matters, but in case the bar\n * was explicitly set wider than its group we'd better accept the\n * whole bar.\n *\n * use `bardelta` instead of `bargroupwidth` so we accept hover\n * in the gap. That way hover doesn't flash on and off as you\n * mouse over the plot in compare modes.\n * In 'closest' mode though the flashing seems inevitable,\n * without far more complex logic\n */\n return Math.min(thisBarMinPos(di), di.p - t.bardelta / 2);\n };\n\n var maxPos = isClosest ?\n thisBarMaxPos :\n function(di) {\n return Math.max(thisBarMaxPos(di), di.p + t.bardelta / 2);\n };\n\n function _positionFn(_minPos, _maxPos) {\n // add a little to the pseudo-distance for wider bars, so that like scatter,\n // if you are over two overlapping bars, the narrower one wins.\n return Fx.inbox(_minPos - posVal, _maxPos - posVal,\n maxHoverDistance + Math.min(1, Math.abs(_maxPos - _minPos) / pRangeCalc) - 1);\n }\n\n function positionFn(di) {\n return _positionFn(minPos(di), maxPos(di));\n }\n\n function thisBarPositionFn(di) {\n return _positionFn(thisBarMinPos(di), thisBarMaxPos(di));\n }\n\n function sizeFn(di) {\n var v = sizeVal;\n var b = di.b;\n var s = di[sizeLetter];\n\n if(isWaterfall) {\n var rawS = Math.abs(di.rawS) || 0;\n if(v > 0) {\n s += rawS;\n } else if(v < 0) {\n s -= rawS;\n }\n }\n\n // add a gradient so hovering near the end of a\n // bar makes it a little closer match\n return Fx.inbox(b - v, s - v, maxHoverDistance + (s - v) / (s - b) - 1);\n }\n\n if(trace.orientation === 'h') {\n posVal = yval;\n sizeVal = xval;\n posLetter = 'y';\n sizeLetter = 'x';\n dx = sizeFn;\n dy = positionFn;\n } else {\n posVal = xval;\n sizeVal = yval;\n posLetter = 'x';\n sizeLetter = 'y';\n dy = sizeFn;\n dx = positionFn;\n }\n\n var pa = pointData[posLetter + 'a'];\n var sa = pointData[sizeLetter + 'a'];\n\n pRangeCalc = Math.abs(pa.r2c(pa.range[1]) - pa.r2c(pa.range[0]));\n\n function dxy(di) { return (dx(di) + dy(di)) / 2; }\n var distfn = Fx.getDistanceFunction(hovermode, dx, dy, dxy);\n Fx.getClosest(cd, distfn, pointData);\n\n // skip the rest (for this trace) if we didn't find a close point\n if(pointData.index === false) return;\n\n // skip points inside axis rangebreaks\n if(cd[pointData.index].p === BADNUM) return;\n\n // if we get here and we're not in 'closest' mode, push min/max pos back\n // onto the group - even though that means occasionally the mouse will be\n // over the hover label.\n if(!isClosest) {\n minPos = function(di) {\n return Math.min(thisBarMinPos(di), di.p - t.bargroupwidth / 2);\n };\n maxPos = function(di) {\n return Math.max(thisBarMaxPos(di), di.p + t.bargroupwidth / 2);\n };\n }\n\n // the closest data point\n var index = pointData.index;\n var di = cd[index];\n\n var size = (trace.base) ? di.b + di.s : di.s;\n pointData[sizeLetter + '0'] = pointData[sizeLetter + '1'] = sa.c2p(di[sizeLetter], true);\n pointData[sizeLetter + 'LabelVal'] = size;\n\n var extent = t.extents[t.extents.round(di.p)];\n pointData[posLetter + '0'] = pa.c2p(isClosest ? minPos(di) : extent[0], true);\n pointData[posLetter + '1'] = pa.c2p(isClosest ? maxPos(di) : extent[1], true);\n\n var hasPeriod = di.orig_p !== undefined;\n pointData[posLetter + 'LabelVal'] = hasPeriod ? di.orig_p : di.p;\n\n pointData.labelLabel = hoverLabelText(pa, pointData[posLetter + 'LabelVal']);\n pointData.valueLabel = hoverLabelText(sa, pointData[sizeLetter + 'LabelVal']);\n pointData.baseLabel = hoverLabelText(sa, di.b);\n\n // spikelines always want \"closest\" distance regardless of hovermode\n pointData.spikeDistance = (sizeFn(di) + thisBarPositionFn(di)) / 2 - maxHoverDistance;\n // they also want to point to the data value, regardless of where the label goes\n // in case of bars shifted within groups\n pointData[posLetter + 'Spike'] = pa.c2p(di.p, true);\n\n fillText(di, trace, pointData);\n pointData.hovertemplate = trace.hovertemplate;\n\n return pointData;\n}\n\nfunction getTraceColor(trace, di) {\n var mc = di.mcc || trace.marker.color;\n var mlc = di.mlcc || trace.marker.line.color;\n var mlw = getLineWidth(trace, di);\n\n if(Color.opacity(mc)) return mc;\n else if(Color.opacity(mlc) && mlw) return mlc;\n}\n\nmodule.exports = {\n hoverPoints: hoverPoints,\n hoverOnBars: hoverOnBars,\n getTraceColor: getTraceColor\n};\n\n},{\"../../components/color\":75,\"../../components/fx\":115,\"../../constants/numerical\":181,\"../../lib\":202,\"../../plots/cartesian/axes\":248,\"../../registry\":290,\"./helpers\":306}],308:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nmodule.exports = {\n attributes: _dereq_('./attributes'),\n layoutAttributes: _dereq_('./layout_attributes'),\n supplyDefaults: _dereq_('./defaults').supplyDefaults,\n crossTraceDefaults: _dereq_('./defaults').crossTraceDefaults,\n supplyLayoutDefaults: _dereq_('./layout_defaults'),\n calc: _dereq_('./calc'),\n crossTraceCalc: _dereq_('./cross_trace_calc').crossTraceCalc,\n colorbar: _dereq_('../scatter/marker_colorbar'),\n arraysToCalcdata: _dereq_('./arrays_to_calcdata'),\n plot: _dereq_('./plot').plot,\n style: _dereq_('./style').style,\n styleOnSelect: _dereq_('./style').styleOnSelect,\n hoverPoints: _dereq_('./hover').hoverPoints,\n eventData: _dereq_('./event_data'),\n selectPoints: _dereq_('./select'),\n\n moduleType: 'trace',\n name: 'bar',\n basePlotModule: _dereq_('../../plots/cartesian'),\n categories: ['bar-like', 'cartesian', 'svg', 'bar', 'oriented', 'errorBarsOK', 'showLegend', 'zoomScale'],\n animatable: true,\n meta: {\n \n }\n};\n\n},{\"../../plots/cartesian\":261,\"../scatter/marker_colorbar\":348,\"./arrays_to_calcdata\":299,\"./attributes\":300,\"./calc\":301,\"./cross_trace_calc\":303,\"./defaults\":304,\"./event_data\":305,\"./hover\":307,\"./layout_attributes\":309,\"./layout_defaults\":310,\"./plot\":311,\"./select\":312,\"./style\":314}],309:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\n\nmodule.exports = {\n barmode: {\n valType: 'enumerated',\n values: ['stack', 'group', 'overlay', 'relative'],\n dflt: 'group',\n \n editType: 'calc',\n \n },\n barnorm: {\n valType: 'enumerated',\n values: ['', 'fraction', 'percent'],\n dflt: '',\n \n editType: 'calc',\n \n },\n bargap: {\n valType: 'number',\n min: 0,\n max: 1,\n \n editType: 'calc',\n \n },\n bargroupgap: {\n valType: 'number',\n min: 0,\n max: 1,\n dflt: 0,\n \n editType: 'calc',\n \n }\n};\n\n},{}],310:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar Registry = _dereq_('../../registry');\nvar Axes = _dereq_('../../plots/cartesian/axes');\nvar Lib = _dereq_('../../lib');\n\nvar layoutAttributes = _dereq_('./layout_attributes');\n\nmodule.exports = function(layoutIn, layoutOut, fullData) {\n function coerce(attr, dflt) {\n return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt);\n }\n\n var hasBars = false;\n var shouldBeGapless = false;\n var gappedAnyway = false;\n var usedSubplots = {};\n\n var mode = coerce('barmode');\n\n for(var i = 0; i < fullData.length; i++) {\n var trace = fullData[i];\n if(Registry.traceIs(trace, 'bar') && trace.visible) hasBars = true;\n else continue;\n\n // if we have at least 2 grouped bar traces on the same subplot,\n // we should default to a gap anyway, even if the data is histograms\n if(mode === 'group') {\n var subploti = trace.xaxis + trace.yaxis;\n if(usedSubplots[subploti]) gappedAnyway = true;\n usedSubplots[subploti] = true;\n }\n\n if(trace.visible && trace.type === 'histogram') {\n var pa = Axes.getFromId({_fullLayout: layoutOut},\n trace[trace.orientation === 'v' ? 'xaxis' : 'yaxis']);\n if(pa.type !== 'category') shouldBeGapless = true;\n }\n }\n\n if(!hasBars) {\n delete layoutOut.barmode;\n return;\n }\n\n if(mode !== 'overlay') coerce('barnorm');\n\n coerce('bargap', (shouldBeGapless && !gappedAnyway) ? 0 : 0.2);\n coerce('bargroupgap');\n};\n\n},{\"../../lib\":202,\"../../plots/cartesian/axes\":248,\"../../registry\":290,\"./layout_attributes\":309}],311:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar d3 = _dereq_('d3');\nvar isNumeric = _dereq_('fast-isnumeric');\n\nvar Lib = _dereq_('../../lib');\nvar svgTextUtils = _dereq_('../../lib/svg_text_utils');\n\nvar Color = _dereq_('../../components/color');\nvar Drawing = _dereq_('../../components/drawing');\nvar Registry = _dereq_('../../registry');\nvar tickText = _dereq_('../../plots/cartesian/axes').tickText;\n\nvar uniformText = _dereq_('./uniform_text');\nvar recordMinTextSize = uniformText.recordMinTextSize;\nvar clearMinTextSize = uniformText.clearMinTextSize;\n\nvar style = _dereq_('./style');\nvar helpers = _dereq_('./helpers');\nvar constants = _dereq_('./constants');\nvar attributes = _dereq_('./attributes');\n\nvar attributeText = attributes.text;\nvar attributeTextPosition = attributes.textposition;\n\nvar appendArrayPointValue = _dereq_('../../components/fx/helpers').appendArrayPointValue;\n\nvar TEXTPAD = constants.TEXTPAD;\n\nfunction keyFunc(d) {return d.id;}\nfunction getKeyFunc(trace) {\n if(trace.ids) {\n return keyFunc;\n }\n}\n\nfunction dirSign(a, b) {\n return (a < b) ? 1 : -1;\n}\n\nfunction getXY(di, xa, ya, isHorizontal) {\n var s = [];\n var p = [];\n\n var sAxis = isHorizontal ? xa : ya;\n var pAxis = isHorizontal ? ya : xa;\n\n s[0] = sAxis.c2p(di.s0, true);\n p[0] = pAxis.c2p(di.p0, true);\n\n s[1] = sAxis.c2p(di.s1, true);\n p[1] = pAxis.c2p(di.p1, true);\n\n return isHorizontal ? [s, p] : [p, s];\n}\n\nfunction transition(selection, fullLayout, opts, makeOnCompleteCallback) {\n if(!fullLayout.uniformtext.mode && hasTransition(opts)) {\n var onComplete;\n if(makeOnCompleteCallback) {\n onComplete = makeOnCompleteCallback();\n }\n return selection\n .transition()\n .duration(opts.duration)\n .ease(opts.easing)\n .each('end', function() { onComplete && onComplete(); })\n .each('interrupt', function() { onComplete && onComplete(); });\n } else {\n return selection;\n }\n}\n\nfunction hasTransition(transitionOpts) {\n return transitionOpts && transitionOpts.duration > 0;\n}\n\nfunction plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback) {\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n var fullLayout = gd._fullLayout;\n\n if(!opts) {\n opts = {\n mode: fullLayout.barmode,\n norm: fullLayout.barmode,\n gap: fullLayout.bargap,\n groupgap: fullLayout.bargroupgap\n };\n\n // don't clear bar when this is called from waterfall or funnel\n clearMinTextSize('bar', fullLayout);\n }\n\n var bartraces = Lib.makeTraceGroups(traceLayer, cdModule, 'trace bars').each(function(cd) {\n var plotGroup = d3.select(this);\n var trace = cd[0].trace;\n var isWaterfall = (trace.type === 'waterfall');\n var isFunnel = (trace.type === 'funnel');\n var isBar = (trace.type === 'bar');\n var shouldDisplayZeros = (isBar || isFunnel);\n\n var adjustPixel = 0;\n if(isWaterfall && trace.connector.visible && trace.connector.mode === 'between') {\n adjustPixel = trace.connector.line.width / 2;\n }\n\n var isHorizontal = (trace.orientation === 'h');\n var withTransition = hasTransition(opts);\n\n var pointGroup = Lib.ensureSingle(plotGroup, 'g', 'points');\n\n var keyFunc = getKeyFunc(trace);\n var bars = pointGroup.selectAll('g.point').data(Lib.identity, keyFunc);\n\n bars.enter().append('g')\n .classed('point', true);\n\n bars.exit().remove();\n\n bars.each(function(di, i) {\n var bar = d3.select(this);\n\n // now display the bar\n // clipped xf/yf (2nd arg true): non-positive\n // log values go off-screen by plotwidth\n // so you see them continue if you drag the plot\n var xy = getXY(di, xa, ya, isHorizontal);\n\n var x0 = xy[0][0];\n var x1 = xy[0][1];\n var y0 = xy[1][0];\n var y1 = xy[1][1];\n\n // empty bars\n var isBlank = (isHorizontal ? x1 - x0 : y1 - y0) === 0;\n\n // display zeros if line.width > 0\n if(isBlank && shouldDisplayZeros && helpers.getLineWidth(trace, di)) {\n isBlank = false;\n }\n\n // skip nulls\n if(!isBlank) {\n isBlank = (\n !isNumeric(x0) ||\n !isNumeric(x1) ||\n !isNumeric(y0) ||\n !isNumeric(y1)\n );\n }\n\n // record isBlank\n di.isBlank = isBlank;\n\n // for blank bars, ensure start and end positions are equal - important for smooth transitions\n if(isBlank) {\n if(isHorizontal) {\n x1 = x0;\n } else {\n y1 = y0;\n }\n }\n\n // in waterfall mode `between` we need to adjust bar end points to match the connector width\n if(adjustPixel && !isBlank) {\n if(isHorizontal) {\n x0 -= dirSign(x0, x1) * adjustPixel;\n x1 += dirSign(x0, x1) * adjustPixel;\n } else {\n y0 -= dirSign(y0, y1) * adjustPixel;\n y1 += dirSign(y0, y1) * adjustPixel;\n }\n }\n\n var lw;\n var mc;\n\n if(trace.type === 'waterfall') {\n if(!isBlank) {\n var cont = trace[di.dir].marker;\n lw = cont.line.width;\n mc = cont.color;\n }\n } else {\n lw = helpers.getLineWidth(trace, di);\n mc = di.mc || trace.marker.color;\n }\n\n function roundWithLine(v) {\n var offset = d3.round((lw / 2) % 1, 2);\n\n // if there are explicit gaps, don't round,\n // it can make the gaps look crappy\n return (opts.gap === 0 && opts.groupgap === 0) ?\n d3.round(Math.round(v) - offset, 2) : v;\n }\n\n function expandToVisible(v, vc, hideZeroSpan) {\n if(hideZeroSpan && v === vc) {\n // should not expand zero span bars\n // when start and end positions are identical\n // i.e. for vertical when y0 === y1\n // and for horizontal when x0 === x1\n return v;\n }\n\n // if it's not in danger of disappearing entirely,\n // round more precisely\n return Math.abs(v - vc) >= 2 ? roundWithLine(v) :\n // but if it's very thin, expand it so it's\n // necessarily visible, even if it might overlap\n // its neighbor\n (v > vc ? Math.ceil(v) : Math.floor(v));\n }\n\n if(!gd._context.staticPlot) {\n // if bars are not fully opaque or they have a line\n // around them, round to integer pixels, mainly for\n // safari so we prevent overlaps from its expansive\n // pixelation. if the bars ARE fully opaque and have\n // no line, expand to a full pixel to make sure we\n // can see them\n\n var op = Color.opacity(mc);\n var fixpx = (op < 1 || lw > 0.01) ? roundWithLine : expandToVisible;\n\n x0 = fixpx(x0, x1, isHorizontal);\n x1 = fixpx(x1, x0, isHorizontal);\n y0 = fixpx(y0, y1, !isHorizontal);\n y1 = fixpx(y1, y0, !isHorizontal);\n }\n\n var sel = transition(Lib.ensureSingle(bar, 'path'), fullLayout, opts, makeOnCompleteCallback);\n sel\n .style('vector-effect', 'non-scaling-stroke')\n .attr('d', (isNaN((x1 - x0) * (y1 - y0)) || (isBlank && gd._context.staticPlot)) ? 'M0,0Z' : 'M' + x0 + ',' + y0 + 'V' + y1 + 'H' + x1 + 'V' + y0 + 'Z')\n .call(Drawing.setClipUrl, plotinfo.layerClipId, gd);\n\n if(!fullLayout.uniformtext.mode && withTransition) {\n var styleFns = Drawing.makePointStyleFns(trace);\n Drawing.singlePointStyle(di, sel, trace, styleFns, gd);\n }\n\n appendBarText(gd, plotinfo, bar, cd, i, x0, x1, y0, y1, opts, makeOnCompleteCallback);\n\n if(plotinfo.layerClipId) {\n Drawing.hideOutsideRangePoint(di, bar.select('text'), xa, ya, trace.xcalendar, trace.ycalendar);\n }\n });\n\n // lastly, clip points groups of `cliponaxis !== false` traces\n // on `plotinfo._hasClipOnAxisFalse === true` subplots\n var hasClipOnAxisFalse = trace.cliponaxis === false;\n Drawing.setClipUrl(plotGroup, hasClipOnAxisFalse ? null : plotinfo.layerClipId, gd);\n });\n\n // error bars are on the top\n Registry.getComponentMethod('errorbars', 'plot')(gd, bartraces, plotinfo, opts);\n}\n\nfunction appendBarText(gd, plotinfo, bar, cd, i, x0, x1, y0, y1, opts, makeOnCompleteCallback) {\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n\n var fullLayout = gd._fullLayout;\n var textPosition;\n\n function appendTextNode(bar, text, font) {\n var textSelection = Lib.ensureSingle(bar, 'text')\n .text(text)\n .attr({\n 'class': 'bartext bartext-' + textPosition,\n 'text-anchor': 'middle',\n // prohibit tex interpretation until we can handle\n // tex and regular text together\n 'data-notex': 1\n })\n .call(Drawing.font, font)\n .call(svgTextUtils.convertToTspans, gd);\n\n return textSelection;\n }\n\n // get trace attributes\n var trace = cd[0].trace;\n var isHorizontal = (trace.orientation === 'h');\n\n var text = getText(fullLayout, cd, i, xa, ya);\n textPosition = getTextPosition(trace, i);\n\n // compute text position\n var inStackOrRelativeMode =\n opts.mode === 'stack' ||\n opts.mode === 'relative';\n\n var calcBar = cd[i];\n var isOutmostBar = !inStackOrRelativeMode || calcBar._outmost;\n\n if(!text ||\n textPosition === 'none' ||\n ((calcBar.isBlank || x0 === x1 || y0 === y1) && (\n textPosition === 'auto' ||\n textPosition === 'inside'))) {\n bar.select('text').remove();\n return;\n }\n\n var layoutFont = fullLayout.font;\n var barColor = style.getBarColor(cd[i], trace);\n var insideTextFont = style.getInsideTextFont(trace, i, layoutFont, barColor);\n var outsideTextFont = style.getOutsideTextFont(trace, i, layoutFont);\n\n // Special case: don't use the c2p(v, true) value on log size axes,\n // so that we can get correctly inside text scaling\n var di = bar.datum();\n if(isHorizontal) {\n if(xa.type === 'log' && di.s0 <= 0) {\n if(xa.range[0] < xa.range[1]) {\n x0 = 0;\n } else {\n x0 = xa._length;\n }\n }\n } else {\n if(ya.type === 'log' && di.s0 <= 0) {\n if(ya.range[0] < ya.range[1]) {\n y0 = ya._length;\n } else {\n y0 = 0;\n }\n }\n }\n\n // padding excluded\n var barWidth = Math.abs(x1 - x0) - 2 * TEXTPAD;\n var barHeight = Math.abs(y1 - y0) - 2 * TEXTPAD;\n\n var textSelection;\n var textBB;\n var textWidth;\n var textHeight;\n var font;\n\n if(textPosition === 'outside') {\n if(!isOutmostBar && !calcBar.hasB) textPosition = 'inside';\n }\n\n if(textPosition === 'auto') {\n if(isOutmostBar) {\n // draw text using insideTextFont and check if it fits inside bar\n textPosition = 'inside';\n\n font = Lib.ensureUniformFontSize(gd, insideTextFont);\n\n textSelection = appendTextNode(bar, text, font);\n\n textBB = Drawing.bBox(textSelection.node()),\n textWidth = textBB.width,\n textHeight = textBB.height;\n\n var textHasSize = (textWidth > 0 && textHeight > 0);\n var fitsInside = (textWidth <= barWidth && textHeight <= barHeight);\n var fitsInsideIfRotated = (textWidth <= barHeight && textHeight <= barWidth);\n var fitsInsideIfShrunk = (isHorizontal) ?\n (barWidth >= textWidth * (barHeight / textHeight)) :\n (barHeight >= textHeight * (barWidth / textWidth));\n\n if(textHasSize && (\n fitsInside ||\n fitsInsideIfRotated ||\n fitsInsideIfShrunk)\n ) {\n textPosition = 'inside';\n } else {\n textPosition = 'outside';\n textSelection.remove();\n textSelection = null;\n }\n } else {\n textPosition = 'inside';\n }\n }\n\n if(!textSelection) {\n font = Lib.ensureUniformFontSize(gd, (textPosition === 'outside') ? outsideTextFont : insideTextFont);\n\n textSelection = appendTextNode(bar, text, font);\n\n var currentTransform = textSelection.attr('transform');\n textSelection.attr('transform', '');\n textBB = Drawing.bBox(textSelection.node()),\n textWidth = textBB.width,\n textHeight = textBB.height;\n textSelection.attr('transform', currentTransform);\n\n if(textWidth <= 0 || textHeight <= 0) {\n textSelection.remove();\n return;\n }\n }\n\n var angle = trace.textangle;\n\n // compute text transform\n var transform, constrained;\n if(textPosition === 'outside') {\n constrained =\n trace.constraintext === 'both' ||\n trace.constraintext === 'outside';\n\n transform = toMoveOutsideBar(x0, x1, y0, y1, textBB, {\n isHorizontal: isHorizontal,\n constrained: constrained,\n angle: angle\n });\n } else {\n constrained =\n trace.constraintext === 'both' ||\n trace.constraintext === 'inside';\n\n transform = toMoveInsideBar(x0, x1, y0, y1, textBB, {\n isHorizontal: isHorizontal,\n constrained: constrained,\n angle: angle,\n anchor: trace.insidetextanchor\n });\n }\n\n transform.fontSize = font.size;\n recordMinTextSize(trace.type, transform, fullLayout);\n calcBar.transform = transform;\n\n transition(textSelection, fullLayout, opts, makeOnCompleteCallback)\n .attr('transform', Lib.getTextTransform(transform));\n}\n\nfunction getRotateFromAngle(angle) {\n return (angle === 'auto') ? 0 : angle;\n}\n\nfunction getRotatedTextSize(textBB, rotate) {\n var a = Math.PI / 180 * rotate;\n var absSin = Math.abs(Math.sin(a));\n var absCos = Math.abs(Math.cos(a));\n\n return {\n x: textBB.width * absCos + textBB.height * absSin,\n y: textBB.width * absSin + textBB.height * absCos\n };\n}\n\nfunction toMoveInsideBar(x0, x1, y0, y1, textBB, opts) {\n var isHorizontal = !!opts.isHorizontal;\n var constrained = !!opts.constrained;\n var angle = opts.angle || 0;\n var anchor = opts.anchor || 'end';\n var isEnd = anchor === 'end';\n var isStart = anchor === 'start';\n var leftToRight = opts.leftToRight || 0; // left: -1, center: 0, right: 1\n var toRight = (leftToRight + 1) / 2;\n var toLeft = 1 - toRight;\n\n var textWidth = textBB.width;\n var textHeight = textBB.height;\n var lx = Math.abs(x1 - x0);\n var ly = Math.abs(y1 - y0);\n\n // compute remaining space\n var textpad = (\n lx > (2 * TEXTPAD) &&\n ly > (2 * TEXTPAD)\n ) ? TEXTPAD : 0;\n\n lx -= 2 * textpad;\n ly -= 2 * textpad;\n\n var rotate = getRotateFromAngle(angle);\n if((angle === 'auto') &&\n !(textWidth <= lx && textHeight <= ly) &&\n (textWidth > lx || textHeight > ly) && (\n !(textWidth > ly || textHeight > lx) ||\n ((textWidth < textHeight) !== (lx < ly))\n )) {\n rotate += 90;\n }\n\n var t = getRotatedTextSize(textBB, rotate);\n\n var scale = 1;\n if(constrained) {\n scale = Math.min(\n 1,\n lx / t.x,\n ly / t.y\n );\n }\n\n // compute text and target positions\n var textX = (\n textBB.left * toLeft +\n textBB.right * toRight\n );\n var textY = (textBB.top + textBB.bottom) / 2;\n var targetX = (\n (x0 + TEXTPAD) * toLeft +\n (x1 - TEXTPAD) * toRight\n );\n var targetY = (y0 + y1) / 2;\n var anchorX = 0;\n var anchorY = 0;\n if(isStart || isEnd) {\n var extrapad = (isHorizontal ? t.x : t.y) / 2;\n var dir = isHorizontal ? dirSign(x0, x1) : dirSign(y0, y1);\n\n if(isHorizontal) {\n if(isStart) {\n targetX = x0 + dir * textpad;\n anchorX = -dir * extrapad;\n } else {\n targetX = x1 - dir * textpad;\n anchorX = dir * extrapad;\n }\n } else {\n if(isStart) {\n targetY = y0 + dir * textpad;\n anchorY = -dir * extrapad;\n } else {\n targetY = y1 - dir * textpad;\n anchorY = dir * extrapad;\n }\n }\n }\n\n return {\n textX: textX,\n textY: textY,\n targetX: targetX,\n targetY: targetY,\n anchorX: anchorX,\n anchorY: anchorY,\n scale: scale,\n rotate: rotate\n };\n}\n\nfunction toMoveOutsideBar(x0, x1, y0, y1, textBB, opts) {\n var isHorizontal = !!opts.isHorizontal;\n var constrained = !!opts.constrained;\n var angle = opts.angle || 0;\n\n var textWidth = textBB.width;\n var textHeight = textBB.height;\n var lx = Math.abs(x1 - x0);\n var ly = Math.abs(y1 - y0);\n\n var textpad;\n // Keep the padding so the text doesn't sit right against\n // the bars, but don't factor it into barWidth\n if(isHorizontal) {\n textpad = (ly > 2 * TEXTPAD) ? TEXTPAD : 0;\n } else {\n textpad = (lx > 2 * TEXTPAD) ? TEXTPAD : 0;\n }\n\n // compute rotate and scale\n var scale = 1;\n if(constrained) {\n scale = (isHorizontal) ?\n Math.min(1, ly / textHeight) :\n Math.min(1, lx / textWidth);\n }\n\n var rotate = getRotateFromAngle(angle);\n var t = getRotatedTextSize(textBB, rotate);\n\n // compute text and target positions\n var extrapad = (isHorizontal ? t.x : t.y) / 2;\n var textX = (textBB.left + textBB.right) / 2;\n var textY = (textBB.top + textBB.bottom) / 2;\n var targetX = (x0 + x1) / 2;\n var targetY = (y0 + y1) / 2;\n var anchorX = 0;\n var anchorY = 0;\n\n var dir = isHorizontal ? dirSign(x1, x0) : dirSign(y0, y1);\n if(isHorizontal) {\n targetX = x1 - dir * textpad;\n anchorX = dir * extrapad;\n } else {\n targetY = y1 + dir * textpad;\n anchorY = -dir * extrapad;\n }\n\n return {\n textX: textX,\n textY: textY,\n targetX: targetX,\n targetY: targetY,\n anchorX: anchorX,\n anchorY: anchorY,\n scale: scale,\n rotate: rotate\n };\n}\n\nfunction getText(fullLayout, cd, index, xa, ya) {\n var trace = cd[0].trace;\n var texttemplate = trace.texttemplate;\n\n var value;\n if(texttemplate) {\n value = calcTexttemplate(fullLayout, cd, index, xa, ya);\n } else if(trace.textinfo) {\n value = calcTextinfo(cd, index, xa, ya);\n } else {\n value = helpers.getValue(trace.text, index);\n }\n\n return helpers.coerceString(attributeText, value);\n}\n\nfunction getTextPosition(trace, index) {\n var value = helpers.getValue(trace.textposition, index);\n return helpers.coerceEnumerated(attributeTextPosition, value);\n}\n\nfunction calcTexttemplate(fullLayout, cd, index, xa, ya) {\n var trace = cd[0].trace;\n var texttemplate = Lib.castOption(trace, index, 'texttemplate');\n if(!texttemplate) return '';\n var isWaterfall = (trace.type === 'waterfall');\n var isFunnel = (trace.type === 'funnel');\n\n var pLetter, pAxis;\n var vLetter, vAxis;\n if(trace.orientation === 'h') {\n pLetter = 'y';\n pAxis = ya;\n vLetter = 'x';\n vAxis = xa;\n } else {\n pLetter = 'x';\n pAxis = xa;\n vLetter = 'y';\n vAxis = ya;\n }\n\n function formatLabel(u) {\n return tickText(pAxis, u, true).text;\n }\n\n function formatNumber(v) {\n return tickText(vAxis, +v, true).text;\n }\n\n var cdi = cd[index];\n var obj = {};\n\n obj.label = cdi.p;\n obj.labelLabel = obj[pLetter + 'Label'] = formatLabel(cdi.p);\n\n var tx = Lib.castOption(trace, cdi.i, 'text');\n if(tx === 0 || tx) obj.text = tx;\n\n obj.value = cdi.s;\n obj.valueLabel = obj[vLetter + 'Label'] = formatNumber(cdi.s);\n\n var pt = {};\n appendArrayPointValue(pt, trace, cdi.i);\n\n if(isWaterfall) {\n obj.delta = +cdi.rawS || cdi.s;\n obj.deltaLabel = formatNumber(obj.delta);\n obj.final = cdi.v;\n obj.finalLabel = formatNumber(obj.final);\n obj.initial = obj.final - obj.delta;\n obj.initialLabel = formatNumber(obj.initial);\n }\n\n if(isFunnel) {\n obj.value = cdi.s;\n obj.valueLabel = formatNumber(obj.value);\n\n obj.percentInitial = cdi.begR;\n obj.percentInitialLabel = Lib.formatPercent(cdi.begR);\n obj.percentPrevious = cdi.difR;\n obj.percentPreviousLabel = Lib.formatPercent(cdi.difR);\n obj.percentTotal = cdi.sumR;\n obj.percenTotalLabel = Lib.formatPercent(cdi.sumR);\n }\n\n var customdata = Lib.castOption(trace, cdi.i, 'customdata');\n if(customdata) obj.customdata = customdata;\n return Lib.texttemplateString(texttemplate, obj, fullLayout._d3locale, pt, obj, trace._meta || {});\n}\n\nfunction calcTextinfo(cd, index, xa, ya) {\n var trace = cd[0].trace;\n var isHorizontal = (trace.orientation === 'h');\n var isWaterfall = (trace.type === 'waterfall');\n var isFunnel = (trace.type === 'funnel');\n\n function formatLabel(u) {\n var pAxis = isHorizontal ? ya : xa;\n return tickText(pAxis, u, true).text;\n }\n\n function formatNumber(v) {\n var sAxis = isHorizontal ? xa : ya;\n return tickText(sAxis, +v, true).text;\n }\n\n var textinfo = trace.textinfo;\n var cdi = cd[index];\n\n var parts = textinfo.split('+');\n var text = [];\n var tx;\n\n var hasFlag = function(flag) { return parts.indexOf(flag) !== -1; };\n\n if(hasFlag('label')) {\n text.push(formatLabel(cd[index].p));\n }\n\n if(hasFlag('text')) {\n tx = Lib.castOption(trace, cdi.i, 'text');\n if(tx === 0 || tx) text.push(tx);\n }\n\n if(isWaterfall) {\n var delta = +cdi.rawS || cdi.s;\n var final = cdi.v;\n var initial = final - delta;\n\n if(hasFlag('initial')) text.push(formatNumber(initial));\n if(hasFlag('delta')) text.push(formatNumber(delta));\n if(hasFlag('final')) text.push(formatNumber(final));\n }\n\n if(isFunnel) {\n if(hasFlag('value')) text.push(formatNumber(cdi.s));\n\n var nPercent = 0;\n if(hasFlag('percent initial')) nPercent++;\n if(hasFlag('percent previous')) nPercent++;\n if(hasFlag('percent total')) nPercent++;\n\n var hasMultiplePercents = nPercent > 1;\n\n if(hasFlag('percent initial')) {\n tx = Lib.formatPercent(cdi.begR);\n if(hasMultiplePercents) tx += ' of initial';\n text.push(tx);\n }\n if(hasFlag('percent previous')) {\n tx = Lib.formatPercent(cdi.difR);\n if(hasMultiplePercents) tx += ' of previous';\n text.push(tx);\n }\n if(hasFlag('percent total')) {\n tx = Lib.formatPercent(cdi.sumR);\n if(hasMultiplePercents) tx += ' of total';\n text.push(tx);\n }\n }\n\n return text.join('
');\n}\n\nmodule.exports = {\n plot: plot,\n toMoveInsideBar: toMoveInsideBar\n};\n\n},{\"../../components/color\":75,\"../../components/drawing\":97,\"../../components/fx/helpers\":111,\"../../lib\":202,\"../../lib/svg_text_utils\":224,\"../../plots/cartesian/axes\":248,\"../../registry\":290,\"./attributes\":300,\"./constants\":302,\"./helpers\":306,\"./style\":314,\"./uniform_text\":316,\"d3\":9,\"fast-isnumeric\":11}],312:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nmodule.exports = function selectPoints(searchInfo, selectionTester) {\n var cd = searchInfo.cd;\n var xa = searchInfo.xaxis;\n var ya = searchInfo.yaxis;\n var trace = cd[0].trace;\n var isFunnel = (trace.type === 'funnel');\n var isHorizontal = (trace.orientation === 'h');\n var selection = [];\n var i;\n\n if(selectionTester === false) {\n // clear selection\n for(i = 0; i < cd.length; i++) {\n cd[i].selected = 0;\n }\n } else {\n for(i = 0; i < cd.length; i++) {\n var di = cd[i];\n var ct = 'ct' in di ? di.ct : getCentroid(di, xa, ya, isHorizontal, isFunnel);\n\n if(selectionTester.contains(ct, false, i, searchInfo)) {\n selection.push({\n pointNumber: i,\n x: xa.c2d(di.x),\n y: ya.c2d(di.y)\n });\n di.selected = 1;\n } else {\n di.selected = 0;\n }\n }\n }\n\n return selection;\n};\n\nfunction getCentroid(d, xa, ya, isHorizontal, isFunnel) {\n var x0 = xa.c2p(isHorizontal ? d.s0 : d.p0, true);\n var x1 = xa.c2p(isHorizontal ? d.s1 : d.p1, true);\n var y0 = ya.c2p(isHorizontal ? d.p0 : d.s0, true);\n var y1 = ya.c2p(isHorizontal ? d.p1 : d.s1, true);\n\n if(isFunnel) {\n return [(x0 + x1) / 2, (y0 + y1) / 2];\n } else {\n if(isHorizontal) {\n return [x1, (y0 + y1) / 2];\n } else {\n return [(x0 + x1) / 2, y1];\n }\n }\n}\n\n},{}],313:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nmodule.exports = Sieve;\n\nvar distinctVals = _dereq_('../../lib').distinctVals;\nvar BADNUM = _dereq_('../../constants/numerical').BADNUM;\n\n/**\n * Helper class to sieve data from traces into bins\n *\n * @class\n *\n * @param {Array} traces\n* Array of calculated traces\n * @param {object} opts\n * - @param {boolean} [sepNegVal]\n * If true, then split data at the same position into a bar\n * for positive values and another for negative values\n * - @param {boolean} [overlapNoMerge]\n * If true, then don't merge overlapping bars into a single bar\n */\nfunction Sieve(traces, opts) {\n this.traces = traces;\n this.sepNegVal = opts.sepNegVal;\n this.overlapNoMerge = opts.overlapNoMerge;\n\n // for single-bin histograms - see histogram/calc\n var width1 = Infinity;\n\n var positions = [];\n for(var i = 0; i < traces.length; i++) {\n var trace = traces[i];\n for(var j = 0; j < trace.length; j++) {\n var bar = trace[j];\n if(bar.p !== BADNUM) positions.push(bar.p);\n }\n if(trace[0] && trace[0].width1) {\n width1 = Math.min(trace[0].width1, width1);\n }\n }\n this.positions = positions;\n\n var dv = distinctVals(positions, {\n unitMinDiff: opts.unitMinDiff\n });\n\n this.distinctPositions = dv.vals;\n if(dv.vals.length === 1 && width1 !== Infinity) this.minDiff = width1;\n else this.minDiff = Math.min(dv.minDiff, width1);\n\n this.binWidth = this.minDiff;\n\n this.bins = {};\n}\n\n/**\n * Sieve datum\n *\n * @method\n * @param {number} position\n * @param {number} value\n * @returns {number} Previous bin value\n */\nSieve.prototype.put = function put(position, value) {\n var label = this.getLabel(position, value);\n var oldValue = this.bins[label] || 0;\n\n this.bins[label] = oldValue + value;\n\n return oldValue;\n};\n\n/**\n * Get current bin value for a given datum\n *\n * @method\n * @param {number} position Position of datum\n * @param {number} [value] Value of datum\n * (required if this.sepNegVal is true)\n * @returns {number} Current bin value\n */\nSieve.prototype.get = function get(position, value) {\n var label = this.getLabel(position, value);\n return this.bins[label] || 0;\n};\n\n/**\n * Get bin label for a given datum\n *\n * @method\n * @param {number} position Position of datum\n * @param {number} [value] Value of datum\n * (required if this.sepNegVal is true)\n * @returns {string} Bin label\n * (prefixed with a 'v' if value is negative and this.sepNegVal is\n * true; otherwise prefixed with '^')\n */\nSieve.prototype.getLabel = function getLabel(position, value) {\n var prefix = (value < 0 && this.sepNegVal) ? 'v' : '^';\n var label = (this.overlapNoMerge) ?\n position :\n Math.round(position / this.binWidth);\n return prefix + label;\n};\n\n},{\"../../constants/numerical\":181,\"../../lib\":202}],314:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar d3 = _dereq_('d3');\nvar Color = _dereq_('../../components/color');\nvar Drawing = _dereq_('../../components/drawing');\nvar Lib = _dereq_('../../lib');\nvar Registry = _dereq_('../../registry');\n\nvar resizeText = _dereq_('./uniform_text').resizeText;\nvar attributes = _dereq_('./attributes');\nvar attributeTextFont = attributes.textfont;\nvar attributeInsideTextFont = attributes.insidetextfont;\nvar attributeOutsideTextFont = attributes.outsidetextfont;\nvar helpers = _dereq_('./helpers');\n\nfunction style(gd) {\n var s = d3.select(gd).selectAll('g.barlayer').selectAll('g.trace');\n resizeText(gd, s, 'bar');\n\n var barcount = s.size();\n var fullLayout = gd._fullLayout;\n\n // trace styling\n s.style('opacity', function(d) { return d[0].trace.opacity; })\n\n // for gapless (either stacked or neighboring grouped) bars use\n // crispEdges to turn off antialiasing so an artificial gap\n // isn't introduced.\n .each(function(d) {\n if((fullLayout.barmode === 'stack' && barcount > 1) ||\n (fullLayout.bargap === 0 &&\n fullLayout.bargroupgap === 0 &&\n !d[0].trace.marker.line.width)) {\n d3.select(this).attr('shape-rendering', 'crispEdges');\n }\n });\n\n s.selectAll('g.points').each(function(d) {\n var sel = d3.select(this);\n var trace = d[0].trace;\n stylePoints(sel, trace, gd);\n });\n\n Registry.getComponentMethod('errorbars', 'style')(s);\n}\n\nfunction stylePoints(sel, trace, gd) {\n Drawing.pointStyle(sel.selectAll('path'), trace, gd);\n styleTextPoints(sel, trace, gd);\n}\n\nfunction styleTextPoints(sel, trace, gd) {\n sel.selectAll('text').each(function(d) {\n var tx = d3.select(this);\n var font = Lib.ensureUniformFontSize(gd, determineFont(tx, d, trace, gd));\n\n Drawing.font(tx, font);\n });\n}\n\nfunction styleOnSelect(gd, cd, sel) {\n var trace = cd[0].trace;\n\n if(trace.selectedpoints) {\n stylePointsInSelectionMode(sel, trace, gd);\n } else {\n stylePoints(sel, trace, gd);\n Registry.getComponentMethod('errorbars', 'style')(sel);\n }\n}\n\nfunction stylePointsInSelectionMode(s, trace, gd) {\n Drawing.selectedPointStyle(s.selectAll('path'), trace);\n styleTextInSelectionMode(s.selectAll('text'), trace, gd);\n}\n\nfunction styleTextInSelectionMode(txs, trace, gd) {\n txs.each(function(d) {\n var tx = d3.select(this);\n var font;\n\n if(d.selected) {\n font = Lib.ensureUniformFontSize(gd, determineFont(tx, d, trace, gd));\n\n var selectedFontColor = trace.selected.textfont && trace.selected.textfont.color;\n if(selectedFontColor) {\n font.color = selectedFontColor;\n }\n\n Drawing.font(tx, font);\n } else {\n Drawing.selectedTextStyle(tx, trace);\n }\n });\n}\n\nfunction determineFont(tx, d, trace, gd) {\n var layoutFont = gd._fullLayout.font;\n var textFont = trace.textfont;\n\n if(tx.classed('bartext-inside')) {\n var barColor = getBarColor(d, trace);\n textFont = getInsideTextFont(trace, d.i, layoutFont, barColor);\n } else if(tx.classed('bartext-outside')) {\n textFont = getOutsideTextFont(trace, d.i, layoutFont);\n }\n\n return textFont;\n}\n\nfunction getTextFont(trace, index, defaultValue) {\n return getFontValue(\n attributeTextFont, trace.textfont, index, defaultValue);\n}\n\nfunction getInsideTextFont(trace, index, layoutFont, barColor) {\n var defaultFont = getTextFont(trace, index, layoutFont);\n\n var wouldFallBackToLayoutFont =\n (trace._input.textfont === undefined || trace._input.textfont.color === undefined) ||\n (Array.isArray(trace.textfont.color) && trace.textfont.color[index] === undefined);\n if(wouldFallBackToLayoutFont) {\n defaultFont = {\n color: Color.contrast(barColor),\n family: defaultFont.family,\n size: defaultFont.size\n };\n }\n\n return getFontValue(\n attributeInsideTextFont, trace.insidetextfont, index, defaultFont);\n}\n\nfunction getOutsideTextFont(trace, index, layoutFont) {\n var defaultFont = getTextFont(trace, index, layoutFont);\n return getFontValue(\n attributeOutsideTextFont, trace.outsidetextfont, index, defaultFont);\n}\n\nfunction getFontValue(attributeDefinition, attributeValue, index, defaultValue) {\n attributeValue = attributeValue || {};\n\n var familyValue = helpers.getValue(attributeValue.family, index);\n var sizeValue = helpers.getValue(attributeValue.size, index);\n var colorValue = helpers.getValue(attributeValue.color, index);\n\n return {\n family: helpers.coerceString(\n attributeDefinition.family, familyValue, defaultValue.family),\n size: helpers.coerceNumber(\n attributeDefinition.size, sizeValue, defaultValue.size),\n color: helpers.coerceColor(\n attributeDefinition.color, colorValue, defaultValue.color)\n };\n}\n\nfunction getBarColor(cd, trace) {\n if(trace.type === 'waterfall') {\n return trace[cd.dir].marker.color;\n }\n return cd.mc || trace.marker.color;\n}\n\nmodule.exports = {\n style: style,\n styleTextPoints: styleTextPoints,\n styleOnSelect: styleOnSelect,\n getInsideTextFont: getInsideTextFont,\n getOutsideTextFont: getOutsideTextFont,\n getBarColor: getBarColor,\n resizeText: resizeText\n};\n\n},{\"../../components/color\":75,\"../../components/drawing\":97,\"../../lib\":202,\"../../registry\":290,\"./attributes\":300,\"./helpers\":306,\"./uniform_text\":316,\"d3\":9}],315:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar Color = _dereq_('../../components/color');\nvar hasColorscale = _dereq_('../../components/colorscale/helpers').hasColorscale;\nvar colorscaleDefaults = _dereq_('../../components/colorscale/defaults');\n\nmodule.exports = function handleStyleDefaults(traceIn, traceOut, coerce, defaultColor, layout) {\n coerce('marker.color', defaultColor);\n\n if(hasColorscale(traceIn, 'marker')) {\n colorscaleDefaults(\n traceIn, traceOut, layout, coerce, {prefix: 'marker.', cLetter: 'c'}\n );\n }\n\n coerce('marker.line.color', Color.defaultLine);\n\n if(hasColorscale(traceIn, 'marker.line')) {\n colorscaleDefaults(\n traceIn, traceOut, layout, coerce, {prefix: 'marker.line.', cLetter: 'c'}\n );\n }\n\n coerce('marker.line.width');\n coerce('marker.opacity');\n coerce('selected.marker.color');\n coerce('unselected.marker.color');\n};\n\n},{\"../../components/color\":75,\"../../components/colorscale/defaults\":85,\"../../components/colorscale/helpers\":86}],316:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar d3 = _dereq_('d3');\nvar Lib = _dereq_('../../lib');\n\nfunction resizeText(gd, gTrace, traceType) {\n var fullLayout = gd._fullLayout;\n var minSize = fullLayout['_' + traceType + 'Text_minsize'];\n if(minSize) {\n var shouldHide = fullLayout.uniformtext.mode === 'hide';\n\n var selector;\n switch(traceType) {\n case 'funnelarea' :\n case 'pie' :\n case 'sunburst' :\n selector = 'g.slice';\n break;\n case 'treemap' :\n selector = 'g.slice, g.pathbar';\n break;\n default :\n selector = 'g.points > g.point';\n }\n\n gTrace.selectAll(selector).each(function(d) {\n var transform = d.transform;\n if(transform) {\n transform.scale = (shouldHide && transform.hide) ? 0 : minSize / transform.fontSize;\n\n var el = d3.select(this).select('text');\n el.attr('transform', Lib.getTextTransform(transform));\n }\n });\n }\n}\n\nfunction recordMinTextSize(\n traceType, // in\n transform, // inout\n fullLayout // inout\n) {\n if(fullLayout.uniformtext.mode) {\n var minKey = getMinKey(traceType);\n var minSize = fullLayout.uniformtext.minsize;\n var size = transform.scale * transform.fontSize;\n\n transform.hide = size < minSize;\n\n fullLayout[minKey] = fullLayout[minKey] || Infinity;\n if(!transform.hide) {\n fullLayout[minKey] = Math.min(\n fullLayout[minKey],\n Math.max(size, minSize)\n );\n }\n }\n}\n\nfunction clearMinTextSize(\n traceType, // in\n fullLayout // inout\n) {\n var minKey = getMinKey(traceType);\n fullLayout[minKey] = undefined;\n}\n\nfunction getMinKey(traceType) {\n return '_' + traceType + 'Text_minsize';\n}\n\nmodule.exports = {\n recordMinTextSize: recordMinTextSize,\n clearMinTextSize: clearMinTextSize,\n resizeText: resizeText\n};\n\n},{\"../../lib\":202,\"d3\":9}],317:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar baseAttrs = _dereq_('../../plots/attributes');\nvar domainAttrs = _dereq_('../../plots/domain').attributes;\nvar fontAttrs = _dereq_('../../plots/font_attributes');\nvar colorAttrs = _dereq_('../../components/color/attributes');\nvar hovertemplateAttrs = _dereq_('../../plots/template_attributes').hovertemplateAttrs;\nvar texttemplateAttrs = _dereq_('../../plots/template_attributes').texttemplateAttrs;\n\nvar extendFlat = _dereq_('../../lib/extend').extendFlat;\n\nvar textFontAttrs = fontAttrs({\n editType: 'plot',\n arrayOk: true,\n colorEditType: 'plot',\n \n});\n\nmodule.exports = {\n labels: {\n valType: 'data_array',\n editType: 'calc',\n \n },\n // equivalent of x0 and dx, if label is missing\n label0: {\n valType: 'number',\n \n dflt: 0,\n editType: 'calc',\n \n },\n dlabel: {\n valType: 'number',\n \n dflt: 1,\n editType: 'calc',\n \n },\n\n values: {\n valType: 'data_array',\n editType: 'calc',\n \n },\n\n marker: {\n colors: {\n valType: 'data_array', // TODO 'color_array' ?\n editType: 'calc',\n \n },\n\n line: {\n color: {\n valType: 'color',\n \n dflt: colorAttrs.defaultLine,\n arrayOk: true,\n editType: 'style',\n \n },\n width: {\n valType: 'number',\n \n min: 0,\n dflt: 0,\n arrayOk: true,\n editType: 'style',\n \n },\n editType: 'calc'\n },\n editType: 'calc'\n },\n\n text: {\n valType: 'data_array',\n editType: 'plot',\n \n },\n hovertext: {\n valType: 'string',\n \n dflt: '',\n arrayOk: true,\n editType: 'style',\n \n },\n\n// 'see eg:'\n// 'https://www.e-education.psu.edu/natureofgeoinfo/sites/www.e-education.psu.edu.natureofgeoinfo/files/image/hisp_pies.gif',\n// '(this example involves a map too - may someday be a whole trace type',\n// 'of its own. but the point is the size of the whole pie is important.)'\n scalegroup: {\n valType: 'string',\n \n dflt: '',\n editType: 'calc',\n \n },\n\n // labels (legend is handled by plots.attributes.showlegend and layout.hiddenlabels)\n textinfo: {\n valType: 'flaglist',\n \n flags: ['label', 'text', 'value', 'percent'],\n extras: ['none'],\n editType: 'calc',\n \n },\n hoverinfo: extendFlat({}, baseAttrs.hoverinfo, {\n flags: ['label', 'text', 'value', 'percent', 'name']\n }),\n hovertemplate: hovertemplateAttrs({}, {\n keys: ['label', 'color', 'value', 'percent', 'text']\n }),\n texttemplate: texttemplateAttrs({editType: 'plot'}, {\n keys: ['label', 'color', 'value', 'percent', 'text']\n }),\n textposition: {\n valType: 'enumerated',\n \n values: ['inside', 'outside', 'auto', 'none'],\n dflt: 'auto',\n arrayOk: true,\n editType: 'plot',\n \n },\n textfont: extendFlat({}, textFontAttrs, {\n \n }),\n insidetextorientation: {\n valType: 'enumerated',\n \n values: ['horizontal', 'radial', 'tangential', 'auto'],\n dflt: 'auto',\n editType: 'plot',\n \n },\n insidetextfont: extendFlat({}, textFontAttrs, {\n \n }),\n outsidetextfont: extendFlat({}, textFontAttrs, {\n \n }),\n automargin: {\n valType: 'boolean',\n dflt: false,\n \n editType: 'plot',\n \n },\n\n title: {\n text: {\n valType: 'string',\n dflt: '',\n \n editType: 'plot',\n \n },\n font: extendFlat({}, textFontAttrs, {\n \n }),\n position: {\n valType: 'enumerated',\n values: [\n 'top left', 'top center', 'top right',\n 'middle center',\n 'bottom left', 'bottom center', 'bottom right'\n ],\n \n editType: 'plot',\n \n },\n\n editType: 'plot'\n },\n\n // position and shape\n domain: domainAttrs({name: 'pie', trace: true, editType: 'calc'}),\n\n hole: {\n valType: 'number',\n \n min: 0,\n max: 1,\n dflt: 0,\n editType: 'calc',\n \n },\n\n // ordering and direction\n sort: {\n valType: 'boolean',\n \n dflt: true,\n editType: 'calc',\n \n },\n direction: {\n /**\n * there are two common conventions, both of which place the first\n * (largest, if sorted) slice with its left edge at 12 o'clock but\n * succeeding slices follow either cw or ccw from there.\n *\n * see http://visage.co/data-visualization-101-pie-charts/\n */\n valType: 'enumerated',\n values: ['clockwise', 'counterclockwise'],\n \n dflt: 'counterclockwise',\n editType: 'calc',\n \n },\n rotation: {\n valType: 'number',\n \n min: -360,\n max: 360,\n dflt: 0,\n editType: 'calc',\n \n },\n\n pull: {\n valType: 'number',\n \n min: 0,\n max: 1,\n dflt: 0,\n arrayOk: true,\n editType: 'calc',\n \n },\n\n _deprecated: {\n title: {\n valType: 'string',\n dflt: '',\n \n editType: 'calc',\n \n },\n titlefont: extendFlat({}, textFontAttrs, {\n \n }),\n titleposition: {\n valType: 'enumerated',\n values: [\n 'top left', 'top center', 'top right',\n 'middle center',\n 'bottom left', 'bottom center', 'bottom right'\n ],\n \n editType: 'calc',\n \n }\n }\n};\n\n},{\"../../components/color/attributes\":74,\"../../lib/extend\":196,\"../../plots/attributes\":244,\"../../plots/domain\":275,\"../../plots/font_attributes\":276,\"../../plots/template_attributes\":289}],318:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar plots = _dereq_('../../plots/plots');\n\nexports.name = 'pie';\n\nexports.plot = function(gd, traces, transitionOpts, makeOnCompleteCallback) {\n plots.plotBasePlot(exports.name, gd, traces, transitionOpts, makeOnCompleteCallback);\n};\n\nexports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) {\n plots.cleanBasePlot(exports.name, newFullData, newFullLayout, oldFullData, oldFullLayout);\n};\n\n},{\"../../plots/plots\":282}],319:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar isNumeric = _dereq_('fast-isnumeric');\nvar tinycolor = _dereq_('tinycolor2');\n\nvar Color = _dereq_('../../components/color');\n\nvar extendedColorWayList = {};\n\nfunction calc(gd, trace) {\n var cd = [];\n\n var fullLayout = gd._fullLayout;\n var hiddenLabels = fullLayout.hiddenlabels || [];\n\n var labels = trace.labels;\n var colors = trace.marker.colors || [];\n var vals = trace.values;\n var len = trace._length;\n var hasValues = trace._hasValues && len;\n\n var i, pt;\n\n if(trace.dlabel) {\n labels = new Array(len);\n for(i = 0; i < len; i++) {\n labels[i] = String(trace.label0 + i * trace.dlabel);\n }\n }\n\n var allThisTraceLabels = {};\n var pullColor = makePullColorFn(fullLayout['_' + trace.type + 'colormap']);\n var vTotal = 0;\n var isAggregated = false;\n\n for(i = 0; i < len; i++) {\n var v, label, hidden;\n if(hasValues) {\n v = vals[i];\n if(!isNumeric(v)) continue;\n v = +v;\n if(v < 0) continue;\n } else v = 1;\n\n label = labels[i];\n if(label === undefined || label === '') label = i;\n label = String(label);\n\n var thisLabelIndex = allThisTraceLabels[label];\n if(thisLabelIndex === undefined) {\n allThisTraceLabels[label] = cd.length;\n\n hidden = hiddenLabels.indexOf(label) !== -1;\n\n if(!hidden) vTotal += v;\n\n cd.push({\n v: v,\n label: label,\n color: pullColor(colors[i], label),\n i: i,\n pts: [i],\n hidden: hidden\n });\n } else {\n isAggregated = true;\n\n pt = cd[thisLabelIndex];\n pt.v += v;\n pt.pts.push(i);\n if(!pt.hidden) vTotal += v;\n\n if(pt.color === false && colors[i]) {\n pt.color = pullColor(colors[i], label);\n }\n }\n }\n\n var shouldSort = (trace.type === 'funnelarea') ? isAggregated : trace.sort;\n if(shouldSort) cd.sort(function(a, b) { return b.v - a.v; });\n\n // include the sum of all values in the first point\n if(cd[0]) cd[0].vTotal = vTotal;\n\n return cd;\n}\n\nfunction makePullColorFn(colorMap) {\n return function pullColor(color, id) {\n if(!color) return false;\n\n color = tinycolor(color);\n if(!color.isValid()) return false;\n\n color = Color.addOpacity(color, color.getAlpha());\n if(!colorMap[id]) colorMap[id] = color;\n\n return color;\n };\n}\n\n/*\n * `calc` filled in (and collated) explicit colors.\n * Now we need to propagate these explicit colors to other traces,\n * and fill in default colors.\n * This is done after sorting, so we pick defaults\n * in the order slices will be displayed\n */\nfunction crossTraceCalc(gd, plotinfo) { // TODO: should we name the second argument opts?\n var desiredType = (plotinfo || {}).type;\n if(!desiredType) desiredType = 'pie';\n\n var fullLayout = gd._fullLayout;\n var calcdata = gd.calcdata;\n var colorWay = fullLayout[desiredType + 'colorway'];\n var colorMap = fullLayout['_' + desiredType + 'colormap'];\n\n if(fullLayout['extend' + desiredType + 'colors']) {\n colorWay = generateExtendedColors(colorWay, extendedColorWayList);\n }\n var dfltColorCount = 0;\n\n for(var i = 0; i < calcdata.length; i++) {\n var cd = calcdata[i];\n var traceType = cd[0].trace.type;\n if(traceType !== desiredType) continue;\n\n for(var j = 0; j < cd.length; j++) {\n var pt = cd[j];\n if(pt.color === false) {\n // have we seen this label and assigned a color to it in a previous trace?\n if(colorMap[pt.label]) {\n pt.color = colorMap[pt.label];\n } else {\n colorMap[pt.label] = pt.color = colorWay[dfltColorCount % colorWay.length];\n dfltColorCount++;\n }\n }\n }\n }\n}\n\n/**\n * pick a default color from the main default set, augmented by\n * itself lighter then darker before repeating\n */\nfunction generateExtendedColors(colorList, extendedColorWays) {\n var i;\n var colorString = JSON.stringify(colorList);\n var colors = extendedColorWays[colorString];\n if(!colors) {\n colors = colorList.slice();\n\n for(i = 0; i < colorList.length; i++) {\n colors.push(tinycolor(colorList[i]).lighten(20).toHexString());\n }\n\n for(i = 0; i < colorList.length; i++) {\n colors.push(tinycolor(colorList[i]).darken(20).toHexString());\n }\n extendedColorWays[colorString] = colors;\n }\n\n return colors;\n}\n\nmodule.exports = {\n calc: calc,\n crossTraceCalc: crossTraceCalc,\n\n makePullColorFn: makePullColorFn,\n generateExtendedColors: generateExtendedColors\n};\n\n},{\"../../components/color\":75,\"fast-isnumeric\":11,\"tinycolor2\":58}],320:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar isNumeric = _dereq_('fast-isnumeric');\nvar Lib = _dereq_('../../lib');\nvar attributes = _dereq_('./attributes');\nvar handleDomainDefaults = _dereq_('../../plots/domain').defaults;\nvar handleText = _dereq_('../bar/defaults').handleText;\n\nfunction handleLabelsAndValues(labels, values) {\n var hasLabels = Array.isArray(labels);\n var hasValues = Lib.isArrayOrTypedArray(values);\n var len = Math.min(\n hasLabels ? labels.length : Infinity,\n hasValues ? values.length : Infinity\n );\n\n if(!isFinite(len)) len = 0;\n\n if(len && hasValues) {\n var hasPositive;\n for(var i = 0; i < len; i++) {\n var v = values[i];\n if(isNumeric(v) && v > 0) {\n hasPositive = true;\n break;\n }\n }\n if(!hasPositive) len = 0;\n }\n\n return {\n hasLabels: hasLabels,\n hasValues: hasValues,\n len: len\n };\n}\n\nfunction supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n\n var labels = coerce('labels');\n var values = coerce('values');\n\n var res = handleLabelsAndValues(labels, values);\n var len = res.len;\n traceOut._hasLabels = res.hasLabels;\n traceOut._hasValues = res.hasValues;\n\n if(!traceOut._hasLabels &&\n traceOut._hasValues\n ) {\n coerce('label0');\n coerce('dlabel');\n }\n\n if(!len) {\n traceOut.visible = false;\n return;\n }\n traceOut._length = len;\n\n var lineWidth = coerce('marker.line.width');\n if(lineWidth) coerce('marker.line.color');\n\n coerce('marker.colors');\n\n coerce('scalegroup');\n // TODO: hole needs to be coerced to the same value within a scaleegroup\n\n var textData = coerce('text');\n var textTemplate = coerce('texttemplate');\n var textInfo;\n if(!textTemplate) textInfo = coerce('textinfo', Array.isArray(textData) ? 'text+percent' : 'percent');\n\n coerce('hovertext');\n coerce('hovertemplate');\n\n if(textTemplate || (textInfo && textInfo !== 'none')) {\n var textposition = coerce('textposition');\n handleText(traceIn, traceOut, layout, coerce, textposition, {\n moduleHasSelected: false,\n moduleHasUnselected: false,\n moduleHasConstrain: false,\n moduleHasCliponaxis: false,\n moduleHasTextangle: false,\n moduleHasInsideanchor: false\n });\n\n var hasBoth = Array.isArray(textposition) || textposition === 'auto';\n var hasOutside = hasBoth || textposition === 'outside';\n if(hasOutside) {\n coerce('automargin');\n }\n\n if(textposition === 'inside' || textposition === 'auto' || Array.isArray(textposition)) {\n coerce('insidetextorientation');\n }\n }\n\n handleDomainDefaults(traceOut, layout, coerce);\n\n var hole = coerce('hole');\n var title = coerce('title.text');\n if(title) {\n var titlePosition = coerce('title.position', hole ? 'middle center' : 'top center');\n if(!hole && titlePosition === 'middle center') traceOut.title.position = 'top center';\n Lib.coerceFont(coerce, 'title.font', layout.font);\n }\n\n coerce('sort');\n coerce('direction');\n coerce('rotation');\n coerce('pull');\n}\n\nmodule.exports = {\n handleLabelsAndValues: handleLabelsAndValues,\n supplyDefaults: supplyDefaults\n};\n\n},{\"../../lib\":202,\"../../plots/domain\":275,\"../bar/defaults\":304,\"./attributes\":317,\"fast-isnumeric\":11}],321:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar appendArrayMultiPointValues = _dereq_('../../components/fx/helpers').appendArrayMultiPointValues;\n\n// Note: like other eventData routines, this creates the data for hover/unhover/click events\n// but it has a different API and goes through a totally different pathway.\n// So to ensure it doesn't get misused, it's not attached to the Pie module.\nmodule.exports = function eventData(pt, trace) {\n var out = {\n curveNumber: trace.index,\n pointNumbers: pt.pts,\n data: trace._input,\n fullData: trace,\n label: pt.label,\n color: pt.color,\n value: pt.v,\n percent: pt.percent,\n text: pt.text,\n\n // pt.v (and pt.i below) for backward compatibility\n v: pt.v\n };\n\n // Only include pointNumber if it's unambiguous\n if(pt.pts.length === 1) out.pointNumber = out.i = pt.pts[0];\n\n // Add extra data arrays to the output\n // notice that this is the multi-point version ('s' on the end!)\n // so added data will be arrays matching the pointNumbers array.\n appendArrayMultiPointValues(out, trace, pt.pts);\n\n // don't include obsolete fields in new funnelarea traces\n if(trace.type === 'funnelarea') {\n delete out.v;\n delete out.i;\n }\n\n return out;\n};\n\n},{\"../../components/fx/helpers\":111}],322:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar Lib = _dereq_('../../lib');\n\nfunction format(vRounded) {\n return (\n vRounded.indexOf('e') !== -1 ? vRounded.replace(/[.]?0+e/, 'e') :\n vRounded.indexOf('.') !== -1 ? vRounded.replace(/[.]?0+$/, '') :\n vRounded\n );\n}\n\nexports.formatPiePercent = function formatPiePercent(v, separators) {\n var vRounded = format((v * 100).toPrecision(3));\n return Lib.numSeparate(vRounded, separators) + '%';\n};\n\nexports.formatPieValue = function formatPieValue(v, separators) {\n var vRounded = format(v.toPrecision(10));\n return Lib.numSeparate(vRounded, separators);\n};\n\nexports.getFirstFilled = function getFirstFilled(array, indices) {\n if(!Array.isArray(array)) return;\n for(var i = 0; i < indices.length; i++) {\n var v = array[indices[i]];\n if(v || v === 0 || v === '') return v;\n }\n};\n\nexports.castOption = function castOption(item, indices) {\n if(Array.isArray(item)) return exports.getFirstFilled(item, indices);\n else if(item) return item;\n};\n\nexports.getRotationAngle = function(rotation) {\n return (rotation === 'auto' ? 0 : rotation) * Math.PI / 180;\n};\n\n},{\"../../lib\":202}],323:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nmodule.exports = {\n attributes: _dereq_('./attributes'),\n supplyDefaults: _dereq_('./defaults').supplyDefaults,\n supplyLayoutDefaults: _dereq_('./layout_defaults'),\n layoutAttributes: _dereq_('./layout_attributes'),\n\n calc: _dereq_('./calc').calc,\n crossTraceCalc: _dereq_('./calc').crossTraceCalc,\n\n plot: _dereq_('./plot').plot,\n style: _dereq_('./style'),\n styleOne: _dereq_('./style_one'),\n\n moduleType: 'trace',\n name: 'pie',\n basePlotModule: _dereq_('./base_plot'),\n categories: ['pie-like', 'pie', 'showLegend'],\n meta: {\n \n }\n};\n\n},{\"./attributes\":317,\"./base_plot\":318,\"./calc\":319,\"./defaults\":320,\"./layout_attributes\":324,\"./layout_defaults\":325,\"./plot\":326,\"./style\":327,\"./style_one\":328}],324:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nmodule.exports = {\n hiddenlabels: {\n valType: 'data_array',\n \n editType: 'calc',\n \n },\n piecolorway: {\n valType: 'colorlist',\n \n editType: 'calc',\n \n },\n extendpiecolors: {\n valType: 'boolean',\n dflt: true,\n \n editType: 'calc',\n \n }\n};\n\n},{}],325:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar Lib = _dereq_('../../lib');\n\nvar layoutAttributes = _dereq_('./layout_attributes');\n\nmodule.exports = function supplyLayoutDefaults(layoutIn, layoutOut) {\n function coerce(attr, dflt) {\n return Lib.coerce(layoutIn, layoutOut, layoutAttributes, attr, dflt);\n }\n\n coerce('hiddenlabels');\n coerce('piecolorway', layoutOut.colorway);\n coerce('extendpiecolors');\n};\n\n},{\"../../lib\":202,\"./layout_attributes\":324}],326:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar d3 = _dereq_('d3');\n\nvar Plots = _dereq_('../../plots/plots');\nvar Fx = _dereq_('../../components/fx');\nvar Color = _dereq_('../../components/color');\nvar Drawing = _dereq_('../../components/drawing');\nvar Lib = _dereq_('../../lib');\nvar strScale = Lib.strScale;\nvar strTranslate = Lib.strTranslate;\nvar svgTextUtils = _dereq_('../../lib/svg_text_utils');\nvar uniformText = _dereq_('../bar/uniform_text');\nvar recordMinTextSize = uniformText.recordMinTextSize;\nvar clearMinTextSize = uniformText.clearMinTextSize;\nvar TEXTPAD = _dereq_('../bar/constants').TEXTPAD;\n\nvar helpers = _dereq_('./helpers');\nvar eventData = _dereq_('./event_data');\nvar isValidTextValue = _dereq_('../../lib').isValidTextValue;\n\nfunction plot(gd, cdModule) {\n var fullLayout = gd._fullLayout;\n var gs = fullLayout._size;\n\n clearMinTextSize('pie', fullLayout);\n\n prerenderTitles(cdModule, gd);\n layoutAreas(cdModule, gs);\n\n var plotGroups = Lib.makeTraceGroups(fullLayout._pielayer, cdModule, 'trace').each(function(cd) {\n var plotGroup = d3.select(this);\n var cd0 = cd[0];\n var trace = cd0.trace;\n\n setCoords(cd);\n\n // TODO: miter might look better but can sometimes cause problems\n // maybe miter with a small-ish stroke-miterlimit?\n plotGroup.attr('stroke-linejoin', 'round');\n\n plotGroup.each(function() {\n var slices = d3.select(this).selectAll('g.slice').data(cd);\n\n slices.enter().append('g')\n .classed('slice', true);\n slices.exit().remove();\n\n var quadrants = [\n [[], []], // y<0: x<0, x>=0\n [[], []] // y>=0: x<0, x>=0\n ];\n var hasOutsideText = false;\n\n slices.each(function(pt, i) {\n if(pt.hidden) {\n d3.select(this).selectAll('path,g').remove();\n return;\n }\n\n // to have consistent event data compared to other traces\n pt.pointNumber = pt.i;\n pt.curveNumber = trace.index;\n\n quadrants[pt.pxmid[1] < 0 ? 0 : 1][pt.pxmid[0] < 0 ? 0 : 1].push(pt);\n\n var cx = cd0.cx;\n var cy = cd0.cy;\n var sliceTop = d3.select(this);\n var slicePath = sliceTop.selectAll('path.surface').data([pt]);\n\n slicePath.enter().append('path')\n .classed('surface', true)\n .style({'pointer-events': 'all'});\n\n sliceTop.call(attachFxHandlers, gd, cd);\n\n if(trace.pull) {\n var pull = +helpers.castOption(trace.pull, pt.pts) || 0;\n if(pull > 0) {\n cx += pull * pt.pxmid[0];\n cy += pull * pt.pxmid[1];\n }\n }\n\n pt.cxFinal = cx;\n pt.cyFinal = cy;\n\n function arc(start, finish, cw, scale) {\n var dx = scale * (finish[0] - start[0]);\n var dy = scale * (finish[1] - start[1]);\n\n return 'a' +\n (scale * cd0.r) + ',' + (scale * cd0.r) + ' 0 ' +\n pt.largeArc + (cw ? ' 1 ' : ' 0 ') + dx + ',' + dy;\n }\n\n var hole = trace.hole;\n if(pt.v === cd0.vTotal) { // 100% fails bcs arc start and end are identical\n var outerCircle = 'M' + (cx + pt.px0[0]) + ',' + (cy + pt.px0[1]) +\n arc(pt.px0, pt.pxmid, true, 1) +\n arc(pt.pxmid, pt.px0, true, 1) + 'Z';\n if(hole) {\n slicePath.attr('d',\n 'M' + (cx + hole * pt.px0[0]) + ',' + (cy + hole * pt.px0[1]) +\n arc(pt.px0, pt.pxmid, false, hole) +\n arc(pt.pxmid, pt.px0, false, hole) +\n 'Z' + outerCircle);\n } else slicePath.attr('d', outerCircle);\n } else {\n var outerArc = arc(pt.px0, pt.px1, true, 1);\n\n if(hole) {\n var rim = 1 - hole;\n slicePath.attr('d',\n 'M' + (cx + hole * pt.px1[0]) + ',' + (cy + hole * pt.px1[1]) +\n arc(pt.px1, pt.px0, false, hole) +\n 'l' + (rim * pt.px0[0]) + ',' + (rim * pt.px0[1]) +\n outerArc +\n 'Z');\n } else {\n slicePath.attr('d',\n 'M' + cx + ',' + cy +\n 'l' + pt.px0[0] + ',' + pt.px0[1] +\n outerArc +\n 'Z');\n }\n }\n\n // add text\n formatSliceLabel(gd, pt, cd0);\n var textPosition = helpers.castOption(trace.textposition, pt.pts);\n var sliceTextGroup = sliceTop.selectAll('g.slicetext')\n .data(pt.text && (textPosition !== 'none') ? [0] : []);\n\n sliceTextGroup.enter().append('g')\n .classed('slicetext', true);\n sliceTextGroup.exit().remove();\n\n sliceTextGroup.each(function() {\n var sliceText = Lib.ensureSingle(d3.select(this), 'text', '', function(s) {\n // prohibit tex interpretation until we can handle\n // tex and regular text together\n s.attr('data-notex', 1);\n });\n\n var font = Lib.ensureUniformFontSize(gd, textPosition === 'outside' ?\n determineOutsideTextFont(trace, pt, fullLayout.font) :\n determineInsideTextFont(trace, pt, fullLayout.font)\n );\n\n sliceText.text(pt.text)\n .attr({\n 'class': 'slicetext',\n transform: '',\n 'text-anchor': 'middle'\n })\n .call(Drawing.font, font)\n .call(svgTextUtils.convertToTspans, gd);\n\n // position the text relative to the slice\n var textBB = Drawing.bBox(sliceText.node());\n var transform;\n\n if(textPosition === 'outside') {\n transform = transformOutsideText(textBB, pt);\n } else {\n transform = transformInsideText(textBB, pt, cd0);\n if(textPosition === 'auto' && transform.scale < 1) {\n var newFont = Lib.ensureUniformFontSize(gd, trace.outsidetextfont);\n\n sliceText.call(Drawing.font, newFont);\n textBB = Drawing.bBox(sliceText.node());\n\n transform = transformOutsideText(textBB, pt);\n }\n }\n\n var textPosAngle = transform.textPosAngle;\n var textXY = textPosAngle === undefined ? pt.pxmid : getCoords(cd0.r, textPosAngle);\n transform.targetX = cx + textXY[0] * transform.rCenter + (transform.x || 0);\n transform.targetY = cy + textXY[1] * transform.rCenter + (transform.y || 0);\n computeTransform(transform, textBB);\n\n // save some stuff to use later ensure no labels overlap\n if(transform.outside) {\n var targetY = transform.targetY;\n pt.yLabelMin = targetY - textBB.height / 2;\n pt.yLabelMid = targetY;\n pt.yLabelMax = targetY + textBB.height / 2;\n pt.labelExtraX = 0;\n pt.labelExtraY = 0;\n hasOutsideText = true;\n }\n\n transform.fontSize = font.size;\n recordMinTextSize(trace.type, transform, fullLayout);\n cd[i].transform = transform;\n\n sliceText.attr('transform', Lib.getTextTransform(transform));\n });\n });\n\n // add the title\n var titleTextGroup = d3.select(this).selectAll('g.titletext')\n .data(trace.title.text ? [0] : []);\n\n titleTextGroup.enter().append('g')\n .classed('titletext', true);\n titleTextGroup.exit().remove();\n\n titleTextGroup.each(function() {\n var titleText = Lib.ensureSingle(d3.select(this), 'text', '', function(s) {\n // prohibit tex interpretation as above\n s.attr('data-notex', 1);\n });\n\n var txt = trace.title.text;\n if(trace._meta) {\n txt = Lib.templateString(txt, trace._meta);\n }\n\n titleText.text(txt)\n .attr({\n 'class': 'titletext',\n transform: '',\n 'text-anchor': 'middle',\n })\n .call(Drawing.font, trace.title.font)\n .call(svgTextUtils.convertToTspans, gd);\n\n var transform;\n\n if(trace.title.position === 'middle center') {\n transform = positionTitleInside(cd0);\n } else {\n transform = positionTitleOutside(cd0, gs);\n }\n\n titleText.attr('transform',\n strTranslate(transform.x, transform.y) +\n strScale(Math.min(1, transform.scale)) +\n strTranslate(transform.tx, transform.ty));\n });\n\n // now make sure no labels overlap (at least within one pie)\n if(hasOutsideText) scootLabels(quadrants, trace);\n\n plotTextLines(slices, trace);\n\n if(hasOutsideText && trace.automargin) {\n // TODO if we ever want to improve perf,\n // we could reuse the textBB computed above together\n // with the sliceText transform info\n var traceBbox = Drawing.bBox(plotGroup.node());\n\n var domain = trace.domain;\n var vpw = gs.w * (domain.x[1] - domain.x[0]);\n var vph = gs.h * (domain.y[1] - domain.y[0]);\n var xgap = (0.5 * vpw - cd0.r) / gs.w;\n var ygap = (0.5 * vph - cd0.r) / gs.h;\n\n Plots.autoMargin(gd, 'pie.' + trace.uid + '.automargin', {\n xl: domain.x[0] - xgap,\n xr: domain.x[1] + xgap,\n yb: domain.y[0] - ygap,\n yt: domain.y[1] + ygap,\n l: Math.max(cd0.cx - cd0.r - traceBbox.left, 0),\n r: Math.max(traceBbox.right - (cd0.cx + cd0.r), 0),\n b: Math.max(traceBbox.bottom - (cd0.cy + cd0.r), 0),\n t: Math.max(cd0.cy - cd0.r - traceBbox.top, 0),\n pad: 5\n });\n }\n });\n });\n\n // This is for a bug in Chrome (as of 2015-07-22, and does not affect FF)\n // if insidetextfont and outsidetextfont are different sizes, sometimes the size\n // of an \"em\" gets taken from the wrong element at first so lines are\n // spaced wrong. You just have to tell it to try again later and it gets fixed.\n // I have no idea why we haven't seen this in other contexts. Also, sometimes\n // it gets the initial draw correct but on redraw it gets confused.\n setTimeout(function() {\n plotGroups.selectAll('tspan').each(function() {\n var s = d3.select(this);\n if(s.attr('dy')) s.attr('dy', s.attr('dy'));\n });\n }, 0);\n}\n\n// TODO add support for transition\nfunction plotTextLines(slices, trace) {\n slices.each(function(pt) {\n var sliceTop = d3.select(this);\n\n if(!pt.labelExtraX && !pt.labelExtraY) {\n sliceTop.select('path.textline').remove();\n return;\n }\n\n // first move the text to its new location\n var sliceText = sliceTop.select('g.slicetext text');\n\n pt.transform.targetX += pt.labelExtraX;\n pt.transform.targetY += pt.labelExtraY;\n\n sliceText.attr('transform', Lib.getTextTransform(pt.transform));\n\n // then add a line to the new location\n var lineStartX = pt.cxFinal + pt.pxmid[0];\n var lineStartY = pt.cyFinal + pt.pxmid[1];\n var textLinePath = 'M' + lineStartX + ',' + lineStartY;\n var finalX = (pt.yLabelMax - pt.yLabelMin) * (pt.pxmid[0] < 0 ? -1 : 1) / 4;\n\n if(pt.labelExtraX) {\n var yFromX = pt.labelExtraX * pt.pxmid[1] / pt.pxmid[0];\n var yNet = pt.yLabelMid + pt.labelExtraY - (pt.cyFinal + pt.pxmid[1]);\n\n if(Math.abs(yFromX) > Math.abs(yNet)) {\n textLinePath +=\n 'l' + (yNet * pt.pxmid[0] / pt.pxmid[1]) + ',' + yNet +\n 'H' + (lineStartX + pt.labelExtraX + finalX);\n } else {\n textLinePath += 'l' + pt.labelExtraX + ',' + yFromX +\n 'v' + (yNet - yFromX) +\n 'h' + finalX;\n }\n } else {\n textLinePath +=\n 'V' + (pt.yLabelMid + pt.labelExtraY) +\n 'h' + finalX;\n }\n\n Lib.ensureSingle(sliceTop, 'path', 'textline')\n .call(Color.stroke, trace.outsidetextfont.color)\n .attr({\n 'stroke-width': Math.min(2, trace.outsidetextfont.size / 8),\n d: textLinePath,\n fill: 'none'\n });\n });\n}\n\nfunction attachFxHandlers(sliceTop, gd, cd) {\n var cd0 = cd[0];\n var trace = cd0.trace;\n var cx = cd0.cx;\n var cy = cd0.cy;\n\n // hover state vars\n // have we drawn a hover label, so it should be cleared later\n if(!('_hasHoverLabel' in trace)) trace._hasHoverLabel = false;\n // have we emitted a hover event, so later an unhover event should be emitted\n // note that click events do not depend on this - you can still get them\n // with hovermode: false or if you were earlier dragging, then clicked\n // in the same slice that you moused up in\n if(!('_hasHoverEvent' in trace)) trace._hasHoverEvent = false;\n\n sliceTop.on('mouseover', function(pt) {\n // in case fullLayout or fullData has changed without a replot\n var fullLayout2 = gd._fullLayout;\n var trace2 = gd._fullData[trace.index];\n\n if(gd._dragging || fullLayout2.hovermode === false) return;\n\n var hoverinfo = trace2.hoverinfo;\n if(Array.isArray(hoverinfo)) {\n // super hacky: we need to pull out the *first* hoverinfo from\n // pt.pts, then put it back into an array in a dummy trace\n // and call castHoverinfo on that.\n // TODO: do we want to have Fx.castHoverinfo somehow handle this?\n // it already takes an array for index, for 2D, so this seems tricky.\n hoverinfo = Fx.castHoverinfo({\n hoverinfo: [helpers.castOption(hoverinfo, pt.pts)],\n _module: trace._module\n }, fullLayout2, 0);\n }\n\n if(hoverinfo === 'all') hoverinfo = 'label+text+value+percent+name';\n\n // in case we dragged over the pie from another subplot,\n // or if hover is turned off\n if(trace2.hovertemplate || (hoverinfo !== 'none' && hoverinfo !== 'skip' && hoverinfo)) {\n var rInscribed = pt.rInscribed || 0;\n var hoverCenterX = cx + pt.pxmid[0] * (1 - rInscribed);\n var hoverCenterY = cy + pt.pxmid[1] * (1 - rInscribed);\n var separators = fullLayout2.separators;\n var text = [];\n\n if(hoverinfo && hoverinfo.indexOf('label') !== -1) text.push(pt.label);\n pt.text = helpers.castOption(trace2.hovertext || trace2.text, pt.pts);\n if(hoverinfo && hoverinfo.indexOf('text') !== -1) {\n var tx = pt.text;\n if(Lib.isValidTextValue(tx)) text.push(tx);\n }\n pt.value = pt.v;\n pt.valueLabel = helpers.formatPieValue(pt.v, separators);\n if(hoverinfo && hoverinfo.indexOf('value') !== -1) text.push(pt.valueLabel);\n pt.percent = pt.v / cd0.vTotal;\n pt.percentLabel = helpers.formatPiePercent(pt.percent, separators);\n if(hoverinfo && hoverinfo.indexOf('percent') !== -1) text.push(pt.percentLabel);\n\n var hoverLabel = trace2.hoverlabel;\n var hoverFont = hoverLabel.font;\n\n Fx.loneHover({\n trace: trace,\n x0: hoverCenterX - rInscribed * cd0.r,\n x1: hoverCenterX + rInscribed * cd0.r,\n y: hoverCenterY,\n text: text.join('
'),\n name: (trace2.hovertemplate || hoverinfo.indexOf('name') !== -1) ? trace2.name : undefined,\n idealAlign: pt.pxmid[0] < 0 ? 'left' : 'right',\n color: helpers.castOption(hoverLabel.bgcolor, pt.pts) || pt.color,\n borderColor: helpers.castOption(hoverLabel.bordercolor, pt.pts),\n fontFamily: helpers.castOption(hoverFont.family, pt.pts),\n fontSize: helpers.castOption(hoverFont.size, pt.pts),\n fontColor: helpers.castOption(hoverFont.color, pt.pts),\n nameLength: helpers.castOption(hoverLabel.namelength, pt.pts),\n textAlign: helpers.castOption(hoverLabel.align, pt.pts),\n hovertemplate: helpers.castOption(trace2.hovertemplate, pt.pts),\n hovertemplateLabels: pt,\n eventData: [eventData(pt, trace2)]\n }, {\n container: fullLayout2._hoverlayer.node(),\n outerContainer: fullLayout2._paper.node(),\n gd: gd\n });\n\n trace._hasHoverLabel = true;\n }\n\n trace._hasHoverEvent = true;\n gd.emit('plotly_hover', {\n points: [eventData(pt, trace2)],\n event: d3.event\n });\n });\n\n sliceTop.on('mouseout', function(evt) {\n var fullLayout2 = gd._fullLayout;\n var trace2 = gd._fullData[trace.index];\n var pt = d3.select(this).datum();\n\n if(trace._hasHoverEvent) {\n evt.originalEvent = d3.event;\n gd.emit('plotly_unhover', {\n points: [eventData(pt, trace2)],\n event: d3.event\n });\n trace._hasHoverEvent = false;\n }\n\n if(trace._hasHoverLabel) {\n Fx.loneUnhover(fullLayout2._hoverlayer.node());\n trace._hasHoverLabel = false;\n }\n });\n\n sliceTop.on('click', function(pt) {\n // TODO: this does not support right-click. If we want to support it, we\n // would likely need to change pie to use dragElement instead of straight\n // mapbox event binding. Or perhaps better, make a simple wrapper with the\n // right mousedown, mousemove, and mouseup handlers just for a left/right click\n // mapbox would use this too.\n var fullLayout2 = gd._fullLayout;\n var trace2 = gd._fullData[trace.index];\n\n if(gd._dragging || fullLayout2.hovermode === false) return;\n\n gd._hoverdata = [eventData(pt, trace2)];\n Fx.click(gd, d3.event);\n });\n}\n\nfunction determineOutsideTextFont(trace, pt, layoutFont) {\n var color =\n helpers.castOption(trace.outsidetextfont.color, pt.pts) ||\n helpers.castOption(trace.textfont.color, pt.pts) ||\n layoutFont.color;\n\n var family =\n helpers.castOption(trace.outsidetextfont.family, pt.pts) ||\n helpers.castOption(trace.textfont.family, pt.pts) ||\n layoutFont.family;\n\n var size =\n helpers.castOption(trace.outsidetextfont.size, pt.pts) ||\n helpers.castOption(trace.textfont.size, pt.pts) ||\n layoutFont.size;\n\n return {\n color: color,\n family: family,\n size: size\n };\n}\n\nfunction determineInsideTextFont(trace, pt, layoutFont) {\n var customColor = helpers.castOption(trace.insidetextfont.color, pt.pts);\n if(!customColor && trace._input.textfont) {\n // Why not simply using trace.textfont? Because if not set, it\n // defaults to layout.font which has a default color. But if\n // textfont.color and insidetextfont.color don't supply a value,\n // a contrasting color shall be used.\n customColor = helpers.castOption(trace._input.textfont.color, pt.pts);\n }\n\n var family =\n helpers.castOption(trace.insidetextfont.family, pt.pts) ||\n helpers.castOption(trace.textfont.family, pt.pts) ||\n layoutFont.family;\n\n var size =\n helpers.castOption(trace.insidetextfont.size, pt.pts) ||\n helpers.castOption(trace.textfont.size, pt.pts) ||\n layoutFont.size;\n\n return {\n color: customColor || Color.contrast(pt.color),\n family: family,\n size: size\n };\n}\n\nfunction prerenderTitles(cdModule, gd) {\n var cd0, trace;\n\n // Determine the width and height of the title for each pie.\n for(var i = 0; i < cdModule.length; i++) {\n cd0 = cdModule[i][0];\n trace = cd0.trace;\n\n if(trace.title.text) {\n var txt = trace.title.text;\n if(trace._meta) {\n txt = Lib.templateString(txt, trace._meta);\n }\n\n var dummyTitle = Drawing.tester.append('text')\n .attr('data-notex', 1)\n .text(txt)\n .call(Drawing.font, trace.title.font)\n .call(svgTextUtils.convertToTspans, gd);\n var bBox = Drawing.bBox(dummyTitle.node(), true);\n cd0.titleBox = {\n width: bBox.width,\n height: bBox.height,\n };\n dummyTitle.remove();\n }\n }\n}\n\nfunction transformInsideText(textBB, pt, cd0) {\n var r = cd0.r || pt.rpx1;\n var rInscribed = pt.rInscribed;\n\n var isEmpty = pt.startangle === pt.stopangle;\n if(isEmpty) {\n return {\n rCenter: 1 - rInscribed,\n scale: 0,\n rotate: 0,\n textPosAngle: 0\n };\n }\n\n var ring = pt.ring;\n var isCircle = (ring === 1) && (Math.abs(pt.startangle - pt.stopangle) === Math.PI * 2);\n\n var halfAngle = pt.halfangle;\n var midAngle = pt.midangle;\n\n var orientation = cd0.trace.insidetextorientation;\n var isHorizontal = orientation === 'horizontal';\n var isTangential = orientation === 'tangential';\n var isRadial = orientation === 'radial';\n var isAuto = orientation === 'auto';\n\n var allTransforms = [];\n var newT;\n\n if(!isAuto) {\n // max size if text is placed (horizontally) at the top or bottom of the arc\n\n var considerCrossing = function(angle, key) {\n if(isCrossing(pt, angle)) {\n var dStart = Math.abs(angle - pt.startangle);\n var dStop = Math.abs(angle - pt.stopangle);\n\n var closestEdge = dStart < dStop ? dStart : dStop;\n\n if(key === 'tan') {\n newT = calcTanTransform(textBB, r, ring, closestEdge, 0);\n } else { // case of 'rad'\n newT = calcRadTransform(textBB, r, ring, closestEdge, Math.PI / 2);\n }\n newT.textPosAngle = angle;\n\n allTransforms.push(newT);\n }\n };\n\n // to cover all cases with trace.rotation added\n var i;\n if(isHorizontal || isTangential) {\n // top\n for(i = 4; i >= -4; i -= 2) considerCrossing(Math.PI * i, 'tan');\n // bottom\n for(i = 4; i >= -4; i -= 2) considerCrossing(Math.PI * (i + 1), 'tan');\n }\n if(isHorizontal || isRadial) {\n // left\n for(i = 4; i >= -4; i -= 2) considerCrossing(Math.PI * (i + 1.5), 'rad');\n // right\n for(i = 4; i >= -4; i -= 2) considerCrossing(Math.PI * (i + 0.5), 'rad');\n }\n }\n\n if(isCircle || isAuto || isHorizontal) {\n // max size text can be inserted inside without rotating it\n // this inscribes the text rectangle in a circle, which is then inscribed\n // in the slice, so it will be an underestimate, which some day we may want\n // to improve so this case can get more use\n var textDiameter = Math.sqrt(textBB.width * textBB.width + textBB.height * textBB.height);\n\n newT = {\n scale: rInscribed * r * 2 / textDiameter,\n\n // and the center position and rotation in this case\n rCenter: 1 - rInscribed,\n rotate: 0\n };\n\n newT.textPosAngle = (pt.startangle + pt.stopangle) / 2;\n if(newT.scale >= 1) return newT;\n\n allTransforms.push(newT);\n }\n\n if(isAuto || isRadial) {\n newT = calcRadTransform(textBB, r, ring, halfAngle, midAngle);\n newT.textPosAngle = (pt.startangle + pt.stopangle) / 2;\n allTransforms.push(newT);\n }\n\n if(isAuto || isTangential) {\n newT = calcTanTransform(textBB, r, ring, halfAngle, midAngle);\n newT.textPosAngle = (pt.startangle + pt.stopangle) / 2;\n allTransforms.push(newT);\n }\n\n var id = 0;\n var maxScale = 0;\n for(var k = 0; k < allTransforms.length; k++) {\n var s = allTransforms[k].scale;\n if(maxScale < s) {\n maxScale = s;\n id = k;\n }\n\n if(!isAuto && maxScale >= 1) {\n // respect test order for non-auto options\n break;\n }\n }\n return allTransforms[id];\n}\n\nfunction isCrossing(pt, angle) {\n var start = pt.startangle;\n var stop = pt.stopangle;\n return (\n (start > angle && angle > stop) ||\n (start < angle && angle < stop)\n );\n}\n\nfunction calcRadTransform(textBB, r, ring, halfAngle, midAngle) {\n r = Math.max(0, r - 2 * TEXTPAD);\n\n // max size if text is rotated radially\n var a = textBB.width / textBB.height;\n var s = calcMaxHalfSize(a, halfAngle, r, ring);\n return {\n scale: s * 2 / textBB.height,\n rCenter: calcRCenter(a, s / r),\n rotate: calcRotate(midAngle)\n };\n}\n\nfunction calcTanTransform(textBB, r, ring, halfAngle, midAngle) {\n r = Math.max(0, r - 2 * TEXTPAD);\n\n // max size if text is rotated tangentially\n var a = textBB.height / textBB.width;\n var s = calcMaxHalfSize(a, halfAngle, r, ring);\n return {\n scale: s * 2 / textBB.width,\n rCenter: calcRCenter(a, s / r),\n rotate: calcRotate(midAngle + Math.PI / 2)\n };\n}\n\nfunction calcRCenter(a, b) {\n return Math.cos(b) - a * b;\n}\n\nfunction calcRotate(t) {\n return (180 / Math.PI * t + 720) % 180 - 90;\n}\n\nfunction calcMaxHalfSize(a, halfAngle, r, ring) {\n var q = a + 1 / (2 * Math.tan(halfAngle));\n return r * Math.min(\n 1 / (Math.sqrt(q * q + 0.5) + q),\n ring / (Math.sqrt(a * a + ring / 2) + a)\n );\n}\n\nfunction getInscribedRadiusFraction(pt, cd0) {\n if(pt.v === cd0.vTotal && !cd0.trace.hole) return 1;// special case of 100% with no hole\n\n return Math.min(1 / (1 + 1 / Math.sin(pt.halfangle)), pt.ring / 2);\n}\n\nfunction transformOutsideText(textBB, pt) {\n var x = pt.pxmid[0];\n var y = pt.pxmid[1];\n var dx = textBB.width / 2;\n var dy = textBB.height / 2;\n\n if(x < 0) dx *= -1;\n if(y < 0) dy *= -1;\n\n return {\n scale: 1,\n rCenter: 1,\n rotate: 0,\n x: dx + Math.abs(dy) * (dx > 0 ? 1 : -1) / 2,\n y: dy / (1 + x * x / (y * y)),\n outside: true\n };\n}\n\nfunction positionTitleInside(cd0) {\n var textDiameter =\n Math.sqrt(cd0.titleBox.width * cd0.titleBox.width + cd0.titleBox.height * cd0.titleBox.height);\n return {\n x: cd0.cx,\n y: cd0.cy,\n scale: cd0.trace.hole * cd0.r * 2 / textDiameter,\n tx: 0,\n ty: - cd0.titleBox.height / 2 + cd0.trace.title.font.size\n };\n}\n\nfunction positionTitleOutside(cd0, plotSize) {\n var scaleX = 1;\n var scaleY = 1;\n var maxPull;\n\n var trace = cd0.trace;\n // position of the baseline point of the text box in the plot, before scaling.\n // we anchored the text in the middle, so the baseline is on the bottom middle\n // of the first line of text.\n var topMiddle = {\n x: cd0.cx,\n y: cd0.cy\n };\n // relative translation of the text box after scaling\n var translate = {\n tx: 0,\n ty: 0\n };\n\n // we reason below as if the baseline is the top middle point of the text box.\n // so we must add the font size to approximate the y-coord. of the top.\n // note that this correction must happen after scaling.\n translate.ty += trace.title.font.size;\n maxPull = getMaxPull(trace);\n\n if(trace.title.position.indexOf('top') !== -1) {\n topMiddle.y -= (1 + maxPull) * cd0.r;\n translate.ty -= cd0.titleBox.height;\n } else if(trace.title.position.indexOf('bottom') !== -1) {\n topMiddle.y += (1 + maxPull) * cd0.r;\n }\n\n var rx = applyAspectRatio(cd0.r, cd0.trace.aspectratio);\n\n var maxWidth = plotSize.w * (trace.domain.x[1] - trace.domain.x[0]) / 2;\n if(trace.title.position.indexOf('left') !== -1) {\n // we start the text at the left edge of the pie\n maxWidth = maxWidth + rx;\n topMiddle.x -= (1 + maxPull) * rx;\n translate.tx += cd0.titleBox.width / 2;\n } else if(trace.title.position.indexOf('center') !== -1) {\n maxWidth *= 2;\n } else if(trace.title.position.indexOf('right') !== -1) {\n maxWidth = maxWidth + rx;\n topMiddle.x += (1 + maxPull) * rx;\n translate.tx -= cd0.titleBox.width / 2;\n }\n scaleX = maxWidth / cd0.titleBox.width;\n scaleY = getTitleSpace(cd0, plotSize) / cd0.titleBox.height;\n return {\n x: topMiddle.x,\n y: topMiddle.y,\n scale: Math.min(scaleX, scaleY),\n tx: translate.tx,\n ty: translate.ty\n };\n}\n\nfunction applyAspectRatio(x, aspectratio) {\n return x / ((aspectratio === undefined) ? 1 : aspectratio);\n}\n\nfunction getTitleSpace(cd0, plotSize) {\n var trace = cd0.trace;\n var pieBoxHeight = plotSize.h * (trace.domain.y[1] - trace.domain.y[0]);\n // use at most half of the plot for the title\n return Math.min(cd0.titleBox.height, pieBoxHeight / 2);\n}\n\nfunction getMaxPull(trace) {\n var maxPull = trace.pull;\n if(!maxPull) return 0;\n\n var j;\n if(Array.isArray(maxPull)) {\n maxPull = 0;\n for(j = 0; j < trace.pull.length; j++) {\n if(trace.pull[j] > maxPull) maxPull = trace.pull[j];\n }\n }\n return maxPull;\n}\n\nfunction scootLabels(quadrants, trace) {\n var xHalf, yHalf, equatorFirst, farthestX, farthestY,\n xDiffSign, yDiffSign, thisQuad, oppositeQuad,\n wholeSide, i, thisQuadOutside, firstOppositeOutsidePt;\n\n function topFirst(a, b) { return a.pxmid[1] - b.pxmid[1]; }\n function bottomFirst(a, b) { return b.pxmid[1] - a.pxmid[1]; }\n\n function scootOneLabel(thisPt, prevPt) {\n if(!prevPt) prevPt = {};\n\n var prevOuterY = prevPt.labelExtraY + (yHalf ? prevPt.yLabelMax : prevPt.yLabelMin);\n var thisInnerY = yHalf ? thisPt.yLabelMin : thisPt.yLabelMax;\n var thisOuterY = yHalf ? thisPt.yLabelMax : thisPt.yLabelMin;\n var thisSliceOuterY = thisPt.cyFinal + farthestY(thisPt.px0[1], thisPt.px1[1]);\n var newExtraY = prevOuterY - thisInnerY;\n\n var xBuffer, i, otherPt, otherOuterY, otherOuterX, newExtraX;\n\n // make sure this label doesn't overlap other labels\n // this *only* has us move these labels vertically\n if(newExtraY * yDiffSign > 0) thisPt.labelExtraY = newExtraY;\n\n // make sure this label doesn't overlap any slices\n if(!Array.isArray(trace.pull)) return; // this can only happen with array pulls\n\n for(i = 0; i < wholeSide.length; i++) {\n otherPt = wholeSide[i];\n\n // overlap can only happen if the other point is pulled more than this one\n if(otherPt === thisPt || (\n (helpers.castOption(trace.pull, thisPt.pts) || 0) >=\n (helpers.castOption(trace.pull, otherPt.pts) || 0))\n ) {\n continue;\n }\n\n if((thisPt.pxmid[1] - otherPt.pxmid[1]) * yDiffSign > 0) {\n // closer to the equator - by construction all of these happen first\n // move the text vertically to get away from these slices\n otherOuterY = otherPt.cyFinal + farthestY(otherPt.px0[1], otherPt.px1[1]);\n newExtraY = otherOuterY - thisInnerY - thisPt.labelExtraY;\n\n if(newExtraY * yDiffSign > 0) thisPt.labelExtraY += newExtraY;\n } else if((thisOuterY + thisPt.labelExtraY - thisSliceOuterY) * yDiffSign > 0) {\n // farther from the equator - happens after we've done all the\n // vertical moving we're going to do\n // move horizontally to get away from these more polar slices\n\n // if we're moving horz. based on a slice that's several slices away from this one\n // then we need some extra space for the lines to labels between them\n xBuffer = 3 * xDiffSign * Math.abs(i - wholeSide.indexOf(thisPt));\n\n otherOuterX = otherPt.cxFinal + farthestX(otherPt.px0[0], otherPt.px1[0]);\n newExtraX = otherOuterX + xBuffer - (thisPt.cxFinal + thisPt.pxmid[0]) - thisPt.labelExtraX;\n\n if(newExtraX * xDiffSign > 0) thisPt.labelExtraX += newExtraX;\n }\n }\n }\n\n for(yHalf = 0; yHalf < 2; yHalf++) {\n equatorFirst = yHalf ? topFirst : bottomFirst;\n farthestY = yHalf ? Math.max : Math.min;\n yDiffSign = yHalf ? 1 : -1;\n\n for(xHalf = 0; xHalf < 2; xHalf++) {\n farthestX = xHalf ? Math.max : Math.min;\n xDiffSign = xHalf ? 1 : -1;\n\n // first sort the array\n // note this is a copy of cd, so cd itself doesn't get sorted\n // but we can still modify points in place.\n thisQuad = quadrants[yHalf][xHalf];\n thisQuad.sort(equatorFirst);\n\n oppositeQuad = quadrants[1 - yHalf][xHalf];\n wholeSide = oppositeQuad.concat(thisQuad);\n\n thisQuadOutside = [];\n for(i = 0; i < thisQuad.length; i++) {\n if(thisQuad[i].yLabelMid !== undefined) thisQuadOutside.push(thisQuad[i]);\n }\n\n firstOppositeOutsidePt = false;\n for(i = 0; yHalf && i < oppositeQuad.length; i++) {\n if(oppositeQuad[i].yLabelMid !== undefined) {\n firstOppositeOutsidePt = oppositeQuad[i];\n break;\n }\n }\n\n // each needs to avoid the previous\n for(i = 0; i < thisQuadOutside.length; i++) {\n var prevPt = i && thisQuadOutside[i - 1];\n // bottom half needs to avoid the first label of the top half\n // top half we still need to call scootOneLabel on the first slice\n // so we can avoid other slices, but we don't pass a prevPt\n if(firstOppositeOutsidePt && !i) prevPt = firstOppositeOutsidePt;\n scootOneLabel(thisQuadOutside[i], prevPt);\n }\n }\n }\n}\n\nfunction layoutAreas(cdModule, plotSize) {\n var scaleGroups = [];\n\n // figure out the center and maximum radius\n for(var i = 0; i < cdModule.length; i++) {\n var cd0 = cdModule[i][0];\n var trace = cd0.trace;\n\n var domain = trace.domain;\n var width = plotSize.w * (domain.x[1] - domain.x[0]);\n var height = plotSize.h * (domain.y[1] - domain.y[0]);\n // leave some space for the title, if it will be displayed outside\n if(trace.title.text && trace.title.position !== 'middle center') {\n height -= getTitleSpace(cd0, plotSize);\n }\n\n var rx = width / 2;\n var ry = height / 2;\n if(trace.type === 'funnelarea' && !trace.scalegroup) {\n ry /= trace.aspectratio;\n }\n\n cd0.r = Math.min(rx, ry) / (1 + getMaxPull(trace));\n\n cd0.cx = plotSize.l + plotSize.w * (trace.domain.x[1] + trace.domain.x[0]) / 2;\n cd0.cy = plotSize.t + plotSize.h * (1 - trace.domain.y[0]) - height / 2;\n if(trace.title.text && trace.title.position.indexOf('bottom') !== -1) {\n cd0.cy -= getTitleSpace(cd0, plotSize);\n }\n\n if(trace.scalegroup && scaleGroups.indexOf(trace.scalegroup) === -1) {\n scaleGroups.push(trace.scalegroup);\n }\n }\n\n groupScale(cdModule, scaleGroups);\n}\n\nfunction groupScale(cdModule, scaleGroups) {\n var cd0, i, trace;\n\n // scale those that are grouped\n for(var k = 0; k < scaleGroups.length; k++) {\n var min = Infinity;\n var g = scaleGroups[k];\n\n for(i = 0; i < cdModule.length; i++) {\n cd0 = cdModule[i][0];\n trace = cd0.trace;\n\n if(trace.scalegroup === g) {\n var area;\n if(trace.type === 'pie') {\n area = cd0.r * cd0.r;\n } else if(trace.type === 'funnelarea') {\n var rx, ry;\n\n if(trace.aspectratio > 1) {\n rx = cd0.r;\n ry = rx / trace.aspectratio;\n } else {\n ry = cd0.r;\n rx = ry * trace.aspectratio;\n }\n\n rx *= (1 + trace.baseratio) / 2;\n\n area = rx * ry;\n }\n\n min = Math.min(min, area / cd0.vTotal);\n }\n }\n\n for(i = 0; i < cdModule.length; i++) {\n cd0 = cdModule[i][0];\n trace = cd0.trace;\n if(trace.scalegroup === g) {\n var v = min * cd0.vTotal;\n if(trace.type === 'funnelarea') {\n v /= (1 + trace.baseratio) / 2;\n v /= trace.aspectratio;\n }\n\n cd0.r = Math.sqrt(v);\n }\n }\n }\n}\n\nfunction setCoords(cd) {\n var cd0 = cd[0];\n var r = cd0.r;\n var trace = cd0.trace;\n var currentAngle = helpers.getRotationAngle(trace.rotation);\n var angleFactor = 2 * Math.PI / cd0.vTotal;\n var firstPt = 'px0';\n var lastPt = 'px1';\n\n var i, cdi, currentCoords;\n\n if(trace.direction === 'counterclockwise') {\n for(i = 0; i < cd.length; i++) {\n if(!cd[i].hidden) break; // find the first non-hidden slice\n }\n if(i === cd.length) return; // all slices hidden\n\n currentAngle += angleFactor * cd[i].v;\n angleFactor *= -1;\n firstPt = 'px1';\n lastPt = 'px0';\n }\n\n currentCoords = getCoords(r, currentAngle);\n\n for(i = 0; i < cd.length; i++) {\n cdi = cd[i];\n if(cdi.hidden) continue;\n\n cdi[firstPt] = currentCoords;\n\n cdi.startangle = currentAngle;\n currentAngle += angleFactor * cdi.v / 2;\n cdi.pxmid = getCoords(r, currentAngle);\n cdi.midangle = currentAngle;\n currentAngle += angleFactor * cdi.v / 2;\n currentCoords = getCoords(r, currentAngle);\n cdi.stopangle = currentAngle;\n\n cdi[lastPt] = currentCoords;\n\n cdi.largeArc = (cdi.v > cd0.vTotal / 2) ? 1 : 0;\n\n cdi.halfangle = Math.PI * Math.min(cdi.v / cd0.vTotal, 0.5);\n cdi.ring = 1 - trace.hole;\n cdi.rInscribed = getInscribedRadiusFraction(cdi, cd0);\n }\n}\n\nfunction getCoords(r, angle) {\n return [r * Math.sin(angle), -r * Math.cos(angle)];\n}\n\nfunction formatSliceLabel(gd, pt, cd0) {\n var fullLayout = gd._fullLayout;\n var trace = cd0.trace;\n // look for textemplate\n var texttemplate = trace.texttemplate;\n\n // now insert text\n var textinfo = trace.textinfo;\n if(!texttemplate && textinfo && textinfo !== 'none') {\n var parts = textinfo.split('+');\n var hasFlag = function(flag) { return parts.indexOf(flag) !== -1; };\n var hasLabel = hasFlag('label');\n var hasText = hasFlag('text');\n var hasValue = hasFlag('value');\n var hasPercent = hasFlag('percent');\n\n var separators = fullLayout.separators;\n var text;\n\n text = hasLabel ? [pt.label] : [];\n if(hasText) {\n var tx = helpers.getFirstFilled(trace.text, pt.pts);\n if(isValidTextValue(tx)) text.push(tx);\n }\n if(hasValue) text.push(helpers.formatPieValue(pt.v, separators));\n if(hasPercent) text.push(helpers.formatPiePercent(pt.v / cd0.vTotal, separators));\n pt.text = text.join('
');\n }\n\n function makeTemplateVariables(pt) {\n return {\n label: pt.label,\n value: pt.v,\n valueLabel: helpers.formatPieValue(pt.v, fullLayout.separators),\n percent: pt.v / cd0.vTotal,\n percentLabel: helpers.formatPiePercent(pt.v / cd0.vTotal, fullLayout.separators),\n color: pt.color,\n text: pt.text,\n customdata: Lib.castOption(trace, pt.i, 'customdata')\n };\n }\n\n if(texttemplate) {\n var txt = Lib.castOption(trace, pt.i, 'texttemplate');\n if(!txt) {\n pt.text = '';\n } else {\n var obj = makeTemplateVariables(pt);\n var ptTx = helpers.getFirstFilled(trace.text, pt.pts);\n if(isValidTextValue(ptTx) || ptTx === '') obj.text = ptTx;\n pt.text = Lib.texttemplateString(txt, obj, gd._fullLayout._d3locale, obj, trace._meta || {});\n }\n }\n}\n\nfunction computeTransform(\n transform, // inout\n textBB // in\n) {\n var a = transform.rotate * Math.PI / 180;\n var cosA = Math.cos(a);\n var sinA = Math.sin(a);\n var midX = (textBB.left + textBB.right) / 2;\n var midY = (textBB.top + textBB.bottom) / 2;\n transform.textX = midX * cosA - midY * sinA;\n transform.textY = midX * sinA + midY * cosA;\n transform.noCenter = true;\n}\n\nmodule.exports = {\n plot: plot,\n formatSliceLabel: formatSliceLabel,\n transformInsideText: transformInsideText,\n determineInsideTextFont: determineInsideTextFont,\n positionTitleOutside: positionTitleOutside,\n prerenderTitles: prerenderTitles,\n layoutAreas: layoutAreas,\n attachFxHandlers: attachFxHandlers,\n computeTransform: computeTransform\n};\n\n},{\"../../components/color\":75,\"../../components/drawing\":97,\"../../components/fx\":115,\"../../lib\":202,\"../../lib/svg_text_utils\":224,\"../../plots/plots\":282,\"../bar/constants\":302,\"../bar/uniform_text\":316,\"./event_data\":321,\"./helpers\":322,\"d3\":9}],327:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar d3 = _dereq_('d3');\n\nvar styleOne = _dereq_('./style_one');\nvar resizeText = _dereq_('../bar/uniform_text').resizeText;\n\nmodule.exports = function style(gd) {\n var s = gd._fullLayout._pielayer.selectAll('.trace');\n resizeText(gd, s, 'pie');\n\n s.each(function(cd) {\n var cd0 = cd[0];\n var trace = cd0.trace;\n var traceSelection = d3.select(this);\n\n traceSelection.style({opacity: trace.opacity});\n\n traceSelection.selectAll('path.surface').each(function(pt) {\n d3.select(this).call(styleOne, pt, trace);\n });\n });\n};\n\n},{\"../bar/uniform_text\":316,\"./style_one\":328,\"d3\":9}],328:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar Color = _dereq_('../../components/color');\nvar castOption = _dereq_('./helpers').castOption;\n\nmodule.exports = function styleOne(s, pt, trace) {\n var line = trace.marker.line;\n var lineColor = castOption(line.color, pt.pts) || Color.defaultLine;\n var lineWidth = castOption(line.width, pt.pts) || 0;\n\n s.style('stroke-width', lineWidth)\n .call(Color.fill, pt.color)\n .call(Color.stroke, lineColor);\n};\n\n},{\"../../components/color\":75,\"./helpers\":322}],329:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n\n'use strict';\n\nvar Lib = _dereq_('../../lib');\n\n\n// arrayOk attributes, merge them into calcdata array\nmodule.exports = function arraysToCalcdata(cd, trace) {\n // so each point knows which index it originally came from\n for(var i = 0; i < cd.length; i++) cd[i].i = i;\n\n Lib.mergeArray(trace.text, cd, 'tx');\n Lib.mergeArray(trace.texttemplate, cd, 'txt');\n Lib.mergeArray(trace.hovertext, cd, 'htx');\n Lib.mergeArray(trace.customdata, cd, 'data');\n Lib.mergeArray(trace.textposition, cd, 'tp');\n if(trace.textfont) {\n Lib.mergeArrayCastPositive(trace.textfont.size, cd, 'ts');\n Lib.mergeArray(trace.textfont.color, cd, 'tc');\n Lib.mergeArray(trace.textfont.family, cd, 'tf');\n }\n\n var marker = trace.marker;\n if(marker) {\n Lib.mergeArrayCastPositive(marker.size, cd, 'ms');\n Lib.mergeArrayCastPositive(marker.opacity, cd, 'mo');\n Lib.mergeArray(marker.symbol, cd, 'mx');\n Lib.mergeArray(marker.color, cd, 'mc');\n\n var markerLine = marker.line;\n if(marker.line) {\n Lib.mergeArray(markerLine.color, cd, 'mlc');\n Lib.mergeArrayCastPositive(markerLine.width, cd, 'mlw');\n }\n\n var markerGradient = marker.gradient;\n if(markerGradient && markerGradient.type !== 'none') {\n Lib.mergeArray(markerGradient.type, cd, 'mgt');\n Lib.mergeArray(markerGradient.color, cd, 'mgc');\n }\n }\n};\n\n},{\"../../lib\":202}],330:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar texttemplateAttrs = _dereq_('../../plots/template_attributes').texttemplateAttrs;\nvar hovertemplateAttrs = _dereq_('../../plots/template_attributes').hovertemplateAttrs;\nvar colorScaleAttrs = _dereq_('../../components/colorscale/attributes');\nvar fontAttrs = _dereq_('../../plots/font_attributes');\nvar dash = _dereq_('../../components/drawing/attributes').dash;\n\nvar Drawing = _dereq_('../../components/drawing');\nvar constants = _dereq_('./constants');\n\nvar extendFlat = _dereq_('../../lib/extend').extendFlat;\n\nfunction axisPeriod(axis) {\n return {\n valType: 'any',\n dflt: 0,\n \n editType: 'calc',\n \n };\n}\n\nfunction axisPeriod0(axis) {\n return {\n valType: 'any',\n \n editType: 'calc',\n \n };\n}\n\nfunction axisPeriodAlignment(axis) {\n return {\n valType: 'enumerated',\n values: [\n 'start', 'middle', 'end'\n ],\n dflt: 'middle',\n \n editType: 'calc',\n \n };\n}\n\nmodule.exports = {\n x: {\n valType: 'data_array',\n editType: 'calc+clearAxisTypes',\n anim: true,\n \n },\n x0: {\n valType: 'any',\n dflt: 0,\n \n editType: 'calc+clearAxisTypes',\n anim: true,\n \n },\n dx: {\n valType: 'number',\n dflt: 1,\n \n editType: 'calc',\n anim: true,\n \n },\n y: {\n valType: 'data_array',\n editType: 'calc+clearAxisTypes',\n anim: true,\n \n },\n y0: {\n valType: 'any',\n dflt: 0,\n \n editType: 'calc+clearAxisTypes',\n anim: true,\n \n },\n dy: {\n valType: 'number',\n dflt: 1,\n \n editType: 'calc',\n anim: true,\n \n },\n\n xperiod: axisPeriod('x'),\n yperiod: axisPeriod('y'),\n xperiod0: axisPeriod0('x0'),\n yperiod0: axisPeriod0('y0'),\n xperiodalignment: axisPeriodAlignment('x'),\n yperiodalignment: axisPeriodAlignment('y'),\n\n stackgroup: {\n valType: 'string',\n \n dflt: '',\n editType: 'calc',\n \n },\n orientation: {\n valType: 'enumerated',\n \n values: ['v', 'h'],\n editType: 'calc',\n \n },\n groupnorm: {\n valType: 'enumerated',\n values: ['', 'fraction', 'percent'],\n dflt: '',\n \n editType: 'calc',\n \n },\n stackgaps: {\n valType: 'enumerated',\n values: ['infer zero', 'interpolate'],\n dflt: 'infer zero',\n \n editType: 'calc',\n \n },\n\n text: {\n valType: 'string',\n \n dflt: '',\n arrayOk: true,\n editType: 'calc',\n \n },\n\n texttemplate: texttemplateAttrs({}, {\n\n }),\n hovertext: {\n valType: 'string',\n \n dflt: '',\n arrayOk: true,\n editType: 'style',\n \n },\n mode: {\n valType: 'flaglist',\n flags: ['lines', 'markers', 'text'],\n extras: ['none'],\n \n editType: 'calc',\n \n },\n hoveron: {\n valType: 'flaglist',\n flags: ['points', 'fills'],\n \n editType: 'style',\n \n },\n hovertemplate: hovertemplateAttrs({}, {\n keys: constants.eventDataKeys\n }),\n line: {\n color: {\n valType: 'color',\n \n editType: 'style',\n anim: true,\n \n },\n width: {\n valType: 'number',\n min: 0,\n dflt: 2,\n \n editType: 'style',\n anim: true,\n \n },\n shape: {\n valType: 'enumerated',\n values: ['linear', 'spline', 'hv', 'vh', 'hvh', 'vhv'],\n dflt: 'linear',\n \n editType: 'plot',\n \n },\n smoothing: {\n valType: 'number',\n min: 0,\n max: 1.3,\n dflt: 1,\n \n editType: 'plot',\n \n },\n dash: extendFlat({}, dash, {editType: 'style'}),\n simplify: {\n valType: 'boolean',\n dflt: true,\n \n editType: 'plot',\n \n },\n editType: 'plot'\n },\n\n connectgaps: {\n valType: 'boolean',\n dflt: false,\n \n editType: 'calc',\n \n },\n cliponaxis: {\n valType: 'boolean',\n dflt: true,\n \n editType: 'plot',\n \n },\n\n fill: {\n valType: 'enumerated',\n values: ['none', 'tozeroy', 'tozerox', 'tonexty', 'tonextx', 'toself', 'tonext'],\n \n editType: 'calc',\n \n },\n fillcolor: {\n valType: 'color',\n \n editType: 'style',\n anim: true,\n \n },\n marker: extendFlat({\n symbol: {\n valType: 'enumerated',\n values: Drawing.symbolList,\n dflt: 'circle',\n arrayOk: true,\n \n editType: 'style',\n \n },\n opacity: {\n valType: 'number',\n min: 0,\n max: 1,\n arrayOk: true,\n \n editType: 'style',\n anim: true,\n \n },\n size: {\n valType: 'number',\n min: 0,\n dflt: 6,\n arrayOk: true,\n \n editType: 'calc',\n anim: true,\n \n },\n maxdisplayed: {\n valType: 'number',\n min: 0,\n dflt: 0,\n \n editType: 'plot',\n \n },\n sizeref: {\n valType: 'number',\n dflt: 1,\n \n editType: 'calc',\n \n },\n sizemin: {\n valType: 'number',\n min: 0,\n dflt: 0,\n \n editType: 'calc',\n \n },\n sizemode: {\n valType: 'enumerated',\n values: ['diameter', 'area'],\n dflt: 'diameter',\n \n editType: 'calc',\n \n },\n\n line: extendFlat({\n width: {\n valType: 'number',\n min: 0,\n arrayOk: true,\n \n editType: 'style',\n anim: true,\n \n },\n editType: 'calc'\n },\n colorScaleAttrs('marker.line', {anim: true})\n ),\n gradient: {\n type: {\n valType: 'enumerated',\n values: ['radial', 'horizontal', 'vertical', 'none'],\n arrayOk: true,\n dflt: 'none',\n \n editType: 'calc',\n \n },\n color: {\n valType: 'color',\n arrayOk: true,\n \n editType: 'calc',\n \n },\n editType: 'calc'\n },\n editType: 'calc'\n },\n colorScaleAttrs('marker', {anim: true})\n ),\n selected: {\n marker: {\n opacity: {\n valType: 'number',\n min: 0,\n max: 1,\n \n editType: 'style',\n \n },\n color: {\n valType: 'color',\n \n editType: 'style',\n \n },\n size: {\n valType: 'number',\n min: 0,\n \n editType: 'style',\n \n },\n editType: 'style'\n },\n textfont: {\n color: {\n valType: 'color',\n \n editType: 'style',\n \n },\n editType: 'style'\n },\n editType: 'style'\n },\n unselected: {\n marker: {\n opacity: {\n valType: 'number',\n min: 0,\n max: 1,\n \n editType: 'style',\n \n },\n color: {\n valType: 'color',\n \n editType: 'style',\n \n },\n size: {\n valType: 'number',\n min: 0,\n \n editType: 'style',\n \n },\n editType: 'style'\n },\n textfont: {\n color: {\n valType: 'color',\n \n editType: 'style',\n \n },\n editType: 'style'\n },\n editType: 'style'\n },\n\n textposition: {\n valType: 'enumerated',\n values: [\n 'top left', 'top center', 'top right',\n 'middle left', 'middle center', 'middle right',\n 'bottom left', 'bottom center', 'bottom right'\n ],\n dflt: 'middle center',\n arrayOk: true,\n \n editType: 'calc',\n \n },\n textfont: fontAttrs({\n editType: 'calc',\n colorEditType: 'style',\n arrayOk: true,\n \n }),\n\n r: {\n valType: 'data_array',\n editType: 'calc',\n \n },\n t: {\n valType: 'data_array',\n editType: 'calc',\n \n }\n};\n\n},{\"../../components/colorscale/attributes\":82,\"../../components/drawing\":97,\"../../components/drawing/attributes\":96,\"../../lib/extend\":196,\"../../plots/font_attributes\":276,\"../../plots/template_attributes\":289,\"./constants\":334}],331:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar isNumeric = _dereq_('fast-isnumeric');\nvar Lib = _dereq_('../../lib');\n\nvar Axes = _dereq_('../../plots/cartesian/axes');\nvar alignPeriod = _dereq_('../../plots/cartesian/align_period');\nvar BADNUM = _dereq_('../../constants/numerical').BADNUM;\n\nvar subTypes = _dereq_('./subtypes');\nvar calcColorscale = _dereq_('./colorscale_calc');\nvar arraysToCalcdata = _dereq_('./arrays_to_calcdata');\nvar calcSelection = _dereq_('./calc_selection');\n\nfunction calc(gd, trace) {\n var fullLayout = gd._fullLayout;\n var xa = Axes.getFromId(gd, trace.xaxis || 'x');\n var ya = Axes.getFromId(gd, trace.yaxis || 'y');\n var origX = xa.makeCalcdata(trace, 'x');\n var origY = ya.makeCalcdata(trace, 'y');\n var x = alignPeriod(trace, xa, 'x', origX);\n var y = alignPeriod(trace, ya, 'y', origY);\n\n var serieslen = trace._length;\n var cd = new Array(serieslen);\n var ids = trace.ids;\n var stackGroupOpts = getStackOpts(trace, fullLayout, xa, ya);\n var interpolateGaps = false;\n var isV, i, j, k, interpolate, vali;\n\n setFirstScatter(fullLayout, trace);\n\n var xAttr = 'x';\n var yAttr = 'y';\n var posAttr;\n if(stackGroupOpts) {\n Lib.pushUnique(stackGroupOpts.traceIndices, trace._expandedIndex);\n isV = stackGroupOpts.orientation === 'v';\n\n // size, like we use for bar\n if(isV) {\n yAttr = 's';\n posAttr = 'x';\n } else {\n xAttr = 's';\n posAttr = 'y';\n }\n interpolate = stackGroupOpts.stackgaps === 'interpolate';\n } else {\n var ppad = calcMarkerSize(trace, serieslen);\n calcAxisExpansion(gd, trace, xa, ya, x, y, ppad);\n }\n\n var hasPeriodX = !!trace.xperiodalignment;\n var hasPeriodY = !!trace.yperiodalignment;\n\n for(i = 0; i < serieslen; i++) {\n var cdi = cd[i] = {};\n var xValid = isNumeric(x[i]);\n var yValid = isNumeric(y[i]);\n if(xValid && yValid) {\n cdi[xAttr] = x[i];\n cdi[yAttr] = y[i];\n\n if(hasPeriodX) {\n cdi.orig_x = origX[i]; // used by hover\n }\n if(hasPeriodY) {\n cdi.orig_y = origY[i]; // used by hover\n }\n } else if(stackGroupOpts && (isV ? xValid : yValid)) {\n // if we're stacking we need to hold on to all valid positions\n // even with invalid sizes\n\n cdi[posAttr] = isV ? x[i] : y[i];\n cdi.gap = true;\n if(interpolate) {\n cdi.s = BADNUM;\n interpolateGaps = true;\n } else {\n cdi.s = 0;\n }\n } else {\n cdi[xAttr] = cdi[yAttr] = BADNUM;\n }\n\n if(ids) {\n cdi.id = String(ids[i]);\n }\n }\n\n arraysToCalcdata(cd, trace);\n calcColorscale(gd, trace);\n calcSelection(cd, trace);\n\n if(stackGroupOpts) {\n // remove bad positions and sort\n // note that original indices get added to cd in arraysToCalcdata\n i = 0;\n while(i < cd.length) {\n if(cd[i][posAttr] === BADNUM) {\n cd.splice(i, 1);\n } else i++;\n }\n\n Lib.sort(cd, function(a, b) {\n return (a[posAttr] - b[posAttr]) || (a.i - b.i);\n });\n\n if(interpolateGaps) {\n // first fill the beginning with constant from the first point\n i = 0;\n while(i < cd.length - 1 && cd[i].gap) {\n i++;\n }\n vali = cd[i].s;\n if(!vali) vali = cd[i].s = 0; // in case of no data AT ALL in this trace - use 0\n for(j = 0; j < i; j++) {\n cd[j].s = vali;\n }\n // then fill the end with constant from the last point\n k = cd.length - 1;\n while(k > i && cd[k].gap) {\n k--;\n }\n vali = cd[k].s;\n for(j = cd.length - 1; j > k; j--) {\n cd[j].s = vali;\n }\n // now interpolate internal gaps linearly\n while(i < k) {\n i++;\n if(cd[i].gap) {\n j = i + 1;\n while(cd[j].gap) {\n j++;\n }\n var pos0 = cd[i - 1][posAttr];\n var size0 = cd[i - 1].s;\n var m = (cd[j].s - size0) / (cd[j][posAttr] - pos0);\n while(i < j) {\n cd[i].s = size0 + (cd[i][posAttr] - pos0) * m;\n i++;\n }\n }\n }\n }\n }\n\n return cd;\n}\n\nfunction calcAxisExpansion(gd, trace, xa, ya, x, y, ppad) {\n var serieslen = trace._length;\n var fullLayout = gd._fullLayout;\n var xId = xa._id;\n var yId = ya._id;\n var firstScatter = fullLayout._firstScatter[firstScatterGroup(trace)] === trace.uid;\n var stackOrientation = (getStackOpts(trace, fullLayout, xa, ya) || {}).orientation;\n var fill = trace.fill;\n\n // cancel minimum tick spacings (only applies to bars and boxes)\n xa._minDtick = 0;\n ya._minDtick = 0;\n\n // check whether bounds should be tight, padded, extended to zero...\n // most cases both should be padded on both ends, so start with that.\n var xOptions = {padded: true};\n var yOptions = {padded: true};\n\n if(ppad) {\n xOptions.ppad = yOptions.ppad = ppad;\n }\n\n // TODO: text size\n\n var openEnded = serieslen < 2 || (x[0] !== x[serieslen - 1]) || (y[0] !== y[serieslen - 1]);\n\n if(openEnded && (\n (fill === 'tozerox') ||\n ((fill === 'tonextx') && (firstScatter || stackOrientation === 'h'))\n )) {\n // include zero (tight) and extremes (padded) if fill to zero\n // (unless the shape is closed, then it's just filling the shape regardless)\n\n xOptions.tozero = true;\n } else if(!(trace.error_y || {}).visible && (\n // if no error bars, markers or text, or fill to y=0 remove x padding\n\n (fill === 'tonexty' || fill === 'tozeroy') ||\n (!subTypes.hasMarkers(trace) && !subTypes.hasText(trace))\n )) {\n xOptions.padded = false;\n xOptions.ppad = 0;\n }\n\n if(openEnded && (\n (fill === 'tozeroy') ||\n ((fill === 'tonexty') && (firstScatter || stackOrientation === 'v'))\n )) {\n // now check for y - rather different logic, though still mostly padded both ends\n // include zero (tight) and extremes (padded) if fill to zero\n // (unless the shape is closed, then it's just filling the shape regardless)\n\n yOptions.tozero = true;\n } else if(fill === 'tonextx' || fill === 'tozerox') {\n // tight y: any x fill\n\n yOptions.padded = false;\n }\n\n // N.B. asymmetric splom traces call this with blank {} xa or ya\n if(xId) trace._extremes[xId] = Axes.findExtremes(xa, x, xOptions);\n if(yId) trace._extremes[yId] = Axes.findExtremes(ya, y, yOptions);\n}\n\nfunction calcMarkerSize(trace, serieslen) {\n if(!subTypes.hasMarkers(trace)) return;\n\n // Treat size like x or y arrays --- Run d2c\n // this needs to go before ppad computation\n var marker = trace.marker;\n var sizeref = 1.6 * (trace.marker.sizeref || 1);\n var markerTrans;\n\n if(trace.marker.sizemode === 'area') {\n markerTrans = function(v) {\n return Math.max(Math.sqrt((v || 0) / sizeref), 3);\n };\n } else {\n markerTrans = function(v) {\n return Math.max((v || 0) / sizeref, 3);\n };\n }\n\n if(Lib.isArrayOrTypedArray(marker.size)) {\n // I tried auto-type but category and dates dont make much sense.\n var ax = {type: 'linear'};\n Axes.setConvert(ax);\n\n var s = ax.makeCalcdata(trace.marker, 'size');\n\n var sizeOut = new Array(serieslen);\n for(var i = 0; i < serieslen; i++) {\n sizeOut[i] = markerTrans(s[i]);\n }\n return sizeOut;\n } else {\n return markerTrans(marker.size);\n }\n}\n\n/**\n * mark the first scatter trace for each subplot\n * note that scatter and scattergl each get their own first trace\n * note also that I'm doing this during calc rather than supplyDefaults\n * so I don't need to worry about transforms, but if we ever do\n * per-trace calc this will get confused.\n */\nfunction setFirstScatter(fullLayout, trace) {\n var group = firstScatterGroup(trace);\n var firstScatter = fullLayout._firstScatter;\n if(!firstScatter[group]) firstScatter[group] = trace.uid;\n}\n\nfunction firstScatterGroup(trace) {\n var stackGroup = trace.stackgroup;\n return trace.xaxis + trace.yaxis + trace.type +\n (stackGroup ? '-' + stackGroup : '');\n}\n\nfunction getStackOpts(trace, fullLayout, xa, ya) {\n var stackGroup = trace.stackgroup;\n if(!stackGroup) return;\n var stackOpts = fullLayout._scatterStackOpts[xa._id + ya._id][stackGroup];\n var stackAx = stackOpts.orientation === 'v' ? ya : xa;\n // Allow stacking only on numeric axes\n // calc is a little late to be figuring this out, but during supplyDefaults\n // we don't know the axis type yet\n if(stackAx.type === 'linear' || stackAx.type === 'log') return stackOpts;\n}\n\nmodule.exports = {\n calc: calc,\n calcMarkerSize: calcMarkerSize,\n calcAxisExpansion: calcAxisExpansion,\n setFirstScatter: setFirstScatter,\n getStackOpts: getStackOpts\n};\n\n},{\"../../constants/numerical\":181,\"../../lib\":202,\"../../plots/cartesian/align_period\":245,\"../../plots/cartesian/axes\":248,\"./arrays_to_calcdata\":329,\"./calc_selection\":332,\"./colorscale_calc\":333,\"./subtypes\":355,\"fast-isnumeric\":11}],332:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar Lib = _dereq_('../../lib');\n\nmodule.exports = function calcSelection(cd, trace) {\n if(Lib.isArrayOrTypedArray(trace.selectedpoints)) {\n Lib.tagSelected(cd, trace);\n }\n};\n\n},{\"../../lib\":202}],333:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar hasColorscale = _dereq_('../../components/colorscale/helpers').hasColorscale;\nvar calcColorscale = _dereq_('../../components/colorscale/calc');\n\nvar subTypes = _dereq_('./subtypes');\n\nmodule.exports = function calcMarkerColorscale(gd, trace) {\n if(subTypes.hasLines(trace) && hasColorscale(trace, 'line')) {\n calcColorscale(gd, trace, {\n vals: trace.line.color,\n containerStr: 'line',\n cLetter: 'c'\n });\n }\n\n if(subTypes.hasMarkers(trace)) {\n if(hasColorscale(trace, 'marker')) {\n calcColorscale(gd, trace, {\n vals: trace.marker.color,\n containerStr: 'marker',\n cLetter: 'c'\n });\n }\n if(hasColorscale(trace, 'marker.line')) {\n calcColorscale(gd, trace, {\n vals: trace.marker.line.color,\n containerStr: 'marker.line',\n cLetter: 'c'\n });\n }\n }\n};\n\n},{\"../../components/colorscale/calc\":83,\"../../components/colorscale/helpers\":86,\"./subtypes\":355}],334:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n\n'use strict';\n\nmodule.exports = {\n PTS_LINESONLY: 20,\n\n // fixed parameters of clustering and clipping algorithms\n\n // fraction of clustering tolerance \"so close we don't even consider it a new point\"\n minTolerance: 0.2,\n // how fast does clustering tolerance increase as you get away from the visible region\n toleranceGrowth: 10,\n\n // number of viewport sizes away from the visible region\n // at which we clip all lines to the perimeter\n maxScreensAway: 20,\n\n eventDataKeys: []\n};\n\n},{}],335:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n\n'use strict';\n\nvar calc = _dereq_('./calc');\n\n/*\n * Scatter stacking & normalization calculations\n * runs per subplot, and can handle multiple stacking groups\n */\n\nmodule.exports = function crossTraceCalc(gd, plotinfo) {\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n var subplot = xa._id + ya._id;\n\n var subplotStackOpts = gd._fullLayout._scatterStackOpts[subplot];\n if(!subplotStackOpts) return;\n\n var calcTraces = gd.calcdata;\n\n var i, j, k, i2, cd, cd0, posj, sumj, norm;\n var groupOpts, interpolate, groupnorm, posAttr, valAttr;\n var hasAnyBlanks;\n\n for(var stackGroup in subplotStackOpts) {\n groupOpts = subplotStackOpts[stackGroup];\n var indices = groupOpts.traceIndices;\n\n // can get here with no indices if the stack axis is non-numeric\n if(!indices.length) continue;\n\n interpolate = groupOpts.stackgaps === 'interpolate';\n groupnorm = groupOpts.groupnorm;\n if(groupOpts.orientation === 'v') {\n posAttr = 'x';\n valAttr = 'y';\n } else {\n posAttr = 'y';\n valAttr = 'x';\n }\n hasAnyBlanks = new Array(indices.length);\n for(i = 0; i < hasAnyBlanks.length; i++) {\n hasAnyBlanks[i] = false;\n }\n\n // Collect the complete set of all positions across ALL traces.\n // Start with the first trace, then interleave items from later traces\n // as needed.\n // Fill in mising items as we go.\n cd0 = calcTraces[indices[0]];\n var allPositions = new Array(cd0.length);\n for(i = 0; i < cd0.length; i++) {\n allPositions[i] = cd0[i][posAttr];\n }\n\n for(i = 1; i < indices.length; i++) {\n cd = calcTraces[indices[i]];\n\n for(j = k = 0; j < cd.length; j++) {\n posj = cd[j][posAttr];\n for(; posj > allPositions[k] && k < allPositions.length; k++) {\n // the current trace is missing a position from some previous trace(s)\n insertBlank(cd, j, allPositions[k], i, hasAnyBlanks, interpolate, posAttr);\n j++;\n }\n if(posj !== allPositions[k]) {\n // previous trace(s) are missing a position from the current trace\n for(i2 = 0; i2 < i; i2++) {\n insertBlank(calcTraces[indices[i2]], k, posj, i2, hasAnyBlanks, interpolate, posAttr);\n }\n allPositions.splice(k, 0, posj);\n }\n k++;\n }\n for(; k < allPositions.length; k++) {\n insertBlank(cd, j, allPositions[k], i, hasAnyBlanks, interpolate, posAttr);\n j++;\n }\n }\n\n var serieslen = allPositions.length;\n\n // stack (and normalize)!\n for(j = 0; j < cd0.length; j++) {\n sumj = cd0[j][valAttr] = cd0[j].s;\n for(i = 1; i < indices.length; i++) {\n cd = calcTraces[indices[i]];\n cd[0].trace._rawLength = cd[0].trace._length;\n cd[0].trace._length = serieslen;\n sumj += cd[j].s;\n cd[j][valAttr] = sumj;\n }\n\n if(groupnorm) {\n norm = ((groupnorm === 'fraction') ? sumj : (sumj / 100)) || 1;\n for(i = 0; i < indices.length; i++) {\n var cdj = calcTraces[indices[i]][j];\n cdj[valAttr] /= norm;\n cdj.sNorm = cdj.s / norm;\n }\n }\n }\n\n // autorange\n for(i = 0; i < indices.length; i++) {\n cd = calcTraces[indices[i]];\n var trace = cd[0].trace;\n var ppad = calc.calcMarkerSize(trace, trace._rawLength);\n var arrayPad = Array.isArray(ppad);\n if((ppad && hasAnyBlanks[i]) || arrayPad) {\n var ppadRaw = ppad;\n ppad = new Array(serieslen);\n for(j = 0; j < serieslen; j++) {\n ppad[j] = cd[j].gap ? 0 : (arrayPad ? ppadRaw[cd[j].i] : ppadRaw);\n }\n }\n var x = new Array(serieslen);\n var y = new Array(serieslen);\n for(j = 0; j < serieslen; j++) {\n x[j] = cd[j].x;\n y[j] = cd[j].y;\n }\n calc.calcAxisExpansion(gd, trace, xa, ya, x, y, ppad);\n\n // while we're here (in a loop over all traces in the stack)\n // record the orientation, so hover can find it easily\n cd[0].t.orientation = groupOpts.orientation;\n }\n }\n};\n\nfunction insertBlank(calcTrace, index, position, traceIndex, hasAnyBlanks, interpolate, posAttr) {\n hasAnyBlanks[traceIndex] = true;\n var newEntry = {\n i: null,\n gap: true,\n s: 0\n };\n newEntry[posAttr] = position;\n calcTrace.splice(index, 0, newEntry);\n // Even if we're not interpolating, if one trace has multiple\n // values at the same position and this trace only has one value there,\n // we just duplicate that one value rather than insert a zero.\n // We also make it look like a real point - because it's ambiguous which\n // one really is the real one!\n if(index && position === calcTrace[index - 1][posAttr]) {\n var prevEntry = calcTrace[index - 1];\n newEntry.s = prevEntry.s;\n // TODO is it going to cause any problems to have multiple\n // calcdata points with the same index?\n newEntry.i = prevEntry.i;\n newEntry.gap = prevEntry.gap;\n } else if(interpolate) {\n newEntry.s = getInterp(calcTrace, index, position, posAttr);\n }\n if(!index) {\n // t and trace need to stay on the first cd entry\n calcTrace[0].t = calcTrace[1].t;\n calcTrace[0].trace = calcTrace[1].trace;\n delete calcTrace[1].t;\n delete calcTrace[1].trace;\n }\n}\n\nfunction getInterp(calcTrace, index, position, posAttr) {\n var pt0 = calcTrace[index - 1];\n var pt1 = calcTrace[index + 1];\n if(!pt1) return pt0.s;\n if(!pt0) return pt1.s;\n return pt0.s + (pt1.s - pt0.s) * (position - pt0[posAttr]) / (pt1[posAttr] - pt0[posAttr]);\n}\n\n},{\"./calc\":331}],336:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n\n'use strict';\n\n\n// remove opacity for any trace that has a fill or is filled to\nmodule.exports = function crossTraceDefaults(fullData) {\n for(var i = 0; i < fullData.length; i++) {\n var tracei = fullData[i];\n if(tracei.type !== 'scatter') continue;\n\n var filli = tracei.fill;\n if(filli === 'none' || filli === 'toself') continue;\n\n tracei.opacity = undefined;\n\n if(filli === 'tonexty' || filli === 'tonextx') {\n for(var j = i - 1; j >= 0; j--) {\n var tracej = fullData[j];\n\n if((tracej.type === 'scatter') &&\n (tracej.xaxis === tracei.xaxis) &&\n (tracej.yaxis === tracei.yaxis)) {\n tracej.opacity = undefined;\n break;\n }\n }\n }\n }\n};\n\n},{}],337:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar Lib = _dereq_('../../lib');\nvar Registry = _dereq_('../../registry');\n\nvar attributes = _dereq_('./attributes');\nvar constants = _dereq_('./constants');\nvar subTypes = _dereq_('./subtypes');\nvar handleXYDefaults = _dereq_('./xy_defaults');\nvar handlePeriodDefaults = _dereq_('./period_defaults');\nvar handleStackDefaults = _dereq_('./stack_defaults');\nvar handleMarkerDefaults = _dereq_('./marker_defaults');\nvar handleLineDefaults = _dereq_('./line_defaults');\nvar handleLineShapeDefaults = _dereq_('./line_shape_defaults');\nvar handleTextDefaults = _dereq_('./text_defaults');\nvar handleFillColorDefaults = _dereq_('./fillcolor_defaults');\n\nmodule.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);\n }\n\n var len = handleXYDefaults(traceIn, traceOut, layout, coerce);\n if(!len) traceOut.visible = false;\n\n if(!traceOut.visible) return;\n\n handlePeriodDefaults(traceIn, traceOut, layout, coerce);\n\n var stackGroupOpts = handleStackDefaults(traceIn, traceOut, layout, coerce);\n\n var defaultMode = !stackGroupOpts && (len < constants.PTS_LINESONLY) ?\n 'lines+markers' : 'lines';\n coerce('text');\n coerce('hovertext');\n coerce('mode', defaultMode);\n\n if(subTypes.hasLines(traceOut)) {\n handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce);\n handleLineShapeDefaults(traceIn, traceOut, coerce);\n coerce('connectgaps');\n coerce('line.simplify');\n }\n\n if(subTypes.hasMarkers(traceOut)) {\n handleMarkerDefaults(traceIn, traceOut, defaultColor, layout, coerce, {gradient: true});\n }\n\n if(subTypes.hasText(traceOut)) {\n coerce('texttemplate');\n handleTextDefaults(traceIn, traceOut, layout, coerce);\n }\n\n var dfltHoverOn = [];\n\n if(subTypes.hasMarkers(traceOut) || subTypes.hasText(traceOut)) {\n coerce('cliponaxis');\n coerce('marker.maxdisplayed');\n dfltHoverOn.push('points');\n }\n\n // It's possible for this default to be changed by a later trace.\n // We handle that case in some hacky code inside handleStackDefaults.\n coerce('fill', stackGroupOpts ? stackGroupOpts.fillDflt : 'none');\n if(traceOut.fill !== 'none') {\n handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce);\n if(!subTypes.hasLines(traceOut)) handleLineShapeDefaults(traceIn, traceOut, coerce);\n }\n\n var lineColor = (traceOut.line || {}).color;\n var markerColor = (traceOut.marker || {}).color;\n\n if(traceOut.fill === 'tonext' || traceOut.fill === 'toself') {\n dfltHoverOn.push('fills');\n }\n coerce('hoveron', dfltHoverOn.join('+') || 'points');\n if(traceOut.hoveron !== 'fills') coerce('hovertemplate');\n var errorBarsSupplyDefaults = Registry.getComponentMethod('errorbars', 'supplyDefaults');\n errorBarsSupplyDefaults(traceIn, traceOut, lineColor || markerColor || defaultColor, {axis: 'y'});\n errorBarsSupplyDefaults(traceIn, traceOut, lineColor || markerColor || defaultColor, {axis: 'x', inherit: 'y'});\n\n Lib.coerceSelectionMarkerOpacity(traceOut, coerce);\n};\n\n},{\"../../lib\":202,\"../../registry\":290,\"./attributes\":330,\"./constants\":334,\"./fillcolor_defaults\":338,\"./line_defaults\":343,\"./line_shape_defaults\":345,\"./marker_defaults\":349,\"./period_defaults\":350,\"./stack_defaults\":353,\"./subtypes\":355,\"./text_defaults\":356,\"./xy_defaults\":357}],338:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n\n'use strict';\n\nvar Color = _dereq_('../../components/color');\nvar isArrayOrTypedArray = _dereq_('../../lib').isArrayOrTypedArray;\n\nmodule.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coerce) {\n var inheritColorFromMarker = false;\n\n if(traceOut.marker) {\n // don't try to inherit a color array\n var markerColor = traceOut.marker.color;\n var markerLineColor = (traceOut.marker.line || {}).color;\n\n if(markerColor && !isArrayOrTypedArray(markerColor)) {\n inheritColorFromMarker = markerColor;\n } else if(markerLineColor && !isArrayOrTypedArray(markerLineColor)) {\n inheritColorFromMarker = markerLineColor;\n }\n }\n\n coerce('fillcolor', Color.addOpacity(\n (traceOut.line || {}).color ||\n inheritColorFromMarker ||\n defaultColor, 0.5\n ));\n};\n\n},{\"../../components/color\":75,\"../../lib\":202}],339:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar Axes = _dereq_('../../plots/cartesian/axes');\n\nmodule.exports = function formatLabels(cdi, trace, fullLayout) {\n var labels = {};\n\n var mockGd = {_fullLayout: fullLayout};\n var xa = Axes.getFromTrace(mockGd, trace, 'x');\n var ya = Axes.getFromTrace(mockGd, trace, 'y');\n\n labels.xLabel = Axes.tickText(xa, cdi.x, true).text;\n labels.yLabel = Axes.tickText(ya, cdi.y, true).text;\n\n return labels;\n};\n\n},{\"../../plots/cartesian/axes\":248}],340:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n\n'use strict';\n\nvar Color = _dereq_('../../components/color');\nvar subtypes = _dereq_('./subtypes');\n\n\nmodule.exports = function getTraceColor(trace, di) {\n var lc, tc;\n\n // TODO: text modes\n\n if(trace.mode === 'lines') {\n lc = trace.line.color;\n return (lc && Color.opacity(lc)) ?\n lc : trace.fillcolor;\n } else if(trace.mode === 'none') {\n return trace.fill ? trace.fillcolor : '';\n } else {\n var mc = di.mcc || (trace.marker || {}).color;\n var mlc = di.mlcc || ((trace.marker || {}).line || {}).color;\n\n tc = (mc && Color.opacity(mc)) ? mc :\n (mlc && Color.opacity(mlc) &&\n (di.mlw || ((trace.marker || {}).line || {}).width)) ? mlc : '';\n\n if(tc) {\n // make sure the points aren't TOO transparent\n if(Color.opacity(tc) < 0.3) {\n return Color.addOpacity(tc, 0.3);\n } else return tc;\n } else {\n lc = (trace.line || {}).color;\n return (lc && Color.opacity(lc) &&\n subtypes.hasLines(trace) && trace.line.width) ?\n lc : trace.fillcolor;\n }\n }\n};\n\n},{\"../../components/color\":75,\"./subtypes\":355}],341:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar Lib = _dereq_('../../lib');\nvar Fx = _dereq_('../../components/fx');\nvar Registry = _dereq_('../../registry');\nvar getTraceColor = _dereq_('./get_trace_color');\nvar Color = _dereq_('../../components/color');\nvar fillText = Lib.fillText;\n\nmodule.exports = function hoverPoints(pointData, xval, yval, hovermode) {\n var cd = pointData.cd;\n var trace = cd[0].trace;\n var xa = pointData.xa;\n var ya = pointData.ya;\n var xpx = xa.c2p(xval);\n var ypx = ya.c2p(yval);\n var pt = [xpx, ypx];\n var hoveron = trace.hoveron || '';\n var minRad = (trace.mode.indexOf('markers') !== -1) ? 3 : 0.5;\n\n // look for points to hover on first, then take fills only if we\n // didn't find a point\n if(hoveron.indexOf('points') !== -1) {\n var dx = function(di) {\n // dx and dy are used in compare modes - here we want to always\n // prioritize the closest data point, at least as long as markers are\n // the same size or nonexistent, but still try to prioritize small markers too.\n var rad = Math.max(3, di.mrc || 0);\n var kink = 1 - 1 / rad;\n var dxRaw = Math.abs(xa.c2p(di.x) - xpx);\n var d = (dxRaw < rad) ? (kink * dxRaw / rad) : (dxRaw - rad + kink);\n return d;\n };\n var dy = function(di) {\n var rad = Math.max(3, di.mrc || 0);\n var kink = 1 - 1 / rad;\n var dyRaw = Math.abs(ya.c2p(di.y) - ypx);\n return (dyRaw < rad) ? (kink * dyRaw / rad) : (dyRaw - rad + kink);\n };\n var dxy = function(di) {\n // scatter points: d.mrc is the calculated marker radius\n // adjust the distance so if you're inside the marker it\n // always will show up regardless of point size, but\n // prioritize smaller points\n var rad = Math.max(minRad, di.mrc || 0);\n var dx = xa.c2p(di.x) - xpx;\n var dy = ya.c2p(di.y) - ypx;\n return Math.max(Math.sqrt(dx * dx + dy * dy) - rad, 1 - minRad / rad);\n };\n var distfn = Fx.getDistanceFunction(hovermode, dx, dy, dxy);\n\n Fx.getClosest(cd, distfn, pointData);\n\n // skip the rest (for this trace) if we didn't find a close point\n if(pointData.index !== false) {\n // the closest data point\n var di = cd[pointData.index];\n var xc = xa.c2p(di.x, true);\n var yc = ya.c2p(di.y, true);\n var rad = di.mrc || 1;\n\n // now we're done using the whole `calcdata` array, replace the\n // index with the original index (in case of inserted point from\n // stacked area)\n pointData.index = di.i;\n\n var orientation = cd[0].t.orientation;\n // TODO: for scatter and bar, option to show (sub)totals and\n // raw data? Currently stacked and/or normalized bars just show\n // the normalized individual sizes, so that's what I'm doing here\n // for now.\n var sizeVal = orientation && (di.sNorm || di.s);\n var xLabelVal = (orientation === 'h') ? sizeVal : di.orig_x !== undefined ? di.orig_x : di.x;\n var yLabelVal = (orientation === 'v') ? sizeVal : di.orig_y !== undefined ? di.orig_y : di.y;\n\n Lib.extendFlat(pointData, {\n color: getTraceColor(trace, di),\n\n x0: xc - rad,\n x1: xc + rad,\n xLabelVal: xLabelVal,\n\n y0: yc - rad,\n y1: yc + rad,\n yLabelVal: yLabelVal,\n\n spikeDistance: dxy(di),\n hovertemplate: trace.hovertemplate\n });\n\n fillText(di, trace, pointData);\n Registry.getComponentMethod('errorbars', 'hoverInfo')(di, trace, pointData);\n\n return [pointData];\n }\n }\n\n // even if hoveron is 'fills', only use it if we have polygons too\n if(hoveron.indexOf('fills') !== -1 && trace._polygons) {\n var polygons = trace._polygons;\n var polygonsIn = [];\n var inside = false;\n var xmin = Infinity;\n var xmax = -Infinity;\n var ymin = Infinity;\n var ymax = -Infinity;\n\n var i, j, polygon, pts, xCross, x0, x1, y0, y1;\n\n for(i = 0; i < polygons.length; i++) {\n polygon = polygons[i];\n // TODO: this is not going to work right for curved edges, it will\n // act as though they're straight. That's probably going to need\n // the elements themselves to capture the events. Worth it?\n if(polygon.contains(pt)) {\n inside = !inside;\n // TODO: need better than just the overall bounding box\n polygonsIn.push(polygon);\n ymin = Math.min(ymin, polygon.ymin);\n ymax = Math.max(ymax, polygon.ymax);\n }\n }\n\n if(inside) {\n // constrain ymin/max to the visible plot, so the label goes\n // at the middle of the piece you can see\n ymin = Math.max(ymin, 0);\n ymax = Math.min(ymax, ya._length);\n\n // find the overall left-most and right-most points of the\n // polygon(s) we're inside at their combined vertical midpoint.\n // This is where we will draw the hover label.\n // Note that this might not be the vertical midpoint of the\n // whole trace, if it's disjoint.\n var yAvg = (ymin + ymax) / 2;\n for(i = 0; i < polygonsIn.length; i++) {\n pts = polygonsIn[i].pts;\n for(j = 1; j < pts.length; j++) {\n y0 = pts[j - 1][1];\n y1 = pts[j][1];\n if((y0 > yAvg) !== (y1 >= yAvg)) {\n x0 = pts[j - 1][0];\n x1 = pts[j][0];\n if(y1 - y0) {\n xCross = x0 + (x1 - x0) * (yAvg - y0) / (y1 - y0);\n xmin = Math.min(xmin, xCross);\n xmax = Math.max(xmax, xCross);\n }\n }\n }\n }\n\n // constrain xmin/max to the visible plot now too\n xmin = Math.max(xmin, 0);\n xmax = Math.min(xmax, xa._length);\n\n // get only fill or line color for the hover color\n var color = Color.defaultLine;\n if(Color.opacity(trace.fillcolor)) color = trace.fillcolor;\n else if(Color.opacity((trace.line || {}).color)) {\n color = trace.line.color;\n }\n\n Lib.extendFlat(pointData, {\n // never let a 2D override 1D type as closest point\n // also: no spikeDistance, it's not allowed for fills\n distance: pointData.maxHoverDistance,\n x0: xmin,\n x1: xmax,\n y0: yAvg,\n y1: yAvg,\n color: color,\n hovertemplate: false\n });\n\n delete pointData.index;\n\n if(trace.text && !Array.isArray(trace.text)) {\n pointData.text = String(trace.text);\n } else pointData.text = trace.name;\n\n return [pointData];\n }\n }\n};\n\n},{\"../../components/color\":75,\"../../components/fx\":115,\"../../lib\":202,\"../../registry\":290,\"./get_trace_color\":340}],342:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar subtypes = _dereq_('./subtypes');\n\nmodule.exports = {\n hasLines: subtypes.hasLines,\n hasMarkers: subtypes.hasMarkers,\n hasText: subtypes.hasText,\n isBubble: subtypes.isBubble,\n\n attributes: _dereq_('./attributes'),\n supplyDefaults: _dereq_('./defaults'),\n crossTraceDefaults: _dereq_('./cross_trace_defaults'),\n calc: _dereq_('./calc').calc,\n crossTraceCalc: _dereq_('./cross_trace_calc'),\n arraysToCalcdata: _dereq_('./arrays_to_calcdata'),\n plot: _dereq_('./plot'),\n colorbar: _dereq_('./marker_colorbar'),\n formatLabels: _dereq_('./format_labels'),\n style: _dereq_('./style').style,\n styleOnSelect: _dereq_('./style').styleOnSelect,\n hoverPoints: _dereq_('./hover'),\n selectPoints: _dereq_('./select'),\n animatable: true,\n\n moduleType: 'trace',\n name: 'scatter',\n basePlotModule: _dereq_('../../plots/cartesian'),\n categories: [\n 'cartesian', 'svg', 'symbols', 'errorBarsOK', 'showLegend', 'scatter-like',\n 'zoomScale'\n ],\n meta: {\n \n }\n};\n\n},{\"../../plots/cartesian\":261,\"./arrays_to_calcdata\":329,\"./attributes\":330,\"./calc\":331,\"./cross_trace_calc\":335,\"./cross_trace_defaults\":336,\"./defaults\":337,\"./format_labels\":339,\"./hover\":341,\"./marker_colorbar\":348,\"./plot\":351,\"./select\":352,\"./style\":354,\"./subtypes\":355}],343:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar isArrayOrTypedArray = _dereq_('../../lib').isArrayOrTypedArray;\nvar hasColorscale = _dereq_('../../components/colorscale/helpers').hasColorscale;\nvar colorscaleDefaults = _dereq_('../../components/colorscale/defaults');\n\nmodule.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, coerce, opts) {\n var markerColor = (traceIn.marker || {}).color;\n\n coerce('line.color', defaultColor);\n\n if(hasColorscale(traceIn, 'line')) {\n colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: 'line.', cLetter: 'c'});\n } else {\n var lineColorDflt = (isArrayOrTypedArray(markerColor) ? false : markerColor) || defaultColor;\n coerce('line.color', lineColorDflt);\n }\n\n coerce('line.width');\n if(!(opts || {}).noDash) coerce('line.dash');\n};\n\n},{\"../../components/colorscale/defaults\":85,\"../../components/colorscale/helpers\":86,\"../../lib\":202}],344:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n\n'use strict';\n\nvar numConstants = _dereq_('../../constants/numerical');\nvar BADNUM = numConstants.BADNUM;\nvar LOG_CLIP = numConstants.LOG_CLIP;\nvar LOG_CLIP_PLUS = LOG_CLIP + 0.5;\nvar LOG_CLIP_MINUS = LOG_CLIP - 0.5;\nvar Lib = _dereq_('../../lib');\nvar segmentsIntersect = Lib.segmentsIntersect;\nvar constrain = Lib.constrain;\nvar constants = _dereq_('./constants');\n\n\nmodule.exports = function linePoints(d, opts) {\n var xa = opts.xaxis;\n var ya = opts.yaxis;\n var xLog = xa.type === 'log';\n var yLog = ya.type === 'log';\n var xLen = xa._length;\n var yLen = ya._length;\n var connectGaps = opts.connectGaps;\n var baseTolerance = opts.baseTolerance;\n var shape = opts.shape;\n var linear = shape === 'linear';\n var fill = opts.fill && opts.fill !== 'none';\n var segments = [];\n var minTolerance = constants.minTolerance;\n var len = d.length;\n var pts = new Array(len);\n var pti = 0;\n\n var i;\n\n // pt variables are pixel coordinates [x,y] of one point\n // these four are the outputs of clustering on a line\n var clusterStartPt, clusterEndPt, clusterHighPt, clusterLowPt;\n\n // \"this\" is the next point we're considering adding to the cluster\n var thisPt;\n\n // did we encounter the high point first, then a low point, or vice versa?\n var clusterHighFirst;\n\n // the first two points in the cluster determine its unit vector\n // so the second is always in the \"High\" direction\n var clusterUnitVector;\n\n // the pixel delta from clusterStartPt\n var thisVector;\n\n // val variables are (signed) pixel distances along the cluster vector\n var clusterRefDist, clusterHighVal, clusterLowVal, thisVal;\n\n // deviation variables are (signed) pixel distances normal to the cluster vector\n var clusterMinDeviation, clusterMaxDeviation, thisDeviation;\n\n // turn one calcdata point into pixel coordinates\n function getPt(index) {\n var di = d[index];\n if(!di) return false;\n var x = opts.linearized ? xa.l2p(di.x) : xa.c2p(di.x);\n var y = opts.linearized ? ya.l2p(di.y) : ya.c2p(di.y);\n\n // if non-positive log values, set them VERY far off-screen\n // so the line looks essentially straight from the previous point.\n if(x === BADNUM) {\n if(xLog) x = xa.c2p(di.x, true);\n if(x === BADNUM) return false;\n // If BOTH were bad log values, make the line follow a constant\n // exponent rather than a constant slope\n if(yLog && y === BADNUM) {\n x *= Math.abs(xa._m * yLen * (xa._m > 0 ? LOG_CLIP_PLUS : LOG_CLIP_MINUS) /\n (ya._m * xLen * (ya._m > 0 ? LOG_CLIP_PLUS : LOG_CLIP_MINUS)));\n }\n x *= 1000;\n }\n if(y === BADNUM) {\n if(yLog) y = ya.c2p(di.y, true);\n if(y === BADNUM) return false;\n y *= 1000;\n }\n return [x, y];\n }\n\n function crossesViewport(xFrac0, yFrac0, xFrac1, yFrac1) {\n var dx = xFrac1 - xFrac0;\n var dy = yFrac1 - yFrac0;\n var dx0 = 0.5 - xFrac0;\n var dy0 = 0.5 - yFrac0;\n var norm2 = dx * dx + dy * dy;\n var dot = dx * dx0 + dy * dy0;\n if(dot > 0 && dot < norm2) {\n var cross = dx0 * dy - dy0 * dx;\n if(cross * cross < norm2) return true;\n }\n }\n\n var latestXFrac, latestYFrac;\n // if we're off-screen, increase tolerance over baseTolerance\n function getTolerance(pt, nextPt) {\n var xFrac = pt[0] / xLen;\n var yFrac = pt[1] / yLen;\n var offScreenFraction = Math.max(0, -xFrac, xFrac - 1, -yFrac, yFrac - 1);\n if(offScreenFraction && (latestXFrac !== undefined) &&\n crossesViewport(xFrac, yFrac, latestXFrac, latestYFrac)\n ) {\n offScreenFraction = 0;\n }\n if(offScreenFraction && nextPt &&\n crossesViewport(xFrac, yFrac, nextPt[0] / xLen, nextPt[1] / yLen)\n ) {\n offScreenFraction = 0;\n }\n\n return (1 + constants.toleranceGrowth * offScreenFraction) * baseTolerance;\n }\n\n function ptDist(pt1, pt2) {\n var dx = pt1[0] - pt2[0];\n var dy = pt1[1] - pt2[1];\n return Math.sqrt(dx * dx + dy * dy);\n }\n\n // last bit of filtering: clip paths that are VERY far off-screen\n // so we don't get near the browser's hard limit (+/- 2^29 px in Chrome and FF)\n\n var maxScreensAway = constants.maxScreensAway;\n\n // find the intersections between the segment from pt1 to pt2\n // and the large rectangle maxScreensAway around the viewport\n // if one of pt1 and pt2 is inside and the other outside, there\n // will be only one intersection.\n // if both are outside there will be 0 or 2 intersections\n // (or 1 if it's right at a corner - we'll treat that like 0)\n // returns an array of intersection pts\n var xEdge0 = -xLen * maxScreensAway;\n var xEdge1 = xLen * (1 + maxScreensAway);\n var yEdge0 = -yLen * maxScreensAway;\n var yEdge1 = yLen * (1 + maxScreensAway);\n var edges = [\n [xEdge0, yEdge0, xEdge1, yEdge0],\n [xEdge1, yEdge0, xEdge1, yEdge1],\n [xEdge1, yEdge1, xEdge0, yEdge1],\n [xEdge0, yEdge1, xEdge0, yEdge0]\n ];\n var xEdge, yEdge, lastXEdge, lastYEdge, lastFarPt, edgePt;\n\n // for linear line shape, edge intersections should be linearly interpolated\n // spline uses this too, which isn't precisely correct but is actually pretty\n // good, because Catmull-Rom weights far-away points less in creating the curvature\n function getLinearEdgeIntersections(pt1, pt2) {\n var out = [];\n var ptCount = 0;\n for(var i = 0; i < 4; i++) {\n var edge = edges[i];\n var ptInt = segmentsIntersect(\n pt1[0], pt1[1], pt2[0], pt2[1],\n edge[0], edge[1], edge[2], edge[3]\n );\n if(ptInt && (!ptCount ||\n Math.abs(ptInt.x - out[0][0]) > 1 ||\n Math.abs(ptInt.y - out[0][1]) > 1\n )) {\n ptInt = [ptInt.x, ptInt.y];\n // if we have 2 intersections, make sure the closest one to pt1 comes first\n if(ptCount && ptDist(ptInt, pt1) < ptDist(out[0], pt1)) out.unshift(ptInt);\n else out.push(ptInt);\n ptCount++;\n }\n }\n return out;\n }\n\n function onlyConstrainedPoint(pt) {\n if(pt[0] < xEdge0 || pt[0] > xEdge1 || pt[1] < yEdge0 || pt[1] > yEdge1) {\n return [constrain(pt[0], xEdge0, xEdge1), constrain(pt[1], yEdge0, yEdge1)];\n }\n }\n\n function sameEdge(pt1, pt2) {\n if(pt1[0] === pt2[0] && (pt1[0] === xEdge0 || pt1[0] === xEdge1)) return true;\n if(pt1[1] === pt2[1] && (pt1[1] === yEdge0 || pt1[1] === yEdge1)) return true;\n }\n\n // for line shapes hv and vh, movement in the two dimensions is decoupled,\n // so all we need to do is constrain each dimension independently\n function getHVEdgeIntersections(pt1, pt2) {\n var out = [];\n var ptInt1 = onlyConstrainedPoint(pt1);\n var ptInt2 = onlyConstrainedPoint(pt2);\n if(ptInt1 && ptInt2 && sameEdge(ptInt1, ptInt2)) return out;\n\n if(ptInt1) out.push(ptInt1);\n if(ptInt2) out.push(ptInt2);\n return out;\n }\n\n // hvh and vhv we sometimes have to move one of the intersection points\n // out BEYOND the clipping rect, by a maximum of a factor of 2, so that\n // the midpoint line is drawn in the right place\n function getABAEdgeIntersections(dim, limit0, limit1) {\n return function(pt1, pt2) {\n var ptInt1 = onlyConstrainedPoint(pt1);\n var ptInt2 = onlyConstrainedPoint(pt2);\n\n var out = [];\n if(ptInt1 && ptInt2 && sameEdge(ptInt1, ptInt2)) return out;\n\n if(ptInt1) out.push(ptInt1);\n if(ptInt2) out.push(ptInt2);\n\n var midShift = 2 * Lib.constrain((pt1[dim] + pt2[dim]) / 2, limit0, limit1) -\n ((ptInt1 || pt1)[dim] + (ptInt2 || pt2)[dim]);\n if(midShift) {\n var ptToAlter;\n if(ptInt1 && ptInt2) {\n ptToAlter = (midShift > 0 === ptInt1[dim] > ptInt2[dim]) ? ptInt1 : ptInt2;\n } else ptToAlter = ptInt1 || ptInt2;\n\n ptToAlter[dim] += midShift;\n }\n\n return out;\n };\n }\n\n var getEdgeIntersections;\n if(shape === 'linear' || shape === 'spline') {\n getEdgeIntersections = getLinearEdgeIntersections;\n } else if(shape === 'hv' || shape === 'vh') {\n getEdgeIntersections = getHVEdgeIntersections;\n } else if(shape === 'hvh') getEdgeIntersections = getABAEdgeIntersections(0, xEdge0, xEdge1);\n else if(shape === 'vhv') getEdgeIntersections = getABAEdgeIntersections(1, yEdge0, yEdge1);\n\n // a segment pt1->pt2 entirely outside the nearby region:\n // find the corner it gets closest to touching\n function getClosestCorner(pt1, pt2) {\n var dx = pt2[0] - pt1[0];\n var m = (pt2[1] - pt1[1]) / dx;\n var b = (pt1[1] * pt2[0] - pt2[1] * pt1[0]) / dx;\n\n if(b > 0) return [m > 0 ? xEdge0 : xEdge1, yEdge1];\n else return [m > 0 ? xEdge1 : xEdge0, yEdge0];\n }\n\n function updateEdge(pt) {\n var x = pt[0];\n var y = pt[1];\n var xSame = x === pts[pti - 1][0];\n var ySame = y === pts[pti - 1][1];\n // duplicate point?\n if(xSame && ySame) return;\n if(pti > 1) {\n // backtracking along an edge?\n var xSame2 = x === pts[pti - 2][0];\n var ySame2 = y === pts[pti - 2][1];\n if(xSame && (x === xEdge0 || x === xEdge1) && xSame2) {\n if(ySame2) pti--; // backtracking exactly - drop prev pt and don't add\n else pts[pti - 1] = pt; // not exact: replace the prev pt\n } else if(ySame && (y === yEdge0 || y === yEdge1) && ySame2) {\n if(xSame2) pti--;\n else pts[pti - 1] = pt;\n } else pts[pti++] = pt;\n } else pts[pti++] = pt;\n }\n\n function updateEdgesForReentry(pt) {\n // if we're outside the nearby region and going back in,\n // we may need to loop around a corner point\n if(pts[pti - 1][0] !== pt[0] && pts[pti - 1][1] !== pt[1]) {\n updateEdge([lastXEdge, lastYEdge]);\n }\n updateEdge(pt);\n lastFarPt = null;\n lastXEdge = lastYEdge = 0;\n }\n\n function addPt(pt) {\n latestXFrac = pt[0] / xLen;\n latestYFrac = pt[1] / yLen;\n // Are we more than maxScreensAway off-screen any direction?\n // if so, clip to this box, but in such a way that on-screen\n // drawing is unchanged\n xEdge = (pt[0] < xEdge0) ? xEdge0 : (pt[0] > xEdge1) ? xEdge1 : 0;\n yEdge = (pt[1] < yEdge0) ? yEdge0 : (pt[1] > yEdge1) ? yEdge1 : 0;\n if(xEdge || yEdge) {\n if(!pti) {\n // to get fills right - if first point is far, push it toward the\n // screen in whichever direction(s) are far\n\n pts[pti++] = [xEdge || pt[0], yEdge || pt[1]];\n } else if(lastFarPt) {\n // both this point and the last are outside the nearby region\n // check if we're crossing the nearby region\n var intersections = getEdgeIntersections(lastFarPt, pt);\n if(intersections.length > 1) {\n updateEdgesForReentry(intersections[0]);\n pts[pti++] = intersections[1];\n }\n } else {\n // we're leaving the nearby region - add the point where we left it\n\n edgePt = getEdgeIntersections(pts[pti - 1], pt)[0];\n pts[pti++] = edgePt;\n }\n\n var lastPt = pts[pti - 1];\n if(xEdge && yEdge && (lastPt[0] !== xEdge || lastPt[1] !== yEdge)) {\n // we've gone out beyond a new corner: add the corner too\n // so that the next point will take the right winding\n if(lastFarPt) {\n if(lastXEdge !== xEdge && lastYEdge !== yEdge) {\n if(lastXEdge && lastYEdge) {\n // we've gone around to an opposite corner - we\n // need to add the correct extra corner\n // in order to get the right winding\n updateEdge(getClosestCorner(lastFarPt, pt));\n } else {\n // we're coming from a far edge - the extra corner\n // we need is determined uniquely by the sectors\n updateEdge([lastXEdge || xEdge, lastYEdge || yEdge]);\n }\n } else if(lastXEdge && lastYEdge) {\n updateEdge([lastXEdge, lastYEdge]);\n }\n }\n updateEdge([xEdge, yEdge]);\n } else if((lastXEdge - xEdge) && (lastYEdge - yEdge)) {\n // we're coming from an edge or far corner to an edge - again the\n // extra corner we need is uniquely determined by the sectors\n updateEdge([xEdge || lastXEdge, yEdge || lastYEdge]);\n }\n lastFarPt = pt;\n lastXEdge = xEdge;\n lastYEdge = yEdge;\n } else {\n if(lastFarPt) {\n // this point is in range but the previous wasn't: add its entry pt first\n updateEdgesForReentry(getEdgeIntersections(lastFarPt, pt)[0]);\n }\n\n pts[pti++] = pt;\n }\n }\n\n // loop over ALL points in this trace\n for(i = 0; i < len; i++) {\n clusterStartPt = getPt(i);\n if(!clusterStartPt) continue;\n\n pti = 0;\n lastFarPt = null;\n addPt(clusterStartPt);\n\n // loop over one segment of the trace\n for(i++; i < len; i++) {\n clusterHighPt = getPt(i);\n if(!clusterHighPt) {\n if(connectGaps) continue;\n else break;\n }\n\n // can't decimate if nonlinear line shape\n // TODO: we *could* decimate [hv]{2,3} shapes if we restricted clusters to horz or vert again\n // but spline would be verrry awkward to decimate\n if(!linear || !opts.simplify) {\n addPt(clusterHighPt);\n continue;\n }\n\n var nextPt = getPt(i + 1);\n\n clusterRefDist = ptDist(clusterHighPt, clusterStartPt);\n\n // #3147 - always include the very first and last points for fills\n if(!(fill && (pti === 0 || pti === len - 1)) &&\n clusterRefDist < getTolerance(clusterHighPt, nextPt) * minTolerance) continue;\n\n clusterUnitVector = [\n (clusterHighPt[0] - clusterStartPt[0]) / clusterRefDist,\n (clusterHighPt[1] - clusterStartPt[1]) / clusterRefDist\n ];\n\n clusterLowPt = clusterStartPt;\n clusterHighVal = clusterRefDist;\n clusterLowVal = clusterMinDeviation = clusterMaxDeviation = 0;\n clusterHighFirst = false;\n clusterEndPt = clusterHighPt;\n\n // loop over one cluster of points that collapse onto one line\n for(i++; i < d.length; i++) {\n thisPt = nextPt;\n nextPt = getPt(i + 1);\n if(!thisPt) {\n if(connectGaps) continue;\n else break;\n }\n thisVector = [\n thisPt[0] - clusterStartPt[0],\n thisPt[1] - clusterStartPt[1]\n ];\n // cross product (or dot with normal to the cluster vector)\n thisDeviation = thisVector[0] * clusterUnitVector[1] - thisVector[1] * clusterUnitVector[0];\n clusterMinDeviation = Math.min(clusterMinDeviation, thisDeviation);\n clusterMaxDeviation = Math.max(clusterMaxDeviation, thisDeviation);\n\n if(clusterMaxDeviation - clusterMinDeviation > getTolerance(thisPt, nextPt)) break;\n\n clusterEndPt = thisPt;\n thisVal = thisVector[0] * clusterUnitVector[0] + thisVector[1] * clusterUnitVector[1];\n\n if(thisVal > clusterHighVal) {\n clusterHighVal = thisVal;\n clusterHighPt = thisPt;\n clusterHighFirst = false;\n } else if(thisVal < clusterLowVal) {\n clusterLowVal = thisVal;\n clusterLowPt = thisPt;\n clusterHighFirst = true;\n }\n }\n\n // insert this cluster into pts\n // we've already inserted the start pt, now check if we have high and low pts\n if(clusterHighFirst) {\n addPt(clusterHighPt);\n if(clusterEndPt !== clusterLowPt) addPt(clusterLowPt);\n } else {\n if(clusterLowPt !== clusterStartPt) addPt(clusterLowPt);\n if(clusterEndPt !== clusterHighPt) addPt(clusterHighPt);\n }\n // and finally insert the end pt\n addPt(clusterEndPt);\n\n // have we reached the end of this segment?\n if(i >= d.length || !thisPt) break;\n\n // otherwise we have an out-of-cluster point to insert as next clusterStartPt\n addPt(thisPt);\n clusterStartPt = thisPt;\n }\n\n // to get fills right - repeat what we did at the start\n if(lastFarPt) updateEdge([lastXEdge || lastFarPt[0], lastYEdge || lastFarPt[1]]);\n\n segments.push(pts.slice(0, pti));\n }\n\n return segments;\n};\n\n},{\"../../constants/numerical\":181,\"../../lib\":202,\"./constants\":334}],345:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n\n'use strict';\n\n\n// common to 'scatter' and 'scatterternary'\nmodule.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) {\n var shape = coerce('line.shape');\n if(shape === 'spline') coerce('line.smoothing');\n};\n\n},{}],346:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar LINKEDFILLS = {tonextx: 1, tonexty: 1, tonext: 1};\n\nmodule.exports = function linkTraces(gd, plotinfo, cdscatter) {\n var trace, i, group, prevtrace, groupIndex;\n\n // first sort traces to keep stacks & filled-together groups together\n var groupIndices = {};\n var needsSort = false;\n var prevGroupIndex = -1;\n var nextGroupIndex = 0;\n var prevUnstackedGroupIndex = -1;\n for(i = 0; i < cdscatter.length; i++) {\n trace = cdscatter[i][0].trace;\n group = trace.stackgroup || '';\n if(group) {\n if(group in groupIndices) {\n groupIndex = groupIndices[group];\n } else {\n groupIndex = groupIndices[group] = nextGroupIndex;\n nextGroupIndex++;\n }\n } else if(trace.fill in LINKEDFILLS && prevUnstackedGroupIndex >= 0) {\n groupIndex = prevUnstackedGroupIndex;\n } else {\n groupIndex = prevUnstackedGroupIndex = nextGroupIndex;\n nextGroupIndex++;\n }\n\n if(groupIndex < prevGroupIndex) needsSort = true;\n trace._groupIndex = prevGroupIndex = groupIndex;\n }\n\n var cdscatterSorted = cdscatter.slice();\n if(needsSort) {\n cdscatterSorted.sort(function(a, b) {\n var traceA = a[0].trace;\n var traceB = b[0].trace;\n return (traceA._groupIndex - traceB._groupIndex) ||\n (traceA.index - traceB.index);\n });\n }\n\n // now link traces to each other\n var prevtraces = {};\n for(i = 0; i < cdscatterSorted.length; i++) {\n trace = cdscatterSorted[i][0].trace;\n group = trace.stackgroup || '';\n\n // Note: The check which ensures all cdscatter here are for the same axis and\n // are either cartesian or scatterternary has been removed. This code assumes\n // the passed scattertraces have been filtered to the proper plot types and\n // the proper subplots.\n if(trace.visible === true) {\n trace._nexttrace = null;\n\n if(trace.fill in LINKEDFILLS) {\n prevtrace = prevtraces[group];\n trace._prevtrace = prevtrace || null;\n\n if(prevtrace) {\n prevtrace._nexttrace = trace;\n }\n }\n\n trace._ownfill = (trace.fill && (\n trace.fill.substr(0, 6) === 'tozero' ||\n trace.fill === 'toself' ||\n (trace.fill.substr(0, 2) === 'to' && !trace._prevtrace)\n ));\n\n prevtraces[group] = trace;\n } else {\n trace._prevtrace = trace._nexttrace = trace._ownfill = null;\n }\n }\n\n return cdscatterSorted;\n};\n\n},{}],347:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n\n'use strict';\n\nvar isNumeric = _dereq_('fast-isnumeric');\n\n\n// used in the drawing step for 'scatter' and 'scattegeo' and\n// in the convert step for 'scatter3d'\nmodule.exports = function makeBubbleSizeFn(trace) {\n var marker = trace.marker;\n var sizeRef = marker.sizeref || 1;\n var sizeMin = marker.sizemin || 0;\n\n // for bubble charts, allow scaling the provided value linearly\n // and by area or diameter.\n // Note this only applies to the array-value sizes\n\n var baseFn = (marker.sizemode === 'area') ?\n function(v) { return Math.sqrt(v / sizeRef); } :\n function(v) { return v / sizeRef; };\n\n // TODO add support for position/negative bubbles?\n // TODO add 'sizeoffset' attribute?\n return function(v) {\n var baseSize = baseFn(v / 2);\n\n // don't show non-numeric and negative sizes\n return (isNumeric(baseSize) && (baseSize > 0)) ?\n Math.max(baseSize, sizeMin) :\n 0;\n };\n};\n\n},{\"fast-isnumeric\":11}],348:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n\n'use strict';\n\nmodule.exports = {\n container: 'marker',\n min: 'cmin',\n max: 'cmax'\n};\n\n},{}],349:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar Color = _dereq_('../../components/color');\nvar hasColorscale = _dereq_('../../components/colorscale/helpers').hasColorscale;\nvar colorscaleDefaults = _dereq_('../../components/colorscale/defaults');\n\nvar subTypes = _dereq_('./subtypes');\n\n/*\n * opts: object of flags to control features not all marker users support\n * noLine: caller does not support marker lines\n * gradient: caller supports gradients\n * noSelect: caller does not support selected/unselected attribute containers\n */\nmodule.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout, coerce, opts) {\n var isBubble = subTypes.isBubble(traceIn);\n var lineColor = (traceIn.line || {}).color;\n var defaultMLC;\n\n opts = opts || {};\n\n // marker.color inherit from line.color (even if line.color is an array)\n if(lineColor) defaultColor = lineColor;\n\n coerce('marker.symbol');\n coerce('marker.opacity', isBubble ? 0.7 : 1);\n coerce('marker.size');\n\n coerce('marker.color', defaultColor);\n if(hasColorscale(traceIn, 'marker')) {\n colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: 'marker.', cLetter: 'c'});\n }\n\n if(!opts.noSelect) {\n coerce('selected.marker.color');\n coerce('unselected.marker.color');\n coerce('selected.marker.size');\n coerce('unselected.marker.size');\n }\n\n if(!opts.noLine) {\n // if there's a line with a different color than the marker, use\n // that line color as the default marker line color\n // (except when it's an array)\n // mostly this is for transparent markers to behave nicely\n if(lineColor && !Array.isArray(lineColor) && (traceOut.marker.color !== lineColor)) {\n defaultMLC = lineColor;\n } else if(isBubble) defaultMLC = Color.background;\n else defaultMLC = Color.defaultLine;\n\n coerce('marker.line.color', defaultMLC);\n if(hasColorscale(traceIn, 'marker.line')) {\n colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: 'marker.line.', cLetter: 'c'});\n }\n\n coerce('marker.line.width', isBubble ? 1 : 0);\n }\n\n if(isBubble) {\n coerce('marker.sizeref');\n coerce('marker.sizemin');\n coerce('marker.sizemode');\n }\n\n if(opts.gradient) {\n var gradientType = coerce('marker.gradient.type');\n if(gradientType !== 'none') {\n coerce('marker.gradient.color');\n }\n }\n};\n\n},{\"../../components/color\":75,\"../../components/colorscale/defaults\":85,\"../../components/colorscale/helpers\":86,\"./subtypes\":355}],350:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar dateTick0 = _dereq_('../../lib').dateTick0;\nvar numConstants = _dereq_('../../constants/numerical');\nvar ONEWEEK = numConstants.ONEWEEK;\n\nfunction getPeriod0Dflt(period, calendar) {\n if(period % ONEWEEK === 0) {\n return dateTick0(calendar, 1); // Sunday\n }\n return dateTick0(calendar, 0);\n}\n\nmodule.exports = function handlePeriodDefaults(traceIn, traceOut, layout, coerce, opts) {\n if(!opts) {\n opts = {\n x: true,\n y: true\n };\n }\n\n if(opts.x) {\n var xperiod = coerce('xperiod');\n if(xperiod) {\n coerce('xperiod0', getPeriod0Dflt(xperiod, traceOut.xcalendar));\n coerce('xperiodalignment');\n }\n }\n\n if(opts.y) {\n var yperiod = coerce('yperiod');\n if(yperiod) {\n coerce('yperiod0', getPeriod0Dflt(yperiod, traceOut.ycalendar));\n coerce('yperiodalignment');\n }\n }\n};\n\n},{\"../../constants/numerical\":181,\"../../lib\":202}],351:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n\n'use strict';\n\nvar d3 = _dereq_('d3');\n\nvar Registry = _dereq_('../../registry');\nvar Lib = _dereq_('../../lib');\nvar ensureSingle = Lib.ensureSingle;\nvar identity = Lib.identity;\nvar Drawing = _dereq_('../../components/drawing');\n\nvar subTypes = _dereq_('./subtypes');\nvar linePoints = _dereq_('./line_points');\nvar linkTraces = _dereq_('./link_traces');\nvar polygonTester = _dereq_('../../lib/polygon').tester;\n\nmodule.exports = function plot(gd, plotinfo, cdscatter, scatterLayer, transitionOpts, makeOnCompleteCallback) {\n var join, onComplete;\n\n // If transition config is provided, then it is only a partial replot and traces not\n // updated are removed.\n var isFullReplot = !transitionOpts;\n var hasTransition = !!transitionOpts && transitionOpts.duration > 0;\n\n // Link traces so the z-order of fill layers is correct\n var cdscatterSorted = linkTraces(gd, plotinfo, cdscatter);\n\n join = scatterLayer.selectAll('g.trace')\n .data(cdscatterSorted, function(d) { return d[0].trace.uid; });\n\n // Append new traces:\n join.enter().append('g')\n .attr('class', function(d) {\n return 'trace scatter trace' + d[0].trace.uid;\n })\n .style('stroke-miterlimit', 2);\n join.order();\n\n createFills(gd, join, plotinfo);\n\n if(hasTransition) {\n if(makeOnCompleteCallback) {\n // If it was passed a callback to register completion, make a callback. If\n // this is created, then it must be executed on completion, otherwise the\n // pos-transition redraw will not execute:\n onComplete = makeOnCompleteCallback();\n }\n\n var transition = d3.transition()\n .duration(transitionOpts.duration)\n .ease(transitionOpts.easing)\n .each('end', function() {\n onComplete && onComplete();\n })\n .each('interrupt', function() {\n onComplete && onComplete();\n });\n\n transition.each(function() {\n // Must run the selection again since otherwise enters/updates get grouped together\n // and these get executed out of order. Except we need them in order!\n scatterLayer.selectAll('g.trace').each(function(d, i) {\n plotOne(gd, i, plotinfo, d, cdscatterSorted, this, transitionOpts);\n });\n });\n } else {\n join.each(function(d, i) {\n plotOne(gd, i, plotinfo, d, cdscatterSorted, this, transitionOpts);\n });\n }\n\n if(isFullReplot) {\n join.exit().remove();\n }\n\n // remove paths that didn't get used\n scatterLayer.selectAll('path:not([d])').remove();\n};\n\nfunction createFills(gd, traceJoin, plotinfo) {\n traceJoin.each(function(d) {\n var fills = ensureSingle(d3.select(this), 'g', 'fills');\n Drawing.setClipUrl(fills, plotinfo.layerClipId, gd);\n\n var trace = d[0].trace;\n\n var fillData = [];\n if(trace._ownfill) fillData.push('_ownFill');\n if(trace._nexttrace) fillData.push('_nextFill');\n\n var fillJoin = fills.selectAll('g').data(fillData, identity);\n\n fillJoin.enter().append('g');\n\n fillJoin.exit()\n .each(function(d) { trace[d] = null; })\n .remove();\n\n fillJoin.order().each(function(d) {\n // make a path element inside the fill group, just so\n // we can give it its own data later on and the group can\n // keep its simple '_*Fill' data\n trace[d] = ensureSingle(d3.select(this), 'path', 'js-fill');\n });\n });\n}\n\nfunction plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transitionOpts) {\n var i;\n\n // Since this has been reorganized and we're executing this on individual traces,\n // we need to pass it the full list of cdscatter as well as this trace's index (idx)\n // since it does an internal n^2 loop over comparisons with other traces:\n selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll);\n\n var hasTransition = !!transitionOpts && transitionOpts.duration > 0;\n\n function transition(selection) {\n return hasTransition ? selection.transition() : selection;\n }\n\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n\n var trace = cdscatter[0].trace;\n var line = trace.line;\n var tr = d3.select(element);\n\n var errorBarGroup = ensureSingle(tr, 'g', 'errorbars');\n var lines = ensureSingle(tr, 'g', 'lines');\n var points = ensureSingle(tr, 'g', 'points');\n var text = ensureSingle(tr, 'g', 'text');\n\n // error bars are at the bottom\n Registry.getComponentMethod('errorbars', 'plot')(gd, errorBarGroup, plotinfo, transitionOpts);\n\n if(trace.visible !== true) return;\n\n transition(tr).style('opacity', trace.opacity);\n\n // BUILD LINES AND FILLS\n var ownFillEl3, tonext;\n var ownFillDir = trace.fill.charAt(trace.fill.length - 1);\n if(ownFillDir !== 'x' && ownFillDir !== 'y') ownFillDir = '';\n\n // store node for tweaking by selectPoints\n cdscatter[0][plotinfo.isRangePlot ? 'nodeRangePlot3' : 'node3'] = tr;\n\n var prevRevpath = '';\n var prevPolygons = [];\n var prevtrace = trace._prevtrace;\n\n if(prevtrace) {\n prevRevpath = prevtrace._prevRevpath || '';\n tonext = prevtrace._nextFill;\n prevPolygons = prevtrace._polygons;\n }\n\n var thispath;\n var thisrevpath;\n // fullpath is all paths for this curve, joined together straight\n // across gaps, for filling\n var fullpath = '';\n // revpath is fullpath reversed, for fill-to-next\n var revpath = '';\n // functions for converting a point array to a path\n var pathfn, revpathbase, revpathfn;\n // variables used before and after the data join\n var pt0, lastSegment, pt1, thisPolygons;\n\n // initialize line join data / method\n var segments = [];\n var makeUpdate = Lib.noop;\n\n ownFillEl3 = trace._ownFill;\n\n if(subTypes.hasLines(trace) || trace.fill !== 'none') {\n if(tonext) {\n // This tells .style which trace to use for fill information:\n tonext.datum(cdscatter);\n }\n\n if(['hv', 'vh', 'hvh', 'vhv'].indexOf(line.shape) !== -1) {\n pathfn = Drawing.steps(line.shape);\n revpathbase = Drawing.steps(\n line.shape.split('').reverse().join('')\n );\n } else if(line.shape === 'spline') {\n pathfn = revpathbase = function(pts) {\n var pLast = pts[pts.length - 1];\n if(pts.length > 1 && pts[0][0] === pLast[0] && pts[0][1] === pLast[1]) {\n // identical start and end points: treat it as a\n // closed curve so we don't get a kink\n return Drawing.smoothclosed(pts.slice(1), line.smoothing);\n } else {\n return Drawing.smoothopen(pts, line.smoothing);\n }\n };\n } else {\n pathfn = revpathbase = function(pts) {\n return 'M' + pts.join('L');\n };\n }\n\n revpathfn = function(pts) {\n // note: this is destructive (reverses pts in place) so can't use pts after this\n return revpathbase(pts.reverse());\n };\n\n segments = linePoints(cdscatter, {\n xaxis: xa,\n yaxis: ya,\n connectGaps: trace.connectgaps,\n baseTolerance: Math.max(line.width || 1, 3) / 4,\n shape: line.shape,\n simplify: line.simplify,\n fill: trace.fill\n });\n\n // since we already have the pixel segments here, use them to make\n // polygons for hover on fill\n // TODO: can we skip this if hoveron!=fills? That would mean we\n // need to redraw when you change hoveron...\n thisPolygons = trace._polygons = new Array(segments.length);\n for(i = 0; i < segments.length; i++) {\n trace._polygons[i] = polygonTester(segments[i]);\n }\n\n if(segments.length) {\n pt0 = segments[0][0];\n lastSegment = segments[segments.length - 1];\n pt1 = lastSegment[lastSegment.length - 1];\n }\n\n makeUpdate = function(isEnter) {\n return function(pts) {\n thispath = pathfn(pts);\n thisrevpath = revpathfn(pts);\n if(!fullpath) {\n fullpath = thispath;\n revpath = thisrevpath;\n } else if(ownFillDir) {\n fullpath += 'L' + thispath.substr(1);\n revpath = thisrevpath + ('L' + revpath.substr(1));\n } else {\n fullpath += 'Z' + thispath;\n revpath = thisrevpath + 'Z' + revpath;\n }\n\n if(subTypes.hasLines(trace) && pts.length > 1) {\n var el = d3.select(this);\n\n // This makes the coloring work correctly:\n el.datum(cdscatter);\n\n if(isEnter) {\n transition(el.style('opacity', 0)\n .attr('d', thispath)\n .call(Drawing.lineGroupStyle))\n .style('opacity', 1);\n } else {\n var sel = transition(el);\n sel.attr('d', thispath);\n Drawing.singleLineStyle(cdscatter, sel);\n }\n }\n };\n };\n }\n\n var lineJoin = lines.selectAll('.js-line').data(segments);\n\n transition(lineJoin.exit())\n .style('opacity', 0)\n .remove();\n\n lineJoin.each(makeUpdate(false));\n\n lineJoin.enter().append('path')\n .classed('js-line', true)\n .style('vector-effect', 'non-scaling-stroke')\n .call(Drawing.lineGroupStyle)\n .each(makeUpdate(true));\n\n Drawing.setClipUrl(lineJoin, plotinfo.layerClipId, gd);\n\n function clearFill(selection) {\n transition(selection).attr('d', 'M0,0Z');\n }\n\n if(segments.length) {\n if(ownFillEl3) {\n ownFillEl3.datum(cdscatter);\n if(pt0 && pt1) {\n if(ownFillDir) {\n if(ownFillDir === 'y') {\n pt0[1] = pt1[1] = ya.c2p(0, true);\n } else if(ownFillDir === 'x') {\n pt0[0] = pt1[0] = xa.c2p(0, true);\n }\n\n // fill to zero: full trace path, plus extension of\n // the endpoints to the appropriate axis\n // For the sake of animations, wrap the points around so that\n // the points on the axes are the first two points. Otherwise\n // animations get a little crazy if the number of points changes.\n transition(ownFillEl3).attr('d', 'M' + pt1 + 'L' + pt0 + 'L' + fullpath.substr(1))\n .call(Drawing.singleFillStyle);\n } else {\n // fill to self: just join the path to itself\n transition(ownFillEl3).attr('d', fullpath + 'Z')\n .call(Drawing.singleFillStyle);\n }\n }\n } else if(tonext) {\n if(trace.fill.substr(0, 6) === 'tonext' && fullpath && prevRevpath) {\n // fill to next: full trace path, plus the previous path reversed\n if(trace.fill === 'tonext') {\n // tonext: for use by concentric shapes, like manually constructed\n // contours, we just add the two paths closed on themselves.\n // This makes strange results if one path is *not* entirely\n // inside the other, but then that is a strange usage.\n transition(tonext).attr('d', fullpath + 'Z' + prevRevpath + 'Z')\n .call(Drawing.singleFillStyle);\n } else {\n // tonextx/y: for now just connect endpoints with lines. This is\n // the correct behavior if the endpoints are at the same value of\n // y/x, but if they *aren't*, we should ideally do more complicated\n // things depending on whether the new endpoint projects onto the\n // existing curve or off the end of it\n transition(tonext).attr('d', fullpath + 'L' + prevRevpath.substr(1) + 'Z')\n .call(Drawing.singleFillStyle);\n }\n trace._polygons = trace._polygons.concat(prevPolygons);\n } else {\n clearFill(tonext);\n trace._polygons = null;\n }\n }\n trace._prevRevpath = revpath;\n trace._prevPolygons = thisPolygons;\n } else {\n if(ownFillEl3) clearFill(ownFillEl3);\n else if(tonext) clearFill(tonext);\n trace._polygons = trace._prevRevpath = trace._prevPolygons = null;\n }\n\n\n function visFilter(d) {\n return d.filter(function(v) { return !v.gap && v.vis; });\n }\n\n function visFilterWithGaps(d) {\n return d.filter(function(v) { return v.vis; });\n }\n\n function gapFilter(d) {\n return d.filter(function(v) { return !v.gap; });\n }\n\n function keyFunc(d) {\n return d.id;\n }\n\n // Returns a function if the trace is keyed, otherwise returns undefined\n function getKeyFunc(trace) {\n if(trace.ids) {\n return keyFunc;\n }\n }\n\n function hideFilter() {\n return false;\n }\n\n function makePoints(points, text, cdscatter) {\n var join, selection, hasNode;\n\n var trace = cdscatter[0].trace;\n var showMarkers = subTypes.hasMarkers(trace);\n var showText = subTypes.hasText(trace);\n\n var keyFunc = getKeyFunc(trace);\n var markerFilter = hideFilter;\n var textFilter = hideFilter;\n\n if(showMarkers || showText) {\n var showFilter = identity;\n // if we're stacking, \"infer zero\" gap mode gets markers in the\n // gap points - because we've inferred a zero there - but other\n // modes (currently \"interpolate\", later \"interrupt\" hopefully)\n // we don't draw generated markers\n var stackGroup = trace.stackgroup;\n var isInferZero = stackGroup && (\n gd._fullLayout._scatterStackOpts[xa._id + ya._id][stackGroup].stackgaps === 'infer zero');\n if(trace.marker.maxdisplayed || trace._needsCull) {\n showFilter = isInferZero ? visFilterWithGaps : visFilter;\n } else if(stackGroup && !isInferZero) {\n showFilter = gapFilter;\n }\n\n if(showMarkers) markerFilter = showFilter;\n if(showText) textFilter = showFilter;\n }\n\n // marker points\n\n selection = points.selectAll('path.point');\n\n join = selection.data(markerFilter, keyFunc);\n\n var enter = join.enter().append('path')\n .classed('point', true);\n\n if(hasTransition) {\n enter\n .call(Drawing.pointStyle, trace, gd)\n .call(Drawing.translatePoints, xa, ya)\n .style('opacity', 0)\n .transition()\n .style('opacity', 1);\n }\n\n join.order();\n\n var styleFns;\n if(showMarkers) {\n styleFns = Drawing.makePointStyleFns(trace);\n }\n\n join.each(function(d) {\n var el = d3.select(this);\n var sel = transition(el);\n hasNode = Drawing.translatePoint(d, sel, xa, ya);\n\n if(hasNode) {\n Drawing.singlePointStyle(d, sel, trace, styleFns, gd);\n\n if(plotinfo.layerClipId) {\n Drawing.hideOutsideRangePoint(d, sel, xa, ya, trace.xcalendar, trace.ycalendar);\n }\n\n if(trace.customdata) {\n el.classed('plotly-customdata', d.data !== null && d.data !== undefined);\n }\n } else {\n sel.remove();\n }\n });\n\n if(hasTransition) {\n join.exit().transition()\n .style('opacity', 0)\n .remove();\n } else {\n join.exit().remove();\n }\n\n // text points\n selection = text.selectAll('g');\n join = selection.data(textFilter, keyFunc);\n\n // each text needs to go in its own 'g' in case\n // it gets converted to mathjax\n join.enter().append('g').classed('textpoint', true).append('text');\n\n join.order();\n\n join.each(function(d) {\n var g = d3.select(this);\n var sel = transition(g.select('text'));\n hasNode = Drawing.translatePoint(d, sel, xa, ya);\n\n if(hasNode) {\n if(plotinfo.layerClipId) {\n Drawing.hideOutsideRangePoint(d, g, xa, ya, trace.xcalendar, trace.ycalendar);\n }\n } else {\n g.remove();\n }\n });\n\n join.selectAll('text')\n .call(Drawing.textPointStyle, trace, gd)\n .each(function(d) {\n // This just *has* to be totally custom because of SVG text positioning :(\n // It's obviously copied from translatePoint; we just can't use that\n var x = xa.c2p(d.x);\n var y = ya.c2p(d.y);\n\n d3.select(this).selectAll('tspan.line').each(function() {\n transition(d3.select(this)).attr({x: x, y: y});\n });\n });\n\n join.exit().remove();\n }\n\n points.datum(cdscatter);\n text.datum(cdscatter);\n makePoints(points, text, cdscatter);\n\n // lastly, clip points groups of `cliponaxis !== false` traces\n // on `plotinfo._hasClipOnAxisFalse === true` subplots\n var hasClipOnAxisFalse = trace.cliponaxis === false;\n var clipUrl = hasClipOnAxisFalse ? null : plotinfo.layerClipId;\n Drawing.setClipUrl(points, clipUrl, gd);\n Drawing.setClipUrl(text, clipUrl, gd);\n}\n\nfunction selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) {\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n var xr = d3.extent(Lib.simpleMap(xa.range, xa.r2c));\n var yr = d3.extent(Lib.simpleMap(ya.range, ya.r2c));\n\n var trace = cdscatter[0].trace;\n if(!subTypes.hasMarkers(trace)) return;\n // if marker.maxdisplayed is used, select a maximum of\n // mnum markers to show, from the set that are in the viewport\n var mnum = trace.marker.maxdisplayed;\n\n // TODO: remove some as we get away from the viewport?\n if(mnum === 0) return;\n\n var cd = cdscatter.filter(function(v) {\n return v.x >= xr[0] && v.x <= xr[1] && v.y >= yr[0] && v.y <= yr[1];\n });\n var inc = Math.ceil(cd.length / mnum);\n var tnum = 0;\n cdscatterAll.forEach(function(cdj, j) {\n var tracei = cdj[0].trace;\n if(subTypes.hasMarkers(tracei) &&\n tracei.marker.maxdisplayed > 0 && j < idx) {\n tnum++;\n }\n });\n\n // if multiple traces use maxdisplayed, stagger which markers we\n // display this formula offsets successive traces by 1/3 of the\n // increment, adding an extra small amount after each triplet so\n // it's not quite periodic\n var i0 = Math.round(tnum * inc / 3 + Math.floor(tnum / 3) * inc / 7.1);\n\n // for error bars: save in cd which markers to show\n // so we don't have to repeat this\n cdscatter.forEach(function(v) { delete v.vis; });\n cd.forEach(function(v, i) {\n if(Math.round((i + i0) % inc) === 0) v.vis = true;\n });\n}\n\n},{\"../../components/drawing\":97,\"../../lib\":202,\"../../lib/polygon\":214,\"../../registry\":290,\"./line_points\":344,\"./link_traces\":346,\"./subtypes\":355,\"d3\":9}],352:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n\n'use strict';\n\nvar subtypes = _dereq_('./subtypes');\n\nmodule.exports = function selectPoints(searchInfo, selectionTester) {\n var cd = searchInfo.cd;\n var xa = searchInfo.xaxis;\n var ya = searchInfo.yaxis;\n var selection = [];\n var trace = cd[0].trace;\n var i;\n var di;\n var x;\n var y;\n\n var hasOnlyLines = (!subtypes.hasMarkers(trace) && !subtypes.hasText(trace));\n if(hasOnlyLines) return [];\n\n if(selectionTester === false) { // clear selection\n for(i = 0; i < cd.length; i++) {\n cd[i].selected = 0;\n }\n } else {\n for(i = 0; i < cd.length; i++) {\n di = cd[i];\n x = xa.c2p(di.x);\n y = ya.c2p(di.y);\n\n if((di.i !== null) && selectionTester.contains([x, y], false, i, searchInfo)) {\n selection.push({\n pointNumber: di.i,\n x: xa.c2d(di.x),\n y: ya.c2d(di.y)\n });\n di.selected = 1;\n } else {\n di.selected = 0;\n }\n }\n }\n\n return selection;\n};\n\n},{\"./subtypes\":355}],353:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar perStackAttrs = ['orientation', 'groupnorm', 'stackgaps'];\n\nmodule.exports = function handleStackDefaults(traceIn, traceOut, layout, coerce) {\n var stackOpts = layout._scatterStackOpts;\n\n var stackGroup = coerce('stackgroup');\n if(stackGroup) {\n // use independent stacking options per subplot\n var subplot = traceOut.xaxis + traceOut.yaxis;\n var subplotStackOpts = stackOpts[subplot];\n if(!subplotStackOpts) subplotStackOpts = stackOpts[subplot] = {};\n\n var groupOpts = subplotStackOpts[stackGroup];\n var firstTrace = false;\n if(groupOpts) {\n groupOpts.traces.push(traceOut);\n } else {\n groupOpts = subplotStackOpts[stackGroup] = {\n // keep track of trace indices for use during stacking calculations\n // this will be filled in during `calc` and used during `crossTraceCalc`\n // so it's OK if we don't recreate it during a non-calc edit\n traceIndices: [],\n // Hold on to the whole set of prior traces\n // First one is most important, so we can clear defaults\n // there if we find explicit values only in later traces.\n // We're only going to *use* the values stored in groupOpts,\n // but for the editor and validate we want things self-consistent\n // The full set of traces is used only to fix `fill` default if\n // we find `orientation: 'h'` beyond the first trace\n traces: [traceOut]\n };\n firstTrace = true;\n }\n // TODO: how is this going to work with groupby transforms?\n // in principle it should be OK I guess, as long as explicit group styles\n // don't override explicit base-trace styles?\n\n var dflts = {\n orientation: (traceOut.x && !traceOut.y) ? 'h' : 'v'\n };\n\n for(var i = 0; i < perStackAttrs.length; i++) {\n var attr = perStackAttrs[i];\n var attrFound = attr + 'Found';\n if(!groupOpts[attrFound]) {\n var traceHasAttr = traceIn[attr] !== undefined;\n var isOrientation = attr === 'orientation';\n if(traceHasAttr || firstTrace) {\n groupOpts[attr] = coerce(attr, dflts[attr]);\n\n if(isOrientation) {\n groupOpts.fillDflt = groupOpts[attr] === 'h' ?\n 'tonextx' : 'tonexty';\n }\n\n if(traceHasAttr) {\n // Note: this will show a value here even if it's invalid\n // in which case it will revert to default.\n groupOpts[attrFound] = true;\n\n // Note: only one trace in the stack will get a _fullData\n // entry for a given stack-wide attribute. If no traces\n // (or the first trace) specify that attribute, the\n // first trace will get it. If the first trace does NOT\n // specify it but some later trace does, then it gets\n // removed from the first trace and only included in the\n // one that specified it. This is mostly important for\n // editors (that want to see the full values to know\n // what settings are available) and Plotly.react diffing.\n // Editors may want to use fullLayout._scatterStackOpts\n // directly and make these settings available from all\n // traces in the stack... then set the new value into\n // the first trace, and clear all later traces.\n if(!firstTrace) {\n delete groupOpts.traces[0][attr];\n\n // orientation can affect default fill of previous traces\n if(isOrientation) {\n for(var j = 0; j < groupOpts.traces.length - 1; j++) {\n var trace2 = groupOpts.traces[j];\n if(trace2._input.fill !== trace2.fill) {\n trace2.fill = groupOpts.fillDflt;\n }\n }\n }\n }\n }\n }\n }\n }\n return groupOpts;\n }\n};\n\n},{}],354:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n\n'use strict';\n\nvar d3 = _dereq_('d3');\nvar Drawing = _dereq_('../../components/drawing');\nvar Registry = _dereq_('../../registry');\n\nfunction style(gd) {\n var s = d3.select(gd).selectAll('g.trace.scatter');\n\n s.style('opacity', function(d) {\n return d[0].trace.opacity;\n });\n\n s.selectAll('g.points').each(function(d) {\n var sel = d3.select(this);\n var trace = d.trace || d[0].trace;\n stylePoints(sel, trace, gd);\n });\n\n s.selectAll('g.text').each(function(d) {\n var sel = d3.select(this);\n var trace = d.trace || d[0].trace;\n styleText(sel, trace, gd);\n });\n\n s.selectAll('g.trace path.js-line')\n .call(Drawing.lineGroupStyle);\n\n s.selectAll('g.trace path.js-fill')\n .call(Drawing.fillGroupStyle);\n\n Registry.getComponentMethod('errorbars', 'style')(s);\n}\n\nfunction stylePoints(sel, trace, gd) {\n Drawing.pointStyle(sel.selectAll('path.point'), trace, gd);\n}\n\nfunction styleText(sel, trace, gd) {\n Drawing.textPointStyle(sel.selectAll('text'), trace, gd);\n}\n\nfunction styleOnSelect(gd, cd, sel) {\n var trace = cd[0].trace;\n\n if(trace.selectedpoints) {\n Drawing.selectedPointStyle(sel.selectAll('path.point'), trace);\n Drawing.selectedTextStyle(sel.selectAll('text'), trace);\n } else {\n stylePoints(sel, trace, gd);\n styleText(sel, trace, gd);\n }\n}\n\nmodule.exports = {\n style: style,\n stylePoints: stylePoints,\n styleText: styleText,\n styleOnSelect: styleOnSelect\n};\n\n},{\"../../components/drawing\":97,\"../../registry\":290,\"d3\":9}],355:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n\n'use strict';\n\nvar Lib = _dereq_('../../lib');\n\nmodule.exports = {\n hasLines: function(trace) {\n return trace.visible && trace.mode &&\n trace.mode.indexOf('lines') !== -1;\n },\n\n hasMarkers: function(trace) {\n return trace.visible && (\n (trace.mode && trace.mode.indexOf('markers') !== -1) ||\n // until splom implements 'mode'\n trace.type === 'splom'\n );\n },\n\n hasText: function(trace) {\n return trace.visible && trace.mode &&\n trace.mode.indexOf('text') !== -1;\n },\n\n isBubble: function(trace) {\n return Lib.isPlainObject(trace.marker) &&\n Lib.isArrayOrTypedArray(trace.marker.size);\n }\n};\n\n},{\"../../lib\":202}],356:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n\n'use strict';\n\nvar Lib = _dereq_('../../lib');\n\n/*\n * opts: object of flags to control features not all text users support\n * noSelect: caller does not support selected/unselected attribute containers\n */\nmodule.exports = function(traceIn, traceOut, layout, coerce, opts) {\n opts = opts || {};\n\n coerce('textposition');\n Lib.coerceFont(coerce, 'textfont', layout.font);\n\n if(!opts.noSelect) {\n coerce('selected.textfont.color');\n coerce('unselected.textfont.color');\n }\n};\n\n},{\"../../lib\":202}],357:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\nvar Lib = _dereq_('../../lib');\nvar Registry = _dereq_('../../registry');\n\nmodule.exports = function handleXYDefaults(traceIn, traceOut, layout, coerce) {\n var x = coerce('x');\n var y = coerce('y');\n var len;\n\n var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleTraceDefaults');\n handleCalendarDefaults(traceIn, traceOut, ['x', 'y'], layout);\n\n if(x) {\n var xlen = Lib.minRowLength(x);\n if(y) {\n len = Math.min(xlen, Lib.minRowLength(y));\n } else {\n len = xlen;\n coerce('y0');\n coerce('dy');\n }\n } else {\n if(!y) return 0;\n\n len = Lib.minRowLength(y);\n coerce('x0');\n coerce('dx');\n }\n\n traceOut._length = len;\n\n return len;\n};\n\n},{\"../../lib\":202,\"../../registry\":290}],358:[function(_dereq_,module,exports){\n/**\n* Copyright 2012-2020, Plotly, Inc.\n* All rights reserved.\n*\n* This source code is licensed under the MIT license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\n'use strict';\n\n// package version injected by `npm run preprocess`\nexports.version = '1.58.4';\n\n},{}]},{},[4])(4)\n});\n","'use strict';\n\nmodule.exports = function bind(fn, thisArg) {\n return function wrap() {\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n return fn.apply(thisArg, args);\n };\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @returns {string} The formatted url\n */\nmodule.exports = function buildURL(url, params, paramsSerializer) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n\n var serializedParams;\n if (paramsSerializer) {\n serializedParams = paramsSerializer(params);\n } else if (utils.isURLSearchParams(params)) {\n serializedParams = params.toString();\n } else {\n var parts = [];\n\n utils.forEach(params, function serialize(val, key) {\n if (val === null || typeof val === 'undefined') {\n return;\n }\n\n if (utils.isArray(val)) {\n key = key + '[]';\n } else {\n val = [val];\n }\n\n utils.forEach(val, function parseValue(v) {\n if (utils.isDate(v)) {\n v = v.toISOString();\n } else if (utils.isObject(v)) {\n v = JSON.stringify(v);\n }\n parts.push(encode(key) + '=' + encode(v));\n });\n });\n\n serializedParams = parts.join('&');\n }\n\n if (serializedParams) {\n var hashmarkIndex = url.indexOf('#');\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n};\n","'use strict';\n\nmodule.exports = function isCancel(value) {\n return !!(value && value.__CANCEL__);\n};\n","'use strict';\n\nvar utils = require('./utils');\nvar normalizeHeaderName = require('./helpers/normalizeHeaderName');\n\nvar DEFAULT_CONTENT_TYPE = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n};\n\nfunction setContentTypeIfUnset(headers, value) {\n if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {\n headers['Content-Type'] = value;\n }\n}\n\nfunction getDefaultAdapter() {\n var adapter;\n if (typeof XMLHttpRequest !== 'undefined') {\n // For browsers use XHR adapter\n adapter = require('./adapters/xhr');\n } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {\n // For node use HTTP adapter\n adapter = require('./adapters/http');\n }\n return adapter;\n}\n\nvar defaults = {\n adapter: getDefaultAdapter(),\n\n transformRequest: [function transformRequest(data, headers) {\n normalizeHeaderName(headers, 'Accept');\n normalizeHeaderName(headers, 'Content-Type');\n if (utils.isFormData(data) ||\n utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');\n return data.toString();\n }\n if (utils.isObject(data)) {\n setContentTypeIfUnset(headers, 'application/json;charset=utf-8');\n return JSON.stringify(data);\n }\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n /*eslint no-param-reassign:0*/\n if (typeof data === 'string') {\n try {\n data = JSON.parse(data);\n } catch (e) { /* Ignore */ }\n }\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n maxBodyLength: -1,\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n }\n};\n\ndefaults.headers = {\n common: {\n 'Accept': 'application/json, text/plain, */*'\n }\n};\n\nutils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {\n defaults.headers[method] = {};\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);\n});\n\nmodule.exports = defaults;\n","'use strict';\n\nvar utils = require('./../utils');\nvar settle = require('./../core/settle');\nvar cookies = require('./../helpers/cookies');\nvar buildURL = require('./../helpers/buildURL');\nvar buildFullPath = require('../core/buildFullPath');\nvar parseHeaders = require('./../helpers/parseHeaders');\nvar isURLSameOrigin = require('./../helpers/isURLSameOrigin');\nvar createError = require('../core/createError');\n\nmodule.exports = function xhrAdapter(config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n var requestData = config.data;\n var requestHeaders = config.headers;\n\n if (utils.isFormData(requestData)) {\n delete requestHeaders['Content-Type']; // Let the browser set it\n }\n\n var request = new XMLHttpRequest();\n\n // HTTP basic authentication\n if (config.auth) {\n var username = config.auth.username || '';\n var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';\n requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);\n }\n\n var fullPath = buildFullPath(config.baseURL, config.url);\n request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);\n\n // Set the request timeout in MS\n request.timeout = config.timeout;\n\n // Listen for ready state\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n\n // Prepare the response\n var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;\n var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;\n var response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config: config,\n request: request\n };\n\n settle(resolve, reject, response);\n\n // Clean up request\n request = null;\n };\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(createError('Request aborted', config, 'ECONNABORTED', request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(createError('Network Error', config, null, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';\n if (config.timeoutErrorMessage) {\n timeoutErrorMessage = config.timeoutErrorMessage;\n }\n reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',\n request));\n\n // Clean up request\n request = null;\n };\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n if (utils.isStandardBrowserEnv()) {\n // Add xsrf header\n var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?\n cookies.read(config.xsrfCookieName) :\n undefined;\n\n if (xsrfValue) {\n requestHeaders[config.xsrfHeaderName] = xsrfValue;\n }\n }\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders, function setRequestHeader(val, key) {\n if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {\n // Remove Content-Type if data is undefined\n delete requestHeaders[key];\n } else {\n // Otherwise add header to the request\n request.setRequestHeader(key, val);\n }\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils.isUndefined(config.withCredentials)) {\n request.withCredentials = !!config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (config.responseType) {\n try {\n request.responseType = config.responseType;\n } catch (e) {\n // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.\n // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.\n if (config.responseType !== 'json') {\n throw e;\n }\n }\n }\n\n // Handle progress if needed\n if (typeof config.onDownloadProgress === 'function') {\n request.addEventListener('progress', config.onDownloadProgress);\n }\n\n // Not all browsers support upload events\n if (typeof config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', config.onUploadProgress);\n }\n\n if (config.cancelToken) {\n // Handle cancellation\n config.cancelToken.promise.then(function onCanceled(cancel) {\n if (!request) {\n return;\n }\n\n request.abort();\n reject(cancel);\n // Clean up request\n request = null;\n });\n }\n\n if (!requestData) {\n requestData = null;\n }\n\n // Send the request\n request.send(requestData);\n });\n};\n","'use strict';\n\nvar enhanceError = require('./enhanceError');\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The created error.\n */\nmodule.exports = function createError(message, config, code, request, response) {\n var error = new Error(message);\n return enhanceError(error, config, code, request, response);\n};\n","'use strict';\n\nvar utils = require('../utils');\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n * @returns {Object} New object resulting from merging config2 to config1\n */\nmodule.exports = function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n var config = {};\n\n var valueFromConfig2Keys = ['url', 'method', 'data'];\n var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];\n var defaultToConfig2Keys = [\n 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',\n 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',\n 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',\n 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',\n 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'\n ];\n var directMergeKeys = ['validateStatus'];\n\n function getMergedValue(target, source) {\n if (utils.isPlainObject(target) && utils.isPlainObject(source)) {\n return utils.merge(target, source);\n } else if (utils.isPlainObject(source)) {\n return utils.merge({}, source);\n } else if (utils.isArray(source)) {\n return source.slice();\n }\n return source;\n }\n\n function mergeDeepProperties(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(config1[prop], config2[prop]);\n } else if (!utils.isUndefined(config1[prop])) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n }\n\n utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(undefined, config2[prop]);\n }\n });\n\n utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);\n\n utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(undefined, config2[prop]);\n } else if (!utils.isUndefined(config1[prop])) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n });\n\n utils.forEach(directMergeKeys, function merge(prop) {\n if (prop in config2) {\n config[prop] = getMergedValue(config1[prop], config2[prop]);\n } else if (prop in config1) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n });\n\n var axiosKeys = valueFromConfig2Keys\n .concat(mergeDeepPropertiesKeys)\n .concat(defaultToConfig2Keys)\n .concat(directMergeKeys);\n\n var otherKeys = Object\n .keys(config1)\n .concat(Object.keys(config2))\n .filter(function filterAxiosKeys(key) {\n return axiosKeys.indexOf(key) === -1;\n });\n\n utils.forEach(otherKeys, mergeDeepProperties);\n\n return config;\n};\n","'use strict';\n\n/**\n * A `Cancel` is an object that is thrown when an operation is canceled.\n *\n * @class\n * @param {string=} message The message.\n */\nfunction Cancel(message) {\n this.message = message;\n}\n\nCancel.prototype.toString = function toString() {\n return 'Cancel' + (this.message ? ': ' + this.message : '');\n};\n\nCancel.prototype.__CANCEL__ = true;\n\nmodule.exports = Cancel;\n","'use strict';\n\nvar has = Object.prototype.hasOwnProperty;\nvar isArray = Array.isArray;\n\nvar hexTable = (function () {\n var array = [];\n for (var i = 0; i < 256; ++i) {\n array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());\n }\n\n return array;\n}());\n\nvar compactQueue = function compactQueue(queue) {\n while (queue.length > 1) {\n var item = queue.pop();\n var obj = item.obj[item.prop];\n\n if (isArray(obj)) {\n var compacted = [];\n\n for (var j = 0; j < obj.length; ++j) {\n if (typeof obj[j] !== 'undefined') {\n compacted.push(obj[j]);\n }\n }\n\n item.obj[item.prop] = compacted;\n }\n }\n};\n\nvar arrayToObject = function arrayToObject(source, options) {\n var obj = options && options.plainObjects ? Object.create(null) : {};\n for (var i = 0; i < source.length; ++i) {\n if (typeof source[i] !== 'undefined') {\n obj[i] = source[i];\n }\n }\n\n return obj;\n};\n\nvar merge = function merge(target, source, options) {\n if (!source) {\n return target;\n }\n\n if (typeof source !== 'object') {\n if (isArray(target)) {\n target.push(source);\n } else if (target && typeof target === 'object') {\n if ((options && (options.plainObjects || options.allowPrototypes)) || !has.call(Object.prototype, source)) {\n target[source] = true;\n }\n } else {\n return [target, source];\n }\n\n return target;\n }\n\n if (!target || typeof target !== 'object') {\n return [target].concat(source);\n }\n\n var mergeTarget = target;\n if (isArray(target) && !isArray(source)) {\n mergeTarget = arrayToObject(target, options);\n }\n\n if (isArray(target) && isArray(source)) {\n source.forEach(function (item, i) {\n if (has.call(target, i)) {\n var targetItem = target[i];\n if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {\n target[i] = merge(targetItem, item, options);\n } else {\n target.push(item);\n }\n } else {\n target[i] = item;\n }\n });\n return target;\n }\n\n return Object.keys(source).reduce(function (acc, key) {\n var value = source[key];\n\n if (has.call(acc, key)) {\n acc[key] = merge(acc[key], value, options);\n } else {\n acc[key] = value;\n }\n return acc;\n }, mergeTarget);\n};\n\nvar assign = function assignSingleSource(target, source) {\n return Object.keys(source).reduce(function (acc, key) {\n acc[key] = source[key];\n return acc;\n }, target);\n};\n\nvar decode = function (str, decoder, charset) {\n var strWithoutPlus = str.replace(/\\+/g, ' ');\n if (charset === 'iso-8859-1') {\n // unescape never throws, no try...catch needed:\n return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);\n }\n // utf-8\n try {\n return decodeURIComponent(strWithoutPlus);\n } catch (e) {\n return strWithoutPlus;\n }\n};\n\nvar encode = function encode(str, defaultEncoder, charset) {\n // This code was originally written by Brian White (mscdex) for the io.js core querystring library.\n // It has been adapted here for stricter adherence to RFC 3986\n if (str.length === 0) {\n return str;\n }\n\n var string = typeof str === 'string' ? str : String(str);\n\n if (charset === 'iso-8859-1') {\n return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {\n return '%26%23' + parseInt($0.slice(2), 16) + '%3B';\n });\n }\n\n var out = '';\n for (var i = 0; i < string.length; ++i) {\n var c = string.charCodeAt(i);\n\n if (\n c === 0x2D // -\n || c === 0x2E // .\n || c === 0x5F // _\n || c === 0x7E // ~\n || (c >= 0x30 && c <= 0x39) // 0-9\n || (c >= 0x41 && c <= 0x5A) // a-z\n || (c >= 0x61 && c <= 0x7A) // A-Z\n ) {\n out += string.charAt(i);\n continue;\n }\n\n if (c < 0x80) {\n out = out + hexTable[c];\n continue;\n }\n\n if (c < 0x800) {\n out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);\n continue;\n }\n\n if (c < 0xD800 || c >= 0xE000) {\n out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);\n continue;\n }\n\n i += 1;\n c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));\n out += hexTable[0xF0 | (c >> 18)]\n + hexTable[0x80 | ((c >> 12) & 0x3F)]\n + hexTable[0x80 | ((c >> 6) & 0x3F)]\n + hexTable[0x80 | (c & 0x3F)];\n }\n\n return out;\n};\n\nvar compact = function compact(value) {\n var queue = [{ obj: { o: value }, prop: 'o' }];\n var refs = [];\n\n for (var i = 0; i < queue.length; ++i) {\n var item = queue[i];\n var obj = item.obj[item.prop];\n\n var keys = Object.keys(obj);\n for (var j = 0; j < keys.length; ++j) {\n var key = keys[j];\n var val = obj[key];\n if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {\n queue.push({ obj: obj, prop: key });\n refs.push(val);\n }\n }\n }\n\n compactQueue(queue);\n\n return value;\n};\n\nvar isRegExp = function isRegExp(obj) {\n return Object.prototype.toString.call(obj) === '[object RegExp]';\n};\n\nvar isBuffer = function isBuffer(obj) {\n if (!obj || typeof obj !== 'object') {\n return false;\n }\n\n return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));\n};\n\nvar combine = function combine(a, b) {\n return [].concat(a, b);\n};\n\nmodule.exports = {\n arrayToObject: arrayToObject,\n assign: assign,\n combine: combine,\n compact: compact,\n decode: decode,\n encode: encode,\n isBuffer: isBuffer,\n isRegExp: isRegExp,\n merge: merge\n};\n","'use strict';\n\nvar replace = String.prototype.replace;\nvar percentTwenties = /%20/g;\n\nmodule.exports = {\n 'default': 'RFC3986',\n formatters: {\n RFC1738: function (value) {\n return replace.call(value, percentTwenties, '+');\n },\n RFC3986: function (value) {\n return value;\n }\n },\n RFC1738: 'RFC1738',\n RFC3986: 'RFC3986'\n};\n","'use strict';\n\nfunction checkDCE() {\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\n if (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined' ||\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE !== 'function'\n ) {\n return;\n }\n if (process.env.NODE_ENV !== 'production') {\n // This branch is unreachable because this function is only called\n // in production, but the condition is true only in development.\n // Therefore if the branch is still here, dead code elimination wasn't\n // properly applied.\n // Don't change the message. React DevTools relies on it. Also make sure\n // this message doesn't occur elsewhere in this function, or it will cause\n // a false positive.\n throw new Error('^_^');\n }\n try {\n // Verify that the code above has been dead code eliminated (DCE'd).\n __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE);\n } catch (err) {\n // DevTools shouldn't crash React, no matter what.\n // We should still report in case we break this code.\n console.error(err);\n }\n}\n\nif (process.env.NODE_ENV === 'production') {\n // DCE check should happen before ReactDOM bundle executes so that\n // DevTools can report bad minification during injection.\n checkDCE();\n module.exports = require('./cjs/react-dom.production.min.js');\n} else {\n module.exports = require('./cjs/react-dom.development.js');\n}\n","export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}","module.exports = require('./lib/axios');","'use strict';\n\nvar stringify = require('./stringify');\nvar parse = require('./parse');\nvar formats = require('./formats');\n\nmodule.exports = {\n formats: formats,\n parse: parse,\n stringify: stringify\n};\n","export default function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}","import arrayWithHoles from \"@babel/runtime/helpers/esm/arrayWithHoles\";\nimport iterableToArrayLimit from \"@babel/runtime/helpers/esm/iterableToArrayLimit\";\nimport unsupportedIterableToArray from \"@babel/runtime/helpers/esm/unsupportedIterableToArray\";\nimport nonIterableRest from \"@babel/runtime/helpers/esm/nonIterableRest\";\nexport default function _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}","export default function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}","export default function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}","import arrayLikeToArray from \"@babel/runtime/helpers/esm/arrayLikeToArray\";\nexport default function _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}","export default function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","export default function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}","import _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nexport default function _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","import getPrototypeOf from \"@babel/runtime/helpers/esm/getPrototypeOf\";\nimport isNativeReflectConstruct from \"@babel/runtime/helpers/esm/isNativeReflectConstruct\";\nimport possibleConstructorReturn from \"@babel/runtime/helpers/esm/possibleConstructorReturn\";\nexport default function _createSuper(Derived) {\n var hasNativeReflectConstruct = isNativeReflectConstruct();\n return function _createSuperInternal() {\n var Super = getPrototypeOf(Derived),\n result;\n\n if (hasNativeReflectConstruct) {\n var NewTarget = getPrototypeOf(this).constructor;\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n\n return possibleConstructorReturn(this, result);\n };\n}","export default function _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"@babel/runtime/helpers/esm/setPrototypeOf\";\nexport default function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}","/** @license React v17.0.2\n * react.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var l=require(\"object-assign\"),n=60103,p=60106;exports.Fragment=60107;exports.StrictMode=60108;exports.Profiler=60114;var q=60109,r=60110,t=60112;exports.Suspense=60113;var u=60115,v=60116;\nif(\"function\"===typeof Symbol&&Symbol.for){var w=Symbol.for;n=w(\"react.element\");p=w(\"react.portal\");exports.Fragment=w(\"react.fragment\");exports.StrictMode=w(\"react.strict_mode\");exports.Profiler=w(\"react.profiler\");q=w(\"react.provider\");r=w(\"react.context\");t=w(\"react.forward_ref\");exports.Suspense=w(\"react.suspense\");u=w(\"react.memo\");v=w(\"react.lazy\")}var x=\"function\"===typeof Symbol&&Symbol.iterator;\nfunction y(a){if(null===a||\"object\"!==typeof a)return null;a=x&&a[x]||a[\"@@iterator\"];return\"function\"===typeof a?a:null}function z(a){for(var b=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+a,c=1;c
b}return!1}function B(a,b,c,d,e,f,g){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=d;this.attributeNamespace=e;this.mustUseProperty=c;this.propertyName=a;this.type=b;this.sanitizeURL=f;this.removeEmptyString=g}var D={};\n\"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style\".split(\" \").forEach(function(a){D[a]=new B(a,0,!1,a,null,!1,!1)});[[\"acceptCharset\",\"accept-charset\"],[\"className\",\"class\"],[\"htmlFor\",\"for\"],[\"httpEquiv\",\"http-equiv\"]].forEach(function(a){var b=a[0];D[b]=new B(b,1,!1,a[1],null,!1,!1)});[\"contentEditable\",\"draggable\",\"spellCheck\",\"value\"].forEach(function(a){D[a]=new B(a,2,!1,a.toLowerCase(),null,!1,!1)});\n[\"autoReverse\",\"externalResourcesRequired\",\"focusable\",\"preserveAlpha\"].forEach(function(a){D[a]=new B(a,2,!1,a,null,!1,!1)});\"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope\".split(\" \").forEach(function(a){D[a]=new B(a,3,!1,a.toLowerCase(),null,!1,!1)});\n[\"checked\",\"multiple\",\"muted\",\"selected\"].forEach(function(a){D[a]=new B(a,3,!0,a,null,!1,!1)});[\"capture\",\"download\"].forEach(function(a){D[a]=new B(a,4,!1,a,null,!1,!1)});[\"cols\",\"rows\",\"size\",\"span\"].forEach(function(a){D[a]=new B(a,6,!1,a,null,!1,!1)});[\"rowSpan\",\"start\"].forEach(function(a){D[a]=new B(a,5,!1,a.toLowerCase(),null,!1,!1)});var oa=/[\\-:]([a-z])/g;function pa(a){return a[1].toUpperCase()}\n\"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height\".split(\" \").forEach(function(a){var b=a.replace(oa,\npa);D[b]=new B(b,1,!1,a,null,!1,!1)});\"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type\".split(\" \").forEach(function(a){var b=a.replace(oa,pa);D[b]=new B(b,1,!1,a,\"http://www.w3.org/1999/xlink\",!1,!1)});[\"xml:base\",\"xml:lang\",\"xml:space\"].forEach(function(a){var b=a.replace(oa,pa);D[b]=new B(b,1,!1,a,\"http://www.w3.org/XML/1998/namespace\",!1,!1)});[\"tabIndex\",\"crossOrigin\"].forEach(function(a){D[a]=new B(a,1,!1,a.toLowerCase(),null,!1,!1)});\nD.xlinkHref=new B(\"xlinkHref\",1,!1,\"xlink:href\",\"http://www.w3.org/1999/xlink\",!0,!1);[\"src\",\"href\",\"action\",\"formAction\"].forEach(function(a){D[a]=new B(a,1,!1,a.toLowerCase(),null,!0,!0)});\nfunction qa(a,b,c,d){var e=D.hasOwnProperty(b)?D[b]:null;var f=null!==e?0===e.type:d?!1:!(2h||e[g]!==f[h])return\"\\n\"+e[g].replace(\" at new \",\" at \");while(1<=g&&0<=h)}break}}}finally{Oa=!1,Error.prepareStackTrace=c}return(a=a?a.displayName||a.name:\"\")?Na(a):\"\"}\nfunction Qa(a){switch(a.tag){case 5:return Na(a.type);case 16:return Na(\"Lazy\");case 13:return Na(\"Suspense\");case 19:return Na(\"SuspenseList\");case 0:case 2:case 15:return a=Pa(a.type,!1),a;case 11:return a=Pa(a.type.render,!1),a;case 22:return a=Pa(a.type._render,!1),a;case 1:return a=Pa(a.type,!0),a;default:return\"\"}}\nfunction Ra(a){if(null==a)return null;if(\"function\"===typeof a)return a.displayName||a.name||null;if(\"string\"===typeof a)return a;switch(a){case ua:return\"Fragment\";case ta:return\"Portal\";case xa:return\"Profiler\";case wa:return\"StrictMode\";case Ba:return\"Suspense\";case Ca:return\"SuspenseList\"}if(\"object\"===typeof a)switch(a.$$typeof){case za:return(a.displayName||\"Context\")+\".Consumer\";case ya:return(a._context.displayName||\"Context\")+\".Provider\";case Aa:var b=a.render;b=b.displayName||b.name||\"\";\nreturn a.displayName||(\"\"!==b?\"ForwardRef(\"+b+\")\":\"ForwardRef\");case Da:return Ra(a.type);case Fa:return Ra(a._render);case Ea:b=a._payload;a=a._init;try{return Ra(a(b))}catch(c){}}return null}function Sa(a){switch(typeof a){case \"boolean\":case \"number\":case \"object\":case \"string\":case \"undefined\":return a;default:return\"\"}}function Ta(a){var b=a.type;return(a=a.nodeName)&&\"input\"===a.toLowerCase()&&(\"checkbox\"===b||\"radio\"===b)}\nfunction Ua(a){var b=Ta(a)?\"checked\":\"value\",c=Object.getOwnPropertyDescriptor(a.constructor.prototype,b),d=\"\"+a[b];if(!a.hasOwnProperty(b)&&\"undefined\"!==typeof c&&\"function\"===typeof c.get&&\"function\"===typeof c.set){var e=c.get,f=c.set;Object.defineProperty(a,b,{configurable:!0,get:function(){return e.call(this)},set:function(a){d=\"\"+a;f.call(this,a)}});Object.defineProperty(a,b,{enumerable:c.enumerable});return{getValue:function(){return d},setValue:function(a){d=\"\"+a},stopTracking:function(){a._valueTracker=\nnull;delete a[b]}}}}function Va(a){a._valueTracker||(a._valueTracker=Ua(a))}function Wa(a){if(!a)return!1;var b=a._valueTracker;if(!b)return!0;var c=b.getValue();var d=\"\";a&&(d=Ta(a)?a.checked?\"true\":\"false\":a.value);a=d;return a!==c?(b.setValue(a),!0):!1}function Xa(a){a=a||(\"undefined\"!==typeof document?document:void 0);if(\"undefined\"===typeof a)return null;try{return a.activeElement||a.body}catch(b){return a.body}}\nfunction Ya(a,b){var c=b.checked;return m({},b,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=c?c:a._wrapperState.initialChecked})}function Za(a,b){var c=null==b.defaultValue?\"\":b.defaultValue,d=null!=b.checked?b.checked:b.defaultChecked;c=Sa(null!=b.value?b.value:c);a._wrapperState={initialChecked:d,initialValue:c,controlled:\"checkbox\"===b.type||\"radio\"===b.type?null!=b.checked:null!=b.value}}function $a(a,b){b=b.checked;null!=b&&qa(a,\"checked\",b,!1)}\nfunction ab(a,b){$a(a,b);var c=Sa(b.value),d=b.type;if(null!=c)if(\"number\"===d){if(0===c&&\"\"===a.value||a.value!=c)a.value=\"\"+c}else a.value!==\"\"+c&&(a.value=\"\"+c);else if(\"submit\"===d||\"reset\"===d){a.removeAttribute(\"value\");return}b.hasOwnProperty(\"value\")?bb(a,b.type,c):b.hasOwnProperty(\"defaultValue\")&&bb(a,b.type,Sa(b.defaultValue));null==b.checked&&null!=b.defaultChecked&&(a.defaultChecked=!!b.defaultChecked)}\nfunction cb(a,b,c){if(b.hasOwnProperty(\"value\")||b.hasOwnProperty(\"defaultValue\")){var d=b.type;if(!(\"submit\"!==d&&\"reset\"!==d||void 0!==b.value&&null!==b.value))return;b=\"\"+a._wrapperState.initialValue;c||b===a.value||(a.value=b);a.defaultValue=b}c=a.name;\"\"!==c&&(a.name=\"\");a.defaultChecked=!!a._wrapperState.initialChecked;\"\"!==c&&(a.name=c)}\nfunction bb(a,b,c){if(\"number\"!==b||Xa(a.ownerDocument)!==a)null==c?a.defaultValue=\"\"+a._wrapperState.initialValue:a.defaultValue!==\"\"+c&&(a.defaultValue=\"\"+c)}function db(a){var b=\"\";aa.Children.forEach(a,function(a){null!=a&&(b+=a)});return b}function eb(a,b){a=m({children:void 0},b);if(b=db(b.children))a.children=b;return a}\nfunction fb(a,b,c,d){a=a.options;if(b){b={};for(var e=0;e=c.length))throw Error(y(93));c=c[0]}b=c}null==b&&(b=\"\");c=b}a._wrapperState={initialValue:Sa(c)}}\nfunction ib(a,b){var c=Sa(b.value),d=Sa(b.defaultValue);null!=c&&(c=\"\"+c,c!==a.value&&(a.value=c),null==b.defaultValue&&a.defaultValue!==c&&(a.defaultValue=c));null!=d&&(a.defaultValue=\"\"+d)}function jb(a){var b=a.textContent;b===a._wrapperState.initialValue&&\"\"!==b&&null!==b&&(a.value=b)}var kb={html:\"http://www.w3.org/1999/xhtml\",mathml:\"http://www.w3.org/1998/Math/MathML\",svg:\"http://www.w3.org/2000/svg\"};\nfunction lb(a){switch(a){case \"svg\":return\"http://www.w3.org/2000/svg\";case \"math\":return\"http://www.w3.org/1998/Math/MathML\";default:return\"http://www.w3.org/1999/xhtml\"}}function mb(a,b){return null==a||\"http://www.w3.org/1999/xhtml\"===a?lb(b):\"http://www.w3.org/2000/svg\"===a&&\"foreignObject\"===b?\"http://www.w3.org/1999/xhtml\":a}\nvar nb,ob=function(a){return\"undefined\"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(b,c,d,e){MSApp.execUnsafeLocalFunction(function(){return a(b,c,d,e)})}:a}(function(a,b){if(a.namespaceURI!==kb.svg||\"innerHTML\"in a)a.innerHTML=b;else{nb=nb||document.createElement(\"div\");nb.innerHTML=\"\";for(b=nb.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;b.firstChild;)a.appendChild(b.firstChild)}});\nfunction pb(a,b){if(b){var c=a.firstChild;if(c&&c===a.lastChild&&3===c.nodeType){c.nodeValue=b;return}}a.textContent=b}\nvar qb={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,\nfloodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},rb=[\"Webkit\",\"ms\",\"Moz\",\"O\"];Object.keys(qb).forEach(function(a){rb.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);qb[b]=qb[a]})});function sb(a,b,c){return null==b||\"boolean\"===typeof b||\"\"===b?\"\":c||\"number\"!==typeof b||0===b||qb.hasOwnProperty(a)&&qb[a]?(\"\"+b).trim():b+\"px\"}\nfunction tb(a,b){a=a.style;for(var c in b)if(b.hasOwnProperty(c)){var d=0===c.indexOf(\"--\"),e=sb(c,b[c],d);\"float\"===c&&(c=\"cssFloat\");d?a.setProperty(c,e):a[c]=e}}var ub=m({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});\nfunction vb(a,b){if(b){if(ub[a]&&(null!=b.children||null!=b.dangerouslySetInnerHTML))throw Error(y(137,a));if(null!=b.dangerouslySetInnerHTML){if(null!=b.children)throw Error(y(60));if(!(\"object\"===typeof b.dangerouslySetInnerHTML&&\"__html\"in b.dangerouslySetInnerHTML))throw Error(y(61));}if(null!=b.style&&\"object\"!==typeof b.style)throw Error(y(62));}}\nfunction wb(a,b){if(-1===a.indexOf(\"-\"))return\"string\"===typeof b.is;switch(a){case \"annotation-xml\":case \"color-profile\":case \"font-face\":case \"font-face-src\":case \"font-face-uri\":case \"font-face-format\":case \"font-face-name\":case \"missing-glyph\":return!1;default:return!0}}function xb(a){a=a.target||a.srcElement||window;a.correspondingUseElement&&(a=a.correspondingUseElement);return 3===a.nodeType?a.parentNode:a}var yb=null,zb=null,Ab=null;\nfunction Bb(a){if(a=Cb(a)){if(\"function\"!==typeof yb)throw Error(y(280));var b=a.stateNode;b&&(b=Db(b),yb(a.stateNode,a.type,b))}}function Eb(a){zb?Ab?Ab.push(a):Ab=[a]:zb=a}function Fb(){if(zb){var a=zb,b=Ab;Ab=zb=null;Bb(a);if(b)for(a=0;ad?0:1<c;c++)b.push(a);return b}\nfunction $c(a,b,c){a.pendingLanes|=b;var d=b-1;a.suspendedLanes&=d;a.pingedLanes&=d;a=a.eventTimes;b=31-Vc(b);a[b]=c}var Vc=Math.clz32?Math.clz32:ad,bd=Math.log,cd=Math.LN2;function ad(a){return 0===a?32:31-(bd(a)/cd|0)|0}var dd=r.unstable_UserBlockingPriority,ed=r.unstable_runWithPriority,fd=!0;function gd(a,b,c,d){Kb||Ib();var e=hd,f=Kb;Kb=!0;try{Hb(e,a,b,c,d)}finally{(Kb=f)||Mb()}}function id(a,b,c,d){ed(dd,hd.bind(null,a,b,c,d))}\nfunction hd(a,b,c,d){if(fd){var e;if((e=0===(b&4))&&0=be),ee=String.fromCharCode(32),fe=!1;\nfunction ge(a,b){switch(a){case \"keyup\":return-1!==$d.indexOf(b.keyCode);case \"keydown\":return 229!==b.keyCode;case \"keypress\":case \"mousedown\":case \"focusout\":return!0;default:return!1}}function he(a){a=a.detail;return\"object\"===typeof a&&\"data\"in a?a.data:null}var ie=!1;function je(a,b){switch(a){case \"compositionend\":return he(b);case \"keypress\":if(32!==b.which)return null;fe=!0;return ee;case \"textInput\":return a=b.data,a===ee&&fe?null:a;default:return null}}\nfunction ke(a,b){if(ie)return\"compositionend\"===a||!ae&&ge(a,b)?(a=nd(),md=ld=kd=null,ie=!1,a):null;switch(a){case \"paste\":return null;case \"keypress\":if(!(b.ctrlKey||b.altKey||b.metaKey)||b.ctrlKey&&b.altKey){if(b.char&&1=b)return{node:c,offset:b-a};a=d}a:{for(;c;){if(c.nextSibling){c=c.nextSibling;break a}c=c.parentNode}c=void 0}c=Ke(c)}}function Me(a,b){return a&&b?a===b?!0:a&&3===a.nodeType?!1:b&&3===b.nodeType?Me(a,b.parentNode):\"contains\"in a?a.contains(b):a.compareDocumentPosition?!!(a.compareDocumentPosition(b)&16):!1:!1}\nfunction Ne(){for(var a=window,b=Xa();b instanceof a.HTMLIFrameElement;){try{var c=\"string\"===typeof b.contentWindow.location.href}catch(d){c=!1}if(c)a=b.contentWindow;else break;b=Xa(a.document)}return b}function Oe(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return b&&(\"input\"===b&&(\"text\"===a.type||\"search\"===a.type||\"tel\"===a.type||\"url\"===a.type||\"password\"===a.type)||\"textarea\"===b||\"true\"===a.contentEditable)}\nvar Pe=fa&&\"documentMode\"in document&&11>=document.documentMode,Qe=null,Re=null,Se=null,Te=!1;\nfunction Ue(a,b,c){var d=c.window===c?c.document:9===c.nodeType?c:c.ownerDocument;Te||null==Qe||Qe!==Xa(d)||(d=Qe,\"selectionStart\"in d&&Oe(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Se&&Je(Se,d)||(Se=d,d=oe(Re,\"onSelect\"),0Af||(a.current=zf[Af],zf[Af]=null,Af--)}function I(a,b){Af++;zf[Af]=a.current;a.current=b}var Cf={},M=Bf(Cf),N=Bf(!1),Df=Cf;\nfunction Ef(a,b){var c=a.type.contextTypes;if(!c)return Cf;var d=a.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===b)return d.__reactInternalMemoizedMaskedChildContext;var e={},f;for(f in c)e[f]=b[f];d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=b,a.__reactInternalMemoizedMaskedChildContext=e);return e}function Ff(a){a=a.childContextTypes;return null!==a&&void 0!==a}function Gf(){H(N);H(M)}function Hf(a,b,c){if(M.current!==Cf)throw Error(y(168));I(M,b);I(N,c)}\nfunction If(a,b,c){var d=a.stateNode;a=b.childContextTypes;if(\"function\"!==typeof d.getChildContext)return c;d=d.getChildContext();for(var e in d)if(!(e in a))throw Error(y(108,Ra(b)||\"Unknown\",e));return m({},c,d)}function Jf(a){a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||Cf;Df=M.current;I(M,a);I(N,N.current);return!0}function Kf(a,b,c){var d=a.stateNode;if(!d)throw Error(y(169));c?(a=If(a,b,Df),d.__reactInternalMemoizedMergedChildContext=a,H(N),H(M),I(M,a)):H(N);I(N,c)}\nvar Lf=null,Mf=null,Nf=r.unstable_runWithPriority,Of=r.unstable_scheduleCallback,Pf=r.unstable_cancelCallback,Qf=r.unstable_shouldYield,Rf=r.unstable_requestPaint,Sf=r.unstable_now,Tf=r.unstable_getCurrentPriorityLevel,Uf=r.unstable_ImmediatePriority,Vf=r.unstable_UserBlockingPriority,Wf=r.unstable_NormalPriority,Xf=r.unstable_LowPriority,Yf=r.unstable_IdlePriority,Zf={},$f=void 0!==Rf?Rf:function(){},ag=null,bg=null,cg=!1,dg=Sf(),O=1E4>dg?Sf:function(){return Sf()-dg};\nfunction eg(){switch(Tf()){case Uf:return 99;case Vf:return 98;case Wf:return 97;case Xf:return 96;case Yf:return 95;default:throw Error(y(332));}}function fg(a){switch(a){case 99:return Uf;case 98:return Vf;case 97:return Wf;case 96:return Xf;case 95:return Yf;default:throw Error(y(332));}}function gg(a,b){a=fg(a);return Nf(a,b)}function hg(a,b,c){a=fg(a);return Of(a,b,c)}function ig(){if(null!==bg){var a=bg;bg=null;Pf(a)}jg()}\nfunction jg(){if(!cg&&null!==ag){cg=!0;var a=0;try{var b=ag;gg(99,function(){for(;az?(q=u,u=null):q=u.sibling;var n=p(e,u,h[z],k);if(null===n){null===u&&(u=q);break}a&&u&&null===\nn.alternate&&b(e,u);g=f(n,g,z);null===t?l=n:t.sibling=n;t=n;u=q}if(z===h.length)return c(e,u),l;if(null===u){for(;zz?(q=u,u=null):q=u.sibling;var w=p(e,u,n.value,k);if(null===w){null===u&&(u=q);break}a&&u&&null===w.alternate&&b(e,u);g=f(w,g,z);null===t?l=w:t.sibling=w;t=w;u=q}if(n.done)return c(e,u),l;if(null===u){for(;!n.done;z++,n=h.next())n=A(e,n.value,k),null!==n&&(g=f(n,g,z),null===t?l=n:t.sibling=n,t=n);return l}for(u=d(e,u);!n.done;z++,n=h.next())n=C(u,e,z,n.value,k),null!==n&&(a&&null!==n.alternate&&\nu.delete(null===n.key?z:n.key),g=f(n,g,z),null===t?l=n:t.sibling=n,t=n);a&&u.forEach(function(a){return b(e,a)});return l}return function(a,d,f,h){var k=\"object\"===typeof f&&null!==f&&f.type===ua&&null===f.key;k&&(f=f.props.children);var l=\"object\"===typeof f&&null!==f;if(l)switch(f.$$typeof){case sa:a:{l=f.key;for(k=d;null!==k;){if(k.key===l){switch(k.tag){case 7:if(f.type===ua){c(a,k.sibling);d=e(k,f.props.children);d.return=a;a=d;break a}break;default:if(k.elementType===f.type){c(a,k.sibling);\nd=e(k,f.props);d.ref=Qg(a,k,f);d.return=a;a=d;break a}}c(a,k);break}else b(a,k);k=k.sibling}f.type===ua?(d=Xg(f.props.children,a.mode,h,f.key),d.return=a,a=d):(h=Vg(f.type,f.key,f.props,null,a.mode,h),h.ref=Qg(a,d,f),h.return=a,a=h)}return g(a);case ta:a:{for(k=f.key;null!==d;){if(d.key===k)if(4===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){c(a,d.sibling);d=e(d,f.children||[]);d.return=a;a=d;break a}else{c(a,d);break}else b(a,d);d=d.sibling}d=\nWg(f,a.mode,h);d.return=a;a=d}return g(a)}if(\"string\"===typeof f||\"number\"===typeof f)return f=\"\"+f,null!==d&&6===d.tag?(c(a,d.sibling),d=e(d,f),d.return=a,a=d):(c(a,d),d=Ug(f,a.mode,h),d.return=a,a=d),g(a);if(Pg(f))return x(a,d,f,h);if(La(f))return w(a,d,f,h);l&&Rg(a,f);if(\"undefined\"===typeof f&&!k)switch(a.tag){case 1:case 22:case 0:case 11:case 15:throw Error(y(152,Ra(a.type)||\"Component\"));}return c(a,d)}}var Yg=Sg(!0),Zg=Sg(!1),$g={},ah=Bf($g),bh=Bf($g),ch=Bf($g);\nfunction dh(a){if(a===$g)throw Error(y(174));return a}function eh(a,b){I(ch,b);I(bh,a);I(ah,$g);a=b.nodeType;switch(a){case 9:case 11:b=(b=b.documentElement)?b.namespaceURI:mb(null,\"\");break;default:a=8===a?b.parentNode:b,b=a.namespaceURI||null,a=a.tagName,b=mb(b,a)}H(ah);I(ah,b)}function fh(){H(ah);H(bh);H(ch)}function gh(a){dh(ch.current);var b=dh(ah.current);var c=mb(b,a.type);b!==c&&(I(bh,a),I(ah,c))}function hh(a){bh.current===a&&(H(ah),H(bh))}var P=Bf(0);\nfunction ih(a){for(var b=a;null!==b;){if(13===b.tag){var c=b.memoizedState;if(null!==c&&(c=c.dehydrated,null===c||\"$?\"===c.data||\"$!\"===c.data))return b}else if(19===b.tag&&void 0!==b.memoizedProps.revealOrder){if(0!==(b.flags&64))return b}else if(null!==b.child){b.child.return=b;b=b.child;continue}if(b===a)break;for(;null===b.sibling;){if(null===b.return||b.return===a)return null;b=b.return}b.sibling.return=b.return;b=b.sibling}return null}var jh=null,kh=null,lh=!1;\nfunction mh(a,b){var c=nh(5,null,null,0);c.elementType=\"DELETED\";c.type=\"DELETED\";c.stateNode=b;c.return=a;c.flags=8;null!==a.lastEffect?(a.lastEffect.nextEffect=c,a.lastEffect=c):a.firstEffect=a.lastEffect=c}function oh(a,b){switch(a.tag){case 5:var c=a.type;b=1!==b.nodeType||c.toLowerCase()!==b.nodeName.toLowerCase()?null:b;return null!==b?(a.stateNode=b,!0):!1;case 6:return b=\"\"===a.pendingProps||3!==b.nodeType?null:b,null!==b?(a.stateNode=b,!0):!1;case 13:return!1;default:return!1}}\nfunction ph(a){if(lh){var b=kh;if(b){var c=b;if(!oh(a,b)){b=rf(c.nextSibling);if(!b||!oh(a,b)){a.flags=a.flags&-1025|2;lh=!1;jh=a;return}mh(jh,c)}jh=a;kh=rf(b.firstChild)}else a.flags=a.flags&-1025|2,lh=!1,jh=a}}function qh(a){for(a=a.return;null!==a&&5!==a.tag&&3!==a.tag&&13!==a.tag;)a=a.return;jh=a}\nfunction rh(a){if(a!==jh)return!1;if(!lh)return qh(a),lh=!0,!1;var b=a.type;if(5!==a.tag||\"head\"!==b&&\"body\"!==b&&!nf(b,a.memoizedProps))for(b=kh;b;)mh(a,b),b=rf(b.nextSibling);qh(a);if(13===a.tag){a=a.memoizedState;a=null!==a?a.dehydrated:null;if(!a)throw Error(y(317));a:{a=a.nextSibling;for(b=0;a;){if(8===a.nodeType){var c=a.data;if(\"/$\"===c){if(0===b){kh=rf(a.nextSibling);break a}b--}else\"$\"!==c&&\"$!\"!==c&&\"$?\"!==c||b++}a=a.nextSibling}kh=null}}else kh=jh?rf(a.stateNode.nextSibling):null;return!0}\nfunction sh(){kh=jh=null;lh=!1}var th=[];function uh(){for(var a=0;af))throw Error(y(301));f+=1;T=S=null;b.updateQueue=null;vh.current=Fh;a=c(d,e)}while(zh)}vh.current=Gh;b=null!==S&&null!==S.next;xh=0;T=S=R=null;yh=!1;if(b)throw Error(y(300));return a}function Hh(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};null===T?R.memoizedState=T=a:T=T.next=a;return T}\nfunction Ih(){if(null===S){var a=R.alternate;a=null!==a?a.memoizedState:null}else a=S.next;var b=null===T?R.memoizedState:T.next;if(null!==b)T=b,S=a;else{if(null===a)throw Error(y(310));S=a;a={memoizedState:S.memoizedState,baseState:S.baseState,baseQueue:S.baseQueue,queue:S.queue,next:null};null===T?R.memoizedState=T=a:T=T.next=a}return T}function Jh(a,b){return\"function\"===typeof b?b(a):b}\nfunction Kh(a){var b=Ih(),c=b.queue;if(null===c)throw Error(y(311));c.lastRenderedReducer=a;var d=S,e=d.baseQueue,f=c.pending;if(null!==f){if(null!==e){var g=e.next;e.next=f.next;f.next=g}d.baseQueue=e=f;c.pending=null}if(null!==e){e=e.next;d=d.baseState;var h=g=f=null,k=e;do{var l=k.lane;if((xh&l)===l)null!==h&&(h=h.next={lane:0,action:k.action,eagerReducer:k.eagerReducer,eagerState:k.eagerState,next:null}),d=k.eagerReducer===a?k.eagerState:a(d,k.action);else{var n={lane:l,action:k.action,eagerReducer:k.eagerReducer,\neagerState:k.eagerState,next:null};null===h?(g=h=n,f=d):h=h.next=n;R.lanes|=l;Dg|=l}k=k.next}while(null!==k&&k!==e);null===h?f=d:h.next=g;He(d,b.memoizedState)||(ug=!0);b.memoizedState=d;b.baseState=f;b.baseQueue=h;c.lastRenderedState=d}return[b.memoizedState,c.dispatch]}\nfunction Lh(a){var b=Ih(),c=b.queue;if(null===c)throw Error(y(311));c.lastRenderedReducer=a;var d=c.dispatch,e=c.pending,f=b.memoizedState;if(null!==e){c.pending=null;var g=e=e.next;do f=a(f,g.action),g=g.next;while(g!==e);He(f,b.memoizedState)||(ug=!0);b.memoizedState=f;null===b.baseQueue&&(b.baseState=f);c.lastRenderedState=f}return[f,d]}\nfunction Mh(a,b,c){var d=b._getVersion;d=d(b._source);var e=b._workInProgressVersionPrimary;if(null!==e)a=e===d;else if(a=a.mutableReadLanes,a=(xh&a)===a)b._workInProgressVersionPrimary=d,th.push(b);if(a)return c(b._source);th.push(b);throw Error(y(350));}\nfunction Nh(a,b,c,d){var e=U;if(null===e)throw Error(y(349));var f=b._getVersion,g=f(b._source),h=vh.current,k=h.useState(function(){return Mh(e,b,c)}),l=k[1],n=k[0];k=T;var A=a.memoizedState,p=A.refs,C=p.getSnapshot,x=A.source;A=A.subscribe;var w=R;a.memoizedState={refs:p,source:b,subscribe:d};h.useEffect(function(){p.getSnapshot=c;p.setSnapshot=l;var a=f(b._source);if(!He(g,a)){a=c(b._source);He(n,a)||(l(a),a=Ig(w),e.mutableReadLanes|=a&e.pendingLanes);a=e.mutableReadLanes;e.entangledLanes|=a;for(var d=\ne.entanglements,h=a;0c?98:c,function(){a(!0)});gg(97\\x3c/script>\",a=a.removeChild(a.firstChild)):\"string\"===typeof d.is?a=g.createElement(c,{is:d.is}):(a=g.createElement(c),\"select\"===c&&(g=a,d.multiple?g.multiple=!0:d.size&&(g.size=d.size))):a=g.createElementNS(a,c);a[wf]=b;a[xf]=d;Bi(a,b,!1,!1);b.stateNode=a;g=wb(c,d);switch(c){case \"dialog\":G(\"cancel\",a);G(\"close\",a);\ne=d;break;case \"iframe\":case \"object\":case \"embed\":G(\"load\",a);e=d;break;case \"video\":case \"audio\":for(e=0;eJi&&(b.flags|=64,f=!0,Fi(d,!1),b.lanes=33554432)}else{if(!f)if(a=ih(g),null!==a){if(b.flags|=64,f=!0,c=a.updateQueue,null!==c&&(b.updateQueue=c,b.flags|=4),Fi(d,!0),null===d.tail&&\"hidden\"===d.tailMode&&!g.alternate&&!lh)return b=b.lastEffect=d.lastEffect,null!==b&&(b.nextEffect=null),null}else 2*O()-d.renderingStartTime>Ji&&1073741824!==c&&(b.flags|=\n64,f=!0,Fi(d,!1),b.lanes=33554432);d.isBackwards?(g.sibling=b.child,b.child=g):(c=d.last,null!==c?c.sibling=g:b.child=g,d.last=g)}return null!==d.tail?(c=d.tail,d.rendering=c,d.tail=c.sibling,d.lastEffect=b.lastEffect,d.renderingStartTime=O(),c.sibling=null,b=P.current,I(P,f?b&1|2:b&1),c):null;case 23:case 24:return Ki(),null!==a&&null!==a.memoizedState!==(null!==b.memoizedState)&&\"unstable-defer-without-hiding\"!==d.mode&&(b.flags|=4),null}throw Error(y(156,b.tag));}\nfunction Li(a){switch(a.tag){case 1:Ff(a.type)&&Gf();var b=a.flags;return b&4096?(a.flags=b&-4097|64,a):null;case 3:fh();H(N);H(M);uh();b=a.flags;if(0!==(b&64))throw Error(y(285));a.flags=b&-4097|64;return a;case 5:return hh(a),null;case 13:return H(P),b=a.flags,b&4096?(a.flags=b&-4097|64,a):null;case 19:return H(P),null;case 4:return fh(),null;case 10:return rg(a),null;case 23:case 24:return Ki(),null;default:return null}}\nfunction Mi(a,b){try{var c=\"\",d=b;do c+=Qa(d),d=d.return;while(d);var e=c}catch(f){e=\"\\nError generating stack: \"+f.message+\"\\n\"+f.stack}return{value:a,source:b,stack:e}}function Ni(a,b){try{console.error(b.value)}catch(c){setTimeout(function(){throw c;})}}var Oi=\"function\"===typeof WeakMap?WeakMap:Map;function Pi(a,b,c){c=zg(-1,c);c.tag=3;c.payload={element:null};var d=b.value;c.callback=function(){Qi||(Qi=!0,Ri=d);Ni(a,b)};return c}\nfunction Si(a,b,c){c=zg(-1,c);c.tag=3;var d=a.type.getDerivedStateFromError;if(\"function\"===typeof d){var e=b.value;c.payload=function(){Ni(a,b);return d(e)}}var f=a.stateNode;null!==f&&\"function\"===typeof f.componentDidCatch&&(c.callback=function(){\"function\"!==typeof d&&(null===Ti?Ti=new Set([this]):Ti.add(this),Ni(a,b));var c=b.stack;this.componentDidCatch(b.value,{componentStack:null!==c?c:\"\"})});return c}var Ui=\"function\"===typeof WeakSet?WeakSet:Set;\nfunction Vi(a){var b=a.ref;if(null!==b)if(\"function\"===typeof b)try{b(null)}catch(c){Wi(a,c)}else b.current=null}function Xi(a,b){switch(b.tag){case 0:case 11:case 15:case 22:return;case 1:if(b.flags&256&&null!==a){var c=a.memoizedProps,d=a.memoizedState;a=b.stateNode;b=a.getSnapshotBeforeUpdate(b.elementType===b.type?c:lg(b.type,c),d);a.__reactInternalSnapshotBeforeUpdate=b}return;case 3:b.flags&256&&qf(b.stateNode.containerInfo);return;case 5:case 6:case 4:case 17:return}throw Error(y(163));}\nfunction Yi(a,b,c){switch(c.tag){case 0:case 11:case 15:case 22:b=c.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){a=b=b.next;do{if(3===(a.tag&3)){var d=a.create;a.destroy=d()}a=a.next}while(a!==b)}b=c.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){a=b=b.next;do{var e=a;d=e.next;e=e.tag;0!==(e&4)&&0!==(e&1)&&(Zi(c,a),$i(c,a));a=d}while(a!==b)}return;case 1:a=c.stateNode;c.flags&4&&(null===b?a.componentDidMount():(d=c.elementType===c.type?b.memoizedProps:lg(c.type,b.memoizedProps),a.componentDidUpdate(d,\nb.memoizedState,a.__reactInternalSnapshotBeforeUpdate)));b=c.updateQueue;null!==b&&Eg(c,b,a);return;case 3:b=c.updateQueue;if(null!==b){a=null;if(null!==c.child)switch(c.child.tag){case 5:a=c.child.stateNode;break;case 1:a=c.child.stateNode}Eg(c,b,a)}return;case 5:a=c.stateNode;null===b&&c.flags&4&&mf(c.type,c.memoizedProps)&&a.focus();return;case 6:return;case 4:return;case 12:return;case 13:null===c.memoizedState&&(c=c.alternate,null!==c&&(c=c.memoizedState,null!==c&&(c=c.dehydrated,null!==c&&Cc(c))));\nreturn;case 19:case 17:case 20:case 21:case 23:case 24:return}throw Error(y(163));}\nfunction aj(a,b){for(var c=a;;){if(5===c.tag){var d=c.stateNode;if(b)d=d.style,\"function\"===typeof d.setProperty?d.setProperty(\"display\",\"none\",\"important\"):d.display=\"none\";else{d=c.stateNode;var e=c.memoizedProps.style;e=void 0!==e&&null!==e&&e.hasOwnProperty(\"display\")?e.display:null;d.style.display=sb(\"display\",e)}}else if(6===c.tag)c.stateNode.nodeValue=b?\"\":c.memoizedProps;else if((23!==c.tag&&24!==c.tag||null===c.memoizedState||c===a)&&null!==c.child){c.child.return=c;c=c.child;continue}if(c===\na)break;for(;null===c.sibling;){if(null===c.return||c.return===a)return;c=c.return}c.sibling.return=c.return;c=c.sibling}}\nfunction bj(a,b){if(Mf&&\"function\"===typeof Mf.onCommitFiberUnmount)try{Mf.onCommitFiberUnmount(Lf,b)}catch(f){}switch(b.tag){case 0:case 11:case 14:case 15:case 22:a=b.updateQueue;if(null!==a&&(a=a.lastEffect,null!==a)){var c=a=a.next;do{var d=c,e=d.destroy;d=d.tag;if(void 0!==e)if(0!==(d&4))Zi(b,c);else{d=b;try{e()}catch(f){Wi(d,f)}}c=c.next}while(c!==a)}break;case 1:Vi(b);a=b.stateNode;if(\"function\"===typeof a.componentWillUnmount)try{a.props=b.memoizedProps,a.state=b.memoizedState,a.componentWillUnmount()}catch(f){Wi(b,\nf)}break;case 5:Vi(b);break;case 4:cj(a,b)}}function dj(a){a.alternate=null;a.child=null;a.dependencies=null;a.firstEffect=null;a.lastEffect=null;a.memoizedProps=null;a.memoizedState=null;a.pendingProps=null;a.return=null;a.updateQueue=null}function ej(a){return 5===a.tag||3===a.tag||4===a.tag}\nfunction fj(a){a:{for(var b=a.return;null!==b;){if(ej(b))break a;b=b.return}throw Error(y(160));}var c=b;b=c.stateNode;switch(c.tag){case 5:var d=!1;break;case 3:b=b.containerInfo;d=!0;break;case 4:b=b.containerInfo;d=!0;break;default:throw Error(y(161));}c.flags&16&&(pb(b,\"\"),c.flags&=-17);a:b:for(c=a;;){for(;null===c.sibling;){if(null===c.return||ej(c.return)){c=null;break a}c=c.return}c.sibling.return=c.return;for(c=c.sibling;5!==c.tag&&6!==c.tag&&18!==c.tag;){if(c.flags&2)continue b;if(null===\nc.child||4===c.tag)continue b;else c.child.return=c,c=c.child}if(!(c.flags&2)){c=c.stateNode;break a}}d?gj(a,c,b):hj(a,c,b)}\nfunction gj(a,b,c){var d=a.tag,e=5===d||6===d;if(e)a=e?a.stateNode:a.stateNode.instance,b?8===c.nodeType?c.parentNode.insertBefore(a,b):c.insertBefore(a,b):(8===c.nodeType?(b=c.parentNode,b.insertBefore(a,c)):(b=c,b.appendChild(a)),c=c._reactRootContainer,null!==c&&void 0!==c||null!==b.onclick||(b.onclick=jf));else if(4!==d&&(a=a.child,null!==a))for(gj(a,b,c),a=a.sibling;null!==a;)gj(a,b,c),a=a.sibling}\nfunction hj(a,b,c){var d=a.tag,e=5===d||6===d;if(e)a=e?a.stateNode:a.stateNode.instance,b?c.insertBefore(a,b):c.appendChild(a);else if(4!==d&&(a=a.child,null!==a))for(hj(a,b,c),a=a.sibling;null!==a;)hj(a,b,c),a=a.sibling}\nfunction cj(a,b){for(var c=b,d=!1,e,f;;){if(!d){d=c.return;a:for(;;){if(null===d)throw Error(y(160));e=d.stateNode;switch(d.tag){case 5:f=!1;break a;case 3:e=e.containerInfo;f=!0;break a;case 4:e=e.containerInfo;f=!0;break a}d=d.return}d=!0}if(5===c.tag||6===c.tag){a:for(var g=a,h=c,k=h;;)if(bj(g,k),null!==k.child&&4!==k.tag)k.child.return=k,k=k.child;else{if(k===h)break a;for(;null===k.sibling;){if(null===k.return||k.return===h)break a;k=k.return}k.sibling.return=k.return;k=k.sibling}f?(g=e,h=c.stateNode,\n8===g.nodeType?g.parentNode.removeChild(h):g.removeChild(h)):e.removeChild(c.stateNode)}else if(4===c.tag){if(null!==c.child){e=c.stateNode.containerInfo;f=!0;c.child.return=c;c=c.child;continue}}else if(bj(a,c),null!==c.child){c.child.return=c;c=c.child;continue}if(c===b)break;for(;null===c.sibling;){if(null===c.return||c.return===b)return;c=c.return;4===c.tag&&(d=!1)}c.sibling.return=c.return;c=c.sibling}}\nfunction ij(a,b){switch(b.tag){case 0:case 11:case 14:case 15:case 22:var c=b.updateQueue;c=null!==c?c.lastEffect:null;if(null!==c){var d=c=c.next;do 3===(d.tag&3)&&(a=d.destroy,d.destroy=void 0,void 0!==a&&a()),d=d.next;while(d!==c)}return;case 1:return;case 5:c=b.stateNode;if(null!=c){d=b.memoizedProps;var e=null!==a?a.memoizedProps:d;a=b.type;var f=b.updateQueue;b.updateQueue=null;if(null!==f){c[xf]=d;\"input\"===a&&\"radio\"===d.type&&null!=d.name&&$a(c,d);wb(a,e);b=wb(a,d);for(e=0;ee&&(e=g);c&=~f}c=e;c=O()-c;c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3E3>c?3E3:4320>\nc?4320:1960*nj(c/1960))-c;if(10 component higher in the tree to provide a loading indicator or placeholder to display.\")}5!==V&&(V=2);k=Mi(k,h);p=\ng;do{switch(p.tag){case 3:f=k;p.flags|=4096;b&=-b;p.lanes|=b;var J=Pi(p,f,b);Bg(p,J);break a;case 1:f=k;var K=p.type,Q=p.stateNode;if(0===(p.flags&64)&&(\"function\"===typeof K.getDerivedStateFromError||null!==Q&&\"function\"===typeof Q.componentDidCatch&&(null===Ti||!Ti.has(Q)))){p.flags|=4096;b&=-b;p.lanes|=b;var L=Si(p,f,b);Bg(p,L);break a}}p=p.return}while(null!==p)}Zj(c)}catch(va){b=va;Y===c&&null!==c&&(Y=c=c.return);continue}break}while(1)}\nfunction Pj(){var a=oj.current;oj.current=Gh;return null===a?Gh:a}function Tj(a,b){var c=X;X|=16;var d=Pj();U===a&&W===b||Qj(a,b);do try{ak();break}catch(e){Sj(a,e)}while(1);qg();X=c;oj.current=d;if(null!==Y)throw Error(y(261));U=null;W=0;return V}function ak(){for(;null!==Y;)bk(Y)}function Rj(){for(;null!==Y&&!Qf();)bk(Y)}function bk(a){var b=ck(a.alternate,a,qj);a.memoizedProps=a.pendingProps;null===b?Zj(a):Y=b;pj.current=null}\nfunction Zj(a){var b=a;do{var c=b.alternate;a=b.return;if(0===(b.flags&2048)){c=Gi(c,b,qj);if(null!==c){Y=c;return}c=b;if(24!==c.tag&&23!==c.tag||null===c.memoizedState||0!==(qj&1073741824)||0===(c.mode&4)){for(var d=0,e=c.child;null!==e;)d|=e.lanes|e.childLanes,e=e.sibling;c.childLanes=d}null!==a&&0===(a.flags&2048)&&(null===a.firstEffect&&(a.firstEffect=b.firstEffect),null!==b.lastEffect&&(null!==a.lastEffect&&(a.lastEffect.nextEffect=b.firstEffect),a.lastEffect=b.lastEffect),1g&&(h=g,g=J,J=h),h=Le(t,J),f=Le(t,g),h&&f&&(1!==v.rangeCount||v.anchorNode!==h.node||v.anchorOffset!==h.offset||v.focusNode!==f.node||v.focusOffset!==f.offset)&&(q=q.createRange(),q.setStart(h.node,h.offset),v.removeAllRanges(),J>g?(v.addRange(q),v.extend(f.node,f.offset)):(q.setEnd(f.node,f.offset),v.addRange(q))))));q=[];for(v=t;v=v.parentNode;)1===v.nodeType&&q.push({element:v,left:v.scrollLeft,top:v.scrollTop});\"function\"===typeof t.focus&&t.focus();for(t=\n0;tO()-jj?Qj(a,0):uj|=c);Mj(a,b)}function lj(a,b){var c=a.stateNode;null!==c&&c.delete(b);b=0;0===b&&(b=a.mode,0===(b&2)?b=1:0===(b&4)?b=99===eg()?1:2:(0===Gj&&(Gj=tj),b=Yc(62914560&~Gj),0===b&&(b=4194304)));c=Hg();a=Kj(a,b);null!==a&&($c(a,b,c),Mj(a,c))}var ck;\nck=function(a,b,c){var d=b.lanes;if(null!==a)if(a.memoizedProps!==b.pendingProps||N.current)ug=!0;else if(0!==(c&d))ug=0!==(a.flags&16384)?!0:!1;else{ug=!1;switch(b.tag){case 3:ri(b);sh();break;case 5:gh(b);break;case 1:Ff(b.type)&&Jf(b);break;case 4:eh(b,b.stateNode.containerInfo);break;case 10:d=b.memoizedProps.value;var e=b.type._context;I(mg,e._currentValue);e._currentValue=d;break;case 13:if(null!==b.memoizedState){if(0!==(c&b.child.childLanes))return ti(a,b,c);I(P,P.current&1);b=hi(a,b,c);return null!==\nb?b.sibling:null}I(P,P.current&1);break;case 19:d=0!==(c&b.childLanes);if(0!==(a.flags&64)){if(d)return Ai(a,b,c);b.flags|=64}e=b.memoizedState;null!==e&&(e.rendering=null,e.tail=null,e.lastEffect=null);I(P,P.current);if(d)break;else return null;case 23:case 24:return b.lanes=0,mi(a,b,c)}return hi(a,b,c)}else ug=!1;b.lanes=0;switch(b.tag){case 2:d=b.type;null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2);a=b.pendingProps;e=Ef(b,M.current);tg(b,c);e=Ch(null,b,d,a,e,c);b.flags|=1;if(\"object\"===\ntypeof e&&null!==e&&\"function\"===typeof e.render&&void 0===e.$$typeof){b.tag=1;b.memoizedState=null;b.updateQueue=null;if(Ff(d)){var f=!0;Jf(b)}else f=!1;b.memoizedState=null!==e.state&&void 0!==e.state?e.state:null;xg(b);var g=d.getDerivedStateFromProps;\"function\"===typeof g&&Gg(b,d,g,a);e.updater=Kg;b.stateNode=e;e._reactInternals=b;Og(b,d,a,c);b=qi(null,b,d,!0,f,c)}else b.tag=0,fi(null,b,e,c),b=b.child;return b;case 16:e=b.elementType;a:{null!==a&&(a.alternate=null,b.alternate=null,b.flags|=2);\na=b.pendingProps;f=e._init;e=f(e._payload);b.type=e;f=b.tag=hk(e);a=lg(e,a);switch(f){case 0:b=li(null,b,e,a,c);break a;case 1:b=pi(null,b,e,a,c);break a;case 11:b=gi(null,b,e,a,c);break a;case 14:b=ii(null,b,e,lg(e.type,a),d,c);break a}throw Error(y(306,e,\"\"));}return b;case 0:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:lg(d,e),li(a,b,d,e,c);case 1:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:lg(d,e),pi(a,b,d,e,c);case 3:ri(b);d=b.updateQueue;if(null===a||null===d)throw Error(y(282));\nd=b.pendingProps;e=b.memoizedState;e=null!==e?e.element:null;yg(a,b);Cg(b,d,null,c);d=b.memoizedState.element;if(d===e)sh(),b=hi(a,b,c);else{e=b.stateNode;if(f=e.hydrate)kh=rf(b.stateNode.containerInfo.firstChild),jh=b,f=lh=!0;if(f){a=e.mutableSourceEagerHydrationData;if(null!=a)for(e=0;e=\nE};k=function(){};exports.unstable_forceFrameRate=function(a){0>a||125>>1,e=a[d];if(void 0!==e&&0I(n,c))void 0!==r&&0>I(r,n)?(a[d]=r,a[v]=c,d=v):(a[d]=n,a[m]=c,d=m);else if(void 0!==r&&0>I(r,c))a[d]=r,a[v]=c,d=v;else break a}}return b}return null}function I(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}var L=[],M=[],N=1,O=null,P=3,Q=!1,R=!1,S=!1;\nfunction T(a){for(var b=J(M);null!==b;){if(null===b.callback)K(M);else if(b.startTime<=a)K(M),b.sortIndex=b.expirationTime,H(L,b);else break;b=J(M)}}function U(a){S=!1;T(a);if(!R)if(null!==J(L))R=!0,f(V);else{var b=J(M);null!==b&&g(U,b.startTime-a)}}\nfunction V(a,b){R=!1;S&&(S=!1,h());Q=!0;var c=P;try{T(b);for(O=J(L);null!==O&&(!(O.expirationTime>b)||a&&!exports.unstable_shouldYield());){var d=O.callback;if(\"function\"===typeof d){O.callback=null;P=O.priorityLevel;var e=d(O.expirationTime<=b);b=exports.unstable_now();\"function\"===typeof e?O.callback=e:O===J(L)&&K(L);T(b)}else K(L);O=J(L)}if(null!==O)var m=!0;else{var n=J(M);null!==n&&g(U,n.startTime-b);m=!1}return m}finally{O=null,P=c,Q=!1}}var W=k;exports.unstable_IdlePriority=5;\nexports.unstable_ImmediatePriority=1;exports.unstable_LowPriority=4;exports.unstable_NormalPriority=3;exports.unstable_Profiling=null;exports.unstable_UserBlockingPriority=2;exports.unstable_cancelCallback=function(a){a.callback=null};exports.unstable_continueExecution=function(){R||Q||(R=!0,f(V))};exports.unstable_getCurrentPriorityLevel=function(){return P};exports.unstable_getFirstCallbackNode=function(){return J(L)};\nexports.unstable_next=function(a){switch(P){case 1:case 2:case 3:var b=3;break;default:b=P}var c=P;P=b;try{return a()}finally{P=c}};exports.unstable_pauseExecution=function(){};exports.unstable_requestPaint=W;exports.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3}var c=P;P=a;try{return b()}finally{P=c}};\nexports.unstable_scheduleCallback=function(a,b,c){var d=exports.unstable_now();\"object\"===typeof c&&null!==c?(c=c.delay,c=\"number\"===typeof c&&0d?(a.sortIndex=c,H(M,a),null===J(L)&&a===J(M)&&(S?h():S=!0,g(U,c-d))):(a.sortIndex=e,H(L,a),R||Q||(R=!0,f(V)));return a};\nexports.unstable_wrapCallback=function(a){var b=P;return function(){var c=P;P=b;try{return a.apply(this,arguments)}finally{P=c}}};\n","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n","module.exports = function(module) {\n\tif (!module.webpackPolyfill) {\n\t\tmodule.deprecate = function() {};\n\t\tmodule.paths = [];\n\t\t// module.parent = undefined by default\n\t\tif (!module.children) module.children = [];\n\t\tObject.defineProperty(module, \"loaded\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.l;\n\t\t\t}\n\t\t});\n\t\tObject.defineProperty(module, \"id\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.i;\n\t\t\t}\n\t\t});\n\t\tmodule.webpackPolyfill = 1;\n\t}\n\treturn module;\n};\n","/** @license React v17.0.2\n * react-jsx-runtime.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';require(\"object-assign\");var f=require(\"react\"),g=60103;exports.Fragment=60107;if(\"function\"===typeof Symbol&&Symbol.for){var h=Symbol.for;g=h(\"react.element\");exports.Fragment=h(\"react.fragment\")}var m=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n=Object.prototype.hasOwnProperty,p={key:!0,ref:!0,__self:!0,__source:!0};\nfunction q(c,a,k){var b,d={},e=null,l=null;void 0!==k&&(e=\"\"+k);void 0!==a.key&&(e=\"\"+a.key);void 0!==a.ref&&(l=a.ref);for(b in a)n.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:g,type:c,key:e,ref:l,props:d,_owner:m.current}}exports.jsx=q;exports.jsxs=q;\n","'use strict';\n\nvar utils = require('./utils');\nvar bind = require('./helpers/bind');\nvar Axios = require('./core/Axios');\nvar mergeConfig = require('./core/mergeConfig');\nvar defaults = require('./defaults');\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n * @return {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n var context = new Axios(defaultConfig);\n var instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context);\n\n // Copy context to instance\n utils.extend(instance, context);\n\n return instance;\n}\n\n// Create the default instance to be exported\nvar axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Factory for creating new instances\naxios.create = function create(instanceConfig) {\n return createInstance(mergeConfig(axios.defaults, instanceConfig));\n};\n\n// Expose Cancel & CancelToken\naxios.Cancel = require('./cancel/Cancel');\naxios.CancelToken = require('./cancel/CancelToken');\naxios.isCancel = require('./cancel/isCancel');\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\naxios.spread = require('./helpers/spread');\n\n// Expose isAxiosError\naxios.isAxiosError = require('./helpers/isAxiosError');\n\nmodule.exports = axios;\n\n// Allow use of default import syntax in TypeScript\nmodule.exports.default = axios;\n","'use strict';\n\nvar utils = require('./../utils');\nvar buildURL = require('../helpers/buildURL');\nvar InterceptorManager = require('./InterceptorManager');\nvar dispatchRequest = require('./dispatchRequest');\nvar mergeConfig = require('./mergeConfig');\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n */\nfunction Axios(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n}\n\n/**\n * Dispatch a request\n *\n * @param {Object} config The config specific for this request (merged with this.defaults)\n */\nAxios.prototype.request = function request(config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof config === 'string') {\n config = arguments[1] || {};\n config.url = arguments[0];\n } else {\n config = config || {};\n }\n\n config = mergeConfig(this.defaults, config);\n\n // Set config.method\n if (config.method) {\n config.method = config.method.toLowerCase();\n } else if (this.defaults.method) {\n config.method = this.defaults.method.toLowerCase();\n } else {\n config.method = 'get';\n }\n\n // Hook up interceptors middleware\n var chain = [dispatchRequest, undefined];\n var promise = Promise.resolve(config);\n\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n chain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n chain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n while (chain.length) {\n promise = promise.then(chain.shift(), chain.shift());\n }\n\n return promise;\n};\n\nAxios.prototype.getUri = function getUri(config) {\n config = mergeConfig(this.defaults, config);\n return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\\?/, '');\n};\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(mergeConfig(config || {}, {\n method: method,\n url: url,\n data: (config || {}).data\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, data, config) {\n return this.request(mergeConfig(config || {}, {\n method: method,\n url: url,\n data: data\n }));\n };\n});\n\nmodule.exports = Axios;\n","'use strict';\n\nvar utils = require('./../utils');\n\nfunction InterceptorManager() {\n this.handlers = [];\n}\n\n/**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\nInterceptorManager.prototype.use = function use(fulfilled, rejected) {\n this.handlers.push({\n fulfilled: fulfilled,\n rejected: rejected\n });\n return this.handlers.length - 1;\n};\n\n/**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n */\nInterceptorManager.prototype.eject = function eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n};\n\n/**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n */\nInterceptorManager.prototype.forEach = function forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n};\n\nmodule.exports = InterceptorManager;\n","'use strict';\n\nvar utils = require('./../utils');\nvar transformData = require('./transformData');\nvar isCancel = require('../cancel/isCancel');\nvar defaults = require('../defaults');\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n * @returns {Promise} The Promise to be fulfilled\n */\nmodule.exports = function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n // Ensure headers exist\n config.headers = config.headers || {};\n\n // Transform request data\n config.data = transformData(\n config.data,\n config.headers,\n config.transformRequest\n );\n\n // Flatten headers\n config.headers = utils.merge(\n config.headers.common || {},\n config.headers[config.method] || {},\n config.headers\n );\n\n utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n function cleanHeaderConfig(method) {\n delete config.headers[method];\n }\n );\n\n var adapter = config.adapter || defaults.adapter;\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData(\n response.data,\n response.headers,\n config.transformResponse\n );\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData(\n reason.response.data,\n reason.response.headers,\n config.transformResponse\n );\n }\n }\n\n return Promise.reject(reason);\n });\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Object|String} data The data to be transformed\n * @param {Array} headers The headers for the request or response\n * @param {Array|Function} fns A single function or Array of functions\n * @returns {*} The resulting transformed data\n */\nmodule.exports = function transformData(data, headers, fns) {\n /*eslint no-param-reassign:0*/\n utils.forEach(fns, function transform(fn) {\n data = fn(data, headers);\n });\n\n return data;\n};\n","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n","'use strict';\n\nvar utils = require('../utils');\n\nmodule.exports = function normalizeHeaderName(headers, normalizedName) {\n utils.forEach(headers, function processHeader(value, name) {\n if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {\n headers[normalizedName] = value;\n delete headers[name];\n }\n });\n};\n","'use strict';\n\nvar createError = require('./createError');\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n */\nmodule.exports = function settle(resolve, reject, response) {\n var validateStatus = response.config.validateStatus;\n if (!response.status || !validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(createError(\n 'Request failed with status code ' + response.status,\n response.config,\n null,\n response.request,\n response\n ));\n }\n};\n","'use strict';\n\n/**\n * Update an Error with the specified config, error code, and response.\n *\n * @param {Error} error The error to update.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The error.\n */\nmodule.exports = function enhanceError(error, config, code, request, response) {\n error.config = config;\n if (code) {\n error.code = code;\n }\n\n error.request = request;\n error.response = response;\n error.isAxiosError = true;\n\n error.toJSON = function toJSON() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: this.config,\n code: this.code\n };\n };\n return error;\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs support document.cookie\n (function standardBrowserEnv() {\n return {\n write: function write(name, value, expires, path, domain, secure) {\n var cookie = [];\n cookie.push(name + '=' + encodeURIComponent(value));\n\n if (utils.isNumber(expires)) {\n cookie.push('expires=' + new Date(expires).toGMTString());\n }\n\n if (utils.isString(path)) {\n cookie.push('path=' + path);\n }\n\n if (utils.isString(domain)) {\n cookie.push('domain=' + domain);\n }\n\n if (secure === true) {\n cookie.push('secure');\n }\n\n document.cookie = cookie.join('; ');\n },\n\n read: function read(name) {\n var match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove: function remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n };\n })() :\n\n // Non standard browser env (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return {\n write: function write() {},\n read: function read() { return null; },\n remove: function remove() {}\n };\n })()\n);\n","'use strict';\n\nvar isAbsoluteURL = require('../helpers/isAbsoluteURL');\nvar combineURLs = require('../helpers/combineURLs');\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n * @returns {string} The combined full path\n */\nmodule.exports = function buildFullPath(baseURL, requestedURL) {\n if (baseURL && !isAbsoluteURL(requestedURL)) {\n return combineURLs(baseURL, requestedURL);\n }\n return requestedURL;\n};\n","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nmodule.exports = function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d\\+\\-\\.]*:)?\\/\\//i.test(url);\n};\n","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n * @returns {string} The combined URL\n */\nmodule.exports = function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/+$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\n// Headers whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nvar ignoreDuplicateOf = [\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n];\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} headers Headers needing to be parsed\n * @returns {Object} Headers parsed into an object\n */\nmodule.exports = function parseHeaders(headers) {\n var parsed = {};\n var key;\n var val;\n var i;\n\n if (!headers) { return parsed; }\n\n utils.forEach(headers.split('\\n'), function parser(line) {\n i = line.indexOf(':');\n key = utils.trim(line.substr(0, i)).toLowerCase();\n val = utils.trim(line.substr(i + 1));\n\n if (key) {\n if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {\n return;\n }\n if (key === 'set-cookie') {\n parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n }\n });\n\n return parsed;\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs have full support of the APIs needed to test\n // whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n var msie = /(msie|trident)/i.test(navigator.userAgent);\n var urlParsingNode = document.createElement('a');\n var originURL;\n\n /**\n * Parse a URL to discover it's components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n var href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })()\n);\n","'use strict';\n\nvar Cancel = require('./Cancel');\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @class\n * @param {Function} executor The executor function.\n */\nfunction CancelToken(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n var resolvePromise;\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n var token = this;\n executor(function cancel(message) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new Cancel(message);\n resolvePromise(token.reason);\n });\n}\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nCancelToken.prototype.throwIfRequested = function throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n};\n\n/**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\nCancelToken.source = function source() {\n var cancel;\n var token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token: token,\n cancel: cancel\n };\n};\n\nmodule.exports = CancelToken;\n","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n * @returns {Function}\n */\nmodule.exports = function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n};\n","'use strict';\n\n/**\n * Determines whether the payload is an error thrown by Axios\n *\n * @param {*} payload The value to test\n * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n */\nmodule.exports = function isAxiosError(payload) {\n return (typeof payload === 'object') && (payload.isAxiosError === true);\n};\n","'use strict';\n\nvar utils = require('./utils');\nvar formats = require('./formats');\nvar has = Object.prototype.hasOwnProperty;\n\nvar arrayPrefixGenerators = {\n brackets: function brackets(prefix) { // eslint-disable-line func-name-matching\n return prefix + '[]';\n },\n comma: 'comma',\n indices: function indices(prefix, key) { // eslint-disable-line func-name-matching\n return prefix + '[' + key + ']';\n },\n repeat: function repeat(prefix) { // eslint-disable-line func-name-matching\n return prefix;\n }\n};\n\nvar isArray = Array.isArray;\nvar push = Array.prototype.push;\nvar pushToArray = function (arr, valueOrArray) {\n push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);\n};\n\nvar toISO = Date.prototype.toISOString;\n\nvar defaults = {\n addQueryPrefix: false,\n allowDots: false,\n charset: 'utf-8',\n charsetSentinel: false,\n delimiter: '&',\n encode: true,\n encoder: utils.encode,\n encodeValuesOnly: false,\n formatter: formats.formatters[formats['default']],\n // deprecated\n indices: false,\n serializeDate: function serializeDate(date) { // eslint-disable-line func-name-matching\n return toISO.call(date);\n },\n skipNulls: false,\n strictNullHandling: false\n};\n\nvar stringify = function stringify( // eslint-disable-line func-name-matching\n object,\n prefix,\n generateArrayPrefix,\n strictNullHandling,\n skipNulls,\n encoder,\n filter,\n sort,\n allowDots,\n serializeDate,\n formatter,\n encodeValuesOnly,\n charset\n) {\n var obj = object;\n if (typeof filter === 'function') {\n obj = filter(prefix, obj);\n } else if (obj instanceof Date) {\n obj = serializeDate(obj);\n } else if (generateArrayPrefix === 'comma' && isArray(obj)) {\n obj = obj.join(',');\n }\n\n if (obj === null) {\n if (strictNullHandling) {\n return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset) : prefix;\n }\n\n obj = '';\n }\n\n if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean' || utils.isBuffer(obj)) {\n if (encoder) {\n var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset);\n return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset))];\n }\n return [formatter(prefix) + '=' + formatter(String(obj))];\n }\n\n var values = [];\n\n if (typeof obj === 'undefined') {\n return values;\n }\n\n var objKeys;\n if (isArray(filter)) {\n objKeys = filter;\n } else {\n var keys = Object.keys(obj);\n objKeys = sort ? keys.sort(sort) : keys;\n }\n\n for (var i = 0; i < objKeys.length; ++i) {\n var key = objKeys[i];\n\n if (skipNulls && obj[key] === null) {\n continue;\n }\n\n if (isArray(obj)) {\n pushToArray(values, stringify(\n obj[key],\n typeof generateArrayPrefix === 'function' ? generateArrayPrefix(prefix, key) : prefix,\n generateArrayPrefix,\n strictNullHandling,\n skipNulls,\n encoder,\n filter,\n sort,\n allowDots,\n serializeDate,\n formatter,\n encodeValuesOnly,\n charset\n ));\n } else {\n pushToArray(values, stringify(\n obj[key],\n prefix + (allowDots ? '.' + key : '[' + key + ']'),\n generateArrayPrefix,\n strictNullHandling,\n skipNulls,\n encoder,\n filter,\n sort,\n allowDots,\n serializeDate,\n formatter,\n encodeValuesOnly,\n charset\n ));\n }\n }\n\n return values;\n};\n\nvar normalizeStringifyOptions = function normalizeStringifyOptions(opts) {\n if (!opts) {\n return defaults;\n }\n\n if (opts.encoder !== null && opts.encoder !== undefined && typeof opts.encoder !== 'function') {\n throw new TypeError('Encoder has to be a function.');\n }\n\n var charset = opts.charset || defaults.charset;\n if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {\n throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');\n }\n\n var format = formats['default'];\n if (typeof opts.format !== 'undefined') {\n if (!has.call(formats.formatters, opts.format)) {\n throw new TypeError('Unknown format option provided.');\n }\n format = opts.format;\n }\n var formatter = formats.formatters[format];\n\n var filter = defaults.filter;\n if (typeof opts.filter === 'function' || isArray(opts.filter)) {\n filter = opts.filter;\n }\n\n return {\n addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults.addQueryPrefix,\n allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,\n charset: charset,\n charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,\n delimiter: typeof opts.delimiter === 'undefined' ? defaults.delimiter : opts.delimiter,\n encode: typeof opts.encode === 'boolean' ? opts.encode : defaults.encode,\n encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults.encoder,\n encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults.encodeValuesOnly,\n filter: filter,\n formatter: formatter,\n serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults.serializeDate,\n skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults.skipNulls,\n sort: typeof opts.sort === 'function' ? opts.sort : null,\n strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling\n };\n};\n\nmodule.exports = function (object, opts) {\n var obj = object;\n var options = normalizeStringifyOptions(opts);\n\n var objKeys;\n var filter;\n\n if (typeof options.filter === 'function') {\n filter = options.filter;\n obj = filter('', obj);\n } else if (isArray(options.filter)) {\n filter = options.filter;\n objKeys = filter;\n }\n\n var keys = [];\n\n if (typeof obj !== 'object' || obj === null) {\n return '';\n }\n\n var arrayFormat;\n if (opts && opts.arrayFormat in arrayPrefixGenerators) {\n arrayFormat = opts.arrayFormat;\n } else if (opts && 'indices' in opts) {\n arrayFormat = opts.indices ? 'indices' : 'repeat';\n } else {\n arrayFormat = 'indices';\n }\n\n var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];\n\n if (!objKeys) {\n objKeys = Object.keys(obj);\n }\n\n if (options.sort) {\n objKeys.sort(options.sort);\n }\n\n for (var i = 0; i < objKeys.length; ++i) {\n var key = objKeys[i];\n\n if (options.skipNulls && obj[key] === null) {\n continue;\n }\n pushToArray(keys, stringify(\n obj[key],\n key,\n generateArrayPrefix,\n options.strictNullHandling,\n options.skipNulls,\n options.encode ? options.encoder : null,\n options.filter,\n options.sort,\n options.allowDots,\n options.serializeDate,\n options.formatter,\n options.encodeValuesOnly,\n options.charset\n ));\n }\n\n var joined = keys.join(options.delimiter);\n var prefix = options.addQueryPrefix === true ? '?' : '';\n\n if (options.charsetSentinel) {\n if (options.charset === 'iso-8859-1') {\n // encodeURIComponent('✓'), the \"numeric entity\" representation of a checkmark\n prefix += 'utf8=%26%2310003%3B&';\n } else {\n // encodeURIComponent('✓')\n prefix += 'utf8=%E2%9C%93&';\n }\n }\n\n return joined.length > 0 ? prefix + joined : '';\n};\n","'use strict';\n\nvar utils = require('./utils');\n\nvar has = Object.prototype.hasOwnProperty;\n\nvar defaults = {\n allowDots: false,\n allowPrototypes: false,\n arrayLimit: 20,\n charset: 'utf-8',\n charsetSentinel: false,\n comma: false,\n decoder: utils.decode,\n delimiter: '&',\n depth: 5,\n ignoreQueryPrefix: false,\n interpretNumericEntities: false,\n parameterLimit: 1000,\n parseArrays: true,\n plainObjects: false,\n strictNullHandling: false\n};\n\nvar interpretNumericEntities = function (str) {\n return str.replace(/(\\d+);/g, function ($0, numberStr) {\n return String.fromCharCode(parseInt(numberStr, 10));\n });\n};\n\n// This is what browsers will submit when the ✓ character occurs in an\n// application/x-www-form-urlencoded body and the encoding of the page containing\n// the form is iso-8859-1, or when the submitted form has an accept-charset\n// attribute of iso-8859-1. Presumably also with other charsets that do not contain\n// the ✓ character, such as us-ascii.\nvar isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('✓')\n\n// These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.\nvar charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')\n\nvar parseValues = function parseQueryStringValues(str, options) {\n var obj = {};\n var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\\?/, '') : str;\n var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;\n var parts = cleanStr.split(options.delimiter, limit);\n var skipIndex = -1; // Keep track of where the utf8 sentinel was found\n var i;\n\n var charset = options.charset;\n if (options.charsetSentinel) {\n for (i = 0; i < parts.length; ++i) {\n if (parts[i].indexOf('utf8=') === 0) {\n if (parts[i] === charsetSentinel) {\n charset = 'utf-8';\n } else if (parts[i] === isoSentinel) {\n charset = 'iso-8859-1';\n }\n skipIndex = i;\n i = parts.length; // The eslint settings do not allow break;\n }\n }\n }\n\n for (i = 0; i < parts.length; ++i) {\n if (i === skipIndex) {\n continue;\n }\n var part = parts[i];\n\n var bracketEqualsPos = part.indexOf(']=');\n var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;\n\n var key, val;\n if (pos === -1) {\n key = options.decoder(part, defaults.decoder, charset);\n val = options.strictNullHandling ? null : '';\n } else {\n key = options.decoder(part.slice(0, pos), defaults.decoder, charset);\n val = options.decoder(part.slice(pos + 1), defaults.decoder, charset);\n }\n\n if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {\n val = interpretNumericEntities(val);\n }\n\n if (val && options.comma && val.indexOf(',') > -1) {\n val = val.split(',');\n }\n\n if (has.call(obj, key)) {\n obj[key] = utils.combine(obj[key], val);\n } else {\n obj[key] = val;\n }\n }\n\n return obj;\n};\n\nvar parseObject = function (chain, val, options) {\n var leaf = val;\n\n for (var i = chain.length - 1; i >= 0; --i) {\n var obj;\n var root = chain[i];\n\n if (root === '[]' && options.parseArrays) {\n obj = [].concat(leaf);\n } else {\n obj = options.plainObjects ? Object.create(null) : {};\n var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;\n var index = parseInt(cleanRoot, 10);\n if (!options.parseArrays && cleanRoot === '') {\n obj = { 0: leaf };\n } else if (\n !isNaN(index)\n && root !== cleanRoot\n && String(index) === cleanRoot\n && index >= 0\n && (options.parseArrays && index <= options.arrayLimit)\n ) {\n obj = [];\n obj[index] = leaf;\n } else {\n obj[cleanRoot] = leaf;\n }\n }\n\n leaf = obj;\n }\n\n return leaf;\n};\n\nvar parseKeys = function parseQueryStringKeys(givenKey, val, options) {\n if (!givenKey) {\n return;\n }\n\n // Transform dot notation to bracket notation\n var key = options.allowDots ? givenKey.replace(/\\.([^.[]+)/g, '[$1]') : givenKey;\n\n // The regex chunks\n\n var brackets = /(\\[[^[\\]]*])/;\n var child = /(\\[[^[\\]]*])/g;\n\n // Get the parent\n\n var segment = brackets.exec(key);\n var parent = segment ? key.slice(0, segment.index) : key;\n\n // Stash the parent if it exists\n\n var keys = [];\n if (parent) {\n // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties\n if (!options.plainObjects && has.call(Object.prototype, parent)) {\n if (!options.allowPrototypes) {\n return;\n }\n }\n\n keys.push(parent);\n }\n\n // Loop through children appending to the array until we hit depth\n\n var i = 0;\n while ((segment = child.exec(key)) !== null && i < options.depth) {\n i += 1;\n if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {\n if (!options.allowPrototypes) {\n return;\n }\n }\n keys.push(segment[1]);\n }\n\n // If there's a remainder, just add whatever is left\n\n if (segment) {\n keys.push('[' + key.slice(segment.index) + ']');\n }\n\n return parseObject(keys, val, options);\n};\n\nvar normalizeParseOptions = function normalizeParseOptions(opts) {\n if (!opts) {\n return defaults;\n }\n\n if (opts.decoder !== null && opts.decoder !== undefined && typeof opts.decoder !== 'function') {\n throw new TypeError('Decoder has to be a function.');\n }\n\n if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {\n throw new Error('The charset option must be either utf-8, iso-8859-1, or undefined');\n }\n var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset;\n\n return {\n allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,\n allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes,\n arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit,\n charset: charset,\n charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,\n comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma,\n decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder,\n delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter,\n depth: typeof opts.depth === 'number' ? opts.depth : defaults.depth,\n ignoreQueryPrefix: opts.ignoreQueryPrefix === true,\n interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities,\n parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit,\n parseArrays: opts.parseArrays !== false,\n plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects,\n strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling\n };\n};\n\nmodule.exports = function (str, opts) {\n var options = normalizeParseOptions(opts);\n\n if (str === '' || str === null || typeof str === 'undefined') {\n return options.plainObjects ? Object.create(null) : {};\n }\n\n var tempObj = typeof str === 'string' ? parseValues(str, options) : str;\n var obj = options.plainObjects ? Object.create(null) : {};\n\n // Iterate over the keys and setup the new object\n\n var keys = Object.keys(tempObj);\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n var newObj = parseKeys(key, tempObj[key], options);\n obj = utils.merge(obj, newObj, options);\n }\n\n return utils.compact(obj);\n};\n"],"sourceRoot":""}