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.
- package/dist/billboard.css +1 -1
- package/dist/billboard.js +650 -199
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +10 -9
- package/dist/billboard.pkgd.js +2390 -1724
- package/dist/billboard.pkgd.min.js +22 -21
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +352 -36
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-stanford.js +352 -36
- package/dist/plugin/billboardjs-plugin-stanford.min.js +5 -5
- package/dist/plugin/billboardjs-plugin-tableview.js +352 -36
- package/dist/plugin/billboardjs-plugin-tableview.min.js +6 -5
- package/dist/plugin/billboardjs-plugin-textoverlap.js +352 -36
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +4 -4
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +1743 -1528
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +8 -8
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +2094 -1563
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +10 -10
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +2095 -1564
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +14 -14
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +2096 -1565
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +12 -11
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +2097 -1566
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +10 -10
- package/dist/theme/dark.css +1 -1
- package/dist/theme/dark.min.css +1 -1
- package/dist/theme/datalab.css +1 -1
- package/dist/theme/datalab.min.css +1 -1
- package/dist/theme/graph.css +1 -1
- package/dist/theme/graph.min.css +1 -1
- package/dist/theme/insight.css +1 -1
- package/dist/theme/insight.min.css +1 -1
- package/dist/theme/modern.css +1 -1
- package/dist/theme/modern.min.css +1 -1
- package/dist-esm/billboard.js +889 -242
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +420 -28
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/package.json +16 -16
- package/src/ChartInternal/ChartInternal.ts +1 -1
- package/src/ChartInternal/data/convert.ts +8 -7
- package/src/ChartInternal/data/data.ts +38 -3
- package/src/ChartInternal/interactions/drag.ts +53 -42
- package/src/ChartInternal/interactions/zoom.ts +23 -19
- package/src/ChartInternal/internals/color.ts +4 -4
- package/src/ChartInternal/internals/domain.ts +9 -4
- package/src/ChartInternal/internals/format.ts +3 -3
- package/src/ChartInternal/internals/grid.ts +10 -10
- package/src/ChartInternal/internals/legend.ts +78 -17
- package/src/ChartInternal/internals/text.ts +37 -8
- package/src/ChartInternal/internals/text.util.ts +19 -0
- package/src/ChartInternal/internals/title.ts +3 -3
- package/src/ChartInternal/internals/tooltip.ts +11 -9
- package/src/ChartInternal/shape/arc.ts +15 -15
- package/src/ChartInternal/shape/bar.ts +5 -4
- package/src/ChartInternal/shape/funnel.ts +17 -17
- package/src/ChartInternal/shape/line.ts +5 -6
- package/src/ChartInternal/shape/point.common.ts +23 -5
- package/src/ChartInternal/shape/radar.ts +2 -2
- package/src/ChartInternal/shape/shape.ts +21 -3
- package/src/config/Options/axis/y2.ts +0 -13
- package/src/config/Options/common/legend.ts +2 -0
- package/src/config/Options/common/point.ts +1 -0
- package/src/config/Options/common/tooltip.ts +4 -1
- package/src/config/Store/State.ts +11 -1
- package/src/module/Cache.ts +26 -1
- package/src/module/sanitize.ts +471 -0
- 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
|
|
8
|
+
* @version 3.18.0
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -135,7 +135,7 @@ class Plugin {
|
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
__publicField(Plugin, "version", "3.18.0
|
|
138
|
+
__publicField(Plugin, "version", "3.18.0");
|
|
139
139
|
|
|
140
140
|
;// ./src/Plugin/bubblecompare/index.ts
|
|
141
141
|
var bubblecompare_defProp = Object.defineProperty;
|
|
@@ -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
|
|
8
|
+
* @version 3.18.0
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
|
-
*/(function(n,i){typeof exports=="object"&&typeof module=="object"?module.exports=i(require("d3-selection")):typeof define=="function"&&define.amd?define("bb",["d3-selection"],i):typeof exports=="object"?exports.bb=i(require("d3-selection")):(n.bb=n.bb||{},n.bb.plugin=n.bb.plugin||{},n.bb.plugin.bubblecompare=i(n.d3))})(this,function(p){return(function(){"use strict";var n={747:(function(r){r.exports=p})},i={};function s(r){var e=i[r];if(e!==void 0)return e.exports;var t=i[r]={exports:{}};return n[r](t,t.exports,s),t.exports}(function(){s.d=function(r,e){for(var t in e)s.o(e,t)&&!s.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:e[t]})}})(),(function(){s.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)}})();var b={};s.d(b,{default:function(){return R}});var $=s(747),g=Object.defineProperty,
|
|
11
|
+
*/(function(n,i){typeof exports=="object"&&typeof module=="object"?module.exports=i(require("d3-selection")):typeof define=="function"&&define.amd?define("bb",["d3-selection"],i):typeof exports=="object"?exports.bb=i(require("d3-selection")):(n.bb=n.bb||{},n.bb.plugin=n.bb.plugin||{},n.bb.plugin.bubblecompare=i(n.d3))})(this,function(p){return(function(){"use strict";var n={747:(function(r){r.exports=p})},i={};function s(r){var e=i[r];if(e!==void 0)return e.exports;var t=i[r]={exports:{}};return n[r](t,t.exports,s),t.exports}(function(){s.d=function(r,e){for(var t in e)s.o(e,t)&&!s.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:e[t]})}})(),(function(){s.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)}})();var b={};s.d(b,{default:function(){return R}});var $=s(747),g=Object.defineProperty,v=(r,e,t)=>e in r?g(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,l=(r,e,t)=>v(r,typeof e!="symbol"?e+"":e,t);class d{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(d,"version","3.18.0");var x=Object.defineProperty,B=(r,e,t)=>e in r?x(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,_=(r,e,t)=>B(r,typeof e!="symbol"?e+"":e,t);const f=class m extends d{constructor(e){return super(e),_(this,"$$"),this}$init(){const{$$:e}=this;e.findClosest=this.findClosest.bind(this),e.getBubbleR=this.getBubbleR.bind(this),e.pointExpandedR=this.pointExpandedR.bind(this)}pointExpandedR(e){const t=this.getBubbleR(e),{expandScale:a=1}=this.options;return m.raiseFocusedBubbleLayer(e),this.changeCursorPoint(),t*a}static raiseFocusedBubbleLayer(e){e.raise&&(0,$.select)(e.node().parentNode.parentNode).raise()}changeCursorPoint(){this.$$.$el.eventRect.style("cursor","pointer")}findClosest(e,t){const{$$:a}=this;return e.filter(o=>o&&!a.isBarType(o.id)).reduce((o,u)=>a.dist(u,t)<this.getBubbleR(u)?u:o,0)}getBubbleR(e){const{minR:t,maxR:a}=this.options,o=this.getZData(e);if(!o)return t;const[u,c]=this.$$.data.targets.reduce(([w,C],j)=>{const h=this.getZData(j.values[0]);return[Math.min(w,h),Math.max(C,h)]},[1e4,0]),P=u>0&&c===u?0:o/c;return Math.abs(P)*(a-t)+t}getZData(e){return this.$$.isBubbleZType(e)?this.$$.getBubbleZData(e.value,"z"):e.value}};_(f,"version","0.0.1");let R=f;return b=b.default,b})()});
|
|
@@ -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
|
|
8
|
+
* @version 3.18.0
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -308,6 +308,308 @@ const [
|
|
|
308
308
|
] = getFallback(win);
|
|
309
309
|
|
|
310
310
|
|
|
311
|
+
;// ./src/module/sanitize.ts
|
|
312
|
+
const ALLOWED_TAGS = /* @__PURE__ */ new Set([
|
|
313
|
+
// HTML tags for tooltip/legend templates
|
|
314
|
+
"span",
|
|
315
|
+
"div",
|
|
316
|
+
"p",
|
|
317
|
+
"br",
|
|
318
|
+
"b",
|
|
319
|
+
"i",
|
|
320
|
+
"em",
|
|
321
|
+
"strong",
|
|
322
|
+
"u",
|
|
323
|
+
"s",
|
|
324
|
+
"sub",
|
|
325
|
+
"sup",
|
|
326
|
+
"ul",
|
|
327
|
+
"ol",
|
|
328
|
+
"li",
|
|
329
|
+
"dl",
|
|
330
|
+
"dt",
|
|
331
|
+
"dd",
|
|
332
|
+
"table",
|
|
333
|
+
"thead",
|
|
334
|
+
"tbody",
|
|
335
|
+
"tfoot",
|
|
336
|
+
"tr",
|
|
337
|
+
"th",
|
|
338
|
+
"td",
|
|
339
|
+
"caption",
|
|
340
|
+
"colgroup",
|
|
341
|
+
"col",
|
|
342
|
+
"hr",
|
|
343
|
+
"pre",
|
|
344
|
+
"code",
|
|
345
|
+
"blockquote",
|
|
346
|
+
"a",
|
|
347
|
+
"img",
|
|
348
|
+
// SVG tags for point patterns
|
|
349
|
+
"svg",
|
|
350
|
+
"g",
|
|
351
|
+
"path",
|
|
352
|
+
"circle",
|
|
353
|
+
"ellipse",
|
|
354
|
+
"rect",
|
|
355
|
+
"line",
|
|
356
|
+
"polyline",
|
|
357
|
+
"polygon",
|
|
358
|
+
"text",
|
|
359
|
+
"tspan",
|
|
360
|
+
"textPath",
|
|
361
|
+
"use",
|
|
362
|
+
"defs",
|
|
363
|
+
"symbol",
|
|
364
|
+
"clipPath",
|
|
365
|
+
"mask",
|
|
366
|
+
"linearGradient",
|
|
367
|
+
"radialGradient",
|
|
368
|
+
"stop",
|
|
369
|
+
"pattern",
|
|
370
|
+
"marker",
|
|
371
|
+
"title",
|
|
372
|
+
"desc"
|
|
373
|
+
]);
|
|
374
|
+
const ALLOWED_ATTRS = /* @__PURE__ */ new Set([
|
|
375
|
+
// Common attributes
|
|
376
|
+
"class",
|
|
377
|
+
"id",
|
|
378
|
+
"style",
|
|
379
|
+
"title",
|
|
380
|
+
"lang",
|
|
381
|
+
"dir",
|
|
382
|
+
// HTML specific
|
|
383
|
+
"href",
|
|
384
|
+
"src",
|
|
385
|
+
"alt",
|
|
386
|
+
"width",
|
|
387
|
+
"height",
|
|
388
|
+
"colspan",
|
|
389
|
+
"rowspan",
|
|
390
|
+
"scope",
|
|
391
|
+
"headers",
|
|
392
|
+
// SVG presentation attributes
|
|
393
|
+
"d",
|
|
394
|
+
"points",
|
|
395
|
+
"x",
|
|
396
|
+
"y",
|
|
397
|
+
"x1",
|
|
398
|
+
"x2",
|
|
399
|
+
"y1",
|
|
400
|
+
"y2",
|
|
401
|
+
"cx",
|
|
402
|
+
"cy",
|
|
403
|
+
"r",
|
|
404
|
+
"rx",
|
|
405
|
+
"ry",
|
|
406
|
+
"dx",
|
|
407
|
+
"dy",
|
|
408
|
+
"viewBox",
|
|
409
|
+
"preserveAspectRatio",
|
|
410
|
+
"transform",
|
|
411
|
+
"fill",
|
|
412
|
+
"fill-opacity",
|
|
413
|
+
"fill-rule",
|
|
414
|
+
"stroke",
|
|
415
|
+
"stroke-width",
|
|
416
|
+
"stroke-opacity",
|
|
417
|
+
"stroke-linecap",
|
|
418
|
+
"stroke-linejoin",
|
|
419
|
+
"stroke-dasharray",
|
|
420
|
+
"stroke-dashoffset",
|
|
421
|
+
"opacity",
|
|
422
|
+
"clip-path",
|
|
423
|
+
"clip-rule",
|
|
424
|
+
"mask",
|
|
425
|
+
"font-family",
|
|
426
|
+
"font-size",
|
|
427
|
+
"font-weight",
|
|
428
|
+
"font-style",
|
|
429
|
+
"text-anchor",
|
|
430
|
+
"dominant-baseline",
|
|
431
|
+
"offset",
|
|
432
|
+
"stop-color",
|
|
433
|
+
"stop-opacity",
|
|
434
|
+
"gradientUnits",
|
|
435
|
+
"gradientTransform",
|
|
436
|
+
"spreadMethod",
|
|
437
|
+
"patternUnits",
|
|
438
|
+
"patternTransform",
|
|
439
|
+
"marker-start",
|
|
440
|
+
"marker-mid",
|
|
441
|
+
"marker-end",
|
|
442
|
+
"markerWidth",
|
|
443
|
+
"markerHeight",
|
|
444
|
+
"refX",
|
|
445
|
+
"refY",
|
|
446
|
+
"xlink:href"
|
|
447
|
+
]);
|
|
448
|
+
const ALLOWED_URI_PROTOCOLS = /* @__PURE__ */ new Set([
|
|
449
|
+
"http:",
|
|
450
|
+
"https:",
|
|
451
|
+
"mailto:"
|
|
452
|
+
]);
|
|
453
|
+
const URI_ATTRS = /* @__PURE__ */ new Set(["href", "src", "xlink:href"]);
|
|
454
|
+
const TAG_NAME_REGEX = /^<\/?([a-zA-Z][a-zA-Z0-9]*)/;
|
|
455
|
+
const CLOSING_TAG_REGEX = /^<\/([a-zA-Z][a-zA-Z0-9]*)\s*>$/;
|
|
456
|
+
const OPENING_TAG_REGEX = /^<([a-zA-Z][a-zA-Z0-9]*)([\s\S]*?)(\/?)>$/;
|
|
457
|
+
const ATTR_REGEX = /([a-zA-Z][\w:-]*)\s*(?:=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g;
|
|
458
|
+
const URL_IN_STYLE_REGEX = /url\s*\(\s*["']?([^"')]+)["']?\s*\)/gi;
|
|
459
|
+
const DANGEROUS_CSS_PATTERNS = [
|
|
460
|
+
"expression(",
|
|
461
|
+
"behavior:",
|
|
462
|
+
"binding:",
|
|
463
|
+
"@import",
|
|
464
|
+
"@charset",
|
|
465
|
+
"-moz-binding:"
|
|
466
|
+
];
|
|
467
|
+
function decodeHTMLEntities(str) {
|
|
468
|
+
return str.replace(/:/gi, ":").replace(/&newline;/gi, "\n").replace(/&tab;/gi, " ").replace(/ /gi, " ").replace(/</gi, "<").replace(/>/gi, ">").replace(/&/gi, "&").replace(/"/gi, '"').replace(/'/gi, "'").replace(/&#(\d+);/gi, (_, code) => String.fromCharCode(parseInt(code, 10))).replace(/&#x([0-9a-f]+);/gi, (_, code) => String.fromCharCode(parseInt(code, 16)));
|
|
469
|
+
}
|
|
470
|
+
function isSafeURI(uri) {
|
|
471
|
+
const decoded = decodeHTMLEntities(uri).trim();
|
|
472
|
+
const normalized = decoded.replace(/[\s\u0000-\u001f]/g, "").toLowerCase();
|
|
473
|
+
if (!normalized || normalized.startsWith("#")) {
|
|
474
|
+
return true;
|
|
475
|
+
}
|
|
476
|
+
if (normalized.startsWith("/") || normalized.startsWith("./") || normalized.startsWith("../") || !normalized.includes(":")) {
|
|
477
|
+
return true;
|
|
478
|
+
}
|
|
479
|
+
const colonIndex = normalized.indexOf(":");
|
|
480
|
+
if (colonIndex > 0) {
|
|
481
|
+
const protocol = normalized.substring(0, colonIndex + 1);
|
|
482
|
+
return ALLOWED_URI_PROTOCOLS.has(protocol);
|
|
483
|
+
}
|
|
484
|
+
return false;
|
|
485
|
+
}
|
|
486
|
+
function sanitizeStyleValue(style) {
|
|
487
|
+
const decoded = decodeHTMLEntities(style);
|
|
488
|
+
const cleaned = decoded.replace(/[\u0000-\u001f]/g, "");
|
|
489
|
+
URL_IN_STYLE_REGEX.lastIndex = 0;
|
|
490
|
+
let match;
|
|
491
|
+
while ((match = URL_IN_STYLE_REGEX.exec(cleaned)) !== null) {
|
|
492
|
+
if (!isSafeURI(match[1])) {
|
|
493
|
+
return null;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
const normalizedLower = cleaned.toLowerCase().replace(/\s/g, "");
|
|
497
|
+
for (const pattern of DANGEROUS_CSS_PATTERNS) {
|
|
498
|
+
if (normalizedLower.includes(pattern)) {
|
|
499
|
+
return null;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
return style;
|
|
503
|
+
}
|
|
504
|
+
const ATTR_ENCODE_MAP = {
|
|
505
|
+
'"': """,
|
|
506
|
+
"'": "'",
|
|
507
|
+
"`": "`"
|
|
508
|
+
};
|
|
509
|
+
const ATTR_ENCODE_REGEX = /["'`]/g;
|
|
510
|
+
function encodeAttrValue(value) {
|
|
511
|
+
return value.replace(ATTR_ENCODE_REGEX, (char) => ATTR_ENCODE_MAP[char]);
|
|
512
|
+
}
|
|
513
|
+
function sanitizeAttrValue(name, value, wasUnquoted = false) {
|
|
514
|
+
if (URI_ATTRS.has(name)) {
|
|
515
|
+
if (!isSafeURI(value)) {
|
|
516
|
+
return null;
|
|
517
|
+
}
|
|
518
|
+
return wasUnquoted ? encodeAttrValue(value) : value;
|
|
519
|
+
}
|
|
520
|
+
if (name === "style") {
|
|
521
|
+
const sanitizedStyle = sanitizeStyleValue(value);
|
|
522
|
+
if (sanitizedStyle === null) {
|
|
523
|
+
return null;
|
|
524
|
+
}
|
|
525
|
+
return wasUnquoted ? encodeAttrValue(sanitizedStyle) : sanitizedStyle;
|
|
526
|
+
}
|
|
527
|
+
const decoded = decodeHTMLEntities(value).toLowerCase().replace(/\s/g, "");
|
|
528
|
+
if (/\bon\w+=/.test(decoded)) {
|
|
529
|
+
return null;
|
|
530
|
+
}
|
|
531
|
+
return wasUnquoted ? encodeAttrValue(value) : value;
|
|
532
|
+
}
|
|
533
|
+
function extractTagName(tag) {
|
|
534
|
+
const match = tag.match(TAG_NAME_REGEX);
|
|
535
|
+
return match ? match[1].toLowerCase() : null;
|
|
536
|
+
}
|
|
537
|
+
function isAllowedTag(tag) {
|
|
538
|
+
const tagName = extractTagName(tag);
|
|
539
|
+
return tagName !== null && ALLOWED_TAGS.has(tagName);
|
|
540
|
+
}
|
|
541
|
+
function sanitizeTag(fullTag) {
|
|
542
|
+
const closingMatch = fullTag.match(CLOSING_TAG_REGEX);
|
|
543
|
+
if (closingMatch) {
|
|
544
|
+
return `</${closingMatch[1].toLowerCase()}>`;
|
|
545
|
+
}
|
|
546
|
+
const openingMatch = fullTag.match(OPENING_TAG_REGEX);
|
|
547
|
+
if (!openingMatch) {
|
|
548
|
+
return "";
|
|
549
|
+
}
|
|
550
|
+
const [, tagName, attrString, selfClose] = openingMatch;
|
|
551
|
+
const lowerTagName = tagName.toLowerCase();
|
|
552
|
+
const allowedAttrs = [];
|
|
553
|
+
ATTR_REGEX.lastIndex = 0;
|
|
554
|
+
let attrMatch;
|
|
555
|
+
while ((attrMatch = ATTR_REGEX.exec(attrString)) !== null) {
|
|
556
|
+
const attrName = attrMatch[1].toLowerCase();
|
|
557
|
+
const doubleQuotedValue = attrMatch[2];
|
|
558
|
+
const singleQuotedValue = attrMatch[3];
|
|
559
|
+
const unquotedValue = attrMatch[4];
|
|
560
|
+
if (attrName.startsWith("on")) {
|
|
561
|
+
continue;
|
|
562
|
+
}
|
|
563
|
+
let attrValue;
|
|
564
|
+
let quoteChar;
|
|
565
|
+
if (doubleQuotedValue !== void 0) {
|
|
566
|
+
attrValue = doubleQuotedValue;
|
|
567
|
+
quoteChar = '"';
|
|
568
|
+
} else if (singleQuotedValue !== void 0) {
|
|
569
|
+
attrValue = singleQuotedValue;
|
|
570
|
+
quoteChar = "'";
|
|
571
|
+
} else if (unquotedValue !== void 0) {
|
|
572
|
+
attrValue = unquotedValue;
|
|
573
|
+
quoteChar = '"';
|
|
574
|
+
} else {
|
|
575
|
+
if (ALLOWED_ATTRS.has(attrName)) {
|
|
576
|
+
allowedAttrs.push(attrName);
|
|
577
|
+
}
|
|
578
|
+
continue;
|
|
579
|
+
}
|
|
580
|
+
if (ALLOWED_ATTRS.has(attrName)) {
|
|
581
|
+
const wasUnquoted = unquotedValue !== void 0;
|
|
582
|
+
const sanitizedValue = sanitizeAttrValue(attrName, attrValue, wasUnquoted);
|
|
583
|
+
if (sanitizedValue !== null) {
|
|
584
|
+
allowedAttrs.push(`${attrName}=${quoteChar}${sanitizedValue}${quoteChar}`);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
const attrsStr = allowedAttrs.length > 0 ? ` ${allowedAttrs.join(" ")}` : "";
|
|
589
|
+
const selfCloseStr = selfClose ? "/>" : ">";
|
|
590
|
+
return `<${lowerTagName}${attrsStr}${selfCloseStr}`;
|
|
591
|
+
}
|
|
592
|
+
function sanitize(str) {
|
|
593
|
+
if (typeof str !== "string" || !str || str.indexOf("<") === -1) {
|
|
594
|
+
return str;
|
|
595
|
+
}
|
|
596
|
+
return str.replace(
|
|
597
|
+
/<\/?[^>]*>|[^<>\s]+>/g,
|
|
598
|
+
(match) => {
|
|
599
|
+
if (match.startsWith("<!--")) {
|
|
600
|
+
return "";
|
|
601
|
+
}
|
|
602
|
+
if (!match.startsWith("<")) {
|
|
603
|
+
return match.slice(0, -1) + ">";
|
|
604
|
+
}
|
|
605
|
+
if (isAllowedTag(match)) {
|
|
606
|
+
return sanitizeTag(match);
|
|
607
|
+
}
|
|
608
|
+
return match.replace(/</g, "<");
|
|
609
|
+
}
|
|
610
|
+
);
|
|
611
|
+
}
|
|
612
|
+
|
|
311
613
|
;// ./src/module/util.ts
|
|
312
614
|
var util_defProp = Object.defineProperty;
|
|
313
615
|
var util_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
@@ -329,6 +631,23 @@ var util_spreadValues = (a, b) => {
|
|
|
329
631
|
|
|
330
632
|
|
|
331
633
|
|
|
634
|
+
function _getRect(relativeViewport, node, forceEval = false) {
|
|
635
|
+
const _ = (n) => n[relativeViewport ? "getBoundingClientRect" : "getBBox"]();
|
|
636
|
+
if (forceEval) {
|
|
637
|
+
return _(node);
|
|
638
|
+
} else {
|
|
639
|
+
const needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +(node.getAttribute("width") || 0);
|
|
640
|
+
return needEvaluate ? node.rect = _(node) : node.rect;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
function _forEachValidItem(items, callback) {
|
|
644
|
+
for (let i = 0; i < items.length; i++) {
|
|
645
|
+
const item = items[i];
|
|
646
|
+
if (item) {
|
|
647
|
+
callback(item, i);
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
}
|
|
332
651
|
const isValue = (v) => v || v === 0;
|
|
333
652
|
const isFunction = (v) => typeof v === "function";
|
|
334
653
|
const isString = (v) => typeof v === "string";
|
|
@@ -375,29 +694,6 @@ function endall(transition, cb) {
|
|
|
375
694
|
transition.call(end);
|
|
376
695
|
}
|
|
377
696
|
}
|
|
378
|
-
const DANGEROUS_TAGS = "script|iframe|object|embed|form|input|button|textarea|select|style|link|meta|base|math|isindex";
|
|
379
|
-
const sanitizeRx = {
|
|
380
|
-
tags: new RegExp(
|
|
381
|
-
`<(${DANGEROUS_TAGS})\\b[\\s\\S]*?>([\\s\\S]*?<\\/(${DANGEROUS_TAGS})\\s*>)?`,
|
|
382
|
-
"gi"
|
|
383
|
-
),
|
|
384
|
-
// Handles: whitespace, slash, quotes before event handlers (e.g., <img/onerror=...>, <img src="x"onerror=...>)
|
|
385
|
-
eventHandlers: /[\s/"']+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,
|
|
386
|
-
// Handles: javascript/data/vbscript URIs with optional whitespace/newlines between protocol and colon
|
|
387
|
-
dangerousURIs: /(href|src|action|xlink:href)\s*=\s*["']?\s*(javascript|data|vbscript)\s*:/gi
|
|
388
|
-
};
|
|
389
|
-
function sanitize(str) {
|
|
390
|
-
if (!isString(str) || !str || str.indexOf("<") === -1) {
|
|
391
|
-
return str;
|
|
392
|
-
}
|
|
393
|
-
let result = str;
|
|
394
|
-
let prev;
|
|
395
|
-
do {
|
|
396
|
-
prev = result;
|
|
397
|
-
result = result.replace(sanitizeRx.tags, "").replace(sanitizeRx.eventHandlers, "").replace(sanitizeRx.dangerousURIs, '$1=""');
|
|
398
|
-
} while (result !== prev);
|
|
399
|
-
return result;
|
|
400
|
-
}
|
|
401
697
|
function setTextValue(node, text, dy = [-1, 1], toMiddle = false) {
|
|
402
698
|
if (!node || !isString(text)) {
|
|
403
699
|
return;
|
|
@@ -462,20 +758,11 @@ function getBrushSelection(ctx) {
|
|
|
462
758
|
}
|
|
463
759
|
return selection;
|
|
464
760
|
}
|
|
465
|
-
function getRect(relativeViewport, node, forceEval = false) {
|
|
466
|
-
const _ = (n) => n[relativeViewport ? "getBoundingClientRect" : "getBBox"]();
|
|
467
|
-
if (forceEval) {
|
|
468
|
-
return _(node);
|
|
469
|
-
} else {
|
|
470
|
-
const needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +(node.getAttribute("width") || 0);
|
|
471
|
-
return needEvaluate ? node.rect = _(node) : node.rect;
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
761
|
function getBoundingRect(node, forceEval = false) {
|
|
475
|
-
return
|
|
762
|
+
return _getRect(true, node, forceEval);
|
|
476
763
|
}
|
|
477
764
|
function getBBox(node, forceEval = false) {
|
|
478
|
-
return
|
|
765
|
+
return _getRect(false, node, forceEval);
|
|
479
766
|
}
|
|
480
767
|
function getRandom(asStr = true, min = 0, max = 1e4) {
|
|
481
768
|
const crpt = win.crypto || win.msCrypto;
|
|
@@ -787,6 +1074,35 @@ function parseShorthand(value) {
|
|
|
787
1074
|
const [a, b = a, c = a, d = b] = values;
|
|
788
1075
|
return { top: a, right: b, bottom: c, left: d };
|
|
789
1076
|
}
|
|
1077
|
+
function scheduleRAFUpdate(rafState, callback) {
|
|
1078
|
+
if (rafState.pendingRaf !== null) {
|
|
1079
|
+
win.cancelAnimationFrame(rafState.pendingRaf);
|
|
1080
|
+
rafState.pendingRaf = win.requestAnimationFrame(() => {
|
|
1081
|
+
rafState.pendingRaf = null;
|
|
1082
|
+
callback();
|
|
1083
|
+
});
|
|
1084
|
+
} else {
|
|
1085
|
+
rafState.pendingRaf = win.requestAnimationFrame(() => {
|
|
1086
|
+
rafState.pendingRaf = null;
|
|
1087
|
+
});
|
|
1088
|
+
callback();
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
function toSet(items, keyFn = ((item) => item)) {
|
|
1092
|
+
const set = /* @__PURE__ */ new Set();
|
|
1093
|
+
_forEachValidItem(items, (item, i) => {
|
|
1094
|
+
set.add(keyFn(item, i));
|
|
1095
|
+
});
|
|
1096
|
+
return set;
|
|
1097
|
+
}
|
|
1098
|
+
function toMap(items, keyFn, valueFn = ((item) => item)) {
|
|
1099
|
+
const map = /* @__PURE__ */ new Map();
|
|
1100
|
+
_forEachValidItem(items, (item, i) => {
|
|
1101
|
+
map.set(keyFn(item, i), valueFn(item, i));
|
|
1102
|
+
});
|
|
1103
|
+
return map;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
790
1106
|
|
|
791
1107
|
;// ./src/config/config.ts
|
|
792
1108
|
|
|
@@ -868,7 +1184,7 @@ class Plugin {
|
|
|
868
1184
|
});
|
|
869
1185
|
}
|
|
870
1186
|
}
|
|
871
|
-
__publicField(Plugin, "version", "3.18.0
|
|
1187
|
+
__publicField(Plugin, "version", "3.18.0");
|
|
872
1188
|
|
|
873
1189
|
;// ./src/Plugin/sparkline/Options.ts
|
|
874
1190
|
class Options {
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.18.0
|
|
8
|
+
* @version 3.18.0
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
|
-
*/(function(b,f){typeof exports=="object"&&typeof module=="object"?module.exports=f(require("d3-brush"),require("d3-selection")):typeof define=="function"&&define.amd?define("bb",["d3-brush","d3-selection"],f):typeof exports=="object"?exports.bb=f(require("d3-brush"),require("d3-selection")):(b.bb=b.bb||{},b.bb.plugin=b.bb.plugin||{},b.bb.plugin.sparkline=f(b.d3,b.d3))})(this,function(
|
|
12
|
-
`)===-1)e.text(t);else{const
|
|
13
|
-
`),o=r?i.length-1:1;e.html(""),i.forEach((l,a)=>{e.append("tspan").attr("x",0).attr("dy",`${a===0?n[0]*o:n[1]}em`).text(l)})}}}function Ae(e){const{x:t,y:n,width:r,height:s}=e.getBBox();return[{x:t,y:n+s},{x:t,y:n},{x:t+r,y:n},{x:t+r,y:n+s}]}function rt(e){const{width:t,height:n}=F(e),r=Ae(e),s=r[0].x,i=Math.min(r[0].y,r[1].y);return{x:s,y:i,width:t,height:n}}function st(e,t){var n;const r=e&&((n=e.touches||e.sourceEvent&&e.sourceEvent.touches)==null?void 0:n[0]);let s=[0,0];try{s=d3Pointer(r||e,t)}catch(i){}return s.map(i=>isNaN(i)?0:i)}function Ce(e){const{event:t,$el:n}=e,r=n.subchart.main||n.main;let s;return t&&t.type==="brush"?s=t.selection:r&&(s=r.select(".bb-brush").node())&&(s=d3BrushSelection(s)),s}function B(e,t,n=!1){const r=s=>s[e?"getBoundingClientRect":"getBBox"]();return n?r(t):!("rect"in t)||"rect"in t&&t.hasAttribute("width")&&t.rect.width!==+(t.getAttribute("width")||0)?t.rect=r(t):t.rect}function F(e,t=!1){return B(!0,e,t)}function it(e,t=!1){return B(!1,e,t)}function ot(e=!0,t=0,n=1e4){const r=window.crypto||window.msCrypto,s=r?t+r.getRandomValues(new Uint32Array(1))[0]%(n-t+1):Math.floor(Math.random()*(n-t)+t);return e?String(s):s}function N(e,t,n,r,s){if(n>r)return-1;const i=Math.floor((n+r)/2);let{x:o,w:l=0}=e[i];return s&&(o=e[i].y,l=e[i].h),t>=o&&t<=o+l?i:t<o?N(e,t,n,i-1,s):N(e,t,i+1,r,s)}function ct(e){const t=Ce(e);return t?t[0]===t[1]:!0}function lt(...e){const t=n=>{if(g(n)&&n.constructor){const r=new n.constructor;for(const s in n)r[s]=t(n[s]);return r}return n};return e.map(n=>t(n)).reduce((n,r)=>D(D({},n),r))}function Pe(e={},t){y(t)&&t.forEach(n=>Pe(e,n));for(const n in t)/^\d+$/.test(n)||n in e||(e[n]=t[n]);return e}const at=e=>e.charAt(0).toUpperCase()+e.slice(1);function ut(e,t="-"){return e.split(t).map((n,r)=>r?n.charAt(0).toUpperCase()+n.slice(1).toLowerCase():n.toLowerCase()).join("")}const Re=e=>[].slice.call(e);function bt(e,t,n){const{rootSelector:r="",sheet:s}=e,o=`${r} ${(l=>l.replace(/\s?(bb-)/g,".$1").replace(/\.+/g,"."))(t)} {${n.join(";")}}`;return s[s.insertRule?"insertRule":"addRule"](o,s.cssRules.length)}function dt(e){let t=[];return e.forEach(n=>{var r;try{n.cssRules&&n.cssRules.length&&(t=t.concat(Re(n.cssRules)))}catch(s){(r=window.console)==null||r.warn(`Error while reading rules from ${n.href}: ${s.toString()}`)}}),t}function ft(e){var t,n,r,s,i,o;return{x:((n=(t=window.pageXOffset)!=null?t:window.scrollX)!=null?n:0)+((r=e.scrollLeft)!=null?r:0),y:((i=(s=window.pageYOffset)!=null?s:window.scrollY)!=null?i:0)+((o=e.scrollTop)!=null?o:0)}}function ht(e,t=0,n=0,r=!0){const s=new DOMPoint(t,n),i=e.getScreenCTM(),o=s.matrixTransform(r?i==null?void 0:i.inverse():i);if(r===!1){const l=F(e);o.x-=l.x,o.y-=l.y}return o}function pt(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 gt(e){const t=e[0]instanceof Date,n=(t?e.map(Number):e).filter((r,s,i)=>i.indexOf(r)===s);return t?n.map(r=>new Date(r)):n}function mt(e){return e&&e.length?e.reduce((t,n)=>t.concat(n)):[]}function w(e,...t){if(!t.length||t.length===1&&!t[0])return e;const n=t.shift();return g(e)&&g(n)&&Object.keys(n).forEach(r=>{if(!/^(__proto__|constructor|prototype)$/i.test(r)){const s=n[r];g(s)?(!e[r]&&(e[r]={}),e[r]=w(e[r],s)):e[r]=y(s)?s.concat():s}}),w(e,...t)}function Se(e,t=!0){let n;return e[0]instanceof Date?n=t?(r,s)=>r-s:(r,s)=>s-r:t&&!e.every(isNaN)?n=(r,s)=>r-s:t||(n=(r,s)=>r>s&&-1||r<s&&1||r===s&&0),e.concat().sort(n)}function vt(e,t){let n=t.filter(r=>Oe(r));return n.length?_(n[0])?n=Math[e](...n):n[0]instanceof Date&&(n=Se(n,e==="min")[0]):n=void 0,n}const _t=(e,t,n=1)=>{const r=[],s=Math.max(0,Math.ceil((t-e)/n))|0;for(let i=e;i<s;i++)r.push(e+i*n);return r},xt={mouse:(()=>{const e=()=>({bubbles:!1,cancelable:!1,screenX:0,screenY:0,clientX:0,clientY:0});try{return new MouseEvent("t"),(t,n,r=e())=>{t.dispatchEvent(new MouseEvent(n,r))}}catch(t){return(n,r,s=e())=>{const i=me.createEvent("MouseEvent");i.initMouseEvent(r,s.bubbles,s.cancelable,v,0,s.screenX,s.screenY,s.clientX,s.clientY,!1,!1,!1,!1,0,null),n.dispatchEvent(i)}}})(),touch:(e,t,n)=>{const r=new Touch(w({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:[r],targetTouches:[],changedTouches:[r]}))}};function yt(e,t){let n=e;for(const r in t)n=n.replace(new RegExp(`{=${r}}`,"g"),t[r]);return Te(n)}function $t(e){var t;let n;if(e instanceof Date)n=e;else if(h(e)){const{config:r,format:s}=this;n=(t=s.dataTime(r.data_xFormat)(e))!=null?t:new Date(e)}else _(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 wt(e){const t=e.attr("viewBox");return t?/(\d+(\.\d+)?){3}/.test(t):!1}function Et(e,t,n=!1){const r=!!e.node;let s=!1;for(const[i,o]of Object.entries(t))if(s=r?e.style(i)===o:e.style[i]===o,n===!1&&s)break;return s}function Ot(){var e,t;return((e=document)==null?void 0:e.hidden)===!1||((t=document)==null?void 0:t.visibilityState)==="visible"}function Tt(e,t){const{DocumentTouch:n,matchMedia:r,navigator:s}=window,i=r==null?void 0:r("(pointer:coarse)").matches;let o=!1;if(t)if(s&&"maxTouchPoints"in s)o=s.maxTouchPoints>0;else if("ontouchmove"in window||n&&document instanceof n)o=!0;else if(i)o=!0;else{const a=s.userAgent;o=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(a)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(a)}return e&&!i&&(r==null?void 0:r("(pointer:fine)").matches)&&"mouse"||o&&"touch"||"mouse"}function Ie(e,t){t()===!1?requestAnimationFrame(()=>Ie(e,t)):e()}function At(e){if(g(e)&&!h(e)){const o=e;return{top:o.top||0,right:o.right||0,bottom:o.bottom||0,left:o.left||0}}const t=(h(e)?e.trim().split(/\s+/):[e]).map(o=>+o||0),[n,r=n,s=n,i=r]=t;return{top:n,right:r,bottom:s,left:i}}function Le(e){const t=this.config;let n,r,s;const i=()=>{const o=r.shift();if(o&&n&&x(n)&&o in n)return n=n[o],i();if(!o)return n};Object.keys(t).forEach(o=>{n=e,r=o.split("_"),s=i(),M(s)&&(t[o]=s)}),this.api&&(this.state.orgConfig=e)}var De=Object.defineProperty,Me=(e,t,n)=>t in e?De(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,E=(e,t,n)=>Me(e,typeof t!="symbol"?t+"":t,n);class k{constructor(t={}){E(this,"$$"),E(this,"options"),this.options=t}$beforeInit(){}$init(){}$afterInit(){}$redraw(){}$willDestroy(){Object.keys(this).forEach(t=>{this[t]=null,delete this[t]})}}E(k,"version","3.18.0-next.1");class je{constructor(){return{selector:void 0}}}var Be=Object.defineProperty,Fe=(e,t,n)=>t in e?Be(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,O=(e,t,n)=>Fe(e,typeof t!="symbol"?t+"":t,n);class q extends k{constructor(t){return super(t),O(this,"config"),O(this,"element"),this.config=new je,this}$beforeInit(){Le.call(this,this.options),this.validate(),this.element=[].slice.call(document.querySelectorAll(this.config.selector)),this.overrideInternals(),this.overrideOptions(),this.overHandler=this.overHandler.bind(this),this.moveHandler=this.moveHandler.bind(this),this.outHandler=this.outHandler.bind(this)}validate(){const{$$:t,config:n}=this;let r="";if((!n.selector||!document.querySelector(n.selector))&&(r="No holder elements found from given selector option."),(t.hasType("bubble")||t.hasType("scatter")||t.hasArcType(t.data.targets))&&(r="Contains non supported chart types."),r)throw new Error(`[Sparkline plugin] ${r}`)}overrideInternals(){const{$$:t}=this,{getBarW:n,getIndices:r}=t;t.getIndices=function(s,i,o){return o==="getShapeX"?{}:r.call(this,s,i)},t.getBarW=function(s,i){return n.call(this,s,i,1)}}overrideOptions(){const{config:t}=this.$$;if(t.legend_show=!1,t.resize_auto=!1,t.axis_x_show=!1,t.padding!==!1){const n=r=>Object.keys(r||{}).length>0;n(t.axis_x_padding)&&(t.axis_x_padding={left:15,right:15,unit:"px"}),n(t.axis_y_padding)&&(t.axis_y_padding=5)}t.axis_y_show=!1,t.tooltip_position||(t.tooltip_position=function(n,r,s){const{internal:{state:{event:i}}}=this;let o=i.pageY-s*1.35,l=i.pageX-r/2;return o<0&&(o=0),l<0&&(l=0),{top:o,left:l}})}$init(){var t;const{$$:{$el:n}}=this;n.chart.style("width","0").style("height","0").style("pointer-events","none"),(t=n.tooltip)!=null&&t.node()&&document.body.appendChild(n.tooltip.node())}$afterInit(){const{$$:t}=this;t.$el.svg.attr("style",null).style("width","0").style("height","0"),this.bindEvents(!0)}bindEvents(t=!0){const{$$:{config:n}}=this;if(n.interaction_enabled&&n.tooltip_show){const r=`${t?"add":"remove"}EventListener`;this.element.forEach(s=>{const i=s.querySelector("svg");i[r]("mouseover",this.overHandler),i[r]("mousemove",this.moveHandler),i[r]("mouseout",this.outHandler)})}}overHandler(t){const{$$:n}=this,{state:{eventReceiver:r}}=n;r.rect=t.target.getBoundingClientRect()}moveHandler(t){var n,r,s,i;const{$$:o}=this,l=o.getDataIndexFromEvent(t),a=(n=o.api.data(t.target.__id))==null?void 0:n[0],u=(r=a==null?void 0:a.values)==null?void 0:r[l];u&&!u.name&&(u.name=u.id),o.state.event=t,(s=o.isPointFocusOnly)!=null&&s.call(o)&&u&&((i=o.showCircleFocus)==null||i.call(o,[u])),o.setExpand(l,a.id,!0),o.showTooltip([u],t.target)}outHandler(t){const{$$:n}=this;n.state.event=t,n.isPointFocusOnly()?n.hideCircleFocus():n.unexpandCircles(),n.hideTooltip()}$redraw(){var t;const{$$:n}=this,{$el:r}=n;let s=this.element;const i=n.api.data(),o=(t=r.chart.html().match(/<svg[^>]*>/))==null?void 0:t[0];if(s.length<i.length){const l=r.chart.node();for(let a=i.length-s.length;a>0;a--)l.parentNode.insertBefore(s[0].cloneNode(),l.nextSibling);this.element=document.querySelectorAll(this.config.selector),s=this.element}i.map(l=>l.id).forEach((l,a)=>{const u=`.${S.target}-${l}`,T=r.main.selectAll(u);let p=s[a].querySelector("svg");p||(s[a].innerHTML=`${o}</svg>`,p=s[a].querySelector("svg"),p.__id=l),p.querySelector(u)||T.style("opacity",null),T.style("fill","none").style("opacity",null),p.innerHTML="",p.appendChild(T.node())})}$willDestroy(){this.bindEvents(!1),this.element.forEach(t=>{t.innerHTML=""})}}return O(q,"version","0.0.1"),m=m.default,m})()});
|
|
11
|
+
*/(function(b,f){typeof exports=="object"&&typeof module=="object"?module.exports=f(require("d3-brush"),require("d3-selection")):typeof define=="function"&&define.amd?define("bb",["d3-brush","d3-selection"],f):typeof exports=="object"?exports.bb=f(require("d3-brush"),require("d3-selection")):(b.bb=b.bb||{},b.bb.plugin=b.bb.plugin||{},b.bb.plugin.sparkline=f(b.d3,b.d3))})(this,function(T,b){return(function(){"use strict";var f={747:(function(e){e.exports=b}),853:(function(e){e.exports=T})},A={};function d(e){var t=A[e];if(t!==void 0)return t.exports;var n=A[e]={exports:{}};return f[e](n,n.exports,d),n.exports}(function(){d.d=function(e,t){for(var n in t)d.o(t,n)&&!d.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}})(),(function(){d.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}})();var m={};d.d(m,{default:function(){return q}});var H=Object.defineProperty,C=Object.getOwnPropertySymbols,k=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable,P=(e,t,n)=>t in e?H(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,c=(e,t)=>{for(var n in t||(t={}))k.call(t,n)&&P(e,n,t[n]);if(C)for(var n of C(t))U.call(t,n)&&P(e,n,t[n]);return e};const R={button:"bb-button",chart:"bb-chart",empty:"bb-empty",main:"bb-main",target:"bb-target",EXPANDED:"_expanded_",dummy:"_dummy_"},X={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"},V={area:"bb-area",areas:"bb-areas"},Y={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"},G={bar:"bb-bar",bars:"bb-bars",chartBar:"bb-chart-bar",chartBars:"bb-chart-bars",barConnectLine:"bb-bar-connectLine"},z={candlestick:"bb-candlestick",candlesticks:"bb-candlesticks",chartCandlestick:"bb-chart-candlestick",chartCandlesticks:"bb-chart-candlesticks",valueDown:"bb-value-down",valueUp:"bb-value-up"},W={chartCircles:"bb-chart-circles",circle:"bb-circle",circles:"bb-circles"},K={colorPattern:"bb-color-pattern",colorScale:"bb-colorscale"},Z={dragarea:"bb-dragarea",INCLUDED:"_included_"},J={funnel:"bb-funnel",chartFunnel:"bb-chart-funnel",chartFunnels:"bb-chart-funnels",funnelBackground:"bb-funnel-background"},Q={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"},ee={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"},te={chartLine:"bb-chart-line",chartLines:"bb-chart-lines",line:"bb-line",lines:"bb-lines"},ne={eventRect:"bb-event-rect",eventRects:"bb-event-rects",eventRectsMultiple:"bb-event-rects-multiple",eventRectsSingle:"bb-event-rects-single"},re={focused:"bb-focused",defocused:"bb-defocused",legendItemFocused:"bb-legend-item-focused",xgridFocus:"bb-xgrid-focus",ygridFocus:"bb-ygrid-focus"},ie={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"},Be={level:"bb-level",levels:"bb-levels"},oe={chartRadar:"bb-chart-radar",chartRadars:"bb-chart-radars"},se={region:"bb-region",regions:"bb-regions"},ce={selectedCircle:"bb-selected-circle",selectedCircles:"bb-selected-circles",SELECTED:"_selected_"},le={shape:"bb-shape",shapes:"bb-shapes"},ae={brush:"bb-brush",subchart:"bb-subchart"},ue={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"},be={tooltip:"bb-tooltip",tooltipContainer:"bb-tooltip-container",tooltipName:"bb-tooltip-name"},de={treemap:"bb-treemap",chartTreemap:"bb-chart-treemap",chartTreemaps:"bb-chart-treemaps"},fe={buttonZoomReset:"bb-zoom-reset",zoomBrush:"bb-zoom-brush"};var je=c(c(c(c(c(c(c(c(c(c(c(c(c(c(c(c(c(c(c(c(c(c(c(c(c({},R),X),V),Y),G),z),W),K),Z),Q),ee),te),ne),re),J),ie),oe),se),ce),le),ae),ue),be),de),fe),Ne=d(853),qe=d(747);function he(){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 pe(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",r=o=>setTimeout(o,1),i=o=>clearTimeout(o);return[t?e.requestAnimationFrame:r,t?e.cancelAnimationFrame:i,n?e.requestIdleCallback:r,n?e.cancelIdleCallback:i]}const _=he(),ge=_==null?void 0:_.document,[He,ke,Ue,Xe]=pe(_);var me=Object.defineProperty,I=Object.getOwnPropertySymbols,_e=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable,L=(e,t,n)=>t in e?me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,M=(e,t)=>{for(var n in t||(t={}))_e.call(t,n)&&L(e,n,t[n]);if(I)for(var n of I(t))ve.call(t,n)&&L(e,n,t[n]);return e};function S(e,t,n=!1){const r=i=>i[e?"getBoundingClientRect":"getBBox"]();return n?r(t):!("rect"in t)||"rect"in t&&t.hasAttribute("width")&&t.rect.width!==+(t.getAttribute("width")||0)?t.rect=r(t):t.rect}function D(e,t){for(let n=0;n<e.length;n++){const r=e[n];r&&t(r,n)}}const Ve=e=>e||e===0,xe=e=>typeof e=="function",p=e=>typeof e=="string",v=e=>typeof e=="number",ye=e=>typeof e=="undefined",F=e=>typeof e!="undefined",Ye=e=>typeof e=="boolean",Ge=e=>Math.ceil(e/10)*10,ze=e=>Math.ceil(e)+.5,We=e=>e[1]-e[0],x=e=>typeof e=="object",we=e=>{for(const t in e)return!1;return!0},$e=e=>ye(e)||e===null||p(e)&&e.length===0||x(e)&&!(e instanceof Date)&&we(e)||v(e)&&isNaN(e),Ee=e=>!$e(e),y=e=>Array.isArray(e),g=e=>e&&!(e!=null&&e.nodeType)&&x(e)&&!y(e);function Ke(e,t,n){return F(e[t])?e[t]:n}function Ze(e,t){let n=!1;return Object.keys(e).forEach(r=>e[r]===t&&(n=!0)),n}function Je(e,t,...n){const r=xe(e);return r&&e.call(t,...n),r}function Qe(e,t){let n=0;const r=function(...i){!--n&&t.apply(this,...i)};"duration"in e?e.each(()=>++n).on("end",r):(++n,e.call(r))}function et(e,t,n=[-1,1],r=!1){if(!(!e||!p(t)))if(t.indexOf(`
|
|
12
|
+
`)===-1)e.text(t);else{const i=[e.text(),t].map(o=>o.replace(/[\s\n]/g,""));if(i[0]!==i[1]){const o=t.split(`
|
|
13
|
+
`),s=r?o.length-1:1;e.html(""),o.forEach((l,a)=>{e.append("tspan").attr("x",0).attr("dy",`${a===0?n[0]*s:n[1]}em`).text(l)})}}}function Oe(e){const{x:t,y:n,width:r,height:i}=e.getBBox();return[{x:t,y:n+i},{x:t,y:n},{x:t+r,y:n},{x:t+r,y:n+i}]}function tt(e){const{width:t,height:n}=B(e),r=Oe(e),i=r[0].x,o=Math.min(r[0].y,r[1].y);return{x:i,y:o,width:t,height:n}}function nt(e,t){var n;const r=e&&((n=e.touches||e.sourceEvent&&e.sourceEvent.touches)==null?void 0:n[0]);let i=[0,0];try{i=d3Pointer(r||e,t)}catch(o){}return i.map(o=>isNaN(o)?0:o)}function Te(e){const{event:t,$el:n}=e,r=n.subchart.main||n.main;let i;return t&&t.type==="brush"?i=t.selection:r&&(i=r.select(".bb-brush").node())&&(i=d3BrushSelection(i)),i}function B(e,t=!1){return S(!0,e,t)}function rt(e,t=!1){return S(!1,e,t)}function it(e=!0,t=0,n=1e4){const r=window.crypto||window.msCrypto,i=r?t+r.getRandomValues(new Uint32Array(1))[0]%(n-t+1):Math.floor(Math.random()*(n-t)+t);return e?String(i):i}function j(e,t,n,r,i){if(n>r)return-1;const o=Math.floor((n+r)/2);let{x:s,w:l=0}=e[o];return i&&(s=e[o].y,l=e[o].h),t>=s&&t<=s+l?o:t<s?j(e,t,n,o-1,i):j(e,t,o+1,r,i)}function ot(e){const t=Te(e);return t?t[0]===t[1]:!0}function st(...e){const t=n=>{if(g(n)&&n.constructor){const r=new n.constructor;for(const i in n)r[i]=t(n[i]);return r}return n};return e.map(n=>t(n)).reduce((n,r)=>M(M({},n),r))}function Ae(e={},t){y(t)&&t.forEach(n=>Ae(e,n));for(const n in t)/^\d+$/.test(n)||n in e||(e[n]=t[n]);return e}const ct=e=>e.charAt(0).toUpperCase()+e.slice(1);function lt(e,t="-"){return e.split(t).map((n,r)=>r?n.charAt(0).toUpperCase()+n.slice(1).toLowerCase():n.toLowerCase()).join("")}const Ce=e=>[].slice.call(e);function at(e,t,n){const{rootSelector:r="",sheet:i}=e,s=`${r} ${(l=>l.replace(/\s?(bb-)/g,".$1").replace(/\.+/g,"."))(t)} {${n.join(";")}}`;return i[i.insertRule?"insertRule":"addRule"](s,i.cssRules.length)}function ut(e){let t=[];return e.forEach(n=>{var r;try{n.cssRules&&n.cssRules.length&&(t=t.concat(Ce(n.cssRules)))}catch(i){(r=window.console)==null||r.warn(`Error while reading rules from ${n.href}: ${i.toString()}`)}}),t}function bt(e){var t,n,r,i,o,s;return{x:((n=(t=window.pageXOffset)!=null?t:window.scrollX)!=null?n:0)+((r=e.scrollLeft)!=null?r:0),y:((o=(i=window.pageYOffset)!=null?i:window.scrollY)!=null?o:0)+((s=e.scrollTop)!=null?s:0)}}function dt(e,t=0,n=0,r=!0){const i=new DOMPoint(t,n),o=e.getScreenCTM(),s=i.matrixTransform(r?o==null?void 0:o.inverse():o);if(r===!1){const l=B(e);s.x-=l.x,s.y-=l.y}return s}function ft(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 ht(e){const t=e[0]instanceof Date,n=(t?e.map(Number):e).filter((r,i,o)=>o.indexOf(r)===i);return t?n.map(r=>new Date(r)):n}function pt(e){return e&&e.length?e.reduce((t,n)=>t.concat(n)):[]}function w(e,...t){if(!t.length||t.length===1&&!t[0])return e;const n=t.shift();return g(e)&&g(n)&&Object.keys(n).forEach(r=>{if(!/^(__proto__|constructor|prototype)$/i.test(r)){const i=n[r];g(i)?(!e[r]&&(e[r]={}),e[r]=w(e[r],i)):e[r]=y(i)?i.concat():i}}),w(e,...t)}function Pe(e,t=!0){let n;return e[0]instanceof Date?n=t?(r,i)=>r-i:(r,i)=>i-r:t&&!e.every(isNaN)?n=(r,i)=>r-i:t||(n=(r,i)=>r>i&&-1||r<i&&1||r===i&&0),e.concat().sort(n)}function gt(e,t){let n=t.filter(r=>Ee(r));return n.length?v(n[0])?n=Math[e](...n):n[0]instanceof Date&&(n=Pe(n,e==="min")[0]):n=void 0,n}const mt=(e,t,n=1)=>{const r=[],i=Math.max(0,Math.ceil((t-e)/n))|0;for(let o=e;o<i;o++)r.push(e+o*n);return r},_t={mouse:(()=>{const e=()=>({bubbles:!1,cancelable:!1,screenX:0,screenY:0,clientX:0,clientY:0});try{return new MouseEvent("t"),(t,n,r=e())=>{t.dispatchEvent(new MouseEvent(n,r))}}catch(t){return(n,r,i=e())=>{const o=ge.createEvent("MouseEvent");o.initMouseEvent(r,i.bubbles,i.cancelable,_,0,i.screenX,i.screenY,i.clientX,i.clientY,!1,!1,!1,!1,0,null),n.dispatchEvent(o)}}})(),touch:(e,t,n)=>{const r=new Touch(w({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:[r],targetTouches:[],changedTouches:[r]}))}};function vt(e,t){let n=e;for(const r in t)n=n.replace(new RegExp(`{=${r}}`,"g"),t[r]);return sanitize(n)}function xt(e){var t;let n;if(e instanceof Date)n=e;else if(p(e)){const{config:r,format:i}=this;n=(t=i.dataTime(r.data_xFormat)(e))!=null?t:new Date(e)}else v(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 yt(e){const t=e.attr("viewBox");return t?/(\d+(\.\d+)?){3}/.test(t):!1}function wt(e,t,n=!1){const r=!!e.node;let i=!1;for(const[o,s]of Object.entries(t))if(i=r?e.style(o)===s:e.style[o]===s,n===!1&&i)break;return i}function $t(){var e,t;return((e=document)==null?void 0:e.hidden)===!1||((t=document)==null?void 0:t.visibilityState)==="visible"}function Et(e,t){const{DocumentTouch:n,matchMedia:r,navigator:i}=window,o=r==null?void 0:r("(pointer:coarse)").matches;let s=!1;if(t)if(i&&"maxTouchPoints"in i)s=i.maxTouchPoints>0;else if("ontouchmove"in window||n&&document instanceof n)s=!0;else if(o)s=!0;else{const a=i.userAgent;s=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(a)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(a)}return e&&!o&&(r==null?void 0:r("(pointer:fine)").matches)&&"mouse"||s&&"touch"||"mouse"}function Re(e,t){t()===!1?requestAnimationFrame(()=>Re(e,t)):e()}function Ot(e){if(g(e)&&!p(e)){const s=e;return{top:s.top||0,right:s.right||0,bottom:s.bottom||0,left:s.left||0}}const t=(p(e)?e.trim().split(/\s+/):[e]).map(s=>+s||0),[n,r=n,i=n,o=r]=t;return{top:n,right:r,bottom:i,left:o}}function Tt(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 At(e,t=(n=>n)){const n=new Set;return D(e,(r,i)=>{n.add(t(r,i))}),n}function Ct(e,t,n=(r=>r)){const r=new Map;return D(e,(i,o)=>{r.set(t(i,o),n(i,o))}),r}function Ie(e){const t=this.config;let n,r,i;const o=()=>{const s=r.shift();if(s&&n&&x(n)&&s in n)return n=n[s],o();if(!s)return n};Object.keys(t).forEach(s=>{n=e,r=s.split("_"),i=o(),F(i)&&(t[s]=i)}),this.api&&(this.state.orgConfig=e)}var Le=Object.defineProperty,Me=(e,t,n)=>t in e?Le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$=(e,t,n)=>Me(e,typeof t!="symbol"?t+"":t,n);class N{constructor(t={}){$(this,"$$"),$(this,"options"),this.options=t}$beforeInit(){}$init(){}$afterInit(){}$redraw(){}$willDestroy(){Object.keys(this).forEach(t=>{this[t]=null,delete this[t]})}}$(N,"version","3.18.0");class Se{constructor(){return{selector:void 0}}}var De=Object.defineProperty,Fe=(e,t,n)=>t in e?De(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,E=(e,t,n)=>Fe(e,typeof t!="symbol"?t+"":t,n);class q extends N{constructor(t){return super(t),E(this,"config"),E(this,"element"),this.config=new Se,this}$beforeInit(){Ie.call(this,this.options),this.validate(),this.element=[].slice.call(document.querySelectorAll(this.config.selector)),this.overrideInternals(),this.overrideOptions(),this.overHandler=this.overHandler.bind(this),this.moveHandler=this.moveHandler.bind(this),this.outHandler=this.outHandler.bind(this)}validate(){const{$$:t,config:n}=this;let r="";if((!n.selector||!document.querySelector(n.selector))&&(r="No holder elements found from given selector option."),(t.hasType("bubble")||t.hasType("scatter")||t.hasArcType(t.data.targets))&&(r="Contains non supported chart types."),r)throw new Error(`[Sparkline plugin] ${r}`)}overrideInternals(){const{$$:t}=this,{getBarW:n,getIndices:r}=t;t.getIndices=function(i,o,s){return s==="getShapeX"?{}:r.call(this,i,o)},t.getBarW=function(i,o){return n.call(this,i,o,1)}}overrideOptions(){const{config:t}=this.$$;if(t.legend_show=!1,t.resize_auto=!1,t.axis_x_show=!1,t.padding!==!1){const n=r=>Object.keys(r||{}).length>0;n(t.axis_x_padding)&&(t.axis_x_padding={left:15,right:15,unit:"px"}),n(t.axis_y_padding)&&(t.axis_y_padding=5)}t.axis_y_show=!1,t.tooltip_position||(t.tooltip_position=function(n,r,i){const{internal:{state:{event:o}}}=this;let s=o.pageY-i*1.35,l=o.pageX-r/2;return s<0&&(s=0),l<0&&(l=0),{top:s,left:l}})}$init(){var t;const{$$:{$el:n}}=this;n.chart.style("width","0").style("height","0").style("pointer-events","none"),(t=n.tooltip)!=null&&t.node()&&document.body.appendChild(n.tooltip.node())}$afterInit(){const{$$:t}=this;t.$el.svg.attr("style",null).style("width","0").style("height","0"),this.bindEvents(!0)}bindEvents(t=!0){const{$$:{config:n}}=this;if(n.interaction_enabled&&n.tooltip_show){const r=`${t?"add":"remove"}EventListener`;this.element.forEach(i=>{const o=i.querySelector("svg");o[r]("mouseover",this.overHandler),o[r]("mousemove",this.moveHandler),o[r]("mouseout",this.outHandler)})}}overHandler(t){const{$$:n}=this,{state:{eventReceiver:r}}=n;r.rect=t.target.getBoundingClientRect()}moveHandler(t){var n,r,i,o;const{$$:s}=this,l=s.getDataIndexFromEvent(t),a=(n=s.api.data(t.target.__id))==null?void 0:n[0],u=(r=a==null?void 0:a.values)==null?void 0:r[l];u&&!u.name&&(u.name=u.id),s.state.event=t,(i=s.isPointFocusOnly)!=null&&i.call(s)&&u&&((o=s.showCircleFocus)==null||o.call(s,[u])),s.setExpand(l,a.id,!0),s.showTooltip([u],t.target)}outHandler(t){const{$$:n}=this;n.state.event=t,n.isPointFocusOnly()?n.hideCircleFocus():n.unexpandCircles(),n.hideTooltip()}$redraw(){var t;const{$$:n}=this,{$el:r}=n;let i=this.element;const o=n.api.data(),s=(t=r.chart.html().match(/<svg[^>]*>/))==null?void 0:t[0];if(i.length<o.length){const l=r.chart.node();for(let a=o.length-i.length;a>0;a--)l.parentNode.insertBefore(i[0].cloneNode(),l.nextSibling);this.element=document.querySelectorAll(this.config.selector),i=this.element}o.map(l=>l.id).forEach((l,a)=>{const u=`.${R.target}-${l}`,O=r.main.selectAll(u);let h=i[a].querySelector("svg");h||(i[a].innerHTML=`${s}</svg>`,h=i[a].querySelector("svg"),h.__id=l),h.querySelector(u)||O.style("opacity",null),O.style("fill","none").style("opacity",null),h.innerHTML="",h.appendChild(O.node())})}$willDestroy(){this.bindEvents(!1),this.element.forEach(t=>{t.innerHTML=""})}}return E(q,"version","0.0.1"),m=m.default,m})()});
|