text: /*!
   * chartjs-plugin-roundedbar v1.2.0
   * (c) 2021 Igor Amado
   * Released under the MIT license
   */
  !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("chart.js")):"function"==typeof define&&define.amd?define(["chart.js"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).RoundedBar=e(t.Chart)}(this,(function(t){"use strict";function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var o=e(t);var a=o.default.elements.Rectangle.extend({draw:function(){const t=this._chart.ctx,e=this._view,o=e.boundingRects(e),a=o.outer,n=o.inner,i=e.addRoundedRectPath;a.w===n.w&&a.h===n.h||(t.save(),a.w===n.w&&a.h===n.h||(t.beginPath(),i(t,a),t.clip(),i(t,n),t.fillStyle=e.borderColor,t.fill("evenodd")),t.beginPath(),i(t,n),t.fillStyle=e.backgroundColor,t.fill())}});const{isObject:n,extend:i}=o.default.helpers,r=Math.PI,l=r/2,d=t=>+t||0;function s(t,e,o){return t===e?o:t===o?e:t}function f(t,e,o){const a=function(t){let e,o,a,i;n(t)?(e=d(t.topLeft),o=d(t.topRight),a=d(t.bottomLeft),i=d(t.bottomRight)):e=o=a=i=d(t);return{topLeft:e,topRight:o,bottomLeft:a,bottomRight:i}}(t.borderRadius),i=Math.min(e,o),r=h(t);return{topLeft:u(r.top||r.left,a.topLeft,0,i),topRight:u(r.top||r.right,a.topRight,0,i),bottomLeft:u(r.bottom||r.left,a.bottomLeft,0,i),bottomRight:u(r.bottom||r.right,a.bottomRight,0,i)}}function u(t,e,o,a){return t?0:Math.max(Math.min(e,a),o)}function h(t){var e=t.borderSkipped,o={};return e?(t.horizontal?t.base>t.x&&(e=s(e,"left","right")):t.base<t.y&&(e=s(e,"bottom","top")),o[e]=!0,o):o}function c(t){const e=function(t){var e,o,a,n,i;return function(t){return t&&void 0!==t.width}(t)?(i=t.width/2,e=t.x-i,o=t.x+i,a=Math.min(t.y,t.base),n=Math.max(t.y,t.base)):(i=t.height/2,e=Math.min(t.x,t.base),o=Math.max(t.x,t.base),a=t.y-i,n=t.y+i),{left:e,top:a,right:o,bottom:n}}(t),o=e.right-e.left,a=e.bottom-e.top,i=function(t,e,o){var a,i,r,l,d=t.borderWidth,s=h(t);return n(d)?(a=+d.top||0,i=+d.right||0,r=+d.bottom||0,l=+d.left||0):a=i=r=l=+d||0,{t:s.top||a<0?0:a>o?o:a,r:s.right||i<0?0:i>e?e:i,b:s.bottom||r<0?0:r>o?o:r,l:s.left||l<0?0:l>e?e:l}}(t,o/2,a/2),r=f(t,o/2,a/2);return{outer:{x:e.left,y:e.top,w:o,h:a,radius:r},inner:{x:e.left+i.l,y:e.top+i.t,w:o-i.l-i.r,h:a-i.t-i.b,radius:{topLeft:Math.max(0,r.topLeft-Math.max(i.t,i.l)),topRight:Math.max(0,r.topRight-Math.max(i.t,i.r)),bottomLeft:Math.max(0,r.bottomLeft-Math.max(i.b,i.l)),bottomRight:Math.max(0,r.bottomRight-Math.max(i.b,i.r))}}}}function p(t,e){const{x:o,y:a,w:n,h:i,radius:d}=e;t.arc(o+d.topLeft,a+d.topLeft,d.topLeft,-l,r,!0),t.lineTo(o,a+i-d.bottomLeft),t.arc(o+d.bottomLeft,a+i-d.bottomLeft,d.bottomLeft,r,l,!0),t.lineTo(o+n-d.bottomRight,a+i),t.arc(o+n-d.bottomRight,a+i-d.bottomRight,d.bottomRight,l,0,!0),t.lineTo(o+n,a+d.topRight),t.arc(o+n-d.topRight,a+d.topRight,d.topRight,0,-l,!0),t.lineTo(o+d.topLeft,a)}let m=o.default.controllers.bar;var g=m.extend({dataElementType:a,updateElement:function(t,e){const o=this,a=o.chart.options.plugins.roundedBar;let n,r={};n=o.getMeta(),n.bar=!0,Object.defineProperty(t,"_model",{configurable:!0,get:function(){return r},set:function(t){i(r,t,o.chart.options.plugins.roundedBar)}}),m.prototype.updateElement.apply(o,arguments),delete t._model,t._model=i(r,{boundingRects:c,addRoundedRectPath:p}),t._roundedBarOptions=a},calculateBarValuePixels:function(t,e,o){var a,n,i,r,l,d,s,f=this,u=f.chart,h=f._getValueScale(),c=h.isHorizontal(),p=u.data.datasets,m=h._getMatchingVisibleMetas(f._type),g=h._parseValue(p[t].data[e]),b=o.minBarLength,x=h.options.stacked,y=f.getMeta().stack,R=void 0===g.start?0:g.max>=0&&g.min>=0?g.min:g.max,M=void 0===g.start?g.end:g.max>=0&&g.min>=0?g.max-g.min:g.min-g.max,v=m.length;if(x||void 0===x&&void 0!==y)for(a=0;a<v&&(n=m[a]).index!==t;++a)n.stack===y&&(i=void 0===(s=h._parseValue(p[n.index].data[e])).start?s.end:s.min>=0&&s.max>=0?s.max:s.min,(g.min<0&&i<0||g.max>=0&&i>0)&&(R+=i-20,M+=20));return r=h.getPixelForValue(R),d=(l=h.getPixelForValue(R+M))-r,void 0!==b&&Math.abs(d)<b&&(d=b,l=M>=0&&!c||M<0&&c?r-b:r+b),{size:d,base:r,head:l,center:l+d/2}}});const b=o.default.defaults;b._set("horizontalBar",{hover:{mode:"index",axis:"y"},scales:{xAxes:[{type:"linear",position:"bottom"}],yAxes:[{type:"category",position:"left",offset:!0,gridLines:{offsetGridLines:!0}}]},elements:{rectangle:{borderSkipped:"left"}},tooltips:{mode:"index",axis:"y"}}),b._set("global",{datasets:{horizontalBar:{categoryPercentage:.8,barPercentage:.9}}});var x=g.extend({_getValueScaleId:function(){return this.getMeta().xAxisID},_getIndexScaleId:function(){return this.getMeta().yAxisID}});o.default.layouts||o.default.layoutService,o.default.plugins;const y={bar:g,horizontalBar:x};function R(){var t,e,o=this,a=[],n=o.data.datasets;for(t=0,e=n.length;t<e;t++){var i=n[t],r=o.getDatasetMeta(t),l=i.type||o.config.type;if(r.type&&r.type!==l&&(o.destroyDatasetMeta(t),r=o.getDatasetMeta(t)),r.type=l,r.order=i.order||0,r.index=t,r.controller)r.controller.updateIndex(t),r.controller.linkScales();else{var d=y[r.type];if(void 0===d)throw new Error('"'+r.type+'" is not a chart type.');r.controller=new d(o,t),a.push(r.controller)}}return a}const M={id:"roundedbar",beforeInit:function(t){t._roundedBar={},t.buildOrUpdateControllers=R,delete t.$plugins,delete t._plugins}};return"function"==typeof define&&define.amd||"object"==typeof module&&module.exports||o.default.plugins.register(M),M}));
  