/**
 * Skipped minification because the original files appears to be already minified.
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
!function(t,a){"object"==typeof exports&&"object"==typeof module?module.exports=a():"function"==typeof define&&define.amd?define([],a):"object"==typeof exports?exports.ChartjsPluginStacked100=a():t.ChartjsPluginStacked100=a()}(self,(function(){return(()=>{"use strict";var t={d:(a,e)=>{for(var n in e)t.o(e,n)&&!t.o(a,n)&&Object.defineProperty(a,n,{enumerable:!0,get:e[n]})},o:(t,a)=>Object.prototype.hasOwnProperty.call(t,a),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},a={};t.r(a),t.d(a,{default:()=>f});var e=function(t,a){for(var e=0,n=a.length,r=t.length;e<n;e++,r++)t[r]=a[e];return t},n=function(t,a){return"object"==typeof(e=t)&&e?a?t.x:t.y:t;var e},r=function(t){t.originalData=t.datasets.map((function(t){return a=t.data,e([],a);var a}))},o=function(){return(o=Object.assign||function(t){for(var a,e=1,n=arguments.length;e<n;e++)for(var r in a=arguments[e])Object.prototype.hasOwnProperty.call(a,r)&&(t[r]=a[r]);return t}).apply(this,arguments)},i=function(t,a){for(var e=0,n=a.length,r=t.length;e<n;e++,r++)t[r]=a[e];return t},u=function(t,a,e){var r,o,u,c=t.datasets.map((function(t){return t.hidden?0:1})),d=(null===(u=null===(o=null===(r=null==t?void 0:t.datasets)||void 0===r?void 0:r[0])||void 0===o?void 0:o.data)||void 0===u?void 0:u.length)||0,f=i([],new Array(d)).map((function(e,r){return t.datasets.reduce((function(t,e,o){var i=e.stack;return t[i]||(t[i]=0),t[i]+=Math.abs(n(e.data[r],a))*c[o],t}),{})}));return t.datasets.map((function(t){return t.data.map((function(r,o){var i=f[o][t.stack],u=n(r,a);return u&&i?function(t,a){var e=Math.pow(10,a);return Math.round(100*t*e)/e}(u/i,e):0}))}))},c=function(t,a){t&&t.forEach((function(t,e){a[e].data=t}))},d=function(t){return"y"===t.options.indexAxis};const f={id:"stacked100",beforeInit:function(t,a,e){if(e.enable){var r=e.replaceTooltipLabel,i=void 0===r||r,u=d(t),c=u?"x":"y",f=t.data.datasets.some((function(t){return t.data.some((function(t){return t<0}))}));["x","y"].forEach((function(a){var e=o(o({stacked:!0},a===c?{min:f?-100:0,max:100}:{}),t.options.scales[a]);t.options.scales[a]=e})),i&&(t.options.plugins.tooltip.callbacks.label=function(t){return function(a){var e=a.chart.data,r=a.datasetIndex,o=a.dataIndex,i=e.datasets[r].label||"",u=e.originalData[r][o];return i+": "+e.calculatedData[r][o]+"% ("+n(u,t)+")"}}(u))}},beforeUpdate:function(t,a,e){if(e.enable){var n=t.data;r(n);var o=function(t){if(!("precision"in t))return 1;if(!t.precision)return 1;var a=Math.floor(t.precision);return isNaN(a)||a<0||a>16?1:a}(e);n.calculatedData=u(n,d(t),o),c(n.calculatedData,n.datasets)}},afterUpdate:function(t,a,e){if(e.enable){var n=t.data;c(n.originalData,n.datasets)}}};return a})()}));