billboard.js 3.18.0-next.2 → 3.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +319 -100
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +10 -9
  5. package/dist/billboard.pkgd.js +2059 -1625
  6. package/dist/billboard.pkgd.min.js +23 -22
  7. package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  9. package/dist/plugin/billboardjs-plugin-sparkline.js +305 -79
  10. package/dist/plugin/billboardjs-plugin-sparkline.min.js +4 -4
  11. package/dist/plugin/billboardjs-plugin-stanford.js +305 -79
  12. package/dist/plugin/billboardjs-plugin-stanford.min.js +11 -11
  13. package/dist/plugin/billboardjs-plugin-tableview.js +305 -79
  14. package/dist/plugin/billboardjs-plugin-tableview.min.js +6 -5
  15. package/dist/plugin/billboardjs-plugin-textoverlap.js +305 -79
  16. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +4 -4
  17. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +1743 -1528
  18. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +8 -8
  19. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +2047 -1606
  20. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +10 -10
  21. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +2048 -1607
  22. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +17 -17
  23. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +2049 -1608
  24. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +13 -12
  25. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +2050 -1609
  26. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +10 -10
  27. package/dist/theme/dark.css +1 -1
  28. package/dist/theme/dark.min.css +1 -1
  29. package/dist/theme/datalab.css +1 -1
  30. package/dist/theme/datalab.min.css +1 -1
  31. package/dist/theme/graph.css +1 -1
  32. package/dist/theme/graph.min.css +1 -1
  33. package/dist/theme/insight.css +1 -1
  34. package/dist/theme/insight.min.css +1 -1
  35. package/dist/theme/modern.css +1 -1
  36. package/dist/theme/modern.min.css +1 -1
  37. package/dist-esm/billboard.js +441 -135
  38. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  39. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
  40. package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
  41. package/dist-esm/plugin/billboardjs-plugin-tableview.js +416 -102
  42. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  43. package/package.json +1 -1
  44. package/src/ChartInternal/ChartInternal.ts +1 -1
  45. package/src/ChartInternal/internals/tooltip.ts +11 -9
  46. package/src/config/Options/axis/y2.ts +0 -13
  47. package/src/config/Options/common/legend.ts +1 -0
  48. package/src/config/Options/common/point.ts +1 -1
  49. package/src/config/Options/common/tooltip.ts +3 -1
  50. package/src/module/sanitize.ts +471 -0
  51. package/src/module/util.ts +1 -131
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.18.0-next.2
8
+ * @version 3.18.0
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -345,6 +345,308 @@ const [
345
345
  ] = getFallback(win);
346
346
 
347
347
 
348
+ ;// ./src/module/sanitize.ts
349
+ const ALLOWED_TAGS = /* @__PURE__ */ new Set([
350
+ // HTML tags for tooltip/legend templates
351
+ "span",
352
+ "div",
353
+ "p",
354
+ "br",
355
+ "b",
356
+ "i",
357
+ "em",
358
+ "strong",
359
+ "u",
360
+ "s",
361
+ "sub",
362
+ "sup",
363
+ "ul",
364
+ "ol",
365
+ "li",
366
+ "dl",
367
+ "dt",
368
+ "dd",
369
+ "table",
370
+ "thead",
371
+ "tbody",
372
+ "tfoot",
373
+ "tr",
374
+ "th",
375
+ "td",
376
+ "caption",
377
+ "colgroup",
378
+ "col",
379
+ "hr",
380
+ "pre",
381
+ "code",
382
+ "blockquote",
383
+ "a",
384
+ "img",
385
+ // SVG tags for point patterns
386
+ "svg",
387
+ "g",
388
+ "path",
389
+ "circle",
390
+ "ellipse",
391
+ "rect",
392
+ "line",
393
+ "polyline",
394
+ "polygon",
395
+ "text",
396
+ "tspan",
397
+ "textPath",
398
+ "use",
399
+ "defs",
400
+ "symbol",
401
+ "clipPath",
402
+ "mask",
403
+ "linearGradient",
404
+ "radialGradient",
405
+ "stop",
406
+ "pattern",
407
+ "marker",
408
+ "title",
409
+ "desc"
410
+ ]);
411
+ const ALLOWED_ATTRS = /* @__PURE__ */ new Set([
412
+ // Common attributes
413
+ "class",
414
+ "id",
415
+ "style",
416
+ "title",
417
+ "lang",
418
+ "dir",
419
+ // HTML specific
420
+ "href",
421
+ "src",
422
+ "alt",
423
+ "width",
424
+ "height",
425
+ "colspan",
426
+ "rowspan",
427
+ "scope",
428
+ "headers",
429
+ // SVG presentation attributes
430
+ "d",
431
+ "points",
432
+ "x",
433
+ "y",
434
+ "x1",
435
+ "x2",
436
+ "y1",
437
+ "y2",
438
+ "cx",
439
+ "cy",
440
+ "r",
441
+ "rx",
442
+ "ry",
443
+ "dx",
444
+ "dy",
445
+ "viewBox",
446
+ "preserveAspectRatio",
447
+ "transform",
448
+ "fill",
449
+ "fill-opacity",
450
+ "fill-rule",
451
+ "stroke",
452
+ "stroke-width",
453
+ "stroke-opacity",
454
+ "stroke-linecap",
455
+ "stroke-linejoin",
456
+ "stroke-dasharray",
457
+ "stroke-dashoffset",
458
+ "opacity",
459
+ "clip-path",
460
+ "clip-rule",
461
+ "mask",
462
+ "font-family",
463
+ "font-size",
464
+ "font-weight",
465
+ "font-style",
466
+ "text-anchor",
467
+ "dominant-baseline",
468
+ "offset",
469
+ "stop-color",
470
+ "stop-opacity",
471
+ "gradientUnits",
472
+ "gradientTransform",
473
+ "spreadMethod",
474
+ "patternUnits",
475
+ "patternTransform",
476
+ "marker-start",
477
+ "marker-mid",
478
+ "marker-end",
479
+ "markerWidth",
480
+ "markerHeight",
481
+ "refX",
482
+ "refY",
483
+ "xlink:href"
484
+ ]);
485
+ const ALLOWED_URI_PROTOCOLS = /* @__PURE__ */ new Set([
486
+ "http:",
487
+ "https:",
488
+ "mailto:"
489
+ ]);
490
+ const URI_ATTRS = /* @__PURE__ */ new Set(["href", "src", "xlink:href"]);
491
+ const TAG_NAME_REGEX = /^<\/?([a-zA-Z][a-zA-Z0-9]*)/;
492
+ const CLOSING_TAG_REGEX = /^<\/([a-zA-Z][a-zA-Z0-9]*)\s*>$/;
493
+ const OPENING_TAG_REGEX = /^<([a-zA-Z][a-zA-Z0-9]*)([\s\S]*?)(\/?)>$/;
494
+ const ATTR_REGEX = /([a-zA-Z][\w:-]*)\s*(?:=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g;
495
+ const URL_IN_STYLE_REGEX = /url\s*\(\s*["']?([^"')]+)["']?\s*\)/gi;
496
+ const DANGEROUS_CSS_PATTERNS = [
497
+ "expression(",
498
+ "behavior:",
499
+ "binding:",
500
+ "@import",
501
+ "@charset",
502
+ "-moz-binding:"
503
+ ];
504
+ function decodeHTMLEntities(str) {
505
+ return str.replace(/&colon;/gi, ":").replace(/&newline;/gi, "\n").replace(/&tab;/gi, " ").replace(/&nbsp;/gi, " ").replace(/&lt;/gi, "<").replace(/&gt;/gi, ">").replace(/&amp;/gi, "&").replace(/&quot;/gi, '"').replace(/&apos;/gi, "'").replace(/&#(\d+);/gi, (_, code) => String.fromCharCode(parseInt(code, 10))).replace(/&#x([0-9a-f]+);/gi, (_, code) => String.fromCharCode(parseInt(code, 16)));
506
+ }
507
+ function isSafeURI(uri) {
508
+ const decoded = decodeHTMLEntities(uri).trim();
509
+ const normalized = decoded.replace(/[\s\u0000-\u001f]/g, "").toLowerCase();
510
+ if (!normalized || normalized.startsWith("#")) {
511
+ return true;
512
+ }
513
+ if (normalized.startsWith("/") || normalized.startsWith("./") || normalized.startsWith("../") || !normalized.includes(":")) {
514
+ return true;
515
+ }
516
+ const colonIndex = normalized.indexOf(":");
517
+ if (colonIndex > 0) {
518
+ const protocol = normalized.substring(0, colonIndex + 1);
519
+ return ALLOWED_URI_PROTOCOLS.has(protocol);
520
+ }
521
+ return false;
522
+ }
523
+ function sanitizeStyleValue(style) {
524
+ const decoded = decodeHTMLEntities(style);
525
+ const cleaned = decoded.replace(/[\u0000-\u001f]/g, "");
526
+ URL_IN_STYLE_REGEX.lastIndex = 0;
527
+ let match;
528
+ while ((match = URL_IN_STYLE_REGEX.exec(cleaned)) !== null) {
529
+ if (!isSafeURI(match[1])) {
530
+ return null;
531
+ }
532
+ }
533
+ const normalizedLower = cleaned.toLowerCase().replace(/\s/g, "");
534
+ for (const pattern of DANGEROUS_CSS_PATTERNS) {
535
+ if (normalizedLower.includes(pattern)) {
536
+ return null;
537
+ }
538
+ }
539
+ return style;
540
+ }
541
+ const ATTR_ENCODE_MAP = {
542
+ '"': "&quot;",
543
+ "'": "&#39;",
544
+ "`": "&#96;"
545
+ };
546
+ const ATTR_ENCODE_REGEX = /["'`]/g;
547
+ function encodeAttrValue(value) {
548
+ return value.replace(ATTR_ENCODE_REGEX, (char) => ATTR_ENCODE_MAP[char]);
549
+ }
550
+ function sanitizeAttrValue(name, value, wasUnquoted = false) {
551
+ if (URI_ATTRS.has(name)) {
552
+ if (!isSafeURI(value)) {
553
+ return null;
554
+ }
555
+ return wasUnquoted ? encodeAttrValue(value) : value;
556
+ }
557
+ if (name === "style") {
558
+ const sanitizedStyle = sanitizeStyleValue(value);
559
+ if (sanitizedStyle === null) {
560
+ return null;
561
+ }
562
+ return wasUnquoted ? encodeAttrValue(sanitizedStyle) : sanitizedStyle;
563
+ }
564
+ const decoded = decodeHTMLEntities(value).toLowerCase().replace(/\s/g, "");
565
+ if (/\bon\w+=/.test(decoded)) {
566
+ return null;
567
+ }
568
+ return wasUnquoted ? encodeAttrValue(value) : value;
569
+ }
570
+ function extractTagName(tag) {
571
+ const match = tag.match(TAG_NAME_REGEX);
572
+ return match ? match[1].toLowerCase() : null;
573
+ }
574
+ function isAllowedTag(tag) {
575
+ const tagName = extractTagName(tag);
576
+ return tagName !== null && ALLOWED_TAGS.has(tagName);
577
+ }
578
+ function sanitizeTag(fullTag) {
579
+ const closingMatch = fullTag.match(CLOSING_TAG_REGEX);
580
+ if (closingMatch) {
581
+ return `</${closingMatch[1].toLowerCase()}>`;
582
+ }
583
+ const openingMatch = fullTag.match(OPENING_TAG_REGEX);
584
+ if (!openingMatch) {
585
+ return "";
586
+ }
587
+ const [, tagName, attrString, selfClose] = openingMatch;
588
+ const lowerTagName = tagName.toLowerCase();
589
+ const allowedAttrs = [];
590
+ ATTR_REGEX.lastIndex = 0;
591
+ let attrMatch;
592
+ while ((attrMatch = ATTR_REGEX.exec(attrString)) !== null) {
593
+ const attrName = attrMatch[1].toLowerCase();
594
+ const doubleQuotedValue = attrMatch[2];
595
+ const singleQuotedValue = attrMatch[3];
596
+ const unquotedValue = attrMatch[4];
597
+ if (attrName.startsWith("on")) {
598
+ continue;
599
+ }
600
+ let attrValue;
601
+ let quoteChar;
602
+ if (doubleQuotedValue !== void 0) {
603
+ attrValue = doubleQuotedValue;
604
+ quoteChar = '"';
605
+ } else if (singleQuotedValue !== void 0) {
606
+ attrValue = singleQuotedValue;
607
+ quoteChar = "'";
608
+ } else if (unquotedValue !== void 0) {
609
+ attrValue = unquotedValue;
610
+ quoteChar = '"';
611
+ } else {
612
+ if (ALLOWED_ATTRS.has(attrName)) {
613
+ allowedAttrs.push(attrName);
614
+ }
615
+ continue;
616
+ }
617
+ if (ALLOWED_ATTRS.has(attrName)) {
618
+ const wasUnquoted = unquotedValue !== void 0;
619
+ const sanitizedValue = sanitizeAttrValue(attrName, attrValue, wasUnquoted);
620
+ if (sanitizedValue !== null) {
621
+ allowedAttrs.push(`${attrName}=${quoteChar}${sanitizedValue}${quoteChar}`);
622
+ }
623
+ }
624
+ }
625
+ const attrsStr = allowedAttrs.length > 0 ? ` ${allowedAttrs.join(" ")}` : "";
626
+ const selfCloseStr = selfClose ? "/>" : ">";
627
+ return `<${lowerTagName}${attrsStr}${selfCloseStr}`;
628
+ }
629
+ function sanitize(str) {
630
+ if (typeof str !== "string" || !str || str.indexOf("<") === -1) {
631
+ return str;
632
+ }
633
+ return str.replace(
634
+ /<\/?[^>]*>|[^<>\s]+>/g,
635
+ (match) => {
636
+ if (match.startsWith("<!--")) {
637
+ return "";
638
+ }
639
+ if (!match.startsWith("<")) {
640
+ return match.slice(0, -1) + "&gt;";
641
+ }
642
+ if (isAllowedTag(match)) {
643
+ return sanitizeTag(match);
644
+ }
645
+ return match.replace(/</g, "&lt;");
646
+ }
647
+ );
648
+ }
649
+
348
650
  ;// ./src/module/util.ts
349
651
  var util_defProp = Object.defineProperty;
350
652
  var util_getOwnPropSymbols = Object.getOwnPropertySymbols;
@@ -365,6 +667,7 @@ var util_spreadValues = (a, b) => {
365
667
 
366
668
 
367
669
 
670
+
368
671
  function _getRect(relativeViewport, node, forceEval = false) {
369
672
  const _ = (n) => n[relativeViewport ? "getBoundingClientRect" : "getBBox"]();
370
673
  if (forceEval) {
@@ -382,66 +685,6 @@ function _forEachValidItem(items, callback) {
382
685
  }
383
686
  }
384
687
  }
385
- const _sanitize = (() => {
386
- const DANGEROUS_TAGS = "script|iframe|object|embed|form|input|button|textarea|select|style|link|meta|base|math|isindex";
387
- const ENTITY_MAP = {
388
- quot: 34,
389
- amp: 38,
390
- apos: 39,
391
- lt: 60,
392
- gt: 62,
393
- nbsp: 160,
394
- iexcl: 161,
395
- cent: 162,
396
- pound: 163,
397
- curren: 164,
398
- yen: 165
399
- };
400
- const LT_CODE = 60;
401
- const GT_CODE = 62;
402
- const MAX_ITERATIONS = 10;
403
- const rx = {
404
- tags: new RegExp(
405
- `<(${DANGEROUS_TAGS})\\b[\\s\\S]*?>([\\s\\S]*?<\\/(${DANGEROUS_TAGS})\\s*>)?`,
406
- "gi"
407
- ),
408
- htmlEntity: /&#x([0-9a-f]+);?|&#([0-9]+);?|&([a-z]+);/gi,
409
- // eslint-disable-next-line no-control-regex
410
- controlChar: /[\x00-\x1F\x7F]/g,
411
- eventHandler: /\s+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|`[^`]*`|[^\s>]*)|on\w+\s*=\s*(?:"[^"]*"|'[^']*'|`[^`]*`|[^\s>]*)/gi,
412
- dangerousUri: /(href|src|action|xlink:href)\s*=\s*(['"`]?)([^'"`>\s]*)\2/gi,
413
- dangerousProtocol: /^(javascript|data|vbscript):/
414
- };
415
- return {
416
- ENTITY_MAP,
417
- LT_CODE,
418
- GT_CODE,
419
- MAX_ITERATIONS,
420
- rx,
421
- /**
422
- * Decode HTML entities to prevent bypass attacks
423
- * @param {string} str String with potential HTML entities
424
- * @returns {string} Decoded string
425
- */
426
- decodeEntities(str) {
427
- return str.replace(rx.htmlEntity, (match, hex, dec, named) => {
428
- const code = hex ? parseInt(hex, 16) : dec ? parseInt(dec, 10) : named ? ENTITY_MAP[named.toLowerCase()] || 0 : 0;
429
- return code && code !== LT_CODE && code !== GT_CODE ? String.fromCharCode(code) : match;
430
- });
431
- },
432
- /**
433
- * Remove dangerous URI protocols from attribute values
434
- * @param {string} str String to sanitize
435
- * @returns {string} Sanitized string
436
- */
437
- removeDangerousUris(str) {
438
- return str.replace(rx.dangerousUri, (match, attr, quote, value) => {
439
- const normalized = value.toLowerCase().replace(/\s/g, "");
440
- return rx.dangerousProtocol.test(normalized) ? `${attr}=${quote}${quote}` : match;
441
- });
442
- }
443
- };
444
- })();
445
688
  const isValue = (v) => v || v === 0;
446
689
  const isFunction = (v) => typeof v === "function";
447
690
  const isString = (v) => typeof v === "string";
@@ -488,23 +731,6 @@ function endall(transition, cb) {
488
731
  transition.call(end);
489
732
  }
490
733
  }
491
- function sanitize(str) {
492
- if (!isString(str) || !str || str.indexOf("<") === -1) {
493
- return str;
494
- }
495
- let result = str;
496
- let prev;
497
- let iterations = 0;
498
- do {
499
- prev = result;
500
- result = _sanitize.decodeEntities(result).replace(_sanitize.rx.controlChar, "").replace(_sanitize.rx.tags, "").replace(_sanitize.rx.eventHandler, "");
501
- result = _sanitize.removeDangerousUris(result);
502
- if (++iterations >= _sanitize.MAX_ITERATIONS) {
503
- break;
504
- }
505
- } while (result !== prev);
506
- return result;
507
- }
508
734
  function setTextValue(node, text, dy = [-1, 1], toMiddle = false) {
509
735
  if (!node || !isString(text)) {
510
736
  return;
@@ -995,7 +1221,7 @@ class Plugin {
995
1221
  });
996
1222
  }
997
1223
  }
998
- __publicField(Plugin, "version", "3.18.0-next.2");
1224
+ __publicField(Plugin, "version", "3.18.0");
999
1225
 
1000
1226
  // EXTERNAL MODULE: external {"commonjs":"d3-axis","commonjs2":"d3-axis","amd":"d3-axis","root":"d3"}
1001
1227
  var external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_ = __webpack_require__(8);
@@ -5,20 +5,20 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.18.0-next.2
8
+ * @version 3.18.0
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
- */(function(f,x){typeof exports=="object"&&typeof module=="object"?module.exports=x(require("d3-color"),require("d3-interpolate"),require("d3-scale"),require("d3-brush"),require("d3-selection"),require("d3-axis"),require("d3-format")):typeof define=="function"&&define.amd?define("bb",["d3-color","d3-interpolate","d3-scale","d3-brush","d3-selection","d3-axis","d3-format"],x):typeof exports=="object"?exports.bb=x(require("d3-color"),require("d3-interpolate"),require("d3-scale"),require("d3-brush"),require("d3-selection"),require("d3-axis"),require("d3-format")):(f.bb=f.bb||{},f.bb.plugin=f.bb.plugin||{},f.bb.plugin.stanford=x(f.d3,f.d3,f.d3,f.d3,f.d3,f.d3,f.d3))})(this,function(j,f,x,Z,J,Q,ee){return(function(){"use strict";var te={218:(function(e){e.exports=j}),390:(function(e){e.exports=ee}),455:(function(e){e.exports=x}),747:(function(e){e.exports=J}),798:(function(e){e.exports=f}),853:(function(e){e.exports=Z}),996:(function(e){e.exports=Q})},I={};function p(e){var t=I[e];if(t!==void 0)return t.exports;var n=I[e]={exports:{}};return te[e](n,n.exports,p),n.exports}(function(){p.d=function(e,t){for(var n in t)p.o(t,n)&&!p.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}})(),(function(){p.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}})();var w={};p.d(w,{default:function(){return dt}});var D=p(218),ne=p(798),S=p(455),oe=Object.defineProperty,F=Object.getOwnPropertySymbols,re=Object.prototype.hasOwnProperty,se=Object.prototype.propertyIsEnumerable,N=(e,t,n)=>t in e?oe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b=(e,t)=>{for(var n in t||(t={}))re.call(t,n)&&N(e,n,t[n]);if(F)for(var n of F(t))se.call(t,n)&&N(e,n,t[n]);return e};const ae={button:"bb-button",chart:"bb-chart",empty:"bb-empty",main:"bb-main",target:"bb-target",EXPANDED:"_expanded_",dummy:"_dummy_"},ie={arc:"bb-arc",arcLabelLine:"bb-arc-label-line",arcLabelLineText:"bb-arc-label-line-text",arcRange:"bb-arc-range",arcs:"bb-arcs",chartArc:"bb-chart-arc",chartArcs:"bb-chart-arcs",chartArcsBackground:"bb-chart-arcs-background",chartArcsTitle:"bb-chart-arcs-title",needle:"bb-needle"},ce={area:"bb-area",areas:"bb-areas"},le={axis:"bb-axis",axisX:"bb-axis-x",axisXLabel:"bb-axis-x-label",axisY:"bb-axis-y",axisY2:"bb-axis-y2",axisY2Label:"bb-axis-y2-label",axisYLabel:"bb-axis-y-label",axisXTooltip:"bb-axis-x-tooltip",axisYTooltip:"bb-axis-y-tooltip",axisY2Tooltip:"bb-axis-y2-tooltip",axisTooltipX:"bb-axis-tooltip-x",axisTooltipY:"bb-axis-tooltip-y"},ue={bar:"bb-bar",bars:"bb-bars",chartBar:"bb-chart-bar",chartBars:"bb-chart-bars",barConnectLine:"bb-bar-connectLine"},de={candlestick:"bb-candlestick",candlesticks:"bb-candlesticks",chartCandlestick:"bb-chart-candlestick",chartCandlesticks:"bb-chart-candlesticks",valueDown:"bb-value-down",valueUp:"bb-value-up"},be={chartCircles:"bb-chart-circles",circle:"bb-circle",circles:"bb-circles"},fe={colorPattern:"bb-color-pattern",colorScale:"bb-colorscale"},pe={dragarea:"bb-dragarea",INCLUDED:"_included_"},he={funnel:"bb-funnel",chartFunnel:"bb-chart-funnel",chartFunnels:"bb-chart-funnels",funnelBackground:"bb-funnel-background"},ge={chartArcsGaugeMax:"bb-chart-arcs-gauge-max",chartArcsGaugeMin:"bb-chart-arcs-gauge-min",chartArcsGaugeUnit:"bb-chart-arcs-gauge-unit",chartArcsGaugeTitle:"bb-chart-arcs-gauge-title",gaugeValue:"bb-gauge-value"},me={legend:"bb-legend",legendBackground:"bb-legend-background",legendItem:"bb-legend-item",legendItemEvent:"bb-legend-item-event",legendItemHidden:"bb-legend-item-hidden",legendItemPoint:"bb-legend-item-point",legendItemTile:"bb-legend-item-tile"},_e={chartLine:"bb-chart-line",chartLines:"bb-chart-lines",line:"bb-line",lines:"bb-lines"},xe={eventRect:"bb-event-rect",eventRects:"bb-event-rects",eventRectsMultiple:"bb-event-rects-multiple",eventRectsSingle:"bb-event-rects-single"},ye={focused:"bb-focused",defocused:"bb-defocused",legendItemFocused:"bb-legend-item-focused",xgridFocus:"bb-xgrid-focus",ygridFocus:"bb-ygrid-focus"},ve={grid:"bb-grid",gridLines:"bb-grid-lines",xgrid:"bb-xgrid",xgridLine:"bb-xgrid-line",xgridLines:"bb-xgrid-lines",xgrids:"bb-xgrids",ygrid:"bb-ygrid",ygridLine:"bb-ygrid-line",ygridLines:"bb-ygrid-lines",ygrids:"bb-ygrids"},ft={level:"bb-level",levels:"bb-levels"},we={chartRadar:"bb-chart-radar",chartRadars:"bb-chart-radars"},$e={region:"bb-region",regions:"bb-regions"},Ee={selectedCircle:"bb-selected-circle",selectedCircles:"bb-selected-circles",SELECTED:"_selected_"},Se={shape:"bb-shape",shapes:"bb-shapes"},Ce={brush:"bb-brush",subchart:"bb-subchart"},Oe={chartText:"bb-chart-text",chartTexts:"bb-chart-texts",text:"bb-text",texts:"bb-texts",title:"bb-title",textBorderRect:"bb-text-border",textLabelImage:"bb-text-label-image",TextOverlapping:"text-overlapping"},C={tooltip:"bb-tooltip",tooltipContainer:"bb-tooltip-container",tooltipName:"bb-tooltip-name"},Re={treemap:"bb-treemap",chartTreemap:"bb-chart-treemap",chartTreemaps:"bb-chart-treemaps"},Pe={buttonZoomReset:"bb-zoom-reset",zoomBrush:"bb-zoom-brush"};var pt=b(b(b(b(b(b(b(b(b(b(b(b(b(b(b(b(b(b(b(b(b(b(b(b(b({},ae),ie),ce),le),ue),de),be),fe),pe),ge),me),_e),xe),ye),he),ve),we),$e),Ee),Se),Ce),Oe),C),Re),Pe),ht=p(853),gt=p(747);function Te(){return typeof globalThis=="object"&&globalThis!==null&&globalThis.Object===Object&&globalThis||typeof global=="object"&&global!==null&&global.Object===Object&&global||typeof self=="object"&&self!==null&&self.Object===Object&&self||Function("return this")()}function Ae(e){const t=typeof(e==null?void 0:e.requestAnimationFrame)=="function"&&typeof(e==null?void 0:e.cancelAnimationFrame)=="function",n=typeof(e==null?void 0:e.requestIdleCallback)=="function"&&typeof(e==null?void 0:e.cancelIdleCallback)=="function",o=s=>setTimeout(s,1),r=s=>clearTimeout(s);return[t?e.requestAnimationFrame:o,t?e.cancelAnimationFrame:r,n?e.requestIdleCallback:o,n?e.cancelIdleCallback:r]}const $=Te(),Le=$==null?void 0:$.document,[mt,_t,xt,yt]=Ae($);var Me=Object.defineProperty,B=Object.getOwnPropertySymbols,je=Object.prototype.hasOwnProperty,Ie=Object.prototype.propertyIsEnumerable,q=(e,t,n)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,U=(e,t)=>{for(var n in t||(t={}))je.call(t,n)&&q(e,n,t[n]);if(B)for(var n of B(t))Ie.call(t,n)&&q(e,n,t[n]);return e};function X(e,t,n=!1){const o=r=>r[e?"getBoundingClientRect":"getBBox"]();return n?o(t):!("rect"in t)||"rect"in t&&t.hasAttribute("width")&&t.rect.width!==+(t.getAttribute("width")||0)?t.rect=o(t):t.rect}function G(e,t){for(let n=0;n<e.length;n++){const o=e[n];o&&t(o,n)}}const y=(()=>{const e="script|iframe|object|embed|form|input|button|textarea|select|style|link|meta|base|math|isindex",t={quot:34,amp:38,apos:39,lt:60,gt:62,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165},n=60,o=62,r=10,s={tags:new RegExp(`<(${e})\\b[\\s\\S]*?>([\\s\\S]*?<\\/(${e})\\s*>)?`,"gi"),htmlEntity:/&#x([0-9a-f]+);?|&#([0-9]+);?|&([a-z]+);/gi,controlChar:/[\x00-\x1F\x7F]/g,eventHandler:/\s+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|`[^`]*`|[^\s>]*)|on\w+\s*=\s*(?:"[^"]*"|'[^']*'|`[^`]*`|[^\s>]*)/gi,dangerousUri:/(href|src|action|xlink:href)\s*=\s*(['"`]?)([^'"`>\s]*)\2/gi,dangerousProtocol:/^(javascript|data|vbscript):/};return{ENTITY_MAP:t,LT_CODE:n,GT_CODE:o,MAX_ITERATIONS:r,rx:s,decodeEntities(a){return a.replace(s.htmlEntity,(i,u,d,l)=>{const c=u?parseInt(u,16):d?parseInt(d,10):l&&t[l.toLowerCase()]||0;return c&&c!==n&&c!==o?String.fromCharCode(c):i})},removeDangerousUris(a){return a.replace(s.dangerousUri,(i,u,d,l)=>{const c=l.toLowerCase().replace(/\s/g,"");return s.dangerousProtocol.test(c)?`${u}=${d}${d}`:i})}}})(),vt=e=>e||e===0,O=e=>typeof e=="function",_=e=>typeof e=="string",R=e=>typeof e=="number",De=e=>typeof e=="undefined",Y=e=>typeof e!="undefined",wt=e=>typeof e=="boolean",$t=e=>Math.ceil(e/10)*10,Et=e=>Math.ceil(e)+.5,St=e=>e[1]-e[0],P=e=>typeof e=="object",Fe=e=>{for(const t in e)return!1;return!0},V=e=>De(e)||e===null||_(e)&&e.length===0||P(e)&&!(e instanceof Date)&&Fe(e)||R(e)&&isNaN(e),Ne=e=>!V(e),T=e=>Array.isArray(e),v=e=>e&&!(e!=null&&e.nodeType)&&P(e)&&!T(e);function Ct(e,t,n){return Y(e[t])?e[t]:n}function Ot(e,t){let n=!1;return Object.keys(e).forEach(o=>e[o]===t&&(n=!0)),n}function Rt(e,t,...n){const o=O(e);return o&&e.call(t,...n),o}function Pt(e,t){let n=0;const o=function(...r){!--n&&t.apply(this,...r)};"duration"in e?e.each(()=>++n).on("end",o):(++n,e.call(o))}function Be(e){if(!_(e)||!e||e.indexOf("<")===-1)return e;let t=e,n,o=0;do if(n=t,t=y.decodeEntities(t).replace(y.rx.controlChar,"").replace(y.rx.tags,"").replace(y.rx.eventHandler,""),t=y.removeDangerousUris(t),++o>=y.MAX_ITERATIONS)break;while(t!==n);return t}function Tt(e,t,n=[-1,1],o=!1){if(!(!e||!_(t)))if(t.indexOf(`
12
- `)===-1)e.text(t);else{const r=[e.text(),t].map(s=>s.replace(/[\s\n]/g,""));if(r[0]!==r[1]){const s=t.split(`
13
- `),a=o?s.length-1:1;e.html(""),s.forEach((i,u)=>{e.append("tspan").attr("x",0).attr("dy",`${u===0?n[0]*a:n[1]}em`).text(i)})}}}function qe(e){const{x:t,y:n,width:o,height:r}=e.getBBox();return[{x:t,y:n+r},{x:t,y:n},{x:t+o,y:n},{x:t+o,y:n+r}]}function At(e){const{width:t,height:n}=k(e),o=qe(e),r=o[0].x,s=Math.min(o[0].y,o[1].y);return{x:r,y:s,width:t,height:n}}function Lt(e,t){var n;const o=e&&((n=e.touches||e.sourceEvent&&e.sourceEvent.touches)==null?void 0:n[0]);let r=[0,0];try{r=d3Pointer(o||e,t)}catch(s){}return r.map(s=>isNaN(s)?0:s)}function Ue(e){const{event:t,$el:n}=e,o=n.subchart.main||n.main;let r;return t&&t.type==="brush"?r=t.selection:o&&(r=o.select(".bb-brush").node())&&(r=d3BrushSelection(r)),r}function k(e,t=!1){return X(!0,e,t)}function Mt(e,t=!1){return X(!1,e,t)}function jt(e=!0,t=0,n=1e4){const o=window.crypto||window.msCrypto,r=o?t+o.getRandomValues(new Uint32Array(1))[0]%(n-t+1):Math.floor(Math.random()*(n-t)+t);return e?String(r):r}function z(e,t,n,o,r){if(n>o)return-1;const s=Math.floor((n+o)/2);let{x:a,w:i=0}=e[s];return r&&(a=e[s].y,i=e[s].h),t>=a&&t<=a+i?s:t<a?z(e,t,n,s-1,r):z(e,t,s+1,o,r)}function It(e){const t=Ue(e);return t?t[0]===t[1]:!0}function Dt(...e){const t=n=>{if(v(n)&&n.constructor){const o=new n.constructor;for(const r in n)o[r]=t(n[r]);return o}return n};return e.map(n=>t(n)).reduce((n,o)=>U(U({},n),o))}function Xe(e={},t){T(t)&&t.forEach(n=>Xe(e,n));for(const n in t)/^\d+$/.test(n)||n in e||(e[n]=t[n]);return e}const Ft=e=>e.charAt(0).toUpperCase()+e.slice(1);function Nt(e,t="-"){return e.split(t).map((n,o)=>o?n.charAt(0).toUpperCase()+n.slice(1).toLowerCase():n.toLowerCase()).join("")}const Ge=e=>[].slice.call(e);function Bt(e,t,n){const{rootSelector:o="",sheet:r}=e,a=`${o} ${(i=>i.replace(/\s?(bb-)/g,".$1").replace(/\.+/g,"."))(t)} {${n.join(";")}}`;return r[r.insertRule?"insertRule":"addRule"](a,r.cssRules.length)}function qt(e){let t=[];return e.forEach(n=>{var o;try{n.cssRules&&n.cssRules.length&&(t=t.concat(Ge(n.cssRules)))}catch(r){(o=window.console)==null||o.warn(`Error while reading rules from ${n.href}: ${r.toString()}`)}}),t}function Ut(e){var t,n,o,r,s,a;return{x:((n=(t=window.pageXOffset)!=null?t:window.scrollX)!=null?n:0)+((o=e.scrollLeft)!=null?o:0),y:((s=(r=window.pageYOffset)!=null?r:window.scrollY)!=null?s:0)+((a=e.scrollTop)!=null?a:0)}}function Xt(e,t=0,n=0,o=!0){const r=new DOMPoint(t,n),s=e.getScreenCTM(),a=r.matrixTransform(o?s==null?void 0:s.inverse():s);if(o===!1){const i=k(e);a.x-=i.x,a.y-=i.y}return a}function Gt(e){const t=e?e.transform:null,n=t&&t.baseVal;return n&&n.numberOfItems?n.getItem(0).matrix:{a:0,b:0,c:0,d:0,e:0,f:0}}function Yt(e){const t=e[0]instanceof Date,n=(t?e.map(Number):e).filter((o,r,s)=>s.indexOf(o)===r);return t?n.map(o=>new Date(o)):n}function Vt(e){return e&&e.length?e.reduce((t,n)=>t.concat(n)):[]}function A(e,...t){if(!t.length||t.length===1&&!t[0])return e;const n=t.shift();return v(e)&&v(n)&&Object.keys(n).forEach(o=>{if(!/^(__proto__|constructor|prototype)$/i.test(o)){const r=n[o];v(r)?(!e[o]&&(e[o]={}),e[o]=A(e[o],r)):e[o]=T(r)?r.concat():r}}),A(e,...t)}function Ye(e,t=!0){let n;return e[0]instanceof Date?n=t?(o,r)=>o-r:(o,r)=>r-o:t&&!e.every(isNaN)?n=(o,r)=>o-r:t||(n=(o,r)=>o>r&&-1||o<r&&1||o===r&&0),e.concat().sort(n)}function kt(e,t){let n=t.filter(o=>Ne(o));return n.length?R(n[0])?n=Math[e](...n):n[0]instanceof Date&&(n=Ye(n,e==="min")[0]):n=void 0,n}const Ve=(e,t,n=1)=>{const o=[],r=Math.max(0,Math.ceil((t-e)/n))|0;for(let s=e;s<r;s++)o.push(e+s*n);return o},zt={mouse:(()=>{const e=()=>({bubbles:!1,cancelable:!1,screenX:0,screenY:0,clientX:0,clientY:0});try{return new MouseEvent("t"),(t,n,o=e())=>{t.dispatchEvent(new MouseEvent(n,o))}}catch(t){return(n,o,r=e())=>{const s=Le.createEvent("MouseEvent");s.initMouseEvent(o,r.bubbles,r.cancelable,$,0,r.screenX,r.screenY,r.clientX,r.clientY,!1,!1,!1,!1,0,null),n.dispatchEvent(s)}}})(),touch:(e,t,n)=>{const o=new Touch(A({identifier:Date.now(),target:e,radiusX:2.5,radiusY:2.5,rotationAngle:10,force:.5},n));e.dispatchEvent(new TouchEvent(t,{cancelable:!0,bubbles:!0,shiftKey:!0,touches:[o],targetTouches:[],changedTouches:[o]}))}};function Ht(e,t){let n=e;for(const o in t)n=n.replace(new RegExp(`{=${o}}`,"g"),t[o]);return Be(n)}function ke(e){var t;let n;if(e instanceof Date)n=e;else if(_(e)){const{config:o,format:r}=this;n=(t=r.dataTime(o.data_xFormat)(e))!=null?t:new Date(e)}else R(e)&&!isNaN(e)&&(n=new Date(+e));return(!n||isNaN(+n))&&console&&console.error&&console.error(`Failed to parse x '${e}' to Date object`),n}function Kt(e){const t=e.attr("viewBox");return t?/(\d+(\.\d+)?){3}/.test(t):!1}function Wt(e,t,n=!1){const o=!!e.node;let r=!1;for(const[s,a]of Object.entries(t))if(r=o?e.style(s)===a:e.style[s]===a,n===!1&&r)break;return r}function Zt(){var e,t;return((e=document)==null?void 0:e.hidden)===!1||((t=document)==null?void 0:t.visibilityState)==="visible"}function Jt(e,t){const{DocumentTouch:n,matchMedia:o,navigator:r}=window,s=o==null?void 0:o("(pointer:coarse)").matches;let a=!1;if(t)if(r&&"maxTouchPoints"in r)a=r.maxTouchPoints>0;else if("ontouchmove"in window||n&&document instanceof n)a=!0;else if(s)a=!0;else{const u=r.userAgent;a=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(u)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(u)}return e&&!s&&(o==null?void 0:o("(pointer:fine)").matches)&&"mouse"||a&&"touch"||"mouse"}function ze(e,t){t()===!1?requestAnimationFrame(()=>ze(e,t)):e()}function Qt(e){if(v(e)&&!_(e)){const a=e;return{top:a.top||0,right:a.right||0,bottom:a.bottom||0,left:a.left||0}}const t=(_(e)?e.trim().split(/\s+/):[e]).map(a=>+a||0),[n,o=n,r=n,s=o]=t;return{top:n,right:o,bottom:r,left:s}}function en(e,t){e.pendingRaf!==null?(window.cancelAnimationFrame(e.pendingRaf),e.pendingRaf=window.requestAnimationFrame(()=>{e.pendingRaf=null,t()})):(e.pendingRaf=window.requestAnimationFrame(()=>{e.pendingRaf=null}),t())}function tn(e,t=(n=>n)){const n=new Set;return G(e,(o,r)=>{n.add(t(o,r))}),n}function nn(e,t,n=(o=>o)){const o=new Map;return G(e,(r,s)=>{o.set(t(r,s),n(r,s))}),o}function He(e){const t=this.config;let n,o,r;const s=()=>{const a=o.shift();if(a&&n&&P(n)&&a in n)return n=n[a],s();if(!a)return n};Object.keys(t).forEach(a=>{n=e,o=a.split("_"),r=s(),Y(r)&&(t[a]=r)}),this.api&&(this.state.orgConfig=e)}var Ke=Object.defineProperty,We=(e,t,n)=>t in e?Ke(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,L=(e,t,n)=>We(e,typeof t!="symbol"?t+"":t,n);class H{constructor(t={}){L(this,"$$"),L(this,"options"),this.options=t}$beforeInit(){}$init(){}$afterInit(){}$redraw(){}$willDestroy(){Object.keys(this).forEach(t=>{this[t]=null,delete this[t]})}}L(H,"version","3.18.0-next.2");var Ze=p(996),Je=p(390),h={colorScale:"bb-colorscale",stanfordElements:"bb-stanford-elements",stanfordLine:"bb-stanford-line",stanfordLines:"bb-stanford-lines",stanfordRegion:"bb-stanford-region",stanfordRegions:"bb-stanford-regions"},Qe=Object.defineProperty,et=(e,t,n)=>t in e?Qe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,K=(e,t,n)=>et(e,typeof t!="symbol"?t+"":t,n);class tt{constructor(t){K(this,"owner"),K(this,"colorScale"),this.owner=t}drawColorScale(){const{$$:t,config:n}=this.owner,o=t.data.targets[0],r=t.state.height-n.padding_bottom-n.padding_top,s=n.scale_width,a=5,i=Ve(n.padding_bottom,r,a),u=(0,S.scaleSequential)(o.colors).domain([i[i.length-1],i[0]]);this.colorScale&&this.colorScale.remove(),this.colorScale=t.$el.svg.append("g").attr("width",50).attr("height",r).attr("class",h.colorScale),this.colorScale.append("g").attr("transform",`translate(0, ${n.padding_top})`).selectAll("bars").data(i).enter().append("rect").attr("y",(m,bt)=>bt*a).attr("x",0).attr("width",s).attr("height",a).attr("fill",m=>u(m));const d=(0,S.scaleSymlog)().domain([o.minEpochs,o.maxEpochs]).range([i[0]+n.padding_top+i[i.length-1]+a-1,i[0]+n.padding_top]),l=(0,Ze.axisRight)(d),c=n.scale_format;c==="pow10"?l.tickValues([1,10,100,1e3,1e4,1e5,1e6,1e7]):O(c)?l.tickFormat(c):l.tickFormat((0,Je.format)("d"));const g=this.colorScale.append("g").attr("class","legend axis").attr("transform",`translate(${s},0)`).call(l);c==="pow10"&&g.selectAll(".tick text").text(null).filter(m=>m/Math.pow(10,Math.ceil(Math.log(m)/Math.LN10-1e-12))===1).text(10).append("tspan").attr("dy","-.7em").text(m=>Math.round(Math.log(m)/Math.LN10)),this.colorScale.attr("transform",`translate(${t.state.current.width-this.xForColorScale()}, 0)`)}xForColorScale(){return this.owner.config.padding_right+this.colorScale.node().getBBox().width}getColorScalePadding(){return this.xForColorScale()+this.owner.config.padding_left+20}}function nt(e,t){const n=e.x,o=e.value;let r=!1;for(let s=0,a=t.length-1;s<t.length;a=s++){const i=t[s].x,u=t[s].y,d=t[a].x,l=t[a].y;u>o!=l>o&&n<(d-i)*(o-u)/(l-u)+i&&(r=!r)}return r}function ot(e,t){return e.epochs<t.epochs?-1:e.epochs>t.epochs?1:0}function rt(e){let t=0,n,o;for(let r=0,s=e.length,a=s-1;r<s;a=r,r++)n=e[r],o=e[a],t+=n.x*o.y,t-=n.y*o.x;return t/=2,t}function E(e){const t=rt(e);let n=0,o=0,r;for(let s=0,a=e.length,i=a-1;s<a;i=s,s++){const u=e[s],d=e[i];r=u.x*d.y-d.x*u.y,n+=(u.x+d.x)*r,o+=(u.y+d.y)*r}return r=t*6,{x:n/r,y:o/r}}var st=Object.defineProperty,at=(e,t,n)=>t in e?st(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,it=(e,t,n)=>at(e,typeof t!="symbol"?t+"":t,n);class ct{constructor(t){it(this,"owner"),this.owner=t;const n=t.$$.$el.main.select(".bb-chart").append("g").attr("class",h.stanfordElements);n.append("g").attr("class",h.stanfordLines),n.append("g").attr("class",h.stanfordRegions)}updateStanfordLines(t){const{$$:n}=this.owner,{config:o,$el:{main:r}}=n,s=o.axis_rotated,a=this.xvCustom.bind(n),i=this.yvCustom.bind(n),u=r.select(`.${h.stanfordLines}`).style("shape-rendering","geometricprecision").selectAll(`.${h.stanfordLine}`).data(this.owner.config.lines);u.exit().transition().duration(t).style("opacity","0").remove();const d=u.enter().append("g");d.append("line").style("opacity","0"),d.merge(u).attr("class",l=>h.stanfordLine+(l.class?` ${l.class}`:"")).select("line").transition().duration(t).attr("x1",l=>s?i(l,"y1"):a(l,"x1")).attr("x2",l=>s?i(l,"y2"):a(l,"x2")).attr("y1",l=>s?a(l,"x1"):i(l,"y1")).attr("y2",l=>s?a(l,"x2"):i(l,"y2")).transition().style("opacity",null)}updateStanfordRegions(t){const{$$:n}=this.owner,{config:o,$el:{main:r}}=n,s=o.axis_rotated,a=this.xvCustom.bind(n),i=this.yvCustom.bind(n),u=this.owner.countEpochsInRegion.bind(n);let d=r.select(`.${h.stanfordRegions}`).selectAll(`.${h.stanfordRegion}`).data(this.owner.config.regions);d.exit().transition().duration(t).style("opacity","0").remove();const l=d.enter().append("g");l.append("polygon").style("opacity","0"),l.append("text").attr("transform",s?"rotate(-90)":"").style("opacity","0"),d=l.merge(d),d.attr("class",c=>h.stanfordRegion+(c.class?` ${c.class}`:"")).select("polygon").transition().duration(t).attr("points",c=>c.points.map(g=>[s?i(g,"y"):a(g,"x"),s?a(g,"x"):i(g,"y")].join(",")).join(" ")).transition().style("opacity",c=>String(c.opacity?c.opacity:.2)),d.select("text").transition().duration(t).attr("x",c=>s?i(E(c.points),"y"):a(E(c.points),"x")).attr("y",c=>s?a(E(c.points),"x"):i(E(c.points),"y")).text(c=>{if(c.text){const{value:g,percentage:m}=u(c.points);return c.text(g,m)}return""}).attr("text-anchor","middle").attr("dominant-baseline","middle").transition().style("opacity",null)}updateStanfordElements(t=0){this.updateStanfordLines(t),this.updateStanfordRegions(t)}xvCustom(t,n){const o=this,{axis:r,config:s}=o;let a=n?t[n]:o.getBaseValue(t);return r.isTimeSeries()?a=ke.call(o,a):r.isCategorized()&&_(a)&&(a=s.axis_x_categories.indexOf(t.value)),o.scale.x(a)}yvCustom(t,n){const o=this,r=t.axis&&t.axis==="y2"?o.scale.y2:o.scale.y,s=n?t[n]:o.getBaseValue(t);return r(s)}}class W{constructor(){return{colors:void 0,epochs:[],lines:[],scale_min:void 0,scale_max:void 0,scale_width:20,scale_format:void 0,padding_top:0,padding_right:0,padding_bottom:0,padding_left:0,regions:[]}}}var lt=Object.defineProperty,ut=(e,t,n)=>t in e?lt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,M=(e,t,n)=>ut(e,typeof t!="symbol"?t+"":t,n);class dt extends H{constructor(t){return super(t),M(this,"config"),M(this,"colorScale"),M(this,"elements"),this.config=new W,this}$beforeInit(){const{$$:t}=this;t.config.data_xSort=!1,t.isMultipleX=()=>!0,t.showGridFocus=()=>{},t.labelishData=o=>o.values,t.opacityForCircle=()=>1;const n=t.getCurrentPadding.bind(t);t.getCurrentPadding=()=>{const o=n();return o.right+=this.colorScale?this.colorScale.getColorScalePadding():0,o}}$init(){const{$$:t}=this;He.call(this,this.options),t.color=this.getStanfordPointColor.bind(t),this.colorScale=new tt(this),this.elements=new ct(this),this.convertData(),this.initStanfordData(),this.setStanfordTooltip(),this.colorScale.drawColorScale(),t.right+=this.colorScale?this.colorScale.getColorScalePadding():0,this.$redraw()}$redraw(t){var n,o;(n=this.colorScale)==null||n.drawColorScale(),(o=this.elements)==null||o.updateStanfordElements(t)}getOptions(){return new W}convertData(){const t=this.$$.data.targets,n=this.options.epochs;t.forEach(o=>{o.values.forEach((r,s)=>{r.epochs=n[s]}),o.minEpochs=void 0,o.maxEpochs=void 0,o.colors=void 0,o.colorscale=void 0})}initStanfordData(){const{config:t}=this,n=this.$$.data.targets[0];n.values.sort(ot);const o=n.values.map(r=>r.epochs);n.minEpochs=isNaN(t.scale_min)?Math.min(...o):t.scale_min,n.maxEpochs=isNaN(t.scale_max)?Math.max(...o):t.scale_max,n.colors=O(t.colors)?t.colors:(0,ne.interpolateHslLong)((0,D.hsl)(250,1,.5),(0,D.hsl)(0,1,.5)),n.colorscale=(0,S.scaleSequentialLog)(n.colors).domain([n.minEpochs,n.maxEpochs])}getStanfordPointColor(t){return this.data.targets[0].colorscale(t.epochs)}setStanfordTooltip(){const{config:t}=this.$$;V(t.tooltip_contents)&&(t.tooltip_contents=function(n,o,r,s){const{data_x:a}=t;let i=`<table class="${C.tooltip}"><tbody>`;return n.forEach(u=>{const{id:d="",value:l=0,epochs:c=0,x:g=""}=u;i+=`<tr>
14
- <th>${a||""}</th>
11
+ */(function(f,_){typeof exports=="object"&&typeof module=="object"?module.exports=_(require("d3-color"),require("d3-interpolate"),require("d3-scale"),require("d3-brush"),require("d3-selection"),require("d3-axis"),require("d3-format")):typeof define=="function"&&define.amd?define("bb",["d3-color","d3-interpolate","d3-scale","d3-brush","d3-selection","d3-axis","d3-format"],_):typeof exports=="object"?exports.bb=_(require("d3-color"),require("d3-interpolate"),require("d3-scale"),require("d3-brush"),require("d3-selection"),require("d3-axis"),require("d3-format")):(f.bb=f.bb||{},f.bb.plugin=f.bb.plugin||{},f.bb.plugin.stanford=_(f.d3,f.d3,f.d3,f.d3,f.d3,f.d3,f.d3))})(this,function(M,f,_,W,Z,J,Q){return(function(){"use strict";var tt={218:(function(t){t.exports=M}),390:(function(t){t.exports=Q}),455:(function(t){t.exports=_}),747:(function(t){t.exports=Z}),798:(function(t){t.exports=f}),853:(function(t){t.exports=W}),996:(function(t){t.exports=J})},j={};function h(t){var e=j[t];if(e!==void 0)return e.exports;var n=j[t]={exports:{}};return tt[t](n,n.exports,h),n.exports}(function(){h.d=function(t,e){for(var n in e)h.o(e,n)&&!h.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})}})(),(function(){h.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}})();var v={};h.d(v,{default:function(){return le}});var F=h(218),et=h(798),E=h(455),nt=Object.defineProperty,I=Object.getOwnPropertySymbols,ot=Object.prototype.hasOwnProperty,rt=Object.prototype.propertyIsEnumerable,D=(t,e,n)=>e in t?nt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,u=(t,e)=>{for(var n in e||(e={}))ot.call(e,n)&&D(t,n,e[n]);if(I)for(var n of I(e))rt.call(e,n)&&D(t,n,e[n]);return t};const st={button:"bb-button",chart:"bb-chart",empty:"bb-empty",main:"bb-main",target:"bb-target",EXPANDED:"_expanded_",dummy:"_dummy_"},it={arc:"bb-arc",arcLabelLine:"bb-arc-label-line",arcLabelLineText:"bb-arc-label-line-text",arcRange:"bb-arc-range",arcs:"bb-arcs",chartArc:"bb-chart-arc",chartArcs:"bb-chart-arcs",chartArcsBackground:"bb-chart-arcs-background",chartArcsTitle:"bb-chart-arcs-title",needle:"bb-needle"},at={area:"bb-area",areas:"bb-areas"},ct={axis:"bb-axis",axisX:"bb-axis-x",axisXLabel:"bb-axis-x-label",axisY:"bb-axis-y",axisY2:"bb-axis-y2",axisY2Label:"bb-axis-y2-label",axisYLabel:"bb-axis-y-label",axisXTooltip:"bb-axis-x-tooltip",axisYTooltip:"bb-axis-y-tooltip",axisY2Tooltip:"bb-axis-y2-tooltip",axisTooltipX:"bb-axis-tooltip-x",axisTooltipY:"bb-axis-tooltip-y"},lt={bar:"bb-bar",bars:"bb-bars",chartBar:"bb-chart-bar",chartBars:"bb-chart-bars",barConnectLine:"bb-bar-connectLine"},ut={candlestick:"bb-candlestick",candlesticks:"bb-candlesticks",chartCandlestick:"bb-chart-candlestick",chartCandlesticks:"bb-chart-candlesticks",valueDown:"bb-value-down",valueUp:"bb-value-up"},dt={chartCircles:"bb-chart-circles",circle:"bb-circle",circles:"bb-circles"},bt={colorPattern:"bb-color-pattern",colorScale:"bb-colorscale"},ft={dragarea:"bb-dragarea",INCLUDED:"_included_"},ht={funnel:"bb-funnel",chartFunnel:"bb-chart-funnel",chartFunnels:"bb-chart-funnels",funnelBackground:"bb-funnel-background"},pt={chartArcsGaugeMax:"bb-chart-arcs-gauge-max",chartArcsGaugeMin:"bb-chart-arcs-gauge-min",chartArcsGaugeUnit:"bb-chart-arcs-gauge-unit",chartArcsGaugeTitle:"bb-chart-arcs-gauge-title",gaugeValue:"bb-gauge-value"},gt={legend:"bb-legend",legendBackground:"bb-legend-background",legendItem:"bb-legend-item",legendItemEvent:"bb-legend-item-event",legendItemHidden:"bb-legend-item-hidden",legendItemPoint:"bb-legend-item-point",legendItemTile:"bb-legend-item-tile"},mt={chartLine:"bb-chart-line",chartLines:"bb-chart-lines",line:"bb-line",lines:"bb-lines"},_t={eventRect:"bb-event-rect",eventRects:"bb-event-rects",eventRectsMultiple:"bb-event-rects-multiple",eventRectsSingle:"bb-event-rects-single"},xt={focused:"bb-focused",defocused:"bb-defocused",legendItemFocused:"bb-legend-item-focused",xgridFocus:"bb-xgrid-focus",ygridFocus:"bb-ygrid-focus"},yt={grid:"bb-grid",gridLines:"bb-grid-lines",xgrid:"bb-xgrid",xgridLine:"bb-xgrid-line",xgridLines:"bb-xgrid-lines",xgrids:"bb-xgrids",ygrid:"bb-ygrid",ygridLine:"bb-ygrid-line",ygridLines:"bb-ygrid-lines",ygrids:"bb-ygrids"},de={level:"bb-level",levels:"bb-levels"},vt={chartRadar:"bb-chart-radar",chartRadars:"bb-chart-radars"},$t={region:"bb-region",regions:"bb-regions"},wt={selectedCircle:"bb-selected-circle",selectedCircles:"bb-selected-circles",SELECTED:"_selected_"},Et={shape:"bb-shape",shapes:"bb-shapes"},St={brush:"bb-brush",subchart:"bb-subchart"},Ct={chartText:"bb-chart-text",chartTexts:"bb-chart-texts",text:"bb-text",texts:"bb-texts",title:"bb-title",textBorderRect:"bb-text-border",textLabelImage:"bb-text-label-image",TextOverlapping:"text-overlapping"},S={tooltip:"bb-tooltip",tooltipContainer:"bb-tooltip-container",tooltipName:"bb-tooltip-name"},Rt={treemap:"bb-treemap",chartTreemap:"bb-chart-treemap",chartTreemaps:"bb-chart-treemaps"},Ot={buttonZoomReset:"bb-zoom-reset",zoomBrush:"bb-zoom-brush"};var be=u(u(u(u(u(u(u(u(u(u(u(u(u(u(u(u(u(u(u(u(u(u(u(u(u({},st),it),at),ct),lt),ut),dt),bt),ft),pt),gt),mt),_t),xt),ht),yt),vt),$t),wt),Et),St),Ct),S),Rt),Ot),fe=h(853),he=h(747);function Pt(){return typeof globalThis=="object"&&globalThis!==null&&globalThis.Object===Object&&globalThis||typeof global=="object"&&global!==null&&global.Object===Object&&global||typeof self=="object"&&self!==null&&self.Object===Object&&self||Function("return this")()}function Tt(t){const e=typeof(t==null?void 0:t.requestAnimationFrame)=="function"&&typeof(t==null?void 0:t.cancelAnimationFrame)=="function",n=typeof(t==null?void 0:t.requestIdleCallback)=="function"&&typeof(t==null?void 0:t.cancelIdleCallback)=="function",o=s=>setTimeout(s,1),r=s=>clearTimeout(s);return[e?t.requestAnimationFrame:o,e?t.cancelAnimationFrame:r,n?t.requestIdleCallback:o,n?t.cancelIdleCallback:r]}const $=Pt(),At=$==null?void 0:$.document,[pe,ge,me,_e]=Tt($);var Lt=Object.defineProperty,N=Object.getOwnPropertySymbols,Mt=Object.prototype.hasOwnProperty,jt=Object.prototype.propertyIsEnumerable,B=(t,e,n)=>e in t?Lt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,q=(t,e)=>{for(var n in e||(e={}))Mt.call(e,n)&&B(t,n,e[n]);if(N)for(var n of N(e))jt.call(e,n)&&B(t,n,e[n]);return t};function U(t,e,n=!1){const o=r=>r[t?"getBoundingClientRect":"getBBox"]();return n?o(e):!("rect"in e)||"rect"in e&&e.hasAttribute("width")&&e.rect.width!==+(e.getAttribute("width")||0)?e.rect=o(e):e.rect}function X(t,e){for(let n=0;n<t.length;n++){const o=t[n];o&&e(o,n)}}const xe=t=>t||t===0,C=t=>typeof t=="function",x=t=>typeof t=="string",R=t=>typeof t=="number",Ft=t=>typeof t=="undefined",V=t=>typeof t!="undefined",ye=t=>typeof t=="boolean",ve=t=>Math.ceil(t/10)*10,$e=t=>Math.ceil(t)+.5,we=t=>t[1]-t[0],O=t=>typeof t=="object",It=t=>{for(const e in t)return!1;return!0},Y=t=>Ft(t)||t===null||x(t)&&t.length===0||O(t)&&!(t instanceof Date)&&It(t)||R(t)&&isNaN(t),Dt=t=>!Y(t),P=t=>Array.isArray(t),y=t=>t&&!(t!=null&&t.nodeType)&&O(t)&&!P(t);function Ee(t,e,n){return V(t[e])?t[e]:n}function Se(t,e){let n=!1;return Object.keys(t).forEach(o=>t[o]===e&&(n=!0)),n}function Ce(t,e,...n){const o=C(t);return o&&t.call(e,...n),o}function Re(t,e){let n=0;const o=function(...r){!--n&&e.apply(this,...r)};"duration"in t?t.each(()=>++n).on("end",o):(++n,t.call(o))}function Oe(t,e,n=[-1,1],o=!1){if(!(!t||!x(e)))if(e.indexOf(`
12
+ `)===-1)t.text(e);else{const r=[t.text(),e].map(s=>s.replace(/[\s\n]/g,""));if(r[0]!==r[1]){const s=e.split(`
13
+ `),i=o?s.length-1:1;t.html(""),s.forEach((a,d)=>{t.append("tspan").attr("x",0).attr("dy",`${d===0?n[0]*i:n[1]}em`).text(a)})}}}function Nt(t){const{x:e,y:n,width:o,height:r}=t.getBBox();return[{x:e,y:n+r},{x:e,y:n},{x:e+o,y:n},{x:e+o,y:n+r}]}function Pe(t){const{width:e,height:n}=G(t),o=Nt(t),r=o[0].x,s=Math.min(o[0].y,o[1].y);return{x:r,y:s,width:e,height:n}}function Te(t,e){var n;const o=t&&((n=t.touches||t.sourceEvent&&t.sourceEvent.touches)==null?void 0:n[0]);let r=[0,0];try{r=d3Pointer(o||t,e)}catch(s){}return r.map(s=>isNaN(s)?0:s)}function Bt(t){const{event:e,$el:n}=t,o=n.subchart.main||n.main;let r;return e&&e.type==="brush"?r=e.selection:o&&(r=o.select(".bb-brush").node())&&(r=d3BrushSelection(r)),r}function G(t,e=!1){return U(!0,t,e)}function Ae(t,e=!1){return U(!1,t,e)}function Le(t=!0,e=0,n=1e4){const o=window.crypto||window.msCrypto,r=o?e+o.getRandomValues(new Uint32Array(1))[0]%(n-e+1):Math.floor(Math.random()*(n-e)+e);return t?String(r):r}function k(t,e,n,o,r){if(n>o)return-1;const s=Math.floor((n+o)/2);let{x:i,w:a=0}=t[s];return r&&(i=t[s].y,a=t[s].h),e>=i&&e<=i+a?s:e<i?k(t,e,n,s-1,r):k(t,e,s+1,o,r)}function Me(t){const e=Bt(t);return e?e[0]===e[1]:!0}function je(...t){const e=n=>{if(y(n)&&n.constructor){const o=new n.constructor;for(const r in n)o[r]=e(n[r]);return o}return n};return t.map(n=>e(n)).reduce((n,o)=>q(q({},n),o))}function qt(t={},e){P(e)&&e.forEach(n=>qt(t,n));for(const n in e)/^\d+$/.test(n)||n in t||(t[n]=e[n]);return t}const Fe=t=>t.charAt(0).toUpperCase()+t.slice(1);function Ie(t,e="-"){return t.split(e).map((n,o)=>o?n.charAt(0).toUpperCase()+n.slice(1).toLowerCase():n.toLowerCase()).join("")}const Ut=t=>[].slice.call(t);function De(t,e,n){const{rootSelector:o="",sheet:r}=t,i=`${o} ${(a=>a.replace(/\s?(bb-)/g,".$1").replace(/\.+/g,"."))(e)} {${n.join(";")}}`;return r[r.insertRule?"insertRule":"addRule"](i,r.cssRules.length)}function Ne(t){let e=[];return t.forEach(n=>{var o;try{n.cssRules&&n.cssRules.length&&(e=e.concat(Ut(n.cssRules)))}catch(r){(o=window.console)==null||o.warn(`Error while reading rules from ${n.href}: ${r.toString()}`)}}),e}function Be(t){var e,n,o,r,s,i;return{x:((n=(e=window.pageXOffset)!=null?e:window.scrollX)!=null?n:0)+((o=t.scrollLeft)!=null?o:0),y:((s=(r=window.pageYOffset)!=null?r:window.scrollY)!=null?s:0)+((i=t.scrollTop)!=null?i:0)}}function qe(t,e=0,n=0,o=!0){const r=new DOMPoint(e,n),s=t.getScreenCTM(),i=r.matrixTransform(o?s==null?void 0:s.inverse():s);if(o===!1){const a=G(t);i.x-=a.x,i.y-=a.y}return i}function Ue(t){const e=t?t.transform:null,n=e&&e.baseVal;return n&&n.numberOfItems?n.getItem(0).matrix:{a:0,b:0,c:0,d:0,e:0,f:0}}function Xe(t){const e=t[0]instanceof Date,n=(e?t.map(Number):t).filter((o,r,s)=>s.indexOf(o)===r);return e?n.map(o=>new Date(o)):n}function Ve(t){return t&&t.length?t.reduce((e,n)=>e.concat(n)):[]}function T(t,...e){if(!e.length||e.length===1&&!e[0])return t;const n=e.shift();return y(t)&&y(n)&&Object.keys(n).forEach(o=>{if(!/^(__proto__|constructor|prototype)$/i.test(o)){const r=n[o];y(r)?(!t[o]&&(t[o]={}),t[o]=T(t[o],r)):t[o]=P(r)?r.concat():r}}),T(t,...e)}function Xt(t,e=!0){let n;return t[0]instanceof Date?n=e?(o,r)=>o-r:(o,r)=>r-o:e&&!t.every(isNaN)?n=(o,r)=>o-r:e||(n=(o,r)=>o>r&&-1||o<r&&1||o===r&&0),t.concat().sort(n)}function Ye(t,e){let n=e.filter(o=>Dt(o));return n.length?R(n[0])?n=Math[t](...n):n[0]instanceof Date&&(n=Xt(n,t==="min")[0]):n=void 0,n}const Vt=(t,e,n=1)=>{const o=[],r=Math.max(0,Math.ceil((e-t)/n))|0;for(let s=t;s<r;s++)o.push(t+s*n);return o},Ge={mouse:(()=>{const t=()=>({bubbles:!1,cancelable:!1,screenX:0,screenY:0,clientX:0,clientY:0});try{return new MouseEvent("t"),(e,n,o=t())=>{e.dispatchEvent(new MouseEvent(n,o))}}catch(e){return(n,o,r=t())=>{const s=At.createEvent("MouseEvent");s.initMouseEvent(o,r.bubbles,r.cancelable,$,0,r.screenX,r.screenY,r.clientX,r.clientY,!1,!1,!1,!1,0,null),n.dispatchEvent(s)}}})(),touch:(t,e,n)=>{const o=new Touch(T({identifier:Date.now(),target:t,radiusX:2.5,radiusY:2.5,rotationAngle:10,force:.5},n));t.dispatchEvent(new TouchEvent(e,{cancelable:!0,bubbles:!0,shiftKey:!0,touches:[o],targetTouches:[],changedTouches:[o]}))}};function ke(t,e){let n=t;for(const o in e)n=n.replace(new RegExp(`{=${o}}`,"g"),e[o]);return sanitize(n)}function Yt(t){var e;let n;if(t instanceof Date)n=t;else if(x(t)){const{config:o,format:r}=this;n=(e=r.dataTime(o.data_xFormat)(t))!=null?e:new Date(t)}else R(t)&&!isNaN(t)&&(n=new Date(+t));return(!n||isNaN(+n))&&console&&console.error&&console.error(`Failed to parse x '${t}' to Date object`),n}function ze(t){const e=t.attr("viewBox");return e?/(\d+(\.\d+)?){3}/.test(e):!1}function He(t,e,n=!1){const o=!!t.node;let r=!1;for(const[s,i]of Object.entries(e))if(r=o?t.style(s)===i:t.style[s]===i,n===!1&&r)break;return r}function Ke(){var t,e;return((t=document)==null?void 0:t.hidden)===!1||((e=document)==null?void 0:e.visibilityState)==="visible"}function We(t,e){const{DocumentTouch:n,matchMedia:o,navigator:r}=window,s=o==null?void 0:o("(pointer:coarse)").matches;let i=!1;if(e)if(r&&"maxTouchPoints"in r)i=r.maxTouchPoints>0;else if("ontouchmove"in window||n&&document instanceof n)i=!0;else if(s)i=!0;else{const d=r.userAgent;i=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(d)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(d)}return t&&!s&&(o==null?void 0:o("(pointer:fine)").matches)&&"mouse"||i&&"touch"||"mouse"}function Gt(t,e){e()===!1?requestAnimationFrame(()=>Gt(t,e)):t()}function Ze(t){if(y(t)&&!x(t)){const i=t;return{top:i.top||0,right:i.right||0,bottom:i.bottom||0,left:i.left||0}}const e=(x(t)?t.trim().split(/\s+/):[t]).map(i=>+i||0),[n,o=n,r=n,s=o]=e;return{top:n,right:o,bottom:r,left:s}}function Je(t,e){t.pendingRaf!==null?(window.cancelAnimationFrame(t.pendingRaf),t.pendingRaf=window.requestAnimationFrame(()=>{t.pendingRaf=null,e()})):(t.pendingRaf=window.requestAnimationFrame(()=>{t.pendingRaf=null}),e())}function Qe(t,e=(n=>n)){const n=new Set;return X(t,(o,r)=>{n.add(e(o,r))}),n}function tn(t,e,n=(o=>o)){const o=new Map;return X(t,(r,s)=>{o.set(e(r,s),n(r,s))}),o}function kt(t){const e=this.config;let n,o,r;const s=()=>{const i=o.shift();if(i&&n&&O(n)&&i in n)return n=n[i],s();if(!i)return n};Object.keys(e).forEach(i=>{n=t,o=i.split("_"),r=s(),V(r)&&(e[i]=r)}),this.api&&(this.state.orgConfig=t)}var zt=Object.defineProperty,Ht=(t,e,n)=>e in t?zt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,A=(t,e,n)=>Ht(t,typeof e!="symbol"?e+"":e,n);class z{constructor(e={}){A(this,"$$"),A(this,"options"),this.options=e}$beforeInit(){}$init(){}$afterInit(){}$redraw(){}$willDestroy(){Object.keys(this).forEach(e=>{this[e]=null,delete this[e]})}}A(z,"version","3.18.0");var Kt=h(996),Wt=h(390),p={colorScale:"bb-colorscale",stanfordElements:"bb-stanford-elements",stanfordLine:"bb-stanford-line",stanfordLines:"bb-stanford-lines",stanfordRegion:"bb-stanford-region",stanfordRegions:"bb-stanford-regions"},Zt=Object.defineProperty,Jt=(t,e,n)=>e in t?Zt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,H=(t,e,n)=>Jt(t,typeof e!="symbol"?e+"":e,n);class Qt{constructor(e){H(this,"owner"),H(this,"colorScale"),this.owner=e}drawColorScale(){const{$$:e,config:n}=this.owner,o=e.data.targets[0],r=e.state.height-n.padding_bottom-n.padding_top,s=n.scale_width,i=5,a=Vt(n.padding_bottom,r,i),d=(0,E.scaleSequential)(o.colors).domain([a[a.length-1],a[0]]);this.colorScale&&this.colorScale.remove(),this.colorScale=e.$el.svg.append("g").attr("width",50).attr("height",r).attr("class",p.colorScale),this.colorScale.append("g").attr("transform",`translate(0, ${n.padding_top})`).selectAll("bars").data(a).enter().append("rect").attr("y",(m,ue)=>ue*i).attr("x",0).attr("width",s).attr("height",i).attr("fill",m=>d(m));const b=(0,E.scaleSymlog)().domain([o.minEpochs,o.maxEpochs]).range([a[0]+n.padding_top+a[a.length-1]+i-1,a[0]+n.padding_top]),c=(0,Kt.axisRight)(b),l=n.scale_format;l==="pow10"?c.tickValues([1,10,100,1e3,1e4,1e5,1e6,1e7]):C(l)?c.tickFormat(l):c.tickFormat((0,Wt.format)("d"));const g=this.colorScale.append("g").attr("class","legend axis").attr("transform",`translate(${s},0)`).call(c);l==="pow10"&&g.selectAll(".tick text").text(null).filter(m=>m/Math.pow(10,Math.ceil(Math.log(m)/Math.LN10-1e-12))===1).text(10).append("tspan").attr("dy","-.7em").text(m=>Math.round(Math.log(m)/Math.LN10)),this.colorScale.attr("transform",`translate(${e.state.current.width-this.xForColorScale()}, 0)`)}xForColorScale(){return this.owner.config.padding_right+this.colorScale.node().getBBox().width}getColorScalePadding(){return this.xForColorScale()+this.owner.config.padding_left+20}}function te(t,e){const n=t.x,o=t.value;let r=!1;for(let s=0,i=e.length-1;s<e.length;i=s++){const a=e[s].x,d=e[s].y,b=e[i].x,c=e[i].y;d>o!=c>o&&n<(b-a)*(o-d)/(c-d)+a&&(r=!r)}return r}function ee(t,e){return t.epochs<e.epochs?-1:t.epochs>e.epochs?1:0}function ne(t){let e=0,n,o;for(let r=0,s=t.length,i=s-1;r<s;i=r,r++)n=t[r],o=t[i],e+=n.x*o.y,e-=n.y*o.x;return e/=2,e}function w(t){const e=ne(t);let n=0,o=0,r;for(let s=0,i=t.length,a=i-1;s<i;a=s,s++){const d=t[s],b=t[a];r=d.x*b.y-b.x*d.y,n+=(d.x+b.x)*r,o+=(d.y+b.y)*r}return r=e*6,{x:n/r,y:o/r}}var oe=Object.defineProperty,re=(t,e,n)=>e in t?oe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,se=(t,e,n)=>re(t,typeof e!="symbol"?e+"":e,n);class ie{constructor(e){se(this,"owner"),this.owner=e;const n=e.$$.$el.main.select(".bb-chart").append("g").attr("class",p.stanfordElements);n.append("g").attr("class",p.stanfordLines),n.append("g").attr("class",p.stanfordRegions)}updateStanfordLines(e){const{$$:n}=this.owner,{config:o,$el:{main:r}}=n,s=o.axis_rotated,i=this.xvCustom.bind(n),a=this.yvCustom.bind(n),d=r.select(`.${p.stanfordLines}`).style("shape-rendering","geometricprecision").selectAll(`.${p.stanfordLine}`).data(this.owner.config.lines);d.exit().transition().duration(e).style("opacity","0").remove();const b=d.enter().append("g");b.append("line").style("opacity","0"),b.merge(d).attr("class",c=>p.stanfordLine+(c.class?` ${c.class}`:"")).select("line").transition().duration(e).attr("x1",c=>s?a(c,"y1"):i(c,"x1")).attr("x2",c=>s?a(c,"y2"):i(c,"x2")).attr("y1",c=>s?i(c,"x1"):a(c,"y1")).attr("y2",c=>s?i(c,"x2"):a(c,"y2")).transition().style("opacity",null)}updateStanfordRegions(e){const{$$:n}=this.owner,{config:o,$el:{main:r}}=n,s=o.axis_rotated,i=this.xvCustom.bind(n),a=this.yvCustom.bind(n),d=this.owner.countEpochsInRegion.bind(n);let b=r.select(`.${p.stanfordRegions}`).selectAll(`.${p.stanfordRegion}`).data(this.owner.config.regions);b.exit().transition().duration(e).style("opacity","0").remove();const c=b.enter().append("g");c.append("polygon").style("opacity","0"),c.append("text").attr("transform",s?"rotate(-90)":"").style("opacity","0"),b=c.merge(b),b.attr("class",l=>p.stanfordRegion+(l.class?` ${l.class}`:"")).select("polygon").transition().duration(e).attr("points",l=>l.points.map(g=>[s?a(g,"y"):i(g,"x"),s?i(g,"x"):a(g,"y")].join(",")).join(" ")).transition().style("opacity",l=>String(l.opacity?l.opacity:.2)),b.select("text").transition().duration(e).attr("x",l=>s?a(w(l.points),"y"):i(w(l.points),"x")).attr("y",l=>s?i(w(l.points),"x"):a(w(l.points),"y")).text(l=>{if(l.text){const{value:g,percentage:m}=d(l.points);return l.text(g,m)}return""}).attr("text-anchor","middle").attr("dominant-baseline","middle").transition().style("opacity",null)}updateStanfordElements(e=0){this.updateStanfordLines(e),this.updateStanfordRegions(e)}xvCustom(e,n){const o=this,{axis:r,config:s}=o;let i=n?e[n]:o.getBaseValue(e);return r.isTimeSeries()?i=Yt.call(o,i):r.isCategorized()&&x(i)&&(i=s.axis_x_categories.indexOf(e.value)),o.scale.x(i)}yvCustom(e,n){const o=this,r=e.axis&&e.axis==="y2"?o.scale.y2:o.scale.y,s=n?e[n]:o.getBaseValue(e);return r(s)}}class K{constructor(){return{colors:void 0,epochs:[],lines:[],scale_min:void 0,scale_max:void 0,scale_width:20,scale_format:void 0,padding_top:0,padding_right:0,padding_bottom:0,padding_left:0,regions:[]}}}var ae=Object.defineProperty,ce=(t,e,n)=>e in t?ae(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,L=(t,e,n)=>ce(t,typeof e!="symbol"?e+"":e,n);class le extends z{constructor(e){return super(e),L(this,"config"),L(this,"colorScale"),L(this,"elements"),this.config=new K,this}$beforeInit(){const{$$:e}=this;e.config.data_xSort=!1,e.isMultipleX=()=>!0,e.showGridFocus=()=>{},e.labelishData=o=>o.values,e.opacityForCircle=()=>1;const n=e.getCurrentPadding.bind(e);e.getCurrentPadding=()=>{const o=n();return o.right+=this.colorScale?this.colorScale.getColorScalePadding():0,o}}$init(){const{$$:e}=this;kt.call(this,this.options),e.color=this.getStanfordPointColor.bind(e),this.colorScale=new Qt(this),this.elements=new ie(this),this.convertData(),this.initStanfordData(),this.setStanfordTooltip(),this.colorScale.drawColorScale(),e.right+=this.colorScale?this.colorScale.getColorScalePadding():0,this.$redraw()}$redraw(e){var n,o;(n=this.colorScale)==null||n.drawColorScale(),(o=this.elements)==null||o.updateStanfordElements(e)}getOptions(){return new K}convertData(){const e=this.$$.data.targets,n=this.options.epochs;e.forEach(o=>{o.values.forEach((r,s)=>{r.epochs=n[s]}),o.minEpochs=void 0,o.maxEpochs=void 0,o.colors=void 0,o.colorscale=void 0})}initStanfordData(){const{config:e}=this,n=this.$$.data.targets[0];n.values.sort(ee);const o=n.values.map(r=>r.epochs);n.minEpochs=isNaN(e.scale_min)?Math.min(...o):e.scale_min,n.maxEpochs=isNaN(e.scale_max)?Math.max(...o):e.scale_max,n.colors=C(e.colors)?e.colors:(0,et.interpolateHslLong)((0,F.hsl)(250,1,.5),(0,F.hsl)(0,1,.5)),n.colorscale=(0,E.scaleSequentialLog)(n.colors).domain([n.minEpochs,n.maxEpochs])}getStanfordPointColor(e){return this.data.targets[0].colorscale(e.epochs)}setStanfordTooltip(){const{config:e}=this.$$;Y(e.tooltip_contents)&&(e.tooltip_contents=function(n,o,r,s){const{data_x:i}=e;let a=`<table class="${S.tooltip}"><tbody>`;return n.forEach(d=>{const{id:b="",value:c=0,epochs:l=0,x:g=""}=d;a+=`<tr>
14
+ <th>${i||""}</th>
15
15
  <th class="value">${o(g)}</th>
16
16
  </tr>
17
17
  <tr>
18
- <th>${u.id}</th>
19
- <th class="value">${r(l)}</th>
18
+ <th>${d.id}</th>
19
+ <th class="value">${r(c)}</th>
20
20
  </tr>
21
- <tr class="${C.tooltipName}-${d}">
22
- <td class="name"><span style="background-color:${s(u)}"></span>Epochs</td>
23
- <td class="value">${r(c)}</td>
24
- </tr>`}),`${i}</tbody></table>`})}countEpochsInRegion(t){const o=this.data.targets[0],r=o.values.reduce((a,i)=>a+Number(i.epochs),0),s=o.values.reduce((a,i)=>nt(i,t)?a+Number(i.epochs):a,0);return{value:s,percentage:s!==0?+(s/r*100).toFixed(1):0}}}return w=w.default,w})()});
21
+ <tr class="${S.tooltipName}-${b}">
22
+ <td class="name"><span style="background-color:${s(d)}"></span>Epochs</td>
23
+ <td class="value">${r(l)}</td>
24
+ </tr>`}),`${a}</tbody></table>`})}countEpochsInRegion(e){const o=this.data.targets[0],r=o.values.reduce((i,a)=>i+Number(a.epochs),0),s=o.values.reduce((i,a)=>te(a,e)?i+Number(a.epochs):i,0);return{value:s,percentage:s!==0?+(s/r*100).toFixed(1):0}}}return v=v.default,v})()});