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,OAAS,GAElCiyB,EAAWF,EAAkBC,GAajC,MAXmB,CACfz0B,QAAS,SACTP,KAAM,GACNJ,SAAU6D,EAAK7D,UAAY,YAC3BC,YAAa,CACT,0CAA4Cu1B,EAAS,iBACrD,uCAvGD,CACH,4CACA,2BACA,8GACAT,EACA,wCACA,wHACAC,EACA,6CACA,uGACA,qGACA,wDACA,iIACF90B,KAAK,KA4FCm1B,GACFn1B,KAAK,KAGf,C","sources":["../node_modules/plotly.js/src/plots/get_data.js","../node_modules/plotly.js/src/plots/gl3d/project.js","../node_modules/plotly.js/src/plots/layout_attributes.js","../node_modules/plotly.js/src/plots/pad_attributes.js","../node_modules/plotly.js/src/plots/plots.js","../node_modules/plotly.js/src/plots/template_attributes.js"],"sourcesContent":["'use strict';\n\nvar Registry = require('../registry');\nvar SUBPLOT_PATTERN = require('./cartesian/constants').SUBPLOT_PATTERN;\n\n/**\n * Get calcdata trace(s) associated with a given subplot\n *\n * @param {array} calcData: as in gd.calcdata\n * @param {string} type: subplot type\n * @param {string} subplotId: subplot id to look for\n *\n * @return {array} array of calcdata traces\n */\nexports.getSubplotCalcData = function(calcData, type, subplotId) {\n var basePlotModule = Registry.subplotsRegistry[type];\n if(!basePlotModule) return [];\n\n var attr = basePlotModule.attr;\n var subplotCalcData = [];\n\n for(var i = 0; i < calcData.length; i++) {\n var calcTrace = calcData[i];\n var trace = calcTrace[0].trace;\n\n if(trace[attr] === subplotId) subplotCalcData.push(calcTrace);\n }\n\n return subplotCalcData;\n};\n/**\n * Get calcdata trace(s) that can be plotted with a given module\n * NOTE: this isn't necessarily just exactly matching trace type,\n * if multiple trace types use the same plotting routine, they will be\n * collected here.\n * In order to not plot the same thing multiple times, we return two arrays,\n * the calcdata we *will* plot with this module, and the ones we *won't*\n *\n * @param {array} calcdata: as in gd.calcdata\n * @param {object|string|fn} arg1:\n * the plotting module, or its name, or its plot method\n *\n * @return {array[array]} [foundCalcdata, remainingCalcdata]\n */\nexports.getModuleCalcData = function(calcdata, arg1) {\n var moduleCalcData = [];\n var remainingCalcData = [];\n\n var plotMethod;\n if(typeof arg1 === 'string') {\n plotMethod = Registry.getModule(arg1).plot;\n } else if(typeof arg1 === 'function') {\n plotMethod = arg1;\n } else {\n plotMethod = arg1.plot;\n }\n if(!plotMethod) {\n return [moduleCalcData, calcdata];\n }\n\n for(var i = 0; i < calcdata.length; i++) {\n var cd = calcdata[i];\n var trace = cd[0].trace;\n // N.B.\n // - 'legendonly' traces do not make it past here\n // - skip over 'visible' traces that got trimmed completely during calc transforms\n if(trace.visible !== true || trace._length === 0) continue;\n\n // group calcdata trace not by 'module' (as the name of this function\n // would suggest), but by 'module plot method' so that if some traces\n // share the same module plot method (e.g. bar and histogram), we\n // only call it one!\n if(trace._module && trace._module.plot === plotMethod) {\n moduleCalcData.push(cd);\n } else {\n remainingCalcData.push(cd);\n }\n }\n\n return [moduleCalcData, remainingCalcData];\n};\n\n/**\n * Get the data trace(s) associated with a given subplot.\n *\n * @param {array} data plotly full data array.\n * @param {string} type subplot type to look for.\n * @param {string} subplotId subplot id to look for.\n *\n * @return {array} list of trace objects.\n *\n */\nexports.getSubplotData = function getSubplotData(data, type, subplotId) {\n if(!Registry.subplotsRegistry[type]) return [];\n\n var attr = Registry.subplotsRegistry[type].attr;\n var subplotData = [];\n var trace, subplotX, subplotY;\n\n if(type === 'gl2d') {\n var spmatch = subplotId.match(SUBPLOT_PATTERN);\n subplotX = 'x' + spmatch[1];\n subplotY = 'y' + spmatch[2];\n }\n\n for(var i = 0; i < data.length; i++) {\n trace = data[i];\n\n if(type === 'gl2d' && Registry.traceIs(trace, 'gl2d')) {\n if(trace[attr[0]] === subplotX && trace[attr[1]] === subplotY) {\n subplotData.push(trace);\n }\n } else {\n if(trace[attr] === subplotId) subplotData.push(trace);\n }\n }\n\n return subplotData;\n};\n","'use strict';\n\nfunction xformMatrix(m, v) {\n var out = [0, 0, 0, 0];\n var i, j;\n\n for(i = 0; i < 4; ++i) {\n for(j = 0; j < 4; ++j) {\n out[j] += m[4 * i + j] * v[i];\n }\n }\n\n return out;\n}\n\nfunction project(camera, v) {\n var p = xformMatrix(camera.projection,\n xformMatrix(camera.view,\n xformMatrix(camera.model, [v[0], v[1], v[2], 1])));\n return p;\n}\n\nmodule.exports = project;\n","'use strict';\n\nvar fontAttrs = require('./font_attributes');\nvar animationAttrs = require('./animation_attributes');\nvar colorAttrs = require('../components/color/attributes');\nvar drawNewShapeAttrs = require('../components/shapes/draw_newshape/attributes');\nvar drawNewSelectionAttrs = require('../components/selections/draw_newselection/attributes');\nvar padAttrs = require('./pad_attributes');\nvar extendFlat = require('../lib/extend').extendFlat;\n\nvar globalFont = fontAttrs({\n editType: 'calc',\n description: [\n 'Sets the global font.',\n 'Note that fonts used in traces and other',\n 'layout components inherit from the global font.'\n ].join(' ')\n});\nglobalFont.family.dflt = '\"Open Sans\", verdana, arial, sans-serif';\nglobalFont.size.dflt = 12;\nglobalFont.color.dflt = colorAttrs.defaultLine;\n\nmodule.exports = {\n font: globalFont,\n title: {\n text: {\n valType: 'string',\n editType: 'layoutstyle',\n description: [\n 'Sets the plot\\'s title.',\n 'Note that before the existence of `title.text`, the title\\'s',\n 'contents used to be defined as the `title` attribute itself.',\n 'This behavior has been deprecated.'\n ].join(' ')\n },\n font: fontAttrs({\n editType: 'layoutstyle',\n description: [\n 'Sets the title font.',\n 'Note that the title\\'s font used to be customized',\n 'by the now deprecated `titlefont` attribute.'\n ].join(' ')\n }),\n xref: {\n valType: 'enumerated',\n dflt: 'container',\n values: ['container', 'paper'],\n editType: 'layoutstyle',\n description: [\n 'Sets the container `x` refers to.',\n '*container* spans the entire `width` of the plot.',\n '*paper* refers to the width of the plotting area only.'\n ].join(' ')\n },\n yref: {\n valType: 'enumerated',\n dflt: 'container',\n values: ['container', 'paper'],\n editType: 'layoutstyle',\n description: [\n 'Sets the container `y` refers to.',\n '*container* spans the entire `height` of the plot.',\n '*paper* refers to the height of the plotting area only.'\n ].join(' ')\n },\n x: {\n valType: 'number',\n min: 0,\n max: 1,\n dflt: 0.5,\n editType: 'layoutstyle',\n description: [\n 'Sets the x position with respect to `xref` in normalized',\n 'coordinates from *0* (left) to *1* (right).'\n ].join(' ')\n },\n y: {\n valType: 'number',\n min: 0,\n max: 1,\n dflt: 'auto',\n editType: 'layoutstyle',\n description: [\n 'Sets the y position with respect to `yref` in normalized',\n 'coordinates from *0* (bottom) to *1* (top).',\n '*auto* places the baseline of the title onto the',\n 'vertical center of the top margin.'\n ].join(' ')\n },\n xanchor: {\n valType: 'enumerated',\n dflt: 'auto',\n values: ['auto', 'left', 'center', 'right'],\n editType: 'layoutstyle',\n description: [\n 'Sets the title\\'s horizontal alignment with respect to its x position.',\n '*left* means that the title starts at x,',\n '*right* means that the title ends at x',\n 'and *center* means that the title\\'s center is at x.',\n '*auto* divides `xref` by three and calculates the `xanchor`',\n 'value automatically based on the value of `x`.'\n ].join(' ')\n },\n yanchor: {\n valType: 'enumerated',\n dflt: 'auto',\n values: ['auto', 'top', 'middle', 'bottom'],\n editType: 'layoutstyle',\n description: [\n 'Sets the title\\'s vertical alignment with respect to its y position.',\n '*top* means that the title\\'s cap line is at y,',\n '*bottom* means that the title\\'s baseline is at y',\n 'and *middle* means that the title\\'s midline is at y.',\n '*auto* divides `yref` by three and calculates the `yanchor`',\n 'value automatically based on the value of `y`.'\n ].join(' ')\n },\n pad: extendFlat(padAttrs({editType: 'layoutstyle'}), {\n description: [\n 'Sets the padding of the title.',\n 'Each padding value only applies when the corresponding',\n '`xanchor`/`yanchor` value is set accordingly. E.g. for left',\n 'padding to take effect, `xanchor` must be set to *left*.',\n 'The same rule applies if `xanchor`/`yanchor` is determined automatically.',\n 'Padding is muted if the respective anchor value is *middle*/*center*.'\n ].join(' ')\n }),\n automargin: {\n valType: 'boolean',\n dflt: false,\n editType: 'plot',\n description: [\n 'Determines whether the title can automatically push the figure margins.',\n 'If `yref=\\'paper\\'` then the margin will expand to ensure that the title doesn\\’t',\n 'overlap with the edges of the container. If `yref=\\'container\\'` then the margins',\n 'will ensure that the title doesn\\’t overlap with the plot area, tick labels,',\n 'and axis titles. If `automargin=true` and the margins need to be expanded,',\n 'then y will be set to a default 1 and yanchor will be set to an appropriate',\n 'default to ensure that minimal margin space is needed. Note that when `yref=\\'paper\\'`,',\n 'only 1 or 0 are allowed y values. Invalid values will be reset to the default 1.'\n ].join(' ')\n },\n editType: 'layoutstyle'\n },\n uniformtext: {\n mode: {\n valType: 'enumerated',\n values: [false, 'hide', 'show'],\n dflt: false,\n editType: 'plot',\n description: [\n 'Determines how the font size for various text',\n 'elements are uniformed between each trace type.',\n 'If the computed text sizes were smaller than',\n 'the minimum size defined by `uniformtext.minsize`',\n 'using *hide* option hides the text; and',\n 'using *show* option shows the text without further downscaling.',\n 'Please note that if the size defined by `minsize` is greater than',\n 'the font size defined by trace, then the `minsize` is used.'\n ].join(' ')\n },\n minsize: {\n valType: 'number',\n min: 0,\n dflt: 0,\n editType: 'plot',\n description: [\n 'Sets the minimum text size between traces of the same type.'\n ].join(' ')\n },\n editType: 'plot'\n },\n autosize: {\n valType: 'boolean',\n dflt: false,\n // autosize, width, and height get special editType treatment in _relayout\n // so we can handle noop resizes more efficiently\n editType: 'none',\n description: [\n 'Determines whether or not a layout width or height',\n 'that has been left undefined by the user',\n 'is initialized on each relayout.',\n\n 'Note that, regardless of this attribute,',\n 'an undefined layout width or height',\n 'is always initialized on the first call to plot.'\n ].join(' ')\n },\n width: {\n valType: 'number',\n min: 10,\n dflt: 700,\n editType: 'plot',\n description: [\n 'Sets the plot\\'s width (in px).'\n ].join(' ')\n },\n height: {\n valType: 'number',\n min: 10,\n dflt: 450,\n editType: 'plot',\n description: [\n 'Sets the plot\\'s height (in px).'\n ].join(' ')\n },\n minreducedwidth: {\n valType: 'number',\n min: 2,\n dflt: 64,\n editType: 'plot',\n description: 'Minimum width of the plot with margin.automargin applied (in px)'\n },\n minreducedheight: {\n valType: 'number',\n min: 2,\n dflt: 64,\n editType: 'plot',\n description: 'Minimum height of the plot with margin.automargin applied (in px)'\n },\n margin: {\n l: {\n valType: 'number',\n min: 0,\n dflt: 80,\n editType: 'plot',\n description: 'Sets the left margin (in px).'\n },\n r: {\n valType: 'number',\n min: 0,\n dflt: 80,\n editType: 'plot',\n description: 'Sets the right margin (in px).'\n },\n t: {\n valType: 'number',\n min: 0,\n dflt: 100,\n editType: 'plot',\n description: 'Sets the top margin (in px).'\n },\n b: {\n valType: 'number',\n min: 0,\n dflt: 80,\n editType: 'plot',\n description: 'Sets the bottom margin (in px).'\n },\n pad: {\n valType: 'number',\n min: 0,\n dflt: 0,\n editType: 'plot',\n description: [\n 'Sets the amount of padding (in px)',\n 'between the plotting area and the axis lines'\n ].join(' ')\n },\n autoexpand: {\n valType: 'boolean',\n dflt: true,\n editType: 'plot',\n description: [\n 'Turns on/off margin expansion computations.',\n 'Legends, colorbars, updatemenus, sliders, axis rangeselector and rangeslider',\n 'are allowed to push the margins by defaults.'\n ].join(' ')\n },\n editType: 'plot'\n },\n computed: {\n valType: 'any',\n editType: 'none',\n description: [\n 'Placeholder for exporting automargin-impacting values namely',\n '`margin.t`, `margin.b`, `margin.l` and `margin.r` in *full-json* mode.',\n ].join(' ')\n },\n paper_bgcolor: {\n valType: 'color',\n dflt: colorAttrs.background,\n editType: 'plot',\n description: 'Sets the background color of the paper where the graph is drawn.'\n },\n plot_bgcolor: {\n // defined here, but set in cartesian.supplyLayoutDefaults\n // because it needs to know if there are (2D) axes or not\n valType: 'color',\n dflt: colorAttrs.background,\n editType: 'layoutstyle',\n description: [\n 'Sets the background color of the plotting area in-between x and y axes.'\n ].join(' ')\n },\n autotypenumbers: {\n valType: 'enumerated',\n values: ['convert types', 'strict'],\n dflt: 'convert types',\n editType: 'calc',\n description: [\n 'Using *strict* a numeric string in trace data is not converted to a number.',\n 'Using *convert types* a numeric string in trace data may be',\n 'treated as a number during automatic axis `type` detection.',\n 'This is the default value; however it could be overridden for individual axes.'\n ].join(' ')\n },\n separators: {\n valType: 'string',\n editType: 'plot',\n description: [\n 'Sets the decimal and thousand separators.',\n 'For example, *. * puts a \\'.\\' before decimals and a space',\n 'between thousands. In English locales, dflt is *.,* but',\n 'other locales may alter this default.'\n ].join(' ')\n },\n hidesources: {\n valType: 'boolean',\n dflt: false,\n editType: 'plot',\n description: [\n 'Determines whether or not a text link citing the data source is',\n 'placed at the bottom-right cored of the figure.',\n 'Has only an effect only on graphs that have been generated via',\n 'forked graphs from the Chart Studio Cloud (at https://chart-studio.plotly.com or on-premise).'\n ].join(' ')\n },\n showlegend: {\n // handled in legend.supplyLayoutDefaults\n // but included here because it's not in the legend object\n valType: 'boolean',\n editType: 'legend',\n description: [\n 'Determines whether or not a legend is drawn.',\n 'Default is `true` if there is a trace to show and any of these:',\n 'a) Two or more traces would by default be shown in the legend.',\n 'b) One pie trace is shown in the legend.',\n 'c) One trace is explicitly given with `showlegend: true`.'\n ].join(' ')\n },\n\n colorway: {\n valType: 'colorlist',\n dflt: colorAttrs.defaults,\n editType: 'calc',\n description: 'Sets the default trace colors.'\n },\n datarevision: {\n valType: 'any',\n editType: 'calc',\n description: [\n 'If provided, a changed value tells `Plotly.react` that',\n 'one or more data arrays has changed. This way you can modify',\n 'arrays in-place rather than making a complete new copy for an',\n 'incremental change.',\n 'If NOT provided, `Plotly.react` assumes that data arrays are',\n 'being treated as immutable, thus any data array with a',\n 'different identity from its predecessor contains new data.'\n ].join(' ')\n },\n uirevision: {\n valType: 'any',\n editType: 'none',\n description: [\n 'Used to allow user interactions with the plot to persist after',\n '`Plotly.react` calls that are unaware of these interactions.',\n 'If `uirevision` is omitted, or if it is given and it changed from',\n 'the previous `Plotly.react` call, the exact new figure is used.',\n 'If `uirevision` is truthy and did NOT change, any attribute',\n 'that has been affected by user interactions and did not receive a',\n 'different value in the new figure will keep the interaction value.',\n '`layout.uirevision` attribute serves as the default for',\n '`uirevision` attributes in various sub-containers. For finer',\n 'control you can set these sub-attributes directly. For example,',\n 'if your app separately controls the data on the x and y axes you',\n 'might set `xaxis.uirevision=*time*` and `yaxis.uirevision=*cost*`.',\n 'Then if only the y data is changed, you can update',\n '`yaxis.uirevision=*quantity*` and the y axis range will reset but',\n 'the x axis range will retain any user-driven zoom.'\n ].join(' ')\n },\n editrevision: {\n valType: 'any',\n editType: 'none',\n description: [\n 'Controls persistence of user-driven changes in `editable: true`',\n 'configuration, other than trace names and axis titles.',\n 'Defaults to `layout.uirevision`.'\n ].join(' ')\n },\n selectionrevision: {\n valType: 'any',\n editType: 'none',\n description: [\n 'Controls persistence of user-driven changes in selected points',\n 'from all traces.'\n ].join(' ')\n },\n template: {\n valType: 'any',\n editType: 'calc',\n description: [\n 'Default attributes to be applied to the plot. Templates can be',\n 'created from existing plots using `Plotly.makeTemplate`, or',\n 'created manually. They should be objects with format:',\n '`{layout: layoutTemplate, data: {[type]: [traceTemplate, ...]}, ...}`',\n '`layoutTemplate` and `traceTemplate` are objects matching the',\n 'attribute structure of `layout` and a data trace. ',\n 'Trace templates are applied cyclically to traces of each type.',\n 'Container arrays (eg `annotations`) have special handling:',\n 'An object ending in `defaults` (eg `annotationdefaults`) is applied',\n 'to each array item. But if an item has a `templateitemname` key',\n 'we look in the template array for an item with matching `name` and',\n 'apply that instead. If no matching `name` is found we mark the item',\n 'invisible. Any named template item not referenced is appended to',\n 'the end of the array, so you can use this for a watermark annotation',\n 'or a logo image, for example. To omit one of these items on the plot,',\n 'make an item with matching `templateitemname` and `visible: false`.'\n ].join(' ')\n },\n\n newshape: drawNewShapeAttrs.newshape,\n activeshape: drawNewShapeAttrs.activeshape,\n\n newselection: drawNewSelectionAttrs.newselection,\n activeselection: drawNewSelectionAttrs.activeselection,\n\n meta: {\n valType: 'any',\n arrayOk: true,\n editType: 'plot',\n description: [\n 'Assigns extra meta information that can be used in various `text` attributes.',\n 'Attributes such as the graph, axis and colorbar `title.text`, annotation `text`',\n '`trace.name` in legend items, `rangeselector`, `updatemenus` and `sliders` `label` text',\n 'all support `meta`. One can access `meta` fields using template strings:',\n '`%{meta[i]}` where `i` is the index of the `meta`',\n 'item in question.',\n '`meta` can also be an object for example `{key: value}` which can be accessed',\n '%{meta[key]}.'\n ].join(' ')\n },\n\n transition: extendFlat({}, animationAttrs.transition, {\n description: [\n 'Sets transition options used during Plotly.react updates.'\n ].join(' '),\n editType: 'none'\n }),\n _deprecated: {\n title: {\n valType: 'string',\n editType: 'layoutstyle',\n description: [\n 'Value of `title` is no longer a simple *string* but a set of sub-attributes.',\n 'To set the contents of the title, please use `title.text` now.'\n ].join(' ')\n },\n titlefont: fontAttrs({\n editType: 'layoutstyle',\n description: [\n 'Former `titlefont` is now the sub-attribute `font` of `title`.',\n 'To customize title font properties, please use `title.font` now.'\n ].join(' ')\n })\n }\n};\n","'use strict';\n\n/**\n * Creates a set of padding attributes.\n *\n * @param {object} opts\n * @param {string} editType:\n * the editType for all pieces of this padding definition\n *\n * @return {object} attributes object containing {t, r, b, l} as specified\n */\nmodule.exports = function(opts) {\n var editType = opts.editType;\n return {\n t: {\n valType: 'number',\n dflt: 0,\n editType: editType,\n description: 'The amount of padding (in px) along the top of the component.'\n },\n r: {\n valType: 'number',\n dflt: 0,\n editType: editType,\n description: 'The amount of padding (in px) on the right side of the component.'\n },\n b: {\n valType: 'number',\n dflt: 0,\n editType: editType,\n description: 'The amount of padding (in px) along the bottom of the component.'\n },\n l: {\n valType: 'number',\n dflt: 0,\n editType: editType,\n description: 'The amount of padding (in px) on the left side of the component.'\n },\n editType: editType\n };\n};\n","'use strict';\n\nvar d3 = require('@plotly/d3');\nvar timeFormatLocale = require('d3-time-format').timeFormatLocale;\nvar formatLocale = require('d3-format').formatLocale;\nvar isNumeric = require('fast-isnumeric');\nvar b64encode = require('base64-arraybuffer');\n\nvar Registry = require('../registry');\nvar PlotSchema = require('../plot_api/plot_schema');\nvar Template = require('../plot_api/plot_template');\nvar Lib = require('../lib');\nvar Color = require('../components/color');\nvar BADNUM = require('../constants/numerical').BADNUM;\n\nvar axisIDs = require('./cartesian/axis_ids');\nvar clearOutline = require('../components/shapes/handle_outline').clearOutline;\nvar scatterAttrs = require('../traces/scatter/layout_attributes');\n\nvar animationAttrs = require('./animation_attributes');\nvar frameAttrs = require('./frame_attributes');\n\nvar getModuleCalcData = require('../plots/get_data').getModuleCalcData;\n\nvar relinkPrivateKeys = Lib.relinkPrivateKeys;\nvar _ = Lib._;\n\nvar plots = module.exports = {};\n\n// Expose registry methods on Plots for backward-compatibility\nLib.extendFlat(plots, Registry);\n\nplots.attributes = require('./attributes');\nplots.attributes.type.values = plots.allTypes;\nplots.fontAttrs = require('./font_attributes');\nplots.layoutAttributes = require('./layout_attributes');\n\n// TODO make this a plot attribute?\nplots.fontWeight = 'normal';\n\nvar transformsRegistry = plots.transformsRegistry;\n\nvar commandModule = require('./command');\nplots.executeAPICommand = commandModule.executeAPICommand;\nplots.computeAPICommandBindings = commandModule.computeAPICommandBindings;\nplots.manageCommandObserver = commandModule.manageCommandObserver;\nplots.hasSimpleAPICommandBindings = commandModule.hasSimpleAPICommandBindings;\n\n// in some cases the browser doesn't seem to know how big\n// the text is at first, so it needs to draw it,\n// then wait a little, then draw it again\nplots.redrawText = function(gd) {\n gd = Lib.getGraphDiv(gd);\n\n return new Promise(function(resolve) {\n setTimeout(function() {\n if(!gd._fullLayout) return;\n Registry.getComponentMethod('annotations', 'draw')(gd);\n Registry.getComponentMethod('legend', 'draw')(gd);\n Registry.getComponentMethod('colorbar', 'draw')(gd);\n resolve(plots.previousPromises(gd));\n }, 300);\n });\n};\n\n// resize plot about the container size\nplots.resize = function(gd) {\n gd = Lib.getGraphDiv(gd);\n\n var resolveLastResize;\n var p = new Promise(function(resolve, reject) {\n if(!gd || Lib.isHidden(gd)) {\n reject(new Error('Resize must be passed a displayed plot div element.'));\n }\n\n if(gd._redrawTimer) clearTimeout(gd._redrawTimer);\n if(gd._resolveResize) resolveLastResize = gd._resolveResize;\n gd._resolveResize = resolve;\n\n gd._redrawTimer = setTimeout(function() {\n // return if there is nothing to resize or is hidden\n if(!gd.layout || (gd.layout.width && gd.layout.height) || Lib.isHidden(gd)) {\n resolve(gd);\n return;\n }\n\n delete gd.layout.width;\n delete gd.layout.height;\n\n // autosizing doesn't count as a change that needs saving\n var oldchanged = gd.changed;\n\n // nor should it be included in the undo queue\n gd.autoplay = true;\n\n Registry.call('relayout', gd, {autosize: true}).then(function() {\n gd.changed = oldchanged;\n // Only resolve if a new call hasn't been made!\n if(gd._resolveResize === resolve) {\n delete gd._resolveResize;\n resolve(gd);\n }\n });\n }, 100);\n });\n\n if(resolveLastResize) resolveLastResize(p);\n return p;\n};\n\n\n// for use in Lib.syncOrAsync, check if there are any\n// pending promises in this plot and wait for them\nplots.previousPromises = function(gd) {\n if((gd._promises || []).length) {\n return Promise.all(gd._promises)\n .then(function() { gd._promises = []; });\n }\n};\n\n/**\n * Adds the 'Edit chart' link.\n * Note that now _doPlot calls this so it can regenerate whenever it replots\n *\n * Add source links to your graph inside the 'showSources' config argument.\n */\nplots.addLinks = function(gd) {\n // Do not do anything if showLink and showSources are not set to true in config\n if(!gd._context.showLink && !gd._context.showSources) return;\n\n var fullLayout = gd._fullLayout;\n\n var linkContainer = Lib.ensureSingle(fullLayout._paper, 'text', 'js-plot-link-container', function(s) {\n s.style({\n 'font-family': '\"Open Sans\", Arial, sans-serif',\n 'font-size': '12px',\n fill: Color.defaultLine,\n 'pointer-events': 'all'\n })\n .each(function() {\n var links = d3.select(this);\n links.append('tspan').classed('js-link-to-tool', true);\n links.append('tspan').classed('js-link-spacer', true);\n links.append('tspan').classed('js-sourcelinks', true);\n });\n });\n\n // The text node inside svg\n var text = linkContainer.node();\n var attrs = {y: fullLayout._paper.attr('height') - 9};\n\n // If text's width is bigger than the layout\n // Check that text is a child node or document.body\n // because otherwise IE/Edge might throw an exception\n // when calling getComputedTextLength().\n // Apparently offsetParent is null for invisibles.\n if(document.body.contains(text) && text.getComputedTextLength() >= (fullLayout.width - 20)) {\n // Align the text at the left\n attrs['text-anchor'] = 'start';\n attrs.x = 5;\n } else {\n // Align the text at the right\n attrs['text-anchor'] = 'end';\n attrs.x = fullLayout._paper.attr('width') - 7;\n }\n\n linkContainer.attr(attrs);\n\n var toolspan = linkContainer.select('.js-link-to-tool');\n var spacespan = linkContainer.select('.js-link-spacer');\n var sourcespan = linkContainer.select('.js-sourcelinks');\n\n if(gd._context.showSources) gd._context.showSources(gd);\n\n // 'view in plotly' link for embedded plots\n if(gd._context.showLink) positionPlayWithData(gd, toolspan);\n\n // separator if we have both sources and tool link\n spacespan.text((toolspan.text() && sourcespan.text()) ? ' - ' : '');\n};\n\n// note that now this function is only adding the brand in\n// iframes and 3rd-party apps\nfunction positionPlayWithData(gd, container) {\n container.text('');\n var link = container.append('a')\n .attr({\n 'xlink:xlink:href': '#',\n class: 'link--impt link--embedview',\n 'font-weight': 'bold'\n })\n .text(gd._context.linkText + ' ' + String.fromCharCode(187));\n\n if(gd._context.sendData) {\n link.on('click', function() {\n plots.sendDataToCloud(gd);\n });\n } else {\n var path = window.location.pathname.split('/');\n var query = window.location.search;\n link.attr({\n 'xlink:xlink:show': 'new',\n 'xlink:xlink:href': '/' + path[2].split('.')[0] + '/' + path[1] + query\n });\n }\n}\n\nplots.sendDataToCloud = function(gd) {\n var baseUrl = (window.PLOTLYENV || {}).BASE_URL || gd._context.plotlyServerURL;\n if(!baseUrl) return;\n\n gd.emit('plotly_beforeexport');\n\n var hiddenformDiv = d3.select(gd)\n .append('div')\n .attr('id', 'hiddenform')\n .style('display', 'none');\n\n var hiddenform = hiddenformDiv\n .append('form')\n .attr({\n action: baseUrl + '/external',\n method: 'post',\n target: '_blank'\n });\n\n var hiddenformInput = hiddenform\n .append('input')\n .attr({\n type: 'text',\n name: 'data'\n });\n\n hiddenformInput.node().value = plots.graphJson(gd, false, 'keepdata');\n hiddenform.node().submit();\n hiddenformDiv.remove();\n\n gd.emit('plotly_afterexport');\n return false;\n};\n\nvar d3FormatKeys = [\n 'days', 'shortDays', 'months', 'shortMonths', 'periods',\n 'dateTime', 'date', 'time',\n 'decimal', 'thousands', 'grouping', 'currency'\n];\n\nvar extraFormatKeys = [\n 'year', 'month', 'dayMonth', 'dayMonthYear'\n];\n\n/*\n * Fill in default values\n * @param {DOM element} gd\n * @param {object} opts\n * @param {boolean} opts.skipUpdateCalc: normally if the existing gd.calcdata looks\n * compatible with the new gd._fullData we finish by linking the new _fullData traces\n * to the old gd.calcdata, so it's correctly set if we're not going to recalc. But also,\n * if there are calcTransforms on the trace, we first remap data arrays from the old full\n * trace into the new one. Use skipUpdateCalc to defer this (needed by Plotly.react)\n *\n * gd.data, gd.layout:\n * are precisely what the user specified (except as modified by cleanData/cleanLayout),\n * these fields shouldn't be modified (except for filling in some auto values)\n * nor used directly after the supply defaults step.\n *\n * gd._fullData, gd._fullLayout:\n * are complete descriptions of how to draw the plot,\n * use these fields in all required computations.\n *\n * gd._fullLayout._modules\n * is a list of all the trace modules required to draw the plot.\n *\n * gd._fullLayout._visibleModules\n * subset of _modules, a list of modules corresponding to visible:true traces.\n *\n * gd._fullLayout._basePlotModules\n * is a list of all the plot modules required to draw the plot.\n *\n * gd._fullLayout._transformModules\n * is a list of all the transform modules invoked.\n *\n */\nplots.supplyDefaults = function(gd, opts) {\n var skipUpdateCalc = opts && opts.skipUpdateCalc;\n var oldFullLayout = gd._fullLayout || {};\n\n if(oldFullLayout._skipDefaults) {\n delete oldFullLayout._skipDefaults;\n return;\n }\n\n var newFullLayout = gd._fullLayout = {};\n var newLayout = gd.layout || {};\n\n var oldFullData = gd._fullData || [];\n var newFullData = gd._fullData = [];\n var newData = gd.data || [];\n\n var oldCalcdata = gd.calcdata || [];\n\n var context = gd._context || {};\n\n var i;\n\n // Create all the storage space for frames, but only if doesn't already exist\n if(!gd._transitionData) plots.createTransitionData(gd);\n\n // So we only need to do this once (and since we have gd here)\n // get the translated placeholder titles.\n // These ones get used as default values so need to be known at supplyDefaults\n // others keep their blank defaults but render the placeholder as desired later\n // TODO: make these work the same way, only inserting the placeholder text at draw time?\n // The challenge is that this has slightly different behavior right now in editable mode:\n // using the placeholder as default makes this text permanently (but lightly) visible,\n // but explicit '' for these titles gives you a placeholder that's hidden until you mouse\n // over it - so you're not distracted by it if you really don't want a title, but if you do\n // and you're new to plotly you may not be able to find it.\n // When editable=false the two behave the same, no title is drawn.\n newFullLayout._dfltTitle = {\n plot: _(gd, 'Click to enter Plot title'),\n x: _(gd, 'Click to enter X axis title'),\n y: _(gd, 'Click to enter Y axis title'),\n colorbar: _(gd, 'Click to enter Colorscale title'),\n annotation: _(gd, 'new text')\n };\n newFullLayout._traceWord = _(gd, 'trace');\n\n var formatObj = getFormatObj(gd, d3FormatKeys);\n\n // stash the token from context so mapbox subplots can use it as default\n newFullLayout._mapboxAccessToken = context.mapboxAccessToken;\n\n // first fill in what we can of layout without looking at data\n // because fullData needs a few things from layout\n if(oldFullLayout._initialAutoSizeIsDone) {\n // coerce the updated layout while preserving width and height\n var oldWidth = oldFullLayout.width;\n var oldHeight = oldFullLayout.height;\n\n plots.supplyLayoutGlobalDefaults(newLayout, newFullLayout, formatObj);\n\n if(!newLayout.width) newFullLayout.width = oldWidth;\n if(!newLayout.height) newFullLayout.height = oldHeight;\n plots.sanitizeMargins(newFullLayout);\n } else {\n // coerce the updated layout and autosize if needed\n plots.supplyLayoutGlobalDefaults(newLayout, newFullLayout, formatObj);\n\n var missingWidthOrHeight = (!newLayout.width || !newLayout.height);\n var autosize = newFullLayout.autosize;\n var autosizable = context.autosizable;\n var initialAutoSize = missingWidthOrHeight && (autosize || autosizable);\n\n if(initialAutoSize) plots.plotAutoSize(gd, newLayout, newFullLayout);\n else if(missingWidthOrHeight) plots.sanitizeMargins(newFullLayout);\n\n // for backwards-compatibility with Plotly v1.x.x\n if(!autosize && missingWidthOrHeight) {\n newLayout.width = newFullLayout.width;\n newLayout.height = newFullLayout.height;\n }\n }\n\n newFullLayout._d3locale = getFormatter(formatObj, newFullLayout.separators);\n newFullLayout._extraFormat = getFormatObj(gd, extraFormatKeys);\n\n newFullLayout._initialAutoSizeIsDone = true;\n\n // keep track of how many traces are inputted\n newFullLayout._dataLength = newData.length;\n\n // clear the lists of trace and baseplot modules, and subplots\n newFullLayout._modules = [];\n newFullLayout._visibleModules = [];\n newFullLayout._basePlotModules = [];\n var subplots = newFullLayout._subplots = emptySubplotLists();\n\n // initialize axis and subplot hash objects for splom-generated grids\n var splomAxes = newFullLayout._splomAxes = {x: {}, y: {}};\n var splomSubplots = newFullLayout._splomSubplots = {};\n // initialize splom grid defaults\n newFullLayout._splomGridDflt = {};\n\n // for stacked area traces to share config across traces\n newFullLayout._scatterStackOpts = {};\n // for the first scatter trace on each subplot (so it knows tonext->tozero)\n newFullLayout._firstScatter = {};\n // for grouped bar/box/violin trace to share config across traces\n newFullLayout._alignmentOpts = {};\n // track color axes referenced in the data\n newFullLayout._colorAxes = {};\n\n // for traces to request a default rangeslider on their x axes\n // eg set `_requestRangeslider.x2 = true` for xaxis2\n newFullLayout._requestRangeslider = {};\n\n // pull uids from old data to use as new defaults\n newFullLayout._traceUids = getTraceUids(oldFullData, newData);\n\n // then do the data\n newFullLayout._globalTransforms = (gd._context || {}).globalTransforms;\n plots.supplyDataDefaults(newData, newFullData, newLayout, newFullLayout);\n\n // redo grid size defaults with info about splom x/y axes,\n // and fill in generated cartesian axes and subplots\n var splomXa = Object.keys(splomAxes.x);\n var splomYa = Object.keys(splomAxes.y);\n if(splomXa.length > 1 && splomYa.length > 1) {\n Registry.getComponentMethod('grid', 'sizeDefaults')(newLayout, newFullLayout);\n\n for(i = 0; i < splomXa.length; i++) {\n Lib.pushUnique(subplots.xaxis, splomXa[i]);\n }\n for(i = 0; i < splomYa.length; i++) {\n Lib.pushUnique(subplots.yaxis, splomYa[i]);\n }\n for(var k in splomSubplots) {\n Lib.pushUnique(subplots.cartesian, k);\n }\n }\n\n // attach helper method to check whether a plot type is present on graph\n newFullLayout._has = plots._hasPlotType.bind(newFullLayout);\n\n if(oldFullData.length === newFullData.length) {\n for(i = 0; i < newFullData.length; i++) {\n relinkPrivateKeys(newFullData[i], oldFullData[i]);\n }\n }\n\n // finally, fill in the pieces of layout that may need to look at data\n plots.supplyLayoutModuleDefaults(newLayout, newFullLayout, newFullData, gd._transitionData);\n\n // Special cases that introduce interactions between traces.\n // This is after relinkPrivateKeys so we can use those in crossTraceDefaults\n // and after layout module defaults, so we can use eg barmode\n var _modules = newFullLayout._visibleModules;\n var crossTraceDefaultsFuncs = [];\n for(i = 0; i < _modules.length; i++) {\n var funci = _modules[i].crossTraceDefaults;\n // some trace types share crossTraceDefaults (ie histogram2d, histogram2dcontour)\n if(funci) Lib.pushUnique(crossTraceDefaultsFuncs, funci);\n }\n for(i = 0; i < crossTraceDefaultsFuncs.length; i++) {\n crossTraceDefaultsFuncs[i](newFullData, newFullLayout);\n }\n\n // turn on flag to optimize large splom-only graphs\n // mostly by omitting SVG layers during Cartesian.drawFramework\n newFullLayout._hasOnlyLargeSploms = (\n newFullLayout._basePlotModules.length === 1 &&\n newFullLayout._basePlotModules[0].name === 'splom' &&\n splomXa.length > 15 &&\n splomYa.length > 15 &&\n newFullLayout.shapes.length === 0 &&\n newFullLayout.images.length === 0\n );\n\n // relink / initialize subplot axis objects\n plots.linkSubplots(newFullData, newFullLayout, oldFullData, oldFullLayout);\n\n // clean subplots and other artifacts from previous plot calls\n plots.cleanPlot(newFullData, newFullLayout, oldFullData, oldFullLayout);\n\n var hadGL2D = !!(oldFullLayout._has && oldFullLayout._has('gl2d'));\n var hasGL2D = !!(newFullLayout._has && newFullLayout._has('gl2d'));\n var hadCartesian = !!(oldFullLayout._has && oldFullLayout._has('cartesian'));\n var hasCartesian = !!(newFullLayout._has && newFullLayout._has('cartesian'));\n var hadBgLayer = hadCartesian || hadGL2D;\n var hasBgLayer = hasCartesian || hasGL2D;\n if(hadBgLayer && !hasBgLayer) {\n // remove bgLayer\n oldFullLayout._bgLayer.remove();\n } else if(hasBgLayer && !hadBgLayer) {\n // create bgLayer\n newFullLayout._shouldCreateBgLayer = true;\n }\n\n // clear selection outline until we implement persistent selection,\n // don't clear them though when drag handlers (e.g. listening to\n // `plotly_selecting`) update the graph.\n // we should try to come up with a better solution when implementing\n // https://github.com/plotly/plotly.js/issues/1851\n if(oldFullLayout._zoomlayer && !gd._dragging) {\n clearOutline({ // mock old gd\n _fullLayout: oldFullLayout\n });\n }\n\n\n // fill in meta helpers\n fillMetaTextHelpers(newFullData, newFullLayout);\n\n // relink functions and _ attributes to promote consistency between plots\n relinkPrivateKeys(newFullLayout, oldFullLayout);\n\n // colorscale crossTraceDefaults needs newFullLayout with relinked keys\n Registry.getComponentMethod('colorscale', 'crossTraceDefaults')(newFullData, newFullLayout);\n\n // For persisting GUI-driven changes in layout\n // _preGUI and _tracePreGUI were already copied over in relinkPrivateKeys\n if(!newFullLayout._preGUI) newFullLayout._preGUI = {};\n // track trace GUI changes by uid rather than by trace index\n if(!newFullLayout._tracePreGUI) newFullLayout._tracePreGUI = {};\n var tracePreGUI = newFullLayout._tracePreGUI;\n var uids = {};\n var uid;\n for(uid in tracePreGUI) uids[uid] = 'old';\n for(i = 0; i < newFullData.length; i++) {\n uid = newFullData[i]._fullInput.uid;\n if(!uids[uid]) tracePreGUI[uid] = {};\n uids[uid] = 'new';\n }\n for(uid in uids) {\n if(uids[uid] === 'old') delete tracePreGUI[uid];\n }\n\n // set up containers for margin calculations\n initMargins(newFullLayout);\n\n // collect and do some initial calculations for rangesliders\n Registry.getComponentMethod('rangeslider', 'makeData')(newFullLayout);\n\n // update object references in calcdata\n if(!skipUpdateCalc && oldCalcdata.length === newFullData.length) {\n plots.supplyDefaultsUpdateCalc(oldCalcdata, newFullData);\n }\n};\n\nplots.supplyDefaultsUpdateCalc = function(oldCalcdata, newFullData) {\n for(var i = 0; i < newFullData.length; i++) {\n var newTrace = newFullData[i];\n var cd0 = (oldCalcdata[i] || [])[0];\n if(cd0 && cd0.trace) {\n var oldTrace = cd0.trace;\n if(oldTrace._hasCalcTransform) {\n var arrayAttrs = oldTrace._arrayAttrs;\n var j, astr, oldArrayVal;\n\n for(j = 0; j < arrayAttrs.length; j++) {\n astr = arrayAttrs[j];\n oldArrayVal = Lib.nestedProperty(oldTrace, astr).get().slice();\n Lib.nestedProperty(newTrace, astr).set(oldArrayVal);\n }\n }\n cd0.trace = newTrace;\n }\n }\n};\n\n/**\n * Create a list of uid strings satisfying (in this order of importance):\n * 1. all unique, all strings\n * 2. matches input uids if provided\n * 3. matches previous data uids\n */\nfunction getTraceUids(oldFullData, newData) {\n var len = newData.length;\n var oldFullInput = [];\n var i, prevFullInput;\n for(i = 0; i < oldFullData.length; i++) {\n var thisFullInput = oldFullData[i]._fullInput;\n if(thisFullInput !== prevFullInput) oldFullInput.push(thisFullInput);\n prevFullInput = thisFullInput;\n }\n var oldLen = oldFullInput.length;\n var out = new Array(len);\n var seenUids = {};\n\n function setUid(uid, i) {\n out[i] = uid;\n seenUids[uid] = 1;\n }\n\n function tryUid(uid, i) {\n if(uid && typeof uid === 'string' && !seenUids[uid]) {\n setUid(uid, i);\n return true;\n }\n }\n\n for(i = 0; i < len; i++) {\n var newUid = newData[i].uid;\n if(typeof newUid === 'number') newUid = String(newUid);\n\n if(tryUid(newUid, i)) continue;\n if(i < oldLen && tryUid(oldFullInput[i].uid, i)) continue;\n setUid(Lib.randstr(seenUids), i);\n }\n\n return out;\n}\n\n/**\n * Make a container for collecting subplots we need to display.\n *\n * Finds all subplot types we need to enumerate once and caches it,\n * but makes a new output object each time.\n * Single-trace subplots (which have no `id`) such as pie, table, etc\n * do not need to be collected because we just draw all visible traces.\n */\nfunction emptySubplotLists() {\n var collectableSubplotTypes = Registry.collectableSubplotTypes;\n var out = {};\n var i, j;\n\n if(!collectableSubplotTypes) {\n collectableSubplotTypes = [];\n\n var subplotsRegistry = Registry.subplotsRegistry;\n\n for(var subplotType in subplotsRegistry) {\n var subplotModule = subplotsRegistry[subplotType];\n var subplotAttr = subplotModule.attr;\n\n if(subplotAttr) {\n collectableSubplotTypes.push(subplotType);\n\n // special case, currently just for cartesian:\n // we need to enumerate axes, not just subplots\n if(Array.isArray(subplotAttr)) {\n for(j = 0; j < subplotAttr.length; j++) {\n Lib.pushUnique(collectableSubplotTypes, subplotAttr[j]);\n }\n }\n }\n }\n }\n\n for(i = 0; i < collectableSubplotTypes.length; i++) {\n out[collectableSubplotTypes[i]] = [];\n }\n return out;\n}\n\n/**\n * getFormatObj: use _context to get the format object from locale.\n * Used to get d3.locale argument object and extraFormat argument object\n *\n * Regarding d3.locale argument :\n * decimal and thousands can be overridden later by layout.separators\n * grouping and currency are not presently used by our automatic number\n * formatting system but can be used by custom formats.\n *\n * @returns {object} d3.locale format object\n */\nfunction getFormatObj(gd, formatKeys) {\n var locale = gd._context.locale;\n if(!locale) locale = 'en-US';\n\n var formatDone = false;\n var formatObj = {};\n\n function includeFormat(newFormat) {\n var formatFinished = true;\n for(var i = 0; i < formatKeys.length; i++) {\n var formatKey = formatKeys[i];\n if(!formatObj[formatKey]) {\n if(newFormat[formatKey]) {\n formatObj[formatKey] = newFormat[formatKey];\n } else formatFinished = false;\n }\n }\n if(formatFinished) formatDone = true;\n }\n\n // same as localize, look for format parts in each format spec in the chain\n for(var i = 0; i < 2; i++) {\n var locales = gd._context.locales;\n for(var j = 0; j < 2; j++) {\n var formatj = (locales[locale] || {}).format;\n if(formatj) {\n includeFormat(formatj);\n if(formatDone) break;\n }\n locales = Registry.localeRegistry;\n }\n\n var baseLocale = locale.split('-')[0];\n if(formatDone || baseLocale === locale) break;\n locale = baseLocale;\n }\n\n // lastly pick out defaults from english (non-US, as DMY is so much more common)\n if(!formatDone) includeFormat(Registry.localeRegistry.en.format);\n\n return formatObj;\n}\n\n/**\n * getFormatter: combine the final separators with the locale formatting object\n * we pulled earlier to generate number and time formatters\n * TODO: remove separators in v3, only use locale, so we don't need this step?\n *\n * @param {object} formatObj: d3.locale format object\n * @param {string} separators: length-2 string to override decimal and thousands\n * separators in number formatting\n *\n * @returns {object} {numberFormat, timeFormat} d3 formatter factory functions\n * for numbers and time\n */\nfunction getFormatter(formatObj, separators) {\n formatObj.decimal = separators.charAt(0);\n formatObj.thousands = separators.charAt(1);\n\n return {\n numberFormat: function(formatStr) {\n try {\n formatStr = formatLocale(formatObj).format(\n Lib.adjustFormat(formatStr)\n );\n } catch(e) {\n Lib.warnBadFormat(formatStr);\n return Lib.noFormat;\n }\n\n return formatStr;\n },\n timeFormat: timeFormatLocale(formatObj).utcFormat\n };\n}\n\nfunction fillMetaTextHelpers(newFullData, newFullLayout) {\n var _meta;\n var meta4data = [];\n\n if(newFullLayout.meta) {\n _meta = newFullLayout._meta = {\n meta: newFullLayout.meta,\n layout: {meta: newFullLayout.meta}\n };\n }\n\n for(var i = 0; i < newFullData.length; i++) {\n var trace = newFullData[i];\n\n if(trace.meta) {\n meta4data[trace.index] = trace._meta = {meta: trace.meta};\n } else if(newFullLayout.meta) {\n trace._meta = {meta: newFullLayout.meta};\n }\n if(newFullLayout.meta) {\n trace._meta.layout = {meta: newFullLayout.meta};\n }\n }\n\n if(meta4data.length) {\n if(!_meta) {\n _meta = newFullLayout._meta = {};\n }\n _meta.data = meta4data;\n }\n}\n\n// Create storage for all of the data related to frames and transitions:\nplots.createTransitionData = function(gd) {\n // Set up the default keyframe if it doesn't exist:\n if(!gd._transitionData) {\n gd._transitionData = {};\n }\n\n if(!gd._transitionData._frames) {\n gd._transitionData._frames = [];\n }\n\n if(!gd._transitionData._frameHash) {\n gd._transitionData._frameHash = {};\n }\n\n if(!gd._transitionData._counter) {\n gd._transitionData._counter = 0;\n }\n\n if(!gd._transitionData._interruptCallbacks) {\n gd._transitionData._interruptCallbacks = [];\n }\n};\n\n// helper function to be bound to fullLayout to check\n// whether a certain plot type is present on plot\n// or trace has a category\nplots._hasPlotType = function(category) {\n var i;\n\n // check base plot modules\n var basePlotModules = this._basePlotModules || [];\n for(i = 0; i < basePlotModules.length; i++) {\n if(basePlotModules[i].name === category) return true;\n }\n\n // check trace modules (including non-visible:true)\n var modules = this._modules || [];\n for(i = 0; i < modules.length; i++) {\n var name = modules[i].name;\n if(name === category) return true;\n // N.B. this is modules[i] along with 'categories' as a hash object\n var _module = Registry.modules[name];\n if(_module && _module.categories[category]) return true;\n }\n\n return false;\n};\n\nplots.cleanPlot = function(newFullData, newFullLayout, oldFullData, oldFullLayout) {\n var i, j;\n\n var basePlotModules = oldFullLayout._basePlotModules || [];\n for(i = 0; i < basePlotModules.length; i++) {\n var _module = basePlotModules[i];\n\n if(_module.clean) {\n _module.clean(newFullData, newFullLayout, oldFullData, oldFullLayout);\n }\n }\n\n var hadGl = oldFullLayout._has && oldFullLayout._has('gl');\n var hasGl = newFullLayout._has && newFullLayout._has('gl');\n\n if(hadGl && !hasGl) {\n if(oldFullLayout._glcontainer !== undefined) {\n oldFullLayout._glcontainer.selectAll('.gl-canvas').remove();\n oldFullLayout._glcontainer.selectAll('.no-webgl').remove();\n oldFullLayout._glcanvas = null;\n }\n }\n\n var hasInfoLayer = !!oldFullLayout._infolayer;\n\n oldLoop:\n for(i = 0; i < oldFullData.length; i++) {\n var oldTrace = oldFullData[i];\n var oldUid = oldTrace.uid;\n\n for(j = 0; j < newFullData.length; j++) {\n var newTrace = newFullData[j];\n\n if(oldUid === newTrace.uid) continue oldLoop;\n }\n\n // clean old colorbars\n if(hasInfoLayer) {\n oldFullLayout._infolayer.select('.cb' + oldUid).remove();\n }\n }\n};\n\nplots.linkSubplots = function(newFullData, newFullLayout, oldFullData, oldFullLayout) {\n var i, j;\n\n var oldSubplots = oldFullLayout._plots || {};\n var newSubplots = newFullLayout._plots = {};\n var newSubplotList = newFullLayout._subplots;\n\n var mockGd = {\n _fullData: newFullData,\n _fullLayout: newFullLayout\n };\n\n var ids = newSubplotList.cartesian.concat(newSubplotList.gl2d || []);\n\n for(i = 0; i < ids.length; i++) {\n var id = ids[i];\n var oldSubplot = oldSubplots[id];\n var xaxis = axisIDs.getFromId(mockGd, id, 'x');\n var yaxis = axisIDs.getFromId(mockGd, id, 'y');\n var plotinfo;\n\n // link or create subplot object\n if(oldSubplot) {\n plotinfo = newSubplots[id] = oldSubplot;\n } else {\n plotinfo = newSubplots[id] = {};\n plotinfo.id = id;\n }\n\n // add these axis ids to each others' subplot lists\n xaxis._counterAxes.push(yaxis._id);\n yaxis._counterAxes.push(xaxis._id);\n xaxis._subplotsWith.push(id);\n yaxis._subplotsWith.push(id);\n\n // update x and y axis layout object refs\n plotinfo.xaxis = xaxis;\n plotinfo.yaxis = yaxis;\n\n // By default, we clip at the subplot level,\n // but if one trace on a given subplot has *cliponaxis* set to false,\n // we need to clip at the trace module layer level;\n // find this out here, once of for all.\n plotinfo._hasClipOnAxisFalse = false;\n\n for(j = 0; j < newFullData.length; j++) {\n var trace = newFullData[j];\n\n if(\n trace.xaxis === plotinfo.xaxis._id &&\n trace.yaxis === plotinfo.yaxis._id &&\n trace.cliponaxis === false\n ) {\n plotinfo._hasClipOnAxisFalse = true;\n break;\n }\n }\n }\n\n // while we're at it, link overlaying axes to their main axes and\n // anchored axes to the axes they're anchored to\n var axList = axisIDs.list(mockGd, null, true);\n var ax;\n for(i = 0; i < axList.length; i++) {\n ax = axList[i];\n var mainAx = null;\n\n if(ax.overlaying) {\n mainAx = axisIDs.getFromId(mockGd, ax.overlaying);\n\n // you cannot overlay an axis that's already overlaying another\n if(mainAx && mainAx.overlaying) {\n ax.overlaying = false;\n mainAx = null;\n }\n }\n ax._mainAxis = mainAx || ax;\n\n /*\n * For now force overlays to overlay completely... so they\n * can drag together correctly and share backgrounds.\n * Later perhaps we make separate axis domain and\n * tick/line domain or something, so they can still share\n * the (possibly larger) dragger and background but don't\n * have to both be drawn over that whole domain\n */\n if(mainAx) ax.domain = mainAx.domain.slice();\n\n ax._anchorAxis = ax.anchor === 'free' ?\n null :\n axisIDs.getFromId(mockGd, ax.anchor);\n }\n\n // finally, we can find the main subplot for each axis\n // (on which the ticks & labels are drawn)\n for(i = 0; i < axList.length; i++) {\n ax = axList[i];\n ax._counterAxes.sort(axisIDs.idSort);\n ax._subplotsWith.sort(Lib.subplotSort);\n ax._mainSubplot = findMainSubplot(ax, newFullLayout);\n\n // find \"full\" domain span of counter axes,\n // this loop can be costly, so only compute it when required\n if(ax._counterAxes.length && (\n (ax.spikemode && ax.spikemode.indexOf('across') !== -1) ||\n (ax.automargin && ax.mirror && ax.anchor !== 'free') ||\n Registry.getComponentMethod('rangeslider', 'isVisible')(ax)\n )) {\n var min = 1;\n var max = 0;\n for(j = 0; j < ax._counterAxes.length; j++) {\n var ax2 = axisIDs.getFromId(mockGd, ax._counterAxes[j]);\n min = Math.min(min, ax2.domain[0]);\n max = Math.max(max, ax2.domain[1]);\n }\n if(min < max) {\n ax._counterDomainMin = min;\n ax._counterDomainMax = max;\n }\n }\n }\n};\n\nfunction findMainSubplot(ax, fullLayout) {\n var mockGd = {_fullLayout: fullLayout};\n\n var isX = ax._id.charAt(0) === 'x';\n var anchorAx = ax._mainAxis._anchorAxis;\n var mainSubplotID = '';\n var nextBestMainSubplotID = '';\n var anchorID = '';\n\n // First try the main ID with the anchor\n if(anchorAx) {\n anchorID = anchorAx._mainAxis._id;\n mainSubplotID = isX ? (ax._id + anchorID) : (anchorID + ax._id);\n }\n\n // Then look for a subplot with the counteraxis overlaying the anchor\n // If that fails just use the first subplot including this axis\n if(!mainSubplotID || !fullLayout._plots[mainSubplotID]) {\n mainSubplotID = '';\n\n var counterIDs = ax._counterAxes;\n for(var j = 0; j < counterIDs.length; j++) {\n var counterPart = counterIDs[j];\n var id = isX ? (ax._id + counterPart) : (counterPart + ax._id);\n if(!nextBestMainSubplotID) nextBestMainSubplotID = id;\n var counterAx = axisIDs.getFromId(mockGd, counterPart);\n if(anchorID && counterAx.overlaying === anchorID) {\n mainSubplotID = id;\n break;\n }\n }\n }\n\n return mainSubplotID || nextBestMainSubplotID;\n}\n\n// This function clears any trace attributes with valType: color and\n// no set dflt filed in the plot schema. This is needed because groupby (which\n// is the only transform for which this currently applies) supplies parent\n// trace defaults, then expanded trace defaults. The result is that `null`\n// colors are default-supplied and inherited as a color instead of a null.\n// The result is that expanded trace default colors have no effect, with\n// the final result that groups are indistinguishable. This function clears\n// those colors so that individual groupby groups get unique colors.\nplots.clearExpandedTraceDefaultColors = function(trace) {\n var colorAttrs, path, i;\n\n // This uses weird closure state in order to satisfy the linter rule\n // that we can't create functions in a loop.\n function locateColorAttrs(attr, attrName, attrs, level) {\n path[level] = attrName;\n path.length = level + 1;\n if(attr.valType === 'color' && attr.dflt === undefined) {\n colorAttrs.push(path.join('.'));\n }\n }\n\n path = [];\n\n // Get the cached colorAttrs:\n colorAttrs = trace._module._colorAttrs;\n\n // Or else compute and cache the colorAttrs on the module:\n if(!colorAttrs) {\n trace._module._colorAttrs = colorAttrs = [];\n PlotSchema.crawl(\n trace._module.attributes,\n locateColorAttrs\n );\n }\n\n for(i = 0; i < colorAttrs.length; i++) {\n var origprop = Lib.nestedProperty(trace, '_input.' + colorAttrs[i]);\n\n if(!origprop.get()) {\n Lib.nestedProperty(trace, colorAttrs[i]).set(null);\n }\n }\n};\n\n\nplots.supplyDataDefaults = function(dataIn, dataOut, layout, fullLayout) {\n var modules = fullLayout._modules;\n var visibleModules = fullLayout._visibleModules;\n var basePlotModules = fullLayout._basePlotModules;\n var cnt = 0;\n var colorCnt = 0;\n\n var i, fullTrace, trace;\n\n fullLayout._transformModules = [];\n\n function pushModule(fullTrace) {\n dataOut.push(fullTrace);\n\n var _module = fullTrace._module;\n if(!_module) return;\n\n Lib.pushUnique(modules, _module);\n if(fullTrace.visible === true) Lib.pushUnique(visibleModules, _module);\n Lib.pushUnique(basePlotModules, fullTrace._module.basePlotModule);\n cnt++;\n\n // TODO: do we really want color not to increment for explicitly invisible traces?\n // This logic is weird, but matches previous behavior: traces that you explicitly\n // set to visible:false do not increment the color, but traces WE determine to be\n // empty or invalid (and thus set to visible:false) DO increment color.\n // I kind of think we should just let all traces increment color, visible or not.\n // see mock: axes-autotype-empty vs. a test of restyling visible: false that\n // I can't find right now...\n if(fullTrace._input.visible !== false) colorCnt++;\n }\n\n var carpetIndex = {};\n var carpetDependents = [];\n var dataTemplate = (layout.template || {}).data || {};\n var templater = Template.traceTemplater(dataTemplate);\n\n for(i = 0; i < dataIn.length; i++) {\n trace = dataIn[i];\n\n // reuse uid we may have pulled out of oldFullData\n // Note: templater supplies trace type\n fullTrace = templater.newTrace(trace);\n fullTrace.uid = fullLayout._traceUids[i];\n plots.supplyTraceDefaults(trace, fullTrace, colorCnt, fullLayout, i);\n\n fullTrace.index = i;\n fullTrace._input = trace;\n fullTrace._expandedIndex = cnt;\n\n if(fullTrace.transforms && fullTrace.transforms.length) {\n var sdInvisible = trace.visible !== false && fullTrace.visible === false;\n\n var expandedTraces = applyTransforms(fullTrace, dataOut, layout, fullLayout);\n\n for(var j = 0; j < expandedTraces.length; j++) {\n var expandedTrace = expandedTraces[j];\n\n // No further templating during transforms.\n var fullExpandedTrace = {\n _template: fullTrace._template,\n type: fullTrace.type,\n // set uid using parent uid and expanded index\n // to promote consistency between update calls\n uid: fullTrace.uid + j\n };\n\n // If the first supplyDefaults created `visible: false`,\n // clear it before running supplyDefaults a second time,\n // because sometimes there are items we still want to coerce\n // inside trace modules before determining that the trace is\n // again `visible: false`, for example partial visibilities\n // in `splom` traces.\n if(sdInvisible && expandedTrace.visible === false) {\n delete expandedTrace.visible;\n }\n\n plots.supplyTraceDefaults(expandedTrace, fullExpandedTrace, cnt, fullLayout, i);\n\n // relink private (i.e. underscore) keys expanded trace to full expanded trace so\n // that transform supply-default methods can set _ keys for future use.\n relinkPrivateKeys(fullExpandedTrace, expandedTrace);\n\n // add info about parent data trace\n fullExpandedTrace.index = i;\n fullExpandedTrace._input = trace;\n fullExpandedTrace._fullInput = fullTrace;\n\n // add info about the expanded data\n fullExpandedTrace._expandedIndex = cnt;\n fullExpandedTrace._expandedInput = expandedTrace;\n\n pushModule(fullExpandedTrace);\n }\n } else {\n // add identify refs for consistency with transformed traces\n fullTrace._fullInput = fullTrace;\n fullTrace._expandedInput = fullTrace;\n\n pushModule(fullTrace);\n }\n\n if(Registry.traceIs(fullTrace, 'carpetAxis')) {\n carpetIndex[fullTrace.carpet] = fullTrace;\n }\n\n if(Registry.traceIs(fullTrace, 'carpetDependent')) {\n carpetDependents.push(i);\n }\n }\n\n for(i = 0; i < carpetDependents.length; i++) {\n fullTrace = dataOut[carpetDependents[i]];\n\n if(!fullTrace.visible) continue;\n\n var carpetAxis = carpetIndex[fullTrace.carpet];\n fullTrace._carpet = carpetAxis;\n\n if(!carpetAxis || !carpetAxis.visible) {\n fullTrace.visible = false;\n continue;\n }\n\n fullTrace.xaxis = carpetAxis.xaxis;\n fullTrace.yaxis = carpetAxis.yaxis;\n }\n};\n\nplots.supplyAnimationDefaults = function(opts) {\n opts = opts || {};\n var i;\n var optsOut = {};\n\n function coerce(attr, dflt) {\n return Lib.coerce(opts || {}, optsOut, animationAttrs, attr, dflt);\n }\n\n coerce('mode');\n coerce('direction');\n coerce('fromcurrent');\n\n if(Array.isArray(opts.frame)) {\n optsOut.frame = [];\n for(i = 0; i < opts.frame.length; i++) {\n optsOut.frame[i] = plots.supplyAnimationFrameDefaults(opts.frame[i] || {});\n }\n } else {\n optsOut.frame = plots.supplyAnimationFrameDefaults(opts.frame || {});\n }\n\n if(Array.isArray(opts.transition)) {\n optsOut.transition = [];\n for(i = 0; i < opts.transition.length; i++) {\n optsOut.transition[i] = plots.supplyAnimationTransitionDefaults(opts.transition[i] || {});\n }\n } else {\n optsOut.transition = plots.supplyAnimationTransitionDefaults(opts.transition || {});\n }\n\n return optsOut;\n};\n\nplots.supplyAnimationFrameDefaults = function(opts) {\n var optsOut = {};\n\n function coerce(attr, dflt) {\n return Lib.coerce(opts || {}, optsOut, animationAttrs.frame, attr, dflt);\n }\n\n coerce('duration');\n coerce('redraw');\n\n return optsOut;\n};\n\nplots.supplyAnimationTransitionDefaults = function(opts) {\n var optsOut = {};\n\n function coerce(attr, dflt) {\n return Lib.coerce(opts || {}, optsOut, animationAttrs.transition, attr, dflt);\n }\n\n coerce('duration');\n coerce('easing');\n\n return optsOut;\n};\n\nplots.supplyFrameDefaults = function(frameIn) {\n var frameOut = {};\n\n function coerce(attr, dflt) {\n return Lib.coerce(frameIn, frameOut, frameAttrs, attr, dflt);\n }\n\n coerce('group');\n coerce('name');\n coerce('traces');\n coerce('baseframe');\n coerce('data');\n coerce('layout');\n\n return frameOut;\n};\n\nplots.supplyTraceDefaults = function(traceIn, traceOut, colorIndex, layout, traceInIndex) {\n var colorway = layout.colorway || Color.defaults;\n var defaultColor = colorway[colorIndex % colorway.length];\n\n var i;\n\n function coerce(attr, dflt) {\n return Lib.coerce(traceIn, traceOut, plots.attributes, attr, dflt);\n }\n\n var visible = coerce('visible');\n\n coerce('type');\n coerce('name', layout._traceWord + ' ' + traceInIndex);\n\n coerce('uirevision', layout.uirevision);\n\n // we want even invisible traces to make their would-be subplots visible\n // so coerce the subplot id(s) now no matter what\n var _module = plots.getModule(traceOut);\n\n traceOut._module = _module;\n if(_module) {\n var basePlotModule = _module.basePlotModule;\n var subplotAttr = basePlotModule.attr;\n var subplotAttrs = basePlotModule.attributes;\n if(subplotAttr && subplotAttrs) {\n var subplots = layout._subplots;\n var subplotId = '';\n\n if(\n visible ||\n basePlotModule.name !== 'gl2d' // for now just drop empty gl2d subplots\n // TODO - currently if we draw an empty gl2d subplot, it draws\n // nothing then gets stuck and you can't get it back without newPlot\n // sort this out in the regl refactor?\n ) {\n if(Array.isArray(subplotAttr)) {\n for(i = 0; i < subplotAttr.length; i++) {\n var attri = subplotAttr[i];\n var vali = Lib.coerce(traceIn, traceOut, subplotAttrs, attri);\n\n if(subplots[attri]) Lib.pushUnique(subplots[attri], vali);\n subplotId += vali;\n }\n } else {\n subplotId = Lib.coerce(traceIn, traceOut, subplotAttrs, subplotAttr);\n }\n\n if(subplots[basePlotModule.name]) {\n Lib.pushUnique(subplots[basePlotModule.name], subplotId);\n }\n }\n }\n }\n\n if(visible) {\n coerce('customdata');\n coerce('ids');\n coerce('meta');\n\n if(Registry.traceIs(traceOut, 'showLegend')) {\n Lib.coerce(traceIn, traceOut,\n _module.attributes.showlegend ? _module.attributes : plots.attributes,\n 'showlegend'\n );\n\n coerce('legend');\n coerce('legendwidth');\n coerce('legendgroup');\n coerce('legendgrouptitle.text');\n coerce('legendrank');\n\n traceOut._dfltShowLegend = true;\n } else {\n traceOut._dfltShowLegend = false;\n }\n\n if(_module) {\n _module.supplyDefaults(traceIn, traceOut, defaultColor, layout);\n }\n\n if(!Registry.traceIs(traceOut, 'noOpacity')) {\n coerce('opacity');\n }\n\n if(Registry.traceIs(traceOut, 'notLegendIsolatable')) {\n // This clears out the legendonly state for traces like carpet that\n // cannot be isolated in the legend\n traceOut.visible = !!traceOut.visible;\n }\n\n if(!Registry.traceIs(traceOut, 'noHover')) {\n if(!traceOut.hovertemplate) Lib.coerceHoverinfo(traceIn, traceOut, layout);\n\n // parcats support hover, but not hoverlabel stylings (yet)\n if(traceOut.type !== 'parcats') {\n Registry.getComponentMethod('fx', 'supplyDefaults')(traceIn, traceOut, defaultColor, layout);\n }\n }\n\n if(_module && _module.selectPoints) {\n var selectedpoints = coerce('selectedpoints');\n if(Lib.isTypedArray(selectedpoints)) {\n traceOut.selectedpoints = Array.from(selectedpoints);\n }\n }\n\n plots.supplyTransformDefaults(traceIn, traceOut, layout);\n }\n\n return traceOut;\n};\n\n/**\n * hasMakesDataTransform: does this trace have a transform that makes its own\n * data, either by grabbing it from somewhere else or by creating it from input\n * parameters? If so, we should still keep going with supplyDefaults\n * even if the trace is invisible, which may just be because it has no data yet.\n */\nfunction hasMakesDataTransform(trace) {\n var transforms = trace.transforms;\n if(Array.isArray(transforms) && transforms.length) {\n for(var i = 0; i < transforms.length; i++) {\n var ti = transforms[i];\n var _module = ti._module || transformsRegistry[ti.type];\n if(_module && _module.makesData) return true;\n }\n }\n return false;\n}\n\nplots.hasMakesDataTransform = hasMakesDataTransform;\n\nplots.supplyTransformDefaults = function(traceIn, traceOut, layout) {\n // For now we only allow transforms on 1D traces, ie those that specify a _length.\n // If we were to implement 2D transforms, we'd need to have each transform\n // describe its own applicability and disable itself when it doesn't apply.\n // Also allow transforms that make their own data, but not in globalTransforms\n if(!(traceOut._length || hasMakesDataTransform(traceIn))) return;\n\n var globalTransforms = layout._globalTransforms || [];\n var transformModules = layout._transformModules || [];\n\n if(!Array.isArray(traceIn.transforms) && globalTransforms.length === 0) return;\n\n var containerIn = traceIn.transforms || [];\n var transformList = globalTransforms.concat(containerIn);\n var containerOut = traceOut.transforms = [];\n\n for(var i = 0; i < transformList.length; i++) {\n var transformIn = transformList[i];\n var type = transformIn.type;\n var _module = transformsRegistry[type];\n var transformOut;\n\n /*\n * Supply defaults may run twice. First pass runs all supply defaults steps\n * and adds the _module to any output transforms.\n * If transforms exist another pass is run so that any generated traces also\n * go through supply defaults. This has the effect of rerunning\n * supplyTransformDefaults. If the transform does not have a `transform`\n * function it could not have generated any new traces and the second stage\n * is unnecessary. We detect this case with the following variables.\n */\n var isFirstStage = !(transformIn._module && transformIn._module === _module);\n var doLaterStages = _module && typeof _module.transform === 'function';\n\n if(!_module) Lib.warn('Unrecognized transform type ' + type + '.');\n\n if(_module && _module.supplyDefaults && (isFirstStage || doLaterStages)) {\n transformOut = _module.supplyDefaults(transformIn, traceOut, layout, traceIn);\n transformOut.type = type;\n transformOut._module = _module;\n\n Lib.pushUnique(transformModules, _module);\n } else {\n transformOut = Lib.extendFlat({}, transformIn);\n }\n\n containerOut.push(transformOut);\n }\n};\n\nfunction applyTransforms(fullTrace, fullData, layout, fullLayout) {\n var container = fullTrace.transforms;\n var dataOut = [fullTrace];\n\n for(var i = 0; i < container.length; i++) {\n var transform = container[i];\n var _module = transformsRegistry[transform.type];\n\n if(_module && _module.transform) {\n dataOut = _module.transform(dataOut, {\n transform: transform,\n fullTrace: fullTrace,\n fullData: fullData,\n layout: layout,\n fullLayout: fullLayout,\n transformIndex: i\n });\n }\n }\n\n return dataOut;\n}\n\nplots.supplyLayoutGlobalDefaults = function(layoutIn, layoutOut, formatObj) {\n function coerce(attr, dflt) {\n return Lib.coerce(layoutIn, layoutOut, plots.layoutAttributes, attr, dflt);\n }\n\n var template = layoutIn.template;\n if(Lib.isPlainObject(template)) {\n layoutOut.template = template;\n layoutOut._template = template.layout;\n layoutOut._dataTemplate = template.data;\n }\n\n coerce('autotypenumbers');\n\n var font = Lib.coerceFont(coerce, 'font');\n var fontSize = font.size;\n\n Lib.coerceFont(coerce, 'title.font', Lib.extendFlat({}, font, {\n size: Math.round(fontSize * 1.4)\n }));\n\n coerce('title.text', layoutOut._dfltTitle.plot);\n coerce('title.xref');\n var titleYref = coerce('title.yref');\n coerce('title.pad.t');\n coerce('title.pad.r');\n coerce('title.pad.b');\n coerce('title.pad.l');\n var titleAutomargin = coerce('title.automargin');\n\n coerce('title.x');\n coerce('title.xanchor');\n coerce('title.y');\n coerce('title.yanchor');\n\n if(titleAutomargin) {\n // when automargin=true\n // title.y is 1 or 0 if paper ref\n // 'auto' is not supported for either title.y or title.yanchor\n\n // TODO: mention this smart default in the title.y and title.yanchor descriptions\n\n if(titleYref === 'paper') {\n if(layoutOut.title.y !== 0) layoutOut.title.y = 1;\n\n if(layoutOut.title.yanchor === 'auto') {\n layoutOut.title.yanchor = layoutOut.title.y === 0 ? 'top' : 'bottom';\n }\n }\n\n if(titleYref === 'container') {\n if(layoutOut.title.y === 'auto') layoutOut.title.y = 1;\n\n if(layoutOut.title.yanchor === 'auto') {\n layoutOut.title.yanchor = layoutOut.title.y < 0.5 ? 'bottom' : 'top';\n }\n }\n }\n\n var uniformtextMode = coerce('uniformtext.mode');\n if(uniformtextMode) {\n coerce('uniformtext.minsize');\n }\n\n // Make sure that autosize is defaulted to *true*\n // on layouts with no set width and height for backward compatibly,\n // in particular https://plotly.com/javascript/responsive-fluid-layout/\n //\n // Before https://github.com/plotly/plotly.js/pull/635 ,\n // layouts with no set width and height were set temporary set to 'initial'\n // to pass through the autosize routine\n //\n // This behavior is subject to change in v3.\n coerce('autosize', !(layoutIn.width && layoutIn.height));\n\n coerce('width');\n coerce('height');\n coerce('minreducedwidth');\n coerce('minreducedheight');\n\n coerce('margin.l');\n coerce('margin.r');\n coerce('margin.t');\n coerce('margin.b');\n coerce('margin.pad');\n coerce('margin.autoexpand');\n\n if(layoutIn.width && layoutIn.height) plots.sanitizeMargins(layoutOut);\n\n Registry.getComponentMethod('grid', 'sizeDefaults')(layoutIn, layoutOut);\n\n coerce('paper_bgcolor');\n\n coerce('separators', formatObj.decimal + formatObj.thousands);\n coerce('hidesources');\n\n coerce('colorway');\n\n coerce('datarevision');\n var uirevision = coerce('uirevision');\n coerce('editrevision', uirevision);\n coerce('selectionrevision', uirevision);\n\n Registry.getComponentMethod(\n 'modebar',\n 'supplyLayoutDefaults'\n )(layoutIn, layoutOut);\n\n Registry.getComponentMethod(\n 'shapes',\n 'supplyDrawNewShapeDefaults'\n )(layoutIn, layoutOut, coerce);\n\n Registry.getComponentMethod(\n 'selections',\n 'supplyDrawNewSelectionDefaults'\n )(layoutIn, layoutOut, coerce);\n\n coerce('meta');\n\n // do not include defaults in fullLayout when users do not set transition\n if(Lib.isPlainObject(layoutIn.transition)) {\n coerce('transition.duration');\n coerce('transition.easing');\n coerce('transition.ordering');\n }\n\n Registry.getComponentMethod(\n 'calendars',\n 'handleDefaults'\n )(layoutIn, layoutOut, 'calendar');\n\n Registry.getComponentMethod(\n 'fx',\n 'supplyLayoutGlobalDefaults'\n )(layoutIn, layoutOut, coerce);\n\n Lib.coerce(layoutIn, layoutOut, scatterAttrs, 'scattermode');\n};\n\nfunction getComputedSize(attr) {\n return (\n (typeof attr === 'string') &&\n (attr.substr(attr.length - 2) === 'px') &&\n parseFloat(attr)\n );\n}\n\n\nplots.plotAutoSize = function plotAutoSize(gd, layout, fullLayout) {\n var context = gd._context || {};\n var frameMargins = context.frameMargins;\n var newWidth;\n var newHeight;\n\n var isPlotDiv = Lib.isPlotDiv(gd);\n\n if(isPlotDiv) gd.emit('plotly_autosize');\n\n // embedded in an iframe - just take the full iframe size\n // if we get to this point, with no aspect ratio restrictions\n if(context.fillFrame) {\n newWidth = window.innerWidth;\n newHeight = window.innerHeight;\n\n // somehow we get a few extra px height sometimes...\n // just hide it\n document.body.style.overflow = 'hidden';\n } else {\n // plotly.js - let the developers do what they want, either\n // provide height and width for the container div,\n // specify size in layout, or take the defaults,\n // but don't enforce any ratio restrictions\n var computedStyle = isPlotDiv ? window.getComputedStyle(gd) : {};\n\n newWidth = getComputedSize(computedStyle.width) || getComputedSize(computedStyle.maxWidth) || fullLayout.width;\n newHeight = getComputedSize(computedStyle.height) || getComputedSize(computedStyle.maxHeight) || fullLayout.height;\n\n if(isNumeric(frameMargins) && frameMargins > 0) {\n var factor = 1 - 2 * frameMargins;\n newWidth = Math.round(factor * newWidth);\n newHeight = Math.round(factor * newHeight);\n }\n }\n\n var minWidth = plots.layoutAttributes.width.min;\n var minHeight = plots.layoutAttributes.height.min;\n if(newWidth < minWidth) newWidth = minWidth;\n if(newHeight < minHeight) newHeight = minHeight;\n\n var widthHasChanged = !layout.width &&\n (Math.abs(fullLayout.width - newWidth) > 1);\n var heightHasChanged = !layout.height &&\n (Math.abs(fullLayout.height - newHeight) > 1);\n\n if(heightHasChanged || widthHasChanged) {\n if(widthHasChanged) fullLayout.width = newWidth;\n if(heightHasChanged) fullLayout.height = newHeight;\n }\n\n // cache initial autosize value, used in relayout when\n // width or height values are set to null\n if(!gd._initialAutoSize) {\n gd._initialAutoSize = { width: newWidth, height: newHeight };\n }\n\n plots.sanitizeMargins(fullLayout);\n};\n\nplots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData, transitionData) {\n var componentsRegistry = Registry.componentsRegistry;\n var basePlotModules = layoutOut._basePlotModules;\n var component, i, _module;\n\n var Cartesian = Registry.subplotsRegistry.cartesian;\n\n // check if any components need to add more base plot modules\n // that weren't captured by traces\n for(component in componentsRegistry) {\n _module = componentsRegistry[component];\n\n if(_module.includeBasePlot) {\n _module.includeBasePlot(layoutIn, layoutOut);\n }\n }\n\n // make sure we *at least* have some cartesian axes\n if(!basePlotModules.length) {\n basePlotModules.push(Cartesian);\n }\n\n // ensure all cartesian axes have at least one subplot\n if(layoutOut._has('cartesian')) {\n Registry.getComponentMethod('grid', 'contentDefaults')(layoutIn, layoutOut);\n Cartesian.finalizeSubplots(layoutIn, layoutOut);\n }\n\n // sort subplot lists\n for(var subplotType in layoutOut._subplots) {\n layoutOut._subplots[subplotType].sort(Lib.subplotSort);\n }\n\n // base plot module layout defaults\n for(i = 0; i < basePlotModules.length; i++) {\n _module = basePlotModules[i];\n\n // e.g. pie does not have a layout-defaults step\n if(_module.supplyLayoutDefaults) {\n _module.supplyLayoutDefaults(layoutIn, layoutOut, fullData);\n }\n }\n\n // trace module layout defaults\n // use _modules rather than _visibleModules so that even\n // legendonly traces can include settings - eg barmode, which affects\n // legend.traceorder default value.\n var modules = layoutOut._modules;\n for(i = 0; i < modules.length; i++) {\n _module = modules[i];\n\n if(_module.supplyLayoutDefaults) {\n _module.supplyLayoutDefaults(layoutIn, layoutOut, fullData);\n }\n }\n\n // transform module layout defaults\n var transformModules = layoutOut._transformModules;\n for(i = 0; i < transformModules.length; i++) {\n _module = transformModules[i];\n\n if(_module.supplyLayoutDefaults) {\n _module.supplyLayoutDefaults(layoutIn, layoutOut, fullData, transitionData);\n }\n }\n\n for(component in componentsRegistry) {\n _module = componentsRegistry[component];\n\n if(_module.supplyLayoutDefaults) {\n _module.supplyLayoutDefaults(layoutIn, layoutOut, fullData);\n }\n }\n};\n\n// Remove all plotly attributes from a div so it can be replotted fresh\n// TODO: these really need to be encapsulated into a much smaller set...\nplots.purge = function(gd) {\n // note: we DO NOT remove _context because it doesn't change when we insert\n // a new plot, and may have been set outside of our scope.\n\n var fullLayout = gd._fullLayout || {};\n if(fullLayout._glcontainer !== undefined) {\n fullLayout._glcontainer.selectAll('.gl-canvas').remove();\n fullLayout._glcontainer.remove();\n fullLayout._glcanvas = null;\n }\n\n // remove modebar\n if(fullLayout._modeBar) fullLayout._modeBar.destroy();\n\n if(gd._transitionData) {\n // Ensure any dangling callbacks are simply dropped if the plot is purged.\n // This is more or less only actually important for testing.\n if(gd._transitionData._interruptCallbacks) {\n gd._transitionData._interruptCallbacks.length = 0;\n }\n\n if(gd._transitionData._animationRaf) {\n window.cancelAnimationFrame(gd._transitionData._animationRaf);\n }\n }\n\n // remove any planned throttles\n Lib.clearThrottle();\n\n // remove responsive handler\n Lib.clearResponsive(gd);\n\n // data and layout\n delete gd.data;\n delete gd.layout;\n delete gd._fullData;\n delete gd._fullLayout;\n delete gd.calcdata;\n delete gd.empty;\n\n delete gd.fid;\n\n delete gd.undoqueue; // action queue\n delete gd.undonum;\n delete gd.autoplay; // are we doing an action that doesn't go in undo queue?\n delete gd.changed;\n\n // these get recreated on _doPlot anyway, but just to be safe\n // (and to have a record of them...)\n delete gd._promises;\n delete gd._redrawTimer;\n delete gd._hmlumcount;\n delete gd._hmpixcount;\n delete gd._transitionData;\n delete gd._transitioning;\n delete gd._initialAutoSize;\n delete gd._transitioningWithDuration;\n\n // created during certain events, that *should* clean them up\n // themselves, but may not if there was an error\n delete gd._dragging;\n delete gd._dragged;\n delete gd._dragdata;\n delete gd._hoverdata;\n delete gd._snapshotInProgress;\n delete gd._editing;\n delete gd._mouseDownTime;\n delete gd._legendMouseDownTime;\n\n // remove all event listeners\n if(gd.removeAllListeners) gd.removeAllListeners();\n};\n\nplots.style = function(gd) {\n var _modules = gd._fullLayout._visibleModules;\n var styleModules = [];\n var i;\n\n // some trace modules reuse the same style method,\n // make sure to not unnecessary call them multiple times.\n\n for(i = 0; i < _modules.length; i++) {\n var _module = _modules[i];\n if(_module.style) {\n Lib.pushUnique(styleModules, _module.style);\n }\n }\n\n for(i = 0; i < styleModules.length; i++) {\n styleModules[i](gd);\n }\n};\n\nplots.sanitizeMargins = function(fullLayout) {\n // polar doesn't do margins...\n if(!fullLayout || !fullLayout.margin) return;\n\n var width = fullLayout.width;\n var height = fullLayout.height;\n var margin = fullLayout.margin;\n var plotWidth = width - (margin.l + margin.r);\n var plotHeight = height - (margin.t + margin.b);\n var correction;\n\n // if margin.l + margin.r = 0 then plotWidth > 0\n // as width >= 10 by supplyDefaults\n // similarly for margin.t + margin.b\n\n if(plotWidth < 0) {\n correction = (width - 1) / (margin.l + margin.r);\n margin.l = Math.floor(correction * margin.l);\n margin.r = Math.floor(correction * margin.r);\n }\n\n if(plotHeight < 0) {\n correction = (height - 1) / (margin.t + margin.b);\n margin.t = Math.floor(correction * margin.t);\n margin.b = Math.floor(correction * margin.b);\n }\n};\n\nplots.clearAutoMarginIds = function(gd) {\n gd._fullLayout._pushmarginIds = {};\n};\n\nplots.allowAutoMargin = function(gd, id) {\n gd._fullLayout._pushmarginIds[id] = 1;\n};\n\nfunction initMargins(fullLayout) {\n var margin = fullLayout.margin;\n\n if(!fullLayout._size) {\n var gs = fullLayout._size = {\n l: Math.round(margin.l),\n r: Math.round(margin.r),\n t: Math.round(margin.t),\n b: Math.round(margin.b),\n p: Math.round(margin.pad)\n };\n gs.w = Math.round(fullLayout.width) - gs.l - gs.r;\n gs.h = Math.round(fullLayout.height) - gs.t - gs.b;\n }\n if(!fullLayout._pushmargin) fullLayout._pushmargin = {};\n if(!fullLayout._pushmarginIds) fullLayout._pushmarginIds = {};\n if(!fullLayout._reservedMargin) fullLayout._reservedMargin = {};\n}\n\n// non-negotiable - this is the smallest height we will allow users to specify via explicit margins\nvar MIN_SPECIFIED_WIDTH = 2;\nvar MIN_SPECIFIED_HEIGHT = 2;\n\n/**\n * autoMargin: called by components that may need to expand the margins to\n * be rendered on-plot.\n *\n * @param {DOM element} gd\n * @param {string} id - an identifier unique (within this plot) to this object,\n * so we can remove a previous margin expansion from the same object.\n * @param {object} o - the margin requirements of this object, or omit to delete\n * this entry (like if it's hidden). Keys are:\n * x, y: plot fraction of the anchor point.\n * xl, xr, yt, yb: if the object has an extent defined in plot fraction,\n * you can specify both edges as plot fractions in each dimension\n * l, r, t, b: the pixels to pad past the plot fraction x[l|r] and y[t|b]\n * pad: extra pixels to add in all directions, default 12 (why?)\n */\nplots.autoMargin = function(gd, id, o) {\n var fullLayout = gd._fullLayout;\n var width = fullLayout.width;\n var height = fullLayout.height;\n var margin = fullLayout.margin;\n var minreducedwidth = fullLayout.minreducedwidth;\n var minreducedheight = fullLayout.minreducedheight;\n\n var minFinalWidth = Lib.constrain(\n width - margin.l - margin.r,\n MIN_SPECIFIED_WIDTH,\n minreducedwidth\n );\n\n var minFinalHeight = Lib.constrain(\n height - margin.t - margin.b,\n MIN_SPECIFIED_HEIGHT,\n minreducedheight\n );\n\n var maxSpaceW = Math.max(0, width - minFinalWidth);\n var maxSpaceH = Math.max(0, height - minFinalHeight);\n\n var pushMargin = fullLayout._pushmargin;\n var pushMarginIds = fullLayout._pushmarginIds;\n\n if(margin.autoexpand !== false) {\n if(!o) {\n delete pushMargin[id];\n delete pushMarginIds[id];\n } else {\n var pad = o.pad;\n if(pad === undefined) {\n // if no explicit pad is given, use 12px unless there's a\n // specified margin that's smaller than that\n pad = Math.min(12, margin.l, margin.r, margin.t, margin.b);\n }\n\n // if the item is too big, just give it enough automargin to\n // make sure you can still grab it and bring it back\n if(maxSpaceW) {\n var rW = (o.l + o.r) / maxSpaceW;\n if(rW > 1) {\n o.l /= rW;\n o.r /= rW;\n }\n }\n if(maxSpaceH) {\n var rH = (o.t + o.b) / maxSpaceH;\n if(rH > 1) {\n o.t /= rH;\n o.b /= rH;\n }\n }\n\n var xl = o.xl !== undefined ? o.xl : o.x;\n var xr = o.xr !== undefined ? o.xr : o.x;\n var yt = o.yt !== undefined ? o.yt : o.y;\n var yb = o.yb !== undefined ? o.yb : o.y;\n\n pushMargin[id] = {\n l: {val: xl, size: o.l + pad},\n r: {val: xr, size: o.r + pad},\n b: {val: yb, size: o.b + pad},\n t: {val: yt, size: o.t + pad}\n };\n pushMarginIds[id] = 1;\n }\n\n if(!fullLayout._replotting) {\n return plots.doAutoMargin(gd);\n }\n }\n};\n\nfunction needsRedrawForShift(gd) {\n if('_redrawFromAutoMarginCount' in gd._fullLayout) {\n return false;\n }\n var axList = axisIDs.list(gd, '', true);\n for(var ax in axList) {\n if(axList[ax].autoshift || axList[ax].shift) return true;\n }\n return false;\n}\n\nplots.doAutoMargin = function(gd) {\n var fullLayout = gd._fullLayout;\n var width = fullLayout.width;\n var height = fullLayout.height;\n\n if(!fullLayout._size) fullLayout._size = {};\n initMargins(fullLayout);\n\n var gs = fullLayout._size;\n var margin = fullLayout.margin;\n var reservedMargins = {t: 0, b: 0, l: 0, r: 0};\n var oldMargins = Lib.extendFlat({}, gs);\n\n // adjust margins for outside components\n // fullLayout.margin is the requested margin,\n // fullLayout._size has margins and plotsize after adjustment\n var ml = margin.l;\n var mr = margin.r;\n var mt = margin.t;\n var mb = margin.b;\n var pushMargin = fullLayout._pushmargin;\n var pushMarginIds = fullLayout._pushmarginIds;\n var minreducedwidth = fullLayout.minreducedwidth;\n var minreducedheight = fullLayout.minreducedheight;\n\n if(margin.autoexpand !== false) {\n for(var k in pushMargin) {\n if(!pushMarginIds[k]) delete pushMargin[k];\n }\n\n var margins = gd._fullLayout._reservedMargin;\n for(var key in margins) {\n for(var side in margins[key]) {\n var val = margins[key][side];\n reservedMargins[side] = Math.max(reservedMargins[side], val);\n }\n }\n // fill in the requested margins\n pushMargin.base = {\n l: {val: 0, size: ml},\n r: {val: 1, size: mr},\n t: {val: 1, size: mt},\n b: {val: 0, size: mb}\n };\n\n\n // make sure that the reservedMargin is the minimum needed\n for(var s in reservedMargins) {\n var autoMarginPush = 0;\n for(var m in pushMargin) {\n if(m !== 'base') {\n if(isNumeric(pushMargin[m][s].size)) {\n autoMarginPush = pushMargin[m][s].size > autoMarginPush ? pushMargin[m][s].size : autoMarginPush;\n }\n }\n }\n var extraMargin = Math.max(0, (margin[s] - autoMarginPush));\n reservedMargins[s] = Math.max(0, reservedMargins[s] - extraMargin);\n }\n\n // now cycle through all the combinations of l and r\n // (and t and b) to find the required margins\n for(var k1 in pushMargin) {\n var pushleft = pushMargin[k1].l || {};\n var pushbottom = pushMargin[k1].b || {};\n var fl = pushleft.val;\n var pl = pushleft.size;\n var fb = pushbottom.val;\n var pb = pushbottom.size;\n var availableWidth = width - reservedMargins.r - reservedMargins.l;\n var availableHeight = height - reservedMargins.t - reservedMargins.b;\n\n for(var k2 in pushMargin) {\n if(isNumeric(pl) && pushMargin[k2].r) {\n var fr = pushMargin[k2].r.val;\n var pr = pushMargin[k2].r.size;\n if(fr > fl) {\n var newL = (pl * fr + (pr - availableWidth) * fl) / (fr - fl);\n var newR = (pr * (1 - fl) + (pl - availableWidth) * (1 - fr)) / (fr - fl);\n if(newL + newR > ml + mr) {\n ml = newL;\n mr = newR;\n }\n }\n }\n\n if(isNumeric(pb) && pushMargin[k2].t) {\n var ft = pushMargin[k2].t.val;\n var pt = pushMargin[k2].t.size;\n if(ft > fb) {\n var newB = (pb * ft + (pt - availableHeight) * fb) / (ft - fb);\n var newT = (pt * (1 - fb) + (pb - availableHeight) * (1 - ft)) / (ft - fb);\n if(newB + newT > mb + mt) {\n mb = newB;\n mt = newT;\n }\n }\n }\n }\n }\n }\n\n var minFinalWidth = Lib.constrain(\n width - margin.l - margin.r,\n MIN_SPECIFIED_WIDTH,\n minreducedwidth\n );\n\n var minFinalHeight = Lib.constrain(\n height - margin.t - margin.b,\n MIN_SPECIFIED_HEIGHT,\n minreducedheight\n );\n\n var maxSpaceW = Math.max(0, width - minFinalWidth);\n var maxSpaceH = Math.max(0, height - minFinalHeight);\n\n if(maxSpaceW) {\n var rW = (ml + mr) / maxSpaceW;\n if(rW > 1) {\n ml /= rW;\n mr /= rW;\n }\n }\n\n if(maxSpaceH) {\n var rH = (mb + mt) / maxSpaceH;\n if(rH > 1) {\n mb /= rH;\n mt /= rH;\n }\n }\n\n\n gs.l = Math.round(ml) + reservedMargins.l;\n gs.r = Math.round(mr) + reservedMargins.r;\n gs.t = Math.round(mt) + reservedMargins.t;\n gs.b = Math.round(mb) + reservedMargins.b;\n gs.p = Math.round(margin.pad);\n gs.w = Math.round(width) - gs.l - gs.r;\n gs.h = Math.round(height) - gs.t - gs.b;\n\n // if things changed and we're not already redrawing, trigger a redraw\n if(!fullLayout._replotting && (plots.didMarginChange(oldMargins, gs) || needsRedrawForShift(gd))) {\n if('_redrawFromAutoMarginCount' in fullLayout) {\n fullLayout._redrawFromAutoMarginCount++;\n } else {\n fullLayout._redrawFromAutoMarginCount = 1;\n }\n\n // Always allow at least one redraw and give each margin-push\n // call 3 loops to converge. Of course, for most cases this way too many,\n // but let's keep things on the safe side until we fix our\n // auto-margin pipeline problems:\n // https://github.com/plotly/plotly.js/issues/2704\n var maxNumberOfRedraws = 3 * (1 + Object.keys(pushMarginIds).length);\n\n if(fullLayout._redrawFromAutoMarginCount < maxNumberOfRedraws) {\n return Registry.call('_doPlot', gd);\n } else {\n fullLayout._size = oldMargins;\n Lib.warn('Too many auto-margin redraws.');\n }\n }\n\n refineTicks(gd);\n};\n\nfunction refineTicks(gd) {\n var axList = axisIDs.list(gd, '', true);\n\n [\n '_adjustTickLabelsOverflow',\n '_hideCounterAxisInsideTickLabels'\n ].forEach(function(k) {\n for(var i = 0; i < axList.length; i++) {\n var hideFn = axList[i][k];\n if(hideFn) hideFn();\n }\n });\n}\n\nvar marginKeys = ['l', 'r', 't', 'b', 'p', 'w', 'h'];\n\nplots.didMarginChange = function(margin0, margin1) {\n for(var i = 0; i < marginKeys.length; i++) {\n var k = marginKeys[i];\n var m0 = margin0[k];\n var m1 = margin1[k];\n // use 1px tolerance in case we old/new differ only\n // by rounding errors, which can lead to infinite loops\n if(!isNumeric(m0) || Math.abs(m1 - m0) > 1) {\n return true;\n }\n }\n return false;\n};\n\n/**\n * JSONify the graph data and layout\n *\n * This function needs to recurse because some src can be inside\n * sub-objects.\n *\n * It also strips out functions and private (starts with _) elements.\n * Therefore, we can add temporary things to data and layout that don't\n * get saved.\n *\n * @param gd The graphDiv\n * @param {Boolean} dataonly If true, don't return layout.\n * @param {'keepref'|'keepdata'|'keepall'} [mode='keepref'] Filter what's kept\n * keepref: remove data for which there's a src present\n * eg if there's xsrc present (and xsrc is well-formed,\n * ie has : and some chars before it), strip out x\n * keepdata: remove all src tags, don't remove the data itself\n * keepall: keep data and src\n * @param {String} output If you specify 'object', the result will not be stringified\n * @param {Boolean} useDefaults If truthy, use _fullLayout and _fullData\n * @param {Boolean} includeConfig If truthy, include _context\n * @returns {Object|String}\n */\nplots.graphJson = function(gd, dataonly, mode, output, useDefaults, includeConfig) {\n // if the defaults aren't supplied yet, we need to do that...\n if((useDefaults && dataonly && !gd._fullData) ||\n (useDefaults && !dataonly && !gd._fullLayout)) {\n plots.supplyDefaults(gd);\n }\n\n var data = (useDefaults) ? gd._fullData : gd.data;\n var layout = (useDefaults) ? gd._fullLayout : gd.layout;\n var frames = (gd._transitionData || {})._frames;\n\n function stripObj(d, keepFunction) {\n if(typeof d === 'function') {\n return keepFunction ? '_function_' : null;\n }\n if(Lib.isPlainObject(d)) {\n var o = {};\n var src;\n Object.keys(d).sort().forEach(function(v) {\n // remove private elements and functions\n // _ is for private, [ is a mistake ie [object Object]\n if(['_', '['].indexOf(v.charAt(0)) !== -1) return;\n\n // if a function, add if necessary then move on\n if(typeof d[v] === 'function') {\n if(keepFunction) o[v] = '_function';\n return;\n }\n\n // look for src/data matches and remove the appropriate one\n if(mode === 'keepdata') {\n // keepdata: remove all ...src tags\n if(v.substr(v.length - 3) === 'src') {\n return;\n }\n } else if(mode === 'keepstream') {\n // keep sourced data if it's being streamed.\n // similar to keepref, but if the 'stream' object exists\n // in a trace, we will keep the data array.\n src = d[v + 'src'];\n if(typeof src === 'string' && src.indexOf(':') > 0) {\n if(!Lib.isPlainObject(d.stream)) {\n return;\n }\n }\n } else if(mode !== 'keepall') {\n // keepref: remove sourced data but only\n // if the source tag is well-formed\n src = d[v + 'src'];\n if(typeof src === 'string' && src.indexOf(':') > 0) {\n return;\n }\n }\n\n // OK, we're including this... recurse into it\n o[v] = stripObj(d[v], keepFunction);\n });\n return o;\n }\n\n var dIsArray = Array.isArray(d);\n var dIsTypedArray = Lib.isTypedArray(d);\n\n if((dIsArray || dIsTypedArray) && d.dtype && d.shape) {\n var bdata = d.bdata;\n return stripObj({\n dtype: d.dtype,\n shape: d.shape,\n\n bdata:\n // case of ArrayBuffer\n Lib.isArrayBuffer(bdata) ? b64encode.encode(bdata) :\n // case of b64 string\n bdata\n\n }, keepFunction);\n }\n\n if(dIsArray) {\n return d.map(function(x) {return stripObj(x, keepFunction);});\n }\n\n if(dIsTypedArray) {\n return Lib.simpleMap(d, Lib.identity);\n }\n\n // convert native dates to date strings...\n // mostly for external users exporting to plotly\n if(Lib.isJSDate(d)) return Lib.ms2DateTimeLocal(+d);\n\n return d;\n }\n\n var obj = {\n data: (data || []).map(function(v) {\n var d = stripObj(v);\n // fit has some little arrays in it that don't contain data,\n // just fit params and meta\n if(dataonly) { delete d.fit; }\n return d;\n })\n };\n if(!dataonly) {\n obj.layout = stripObj(layout);\n if(useDefaults) {\n var gs = layout._size;\n obj.layout.computed = {\n margin: {\n b: gs.b,\n l: gs.l,\n r: gs.r,\n t: gs.t\n }\n };\n }\n }\n\n if(frames) obj.frames = stripObj(frames);\n\n if(includeConfig) obj.config = stripObj(gd._context, true);\n\n return (output === 'object') ? obj : JSON.stringify(obj);\n};\n\n/**\n * Modify a keyframe using a list of operations:\n *\n * @param {array of objects} operations\n * Sequence of operations to be performed on the keyframes\n */\nplots.modifyFrames = function(gd, operations) {\n var i, op, frame;\n var _frames = gd._transitionData._frames;\n var _frameHash = gd._transitionData._frameHash;\n\n for(i = 0; i < operations.length; i++) {\n op = operations[i];\n\n switch(op.type) {\n // No reason this couldn't exist, but is currently unused/untested:\n /* case 'rename':\n frame = _frames[op.index];\n delete _frameHash[frame.name];\n _frameHash[op.name] = frame;\n frame.name = op.name;\n break;*/\n case 'replace':\n frame = op.value;\n var oldName = (_frames[op.index] || {}).name;\n var newName = frame.name;\n _frames[op.index] = _frameHash[newName] = frame;\n\n if(newName !== oldName) {\n // If name has changed in addition to replacement, then update\n // the lookup table:\n delete _frameHash[oldName];\n _frameHash[newName] = frame;\n }\n\n break;\n case 'insert':\n frame = op.value;\n _frameHash[frame.name] = frame;\n _frames.splice(op.index, 0, frame);\n break;\n case 'delete':\n frame = _frames[op.index];\n delete _frameHash[frame.name];\n _frames.splice(op.index, 1);\n break;\n }\n }\n\n return Promise.resolve();\n};\n\n/*\n * Compute a keyframe. Merge a keyframe into its base frame(s) and\n * expand properties.\n *\n * @param {object} frameLookup\n * An object containing frames keyed by name (i.e. gd._transitionData._frameHash)\n * @param {string} frame\n * The name of the keyframe to be computed\n *\n * Returns: a new object with the merged content\n */\nplots.computeFrame = function(gd, frameName) {\n var frameLookup = gd._transitionData._frameHash;\n var i, traceIndices, traceIndex, destIndex;\n\n // Null or undefined will fail on .toString(). We'll allow numbers since we\n // make it clear frames must be given string names, but we'll allow numbers\n // here since they're otherwise fine for looking up frames as long as they're\n // properly cast to strings. We really just want to ensure here that this\n // 1) doesn't fail, and\n // 2) doens't give an incorrect answer (which String(frameName) would)\n if(!frameName) {\n throw new Error('computeFrame must be given a string frame name');\n }\n\n var framePtr = frameLookup[frameName.toString()];\n\n // Return false if the name is invalid:\n if(!framePtr) {\n return false;\n }\n\n var frameStack = [framePtr];\n var frameNameStack = [framePtr.name];\n\n // Follow frame pointers:\n while(framePtr.baseframe && (framePtr = frameLookup[framePtr.baseframe.toString()])) {\n // Avoid infinite loops:\n if(frameNameStack.indexOf(framePtr.name) !== -1) break;\n\n frameStack.push(framePtr);\n frameNameStack.push(framePtr.name);\n }\n\n // A new object for the merged result:\n var result = {};\n\n // Merge, starting with the last and ending with the desired frame:\n while((framePtr = frameStack.pop())) {\n if(framePtr.layout) {\n result.layout = plots.extendLayout(result.layout, framePtr.layout);\n }\n\n if(framePtr.data) {\n if(!result.data) {\n result.data = [];\n }\n traceIndices = framePtr.traces;\n\n if(!traceIndices) {\n // If not defined, assume serial order starting at zero\n traceIndices = [];\n for(i = 0; i < framePtr.data.length; i++) {\n traceIndices[i] = i;\n }\n }\n\n if(!result.traces) {\n result.traces = [];\n }\n\n for(i = 0; i < framePtr.data.length; i++) {\n // Loop through this frames data, find out where it should go,\n // and merge it!\n traceIndex = traceIndices[i];\n if(traceIndex === undefined || traceIndex === null) {\n continue;\n }\n\n destIndex = result.traces.indexOf(traceIndex);\n if(destIndex === -1) {\n destIndex = result.data.length;\n result.traces[destIndex] = traceIndex;\n }\n\n result.data[destIndex] = plots.extendTrace(result.data[destIndex], framePtr.data[i]);\n }\n }\n }\n\n return result;\n};\n\n/*\n * Recompute the lookup table that maps frame name -> frame object. addFrames/\n * deleteFrames already manages this data one at a time, so the only time this\n * is necessary is if you poke around manually in `gd._transitionData._frames`\n * and create and haven't updated the lookup table.\n */\nplots.recomputeFrameHash = function(gd) {\n var hash = gd._transitionData._frameHash = {};\n var frames = gd._transitionData._frames;\n for(var i = 0; i < frames.length; i++) {\n var frame = frames[i];\n if(frame && frame.name) {\n hash[frame.name] = frame;\n }\n }\n};\n\n/**\n * Extend an object, treating container arrays very differently by extracting\n * their contents and merging them separately.\n *\n * This exists so that we can extendDeepNoArrays and avoid stepping into data\n * arrays without knowledge of the plot schema, but so that we may also manually\n * recurse into known container arrays, such as transforms.\n *\n * See extendTrace and extendLayout below for usage.\n */\nplots.extendObjectWithContainers = function(dest, src, containerPaths) {\n var containerProp, containerVal, i, j, srcProp, destProp, srcContainer, destContainer;\n var copy = Lib.extendDeepNoArrays({}, src || {});\n var expandedObj = Lib.expandObjectPaths(copy);\n var containerObj = {};\n\n // Step through and extract any container properties. Otherwise extendDeepNoArrays\n // will clobber any existing properties with an empty array and then supplyDefaults\n // will reset everything to defaults.\n if(containerPaths && containerPaths.length) {\n for(i = 0; i < containerPaths.length; i++) {\n containerProp = Lib.nestedProperty(expandedObj, containerPaths[i]);\n containerVal = containerProp.get();\n\n if(containerVal === undefined) {\n Lib.nestedProperty(containerObj, containerPaths[i]).set(null);\n } else {\n containerProp.set(null);\n Lib.nestedProperty(containerObj, containerPaths[i]).set(containerVal);\n }\n }\n }\n\n dest = Lib.extendDeepNoArrays(dest || {}, expandedObj);\n\n if(containerPaths && containerPaths.length) {\n for(i = 0; i < containerPaths.length; i++) {\n srcProp = Lib.nestedProperty(containerObj, containerPaths[i]);\n srcContainer = srcProp.get();\n\n if(!srcContainer) continue;\n\n destProp = Lib.nestedProperty(dest, containerPaths[i]);\n destContainer = destProp.get();\n\n if(!Array.isArray(destContainer)) {\n destContainer = [];\n destProp.set(destContainer);\n }\n\n for(j = 0; j < srcContainer.length; j++) {\n var srcObj = srcContainer[j];\n\n if(srcObj === null) destContainer[j] = null;\n else {\n destContainer[j] = plots.extendObjectWithContainers(destContainer[j], srcObj);\n }\n }\n\n destProp.set(destContainer);\n }\n }\n\n return dest;\n};\n\nplots.dataArrayContainers = ['transforms', 'dimensions'];\nplots.layoutArrayContainers = Registry.layoutArrayContainers;\n\n/*\n * Extend a trace definition. This method:\n *\n * 1. directly transfers any array references\n * 2. manually recurses into container arrays like transforms\n *\n * The result is the original object reference with the new contents merged in.\n */\nplots.extendTrace = function(destTrace, srcTrace) {\n return plots.extendObjectWithContainers(destTrace, srcTrace, plots.dataArrayContainers);\n};\n\n/*\n * Extend a layout definition. This method:\n *\n * 1. directly transfers any array references (not critically important for\n * layout since there aren't really data arrays)\n * 2. manually recurses into container arrays like annotations\n *\n * The result is the original object reference with the new contents merged in.\n */\nplots.extendLayout = function(destLayout, srcLayout) {\n return plots.extendObjectWithContainers(destLayout, srcLayout, plots.layoutArrayContainers);\n};\n\n/**\n * Transition to a set of new data and layout properties from Plotly.animate\n *\n * @param {DOM element} gd\n * @param {Object[]} data\n * an array of data objects following the normal Plotly data definition format\n * @param {Object} layout\n * a layout object, following normal Plotly layout format\n * @param {Number[]} traces\n * indices of the corresponding traces specified in `data`\n * @param {Object} frameOpts\n * options for the frame (i.e. whether to redraw post-transition)\n * @param {Object} transitionOpts\n * options for the transition\n */\nplots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) {\n var opts = {redraw: frameOpts.redraw};\n var transitionedTraces = {};\n var axEdits = [];\n\n opts.prepareFn = function() {\n var dataLength = Array.isArray(data) ? data.length : 0;\n var traceIndices = traces.slice(0, dataLength);\n\n for(var i = 0; i < traceIndices.length; i++) {\n var traceIdx = traceIndices[i];\n var trace = gd._fullData[traceIdx];\n var _module = trace._module;\n\n // There's nothing to do if this module is not defined:\n if(!_module) continue;\n\n // Don't register the trace as transitioned if it doesn't know what to do.\n // If it *is* registered, it will receive a callback that it's responsible\n // for calling in order to register the transition as having completed.\n if(_module.animatable) {\n var n = _module.basePlotModule.name;\n if(!transitionedTraces[n]) transitionedTraces[n] = [];\n transitionedTraces[n].push(traceIdx);\n }\n\n gd.data[traceIndices[i]] = plots.extendTrace(gd.data[traceIndices[i]], data[i]);\n }\n\n // Follow the same procedure. Clone it so we don't mangle the input, then\n // expand any object paths so we can merge deep into gd.layout:\n var layoutUpdate = Lib.expandObjectPaths(Lib.extendDeepNoArrays({}, layout));\n\n // Before merging though, we need to modify the incoming layout. We only\n // know how to *transition* layout ranges, so it's imperative that a new\n // range not be sent to the layout before the transition has started. So\n // we must remove the things we can transition:\n var axisAttrRe = /^[xy]axis[0-9]*$/;\n for(var attr in layoutUpdate) {\n if(!axisAttrRe.test(attr)) continue;\n delete layoutUpdate[attr].range;\n }\n\n plots.extendLayout(gd.layout, layoutUpdate);\n\n // Supply defaults after applying the incoming properties. Note that any attempt\n // to simplify this step and reduce the amount of work resulted in the reconstruction\n // of essentially the whole supplyDefaults step, so that it seems sensible to just use\n // supplyDefaults even though it's heavier than would otherwise be desired for\n // transitions:\n\n // first delete calcdata so supplyDefaults knows a calc step is coming\n delete gd.calcdata;\n\n plots.supplyDefaults(gd);\n plots.doCalcdata(gd);\n\n var newLayout = Lib.expandObjectPaths(layout);\n\n if(newLayout) {\n var subplots = gd._fullLayout._plots;\n\n for(var k in subplots) {\n var plotinfo = subplots[k];\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n var xr0 = xa.range.slice();\n var yr0 = ya.range.slice();\n\n var xr1 = null;\n var yr1 = null;\n var editX = null;\n var editY = null;\n\n if(Array.isArray(newLayout[xa._name + '.range'])) {\n xr1 = newLayout[xa._name + '.range'].slice();\n } else if(Array.isArray((newLayout[xa._name] || {}).range)) {\n xr1 = newLayout[xa._name].range.slice();\n }\n if(Array.isArray(newLayout[ya._name + '.range'])) {\n yr1 = newLayout[ya._name + '.range'].slice();\n } else if(Array.isArray((newLayout[ya._name] || {}).range)) {\n yr1 = newLayout[ya._name].range.slice();\n }\n\n if(xr0 && xr1 &&\n (xa.r2l(xr0[0]) !== xa.r2l(xr1[0]) || xa.r2l(xr0[1]) !== xa.r2l(xr1[1]))\n ) {\n editX = {xr0: xr0, xr1: xr1};\n }\n if(yr0 && yr1 &&\n (ya.r2l(yr0[0]) !== ya.r2l(yr1[0]) || ya.r2l(yr0[1]) !== ya.r2l(yr1[1]))\n ) {\n editY = {yr0: yr0, yr1: yr1};\n }\n\n if(editX || editY) {\n axEdits.push(Lib.extendFlat({plotinfo: plotinfo}, editX, editY));\n }\n }\n }\n\n return Promise.resolve();\n };\n\n opts.runFn = function(makeCallback) {\n var traceTransitionOpts;\n var basePlotModules = gd._fullLayout._basePlotModules;\n var hasAxisTransition = axEdits.length;\n var i;\n\n if(layout) {\n for(i = 0; i < basePlotModules.length; i++) {\n if(basePlotModules[i].transitionAxes) {\n basePlotModules[i].transitionAxes(gd, axEdits, transitionOpts, makeCallback);\n }\n }\n }\n\n // Here handle the exception that we refuse to animate scales and axes at the same\n // time. In other words, if there's an axis transition, then set the data transition\n // to instantaneous.\n if(hasAxisTransition) {\n traceTransitionOpts = Lib.extendFlat({}, transitionOpts);\n traceTransitionOpts.duration = 0;\n // This means do not transition cartesian traces,\n // this happens on layout-only (e.g. axis range) animations\n delete transitionedTraces.cartesian;\n } else {\n traceTransitionOpts = transitionOpts;\n }\n\n // Note that we pass a callback to *create* the callback that must be invoked on completion.\n // This is since not all traces know about transitions, so it greatly simplifies matters if\n // the trace is responsible for creating a callback, if needed, and then executing it when\n // the time is right.\n for(var n in transitionedTraces) {\n var traceIndices = transitionedTraces[n];\n var _module = gd._fullData[traceIndices[0]]._module;\n _module.basePlotModule.plot(gd, traceIndices, traceTransitionOpts, makeCallback);\n }\n };\n\n return _transition(gd, transitionOpts, opts);\n};\n\n/**\n * Transition to a set of new data and layout properties from Plotly.react\n *\n * @param {DOM element} gd\n * @param {object} restyleFlags\n * - anim {'all'|'some'}\n * @param {object} relayoutFlags\n * - anim {'all'|'some'}\n * @param {object} oldFullLayout : old (pre Plotly.react) fullLayout\n */\nplots.transitionFromReact = function(gd, restyleFlags, relayoutFlags, oldFullLayout) {\n var fullLayout = gd._fullLayout;\n var transitionOpts = fullLayout.transition;\n var opts = {};\n var axEdits = [];\n\n opts.prepareFn = function() {\n var subplots = fullLayout._plots;\n\n // no need to redraw at end of transition,\n // if all changes are animatable\n opts.redraw = false;\n if(restyleFlags.anim === 'some') opts.redraw = true;\n if(relayoutFlags.anim === 'some') opts.redraw = true;\n\n for(var k in subplots) {\n var plotinfo = subplots[k];\n var xa = plotinfo.xaxis;\n var ya = plotinfo.yaxis;\n var xr0 = oldFullLayout[xa._name].range.slice();\n var yr0 = oldFullLayout[ya._name].range.slice();\n var xr1 = xa.range.slice();\n var yr1 = ya.range.slice();\n\n xa.setScale();\n ya.setScale();\n\n var editX = null;\n var editY = null;\n\n if(xa.r2l(xr0[0]) !== xa.r2l(xr1[0]) || xa.r2l(xr0[1]) !== xa.r2l(xr1[1])) {\n editX = {xr0: xr0, xr1: xr1};\n }\n if(ya.r2l(yr0[0]) !== ya.r2l(yr1[0]) || ya.r2l(yr0[1]) !== ya.r2l(yr1[1])) {\n editY = {yr0: yr0, yr1: yr1};\n }\n\n if(editX || editY) {\n axEdits.push(Lib.extendFlat({plotinfo: plotinfo}, editX, editY));\n }\n }\n\n return Promise.resolve();\n };\n\n opts.runFn = function(makeCallback) {\n var fullData = gd._fullData;\n var fullLayout = gd._fullLayout;\n var basePlotModules = fullLayout._basePlotModules;\n\n var axisTransitionOpts;\n var traceTransitionOpts;\n var transitionedTraces;\n\n var allTraceIndices = [];\n for(var i = 0; i < fullData.length; i++) {\n allTraceIndices.push(i);\n }\n\n function transitionAxes() {\n if(!gd._fullLayout) return;\n for(var j = 0; j < basePlotModules.length; j++) {\n if(basePlotModules[j].transitionAxes) {\n basePlotModules[j].transitionAxes(gd, axEdits, axisTransitionOpts, makeCallback);\n }\n }\n }\n\n function transitionTraces() {\n if(!gd._fullLayout) return;\n for(var j = 0; j < basePlotModules.length; j++) {\n basePlotModules[j].plot(gd, transitionedTraces, traceTransitionOpts, makeCallback);\n }\n }\n\n if(axEdits.length && restyleFlags.anim) {\n if(transitionOpts.ordering === 'traces first') {\n axisTransitionOpts = Lib.extendFlat({}, transitionOpts, {duration: 0});\n transitionedTraces = allTraceIndices;\n traceTransitionOpts = transitionOpts;\n setTimeout(transitionAxes, transitionOpts.duration);\n transitionTraces();\n } else {\n axisTransitionOpts = transitionOpts;\n transitionedTraces = null;\n traceTransitionOpts = Lib.extendFlat({}, transitionOpts, {duration: 0});\n setTimeout(transitionTraces, axisTransitionOpts.duration);\n transitionAxes();\n }\n } else if(axEdits.length) {\n axisTransitionOpts = transitionOpts;\n transitionAxes();\n } else if(restyleFlags.anim) {\n transitionedTraces = allTraceIndices;\n traceTransitionOpts = transitionOpts;\n transitionTraces();\n }\n };\n\n return _transition(gd, transitionOpts, opts);\n};\n\n/**\n * trace/layout transition wrapper that works\n * for transitions initiated by Plotly.animate and Plotly.react.\n *\n * @param {DOM element} gd\n * @param {object} transitionOpts\n * @param {object} opts\n * - redraw {boolean}\n * - prepareFn {function} *should return a Promise*\n * - runFn {function} ran inside executeTransitions\n */\nfunction _transition(gd, transitionOpts, opts) {\n var aborted = false;\n\n function executeCallbacks(list) {\n var p = Promise.resolve();\n if(!list) return p;\n while(list.length) {\n p = p.then((list.shift()));\n }\n return p;\n }\n\n function flushCallbacks(list) {\n if(!list) return;\n while(list.length) {\n list.shift();\n }\n }\n\n function executeTransitions() {\n gd.emit('plotly_transitioning', []);\n\n return new Promise(function(resolve) {\n // This flag is used to disabled things like autorange:\n gd._transitioning = true;\n\n // When instantaneous updates are coming through quickly, it's too much to simply disable\n // all interaction, so store this flag so we can disambiguate whether mouse interactions\n // should be fully disabled or not:\n if(transitionOpts.duration > 0) {\n gd._transitioningWithDuration = true;\n }\n\n // If another transition is triggered, this callback will be executed simply because it's\n // in the interruptCallbacks queue. If this transition completes, it will instead flush\n // that queue and forget about this callback.\n gd._transitionData._interruptCallbacks.push(function() {\n aborted = true;\n });\n\n if(opts.redraw) {\n gd._transitionData._interruptCallbacks.push(function() {\n return Registry.call('redraw', gd);\n });\n }\n\n // Emit this and make sure it happens last:\n gd._transitionData._interruptCallbacks.push(function() {\n gd.emit('plotly_transitioninterrupted', []);\n });\n\n // Construct callbacks that are executed on transition end. This ensures the d3 transitions\n // are *complete* before anything else is done.\n var numCallbacks = 0;\n var numCompleted = 0;\n function makeCallback() {\n numCallbacks++;\n return function() {\n numCompleted++;\n // When all are complete, perform a redraw:\n if(!aborted && numCompleted === numCallbacks) {\n completeTransition(resolve);\n }\n };\n }\n\n opts.runFn(makeCallback);\n\n // If nothing else creates a callback, then this will trigger the completion in the next tick:\n setTimeout(makeCallback());\n });\n }\n\n function completeTransition(callback) {\n // This a simple workaround for tests which purge the graph before animations\n // have completed. That's not a very common case, so this is the simplest\n // fix.\n if(!gd._transitionData) return;\n\n flushCallbacks(gd._transitionData._interruptCallbacks);\n\n return Promise.resolve().then(function() {\n if(opts.redraw) {\n return Registry.call('redraw', gd);\n }\n }).then(function() {\n // Set transitioning false again once the redraw has occurred. This is used, for example,\n // to prevent the trailing redraw from autoranging:\n gd._transitioning = false;\n gd._transitioningWithDuration = false;\n\n gd.emit('plotly_transitioned', []);\n }).then(callback);\n }\n\n function interruptPreviousTransitions() {\n // Fail-safe against purged plot:\n if(!gd._transitionData) return;\n\n // If a transition is interrupted, set this to false. At the moment, the only thing that would\n // interrupt a transition is another transition, so that it will momentarily be set to true\n // again, but this determines whether autorange or dragbox work, so it's for the sake of\n // cleanliness:\n gd._transitioning = false;\n\n return executeCallbacks(gd._transitionData._interruptCallbacks);\n }\n\n var seq = [\n plots.previousPromises,\n interruptPreviousTransitions,\n opts.prepareFn,\n plots.rehover,\n plots.reselect,\n executeTransitions\n ];\n\n var transitionStarting = Lib.syncOrAsync(seq, gd);\n\n if(!transitionStarting || !transitionStarting.then) {\n transitionStarting = Promise.resolve();\n }\n\n return transitionStarting.then(function() { return gd; });\n}\n\nplots.doCalcdata = function(gd, traces) {\n var axList = axisIDs.list(gd);\n var fullData = gd._fullData;\n var fullLayout = gd._fullLayout;\n\n var trace, _module, i, j;\n\n // XXX: Is this correct? Needs a closer look so that *some* traces can be recomputed without\n // *all* needing doCalcdata:\n var calcdata = new Array(fullData.length);\n var oldCalcdata = (gd.calcdata || []).slice();\n gd.calcdata = calcdata;\n\n // extra helper variables\n\n // how many box/violins plots do we have (in case they're grouped)\n fullLayout._numBoxes = 0;\n fullLayout._numViolins = 0;\n\n // initialize violin per-scale-group stats container\n fullLayout._violinScaleGroupStats = {};\n\n // for calculating avg luminosity of heatmaps\n gd._hmpixcount = 0;\n gd._hmlumcount = 0;\n\n // for sharing colors across pies / sunbursts / treemap / icicle / funnelarea (and for legend)\n fullLayout._piecolormap = {};\n fullLayout._sunburstcolormap = {};\n fullLayout._treemapcolormap = {};\n fullLayout._iciclecolormap = {};\n fullLayout._funnelareacolormap = {};\n\n // If traces were specified and this trace was not included,\n // then transfer it over from the old calcdata:\n for(i = 0; i < fullData.length; i++) {\n if(Array.isArray(traces) && traces.indexOf(i) === -1) {\n calcdata[i] = oldCalcdata[i];\n continue;\n }\n }\n\n for(i = 0; i < fullData.length; i++) {\n trace = fullData[i];\n\n trace._arrayAttrs = PlotSchema.findArrayAttributes(trace);\n\n // keep track of trace extremes (for autorange) in here\n trace._extremes = {};\n }\n\n // add polar axes to axis list\n var polarIds = fullLayout._subplots.polar || [];\n for(i = 0; i < polarIds.length; i++) {\n axList.push(\n fullLayout[polarIds[i]].radialaxis,\n fullLayout[polarIds[i]].angularaxis\n );\n }\n\n // clear relinked cmin/cmax values in shared axes to start aggregation from scratch\n for(var k in fullLayout._colorAxes) {\n var cOpts = fullLayout[k];\n if(cOpts.cauto !== false) {\n delete cOpts.cmin;\n delete cOpts.cmax;\n }\n }\n\n var hasCalcTransform = false;\n\n function transformCalci(i) {\n trace = fullData[i];\n _module = trace._module;\n\n if(trace.visible === true && trace.transforms) {\n // we need one round of trace module calc before\n // the calc transform to 'fill in' the categories list\n // used for example in the data-to-coordinate method\n if(_module && _module.calc) {\n var cdi = _module.calc(gd, trace);\n\n // must clear scene 'batches', so that 2nd\n // _module.calc call starts from scratch\n if(cdi[0] && cdi[0].t && cdi[0].t._scene) {\n delete cdi[0].t._scene.dirty;\n }\n }\n\n for(j = 0; j < trace.transforms.length; j++) {\n var transform = trace.transforms[j];\n\n _module = transformsRegistry[transform.type];\n if(_module && _module.calcTransform) {\n trace._hasCalcTransform = true;\n hasCalcTransform = true;\n _module.calcTransform(gd, trace, transform);\n }\n }\n }\n }\n\n function calci(i, isContainer) {\n trace = fullData[i];\n _module = trace._module;\n\n if(!!_module.isContainer !== isContainer) return;\n\n var cd = [];\n\n if(trace.visible === true && trace._length !== 0) {\n // clear existing ref in case it got relinked\n delete trace._indexToPoints;\n // keep ref of index-to-points map object of the *last* enabled transform,\n // this index-to-points map object is required to determine the calcdata indices\n // that correspond to input indices (e.g. from 'selectedpoints')\n var transforms = trace.transforms || [];\n for(j = transforms.length - 1; j >= 0; j--) {\n if(transforms[j].enabled) {\n trace._indexToPoints = transforms[j]._indexToPoints;\n break;\n }\n }\n\n if(_module && _module.calc) {\n cd = _module.calc(gd, trace);\n }\n }\n\n // Make sure there is a first point.\n //\n // This ensures there is a calcdata item for every trace,\n // even if cartesian logic doesn't handle it (for things like legends).\n if(!Array.isArray(cd) || !cd[0]) {\n cd = [{x: BADNUM, y: BADNUM}];\n }\n\n // add the trace-wide properties to the first point,\n // per point properties to every point\n // t is the holder for trace-wide properties\n if(!cd[0].t) cd[0].t = {};\n cd[0].trace = trace;\n\n calcdata[i] = cd;\n }\n\n setupAxisCategories(axList, fullData, fullLayout);\n\n // 'transform' loop - must calc container traces first\n // so that if their dependent traces can get transform properly\n for(i = 0; i < fullData.length; i++) calci(i, true);\n for(i = 0; i < fullData.length; i++) transformCalci(i);\n\n // clear stuff that should recomputed in 'regular' loop\n if(hasCalcTransform) setupAxisCategories(axList, fullData, fullLayout);\n\n // 'regular' loop - make sure container traces (eg carpet) calc before\n // contained traces (eg contourcarpet)\n for(i = 0; i < fullData.length; i++) calci(i, true);\n for(i = 0; i < fullData.length; i++) calci(i, false);\n\n doCrossTraceCalc(gd);\n\n // Sort axis categories per value if specified\n var sorted = sortAxisCategoriesByValue(axList, gd);\n if(sorted.length) {\n // how many box/violins plots do we have (in case they're grouped)\n fullLayout._numBoxes = 0;\n fullLayout._numViolins = 0;\n // If a sort operation was performed, run calc() again\n for(i = 0; i < sorted.length; i++) calci(sorted[i], true);\n for(i = 0; i < sorted.length; i++) calci(sorted[i], false);\n doCrossTraceCalc(gd);\n }\n\n Registry.getComponentMethod('fx', 'calc')(gd);\n Registry.getComponentMethod('errorbars', 'calc')(gd);\n};\n\nvar sortAxisCategoriesByValueRegex = /(total|sum|min|max|mean|median) (ascending|descending)/;\n\nfunction sortAxisCategoriesByValue(axList, gd) {\n var affectedTraces = [];\n var i, j, k, l, o;\n\n function zMapCategory(type, ax, value) {\n var axLetter = ax._id.charAt(0);\n if(type === 'histogram2dcontour') {\n var counterAxLetter = ax._counterAxes[0];\n var counterAx = axisIDs.getFromId(gd, counterAxLetter);\n\n var xCategorical = axLetter === 'x' || (counterAxLetter === 'x' && counterAx.type === 'category');\n var yCategorical = axLetter === 'y' || (counterAxLetter === 'y' && counterAx.type === 'category');\n\n return function(o, l) {\n if(o === 0 || l === 0) return -1; // Skip first row and column\n if(xCategorical && o === value[l].length - 1) return -1;\n if(yCategorical && l === value.length - 1) return -1;\n\n return (axLetter === 'y' ? l : o) - 1;\n };\n } else {\n return function(o, l) {\n return axLetter === 'y' ? l : o;\n };\n }\n }\n\n var aggFn = {\n min: function(values) {return Lib.aggNums(Math.min, null, values);},\n max: function(values) {return Lib.aggNums(Math.max, null, values);},\n sum: function(values) {return Lib.aggNums(function(a, b) { return a + b;}, null, values);},\n total: function(values) {return Lib.aggNums(function(a, b) { return a + b;}, null, values);},\n mean: function(values) {return Lib.mean(values);},\n median: function(values) {return Lib.median(values);}\n };\n\n function sortAscending(a, b) {\n return a[1] - b[1];\n }\n\n function sortDescending(a, b) {\n return b[1] - a[1];\n }\n\n for(i = 0; i < axList.length; i++) {\n var ax = axList[i];\n if(ax.type !== 'category') continue;\n\n // Order by value\n var match = ax.categoryorder.match(sortAxisCategoriesByValueRegex);\n if(match) {\n var aggregator = match[1];\n var order = match[2];\n\n var axLetter = ax._id.charAt(0);\n var isX = axLetter === 'x';\n\n // Store values associated with each category\n var categoriesValue = [];\n for(j = 0; j < ax._categories.length; j++) {\n categoriesValue.push([ax._categories[j], []]);\n }\n\n // Collect values across traces\n for(j = 0; j < ax._traceIndices.length; j++) {\n var traceIndex = ax._traceIndices[j];\n var fullTrace = gd._fullData[traceIndex];\n\n // Skip over invisible traces\n if(fullTrace.visible !== true) continue;\n\n var type = fullTrace.type;\n if(Registry.traceIs(fullTrace, 'histogram')) {\n delete fullTrace._xautoBinFinished;\n delete fullTrace._yautoBinFinished;\n }\n var isSplom = type === 'splom';\n var isScattergl = type === 'scattergl';\n\n var cd = gd.calcdata[traceIndex];\n for(k = 0; k < cd.length; k++) {\n var cdi = cd[k];\n var catIndex, value;\n\n if(isSplom) {\n // If `splom`, collect values across dimensions\n // Find which dimension the current axis is representing\n var currentDimensionIndex = fullTrace._axesDim[ax._id];\n\n // Apply logic to associated x axis if it's defined\n if(!isX) {\n var associatedXAxisID = fullTrace._diag[currentDimensionIndex][0];\n if(associatedXAxisID) ax = gd._fullLayout[axisIDs.id2name(associatedXAxisID)];\n }\n\n var categories = cdi.trace.dimensions[currentDimensionIndex].values;\n for(l = 0; l < categories.length; l++) {\n catIndex = ax._categoriesMap[categories[l]];\n\n // Collect associated values at index `l` over all other dimensions\n for(o = 0; o < cdi.trace.dimensions.length; o++) {\n if(o === currentDimensionIndex) continue;\n var dimension = cdi.trace.dimensions[o];\n categoriesValue[catIndex][1].push(dimension.values[l]);\n }\n }\n } else if(isScattergl) {\n // If `scattergl`, collect all values stashed under cdi.t\n for(l = 0; l < cdi.t.x.length; l++) {\n if(isX) {\n catIndex = cdi.t.x[l];\n value = cdi.t.y[l];\n } else {\n catIndex = cdi.t.y[l];\n value = cdi.t.x[l];\n }\n categoriesValue[catIndex][1].push(value);\n }\n // must clear scene 'batches', so that 2nd\n // _module.calc call starts from scratch\n if(cdi.t && cdi.t._scene) {\n delete cdi.t._scene.dirty;\n }\n } else if(cdi.hasOwnProperty('z')) {\n // If 2dMap, collect values in `z`\n value = cdi.z;\n var mapping = zMapCategory(fullTrace.type, ax, value);\n\n for(l = 0; l < value.length; l++) {\n for(o = 0; o < value[l].length; o++) {\n catIndex = mapping(o, l);\n if(catIndex + 1) categoriesValue[catIndex][1].push(value[l][o]);\n }\n }\n } else {\n // For all other 2d cartesian traces\n catIndex = cdi.p;\n if(catIndex === undefined) catIndex = cdi[axLetter];\n\n value = cdi.s;\n if(value === undefined) value = cdi.v;\n if(value === undefined) value = isX ? cdi.y : cdi.x;\n\n if(!Array.isArray(value)) {\n if(value === undefined) value = [];\n else value = [value];\n }\n for(l = 0; l < value.length; l++) {\n categoriesValue[catIndex][1].push(value[l]);\n }\n }\n }\n }\n\n ax._categoriesValue = categoriesValue;\n\n var categoriesAggregatedValue = [];\n for(j = 0; j < categoriesValue.length; j++) {\n categoriesAggregatedValue.push([\n categoriesValue[j][0],\n aggFn[aggregator](categoriesValue[j][1])\n ]);\n }\n\n // Sort by aggregated value\n categoriesAggregatedValue.sort(order === 'descending' ? sortDescending : sortAscending);\n\n ax._categoriesAggregatedValue = categoriesAggregatedValue;\n\n // Set new category order\n ax._initialCategories = categoriesAggregatedValue.map(function(c) {\n return c[0];\n });\n\n // Sort all matching axes\n affectedTraces = affectedTraces.concat(ax.sortByInitialCategories());\n }\n }\n return affectedTraces;\n}\n\nfunction setupAxisCategories(axList, fullData, fullLayout) {\n var axLookup = {};\n\n function setupOne(ax) {\n ax.clearCalc();\n if(ax.type === 'multicategory') {\n ax.setupMultiCategory(fullData);\n }\n\n axLookup[ax._id] = 1;\n }\n\n Lib.simpleMap(axList, setupOne);\n\n // look into match groups for 'missing' axes\n var matchGroups = fullLayout._axisMatchGroups || [];\n for(var i = 0; i < matchGroups.length; i++) {\n for(var axId in matchGroups[i]) {\n if(!axLookup[axId]) {\n setupOne(fullLayout[axisIDs.id2name(axId)]);\n }\n }\n }\n}\n\nfunction doCrossTraceCalc(gd) {\n var fullLayout = gd._fullLayout;\n var modules = fullLayout._visibleModules;\n var hash = {};\n var i, j, k;\n\n // position and range calculations for traces that\n // depend on each other ie bars (stacked or grouped)\n // and boxes (grouped) push each other out of the way\n\n for(j = 0; j < modules.length; j++) {\n var _module = modules[j];\n var fn = _module.crossTraceCalc;\n if(fn) {\n var spType = _module.basePlotModule.name;\n if(hash[spType]) {\n Lib.pushUnique(hash[spType], fn);\n } else {\n hash[spType] = [fn];\n }\n }\n }\n\n for(k in hash) {\n var methods = hash[k];\n var subplots = fullLayout._subplots[k];\n\n if(Array.isArray(subplots)) {\n for(i = 0; i < subplots.length; i++) {\n var sp = subplots[i];\n var spInfo = k === 'cartesian' ?\n fullLayout._plots[sp] :\n fullLayout[sp];\n\n for(j = 0; j < methods.length; j++) {\n methods[j](gd, spInfo, sp);\n }\n }\n } else {\n for(j = 0; j < methods.length; j++) {\n methods[j](gd);\n }\n }\n }\n}\n\nplots.rehover = function(gd) {\n if(gd._fullLayout._rehover) {\n gd._fullLayout._rehover();\n }\n};\n\nplots.redrag = function(gd) {\n if(gd._fullLayout._redrag) {\n gd._fullLayout._redrag();\n }\n};\n\nplots.reselect = function(gd) {\n var fullLayout = gd._fullLayout;\n\n var A = (gd.layout || {}).selections;\n var B = fullLayout._previousSelections;\n fullLayout._previousSelections = A;\n\n var mayEmitSelected = fullLayout._reselect ||\n JSON.stringify(A) !== JSON.stringify(B);\n\n Registry.getComponentMethod('selections', 'reselect')(gd, mayEmitSelected);\n};\n\nplots.generalUpdatePerTraceModule = function(gd, subplot, subplotCalcData, subplotLayout) {\n var traceHashOld = subplot.traceHash;\n var traceHash = {};\n var i;\n\n // build up moduleName -> calcData hash\n for(i = 0; i < subplotCalcData.length; i++) {\n var calcTraces = subplotCalcData[i];\n var trace = calcTraces[0].trace;\n\n // skip over visible === false traces\n // as they don't have `_module` ref\n if(trace.visible) {\n traceHash[trace.type] = traceHash[trace.type] || [];\n traceHash[trace.type].push(calcTraces);\n }\n }\n\n // when a trace gets deleted, make sure that its module's\n // plot method is called so that it is properly\n // removed from the DOM.\n for(var moduleNameOld in traceHashOld) {\n if(!traceHash[moduleNameOld]) {\n var fakeCalcTrace = traceHashOld[moduleNameOld][0];\n var fakeTrace = fakeCalcTrace[0].trace;\n\n fakeTrace.visible = false;\n traceHash[moduleNameOld] = [fakeCalcTrace];\n }\n }\n\n // call module plot method\n for(var moduleName in traceHash) {\n var moduleCalcData = traceHash[moduleName];\n var _module = moduleCalcData[0][0].trace._module;\n\n _module.plot(gd, subplot, Lib.filterVisible(moduleCalcData), subplotLayout);\n }\n\n // update moduleName -> calcData hash\n subplot.traceHash = traceHash;\n};\n\nplots.plotBasePlot = function(desiredType, gd, traces, transitionOpts, makeOnCompleteCallback) {\n var _module = Registry.getModule(desiredType);\n var cdmodule = getModuleCalcData(gd.calcdata, _module)[0];\n _module.plot(gd, cdmodule, transitionOpts, makeOnCompleteCallback);\n};\n\nplots.cleanBasePlot = function(desiredType, newFullData, newFullLayout, oldFullData, oldFullLayout) {\n var had = (oldFullLayout._has && oldFullLayout._has(desiredType));\n var has = (newFullLayout._has && newFullLayout._has(desiredType));\n\n if(had && !has) {\n oldFullLayout['_' + desiredType + 'layer'].selectAll('g.trace').remove();\n }\n};\n","'use strict';\n\nvar docs = require('../constants/docs');\nvar FORMAT_LINK = docs.FORMAT_LINK;\nvar DATE_FORMAT_LINK = docs.DATE_FORMAT_LINK;\n\nfunction templateFormatStringDescription(opts) {\n var supportOther = opts && opts.supportOther;\n\n return [\n 'Variables are inserted using %{variable},',\n 'for example \"y: %{y}\"' + (\n supportOther ?\n ' as well as %{xother}, {%_xother}, {%_xother_}, {%xother_}. When showing info for several points, *xother* will be added to those with different x positions from the first point. An underscore before or after *(x|y)other* will add a space on that side, only when this field is shown.' :\n '.'\n ),\n 'Numbers are formatted using d3-format\\'s syntax %{variable:d3-format}, for example \"Price: %{y:$.2f}\".',\n FORMAT_LINK,\n 'for details on the formatting syntax.',\n 'Dates are formatted using d3-time-format\\'s syntax %{variable|d3-time-format}, for example \"Day: %{2019-01-01|%A}\".',\n DATE_FORMAT_LINK,\n 'for details on the date formatting syntax.'\n ].join(' ');\n}\n\nfunction shapeTemplateFormatStringDescription() {\n return [\n 'Variables are inserted using %{variable},',\n 'for example \"x0: %{x0}\".',\n 'Numbers are formatted using d3-format\\'s syntax %{variable:d3-format}, for example \"Price: %{x0:$.2f}\". See',\n FORMAT_LINK,\n 'for details on the formatting syntax.',\n 'Dates are formatted using d3-time-format\\'s syntax %{variable|d3-time-format}, for example \"Day: %{x0|%m %b %Y}\". See',\n DATE_FORMAT_LINK,\n 'for details on the date formatting syntax.',\n 'A single multiplication or division operation may be applied to numeric variables, and combined with',\n 'd3 number formatting, for example \"Length in cm: %{x0*2.54}\", \"%{slope*60:.1f} meters per second.\"',\n 'For log axes, variable values are given in log units.',\n 'For date axes, x/y coordinate variables and center variables use datetimes, while all other variable values use values in ms.',\n ].join(' ');\n}\n\nfunction describeVariables(extra) {\n var descPart = extra.description ? ' ' + extra.description : '';\n var keys = extra.keys || [];\n if(keys.length > 0) {\n var quotedKeys = [];\n for(var i = 0; i < keys.length; i++) {\n quotedKeys[i] = '`' + keys[i] + '`';\n }\n descPart = descPart + 'Finally, the template string has access to ';\n if(keys.length === 1) {\n descPart = descPart + 'variable ' + quotedKeys[0];\n } else {\n descPart = descPart + 'variables ' + quotedKeys.slice(0, -1).join(', ') + ' and ' + quotedKeys.slice(-1) + '.';\n }\n }\n return descPart;\n}\n\nexports.hovertemplateAttrs = function(opts, extra) {\n opts = opts || {};\n extra = extra || {};\n\n var descPart = describeVariables(extra);\n\n var hovertemplate = {\n valType: 'string',\n dflt: '',\n editType: opts.editType || 'none',\n description: [\n 'Template string used for rendering the information that appear on hover box.',\n 'Note that this will override `hoverinfo`.',\n templateFormatStringDescription({supportOther: true}),\n 'The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data.',\n 'Additionally, every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available.',\n descPart,\n 'Anything contained in tag `` is displayed in the secondary box, for example \"{fullData.name}\".',\n 'To hide the secondary box completely, use an empty tag ``.'\n ].join(' ')\n };\n\n if(opts.arrayOk !== false) {\n hovertemplate.arrayOk = true;\n }\n\n return hovertemplate;\n};\n\nexports.texttemplateAttrs = function(opts, extra) {\n opts = opts || {};\n extra = extra || {};\n\n var descPart = describeVariables(extra);\n\n var texttemplate = {\n valType: 'string',\n dflt: '',\n editType: opts.editType || 'calc',\n description: [\n 'Template string used for rendering the information text that appear on points.',\n 'Note that this will override `textinfo`.',\n templateFormatStringDescription(),\n 'Every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available.',\n descPart\n ].join(' ')\n };\n\n if(opts.arrayOk !== false) {\n texttemplate.arrayOk = true;\n }\n return texttemplate;\n};\n\n\nexports.shapeTexttemplateAttrs = function(opts, extra) {\n opts = opts || {};\n extra = extra || {};\n\n var newStr = opts.newshape ? 'new ' : '';\n\n var descPart = describeVariables(extra);\n\n var texttemplate = {\n valType: 'string',\n dflt: '',\n editType: opts.editType || 'arraydraw',\n description: [\n 'Template string used for rendering the ' + newStr + 'shape\\'s label.',\n 'Note that this will override `text`.',\n shapeTemplateFormatStringDescription(),\n descPart,\n ].join(' ')\n };\n return texttemplate;\n};\n"],"names":["Registry","require","SUBPLOT_PATTERN","exports","calcdata","arg1","plotMethod","moduleCalcData","remainingCalcData","getModule","plot","i","length","cd","trace","visible","_length","_module","push","xformMatrix","m","v","j","out","module","camera","projection","view","model","fontAttrs","animationAttrs","colorAttrs","drawNewShapeAttrs","drawNewSelectionAttrs","padAttrs","extendFlat","globalFont","editType","description","join","family","dflt","size","color","defaultLine","font","title","text","valType","xref","values","yref","x","min","max","y","xanchor","yanchor","pad","automargin","uniformtext","mode","minsize","autosize","width","height","minreducedwidth","minreducedheight","margin","l","r","t","b","autoexpand","computed","paper_bgcolor","background","plot_bgcolor","autotypenumbers","separators","hidesources","showlegend","colorway","defaults","datarevision","uirevision","editrevision","selectionrevision","template","newshape","activeshape","newselection","activeselection","meta","arrayOk","transition","_deprecated","titlefont","opts","d3","timeFormatLocale","formatLocale","isNumeric","b64encode","PlotSchema","Template","Lib","Color","BADNUM","axisIDs","clearOutline","scatterAttrs","frameAttrs","getModuleCalcData","relinkPrivateKeys","_","plots","attributes","type","allTypes","layoutAttributes","fontWeight","transformsRegistry","commandModule","executeAPICommand","computeAPICommandBindings","manageCommandObserver","hasSimpleAPICommandBindings","redrawText","gd","getGraphDiv","Promise","resolve","setTimeout","_fullLayout","getComponentMethod","previousPromises","resize","resolveLastResize","p","reject","isHidden","Error","_redrawTimer","clearTimeout","_resolveResize","layout","oldchanged","changed","autoplay","call","then","_promises","all","addLinks","_context","showLink","showSources","fullLayout","linkContainer","ensureSingle","_paper","s","style","fill","each","links","select","this","append","classed","node","attrs","attr","document","body","contains","getComputedTextLength","toolspan","spacespan","sourcespan","container","link","class","linkText","String","fromCharCode","sendData","on","sendDataToCloud","path","window","location","pathname","split","query","search","positionPlayWithData","baseUrl","PLOTLYENV","BASE_URL","plotlyServerURL","emit","hiddenformDiv","hiddenform","action","method","target","name","value","graphJson","submit","remove","d3FormatKeys","extraFormatKeys","getFormatObj","formatKeys","locale","formatDone","formatObj","includeFormat","newFormat","formatFinished","formatKey","locales","formatj","format","localeRegistry","baseLocale","en","findMainSubplot","ax","mockGd","isX","_id","charAt","anchorAx","_mainAxis","_anchorAxis","mainSubplotID","nextBestMainSubplotID","anchorID","_plots","counterIDs","_counterAxes","counterPart","id","counterAx","getFromId","overlaying","hasMakesDataTransform","transforms","Array","isArray","ti","makesData","applyTransforms","fullTrace","fullData","dataOut","transform","transformIndex","getComputedSize","substr","parseFloat","initMargins","_size","gs","Math","round","w","h","_pushmargin","_pushmarginIds","_reservedMargin","supplyDefaults","skipUpdateCalc","oldFullLayout","_skipDefaults","newFullLayout","newLayout","oldFullData","_fullData","newFullData","newData","data","oldCalcdata","context","_transitionData","createTransitionData","_dfltTitle","colorbar","annotation","_traceWord","_mapboxAccessToken","mapboxAccessToken","_initialAutoSizeIsDone","oldWidth","oldHeight","supplyLayoutGlobalDefaults","sanitizeMargins","missingWidthOrHeight","autosizable","plotAutoSize","_d3locale","decimal","thousands","numberFormat","formatStr","adjustFormat","e","warnBadFormat","noFormat","timeFormat","utcFormat","getFormatter","_extraFormat","_dataLength","_modules","_visibleModules","_basePlotModules","subplots","_subplots","collectableSubplotTypes","subplotsRegistry","subplotType","subplotAttr","pushUnique","emptySubplotLists","splomAxes","_splomAxes","splomSubplots","_splomSubplots","_splomGridDflt","_scatterStackOpts","_firstScatter","_alignmentOpts","_colorAxes","_requestRangeslider","_traceUids","prevFullInput","len","oldFullInput","thisFullInput","_fullInput","oldLen","seenUids","setUid","uid","tryUid","newUid","randstr","getTraceUids","_globalTransforms","globalTransforms","supplyDataDefaults","splomXa","Object","keys","splomYa","xaxis","yaxis","k","cartesian","_has","_hasPlotType","bind","supplyLayoutModuleDefaults","crossTraceDefaultsFuncs","funci","crossTraceDefaults","_hasOnlyLargeSploms","shapes","images","linkSubplots","cleanPlot","hadGL2D","hasGL2D","hadBgLayer","hasBgLayer","_bgLayer","_shouldCreateBgLayer","_zoomlayer","_dragging","_meta","meta4data","index","fillMetaTextHelpers","_preGUI","_tracePreGUI","tracePreGUI","uids","supplyDefaultsUpdateCalc","newTrace","cd0","oldTrace","_hasCalcTransform","astr","oldArrayVal","arrayAttrs","_arrayAttrs","nestedProperty","get","slice","set","_frames","_frameHash","_counter","_interruptCallbacks","category","basePlotModules","modules","categories","clean","hadGl","hasGl","undefined","_glcontainer","selectAll","_glcanvas","hasInfoLayer","_infolayer","oldLoop","oldUid","oldSubplots","newSubplots","newSubplotList","ids","concat","gl2d","plotinfo","oldSubplot","_subplotsWith","_hasClipOnAxisFalse","cliponaxis","axList","list","mainAx","domain","anchor","sort","idSort","subplotSort","_mainSubplot","spikemode","indexOf","mirror","ax2","_counterDomainMin","_counterDomainMax","clearExpandedTraceDefaultColors","_colorAttrs","crawl","attrName","level","dataIn","visibleModules","cnt","colorCnt","pushModule","basePlotModule","_input","_transformModules","carpetIndex","carpetDependents","dataTemplate","templater","traceTemplater","supplyTraceDefaults","_expandedIndex","sdInvisible","expandedTraces","expandedTrace","fullExpandedTrace","_template","_expandedInput","traceIs","carpet","carpetAxis","_carpet","supplyAnimationDefaults","optsOut","coerce","frame","supplyAnimationFrameDefaults","supplyAnimationTransitionDefaults","supplyFrameDefaults","frameIn","frameOut","traceIn","traceOut","colorIndex","traceInIndex","defaultColor","subplotAttrs","subplotId","attri","vali","_dfltShowLegend","hovertemplate","coerceHoverinfo","selectPoints","selectedpoints","isTypedArray","from","supplyTransformDefaults","transformModules","containerIn","transformList","containerOut","transformOut","transformIn","isFirstStage","doLaterStages","warn","layoutIn","layoutOut","isPlainObject","_dataTemplate","coerceFont","fontSize","titleYref","titleAutomargin","newWidth","newHeight","frameMargins","isPlotDiv","fillFrame","innerWidth","innerHeight","overflow","computedStyle","getComputedStyle","maxWidth","maxHeight","factor","minWidth","minHeight","widthHasChanged","abs","heightHasChanged","_initialAutoSize","transitionData","component","componentsRegistry","Cartesian","includeBasePlot","finalizeSubplots","supplyLayoutDefaults","purge","_modeBar","destroy","_animationRaf","cancelAnimationFrame","clearThrottle","clearResponsive","empty","fid","undoqueue","undonum","_hmlumcount","_hmpixcount","_transitioning","_transitioningWithDuration","_dragged","_dragdata","_hoverdata","_snapshotInProgress","_editing","_mouseDownTime","_legendMouseDownTime","removeAllListeners","styleModules","correction","plotWidth","plotHeight","floor","clearAutoMarginIds","allowAutoMargin","autoMargin","o","minFinalWidth","constrain","minFinalHeight","maxSpaceW","maxSpaceH","pushMargin","pushMarginIds","rW","rH","xl","xr","yt","yb","val","_replotting","doAutoMargin","reservedMargins","oldMargins","ml","mr","mt","mb","margins","key","side","base","autoMarginPush","extraMargin","k1","pushleft","pushbottom","fl","pl","fb","pb","availableWidth","availableHeight","k2","fr","pr","newL","newR","ft","pt","newB","newT","didMarginChange","autoshift","shift","needsRedrawForShift","_redrawFromAutoMarginCount","maxNumberOfRedraws","forEach","hideFn","refineTicks","marginKeys","_transition","transitionOpts","aborted","seq","executeCallbacks","prepareFn","rehover","reselect","duration","redraw","numCallbacks","numCompleted","makeCallback","callback","flushCallbacks","completeTransition","runFn","transitionStarting","syncOrAsync","margin0","margin1","m0","m1","dataonly","output","useDefaults","includeConfig","frames","stripObj","d","keepFunction","src","stream","dIsArray","dIsTypedArray","dtype","shape","bdata","isArrayBuffer","encode","map","simpleMap","identity","isJSDate","ms2DateTimeLocal","obj","fit","config","JSON","stringify","modifyFrames","operations","op","oldName","newName","splice","computeFrame","frameName","traceIndices","traceIndex","destIndex","frameLookup","framePtr","toString","frameStack","frameNameStack","baseframe","result","pop","extendLayout","traces","extendTrace","recomputeFrameHash","hash","extendObjectWithContainers","dest","containerPaths","containerProp","containerVal","destProp","srcContainer","destContainer","copy","extendDeepNoArrays","expandedObj","expandObjectPaths","containerObj","srcObj","dataArrayContainers","layoutArrayContainers","destTrace","srcTrace","destLayout","srcLayout","frameOpts","transitionedTraces","axEdits","dataLength","traceIdx","animatable","n","layoutUpdate","axisAttrRe","test","range","doCalcdata","xa","ya","xr0","yr0","xr1","yr1","editX","editY","_name","r2l","traceTransitionOpts","hasAxisTransition","transitionAxes","transitionFromReact","restyleFlags","relayoutFlags","anim","setScale","axisTransitionOpts","allTraceIndices","transitionTraces","ordering","_numBoxes","_numViolins","_violinScaleGroupStats","_piecolormap","_sunburstcolormap","_treemapcolormap","_iciclecolormap","_funnelareacolormap","findArrayAttributes","_extremes","polarIds","polar","radialaxis","angularaxis","cOpts","cauto","cmin","cmax","hasCalcTransform","transformCalci","calc","cdi","_scene","dirty","calcTransform","calci","isContainer","_indexToPoints","enabled","setupAxisCategories","doCrossTraceCalc","sorted","affectedTraces","zMapCategory","axLetter","counterAxLetter","xCategorical","yCategorical","aggFn","aggNums","sum","a","total","mean","median","sortAscending","sortDescending","match","categoryorder","sortAxisCategoriesByValueRegex","aggregator","order","categoriesValue","_categories","_traceIndices","_xautoBinFinished","_yautoBinFinished","isSplom","isScattergl","catIndex","currentDimensionIndex","_axesDim","associatedXAxisID","_diag","id2name","dimensions","_categoriesMap","dimension","hasOwnProperty","z","mapping","_categoriesValue","categoriesAggregatedValue","_categoriesAggregatedValue","_initialCategories","c","sortByInitialCategories","sortAxisCategoriesByValue","axLookup","setupOne","clearCalc","setupMultiCategory","matchGroups","_axisMatchGroups","axId","fn","crossTraceCalc","spType","methods","sp","spInfo","_rehover","redrag","_redrag","A","selections","B","_previousSelections","mayEmitSelected","_reselect","generalUpdatePerTraceModule","subplot","subplotCalcData","subplotLayout","traceHashOld","traceHash","calcTraces","moduleNameOld","fakeCalcTrace","moduleName","filterVisible","plotBasePlot","desiredType","makeOnCompleteCallback","cdmodule","cleanBasePlot","had","has","docs","FORMAT_LINK","DATE_FORMAT_LINK","templateFormatStringDescription","supportOther","describeVariables","extra","descPart","quotedKeys","texttemplate","newStr"],"sourceRoot":""}