import{a$ as t,b0 as e,b1 as s,b2 as i,b3 as r}from"./p-BTBbFFOR.js";import{B as a,a as o,L as n,P as c,b as h,c as l}from"./p-B0jJxKxv.js";import{Y as d,X as u,a as p,b}from"./p-DPSa6HJG.js";import{I as w,V as v}from"./p-ULeawcYN.js";import"./p-B2ZFKKru.js";class x extends a{addInteractionSupport(){}draw(){const{dataSource:t=[],xScale:e,yScale:s,colors:i,direction:r}=this.options.renderOptions,a=t.map((t=>t.x)),o=t.map((t=>t.y));a.forEach(((t,a)=>{var n,c;const h=o[a]||0;let l=0,d=0,u={x:0,y:0};"horizontal"!==r?(l=(null===(n=e.bandwidth)||void 0===n?void 0:n.call(e))||5,d=Math.abs(s(0)-s(h)),u={x:e(t),y:s(Math.max(0,h))}):(d=(null===(c=s.bandwidth)||void 0===c?void 0:c.call(s))||5,l=Math.abs(e(h)-e(0)),u={x:e(Math.min(h,0)),y:s(t)}),this.renderer.drawRect(u,l,d,this.getColorFromToken(this.getColorByIndex(0,i)))}))}}class f extends d{process(t,e){const{dataSource:s,yAxis:i}=t,{innerWidth:r,innerHeight:a}=e,{scale:o,ticks:n}=this.getScale(s,[0,r],4);return{start:{x:0,y:a},end:{x:r,y:a},tickSize:n,scale:o,labelFormatter:null==i?void 0:i.labelFormatter,width:r,height:a,direction:"horizontal"}}}class m extends u{process(t,e){const{dataSource:s,xAxis:i,container:r}=t,{innerWidth:a,innerHeight:o}=e;return{start:{x:0,y:0},end:{x:0,y:o},tickSize:4,scale:this.getScale(s,o,(null==i?void 0:i.type)||"value","VEGA-LINE-CHART"===r.tagName?1:.1,null==i?void 0:i.sorter),labelFormatter:null==i?void 0:i.labelFormatter,width:a,height:o,direction:"horizontal"}}}class j extends o{constructor(){super(...arguments),this.layoutInputProcessor=new n,this.xAxisInputProcessorChain=new c([this.layoutInputProcessor,new u]),this.horizontalXAxisInputProcessorChain=new c([this.layoutInputProcessor,new f]),this.yAxisInputProcessorChain=new c([this.layoutInputProcessor,new d]),this.horizontalYAxisInputProcessorChain=new c([this.layoutInputProcessor,new m]),this.legendInputProcessorChain=new c([this.layoutInputProcessor,new h])}createDrawerChain(t,e){const{colors:s,xAxis:i,dataSource:r,direction:a}=this.options,o=Object.assign(Object.assign({},this.options),{xAxis:Object.assign(Object.assign({},i),{type:"category"})}),n="horizontal"===a?this.horizontalXAxisInputProcessorChain.process(o):this.xAxisInputProcessorChain.process(o),c="horizontal"===a?this.horizontalYAxisInputProcessorChain.process(o):this.yAxisInputProcessorChain.process(o);return[new p(t,e,{renderOptions:n}),new b(t,e,{renderOptions:c}),new l(t,e,{renderOptions:this.legendInputProcessorChain.process(o)}),new x(t,e,{renderOptions:{dataSource:r,xScale:n.scale,yScale:c.scale,colors:s,direction:a}})]}}var O=function(t,e,s,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,s,i);else for(var n=t.length-1;n>=0;n--)(r=t[n])&&(o=(a<3?r(o):a>3?r(e,s,o):r(e,s))||o);return a>3&&o&&Object.defineProperty(e,s,o),o};const S=class{constructor(t){e(this,t),this.globalSlimmers={},this.vegaComponentUsageRuntimeMetricsSlimmer=new v,this.options={}}watchOptions(t){this.initChart(t)}componentWillLoad(){this.initChart(this.options)}render(){return s(i,{key:"4cc728ae4f8b87c54e24a8b080c91fbac8fd6269"})}initChart(t){const{mode:e="svg",dataSource:s=[]}=t,i=function(t,e){var s={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(s[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(s[i[r]]=t[i[r]])}return s}(t,["mode","dataSource"]),r=Object.assign(Object.assign({},i),{mode:e,container:this.host,dataSource:s});this.chart?this.chart.updateOptions(r):(this.chart=new j(r),this.chart.render())}get host(){return r(this)}static get watchers(){return{options:[{watchOptions:0}]}}};O([w()],S.prototype,"globalSlimmers",void 0),O([t()],S.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),S.style=".vega-chart-legend-item{cursor:pointer}.vega-chart-line-path:hover{stroke-width:5}:host{display:block}";export{S as vega_bar_chart}