billboard.js 3.18.0-next.1 → 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 (72) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +650 -199
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +10 -9
  5. package/dist/billboard.pkgd.js +2390 -1724
  6. package/dist/billboard.pkgd.min.js +22 -21
  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 +352 -36
  10. package/dist/plugin/billboardjs-plugin-sparkline.min.js +4 -4
  11. package/dist/plugin/billboardjs-plugin-stanford.js +352 -36
  12. package/dist/plugin/billboardjs-plugin-stanford.min.js +5 -5
  13. package/dist/plugin/billboardjs-plugin-tableview.js +352 -36
  14. package/dist/plugin/billboardjs-plugin-tableview.min.js +6 -5
  15. package/dist/plugin/billboardjs-plugin-textoverlap.js +352 -36
  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 +2094 -1563
  20. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +10 -10
  21. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +2095 -1564
  22. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +14 -14
  23. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +2096 -1565
  24. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +12 -11
  25. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +2097 -1566
  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 +889 -242
  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 +420 -28
  42. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  43. package/package.json +16 -16
  44. package/src/ChartInternal/ChartInternal.ts +1 -1
  45. package/src/ChartInternal/data/convert.ts +8 -7
  46. package/src/ChartInternal/data/data.ts +38 -3
  47. package/src/ChartInternal/interactions/drag.ts +53 -42
  48. package/src/ChartInternal/interactions/zoom.ts +23 -19
  49. package/src/ChartInternal/internals/color.ts +4 -4
  50. package/src/ChartInternal/internals/domain.ts +9 -4
  51. package/src/ChartInternal/internals/format.ts +3 -3
  52. package/src/ChartInternal/internals/grid.ts +10 -10
  53. package/src/ChartInternal/internals/legend.ts +78 -17
  54. package/src/ChartInternal/internals/text.ts +37 -8
  55. package/src/ChartInternal/internals/text.util.ts +19 -0
  56. package/src/ChartInternal/internals/title.ts +3 -3
  57. package/src/ChartInternal/internals/tooltip.ts +11 -9
  58. package/src/ChartInternal/shape/arc.ts +15 -15
  59. package/src/ChartInternal/shape/bar.ts +5 -4
  60. package/src/ChartInternal/shape/funnel.ts +17 -17
  61. package/src/ChartInternal/shape/line.ts +5 -6
  62. package/src/ChartInternal/shape/point.common.ts +23 -5
  63. package/src/ChartInternal/shape/radar.ts +2 -2
  64. package/src/ChartInternal/shape/shape.ts +21 -3
  65. package/src/config/Options/axis/y2.ts +0 -13
  66. package/src/config/Options/common/legend.ts +2 -0
  67. package/src/config/Options/common/point.ts +1 -0
  68. package/src/config/Options/common/tooltip.ts +4 -1
  69. package/src/config/Store/State.ts +11 -1
  70. package/src/module/Cache.ts +26 -1
  71. package/src/module/sanitize.ts +471 -0
  72. package/src/module/util.ts +192 -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.1
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;
@@ -366,6 +668,23 @@ var util_spreadValues = (a, b) => {
366
668
 
367
669
 
368
670
 
671
+ function _getRect(relativeViewport, node, forceEval = false) {
672
+ const _ = (n) => n[relativeViewport ? "getBoundingClientRect" : "getBBox"]();
673
+ if (forceEval) {
674
+ return _(node);
675
+ } else {
676
+ const needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +(node.getAttribute("width") || 0);
677
+ return needEvaluate ? node.rect = _(node) : node.rect;
678
+ }
679
+ }
680
+ function _forEachValidItem(items, callback) {
681
+ for (let i = 0; i < items.length; i++) {
682
+ const item = items[i];
683
+ if (item) {
684
+ callback(item, i);
685
+ }
686
+ }
687
+ }
369
688
  const isValue = (v) => v || v === 0;
370
689
  const isFunction = (v) => typeof v === "function";
371
690
  const isString = (v) => typeof v === "string";
@@ -412,29 +731,6 @@ function endall(transition, cb) {
412
731
  transition.call(end);
413
732
  }
414
733
  }
415
- const DANGEROUS_TAGS = "script|iframe|object|embed|form|input|button|textarea|select|style|link|meta|base|math|isindex";
416
- const sanitizeRx = {
417
- tags: new RegExp(
418
- `<(${DANGEROUS_TAGS})\\b[\\s\\S]*?>([\\s\\S]*?<\\/(${DANGEROUS_TAGS})\\s*>)?`,
419
- "gi"
420
- ),
421
- // Handles: whitespace, slash, quotes before event handlers (e.g., <img/onerror=...>, <img src="x"onerror=...>)
422
- eventHandlers: /[\s/"']+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,
423
- // Handles: javascript/data/vbscript URIs with optional whitespace/newlines between protocol and colon
424
- dangerousURIs: /(href|src|action|xlink:href)\s*=\s*["']?\s*(javascript|data|vbscript)\s*:/gi
425
- };
426
- function sanitize(str) {
427
- if (!isString(str) || !str || str.indexOf("<") === -1) {
428
- return str;
429
- }
430
- let result = str;
431
- let prev;
432
- do {
433
- prev = result;
434
- result = result.replace(sanitizeRx.tags, "").replace(sanitizeRx.eventHandlers, "").replace(sanitizeRx.dangerousURIs, '$1=""');
435
- } while (result !== prev);
436
- return result;
437
- }
438
734
  function setTextValue(node, text, dy = [-1, 1], toMiddle = false) {
439
735
  if (!node || !isString(text)) {
440
736
  return;
@@ -499,20 +795,11 @@ function getBrushSelection(ctx) {
499
795
  }
500
796
  return selection;
501
797
  }
502
- function getRect(relativeViewport, node, forceEval = false) {
503
- const _ = (n) => n[relativeViewport ? "getBoundingClientRect" : "getBBox"]();
504
- if (forceEval) {
505
- return _(node);
506
- } else {
507
- const needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +(node.getAttribute("width") || 0);
508
- return needEvaluate ? node.rect = _(node) : node.rect;
509
- }
510
- }
511
798
  function getBoundingRect(node, forceEval = false) {
512
- return getRect(true, node, forceEval);
799
+ return _getRect(true, node, forceEval);
513
800
  }
514
801
  function getBBox(node, forceEval = false) {
515
- return getRect(false, node, forceEval);
802
+ return _getRect(false, node, forceEval);
516
803
  }
517
804
  function getRandom(asStr = true, min = 0, max = 1e4) {
518
805
  const crpt = win.crypto || win.msCrypto;
@@ -824,6 +1111,35 @@ function parseShorthand(value) {
824
1111
  const [a, b = a, c = a, d = b] = values;
825
1112
  return { top: a, right: b, bottom: c, left: d };
826
1113
  }
1114
+ function scheduleRAFUpdate(rafState, callback) {
1115
+ if (rafState.pendingRaf !== null) {
1116
+ win.cancelAnimationFrame(rafState.pendingRaf);
1117
+ rafState.pendingRaf = win.requestAnimationFrame(() => {
1118
+ rafState.pendingRaf = null;
1119
+ callback();
1120
+ });
1121
+ } else {
1122
+ rafState.pendingRaf = win.requestAnimationFrame(() => {
1123
+ rafState.pendingRaf = null;
1124
+ });
1125
+ callback();
1126
+ }
1127
+ }
1128
+ function toSet(items, keyFn = ((item) => item)) {
1129
+ const set = /* @__PURE__ */ new Set();
1130
+ _forEachValidItem(items, (item, i) => {
1131
+ set.add(keyFn(item, i));
1132
+ });
1133
+ return set;
1134
+ }
1135
+ function toMap(items, keyFn, valueFn = ((item) => item)) {
1136
+ const map = /* @__PURE__ */ new Map();
1137
+ _forEachValidItem(items, (item, i) => {
1138
+ map.set(keyFn(item, i), valueFn(item, i));
1139
+ });
1140
+ return map;
1141
+ }
1142
+
827
1143
 
828
1144
  ;// ./src/config/config.ts
829
1145
 
@@ -905,7 +1221,7 @@ class Plugin {
905
1221
  });
906
1222
  }
907
1223
  }
908
- __publicField(Plugin, "version", "3.18.0-next.1");
1224
+ __publicField(Plugin, "version", "3.18.0");
909
1225
 
910
1226
  // EXTERNAL MODULE: external {"commonjs":"d3-axis","commonjs2":"d3-axis","amd":"d3-axis","root":"d3"}
911
1227
  var external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_ = __webpack_require__(8);
@@ -5,13 +5,13 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.18.0-next.1
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(M,f,x,Z,J,Q,tt){return(function(){"use strict";var et={218:(function(t){t.exports=M}),390:(function(t){t.exports=tt}),455:(function(t){t.exports=x}),747:(function(t){t.exports=J}),798:(function(t){t.exports=f}),853:(function(t){t.exports=Z}),996:(function(t){t.exports=Q})},I={};function h(t){var e=I[t];if(e!==void 0)return e.exports;var n=I[t]={exports:{}};return et[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 de}});var D=h(218),nt=h(798),E=h(455),ot=Object.defineProperty,N=Object.getOwnPropertySymbols,rt=Object.prototype.hasOwnProperty,st=Object.prototype.propertyIsEnumerable,F=(t,e,n)=>e in t?ot(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,u=(t,e)=>{for(var n in e||(e={}))rt.call(e,n)&&F(t,n,e[n]);if(N)for(var n of N(e))st.call(e,n)&&F(t,n,e[n]);return t};const at={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"},ct={area:"bb-area",areas:"bb-areas"},lt={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"},ut={bar:"bb-bar",bars:"bb-bars",chartBar:"bb-chart-bar",chartBars:"bb-chart-bars",barConnectLine:"bb-bar-connectLine"},dt={candlestick:"bb-candlestick",candlesticks:"bb-candlesticks",chartCandlestick:"bb-chart-candlestick",chartCandlesticks:"bb-chart-candlesticks",valueDown:"bb-value-down",valueUp:"bb-value-up"},bt={chartCircles:"bb-chart-circles",circle:"bb-circle",circles:"bb-circles"},ft={colorPattern:"bb-color-pattern",colorScale:"bb-colorscale"},ht={dragarea:"bb-dragarea",INCLUDED:"_included_"},pt={funnel:"bb-funnel",chartFunnel:"bb-chart-funnel",chartFunnels:"bb-chart-funnels",funnelBackground:"bb-funnel-background"},gt={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"},mt={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"},_t={chartLine:"bb-chart-line",chartLines:"bb-chart-lines",line:"bb-line",lines:"bb-lines"},xt={eventRect:"bb-event-rect",eventRects:"bb-event-rects",eventRectsMultiple:"bb-event-rects-multiple",eventRectsSingle:"bb-event-rects-single"},yt={focused:"bb-focused",defocused:"bb-defocused",legendItemFocused:"bb-legend-item-focused",xgridFocus:"bb-xgrid-focus",ygridFocus:"bb-ygrid-focus"},vt={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"},fe={level:"bb-level",levels:"bb-levels"},$t={chartRadar:"bb-chart-radar",chartRadars:"bb-chart-radars"},wt={region:"bb-region",regions:"bb-regions"},Et={selectedCircle:"bb-selected-circle",selectedCircles:"bb-selected-circles",SELECTED:"_selected_"},St={shape:"bb-shape",shapes:"bb-shapes"},Ct={brush:"bb-brush",subchart:"bb-subchart"},Ot={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"},Pt={treemap:"bb-treemap",chartTreemap:"bb-chart-treemap",chartTreemaps:"bb-chart-treemaps"},Rt={buttonZoomReset:"bb-zoom-reset",zoomBrush:"bb-zoom-brush"};var he=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({},at),it),ct),lt),ut),dt),bt),ft),ht),gt),mt),_t),xt),yt),pt),vt),$t),wt),Et),St),Ct),Ot),S),Pt),Rt),pe=h(853),ge=h(747);function Tt(){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 At(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 $=Tt(),Lt=$==null?void 0:$.document,[me,_e,xe,ye]=At($);var jt=Object.defineProperty,B=Object.getOwnPropertySymbols,Mt=Object.prototype.hasOwnProperty,It=Object.prototype.propertyIsEnumerable,q=(t,e,n)=>e in t?jt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,U=(t,e)=>{for(var n in e||(e={}))Mt.call(e,n)&&q(t,n,e[n]);if(B)for(var n of B(e))It.call(e,n)&&q(t,n,e[n]);return t};const ve=t=>t||t===0,C=t=>typeof t=="function",_=t=>typeof t=="string",O=t=>typeof t=="number",Dt=t=>typeof t=="undefined",X=t=>typeof t!="undefined",$e=t=>typeof t=="boolean",we=t=>Math.ceil(t/10)*10,Ee=t=>Math.ceil(t)+.5,Se=t=>t[1]-t[0],P=t=>typeof t=="object",Nt=t=>{for(const e in t)return!1;return!0},G=t=>Dt(t)||t===null||_(t)&&t.length===0||P(t)&&!(t instanceof Date)&&Nt(t)||O(t)&&isNaN(t),Ft=t=>!G(t),R=t=>Array.isArray(t),y=t=>t&&!(t!=null&&t.nodeType)&&P(t)&&!R(t);function Ce(t,e,n){return X(t[e])?t[e]:n}function Oe(t,e){let n=!1;return Object.keys(t).forEach(o=>t[o]===e&&(n=!0)),n}function Pe(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))}const Y="script|iframe|object|embed|form|input|button|textarea|select|style|link|meta|base|math|isindex",T={tags:new RegExp(`<(${Y})\\b[\\s\\S]*?>([\\s\\S]*?<\\/(${Y})\\s*>)?`,"gi"),eventHandlers:/[\s/"']+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,dangerousURIs:/(href|src|action|xlink:href)\s*=\s*["']?\s*(javascript|data|vbscript)\s*:/gi};function Bt(t){if(!_(t)||!t||t.indexOf("<")===-1)return t;let e=t,n;do n=e,e=e.replace(T.tags,"").replace(T.eventHandlers,"").replace(T.dangerousURIs,'$1=""');while(e!==n);return e}function Te(t,e,n=[-1,1],o=!1){if(!(!t||!_(e)))if(e.indexOf(`
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
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
- `),a=o?s.length-1:1;t.html(""),s.forEach((i,d)=>{t.append("tspan").attr("x",0).attr("dy",`${d===0?n[0]*a:n[1]}em`).text(i)})}}}function qt(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 Ae(t){const{width:e,height:n}=k(t),o=qt(t),r=o[0].x,s=Math.min(o[0].y,o[1].y);return{x:r,y:s,width:e,height:n}}function Le(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 Ut(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 V(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 k(t,e=!1){return V(!0,t,e)}function je(t,e=!1){return V(!1,t,e)}function Me(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 z(t,e,n,o,r){if(n>o)return-1;const s=Math.floor((n+o)/2);let{x:a,w:i=0}=t[s];return r&&(a=t[s].y,i=t[s].h),e>=a&&e<=a+i?s:e<a?z(t,e,n,s-1,r):z(t,e,s+1,o,r)}function Ie(t){const e=Ut(t);return e?e[0]===e[1]:!0}function De(...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)=>U(U({},n),o))}function Xt(t={},e){R(e)&&e.forEach(n=>Xt(t,n));for(const n in e)/^\d+$/.test(n)||n in t||(t[n]=e[n]);return t}const Ne=t=>t.charAt(0).toUpperCase()+t.slice(1);function Fe(t,e="-"){return t.split(e).map((n,o)=>o?n.charAt(0).toUpperCase()+n.slice(1).toLowerCase():n.toLowerCase()).join("")}const Gt=t=>[].slice.call(t);function Be(t,e,n){const{rootSelector:o="",sheet:r}=t,a=`${o} ${(i=>i.replace(/\s?(bb-)/g,".$1").replace(/\.+/g,"."))(e)} {${n.join(";")}}`;return r[r.insertRule?"insertRule":"addRule"](a,r.cssRules.length)}function qe(t){let e=[];return t.forEach(n=>{var o;try{n.cssRules&&n.cssRules.length&&(e=e.concat(Gt(n.cssRules)))}catch(r){(o=window.console)==null||o.warn(`Error while reading rules from ${n.href}: ${r.toString()}`)}}),e}function Ue(t){var e,n,o,r,s,a;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)+((a=t.scrollTop)!=null?a:0)}}function Xe(t,e=0,n=0,o=!0){const r=new DOMPoint(e,n),s=t.getScreenCTM(),a=r.matrixTransform(o?s==null?void 0:s.inverse():s);if(o===!1){const i=k(t);a.x-=i.x,a.y-=i.y}return a}function Ge(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 Ye(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 A(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]=A(t[o],r)):t[o]=R(r)?r.concat():r}}),A(t,...e)}function Yt(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 ke(t,e){let n=e.filter(o=>Ft(o));return n.length?O(n[0])?n=Math[t](...n):n[0]instanceof Date&&(n=Yt(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},ze={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=Lt.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(A({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 He(t,e){let n=t;for(const o in e)n=n.replace(new RegExp(`{=${o}}`,"g"),e[o]);return Bt(n)}function kt(t){var e;let n;if(t instanceof Date)n=t;else if(_(t)){const{config:o,format:r}=this;n=(e=r.dataTime(o.data_xFormat)(t))!=null?e:new Date(t)}else O(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 Ke(t){const e=t.attr("viewBox");return e?/(\d+(\.\d+)?){3}/.test(e):!1}function We(t,e,n=!1){const o=!!t.node;let r=!1;for(const[s,a]of Object.entries(e))if(r=o?t.style(s)===a:t.style[s]===a,n===!1&&r)break;return r}function Ze(){var t,e;return((t=document)==null?void 0:t.hidden)===!1||((e=document)==null?void 0:e.visibilityState)==="visible"}function Je(t,e){const{DocumentTouch:n,matchMedia:o,navigator:r}=window,s=o==null?void 0:o("(pointer:coarse)").matches;let a=!1;if(e)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 d=r.userAgent;a=/\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"||a&&"touch"||"mouse"}function zt(t,e){e()===!1?requestAnimationFrame(()=>zt(t,e)):t()}function Qe(t){if(y(t)&&!_(t)){const a=t;return{top:a.top||0,right:a.right||0,bottom:a.bottom||0,left:a.left||0}}const e=(_(t)?t.trim().split(/\s+/):[t]).map(a=>+a||0),[n,o=n,r=n,s=o]=e;return{top:n,right:o,bottom:r,left:s}}function Ht(t){const e=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(e).forEach(a=>{n=t,o=a.split("_"),r=s(),X(r)&&(e[a]=r)}),this.api&&(this.state.orgConfig=t)}var Kt=Object.defineProperty,Wt=(t,e,n)=>e in t?Kt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,L=(t,e,n)=>Wt(t,typeof e!="symbol"?e+"":e,n);class H{constructor(e={}){L(this,"$$"),L(this,"options"),this.options=e}$beforeInit(){}$init(){}$afterInit(){}$redraw(){}$willDestroy(){Object.keys(this).forEach(e=>{this[e]=null,delete this[e]})}}L(H,"version","3.18.0-next.1");var Zt=h(996),Jt=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"},Qt=Object.defineProperty,te=(t,e,n)=>e in t?Qt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,K=(t,e,n)=>te(t,typeof e!="symbol"?e+"":e,n);class ee{constructor(e){K(this,"owner"),K(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,a=5,i=Vt(n.padding_bottom,r,a),d=(0,E.scaleSequential)(o.colors).domain([i[i.length-1],i[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(i).enter().append("rect").attr("y",(m,be)=>be*a).attr("x",0).attr("width",s).attr("height",a).attr("fill",m=>d(m));const b=(0,E.scaleSymlog)().domain([o.minEpochs,o.maxEpochs]).range([i[0]+n.padding_top+i[i.length-1]+a-1,i[0]+n.padding_top]),c=(0,Zt.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,Jt.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 ne(t,e){const n=t.x,o=t.value;let r=!1;for(let s=0,a=e.length-1;s<e.length;a=s++){const i=e[s].x,d=e[s].y,b=e[a].x,c=e[a].y;d>o!=c>o&&n<(b-i)*(o-d)/(c-d)+i&&(r=!r)}return r}function oe(t,e){return t.epochs<e.epochs?-1:t.epochs>e.epochs?1:0}function re(t){let e=0,n,o;for(let r=0,s=t.length,a=s-1;r<s;a=r,r++)n=t[r],o=t[a],e+=n.x*o.y,e-=n.y*o.x;return e/=2,e}function w(t){const e=re(t);let n=0,o=0,r;for(let s=0,a=t.length,i=a-1;s<a;i=s,s++){const d=t[s],b=t[i];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 se=Object.defineProperty,ae=(t,e,n)=>e in t?se(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ie=(t,e,n)=>ae(t,typeof e!="symbol"?e+"":e,n);class ce{constructor(e){ie(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,a=this.xvCustom.bind(n),i=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?i(c,"y1"):a(c,"x1")).attr("x2",c=>s?i(c,"y2"):a(c,"x2")).attr("y1",c=>s?a(c,"x1"):i(c,"y1")).attr("y2",c=>s?a(c,"x2"):i(c,"y2")).transition().style("opacity",null)}updateStanfordRegions(e){const{$$:n}=this.owner,{config:o,$el:{main:r}}=n,s=o.axis_rotated,a=this.xvCustom.bind(n),i=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?i(g,"y"):a(g,"x"),s?a(g,"x"):i(g,"y")].join(",")).join(" ")).transition().style("opacity",l=>String(l.opacity?l.opacity:.2)),b.select("text").transition().duration(e).attr("x",l=>s?i(w(l.points),"y"):a(w(l.points),"x")).attr("y",l=>s?a(w(l.points),"x"):i(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 a=n?e[n]:o.getBaseValue(e);return r.isTimeSeries()?a=kt.call(o,a):r.isCategorized()&&_(a)&&(a=s.axis_x_categories.indexOf(e.value)),o.scale.x(a)}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 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 le=Object.defineProperty,ue=(t,e,n)=>e in t?le(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,j=(t,e,n)=>ue(t,typeof e!="symbol"?e+"":e,n);class de extends H{constructor(e){return super(e),j(this,"config"),j(this,"colorScale"),j(this,"elements"),this.config=new W,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;Ht.call(this,this.options),e.color=this.getStanfordPointColor.bind(e),this.colorScale=new ee(this),this.elements=new ce(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 W}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(oe);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,nt.interpolateHslLong)((0,D.hsl)(250,1,.5),(0,D.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.$$;G(e.tooltip_contents)&&(e.tooltip_contents=function(n,o,r,s){const{data_x:a}=e;let i=`<table class="${S.tooltip}"><tbody>`;return n.forEach(d=>{const{id:b="",value:c=0,epochs:l=0,x:g=""}=d;i+=`<tr>
14
- <th>${a||""}</th>
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>
@@ -21,4 +21,4 @@
21
21
  <tr class="${S.tooltipName}-${b}">
22
22
  <td class="name"><span style="background-color:${s(d)}"></span>Epochs</td>
23
23
  <td class="value">${r(l)}</td>
24
- </tr>`}),`${i}</tbody></table>`})}countEpochsInRegion(e){const o=this.data.targets[0],r=o.values.reduce((a,i)=>a+Number(i.epochs),0),s=o.values.reduce((a,i)=>ne(i,e)?a+Number(i.epochs):a,0);return{value:s,percentage:s!==0?+(s/r*100).toFixed(1):0}}}return v=v.default,v})()});
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})()});