bezel-charts 1.1.1 → 1.2.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/README.md +44 -7
- package/dist/bezel-charts.iife.js +9 -9
- package/dist/bezel-charts.js +272 -44
- package/dist/bezel-charts.min.js +9 -9
- package/package.json +3 -3
- package/src/charts/bars.js +16 -5
- package/src/charts/donut.js +9 -1
- package/src/charts/gauge.js +8 -0
- package/src/charts/heatmap.js +22 -5
- package/src/charts/line.js +27 -5
- package/src/charts/progress.js +9 -0
- package/src/charts/ring.js +7 -0
- package/src/charts/scatter.js +20 -4
- package/src/charts/spark.js +5 -0
- package/src/core/util.js +57 -6
- package/src/element.js +114 -16
- package/src/index.js +1 -1
- package/src/render.js +14 -1
package/README.md
CHANGED
|
@@ -20,8 +20,8 @@ Bezel Charts is a set of free, open-source web components: ten chart tiles drawn
|
|
|
20
20
|
- **Made for READMEs.** Every chart exports as a clean static SVG, so a GitHub README can show a real chart.
|
|
21
21
|
- **Data science friendly.** Scatter plots with a least-squares trend line and Pearson's r, grouped series, goal lines and notes on key points.
|
|
22
22
|
- **Speaks your language.** Numbers and dates follow any locale, including Persian.
|
|
23
|
-
- **Light.** About
|
|
24
|
-
- **Accessible.**
|
|
23
|
+
- **Light.** About 16 kB gzipped for all ten charts, with no dependencies and no build step.
|
|
24
|
+
- **Accessible.** Tab to any chart and step through its values with the arrow keys. Screen readers hear each value and get a hidden table of the data. Dashes, shapes and patterns tell series apart without relying on colour, and animation respects reduced-motion settings.
|
|
25
25
|
- **Python too.** `pip install bezel-charts` draws the same charts straight from a pandas DataFrame, for notebooks, reports and READMEs.
|
|
26
26
|
|
|
27
27
|
A sibling of [Bezel](https://github.com/ShazMoghaddam/bezel), the clock, calendar and weather tiles.
|
|
@@ -33,6 +33,7 @@ A sibling of [Bezel](https://github.com/ShazMoghaddam/bezel), the clock, calenda
|
|
|
33
33
|
- [The charts](#the-charts)
|
|
34
34
|
- [Options for every chart](#options-for-every-chart)
|
|
35
35
|
- [Colours and dark mode](#colours-and-dark-mode)
|
|
36
|
+
- [Accessibility](#accessibility)
|
|
36
37
|
- [Charts in a README](#charts-in-a-readme)
|
|
37
38
|
- [JavaScript API](#javascript-api)
|
|
38
39
|
- [Python](#python)
|
|
@@ -47,7 +48,7 @@ A sibling of [Bezel](https://github.com/ShazMoghaddam/bezel), the clock, calenda
|
|
|
47
48
|
<bezel-bars heading="Commits this week" values="4,9,6,3,8,5,3" labels="M,T,W,T,F,S,S" stat="total"></bezel-bars>
|
|
48
49
|
```
|
|
49
50
|
|
|
50
|
-
`@1` always loads the latest 1.x release, so you get fixes without changing anything. To pin an exact version, use `@v1.
|
|
51
|
+
`@1` always loads the latest 1.x release, so you get fixes without changing anything. To pin an exact version, use `@v1.2.0` instead.
|
|
51
52
|
|
|
52
53
|
That's all. Charts fill the width of whatever they sit in and redraw when it changes, so they work in a sidebar, a card grid or a full-width section without extra CSS.
|
|
53
54
|
|
|
@@ -135,6 +136,8 @@ One or more lines over time, with an axis, a legend and notes on key moments. Se
|
|
|
135
136
|
| `height` | chart height in px | `170` |
|
|
136
137
|
| `zero` | boolean, start the axis at zero | off |
|
|
137
138
|
| `straight` | boolean, straight lines instead of curves | off |
|
|
139
|
+
| `dash` | a line style per series: `solid`, `dashed`, `dotted`, `dashdot`. On its own, gives each series the next style | off |
|
|
140
|
+
| `markers` | a shape on each point, per series: `circle`, `square`, `triangle`, `diamond`, `none`. On its own, gives each series the next shape | off |
|
|
138
141
|
|
|
139
142
|
### `<bezel-bars>`
|
|
140
143
|
|
|
@@ -153,6 +156,7 @@ Bars, vertical or horizontal. Give it more than one series and you get **grouped
|
|
|
153
156
|
| `horizontal` | boolean, bars run left to right with labels beside them | off |
|
|
154
157
|
| `stacked` | boolean, with several series, piles them into one bar per group | off |
|
|
155
158
|
| `angle-labels` | boolean, slants labels under vertical bars when they don't fit side by side, so every one shows | off |
|
|
159
|
+
| `patterns` | with several series, a fill per series: `solid`, `stripes`, `dots`, `grid`. On its own, gives each series the next pattern | off |
|
|
156
160
|
| `highlight` | `none` to stop the highest bar standing out | on |
|
|
157
161
|
| `height` | chart height in px (vertical bars) | `140` |
|
|
158
162
|
|
|
@@ -185,6 +189,7 @@ How two measures move together. Pass matching `x` and `y` lists; separate groups
|
|
|
185
189
|
| `labels` | point names, shown in tooltips | |
|
|
186
190
|
| `x-label`, `y-label` | axis titles | |
|
|
187
191
|
| `trend` | boolean, a least-squares line per group with Pearson's r | off |
|
|
192
|
+
| `markers` | a point shape per group: `circle`, `square`, `triangle`, `diamond`. On its own, gives each group the next shape | circles |
|
|
188
193
|
| `zero` | boolean, start the y axis at zero | off |
|
|
189
194
|
| `height` | chart height in px | `210` |
|
|
190
195
|
|
|
@@ -298,7 +303,7 @@ Any of the above, picked with `type`: `<bezel-chart type="donut" values="3,2,1">
|
|
|
298
303
|
| `notes` | `point:text` pairs separated by `;`, e.g. `Jun:Launch;9:Peak`. A point is a label or, if no label matches, a position counted from 0 | |
|
|
299
304
|
| `show-values` | boolean, writes each value on the chart | off |
|
|
300
305
|
| `width` | a fixed width in px instead of filling the container | |
|
|
301
|
-
| `no-tooltips` | boolean, turns off hover and
|
|
306
|
+
| `no-tooltips` | boolean, turns off hover, tap and keyboard values, and leaves the chart out of the Tab order | off |
|
|
302
307
|
| `static` | boolean, skips the entrance animation | off |
|
|
303
308
|
|
|
304
309
|
Not every option suits every chart: `notes` works on spark, line and scatter; `show-values` on spark, line and bars; `goal-label` on spark, line, bars and scatter; `stat` on everything except the gauge and scatter. The Studio only shows what applies.
|
|
@@ -314,6 +319,36 @@ With `theme="auto"` (the default) a chart follows the viewer's light or dark set
|
|
|
314
319
|
|
|
315
320
|
Set `color` to use your own. Colours you set stay the same in both themes, so choose ones with enough contrast against both tile colours, or set `theme` to fix one.
|
|
316
321
|
|
|
322
|
+
## Accessibility
|
|
323
|
+
|
|
324
|
+
Every chart works without a mouse and without seeing it.
|
|
325
|
+
|
|
326
|
+
**Keyboard.** Press Tab to reach a chart. A focus ring shows where you are, then:
|
|
327
|
+
|
|
328
|
+
| Key | Does |
|
|
329
|
+
| --- | --- |
|
|
330
|
+
| Right or Down | The next value |
|
|
331
|
+
| Left or Up | The previous value |
|
|
332
|
+
| Home, End | The first or last value |
|
|
333
|
+
| Escape | Hides the tooltip |
|
|
334
|
+
|
|
335
|
+
The value you're on is outlined, with its tooltip showing. On a heatmap, Left and Right move a week and Up and Down move a day, following the grid. A chart keeps its place when it redraws, for example when the window resizes.
|
|
336
|
+
|
|
337
|
+
**Screen readers** hear the chart's name and summary, a hint about the arrow keys, and each value as you move, such as "Tue: 9. 2 of 7". Each chart also carries a hidden table of its data, with every value, including the small donut slices grouped as "Other" and the early weeks a narrow heatmap leaves out.
|
|
338
|
+
|
|
339
|
+
**Telling series apart.** Colour alone isn't enough for everyone, so lines can have their own dash, points their own shape, and grouped or stacked bars their own pattern. Use the attribute on its own to hand out styles in turn, or list one per series, in the same order as `color`:
|
|
340
|
+
|
|
341
|
+
```html
|
|
342
|
+
<bezel-line values="420,460,510|380,400,430" series="2026,2025" dash markers></bezel-line>
|
|
343
|
+
<bezel-bars values="4,9,6|3,7,8" series="2026,2025" labels="Q1,Q2,Q3" patterns="solid,stripes"></bezel-bars>
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
The legend shows each style, so it still matches the chart in black and white.
|
|
347
|
+
|
|
348
|
+
**Fewer tab stops.** A page with many charts gets a tab stop for each. Add `no-tooltips` to a chart that doesn't need exact values, such as a decorative sparkline: it drops the tooltips and the tab stop, and keeps the name and the hidden table.
|
|
349
|
+
|
|
350
|
+
**Images.** An exported SVG is a picture, so give it alt text that says what it shows: ``. The Python package writes this for you with `chart.alt`.
|
|
351
|
+
|
|
317
352
|
## Charts in a README
|
|
318
353
|
|
|
319
354
|
GitHub doesn't run scripts in a README, but it shows SVG images. So:
|
|
@@ -323,9 +358,11 @@ GitHub doesn't run scripts in a README, but it shows SVG images. So:
|
|
|
323
358
|
3. Add it to your README:
|
|
324
359
|
|
|
325
360
|
```md
|
|
326
|
-

|
|
361
|
+

|
|
327
362
|
```
|
|
328
363
|
|
|
364
|
+
Make the alt text say what the chart shows, since that's all a screen reader gets from an image.
|
|
365
|
+
|
|
329
366
|
The SVG is self-contained: no scripts, no fonts to load, no tooltips. It uses the system font, so it looks at home on GitHub, in Notion and in slides.
|
|
330
367
|
|
|
331
368
|
## JavaScript API
|
|
@@ -363,7 +400,7 @@ bc.line(df, x="month", y=["sales", "costs"], heading="Sales", prefix="£")
|
|
|
363
400
|
bc.spark(df["signups"], heading="Signups").save("docs/signups.svg")
|
|
364
401
|
```
|
|
365
402
|
|
|
366
|
-
All ten charts are available, and the Python output matches the JavaScript byte for byte, checked in CI. See the [Python README](python/README.md).
|
|
403
|
+
All ten charts are available, and the Python output matches the JavaScript byte for byte, checked in CI. `chart.alt` gives ready-made alt text for the saved image. See the [Python README](python/README.md).
|
|
367
404
|
|
|
368
405
|
## Frameworks
|
|
369
406
|
|
|
@@ -406,7 +443,7 @@ docs/ the README image and social preview, with the pages that render t
|
|
|
406
443
|
test/ node:test suites, plus a Playwright browser test
|
|
407
444
|
```
|
|
408
445
|
|
|
409
|
-
Each chart is a pure function that takes its options and a theme and returns an SVG string, which keeps them easy to test and lets the same code run in Node. The bundle has a
|
|
446
|
+
Each chart is a pure function that takes its options and a theme and returns an SVG string, which keeps them easy to test and lets the same code run in Node. The bundle has a 16 kB gzip budget, checked in CI. See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
410
447
|
|
|
411
448
|
## Security
|
|
412
449
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/*! Bezel Charts v1.
|
|
2
|
-
var BezelCharts=(()=>{var le=Object.defineProperty;var De=Object.getOwnPropertyDescriptor;var Ge=Object.getOwnPropertyNames;var Pe=Object.prototype.hasOwnProperty;var Ue=(t,e)=>{for(var r in e)le(t,r,{get:e[r],enumerable:!0})},He=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of Ge(e))!Pe.call(t,l)&&l!==r&&le(t,l,{get:()=>e[l],enumerable:!(i=De(e,l))||i.enumerable});return t};var Ie=t=>He(le({},"__esModule",{value:!0}),t);var Je={};Ue(Je,{BezelChart:()=>Vt,render:()=>Yt,themes:()=>Ht,toSVG:()=>Ae,types:()=>Fe,version:()=>Qe});var Ht={dark:{tile:"#15151d",bezel:"#000000",fg:"#f2f1f7",muted:"#8c8aa0",grid:"#2a2935",up:"#5EE6C8",down:"#F675A8",palette:["#9FA1FF","#F675A8","#5EE6C8","#FFC857","#7CC4FF","#FF8A5B"]},light:{tile:"#ffffff",bezel:"#000000",fg:"#17161f",muted:"#6b6980",grid:"#e8e6ef",up:"#12a383",down:"#d63f7c",palette:["#6E70F0","#E2508C","#16A884","#D99A0E","#2F8FE0","#EE6431"]}};var tt="ui-sans-serif,system-ui,-apple-system,'Segoe UI',Roboto,Helvetica,Arial,sans-serif",lt="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace",$e=0;function It(t){return"bzc"+t+(++$e).toString(36)+Math.random().toString(36).slice(2,6)}function ut(t){return String(t??"").replace(/[&<>"']/g,function(e){return{"&":"&","<":"<",">":">",'"':""","'":"'"}[e]})}function a(t){return Math.round(t*100)/100}function X(t,e,r){return Math.max(e,Math.min(r,t))}function _(t,e){var r=parseFloat(t);return isFinite(r)?r:e}function O(t){return t!=null&&t!==""}function ct(t){return Array.isArray(t)?t.map(function(e){var r=+e;return isFinite(r)?r:0}):O(t)?String(t).split(/[\s,;]+/).filter(Boolean).map(function(e){var r=+e;return isFinite(r)?r:0}):[]}function Z(t){return Array.isArray(t)?t.map(String):O(t)?String(t).split(",").map(function(e){return e.trim()}):[]}function Ct(t){return Array.isArray(t)?Array.isArray(t[0])?t.map(ct):[ct(t)]:O(t)?String(t).split("|").map(ct).filter(function(e){return e.length}):[]}function Lt(t){return t.reduce(function(e,r){return e+r},0)}function vt(t,e,r){return String(t).length*e*(r?.6:.56)}function Nt(t,e){return t=String(t),t.length>e?t.slice(0,Math.max(1,e-1))+"\u2026":t}function J(t){return t===!0||t===""||t==="true"||t==="1"}function g(t,e,r){if(!isFinite(t))return"\u2013";var i=Math.abs(t),l;O(e.decimals)?l=X(parseInt(e.decimals,10)||0,0,6):l=t%1===0?0:i<10?2:i<100?1:0;var n={maximumFractionDigits:l,minimumFractionDigits:O(e.decimals)?l:0};(J(e.compact)||r)&&i>=1e4&&(n={notation:"compact",maximumFractionDigits:1});var s;try{s=new Intl.NumberFormat(e.lang||"en-GB",n).format(i)}catch{s=String(a(i))}return(t<0?"\u2212":"")+(e.prefix||"")+s+(e.suffix||"")}function Qt(t,e,r){if(t===e)if(t===0)e=1;else{var i=Math.abs(t)*.1;t-=i,e+=i}for(var l=(e-t)/(r||4),n=Math.pow(10,Math.floor(Math.log10(l))),s=l/n,o=(s<=1?1:s<=2?2:s<=5?5:10)*n,c=Math.floor(t/o)*o,A=Math.ceil(e/o)*o,x=[],y=c;y<=A+o/2;y+=o)x.push(+y.toFixed(10));return{lo:c,hi:A,ticks:x}}function jt(t,e){if(!t.length)return"";for(var r="M"+a(t[0][0])+","+a(t[0][1]),i=1;i<t.length;i++){var l=t[i-1],n=t[i];if(e)r+="L"+a(n[0])+","+a(n[1]);else{var s=(l[0]+n[0])/2;r+="C"+a(s)+","+a(l[1])+" "+a(s)+","+a(n[1])+" "+a(n[0])+","+a(n[1])}}return r}function M(t,e,r,i){return'<text x="'+a(t)+'" y="'+a(e)+'" '+(i||"")+">"+ut(r)+"</text>"}function H(t,e,r,i){return'fill="'+(i||t.muted)+'" font-family="'+lt+'" font-size="'+(e||10)+'"'+(r?" "+r:"")}function pt(t,e,r,i,l){return'<rect class="bzc-hit" x="'+a(t)+'" y="'+a(e)+'" width="'+a(Math.max(1,r))+'" height="'+a(Math.max(1,i))+'" fill="#000" fill-opacity="0" data-tip="'+ut(l)+'"/>'}function ot(t,e,r){return t.animate?' class="'+e+'"'+(r?' style="animation-delay:'+a(r)+'s"':""):""}function at(t,e){var r=Z(t.color).filter(Boolean);return r.length?r:e.palette}function nt(t,e,r,i,l){return M(e+i/2,r+l/2+4,"No data yet",'text-anchor="middle" fill="'+t.muted+'" font-family="'+tt+'" font-size="13"')}function $t(t,e){return O(t.notes)?String(t.notes).split(";").map(function(r){var i=r.indexOf(":");if(i<0)return null;var l=r.slice(0,i).trim(),n=r.slice(i+1).trim(),s=e.map(String).indexOf(l);return s<0&&String(parseInt(l,10))===l&&(s=parseInt(l,10)),s>=0&&n?{i:s,text:n}:null}).filter(Boolean):[]}function At(t,e,r,i,l){var n=(O(t.goalLabel)?t.goalLabel:"Goal")+" "+g(_(t.goal,0),t);return'<line x1="'+a(r)+'" x2="'+a(i)+'" y1="'+a(l)+'" y2="'+a(l)+'" stroke="'+e.fg+'" stroke-opacity=".55" stroke-width="1.25" stroke-dasharray="4 4"/>'+M(i,l-5,n,H(e,10,'text-anchor="end"'))}function xt(t,e,r){var i=String(O(e.stat)?e.stat:r||"").toLowerCase();if(!i||i==="none"||!t.length)return null;var l=Lt(t),n={last:t[t.length-1],total:l,sum:l,average:l/t.length,avg:l/t.length,max:Math.max.apply(null,t),min:Math.min.apply(null,t)};if(!(i in n))return null;var s=null;return i==="last"&&t.length>1&&e.delta!=="none"&&(s=t[t.length-1]-t[0]),{val:n[i],delta:s}}function Rt(t,e,r,i,l,n){var s=i,o=l,c="";return t.forEach(function(A,x){var y=13+vt(A,12)+16;s>i&&s+y-16>i+n&&(s=i,o+=20),c+='<circle cx="'+a(s+4)+'" cy="'+a(o+6)+'" r="4" fill="'+e[x%e.length]+'"/>'+M(s+13,o+10,A,'fill="'+r.fg+'" font-family="'+tt+'" font-size="12"'),s+=y}),{svg:c,height:o-l+24}}function Ee(t){return Math.max.apply(null,t.map(function(e){return vt(e,10,!0)}))+10}function Bt(t){var e=Math.round(X(_(t.width,360),160,2400)),r=t.frame==="none"?0:4,i=t.frame==="none"?8:20;return{W:e,b:r,P:i,w:e-2*(r+i)}}var Ye=".bzc-a{animation:bzc-in .6s ease both}.bzc-d{animation:bzc-draw 1.1s cubic-bezier(.3,.7,.2,1) both}.bzc-g{transform-box:fill-box;transform-origin:50% 100%;animation:bzc-grow .7s cubic-bezier(.2,.8,.2,1) both}.bzc-gn{transform-box:fill-box;transform-origin:50% 0;animation:bzc-grow .7s cubic-bezier(.2,.8,.2,1) both}.bzc-gx{transform-box:fill-box;transform-origin:0 50%;animation:bzc-growx .8s cubic-bezier(.2,.8,.2,1) both}.bzc-s{animation:bzc-sweep 1.1s cubic-bezier(.2,.8,.2,1) both}@keyframes bzc-in{from{opacity:0}}@keyframes bzc-draw{from{stroke-dashoffset:1}}@keyframes bzc-grow{from{transform:scaleY(0)}}@keyframes bzc-growx{from{transform:scaleX(0)}}@keyframes bzc-sweep{from{stroke-dasharray:0 100}}@media (prefers-reduced-motion:reduce){[class^=bzc-]{animation:none!important}}";function it(t,e,r,i,l){var n=Bt(t),s=n.W,o=n.b,c=n.P,A=n.w,x=X(_(t.corners,22),0,60),y=o+c,u="";O(t.heading)&&(u+=M(o+c,y+10,String(t.heading).toUpperCase(),H(e,11,'font-weight="600" letter-spacing="1.3"')),y+=24);var S=l&&l.stat;if(S){if(u+=M(o+c,y+30,g(S.val,t),'fill="'+e.fg+'" font-family="'+tt+'" font-size="32" font-weight="800" letter-spacing="-0.5"'),S.delta!=null){var F=S.delta>0,C=S.delta===0,T=t.delta==="inverse"?!F:F,k=C?e.muted:T?e.up:e.down,E=(C?"\u25CF ":F?"\u25B2 ":"\u25BC ")+g(Math.abs(S.delta),t)+" "+(O(t.deltaLabel)?t.deltaLabel:"since start");u+=M(o+c+A,y+28,E,'text-anchor="end" fill="'+k+'" font-family="'+lt+'" font-size="11" font-weight="600"')}y+=44}var f=i(o+c,y,A,r),R=Math.round(y+r+c+o),v="";t.frame!=="none"?v='<rect width="'+s+'" height="'+R+'" rx="'+x+'" fill="'+e.bezel+'"/><rect x="'+o+'" y="'+o+'" width="'+(s-2*o)+'" height="'+(R-2*o)+'" rx="'+Math.max(0,x-o)+'" fill="'+(t.background||e.tile)+'"/>':O(t.background)&&(v='<rect width="'+s+'" height="'+R+'" rx="'+x+'" fill="'+t.background+'"/>');var b=(O(t.heading)?t.heading+": ":"")+(l&&l.summary||"chart");return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 '+s+" "+R+'" width="'+s+'" height="'+R+'" role="img" aria-label="'+ut(b)+'"><title>'+ut(b)+"</title>"+(t.animate?"<style>"+Ye+"</style>":"")+v+u+f+"</svg>"}function oe(t,e){var r=ct(t.values),i=at(t,e)[0],l=_(t.height,64),n=Z(t.labels),s=$t(t,n),o=xt(r,t,"last");return it(t,e,l,function(c,A,x,y){if(!r.length)return nt(e,c,A,x,y);var u=r.length===1?[r[0],r[0]]:r,S=Math.min.apply(null,u),F=Math.max.apply(null,u);O(t.goal)&&(S=Math.min(S,+t.goal),F=Math.max(F,+t.goal));var C=(F-S||Math.abs(F)||1)*.12;S-=C,F+=C;var T=function(m){return c+m*x/(u.length-1)},k=function(m){return A+y-(m-S)/(F-S)*y},E=u.map(function(m,h){return[T(h),k(m)]}),f=jt(E,J(t.straight)),R=It("g"),v=E[E.length-1],b='<defs><linearGradient id="'+R+'" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="'+i+'" stop-opacity=".32"/><stop offset="1" stop-color="'+i+'" stop-opacity="0"/></linearGradient></defs>';[1/3,2/3].forEach(function(m){b+='<line x1="'+c+'" x2="'+(c+x)+'" y1="'+a(A+y*m)+'" y2="'+a(A+y*m)+'" stroke="'+e.grid+'" stroke-dasharray="2 4"/>'}),b+='<path d="'+f+"L"+a(v[0])+","+(A+y)+"L"+c+","+(A+y)+'Z" fill="url(#'+R+')"'+ot(t,"bzc-a")+"/>",b+='<path d="'+f+'" fill="none" stroke="'+i+'" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" pathLength="1" style="stroke-dasharray:1"'+ot(t,"bzc-d")+"/>",O(t.goal)&&(b+=At(t,e,c,c+x,k(+t.goal))),s.forEach(function(m){if(!(m.i>=r.length)){var h=E[m.i];b+='<circle cx="'+a(h[0])+'" cy="'+a(h[1])+'" r="3.5" fill="'+e.fg+'"/>'+M(X(h[0],c+30,c+x-30),h[1]-9,m.text,H(e,10,'text-anchor="middle"',e.fg))}}),b+='<circle cx="'+a(v[0])+'" cy="'+a(v[1])+'" r="9" fill="'+i+'" fill-opacity=".25"/><circle cx="'+a(v[0])+'" cy="'+a(v[1])+'" r="4.5" fill="'+i+'"/>',J(t.showValues)&&E.forEach(function(m,h){h<r.length&&(b+=M(m[0],m[1]-8,g(r[h],t,!0),H(e,9,'text-anchor="middle"')))});var N=r.length>1?x/(r.length-1):x;return r.forEach(function(m,h){b+=pt(T(h)-N/2,A-6,N,y+12,(n[h]||"#"+(h+1))+": "+g(m,t))}),b},{stat:o,summary:r.length?"latest "+g(r[r.length-1],t):"no data"})}function se(t,e){var r=Ct(t.values),i=Z(t.series),l=Z(t.labels),n=at(t,e),s=_(t.height,170),o=Math.max.apply(null,[0].concat(r.map(function(y){return y.length}))),c=$t(t,l),A=r.length>1||i.length>0,x=xt(r[0]||[],t,"");return it(t,e,s,function(y,u,S,F){if(!o)return nt(e,y,u,S,F);var C="",T=u;if(A){var k=Rt(r.map(function(w,z){return i[z]||"Series "+(z+1)}),n,e,y,T,S);C+=k.svg,T+=k.height}var E=[].concat.apply([],r),f=Math.min.apply(null,E),R=Math.max.apply(null,E);O(t.goal)&&(f=Math.min(f,+t.goal),R=Math.max(R,+t.goal)),J(t.zero)&&(f=Math.min(0,f),R=Math.max(0,R));var v=Qt(f,R,4),b=v.ticks.map(function(w){return g(w,t,!0)}),N=Math.max.apply(null,b.map(function(w){return vt(w,10,!0)}))+10,m=l.length?20:4,h=y+N,I=S-N,p=F-(T-u)-m,D=function(w){return o===1?h+I/2:h+w*I/(o-1)},L=function(w){return T+p-(w-v.lo)/(v.hi-v.lo)*p};if(v.ticks.forEach(function(w,z){var $=L(w);C+='<line x1="'+a(h)+'" x2="'+a(h+I)+'" y1="'+a($)+'" y2="'+a($)+'" stroke="'+e.grid+'"'+(w===0?"":' stroke-dasharray="2 4"')+"/>"+M(h-8,$+3.5,b[z],H(e,10,'text-anchor="end"'))}),l.length){for(var U=Math.max(1,Math.ceil(o*(Math.max.apply(null,l.map(function(w){return vt(w,10,!0)}))+10)/I)),W=0;W<o;W+=U)if(l[W]!=null){var q=o>1&&W===0?"start":o>1&&W===o-1?"end":"middle";C+=M(D(W),T+p+15,l[W],H(e,10,'text-anchor="'+q+'"'))}}c.forEach(function(w){if(!(w.i>=o)){var z=D(w.i);C+='<line x1="'+a(z)+'" x2="'+a(z)+'" y1="'+a(T+12)+'" y2="'+a(T+p)+'" stroke="'+e.fg+'" stroke-opacity=".4" stroke-dasharray="3 3"/>'+M(X(z,h+30,h+I-30),T+8,w.text,H(e,10,'text-anchor="middle"',e.fg))}}),r.forEach(function(w,z){var $=n[z%n.length],G=w.map(function(mt,B){return[D(B),L(mt)]});G.length===1&&(G=[[h,G[0][1]],[h+I,G[0][1]]]);var dt=jt(G,J(t.straight));if(z===0){var ht=It("g"),et=G[G.length-1];C+='<defs><linearGradient id="'+ht+'" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="'+$+'" stop-opacity=".26"/><stop offset="1" stop-color="'+$+'" stop-opacity="0"/></linearGradient></defs><path d="'+dt+"L"+a(et[0])+","+a(T+p)+"L"+a(G[0][0])+","+a(T+p)+'Z" fill="url(#'+ht+')"'+ot(t,"bzc-a")+"/>"}C+='<path d="'+dt+'" fill="none" stroke="'+$+'" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" pathLength="1" style="stroke-dasharray:1'+(t.animate?";animation-delay:"+z*.15+"s":"")+'"'+(t.animate?' class="bzc-d"':"")+"/>";var ft=G[G.length-1];C+='<circle cx="'+a(ft[0])+'" cy="'+a(ft[1])+'" r="4" fill="'+$+'" stroke="'+(t.background||e.tile)+'" stroke-width="2"/>',J(t.showValues)&&w.forEach(function(mt,B){C+=M(D(B),L(mt)-8,g(mt,t,!0),H(e,9,'text-anchor="middle"'))})}),O(t.goal)&&(C+=At(t,e,h,h+I,L(+t.goal)));for(var st=o>1?I/(o-1):I,Q=0;Q<o;Q++){var d=l[Q]||"#"+(Q+1);r.forEach(function(w,z){Q<w.length&&(d+=`
|
|
3
|
-
`+(
|
|
4
|
-
`+
|
|
5
|
-
Total: `+g(C[d],t):""):m(d)+": "+g(u[d],t)},I=Bt(t),p=c||i.length?Rt(r.map(function(d,w){return v(w)}),n,e,0,0,I.w).height:0,D=x?1:s,L=c&&!x,U=L?10:14,W=3,q=A?D*U+(D-1)*W+(L?14:16):0,st=A?p+Math.max(1,o)*q-6:_(t.height,140)+p,Q=u.indexOf(Math.max.apply(null,u.length?u:[0]));return it(t,e,st,function(d,w,z,$){if(!o)return nt(e,d,w,z,$);var G="",dt=w;p&&(G+=Rt(r.map(function(P,j){return v(j)}),n,e,d,w,z).svg,dt+=p);var ht=Math.min(0,Math.min.apply(null,f)),et=Math.max(0,R);if(O(t.goal)&&(ht=Math.min(ht,+t.goal),et=Math.max(et,+t.goal)),et===ht&&(et=ht+1),A){for(var ft=l.length?Math.min(z*.4,Math.max.apply(null,l.map(function(P){return vt(P,12)}))+10):0,mt=x?[C.map(function(P){return g(P,t)})]:r.map(function(P){return P.map(function(j){return g(j,t)})}),B=Math.max.apply(null,[].concat.apply([],mt).map(function(P){return vt(P,L?10:11,!0)}))+10,Y=d+ft,V=z-ft-B,kt=Math.max(et,0)||1,K=0;K<o;K++){var bt=dt+K*q;l[K]!=null&&(G+=M(d,bt+(q-6)/2+4,Nt(l[K],Math.floor(ft/6.7)),'fill="'+e.fg+'" font-family="'+tt+'" font-size="12"')),x?(G+=Dt(K,Y,bt+5,V,kt),G+=M(d+z,bt+5+U/2+3.8,mt[0][K],'text-anchor="end" fill="'+e.fg+'" font-family="'+lt+'" font-size="11" font-weight="600"')):r.forEach(function(P,j){if(!(K>=P.length)){var rt=P[K],yt=bt+(c?2:5)+j*(U+W),wt=Math.max(0,rt)/kt*V;c||(G+='<rect x="'+a(Y)+'" y="'+a(yt)+'" width="'+a(V)+'" height="'+U+'" rx="'+U/2+'" fill="'+e.grid+'" fill-opacity=".6"/>'),wt>0&&(G+='<rect x="'+a(Y)+'" y="'+a(yt)+'" width="'+a(Math.max(U,wt))+'" height="'+U+'" rx="'+U/2+'" fill="'+b(j,K)+'" fill-opacity="'+N(rt)+'"'+ot(t,"bzc-gx",K*.06+j*.03)+"/>"),G+=M(d+z,yt+U/2+3.8,mt[j][K],'text-anchor="end" fill="'+e.fg+'" font-family="'+lt+'" font-size="'+(c?10:11)+'" font-weight="600"')}}),G+=pt(d,bt,z,q-6,h(K))}if(O(t.goal)&&+t.goal>0){var Ot=Y+ +t.goal/kt*V;G+='<line x1="'+a(Ot)+'" x2="'+a(Ot)+'" y1="'+a(dt-2)+'" y2="'+a(w+$+2)+'" stroke="'+e.fg+'" stroke-opacity=".55" stroke-dasharray="3 3"/>'}return G}function Dt(P,j,rt,yt,wt){var zt='<rect x="'+a(j)+'" y="'+a(rt)+'" width="'+a(yt)+'" height="'+U+'" rx="'+U/2+'" fill="'+e.grid+'" fill-opacity=".6"/>',Pt=0;return r.forEach(function(qt,St){var Ut=P<qt.length?qt[P]:0,Et=Math.max(0,Ut)/wt*yt;if(!(Et<=0)){var Ft=Pt>0?1.5:0;zt+='<rect x="'+a(j+Pt+Ft)+'" y="'+a(rt)+'" width="'+a(Math.max(2,Et-Ft))+'" height="'+U+'" rx="'+a(Math.min(3,Et/2))+'" fill="'+b(St,P)+'"'+ot(t,"bzc-gx",P*.06+St*.03)+"/>",Pt+=Et}}),zt}var xe=l.length?Math.max.apply(null,l.map(function(P){return vt(P,10,!0)})):0,te=l.length?Math.max(1,Math.ceil(o*(xe+8)/z)):1,Wt=J(t.angleLabels)&&te>1,ye=Le*Math.PI/180,be=function(P){return Wt?Nt(P,Oe):P};if(Wt){var Ce=z/o,Gt=0;l.forEach(function(P,j){Gt=Math.max(Gt,Math.cos(ye)*vt(be(P),10,!0)+4-(j+.5)*Ce)}),Gt=Math.min(Gt,z*.25),d+=Gt,z-=Gt,te=1}var Me=J(t.showValues)&&ht<0?14:0,Ne=Wt?Math.ceil(Math.sin(ye)*Math.min(xe,vt("x".repeat(Oe),10,!0)))+18:20,Re=(l.length?Ne:2)+Me,ke=J(t.showValues)?16:4,ee=$-(dt-w)-Re-ke,we=dt+ke,Mt=function(P){return we+ee-(P-ht)/(et-ht)*ee},Xt=z/o,_t=Math.min(Xt*(L?.78:.62),L?s*30:56),ze=L?Math.min(3,_t/s*.15):0,Tt=x?_t:(_t-ze*(s-1))/s,Kt=Mt(0);G+='<line x1="'+d+'" x2="'+(d+z)+'" y1="'+a(Kt)+'" y2="'+a(Kt)+'" stroke="'+e.grid+'"/>';for(var gt=0;gt<o;gt++){var re=d+gt*Xt+(Xt-_t)/2;if(x?G+=Be(gt,re):r.forEach(function(P,j){if(!(gt>=P.length)){var rt=P[gt],yt=re+j*(Tt+ze),wt=Math.min(Mt(rt),Kt),zt=Math.abs(Mt(rt)-Kt);zt>.5&&(G+='<rect x="'+a(yt)+'" y="'+a(wt)+'" width="'+a(Tt)+'" height="'+a(zt)+'" rx="'+a(Math.min(6,Tt/2,zt/2))+'" fill="'+b(j,gt)+'" fill-opacity="'+N(rt)+'"'+ot(t,rt<0?"bzc-gn":"bzc-g",gt*.05+j*.03)+"/>"),J(t.showValues)&&(G+=M(yt+Tt/2,rt<0?Mt(rt)+12:Mt(rt)-5,g(rt,t,!0),'text-anchor="middle" fill="'+e.fg+'" font-family="'+lt+'" font-size="'+(c?9:10)+'" font-weight="600"'))}}),l[gt]!=null&>%te===0){var ae=re+_t/2,ne=we+ee+Me+(Wt?12:15);G+=Wt?M(ae,ne,be(l[gt]),H(e,10,'text-anchor="end" transform="rotate(-'+Le+" "+a(ae)+" "+a(ne)+')"')):M(ae,ne,l[gt],H(e,10,'text-anchor="middle"'))}G+=pt(d+gt*Xt,dt,Xt,$-(dt-w),h(gt))}return O(t.goal)&&(G+=At(t,e,d,d+z,Mt(+t.goal))),G;function Be(P,j){var rt="",yt=0,wt=0;if(r.forEach(function(Pt,qt){var St=P<Pt.length?Pt[P]:0;if(St){var Ut=St>0?yt:wt,Et=Ut+St;St>0?yt=Et:wt=Et;var Ft=Mt(Math.max(Ut,Et)),ie=Mt(Math.min(Ut,Et)),Zt=ie-Ft,Se=Ut!==0?Math.min(1.5,Zt/2):0;St>0?ie-=Se:Ft+=Se,Zt=ie-Ft,Zt>.5&&(rt+='<rect x="'+a(j)+'" y="'+a(Ft)+'" width="'+a(Tt)+'" height="'+a(Zt)+'" rx="'+a(Math.min(3,Tt/2,Zt/2))+'" fill="'+b(qt,P)+'"'+ot(t,St<0?"bzc-gn":"bzc-g",P*.05+qt*.03)+"/>")}}),J(t.showValues)){var zt=C[P];rt+=M(j+Tt/2,zt<0?Mt(k[P])+12:Mt(T[P])-5,g(zt,t,!0),'text-anchor="middle" fill="'+e.fg+'" font-family="'+lt+'" font-size="10" font-weight="600"')}return rt}},{stat:xt(u,t,""),summary:o?x?s+" series stacked across "+o+" groups":c?s+" series across "+o+" groups":"highest "+(l[Q]||"")+" "+g(u[Q],t):"no data"})}function ce(t,e){var r=ct(t.values),i=Z(t.labels),l=at(t,e),n=_(t.max,100)||100,s=_(t.height,140),o=!O(t.prefix)&&!O(t.suffix)&&n===100,c=function(x){return g(x,t)+(o?"%":"")},A=xt(r,t,"");return it(t,e,s,function(x,y,u,S){if(!r.length)return nt(e,x,y,u,S);var F="",C=r.length===1,T=Math.min(S,C?u:u*.55),k=C?x+u/2:x+T/2,E=y+S/2,f=C?T*.12:X(T*.42/(r.length*1.35),5,16),R=f*.38;if(r.forEach(function(m,h){var I=T/2-f/2-h*(f+R);if(!(I<=f/2)){var p=X(m/n*100,0,100),D=l[h%l.length];F+='<circle cx="'+a(k)+'" cy="'+a(E)+'" r="'+a(I)+'" fill="none" stroke="'+D+'" stroke-opacity=".16" stroke-width="'+a(f)+'"/>',p>0&&(F+='<circle cx="'+a(k)+'" cy="'+a(E)+'" r="'+a(I)+'" fill="none" stroke="'+D+'" stroke-width="'+a(f)+'" stroke-linecap="round" pathLength="100" transform="rotate(-90 '+a(k)+" "+a(E)+')" style="stroke-dasharray:'+a(p)+" 100"+(t.animate?";animation-delay:"+h*.12+"s":"")+'"'+(t.animate?' class="bzc-s"':"")+"/>"),F+='<circle cx="'+a(k)+'" cy="'+a(E)+'" r="'+a(I+f/2)+'" fill="#000" fill-opacity="0" class="bzc-hit" data-tip="'+ut((i[h]||"#"+(h+1))+": "+c(m)+(o?"":" of "+g(n,t)))+'"/>'}}),C)F+=M(k,E+T*.08,c(r[0]),'text-anchor="middle" fill="'+e.fg+'" font-family="'+tt+'" font-size="'+a(T*.22)+'" font-weight="800"'),i[0]&&(F+=M(k,E+T*.08+16,i[0],H(e,10,'text-anchor="middle"')));else{var v=x+T+22,b=Math.min(26,S/r.length),N=E-b*r.length/2;r.forEach(function(m,h){var I=N+h*b+b/2;F+='<circle cx="'+a(v+4)+'" cy="'+a(I)+'" r="4" fill="'+l[h%l.length]+'"/>'+M(v+14,I+4,Nt(i[h]||"#"+(h+1),Math.floor((x+u-v-60)/6.7)),'fill="'+e.fg+'" font-family="'+tt+'" font-size="12"')+M(x+u,I+4,c(m),'text-anchor="end" fill="'+e.fg+'" font-family="'+lt+'" font-size="11" font-weight="600"')})}return F},{stat:A,summary:r.map(function(x,y){return(i[y]?i[y]+" ":"")+c(x)}).join(", ")})}function ue(t,e){var r=ct(t.values).map(function(u){return Math.max(0,u)}),i=Z(t.labels),l=at(t,e),n=r.slice(),s=i.slice();if(n.length>6){var o=n.map(function(u,S){return S}).sort(function(u,S){return r[S]-r[u]}),c=o.slice(0,5).sort(function(u,S){return u-S});n=c.map(function(u){return r[u]}),s=c.map(function(u){return i[u]||"#"+(u+1)}),n.push(Lt(o.slice(5).map(function(u){return r[u]}))),s.push("Other")}var A=Lt(n),x=_(t.height,150),y=xt(n,t,"");return it(t,e,x,function(u,S,F,C){if(!A)return nt(e,u,S,F,C);var T="",k=Math.min(C,F*.5),E=u+k/2,f=S+C/2,R=k*.16,v=(k-R)/2,b=0,N=n.filter(Boolean).length>1?.9:0;n.forEach(function(p,D){var L=p/A*100;if(!(L<=0)){var U=Math.max(.01,L-N);T+='<circle cx="'+a(E)+'" cy="'+a(f)+'" r="'+a(v)+'" fill="none" stroke="'+l[D%l.length]+'" stroke-width="'+a(R)+'" pathLength="100" stroke-dasharray="'+a(U)+" "+a(100-U)+'" stroke-dashoffset="'+a(-b)+'" transform="rotate(-90 '+a(E)+" "+a(f)+')"'+ot(t,"bzc-a",D*.08)+"/>",b+=L}}),T+=M(E,f+2,g(A,t,!0),'text-anchor="middle" fill="'+e.fg+'" font-family="'+tt+'" font-size="'+a(k*.17)+'" font-weight="800"'),T+=M(E,f+2+14,(O(t.centerLabel)?t.centerLabel:"Total").toUpperCase(),H(e,9,'text-anchor="middle" letter-spacing="1"'));var m=u+k+22,h=Math.min(24,C/n.length),I=f-h*n.length/2;return n.forEach(function(p,D){var L=I+D*h+h/2,U=Math.round(p/A*100),W=(s[D]||"#"+(D+1))+": "+g(p,t)+" ("+U+"%)";T+='<circle cx="'+a(m+4)+'" cy="'+a(L)+'" r="4" fill="'+l[D%l.length]+'"/>'+M(m+14,L+4,Nt(s[D]||"#"+(D+1),Math.floor((u+F-m-50)/6.7)),'fill="'+e.fg+'" font-family="'+tt+'" font-size="12"')+M(u+F,L+4,U+"%",'text-anchor="end" fill="'+e.muted+'" font-family="'+lt+'" font-size="11" font-weight="600"')+pt(m,L-h/2,u+F-m,h,W)}),b=0,n.forEach(function(p,D){var L=p/A*100;L<=0||(T+='<circle cx="'+a(E)+'" cy="'+a(f)+'" r="'+a(v)+'" fill="none" stroke="#000" stroke-opacity="0" stroke-width="'+a(R)+'" pathLength="100" stroke-dasharray="'+a(L)+" "+a(100-L)+'" stroke-dashoffset="'+a(-b)+'" transform="rotate(-90 '+a(E)+" "+a(f)+')" class="bzc-hit" data-tip="'+ut((s[D]||"#"+(D+1))+": "+g(p,t)+" ("+Math.round(L)+"%)")+'"/>',b+=L)}),T},{stat:y,summary:"total "+g(A,t)+" across "+n.length+" parts"})}function he(t,e){var r=ct(t.values),i=r.length?r[0]:_(t.value,NaN),l=Z(t.labels),n=_(t.min,0),s=_(t.max,100),o=_(t.height,130);s===n&&(s=n+1);var c=ct(t.zones),A=at(t,e),x=Z(t.color).filter(Boolean).length>1?A:[e.up,e.palette[3],e.down],y=A[0];if(c.length&&isFinite(i)){for(var u=0;u<c.length&&i>=c[u];)u++;y=x[Math.min(u,x.length-1)]}var S=!O(t.prefix)&&!O(t.suffix)&&n===0&&s===100,F=function(C){return g(C,t)+(S?"%":"")};return it(t,e,o,function(C,T,k,E){if(!isFinite(i))return nt(e,C,T,k,E);var f=Math.min(k/2,E-22),R=f*.16,v=f-R/2,b=C+k/2,N=T+f,m=X((i-n)/(s-n),0,1),h=function(q,st){var Q=Math.PI*(1-q);return[b+st*Math.cos(Q),N-st*Math.sin(Q)]},I="M"+a(b-v)+","+a(N)+"A"+a(v)+","+a(v)+" 0 0 1 "+a(b+v)+","+a(N),p='<path d="'+I+'" fill="none" stroke="'+y+'" stroke-opacity=".16" stroke-width="'+a(R)+'" stroke-linecap="round"/>';c.length&&c.forEach(function(q){var st=X((q-n)/(s-n),0,1),Q=h(st,v-R/2-3),d=h(st,v-R/2-8);p+='<line x1="'+a(Q[0])+'" y1="'+a(Q[1])+'" x2="'+a(d[0])+'" y2="'+a(d[1])+'" stroke="'+e.muted+'" stroke-width="1.5"/>'}),m>0&&(p+='<path d="'+I+'" fill="none" stroke="'+y+'" stroke-width="'+a(R)+'" stroke-linecap="round" pathLength="100" style="stroke-dasharray:'+a(m*100)+' 100"'+ot(t,"bzc-s")+"/>");var D=h(m,v);if(p+='<circle cx="'+a(D[0])+'" cy="'+a(D[1])+'" r="'+a(R*.26)+'" fill="'+(t.background||e.tile)+'"'+ot(t,"bzc-a",.9)+"/>",O(t.goal)){var L=X((+t.goal-n)/(s-n),0,1),U=h(L,v+R/2+4),W=h(L,v-R/2-4);p+='<line x1="'+a(U[0])+'" y1="'+a(U[1])+'" x2="'+a(W[0])+'" y2="'+a(W[1])+'" stroke="'+e.fg+'" stroke-width="2" stroke-linecap="round"/>'}return p+=M(b,N-f*.12,F(i),'text-anchor="middle" fill="'+e.fg+'" font-family="'+tt+'" font-size="'+a(f*.34)+'" font-weight="800"'),l[0]&&(p+=M(b,N-f*.12+16,l[0],H(e,10,'text-anchor="middle"'))),p+=M(b-v,N+18,g(n,t,!0),H(e,10,'text-anchor="middle"'))+M(b+v,N+18,g(s,t,!0),H(e,10,'text-anchor="middle"')),p+=pt(b-f,N-f,f*2,f,(l[0]?l[0]+": ":"")+F(i)+" (range "+g(n,t)+" to "+g(s,t)+")"+(O(t.goal)?`
|
|
6
|
-
Goal: `+
|
|
7
|
-
`:F
|
|
8
|
-
`:"")+(
|
|
9
|
-
`+(
|
|
1
|
+
/*! Bezel Charts v1.2.0 | MIT | github.com/ShazMoghaddam/bezel-charts */
|
|
2
|
+
var BezelCharts=(()=>{var Se=Object.defineProperty;var tr=Object.getOwnPropertyDescriptor;var er=Object.getOwnPropertyNames;var rr=Object.prototype.hasOwnProperty;var ar=(t,e)=>{for(var r in e)Se(t,r,{get:e[r],enumerable:!0})},nr=(t,e,r,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of er(e))!rr.call(t,i)&&i!==r&&Se(t,i,{get:()=>e[i],enumerable:!(l=tr(e,i))||l.enumerable});return t};var ir=t=>nr(Se({},"__esModule",{value:!0}),t);var vr={};ar(vr,{BezelChart:()=>Jt,render:()=>Qt,themes:()=>Gt,toSVG:()=>We,types:()=>_e,version:()=>gr});var Gt={dark:{tile:"#15151d",bezel:"#000000",fg:"#f2f1f7",muted:"#8c8aa0",grid:"#2a2935",up:"#5EE6C8",down:"#F675A8",palette:["#9FA1FF","#F675A8","#5EE6C8","#FFC857","#7CC4FF","#FF8A5B"]},light:{tile:"#ffffff",bezel:"#000000",fg:"#17161f",muted:"#6b6980",grid:"#e8e6ef",up:"#12a383",down:"#d63f7c",palette:["#6E70F0","#E2508C","#16A884","#D99A0E","#2F8FE0","#EE6431"]}};var it="ui-sans-serif,system-ui,-apple-system,'Segoe UI',Roboto,Helvetica,Arial,sans-serif",dt="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace",lr=0;function Ht(t){return"bzc"+t+(++lr).toString(36)+Math.random().toString(36).slice(2,6)}function at(t){return String(t??"").replace(/[&<>"']/g,function(e){return{"&":"&","<":"<",">":">",'"':""","'":"'"}[e]})}function a(t){return Math.round(t*100)/100}function _(t,e,r){return Math.max(e,Math.min(r,t))}function I(t,e){var r=parseFloat(t);return isFinite(r)?r:e}function v(t){return t!=null&&t!==""}function K(t){return Array.isArray(t)?t.map(function(e){var r=+e;return isFinite(r)?r:0}):v(t)?String(t).split(/[\s,;]+/).filter(Boolean).map(function(e){var r=+e;return isFinite(r)?r:0}):[]}function U(t){return Array.isArray(t)?t.map(String):v(t)?String(t).split(",").map(function(e){return e.trim()}):[]}function Et(t){return Array.isArray(t)?Array.isArray(t[0])?t.map(K):[K(t)]:v(t)?String(t).split("|").map(K).filter(function(e){return e.length}):[]}function zt(t){return t.reduce(function(e,r){return e+r},0)}function bt(t,e,r){return String(t).length*e*(r?.6:.56)}function Bt(t,e){return t=String(t),t.length>e?t.slice(0,Math.max(1,e-1))+"\u2026":t}function j(t){return t===!0||t===""||t==="true"||t==="1"}function h(t,e,r){if(!isFinite(t))return"\u2013";var l=Math.abs(t),i;v(e.decimals)?i=_(parseInt(e.decimals,10)||0,0,6):i=t%1===0?0:l<10?2:l<100?1:0;var n={maximumFractionDigits:i,minimumFractionDigits:v(e.decimals)?i:0};(j(e.compact)||r)&&l>=1e4&&(n={notation:"compact",maximumFractionDigits:1});var s;try{s=new Intl.NumberFormat(e.lang||"en-GB",n).format(l)}catch{s=String(a(l))}return(t<0?"\u2212":"")+(e.prefix||"")+s+(e.suffix||"")}function ae(t,e,r){if(t===e)if(t===0)e=1;else{var l=Math.abs(t)*.1;t-=l,e+=l}for(var i=(e-t)/(r||4),n=Math.pow(10,Math.floor(Math.log10(i))),s=i/n,o=(s<=1?1:s<=2?2:s<=5?5:10)*n,c=Math.floor(t/o)*o,x=Math.ceil(e/o)*o,g=[],d=c;d<=x+o/2;d+=o)g.push(+d.toFixed(10));return{lo:c,hi:x,ticks:g}}function ie(t,e){if(!t.length)return"";for(var r="M"+a(t[0][0])+","+a(t[0][1]),l=1;l<t.length;l++){var i=t[l-1],n=t[l];if(e)r+="L"+a(n[0])+","+a(n[1]);else{var s=(i[0]+n[0])/2;r+="C"+a(s)+","+a(i[1])+" "+a(s)+","+a(n[1])+" "+a(n[0])+","+a(n[1])}}return r}function S(t,e,r,l){return'<text x="'+a(t)+'" y="'+a(e)+'" '+(l||"")+">"+at(r)+"</text>"}function G(t,e,r,l){return'fill="'+(l||t.muted)+'" font-family="'+dt+'" font-size="'+(e||10)+'"'+(r?" "+r:"")}function vt(t,e,r,l,i){return'<rect class="bzc-hit" x="'+a(t)+'" y="'+a(e)+'" width="'+a(Math.max(1,r))+'" height="'+a(Math.max(1,l))+'" fill="#000" fill-opacity="0" data-tip="'+at(i)+'"/>'}function lt(t,e,r){return t.animate?' class="'+e+'"'+(r?' style="animation-delay:'+a(r)+'s"':""):""}function ut(t,e){var r=U(t.color).filter(Boolean);return r.length?r:e.palette}function ht(t,e,r,l,i){return S(e+l/2,r+i/2+4,"No data yet",'text-anchor="middle" fill="'+t.muted+'" font-family="'+it+'" font-size="13"')}function Xt(t,e){return v(t.notes)?String(t.notes).split(";").map(function(r){var l=r.indexOf(":");if(l<0)return null;var i=r.slice(0,l).trim(),n=r.slice(l+1).trim(),s=e.map(String).indexOf(i);return s<0&&String(parseInt(i,10))===i&&(s=parseInt(i,10)),s>=0&&n?{i:s,text:n}:null}).filter(Boolean):[]}function Dt(t,e,r,l,i){var n=(v(t.goalLabel)?t.goalLabel:"Goal")+" "+h(I(t.goal,0),t);return'<line x1="'+a(r)+'" x2="'+a(l)+'" y1="'+a(i)+'" y2="'+a(i)+'" stroke="'+e.fg+'" stroke-opacity=".55" stroke-width="1.25" stroke-dasharray="4 4"/>'+S(l,i-5,n,G(e,10,'text-anchor="end"'))}function kt(t,e,r){var l=String(v(e.stat)?e.stat:r||"").toLowerCase();if(!l||l==="none"||!t.length)return null;var i=zt(t),n={last:t[t.length-1],total:i,sum:i,average:i/t.length,avg:i/t.length,max:Math.max.apply(null,t),min:Math.min.apply(null,t)};if(!(l in n))return null;var s=null;return l==="last"&&t.length>1&&e.delta!=="none"&&(s=t[t.length-1]-t[0]),{val:n[l],delta:s}}function Ut(t,e,r,l,i,n,s,o){var c=l,x=i,g="",d=o||13;return t.forEach(function(f,C){var E=d+bt(f,12)+16;c>l&&c+E-16>l+n&&(c=l,x+=20),g+=(s?s(C,c,x):'<circle cx="'+a(c+4)+'" cy="'+a(x+6)+'" r="4" fill="'+e[C%e.length]+'"/>')+S(c+d,x+10,f,'fill="'+r.fg+'" font-family="'+it+'" font-size="12"'),c+=E}),{svg:g,height:x-i+24}}var le={solid:"",dashed:"7 5",dotted:"1 5",dashdot:"9 4 1 4"},oe=["circle","square","triangle","diamond"],De=["solid","stripes","dots","grid"];function Vt(t,e,r){if(t==null||t===!1||t==="none"||t==="false")return null;var l=t===!0||t===""||t==="auto"?e:U(t).map(function(i){return e.indexOf(i)<0?r:i});return l.length?function(i){return l[i%l.length]}:null}function _t(t,e,r,l,i){var n=l*1.15,s=l*.85;return t==="square"?'<rect x="'+a(e-s)+'" y="'+a(r-s)+'" width="'+a(2*s)+'" height="'+a(2*s)+'" rx="1"'+i+"/>":t==="triangle"?'<path d="M'+a(e)+","+a(r-n)+"L"+a(e+n)+","+a(r+s)+"L"+a(e-n)+","+a(r+s)+'Z"'+i+"/>":t==="diamond"?'<path d="M'+a(e)+","+a(r-n*1.1)+"L"+a(e+n)+","+a(r)+"L"+a(e)+","+a(r+n*1.1)+"L"+a(e-n)+","+a(r)+'Z"'+i+"/>":'<circle cx="'+a(e)+'" cy="'+a(r)+'" r="'+a(l)+'"'+i+"/>"}function Pe(t,e,r,l){var i=' stroke="'+l+'" stroke-opacity=".55" stroke-width="1.5"';return'<pattern id="'+t+'" width="6" height="6" patternUnits="userSpaceOnUse"'+(e==="dots"?"":' patternTransform="rotate(45)"')+'><rect width="6" height="6" fill="'+r+'"/>'+(e==="dots"?'<circle cx="3" cy="3" r="1.3" fill="'+l+'" fill-opacity=".55"/>':'<path d="M3,0V6'+(e==="grid"?"M0,3H6":"")+'"'+i+"/>")+"</pattern>"}function $e(t){return Math.max.apply(null,t.map(function(e){return bt(e,10,!0)}))+10}function se(t,e){for(var r=Et(t.values),l=U(t.series),i=U(t.labels),n=[],s=Math.max.apply(null,[0].concat(r.map(function(d){return d.length}))),o=0;o<s;o++){var c=[i[o]||"#"+(o+1)],x=0;r.forEach(function(d){c.push(o<d.length?h(d[o],t):""),x+=o<d.length?d[o]:0}),e&&c.push(h(x,t)),n.push(c)}var g=r.length>1||l.length?r.map(function(d,f){return l[f]||"Series "+(f+1)}):["Value"];return{head:["Label"].concat(g,e?["Total"]:[]),rows:n}}function It(t){var e=Math.round(_(I(t.width,360),160,2400)),r=t.frame==="none"?0:4,l=t.frame==="none"?8:20;return{W:e,b:r,P:l,w:e-2*(r+l)}}var or=".bzc-a{animation:bzc-in .6s ease both}.bzc-d{animation:bzc-draw 1.1s cubic-bezier(.3,.7,.2,1) both}.bzc-g{transform-box:fill-box;transform-origin:50% 100%;animation:bzc-grow .7s cubic-bezier(.2,.8,.2,1) both}.bzc-gn{transform-box:fill-box;transform-origin:50% 0;animation:bzc-grow .7s cubic-bezier(.2,.8,.2,1) both}.bzc-gx{transform-box:fill-box;transform-origin:0 50%;animation:bzc-growx .8s cubic-bezier(.2,.8,.2,1) both}.bzc-s{animation:bzc-sweep 1.1s cubic-bezier(.2,.8,.2,1) both}@keyframes bzc-in{from{opacity:0}}@keyframes bzc-draw{from{stroke-dashoffset:1}}@keyframes bzc-grow{from{transform:scaleY(0)}}@keyframes bzc-growx{from{transform:scaleX(0)}}@keyframes bzc-sweep{from{stroke-dasharray:0 100}}@media (prefers-reduced-motion:reduce){[class^=bzc-]{animation:none!important}}";function mt(t,e,r,l,i){var n=It(t),s=n.W,o=n.b,c=n.P,x=n.w,g=_(I(t.corners,22),0,60),d=o+c,f="";v(t.heading)&&(f+=S(o+c,d+10,String(t.heading).toUpperCase(),G(e,11,'font-weight="600" letter-spacing="1.3"')),d+=24);var C=i&&i.stat;if(C){if(f+=S(o+c,d+30,h(C.val,t),'fill="'+e.fg+'" font-family="'+it+'" font-size="32" font-weight="800" letter-spacing="-0.5"'),C.delta!=null){var E=C.delta>0,R=C.delta===0,F=t.delta==="inverse"?!E:E,y=R?e.muted:F?e.up:e.down,L=(R?"\u25CF ":E?"\u25B2 ":"\u25BC ")+h(Math.abs(C.delta),t)+" "+(v(t.deltaLabel)?t.deltaLabel:"since start");f+=S(o+c+x,d+28,L,'text-anchor="end" fill="'+y+'" font-family="'+dt+'" font-size="11" font-weight="600"')}d+=44}var m=l(o+c,d,x,r),A=Math.round(d+r+c+o),z="";t.frame!=="none"?z='<rect width="'+s+'" height="'+A+'" rx="'+g+'" fill="'+e.bezel+'"/><rect x="'+o+'" y="'+o+'" width="'+(s-2*o)+'" height="'+(A-2*o)+'" rx="'+Math.max(0,g-o)+'" fill="'+(t.background||e.tile)+'"/>':v(t.background)&&(z='<rect width="'+s+'" height="'+A+'" rx="'+g+'" fill="'+t.background+'"/>');var b=(v(t.heading)?t.heading+": ":"")+(i&&i.summary||"chart");return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 '+s+" "+A+'" width="'+s+'" height="'+A+'" role="img" aria-label="'+at(b)+'"><title>'+at(b)+"</title>"+(t.animate?"<style>"+or+"</style>":"")+z+f+m+"</svg>"}function fe(t,e){var r=K(t.values),l=ut(t,e)[0],i=I(t.height,64),n=U(t.labels),s=Xt(t,n),o=kt(r,t,"last");return mt(t,e,i,function(c,x,g,d){if(!r.length)return ht(e,c,x,g,d);var f=r.length===1?[r[0],r[0]]:r,C=Math.min.apply(null,f),E=Math.max.apply(null,f);v(t.goal)&&(C=Math.min(C,+t.goal),E=Math.max(E,+t.goal));var R=(E-C||Math.abs(E)||1)*.12;C-=R,E+=R;var F=function(k){return c+k*g/(f.length-1)},y=function(k){return x+d-(k-C)/(E-C)*d},L=f.map(function(k,p){return[F(p),y(k)]}),m=ie(L,j(t.straight)),A=Ht("g"),z=L[L.length-1],b='<defs><linearGradient id="'+A+'" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="'+l+'" stop-opacity=".32"/><stop offset="1" stop-color="'+l+'" stop-opacity="0"/></linearGradient></defs>';[1/3,2/3].forEach(function(k){b+='<line x1="'+c+'" x2="'+(c+g)+'" y1="'+a(x+d*k)+'" y2="'+a(x+d*k)+'" stroke="'+e.grid+'" stroke-dasharray="2 4"/>'}),b+='<path d="'+m+"L"+a(z[0])+","+(x+d)+"L"+c+","+(x+d)+'Z" fill="url(#'+A+')"'+lt(t,"bzc-a")+"/>",b+='<path d="'+m+'" fill="none" stroke="'+l+'" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" pathLength="1" style="stroke-dasharray:1"'+lt(t,"bzc-d")+"/>",v(t.goal)&&(b+=Dt(t,e,c,c+g,y(+t.goal))),s.forEach(function(k){if(!(k.i>=r.length)){var p=L[k.i];b+='<circle cx="'+a(p[0])+'" cy="'+a(p[1])+'" r="3.5" fill="'+e.fg+'"/>'+S(_(p[0],c+30,c+g-30),p[1]-9,k.text,G(e,10,'text-anchor="middle"',e.fg))}}),b+='<circle cx="'+a(z[0])+'" cy="'+a(z[1])+'" r="9" fill="'+l+'" fill-opacity=".25"/><circle cx="'+a(z[0])+'" cy="'+a(z[1])+'" r="4.5" fill="'+l+'"/>',j(t.showValues)&&L.forEach(function(k,p){p<r.length&&(b+=S(k[0],k[1]-8,h(r[p],t,!0),G(e,9,'text-anchor="middle"')))});var O=r.length>1?g/(r.length-1):g;return r.forEach(function(k,p){b+=vt(F(p)-O/2,x-6,O,d+12,(n[p]||"#"+(p+1))+": "+h(k,t))}),b},{stat:o,summary:r.length?"latest "+h(r[r.length-1],t):"no data"})}fe.table=function(t){var e=U(t.labels);return{head:["Label","Value"],rows:K(t.values).map(function(r,l){return[e[l]||"#"+(l+1),h(r,t)]})}};function ce(t,e){var r=Et(t.values),l=U(t.series),i=U(t.labels),n=ut(t,e),s=I(t.height,170),o=Math.max.apply(null,[0].concat(r.map(function(R){return R.length}))),c=Xt(t,i),x=r.length>1||l.length>0,g=kt(r[0]||[],t,""),d=Vt(t.dash,Object.keys(le),"solid"),f=Vt(t.markers,oe,"none"),C=t.background||e.tile,E=(d||f)&&function(R,F,y){var L=n[R%n.length],m=d?le[d(R)]:"",A=f?f(R):"none";return'<line x1="'+a(F)+'" x2="'+a(F+18)+'" y1="'+a(y+6)+'" y2="'+a(y+6)+'" stroke="'+L+'" stroke-width="2.5" stroke-linecap="round"'+(m?' stroke-dasharray="'+m+'"':"")+"/>"+(A!=="none"?_t(A,F+9,y+6,3.5,' fill="'+L+'" stroke="'+C+'" stroke-width="1.5"'):"")};return mt(t,e,s,function(R,F,y,L){if(!o)return ht(e,R,F,y,L);var m="",A=F;if(x){var z=Ut(r.map(function(D,u){return l[u]||"Series "+(u+1)}),n,e,R,A,y,E,E&&24);m+=z.svg,A+=z.height}var b=[].concat.apply([],r),O=Math.min.apply(null,b),k=Math.max.apply(null,b);v(t.goal)&&(O=Math.min(O,+t.goal),k=Math.max(k,+t.goal)),j(t.zero)&&(O=Math.min(0,O),k=Math.max(0,k));var p=ae(O,k,4),B=p.ticks.map(function(D){return h(D,t,!0)}),M=Math.max.apply(null,B.map(function(D){return bt(D,10,!0)}))+10,w=i.length?20:4,T=R+M,V=y-M,Y=L-(A-F)-w,tt=function(D){return o===1?T+V/2:T+D*V/(o-1)},Q=function(D){return A+Y-(D-p.lo)/(p.hi-p.lo)*Y};if(p.ticks.forEach(function(D,u){var H=Q(D);m+='<line x1="'+a(T)+'" x2="'+a(T+V)+'" y1="'+a(H)+'" y2="'+a(H)+'" stroke="'+e.grid+'"'+(D===0?"":' stroke-dasharray="2 4"')+"/>"+S(T-8,H+3.5,B[u],G(e,10,'text-anchor="end"'))}),i.length){for(var ot=Math.max(1,Math.ceil(o*(Math.max.apply(null,i.map(function(D){return bt(D,10,!0)}))+10)/V)),q=0;q<o;q+=ot)if(i[q]!=null){var J=o>1&&q===0?"start":o>1&&q===o-1?"end":"middle";m+=S(tt(q),A+Y+15,i[q],G(e,10,'text-anchor="'+J+'"'))}}c.forEach(function(D){if(!(D.i>=o)){var u=tt(D.i);m+='<line x1="'+a(u)+'" x2="'+a(u)+'" y1="'+a(A+12)+'" y2="'+a(A+Y)+'" stroke="'+e.fg+'" stroke-opacity=".4" stroke-dasharray="3 3"/>'+S(_(u,T+30,T+V-30),A+8,D.text,G(e,10,'text-anchor="middle"',e.fg))}}),r.forEach(function(D,u){var H=n[u%n.length],N=D.map(function(X,ft){return[tt(ft),Q(X)]});N.length===1&&(N=[[T,N[0][1]],[T+V,N[0][1]]]);var et=ie(N,j(t.straight));if(u===0){var W=Ht("g"),gt=N[N.length-1];m+='<defs><linearGradient id="'+W+'" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="'+H+'" stop-opacity=".26"/><stop offset="1" stop-color="'+H+'" stop-opacity="0"/></linearGradient></defs><path d="'+et+"L"+a(gt[0])+","+a(A+Y)+"L"+a(N[0][0])+","+a(A+Y)+'Z" fill="url(#'+W+')"'+lt(t,"bzc-a")+"/>"}var xt=d?le[d(u)]:"",Mt=f?f(u):"none";if(m+=xt?'<path d="'+et+'" fill="none" stroke="'+H+'" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="'+xt+'"'+lt(t,"bzc-a",u*.15)+"/>":'<path d="'+et+'" fill="none" stroke="'+H+'" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" pathLength="1" style="stroke-dasharray:1'+(t.animate?";animation-delay:"+u*.15+"s":"")+'"'+(t.animate?' class="bzc-d"':"")+"/>",Mt!=="none"){var P=Math.ceil(D.length/40);D.forEach(function(X,ft){(ft%P===0||ft===D.length-1)&&(m+=_t(Mt,tt(ft),Q(X),3.5,' fill="'+H+'" stroke="'+C+'" stroke-width="1.5"'+lt(t,"bzc-a",.6+u*.15)))})}else{var Z=N[N.length-1];m+='<circle cx="'+a(Z[0])+'" cy="'+a(Z[1])+'" r="4" fill="'+H+'" stroke="'+C+'" stroke-width="2"/>'}j(t.showValues)&&D.forEach(function(X,ft){m+=S(tt(ft),Q(X)-8,h(X,t,!0),G(e,9,'text-anchor="middle"'))})}),v(t.goal)&&(m+=Dt(t,e,T,T+V,Q(+t.goal)));for(var Lt=o>1?V/(o-1):V,st=0;st<o;st++){var pt=i[st]||"#"+(st+1);r.forEach(function(D,u){st<D.length&&(pt+=`
|
|
3
|
+
`+(x?(l[u]||"Series "+(u+1))+": ":"")+h(D[st],t))}),m+=vt(tt(st)-Lt/2,A,Lt,Y,pt)}return m},{stat:g,summary:r.length+" series over "+o+" points"})}ce.table=function(t){return se(t)};var Ge=40,Be=24;function ue(t,e){for(var r=Et(t.values),l=U(t.series),i=U(t.labels),n=ut(t,e),s=r.length,o=Math.max.apply(null,[0].concat(r.map(function(u){return u.length}))),c=s>1,x=j(t.horizontal),g=c&&j(t.stacked),d=!c&&U(t.color).filter(Boolean).length>1,f=r[0]||[],C=[].concat.apply([],r),E=function(u,H){return r.reduce(function(N,et){return u<et.length&&et[u]*H>0?N+et[u]:N},0)},R=[],F=[],y=[],L=0;g&&L<o;L++)F.push(E(L,1)),y.push(E(L,-1)),R.push(F[L]+y[L]);for(var m=g?F.concat(y):C,A=m.length?Math.max.apply(null,m):0,z=function(u){return l[u]||"Series "+(u+1)},b=c?Vt(t.patterns,De,"solid"):null,O="",k=[],p=0;b&&p<s;p++)if(b(p)!=="solid"){var B=Ht("g");O+=Pe(B,b(p),n[p%n.length],t.background||e.tile),k[p]="url(#"+B+")"}var M=function(u,H){return c?k[u]||n[u%n.length]:d?n[H%n.length]:n[0]},w=b&&function(u,H,N){return'<rect x="'+a(H)+'" y="'+a(N+1)+'" width="10" height="10" rx="2" fill="'+M(u)+'"/>'},T=function(u){return c||d||t.highlight==="none"||u===A?1:.5},V=function(u){return i[u]||"#"+(u+1)},Y=function(u){return c?V(u)+r.map(function(H,N){return u<H.length?`
|
|
4
|
+
`+z(N)+": "+h(H[u],t):""}).join("")+(g?`
|
|
5
|
+
Total: `+h(R[u],t):""):V(u)+": "+h(f[u],t)},tt=It(t),Q=c||l.length?Ut(r.map(function(u,H){return z(H)}),n,e,0,0,tt.w,w,w&&15).height:0,ot=g?1:s,q=c&&!g,J=q?10:14,Lt=3,st=x?ot*J+(ot-1)*Lt+(q?14:16):0,pt=x?Q+Math.max(1,o)*st-6:I(t.height,140)+Q,D=f.indexOf(Math.max.apply(null,f.length?f:[0]));return mt(t,e,pt,function(u,H,N,et){if(!o)return ht(e,u,H,N,et);var W=O?"<defs>"+O+"</defs>":"",gt=H;Q&&(W+=Ut(r.map(function($,rt){return z(rt)}),n,e,u,H,N,w,w&&15).svg,gt+=Q);var xt=Math.min(0,Math.min.apply(null,m)),Mt=Math.max(0,A);if(v(t.goal)&&(xt=Math.min(xt,+t.goal),Mt=Math.max(Mt,+t.goal)),Mt===xt&&(Mt=xt+1),x){for(var P=i.length?Math.min(N*.4,Math.max.apply(null,i.map(function($){return bt($,12)}))+10):0,Z=g?[R.map(function($){return h($,t)})]:r.map(function($){return $.map(function(rt){return h(rt,t)})}),X=Math.max.apply(null,[].concat.apply([],Z).map(function($){return bt($,q?10:11,!0)}))+10,ft=u+P,St=N-P-X,Rt=Math.max(Mt,0)||1,nt=0;nt<o;nt++){var At=gt+nt*st;i[nt]!=null&&(W+=S(u,At+(st-6)/2+4,Bt(i[nt],Math.floor(P/6.7)),'fill="'+e.fg+'" font-family="'+it+'" font-size="12"')),g?(W+=Ze(nt,ft,At+5,St,Rt),W+=S(u+N,At+5+J/2+3.8,Z[0][nt],'text-anchor="end" fill="'+e.fg+'" font-family="'+dt+'" font-size="11" font-weight="600"')):r.forEach(function($,rt){if(!(nt>=$.length)){var ct=$[nt],wt=At+(c?2:5)+rt*(J+Lt),Tt=Math.max(0,ct)/Rt*St;c||(W+='<rect x="'+a(ft)+'" y="'+a(wt)+'" width="'+a(St)+'" height="'+J+'" rx="'+J/2+'" fill="'+e.grid+'" fill-opacity=".6"/>'),Tt>0&&(W+='<rect x="'+a(ft)+'" y="'+a(wt)+'" width="'+a(Math.max(J,Tt))+'" height="'+J+'" rx="'+J/2+'" fill="'+M(rt,nt)+'" fill-opacity="'+T(ct)+'"'+lt(t,"bzc-gx",nt*.06+rt*.03)+"/>"),W+=S(u+N,wt+J/2+3.8,Z[rt][nt],'text-anchor="end" fill="'+e.fg+'" font-family="'+dt+'" font-size="'+(c?10:11)+'" font-weight="600"')}}),W+=vt(u,At,N,st-6,Y(nt))}if(v(t.goal)&&+t.goal>0){var Le=ft+ +t.goal/Rt*St;W+='<line x1="'+a(Le)+'" x2="'+a(Le)+'" y1="'+a(gt-2)+'" y2="'+a(H+et+2)+'" stroke="'+e.fg+'" stroke-opacity=".55" stroke-dasharray="3 3"/>'}return W}function Ze($,rt,ct,wt,Tt){var Ct='<rect x="'+a(rt)+'" y="'+a(ct)+'" width="'+a(wt)+'" height="'+J+'" rx="'+J/2+'" fill="'+e.grid+'" fill-opacity=".6"/>',qt=0;return r.forEach(function(ee,Ft){var Wt=$<ee.length?ee[$]:0,Nt=Math.max(0,Wt)/Tt*wt;if(!(Nt<=0)){var $t=qt>0?1.5:0;Ct+='<rect x="'+a(rt+qt+$t)+'" y="'+a(ct)+'" width="'+a(Math.max(2,Nt-$t))+'" height="'+J+'" rx="'+a(Math.min(3,Nt/2))+'" fill="'+M(Ft,$)+'"'+lt(t,"bzc-gx",$*.06+Ft*.03)+"/>",qt+=Nt}}),Ct}var Ae=i.length?Math.max.apply(null,i.map(function($){return bt($,10,!0)})):0,xe=i.length?Math.max(1,Math.ceil(o*(Ae+8)/N)):1,Kt=j(t.angleLabels)&&xe>1,Oe=Ge*Math.PI/180,Te=function($){return Kt?Bt($,Be):$};if(Kt){var Qe=N/o,Yt=0;i.forEach(function($,rt){Yt=Math.max(Yt,Math.cos(Oe)*bt(Te($),10,!0)+4-(rt+.5)*Qe)}),Yt=Math.min(Yt,N*.25),u+=Yt,N-=Yt,xe=1}var Ce=j(t.showValues)&&xt<0?14:0,Je=Kt?Math.ceil(Math.sin(Oe)*Math.min(Ae,bt("x".repeat(Be),10,!0)))+18:20,Ke=(i.length?Je:2)+Ce,Fe=j(t.showValues)?16:4,ye=et-(gt-H)-Ke-Fe,Ne=gt+Fe,Ot=function($){return Ne+ye-($-xt)/(Mt-xt)*ye},jt=N/o,te=Math.min(jt*(q?.78:.62),q?s*30:56),Re=q?Math.min(3,te/s*.15):0,Pt=g?te:(te-Re*(s-1))/s,ne=Ot(0);W+='<line x1="'+u+'" x2="'+(u+N)+'" y1="'+a(ne)+'" y2="'+a(ne)+'" stroke="'+e.grid+'"/>';for(var yt=0;yt<o;yt++){var be=u+yt*jt+(jt-te)/2;if(g?W+=je(yt,be):r.forEach(function($,rt){if(!(yt>=$.length)){var ct=$[yt],wt=be+rt*(Pt+Re),Tt=Math.min(Ot(ct),ne),Ct=Math.abs(Ot(ct)-ne);Ct>.5&&(W+='<rect x="'+a(wt)+'" y="'+a(Tt)+'" width="'+a(Pt)+'" height="'+a(Ct)+'" rx="'+a(Math.min(6,Pt/2,Ct/2))+'" fill="'+M(rt,yt)+'" fill-opacity="'+T(ct)+'"'+lt(t,ct<0?"bzc-gn":"bzc-g",yt*.05+rt*.03)+"/>"),j(t.showValues)&&(W+=S(wt+Pt/2,ct<0?Ot(ct)+12:Ot(ct)-5,h(ct,t,!0),'text-anchor="middle" fill="'+e.fg+'" font-family="'+dt+'" font-size="'+(c?9:10)+'" font-weight="600"'))}}),i[yt]!=null&&yt%xe===0){var ke=be+te/2,Me=Ne+ye+Ce+(Kt?12:15);W+=Kt?S(ke,Me,Te(i[yt]),G(e,10,'text-anchor="end" transform="rotate(-'+Ge+" "+a(ke)+" "+a(Me)+')"')):S(ke,Me,i[yt],G(e,10,'text-anchor="middle"'))}W+=vt(u+yt*jt,gt,jt,et-(gt-H),Y(yt))}return v(t.goal)&&(W+=Dt(t,e,u,u+N,Ot(+t.goal))),W;function je($,rt){var ct="",wt=0,Tt=0;if(r.forEach(function(qt,ee){var Ft=$<qt.length?qt[$]:0;if(Ft){var Wt=Ft>0?wt:Tt,Nt=Wt+Ft;Ft>0?wt=Nt:Tt=Nt;var $t=Ot(Math.max(Wt,Nt)),we=Ot(Math.min(Wt,Nt)),re=we-$t,He=Wt!==0?Math.min(1.5,re/2):0;Ft>0?we-=He:$t+=He,re=we-$t,re>.5&&(ct+='<rect x="'+a(rt)+'" y="'+a($t)+'" width="'+a(Pt)+'" height="'+a(re)+'" rx="'+a(Math.min(3,Pt/2,re/2))+'" fill="'+M(ee,$)+'"'+lt(t,Ft<0?"bzc-gn":"bzc-g",$*.05+ee*.03)+"/>")}}),j(t.showValues)){var Ct=R[$];ct+=S(rt+Pt/2,Ct<0?Ot(y[$])+12:Ot(F[$])-5,h(Ct,t,!0),'text-anchor="middle" fill="'+e.fg+'" font-family="'+dt+'" font-size="10" font-weight="600"')}return ct}},{stat:kt(f,t,""),summary:o?g?s+" series stacked across "+o+" groups":c?s+" series across "+o+" groups":"highest "+(i[D]||"")+" "+h(f[D],t):"no data"})}ue.table=function(t){return se(t,Et(t.values).length>1&&j(t.stacked))};function he(t,e){var r=K(t.values),l=U(t.labels),i=ut(t,e),n=I(t.max,100)||100,s=I(t.height,140),o=!v(t.prefix)&&!v(t.suffix)&&n===100,c=function(g){return h(g,t)+(o?"%":"")},x=kt(r,t,"");return mt(t,e,s,function(g,d,f,C){if(!r.length)return ht(e,g,d,f,C);var E="",R=r.length===1,F=Math.min(C,R?f:f*.55),y=R?g+f/2:g+F/2,L=d+C/2,m=R?F*.12:_(F*.42/(r.length*1.35),5,16),A=m*.38;if(r.forEach(function(k,p){var B=F/2-m/2-p*(m+A);if(!(B<=m/2)){var M=_(k/n*100,0,100),w=i[p%i.length];E+='<circle cx="'+a(y)+'" cy="'+a(L)+'" r="'+a(B)+'" fill="none" stroke="'+w+'" stroke-opacity=".16" stroke-width="'+a(m)+'"/>',M>0&&(E+='<circle cx="'+a(y)+'" cy="'+a(L)+'" r="'+a(B)+'" fill="none" stroke="'+w+'" stroke-width="'+a(m)+'" stroke-linecap="round" pathLength="100" transform="rotate(-90 '+a(y)+" "+a(L)+')" style="stroke-dasharray:'+a(M)+" 100"+(t.animate?";animation-delay:"+p*.12+"s":"")+'"'+(t.animate?' class="bzc-s"':"")+"/>"),E+='<circle cx="'+a(y)+'" cy="'+a(L)+'" r="'+a(B+m/2)+'" fill="#000" fill-opacity="0" class="bzc-hit" data-tip="'+at((l[p]||"#"+(p+1))+": "+c(k)+(o?"":" of "+h(n,t)))+'"/>'}}),R)E+=S(y,L+F*.08,c(r[0]),'text-anchor="middle" fill="'+e.fg+'" font-family="'+it+'" font-size="'+a(F*.22)+'" font-weight="800"'),l[0]&&(E+=S(y,L+F*.08+16,l[0],G(e,10,'text-anchor="middle"')));else{var z=g+F+22,b=Math.min(26,C/r.length),O=L-b*r.length/2;r.forEach(function(k,p){var B=O+p*b+b/2;E+='<circle cx="'+a(z+4)+'" cy="'+a(B)+'" r="4" fill="'+i[p%i.length]+'"/>'+S(z+14,B+4,Bt(l[p]||"#"+(p+1),Math.floor((g+f-z-60)/6.7)),'fill="'+e.fg+'" font-family="'+it+'" font-size="12"')+S(g+f,B+4,c(k),'text-anchor="end" fill="'+e.fg+'" font-family="'+dt+'" font-size="11" font-weight="600"')})}return E},{stat:x,summary:r.map(function(g,d){return(l[d]?l[d]+" ":"")+c(g)}).join(", ")})}he.table=function(t){var e=U(t.labels),r=I(t.max,100)||100,l=!v(t.prefix)&&!v(t.suffix)&&r===100;return{head:["Label","Value"],rows:K(t.values).map(function(i,n){return[e[n]||"#"+(n+1),h(i,t)+(l?"%":" of "+h(r,t))]})}};function me(t,e){var r=K(t.values).map(function(f){return Math.max(0,f)}),l=U(t.labels),i=ut(t,e),n=r.slice(),s=l.slice();if(n.length>6){var o=n.map(function(f,C){return C}).sort(function(f,C){return r[C]-r[f]}),c=o.slice(0,5).sort(function(f,C){return f-C});n=c.map(function(f){return r[f]}),s=c.map(function(f){return l[f]||"#"+(f+1)}),n.push(zt(o.slice(5).map(function(f){return r[f]}))),s.push("Other")}var x=zt(n),g=I(t.height,150),d=kt(n,t,"");return mt(t,e,g,function(f,C,E,R){if(!x)return ht(e,f,C,E,R);var F="",y=Math.min(R,E*.5),L=f+y/2,m=C+R/2,A=y*.16,z=(y-A)/2,b=0,O=n.filter(Boolean).length>1?.9:0;n.forEach(function(M,w){var T=M/x*100;if(!(T<=0)){var V=Math.max(.01,T-O);F+='<circle cx="'+a(L)+'" cy="'+a(m)+'" r="'+a(z)+'" fill="none" stroke="'+i[w%i.length]+'" stroke-width="'+a(A)+'" pathLength="100" stroke-dasharray="'+a(V)+" "+a(100-V)+'" stroke-dashoffset="'+a(-b)+'" transform="rotate(-90 '+a(L)+" "+a(m)+')"'+lt(t,"bzc-a",w*.08)+"/>",b+=T}}),F+=S(L,m+2,h(x,t,!0),'text-anchor="middle" fill="'+e.fg+'" font-family="'+it+'" font-size="'+a(y*.17)+'" font-weight="800"'),F+=S(L,m+2+14,(v(t.centerLabel)?t.centerLabel:"Total").toUpperCase(),G(e,9,'text-anchor="middle" letter-spacing="1"'));var k=f+y+22,p=Math.min(24,R/n.length),B=m-p*n.length/2;return n.forEach(function(M,w){var T=B+w*p+p/2,V=Math.round(M/x*100),Y=(s[w]||"#"+(w+1))+": "+h(M,t)+" ("+V+"%)";F+='<circle cx="'+a(k+4)+'" cy="'+a(T)+'" r="4" fill="'+i[w%i.length]+'"/>'+S(k+14,T+4,Bt(s[w]||"#"+(w+1),Math.floor((f+E-k-50)/6.7)),'fill="'+e.fg+'" font-family="'+it+'" font-size="12"')+S(f+E,T+4,V+"%",'text-anchor="end" fill="'+e.muted+'" font-family="'+dt+'" font-size="11" font-weight="600"')+vt(k,T-p/2,f+E-k,p,Y)}),b=0,n.forEach(function(M,w){var T=M/x*100;T<=0||(F+='<circle cx="'+a(L)+'" cy="'+a(m)+'" r="'+a(z)+'" fill="none" stroke="#000" stroke-opacity="0" stroke-width="'+a(A)+'" pathLength="100" stroke-dasharray="'+a(T)+" "+a(100-T)+'" stroke-dashoffset="'+a(-b)+'" transform="rotate(-90 '+a(L)+" "+a(m)+')" class="bzc-hit" data-skip="" data-tip="'+at((s[w]||"#"+(w+1))+": "+h(M,t)+" ("+Math.round(T)+"%)")+'"/>',b+=T)}),F},{stat:d,summary:"total "+h(x,t)+" across "+n.length+" parts"})}me.table=function(t){var e=K(t.values).map(function(i){return Math.max(0,i)}),r=U(t.labels),l=zt(e);return{head:["Label","Value","Share"],rows:e.map(function(i,n){return[r[n]||"#"+(n+1),h(i,t),(l?Math.round(i/l*100):0)+"%"]})}};function pe(t,e){var r=K(t.values),l=r.length?r[0]:I(t.value,NaN),i=U(t.labels),n=I(t.min,0),s=I(t.max,100),o=I(t.height,130);s===n&&(s=n+1);var c=K(t.zones),x=ut(t,e),g=U(t.color).filter(Boolean).length>1?x:[e.up,e.palette[3],e.down],d=x[0];if(c.length&&isFinite(l)){for(var f=0;f<c.length&&l>=c[f];)f++;d=g[Math.min(f,g.length-1)]}var C=!v(t.prefix)&&!v(t.suffix)&&n===0&&s===100,E=function(R){return h(R,t)+(C?"%":"")};return mt(t,e,o,function(R,F,y,L){if(!isFinite(l))return ht(e,R,F,y,L);var m=Math.min(y/2,L-22),A=m*.16,z=m-A/2,b=R+y/2,O=F+m,k=_((l-n)/(s-n),0,1),p=function(tt,Q){var ot=Math.PI*(1-tt);return[b+Q*Math.cos(ot),O-Q*Math.sin(ot)]},B="M"+a(b-z)+","+a(O)+"A"+a(z)+","+a(z)+" 0 0 1 "+a(b+z)+","+a(O),M='<path d="'+B+'" fill="none" stroke="'+d+'" stroke-opacity=".16" stroke-width="'+a(A)+'" stroke-linecap="round"/>';c.length&&c.forEach(function(tt){var Q=_((tt-n)/(s-n),0,1),ot=p(Q,z-A/2-3),q=p(Q,z-A/2-8);M+='<line x1="'+a(ot[0])+'" y1="'+a(ot[1])+'" x2="'+a(q[0])+'" y2="'+a(q[1])+'" stroke="'+e.muted+'" stroke-width="1.5"/>'}),k>0&&(M+='<path d="'+B+'" fill="none" stroke="'+d+'" stroke-width="'+a(A)+'" stroke-linecap="round" pathLength="100" style="stroke-dasharray:'+a(k*100)+' 100"'+lt(t,"bzc-s")+"/>");var w=p(k,z);if(M+='<circle cx="'+a(w[0])+'" cy="'+a(w[1])+'" r="'+a(A*.26)+'" fill="'+(t.background||e.tile)+'"'+lt(t,"bzc-a",.9)+"/>",v(t.goal)){var T=_((+t.goal-n)/(s-n),0,1),V=p(T,z+A/2+4),Y=p(T,z-A/2-4);M+='<line x1="'+a(V[0])+'" y1="'+a(V[1])+'" x2="'+a(Y[0])+'" y2="'+a(Y[1])+'" stroke="'+e.fg+'" stroke-width="2" stroke-linecap="round"/>'}return M+=S(b,O-m*.12,E(l),'text-anchor="middle" fill="'+e.fg+'" font-family="'+it+'" font-size="'+a(m*.34)+'" font-weight="800"'),i[0]&&(M+=S(b,O-m*.12+16,i[0],G(e,10,'text-anchor="middle"'))),M+=S(b-z,O+18,h(n,t,!0),G(e,10,'text-anchor="middle"'))+S(b+z,O+18,h(s,t,!0),G(e,10,'text-anchor="middle"')),M+=vt(b-m,O-m,m*2,m,(i[0]?i[0]+": ":"")+E(l)+" (range "+h(n,t)+" to "+h(s,t)+")"+(v(t.goal)?`
|
|
6
|
+
Goal: `+h(+t.goal,t):"")),M},{summary:isFinite(l)?E(l)+" on a scale of "+h(n,t)+" to "+h(s,t):"no data"})}pe.table=function(t){var e=K(t.values),r=e.length?e[0]:I(t.value,NaN),l=U(t.labels),i=I(t.min,0),n=I(t.max,100),s=!v(t.prefix)&&!v(t.suffix)&&i===0&&n===100;return isFinite(r)?{head:["Label","Value"],rows:[[l[0]||"Reading",h(r,t)+(s?"%":"")],["Lowest",h(i,t)],["Highest",h(n,t)]].concat(v(t.goal)?[["Goal",h(+t.goal,t)]]:[])}:{head:["Label","Value"],rows:[]}};function de(t,e){var r=K(t.values).map(function(y){return Math.max(0,y)}),l=U(t.labels),i=ut(t,e),n=r.length===1,s=zt(r),o=v(t.max)?I(t.max,100):n?100:s;o>0||(o=1);var c=!v(t.prefix)&&!v(t.suffix)&&o===100&&n,x=function(y){return h(y,t)+(c?"%":"")},g=It(t),d=g.w,f=0,C=[];if(!n&&r.length){var E=0;f=1,r.forEach(function(y,L){var m=l[L]||"#"+(L+1),A=14+bt(m,12)+6+bt(h(y,t),11,!0)+18;E>0&&E+A>d&&(E=0,f++),C.push({x:E,row:f-1,l:m}),E+=A})}var R=36+(f?12+f*20:0),F=kt(r,t,"");return mt(t,e,R,function(y,L,m,A){if(!r.length)return ht(e,y,L,m,A);var z="",b=L+22,O=Ht("c"),k=n?x(r[0])+(c?"":" of "+h(o,t)):h(s,t)+" of "+h(o,t);n&&l[0]&&(z+=S(y,L+11,l[0],'fill="'+e.fg+'" font-family="'+it+'" font-size="12"')),z+=S(y+m,L+11,k,'text-anchor="end" fill="'+e.fg+'" font-family="'+dt+'" font-size="11" font-weight="600"'),z+='<rect x="'+y+'" y="'+b+'" width="'+m+'" height="14" rx="7" fill="'+e.grid+'" fill-opacity=".7"/>',z+='<clipPath id="'+O+'"><rect x="'+y+'" y="'+b+'" width="'+m+'" height="14" rx="7"/></clipPath><g clip-path="url(#'+O+')"><g'+lt(t,"bzc-gx")+">";var p=0;if(r.forEach(function(M,w){var T=Math.min(M,Math.max(0,o-p))/o*m;T>0&&(z+='<rect x="'+a(y+p/o*m)+'" y="'+b+'" width="'+a(T)+'" height="14" fill="'+i[w%i.length]+'"/>'),w>0&&T>0&&(z+='<rect x="'+a(y+p/o*m-1)+'" y="'+b+'" width="2" height="14" fill="'+(t.background||e.tile)+'"/>'),p+=M}),z+="</g></g>",v(t.goal)){var B=y+_(+t.goal/o,0,1)*m;z+='<line x1="'+a(B)+'" x2="'+a(B)+'" y1="'+(b-4)+'" y2="'+(b+18)+'" stroke="'+e.fg+'" stroke-width="2" stroke-linecap="round"/>'}return p=0,r.forEach(function(M,w){var T=Math.min(M,Math.max(0,o-p))/o*m;T>0&&(z+=vt(y+p/o*m,b-4,T,22,(l[w]||(n?"Progress":"#"+(w+1)))+": "+x(M)+(n?"":" ("+Math.round(M/o*100)+"%)"))),p+=M}),C.forEach(function(M,w){var T=y+M.x,V=b+14+12+M.row*20+8;z+='<circle cx="'+a(T+4)+'" cy="'+a(V)+'" r="4" fill="'+i[w%i.length]+'"/><text x="'+a(T+14)+'" y="'+a(V+4)+'" fill="'+e.fg+'" font-family="'+it+'" font-size="12">'+at(M.l)+'<tspan dx="6" fill="'+e.muted+'" font-family="'+dt+'" font-size="11">'+at(h(r[w],t))+"</tspan></text>"}),z},{stat:F,summary:n?x(r[0])+(c?"":" of "+h(o,t)):h(s,t)+" of "+h(o,t)})}de.table=function(t){var e=K(t.values).map(function(s){return Math.max(0,s)}),r=U(t.labels),l=e.length===1,i=v(t.max)?I(t.max,100):l?100:zt(e);i>0||(i=1);var n=!v(t.prefix)&&!v(t.suffix)&&i===100&&l;return l?{head:["Label","Value"],rows:[[r[0]||"Progress",h(e[0],t)+(n?"%":" of "+h(i,t))]]}:{head:["Label","Value","Share"],rows:e.map(function(s,o){return[r[o]||"#"+(o+1),h(s,t),Math.round(s/i*100)+"%"]})}};var Ue={weekday:"short",day:"numeric",month:"short",year:"numeric"};function Ve(t,e){if(v(t.start)&&/^\d{4}-\d{2}-\d{2}$/.test(String(t.start)))return new Date(String(t.start)+"T00:00:00Z");var r=new Date;return new Date(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate())-Math.max(0,e-1)*864e5)}function Ie(t,e){try{return new Intl.DateTimeFormat(t,Object.assign({timeZone:"UTC"},e))}catch{return new Intl.DateTimeFormat("en-GB",Object.assign({timeZone:"UTC"},e))}}function ge(t,e){var r=K(t.values),l=ut(t,e)[0],i=t.lang||"en-GB",n=Ve(t,r.length),s=(n.getUTCDay()+6)%7,o=Math.max(1,Math.ceil((s+r.length)/7)),c=It(t),x=28,g=Math.max(1,Math.floor((c.w-x)/10));if(o>g){var d=(o-g)*7-s;r=r.slice(d),n=new Date(n.getTime()+d*864e5),s=0,o=g}var f=Math.min(18,(c.w-x)/o),C=f<8?1:3,E=f-C,R=16+7*f+26,F=r.length?Math.max.apply(null,r):0,y=function(b){return Ie(i,b)},L=y({month:"short"}),m=y({weekday:"short"}),A=y(Ue),z=kt(r,t,"");return mt(t,e,R,function(b,O,k,p){if(!r.length)return ht(e,b,O,k,p);var B="",M=b+x,w=O+16,T=-99,V=[.28,.5,.75,1];f>=9&&[0,2,4].forEach(function(W){var gt=new Date(Date.UTC(2024,0,1+W));B+=S(b,w+W*f+E/2+3.5,m.format(gt),G(e,9))});for(var Y=0;Y<r.length;Y++){var tt=s+Y,Q=Math.floor(tt/7),ot=tt%7,q=new Date(n.getTime()+Y*864e5),J=M+Q*f,Lt=w+ot*f;(q.getUTCDate()===1||Y===0)&&J-T>30&&(B+=S(J,O+9,L.format(q),G(e,9)),T=J);var st=r[Y]<=0||!F?0:Math.ceil(r[Y]/F*4),pt=st?l:e.grid,D=st?V[st-1]:.7;B+='<rect x="'+a(J)+'" y="'+a(Lt)+'" width="'+a(E)+'" height="'+a(E)+'" rx="'+a(E*.24)+'" fill="'+pt+'" fill-opacity="'+D+'"'+(t.animate?' class="bzc-a" style="animation-delay:'+a(Q*.012)+'s"':"")+' data-tip="'+at(A.format(q)+": "+h(r[Y],t))+'"/>'}var u=w+7*f+14,H=10,N=b+k-5*(H+3)-30;B+=S(b,u+8,h(zt(r),t,!0)+" in "+r.length+" days",G(e,10)),B+=S(N-6,u+8,"Less",G(e,9,'text-anchor="end"'));for(var et=0;et<5;et++)B+='<rect x="'+a(N+et*(H+3))+'" y="'+u+'" width="'+H+'" height="'+H+'" rx="2.5" fill="'+(et?l:e.grid)+'" fill-opacity="'+(et?V[et-1]:.7)+'"/>';return B+=S(N+5*(H+3)+3,u+8,"More",G(e,9)),B},{stat:z,summary:h(zt(r),t)+" across "+r.length+" days"})}ge.table=function(t){var e=K(t.values),r=Ve(t,e.length),l=Ie(t.lang||"en-GB",Ue);return{head:["Date","Value"],rows:e.map(function(i,n){return[l.format(new Date(r.getTime()+n*864e5)),h(i,t)]})}};function sr(t,e){var r=Math.min(t.length,e.length);if(r<2)return null;var l=0,i=0,n;for(n=0;n<r;n++)l+=t[n],i+=e[n];l/=r,i/=r;var s=0,o=0,c=0;for(n=0;n<r;n++)s+=(t[n]-l)*(t[n]-l),o+=(e[n]-i)*(e[n]-i),c+=(t[n]-l)*(e[n]-i);if(!s)return null;var x=c/s;return{slope:x,intercept:i-x*l,r:o?c/Math.sqrt(s*o):0}}function ve(t,e){for(var r=Et(t.x),l=Et(t.y),i=U(t.series),n=U(t.labels),s=ut(t,e),o=[],c=0;c<Math.max(r.length,l.length);c++){var x=r[c]||[],g=l[c]||[],d=Math.min(x.length,g.length);o.push({xs:x.slice(0,d),ys:g.slice(0,d)})}o=o.filter(function(O){return O.xs.length});var f=o.reduce(function(O,k){return O+k.xs.length},0),C=I(t.height,210),E=o.length>1||i.length>0,R=j(t.trend),F=function(O){return i[O]||"Group "+(O+1)},y={decimals:t.decimals,compact:t.compact,lang:t.lang},L=Xt(t,n),m=Vt(t.markers,oe,"circle"),A=t.background||e.tile,z=function(O){var k=m?m(O):"circle";return k==="none"?"circle":k},b=m&&function(O,k,p){return _t(z(O),k+4,p+6,4,' fill="'+s[O%s.length]+'"')};return mt(t,e,C,function(O,k,p,B){if(!f)return ht(e,O,k,p,B);var M="",w=k;if(E){var T=Ut(o.map(function(P,Z){return F(Z)}),s,e,O,w,p,b);M+=T.svg,w+=T.height}var V=[].concat.apply([],o.map(function(P){return P.xs})),Y=[].concat.apply([],o.map(function(P){return P.ys})),tt=Math.min.apply(null,Y),Q=Math.max.apply(null,Y);v(t.goal)&&(tt=Math.min(tt,+t.goal),Q=Math.max(Q,+t.goal)),j(t.zero)&&(tt=Math.min(0,tt),Q=Math.max(0,Q));var ot=ae(tt,Q,4),q=ae(Math.min.apply(null,V),Math.max.apply(null,V),5),J=ot.ticks.map(function(P){return h(P,t,!0)}),Lt=$e(J)+(v(t.yLabel)?14:0),st=20+(v(t.xLabel)?16:0),pt=O+Lt,D=p-Lt,u=B-(w-k)-st,H=function(P){return pt+6+(P-q.lo)/(q.hi-q.lo)*(D-12)},N=function(P){return w+6+u-6-(P-ot.lo)/(ot.hi-ot.lo)*(u-6)};ot.ticks.forEach(function(P,Z){var X=N(P);M+='<line x1="'+a(pt)+'" x2="'+a(pt+D)+'" y1="'+a(X)+'" y2="'+a(X)+'" stroke="'+e.grid+'" stroke-dasharray="2 4"/>'+S(pt-8,X+3.5,J[Z],G(e,10,'text-anchor="end"'))});var et=Math.max(1,Math.ceil(q.ticks.length*44/D));if(q.ticks.forEach(function(P,Z){if(!(Z%et)){var X=H(P);M+='<line x1="'+a(X)+'" x2="'+a(X)+'" y1="'+a(w)+'" y2="'+a(w+u)+'" stroke="'+e.grid+'" stroke-dasharray="2 4"/>'+S(X,w+u+15,h(P,y,!0),G(e,10,'text-anchor="middle"'))}}),v(t.xLabel)&&(M+=S(pt+D/2,w+u+32,t.xLabel,G(e,10,'text-anchor="middle" font-weight="600"'))),v(t.yLabel)){var W=w+u/2;M+='<text x="'+a(O+4)+'" y="'+a(W)+'" transform="rotate(-90 '+a(O+4)+" "+a(W)+')" text-anchor="middle" '+G(e,10,'font-weight="600"')+' dominant-baseline="hanging">'+String(t.yLabel).replace(/[&<>"]/g,function(P){return{"&":"&","<":"<",">":">",'"':"""}[P]})+"</text>"}v(t.goal)&&(M+=Dt(t,e,pt,pt+D,N(+t.goal))),R&&o.forEach(function(P,Z){var X=sr(P.xs,P.ys);if(X){var ft=Math.min.apply(null,P.xs),St=Math.max.apply(null,P.xs),Rt=X.slope*ft+X.intercept,nt=X.slope*St+X.intercept,At=s[Z%s.length];M+='<line x1="'+a(H(ft))+'" y1="'+a(_(N(Rt),w,w+u))+'" x2="'+a(H(St))+'" y2="'+a(_(N(nt),w,w+u))+'" stroke="'+At+'" stroke-width="2" stroke-dasharray="6 4" stroke-linecap="round" stroke-opacity=".9"/>',M+=S(Math.min(H(St),pt+D)-2,_(N(nt),w+10,w+u)-7,"r = "+X.r.toFixed(2),G(e,10,'text-anchor="end" font-weight="600"',At))}});var gt=0,xt=f>150?3:4.5;o.forEach(function(P,Z){var X=s[Z%s.length];P.xs.forEach(function(ft,St){var Rt=H(ft),nt=N(P.ys[St]),At=(n[gt]?n[gt]+`
|
|
7
|
+
`:E?F(Z)+`
|
|
8
|
+
`:"")+(v(t.xLabel)?t.xLabel:"x")+": "+h(ft,y)+`
|
|
9
|
+
`+(v(t.yLabel)?t.yLabel:"y")+": "+h(P.ys[St],t);M+=_t(z(Z),Rt,nt,xt,' fill="'+X+'" fill-opacity=".85" stroke="'+A+'" stroke-width="1.5"'+(t.animate?' class="bzc-a" style="animation-delay:'+a(Math.min(.8,gt*.012))+'s"':"")),M+=vt(Rt-8,nt-8,16,16,At),gt++})});var Mt=[];return o.forEach(function(P){P.xs.forEach(function(Z,X){Mt.push([H(Z),N(P.ys[X])])})}),L.forEach(function(P){var Z=Mt[P.i];Z&&(M+='<circle cx="'+a(Z[0])+'" cy="'+a(Z[1])+'" r="'+(xt+4)+'" fill="none" stroke="'+e.fg+'" stroke-width="1.5"/>'+S(_(Z[0],pt+30,pt+D-30),Z[1]-xt-9,P.text,G(e,10,'text-anchor="middle"',e.fg)))}),M},{summary:f+" points"+(E?" in "+o.length+" groups":"")})}ve.table=function(t){var e=Et(t.x),r=Et(t.y),l=U(t.series),i=U(t.labels),n=e.length>1||l.length>0,s={decimals:t.decimals,compact:t.compact,lang:t.lang},o=[],c=0;return e.forEach(function(x,g){for(var d=r[g]||[],f=0;f<Math.min(x.length,d.length);f++,c++)o.push([i[c]||"#"+(c+1)].concat(n?[l[g]||"Group "+(g+1)]:[],[h(x[f],s),h(d[f],t)]))}),{head:["Point"].concat(n?["Group"]:[],[v(t.xLabel)?t.xLabel:"x",v(t.yLabel)?t.yLabel:"y"]),rows:o}};var Zt={spark:fe,line:ce,bars:ue,scatter:ve,ring:he,donut:me,gauge:pe,progress:de,heatmap:ge},fr=t=>t.replace(/-([a-z])/g,(e,r)=>r.toUpperCase());function Ye(t,e){if(!Zt[t])throw new Error(`Bezel Charts: unknown chart type "${t}". Choose one of: ${Object.keys(Zt).join(", ")}.`);let r={};for(let[l,i]of Object.entries(e))r[fr(l)]=i;return r}function Qt(t,e={}){let r=Ye(t,e);r.animate=j(r.animate),r.frame=r.frame==="none"?"none":"bezel";let l=r.theme==="light"||r.theme==="dark"?r.theme:r.autoTheme||"dark";return Zt[t](r,Gt[l])}function qe(t,e={}){return Zt[t].table(Ye(t,e))}function Ee(t){return t.replace(/<rect class="bzc-hit"[^>]*\/>/g,"").replace(/<circle[^>]* class="bzc-hit"[^>]*\/>/g,"").replace(/ data-tip="[^"]*"/g,"")}function We(t,e={}){return Ee(Qt(t,{...e,animate:!1}))}var Xe=["type","values","labels","series","heading","prefix","suffix","decimals","compact","color","theme","frame","width","height","goal","goal-label","notes","show-values","stat","delta","delta-label","max","min","value","zones","horizontal","straight","zero","start","lang","corners","background","center-label","highlight","x","y","x-label","y-label","trend","static","no-tooltips","stacked","angle-labels","dash","markers","patterns"],cr=`:host{display:block;position:relative;max-width:100%}:host([hidden]){display:none}svg{display:block;max-width:100%;height:auto;overflow:visible}.tip{position:absolute;left:0;top:0;pointer-events:none;background:#0b0b10;color:#f2f1f7;font:600 12px/1.5 ${dt};padding:7px 10px;border-radius:10px;white-space:pre;opacity:0;transform:translate(-50%,calc(-100% - 12px));transition:opacity .12s;z-index:3;border:1px solid #2a2935;box-shadow:0 8px 24px rgba(0,0,0,.35)}.tip.on{opacity:1}.c{outline:none}.c:focus-visible{outline:2px solid #fff;outline-offset:3px;box-shadow:0 0 0 7px #000}.k{stroke:currentColor;stroke-width:2;stroke-opacity:1}.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}@media (forced-colors:active){.c:focus-visible{outline-color:Highlight}}`,ur={ArrowLeft:-1,ArrowUp:-1,ArrowRight:1,ArrowDown:1},hr=()=>typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)"):null,mr=()=>{let t=typeof document<"u"&&document.documentElement?.getAttribute?.("data-theme");return t==="light"||t==="dark"?t:null},ze=new Set;typeof MutationObserver=="function"&&typeof document<"u"&&document.documentElement&&new MutationObserver(()=>ze.forEach(t=>t.refresh())).observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});var pr=typeof HTMLElement>"u"?class{}:HTMLElement,Jt=class extends pr{static get observedAttributes(){return Xe}static get themes(){return Gt}get resolvedTheme(){let e=this.getAttribute("theme");return e==="light"||e==="dark"?e:this.options.autoTheme}get chartType(){return this.getAttribute("type")||"spark"}connectedCallback(){this.shadowRoot||(this.attachShadow({mode:"open"}).innerHTML=`<style>${cr}</style><div class="c" role="group" aria-roledescription="chart"></div><p class="sr" id="h">Use the arrow keys to step through the values.</p><div class="tip" aria-hidden="true"></div><div class="sr" aria-live="polite"></div><div class="sr"></div>`,[,this.#t,,this.#r,this.#o,this.#c]=this.shadowRoot.children,this.shadowRoot.addEventListener("pointermove",e=>this.#h(e)),this.shadowRoot.addEventListener("pointerdown",e=>this.#h(e)),this.addEventListener("pointerleave",()=>this.#r.classList.remove("on")),this.#t.addEventListener("keydown",e=>this.#v(e)),this.#t.addEventListener("blur",()=>this.#g())),ze.add(this),this.#a=hr(),this.#a?.addEventListener?.("change",this.#u),typeof ResizeObserver=="function"?(this.#l=new ResizeObserver(([e])=>{let r=Math.round(e.contentRect.width);(!this.#n||!this.hasAttribute("width")&&r>0&&Math.abs(r-this.#s)>1)&&this.#i()}),this.#l.observe(this)):this.#i()}disconnectedCallback(){ze.delete(this),this.#l?.disconnect(),this.#a?.removeEventListener?.("change",this.#u)}attributeChangedCallback(){!this.#n||this.#f||(this.#f=!0,queueMicrotask(()=>{this.#f=!1,this.#i()}))}get options(){let e={};for(let r of Xe)this.hasAttribute(r)&&(e[r]=this.getAttribute(r));return e.width||(e.width=this.#s||360),e.autoTheme=mr()||(this.#a?this.#a.matches?"dark":"light":"dark"),e}refresh(){this.#n&&this.#i()}toSVG(e={}){return Ee(Qt(this.chartType,{...this.options,...e,animate:!1}))}download(e){let r=URL.createObjectURL(new Blob([this.toSVG()],{type:"image/svg+xml"})),l=Object.assign(document.createElement("a"),{href:r,download:`${(e||this.getAttribute("heading")||this.chartType).replace(/[^\w-]+/g,"-").toLowerCase()}.svg`});document.body.append(l),l.click(),l.remove(),setTimeout(()=>URL.revokeObjectURL(r),1e3)}#l=null;#t=null;#r=null;#o=null;#c=null;#e=-1;#a=null;#s=0;#n=!1;#f=!1;#u=()=>{let e=this.getAttribute("theme");(!e||e==="auto")&&this.refresh()};#i(){if(!this.shadowRoot)return;let e=Math.round(this.getBoundingClientRect?.().width||0);this.#s=e>0?e:360;let r=this.options;r.animate=!this.#n&&!this.hasAttribute("static");let l,i=null;try{l=Qt(this.chartType,r),i=qe(this.chartType,r)}catch(c){l=`<p style="font:13px ${it};color:#d63f7c">${at(c.message)}</p>`}let n=this.#t;n.innerHTML=l.replace(/<title>[\s\S]*?<\/title>/,"");let s=n.querySelector("svg");s?(n.setAttribute("aria-label",s.getAttribute("aria-label")),s.removeAttribute("role"),s.removeAttribute("aria-label"),s.setAttribute("aria-hidden","true")):n.removeAttribute("aria-label");let o=!!s&&!this.hasAttribute("no-tooltips");o?(n.setAttribute("tabindex","0"),n.setAttribute("aria-describedby","h")):(n.removeAttribute("tabindex"),n.removeAttribute("aria-describedby")),n.style.color=Gt[r.theme==="light"||r.theme==="dark"?r.theme:r.autoTheme].fg,n.style.borderRadius=`${r.frame==="none"?4:_(+r.corners||22,0,60)}px`,this.#c.innerHTML=i&&i.rows.length?dr(r.heading,i):"",this.#e>=0&&o&&this.shadowRoot.activeElement===n?this.#d(this.#e):this.#e=-1,this.#n=!0,this.dispatchEvent(new CustomEvent("bezel-render",{bubbles:!0}))}#h(e){if(this.hasAttribute("no-tooltips"))return;let r=e.target?.closest?.("[data-tip]");if(!r){this.#r.classList.remove("on");return}this.#m(r,e.clientX,e.clientY)}#m(e,r,l){let i=this.#r;i.textContent=e.getAttribute("data-tip");let n=this.getBoundingClientRect?.()||{left:0,top:0,width:0},s=i.offsetWidth/2;i.style.left=`${_(r-n.left,s,Math.max(s,n.width-s))}px`,i.style.top=`${l-n.top}px`,i.classList.add("on")}#p(){return[...this.#t.querySelectorAll("[data-tip]:not([data-skip])")]}#v(e){let r=this.#p(),l=r.length;if(!l)return;let i=this.#e,n=ur[e.key];if(n)this.chartType==="heatmap"&&/Left|Right/.test(e.key)&&(n*=7),i=i<0?n>0?0:l-1:_(i+n,0,l-1);else if(e.key==="Home"||e.key==="End")i=e.key==="Home"?0:l-1;else{e.key==="Escape"&&this.#g();return}e.preventDefault(),this.#d(i,!0)}#d(e,r){let l=this.#p();if(!l.length)return;e=_(e,0,l.length-1),this.#t.querySelector(".k")?.classList.remove("k");let i=l[e],n=i.getBoundingClientRect?.()||{left:0,top:0,width:0};i.classList.add("k"),this.#e=e,this.#m(i,n.left+n.width/2,n.top),r&&(this.#o.textContent=`${i.getAttribute("data-tip").replace(/\n/g,", ")}. ${e+1} of ${l.length}`)}#g(){this.#t.querySelector(".k")?.classList.remove("k"),this.#r.classList.remove("on"),this.#o.textContent="",this.#e=-1}};function dr(t,{head:e,rows:r}){let l=i=>i.map((n,s)=>s?`<td>${at(n)}</td>`:`<th scope="row">${at(n)}</th>`).join("");return`<table><caption>${at(t||"Chart data")}</caption><thead><tr>${e.map(i=>`<th scope="col">${at(i)}</th>`).join("")}</tr></thead><tbody>${r.map(i=>`<tr>${l(i)}</tr>`).join("")}</tbody></table>`}var gr="1.2.0",_e=Object.keys(Zt);if(typeof customElements<"u"&&typeof HTMLElement<"u"){for(let t of _e){let e=`bezel-${t}`;customElements.get(e)||customElements.define(e,class extends Jt{get chartType(){return t}})}customElements.get("bezel-chart")||customElements.define("bezel-chart",class extends Jt{})}return ir(vr);})();
|