@opengis/bi 1.0.36 → 1.0.37

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/bi.js CHANGED
@@ -1,4 +1,4 @@
1
- import { l as f } from "./import-file-P2S3-jSU.js";
1
+ import { l as f } from "./import-file-DvlE1tB-.js";
2
2
  export {
3
3
  f as default
4
4
  };
package/dist/bi.umd.cjs CHANGED
@@ -97,7 +97,7 @@ echarts.use([`+oe+"]);":"Unknown series "+Q))}return}if(d==="tooltip"){if(P){gf.
97
97
  `}),S+="</div>",S}},xAxis:{data:e!=null&&e.length?e:null,type:e?"category":"value",name:((n=(i=this.styleData)==null?void 0:i.x_axis)==null?void 0:n.name)||"",axisLabel:{...nF((a=this.styleData)==null?void 0:a.x_axis),formatter:m=>{var b,S;const _=this.formatDate(m);return((S=(b=this.styleData)==null?void 0:b.x_axis)==null?void 0:S.overflow)==="ellipsis"&&_.length>10?`${_.slice(0,10)}...`:_}}},yAxis:{data:t!=null&&t.length?t:null,type:t?"category":"value",name:((s=(o=this.styleData)==null?void 0:o.y_axis)==null?void 0:s.name)||"",axisLabel:nF((l=this.styleData)==null?void 0:l.y_axis)},series:r!=null&&r.length?r:null,...ih(this.styleData),grid:{bottom:"0%",right:"0%",left:"0%",top:"20px",containLabel:!0,...((h=this.styleData)==null?void 0:h.grid)||{}}};await d.setOption(v),d.resize(),this.widgetInstance=d,this.$emit("update:currentWidget",d)}catch(f){console.error(f)}},async setSeriesOption(r,e){const t=r.getOption(),{series:i=[]}=t,n=i.map(a=>({...a,...e}));r.setOption({...t,series:n})},async changeOptionsByName(r,e){const t=document.getElementById(r);if(!t)return null;const i=sS(t);if(!i)return null;const n=i.getOption();e.seriesOptions&&this.setSeriesOption(i,e.seriesOptions),i.setOption({...n,...e.options,tooltip:{...Tse.getTooltipOptions(e.options.tooltip.show)}})},async changeData(r){var e;try{let t=this.dashboard?`${this.prefix||""}/bi-data?dashboard=${this.dashboard}&widget=${this.widget}`:`${this.prefix||""}/bi-data?&widget=${this.widget}`;(e=r==null?void 0:r.granularity)!=null&&e.length&&(t+=`&granularity=${r.granularity}`),r!=null&&r.metrics&&(t+=`&metrics=${r.metrics}`),this.getDataFromURL(t)}catch(t){console.error(t)}},async setFilter(r){const e=`${this.prefix||""}/bi-data?dashboard=${this.dashboardName}&widget=${this.widgetName}${r||""}`;await this.getDataFromURL(e)},async changeStyle(r,e){this.styleData[r]=e,this.onChangedData()},getMetricValue(r){var i;const e=(r==null?void 0:r.metric)||r;return parseFloat(e)?(i=gi(e,{notation:"standard"}))==null?void 0:i.replaceAll(","," "):e}}},dr=(r,e)=>{const t=r.__vccOpts||r;for(const[i,n]of e)t[i]=n;return t},Ase={name:"VsBar",mixins:[da],data(){return{resizeObserver:null}},computed:{uniqueID(){return this.widget}},async mounted(){var e;this.getData(),this.onChangedData();const r=(e=this.$refs)==null?void 0:e.chart;r&&(this.resizeObserver=new ResizeObserver(()=>{var t;this.widgetInstance&&((t=this.widgetInstance)==null||t.resize())}),this.resizeObserver.observe(r))},unmounted(){this.resizeObserver.disconnect()},methods:{async onChangedData(){try{if(this.sourceData){await this.$nextTick();const{series:r,xs:e,ys:t}=this.prepareData();r&&(this==null||this.initChart(r,e,t))}}catch(r){console.error(r)}},prepareData(){var r,e,t,i,n,a;try{if(!((r=this.sourceData)!=null&&r.length))return{series:[],xs:[],ys:void 0};const o=Array.from(new Set(this.sourceData.filter(v=>v[this.dimensions[0]]).map(v=>v[this.dimensions[0]])));let s;this.dimensions[0].includes("date")?s=o.map(v=>Yo(v)):s=[...o];let l,h;((e=this.styleData)==null?void 0:e.horizontal)===!0?h=[...s]:l=[...s];const f=this.sourceData.filter(v=>parseFloat(v[this.dimensions[1]])&&v[this.dimensions[0]]).map(v=>parseFloat(v[this.dimensions[1]]));let d;return((t=this.styleData)==null?void 0:t.stack)!==!1?d=this.prepareStackData():((i=this.styleData)==null?void 0:i.negative_waterfall)===!0?d=this.prepareNegativeWaterfall():((n=this.styleData)==null?void 0:n.waterfall)===!0?d=this.prepareWaterfallData(f):((a=this.styleData)==null?void 0:a.accumulative)===!0?d=this.prepareAccumulative(f):d=this.dimensions.slice(1).map((m,_)=>({name:m,type:"bar",stack:`a${_}`,data:this.sourceData.filter(b=>parseFloat(b[m])&&m).map(b=>parseFloat(b[m]))})),{series:d,xs:l,ys:h}}catch(o){return console.error(o),{series:[],xs:[],ys:[]}}},prepareWaterfallData(r){let e=r.reduce((a,o)=>a+o,0);const t=[e,...r],i=t.map((a,o)=>{if(o===0)return 0;const s=e-a;return e-=a,s>=0?s:0});return[{type:"bar",stack:"Total",itemStyle:{borderColor:"transparent",color:"transparent"},data:i,tooltip:{show:!1}},{name:this.title?this.title:this.dimensions[0],type:"bar",stack:"Total",data:t}]},prepareStackData(){return this.dimensions.slice(1).map(t=>({name:t,type:"bar",stack:"a",data:this.sourceData.filter(i=>parseFloat(i[t])&&t).map(i=>parseFloat(i[t]))}))},prepareNegativeWaterfall(){const r=this.sourceData.map(a=>Number.isNaN(a[this.dimensions[1]])?0:Number(a[this.dimensions[1]])),e=this.sourceData.map(a=>Number.isNaN(a[this.dimensions[2]])?0:Number(a[this.dimensions[2]]));let t=0;const i=r.map((a,o)=>{const s=t;return t+=Number.isNaN(a)?0:a,o===0&&(t-=Number.isNaN(e[o])?0:e[o]),t-=Number.isNaN(e[o+1])?0:e[o+1],s>=0?s:0});return[{type:"bar",stack:"a",itemStyle:{borderColor:"transparent",color:"transparent"},data:i,tooltip:{show:!1}},{name:this.dimensions[1],type:"bar",stack:"a",data:r},{name:this.dimensions[2],type:"bar",stack:"a",data:e}]},prepareAccumulative(r){let e=0;const t=r.map(n=>(e+=n,e));return[{name:this.titleCharts,type:"bar",stack:"Total",data:t}]}}},Ise=["id"];function Ese(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",{id:a.uniqueID,ref:"chart",class:"h-full w-full min-h-[200px]"},null,8,Ise)}const FC=dr(Ase,[["render",Ese]]),Mse=Object.freeze(Object.defineProperty({__proto__:null,default:FC},Symbol.toStringTag,{value:"Module"})),kse={name:"VsPie",props:["currentWidget"],mixins:[da],data(){return{chartInstance:null,resizeObserver:null}},computed:{uniqueID(){return this.widget}},async mounted(){var t;await this.$nextTick(),await this.getData();const{series:r}=this.prepareData()||{};r&&this.initChart(r);const e=(t=this.$refs)==null?void 0:t.chart;e&&(this.resizeObserver=new ResizeObserver(()=>{this.chartInstance&&this.chartInstance.resize()}),this.resizeObserver.observe(e))},unmounted(){var r;(r=this.resizeObserver)==null||r.disconnect()},methods:{onChangedData(){try{if(this.sourceData){const{series:r,xs:e,ys:t}=this.prepareData();r&&this.initChart(r,e,t)}}catch(r){console.error(r)}},buildTooltipForDonut(r,e){const{name:t,value:i,percent:n}=r;return`
98
98
  <div style="background-color:${e[0]}; font-size:12px; font-family:Helvetica, Arial, sans-serif; color:#ffff; padding:5px; border-radius:5px;">
99
99
  ${t==null?void 0:t.replace("null","Не визначено")}: ${gi(i)} (${n}%)
100
- </div>`},prepareData(){var r,e,t;try{const i=Array.from(new Set(this.sourceData.map(d=>d[this.dimensions[0]]))),n=Array.from(new Set(this.sourceData.map(d=>d[this.dimensions[1]]))),a=parseInt(this.sourceData.reduce((d,v)=>d+parseFloat(v==null?void 0:v.metric),0),10),o=i.map((d,v)=>{const m=(n[v]/a*100).toFixed(2);return{name:`${d} (${m}%)`,value:n[v]}}),s=((r=this.styleData)==null?void 0:r.innerRadius)||"0%",l=((e=this.styleData)==null?void 0:e.outerRadius)||"100%",h=[s,l];return this.styleData.legend=O0.getLegendOpions({borderRadius:10,height:"100%",padding:10,type:"scroll",itemWidth:14,itemHeight:14,formatter:d=>d==null?void 0:d.replace("null","Не визначено"),textStyle:{fontSize:"14px"},...this.styleData.legend}),this.styleData.label=O0.getLabelOptions(this.styleData.label),this.styleData.show_legend=((t=this.styleData)==null?void 0:t.show_legend)||!0,{series:[{name:this.titleCharts?this.titleCharts:this.dimensions[0],type:"pie",radius:h,center:["50%","60%"],height:"75%",...ih(this.styleData),data:o}]}}catch(i){return console.error(i),null}},async initChart(r){try{const e=this.$refs.chart;this.chartInstance=f_(e);const t={tooltip:{trigger:"item",formatter:i=>this.buildTooltipForDonut(i,[i.color]),borderWidth:0,appendToBody:!0,borderColor:"transparent",textStyle:{color:"#000"},padding:[15,15],shadowColor:"transparent",backgroundColor:"transparent"},series:r,...ih({...this.styleData})};this.chartInstance.setOption(t),this.$emit("update:currentWidget",this.chartInstance),this.chartInstance.resize(),window.addEventListener("resize",()=>{this.chartInstance.resize()})}catch(e){console.error(e)}}}},Pse=["id"];function Lse(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",{id:a.uniqueID,ref:"chart",class:"h-full min-h-[200px] flex items-center"},null,8,Pse)}const $C=dr(kse,[["render",Lse]]),Rse=Object.freeze(Object.defineProperty({__proto__:null,default:$C},Symbol.toStringTag,{value:"Module"})),zse={name:"VsLine",mixins:[da],data(){return{chartInstance:null,uniqueID:null}},async mounted(){this.uniqueID=this.widget,await this.$nextTick(),await this.getData();const{series:r,xs:e}=this.prepareData();r&&this.initChart(r,e)},methods:{onChangedData(){try{if(this.sourceData){const{series:r,xs:e,ys:t}=this.prepareData();r&&(this==null||this.initChart(r,e,t))}}catch(r){console.error(r)}},prepareData(){var r,e;try{const t=Array.from(new Set(this.sourceData.map(o=>o[this.dimensions[0]])));let i;this.dimensions[0].includes("date")?i=t.map(o=>Yo(o)):i=[...t];const n=this.sourceData.map(o=>parseFloat(o[this.dimensions[1]]));let a;return(r=this.styleData)!=null&&r.stack?a=this.dimensions.slice(1).map(s=>({name:s,type:"line",stack:"a",areaStyle:this.styleData.area?{}:null,data:this.sourceData.filter(l=>parseFloat(l[s])).map(l=>parseFloat(l[s]))})):a=[{name:this.title,type:"line",areaStyle:(e=this.styleData)!=null&&e.area?{}:null,data:n,stack:"a"}],{series:a,xs:i}}catch(t){return console.error(t),null}}}},Nse=["id"];function Ose(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",{id:n.uniqueID,ref:"chart",style:{height:"400px"}},null,8,Nse)}const GC=dr(zse,[["render",Ose]]),Bse=Object.freeze(Object.defineProperty({__proto__:null,default:GC},Symbol.toStringTag,{value:"Module"})),Vse={name:"VsStat",mixins:[da],data(){return{restDimensions:[],sumValue:0,columns:null,showTooltip:-1}},async mounted(){await this.getData(),this.prepareData()},methods:{onChangedData(){try{this.sourceData&&this.prepareData()}catch{}},prepareData(){this.columns=Object.keys(this.sourceData[0]);const r=this.getValues();this.sumValue=r.reduce((e,t)=>e+t,0),this.sourceData.forEach((e,t)=>{e.color=t<aF.length-1?aF[t]:Dse()})},formattedValue(r){const e=parseFloat(r);return gi(e)}}},Fse={class:"flex flex-col w-full h-full pt-[16px] rounded-xl"},$se={class:"flex flex-col justify-between w-full h-full"},Gse={class:"w-full h-full pb-6 space-y-4"},Use={class:"flex w-full h-3 rounded-full gap-x-1 min-h-3 custom-x-scrollbar"},Hse=["onMouseover"],Wse={key:0,class:"absolute top-[-1] left-1/2 transform -translate-x-1/2 -translate-y-full bg-black text-white rounded px-2 py-1"},Zse={class:"h-[calc(100%-20px)] w-full custom-scrollbar"},jse={class:"grid items-center justify-between grid-cols-2 py-2 gap-x-4"},qse={class:"flex items-center"},Xse={class:"text-sm text-gray-800"},Yse={class:"text-end"},Kse={class:"text-sm text-gray-500"};function Jse(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",Fse,[N.createElementVNode("div",$se,[N.createElementVNode("div",Gse,[N.createElementVNode("div",Use,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(r.sourceData,(o,s)=>{var l,h,f,d;return N.openBlock(),N.createElementBlock("div",{class:N.normalizeClass(["flex flex-col min-w-[5px] justify-center min-h-2.5 h-2.5 text-xs text-white text-center whitespace-nowrap",`bg-[${o.color}]`]),style:N.normalizeStyle({width:`${parseFloat(o==null?void 0:o[(l=n.columns)==null?void 0:l[1]])/n.sumValue*100}%`}),role:"progressbar","aria-valuenow":"42","aria-valuemin":"0","aria-valuemax":"100",onMouseover:v=>n.showTooltip=s,onMouseleave:e[0]||(e[0]=v=>n.showTooltip=-1)},[n.showTooltip>-1?(N.openBlock(),N.createElementBlock("div",Wse,N.toDisplayString(r.sourceData[n.showTooltip][n.columns[0]])+" "+N.toDisplayString((parseFloat((d=(h=r.sourceData)==null?void 0:h[n.showTooltip])==null?void 0:d[(f=n.columns)==null?void 0:f[1]])/n.sumValue*100).toFixed(2))+"% ",1)):N.createCommentVNode("",!0)],46,Hse)}),256))]),N.createElementVNode("ul",Zse,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(r.sourceData,o=>{var s,l;return N.openBlock(),N.createElementBlock("li",jse,[N.createElementVNode("div",qse,[N.createElementVNode("span",{class:N.normalizeClass(["shrink-0 size-2.5 inline-block rounded-sm me-2.5 min-w-[10px] w-[10px] h-[10px] min-h-[10px]",`bg-[${o.color}]`])},null,2),N.createElementVNode("span",Xse,N.toDisplayString((o==null?void 0:o[(s=n.columns)==null?void 0:s[0]])||"Не визначено"),1)]),N.createElementVNode("div",Yse,[N.createElementVNode("span",Kse,N.toDisplayString(a.formattedValue(o==null?void 0:o[(l=n.columns)==null?void 0:l[1]])||"-"),1)])])}),256))])])])])}const UC=dr(Vse,[["render",Jse]]),Qse=Object.freeze(Object.defineProperty({__proto__:null,default:UC},Symbol.toStringTag,{value:"Module"})),ele={name:"VsProgressBar",mixins:[da],data(){return{restDimensions:[],maxValue:0,columns:null}},async mounted(){await this.getData(),this.prepareData()},methods:{onChangedData(){try{this.sourceData&&this.prepareData()}catch{}},prepareData(){var e;this.columns=Object.keys((e=this.sourceData)==null?void 0:e[0])||null;const r=this.getValues();this.maxValue=Math.max(...r)},formattedValue(r){return gi(r)}}},tle={key:0,class:"flex flex-col h-full pt-[16px] rounded-xl"},rle={class:"h-full pt-0 pb-6 space-y-4"},ile={class:"h-full space-y-4 custom-scrollbar"},nle={class:"flex items-center justify-between mr-2 gap-x-2"},ale={class:"grid items-center w-full grid-cols-2 gap-x-2"},ole={class:"text-sm text-gray-800"},sle={class:"flex justify-end",role:"progressbar","aria-valuenow":"100","aria-valuemin":"0","aria-valuemax":"100"},lle={class:"min-w-[60px] text-end"},ule={class:"text-sm text-gray-500"};function cle(r,e,t,i,n,a){return n.columns?(N.openBlock(),N.createElementBlock("div",tle,[N.createElementVNode("div",rle,[N.createElementVNode("ul",ile,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(r.sourceData,(o,s)=>(N.openBlock(),N.createElementBlock("li",nle,[N.createElementVNode("div",ale,[N.createElementVNode("span",ole,N.toDisplayString(o[n.columns[0]]),1),N.createElementVNode("div",sle,[N.createElementVNode("div",{class:"h-1.5 flex flex-col justify-center overflow-hidden bg-indigo-500 rounded-full text-xs text-white text-center whitespace-nowrap",style:N.normalizeStyle({width:`${parseFloat(o[n.columns[1]])/n.maxValue*100}%`})},null,4)])]),N.createElementVNode("div",lle,[N.createElementVNode("span",ule,N.toDisplayString(a.formattedValue(o[n.columns[1]])),1)])]))),256))])])])):N.createCommentVNode("",!0)}const HC=dr(ele,[["render",cle]]),hle=Object.freeze(Object.defineProperty({__proto__:null,default:HC},Symbol.toStringTag,{value:"Module"})),fle={name:"VsListbar",mixins:[da],props:["source"],data(){return{restDimensions:[],maxValue:0,columns:null}},async mounted(){await this.getData(),this.prepareData()},methods:{onChangedData(){try{this.sourceData&&this.prepareData()}catch(r){console.error(r)}},prepareData(){var e;this.columns=Object.keys(this.sourceData[0]);const r=this.sourceData.map(t=>{var i;return t[(i=this.columns)==null?void 0:i[1]]});this.maxValue=Math.max(...r),this.restDimensions=(e=this.columns)==null?void 0:e.filter((t,i)=>i!==0)},formattedValue(r){return gi(r)},getWidth(r){return`${r/this.maxValue*100}%`}}},dle={class:"h-full pt-[20px] list-bar"},ple={class:"space-y-2 custom-scrollbar h-[calc(100%-20px)]"},vle={class:"relative w-full truncate"},gle={class:"relative z-[1] text-sm block py-1 px-2 w-full text-sm truncate text-gray-800"},mle={class:"text-[14px] text-gray-500"};function yle(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",dle,[N.createElementVNode("ul",ple,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(r.sourceData,(o,s)=>{var l,h,f;return N.openBlock(),N.createElementBlock("li",{key:s,class:"flex items-center justify-between w-full gap-x-2"},[N.createElementVNode("div",vle,[N.createElementVNode("span",gle,N.toDisplayString((o==null?void 0:o[(l=n.columns)==null?void 0:l[0]])||"Без категорії"),1),N.createElementVNode("div",{class:N.normalizeClass(["absolute inset-y-0 h-full rounded start-0",o!=null&&o[(h=n.columns)==null?void 0:h[0]]?"bg-indigo-100":"bg-gray-100"]),style:N.normalizeStyle({width:a.getWidth(o==null?void 0:o[(f=n.columns)==null?void 0:f[1]])})},null,6)]),(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(n.restDimensions,(d,v)=>(N.openBlock(),N.createElementBlock("div",{key:v,class:"w-20 mr-2 text-end"},[N.createElementVNode("span",mle,N.toDisplayString(a.formattedValue(o==null?void 0:o[d])),1)]))),128))])}),128))])])}const WC=dr(fle,[["render",yle]]),_le=Object.freeze(Object.defineProperty({__proto__:null,default:WC},Symbol.toStringTag,{value:"Module"})),ZC={week:"Тиждень",month:"Місяць",quarter:"Квартал",year:"Рік"},xle=["onClick"],ble={class:"flex items-center justify-between w-full"},wle={key:0},Sle={__name:"vs-bi-dropdown",props:{title:String,options:[Array,String],value:{type:String}},emits:["selected"],setup(r,{emit:e}){const t=r,i=e,n=N.ref(!1),a=N.ref(t.value||null),o=N.ref(null),s=N.computed(()=>typeof t.options=="string"?t.options.split(",").map((m,_)=>({id:_,text:m.trim()})):t.options),l=N.computed(()=>{const m=s.value.find(_=>(_.id||_)===a.value);return m?m.text||m:t.title}),h=m=>{a.value=m.id||m,n.value=!1,i("selected",(m==null?void 0:m.id)||m),document.removeEventListener("click",f)},f=m=>{o.value&&!o.value.contains(m.target)&&(n.value=!1,document.removeEventListener("click",f))},d=()=>{n.value=!n.value,n.value?setTimeout(()=>{document.addEventListener("click",f)},200):document.removeEventListener("click",f)},v=m=>(ZC==null?void 0:ZC[m])||m;return N.onUnmounted(()=>{document.removeEventListener("click",f)}),(m,_)=>(N.openBlock(),N.createElementBlock(N.Fragment,null,[N.createElementVNode("button",{type:"button","aria-expanded":"true",class:"hs-select-disabled:pointer-events-none hs-select-disabled:opacity-50 relative group pr-2 -ms-2 py-1.5 pl-2.5 inline-flex shrink-0 justify-center items-center gap-x-1.5 text-sm text-gray-800 rounded-lg hover:bg-gray-100 focus:outline-none focus:bg-gray-100 before:absolute before:inset-0 before:z-[1] dark:text-neutral-400 dark:hover:bg-neutral-800 dark:focus:bg-neutral-700",onClick:d},[N.createTextVNode(N.toDisplayString(v(l.value))+" ",1),_[0]||(_[0]=N.createElementVNode("svg",{class:"shrink-0 size-3.5 text-gray-600 dark:text-neutral-400",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[N.createElementVNode("path",{d:"m6 9 6 6 6-6"})],-1))]),n.value?(N.openBlock(),N.createElementBlock("div",{key:0,ref_key:"biDropdown",ref:o,"data-hs-select-dropdown":"",class:"absolute mt-2 z-50 w-48 p-1 space-y-0.5 bg-white rounded-xl shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] dark:bg-neutral-950 opened",role:"listbox",tabindex:"-1","aria-orientation":"vertical",style:{"margin-top":"10px"}},[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(s.value,b=>(N.openBlock(),N.createElementBlock("div",{key:b.id||b,class:"cursor-pointer selected hs-selected:bg-gray-100 dark:hs-selected:bg-neutral-800 py-1.5 px-2 w-full text-[13px] text-gray-800 rounded-lg hover:bg-gray-100 focus:outline-none focus:bg-gray-100 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:S=>h(b)},[N.createElementVNode("div",ble,[N.createElementVNode("span",null,N.toDisplayString(v(b.text||b)),1),a.value===(b.id||b)?(N.openBlock(),N.createElementBlock("span",wle,_[1]||(_[1]=[N.createElementVNode("svg",{class:"shrink-0 h-3.5 w-3.5 text-gray-800 dark:text-neutral-200",xmlns:"http:.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[N.createElementVNode("polyline",{points:"20 6 9 17 4 12"})],-1)]))):N.createCommentVNode("",!0)])],8,xle))),128))],512)):N.createCommentVNode("",!0)],64))}},Tle={"bi-bar":N.defineAsyncComponent(()=>Promise.resolve().then(()=>Mse)),"bi-number":N.defineAsyncComponent(()=>Promise.resolve().then(()=>ghe)),"bi-text":N.defineAsyncComponent(()=>Promise.resolve().then(()=>Qhe)),"bi-listbar":N.defineAsyncComponent(()=>Promise.resolve().then(()=>_le)),"bi-pie":N.defineAsyncComponent(()=>Promise.resolve().then(()=>Rse)),"bi-donut":N.defineAsyncComponent(()=>Promise.resolve().then(()=>ife)),"bi-line":N.defineAsyncComponent(()=>Promise.resolve().then(()=>Bse)),"bi-stat":N.defineAsyncComponent(()=>Promise.resolve().then(()=>Qse)),"bi-pivot":N.defineAsyncComponent(()=>Promise.resolve().then(()=>Lue)),"bi-progress":N.defineAsyncComponent(()=>Promise.resolve().then(()=>hle)),"bi-funnel":N.defineAsyncComponent(()=>Promise.resolve().then(()=>sfe)),"bi-map":N.defineAsyncComponent(()=>Promise.resolve().then(()=>gde)),"bi-cluster":N.defineAsyncComponent(()=>Promise.resolve().then(()=>wde)),"bi-table":N.defineAsyncComponent(()=>Promise.resolve().then(()=>zde))},Cle={class:"flex items-center space-x-2"},Dle=N.defineComponent({__name:"vs-bi-switch",props:N.mergeModels({leftLabel:{},rightLabel:{},modelValue:{type:Boolean}},{modelValue:{default:()=>!1,type:Boolean},modelModifiers:{}}),emits:N.mergeModels(["update:is-enabled"],["update:modelValue"]),setup(r,{emit:e}){const t=e,i=N.useModel(r,"modelValue"),n=()=>{t("update:is-enabled",i)};return(a,o)=>(N.openBlock(),N.createElementBlock("div",Cle,[a.leftLabel?(N.openBlock(),N.createElementBlock("div",{key:0,class:N.normalizeClass(["transition-colors",{"text-blue-500":!i.value}])},N.toDisplayString(a.leftLabel),3)):N.createCommentVNode("",!0),N.withDirectives(N.createElementVNode("input",{"onUpdate:modelValue":o[0]||(o[0]=s=>i.value=s),type:"checkbox",class:"relative w-11 h-6 p-px bg-gray-100 border-transparent text-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:ring-blue-600 disabled:opacity-50 disabled:pointer-events-none checked:bg-none checked:text-blue-600 checked:border-blue-600 focus:checked:border-blue-600 dark:bg-neutral-800 dark:border-neutral-700 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-600 before:inline-block before:size-5 before:bg-white checked:before:bg-blue-200 before:translate-x-0 checked:before:translate-x-full before:rounded-full before:shadow before:h-5 before:w-5 before:transform before:ring-0 before:transition before:ease-in-out before:duration-200 dark:before:bg-neutral-400 dark:checked:before:bg-blue-200",onChange:n},null,544),[[N.vModelCheckbox,i.value]]),a.rightLabel?(N.openBlock(),N.createElementBlock("div",{key:1,class:N.normalizeClass(["transition-colors",{"text-blue-500":i.value}])},N.toDisplayString(a.rightLabel),3)):N.createCommentVNode("",!0)]))}}),Ale={},Ile={class:"flex items-center justify-center h-full"};function Ele(r,e){return N.openBlock(),N.createElementBlock("div",Ile,e[0]||(e[0]=[N.createElementVNode("div",{class:"text-center text-gray-500"},[N.createElementVNode("h2",{class:"text-2xl font-bold"},"No data available")],-1)]))}const Mle=dr(Ale,[["render",Ele]]),kle={},Ple={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function Lle(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("svg",Ple,e[0]||(e[0]=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),N.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),N.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Rle={components:{VsBiDropdown:Sle,VsBiSwitch:Dle,VsNoDataChart:Mle,IconDownload:dr(kle,[["render",Lle]]),...Tle},props:{dashboard:{type:String},prefix:{type:String,default:""},widget:{type:String},filterURl:{type:String},dashboardWidgets:{type:Object},selectedWidget:{type:String}},data(){return{checked:[],selected:[],currentWidget:null,widgetData:[]}},computed:{computedTitle(){var e,t;const r=(e=this.dashboardWidgets)==null?void 0:e.find(i=>i.name===this.widget);return((t=r==null?void 0:r.data)==null?void 0:t.title)||(r==null?void 0:r.title)||""},computedType(){var e;const r=(e=this.dashboardWidgets)==null?void 0:e.find(t=>t.name===this.widget);return(r==null?void 0:r.type)||"text"},controls(){var e;return Object.keys(((e=this.widgetData)==null?void 0:e.controls)||{}).map(t=>{var i,n,a;return{name:t,options:typeof((i=this.widgetData)==null?void 0:i.controls)=="boolean"?!1:(a=(n=this.widgetData)==null?void 0:n.controls)==null?void 0:a[t]}})}},mounted(){this.prefix&&(mr.defaults.baseURL=this.prefix)},watch:{filterURl(r){var e,t;(t=(e=this.$refs)==null?void 0:e.chart)==null||t.setFilter(r)},selectedWidget(r,e){var t;r!==e&&r===((t=this.widgetData)==null?void 0:t.id)&&this.$emit("update:current-widget-data",this.widgetData)},widgetData(r,e){if((r==null?void 0:r.id)===(e==null?void 0:e.id))return;const i=new URLSearchParams(window.top.location.search).get("widget");i&&i===(r==null?void 0:r.id)&&this.$emit("update:current-widget-data",r)}},methods:{changeStyleHandler(r,e){var t;(t=this.$refs.chart)==null||t.changeStyle(r,e)},selectedOptionHandler(r,e){let t=!0;this.selected.forEach(i=>{i.name===e&&(i.option=r,t=!1)}),t&&this.selected.push({name:e,option:r}),this.makeUpUrl()},makeUpUrl(){var e;let r=`/bi-data?dashboard=${this.dashboard}&widget=${this.widget}`;this.selected.forEach((t,i)=>{r+=`&${t.name}=${t.option}`}),(e=this.$refs.chart)==null||e.getDataFromURL(r)},exportChart(){if(this.currentWidget){const r=this.currentWidget.getDataURL({type:"png",pixelRatio:2,backgroundColor:"#ffffff"}),e=document.createElement("a");e.href=r,e.download="chart.png",document.body.appendChild(e),e.click(),document.body.removeChild(e)}}}},zle={ref:"widget",class:"box-border relative h-full p-4 bg-white border border-gray-200 select-auto rounded-xl"},Nle={class:"text-[16px] flex max-w-full items-center min-h-0 flex justify-between max-h-[50px] h-fit shrink-0"},Ole={class:"flex items-center justify-between w-full"},Ble={class:"grid"},Vle={class:"text-gray-800 max-h-[30px] inline-block text-nowrap font-semibold font-[24px]"},Fle={class:"flex flex-col justify-end"},$le={key:0,class:"flex items-center justify-end w-full gap-2"},Gle={class:"w-full h-full"};function Ule(r,e,t,i,n,a){var f,d,v;const o=N.resolveComponent("VsBiDropdown"),s=N.resolveComponent("VsBiSwitch"),l=N.resolveComponent("IconDownload"),h=N.resolveComponent("VsNoDataChart");return N.openBlock(),N.createElementBlock("div",zle,[N.createElementVNode("div",Nle,[N.createElementVNode("div",Ole,[N.createElementVNode("div",Ble,[N.createElementVNode("span",Vle,N.toDisplayString(a.computedTitle),1)]),N.createElementVNode("div",Fle,[(f=a.controls)!=null&&f.length?(N.openBlock(),N.createElementBlock("span",$le,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList((d=a.controls)==null?void 0:d.filter(m=>(m==null?void 0:m.options)&&(m==null?void 0:m.name)!=="export"),m=>{var _;return N.openBlock(),N.createElementBlock("div",null,[Array.isArray(m==null?void 0:m.options)?(N.openBlock(),N.createBlock(o,{key:0,title:m==null?void 0:m.name,options:m==null?void 0:m.options,value:(_=n.widgetData)==null?void 0:_.data[m==null?void 0:m.name],onSelected:b=>a.selectedOptionHandler(b,m==null?void 0:m.name)},null,8,["title","options","value","onSelected"])):typeof m.options=="boolean"?(N.openBlock(),N.createBlock(s,{key:1,"left-label":m==null?void 0:m.name,"is-enabled":m==null?void 0:m.options,"onUpdate:isEnabled":b=>a.changeStyleHandler(m==null?void 0:m.name,b)},null,8,["left-label","is-enabled","onUpdate:isEnabled"])):N.createCommentVNode("",!0)])}),256)),(v=a.controls)!=null&&v.some(m=>(m==null?void 0:m.name)==="export")?(N.openBlock(),N.createElementBlock("button",{key:0,onClick:e[0]||(e[0]=(...m)=>a.exportChart&&a.exportChart(...m)),class:"h-[32px] w-[32px] rounded-lg hover:bg-gray-100 duration-100 flex items-center justify-center"},[N.createVNode(l,{height:"16",width:"16",class:"text-gray-800"})])):N.createCommentVNode("",!0)])):N.createCommentVNode("",!0)])])]),N.createElementVNode("div",Gle,[n.widgetData?(N.openBlock(),N.createBlock(N.resolveDynamicComponent("bi-"+a.computedType),{key:0,currentWidget:n.currentWidget,"onUpdate:currentWidget":e[1]||(e[1]=m=>n.currentWidget=m),widgetData:n.widgetData,"onUpdate:widgetData":e[2]||(e[2]=m=>n.widgetData=m),ref:"chart",dashboard:t.dashboard,prefix:t.prefix,widget:t.widget},null,40,["currentWidget","widgetData","dashboard","prefix","widget"])):(N.openBlock(),N.createBlock(h,{key:1,class:"w-full h-full"}))])],512)}const qv=dr(Rle,[["render",Ule]]),Hle={props:{title:{type:String,default:()=>"Дані для відображення відсутні"},text:{type:String,default:()=>"Змініть параметри пошуку або спробуйте пізніше"}}},Wle={class:"w-full overflow-hidden rounded vs-table-interface__table-wrp h-fit"},Zle={class:"p-5 min-h-[500px] flex flex-col justify-center items-center text-center"},jle={class:"max-w-sm mx-auto mt-6"},qle={class:"font-medium text-gray-800 dark:text-neutral-200"},Xle={class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"};function Yle(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",Wle,[N.createElementVNode("div",null,[N.createElementVNode("div",Zle,[e[0]||(e[0]=N.createStaticVNode('<svg class="w-48 mx-auto" viewBox="0 0 178 90" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs></svg>',1)),N.createElementVNode("div",jle,[N.createElementVNode("p",qle,N.toDisplayString(t.title),1),N.createElementVNode("p",Xle,N.toDisplayString(t.text),1)])])])])}const jC=dr(Hle,[["render",Yle]]),Kle={},Jle={class:"flex-shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Qle(r,e){return N.openBlock(),N.createElementBlock("svg",Jle,e[0]||(e[0]=[N.createStaticVNode('<line x1="21" x2="14" y1="4" y2="4"></line><line x1="10" x2="3" y1="4" y2="4"></line><line x1="21" x2="12" y1="12" y2="12"></line><line x1="8" x2="3" y1="12" y2="12"></line><line x1="21" x2="16" y1="20" y2="20"></line><line x1="12" x2="3" y1="20" y2="20"></line><line x1="14" x2="14" y1="2" y2="6"></line><line x1="8" x2="8" y1="10" y2="14"></line><line x1="16" x2="16" y1="18" y2="22"></line>',9)]))}const eue=dr(Kle,[["render",Qle]]),tue={},rue={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-refresh"};function iue(r,e){return N.openBlock(),N.createElementBlock("svg",rue,e[0]||(e[0]=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4"},null,-1),N.createElementVNode("path",{d:"M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"},null,-1)]))}const nue={components:{filterIcon:eue,refreshIcon:dr(tue,[["render",iue]])},props:["filterScheme"],emits:["filters:changed"],data(){return{rows:[],isFilterVisible:!1,rowList:[],activeFilters:"",filters:{}}},async mounted(){const e=await(await new URLSearchParams(window.top.location.search)).get("filter");this.filters.url=e||""},computed:{activeFiltersCount(){var r,e;return(r=this.filters)!=null&&r.url?((e=this.filters)==null?void 0:e.url.split("=").length)-1:0}},methods:{toggleFilterShown(){this.isFilterVisible=!this.isFilterVisible},handleFilterChange(r){var e,t;this.filters=r,this.activeFilters=(t=(e=this.$refs)==null?void 0:e.filter)==null?void 0:t.activeFilters,this.$emit("filters:changed",this.filters)},resetFilters(){this.$refs.filter&&this.$refs.filter.clearAll(),this.isFilterVisible=!1,this.$emit("filters:changed",""),this.activeFilters=null},closeFilter({target:r}){this.isFilterVisible&&r.classList.contains("filter-container")&&(this.isFilterVisible=!1)}}},aue={class:"flex items-center"},oue={key:0,class:"font-medium text-[10px] min-w-[16px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full"};function sue(r,e,t,i,n,a){const o=N.resolveComponent("filterIcon"),s=N.resolveComponent("VsFilterList");return N.openBlock(),N.createElementBlock("div",aue,[t.filterScheme?(N.openBlock(),N.createBlock(s,{key:0,ref:"filter",scheme:t.filterScheme,closeFilterBtn:!0,onFilterClose:e[1]||(e[1]=l=>n.isFilterVisible=!1),layout:"default","apply-vue-router":"",history:"",view:"plain",token:r.table,name:"filter",footer:!0,background:!0,onFilterChange:a.handleFilterChange},{button:N.withCtx(()=>[N.createElementVNode("button",{type:"button",class:"py-2 px-2.5 ml-3 h-[38px] inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50",onClick:e[0]||(e[0]=(...l)=>a.toggleFilterShown&&a.toggleFilterShown(...l))},[N.createVNode(o),e[2]||(e[2]=N.createTextVNode(" Фільтри ")),a.activeFiltersCount>=1?(N.openBlock(),N.createElementBlock("span",oue,N.toDisplayString(a.activeFiltersCount),1)):N.createCommentVNode("",!0)])]),_:1},8,["scheme","token","onFilterChange"])):N.createCommentVNode("",!0)])}const lue={props:["dashboardData","filters"],components:{VsFilterHeader:dr(nue,[["render",sue]])}},uue={class:"bg-white px-5 flex gap-4 h-[90px] border border-gray-200 mt-2 rounded-xl mb-2 pt-[3px] justify-between items-center"},cue={class:"grow"},hue={class:"text-lg font-semibold text-stone-800 dark:text-neutral-200"},fue={type:"button",class:"inline-flex items-center text-sm gap-x-2 text-stone-800 hover:text-stone-500 focus:outline-none focus:text-stone-500 dark:text-neutral-200 dark:hover:text-neutral-400 dark:focus:text-neutral-400","data-clipboard-target":"#hs-erc","data-clipboard-action":"copy","data-clipboard-success-text":"Copied"};function due(r,e,t,i,n,a){var s,l;const o=N.resolveComponent("VsFilterHeader");return N.openBlock(),N.createElementBlock("div",uue,[N.createElementVNode("div",cue,[N.createElementVNode("h1",hue,N.toDisplayString((s=t.dashboardData)==null?void 0:s.title),1),N.createElementVNode("button",fue,N.toDisplayString((l=t.dashboardData)==null?void 0:l.description),1)]),N.createVNode(o,{filterScheme:t.filters,"onFilters:changed":e[0]||(e[0]=h=>r.$emit("filters:changed",h))},null,8,["filterScheme"])])}const pue={components:{VsWidget:qv,VsNewNodata:jC,VsHeader:dr(lue,[["render",due]])},props:["id","prefix"],data(){return{widgets:[],panels:[],error:!1,selectedPanel:"",filterURl:null,dashboardData:null}},async mounted(){mr.defaults.baseURL=this.prefix||"/api",await this.fetchData()},methods:{async fetchData(){if(this.id)try{const{data:r}=await mr.get(`/bi-dashboard/${this.id}`);this.dashboardData=r}catch(r){console.error(r)}},columnClass(r){const e=r!=null&&r.col?r==null?void 0:r.col:12;return{1:"md:w-1/12 sm:w-full",2:"md:w-1/6 sm:w-full",3:"md:w-1/4 sm:w-full",4:"md:w-1/3 sm:w-full",6:"md:w-1/2 sm:w-full",8:"md:w-2/3 sm:w-full",10:"md:w-5/6 sm:w-full",12:"w-full"}[e]||"w-full"},async filterHandler(r){var t;this.filterURl="";let e="&filter=";(t=r==null?void 0:r.url)!=null&&t.length&&(r.url.split("|").forEach(n=>{const a=n.split("=");e+=`${a[0]}=${a[1]}`}),this.filterURl+=e)}}},vue={class:"w-full pb-8 overflow-y-auto"},gue={class:"grid flex-grow w-full grid-cols-12 gap-4 h-fit"};function mue(r,e,t,i,n,a){var h,f,d;const o=N.resolveComponent("VsHeader"),s=N.resolveComponent("VsNewNodata"),l=N.resolveComponent("VsWidget");return N.openBlock(),N.createElementBlock("div",vue,[N.createElementVNode("div",null,[(h=n.dashboardData)!=null&&h.filters?(N.openBlock(),N.createBlock(o,{key:0,filters:(f=n.dashboardData)==null?void 0:f.filters,dashboardData:n.dashboardData,"onFilters:changed":e[0]||(e[0]=v=>a.filterHandler(v))},null,8,["filters","dashboardData"])):N.createCommentVNode("",!0)]),N.createElementVNode("div",gue,[n.error||!n.dashboardData?(N.openBlock(),N.createBlock(s,{key:0,class:"col-span-12"})):N.createCommentVNode("",!0),(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(((d=n.dashboardData)==null?void 0:d.panels)||[],(v,m)=>{var _;return N.openBlock(),N.createElementBlock("div",{key:m,class:N.normalizeClass([`col-span-${v.col||12}`,"flex flex-col gap-[10px]"])},[(_=v.widgets)!=null&&_.length?(N.openBlock(!0),N.createElementBlock(N.Fragment,{key:0},N.renderList(v.widgets,b=>(N.openBlock(),N.createBlock(l,{key:b,dashboard:t.id,widget:b,"dashboard-widgets":n.dashboardData.widgets,"filter-u-rl":n.filterURl},null,8,["dashboard","widget","dashboard-widgets","filter-u-rl"]))),128)):(N.openBlock(),N.createBlock(l,{key:1,class:"max-h-[460px] flex flex-col",dashboard:t.id,widget:v.widget,"dashboard-widgets":n.dashboardData.widgets,"filter-u-rl":n.filterURl},null,8,["dashboard","widget","dashboard-widgets","filter-u-rl"]))],2)}),128))])])}const oF=dr(pue,[["render",mue]]),yue={name:"VsPivotTable",mixins:[da],data(){return{values:null,xs:null,products:null}},async mounted(){await this.getData(),this.prepareData()},methods:{onChangedData(){try{this.sourceData&&this.prepareData()}catch{}},prepareData(){try{const r=Array.from(new Set(this.sourceData.map(e=>e[this.dimensions[0]])));this.dimensions[0].includes("date")?this.xs=r.map(e=>Yo(e)):this.xs=[...r],this.products=this.dimensions.filter((e,t)=>t!=0),this.values=this.products.map((e,t)=>({name:e,data:this.sourceData.filter(i=>parseFloat(i[e])).map(i=>gi(parseFloat(i[e])))}))}catch(r){console.error(r)}}}},_ue={class:"flex flex-col h-full p-5 space-y-4 rounded-xl custom-scrollbar"},xue={class:"overflow-x-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 custom-scrollbar"},bue={class:"inline-block min-w-full align-middle"},wue={class:"min-w-full divide-y divide-gray-200"},Sue={class:"space-x-2"},Tue={scope:"col",class:"xl:min-w-[120px] min-w-48"},Cue={class:"py-2.5 text-text-start flex items-center gap-x-1 text-sm font-normal text-gray-500"},Due={class:"divide-y divide-gray-200 text-[12px]"},Aue={class:"py-3 size-px whitespace-nowrap"},Iue={class:"flex items-center gap-x-3"},Eue={class:"font-medium text-gray-800"},Mue={class:"py-3 size-px whitespace-nowrap"},kue={class:"text-gray-600"};function Pue(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",_ue,[N.createElementVNode("div",xue,[N.createElementVNode("div",bue,[N.createElementVNode("table",wue,[N.createElementVNode("thead",null,[N.createElementVNode("tr",Sue,[e[0]||(e[0]=N.createElementVNode("th",{scope:"col",class:"min-w-[200px]"},[N.createElementVNode("div",{class:"py-2.5 text-text-start flex items-center gap-x-1 text-sm font-normal text-gray-500"})],-1)),(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(n.xs,o=>(N.openBlock(),N.createElementBlock("th",Tue,[N.createElementVNode("div",Cue,N.toDisplayString(o),1)]))),256))])]),(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(n.values,o=>(N.openBlock(),N.createElementBlock("tbody",Due,[N.createElementVNode("tr",null,[N.createElementVNode("td",Aue,[N.createElementVNode("div",Iue,[N.createElementVNode("span",Eue,N.toDisplayString(o.name),1)])]),(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(n.xs,(s,l)=>(N.openBlock(),N.createElementBlock("td",Mue,[N.createElementVNode("span",kue,N.toDisplayString(o.data[l]),1)]))),256))])]))),256))])])])])}const qC=dr(yue,[["render",Pue]]),Lue=Object.freeze(Object.defineProperty({__proto__:null,default:qC},Symbol.toStringTag,{value:"Module"})),Rue={},zue={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Nue(r,e){return N.openBlock(),N.createElementBlock("svg",zue,e[0]||(e[0]=[N.createElementVNode("path",{d:"M3.3335 8H12.6668",stroke:"#1E40AF","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M8 3.33325V12.6666",stroke:"#1E40AF","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]))}const Oue=dr(Rue,[["render",Nue]]),Bue={},Vue={width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"mr-3"};function Fue(r,e){return N.openBlock(),N.createElementBlock("svg",Vue,e[0]||(e[0]=[N.createElementVNode("path",{d:"M6.41667 11.0833C8.994 11.0833 11.0833 8.994 11.0833 6.41667C11.0833 3.83934 8.994 1.75 6.41667 1.75C3.83934 1.75 1.75 3.83934 1.75 6.41667C1.75 8.994 3.83934 11.0833 6.41667 11.0833Z",stroke:"#6B7280","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M12.25 12.25L9.7417 9.7417",stroke:"#6B7280","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]))}const $ue=dr(Bue,[["render",Fue]]),Gue={},Uue={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-upload"};function Hue(r,e){return N.openBlock(),N.createElementBlock("svg",Uue,e[0]||(e[0]=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),N.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),N.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Wue=dr(Gue,[["render",Hue]]),Zue={},jue={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-lock"};function que(r,e){return N.openBlock(),N.createElementBlock("svg",jue,e[0]||(e[0]=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-6z"},null,-1),N.createElementVNode("path",{d:"M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0"},null,-1),N.createElementVNode("path",{d:"M8 11v-4a4 4 0 1 1 8 0v4"},null,-1)]))}const Xue=dr(Zue,[["render",que]]),Yue=[{type:"Text",key:"name",label:"Назва",validators:["required"],original:{type:"Text",ua:"Назва",col:8}},{type:"Text",key:"title",label:"Заголовок",validators:["required"],original:{type:"Text",ua:"Титул",col:8}},{type:"Text",key:"description",label:"Опис",original:{type:"Text",ua:"Назва",col:8}},{type:"Text",key:"words",label:"Ключові слова",original:{type:"Text",ua:"Назва",col:8}},{type:"Text",key:"table_name",validators:["required"],label:"Назва таблиці",original:{type:"Text",ua:"Назва",col:8}},{type:"Text",key:"db",label:"База даних",original:{type:"Text",ua:"Назва",col:8}},{type:"Switcher",key:"public",label:"Публічний",original:{type:"Text",ua:"Назва",col:8}}],Kue={components:{plusIcon:Oue,searchIcon:$ue,IconLock:Xue,IconImport:Wue},props:["selectedDashboard","prefix"],emits:["update:selectedDashboard","add","update"],mounted(){mr.defaults.baseURL=this.prefix||"/api",this.getFileItems(),this.getList()},data(){return{searchQuery:"",scheme:null,formValues:{},formCreateValues:{},isVisible:!1,isVisibleFormDashboard:!1,fileItems:null,list:null,addDashboardForm:Yue}},methods:{async getFileItems(){var r;try{const{data:e}=await mr.get("/bi-dashboard?type=file");this.scheme={dashboard:{type:"Checkbox",ua:"Дашборди",options:(r=e==null?void 0:e.rows)==null?void 0:r.map(({name:t,title:i})=>({id:t,text:i}))}}}catch{}},async getList(){try{const{data:r}=await mr.get("/bi-dashboard?type=db");this.list=r.rows.filter(e=>e.type==="db")}catch(r){console.error(r)}},async dashboardImport(){try{await mr.get(`/bi-dashboard-import?dashboard=${this.formValues.dashboard}`),this.isVisible=!1,this.formValues={},this.$notify({type:"success",title:"Успішно!",message:"Дашборд імпортовано успішно"}),this.getList()}catch{this.$notify({type:"error",title:"Помилка!",message:"При спробі імпортувати дашборд виникла помилка"})}},async createDashboard(){try{await this.$refs.form.doValidation(),await mr.post("/bi-dashboard",this.formCreateValues),this.isVisibleFormDashboard=!1,this.formCreateValues={},this.$notify({type:"success",title:"Успішно!",message:"Дашборд створено успішно"}),this.getList()}catch{this.$notify({type:"error",title:"Помилка!",message:"При спробі створити дашборд виникла помилка"})}}},computed:{filteredList(){var e;const r=this.searchQuery.toLowerCase();return(e=this.list)==null?void 0:e.filter(t=>(t==null?void 0:t.title)&&(t==null?void 0:t.title.toLowerCase().includes(r))||(t==null?void 0:t.name)&&(t==null?void 0:t.name.toLowerCase().includes(r)))}}},Jue={class:"h-full w-[300px] shrink-0 bg-white border-r border-gray-200 flex flex-col"},Que={class:"flex h-[49px] border-b justify-between px-[16px] items-center"},ece={class:"flex items-center gap-2"},tce={class:"flex items-center gap-2 px-[10px] py-2"},rce={class:"relative w-full"},ice={class:"px-[10px] flex flex-col gap-[2px] overflow-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300"},nce=["item","onClick"],ace={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},oce={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"};function sce(r,e,t,i,n,a){const o=N.resolveComponent("IconImport"),s=N.resolveComponent("VsPopover"),l=N.resolveComponent("plusIcon"),h=N.resolveComponent("IconLock"),f=N.resolveComponent("VsForm"),d=N.resolveComponent("VsDialog");return N.openBlock(),N.createElementBlock(N.Fragment,null,[N.createElementVNode("div",Jue,[N.createElementVNode("div",Que,[e[13]||(e[13]=N.createElementVNode("div",{class:"text-[20px]"},[N.createTextVNode("Editor "),N.createElementVNode("span",{class:"text-[#666666]"})],-1)),N.createElementVNode("div",ece,[N.createVNode(s,{placement:"left",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{class:"bg-[#DBEAFE] h-[38px] text-blue-500 w-[38px] flex items-center hover:bg-blue-300 duration-300 justify-center rounded-lg shrink-0",onClick:e[0]||(e[0]=v=>n.isVisible=!0)},[N.createVNode(o,{height:"18",width:"18"})])]),default:N.withCtx(()=>[e[11]||(e[11]=N.createTextVNode(" Імпортувати дашборд "))]),_:1}),N.createVNode(s,{placement:"right",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{class:"bg-[#DBEAFE] h-[38px] w-[38px] flex items-center hover:bg-blue-300 duration-300 justify-center rounded-lg shrink-0",onClick:e[1]||(e[1]=v=>n.isVisibleFormDashboard=!0)},[N.createVNode(l)])]),default:N.withCtx(()=>[e[12]||(e[12]=N.createTextVNode(" Створити дашборд "))]),_:1})])]),N.createElementVNode("div",tce,[N.createElementVNode("div",rce,[N.withDirectives(N.createElementVNode("input",{"onUpdate:modelValue":e[2]||(e[2]=v=>n.searchQuery=v),class:"flex-1 text-[13px] w-full h-[38px] px-3 text-gray-800 rounded-lg !border-none bg-gray-100 placeholder-gray-800 focus:outline-2 focus:outline-blue-600",placeholder:"Пошук..."},null,512),[[N.vModelText,n.searchQuery]])])]),N.createElementVNode("div",ice,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(a.filteredList,(v,m)=>(N.openBlock(),N.createElementBlock("div",{key:m,item:v,class:N.normalizeClass(["flex items-center cursor-pointer hover:bg-[#F3F4F6] py-1.5 px-2 text-[13px] text-gray-800 rounded-lg",{"bg-gray-100 outline-none":v.name===t.selectedDashboard}]),onClick:_=>r.$emit("update:selectedDashboard",v==null?void 0:v.name)},[N.createTextVNode(N.toDisplayString((v==null?void 0:v.title)||(v==null?void 0:v.name))+" ",1),v!=null&&v.public?N.createCommentVNode("",!0):(N.openBlock(),N.createBlock(h,{key:0,height:"12",width:"12",class:"ml-1 shrink-0"}))],10,nce))),128))])]),N.createVNode(d,{visible:n.isVisible,"onUpdate:visible":e[6]||(e[6]=v=>n.isVisible=v),title:"Імпортувати"},{footer:N.withCtx(()=>[N.createElementVNode("div",ace,[N.createElementVNode("button",{style:{border:"1px solid #000"},onClick:e[4]||(e[4]=v=>n.isVisible=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),N.createElementVNode("button",{onClick:e[5]||(e[5]=(...v)=>a.dashboardImport&&a.dashboardImport(...v)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Імпортувати ")])]),default:N.withCtx(()=>{var v;return[N.createTextVNode(N.toDisplayString((v=n.fileItems)==null?void 0:v.map(({name:m,title:_})=>({value:m,text:_})))+" ",1),N.createVNode(f,{scheme:n.scheme,modelValue:n.formValues,"onUpdate:modelValue":e[3]||(e[3]=m=>n.formValues=m)},null,8,["scheme","modelValue"])]}),_:1},8,["visible"]),N.createVNode(d,{visible:n.isVisibleFormDashboard,"onUpdate:visible":e[10]||(e[10]=v=>n.isVisibleFormDashboard=v),title:"Створити дашборд"},{footer:N.withCtx(()=>[N.createElementVNode("div",oce,[N.createElementVNode("button",{style:{border:"1px solid #000"},onClick:e[8]||(e[8]=v=>n.isVisibleFormDashboard=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),N.createElementVNode("button",{onClick:e[9]||(e[9]=(...v)=>a.createDashboard&&a.createDashboard(...v)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:N.withCtx(()=>[N.createVNode(f,{ref:"form",scheme:n.addDashboardForm,modelValue:n.formCreateValues,"onUpdate:modelValue":e[7]||(e[7]=v=>n.formCreateValues=v)},null,8,["scheme","modelValue"])]),_:1},8,["visible"])],64)}const lce=dr(Kue,[["render",sce]]),uce={},cce={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-trash"};function hce(r,e){return N.openBlock(),N.createElementBlock("svg",cce,e[0]||(e[0]=[N.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7l16 0"></path><path d="M10 11l0 6"></path><path d="M14 11l0 6"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>',6)]))}const sF=dr(uce,[["render",hce]]),fce={},dce={class:"shrink-0 size-3",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function pce(r,e){return N.openBlock(),N.createElementBlock("svg",dce,e[0]||(e[0]=[N.createElementVNode("path",{d:"M18 6 6 18"},null,-1),N.createElementVNode("path",{d:"m6 6 12 12"},null,-1)]))}const lF=dr(fce,[["render",pce]]),vce={},gce={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-edit"};function mce(r,e){return N.openBlock(),N.createElementBlock("svg",gce,e[0]||(e[0]=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"},null,-1),N.createElementVNode("path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z"},null,-1),N.createElementVNode("path",{d:"M16 5l3 3"},null,-1)]))}const uF=dr(vce,[["render",mce]]),yce={class:"pt-[10px]"},_ce={__name:"vs-editor-form-style",props:{widgetName:{type:String},data:{type:Object,default:()=>{}}},setup(r){var v,m,_,b,S,D;const{$notify:e}=N.getCurrentInstance().proxy,t=r,i=N.ref(null),n={show:{label:"Label",type:"switcher",title:"Show label"},rotate:{type:"number",label:"Rotate angel",conditions:["show","==",!0]},align:{type:"radio",view:"buttons",style:{size:"xs"},conditions:["show","==",!0],options:[{id:"center",text:"Center"},{id:"left",text:"Left"},{id:"right",text:"Right"}]},position:{type:"radio",view:"buttons",style:{size:"xs"},conditions:["show","==",!0],options:[{id:"top",text:"Top"},{id:"right",text:"Right"},{id:"left",text:"Left"},{id:"bottom",text:"Bottom"}]}},a={show:{label:"Legend",type:"switcher",title:"Show legend"}},o={show:{label:"Tooltip ",type:"switcher",title:"Show tooltip"}},s=N.ref({...((m=(v=t.data)==null?void 0:v.style)==null?void 0:m.label)||{}}),l=N.ref({...((b=(_=t.data)==null?void 0:_.style)==null?void 0:b.legend)||{}}),h=N.ref({...((D=(S=t.data)==null?void 0:S.style)==null?void 0:D.tooltip)||{}}),f=()=>{const k=new CustomEvent(`update-style-${t.widgetName}`);k.chartId=t.widgetName,k.options={options:{legend:l.value,tooltip:h.value,label:s.value},seriesOptions:s.value},window.dispatchEvent(k)};N.watch(s,f,{deep:!0}),N.watch(l,f,{deep:!0}),N.watch(h,f,{deep:!0});const d=async()=>{try{await mr.put(`/bi-dashboard/${i.value}/${t.widgetName}`,{style:{legend:l.value,tooltip:h.value,label:s.value}});const k=new CustomEvent(`update-style-${t.widgetName}`);k.chartId=t.widgetName,k.options={options:{legend:l.value,tooltip:h.value,label:s.value},seriesOptions:s.value},window.dispatchEvent(k),await e({type:"success",title:"Успішно!",message:"Дані успішно оновлено"})}catch{await e({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}};return N.onMounted(()=>{const k=new URLSearchParams(window.top.location.search);i.value=k.get("dashboard")}),(k,P)=>{const z=N.resolveComponent("VsButton"),F=N.resolveComponent("VsForm");return N.openBlock(),N.createElementBlock("div",yce,[N.createVNode(z,{class:"ml-[10px] mb-[10px]",type:"plain",onClick:d},{default:N.withCtx(()=>P[3]||(P[3]=[N.createTextVNode(" Зберегти ")])),_:1}),N.createVNode(F,{scheme:n,modelValue:s.value,"onUpdate:modelValue":P[0]||(P[0]=V=>s.value=V),class:"p-0"},null,8,["modelValue"]),N.createVNode(F,{scheme:a,modelValue:l.value,"onUpdate:modelValue":P[1]||(P[1]=V=>l.value=V),class:"p-0"},null,8,["modelValue"]),N.createVNode(F,{scheme:o,modelValue:h.value,"onUpdate:modelValue":P[2]||(P[2]=V=>h.value=V),class:"p-0"},null,8,["modelValue"])])}}},xce={class:"pt-[10px]"},bce={__name:"vs-editor-form-data",props:{widgetName:{type:String},data:{type:Object,default:()=>{}},columns:{type:Array,default:()=>[]}},emits:["update-dashboard"],setup(r,{emit:e}){var h,f,d,v,m,_,b,S,D,k,P,z,F,V,U,Z,j,K,Q,oe;const{$notify:t}=N.getCurrentInstance().proxy,i=r,n=N.ref(null),a={text:{type:"Text",label:"Text",conditions:["type","==","text"]},x:{type:"radio",label:"X Axis",view:"buttons",style:{size:"xs"},conditions:["type","not_in",["text","table","map"]],options:(f=(h=i.columns)==null?void 0:h.filter(ne=>(ne==null?void 0:ne.type)=="text"||(ne==null?void 0:ne.type)==="date"||(ne==null?void 0:ne.type)==="timestamp without time zone"||(ne==null?void 0:ne.type)==="boolean"||(ne==null?void 0:ne.type)==="integer"))==null?void 0:f.map(({name:ne,type:he})=>({id:ne,label:ne,type:he}))},metric:{type:"radio",label:"Y Axis",view:"buttons",style:{size:"xs"},conditions:["type","not_in",["text","table","map"]],options:[{id:"count",label:"count"},...(v=(d=i.columns)==null?void 0:d.filter(ne=>(ne==null?void 0:ne.type)==="numeric"||(ne==null?void 0:ne.type)==="double precision"))==null?void 0:v.map(({name:ne,type:he})=>({id:ne,label:ne,type:he}))]},groupby:{type:"radio",label:"Groupby",view:"buttons",style:{size:"xs"},options:[{id:"null",label:"null"},...(_=(m=i.columns)==null?void 0:m.filter(ne=>(ne==null?void 0:ne.type)=="text"||(ne==null?void 0:ne.type)==="boolean"||(ne==null?void 0:ne.type)==="integer"))==null?void 0:_.map(({name:ne})=>({id:ne,label:ne}))],conditions:["type","==","bar"]},columns:{type:"checkbox",label:"Columns",style:{size:"xs"},options:(b=i.columns)==null?void 0:b.map(({name:ne})=>ne),conditions:["type","in",["table","map"]]},granularity:{type:"radio",label:"Granularity",options:[{id:"year",label:"year"},{id:"quarter",label:"quarter"},{id:"month",label:"month"},{id:"week",label:"week"}],conditions:["x.type","==","date"]},type:{type:"Text",hidden:!0}},o=N.ref({x:((D=(S=i.data)==null?void 0:S.data)==null?void 0:D.x)||null,metric:((P=(k=i.data)==null?void 0:k.data)==null?void 0:P.metric)||null,columns:((F=(z=i.data)==null?void 0:z.data)==null?void 0:F.columns)||null,granularity:((U=(V=i.data)==null?void 0:V.data)==null?void 0:U.granularity)||null,type:((j=(Z=i.data)==null?void 0:Z.data)==null?void 0:j.type)||((K=i.data)==null?void 0:K.type)||null,groupby:((oe=(Q=i.data)==null?void 0:Q.data)==null?void 0:oe.groupby)||null}),s=async()=>{try{await mr.put(`/bi-dashboard/${n.value}/${i.widgetName}`,{data:o.value});let ne=`/bi-data?dashboard=${n.value}&widget=${i.widgetName}`;Object.entries(o.value).forEach(([fe,ye])=>{ne+=`&${fe}=${ye}`});const he=new CustomEvent(`update-data-${i.widgetName}`);he.filterUrl=ne,window.dispatchEvent(he),await t({type:"success",title:"Успішно!",message:"Дані успішно оновлено"})}catch{await t({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}},l=async()=>{try{let ne=`/bi-data?dashboard=${n.value}&widget=${i.widgetName}`;Object.entries(o.value).forEach(([fe,ye])=>{ne+=`&${fe}=${ye}`});const he=new CustomEvent(`update-data-${i.widgetName}`);he.filterUrl=ne,window.dispatchEvent(he)}catch{await t({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}};return N.watch(o,(ne,he)=>{var Me,Ce;const fe=(Me=Object.entries(ne))==null?void 0:Me.reduce((Oe,[Ue,We])=>We?Oe+We:Oe),ye=(Ce=Object.entries(he))==null?void 0:Ce.reduce((Oe,[Ue,We])=>We?Oe+We:Oe);fe!==ye&&l()},{deep:!0}),N.onMounted(()=>{const ne=new URLSearchParams(window.top.location.search);n.value=ne.get("dashboard")}),(ne,he)=>{const fe=N.resolveComponent("VsButton"),ye=N.resolveComponent("VsForm");return N.openBlock(),N.createElementBlock("div",xce,[N.createVNode(fe,{class:"ml-[10px] mb-[10px]",type:"plain",onClick:s},{default:N.withCtx(()=>he[1]||(he[1]=[N.createTextVNode(" Зберегти ")])),_:1}),N.createVNode(ye,{scheme:a,modelValue:o.value,"onUpdate:modelValue":he[0]||(he[0]=Me=>o.value=Me)},null,8,["modelValue"])])}}},wce={class:"pt-[10px]"},Sce={__name:"vs-editor-form-yaml",props:{yamlValue:{type:null,default:()=>""},widgetName:{type:String},data:{type:Object}},setup(r){const e=N.ref(null),{$notify:t}=N.getCurrentInstance().proxy,i=r,n=(l,{dimensions:h,source:f})=>{const d=l.getOption();(d==null?void 0:d.series)[0];const[,...v]=h||[],m=v.map((_,b)=>({...(d==null?void 0:d.series[b])||{},data:f.map(S=>S[b+1]),name:_}));l==null||l.setOption({...d||{},dataset:{dimensions:h,source:f},series:m,xAxis:{type:"category"},yAxis:{}},!0)},a=l=>{const h=document.getElementById(l);if(!h)return null;const f=sS(h);return f||null},o=N.ref(i.yamlValue),s=async()=>{try{await mr.put(`/bi-dashboard/${e.value}/${i.widgetName}`,{yml:o.value});const l=a(i.widgetName);if(l){const{data:h}=await mr.get(`/bi-data?dashboard=${e.value}&widget=${i.widgetName}`);n(l,h)}await t({type:"success",title:"Успішно!",message:"Дані успішно оновлено"})}catch{await t({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}};return N.onMounted(()=>{const l=new URLSearchParams(window.top.location.search);e.value=l.get("dashboard")}),(l,h)=>{const f=N.resolveComponent("VsButton"),d=N.resolveComponent("VsFormAce");return N.openBlock(),N.createElementBlock("div",wce,[N.createVNode(f,{class:"ml-[10px] mb-[10px]",type:"plain",onClick:s},{default:N.withCtx(()=>h[1]||(h[1]=[N.createTextVNode(" Зберегти ")])),_:1}),N.createVNode(d,{modelValue:o.value,"onUpdate:modelValue":h[0]||(h[0]=v=>o.value=v),value:o.value,fontSize:"12px"},null,8,["modelValue","value"])])}}},Tce={class:"pt-[10px]"},cF={"vs-editor-form-style":_ce,"vs-editor-form-data":bce,"vs-editor-form-yaml":Sce,"vs-editor-form-controls":{__name:"vs-editor-form-controls",props:{widgetName:{type:String},controls:{type:Object,default:()=>{}},columns:{type:Array,default:()=>[]}},emits:["update-dashboard"],setup(r,{emit:e}){var h;const{$notify:t}=N.getCurrentInstance().proxy,i=e,n=r,a=N.ref(null),o={granularity:{ua:"Granularity",type:"checkbox",options:["week","month","quarter","year"]},export:{ua:"Export",type:"Switcher"},groupby:{ua:"Groupby",type:"checkbox",options:(h=n.columns)==null?void 0:h.map(({name:f})=>f)}},s=N.ref(n.controls||{}),l=async()=>{try{await mr.put(`/bi-dashboard/${a.value}/${n.widgetName}`,{controls:s.value}),await t({type:"success",title:"Успішно!",message:"Дані успішно оновлено"}),staticTypes!=null&&staticTypes.includes(s.value.type)&&i("update-dashboard")}catch{await t({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}};return N.onMounted(()=>{const f=new URLSearchParams(window.top.location.search);a.value=f.get("dashboard")}),(f,d)=>{const v=N.resolveComponent("VsButton"),m=N.resolveComponent("VsForm");return N.openBlock(),N.createElementBlock("div",Tce,[N.createVNode(v,{class:"ml-[10px] mb-[10px]",type:"plain",onClick:l},{default:N.withCtx(()=>d[1]||(d[1]=[N.createTextVNode(" Зберегти ")])),_:1}),N.createVNode(m,{scheme:o,modelValue:s.value,"onUpdate:modelValue":d[0]||(d[0]=_=>s.value=_)},null,8,["modelValue"])])}}}},Cce={class:"h-full flex flex-col bg-white shrink-0 !w-[400px] border-l"},Dce={key:0},Ace={class:"border-b flex items-center px-[10px] h-[49px] border-transparent border-solid border-b-gray-200"},Ice={class:"flex gap-2 ml-auto"},Ece={class:"h-[calc(100vh-110px)] overflow-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},Mce={key:0},kce={key:1},Pce={class:"p-4"},Lce={class:"flex justify-end mt-4 gap-x-3"},Rce={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},zce={__name:"vs-editor-forms",props:N.mergeModels({selectedWidgetData:{type:Object,required:!1,default:null},selectedDashboard:{type:String,default:()=>""},currentWidgetData:{type:String,default:()=>""}},{selectedWidget:{},selectedWidgetModifiers:{}}),emits:N.mergeModels(["update-data"],["update:selectedWidget"]),setup(r,{emit:e}){var D,k;const t=(k=(D=N.getCurrentInstance())==null?void 0:D.proxy)==null?void 0:k.$notify,i=e,n=r,a=N.ref(!1),o=N.ref(!0),s=N.ref(!1),l=N.ref({}),h=N.useModel(r,"selectedWidget"),f=["table","text","number","stat","progress","listbar","map","pivot"],d=N.ref("data"),v=async()=>{try{await mr.delete(`/bi-dashboard/${n.selectedDashboard}/${n.selectedWidgetData.name}`);const P=new URL(window.top.location.href);P.searchParams.set("dashboard",n.selectedDashboard),P.searchParams.delete("widget"),window.top.history.pushState({},"",P),i("update-data"),a.value=!1,t({type:"success",title:"Успішно!",message:"Віджет успішно видалено"})}catch(P){console.error(P),t({type:"error",title:"Помилка!",message:"При спробі видалити віджет виникла помилка"})}},m=N.computed(()=>{const P=[{id:"data",label:"Дані"},{id:"style",label:"Стилі"},{id:"yaml",label:"{ }"},{id:"controls",label:"Контролси"}];return P==null?void 0:P.filter(z=>{var F,V,U;return z.id==="style"?!(f!=null&&f.includes(((F=n.selectedWidgetData)==null?void 0:F.type)||((U=(V=n.selectedWidgetData)==null?void 0:V.data)==null?void 0:U.type))):!0})}),_=()=>{var P,z,F;l.value={title:(P=n.selectedWidgetData)==null?void 0:P.title,type:(z=n.selectedWidgetData)==null?void 0:z.type,table:(F=n.selectedWidgetData)==null?void 0:F.table_name},s.value=!0},b=async()=>{try{await mr.put(`/bi-dashboard/${n.selectedDashboard}/${n.selectedWidgetData.name}`,l.value),t({type:"success",title:"Успішно!",message:"Дані успішно змінено"}),await i("update-data"),s.value=!1}catch{t({type:"error",title:"Помилка!",message:"При спробі внести зміни виникла помилка"})}};N.watch(h,P=>{o.value=!1;const z=new URL(window.top.location.href);P?(z.searchParams.set("widget",P),window.top.history.pushState({},"",z)):(z.searchParams.delete("widget"),window.top.history.pushState({},"",z)),setTimeout(()=>o.value=!0)});const S={title:{type:"text",ua:"Заголовок",placeholder:"Заголовок",validators:["required"]},type:{type:"radio",view:"buttons",validators:["required"],slots:{label:'<div style="width: 120px; height:160px" class="flex gap-[12px] flex-col"><img class="block" style="height: calc(100% - 40px)" :src="`https://cdn.softpro.ua/data/icons/bi/${id}.png`"/><span class="font-[500]">{{ label }}</span></div>'},options:[{label:"Bar",id:"bar"},{label:"Funnel",id:"funnel"},{label:"Line",id:"line"},{label:"List bar",id:"listbar"},{label:"Number",id:"number"},{label:"Pie",id:"pie"},{label:"Donut",id:"donut"},{label:"Pivot",id:"pivot"},{label:"Table",id:"table"},{label:"Progress",id:"progress"},{label:"Stat",id:"stat"},{label:"Text",id:"text"},{label:"Map",id:"map"}]},table:{type:"text",ua:"Таблиця",placeholder:"Таблиця"}};return(P,z)=>{var K,Q,oe,ne,he,fe,ye,Me;const F=N.resolveComponent("VsFormRadio"),V=N.resolveComponent("VsPopover"),U=N.resolveComponent("VsConfirm"),Z=N.resolveComponent("VsForm"),j=N.resolveComponent("VsDialog");return N.openBlock(),N.createElementBlock(N.Fragment,null,[N.createElementVNode("div",Cce,[r.selectedWidgetData?(N.openBlock(),N.createElementBlock("div",Dce,[N.createElementVNode("div",Ace,[o.value?(N.openBlock(),N.createBlock(F,{key:0,options:m.value,modelValue:d.value,"onUpdate:modelValue":z[0]||(z[0]=Ce=>d.value=Ce),view:"buttons"},null,8,["options","modelValue"])):(N.openBlock(),N.createBlock(F,{key:1,options:m.value,modelValue:d.value,"onUpdate:modelValue":z[1]||(z[1]=Ce=>d.value=Ce),view:"buttons"},null,8,["options","modelValue"])),N.createElementVNode("div",Ice,[N.createVNode(V,{placement:"left",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{onClick:_,class:"h-[30px] w-[30px] rounded-full bg-gray-100 flex items-center justify-center duration-300 hover:bg-gray-200"},[N.createVNode(uF,{class:"h-[16px]"})])]),default:N.withCtx(()=>[z[10]||(z[10]=N.createTextVNode(" Редагувати віджет "))]),_:1}),N.createVNode(V,{placement:"left",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{class:"h-[30px] w-[30px] rounded-full bg-gray-100 flex items-center justify-center duration-300 hover:bg-gray-200",onClick:z[2]||(z[2]=Ce=>a.value=!0)},[N.createVNode(N.unref(sF),{class:"h-[16px]"})])]),default:N.withCtx(()=>[z[11]||(z[11]=N.createTextVNode(" Видалити віджет "))]),_:1})])]),N.createElementVNode("div",Ece,[o.value&&r.currentWidgetData?(N.openBlock(),N.createElementBlock("div",Mce,[(N.openBlock(),N.createBlock(N.resolveDynamicComponent(N.unref(cF)["vs-editor-form-"+d.value]),{widgetName:(K=r.selectedWidgetData)==null?void 0:K.name,yamlValue:((Q=r.selectedWidgetData)==null?void 0:Q.yml)||"",data:r.selectedWidgetData,controls:(oe=r.selectedWidgetData)==null?void 0:oe.controls,columns:(ne=r.currentWidgetData)==null?void 0:ne.columns,onUpdateDashboard:z[3]||(z[3]=Ce=>P.$emit("update-dashboard"))},null,40,["widgetName","yamlValue","data","controls","columns"]))])):(N.openBlock(),N.createElementBlock("div",kce,[(N.openBlock(),N.createBlock(N.resolveDynamicComponent(N.unref(cF)["vs-editor-form-"+d.value]),{widgetName:(he=r.selectedWidgetData)==null?void 0:he.name,yamlValue:((fe=r.selectedWidgetData)==null?void 0:fe.yml)||"",data:r.selectedWidgetData,controls:(ye=r.selectedWidgetData)==null?void 0:ye.controls,columns:(Me=r.currentWidgetData)==null?void 0:Me.columns,onUpdateDashboard:z[4]||(z[4]=Ce=>P.$emit("update-dashboard"))},null,40,["widgetName","yamlValue","data","controls","columns"]))])),N.createVNode(U,{visible:a.value,"onUpdate:visible":z[6]||(z[6]=Ce=>a.value=Ce),title:"Ви впевнені?"},{default:N.withCtx(()=>[N.createElementVNode("div",Pce,[z[12]||(z[12]=N.createElementVNode("p",{class:"mt-1 text-gray-500 dark:text-neutral-500"}," Ви впевнені, що хочете видалити цей віджет? ",-1)),N.createElementVNode("div",Lce,[N.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-200 rounded-lg shadow-sm gap-x-2 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:z[5]||(z[5]=Ce=>a.value=!1)}," Скасувати "),N.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-semibold text-white bg-red-500 border border-transparent rounded-lg gap-x-2 hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:v}," Так, я впевнена(ий) ")])])]),_:1},8,["visible"])])])):(N.openBlock(),N.createBlock(jC,{key:1,title:"Оберіть один з віджетів",text:""}))]),N.createVNode(j,{visible:s.value,"onUpdate:visible":z[9]||(z[9]=Ce=>s.value=Ce),title:"Редагувати віджет"},{footer:N.withCtx(()=>[N.createElementVNode("div",Rce,[N.createElementVNode("button",{style:{border:"1px solid #000"},onClick:z[8]||(z[8]=Ce=>s.value=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),N.createElementVNode("button",{onClick:b,class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:N.withCtx(()=>[N.createVNode(Z,{scheme:S,modelValue:l.value,"onUpdate:modelValue":z[7]||(z[7]=Ce=>l.value=Ce)},null,8,["modelValue"])]),_:1},8,["visible"])],64)}}},Nce={},Oce={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-plus"};function Bce(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("svg",Oce,e[0]||(e[0]=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M12 5l0 14"},null,-1),N.createElementVNode("path",{d:"M5 12l14 0"},null,-1)]))}const Vce=dr(Nce,[["render",Bce]]),Fce={class:"mb-4 overflow-auto scrollbar max-h-96"},$ce={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},Gce={__name:"vs-editor-create-widget",props:{columns:{type:Array,default:()=>[]},selectedDashboard:String},emits:"update-data",setup(r,{emit:e}){var f;const t=(f=N.getCurrentInstance().proxy)==null?void 0:f.$notify,i=e,n=r,a=N.ref(!1),o=N.ref({}),s=N.ref(),l=async()=>{try{await s.value.doValidation(),await mr.post(`/bi-dashboard/${n.selectedDashboard}`,o.value),await t({type:"success",title:"Успішно!",message:"Віджет успішно створено"}),await i("update-data"),o.value={},a.value=!1}catch{t({type:"error",title:"Помилка!",message:"При спробі створити віджет сталася помилка"})}},h=N.computed(()=>{var d,v,m,_;return{title:{type:"text",label:"Widget title",placeholder:"Widget title",validators:["required"]},x:{type:"radio",label:"X Axis",view:"buttons",style:{size:"xs"},validators:["required"],options:(v=(d=n.columns)==null?void 0:d.filter(b=>(b==null?void 0:b.type)=="text"||(b==null?void 0:b.type)==="date"||(b==null?void 0:b.type)==="timestamp without time zone"||(b==null?void 0:b.type)==="boolean"||(b==null?void 0:b.type)==="integer"))==null?void 0:v.map(({name:b,type:S})=>({id:b,label:b,type:S}))},metric:{type:"radio",label:"Y Axis",view:"buttons",validators:["required"],style:{size:"xs"},options:[{id:"count",label:"count"},...(_=(m=n.columns)==null?void 0:m.filter(b=>(b==null?void 0:b.type)==="numeric"||(b==null?void 0:b.type)==="double precision"))==null?void 0:_.map(({name:b,type:S})=>({id:b,label:b,type:S}))]},col:{type:"radio",label:"Columns count",validators:["required"],options:[{id:1,label:1},{id:2,label:2},{id:3,label:3},{id:4,label:4},{id:6,label:6},{id:9,label:9},{id:12,label:12}]},type:{type:"radio",view:"buttons",validators:["required"],slots:{label:'<div style="width: 120px; height:160px" class="flex gap-[12px] flex-col"><img class="block" style="height: calc(100% - 40px)" :src="`https://cdn.softpro.ua/data/icons/bi/${id}.png`"/><span class="font-[500]">{{ label }}</span></div>'},options:[{label:"Bar",id:"bar"},{label:"Funnel",id:"funnel"},{label:"Line",id:"line"},{label:"List bar",id:"listbar"},{label:"Number",id:"number"},{label:"Pie",id:"pie"},{label:"Donut",id:"donut"},{label:"Pivot",id:"pivot"},{label:"Table",id:"table"},{label:"Progress",id:"progress"},{label:"Stat",id:"stat"},{label:"Text",id:"text"},{label:"Map",id:"map"}]}}});return(d,v)=>{const m=N.resolveComponent("VsPopover"),_=N.resolveComponent("VsForm"),b=N.resolveComponent("VsDialog");return N.openBlock(),N.createElementBlock("div",null,[N.createVNode(m,{placement:"right",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("div",null,[N.createElementVNode("button",{class:"z-50 flex items-center justify-center h-[50px] !w-[50px] text-2xl text-white transition-colors bg-blue-500 rounded-full cursor-pointer hover:bg-blue-700",onClick:v[0]||(v[0]=S=>a.value=!0)},[N.createVNode(Vce,{height:"20",width:"20"})])])]),default:N.withCtx(()=>[v[4]||(v[4]=N.createTextVNode(" Створити віджет "))]),_:1}),N.createVNode(b,{visible:a.value,"onUpdate:visible":v[3]||(v[3]=S=>a.value=S),title:"Створити віджет"},{footer:N.withCtx(()=>[N.createElementVNode("div",$ce,[N.createElementVNode("button",{style:{border:"1px solid #000"},onClick:v[2]||(v[2]=S=>a.value=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),N.createElementVNode("button",{onClick:l,class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Створити ")])]),default:N.withCtx(()=>[N.createElementVNode("div",Fce,[N.createVNode(_,{ref_key:"form",ref:s,scheme:h.value,modelValue:o.value,"onUpdate:modelValue":v[1]||(v[1]=S=>o.value=S)},null,8,["scheme","modelValue"])])]),_:1},8,["visible"])])}}},Uce={},Hce={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-box-left-stretch"};function Wce(r,e){return N.openBlock(),N.createElementBlock("svg",Hce,e[0]||(e[0]=[N.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z"></path><path d="M9 17h-2"></path><path d="M13 12h-6"></path><path d="M11 7h-4"></path>',5)]))}const Zce=dr(Uce,[["render",Wce]]),jce={},qce={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-filter"};function Xce(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("svg",qce,e[0]||(e[0]=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227z"},null,-1)]))}const Yce={components:{deleteIcon:sF,editIcon:uF,IconGrid:Zce,IconFilter:dr(jce,[["render",Xce]])},watch:{dashboardData(r){var t,i;if(this.formEditValue={title:r==null?void 0:r.title,description:r==null?void 0:r.description,table_name:r==null?void 0:r.table_name,db:r==null?void 0:r.db,public:r==null?void 0:r.public,words:r==null?void 0:r.words},!((t=r==null?void 0:r.panels)!=null&&t.length))return[];const e=(i=r==null?void 0:r.panels)==null?void 0:i.map(n=>{var s,l;const{title:a="",type:o=""}=((l=(s=r==null?void 0:r.widgets)==null?void 0:s.find(h=>(h==null?void 0:h.name)===(n==null?void 0:n.widget)))==null?void 0:l.data)||{};return{title:a,type:o,...n}});this.formGridValue={panels:e},this.formFilterValue={filters:(r==null?void 0:r.filters)||null}}},data(){return{isDeleteConfirm:!1,isFormEdit:!1,isFormGrid:!1,isFormFilter:!1,formEditValue:{},formGridValue:{},formFilterValue:{},editDashboardScheme:[{type:"Text",key:"title",label:"Заголовок",validators:["required"]},{type:"Text",key:"description",label:"Опис"},{type:"Text",key:"table_name",validators:["required"],label:"Назва таблиці"},{type:"Text",key:"words",label:"Ключові слова"},{type:"Text",key:"db",label:"База даних",original:{type:"Text",ua:"Назва",col:8}},{type:"Switcher",key:"public",label:"Публічний",original:{type:"Text",ua:"Назва",col:8}}],editGridScheme:[{type:"DataTable",ua:"Панелі",key:"panels",editable:!1,addition:!1,colModel:[{name:"title",ua:"Назва",type:"Text",key:"col"},{name:"type",ua:"Тип",type:"Text",key:"col",disabled:!0},{name:"widget",type:"Text",ua:"Назва",key:"widget",hiddenCol:!0},{name:"col",ua:"Кількість стовпчиків",type:"Text",key:"col"}]}],editFilterScheme:[{name:"filters",type:"DataTable",colModel:[{ua:"Підпис",type:"Text",key:"label"},{ua:"Тип",type:"Text",key:"type"}]}]}},props:{selected:{type:String,default:()=>""},dashboardData:{type:Object,default:()=>{}},selectedWidgetData:{type:Object,default:()=>{}}},methods:{async editDashboard(){var r,e;try{(e=(r=this.$refs)==null?void 0:r.formEdit)==null||e.doValidation(),await mr.put(`/bi-dashboard/${this.selected}`,this.formEditValue),await this.$notify({title:"Успішно!",type:"success",message:"Дані успішно оновлено"}),this.isFormEdit=!1,await this.$emit("update-editor")}catch{this.$notify({title:"Помилка!",type:"error",message:"при спробі оновити дані виникла помилка"})}},async editDashboardGrid(){var r,e;try{(e=(r=this.$refs)==null?void 0:r.formGrid)==null||e.doValidation(),await mr.put(`/bi-dashboard/${this.selected}`,{...this.formEditValue,...this.formGridValue}),await this.$notify({title:"Успішно!",type:"success",message:"Дані успішно оновлено"}),this.isFormGrid=!1,await this.$emit("update-editor")}catch{this.$notify({title:"Помилка!",type:"error",message:"При спробі оновити дані виникла помилка"})}},async editDashboardFilters(){var r,e;try{(e=(r=this.$refs)==null?void 0:r.formFilter)==null||e.doValidation(),await mr.put(`/bi-dashboard/${this.selected}`,{...this.formEditValue,...this.formGridValue,...this.formFilterValue}),await this.$notify({title:"Успішно!",type:"success",message:"Дані успішно оновлено"}),this.isFormFilter=!1,await this.$emit("update-editor")}catch{this.$notify({title:"Помилка!",type:"error",message:"При спробі оновити дані виникла помилка"})}},async deleteDashboard(){try{await mr.delete(`/bi-dashboard/${this.selected}`);const r=new URL(window.top.location.href);r.searchParams.delete("dashboard"),r.searchParams.delete("widget"),window.history.pushState({},"",r),await this.$notify({title:"Успішно!",type:"success",message:"Дашборд видалено успішно"}),this.isDeleteConfirm=!1,await this.$emit("update:selected",null),await this.$emit("update-editor")}catch{this.$notify({title:"Помилка!",type:"error",message:"При спробі видалити дашборд виникла помилка"})}}}},Kce={class:"bg-white h-[49px] min-h-[49px] mb-[8px] flex justify-between px-[10px] py-[15px] items-center border-b border-b-solid border-b-gray-200"},Jce={class:"flex items-center gap-2 text-center truncate grow lg:text-start"},Qce={class:"block text-sm font-semibold leading-4 text-gray-800 truncate"},ehe={class:"text-[12px] text-gray-500"},the={key:0,class:"flex"},rhe={class:"pr-[5px] flex items-center gap-[8px] mr-[5px] flex"},ihe={class:"p-4"},nhe={class:"flex justify-end mt-4 gap-x-3"},ahe={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},ohe={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},she={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"};function lhe(r,e,t,i,n,a){var _,b,S,D,k;const o=N.resolveComponent("IconFilter"),s=N.resolveComponent("VsPopover"),l=N.resolveComponent("IconGrid"),h=N.resolveComponent("editIcon"),f=N.resolveComponent("deleteIcon"),d=N.resolveComponent("VsConfirm"),v=N.resolveComponent("VsForm"),m=N.resolveComponent("VsDialog");return N.openBlock(),N.createElementBlock(N.Fragment,null,[N.createElementVNode("div",Kce,[N.createElementVNode("div",null,[N.createElementVNode("div",Jce,[N.createElementVNode("span",Qce,N.toDisplayString((_=t.dashboardData)==null?void 0:_.title)+" "+N.toDisplayString((b=t.selectedWidgetData)!=null&&b.title?` / ${(S=t.selectedWidgetData)==null?void 0:S.title}`:""),1),N.createElementVNode("span",ehe,N.toDisplayString((D=t.selectedWidgetData)!=null&&D.table_name?`${(k=t.selectedWidgetData)==null?void 0:k.table_name}`:""),1)])]),t.selected?(N.openBlock(),N.createElementBlock("div",the,[N.createElementVNode("div",rhe,[N.createVNode(s,{placement:"left",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{class:"h-[30px] w-[30px] rounded-full bg-gray-100 flex items-center justify-center duration-300 hover:bg-gray-200",onClick:e[0]||(e[0]=P=>n.isFormFilter=!0)},[N.createVNode(o,{class:"h-[16px] text-gray-500"})])]),default:N.withCtx(()=>[e[19]||(e[19]=N.createTextVNode(" Редагувати фільтри "))]),_:1}),N.createVNode(s,{placement:"left",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{class:"h-[30px] w-[30px] rounded-full bg-gray-100 flex items-center justify-center duration-300 hover:bg-gray-200",onClick:e[1]||(e[1]=P=>n.isFormGrid=!0)},[N.createVNode(l,{class:"h-[16px] text-gray-500"})])]),default:N.withCtx(()=>[e[20]||(e[20]=N.createTextVNode(" Редагувати структуру дашборду "))]),_:1}),N.createVNode(s,{placement:"left",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{class:"h-[30px] w-[30px] rounded-full bg-gray-100 flex items-center justify-center duration-300 hover:bg-gray-200",onClick:e[2]||(e[2]=P=>n.isFormEdit=!0)},[N.createVNode(h,{class:"h-[16px]"})])]),default:N.withCtx(()=>[e[21]||(e[21]=N.createTextVNode(" Редагувати дашборд "))]),_:1}),N.createVNode(s,{placement:"right",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{onClick:e[3]||(e[3]=P=>n.isDeleteConfirm=!0),class:"h-[30px] w-[30px] rounded-full bg-gray-100 flex items-center justify-center duration-300 hover:bg-gray-200"},[N.createVNode(f,{class:"h-[16px]"})])]),default:N.withCtx(()=>[e[22]||(e[22]=N.createTextVNode(" Видалити дашборд "))]),_:1})])])):N.createCommentVNode("",!0)]),N.createVNode(d,{visible:n.isDeleteConfirm,"onUpdate:visible":e[6]||(e[6]=P=>n.isDeleteConfirm=P),size:"small",title:"Ви впевнені?"},{default:N.withCtx(()=>[N.createElementVNode("div",ihe,[e[23]||(e[23]=N.createElementVNode("p",{class:"mt-1 text-gray-500 dark:text-neutral-500"}," Ви впевнені, що хочете видалити цей дашборд? ",-1)),N.createElementVNode("div",nhe,[N.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-200 rounded-lg shadow-sm gap-x-2 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[4]||(e[4]=P=>n.isDeleteConfirm=!1)}," Скасувати "),N.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-semibold text-white bg-red-500 border border-transparent rounded-lg gap-x-2 hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:e[5]||(e[5]=(...P)=>a.deleteDashboard&&a.deleteDashboard(...P))}," Так, я впевнена(ий) ")])])]),_:1},8,["visible"]),N.createVNode(m,{visible:n.isFormEdit,"onUpdate:visible":e[10]||(e[10]=P=>n.isFormEdit=P),title:"Редагувати дашборд"},{footer:N.withCtx(()=>[N.createElementVNode("div",ahe,[N.createElementVNode("button",{style:{border:"1px solid #000"},onClick:e[8]||(e[8]=P=>n.isFormEdit=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),N.createElementVNode("button",{onClick:e[9]||(e[9]=(...P)=>a.editDashboard&&a.editDashboard(...P)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:N.withCtx(()=>[N.createVNode(v,{ref:"formEdit",scheme:n.editDashboardScheme,modelValue:n.formEditValue,"onUpdate:modelValue":e[7]||(e[7]=P=>n.formEditValue=P)},null,8,["scheme","modelValue"])]),_:1},8,["visible"]),N.createVNode(m,{visible:n.isFormGrid,"onUpdate:visible":e[14]||(e[14]=P=>n.isFormGrid=P),title:"Редагувати структуру дашборду"},{footer:N.withCtx(()=>[N.createElementVNode("div",ohe,[N.createElementVNode("button",{style:{border:"1px solid #000"},onClick:e[12]||(e[12]=P=>n.isFormGrid=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),N.createElementVNode("button",{onClick:e[13]||(e[13]=(...P)=>a.editDashboardGrid&&a.editDashboardGrid(...P)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:N.withCtx(()=>[N.createVNode(v,{ref:"formgrid",scheme:n.editGridScheme,modelValue:n.formGridValue,"onUpdate:modelValue":e[11]||(e[11]=P=>n.formGridValue=P)},null,8,["scheme","modelValue"])]),_:1},8,["visible"]),N.createVNode(m,{visible:n.isFormFilter,"onUpdate:visible":e[18]||(e[18]=P=>n.isFormFilter=P),title:"Редагувати фільтри"},{footer:N.withCtx(()=>[N.createElementVNode("div",she,[N.createElementVNode("button",{style:{border:"1px solid #000"},onClick:e[16]||(e[16]=P=>n.isFormFilter=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),N.createElementVNode("button",{onClick:e[17]||(e[17]=(...P)=>a.editDashboardFilters&&a.editDashboardFilters(...P)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:N.withCtx(()=>[N.createVNode(v,{ref:"formFilter",scheme:n.editFilterScheme,modelValue:n.formFilterValue,"onUpdate:modelValue":e[15]||(e[15]=P=>n.formFilterValue=P)},null,8,["scheme","modelValue"])]),_:1},8,["visible"])],64)}const uhe=dr(Yce,[["render",lhe]]),che={class:"relative flex-grow h-full"},hhe={class:"grid flex-grow w-full grid-cols-12 gap-4 p-[10px] h-[calc(100%-120px)] overflow-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},fhe=dr({__name:"vs-editor",props:{prefix:String,customClass:{type:String,default:()=>"w-screen h-screen"}},setup(r){const e=r;mr.defaults.baseURL=e.prefix||"/api";const t=N.ref(""),i=N.ref(""),n=N.ref(null),a=N.ref(null),o=async()=>{if(!t.value){n.value=null;return}try{const{data:l}=await mr.get(`/bi-dashboard/${t.value}`);n.value=l}catch(l){console.error(l)}},s=N.computed(()=>{var l,h,f;return(f=Array.isArray((l=n.value)==null?void 0:l.widgets)?(h=n.value)==null?void 0:h.widgets:[])==null?void 0:f.find(d=>(d==null?void 0:d.name)===i.value)});return N.watch(t,(l,h)=>{var d,v,m;h&&(i.value="");const f=new URL(window.top.location.href);l?((d=f==null?void 0:f.searchParams)==null||d.set("dashboard",l),(m=(v=window.top)==null?void 0:v.history)==null||m.pushState({},"",f),o()):(f==null||f.searchParams.delete("dashboard"),f==null||f.searchParams.delete("widget"))}),N.onMounted(()=>{const l=new URLSearchParams(window.top.location.search);t.value=l.get("dashboard"),i.value=l.get("widget"),o()}),(l,h)=>{var f;return N.openBlock(),N.createElementBlock("div",{class:N.normalizeClass(["flex w-full h-full",[r.customClass]])},[N.createVNode(lce,{ref:"MenuNativeRouting",prefix:r.prefix,selectedDashboard:t.value,"onUpdate:selectedDashboard":h[0]||(h[0]=d=>t.value=d)},null,8,["prefix","selectedDashboard"]),N.createElementVNode("div",che,[N.createVNode(uhe,{selected:t.value,"onUpdate:selected":h[1]||(h[1]=d=>t.value=d),dashboardData:n.value,selectedWidgetData:s.value,prefix:r.prefix,onUpdateEditor:h[2]||(h[2]=()=>{var d;o(),(d=l.$refs.MenuNativeRouting)==null||d.getList()})},null,8,["selected","dashboardData","selectedWidgetData","prefix"]),N.createElementVNode("div",hhe,[n.value?(N.openBlock(!0),N.createElementBlock(N.Fragment,{key:1},N.renderList(n.value.panels,(d,v)=>{var m;return N.openBlock(),N.createElementBlock("div",{key:v,class:N.normalizeClass([`col-span-${d.col||12}`,"flex flex-col gap-[10px]"])},[(m=d.widgets)!=null&&m.length?(N.openBlock(!0),N.createElementBlock(N.Fragment,{key:0},N.renderList(d.widgets,_=>(N.openBlock(),N.createBlock(qv,{onClick:b=>i.value=_,"onUpdate:currentWidgetData":h[3]||(h[3]=b=>a.value=b),key:_,dashboard:t.value,widget:_,selectedWidget:i.value,"dashboard-widgets":n.value.widgets,class:N.normalizeClass({"border border-blue-500":i.value===_})},null,8,["onClick","dashboard","widget","selectedWidget","dashboard-widgets","class"]))),128)):(N.openBlock(),N.createBlock(qv,{key:1,onClick:_=>i.value=d.widget,"onUpdate:currentWidgetData":h[4]||(h[4]=_=>a.value=_),class:N.normalizeClass(["max-h-[460px] flex flex-col",{"border border-blue-500":i.value===d.widget}]),dashboard:t.value,widget:d.widget,selectedWidget:i.value,"dashboard-widgets":n.value.widgets},null,8,["onClick","class","dashboard","widget","selectedWidget","dashboard-widgets"]))],2)}),128)):(N.openBlock(),N.createBlock(jC,{key:0,class:"col-span-12"}))]),t.value?(N.openBlock(),N.createBlock(Gce,{key:0,class:"bottom-[10px] left-[10px] absolute",columns:(f=n.value)==null?void 0:f.columns,selectedDashboard:t.value,onUpdateData:o},null,8,["columns","selectedDashboard"])):N.createCommentVNode("",!0)]),N.createVNode(zce,{selectedWidget:i.value,"onUpdate:selectedWidget":h[5]||(h[5]=d=>i.value=d),selectedWidgetData:s.value,currentWidgetData:a.value,selectedDashboard:t.value,onUpdateData:o},null,8,["selectedWidget","selectedWidgetData","currentWidgetData","selectedDashboard"])],2)}}},[["__scopeId","data-v-63d54538"]]),hF={install:r=>{r.component("VsBar",FC),r.component("VsLine",GC),r.component("VsPie",$C),r.component("VsStat",UC),r.component("VsDashboard",oF),r.component("VsWidget",qv),r.component("VsProgressBar",HC),r.component("VsListBar",WC),r.component("VsPivotTable",qC),r.component("VsEditor",fhe)},components:{VsBar:FC,VsLine:GC,VsPie:$C,VsStat:UC,VsDashboard:oF,VsProgressBar:HC,VsListBar:WC,VsPivotTable:qC,VsWidget:qv}};typeof window<"u"&&(window.v3bi=hF);const dhe={name:"VsNumber",mixins:[da],data(){return{number:""}},computed:{formattedNumber(){return y6(this.number)},prefix(){var r,e;return(r=this.styleData)!=null&&r.prefix?(e=this.styleData)==null?void 0:e.prefix:""}},watch:{sourceData:{async handler(){this.getNumber()},deep:!0}},async mounted(){await this.getData(),this.getNumber()},methods:{onChangedData(){try{this.sourceData&&this.getNumber()}catch(r){console.error(r)}},async getNumber(){var r,e;try{this.number=((e=this.sourceData[0])==null?void 0:e[Object.keys((r=this.sourceData)==null?void 0:r[0])])||0}catch(t){console.error(t)}}}},phe={class:"text-lg lg:text-xl xl:text-2xl text-gray-800 h-[32px] flex items-center"};function vhe(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",phe,N.toDisplayString(a.prefix)+N.toDisplayString(a.formattedNumber),1)}const ghe=Object.freeze(Object.defineProperty({__proto__:null,default:dr(dhe,[["render",vhe]])},Symbol.toStringTag,{value:"Module"}));function XC(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let nh=XC();function fF(r){nh=r}const dF=/[&<>"']/,mhe=new RegExp(dF.source,"g"),pF=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,yhe=new RegExp(pF.source,"g"),_he={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},vF=r=>_he[r];function ka(r,e){if(e){if(dF.test(r))return r.replace(mhe,vF)}else if(pF.test(r))return r.replace(yhe,vF);return r}const xhe=/(^|[^\[])\^/g;function ri(r,e){let t=typeof r=="string"?r:r.source;e=e||"";const i={replace:(n,a)=>{let o=typeof a=="string"?a:a.source;return o=o.replace(xhe,"$1"),t=t.replace(n,o),i},getRegex:()=>new RegExp(t,e)};return i}function gF(r){try{r=encodeURI(r).replace(/%25/g,"%")}catch{return null}return r}const Xv={exec:()=>null};function mF(r,e){const t=r.replace(/\|/g,(a,o,s)=>{let l=!1,h=o;for(;--h>=0&&s[h]==="\\";)l=!l;return l?"|":" |"}),i=t.split(/ \|/);let n=0;if(i[0].trim()||i.shift(),i.length>0&&!i[i.length-1].trim()&&i.pop(),e)if(i.length>e)i.splice(e);else for(;i.length<e;)i.push("");for(;n<i.length;n++)i[n]=i[n].trim().replace(/\\\|/g,"|");return i}function Yv(r,e,t){const i=r.length;if(i===0)return"";let n=0;for(;n<i;){const a=r.charAt(i-n-1);if(a===e&&!t)n++;else if(a!==e&&t)n++;else break}return r.slice(0,i-n)}function bhe(r,e){if(r.indexOf(e[1])===-1)return-1;let t=0;for(let i=0;i<r.length;i++)if(r[i]==="\\")i++;else if(r[i]===e[0])t++;else if(r[i]===e[1]&&(t--,t<0))return i;return-1}function yF(r,e,t,i){const n=e.href,a=e.title?ka(e.title):null,o=r[1].replace(/\\([\[\]])/g,"$1");if(r[0].charAt(0)!=="!"){i.state.inLink=!0;const s={type:"link",raw:t,href:n,title:a,text:o,tokens:i.inlineTokens(o)};return i.state.inLink=!1,s}return{type:"image",raw:t,href:n,title:a,text:ka(o)}}function whe(r,e){const t=r.match(/^(\s+)(?:```)/);if(t===null)return e;const i=t[1];return e.split(`
100
+ </div>`},prepareData(){var r,e,t;try{const i=Array.from(new Set(this.sourceData.map(d=>d[this.dimensions[0]]))),n=Array.from(new Set(this.sourceData.map(d=>d[this.dimensions[1]]))),a=parseInt(this.sourceData.reduce((d,v)=>d+parseFloat(v==null?void 0:v.metric),0),10),o=i.map((d,v)=>{const m=(n[v]/a*100).toFixed(2);return{name:`${d} (${m}%)`,value:n[v]}}),s=((r=this.styleData)==null?void 0:r.innerRadius)||"0%",l=((e=this.styleData)==null?void 0:e.outerRadius)||"100%",h=[s,l];return this.styleData.legend=O0.getLegendOpions({borderRadius:10,height:"100%",padding:10,type:"scroll",itemWidth:14,itemHeight:14,formatter:d=>d==null?void 0:d.replace("null","Не визначено"),textStyle:{fontSize:"14px"},...this.styleData.legend}),this.styleData.label=O0.getLabelOptions(this.styleData.label),this.styleData.show_legend=((t=this.styleData)==null?void 0:t.show_legend)||!0,{series:[{name:this.titleCharts?this.titleCharts:this.dimensions[0],type:"pie",radius:h,center:["50%","60%"],height:"75%",...ih(this.styleData),data:o}]}}catch(i){return console.error(i),null}},async initChart(r){try{const e=this.$refs.chart;this.chartInstance=f_(e);const t={tooltip:{trigger:"item",formatter:i=>this.buildTooltipForDonut(i,[i.color]),borderWidth:0,appendToBody:!0,borderColor:"transparent",textStyle:{color:"#000"},padding:[15,15],shadowColor:"transparent",backgroundColor:"transparent"},series:r,...ih({...this.styleData})};this.chartInstance.setOption(t),this.$emit("update:currentWidget",this.chartInstance),this.chartInstance.resize(),window.addEventListener("resize",()=>{this.chartInstance.resize()})}catch(e){console.error(e)}}}},Pse=["id"];function Lse(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",{id:a.uniqueID,ref:"chart",class:"h-full min-h-[200px] flex items-center"},null,8,Pse)}const $C=dr(kse,[["render",Lse]]),Rse=Object.freeze(Object.defineProperty({__proto__:null,default:$C},Symbol.toStringTag,{value:"Module"})),zse={name:"VsLine",mixins:[da],data(){return{chartInstance:null,uniqueID:null}},async mounted(){this.uniqueID=this.widget,await this.$nextTick(),await this.getData();const{series:r,xs:e}=this.prepareData();r&&this.initChart(r,e)},methods:{onChangedData(){try{if(this.sourceData){const{series:r,xs:e,ys:t}=this.prepareData();r&&(this==null||this.initChart(r,e,t))}}catch(r){console.error(r)}},prepareData(){var r,e;try{const t=Array.from(new Set(this.sourceData.map(o=>o[this.dimensions[0]])));let i;this.dimensions[0].includes("date")?i=t.map(o=>Yo(o)):i=[...t];const n=this.sourceData.map(o=>parseFloat(o[this.dimensions[1]]));let a;return(r=this.styleData)!=null&&r.stack?a=this.dimensions.slice(1).map(s=>({name:s,type:"line",stack:"a",areaStyle:this.styleData.area?{}:null,data:this.sourceData.filter(l=>parseFloat(l[s])).map(l=>parseFloat(l[s]))})):a=[{name:this.title,type:"line",areaStyle:(e=this.styleData)!=null&&e.area?{}:null,data:n,stack:"a"}],{series:a,xs:i}}catch(t){return console.error(t),null}}}},Nse=["id"];function Ose(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",{id:n.uniqueID,ref:"chart",style:{height:"400px"}},null,8,Nse)}const GC=dr(zse,[["render",Ose]]),Bse=Object.freeze(Object.defineProperty({__proto__:null,default:GC},Symbol.toStringTag,{value:"Module"})),Vse={name:"VsStat",mixins:[da],data(){return{restDimensions:[],sumValue:0,columns:null,showTooltip:-1}},async mounted(){await this.getData(),this.prepareData()},methods:{onChangedData(){try{this.sourceData&&this.prepareData()}catch{}},prepareData(){this.columns=Object.keys(this.sourceData[0]);const r=this.getValues();this.sumValue=r.reduce((e,t)=>e+t,0),this.sourceData.forEach((e,t)=>{e.color=t<aF.length-1?aF[t]:Dse()})},formattedValue(r){const e=parseFloat(r);return gi(e)}}},Fse={class:"flex flex-col w-full h-full pt-[16px] rounded-xl"},$se={class:"flex flex-col justify-between w-full h-full"},Gse={class:"w-full h-full pb-6 space-y-4"},Use={class:"flex w-full h-3 rounded-full gap-x-1 min-h-3 custom-x-scrollbar"},Hse=["onMouseover"],Wse={key:0,class:"absolute top-[-1] left-1/2 transform -translate-x-1/2 -translate-y-full bg-black text-white rounded px-2 py-1"},Zse={class:"h-[calc(100%-20px)] w-full custom-scrollbar"},jse={class:"grid items-center justify-between grid-cols-2 py-2 gap-x-4"},qse={class:"flex items-center"},Xse={class:"text-sm text-gray-800"},Yse={class:"text-end"},Kse={class:"text-sm text-gray-500"};function Jse(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",Fse,[N.createElementVNode("div",$se,[N.createElementVNode("div",Gse,[N.createElementVNode("div",Use,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(r.sourceData,(o,s)=>{var l,h,f,d;return N.openBlock(),N.createElementBlock("div",{class:N.normalizeClass(["flex flex-col min-w-[5px] justify-center min-h-2.5 h-2.5 text-xs text-white text-center whitespace-nowrap",`bg-[${o.color}]`]),style:N.normalizeStyle({width:`${parseFloat(o==null?void 0:o[(l=n.columns)==null?void 0:l[1]])/n.sumValue*100}%`}),role:"progressbar","aria-valuenow":"42","aria-valuemin":"0","aria-valuemax":"100",onMouseover:v=>n.showTooltip=s,onMouseleave:e[0]||(e[0]=v=>n.showTooltip=-1)},[n.showTooltip>-1?(N.openBlock(),N.createElementBlock("div",Wse,N.toDisplayString(r.sourceData[n.showTooltip][n.columns[0]])+" "+N.toDisplayString((parseFloat((d=(h=r.sourceData)==null?void 0:h[n.showTooltip])==null?void 0:d[(f=n.columns)==null?void 0:f[1]])/n.sumValue*100).toFixed(2))+"% ",1)):N.createCommentVNode("",!0)],46,Hse)}),256))]),N.createElementVNode("ul",Zse,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(r.sourceData,o=>{var s,l;return N.openBlock(),N.createElementBlock("li",jse,[N.createElementVNode("div",qse,[N.createElementVNode("span",{class:N.normalizeClass(["shrink-0 size-2.5 inline-block rounded-sm me-2.5 min-w-[10px] w-[10px] h-[10px] min-h-[10px]",`bg-[${o.color}]`])},null,2),N.createElementVNode("span",Xse,N.toDisplayString((o==null?void 0:o[(s=n.columns)==null?void 0:s[0]])||"Не визначено"),1)]),N.createElementVNode("div",Yse,[N.createElementVNode("span",Kse,N.toDisplayString(a.formattedValue(o==null?void 0:o[(l=n.columns)==null?void 0:l[1]])||"-"),1)])])}),256))])])])])}const UC=dr(Vse,[["render",Jse]]),Qse=Object.freeze(Object.defineProperty({__proto__:null,default:UC},Symbol.toStringTag,{value:"Module"})),ele={name:"VsProgressBar",mixins:[da],data(){return{restDimensions:[],maxValue:0,columns:null}},async mounted(){await this.getData(),this.prepareData()},methods:{onChangedData(){try{this.sourceData&&this.prepareData()}catch{}},prepareData(){var e;this.columns=Object.keys((e=this.sourceData)==null?void 0:e[0])||null;const r=this.getValues();this.maxValue=Math.max(...r)},formattedValue(r){return gi(r)}}},tle={key:0,class:"flex flex-col h-full pt-[16px] rounded-xl"},rle={class:"h-full pt-0 pb-6 space-y-4"},ile={class:"h-full space-y-4 custom-scrollbar"},nle={class:"flex items-center justify-between mr-2 gap-x-2"},ale={class:"grid items-center w-full grid-cols-2 gap-x-2"},ole={class:"text-sm text-gray-800"},sle={class:"flex justify-end",role:"progressbar","aria-valuenow":"100","aria-valuemin":"0","aria-valuemax":"100"},lle={class:"min-w-[60px] text-end"},ule={class:"text-sm text-gray-500"};function cle(r,e,t,i,n,a){return n.columns?(N.openBlock(),N.createElementBlock("div",tle,[N.createElementVNode("div",rle,[N.createElementVNode("ul",ile,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(r.sourceData,(o,s)=>(N.openBlock(),N.createElementBlock("li",nle,[N.createElementVNode("div",ale,[N.createElementVNode("span",ole,N.toDisplayString(o[n.columns[0]]),1),N.createElementVNode("div",sle,[N.createElementVNode("div",{class:"h-1.5 flex flex-col justify-center overflow-hidden bg-indigo-500 rounded-full text-xs text-white text-center whitespace-nowrap",style:N.normalizeStyle({width:`${parseFloat(o[n.columns[1]])/n.maxValue*100}%`})},null,4)])]),N.createElementVNode("div",lle,[N.createElementVNode("span",ule,N.toDisplayString(a.formattedValue(o[n.columns[1]])),1)])]))),256))])])])):N.createCommentVNode("",!0)}const HC=dr(ele,[["render",cle]]),hle=Object.freeze(Object.defineProperty({__proto__:null,default:HC},Symbol.toStringTag,{value:"Module"})),fle={name:"VsListbar",mixins:[da],props:["source"],data(){return{restDimensions:[],maxValue:0,columns:null}},async mounted(){await this.getData(),this.prepareData()},methods:{onChangedData(){try{this.sourceData&&this.prepareData()}catch(r){console.error(r)}},prepareData(){var e;this.columns=Object.keys(this.sourceData[0]);const r=this.sourceData.map(t=>{var i;return t[(i=this.columns)==null?void 0:i[1]]});this.maxValue=Math.max(...r),this.restDimensions=(e=this.columns)==null?void 0:e.filter((t,i)=>i!==0)},formattedValue(r){return gi(r)},getWidth(r){return`${r/this.maxValue*100}%`}}},dle={class:"h-full pt-[20px] list-bar"},ple={class:"space-y-2 custom-scrollbar h-[calc(100%-20px)]"},vle={class:"relative w-full truncate"},gle={class:"relative z-[1] text-sm block py-1 px-2 w-full text-sm truncate text-gray-800"},mle={class:"text-[14px] text-gray-500"};function yle(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",dle,[N.createElementVNode("ul",ple,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(r.sourceData,(o,s)=>{var l,h,f;return N.openBlock(),N.createElementBlock("li",{key:s,class:"flex items-center justify-between w-full gap-x-2"},[N.createElementVNode("div",vle,[N.createElementVNode("span",gle,N.toDisplayString((o==null?void 0:o[(l=n.columns)==null?void 0:l[0]])||"Без категорії"),1),N.createElementVNode("div",{class:N.normalizeClass(["absolute inset-y-0 h-full rounded start-0",o!=null&&o[(h=n.columns)==null?void 0:h[0]]?"bg-indigo-100":"bg-gray-100"]),style:N.normalizeStyle({width:a.getWidth(o==null?void 0:o[(f=n.columns)==null?void 0:f[1]])})},null,6)]),(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(n.restDimensions,(d,v)=>(N.openBlock(),N.createElementBlock("div",{key:v,class:"w-20 mr-2 text-end"},[N.createElementVNode("span",mle,N.toDisplayString(a.formattedValue(o==null?void 0:o[d])),1)]))),128))])}),128))])])}const WC=dr(fle,[["render",yle]]),_le=Object.freeze(Object.defineProperty({__proto__:null,default:WC},Symbol.toStringTag,{value:"Module"})),ZC={week:"Тиждень",month:"Місяць",quarter:"Квартал",year:"Рік"},xle=["onClick"],ble={class:"flex items-center justify-between w-full"},wle={key:0},Sle={__name:"vs-bi-dropdown",props:{title:String,options:[Array,String],value:{type:String}},emits:["selected"],setup(r,{emit:e}){const t=r,i=e,n=N.ref(!1),a=N.ref(t.value||null),o=N.ref(null),s=N.computed(()=>typeof t.options=="string"?t.options.split(",").map((m,_)=>({id:_,text:m.trim()})):t.options),l=N.computed(()=>{const m=s.value.find(_=>(_.id||_)===a.value);return m?m.text||m:t.title}),h=m=>{a.value=m.id||m,n.value=!1,i("selected",(m==null?void 0:m.id)||m),document.removeEventListener("click",f)},f=m=>{o.value&&!o.value.contains(m.target)&&(n.value=!1,document.removeEventListener("click",f))},d=()=>{n.value=!n.value,n.value?setTimeout(()=>{document.addEventListener("click",f)},200):document.removeEventListener("click",f)},v=m=>(ZC==null?void 0:ZC[m])||m;return N.onUnmounted(()=>{document.removeEventListener("click",f)}),(m,_)=>(N.openBlock(),N.createElementBlock(N.Fragment,null,[N.createElementVNode("button",{type:"button","aria-expanded":"true",class:"hs-select-disabled:pointer-events-none hs-select-disabled:opacity-50 relative group pr-2 -ms-2 py-1.5 pl-2.5 inline-flex shrink-0 justify-center items-center gap-x-1.5 text-sm text-gray-800 rounded-lg hover:bg-gray-100 focus:outline-none focus:bg-gray-100 before:absolute before:inset-0 before:z-[1] dark:text-neutral-400 dark:hover:bg-neutral-800 dark:focus:bg-neutral-700",onClick:d},[N.createTextVNode(N.toDisplayString(v(l.value))+" ",1),_[0]||(_[0]=N.createElementVNode("svg",{class:"shrink-0 size-3.5 text-gray-600 dark:text-neutral-400",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[N.createElementVNode("path",{d:"m6 9 6 6 6-6"})],-1))]),n.value?(N.openBlock(),N.createElementBlock("div",{key:0,ref_key:"biDropdown",ref:o,"data-hs-select-dropdown":"",class:"absolute mt-2 z-50 w-48 p-1 space-y-0.5 bg-white rounded-xl shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] dark:bg-neutral-950 opened",role:"listbox",tabindex:"-1","aria-orientation":"vertical",style:{"margin-top":"10px"}},[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(s.value,b=>(N.openBlock(),N.createElementBlock("div",{key:b.id||b,class:"cursor-pointer selected hs-selected:bg-gray-100 dark:hs-selected:bg-neutral-800 py-1.5 px-2 w-full text-[13px] text-gray-800 rounded-lg hover:bg-gray-100 focus:outline-none focus:bg-gray-100 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:S=>h(b)},[N.createElementVNode("div",ble,[N.createElementVNode("span",null,N.toDisplayString(v(b.text||b)),1),a.value===(b.id||b)?(N.openBlock(),N.createElementBlock("span",wle,_[1]||(_[1]=[N.createElementVNode("svg",{class:"shrink-0 h-3.5 w-3.5 text-gray-800 dark:text-neutral-200",xmlns:"http:.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[N.createElementVNode("polyline",{points:"20 6 9 17 4 12"})],-1)]))):N.createCommentVNode("",!0)])],8,xle))),128))],512)):N.createCommentVNode("",!0)],64))}},Tle={"bi-bar":N.defineAsyncComponent(()=>Promise.resolve().then(()=>Mse)),"bi-number":N.defineAsyncComponent(()=>Promise.resolve().then(()=>ghe)),"bi-text":N.defineAsyncComponent(()=>Promise.resolve().then(()=>Qhe)),"bi-listbar":N.defineAsyncComponent(()=>Promise.resolve().then(()=>_le)),"bi-pie":N.defineAsyncComponent(()=>Promise.resolve().then(()=>Rse)),"bi-donut":N.defineAsyncComponent(()=>Promise.resolve().then(()=>ife)),"bi-line":N.defineAsyncComponent(()=>Promise.resolve().then(()=>Bse)),"bi-stat":N.defineAsyncComponent(()=>Promise.resolve().then(()=>Qse)),"bi-pivot":N.defineAsyncComponent(()=>Promise.resolve().then(()=>Lue)),"bi-progress":N.defineAsyncComponent(()=>Promise.resolve().then(()=>hle)),"bi-funnel":N.defineAsyncComponent(()=>Promise.resolve().then(()=>sfe)),"bi-map":N.defineAsyncComponent(()=>Promise.resolve().then(()=>gde)),"bi-cluster":N.defineAsyncComponent(()=>Promise.resolve().then(()=>wde)),"bi-table":N.defineAsyncComponent(()=>Promise.resolve().then(()=>zde))},Cle={class:"flex items-center space-x-2"},Dle=N.defineComponent({__name:"vs-bi-switch",props:N.mergeModels({leftLabel:{},rightLabel:{},modelValue:{type:Boolean}},{modelValue:{default:()=>!1,type:Boolean},modelModifiers:{}}),emits:N.mergeModels(["update:is-enabled"],["update:modelValue"]),setup(r,{emit:e}){const t=e,i=N.useModel(r,"modelValue"),n=()=>{t("update:is-enabled",i)};return(a,o)=>(N.openBlock(),N.createElementBlock("div",Cle,[a.leftLabel?(N.openBlock(),N.createElementBlock("div",{key:0,class:N.normalizeClass(["transition-colors",{"text-blue-500":!i.value}])},N.toDisplayString(a.leftLabel),3)):N.createCommentVNode("",!0),N.withDirectives(N.createElementVNode("input",{"onUpdate:modelValue":o[0]||(o[0]=s=>i.value=s),type:"checkbox",class:"relative w-11 h-6 p-px bg-gray-100 border-transparent text-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:ring-blue-600 disabled:opacity-50 disabled:pointer-events-none checked:bg-none checked:text-blue-600 checked:border-blue-600 focus:checked:border-blue-600 dark:bg-neutral-800 dark:border-neutral-700 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-600 before:inline-block before:size-5 before:bg-white checked:before:bg-blue-200 before:translate-x-0 checked:before:translate-x-full before:rounded-full before:shadow before:h-5 before:w-5 before:transform before:ring-0 before:transition before:ease-in-out before:duration-200 dark:before:bg-neutral-400 dark:checked:before:bg-blue-200",onChange:n},null,544),[[N.vModelCheckbox,i.value]]),a.rightLabel?(N.openBlock(),N.createElementBlock("div",{key:1,class:N.normalizeClass(["transition-colors",{"text-blue-500":i.value}])},N.toDisplayString(a.rightLabel),3)):N.createCommentVNode("",!0)]))}}),Ale={},Ile={class:"flex items-center justify-center h-full"};function Ele(r,e){return N.openBlock(),N.createElementBlock("div",Ile,e[0]||(e[0]=[N.createElementVNode("div",{class:"text-center text-gray-500"},[N.createElementVNode("h2",{class:"text-2xl font-bold"},"No data available")],-1)]))}const Mle=dr(Ale,[["render",Ele]]),kle={},Ple={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function Lle(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("svg",Ple,e[0]||(e[0]=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),N.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),N.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Rle={components:{VsBiDropdown:Sle,VsBiSwitch:Dle,VsNoDataChart:Mle,IconDownload:dr(kle,[["render",Lle]]),...Tle},props:{dashboard:{type:String},prefix:{type:String,default:""},widget:{type:String},filterURl:{type:String},dashboardWidgets:{type:Object},selectedWidget:{type:String}},data(){return{checked:[],selected:[],currentWidget:null,widgetData:[]}},computed:{computedTitle(){var e,t;const r=(e=this.dashboardWidgets)==null?void 0:e.find(i=>i.name===this.widget);return((t=r==null?void 0:r.data)==null?void 0:t.title)||(r==null?void 0:r.title)||""},computedType(){var e;const r=(e=this.dashboardWidgets)==null?void 0:e.find(t=>t.name===this.widget);return(r==null?void 0:r.type)||"text"},controls(){var e;return Object.keys(((e=this.widgetData)==null?void 0:e.controls)||{}).map(t=>{var i,n,a;return{name:t,options:typeof((i=this.widgetData)==null?void 0:i.controls)=="boolean"?!1:(a=(n=this.widgetData)==null?void 0:n.controls)==null?void 0:a[t]}})}},mounted(){this.prefix&&(mr.defaults.baseURL=this.prefix)},watch:{filterURl(r){var e,t;(t=(e=this.$refs)==null?void 0:e.chart)==null||t.setFilter(r)},selectedWidget(r,e){var t;r!==e&&r===((t=this.widgetData)==null?void 0:t.id)&&this.$emit("update:current-widget-data",this.widgetData)},widgetData(r,e){if((r==null?void 0:r.id)===(e==null?void 0:e.id))return;const i=new URLSearchParams(window.top.location.search).get("widget");i&&i===(r==null?void 0:r.id)&&this.$emit("update:current-widget-data",r)}},methods:{changeStyleHandler(r,e){var t;(t=this.$refs.chart)==null||t.changeStyle(r,e)},selectedOptionHandler(r,e){let t=!0;this.selected.forEach(i=>{i.name===e&&(i.option=r,t=!1)}),t&&this.selected.push({name:e,option:r}),this.makeUpUrl()},makeUpUrl(){var e;let r=`/bi-data?dashboard=${this.dashboard}&widget=${this.widget}`;this.selected.forEach((t,i)=>{r+=`&${t.name}=${t.option}`}),(e=this.$refs.chart)==null||e.getDataFromURL(r)},exportChart(){if(this.currentWidget){const r=this.currentWidget.getDataURL({type:"png",pixelRatio:2,backgroundColor:"#ffffff"}),e=document.createElement("a");e.href=r,e.download="chart.png",document.body.appendChild(e),e.click(),document.body.removeChild(e)}}}},zle={ref:"widget",class:"box-border relative h-full p-4 bg-white border border-gray-200 select-auto rounded-xl"},Nle={class:"text-[16px] flex max-w-full items-center min-h-0 flex justify-between max-h-[50px] h-fit shrink-0"},Ole={class:"flex items-center justify-between w-full"},Ble={class:"grid"},Vle={class:"text-gray-800 max-h-[30px] inline-block text-nowrap font-semibold font-[24px]"},Fle={class:"flex flex-col justify-end"},$le={key:0,class:"flex items-center justify-end w-full gap-2"},Gle={class:"w-full h-full"};function Ule(r,e,t,i,n,a){var f,d,v;const o=N.resolveComponent("VsBiDropdown"),s=N.resolveComponent("VsBiSwitch"),l=N.resolveComponent("IconDownload"),h=N.resolveComponent("VsNoDataChart");return N.openBlock(),N.createElementBlock("div",zle,[N.createElementVNode("div",Nle,[N.createElementVNode("div",Ole,[N.createElementVNode("div",Ble,[N.createElementVNode("span",Vle,N.toDisplayString(a.computedTitle),1)]),N.createElementVNode("div",Fle,[(f=a.controls)!=null&&f.length?(N.openBlock(),N.createElementBlock("span",$le,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList((d=a.controls)==null?void 0:d.filter(m=>(m==null?void 0:m.options)&&(m==null?void 0:m.name)!=="export"),m=>{var _;return N.openBlock(),N.createElementBlock("div",null,[Array.isArray(m==null?void 0:m.options)?(N.openBlock(),N.createBlock(o,{key:0,title:m==null?void 0:m.name,options:m==null?void 0:m.options,value:(_=n.widgetData)==null?void 0:_.data[m==null?void 0:m.name],onSelected:b=>a.selectedOptionHandler(b,m==null?void 0:m.name)},null,8,["title","options","value","onSelected"])):typeof m.options=="boolean"?(N.openBlock(),N.createBlock(s,{key:1,"left-label":m==null?void 0:m.name,"is-enabled":m==null?void 0:m.options,"onUpdate:isEnabled":b=>a.changeStyleHandler(m==null?void 0:m.name,b)},null,8,["left-label","is-enabled","onUpdate:isEnabled"])):N.createCommentVNode("",!0)])}),256)),(v=a.controls)!=null&&v.some(m=>(m==null?void 0:m.name)==="export")?(N.openBlock(),N.createElementBlock("button",{key:0,onClick:e[0]||(e[0]=(...m)=>a.exportChart&&a.exportChart(...m)),class:"h-[32px] w-[32px] rounded-lg hover:bg-gray-100 duration-100 flex items-center justify-center"},[N.createVNode(l,{height:"16",width:"16",class:"text-gray-800"})])):N.createCommentVNode("",!0)])):N.createCommentVNode("",!0)])])]),N.createElementVNode("div",Gle,[n.widgetData?(N.openBlock(),N.createBlock(N.resolveDynamicComponent("bi-"+a.computedType),{key:0,currentWidget:n.currentWidget,"onUpdate:currentWidget":e[1]||(e[1]=m=>n.currentWidget=m),widgetData:n.widgetData,"onUpdate:widgetData":e[2]||(e[2]=m=>n.widgetData=m),ref:"chart",dashboard:t.dashboard,widget:t.widget},null,40,["currentWidget","widgetData","dashboard","widget"])):(N.openBlock(),N.createBlock(h,{key:1,class:"w-full h-full"}))])],512)}const qv=dr(Rle,[["render",Ule]]),Hle={props:{title:{type:String,default:()=>"Дані для відображення відсутні"},text:{type:String,default:()=>"Змініть параметри пошуку або спробуйте пізніше"}}},Wle={class:"w-full overflow-hidden rounded vs-table-interface__table-wrp h-fit"},Zle={class:"p-5 min-h-[500px] flex flex-col justify-center items-center text-center"},jle={class:"max-w-sm mx-auto mt-6"},qle={class:"font-medium text-gray-800 dark:text-neutral-200"},Xle={class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"};function Yle(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",Wle,[N.createElementVNode("div",null,[N.createElementVNode("div",Zle,[e[0]||(e[0]=N.createStaticVNode('<svg class="w-48 mx-auto" viewBox="0 0 178 90" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs></svg>',1)),N.createElementVNode("div",jle,[N.createElementVNode("p",qle,N.toDisplayString(t.title),1),N.createElementVNode("p",Xle,N.toDisplayString(t.text),1)])])])])}const jC=dr(Hle,[["render",Yle]]),Kle={},Jle={class:"flex-shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Qle(r,e){return N.openBlock(),N.createElementBlock("svg",Jle,e[0]||(e[0]=[N.createStaticVNode('<line x1="21" x2="14" y1="4" y2="4"></line><line x1="10" x2="3" y1="4" y2="4"></line><line x1="21" x2="12" y1="12" y2="12"></line><line x1="8" x2="3" y1="12" y2="12"></line><line x1="21" x2="16" y1="20" y2="20"></line><line x1="12" x2="3" y1="20" y2="20"></line><line x1="14" x2="14" y1="2" y2="6"></line><line x1="8" x2="8" y1="10" y2="14"></line><line x1="16" x2="16" y1="18" y2="22"></line>',9)]))}const eue=dr(Kle,[["render",Qle]]),tue={},rue={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-refresh"};function iue(r,e){return N.openBlock(),N.createElementBlock("svg",rue,e[0]||(e[0]=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4"},null,-1),N.createElementVNode("path",{d:"M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"},null,-1)]))}const nue={components:{filterIcon:eue,refreshIcon:dr(tue,[["render",iue]])},props:["filterScheme"],emits:["filters:changed"],data(){return{rows:[],isFilterVisible:!1,rowList:[],activeFilters:"",filters:{}}},async mounted(){const e=await(await new URLSearchParams(window.top.location.search)).get("filter");this.filters.url=e||""},computed:{activeFiltersCount(){var r,e;return(r=this.filters)!=null&&r.url?((e=this.filters)==null?void 0:e.url.split("=").length)-1:0}},methods:{toggleFilterShown(){this.isFilterVisible=!this.isFilterVisible},handleFilterChange(r){var e,t;this.filters=r,this.activeFilters=(t=(e=this.$refs)==null?void 0:e.filter)==null?void 0:t.activeFilters,this.$emit("filters:changed",this.filters)},resetFilters(){this.$refs.filter&&this.$refs.filter.clearAll(),this.isFilterVisible=!1,this.$emit("filters:changed",""),this.activeFilters=null},closeFilter({target:r}){this.isFilterVisible&&r.classList.contains("filter-container")&&(this.isFilterVisible=!1)}}},aue={class:"flex items-center"},oue={key:0,class:"font-medium text-[10px] min-w-[16px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full"};function sue(r,e,t,i,n,a){const o=N.resolveComponent("filterIcon"),s=N.resolveComponent("VsFilterList");return N.openBlock(),N.createElementBlock("div",aue,[t.filterScheme?(N.openBlock(),N.createBlock(s,{key:0,ref:"filter",scheme:t.filterScheme,closeFilterBtn:!0,onFilterClose:e[1]||(e[1]=l=>n.isFilterVisible=!1),layout:"default","apply-vue-router":"",history:"",view:"plain",token:r.table,name:"filter",footer:!0,background:!0,onFilterChange:a.handleFilterChange},{button:N.withCtx(()=>[N.createElementVNode("button",{type:"button",class:"py-2 px-2.5 ml-3 h-[38px] inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50",onClick:e[0]||(e[0]=(...l)=>a.toggleFilterShown&&a.toggleFilterShown(...l))},[N.createVNode(o),e[2]||(e[2]=N.createTextVNode(" Фільтри ")),a.activeFiltersCount>=1?(N.openBlock(),N.createElementBlock("span",oue,N.toDisplayString(a.activeFiltersCount),1)):N.createCommentVNode("",!0)])]),_:1},8,["scheme","token","onFilterChange"])):N.createCommentVNode("",!0)])}const lue={props:["dashboardData","filters"],components:{VsFilterHeader:dr(nue,[["render",sue]])}},uue={class:"bg-white px-5 flex gap-4 h-[90px] border border-gray-200 mt-2 rounded-xl mb-2 pt-[3px] justify-between items-center"},cue={class:"grow"},hue={class:"text-lg font-semibold text-stone-800 dark:text-neutral-200"},fue={type:"button",class:"inline-flex items-center text-sm gap-x-2 text-stone-800 hover:text-stone-500 focus:outline-none focus:text-stone-500 dark:text-neutral-200 dark:hover:text-neutral-400 dark:focus:text-neutral-400","data-clipboard-target":"#hs-erc","data-clipboard-action":"copy","data-clipboard-success-text":"Copied"};function due(r,e,t,i,n,a){var s,l;const o=N.resolveComponent("VsFilterHeader");return N.openBlock(),N.createElementBlock("div",uue,[N.createElementVNode("div",cue,[N.createElementVNode("h1",hue,N.toDisplayString((s=t.dashboardData)==null?void 0:s.title),1),N.createElementVNode("button",fue,N.toDisplayString((l=t.dashboardData)==null?void 0:l.description),1)]),N.createVNode(o,{filterScheme:t.filters,"onFilters:changed":e[0]||(e[0]=h=>r.$emit("filters:changed",h))},null,8,["filterScheme"])])}const pue={components:{VsWidget:qv,VsNewNodata:jC,VsHeader:dr(lue,[["render",due]])},props:["id","prefix"],data(){return{widgets:[],panels:[],error:!1,selectedPanel:"",filterURl:null,dashboardData:null}},async mounted(){mr.defaults.baseURL=this.prefix||"/api",await this.fetchData()},methods:{async fetchData(){if(this.id)try{const{data:r}=await mr.get(`/bi-dashboard/${this.id}`);this.dashboardData=r}catch(r){console.error(r)}},columnClass(r){const e=r!=null&&r.col?r==null?void 0:r.col:12;return{1:"md:w-1/12 sm:w-full",2:"md:w-1/6 sm:w-full",3:"md:w-1/4 sm:w-full",4:"md:w-1/3 sm:w-full",6:"md:w-1/2 sm:w-full",8:"md:w-2/3 sm:w-full",10:"md:w-5/6 sm:w-full",12:"w-full"}[e]||"w-full"},async filterHandler(r){var t;this.filterURl="";let e="&filter=";(t=r==null?void 0:r.url)!=null&&t.length&&(r.url.split("|").forEach(n=>{const a=n.split("=");e+=`${a[0]}=${a[1]}`}),this.filterURl+=e)}}},vue={class:"w-full pb-8 overflow-y-auto"},gue={class:"grid flex-grow w-full grid-cols-12 gap-4 h-fit"};function mue(r,e,t,i,n,a){var h,f,d;const o=N.resolveComponent("VsHeader"),s=N.resolveComponent("VsNewNodata"),l=N.resolveComponent("VsWidget");return N.openBlock(),N.createElementBlock("div",vue,[N.createElementVNode("div",null,[(h=n.dashboardData)!=null&&h.filters?(N.openBlock(),N.createBlock(o,{key:0,filters:(f=n.dashboardData)==null?void 0:f.filters,dashboardData:n.dashboardData,"onFilters:changed":e[0]||(e[0]=v=>a.filterHandler(v))},null,8,["filters","dashboardData"])):N.createCommentVNode("",!0)]),N.createElementVNode("div",gue,[n.error||!n.dashboardData?(N.openBlock(),N.createBlock(s,{key:0,class:"col-span-12"})):N.createCommentVNode("",!0),(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(((d=n.dashboardData)==null?void 0:d.panels)||[],(v,m)=>{var _;return N.openBlock(),N.createElementBlock("div",{key:m,class:N.normalizeClass([`col-span-${v.col||12}`,"flex flex-col gap-[10px]"])},[(_=v.widgets)!=null&&_.length?(N.openBlock(!0),N.createElementBlock(N.Fragment,{key:0},N.renderList(v.widgets,b=>(N.openBlock(),N.createBlock(l,{key:b,dashboard:t.id,widget:b,"dashboard-widgets":n.dashboardData.widgets,"filter-u-rl":n.filterURl},null,8,["dashboard","widget","dashboard-widgets","filter-u-rl"]))),128)):(N.openBlock(),N.createBlock(l,{key:1,class:"max-h-[460px] flex flex-col",dashboard:t.id,widget:v.widget,"dashboard-widgets":n.dashboardData.widgets,"filter-u-rl":n.filterURl},null,8,["dashboard","widget","dashboard-widgets","filter-u-rl"]))],2)}),128))])])}const oF=dr(pue,[["render",mue]]),yue={name:"VsPivotTable",mixins:[da],data(){return{values:null,xs:null,products:null}},async mounted(){await this.getData(),this.prepareData()},methods:{onChangedData(){try{this.sourceData&&this.prepareData()}catch{}},prepareData(){try{const r=Array.from(new Set(this.sourceData.map(e=>e[this.dimensions[0]])));this.dimensions[0].includes("date")?this.xs=r.map(e=>Yo(e)):this.xs=[...r],this.products=this.dimensions.filter((e,t)=>t!=0),this.values=this.products.map((e,t)=>({name:e,data:this.sourceData.filter(i=>parseFloat(i[e])).map(i=>gi(parseFloat(i[e])))}))}catch(r){console.error(r)}}}},_ue={class:"flex flex-col h-full p-5 space-y-4 rounded-xl custom-scrollbar"},xue={class:"overflow-x-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 custom-scrollbar"},bue={class:"inline-block min-w-full align-middle"},wue={class:"min-w-full divide-y divide-gray-200"},Sue={class:"space-x-2"},Tue={scope:"col",class:"xl:min-w-[120px] min-w-48"},Cue={class:"py-2.5 text-text-start flex items-center gap-x-1 text-sm font-normal text-gray-500"},Due={class:"divide-y divide-gray-200 text-[12px]"},Aue={class:"py-3 size-px whitespace-nowrap"},Iue={class:"flex items-center gap-x-3"},Eue={class:"font-medium text-gray-800"},Mue={class:"py-3 size-px whitespace-nowrap"},kue={class:"text-gray-600"};function Pue(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",_ue,[N.createElementVNode("div",xue,[N.createElementVNode("div",bue,[N.createElementVNode("table",wue,[N.createElementVNode("thead",null,[N.createElementVNode("tr",Sue,[e[0]||(e[0]=N.createElementVNode("th",{scope:"col",class:"min-w-[200px]"},[N.createElementVNode("div",{class:"py-2.5 text-text-start flex items-center gap-x-1 text-sm font-normal text-gray-500"})],-1)),(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(n.xs,o=>(N.openBlock(),N.createElementBlock("th",Tue,[N.createElementVNode("div",Cue,N.toDisplayString(o),1)]))),256))])]),(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(n.values,o=>(N.openBlock(),N.createElementBlock("tbody",Due,[N.createElementVNode("tr",null,[N.createElementVNode("td",Aue,[N.createElementVNode("div",Iue,[N.createElementVNode("span",Eue,N.toDisplayString(o.name),1)])]),(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(n.xs,(s,l)=>(N.openBlock(),N.createElementBlock("td",Mue,[N.createElementVNode("span",kue,N.toDisplayString(o.data[l]),1)]))),256))])]))),256))])])])])}const qC=dr(yue,[["render",Pue]]),Lue=Object.freeze(Object.defineProperty({__proto__:null,default:qC},Symbol.toStringTag,{value:"Module"})),Rue={},zue={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Nue(r,e){return N.openBlock(),N.createElementBlock("svg",zue,e[0]||(e[0]=[N.createElementVNode("path",{d:"M3.3335 8H12.6668",stroke:"#1E40AF","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M8 3.33325V12.6666",stroke:"#1E40AF","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]))}const Oue=dr(Rue,[["render",Nue]]),Bue={},Vue={width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"mr-3"};function Fue(r,e){return N.openBlock(),N.createElementBlock("svg",Vue,e[0]||(e[0]=[N.createElementVNode("path",{d:"M6.41667 11.0833C8.994 11.0833 11.0833 8.994 11.0833 6.41667C11.0833 3.83934 8.994 1.75 6.41667 1.75C3.83934 1.75 1.75 3.83934 1.75 6.41667C1.75 8.994 3.83934 11.0833 6.41667 11.0833Z",stroke:"#6B7280","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M12.25 12.25L9.7417 9.7417",stroke:"#6B7280","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]))}const $ue=dr(Bue,[["render",Fue]]),Gue={},Uue={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-upload"};function Hue(r,e){return N.openBlock(),N.createElementBlock("svg",Uue,e[0]||(e[0]=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),N.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),N.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Wue=dr(Gue,[["render",Hue]]),Zue={},jue={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-lock"};function que(r,e){return N.openBlock(),N.createElementBlock("svg",jue,e[0]||(e[0]=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-6z"},null,-1),N.createElementVNode("path",{d:"M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0"},null,-1),N.createElementVNode("path",{d:"M8 11v-4a4 4 0 1 1 8 0v4"},null,-1)]))}const Xue=dr(Zue,[["render",que]]),Yue=[{type:"Text",key:"name",label:"Назва",validators:["required"],original:{type:"Text",ua:"Назва",col:8}},{type:"Text",key:"title",label:"Заголовок",validators:["required"],original:{type:"Text",ua:"Титул",col:8}},{type:"Text",key:"description",label:"Опис",original:{type:"Text",ua:"Назва",col:8}},{type:"Text",key:"words",label:"Ключові слова",original:{type:"Text",ua:"Назва",col:8}},{type:"Text",key:"table_name",validators:["required"],label:"Назва таблиці",original:{type:"Text",ua:"Назва",col:8}},{type:"Text",key:"db",label:"База даних",original:{type:"Text",ua:"Назва",col:8}},{type:"Switcher",key:"public",label:"Публічний",original:{type:"Text",ua:"Назва",col:8}}],Kue={components:{plusIcon:Oue,searchIcon:$ue,IconLock:Xue,IconImport:Wue},props:["selectedDashboard","prefix"],emits:["update:selectedDashboard","add","update"],mounted(){mr.defaults.baseURL=this.prefix||"/api",this.getFileItems(),this.getList()},data(){return{searchQuery:"",scheme:null,formValues:{},formCreateValues:{},isVisible:!1,isVisibleFormDashboard:!1,fileItems:null,list:null,addDashboardForm:Yue}},methods:{async getFileItems(){var r;try{const{data:e}=await mr.get("/bi-dashboard?type=file");this.scheme={dashboard:{type:"Checkbox",ua:"Дашборди",options:(r=e==null?void 0:e.rows)==null?void 0:r.map(({name:t,title:i})=>({id:t,text:i}))}}}catch{}},async getList(){try{const{data:r}=await mr.get("/bi-dashboard?type=db");this.list=r.rows.filter(e=>e.type==="db")}catch(r){console.error(r)}},async dashboardImport(){try{await mr.get(`/bi-dashboard-import?dashboard=${this.formValues.dashboard}`),this.isVisible=!1,this.formValues={},this.$notify({type:"success",title:"Успішно!",message:"Дашборд імпортовано успішно"}),this.getList()}catch{this.$notify({type:"error",title:"Помилка!",message:"При спробі імпортувати дашборд виникла помилка"})}},async createDashboard(){try{await this.$refs.form.doValidation(),await mr.post("/bi-dashboard",this.formCreateValues),this.isVisibleFormDashboard=!1,this.formCreateValues={},this.$notify({type:"success",title:"Успішно!",message:"Дашборд створено успішно"}),this.getList()}catch{this.$notify({type:"error",title:"Помилка!",message:"При спробі створити дашборд виникла помилка"})}}},computed:{filteredList(){var e;const r=this.searchQuery.toLowerCase();return(e=this.list)==null?void 0:e.filter(t=>(t==null?void 0:t.title)&&(t==null?void 0:t.title.toLowerCase().includes(r))||(t==null?void 0:t.name)&&(t==null?void 0:t.name.toLowerCase().includes(r)))}}},Jue={class:"h-full w-[300px] shrink-0 bg-white border-r border-gray-200 flex flex-col"},Que={class:"flex h-[49px] border-b justify-between px-[16px] items-center"},ece={class:"flex items-center gap-2"},tce={class:"flex items-center gap-2 px-[10px] py-2"},rce={class:"relative w-full"},ice={class:"px-[10px] flex flex-col gap-[2px] overflow-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300"},nce=["item","onClick"],ace={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},oce={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"};function sce(r,e,t,i,n,a){const o=N.resolveComponent("IconImport"),s=N.resolveComponent("VsPopover"),l=N.resolveComponent("plusIcon"),h=N.resolveComponent("IconLock"),f=N.resolveComponent("VsForm"),d=N.resolveComponent("VsDialog");return N.openBlock(),N.createElementBlock(N.Fragment,null,[N.createElementVNode("div",Jue,[N.createElementVNode("div",Que,[e[13]||(e[13]=N.createElementVNode("div",{class:"text-[20px]"},[N.createTextVNode("Editor "),N.createElementVNode("span",{class:"text-[#666666]"})],-1)),N.createElementVNode("div",ece,[N.createVNode(s,{placement:"left",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{class:"bg-[#DBEAFE] h-[38px] text-blue-500 w-[38px] flex items-center hover:bg-blue-300 duration-300 justify-center rounded-lg shrink-0",onClick:e[0]||(e[0]=v=>n.isVisible=!0)},[N.createVNode(o,{height:"18",width:"18"})])]),default:N.withCtx(()=>[e[11]||(e[11]=N.createTextVNode(" Імпортувати дашборд "))]),_:1}),N.createVNode(s,{placement:"right",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{class:"bg-[#DBEAFE] h-[38px] w-[38px] flex items-center hover:bg-blue-300 duration-300 justify-center rounded-lg shrink-0",onClick:e[1]||(e[1]=v=>n.isVisibleFormDashboard=!0)},[N.createVNode(l)])]),default:N.withCtx(()=>[e[12]||(e[12]=N.createTextVNode(" Створити дашборд "))]),_:1})])]),N.createElementVNode("div",tce,[N.createElementVNode("div",rce,[N.withDirectives(N.createElementVNode("input",{"onUpdate:modelValue":e[2]||(e[2]=v=>n.searchQuery=v),class:"flex-1 text-[13px] w-full h-[38px] px-3 text-gray-800 rounded-lg !border-none bg-gray-100 placeholder-gray-800 focus:outline-2 focus:outline-blue-600",placeholder:"Пошук..."},null,512),[[N.vModelText,n.searchQuery]])])]),N.createElementVNode("div",ice,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(a.filteredList,(v,m)=>(N.openBlock(),N.createElementBlock("div",{key:m,item:v,class:N.normalizeClass(["flex items-center cursor-pointer hover:bg-[#F3F4F6] py-1.5 px-2 text-[13px] text-gray-800 rounded-lg",{"bg-gray-100 outline-none":v.name===t.selectedDashboard}]),onClick:_=>r.$emit("update:selectedDashboard",v==null?void 0:v.name)},[N.createTextVNode(N.toDisplayString((v==null?void 0:v.title)||(v==null?void 0:v.name))+" ",1),v!=null&&v.public?N.createCommentVNode("",!0):(N.openBlock(),N.createBlock(h,{key:0,height:"12",width:"12",class:"ml-1 shrink-0"}))],10,nce))),128))])]),N.createVNode(d,{visible:n.isVisible,"onUpdate:visible":e[6]||(e[6]=v=>n.isVisible=v),title:"Імпортувати"},{footer:N.withCtx(()=>[N.createElementVNode("div",ace,[N.createElementVNode("button",{style:{border:"1px solid #000"},onClick:e[4]||(e[4]=v=>n.isVisible=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),N.createElementVNode("button",{onClick:e[5]||(e[5]=(...v)=>a.dashboardImport&&a.dashboardImport(...v)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Імпортувати ")])]),default:N.withCtx(()=>{var v;return[N.createTextVNode(N.toDisplayString((v=n.fileItems)==null?void 0:v.map(({name:m,title:_})=>({value:m,text:_})))+" ",1),N.createVNode(f,{scheme:n.scheme,modelValue:n.formValues,"onUpdate:modelValue":e[3]||(e[3]=m=>n.formValues=m)},null,8,["scheme","modelValue"])]}),_:1},8,["visible"]),N.createVNode(d,{visible:n.isVisibleFormDashboard,"onUpdate:visible":e[10]||(e[10]=v=>n.isVisibleFormDashboard=v),title:"Створити дашборд"},{footer:N.withCtx(()=>[N.createElementVNode("div",oce,[N.createElementVNode("button",{style:{border:"1px solid #000"},onClick:e[8]||(e[8]=v=>n.isVisibleFormDashboard=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),N.createElementVNode("button",{onClick:e[9]||(e[9]=(...v)=>a.createDashboard&&a.createDashboard(...v)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:N.withCtx(()=>[N.createVNode(f,{ref:"form",scheme:n.addDashboardForm,modelValue:n.formCreateValues,"onUpdate:modelValue":e[7]||(e[7]=v=>n.formCreateValues=v)},null,8,["scheme","modelValue"])]),_:1},8,["visible"])],64)}const lce=dr(Kue,[["render",sce]]),uce={},cce={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-trash"};function hce(r,e){return N.openBlock(),N.createElementBlock("svg",cce,e[0]||(e[0]=[N.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7l16 0"></path><path d="M10 11l0 6"></path><path d="M14 11l0 6"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>',6)]))}const sF=dr(uce,[["render",hce]]),fce={},dce={class:"shrink-0 size-3",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function pce(r,e){return N.openBlock(),N.createElementBlock("svg",dce,e[0]||(e[0]=[N.createElementVNode("path",{d:"M18 6 6 18"},null,-1),N.createElementVNode("path",{d:"m6 6 12 12"},null,-1)]))}const lF=dr(fce,[["render",pce]]),vce={},gce={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-edit"};function mce(r,e){return N.openBlock(),N.createElementBlock("svg",gce,e[0]||(e[0]=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"},null,-1),N.createElementVNode("path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z"},null,-1),N.createElementVNode("path",{d:"M16 5l3 3"},null,-1)]))}const uF=dr(vce,[["render",mce]]),yce={class:"pt-[10px]"},_ce={__name:"vs-editor-form-style",props:{widgetName:{type:String},data:{type:Object,default:()=>{}}},setup(r){var v,m,_,b,S,D;const{$notify:e}=N.getCurrentInstance().proxy,t=r,i=N.ref(null),n={show:{label:"Label",type:"switcher",title:"Show label"},rotate:{type:"number",label:"Rotate angel",conditions:["show","==",!0]},align:{type:"radio",view:"buttons",style:{size:"xs"},conditions:["show","==",!0],options:[{id:"center",text:"Center"},{id:"left",text:"Left"},{id:"right",text:"Right"}]},position:{type:"radio",view:"buttons",style:{size:"xs"},conditions:["show","==",!0],options:[{id:"top",text:"Top"},{id:"right",text:"Right"},{id:"left",text:"Left"},{id:"bottom",text:"Bottom"}]}},a={show:{label:"Legend",type:"switcher",title:"Show legend"}},o={show:{label:"Tooltip ",type:"switcher",title:"Show tooltip"}},s=N.ref({...((m=(v=t.data)==null?void 0:v.style)==null?void 0:m.label)||{}}),l=N.ref({...((b=(_=t.data)==null?void 0:_.style)==null?void 0:b.legend)||{}}),h=N.ref({...((D=(S=t.data)==null?void 0:S.style)==null?void 0:D.tooltip)||{}}),f=()=>{const k=new CustomEvent(`update-style-${t.widgetName}`);k.chartId=t.widgetName,k.options={options:{legend:l.value,tooltip:h.value,label:s.value},seriesOptions:s.value},window.dispatchEvent(k)};N.watch(s,f,{deep:!0}),N.watch(l,f,{deep:!0}),N.watch(h,f,{deep:!0});const d=async()=>{try{await mr.put(`/bi-dashboard/${i.value}/${t.widgetName}`,{style:{legend:l.value,tooltip:h.value,label:s.value}});const k=new CustomEvent(`update-style-${t.widgetName}`);k.chartId=t.widgetName,k.options={options:{legend:l.value,tooltip:h.value,label:s.value},seriesOptions:s.value},window.dispatchEvent(k),await e({type:"success",title:"Успішно!",message:"Дані успішно оновлено"})}catch{await e({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}};return N.onMounted(()=>{const k=new URLSearchParams(window.top.location.search);i.value=k.get("dashboard")}),(k,P)=>{const z=N.resolveComponent("VsButton"),F=N.resolveComponent("VsForm");return N.openBlock(),N.createElementBlock("div",yce,[N.createVNode(z,{class:"ml-[10px] mb-[10px]",type:"plain",onClick:d},{default:N.withCtx(()=>P[3]||(P[3]=[N.createTextVNode(" Зберегти ")])),_:1}),N.createVNode(F,{scheme:n,modelValue:s.value,"onUpdate:modelValue":P[0]||(P[0]=V=>s.value=V),class:"p-0"},null,8,["modelValue"]),N.createVNode(F,{scheme:a,modelValue:l.value,"onUpdate:modelValue":P[1]||(P[1]=V=>l.value=V),class:"p-0"},null,8,["modelValue"]),N.createVNode(F,{scheme:o,modelValue:h.value,"onUpdate:modelValue":P[2]||(P[2]=V=>h.value=V),class:"p-0"},null,8,["modelValue"])])}}},xce={class:"pt-[10px]"},bce={__name:"vs-editor-form-data",props:{widgetName:{type:String},data:{type:Object,default:()=>{}},columns:{type:Array,default:()=>[]}},emits:["update-dashboard"],setup(r,{emit:e}){var h,f,d,v,m,_,b,S,D,k,P,z,F,V,U,Z,j,K,Q,oe;const{$notify:t}=N.getCurrentInstance().proxy,i=r,n=N.ref(null),a={text:{type:"Text",label:"Text",conditions:["type","==","text"]},x:{type:"radio",label:"X Axis",view:"buttons",style:{size:"xs"},conditions:["type","not_in",["text","table","map"]],options:(f=(h=i.columns)==null?void 0:h.filter(ne=>(ne==null?void 0:ne.type)=="text"||(ne==null?void 0:ne.type)==="date"||(ne==null?void 0:ne.type)==="timestamp without time zone"||(ne==null?void 0:ne.type)==="boolean"||(ne==null?void 0:ne.type)==="integer"))==null?void 0:f.map(({name:ne,type:he})=>({id:ne,label:ne,type:he}))},metric:{type:"radio",label:"Y Axis",view:"buttons",style:{size:"xs"},conditions:["type","not_in",["text","table","map"]],options:[{id:"count",label:"count"},...(v=(d=i.columns)==null?void 0:d.filter(ne=>(ne==null?void 0:ne.type)==="numeric"||(ne==null?void 0:ne.type)==="double precision"))==null?void 0:v.map(({name:ne,type:he})=>({id:ne,label:ne,type:he}))]},groupby:{type:"radio",label:"Groupby",view:"buttons",style:{size:"xs"},options:[{id:"null",label:"null"},...(_=(m=i.columns)==null?void 0:m.filter(ne=>(ne==null?void 0:ne.type)=="text"||(ne==null?void 0:ne.type)==="boolean"||(ne==null?void 0:ne.type)==="integer"))==null?void 0:_.map(({name:ne})=>({id:ne,label:ne}))],conditions:["type","==","bar"]},columns:{type:"checkbox",label:"Columns",style:{size:"xs"},options:(b=i.columns)==null?void 0:b.map(({name:ne})=>ne),conditions:["type","in",["table","map"]]},granularity:{type:"radio",label:"Granularity",options:[{id:"year",label:"year"},{id:"quarter",label:"quarter"},{id:"month",label:"month"},{id:"week",label:"week"}],conditions:["x.type","==","date"]},type:{type:"Text",hidden:!0}},o=N.ref({x:((D=(S=i.data)==null?void 0:S.data)==null?void 0:D.x)||null,metric:((P=(k=i.data)==null?void 0:k.data)==null?void 0:P.metric)||null,columns:((F=(z=i.data)==null?void 0:z.data)==null?void 0:F.columns)||null,granularity:((U=(V=i.data)==null?void 0:V.data)==null?void 0:U.granularity)||null,type:((j=(Z=i.data)==null?void 0:Z.data)==null?void 0:j.type)||((K=i.data)==null?void 0:K.type)||null,groupby:((oe=(Q=i.data)==null?void 0:Q.data)==null?void 0:oe.groupby)||null}),s=async()=>{try{await mr.put(`/bi-dashboard/${n.value}/${i.widgetName}`,{data:o.value});let ne=`/bi-data?dashboard=${n.value}&widget=${i.widgetName}`;Object.entries(o.value).forEach(([fe,ye])=>{ne+=`&${fe}=${ye}`});const he=new CustomEvent(`update-data-${i.widgetName}`);he.filterUrl=ne,window.dispatchEvent(he),await t({type:"success",title:"Успішно!",message:"Дані успішно оновлено"})}catch{await t({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}},l=async()=>{try{let ne=`/bi-data?dashboard=${n.value}&widget=${i.widgetName}`;Object.entries(o.value).forEach(([fe,ye])=>{ne+=`&${fe}=${ye}`});const he=new CustomEvent(`update-data-${i.widgetName}`);he.filterUrl=ne,window.dispatchEvent(he)}catch{await t({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}};return N.watch(o,(ne,he)=>{var Me,Ce;const fe=(Me=Object.entries(ne))==null?void 0:Me.reduce((Oe,[Ue,We])=>We?Oe+We:Oe),ye=(Ce=Object.entries(he))==null?void 0:Ce.reduce((Oe,[Ue,We])=>We?Oe+We:Oe);fe!==ye&&l()},{deep:!0}),N.onMounted(()=>{const ne=new URLSearchParams(window.top.location.search);n.value=ne.get("dashboard")}),(ne,he)=>{const fe=N.resolveComponent("VsButton"),ye=N.resolveComponent("VsForm");return N.openBlock(),N.createElementBlock("div",xce,[N.createVNode(fe,{class:"ml-[10px] mb-[10px]",type:"plain",onClick:s},{default:N.withCtx(()=>he[1]||(he[1]=[N.createTextVNode(" Зберегти ")])),_:1}),N.createVNode(ye,{scheme:a,modelValue:o.value,"onUpdate:modelValue":he[0]||(he[0]=Me=>o.value=Me)},null,8,["modelValue"])])}}},wce={class:"pt-[10px]"},Sce={__name:"vs-editor-form-yaml",props:{yamlValue:{type:null,default:()=>""},widgetName:{type:String},data:{type:Object}},setup(r){const e=N.ref(null),{$notify:t}=N.getCurrentInstance().proxy,i=r,n=(l,{dimensions:h,source:f})=>{const d=l.getOption();(d==null?void 0:d.series)[0];const[,...v]=h||[],m=v.map((_,b)=>({...(d==null?void 0:d.series[b])||{},data:f.map(S=>S[b+1]),name:_}));l==null||l.setOption({...d||{},dataset:{dimensions:h,source:f},series:m,xAxis:{type:"category"},yAxis:{}},!0)},a=l=>{const h=document.getElementById(l);if(!h)return null;const f=sS(h);return f||null},o=N.ref(i.yamlValue),s=async()=>{try{await mr.put(`/bi-dashboard/${e.value}/${i.widgetName}`,{yml:o.value});const l=a(i.widgetName);if(l){const{data:h}=await mr.get(`/bi-data?dashboard=${e.value}&widget=${i.widgetName}`);n(l,h)}await t({type:"success",title:"Успішно!",message:"Дані успішно оновлено"})}catch{await t({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}};return N.onMounted(()=>{const l=new URLSearchParams(window.top.location.search);e.value=l.get("dashboard")}),(l,h)=>{const f=N.resolveComponent("VsButton"),d=N.resolveComponent("VsFormAce");return N.openBlock(),N.createElementBlock("div",wce,[N.createVNode(f,{class:"ml-[10px] mb-[10px]",type:"plain",onClick:s},{default:N.withCtx(()=>h[1]||(h[1]=[N.createTextVNode(" Зберегти ")])),_:1}),N.createVNode(d,{modelValue:o.value,"onUpdate:modelValue":h[0]||(h[0]=v=>o.value=v),value:o.value,fontSize:"12px"},null,8,["modelValue","value"])])}}},Tce={class:"pt-[10px]"},cF={"vs-editor-form-style":_ce,"vs-editor-form-data":bce,"vs-editor-form-yaml":Sce,"vs-editor-form-controls":{__name:"vs-editor-form-controls",props:{widgetName:{type:String},controls:{type:Object,default:()=>{}},columns:{type:Array,default:()=>[]}},emits:["update-dashboard"],setup(r,{emit:e}){var h;const{$notify:t}=N.getCurrentInstance().proxy,i=e,n=r,a=N.ref(null),o={granularity:{ua:"Granularity",type:"checkbox",options:["week","month","quarter","year"]},export:{ua:"Export",type:"Switcher"},groupby:{ua:"Groupby",type:"checkbox",options:(h=n.columns)==null?void 0:h.map(({name:f})=>f)}},s=N.ref(n.controls||{}),l=async()=>{try{await mr.put(`/bi-dashboard/${a.value}/${n.widgetName}`,{controls:s.value}),await t({type:"success",title:"Успішно!",message:"Дані успішно оновлено"}),staticTypes!=null&&staticTypes.includes(s.value.type)&&i("update-dashboard")}catch{await t({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}};return N.onMounted(()=>{const f=new URLSearchParams(window.top.location.search);a.value=f.get("dashboard")}),(f,d)=>{const v=N.resolveComponent("VsButton"),m=N.resolveComponent("VsForm");return N.openBlock(),N.createElementBlock("div",Tce,[N.createVNode(v,{class:"ml-[10px] mb-[10px]",type:"plain",onClick:l},{default:N.withCtx(()=>d[1]||(d[1]=[N.createTextVNode(" Зберегти ")])),_:1}),N.createVNode(m,{scheme:o,modelValue:s.value,"onUpdate:modelValue":d[0]||(d[0]=_=>s.value=_)},null,8,["modelValue"])])}}}},Cce={class:"h-full flex flex-col bg-white shrink-0 !w-[400px] border-l"},Dce={key:0},Ace={class:"border-b flex items-center px-[10px] h-[49px] border-transparent border-solid border-b-gray-200"},Ice={class:"flex gap-2 ml-auto"},Ece={class:"h-[calc(100vh-110px)] overflow-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},Mce={key:0},kce={key:1},Pce={class:"p-4"},Lce={class:"flex justify-end mt-4 gap-x-3"},Rce={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},zce={__name:"vs-editor-forms",props:N.mergeModels({selectedWidgetData:{type:Object,required:!1,default:null},selectedDashboard:{type:String,default:()=>""},currentWidgetData:{type:String,default:()=>""}},{selectedWidget:{},selectedWidgetModifiers:{}}),emits:N.mergeModels(["update-data"],["update:selectedWidget"]),setup(r,{emit:e}){var D,k;const t=(k=(D=N.getCurrentInstance())==null?void 0:D.proxy)==null?void 0:k.$notify,i=e,n=r,a=N.ref(!1),o=N.ref(!0),s=N.ref(!1),l=N.ref({}),h=N.useModel(r,"selectedWidget"),f=["table","text","number","stat","progress","listbar","map","pivot"],d=N.ref("data"),v=async()=>{try{await mr.delete(`/bi-dashboard/${n.selectedDashboard}/${n.selectedWidgetData.name}`);const P=new URL(window.top.location.href);P.searchParams.set("dashboard",n.selectedDashboard),P.searchParams.delete("widget"),window.top.history.pushState({},"",P),i("update-data"),a.value=!1,t({type:"success",title:"Успішно!",message:"Віджет успішно видалено"})}catch(P){console.error(P),t({type:"error",title:"Помилка!",message:"При спробі видалити віджет виникла помилка"})}},m=N.computed(()=>{const P=[{id:"data",label:"Дані"},{id:"style",label:"Стилі"},{id:"yaml",label:"{ }"},{id:"controls",label:"Контролси"}];return P==null?void 0:P.filter(z=>{var F,V,U;return z.id==="style"?!(f!=null&&f.includes(((F=n.selectedWidgetData)==null?void 0:F.type)||((U=(V=n.selectedWidgetData)==null?void 0:V.data)==null?void 0:U.type))):!0})}),_=()=>{var P,z,F;l.value={title:(P=n.selectedWidgetData)==null?void 0:P.title,type:(z=n.selectedWidgetData)==null?void 0:z.type,table:(F=n.selectedWidgetData)==null?void 0:F.table_name},s.value=!0},b=async()=>{try{await mr.put(`/bi-dashboard/${n.selectedDashboard}/${n.selectedWidgetData.name}`,l.value),t({type:"success",title:"Успішно!",message:"Дані успішно змінено"}),await i("update-data"),s.value=!1}catch{t({type:"error",title:"Помилка!",message:"При спробі внести зміни виникла помилка"})}};N.watch(h,P=>{o.value=!1;const z=new URL(window.top.location.href);P?(z.searchParams.set("widget",P),window.top.history.pushState({},"",z)):(z.searchParams.delete("widget"),window.top.history.pushState({},"",z)),setTimeout(()=>o.value=!0)});const S={title:{type:"text",ua:"Заголовок",placeholder:"Заголовок",validators:["required"]},type:{type:"radio",view:"buttons",validators:["required"],slots:{label:'<div style="width: 120px; height:160px" class="flex gap-[12px] flex-col"><img class="block" style="height: calc(100% - 40px)" :src="`https://cdn.softpro.ua/data/icons/bi/${id}.png`"/><span class="font-[500]">{{ label }}</span></div>'},options:[{label:"Bar",id:"bar"},{label:"Funnel",id:"funnel"},{label:"Line",id:"line"},{label:"List bar",id:"listbar"},{label:"Number",id:"number"},{label:"Pie",id:"pie"},{label:"Donut",id:"donut"},{label:"Pivot",id:"pivot"},{label:"Table",id:"table"},{label:"Progress",id:"progress"},{label:"Stat",id:"stat"},{label:"Text",id:"text"},{label:"Map",id:"map"}]},table:{type:"text",ua:"Таблиця",placeholder:"Таблиця"}};return(P,z)=>{var K,Q,oe,ne,he,fe,ye,Me;const F=N.resolveComponent("VsFormRadio"),V=N.resolveComponent("VsPopover"),U=N.resolveComponent("VsConfirm"),Z=N.resolveComponent("VsForm"),j=N.resolveComponent("VsDialog");return N.openBlock(),N.createElementBlock(N.Fragment,null,[N.createElementVNode("div",Cce,[r.selectedWidgetData?(N.openBlock(),N.createElementBlock("div",Dce,[N.createElementVNode("div",Ace,[o.value?(N.openBlock(),N.createBlock(F,{key:0,options:m.value,modelValue:d.value,"onUpdate:modelValue":z[0]||(z[0]=Ce=>d.value=Ce),view:"buttons"},null,8,["options","modelValue"])):(N.openBlock(),N.createBlock(F,{key:1,options:m.value,modelValue:d.value,"onUpdate:modelValue":z[1]||(z[1]=Ce=>d.value=Ce),view:"buttons"},null,8,["options","modelValue"])),N.createElementVNode("div",Ice,[N.createVNode(V,{placement:"left",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{onClick:_,class:"h-[30px] w-[30px] rounded-full bg-gray-100 flex items-center justify-center duration-300 hover:bg-gray-200"},[N.createVNode(uF,{class:"h-[16px]"})])]),default:N.withCtx(()=>[z[10]||(z[10]=N.createTextVNode(" Редагувати віджет "))]),_:1}),N.createVNode(V,{placement:"left",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{class:"h-[30px] w-[30px] rounded-full bg-gray-100 flex items-center justify-center duration-300 hover:bg-gray-200",onClick:z[2]||(z[2]=Ce=>a.value=!0)},[N.createVNode(N.unref(sF),{class:"h-[16px]"})])]),default:N.withCtx(()=>[z[11]||(z[11]=N.createTextVNode(" Видалити віджет "))]),_:1})])]),N.createElementVNode("div",Ece,[o.value&&r.currentWidgetData?(N.openBlock(),N.createElementBlock("div",Mce,[(N.openBlock(),N.createBlock(N.resolveDynamicComponent(N.unref(cF)["vs-editor-form-"+d.value]),{widgetName:(K=r.selectedWidgetData)==null?void 0:K.name,yamlValue:((Q=r.selectedWidgetData)==null?void 0:Q.yml)||"",data:r.selectedWidgetData,controls:(oe=r.selectedWidgetData)==null?void 0:oe.controls,columns:(ne=r.currentWidgetData)==null?void 0:ne.columns,onUpdateDashboard:z[3]||(z[3]=Ce=>P.$emit("update-dashboard"))},null,40,["widgetName","yamlValue","data","controls","columns"]))])):(N.openBlock(),N.createElementBlock("div",kce,[(N.openBlock(),N.createBlock(N.resolveDynamicComponent(N.unref(cF)["vs-editor-form-"+d.value]),{widgetName:(he=r.selectedWidgetData)==null?void 0:he.name,yamlValue:((fe=r.selectedWidgetData)==null?void 0:fe.yml)||"",data:r.selectedWidgetData,controls:(ye=r.selectedWidgetData)==null?void 0:ye.controls,columns:(Me=r.currentWidgetData)==null?void 0:Me.columns,onUpdateDashboard:z[4]||(z[4]=Ce=>P.$emit("update-dashboard"))},null,40,["widgetName","yamlValue","data","controls","columns"]))])),N.createVNode(U,{visible:a.value,"onUpdate:visible":z[6]||(z[6]=Ce=>a.value=Ce),title:"Ви впевнені?"},{default:N.withCtx(()=>[N.createElementVNode("div",Pce,[z[12]||(z[12]=N.createElementVNode("p",{class:"mt-1 text-gray-500 dark:text-neutral-500"}," Ви впевнені, що хочете видалити цей віджет? ",-1)),N.createElementVNode("div",Lce,[N.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-200 rounded-lg shadow-sm gap-x-2 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:z[5]||(z[5]=Ce=>a.value=!1)}," Скасувати "),N.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-semibold text-white bg-red-500 border border-transparent rounded-lg gap-x-2 hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:v}," Так, я впевнена(ий) ")])])]),_:1},8,["visible"])])])):(N.openBlock(),N.createBlock(jC,{key:1,title:"Оберіть один з віджетів",text:""}))]),N.createVNode(j,{visible:s.value,"onUpdate:visible":z[9]||(z[9]=Ce=>s.value=Ce),title:"Редагувати віджет"},{footer:N.withCtx(()=>[N.createElementVNode("div",Rce,[N.createElementVNode("button",{style:{border:"1px solid #000"},onClick:z[8]||(z[8]=Ce=>s.value=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),N.createElementVNode("button",{onClick:b,class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:N.withCtx(()=>[N.createVNode(Z,{scheme:S,modelValue:l.value,"onUpdate:modelValue":z[7]||(z[7]=Ce=>l.value=Ce)},null,8,["modelValue"])]),_:1},8,["visible"])],64)}}},Nce={},Oce={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-plus"};function Bce(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("svg",Oce,e[0]||(e[0]=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M12 5l0 14"},null,-1),N.createElementVNode("path",{d:"M5 12l14 0"},null,-1)]))}const Vce=dr(Nce,[["render",Bce]]),Fce={class:"mb-4 overflow-auto scrollbar max-h-96"},$ce={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},Gce={__name:"vs-editor-create-widget",props:{columns:{type:Array,default:()=>[]},selectedDashboard:String},emits:"update-data",setup(r,{emit:e}){var f;const t=(f=N.getCurrentInstance().proxy)==null?void 0:f.$notify,i=e,n=r,a=N.ref(!1),o=N.ref({}),s=N.ref(),l=async()=>{try{await s.value.doValidation(),await mr.post(`/bi-dashboard/${n.selectedDashboard}`,o.value),await t({type:"success",title:"Успішно!",message:"Віджет успішно створено"}),await i("update-data"),o.value={},a.value=!1}catch{t({type:"error",title:"Помилка!",message:"При спробі створити віджет сталася помилка"})}},h=N.computed(()=>{var d,v,m,_;return{title:{type:"text",label:"Widget title",placeholder:"Widget title",validators:["required"]},x:{type:"radio",label:"X Axis",view:"buttons",style:{size:"xs"},validators:["required"],options:(v=(d=n.columns)==null?void 0:d.filter(b=>(b==null?void 0:b.type)=="text"||(b==null?void 0:b.type)==="date"||(b==null?void 0:b.type)==="timestamp without time zone"||(b==null?void 0:b.type)==="boolean"||(b==null?void 0:b.type)==="integer"))==null?void 0:v.map(({name:b,type:S})=>({id:b,label:b,type:S}))},metric:{type:"radio",label:"Y Axis",view:"buttons",validators:["required"],style:{size:"xs"},options:[{id:"count",label:"count"},...(_=(m=n.columns)==null?void 0:m.filter(b=>(b==null?void 0:b.type)==="numeric"||(b==null?void 0:b.type)==="double precision"))==null?void 0:_.map(({name:b,type:S})=>({id:b,label:b,type:S}))]},col:{type:"radio",label:"Columns count",validators:["required"],options:[{id:1,label:1},{id:2,label:2},{id:3,label:3},{id:4,label:4},{id:6,label:6},{id:9,label:9},{id:12,label:12}]},type:{type:"radio",view:"buttons",validators:["required"],slots:{label:'<div style="width: 120px; height:160px" class="flex gap-[12px] flex-col"><img class="block" style="height: calc(100% - 40px)" :src="`https://cdn.softpro.ua/data/icons/bi/${id}.png`"/><span class="font-[500]">{{ label }}</span></div>'},options:[{label:"Bar",id:"bar"},{label:"Funnel",id:"funnel"},{label:"Line",id:"line"},{label:"List bar",id:"listbar"},{label:"Number",id:"number"},{label:"Pie",id:"pie"},{label:"Donut",id:"donut"},{label:"Pivot",id:"pivot"},{label:"Table",id:"table"},{label:"Progress",id:"progress"},{label:"Stat",id:"stat"},{label:"Text",id:"text"},{label:"Map",id:"map"}]}}});return(d,v)=>{const m=N.resolveComponent("VsPopover"),_=N.resolveComponent("VsForm"),b=N.resolveComponent("VsDialog");return N.openBlock(),N.createElementBlock("div",null,[N.createVNode(m,{placement:"right",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("div",null,[N.createElementVNode("button",{class:"z-50 flex items-center justify-center h-[50px] !w-[50px] text-2xl text-white transition-colors bg-blue-500 rounded-full cursor-pointer hover:bg-blue-700",onClick:v[0]||(v[0]=S=>a.value=!0)},[N.createVNode(Vce,{height:"20",width:"20"})])])]),default:N.withCtx(()=>[v[4]||(v[4]=N.createTextVNode(" Створити віджет "))]),_:1}),N.createVNode(b,{visible:a.value,"onUpdate:visible":v[3]||(v[3]=S=>a.value=S),title:"Створити віджет"},{footer:N.withCtx(()=>[N.createElementVNode("div",$ce,[N.createElementVNode("button",{style:{border:"1px solid #000"},onClick:v[2]||(v[2]=S=>a.value=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),N.createElementVNode("button",{onClick:l,class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Створити ")])]),default:N.withCtx(()=>[N.createElementVNode("div",Fce,[N.createVNode(_,{ref_key:"form",ref:s,scheme:h.value,modelValue:o.value,"onUpdate:modelValue":v[1]||(v[1]=S=>o.value=S)},null,8,["scheme","modelValue"])])]),_:1},8,["visible"])])}}},Uce={},Hce={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-box-left-stretch"};function Wce(r,e){return N.openBlock(),N.createElementBlock("svg",Hce,e[0]||(e[0]=[N.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z"></path><path d="M9 17h-2"></path><path d="M13 12h-6"></path><path d="M11 7h-4"></path>',5)]))}const Zce=dr(Uce,[["render",Wce]]),jce={},qce={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-filter"};function Xce(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("svg",qce,e[0]||(e[0]=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227z"},null,-1)]))}const Yce={components:{deleteIcon:sF,editIcon:uF,IconGrid:Zce,IconFilter:dr(jce,[["render",Xce]])},watch:{dashboardData(r){var t,i;if(this.formEditValue={title:r==null?void 0:r.title,description:r==null?void 0:r.description,table_name:r==null?void 0:r.table_name,db:r==null?void 0:r.db,public:r==null?void 0:r.public,words:r==null?void 0:r.words},!((t=r==null?void 0:r.panels)!=null&&t.length))return[];const e=(i=r==null?void 0:r.panels)==null?void 0:i.map(n=>{var s,l;const{title:a="",type:o=""}=((l=(s=r==null?void 0:r.widgets)==null?void 0:s.find(h=>(h==null?void 0:h.name)===(n==null?void 0:n.widget)))==null?void 0:l.data)||{};return{title:a,type:o,...n}});this.formGridValue={panels:e},this.formFilterValue={filters:(r==null?void 0:r.filters)||null}}},data(){return{isDeleteConfirm:!1,isFormEdit:!1,isFormGrid:!1,isFormFilter:!1,formEditValue:{},formGridValue:{},formFilterValue:{},editDashboardScheme:[{type:"Text",key:"title",label:"Заголовок",validators:["required"]},{type:"Text",key:"description",label:"Опис"},{type:"Text",key:"table_name",validators:["required"],label:"Назва таблиці"},{type:"Text",key:"words",label:"Ключові слова"},{type:"Text",key:"db",label:"База даних",original:{type:"Text",ua:"Назва",col:8}},{type:"Switcher",key:"public",label:"Публічний",original:{type:"Text",ua:"Назва",col:8}}],editGridScheme:[{type:"DataTable",ua:"Панелі",key:"panels",editable:!1,addition:!1,colModel:[{name:"title",ua:"Назва",type:"Text",key:"col"},{name:"type",ua:"Тип",type:"Text",key:"col",disabled:!0},{name:"widget",type:"Text",ua:"Назва",key:"widget",hiddenCol:!0},{name:"col",ua:"Кількість стовпчиків",type:"Text",key:"col"}]}],editFilterScheme:[{name:"filters",type:"DataTable",colModel:[{ua:"Підпис",type:"Text",key:"label"},{ua:"Тип",type:"Text",key:"type"}]}]}},props:{selected:{type:String,default:()=>""},dashboardData:{type:Object,default:()=>{}},selectedWidgetData:{type:Object,default:()=>{}}},methods:{async editDashboard(){var r,e;try{(e=(r=this.$refs)==null?void 0:r.formEdit)==null||e.doValidation(),await mr.put(`/bi-dashboard/${this.selected}`,this.formEditValue),await this.$notify({title:"Успішно!",type:"success",message:"Дані успішно оновлено"}),this.isFormEdit=!1,await this.$emit("update-editor")}catch{this.$notify({title:"Помилка!",type:"error",message:"при спробі оновити дані виникла помилка"})}},async editDashboardGrid(){var r,e;try{(e=(r=this.$refs)==null?void 0:r.formGrid)==null||e.doValidation(),await mr.put(`/bi-dashboard/${this.selected}`,{...this.formEditValue,...this.formGridValue}),await this.$notify({title:"Успішно!",type:"success",message:"Дані успішно оновлено"}),this.isFormGrid=!1,await this.$emit("update-editor")}catch{this.$notify({title:"Помилка!",type:"error",message:"При спробі оновити дані виникла помилка"})}},async editDashboardFilters(){var r,e;try{(e=(r=this.$refs)==null?void 0:r.formFilter)==null||e.doValidation(),await mr.put(`/bi-dashboard/${this.selected}`,{...this.formEditValue,...this.formGridValue,...this.formFilterValue}),await this.$notify({title:"Успішно!",type:"success",message:"Дані успішно оновлено"}),this.isFormFilter=!1,await this.$emit("update-editor")}catch{this.$notify({title:"Помилка!",type:"error",message:"При спробі оновити дані виникла помилка"})}},async deleteDashboard(){try{await mr.delete(`/bi-dashboard/${this.selected}`);const r=new URL(window.top.location.href);r.searchParams.delete("dashboard"),r.searchParams.delete("widget"),window.history.pushState({},"",r),await this.$notify({title:"Успішно!",type:"success",message:"Дашборд видалено успішно"}),this.isDeleteConfirm=!1,await this.$emit("update:selected",null),await this.$emit("update-editor")}catch{this.$notify({title:"Помилка!",type:"error",message:"При спробі видалити дашборд виникла помилка"})}}}},Kce={class:"bg-white h-[49px] min-h-[49px] mb-[8px] flex justify-between px-[10px] py-[15px] items-center border-b border-b-solid border-b-gray-200"},Jce={class:"flex items-center gap-2 text-center truncate grow lg:text-start"},Qce={class:"block text-sm font-semibold leading-4 text-gray-800 truncate"},ehe={class:"text-[12px] text-gray-500"},the={key:0,class:"flex"},rhe={class:"pr-[5px] flex items-center gap-[8px] mr-[5px] flex"},ihe={class:"p-4"},nhe={class:"flex justify-end mt-4 gap-x-3"},ahe={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},ohe={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},she={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"};function lhe(r,e,t,i,n,a){var _,b,S,D,k;const o=N.resolveComponent("IconFilter"),s=N.resolveComponent("VsPopover"),l=N.resolveComponent("IconGrid"),h=N.resolveComponent("editIcon"),f=N.resolveComponent("deleteIcon"),d=N.resolveComponent("VsConfirm"),v=N.resolveComponent("VsForm"),m=N.resolveComponent("VsDialog");return N.openBlock(),N.createElementBlock(N.Fragment,null,[N.createElementVNode("div",Kce,[N.createElementVNode("div",null,[N.createElementVNode("div",Jce,[N.createElementVNode("span",Qce,N.toDisplayString((_=t.dashboardData)==null?void 0:_.title)+" "+N.toDisplayString((b=t.selectedWidgetData)!=null&&b.title?` / ${(S=t.selectedWidgetData)==null?void 0:S.title}`:""),1),N.createElementVNode("span",ehe,N.toDisplayString((D=t.selectedWidgetData)!=null&&D.table_name?`${(k=t.selectedWidgetData)==null?void 0:k.table_name}`:""),1)])]),t.selected?(N.openBlock(),N.createElementBlock("div",the,[N.createElementVNode("div",rhe,[N.createVNode(s,{placement:"left",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{class:"h-[30px] w-[30px] rounded-full bg-gray-100 flex items-center justify-center duration-300 hover:bg-gray-200",onClick:e[0]||(e[0]=P=>n.isFormFilter=!0)},[N.createVNode(o,{class:"h-[16px] text-gray-500"})])]),default:N.withCtx(()=>[e[19]||(e[19]=N.createTextVNode(" Редагувати фільтри "))]),_:1}),N.createVNode(s,{placement:"left",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{class:"h-[30px] w-[30px] rounded-full bg-gray-100 flex items-center justify-center duration-300 hover:bg-gray-200",onClick:e[1]||(e[1]=P=>n.isFormGrid=!0)},[N.createVNode(l,{class:"h-[16px] text-gray-500"})])]),default:N.withCtx(()=>[e[20]||(e[20]=N.createTextVNode(" Редагувати структуру дашборду "))]),_:1}),N.createVNode(s,{placement:"left",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{class:"h-[30px] w-[30px] rounded-full bg-gray-100 flex items-center justify-center duration-300 hover:bg-gray-200",onClick:e[2]||(e[2]=P=>n.isFormEdit=!0)},[N.createVNode(h,{class:"h-[16px]"})])]),default:N.withCtx(()=>[e[21]||(e[21]=N.createTextVNode(" Редагувати дашборд "))]),_:1}),N.createVNode(s,{placement:"right",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{onClick:e[3]||(e[3]=P=>n.isDeleteConfirm=!0),class:"h-[30px] w-[30px] rounded-full bg-gray-100 flex items-center justify-center duration-300 hover:bg-gray-200"},[N.createVNode(f,{class:"h-[16px]"})])]),default:N.withCtx(()=>[e[22]||(e[22]=N.createTextVNode(" Видалити дашборд "))]),_:1})])])):N.createCommentVNode("",!0)]),N.createVNode(d,{visible:n.isDeleteConfirm,"onUpdate:visible":e[6]||(e[6]=P=>n.isDeleteConfirm=P),size:"small",title:"Ви впевнені?"},{default:N.withCtx(()=>[N.createElementVNode("div",ihe,[e[23]||(e[23]=N.createElementVNode("p",{class:"mt-1 text-gray-500 dark:text-neutral-500"}," Ви впевнені, що хочете видалити цей дашборд? ",-1)),N.createElementVNode("div",nhe,[N.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-200 rounded-lg shadow-sm gap-x-2 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[4]||(e[4]=P=>n.isDeleteConfirm=!1)}," Скасувати "),N.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-semibold text-white bg-red-500 border border-transparent rounded-lg gap-x-2 hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:e[5]||(e[5]=(...P)=>a.deleteDashboard&&a.deleteDashboard(...P))}," Так, я впевнена(ий) ")])])]),_:1},8,["visible"]),N.createVNode(m,{visible:n.isFormEdit,"onUpdate:visible":e[10]||(e[10]=P=>n.isFormEdit=P),title:"Редагувати дашборд"},{footer:N.withCtx(()=>[N.createElementVNode("div",ahe,[N.createElementVNode("button",{style:{border:"1px solid #000"},onClick:e[8]||(e[8]=P=>n.isFormEdit=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),N.createElementVNode("button",{onClick:e[9]||(e[9]=(...P)=>a.editDashboard&&a.editDashboard(...P)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:N.withCtx(()=>[N.createVNode(v,{ref:"formEdit",scheme:n.editDashboardScheme,modelValue:n.formEditValue,"onUpdate:modelValue":e[7]||(e[7]=P=>n.formEditValue=P)},null,8,["scheme","modelValue"])]),_:1},8,["visible"]),N.createVNode(m,{visible:n.isFormGrid,"onUpdate:visible":e[14]||(e[14]=P=>n.isFormGrid=P),title:"Редагувати структуру дашборду"},{footer:N.withCtx(()=>[N.createElementVNode("div",ohe,[N.createElementVNode("button",{style:{border:"1px solid #000"},onClick:e[12]||(e[12]=P=>n.isFormGrid=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),N.createElementVNode("button",{onClick:e[13]||(e[13]=(...P)=>a.editDashboardGrid&&a.editDashboardGrid(...P)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:N.withCtx(()=>[N.createVNode(v,{ref:"formgrid",scheme:n.editGridScheme,modelValue:n.formGridValue,"onUpdate:modelValue":e[11]||(e[11]=P=>n.formGridValue=P)},null,8,["scheme","modelValue"])]),_:1},8,["visible"]),N.createVNode(m,{visible:n.isFormFilter,"onUpdate:visible":e[18]||(e[18]=P=>n.isFormFilter=P),title:"Редагувати фільтри"},{footer:N.withCtx(()=>[N.createElementVNode("div",she,[N.createElementVNode("button",{style:{border:"1px solid #000"},onClick:e[16]||(e[16]=P=>n.isFormFilter=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),N.createElementVNode("button",{onClick:e[17]||(e[17]=(...P)=>a.editDashboardFilters&&a.editDashboardFilters(...P)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:N.withCtx(()=>[N.createVNode(v,{ref:"formFilter",scheme:n.editFilterScheme,modelValue:n.formFilterValue,"onUpdate:modelValue":e[15]||(e[15]=P=>n.formFilterValue=P)},null,8,["scheme","modelValue"])]),_:1},8,["visible"])],64)}const uhe=dr(Yce,[["render",lhe]]),che={class:"relative flex-grow h-full"},hhe={class:"grid flex-grow w-full grid-cols-12 gap-4 p-[10px] h-[calc(100%-120px)] overflow-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},fhe=dr({__name:"vs-editor",props:{prefix:String,customClass:{type:String,default:()=>"w-screen h-screen"}},setup(r){const e=r;mr.defaults.baseURL=e.prefix||"/api";const t=N.ref(""),i=N.ref(""),n=N.ref(null),a=N.ref(null),o=async()=>{if(!t.value){n.value=null;return}try{const{data:l}=await mr.get(`/bi-dashboard/${t.value}`);n.value=l}catch(l){console.error(l)}},s=N.computed(()=>{var l,h,f;return(f=Array.isArray((l=n.value)==null?void 0:l.widgets)?(h=n.value)==null?void 0:h.widgets:[])==null?void 0:f.find(d=>(d==null?void 0:d.name)===i.value)});return N.watch(t,(l,h)=>{var d,v,m;h&&(i.value="");const f=new URL(window.top.location.href);l?((d=f==null?void 0:f.searchParams)==null||d.set("dashboard",l),(m=(v=window.top)==null?void 0:v.history)==null||m.pushState({},"",f),o()):(f==null||f.searchParams.delete("dashboard"),f==null||f.searchParams.delete("widget"))}),N.onMounted(()=>{const l=new URLSearchParams(window.top.location.search);t.value=l.get("dashboard"),i.value=l.get("widget"),o()}),(l,h)=>{var f;return N.openBlock(),N.createElementBlock("div",{class:N.normalizeClass(["flex w-full h-full",[r.customClass]])},[N.createVNode(lce,{ref:"MenuNativeRouting",prefix:r.prefix,selectedDashboard:t.value,"onUpdate:selectedDashboard":h[0]||(h[0]=d=>t.value=d)},null,8,["prefix","selectedDashboard"]),N.createElementVNode("div",che,[N.createVNode(uhe,{selected:t.value,"onUpdate:selected":h[1]||(h[1]=d=>t.value=d),dashboardData:n.value,selectedWidgetData:s.value,prefix:r.prefix,onUpdateEditor:h[2]||(h[2]=()=>{var d;o(),(d=l.$refs.MenuNativeRouting)==null||d.getList()})},null,8,["selected","dashboardData","selectedWidgetData","prefix"]),N.createElementVNode("div",hhe,[n.value?(N.openBlock(!0),N.createElementBlock(N.Fragment,{key:1},N.renderList(n.value.panels,(d,v)=>{var m;return N.openBlock(),N.createElementBlock("div",{key:v,class:N.normalizeClass([`col-span-${d.col||12}`,"flex flex-col gap-[10px]"])},[(m=d.widgets)!=null&&m.length?(N.openBlock(!0),N.createElementBlock(N.Fragment,{key:0},N.renderList(d.widgets,_=>(N.openBlock(),N.createBlock(qv,{onClick:b=>i.value=_,"onUpdate:currentWidgetData":h[3]||(h[3]=b=>a.value=b),key:_,dashboard:t.value,widget:_,selectedWidget:i.value,"dashboard-widgets":n.value.widgets,class:N.normalizeClass({"border border-blue-500":i.value===_})},null,8,["onClick","dashboard","widget","selectedWidget","dashboard-widgets","class"]))),128)):(N.openBlock(),N.createBlock(qv,{key:1,onClick:_=>i.value=d.widget,"onUpdate:currentWidgetData":h[4]||(h[4]=_=>a.value=_),class:N.normalizeClass(["max-h-[460px] flex flex-col",{"border border-blue-500":i.value===d.widget}]),dashboard:t.value,widget:d.widget,selectedWidget:i.value,"dashboard-widgets":n.value.widgets},null,8,["onClick","class","dashboard","widget","selectedWidget","dashboard-widgets"]))],2)}),128)):(N.openBlock(),N.createBlock(jC,{key:0,class:"col-span-12"}))]),t.value?(N.openBlock(),N.createBlock(Gce,{key:0,class:"bottom-[10px] left-[10px] absolute",columns:(f=n.value)==null?void 0:f.columns,selectedDashboard:t.value,onUpdateData:o},null,8,["columns","selectedDashboard"])):N.createCommentVNode("",!0)]),N.createVNode(zce,{selectedWidget:i.value,"onUpdate:selectedWidget":h[5]||(h[5]=d=>i.value=d),selectedWidgetData:s.value,currentWidgetData:a.value,selectedDashboard:t.value,onUpdateData:o},null,8,["selectedWidget","selectedWidgetData","currentWidgetData","selectedDashboard"])],2)}}},[["__scopeId","data-v-63d54538"]]),hF={install:r=>{r.component("VsBar",FC),r.component("VsLine",GC),r.component("VsPie",$C),r.component("VsStat",UC),r.component("VsDashboard",oF),r.component("VsWidget",qv),r.component("VsProgressBar",HC),r.component("VsListBar",WC),r.component("VsPivotTable",qC),r.component("VsEditor",fhe)},components:{VsBar:FC,VsLine:GC,VsPie:$C,VsStat:UC,VsDashboard:oF,VsProgressBar:HC,VsListBar:WC,VsPivotTable:qC,VsWidget:qv}};typeof window<"u"&&(window.v3bi=hF);const dhe={name:"VsNumber",mixins:[da],data(){return{number:""}},computed:{formattedNumber(){return y6(this.number)},prefix(){var r,e;return(r=this.styleData)!=null&&r.prefix?(e=this.styleData)==null?void 0:e.prefix:""}},watch:{sourceData:{async handler(){this.getNumber()},deep:!0}},async mounted(){await this.getData(),this.getNumber()},methods:{onChangedData(){try{this.sourceData&&this.getNumber()}catch(r){console.error(r)}},async getNumber(){var r,e;try{this.number=((e=this.sourceData[0])==null?void 0:e[Object.keys((r=this.sourceData)==null?void 0:r[0])])||0}catch(t){console.error(t)}}}},phe={class:"text-lg lg:text-xl xl:text-2xl text-gray-800 h-[32px] flex items-center"};function vhe(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",phe,N.toDisplayString(a.prefix)+N.toDisplayString(a.formattedNumber),1)}const ghe=Object.freeze(Object.defineProperty({__proto__:null,default:dr(dhe,[["render",vhe]])},Symbol.toStringTag,{value:"Module"}));function XC(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let nh=XC();function fF(r){nh=r}const dF=/[&<>"']/,mhe=new RegExp(dF.source,"g"),pF=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,yhe=new RegExp(pF.source,"g"),_he={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},vF=r=>_he[r];function ka(r,e){if(e){if(dF.test(r))return r.replace(mhe,vF)}else if(pF.test(r))return r.replace(yhe,vF);return r}const xhe=/(^|[^\[])\^/g;function ri(r,e){let t=typeof r=="string"?r:r.source;e=e||"";const i={replace:(n,a)=>{let o=typeof a=="string"?a:a.source;return o=o.replace(xhe,"$1"),t=t.replace(n,o),i},getRegex:()=>new RegExp(t,e)};return i}function gF(r){try{r=encodeURI(r).replace(/%25/g,"%")}catch{return null}return r}const Xv={exec:()=>null};function mF(r,e){const t=r.replace(/\|/g,(a,o,s)=>{let l=!1,h=o;for(;--h>=0&&s[h]==="\\";)l=!l;return l?"|":" |"}),i=t.split(/ \|/);let n=0;if(i[0].trim()||i.shift(),i.length>0&&!i[i.length-1].trim()&&i.pop(),e)if(i.length>e)i.splice(e);else for(;i.length<e;)i.push("");for(;n<i.length;n++)i[n]=i[n].trim().replace(/\\\|/g,"|");return i}function Yv(r,e,t){const i=r.length;if(i===0)return"";let n=0;for(;n<i;){const a=r.charAt(i-n-1);if(a===e&&!t)n++;else if(a!==e&&t)n++;else break}return r.slice(0,i-n)}function bhe(r,e){if(r.indexOf(e[1])===-1)return-1;let t=0;for(let i=0;i<r.length;i++)if(r[i]==="\\")i++;else if(r[i]===e[0])t++;else if(r[i]===e[1]&&(t--,t<0))return i;return-1}function yF(r,e,t,i){const n=e.href,a=e.title?ka(e.title):null,o=r[1].replace(/\\([\[\]])/g,"$1");if(r[0].charAt(0)!=="!"){i.state.inLink=!0;const s={type:"link",raw:t,href:n,title:a,text:o,tokens:i.inlineTokens(o)};return i.state.inLink=!1,s}return{type:"image",raw:t,href:n,title:a,text:ka(o)}}function whe(r,e){const t=r.match(/^(\s+)(?:```)/);if(t===null)return e;const i=t[1];return e.split(`
101
101
  `).map(n=>{const a=n.match(/^\s+/);if(a===null)return n;const[o]=a;return o.length>=i.length?n.slice(i.length):n}).join(`
102
102
  `)}class B0{constructor(e){ci(this,"options");ci(this,"rules");ci(this,"lexer");this.options=e||nh}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const i=t[0].replace(/^(?: {1,4}| {0,3}\t)/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?i:Yv(i,`
103
103
  `)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const i=t[0],n=whe(i,t[3]||"");return{type:"code",raw:i,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let i=t[2].trim();if(/#$/.test(i)){const n=Yv(i,"#");(this.options.pedantic||!n||/ $/.test(n))&&(i=n.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:i,tokens:this.lexer.inline(i)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Yv(t[0],`
@@ -46470,19 +46470,19 @@ const g_ = /* @__PURE__ */ qt(_j, [["render", Dj]]), Cj = /* @__PURE__ */ Object
46470
46470
  }
46471
46471
  }, Ej = {
46472
46472
  "bi-bar": rr(() => Promise.resolve().then(() => Vq)),
46473
- "bi-number": rr(() => import("./vs-number-UWj-bst_.js")),
46474
- "bi-text": rr(() => import("./vs-text-FouEorvE.js")),
46473
+ "bi-number": rr(() => import("./vs-number-CkGMYlM9.js")),
46474
+ "bi-text": rr(() => import("./vs-text-FI-Cowvo.js")),
46475
46475
  "bi-listbar": rr(() => Promise.resolve().then(() => Cj)),
46476
46476
  "bi-pie": rr(() => Promise.resolve().then(() => Gq)),
46477
- "bi-donut": rr(() => import("./vs-donut-BU63imSx.js")),
46477
+ "bi-donut": rr(() => import("./vs-donut-DMLTafsi.js")),
46478
46478
  "bi-line": rr(() => Promise.resolve().then(() => Uq)),
46479
46479
  "bi-stat": rr(() => Promise.resolve().then(() => oj)),
46480
46480
  "bi-pivot": rr(() => Promise.resolve().then(() => $K)),
46481
46481
  "bi-progress": rr(() => Promise.resolve().then(() => mj)),
46482
- "bi-funnel": rr(() => import("./vs-funnel-bar-DYNnxgrn.js")),
46483
- "bi-map": rr(() => import("./vs-map-BpeilpO5.js")),
46484
- "bi-cluster": rr(() => import("./vs-map-cluster-B2LSExjW.js")),
46485
- "bi-table": rr(() => import("./vs-table-DGuWaiP9.js"))
46482
+ "bi-funnel": rr(() => import("./vs-funnel-bar-DGFJ8biS.js")),
46483
+ "bi-map": rr(() => import("./vs-map-CigyNoPm.js")),
46484
+ "bi-cluster": rr(() => import("./vs-map-cluster-DS-uWqwB.js")),
46485
+ "bi-table": rr(() => import("./vs-table-D8yc91eR.js"))
46486
46486
  }, Pj = { class: "flex items-center space-x-2" }, Rj = /* @__PURE__ */ yP({
46487
46487
  __name: "vs-bi-switch",
46488
46488
  props: /* @__PURE__ */ fc({
@@ -46710,9 +46710,8 @@ function Kj(r, t, e, a, n, i) {
46710
46710
  "onUpdate:widgetData": t[2] || (t[2] = (v) => n.widgetData = v),
46711
46711
  ref: "chart",
46712
46712
  dashboard: e.dashboard,
46713
- prefix: e.prefix,
46714
46713
  widget: e.widget
46715
- }, null, 40, ["currentWidget", "widgetData", "dashboard", "prefix", "widget"])) : (Y(), me(u, {
46714
+ }, null, 40, ["currentWidget", "widgetData", "dashboard", "widget"])) : (Y(), me(u, {
46716
46715
  key: 1,
46717
46716
  class: "w-full h-full"
46718
46717
  }))
@@ -1,5 +1,5 @@
1
1
  import { openBlock as Rt, createElementBlock as jt, createElementVNode as Ye, createStaticVNode as Wp, resolveComponent as $o, Fragment as Da, createVNode as qo, createBlock as Ku, Teleport as Ju, toDisplayString as ms, createCommentVNode as rn, renderList as Hl, normalizeStyle as Hu, normalizeClass as ch, withDirectives as Kp, vShow as Jp } from "vue";
2
- import { _ as gs } from "./import-file-P2S3-jSU.js";
2
+ import { _ as gs } from "./import-file-DvlE1tB-.js";
3
3
  const Yp = {}, Qp = {
4
4
  class: "shrink-0 size-3",
5
5
  xmlns: "http://www.w3.org/2000/svg",
@@ -1,4 +1,4 @@
1
- import { _ as y, c as D, a as c, P as h, b as l, i as g } from "./import-file-P2S3-jSU.js";
1
+ import { _ as y, c as D, a as c, P as h, b as l, i as g } from "./import-file-DvlE1tB-.js";
2
2
  import { openBlock as b, createElementBlock as x } from "vue";
3
3
  const _ = {
4
4
  name: "VsPie",
@@ -1,4 +1,4 @@
1
- import { _ as n, c, d as h, a as l, b as o, i as d } from "./import-file-P2S3-jSU.js";
1
+ import { _ as n, c, d as h, a as l, b as o, i as d } from "./import-file-DvlE1tB-.js";
2
2
  import { openBlock as p, createElementBlock as u } from "vue";
3
3
  const m = {
4
4
  name: "VsFunnelBar",
@@ -1,5 +1,5 @@
1
- import { l as M, m as w } from "./map-component-mixin-D156eanj.js";
2
- import { _ as b, c as y } from "./import-file-P2S3-jSU.js";
1
+ import { l as M, m as w } from "./map-component-mixin-CBw16E04.js";
2
+ import { _ as b, c as y } from "./import-file-DvlE1tB-.js";
3
3
  import { resolveComponent as i, openBlock as u, createElementBlock as V, createElementVNode as d, createBlock as _, createCommentVNode as v, createVNode as c } from "vue";
4
4
  const $ = {
5
5
  mixins: [y, M, w],
@@ -1,5 +1,5 @@
1
- import { l as v, m as k, p as L } from "./map-component-mixin-D156eanj.js";
2
- import { _ as C, c as I } from "./import-file-P2S3-jSU.js";
1
+ import { l as v, m as k, p as L } from "./map-component-mixin-CBw16E04.js";
2
+ import { _ as C, c as I } from "./import-file-DvlE1tB-.js";
3
3
  import { resolveComponent as e, openBlock as g, createElementBlock as S, createElementVNode as u, createBlock as _, createCommentVNode as $, createVNode as i } from "vue";
4
4
  const z = {
5
5
  mixins: [I, v, k],
@@ -1,4 +1,4 @@
1
- import { _ as c, c as o, f as n } from "./import-file-P2S3-jSU.js";
1
+ import { _ as c, c as o, f as n } from "./import-file-DvlE1tB-.js";
2
2
  import { openBlock as i, createElementBlock as m, toDisplayString as s } from "vue";
3
3
  const u = {
4
4
  name: "VsNumber",
@@ -1,4 +1,4 @@
1
- import { _ as m, c as f, d as _, a as b } from "./import-file-P2S3-jSU.js";
1
+ import { _ as m, c as f, d as _, a as b } from "./import-file-DvlE1tB-.js";
2
2
  import { openBlock as a, createElementBlock as r, createElementVNode as s, Fragment as n, renderList as c, toDisplayString as d } from "vue";
3
3
  const x = {
4
4
  name: "VsTable",
@@ -1,7 +1,7 @@
1
1
  var ge = Object.defineProperty;
2
2
  var ke = (c, e, t) => e in c ? ge(c, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[e] = t;
3
3
  var k = (c, e, t) => ke(c, typeof e != "symbol" ? e + "" : e, t);
4
- import { _ as de, c as xe } from "./import-file-P2S3-jSU.js";
4
+ import { _ as de, c as xe } from "./import-file-DvlE1tB-.js";
5
5
  import { openBlock as V, createElementBlock as J, createCommentVNode as be } from "vue";
6
6
  function Q() {
7
7
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/bi",
3
- "version": "1.0.36",
3
+ "version": "1.0.37",
4
4
  "description": "BI data visualization module",
5
5
  "main": "dist/bi.js",
6
6
  "browser": "dist/bi.umd.cjs",