evui 3.4.211 → 3.4.212

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.
@@ -25,4 +25,4 @@ Component that was made reactive: `,e=ue(e)),function(c,d=null,h=null,f=0,m=null
25
25
  8.705L5.41508 8L7.00008 9.585Z" fill="#D8D8D8" fill-opacity="0.09"></path><path d="M7.00008 3.915L8.58508 5.5L9.29008 4.795L7.00008 2.5L4.70508
26
26
  4.795L5.41508 5.5L7.00008 3.915Z" fill="#DEE2E6"></path></svg>`,1)])])):i.createCommentVNode("",!0)}const Mr=le(k0,[["render",v0]]),T0={name:"GridOptionButton"},B0={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function D0(e,t,n,o,s,l){return i.openBlock(),i.createElementBlock("svg",B0,[...t[0]||(t[0]=[i.createElementVNode("circle",{cx:"6.49805",cy:"11.998",r:"1.5",transform:"rotate(-90 6.49805 11.998)",fill:"#ADB5BD"},null,-1),i.createElementVNode("circle",{cx:"11.998",cy:"11.998",r:"1.5",transform:"rotate(-90 11.998 11.998)",fill:"#ADB5BD"},null,-1),i.createElementVNode("path",{d:`M17.498 10.498C18.3265 10.498 18.998 11.1696 18.998 11.998C18.998
27
27
  12.8265 18.3265 13.498 17.498 13.498C16.6696 13.498 15.998 12.8265
28
- 15.998 11.998C15.998 11.1696 16.6696 10.498 17.498 10.498Z`,fill:"#ADB5BD"},null,-1)])])}const Ns=le(T0,[["render",D0]]),wt=0,mn=1,de=2,to=3,Ls=4,O0=()=>{const{props:e}=i.getCurrentInstance();return{isRenderer:(a={})=>{var r;return!!((r=a==null?void 0:a.render)!=null&&r.use)},getComponentName:(a="")=>{const r=h=>h.charAt(0).toUpperCase()+h.slice(1),c="Renderer";let d="";if(a.indexOf("_")!==-1){const h=a.split("_");for(let f=0;f<h.length;f++)d+=r(h[f])}else d=r(a);return d+c},getConvertValue:(a,r)=>{let c=a.type==="number"||a.type==="float"?Number(r):r;return a.type==="number"?(c=Ht(r),c=c===!1?r:c):a.type==="float"&&(c=c.toFixed(a.decimal??3).replace(/\B(?=(\d{3})+(?!\d))/g,",")),c},getColumnIndex:a=>e.columns.findIndex(r=>r.field===a),setPixelUnit:a=>{let r=a;const c=r.toString().indexOf("px")>=0,d=r.toString().indexOf("%")>=0;return!c&&!d&&(r=`${r}px`),r}}},ii=e=>{var o;const t=((o=e.movedColumns)!=null&&o.length?e.movedColumns:e.originColumns)??[],n=new Map((e.filteredColumns??[]).map(s=>[s.index,s]));return t.map(s=>{const l=n.get(s.index)??{};return{...s,...l}})},R0=e=>{const{scrollInfo:t,stores:n,elementInfo:o,resizeInfo:s,pageInfo:l,summaryScroll:a,getPagingData:r,updatePagingInfo:c,expandedInfo:d}=e,h=g=>{var y,w;const u=o.body,x=s.rowHeight,b=d.detailRowHeight??0;if(u){let I=n.store;l.isClientPaging&&(I=r());const E=((y=d.expandedRows)==null?void 0:y.length)??0,B=((w=d.expandedRows)==null?void 0:w.map(v=>I.findIndex(O=>O[de]===v)))??[],_=I.length*x+E*b;let C=0,S=0;if(E)for(C=0;S+x<u.scrollTop;C++)B.includes(C)&&(S+=b),S+=x;else C=Math.floor(u.scrollTop/x),S=Math.max(C,0)*x;C>I.length-1&&(C=0);let M=0,k=0;if(E)for(let v=C;k<=u.clientHeight;v++)B.includes(v)&&(k+=b),k+=x,M+=1;else M=u.clientHeight>x?Math.ceil(u.clientHeight/x):I.length,k=M*x;const T=C+M+1,R=Math.max(C,0),L=T,N=o.table;n.viewStore=I.slice(R,L),t.hasVerticalScrollBar=M<I.length||u.clientHeight<N.clientHeight,t.vScrollTopHeight=S,t.vScrollBottomHeight=_-k-t.vScrollTopHeight,g&&l.isInfinite&&t.vScrollBottomHeight===0&&(l.prevPage=l.currentPage,l.currentPage=Math.ceil(L/l.perPage)+1,l.startIndex=L,c({onScrollEnd:!0}))}},f=g=>{if(d.useRowDetail&&!d.detailRowHeight){let u=n.store;l.isClientPaging&&(u=r()),n.viewStore=[...u],t.vScrollTopHeight=0,t.vScrollBottomHeight=0}else h(g)},m=()=>{const g=o.header,u=o.body,x=o.table;g.scrollLeft=u.scrollLeft,a.value=u.scrollLeft,t.hasHorizontalScrollBar=u.clientWidth<x.clientWidth};return{updateVScroll:f,updateHScroll:m,onScroll:()=>{const g=o.body,u=g.scrollTop,x=g.scrollLeft,b=t.lastScroll.top,y=t.lastScroll.left,w=x!==y;u!==b&&(g!=null&&g.clientHeight)&&f(!0),w&&m(),t.lastScroll.top=u,t.lastScroll.left=x}}},N0=e=>{const{props:t,emit:n}=i.getCurrentInstance(),{resizeInfo:o,elementInfo:s,checkInfo:l,expandedInfo:a,stores:r,isRenderer:c,updateVScroll:d,updateHScroll:h,contextInfo:f}=e,m=()=>{var y;let x=o.columnWidth,b=0;if(o.adjust){const w=s.body;let I=w.offsetWidth;const E=w.offsetHeight,B=((y=w.querySelector("tr"))==null?void 0:y.offsetHeight)||o.rowHeight,_=I-w.clientWidth,C=r.orderedColumns.reduce((S,M)=>(M.hide||M.hiddenDisplay||(M.width?S.totalWidth+=M.width:S.emptyCount++),S),{totalWidth:f.customContextMenu.length?30:0,emptyCount:0});if(B*t.rows.length>E&&(I-=_),l.useCheckbox.use&&(I-=o.minWidth),a.useRowDetail&&(I-=o.minWidth),x=I-C.totalWidth,x>0){const S=C.emptyCount===0?0:Math.floor(x/C.emptyCount);b=x-S*C.emptyCount,x=C.emptyCount!==0?S:x}else x=o.columnWidth;x=x<o.minWidth?o.minWidth:x,o.columnWidth=x}if(r.orderedColumns.forEach(w=>{const I=c(w)?o.rendererMinWidth:o.minWidth;w.width&&w.width<I&&(w.width=I),!w.width&&!w.hide&&(w.width=x)}),b&&r.orderedColumns.length){let w=r.orderedColumns.length-1,I=r.orderedColumns[w];for(;w>0&&I&&(I.hide||I.hiddenDisplay);)w-=1,I=r.orderedColumns[w];I&&(I.width+=b)}},p=()=>{const x=new Map(t.columns.map(b=>[b.field,b.width]));i.nextTick(()=>{var b,y;o.adjust&&r.orderedColumns.forEach(w=>{const I=w;return I.resized||(I.width=x.get(I.field)??0),I},void 0),m(),(b=s.body)!=null&&b.clientHeight&&d(),(y=s.body)!=null&&y.clientWidth&&h()})};return{calculatedColumn:m,onResize:p,onShow:x=>{x&&p()},onColumnResize:(x,b)=>{b.preventDefault();const y=s.header,w=s.body,I=y.getBoundingClientRect().left,E=y.querySelector(`li[data-index="${x}"]`),B=c(r.orderedColumns[x])?o.rendererMinWidth:o.minWidth,_=E.getBoundingClientRect(),C=s.resizeLine,S=_.left-I+B,M=_.right-I,k=b.clientX,T=_.left-I;w.style.overflow="auto",C.style.left=`${M}px`,o.showResizeLine=!0;const R=N=>{const v=N.clientX-k,O=M+v,D=Math.max(S,O);C.style.left=`${D}px`},L=()=>{const v=parseInt(C.style.left,10)-T;r.orderedColumns[x]&&(r.orderedColumns[x].width=v,r.orderedColumns[x].resized=!0),o.showResizeLine=!1,document.removeEventListener("mousemove",R),p();const O=ii(r);n("resize-column",{column:r.orderedColumns[x],columns:O}),n("change-column-info",{type:"resize",columns:O})};document.addEventListener("mousemove",R),document.addEventListener("mouseup",L,{once:!0})}}},L0=e=>{const{emit:t}=i.getCurrentInstance(),{selectInfo:n,stores:o}=e,s=(d,h)=>{var p;const f=(p=d.target.tagName)==null?void 0:p.toLowerCase();let m={};return f==="td"?m=d.target.dataset:m=d.target.parentNode.dataset,{event:d,rowData:h[de],rowIndex:h[wt],cellName:m.name,cellIndex:m.index}};let l=null,a=-1;return{onRowClick:(d,h,f)=>{var g,u,x;if((g=d.target.parentElement.classList)!=null&&g.contains("row-checkbox-input"))return!1;const m=!!((x=(u=d.target.closest("td"))==null?void 0:u.classList)!=null&&x.contains("row-contextmenu")),p=(b,y,w)=>{if(b==="shift"){const I=h[wt];if(a>-1)for(let E=Math.min(I,a);E<=Math.max(I,a);E++)if(!y)o.originStore[E][to]=!0,a!==E&&n.selectedRow.push(o.originStore[E][de]);else{o.originStore[E][to]=!1;const B=n.selectedRow.indexOf(o.originStore[E][de]);B>-1&&n.selectedRow.splice(B,1)}}else b==="ctrl"&&(y?n.selectedRow.splice(n.selectedRow.indexOf(h[de]),1):n.selectedRow.push(w))};return l&&clearTimeout(l),l=setTimeout(()=>{if(n.useSelect){const b=h[de],y=h[to];h[to]=!h[to];let w="";d.shiftKey?w="shift":d.ctrlKey&&(w="ctrl"),n.multiple&&w?p(w,y,b):f||m?(n.selectedRow=[...n.selectedRow],n.selectedRow.includes(b)||(n.selectedRow=[b])):y?n.selectedRow=[]:n.selectedRow=[b],a=h[wt],t("update:selected",n.selectedRow),t("click-row",s(d,h))}},100),!0},onRowDblClick:(d,h)=>{l&&clearTimeout(l),t("dblclick-row",s(d,h))}}},_0=e=>{const{checkInfo:t,stores:n,pageInfo:o,getPagingData:s}=e,{props:l,emit:a}=i.getCurrentInstance(),r=h=>{const f=n.originStore.findIndex(m=>m[de]===h[de]);f!==-1&&(n.originStore[f][mn]=h[mn])};return{onCheck:(h,f)=>{if(t.useCheckbox.mode==="single"&&t.prevCheckedRow.length&&(t.prevCheckedRow=[],r(t.prevCheckedRow)),f[mn]){t.useCheckbox.mode==="single"?t.checkedRows=[f[de]]:t.checkedRows.push(f[de]);let m=n.store;o.isClientPaging&&(m=s());const p=m.filter(g=>!l.uncheckable.includes(g[de])).filter(g=>!l.disabledRows.includes(g[de])).every(g=>g[mn]);m.length&&p&&(t.isHeaderChecked=!0),t.isHeaderIndeterminate=m.length&&!p}else t.useCheckbox.mode==="single"?t.checkedRows=[]:t.checkedRows.splice(t.checkedRows.indexOf(f[de]),1),t.isHeaderChecked=!1,t.isHeaderIndeterminate=!!(n.store.length&&t.checkedRows.length);t.prevCheckedRow=f.slice(),a("update:checked",t.checkedRows),a("check-row",h,f[wt],f[de])},onCheckAll:h=>{const f=t.isHeaderChecked;let m=n.store;o.isClientPaging&&(m=s()),m.forEach(p=>{const g=l.uncheckable.includes(p[de])||l.disabledRows.includes(p[de]);f?!t.checkedRows.includes(p[de])&&!g&&t.checkedRows.push(p[de]):t.checkedRows.splice(t.checkedRows.indexOf(p[de]),1),g||(p[mn]=f)}),t.isHeaderIndeterminate=!1,a("update:checked",t.checkedRows),a("check-all",h,t.checkedRows)}}},V0=e=>{const{expandedInfo:t}=e,{emit:n}=i.getCurrentInstance();return{onExpanded:(s,l)=>{const a=l[de],r=t.expandedRows.indexOf(a);r===-1?t.expandedRows.push(a):t.expandedRows.splice(r,1),l[Ls]=!l[Ls],n("update:expanded",t.expandedRows),n("expand-row",s,l[de],l[Ls],l[wt])}}},P0=e=>{const{sortInfo:t,stores:n,updatePagingInfo:o}=e,{emit:s}=i.getCurrentInstance(),l=(u=!0)=>u?["asc","desc","init"]:["asc","desc"];function a(){this.orders=l(),this.dequeue=()=>this.orders.shift(),this.enqueue=u=>this.orders.push(u)}const r=(u,x="init")=>{n.orderedColumns.forEach(b=>{b.index===(u==null?void 0:u.index)&&x?b.sortOption={sortType:x}:b.sortOption={sortType:"init"}})},c=()=>{const u=n.originColumns.filter(x=>x.hiddenDisplay||x.hide);u.length&&u.forEach(x=>{x.sortOption={sortType:"init"}})},d=new a,h=(u,x=!0)=>{const{sortType:b}=(u==null?void 0:u.sortOption)||{};t.sortColumn=u,t.sortField=u==null?void 0:u.field,t.sortOrder=b,t.isSorting=!!b,x&&(r(u,b),s("change-column-info",{type:"sort",columns:ii(n)}))},f=(u,x)=>{if(u.sortable===void 0?!0:u.sortable){t.sortColumn=u,t.sortField!==(u==null?void 0:u.field)&&(d.orders=l(),t.sortField=u==null?void 0:u.field),x&&(d.orders=l(),x==="desc"&&(t.sortOrder=d.dequeue(),d.enqueue(t.sortOrder))),t.sortOrder=d.dequeue(),d.enqueue(t.sortOrder),t.isSorting=!0,o({onSort:!0}),c(),r(u,t.sortOrder);const y=ii(n);s("sort-column",{field:t.sortField,order:t.sortOrder,column:t.sortColumn,columns:y}),s("change-column-info",{type:"sort",columns:y})}},m=()=>{var M;const{field:u,index:x}=t.sortColumn||{},b=((M=t.sortFunction)==null?void 0:M[u])??null,y=(k,T)=>k>T?-1:1,w=(k,T)=>k<T?-1:1,I=(k,T)=>(k===null)-(T===null)||Number(T)-Number(k),E=(k,T)=>(k===null)-(T===null)||Number(k)-Number(T);if(t.sortOrder==="init"||!t.sortField&&!t.isSorting){n.store.sort((k,T)=>typeof k[wt]=="number"?w(k[wt],T[wt]):0);return}const B=t.sortColumn.type||"string",_=t.sortOrder==="desc"?y:w,C=t.sortOrder==="desc"?I:E,S=(k,T)=>{var N,v;let R=k[de][x],L=T[de][x];return k[de][x]&&typeof k[de][x]=="object"&&(R=k[de][x][(N=n.originColumns[x])==null?void 0:N.field],L=T[de][x][(v=n.originColumns[x])==null?void 0:v.field]),{aCol:R,bCol:L}};if(b){n.store.sort((k,T)=>{const R=k[de][x],L=T[de][x],N=b(R,L);return t.sortOrder==="desc"?-N:N});return}switch(B){case"string":n.store.sort((k,T)=>{let{aCol:R,bCol:L}=S(k,T);if((!R||typeof R=="string")&&(!L||typeof L=="string")){R=R||"",L=L||"";const N=R.toLowerCase(),v=L.toLowerCase();if(R!==L&&N===v){const O=Array.from(R).findIndex((D,V)=>D!==L[V]);return _(R[O],L[O])}return _(N,v)}return 0});break;case"stringNumber":n.store.sort((k,T)=>{let{aCol:R,bCol:L}=S(k,T);return!R||typeof R=="string"||typeof R=="number"?(R=R===""?null:R,L=L===""?null:L,C(R??null,L??null)):0});break;default:n.store.sort((k,T)=>{const{aCol:R,bCol:L}=S(k,T);return!R||typeof R=="number"||typeof R=="boolean"?C(R??null,L??null):0});break}},p=()=>{var u;return(u=n.orderedColumns)==null?void 0:u.find(x=>(x==null?void 0:x.sortOption)&&l(!1).includes(x.sortOption.sortType))};return{onSort:f,getSortTarget:p,setSort:m,setSortInfo:h,hasSortTarget:()=>!!p()}},A0=e=>{const{props:t}=i.getCurrentInstance(),{columnSettingInfo:n,filterInfo:o,stores:s,checkInfo:l,pageInfo:a,getConvertValue:r,updateVScroll:c,getPagingData:d,updatePagingInfo:h,getColumnIndex:f}=e,m=E=>{let B=0;E.forEach(_=>{const C=l.checkedRows.includes(_[de]);_[mn]=C,B+=C?1:0}),E.length&&(l.isHeaderChecked=E.length===B,l.isHeaderIndeterminate=E.length!==B&&B>0,l.isHeaderUncheckable=E.every(_=>t.uncheckable.includes(_[de])||t.disabledRows.includes(_[de])))},p=(E,B,_)=>{if(typeof E!="string"||B===null)return!1;const C=B==null?void 0:B.toLowerCase(),S=E==null?void 0:E.toLowerCase();let M=C.includes(S);return _&&(_==="start"?M=C.startsWith(S):_==="end"&&(M=C.endsWith(S))),M},g=(E,B)=>{const _=B.comparison,C=B.value;let S=E[de][B.index];(S||S===0)&&(S=`${E[de][B.index]}`);let M;return _==="="?M=(C==null?void 0:C.toLowerCase())===(S==null?void 0:S.toLowerCase()):_==="!="?M=(C==null?void 0:C.toLowerCase())!==(S==null?void 0:S.toLowerCase()):_==="%s%"?M=p(C,S):_==="notLike"?M=!p(C,S):_==="s%"?M=p(C,S,"start"):_==="%s"?M=p(C,S,"end"):_==="isEmpty"?M=S==null||S==="":_==="isNotEmpty"&&(M=!!S),M},u=(E,B,_)=>{const C=B.comparison,S=Number(B.value.replace(/,/g,""));let M=Number(E[de][B.index]),k;return _==="float"&&(M=Number(M.toFixed(3))),C==="="?k=M===S:C===">"?k=M>S:C==="<"?k=M<S:C==="<="?k=M<=S:C===">="?k=M>=S:C==="!="?k=M!==S:C==="isEmpty"?k=M==null||isNaN(M):C==="isNotEmpty"&&(k=!!M||M===0),k},x=(E,B)=>{const _=B.comparison,C=B.value,S=`${E[de][B.index]}`;let M;return _==="="&&(M=S===C),M},b=(E,B,_)=>{let C=B==="string"||B==="stringNumber"?g:u;return B==="boolean"&&(C=x),E.filter(S=>C(S,_,B))||[]},y=()=>{const E=o.filteringItemsByColumn,B=Object.keys(E),_=s.originStore;let C=[],S=!1,M=[];B.forEach((k,T)=>{const R=E[k],L=f(k),N=t.columns[L].type,v=o.columnOperator==="or",O=T>0&&o.columnOperator==="and";R.forEach((D,V)=>{!C.length&&!S?C=b(_,N,{...D,index:L}):O&&D.operator==="or"?V>0?C.push(...b(M,N,{...D,index:L})):C=b(M,N,{...D,index:L}):V===0&&v||V!==0&&D.operator==="or"?C.push(...b(_,N,{...D,index:L})):C=b(C,N,{...D,index:L}),S=!0}),M=JSON.parse(JSON.stringify(C))}),S?s.filterStore=qp(C,JSON.stringify):s.filterStore=_};let w=null;return{onSearch:E=>{w&&clearTimeout(w),w=setTimeout(()=>{o.isSearch=!1,o.searchWord=E,E&&(s.searchStore=s.store.filter(B=>{let _=!1;const C=n.isFilteringColumn?B[de].filter((S,M)=>n.visibleColumnIdx.includes(M)):B[de];for(let S=0;S<s.orderedColumns.length;S++){const M=s.orderedColumns[S]||{};let k=C[M.index]??null;if(M.type=M.type||"string",k!==null&&(k instanceof Array?k=JSON.stringify(k):typeof k=="object"&&(k=k[M.field]),!M.hide&&((M==null?void 0:M.searchable)===void 0||M!=null&&M.searchable)&&(k=r(M,k).toString(),_=k.toLowerCase().includes(E.toString().toLowerCase()),_)))break}return _}),o.isSearch=!0),m(s.store),!E&&a.isClientPaging&&a.prevPage&&(a.currentPage=1,s.pagingStore=d()),h({onSearch:!0}),c()},500)},setFilter:y,setHeaderCheckboxByFilter:m}},z0=e=>{const{contextInfo:t,stores:n,selectInfo:o,onSort:s,filterInfo:l,useGridSetting:a,columnSettingInfo:r,setColumnHidden:c}=e;let d=null;const{emit:h}=i.getCurrentInstance(),f=u=>{d&&clearTimeout(d);const x=[];d=setTimeout(()=>{if(t.customContextMenu.length){const b=t.customContextMenu.map(y=>{const w=y;return w.validate&&(w.disabled=!w.validate(w.itemId,o.selectedRow)),w.selectedRow=o.selectedRow??[],w.contextmenuInfo=o.contextmenuInfo??[],w});x.push(...b)}t.contextMenuItems=x,t.menu.show(u)},200)};return{setContextMenu:f,onContextMenu:u=>{var w,I,E;u.preventDefault();const b=(I=(w=u.target.closest(".row"))==null?void 0:w.dataset)==null?void 0:I.index;let y=null;b&&(y=(E=n.viewStore.find(B=>B[wt]===+b))==null?void 0:E[de]),y&&(o.contextmenuInfo=[y],f(u))},onColumnContextMenu:(u,x)=>{var b,y,w,I,E,B,_,C;if(u.target.className==="column-name"){const S=x.sortable===void 0?!0:x.sortable,M=l.isFiltering&&x.filterable===void 0?!0:x.filterable,k=[{text:((b=t.columnMenuTextInfo)==null?void 0:b.ascending)??"Ascending",iconClass:"ev-icon-allow2-up",disabled:!S,hidden:(y=t.hiddenColumnMenuItem)==null?void 0:y.ascending,click:()=>s(x,"asc")},{text:((w=t.columnMenuTextInfo)==null?void 0:w.descending)??"Descending",iconClass:"ev-icon-allow2-down",disabled:!S,hidden:(I=t.hiddenColumnMenuItem)==null?void 0:I.descending,click:()=>s(x,"desc")},{text:((E=t.columnMenuTextInfo)==null?void 0:E.filter)??"Filter",iconClass:"ev-icon-filter-list",click:()=>{const T=document.documentElement.clientWidth,R=t.columnMenu.menuStyle.clientX,L=t.columnMenu.menuStyle.pageX,N=350;T<R+N&&(t.columnMenu.menuStyle.left=`${L-N}px`),l.filterSettingPosition={top:t.columnMenu.menuStyle.top,left:t.columnMenu.menuStyle.left},l.isShowFilterSetting=!0,l.filteringColumn=x,h("change-column-info",{type:"filter",columns:n.updatedColumns})},disabled:!M,hidden:((B=t.hiddenColumnMenuItem)==null?void 0:B.filter)||!l.isFiltering},{text:((_=t.columnMenuTextInfo)==null?void 0:_.hide)??"Hide",iconClass:"ev-icon-visibility-off",disabled:!a.value||n.orderedColumns.length===1||x.fixed,hidden:((C=t.hiddenColumnMenuItem)==null?void 0:C.hide)||!a.value,click:()=>{c(x.field),h("change-column-status",{columns:n.updatedColumns}),h("change-column-info",{type:"display",columns:n.updatedColumns})}}];if(t.columnMenuItems=[],!S&&!M&&!a.value)return;t.columnMenuItems=k.filter(T=>!T.hidden)}},onGridSettingContextMenu:u=>{const{useDefaultColumnSetting:x,columnSettingTextInfo:b}=r,y={text:(b==null?void 0:b.title)??"Column List",isShowMenu:!0,click:()=>{r.isShowColumnSetting=!0,t.isShowMenuOnClick=!0}};t.customGridSettingContextMenu.length&&(t.gridSettingContextMenuItems=[...t.customGridSettingContextMenu]),x&&t.gridSettingContextMenuItems.push(y),t.gridSettingMenu.show(u)}}},F0=e=>{const{props:t}=i.getCurrentInstance(),{selectInfo:n,checkInfo:o,stores:s,sortInfo:l,elementInfo:a,filterInfo:r,expandedInfo:c,setSort:d,setSortInfo:h,updateVScroll:f,setFilter:m}=e;return{setStore:({rows:g,isMakeIndex:u=!0,isInit:x=!1})=>{var y,w,I;const b=s.orderedColumns.find(E=>(E==null?void 0:E.sortOption)&&["asc","desc"].includes(E.sortOption.sortType));if(u){const E=[];let B=!1;g.forEach((_,C)=>{const S=t.checked.includes(_),M=t.uncheckable.includes(_)||t.disabledRows.includes(_);let k=!1;n.useSelect&&(k=t.selected.includes(_)),!S&&!M&&(B=!0);let T=!1;c.useRowDetail&&(T=t.expanded.includes(_));const R=t.disabledRows.includes(_);E.push([C,S,_,k,T,M,R])}),g.length!==t.checked.length&&(g.length===((y=t.uncheckable)==null?void 0:y.length)||g.length===((w=t.disabledRows)==null?void 0:w.length))&&(B=!0),o.isHeaderChecked=g.length>0?!B:!1,o.isHeaderIndeterminate=B&&!!o.checkedRows.length,o.isHeaderUncheckable=g.every(_=>t.uncheckable.includes(_)||t.disabledRows.includes(_)),s.originStore=E}r.isFiltering&&m(),b&&x&&h(b,!1),l.sortField&&d(),(I=a.body)!=null&&I.clientHeight&&f()}}},H0=e=>{const{emit:t}=i.getCurrentInstance(),{stores:n,pageInfo:o,sortInfo:s,filterInfo:l,elementInfo:a,clearCheckInfo:r}=e,c=()=>{const f=(o.currentPage-1)*o.perPage,m=parseInt(f,10)+parseInt(o.perPage,10);return n.store.slice(f,m)},d=f=>{t("page-change",{eventName:f,pageInfo:{currentPage:o.currentPage,prevPage:o.prevPage,startIndex:o.startIndex,total:o.pageTotal,perPage:o.perPage},sortInfo:{field:s.sortField,order:s.sortOrder},searchInfo:{searchWord:l.searchWord,searchColumns:n.orderedColumns.filter(m=>!m.hide&&((m==null?void 0:m.searchable)===void 0||(m==null?void 0:m.searchable))).map(m=>m.field)}}),o.isInfinite&&(f!=null&&f.onSearch||f!=null&&f.onSort)&&(o.currentPage=1,a.body.scrollTop=0,r())};return{getPagingData:c,updatePagingInfo:d,changePage:f=>{if(o.isClientPaging)if(o.prevPage=f,n.store.length<=o.perPage)n.pagingStore=n.store;else{const m=(o.currentPage-1)*o.perPage,p=parseInt(m,10)+parseInt(o.perPage,10);n.pagingStore=n.store.slice(m,p),a.body.scrollTop=0,o.startIndex=m}d({onChangePage:!0})}}},Er=e=>{const{props:t,emit:n}=i.getCurrentInstance(),{stores:o,columnSettingInfo:s,contextInfo:l,onSearch:a,onResize:r}=e,c=u=>{var x,b,y;if(s.isShowColumnSetting)if(s.columnSettingPosition.columnListMenuWidth=0,l.gridSettingContextMenuItems.length){const w=l.gridSettingContextMenuItems.length-1,I=(y=(b=(x=l.gridSettingMenu)==null?void 0:x.rootMenuList)==null?void 0:b.$el)==null?void 0:y.children[0].children[w].getBoundingClientRect();s.columnSettingPosition.columnListMenuWidth=I.width,s.columnSettingPosition.top=I.top,s.columnSettingPosition.left=I.right}else{const w=u==null?void 0:u.getBoundingClientRect(),I=w==null?void 0:w.height;s.columnSettingPosition.top=(w==null?void 0:w.top)+I,s.columnSettingPosition.left=w==null?void 0:w.right}},d=()=>{o.filteredColumns.length=0,s.isFilteringColumn=!1,s.visibleColumnIdx=[],s.hiddenColumn=""},h=()=>Array.isArray(o.movedColumns)&&o.movedColumns.length?o.movedColumns:o.originColumns||[],f=(u,x)=>{var y;if(!u)return;u.hiddenDisplay=x;const b=(y=o.originColumns)==null?void 0:y.find(w=>w.index===u.index);if(b&&b!==u&&(b.hiddenDisplay=x),Array.isArray(o.movedColumns)){const w=o.movedColumns.find(I=>I.index===u.index);w&&w!==u&&(w.hiddenDisplay=x)}},m=()=>{s.visibleColumnIdx=o.filteredColumns.map(b=>b.index);const u=o.originColumns.filter(b=>!b.hide||b.hiddenDisplay).map(b=>b.index),x=s.visibleColumnIdx;s.isFilteringColumn=x.length!==u.length,t.option.searchValue&&a(t.option.searchValue),r()};return{setPositionColumnSetting:c,initColumnSettingInfo:d,onApplyColumn:u=>{const x=o.orderedColumns.filter(I=>!I.hide&&!I.hiddenDisplay);if(u.length===x.length&&x.every(I=>u.includes(I.field)))return;const y=h(),w=new Set(u);o.filteredColumns=y.filter(I=>{const E=w.has(I.field)||!I.caption;return f(I,!E),E}),s.hiddenColumn="",m(),n("change-column-status",{columns:o.updatedColumns}),n("change-column-info",{type:"display",columns:o.updatedColumns})},setColumnHidden:u=>{const x=o.orderedColumns.filter(y=>!y.hide&&!y.hiddenDisplay);if(x.length===1)return;o.filteredColumns=x.filter(y=>{const w=y.field===u;return f(y,w),!w}),h().forEach(y=>{y.field===u&&f(y,!0)}),s.hiddenColumn=u,m()}}},W0=({stores:e})=>{const{emit:t}=i.getCurrentInstance(),n=r=>{var f;const c=(f=e.movedColumns)!=null&&f.length?[...e.movedColumns]:[...e.originColumns],d=[...r],h=new Set(d.map(m=>m.index));e.movedColumns=c.map(m=>h.has(m.index)?d.shift():m)},o=(r,c)=>{const d=parseInt(r,10),h=parseInt(c,10);if(!Number.isInteger(d)||!Number.isInteger(h))return;const f=[...e.orderedColumns],m=f[d];f.splice(d,1),f.splice(h,0,m),e.filteredColumns.length&&(e.filteredColumns=f),n(f)};return{onDragStart:r=>{r.dataTransfer.setData("text/plain",r.currentTarget.dataset.index)},onDragOver:r=>{r.preventDefault()},onDrop:r=>{r.preventDefault();const c=r.dataTransfer.getData("text/plain"),d=r.target.parentNode.dataset.index;o(c,d),t("change-column-order",{column:e.orderedColumns[d],columns:e.updatedColumns}),t("change-column-info",{type:"order",columns:e.updatedColumns})}}},$0={name:"EvGrid",directives:{clickoutside:Ro,observeVisibility:$i,resize:wn},components:{Toolbar:Kb,GridPagination:pr,GridSummary:wr,ColumnSetting:kr,FilterSetting:w0,GridSortButton:Mr,GridOptionButton:Ns},props:{columns:{type:[Array],default:()=>[]},rows:{type:[Array],default:()=>[]},width:{type:[String,Number],default:"100%"},height:{type:[String,Number],default:"100%"},selected:{type:[Array],default:()=>[]},checked:{type:[Array],default:()=>[]},uncheckable:{type:[Array],default:()=>[]},expanded:{type:[Array],default:()=>[]},disabledRows:{type:[Array],default:()=>[]},option:{type:Object,default:()=>({})}},emits:{"update:selected":null,"update:checked":null,"update:expanded":null,"check-row":null,"check-all":null,"click-row":null,"dblclick-row":null,"page-change":null,"sort-column":null,"expand-row":null,"resize-column":({column:e,columns:t})=>({column:e,columns:t}),"change-column-order":({column:e,columns:t})=>({column:e,columns:t}),"change-column-status":({columns:e})=>({columns:e}),"change-column-info":({type:e,columns:t})=>({type:e,columns:t})},setup(e){var Wr,$r,Xr,Ur,Yr,jr,Gr,Zr,qr;const{isRenderer:a,getComponentName:r,getConvertValue:c,getColumnIndex:d,setPixelUnit:h}=O0(),f=i.ref(null),m=i.computed(()=>{var z,te;return((te=(z=e.option)==null?void 0:z.useGridSetting)==null?void 0:te.use)||!1}),p=i.computed(()=>e.option.showHeader??!0),g=i.computed(()=>{var z;return((z=e.option)==null?void 0:z.useSummary)||!1}),u=i.computed(()=>{var z;return((z=e.option.style)==null?void 0:z.stripe)||!1}),x=i.computed(()=>{var z;return((z=e.option.style)==null?void 0:z.border)||""}),b=i.computed(()=>{var z;return((z=e.option.style)==null?void 0:z.highlight)??-1}),y=i.computed(()=>e.option.emptyText??"No records"),w=e.option.rowMinHeight||35,I=i.ref(0),E=i.reactive({body:null,header:null,table:null,resizeLine:null,"grid-wrapper":null}),B=i.reactive({isSearch:!1,searchWord:"",isFiltering:i.computed(()=>e.option.useFilter??!1),isShowFilterSetting:!1,filterSettingPosition:{left:0,top:0},filteringColumn:null,filteringItemsByColumn:{},columnOperator:"and"}),_=i.reactive({isShowColumnSetting:!1,isFilteringColumn:!1,visibleColumnIdx:[],hiddenColumn:"",columnSettingPosition:{top:0,left:0,columnListMenuWidth:0},useDefaultColumnSetting:i.computed(()=>{var z,te;return((te=(z=e.option)==null?void 0:z.useGridSetting)==null?void 0:te.useDefaultColumnSetting)??!0}),columnSettingTextInfo:{title:(($r=(Wr=e.option)==null?void 0:Wr.useGridSetting)==null?void 0:$r.columnMenuText)??"Column List",search:((Ur=(Xr=e.option)==null?void 0:Xr.useGridSetting)==null?void 0:Ur.searchText)??"Search",empty:((jr=(Yr=e.option)==null?void 0:Yr.useGridSetting)==null?void 0:jr.emptyText)??"No records",ok:((Zr=(Gr=e.option)==null?void 0:Gr.useGridSetting)==null?void 0:Zr.okBtnText)??"OK"}}),C=i.reactive({viewStore:[],originStore:[],pagingStore:[],searchStore:[],filterStore:[],store:i.computed(()=>{const z=B.isFiltering?C.filterStore:C.originStore;return B.isSearch?C.searchStore:z}),filteredColumns:[],movedColumns:[],originColumns:i.computed(()=>e.columns.map((z,te)=>{var Ce;return{index:te,hiddenDisplay:!1,...z,width:isFinite(z.width)?z.width:void 0,sortOption:{sortType:((Ce=z==null?void 0:z.sortOption)==null?void 0:Ce.sortType)||"init"}}})),orderedColumns:i.computed(()=>{const z=C.movedColumns.length?C.movedColumns:C.originColumns;return C.filteredColumns.length?C.filteredColumns:z}),updatedColumns:i.computed(()=>ii(C))}),S=i.reactive({usePage:i.computed(()=>{var z;return((z=e.option.page)==null?void 0:z.use)||!1}),useClient:((qr=e.option.page)==null?void 0:qr.useClient)||!1,isInfinite:i.computed(()=>{var z;return((z=e.option.page)==null?void 0:z.isInfinite)||!1}),startIndex:0,prevPage:0,currentPage:0,pageTotal:i.computed(()=>{var z,te;return(z=e.option.page)!=null&&z.useClient?C.store.length:(te=e.option.page)==null?void 0:te.total}),perPage:i.computed(()=>{var z;return((z=e.option.page)==null?void 0:z.perPage)||20}),visiblePage:i.computed(()=>{var z;return((z=e.option.page)==null?void 0:z.visiblePage)||8}),order:i.computed(()=>{var z;return((z=e.option.page)==null?void 0:z.order)||"center"}),showPageInfo:i.computed(()=>{var z;return((z=e.option.page)==null?void 0:z.showPageInfo)||!1}),isClientPaging:i.computed(()=>S.useClient&&S.usePage&&!S.isInfinite),isHighlight:!1,highlightPage:0}),M=i.reactive({prevCheckedRow:[],isHeaderChecked:!1,isHeaderUncheckable:!1,isHeaderIndeterminate:!1,checkedRows:e.checked,useCheckbox:i.computed(()=>e.option.useCheckbox||{})}),k=i.reactive({expandedRows:e.expanded,useRowDetail:i.computed(()=>{var z,te;return((te=(z=e.option)==null?void 0:z.rowDetail)==null?void 0:te.use)??!1}),detailRowHeight:i.computed(()=>{var z,te;return(te=(z=e.option)==null?void 0:z.rowDetail)==null?void 0:te.detailRowHeight})}),T=i.reactive({lastScroll:{top:0,left:0},vScrollTopHeight:0,vScrollBottomHeight:0,hasVerticalScrollBar:!1,hasHorizontalScrollBar:!1}),R=i.reactive({contextmenuInfo:e.contextmenuInfo,selectedRow:e.selected,useSelect:i.computed(()=>{var z,te;return((te=(z=e.option)==null?void 0:z.useSelection)==null?void 0:te.use)??!0}),multiple:i.computed(()=>{var z,te;return((te=(z=e.option)==null?void 0:z.useSelection)==null?void 0:te.multiple)??!1})}),L=i.reactive({isSorting:!1,sortField:"",sortOrder:"",sortColumn:{},sortFunction:e.option.customAscFunction??{}}),N=i.reactive({menu:null,contextMenuItems:[],contextMenuClass:e.option.customContextMenuClass||"",columnMenu:null,columnMenuItems:[],columnMenuTextInfo:e.option.columnMenuText||{},hiddenColumnMenuItem:e.option.hiddenColumnMenuItem||{},customContextMenu:e.option.customContextMenu||[],gridSettingMenu:null,gridSettingContextMenuItems:[],customGridSettingContextMenu:i.computed(()=>{var z,te;return((te=(z=e.option)==null?void 0:z.useGridSetting)==null?void 0:te.customContextMenu)||[]}),isShowMenuOnClick:!1}),v=i.reactive({minWidth:40,rendererMinWidth:80,iconWidth:42,showResizeLine:!1,adjust:e.option.adjust||!1,columnWidth:e.option.columnWidth||80,scrollWidth:e.option.scrollWidth||17,rowHeight:i.computed(()=>e.option.rowHeight>w?e.option.rowHeight:w),gridWidth:i.computed(()=>e.width?h(e.width):"100%"),gridHeight:i.computed(()=>e.height?h(e.height):"100%")}),O=()=>{M.checkedRows=[],M.isHeaderChecked=!1,M.isHeaderIndeterminate=!1,C.store.forEach(z=>{z[1]=!1})},D=()=>{R.selectedRow=[],C.store.forEach(z=>{z[3]=!1})},V=()=>{C.store.forEach(z=>{z[4]=!1}),k.expandedRows=[]},{getPagingData:P,updatePagingInfo:A,changePage:F}=H0({stores:C,pageInfo:S,sortInfo:L,filterInfo:B,elementInfo:E,clearCheckInfo:O}),X=i.ref(0),{updateVScroll:U,updateHScroll:H,onScroll:$}=R0({scrollInfo:T,stores:C,elementInfo:E,resizeInfo:v,pageInfo:S,summaryScroll:X,expandedInfo:k,getPagingData:P,updatePagingInfo:A}),{onCheck:j,onCheckAll:K}=_0({checkInfo:M,stores:C,pageInfo:S,getPagingData:P}),{onExpanded:q}=V0({expandedInfo:k}),{onSort:Q,getSortTarget:J,setSort:ee,setSortInfo:G,hasSortTarget:ne}=P0({sortInfo:L,stores:C,updatePagingInfo:A}),{onSearch:Z,setFilter:re,setHeaderCheckboxByFilter:me}=A0({columnSettingInfo:_,filterInfo:B,stores:C,checkInfo:M,pageInfo:S,getConvertValue:c,updateVScroll:U,getPagingData:P,updatePagingInfo:A,getColumnIndex:d}),{setStore:ae}=F0({selectInfo:R,checkInfo:M,stores:C,sortInfo:L,elementInfo:E,filterInfo:B,expandedInfo:k,setSort:ee,setSortInfo:G,updateVScroll:U,setFilter:re}),{calculatedColumn:fe,onResize:ke,onShow:jt,onColumnResize:Gt}=N0({resizeInfo:v,elementInfo:E,checkInfo:M,expandedInfo:k,stores:C,isRenderer:a,updateVScroll:U,updateHScroll:H,contextInfo:N}),{setPositionColumnSetting:mt,initColumnSettingInfo:ho,onApplyColumn:fo,setColumnHidden:uo}=Er({stores:C,columnSettingInfo:_,contextInfo:N,onSearch:Z,onResize:ke}),{setContextMenu:Zt,onContextMenu:Ps,onColumnContextMenu:As,onGridSettingContextMenu:ri}=z0({contextInfo:N,stores:C,selectInfo:R,useGridSetting:m,filterInfo:B,columnSettingInfo:_,setColumnHidden:uo,onSort:Q}),{onRowClick:ci,onRowDblClick:di}=L0({selectInfo:R,stores:C}),{onDragStart:hi,onDragOver:fi,onDrop:ui}=W0({stores:C}),mi=z=>{N.gridSettingContextMenuItems.length=0,N.customGridSettingContextMenu.length?ri(z):_.isShowColumnSetting=!0},qt=z=>{var te,Ce,gt,Kt,mo,kt,Je,gi,pi,Kr;z.type==="wheel"&&((te=N.menu)==null||te.hide(z)),z.type==="scroll"&&!((Ce=z.target.classList)!=null&&Ce.contains("table-body"))&&!((Kt=(gt=z.target.offsetParent)==null?void 0:gt.classList)!=null&&Kt.contains("ev-select-dropbox"))&&!((kt=(mo=z.target.offsetParent)==null?void 0:mo.classList)!=null&&kt.contains("ev-grid-column-setting"))&&!((gi=(Je=z.target.offsetParent)==null?void 0:Je.classList)!=null&&gi.contains("ev-text-field-wrapper"))&&(B.isShowFilterSetting=!1,_.isShowColumnSetting=!1,N.isShowMenuOnClick=!1,(pi=N.columnMenu)==null||pi.hide(z),(Kr=N.gridSettingMenu)==null||Kr.hide())};i.onMounted(()=>{fe(),ae({rows:e.rows,isInit:!0}),document.addEventListener("wheel",qt,{capture:!1}),document.addEventListener("scroll",qt,{capture:!0})}),i.onUnmounted(()=>{document.removeEventListener("wheel",qt,{capture:!1}),document.removeEventListener("scroll",qt,{capture:!0})}),i.onActivated(()=>{ke()}),i.onUpdated(()=>{var z;I.value=((z=E["grid-wrapper"])==null?void 0:z.offsetWidth)/1.5||0}),i.watch(()=>_.isShowColumnSetting,z=>{var te;if(!z){(te=N.gridSettingMenu)==null||te.hide();return}mt(f.value)}),i.watch(()=>e.columns,()=>{ne()?G(J()):(G(J()),ee()),B.filteringColumn=null,B.filteringItemsByColumn={},C.filterStore=[],ae({rows:[],isMakeIndex:!1}),ho(),C.movedColumns.length=0},{deep:!0}),i.watch(()=>L.isSorting,z=>{z&&(ae({rows:C.originStore,isMakeIndex:!1}),L.isSorting=!z,S.isClientPaging&&(S.currentPage=1,C.pagingStore=P(),O()))}),i.watch(()=>e.rows,z=>{ae({rows:z}),B.isSearch&&Z(B.searchWord),ke()},{deep:!0}),i.watch(()=>e.uncheckable,()=>{ae({rows:e.rows})},{deep:!0}),i.watch(()=>e.checked,z=>{M.checkedRows=z}),i.watch(()=>e.disabledRows,()=>{C.store.length&&C.store.forEach(z=>{z[6]=e.disabledRows.includes(z[2])})},{deep:!0}),i.watch(()=>M.checkedRows,z=>{M.isHeaderChecked=!1;let te=C.store;S.isClientPaging&&(te=P()),te.length&&(te.forEach(Ce=>{Ce[1]=z.includes(Ce[2])}),M.isHeaderChecked=z.length===te.length),U()}),i.watch(()=>e.selected,z=>{R.useSelect&&(R.selectedRow=z)}),i.watch(()=>R.selectedRow,z=>{R.useSelect&&(C.store.forEach(te=>{te[3]=z.includes(te[2])&&!e.disabledRows.includes(te[2])}),U())}),i.watch(()=>b.value,async z=>{if(await i.nextTick(),z>=0){if(S.usePage&&!S.isInfinite&&(S.highlightPage=Math.ceil(z/S.perPage)||1,S.highlightPage!==S.currentPage)){S.currentPage=S.highlightPage,S.isHighlight=!0;return}E.body.scrollTop=v.rowHeight*b.value}}),i.watch(()=>M.useCheckbox.mode,()=>{O()}),i.watch(()=>R.useSelect,()=>{D()}),i.watch(()=>R.multiple,()=>{D()}),i.watch(()=>e.checked.length,z=>{z||O()}),i.watch(()=>e.expanded.length,z=>{z||V(),U()}),i.watch(()=>[e.option.columnWidth,v.gridWidth],async()=>{await i.nextTick(),v.columnWidth=e.option.columnWidth;const z=E["grid-wrapper"];z.style.width=v.gridWidth,z.style.height=v.gridHeight,C.orderedColumns.map(te=>{var gt;const Ce=te;return!((gt=e.columns[te.index])!=null&&gt.width)&&!Ce.resized&&(Ce.width=0),Ce}),ke()}),i.watch(()=>e.option.searchValue,z=>{z!==void 0&&(Z((z==null?void 0:z.value)??z),S.isClientPaging&&(O(),D()))},{immediate:!0}),i.watch(()=>{var z;return(z=e.option.page)==null?void 0:z.currentPage},z=>{var Ce;const te=z||1;S.currentPage=(Ce=e.option.page)!=null&&Ce.isInfinite?1:te},{immediate:!0}),i.watch(()=>S.currentPage,(z,te)=>{i.nextTick(()=>{F(te),S.isClientPaging&&z!==te&&(O(),D()),U(),z===S.highlightPage&&S.isHighlight&&(E.body.scrollTop=v.rowHeight*b.value,S.isHighlight=!S.isHighlight)})});const gn=i.reactive({boxTop:0,boxLeft:0}),W=i.ref(null),oe=i.ref(!1),he=i.ref(!1),xe=i.ref(null),Me=i.ref({}),Ve=i.reactive({caption:"",field:""}),Xe=i.ref([]),aw=[{name:"AND",value:"and"},{name:"OR",value:"or"}],zs=i.ref(0),rw=({caption:z,field:te},Ce)=>{if(Ve.caption=z,Ve.field=te,Xe.value=Ce,(Ce==null?void 0:Ce.length)>1){oe.value=!0;const gt=W.value.getBoundingClientRect().left,Kt=window.pageYOffset+W.value.getBoundingClientRect().top+W.value.getBoundingClientRect().height;gn.boxTop=`${Kt}px`,gn.boxLeft=`${gt}px`}},cw=()=>{C.filterStore=[],ae({rows:[],isMakeIndex:!1})},Fs=async z=>{var Kt,mo;z&&he.value&&(zs.value=0);const te=(Kt=W.value)==null?void 0:Kt.getElementsByClassName("filtering-items__item"),Ce=[];let gt=0;if(te){for(let kt=0;kt<te.length;kt++){const Je=te[kt];Je.classList.remove("non-display");const gi=(mo=W.value.getBoundingClientRect())==null?void 0:mo.width,{width:pi}=Je.getBoundingClientRect();gt+=pi+10,gi-150<=gt&&!Je.classList.contains("filtering-items__item--count")?(zs.value++,Ce.push(Je),Me.value={...Me.value,[Je.dataset.field]:Se(B.filteringItemsByColumn[Je.dataset.field])}):delete Me.value[Je.dataset.field]}te.forEach(kt=>{const Je=Ce.includes(kt);kt.classList.toggle("non-display",Je)})}},dw=async(z,te)=>{te!=null&&te.length?(B.filteringItemsByColumn[z]=te,he.value=!0):(delete Me.value[z],delete B.filteringItemsByColumn[z]),await i.nextTick(),Fs(!0),B.isShowFilterSetting=!1,C.filterStore=[],ae({rows:[],isMakeIndex:!1}),me(C.filterStore)};let Hs=null;const hw=()=>{Hs&&clearTimeout(Hs),Hs=setTimeout(()=>{he.value=!he.value,Fs(he.value)},150)},fw=()=>{B.filteringColumn=null,B.filteringItemsByColumn={},Me.value={},C.filterStore=[],ae({rows:[],isMakeIndex:!1})},uw=i.computed(()=>{var z;return{width:`${I.value}px`,top:`${((z=W.value)==null?void 0:z.getBoundingClientRect().height)||0}px`}}),mw=z=>{const te=B.filteringItemsByColumn[z];return te==null?void 0:te[te.length-1]},gw=()=>{const z=document.createElement("div");z.id="ev-grid-filtering-items-modal",z.setAttribute("style","position: absolute; top: 0; left: 0;"),document.getElementById("ev-grid-filtering-items-modal")||document.body.appendChild(z)};return i.onBeforeMount(()=>gw()),{idColIndex:i.computed(()=>{var z;return(z=C.orderedColumns.find(te=>te.field==="id"))==null?void 0:z.index}),summaryScroll:X,showHeader:p,stripeStyle:u,borderStyle:x,highlightIdx:b,useSummary:g,useGridSetting:m,toolbarRef:f,stores:C,emptyText:y,...i.toRefs(E),...i.toRefs(C),...i.toRefs(B),...i.toRefs(T),...i.toRefs(S),...i.toRefs(v),...i.toRefs(R),...i.toRefs(M),...i.toRefs(k),...i.toRefs(L),...i.toRefs(N),...i.toRefs(_),isRenderer:a,getComponentName:r,getConvertValue:c,getColumnIndex:d,setPixelUnit:h,updateVScroll:U,updateHScroll:H,onScroll:$,calculatedColumn:fe,onResize:ke,onShow:jt,onColumnResize:Gt,onRowClick:ci,onRowDblClick:di,onCheck:j,onCheckAll:K,onExpanded:q,onSort:Q,setSort:ee,setStore:ae,setContextMenu:Zt,onContextMenu:Ps,onSearch:Z,setGridSetting:mi,onApplyColumn:fo,onColumnContextMenu:As,filteringItemsWidth:I,isShowColumnFilteringItems:he,operatorItems:aw,selectedFilteringItems:Xe,selectedFilteringColumn:Ve,filteringItemsRef:W,isShowFilteringItemsBox:oe,filteringItemsStyle:uw,hiddenFilteringItemsCount:zs,...i.toRefs(gn),hiddenFilteringItemsRef:xe,hiddenFilteringItemsByColumn:Me,removeAllFiltering:fw,onExpandFilteringItems:hw,setColumnFilteringItems:Fs,onChangeOperator:cw,onApplyFilter:dw,onClickFilteringItem:rw,getFilteringItemByField:mw,onDragStart:hi,onDragOver:fi,onDrop:ui,ROW_DISABLED_INDEX:6}}},X0={key:0,class:"filtering-items filtering-items--used"},U0={key:1,ref:"filteringItemsRef",class:"filtering-items"},Y0=["data-field","onClick"],j0={class:"filtering-items__item--title"},G0=["title"],Z0={key:1,class:"filtering-items__item--value"},q0=["onClick"],K0={class:"filtering-items__item--title"},J0=["title"],Q0={key:1,class:"filtering-items__item--value"},eC={class:"column-list"},tC=["data-index"],nC=["title","onClick"],oC=["onClick"],iC=["onMousedown"],sC={ref:"table"},lC=["data-index","disabled","onClick","onContextmenu","onDblclick"],aC=["data-name","data-index","disabled"],rC={key:0},cC=["title"],dC=["disabled"],hC=["disabled"],fC={key:0},uC=["colspan"],mC={key:0},gC={class:"is-empty"},pC={ref:"resizeLine",class:"table-resize-line"};function yC(e,t,n,o,s,l){var I;const a=i.resolveComponent("ev-icon"),r=i.resolveComponent("ev-select"),c=i.resolveComponent("grid-option-button"),d=i.resolveComponent("toolbar"),h=i.resolveComponent("ev-checkbox"),f=i.resolveComponent("grid-sort-button"),m=i.resolveComponent("ev-context-menu"),p=i.resolveComponent("grid-summary"),g=i.resolveComponent("grid-pagination"),u=i.resolveComponent("filter-setting"),x=i.resolveComponent("column-setting"),b=i.resolveDirective("clickoutside"),y=i.resolveDirective("resize"),w=i.resolveDirective("observe-visibility");return i.openBlock(),i.createElementBlock(i.Fragment,null,[e.$slots.toolbar||o.useGridSetting?(i.openBlock(),i.createElementBlock("div",{key:0,ref:"toolbarRef",class:"toolbar-wrapper",style:i.normalizeStyle(`width: ${e.gridWidth};`)},[i.createVNode(d,null,{toolbarWrapper:i.withCtx(()=>[i.createElementVNode("div",{class:"filtering",style:i.normalizeStyle({width:`${o.filteringItemsWidth}px`})},[e.isFiltering&&!Object.keys(e.filteringItemsByColumn).length?(i.openBlock(),i.createElementBlock("div",X0,[i.createVNode(a,{icon:"ev-icon-filter-list"}),t[18]||(t[18]=i.createElementVNode("span",null,"Filter",-1))])):i.createCommentVNode("",!0),e.isFiltering&&Object.keys(e.filteringItemsByColumn).length?(i.openBlock(),i.createElementBlock("div",U0,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(Object.keys(e.filteringItemsByColumn),(E,B)=>{var _,C,S,M;return i.openBlock(),i.createElementBlock(i.Fragment,{key:B},[B===0?(i.openBlock(),i.createElementBlock("div",{key:0,class:"filtering-items__item filtering-items__item--filter",onClick:t[0]||(t[0]=i.withModifiers((...k)=>o.onExpandFilteringItems&&o.onExpandFilteringItems(...k),["stop"]))},[i.createVNode(a,{icon:"ev-icon-filter-list",class:"filtering-items-expand"}),i.createElementVNode("span",null," Filter ("+i.toDisplayString(Object.keys(e.filteringItemsByColumn).length)+") ",1),i.createVNode(a,{class:"filtering-items__item--remove",icon:"ev-icon-s-close",style:{"margin-left":"0"},onClick:i.withModifiers(o.removeAllFiltering,["stop"])},null,8,["onClick"])])):i.createCommentVNode("",!0),B===1?(i.openBlock(),i.createBlock(r,{key:1,modelValue:e.columnOperator,"onUpdate:modelValue":t[1]||(t[1]=k=>e.columnOperator=k),items:o.operatorItems,class:"filtering-items__item--operator",onChange:o.onChangeOperator},null,8,["modelValue","items","onChange"])):i.createCommentVNode("",!0),i.createElementVNode("div",{class:"filtering-items__item non-display","data-field":E,onClick:i.withModifiers(k=>{var T;return o.onClickFilteringItem({caption:(T=o.getFilteringItemByField(E))==null?void 0:T.caption,field:E},e.filteringItemsByColumn[E])},["stop"])},[i.createElementVNode("span",j0,i.toDisplayString((_=o.getFilteringItemByField(E))==null?void 0:_.caption)+" "+i.toDisplayString((C=o.getFilteringItemByField(E))==null?void 0:C.comparison),1),e.filteringItemsByColumn[E].length<2?(i.openBlock(),i.createElementBlock("span",{key:0,class:"filtering-items__item--value",title:(S=o.getFilteringItemByField(E))==null?void 0:S.value},i.toDisplayString((M=o.getFilteringItemByField(E))==null?void 0:M.value),9,G0)):(i.openBlock(),i.createElementBlock("span",Z0," + "+i.toDisplayString(e.filteringItemsByColumn[E].length),1)),i.createVNode(a,{class:"filtering-items__item--remove",icon:"ev-icon-s-close",onClick:k=>o.onApplyFilter(E,[])},null,8,["onClick"])],8,Y0)],64)}),128)),o.isShowColumnFilteringItems&&Object.keys(e.filteringItemsByColumn).length&&o.hiddenFilteringItemsCount>0?(i.openBlock(),i.createElementBlock("div",{key:0,class:"filtering-items__item filtering-items__item--count",onClick:t[2]||(t[2]=(...E)=>o.onExpandFilteringItems&&o.onExpandFilteringItems(...E))}," + "+i.toDisplayString(o.hiddenFilteringItemsCount),1)):i.createCommentVNode("",!0)],512)):i.createCommentVNode("",!0),!o.isShowColumnFilteringItems&&Object.keys(o.hiddenFilteringItemsByColumn).length?i.withDirectives((i.openBlock(),i.createElementBlock("div",{key:2,ref:"hiddenFilteringItemsRef",class:"filtering-items filtering-items__hidden-items",style:i.normalizeStyle(o.filteringItemsStyle)},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(Object.keys(o.hiddenFilteringItemsByColumn),(E,B)=>{var _,C,S,M;return i.openBlock(),i.createElementBlock("div",{key:B,class:"filtering-items__item",onClick:i.withModifiers(k=>{var T;return o.onClickFilteringItem({caption:(T=o.getFilteringItemByField(E))==null?void 0:T.caption,field:E},o.hiddenFilteringItemsByColumn[E])},["stop"])},[i.createElementVNode("span",K0,i.toDisplayString((_=o.getFilteringItemByField(E))==null?void 0:_.caption)+" "+i.toDisplayString((C=o.getFilteringItemByField(E))==null?void 0:C.comparison),1),o.hiddenFilteringItemsByColumn[E].length<2?(i.openBlock(),i.createElementBlock("span",{key:0,class:"filtering-items__item--value",title:(S=o.getFilteringItemByField(E))==null?void 0:S.value},i.toDisplayString((M=o.getFilteringItemByField(E))==null?void 0:M.value),9,J0)):(i.openBlock(),i.createElementBlock("span",Q0," + "+i.toDisplayString(o.hiddenFilteringItemsByColumn[E].length),1)),i.createVNode(a,{class:"filtering-items__item--remove",icon:"ev-icon-s-close",onClick:k=>o.onApplyFilter(E,[],!0)},null,8,["onClick"])],8,q0)}),128))],4)),[[b,()=>{o.isShowColumnFilteringItems||o.onExpandFilteringItems()}]]):i.createCommentVNode("",!0)],4),o.useGridSetting?(i.openBlock(),i.createBlock(c,{key:0,class:"grid-setting__icon",onClick:t[3]||(t[3]=E=>o.setGridSetting(E))})):i.createCommentVNode("",!0),i.renderSlot(e.$slots,"toolbar",{item:{onSearch:o.onSearch}},void 0,!0)]),_:3})],4)):i.createCommentVNode("",!0),i.withDirectives((i.openBlock(),i.createElementBlock("div",i.mergeProps({ref:"grid-wrapper"},e.$attrs,{class:"grid-wrapper",style:`width: ${e.gridWidth}; height: ${e.gridHeight};`}),[i.createElementVNode("div",{ref:"grid",class:i.normalizeClass({table:!0,adjust:e.adjust,"ev-grid":!0,"non-header":!o.showHeader,"ev-grid--empty":!e.viewStore.length})},[i.withDirectives(i.createElementVNode("div",{ref:"header",class:i.normalizeClass({"table-header":!0,"non-border":!!o.borderStyle})},[i.createElementVNode("ul",eC,[e.useCheckbox.use?(i.openBlock(),i.createElementBlock("li",{key:0,class:i.normalizeClass({column:!0,"checkbox-all":!0,"non-border":!!o.borderStyle}),style:i.normalizeStyle({width:`${e.minWidth}px`,"border-right":"1px solid #CFCFCF"})},[e.useCheckbox.use&&e.useCheckbox.headerCheck&&e.useCheckbox.mode!=="single"?(i.openBlock(),i.createBlock(h,{key:0,modelValue:e.isHeaderChecked,"onUpdate:modelValue":t[4]||(t[4]=E=>e.isHeaderChecked=E),disabled:e.isHeaderUncheckable,indeterminate:e.isHeaderIndeterminate,onChange:o.onCheckAll},null,8,["modelValue","disabled","indeterminate","onChange"])):i.createCommentVNode("",!0)],6)):i.createCommentVNode("",!0),e.useRowDetail?(i.openBlock(),i.createElementBlock("li",{key:1,class:i.normalizeClass({column:!0,"non-border":!!o.borderStyle}),style:i.normalizeStyle({width:`${e.minWidth}px`,"border-right":"1px solid #CFCFCF"})},null,6)):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.orderedColumns,(E,B)=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:B},[!E.hide&&!E.hiddenDisplay?(i.openBlock(),i.createElementBlock("li",{key:0,"data-index":B,class:i.normalizeClass({column:!0,render:o.isRenderer(E),"non-border":!!o.borderStyle,[E.field]:E.field}),style:i.normalizeStyle({width:`${E.width}px`,"min-width":`${o.isRenderer(E)?e.rendererMinWidth:e.minWidth}px`,"margin-right":e.orderedColumns.length-1===B&&(e.hasVerticalScrollBar||e.hasHorizontalScrollBar)?`${e.scrollWidth}px`:"0px","border-right":e.orderedColumns.length-1===B?"none":"1px solid #CFCFCF"}),draggable:!0,onDragstart:t[6]||(t[6]=(..._)=>o.onDragStart&&o.onDragStart(..._)),onDragover:t[7]||(t[7]=(..._)=>o.onDragOver&&o.onDragOver(..._)),onDrop:t[8]||(t[8]=(..._)=>o.onDrop&&o.onDrop(..._))},[E.customHeader&&e.$slots.customHeader?i.renderSlot(e.$slots,"customHeader",{key:0},void 0,!0):(i.openBlock(),i.createElementBlock("span",{key:1,title:E.caption,class:"column-name",onClick:[_=>o.onColumnContextMenu(_,E),t[5]||(t[5]=i.withModifiers((..._)=>e.columnMenu.show&&e.columnMenu.show(..._),["prevent"]))]},[i.createTextVNode(i.toDisplayString(E.caption)+" ",1),i.createElementVNode("span",{onClick:i.withModifiers(_=>o.onSort(E),["stop"])},[e.$slots.sortIcon?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[E.sortable===void 0||E.sortable?(i.openBlock(),i.createElementBlock("span",{key:0,class:"column-sort__icon column-sort__icon--basic",style:i.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`})},[i.renderSlot(e.$slots,"sortIcon",{},void 0,!0)],4)):i.createCommentVNode("",!0),e.sortField===E.field?(i.openBlock(),i.createElementBlock("span",{key:1,class:i.normalizeClass([{"column-sort__icon":!0,"column-sort__icon--asc":e.sortOrder==="asc","column-sort__icon--desc":e.sortOrder==="desc"}]),style:i.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`})},[i.renderSlot(e.$slots,`sortIcon_${e.sortOrder}`,{},void 0,!0)],6)):i.createCommentVNode("",!0)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[E.sortable===void 0||E.sortable?(i.openBlock(),i.createBlock(f,{key:0,class:"column-sort__icon column-sort__icon--basic",icon:"basic",style:i.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`})},null,8,["style"])):i.createCommentVNode("",!0),e.sortField===E.field?(i.openBlock(),i.createBlock(f,{key:1,class:i.normalizeClass([{"column-sort__icon":!0,"column-sort__icon--asc":e.sortOrder==="asc","column-sort__icon--desc":e.sortOrder==="desc"}]),icon:e.sortOrder,style:i.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`,visibility:e.sortOrder?E.hidden:!0})},null,8,["class","icon","style"])):i.createCommentVNode("",!0)],64))],8,oC)],8,nC)),i.createElementVNode("span",{class:"column-resize",onMousedown:i.withModifiers(_=>o.onColumnResize(B,_),["stop","left"])},null,40,iC)],46,tC)):i.createCommentVNode("",!0)],64))),128)),(I=e.$props.option.customContextMenu)!=null&&I.length?(i.openBlock(),i.createElementBlock("li",{key:2,class:i.normalizeClass({column:!0,"non-border":!!o.borderStyle}),style:i.normalizeStyle({width:"30px","min-width":"30px","margin-right":e.hasVerticalScrollBar||e.hasHorizontalScrollBar?`${e.scrollWidth}px`:"0px"})},null,6)):i.createCommentVNode("",!0)])],2),[[i.vShow,o.showHeader]]),i.createElementVNode("div",{ref:"body",class:i.normalizeClass({stripe:o.stripeStyle,"table-body":!0,"bottom-border":!!e.viewStore.length,"non-border":!!o.borderStyle}),onScroll:t[11]||(t[11]=(...E)=>o.onScroll&&o.onScroll(...E)),onContextmenu:t[12]||(t[12]=E=>o.onContextMenu(E))},[i.createElementVNode("div",{style:i.normalizeStyle(`height: ${e.vScrollTopHeight}px;`),class:"vscroll-spacer"},null,4),i.createElementVNode("table",sC,[i.createElementVNode("tbody",null,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.viewStore,(E,B)=>{var _,C;return i.openBlock(),i.createElementBlock(i.Fragment,{key:o.idColIndex!=null?E[2][o.idColIndex]:B},[i.createElementVNode("tr",{"data-index":E[0],class:i.normalizeClass({row:!0,selected:E[3],highlight:E[0]===o.highlightIdx,"non-border":!!o.borderStyle&&o.borderStyle!=="rows"}),disabled:E[o.ROW_DISABLED_INDEX],onClick:S=>o.onRowClick(S,E),onContextmenu:S=>o.onRowClick(S,E,!0),onDblclick:S=>o.onRowDblClick(S,E)},[e.useCheckbox.use?(i.openBlock(),i.createElementBlock("td",{key:0,class:i.normalizeClass({cell:!0,"row-checkbox":!0,"non-border":!!o.borderStyle}),style:i.normalizeStyle({width:`${e.minWidth}px`,height:`${e.rowHeight}px`,"border-right":"1px solid #CFCFCF"})},[i.createVNode(h,{modelValue:E[1],"onUpdate:modelValue":S=>E[1]=S,class:"row-checkbox-input",disabled:E[5]||E[o.ROW_DISABLED_INDEX],onChange:S=>o.onCheck(S,E)},null,8,["modelValue","onUpdate:modelValue","disabled","onChange"])],6)):i.createCommentVNode("",!0),e.useRowDetail?(i.openBlock(),i.createElementBlock("td",{key:1,class:i.normalizeClass({cell:!0,"row-detail-toggle":!0,"non-border":!!o.borderStyle,"row-detail-toggle--expanded":E[4]}),style:i.normalizeStyle({width:`${e.minWidth}px`,height:`${e.rowHeight}px`,"border-right":"1px solid #CFCFCF"})},[i.createVNode(a,{modelValue:E[4],"onUpdate:modelValue":S=>E[4]=S,icon:"ev-icon-s-play",class:"row-detail-toggle-icon",onClick:i.withModifiers(S=>o.onExpanded(S,E),["stop"])},null,8,["modelValue","onUpdate:modelValue","onClick"])],6)):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.orderedColumns,(S,M)=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:`${o.idColIndex!=null?E[2][o.idColIndex]:B}-${M}`},[!S.hide&&!S.hiddenDisplay?(i.openBlock(),i.createElementBlock("td",{key:0,"data-name":S.field,"data-index":S.index,class:i.normalizeClass({cell:!0,render:o.isRenderer(S),[S.type]:S.type,[S.align]:S.align,[S.field]:S.field,"non-border":!!o.borderStyle}),style:i.normalizeStyle({width:`${S.width}px`,height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`,"min-width":`${o.isRenderer(S)?e.rendererMinWidth:e.minWidth}px`,"border-right":e.orderedColumns.length-1===M?"none":"1px solid #CFCFCF"}),disabled:E[o.ROW_DISABLED_INDEX]},[e.$slots[S.field]?(i.openBlock(),i.createElementBlock("div",rC,[i.renderSlot(e.$slots,S.field,{item:{row:E,column:S},disabled:E[o.ROW_DISABLED_INDEX]},void 0,!0)])):(i.openBlock(),i.createElementBlock("div",{key:1,title:o.getConvertValue(S,E[2][S.index])},i.toDisplayString(o.getConvertValue(S,E[2][S.index])),9,cC))],14,aC)):i.createCommentVNode("",!0)],64))),128)),(_=e.$props.option.customContextMenu)!=null&&_.length?(i.openBlock(),i.createElementBlock("td",{key:2,class:i.normalizeClass({"row-contextmenu":!0,"non-border":!!o.borderStyle}),style:i.normalizeStyle({position:"sticky",right:0,width:"30px",height:`${e.rowHeight}px`,"min-width":"30px","line-height":`${e.rowHeight}px`}),disabled:E[o.ROW_DISABLED_INDEX]},[e.$slots.contextmenuIcon?(i.openBlock(),i.createElementBlock("span",{key:0,class:"row-contextmenu__btn",disabled:E[o.ROW_DISABLED_INDEX],onClick:t[9]||(t[9]=S=>o.onContextMenu(S))},[i.renderSlot(e.$slots,"contextmenuIcon",{},void 0,!0)],8,hC)):(i.openBlock(),i.createBlock(c,{key:1,icon:"ev-icon-warning2",class:"row-contextmenu__btn",disabled:E[o.ROW_DISABLED_INDEX],onClick:t[10]||(t[10]=S=>o.onContextMenu(S))},null,8,["disabled"]))],14,dC)):i.createCommentVNode("",!0)],42,lC),e.useRowDetail&&((C=e.$slots)!=null&&C.rowDetail)&&E[4]?(i.openBlock(),i.createElementBlock("tr",fC,[i.createElementVNode("td",{colspan:E.length},[i.createElementVNode("div",{style:i.normalizeStyle({width:"100%",height:`${e.detailRowHeight}px`,"min-height":`${e.detailRowHeight}px`,"max-height":`${e.detailRowHeight}px`})},[i.renderSlot(e.$slots,"rowDetail",{item:{row:E}},void 0,!0)],4)],8,uC)])):i.createCommentVNode("",!0)],64)}),128)),e.viewStore.length?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("tr",mC,[i.createElementVNode("td",gC,i.toDisplayString(o.emptyText),1)]))])],512),i.createElementVNode("div",{style:i.normalizeStyle(`height: ${e.vScrollBottomHeight}px;`),class:"vscroll-spacer"},null,4),i.createVNode(m,{ref:"menu","custom-class":e.contextMenuClass,items:e.contextMenuItems},null,8,["custom-class","items"]),i.createVNode(m,{ref:"columnMenu",items:e.columnMenuItems},null,8,["items"]),i.createVNode(m,{ref:"gridSettingMenu",items:e.gridSettingContextMenuItems,"is-show-menu-on-click":e.isShowMenuOnClick},null,8,["items","is-show-menu-on-click"])],34),i.withDirectives(i.createElementVNode("div",pC,null,512),[[i.vShow,e.showResizeLine]])],2)],16)),[[y,o.onResize],[w,{callback:o.onShow,once:!0}]]),o.useSummary?(i.openBlock(),i.createBlock(p,{key:1,"ordered-columns":e.orderedColumns,stores:o.stores,"use-checkbox":e.useCheckbox.use,"style-option":{borderStyle:o.borderStyle,minWidth:e.minWidth,rowHeight:e.rowHeight},"scroll-left":o.summaryScroll},null,8,["ordered-columns","stores","use-checkbox","style-option","scroll-left"])):i.createCommentVNode("",!0),e.usePage&&!e.isInfinite?(i.openBlock(),i.createBlock(g,{key:2,modelValue:e.currentPage,"onUpdate:modelValue":t[13]||(t[13]=E=>e.currentPage=E),total:e.pageTotal,"per-page":e.perPage,"visible-page":e.visiblePage,"show-page-info":e.showPageInfo,order:e.order},null,8,["modelValue","total","per-page","visible-page","show-page-info","order"])):i.createCommentVNode("",!0),i.createVNode(u,{"is-show":e.isShowFilterSetting,"onUpdate:isShow":t[14]||(t[14]=E=>e.isShowFilterSetting=E),items:e.filteringItemsByColumn,"onUpdate:items":t[15]||(t[15]=E=>e.filteringItemsByColumn=E),column:e.filteringColumn,position:e.filterSettingPosition,onApplyFiltering:o.onApplyFilter},null,8,["is-show","items","column","position","onApplyFiltering"]),i.createVNode(x,{"is-show":e.isShowColumnSetting,"onUpdate:isShow":t[16]||(t[16]=E=>e.isShowColumnSetting=E),"is-show-menu-on-click":e.isShowMenuOnClick,"onUpdate:isShowMenuOnClick":t[17]||(t[17]=E=>e.isShowMenuOnClick=E),columns:e.updatedColumns,"hidden-column":e.hiddenColumn,position:e.columnSettingPosition,"text-info":e.columnSettingTextInfo,onApplyColumn:o.onApplyColumn},null,8,["is-show","is-show-menu-on-click","columns","hidden-column","position","text-info","onApplyColumn"])],64)}const no=le($0,[["render",yC],["__scopeId","data-v-f8886e09"]]);no.install=e=>{e.component(no.name,no)};var Ir={exports:{}};(function(e,t){(function(n,o){e.exports=o()})(Xi,function(){var n=1e3,o=6e4,s=36e5,l="millisecond",a="second",r="minute",c="hour",d="day",h="week",f="month",m="quarter",p="year",g="date",u="Invalid Date",x=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,y={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(L){var N=["th","st","nd","rd"],v=L%100;return"["+L+(N[(v-20)%10]||N[v]||N[0])+"]"}},w=function(L,N,v){var O=String(L);return!O||O.length>=N?L:""+Array(N+1-O.length).join(v)+L},I={s:w,z:function(L){var N=-L.utcOffset(),v=Math.abs(N),O=Math.floor(v/60),D=v%60;return(N<=0?"+":"-")+w(O,2,"0")+":"+w(D,2,"0")},m:function L(N,v){if(N.date()<v.date())return-L(v,N);var O=12*(v.year()-N.year())+(v.month()-N.month()),D=N.clone().add(O,f),V=v-D<0,P=N.clone().add(O+(V?-1:1),f);return+(-(O+(v-D)/(V?D-P:P-D))||0)},a:function(L){return L<0?Math.ceil(L)||0:Math.floor(L)},p:function(L){return{M:f,y:p,w:h,d,D:g,h:c,m:r,s:a,ms:l,Q:m}[L]||String(L||"").toLowerCase().replace(/s$/,"")},u:function(L){return L===void 0}},E="en",B={};B[E]=y;var _="$isDayjsObject",C=function(L){return L instanceof T||!(!L||!L[_])},S=function L(N,v,O){var D;if(!N)return E;if(typeof N=="string"){var V=N.toLowerCase();B[V]&&(D=V),v&&(B[V]=v,D=V);var P=N.split("-");if(!D&&P.length>1)return L(P[0])}else{var A=N.name;B[A]=N,D=A}return!O&&D&&(E=D),D||!O&&E},M=function(L,N){if(C(L))return L.clone();var v=typeof N=="object"?N:{};return v.date=L,v.args=arguments,new T(v)},k=I;k.l=S,k.i=C,k.w=function(L,N){return M(L,{locale:N.$L,utc:N.$u,x:N.$x,$offset:N.$offset})};var T=function(){function L(v){this.$L=S(v.locale,null,!0),this.parse(v),this.$x=this.$x||v.x||{},this[_]=!0}var N=L.prototype;return N.parse=function(v){this.$d=function(O){var D=O.date,V=O.utc;if(D===null)return new Date(NaN);if(k.u(D))return new Date;if(D instanceof Date)return new Date(D);if(typeof D=="string"&&!/Z$/i.test(D)){var P=D.match(x);if(P){var A=P[2]-1||0,F=(P[7]||"0").substring(0,3);return V?new Date(Date.UTC(P[1],A,P[3]||1,P[4]||0,P[5]||0,P[6]||0,F)):new Date(P[1],A,P[3]||1,P[4]||0,P[5]||0,P[6]||0,F)}}return new Date(D)}(v),this.init()},N.init=function(){var v=this.$d;this.$y=v.getFullYear(),this.$M=v.getMonth(),this.$D=v.getDate(),this.$W=v.getDay(),this.$H=v.getHours(),this.$m=v.getMinutes(),this.$s=v.getSeconds(),this.$ms=v.getMilliseconds()},N.$utils=function(){return k},N.isValid=function(){return this.$d.toString()!==u},N.isSame=function(v,O){var D=M(v);return this.startOf(O)<=D&&D<=this.endOf(O)},N.isAfter=function(v,O){return M(v)<this.startOf(O)},N.isBefore=function(v,O){return this.endOf(O)<M(v)},N.$g=function(v,O,D){return k.u(v)?this[O]:this.set(D,v)},N.unix=function(){return Math.floor(this.valueOf()/1e3)},N.valueOf=function(){return this.$d.getTime()},N.startOf=function(v,O){var D=this,V=!!k.u(O)||O,P=k.p(v),A=function(q,Q){var J=k.w(D.$u?Date.UTC(D.$y,Q,q):new Date(D.$y,Q,q),D);return V?J:J.endOf(d)},F=function(q,Q){return k.w(D.toDate()[q].apply(D.toDate("s"),(V?[0,0,0,0]:[23,59,59,999]).slice(Q)),D)},X=this.$W,U=this.$M,H=this.$D,$="set"+(this.$u?"UTC":"");switch(P){case p:return V?A(1,0):A(31,11);case f:return V?A(1,U):A(0,U+1);case h:var j=this.$locale().weekStart||0,K=(X<j?X+7:X)-j;return A(V?H-K:H+(6-K),U);case d:case g:return F($+"Hours",0);case c:return F($+"Minutes",1);case r:return F($+"Seconds",2);case a:return F($+"Milliseconds",3);default:return this.clone()}},N.endOf=function(v){return this.startOf(v,!1)},N.$set=function(v,O){var D,V=k.p(v),P="set"+(this.$u?"UTC":""),A=(D={},D[d]=P+"Date",D[g]=P+"Date",D[f]=P+"Month",D[p]=P+"FullYear",D[c]=P+"Hours",D[r]=P+"Minutes",D[a]=P+"Seconds",D[l]=P+"Milliseconds",D)[V],F=V===d?this.$D+(O-this.$W):O;if(V===f||V===p){var X=this.clone().set(g,1);X.$d[A](F),X.init(),this.$d=X.set(g,Math.min(this.$D,X.daysInMonth())).$d}else A&&this.$d[A](F);return this.init(),this},N.set=function(v,O){return this.clone().$set(v,O)},N.get=function(v){return this[k.p(v)]()},N.add=function(v,O){var D,V=this;v=Number(v);var P=k.p(O),A=function(U){var H=M(V);return k.w(H.date(H.date()+Math.round(U*v)),V)};if(P===f)return this.set(f,this.$M+v);if(P===p)return this.set(p,this.$y+v);if(P===d)return A(1);if(P===h)return A(7);var F=(D={},D[r]=o,D[c]=s,D[a]=n,D)[P]||1,X=this.$d.getTime()+v*F;return k.w(X,this)},N.subtract=function(v,O){return this.add(-1*v,O)},N.format=function(v){var O=this,D=this.$locale();if(!this.isValid())return D.invalidDate||u;var V=v||"YYYY-MM-DDTHH:mm:ssZ",P=k.z(this),A=this.$H,F=this.$m,X=this.$M,U=D.weekdays,H=D.months,$=D.meridiem,j=function(Q,J,ee,G){return Q&&(Q[J]||Q(O,V))||ee[J].slice(0,G)},K=function(Q){return k.s(A%12||12,Q,"0")},q=$||function(Q,J,ee){var G=Q<12?"AM":"PM";return ee?G.toLowerCase():G};return V.replace(b,function(Q,J){return J||function(ee){switch(ee){case"YY":return String(O.$y).slice(-2);case"YYYY":return k.s(O.$y,4,"0");case"M":return X+1;case"MM":return k.s(X+1,2,"0");case"MMM":return j(D.monthsShort,X,H,3);case"MMMM":return j(H,X);case"D":return O.$D;case"DD":return k.s(O.$D,2,"0");case"d":return String(O.$W);case"dd":return j(D.weekdaysMin,O.$W,U,2);case"ddd":return j(D.weekdaysShort,O.$W,U,3);case"dddd":return U[O.$W];case"H":return String(A);case"HH":return k.s(A,2,"0");case"h":return K(1);case"hh":return K(2);case"a":return q(A,F,!0);case"A":return q(A,F,!1);case"m":return String(F);case"mm":return k.s(F,2,"0");case"s":return String(O.$s);case"ss":return k.s(O.$s,2,"0");case"SSS":return k.s(O.$ms,3,"0");case"Z":return P}return null}(Q)||P.replace(":","")})},N.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},N.diff=function(v,O,D){var V,P=this,A=k.p(O),F=M(v),X=(F.utcOffset()-this.utcOffset())*o,U=this-F,H=function(){return k.m(P,F)};switch(A){case p:V=H()/12;break;case f:V=H();break;case m:V=H()/3;break;case h:V=(U-X)/6048e5;break;case d:V=(U-X)/864e5;break;case c:V=U/s;break;case r:V=U/o;break;case a:V=U/n;break;default:V=U}return D?V:k.a(V)},N.daysInMonth=function(){return this.endOf(f).$D},N.$locale=function(){return B[this.$L]},N.locale=function(v,O){if(!v)return this.$L;var D=this.clone(),V=S(v,O,!0);return V&&(D.$L=V),D},N.clone=function(){return k.w(this.$d,this)},N.toDate=function(){return new Date(this.valueOf())},N.toJSON=function(){return this.isValid()?this.toISOString():null},N.toISOString=function(){return this.$d.toISOString()},N.toString=function(){return this.$d.toUTCString()},L}(),R=T.prototype;return M.prototype=R,[["$ms",l],["$s",a],["$m",r],["$H",c],["$W",d],["$M",f],["$y",p],["$D",g]].forEach(function(L){R[L[1]]=function(N){return this.$g(N,L[0],L[1])}}),M.extend=function(L,N){return L.$i||(L(N,T,M),L.$i=!0),M},M.locale=S,M.isDayjs=C,M.unix=function(L){return M(1e3*L)},M.en=B[E],M.Ls=B,M.p={},M})})(Ir);var xC=Ir.exports;const at=Hl(xC),vr=document.createElement("canvas").getContext("2d"),Y={hexToRgb(e){if(!e)return!1;const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e),n=parseInt(t[1],16),o=parseInt(t[2],16),s=parseInt(t[3],16);return`${n},${o},${s}`},getColorStringType(e){if(!e)return"";const t=e.replace(/ /g,""),n=/^#(?:[A-Fa-f0-9]{3}){1,2}$/.exec(t),o=/^rgb[(](?:\s*0*(?:\d\d?(?:\.\d+)?(?:\s*%)?|\.\d+\s*%|100(?:\.0*)?\s*%|(?:1\d\d|2[0-4]\d|25[0-5])(?:\.\d+)?)\s*(?:,(?![)])|(?=[)]))){3}[)]$/.exec(t),s=/^rgba[(](?:\s*0*(?:\d\d?(?:\.\d+)?(?:\s*%)?|\.\d+\s*%|100(?:\.0*)?\s*%|(?:1\d\d|2[0-4]\d|25[0-5])(?:\.\d+)?)\s*,){3}\s*0*(?:\.\d+|1?)\s*[)]$/.exec(t);let l="";return n?l="HEX":o?l="RGB":s?l="RGBA":l="NONE",l},colorStringToRgba(e,t=1){const n=e.replace(/ /g,""),o=this.getColorStringType(n);let s="";switch(o){case"HEX":s=`rgba(${this.hexToRgb(n)},${t})`;break;case"RGB":s=n.replace(")",`, ${t})`).replace("rgb","rgba");break;case"RGBA":s=n.replace(`${this.getOpacity(e)})`,`${t})`);break;default:s=`rgba(0, 0, 0, ${t})`;break}return s},getOpacity(e){const t=e==null?void 0:e.replace(/ /g,"");return this.getColorStringType(t)==="RGBA"?t.replace(/^.*,(.+)\)/,"$1"):"1"},calculateMagnitude(e){return Math.floor(Math.log(e)/Math.LN10)},aliasPixel(e){return e%2===0?0:.5},getLabelStyle(e){const{fontStyle:t="normal",fontWeight:n="normal",fontSize:o="12",fontFamily:s="Roboto"}=e;return`${t} normal ${n} ${o}px ${s}`},labelSignFormat(e,t=null){const n=Ch(1),o=bh(1),s=xh(1),l=yh(1),a=1e3;let r;if(!ht(e))return e;const c=e<0,d=Math.abs(e),h=(f,m,p)=>{let g;return f%m===0?g=xt(t)?`${f/m}${p}`:`${(f/m).toFixed(t)}${p}`:g=`${(f/m).toFixed(1)}${p}`,c?`-${g}`:g};if(d>=n)r=h(d,n,"P");else if(d>=o)r=h(d,o,"T");else if(d>=s)r=h(d,s,"G");else if(d>=l)r=h(d,l,"M");else if(d>=a)r=h(d,1e3,"K");else{const f=xt(t)?d:d.toFixed(t);r=c?`-${f}`:`${f}`}return r},calcTextSize(e,t,n=0){const o=document.createElement("span"),s=`visibility:hidden; position:absolute; top:-10000px; font: ${t}; padding: 0 ${n}px`;o.setAttribute("style",s),o.style.font=t,o.textContent=e,document.body.appendChild(o);const l=o.getBoundingClientRect(),a=l.width||2,r=l.height||2;return o.remove(),{width:a,height:r}},calcTextSizeCanvas(e,t){if(!e)return{width:2,height:2};vr.font=t;const n=vr.measureText(e),o=t.match(/(\d+(?:\.\d+)?)px/),l=(o?Number(o[1]):14)*1.2;return{width:Math.max(Math.ceil(n.width),2),height:Math.max(Math.ceil(l),2)}},getStringMinMax(e){const t={min:e[0],max:e[0]};return e.forEach(n=>{var o,s;((o=t==null?void 0:t.max)==null?void 0:o.length)<(n==null?void 0:n.length)&&(t.max=n),((s=t==null?void 0:t.min)==null?void 0:s.length)>(n==null?void 0:n.length)&&(t.min=n)}),t},truncateLabelWithEllipsis(e,t,n,o="right"){if(!e)return"";if(!t)return e;const s="…",l=n.measureText(s).width;let a=e,r=n.measureText(a).width;if(r<=t||r<=l)return e;let c=a.length;for(;r>=t-l&&c-- >0;)a=o==="right"?a.substring(0,c):a.substring(1,a.length),r=n.measureText(a).width;return o==="right"?a+s:s+a},showLabelTip(e){const{ctx:t,width:n,height:o,x:s,y:l,arrowSize:a,borderRadius:r,text:c,backgroundColor:d,textColor:h}=e,f=s-n/2,m=s+n/2,p=l-o,g=l;t.beginPath(),t.save(),t.fillStyle=d||"#E96E2C",t.strokeStyle=d||"#E96E2C",t.shadowBlur=0,t.moveTo(f+r,p),t.quadraticCurveTo(f,p,f,p+r),t.lineTo(f,g-r),t.quadraticCurveTo(f,g,f+r,g),t.lineTo(m-r,g),t.quadraticCurveTo(m,g,m,g-r),t.lineTo(m,p+r),t.quadraticCurveTo(m,p,m-r,p),t.lineTo(s-a,p),t.lineTo(s,p-a),t.lineTo(s+a,p),t.lineTo(f+r,p),t.closePath(),t.fill(),t.restore(),t.save(),t.font="normal normal bold 12px Roboto",t.fillStyle=h||"#FFF",t.textBaseline="middle",t.textAlign="center",t.fillText(`${c}`,s,p+o/2),t.restore(),t.beginPath()},isPieType(e){return e==="pie"||e==="doughnut"||e==="sunburst"},isDoughnutHole(e){return e==="doughnut"||e==="sunburst"},setDOMStyle(e,t){var n;!e||!t||(n=Object.keys(t))==null||n.forEach(o=>{e.style[o]=t[o]})},checkSafeInteger(e){return e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER},htmlToElement(e){const t=document.createElement("template");return t.innerHTML=e.trim(),t.content.firstChild},isNullOrUndefined(e){return e==null},rgbaAdjustHalfOpacity(e){const t=/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/,n=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)$/;if(t.test(e)){const[,o,s,l]=e.match(t);return`rgba(${o}, ${s}, ${l}, 0.5)`}if(n.test(e)){const[,o,s,l,a]=e.match(n),r=(parseFloat(a)/2).toFixed(2);return`rgba(${o}, ${s}, ${l}, ${r})`}return e.startsWith("#")&&e.length>7?e:`${e}80`}},bC={createDataSet(e,t){Object.keys(this.seriesInfo.charts).forEach(n=>{const o=this.seriesInfo.charts[n];o.length&&(n==="pie"?this.options.sunburst?this.createSunburstDataSet(e):this.createPieDataSet(e,o):n==="scatter"?o.forEach(s=>{const l=this.seriesList[s],a=e[s],r=l==null?void 0:l.passingValue;l&&a&&(l.data=this.addSeriesDSforScatter(a),l.minMax=this.getSeriesMinMax(l.data,r))}):n==="heatMap"?o.forEach(s=>{const l=this.seriesList[s],a=l==null?void 0:l.passingValue,r=e[s];l&&r&&(l.labels=t,l.data=this.addSeriesDSForHeatMap(r),l.minMax=this.getSeriesMinMax(l.data,a),l.valueOpt=this.getSeriesValueOptForHeatMap(l))}):o.forEach(s=>{var c,d;const l=this.seriesList[s],a=(c=e==null?void 0:e[s])==null?void 0:c.some(h=>h===l.passingValue);l.hasPassingValueInData=a;const r=(d=e==null?void 0:e[s])==null?void 0:d.map(h=>l.interpolation==="zero"&&!h?0:h===l.passingValue?null:h);l&&r&&(l.isExistGrp&&l.stackIndex&&!l.isOverlapping?l.data=this.addSeriesStackDS(r,t,l.bsIds,l.stackIndex):l.data=this.addSeriesDS(r,t,l.isExistGrp),l.minMax=this.getSeriesMinMax(l.data,l.passingValue))}))})},createRealTimeScatterDataSet(e){var o,s,l;const t=Object.keys(e),n={maxY:0,minY:1/0,fromTime:0,toTime:0};for(let a=0;a<t.length;a++){const r=t[a],c=e[r],d=c==null?void 0:c.length;let h=0;if(!this.isInit||this.updateSeries){const y={dataGroup:[],startIndex:0,endIndex:0,length:0,fromTime:0,toTime:0};this.dataSet[r]={...y,...this.dataSet[r]}}const f=this.dataSet[r],m=f.dataGroup;f.length=this.options.realTimeScatter.range||300;const p=f.length;for(let y=0;y<d;y++){const w=c[y];h<w.x&&(h=w.x)}h=Math.floor(h/1e3)*1e3;const g=((l=(s=(o=m.at(-1))==null?void 0:o.data)==null?void 0:s.at(-1))==null?void 0:l.x)||Date.now();if(f.toTime=h||(g?Math.floor(g/1e3)*1e3:0),f.fromTime=f.toTime-p*1e3,f.endIndex=p-1,(f.toTime-h)/1e3>p&&r==="")return;const u=(h-f.toTime)/1e3;u>0&&(f.toTime=h,f.fromTime=h-p*1e3);const x=y=>{y.data?y.data.length=0:y.data=[],y.max=0,y.min=1/0};for(let y=0;y<p;y++)m[y]||(m[y]={data:[],max:0,min:1/0});if(u>0)if(u>=p){for(let y=0;y<p;y++)x(m[y]);f.startIndex=0,f.endIndex=p-1}else{let y=f.startIndex,w=f.endIndex;for(let I=0;I<u;I++)x(m[y]),y=(y+1)%p,w=(w+1)%p;f.startIndex=y,f.endIndex=w}for(let y=0;y<d;y++){const w=c[y],I=Math.floor(w.x/1e3)*1e3;if(f.fromTime<=I){let E=f.endIndex-(f.toTime-I)/1e3;E<0&&(E=p+E),m[E].data.push({x:w.x,y:w.y,o:w.value??w.y,color:w.color}),m[E].max=Math.max(m[E].max,w.y),m[E].min=Math.min(m[E].min,w.y)}}const b={maxY:0,minY:1/0};for(let y=0;y<this.dataSet[r].length;y++)this.dataSet[r].dataGroup[y].max>b.maxY&&(b.maxY=this.dataSet[r].dataGroup[y].max),this.dataSet[r].dataGroup[y].min<b.minY&&(b.minY=this.dataSet[r].dataGroup[y].min);n.maxY=Math.max(n.maxY,b.maxY),n.minY=Math.min(n.minY,b.minY),n.fromTime=this.dataSet[r].fromTime,n.toTime=this.dataSet[r].toTime}this.seriesInfo.charts.scatter.forEach(a=>{const r=this.seriesList[a];r.data=this.dataSet,r.minMax={minX:at(n.fromTime),minY:n.minY,maxX:at(n.toTime),maxY:n.maxY}})},createSunburstDataSet(e){this.pieDataSet=[];const t=this.pieDataSet,n=[];for(let o=0;o<e.length;o++){const s=e[o],l=this.seriesList[s.id];let a=!1;if(t[0]||(t[0]={ir:0,or:0,total:0,data:[]}),l.show){if(t[0].total+=s.value||0,t[0].data.push({parent:"$ev-root",id:s.id,value:s.value,sa:0,ea:0}),s.children)for(let r=0;r<s.children.length;r++)this.seriesList[s.children[r].id].show&&(a=!0),n.push({parent:s.id,data:s.children[r],depth:1});else{const r={id:"dummy",value:s.value};n.push({parent:s.id,data:r,depth:1})}if(!a){const r={id:"dummy",value:s.value};n.push({parent:s.id,data:r,depth:1})}}}for(t[0].data.sort((o,s)=>s.value-o.value);n.length;){const o=n.shift(),s=o.parent,l=o.data,a=o.depth;let r=!1;t[a]||(t[a]={ir:0,or:0,total:{},data:[]}),t[a].total[s]||(t[a].total[s]=0);const c=this.seriesList[l.id];if(l.id==="dummy")t[a].data.push({parent:s,id:"dummy",value:l.value,sa:0,ea:0}),t[a].total[s]+=l.value;else if(c&&c.show){if(t[a].data.push({parent:s,id:l.id,value:l.value,sa:0,ea:0}),t[a].total[s]+=l.value,l.children)for(let d=0;d<l.children.length;d++)this.seriesList[l.children[d].id].show&&(r=!0),n.push({parent:l.id,data:l.children[d],depth:a+1});else{const d={id:"dummy",value:l.value};n.push({parent:l.id,data:d,depth:a+1})}if(!r){const d={id:"dummy",value:l.value};n.push({parent:l.id,data:d,depth:a+1})}}t[a].data.sort((d,h)=>h.value-d.value)}},createPieDataSet(e,t){this.pieDataSet=[];const n=this.pieDataSet;n[0]={data:[],ir:0,or:0,total:0},t.forEach(o=>{if(this.seriesList[o].show){const s=e[o][0]??0;n[0].total+=s,n[0].data.push({id:o,value:s,sa:0,ea:0})}}),n.forEach(o=>{o.data.sort((s,l)=>l.value-s.value)})},addSeriesStackDS(e,t,n,o=0){const s=this.seriesList,l=this.options.horizontal,a=[],r=new Map,c=(h,f,m)=>{const p=`${h}-${f}-${m>=0?"pos":"neg"}`;if(r.has(p))return r.get(p);let g=0,u=h;for(;u>=0;){const x=s[n[u]];if(x!=null&&x.show){const b=x.data[f],y=l?b==null?void 0:b.x:b==null?void 0:b.y,w=b==null?void 0:b.o,I=!Y.isNullOrUndefined(x.passingValue)&&x.passingValue===w,E=m>=0&&w>=0||m<0&&w<0;if(y!=null&&!I&&E){g=y;break}}u--}return r.set(p,g),g},d=n.length-1;return e.forEach((h,f)=>{const m=Math.max(0,d);let p=c(m,f,h),g=h,u=t[f],x=h;if(p!=null&&u!=null){x&&typeof x=="object"&&("x"in x||"y"in x)&&(g=l?h.x:h.y,u=l?h.y:h.x);const b=(g==null?void 0:g.value)??g;o>0?b!=null?x=p+b:x=g:(p=0,x=b),a.push(this.addData(x,u,g,p))}}),a},addSeriesDS(e,t,n){var a;const o=this.options.horizontal,s=[],l=(a=this.seriesList[Object.keys(this.seriesList)[0]])==null?void 0:a.passingValue;return e.forEach((r,c)=>{let d=r,h=t[c];if(d&&typeof d=="object"&&(r.x||r.y)&&(d=o?r.x:r.y,h=o?r.y:r.x),h!==null){const f=n&&!Y.isNullOrUndefined(l)&&d===l;s.push(this.addData(f?0:d,h,d))}}),s},addSeriesDSforScatter(e){return e.map(t=>{const n=t.x,o={value:t.y,color:(t==null?void 0:t.color)||null};return this.addData(o,n,o)})},addSeriesDSForHeatMap(e){return e.map(({x:t,y:n,value:o,color:s=null})=>({x:t,y:n,o,xp:null,yp:null,w:null,h:null,dataColor:s,cId:null}))},addData(e,t,n=null,o=null){let s,l=null,a=null,r=null,c=null,d=null;return e!==null&&typeof e=="object"?(l=e.value,r=e.color,d=e.textColor):l=e??null,n!==null&&typeof n=="object"?(a=n.value,c=n.color):a=n??null,this.options.horizontal?s={x:l,y:t,o:a,b:o}:s={x:t,y:l,o:a,b:o},s.xp=null,s.yp=null,s.w=null,s.h=null,s.dataColor=r??c,s.dataTextColor=d,s},getSeriesMinMax(e,t){const n={minX:null,minY:null,maxX:null,maxY:null,maxDomain:null},o=this.options.horizontal;if(e.length){const s=!Y.isNullOrUndefined(t);return e.reduce((l,a,r)=>{var m,p,g;const c=l,d=((m=a.x)==null?void 0:m.value)||a.x,h=((p=a.y)==null?void 0:p.value)||a.y,f=((g=a.o)==null?void 0:g.value)||a.o;return(s?f!==t&&d<=c.minX:d<=c.minX)&&(c.minX=d===null?0:d),(s?f!==t&&h<=c.minY:h<=c.minY)&&(c.minY=h===null?0:h),(s?f!==t&&d>=c.maxX:d>=c.maxX)&&(c.maxX=d===null?0:d,o&&d!==null&&(c.maxDomain=h,c.maxDomainIndex=r)),(s?f!==t&&h>=c.maxY:h>=c.maxY)&&(c.maxY=h===null?0:h,!o&&h!==null&&(c.maxDomain=d,c.maxDomainIndex=r)),c},{minX:e[0].x,minY:e[0].y,maxX:e[0].x,maxY:e[0].y,maxDomain:o?e[0].y:e[0].x,maxDomainIndex:0})}return n},getSeriesValueOptForHeatMap(e){const{data:t,colorState:n,isGradient:o}=e,s=this.options.heatMapColor,l=s.colorsByRange.length||s.rangeCount,a=s.decimalPoint;let r,c=0,d=!1;t.forEach(({o:f})=>{c<f&&(c=Math.max(c,f)),f<0?d=!0:r===void 0?r=f:r=Math.min(r,f)}),d&&!o&&n.length===l&&n.push({id:`color#${l}`,color:s.error,state:"normal",label:"Error",show:!0});let h=c>r?Math.floor((c-r)/l):1;return c-r<=l&&(a>0?h=+((c-r)/l).toFixed(a):h=1),{min:r,max:c,interval:h,existError:d,decimalPoint:a}},getItemByLabelIndex(e){if(e<0)return!1;const t=Object.keys(this.seriesList),n=!!this.options.horizontal;let o=null,s=null,l=null,a="",r=0,c=!1,d=!1;if(e>-1){for(let h=0;h<t.length;h++){const f=t[h],m=this.seriesList[f],p=m.data[e];if(p&&m.show&&m.showLegend){const g=n?p.y:p.x,u=n?p.yp:p.xp;if(g!=null){const x=n?p.o||p.x:p.o||p.y;m.stackIndex?(r+=isNaN(p.o)?0:p.o,c=!0):r+=p.y,(l===null||l<=x)&&(l=x,a=f,o=g,s=u)}}}d={label:o,pos:s,value:l===null?0:l,sId:a,acc:r,useStack:c,maxIndex:e}}return d},getItem(e,t=!1){const{seriesID:n,dataIndex:o}=e;let s;if("seriesID"in e){const l=this.getDataByValues(n,o);if(!l||!(l!=null&&l.xp)||!(l!=null&&l.yp))return null;s=[this.getItemByPosition([l.xp,l.yp],t,o,!0)]}else{const l=Object.entries(this.seriesList);let a;for(let r=0;r<l.length;r++){const[c,d]=l[r];if(d.show){a=c;break}}s=o==null?void 0:o.map(r=>{const c=this.getDataByValues(a,r);return c?this.getItemByPosition([(c==null?void 0:c.xp)??0,(c==null?void 0:c.yp)??0],t,r,!0):null})}return s},getDataByValues(e,t){const n=this.seriesList[e];return!n||isNaN(t)||t<0||(n==null?void 0:n.data.length)<=t?!1:n.data[t]},getItemByPosition(e,t=!1,n,o=!1){const s=Object.keys(this.seriesList),l=!!this.options.horizontal;let a=null,r=null,c=null,d=null,h="",f=0,m=!1,p=null;for(let g=0;g<s.length;g++){const u=s[g],x=this.seriesList[u],b=t?x.findApproximateData:x.findGraphData;if(b){const y=b.call(x,e,l,n,o),w=y.data,I=y.index;if(w)if(Y.isPieType(y.type))r=u,h=u,c=(w.ea-w.sa)/2,d=w.o,p=w.index,a=y.type;else{const E=l?w.y:w.x,B=l?w.yp:w.xp;if(E!=null){const _=l?w.o||w.x:w.o||w.y;x.stackIndex!=null?(f+=isNaN(w.o)?0:w.o,m=!0):f+=w.y,a==="bar"&&m?y.hit&&(d=_,h=u,p=I,r=E,c=B,a=x.type):(d===null||d<=_)&&(d=_,h=u,r=E,c=B,p=I,a=x.type)}}}}return{type:a,label:r,pos:c,value:d??0,sId:h,acc:f,useStack:m,maxIndex:p}},getLabelInfoByPosition(e,t){var u,x,b;const[n,o]=e,s={x1:this.chartRect.x1+this.labelOffset.left,x2:this.chartRect.x2-this.labelOffset.right,y1:this.chartRect.y1+this.labelOffset.top,y2:this.chartRect.y2-this.labelOffset.bottom},l=this.data.series,a=((u=Object.values(l).sort((y,w)=>w.pointSize??0-y.pointSize??0)[0])==null?void 0:u.pointSize)??3,{horizontal:r,selectLabel:c}=this.options;let d,h;t==="xAxis"?(d=this.axesX[0],h=this.scrollbar.x):t==="yAxis"?(d=this.axesY[0],h=this.scrollbar.y):(d=r?this.axesY[0]:this.axesX[0],h=r?this.scrollbar.y:this.scrollbar.x);const f=s[d.units.rectStart],m=s[d.units.rectEnd];let p,g;if(h!=null&&h.use&&((x=d==null?void 0:d.labels)!=null&&x.length)){const{type:y,range:w,interval:I=1}=h,[E,B]=w??[0,d.labels.length],_=Math.floor((+B-+E)/I)+1,C=(m-f)/_,M=Math.floor(((t==="yAxis"||r?o:n)-f)/C);y==="step"?p=E+M:p=(d==null?void 0:d.labels.findIndex(T=>T===+E))+M}else if((b=d==null?void 0:d.labels)!=null&&b.length){const y=(m-f)/d.labels.length,I=Math.floor(((t==="yAxis"?o:n)-f)/y);p=d.labels.length>I?I:-1}else{let y,w;n<f-a?(y=f,w=0):n>m+a?(y=m,w=this.data.labels.length-1):y=n,g=this.getItemByPosition([y,o],c==null?void 0:c.useApproximateValue,w,!0),p=g.maxIndex??-1}return{labelIndex:p,hitInfo:g}},getCurMouseLabelVal(e,t,n){const{type:o,horizontal:s}=this.options,l=e==="xAxis",a=l?"x":"y";let r="",c=-1;const d=()=>{let f="";switch(o){case"bar":case"line":{f=s&&!l||!s&&l?this.data.labels[n]:"";break}case"heatMap":{f=this.data.labels[a][n];break}}return f},h=()=>{let f="";const m={x1:this.chartRect.x1+this.labelOffset.left,x2:this.chartRect.x2-this.labelOffset.right,y1:this.chartRect.y1+this.labelOffset.top,y2:this.chartRect.y2-this.labelOffset.bottom},{steps:p,interval:g,graphMin:u}=this.axesSteps[a][0],{width:x,height:b}=this.axesRange[a][0].size,y=l?this.axesX:this.axesY,w=m[y[0].units.rectStart],I=m[y[0].units.rectEnd],E=Math.abs(t[l?0:1]-w),B=(l?x:b)/2,_=Math.abs(w-I)/p,C=Math.floor((E+B)/_);return _*C+B>E&&_*C-B<E&&(f=C*g+u),f};return typeof n=="number"&&(r=d(),c=n),r||(r=h(),c=-1),{labelVal:r,labelIdx:c}},getStoreMinMax(){const e=Object.keys(this.seriesList),t=this.options.horizontal,n={x:[{min:null,max:null}],y:[{min:null,max:null}]};return e.length?e.reduce((o,s)=>{const l=o,a=this.seriesList[s],r=a.minMax,c=a.xAxisIndex,d=a.yAxisIndex;if(l.x[c]||(l.x[c]={min:null,max:null,maxSID:null}),l.y[d]||(l.y[d]={min:null,max:null,maxSID:null}),r&&a.show){t?((l.x[c].min===null||r.minX<l.x[c].min)&&(l.x[c].min=r.minX),r.minY!==null&&(l.y[d].min===null||r.minY<l.y[d].min)&&(l.y[d].min=r.minY)):(r.minX!==null&&(l.x[c].min===null||r.minX<l.x[c].min)&&(l.x[c].min=r.minX),(l.y[d].min===null||r.minY<l.y[d].min)&&(l.y[d].min=r.minY));const h=this.seriesList[s].isExistGrp,f=l.x[c].max<0;(h&&f||!l.x[c].max||r.maxX>=l.x[c].max)&&(l.x[c].max=r.maxX,l.x[c].maxSID=s);const m=l.y[d].max<0;(h&&m||!l.y[d].max||r.maxY>=l.y[d].max)&&(l.y[d].max=r.maxY,l.y[d].maxSID=s)}return l},{x:[{min:null,max:null,maxSID:null}],y:[{min:null,max:null,maxSID:null}]}):n},calculateAngle(){const e=this.pieDataSet;let t,n,o,s,l,a,r,c,d;const h=[],f={"$ev-root":1.5*Math.PI};for(let m=0;m<e.length;m++){const p=e[m];d=!0;for(let g=0;g<p.data.length;g++)if(t=p.data[g],n=t.value,d&&(d=t.id==="dummy"),!m)a=f["$ev-root"],l=2*Math.PI*(n/p.total),r=a+l,t.sa=a,t.ea=r,f["$ev-root"]+=l;else{if(o=this.getParentInfo(m-1,t.parent),!o)break;f[t.parent]||(f[t.parent]=o.sa),a=f[t.parent],c=o.ea-o.sa,s=p.total[t.parent]||0,l=c*(n/s),r=a+l,t.sa=a,t.ea=r,f[t.parent]+=l}d&&h.push(m)}for(let m=0;m<h.length;m++)this.pieDataSet.splice(h,1);this.options.reverse&&(this.pieDataSet=Xp(this.pieDataSet))},getParentInfo(e,t){for(let n=e;n>=0;n--){const o=this.pieDataSet[n];for(let s=0;s<o.data.length;s++)if(o.data[s].id===t)return o.data[s]}return null},getAggregations(){const e=this.data.data,t=this.data.series,n={},o=Object.keys(t);return o==null||o.forEach(s=>{const l=e[s].map(m=>m!=null&&m.value?m.value:m),a=l[l.length-1],r=l.filter(m=>m!=null),c=Math.min(...r),d=Math.max(...r),h=r.reduce((m,p)=>m+p,0),f=h/r.length||0;(!Y.checkSafeInteger(c)||!Y.checkSafeInteger(d)||!Y.checkSafeInteger(f)||!Y.checkSafeInteger(h)||!Y.checkSafeInteger(a))&&console.warn("[EVUI][Chart] The aggregated value exceeds 9007199254740991 or less than -9007199254740991."),n[s]={min:c,max:d,avg:f,total:h,last:a}}),n}},CC={x:{rectStart:"x1",rectEnd:"x2",rectOffsetCounter:e=>e==="top"?"y2":"y1",rectOffset:e=>e==="top"?"y1":"y2"},y:{rectStart:"y2",rectEnd:"y1",rectOffsetCounter:e=>e==="left"?"x2":"x1",rectOffset:e=>e==="left"?"x1":"x2"}},Nt=["#2b99f0","#8ac449","#00C4C5","#ffde00","#ff7781","#8470ff","#75cd8e","#48d1cc","#fec64f","#fe984f","#0052ff","#00a48c","#83cfde","#dfe32d","#ff7d40","#99c7ff","#a5fee3","#0379c9","#eef093","#ffa891","#00c5cd","#009bc7","#cacaff","#ffc125","#df6264"],Tr={show:!0,highlight:{defaultSize:4,maxSize:6,maxShadowSize:10,maxShadowOpacity:.4},xAxisIndex:0,yAxisIndex:0,point:!0,pointHighlight:!0,pointSize:3,pointStyle:"",lineWidth:2,fill:!1,fillOpacity:.4,showLegend:!0,passingValue:null,interpolation:"none"},SC={show:!0,highlight:{pointSize:5},xAxisIndex:0,yAxisIndex:0,category:!0,showLegend:!0,showValue:{use:!1,fontSize:12,textColor:"#000000",formatter:null,decimalPoint:null}},wC={show:!0,showLegend:!0,stroke:{show:!0,color:"#FFFFFF",lineWidth:2},showValue:{use:!1,fontSize:12,textColor:"#000000",formatter:null}},Br={min:null,max:null,autoScaleRatio:null,startToZero:!1,showAxis:!0,axisLineColor:"#C9CFDC",axisLineWidth:1,showGrid:!0,gridLineColor:"#C9CFDC",showAxisTick:!0,showIndicator:!1,timeFormat:"mm:ss",range:null,interval:null,decimalPoint:"auto",fixedSteps:!1,niceScale:!1,labelStyle:{show:!0,fontSize:12,color:"#25262E",fontFamily:"Roboto",fontWeight:400,fitWidth:!1,fitDir:"right",alignToGridLine:!1,padding:0,fixWidth:void 0},title:{use:!1,text:null,fontWeight:400,fontSize:12,fontFamily:"Roboto",textAlign:"right",fontStyle:"normal",color:"#808080"},scrollbar:{use:!1,width:14,height:14,background:"#F2F2F2",showButton:!0,thumbStyle:{background:"#929292",radius:0}}},Dr={show:!1,fontSize:12,fontColor:"#FF0000",fillColor:"#FFFFFF",lineColor:"#FF0000",lineWidth:0,fontWeight:400,fontFamily:"Roboto",verticalAlign:"middle",textAlign:"center",textOverflow:"none",maxWidth:null},Or={color:"#FF0000",lineWidth:1,label:Dr},Rr={color:"#FAE59D"},kC={show:!0,xAxisIndex:0,yAxisIndex:0,showLegend:!0,showValue:{use:!1,fontSize:12,textColor:"#000000",formatter:null,decimalPoint:0},highlight:{stroke:{use:!1,color:null,width:1,radius:0},shadow:{use:!0,offsetX:0,offsetY:0,blur:4,color:"#959494"}}},si={millisecond:{common:!0,size:1,steps:[1,2,5,10,20,50,100,250,500]},second:{common:!0,size:1e3,steps:[1,2,5,10,30]},minute:{common:!0,size:6e4,steps:[1,2,5,10,30]},hour:{common:!0,size:36e5,steps:[1,2,3,6,12]},day:{common:!0,size:864e5,steps:[1,2,5]},week:{common:!1,size:6048e5,steps:[1,2,3,4]},month:{common:!0,size:26784e5,steps:[1,2,3]},quarter:{common:!1,size:7884e6,steps:[1,2,3,4]},year:{common:!0,size:3154e7}},_s=Object.freeze([1,2,2.5,5,10]),ie={calculateX(e,t,n,o,s=0){if(e==null||e>n||e<t)return null;const l=o/(n-t);return Math.ceil(s+l*(e-t))},calculateSubX(e,t,n,o,s=0){if(e==null)return null;const l=o/(n-t);return Math.ceil(s+l*(e-t))},calculateY(e,t,n,o,s=0){let l;if(e==null||e>n||e<t)return null;const a=o/(n-t);return s?l=s-a*(e-(t||0)):l=-(a*(e-(t||0))),Math.floor(l)},drawPoint(e,t,n,o,s){let l,a,r,c,d;if(isNaN(n)||n<=0)return;let h,f,m,p;switch(t){case"triangle":e.beginPath(),l=3*n/Math.sqrt(3),c=l*Math.sqrt(3)/2,e.moveTo(o-l/2,s+c/3),e.lineTo(o+l/2,s+c/3),e.lineTo(o,s-2*c/3),e.closePath(),e.fill();break;case"rect":d=1/Math.SQRT2*n,e.beginPath(),e.fillRect(o-d,s-d,2*d,2*d),e.strokeRect(o-d,s-d,2*d,2*d);break;case"rectRounded":h=n/Math.SQRT2,f=o-h,m=s-h,p=Math.SQRT2*n,e.beginPath(),this.roundedRect(e,f,m,p,p,n/2),e.closePath(),e.fill();break;case"rectRot":d=1/Math.SQRT2*n,e.beginPath(),e.moveTo(o-d,s),e.lineTo(o,s+d),e.lineTo(o+d,s),e.lineTo(o,s-d),e.closePath(),e.fill();break;case"cross":e.beginPath(),e.moveTo(o,s+n),e.lineTo(o,s-n),e.moveTo(o-n,s),e.lineTo(o+n,s),e.closePath();break;case"crossRot":e.beginPath(),a=Math.cos(Math.PI/4)*n,r=Math.sin(Math.PI/4)*n,e.moveTo(o-a,s-r),e.lineTo(o+a,s+r),e.moveTo(o-a,s+r),e.lineTo(o+a,s-r),e.closePath();break;case"star":e.beginPath(),e.moveTo(o,s+n),e.lineTo(o,s-n),e.moveTo(o-n,s),e.lineTo(o+n,s),a=Math.cos(Math.PI/4)*n,r=Math.sin(Math.PI/4)*n,e.moveTo(o-a,s-r),e.lineTo(o+a,s+r),e.moveTo(o-a,s+r),e.lineTo(o+a,s-r),e.closePath();break;case"line":e.beginPath(),e.moveTo(o-n,s),e.lineTo(o+n,s),e.closePath();break;default:e.beginPath(),e.arc(o,s,n,0,Math.PI*2),e.closePath(),e.fill();break}e.stroke()},roundedRect(e,t,n,o,s,l){const a=Math.PI,r=a/2;if(l){const c=Math.min(l,s/2,o/2),d=t+c,h=n+c,f=t+o-c,m=n+s-c;e.moveTo(t,h),d<f&&h<m?(e.arc(d,h,c,-a,-r),e.arc(f,h,c,-r,0),e.arc(f,m,c,0,r),e.arc(d,m,c,r,a)):d<f?(e.moveTo(d,n),e.arc(f,h,c,-r,r),e.arc(d,h,c,r,a+r)):h<m?(e.arc(d,h,c,-a,0),e.arc(d,m,c,0,a)):e.arc(d,h,c,-a,a),e.closePath(),e.moveTo(t,n)}else e.rect(t,n,o,s)},createGradient(e,t,n,o,s,l){const{x:a,y:r,w:c,h:d}=n;let h;t?h=e.createLinearGradient(a,0,a+c,0):h=e.createLinearGradient(0,r,0,r+d);for(let f=0;f<o.length;f++){const m=o[f][0]??0,p=o[f][1]??"rgba(255, 255, 255, 0)",g=p.includes("rgba")?Y.getOpacity(p):1,u=s?l:g;h.addColorStop(m,Y.colorStringToRgba(p,u))}return h}};class MC{constructor(t,n,o){const s=Fe({},n,Tr);Object.keys(s).forEach(l=>{this[l]=s[l]}),this.name===void 0&&(this.name=`series-${o}`),["color","pointFill","fillColor"].forEach(l=>{this[l]===void 0&&(this[l]=l==="pointFill"?this.color:Nt[o%Nt.length])}),this.type="line",this.sId=t,this.extent={downplay:{opacity:.3,lineWidth:1},normal:{opacity:1,lineWidth:1},highlight:{opacity:1,lineWidth:2}},this.data=[],this.beforeMouseXp=0,this.beforeMouseYp=0,this.beforeFindItemIndex=-1,this.size={comboOffset:0}}useLinearInterpolation(){return this.interpolation==="linear"||this.interpolation==="none"&&!!this.passingValue&&this.hasPassingValueInData}draw(t){var V,P,A,F,X,U,H;if(!this.show)return;const{ctx:n,chartRect:o,labelOffset:s,axesSteps:l,selectLabel:a,selectSeries:r,legendHitInfo:c,isBrush:d,unSelectedOpacity:h}=t,f=a==null?void 0:a.option,m=(f==null?void 0:f.use)&&(f==null?void 0:f.useSeriesOpacity),p=((V=a==null?void 0:a.selected)==null?void 0:V.dataIndex)??[];let g;if(c)g=this.extent[(c==null?void 0:c.sId)===this.sId?"highlight":"downplay"];else if((P=r==null?void 0:r.option)!=null&&P.use&&((F=(A=r==null?void 0:r.selected)==null?void 0:A.seriesId)!=null&&F.length)){const $=(U=(X=r==null?void 0:r.selected)==null?void 0:X.seriesId)==null?void 0:U.includes(this.sId);g=this.extent[$?"highlight":"downplay"]}else m&&p.length?g=this.extent.downplay:g=this.extent.normal;g===this.extent.downplay&&(g={...g,opacity:h});const u=$=>$!=null&&$.includes("rgba")?Y.getOpacity($):g.opacity,x=this.color,b=u(x),y=this.pointFill,w=u(y),I=this.extent.downplay?this.fillOpacity*g.opacity:this.fillOpacity,E=this.lineWidth*g.lineWidth;n.beginPath(),n.save(),n.lineJoin="round",n.lineWidth=E,n.strokeStyle=Y.colorStringToRgba(x,b),this.segments&&n.setLineDash(this.segments);const B=this.useLinearInterpolation();let _=0;const C=l.x[this.xAxisIndex],S=l.y[this.yAxisIndex];let M=o.chartWidth-(s.left+s.right);const k=o.chartHeight-(s.top+s.bottom);this.combo&&(_=M/(this.data.length||1),M-=_,this.size.comboOffset=_);const T=o.x1+s.left+_/2,R=o.y2-s.bottom,L=$=>ie.calculateX($,C.graphMin,C.graphMax,M,T),N=$=>ie.calculateY($,S.graphMin,S.graphMax,k,R),v=this.data.some($=>$.o<0),O=v?N(0):o.y2-s.bottom;let D;if(this.data.forEach($=>{let j=L($.x),K=N($.y);this.isExistGrp&&B&&$.o===null&&(K=N($.b??0)),j!==null&&(j+=Y.aliasPixel(j)),$.xp=j,$.yp=K,!(B&&$.o===null)&&(xt(D==null?void 0:D.y)&&!this.isExistGrp||!B&&(xt(D==null?void 0:D.y)||xt($.o))?n.moveTo(j,K):n.lineTo(j,K),D=$)}),n.stroke(),this.segments&&n.setLineDash([]),this.fill&&this.data.length){n.beginPath();const $=Y.colorStringToRgba(this.fillColor||x,I);if((H=this.fill)!=null&&H.gradient){let J=this.data[0].yp,ee=this.data[0].y;this.data.forEach(Z=>{Z.yp&&Z.yp<=J?J=Z.yp:Z.y&&Z.y>=ee&&(ee=Z.y)});const G=n.createLinearGradient(0,o.y2,0,J),ne=g.opacity<1?$:x;G.addColorStop(0,v?ne:$),G.addColorStop(.5,$),G.addColorStop(1,ne),n.fillStyle=G}else n.fillStyle=$;let j=null,K=null;const q=this.data.map(J=>J==null?void 0:J.o),Q=[];for(let J=0;J<q.length+1;J++)if(B&&Hp(q[J])||!B&&xt(q[J])){if(j!==null&&K!==null){const G=q.slice(j,J).findLastIndex(ne=>!xt(ne)&&ne!==null);Q.push([j,j+G]),j=null,K=null}}else B&&q[J]===null||(j=j===null?J:j),K=J;Q.forEach(([J,ee])=>{if(J===ee){const G=this.data[J];n.moveTo(G.xp-E,G.yp),n.lineTo(G.xp+E,G.yp),n.lineTo(G.xp+E,N(G.b)??O),n.closePath();return}for(let G=J;G<=ee;G++){const ne=this.data[G];if(G===J?n.moveTo(ne.xp,ne.yp):ne.o!==null&&n.lineTo(ne.xp,ne.yp),G===ee){for(let Z=ee;Z>=J;Z--){const re=this.data[Z],me=L(re.x),ae=re.o===null?N(0):N(re.b)??N(0);n.lineTo(me,ae)}n.closePath()}}}),n.fill()}if(!d){n.strokeStyle=Y.colorStringToRgba(x,b);const $=Y.colorStringToRgba(y,1),j=Y.colorStringToRgba(y,w),K=this.interpolation==="linear"&&this.data.filter(q=>q.o!==null).length===1;this.data.forEach((q,Q)=>{var Z,re;if(q.xp===null||q.yp===null||q.o===null)return;const J=(Z=this.data[Q-1])==null?void 0:Z.o,ee=(re=this.data[Q+1])==null?void 0:re.o,G=!B&&xt(J)&&xt(ee)||K,ne=p.includes(Q);(this.point||G||ne)&&(n.fillStyle=ne&&!c?$:j,ie.drawPoint(n,this.pointStyle,this.pointSize,q.xp,q.yp))})}n.restore()}itemHighlight(t,n){const o=t.data,s=n,{xp:l,yp:a,o:r}=o;s.save(),l!==null&&a!==null&&r!==null&&this.pointHighlight&&(s.strokeStyle=Y.colorStringToRgba(this.color,0),s.fillStyle=Y.colorStringToRgba(this.color,this.highlight.maxShadowOpacity),ie.drawPoint(s,this.pointStyle,this.highlight.maxShadowSize,l,a),s.fillStyle=this.color,ie.drawPoint(s,this.pointStyle,this.highlight.maxSize,l,a),s.fillStyle="#fff",ie.drawPoint(s,this.pointStyle,this.highlight.defaultSize,l,a)),s.restore()}findGraphData(t,n,o,s){var h;const l=t[0],a=t[1],r={data:null,hit:!1,color:this.color},c=this.data.filter(f=>!Y.isNullOrUndefined(f.x)),d=this.useLinearInterpolation();if(c!=null&&c.length)if(typeof o=="number"&&this.show){if(r.data=c[o],r.index=o,r.data){const f=c[o];Math.abs(a-f.yp)<=15&&(r.hit=!0)}}else if(typeof this.beforeFindItemIndex=="number"&&this.beforeFindItemIndex!==-1&&this.show&&s)r.data=c[this.beforeFindItemIndex],r.index=this.beforeFindItemIndex;else{let f=1/0,m=-1;const p=[];c.forEach((b,y)=>{b.xp!==null&&b.yp!==null&&b.o!==null&&p.push({...b,originalIndex:y})}),p.length===0&&c.forEach((b,y)=>{p.push({...b,originalIndex:y})});let g=0,u=p.length-1;for(;g<=u;){const b=Math.floor((g+u)/2),y=p[b],w=Math.abs(l-y.xp);if(w<f&&(f=w,m=y.originalIndex),y.xp<l){if(g=b+1,g<p.length){const I=Math.abs(l-p[g].xp);I<f&&(f=I,m=p[g].originalIndex)}}else if(y.xp>l){if(u=b-1,u>=0){const I=Math.abs(l-p[u].xp);I<f&&(f=I,m=p[u].originalIndex)}}else break}const x=p.findIndex(b=>b.originalIndex===m);if(x!==-1)for(let b=Math.max(0,x-2);b<=Math.min(p.length-1,x+2);b++){const y=p[b],w=Math.abs(l-y.xp);w<f&&(f=w,m=y.originalIndex)}if(m!==-1){let b=50;if(c.length>1){const w=[];for(let I=1;I<c.length;I++)c[I].xp!==null&&c[I-1].xp!==null&&w.push(Math.abs(c[I].xp-c[I-1].xp));w.length>0&&(b=w.reduce((I,E)=>I+E,0)/w.length)}const y=Math.max(b,1);if(f<=y)r.data=c[m],r.index=m;else{let w=!1,I=d?1/0:y;const E=d?p:c;for(let B=0;B<E.length;B++){const _=Math.abs(l-E[B].xp);_<=I&&(w=!0,I=_,m=d?E[B].originalIndex:B)}w&&(r.data=c[m],r.index=m)}if(r.data){const w=c[m];Math.abs(a-w.yp)<=15&&(r.hit=!0)}}}return s||(this.beforeMouseXp=l,this.beforeMouseYp=a,typeof r.index=="number"&&(this.beforeFindItemIndex=r.index)),d&&((h=r==null?void 0:r.data)==null?void 0:h.o)===null&&(r.data=null),r}findApproximateData(t){var m,p;const n=t[0],o=t[1],s={data:null,hit:!1,color:this.color},l=this.data.filter(g=>!Y.isNullOrUndefined(g.x));if(!l.length)return s;const a=l.length>1?Math.abs(((m=l[1])==null?void 0:m.xp)-((p=l[0])==null?void 0:p.xp)):50,r=Math.max(a*.4,10);let c=0,d=l.length-1,h=-1,f=1/0;for(;c<=d;){const g=Math.floor((c+d)/2),u=l[g].xp;if(u-r<=n&&n<=u+r){const x=Math.max(0,g-2),b=Math.min(l.length-1,g+2);for(let y=x;y<=b;y++)if(l[y].xp!==null&&l[y].yp!==null){const w=Math.sqrt((n-l[y].xp)**2+(o-l[y].yp)**2);w<f&&(f=w,h=y)}return h!==-1&&(s.data=l[h],s.index=h,f<5&&(s.hit=!0)),s}else if(u+r<n){if(g<d&&n<l[g+1].xp){const x=Math.abs(l[g].xp-n),b=Math.abs(l[g+1].xp-n);s.data=x>b?l[g+1]:l[g],s.index=x>b?g+1:g;const y=s.data;return Math.abs(o-y.yp)<10&&(s.hit=!0),s}c=g+1}else{if(g>0&&n>l[g-1].xp){const x=Math.abs(l[g-1].xp-n),b=Math.abs(l[g].xp-n);s.data=x>b?l[g]:l[g-1],s.index=x>b?g:g-1;const y=s.data;return Math.abs(o-y.yp)<10&&(s.hit=!0),s}d=g-1}}return s}findItems({xsp:t,width:n}){const o=t+n;return this.data.filter(s=>t-1<=s.xp&&s.xp<=o+1)}}class EC{constructor(t,n,o,s=!1){const l=ys({},Tr,n);Object.keys(l).forEach(a=>{this[a]=l[a]}),this.name===void 0&&(this.name=`series-${o}`),["color","pointFill","fillColor","overflowColor"].forEach(a=>{this[a]===void 0&&(this[a]=Nt[o%Nt.length])}),this.sId=t,this.data=[],this.type="scatter",this.realTimeScatter=s,this._rtTotalCount=0,this._colorCache=new Map}getCachedColor(t,n){const o=`${t}_${n}`;if(this._colorCache.has(o))return this._colorCache.get(o);const s=Y.colorStringToRgba(t,n);if(this._colorCache.size>100){const l=this._colorCache.keys().next().value;this._colorCache.delete(l)}return this._colorCache.set(o,s),s}draw(t){this.show&&(this.realTimeScatter?this.realTimeScatterDraw(t):this.defaultScatterDraw(t))}getOpacity(t,n,o){const s=n.includes("rgba")?Y.getOpacity(n):1;let l=!1;const{selectInfo:a,legendHitInfo:r,unSelectedOpacity:c}=t;return r?l=r.sId!==this.sId:a&&(l=(a==null?void 0:a.seriesID)!==this.sId||(a==null?void 0:a.dataIndex)!==o),l?c:s}calcItem(t,n){const{chartRect:o,labelOffset:s,axesSteps:l,displayOverflow:a}=n;let r;const c=l.x[this.xAxisIndex],d=l.y[this.yAxisIndex],h=o.chartWidth-(s.left+s.right),f=o.chartHeight-(s.top+s.bottom),m=o.x1+s.left,p=o.y2-s.bottom;let g=ie.calculateX(t.x,c.graphMin,c.graphMax,h,m);const u=ie.calculateY(a&&t.y>d.graphMax?d.graphMax:t.y,d.graphMin,d.graphMax,f,p);g!==null&&(r=Y.aliasPixel(g),g+=r),t.xp=g,t.yp=u}defaultScatterDraw(t){const{ctx:n,axesSteps:o,duple:s,legendHitInfo:l,coordinateDedupe:a}=t,r=o.y[this.yAxisIndex];for(let c=0;c<this.data.length;c++){const d=this.data[c],h=c,f=a!==!1;let m;if(l?m=l.sId===this.sId:f?m=s.get(`${d.x}${d.y}`)===this.sId:m=!0,m&&(this.calcItem(d,t),d.xp!==null&&d.yp!==null)){const g=d.y>r.graphMax&&this.overflowColor||d.dataColor||this.color,u=this.getOpacity(t,g,h);n.strokeStyle=this.getCachedColor(g,u);const x=d.dataColor||this.pointFill,b=this.getOpacity(t,x,h);n.fillStyle=this.getCachedColor(x,b),ie.drawPoint(n,this.pointStyle,this.pointSize,d.xp,d.yp)}}}realTimeScatterDraw(t){var f,m,p,g,u,x;const{ctx:n,axesSteps:o,duple:s,legendHitInfo:l,coordinateDedupe:a}=t,r=o.y[this.yAxisIndex],c=typeof this.pointStyle=="string"?this.pointStyle:this.pointStyle.value,d=typeof this.pointSize=="number"?this.pointSize:this.pointSize.value;let h=0;for(let b=0;b<((m=(f=this.data[this.sId])==null?void 0:f.dataGroup)==null?void 0:m.length);b++)for(let y=0;y<((g=(p=this.data[this.sId])==null?void 0:p.dataGroup[b])==null?void 0:g.data.length);y++){const w=(x=(u=this.data[this.sId])==null?void 0:u.dataGroup[b])==null?void 0:x.data[y];h++;const I=a!==!1;let E;if(l?E=l.sId===this.sId:I?E=s.get(`${w.x}${w.y}`)===this.sId:E=!0,E&&(this.calcItem(w,t),w.xp!==null&&w.yp!==null)){const B=w.y>r.graphMax&&this.overflowColor,_=B||w.color||this.color,C=B||w.color||this.pointFill||this.color,S=this.getOpacity(t,_,y),M=this.getOpacity(t,C,y);n.strokeStyle=this.getCachedColor(_,S),n.fillStyle=this.getCachedColor(C,M),ie.drawPoint(n,c,d,w.xp,w.yp)}}this._rtTotalCount=h}findItemsInRange(t,n,o,s,l){return t.filter(a=>n-1<=a.xp&&a.xp<=s+1&&o-1<=a.yp&&a.yp<=l+1)}defaultScatterFindItems(t,n,o,s,l){return this.findItemsInRange(t,n,o,s,l)}realTimeScatterFindItems(t,n,o,s,l){const a=[];for(let r=0;r<t[this.sId].dataGroup.length;r++){const c=t[this.sId].dataGroup[r];a.push(...this.findItemsInRange(c.data,n,o,s,l))}return a}findItems({xsp:t,ysp:n,width:o,height:s}){const l=this.data,a=t+o,r=n+s;let c=[];return this.realTimeScatter?c=this.realTimeScatterFindItems(l,t,n,a,r):c=this.defaultScatterFindItems(l,t,n,a,r),c}itemHighlight(t,n){const o=t.data,s=n,l=o.xp,a=o.yp;if(s.save(),l!==null&&a!==null){const r=o.dataColor||this.color,c=o.dataColor||this.pointFill;s.strokeStyle=this.getCachedColor(r,0),s.fillStyle=this.getCachedColor(c,this.highlight.maxShadowOpacity),ie.drawPoint(s,this.pointStyle,this.highlight.maxShadowSize,l,a),s.fillStyle=r,ie.drawPoint(s,this.pointStyle,this.highlight.maxSize,l,a),s.fillStyle="#fff",ie.drawPoint(s,this.pointStyle,this.highlight.defaultSize,l,a)}s.restore()}findGraphData(t){var c;const n=t[0],o=t[1],s={data:null,hit:!1,color:this.color,index:null},l=this.pointSize;if(this.realTimeScatter){const d=(c=this.data[this.sId])==null?void 0:c.dataGroup;if(!d)return s;let f=this._rtTotalCount-1;for(let m=d.length-1;m>=0;m--){const p=d[m];if(p!=null&&p.data)for(let g=p.data.length-1;g>=0;g--){const u=p.data[g];if(u.xp!==null&&u.yp!==null){const x=u.xp,b=u.yp;if(x-l<=n&&n<=x+l&&b-l<=o&&o<=b+l)return s.data=u,s.index=f,s.hit=!0,s}f--}}return s}const a=this.data,r=a.findIndex(d=>{const h=d.xp,f=d.yp;return h-l<=n&&n<=h+l&&f-l<=o&&o<=f+l});return r>-1&&(s.data=a[r],s.index=r,s.hit=!0),s}}class Nr{constructor(t,n,o,s){const l=Fe({},n,SC);Object.keys(l).forEach(a=>{this[a]=l[a]}),this.name===void 0&&(this.name=`series-${o}`),this.color===void 0&&(this.color=Nt[o%Nt.length]),this.type="bar",this.sId=t,this.data=[],this.isHorizontal=s,this.size={cat:0,bar:0,cPad:0,bPad:0,w:0,h:0,ix:0}}draw(t){var F,X,U,H,$;if(!this.show)return;const{isHorizontal:n,showValue:o}=this,s=t.ctx,l=t.chartRect,a=t.labelOffset,r=t.axesSteps,c=t.showIndex,d=t.thickness,h=t.showSeriesCount;let f,m;const p=r.x[this.xAxisIndex],g=r.y[this.yAxisIndex];let u=this.data.length;const[x,b]=n?[g.minIndex,g.maxIndex]:[p.minIndex,p.maxIndex];ve(x)&&ve(b)&&(u=b-x+1);const y=l.chartWidth-(a.left+a.right),w=l.chartHeight-(a.top+a.bottom),I=l.x1+a.left,E=l.y2-a.bottom,B=ie.calculateX(0,p.graphMin,p.graphMax,y),_=ie.calculateY(0,g.graphMin,g.graphMax,w),C=n?I+B:I,S=n?E:E+_,M=n?w:y,k=M/(u||1);let T;t.cPadRatio>=1||t.cPadRatio<=0?T=2:T=Math.max(M*(t.cPadRatio/2)/u,2);let L,N,v;L=k>T*2?k-T*2:k,L=this.isExistGrp?L:L/h;const O=this.calculateBarSize(d,L);N=n?null:O,v=n?O:null;const D=n?(L-v)/2:(L-N)/2,V=this.isExistGrp?1:c+1;this.size.cat=k,this.size.bar=L,this.size.cPad=T,this.size.bPad=D,this.size.w=N,this.size.h=v,this.size.ix=V,this.chartRect=l,this.labelOffset=a,this.borderRadius=t.borderRadius,this.filteredCount=u;const P=ve(x)?x:0,A=ve(b)?b:this.data.length-1;for(let j=P;j<=A;j++){const K=j-P,q=this.data[j];if(q){const Q=n?S-k*K-T:C+k*K+T;if(n?(f=C,m=Math.round(Q-(L*V-(v+D)))):(f=Math.round(Q+(L*V-(N+D))),m=S),n){const fe=q.b?q.o:q.x;N=ie.calculateX(fe,p.graphMin,p.graphMax,y,-B),q.b&&(f=ie.calculateX(q.b,p.graphMin,p.graphMax,y,C-B));const ke=fe>0?-1:1;N=fe&&Math.abs(N)===0?ke:N}else{const fe=q.b?q.o:q.y;v=ie.calculateY(fe,g.graphMin,g.graphMax,w,-_),q.b&&(m=ie.calculateY(q.b,g.graphMin,g.graphMax,w,S-_));const ke=fe>0?-1:1;v=fe&&Math.abs(v)===0?ke:v}const J=q.dataColor||this.color,ee=t==null?void 0:t.legendHitInfo,G=(F=t==null?void 0:t.selectLabel)==null?void 0:F.option,ne=(X=t==null?void 0:t.selectItem)==null?void 0:X.option,Z=((H=(U=t==null?void 0:t.selectLabel)==null?void 0:U.selected)==null?void 0:H.dataIndex)??[],{dataIndex:re,seriesID:me}=(($=t==null?void 0:t.selectItem)==null?void 0:$.selected)??{};let ae=!1;if(ee?ae=(ee==null?void 0:ee.sId)!==this.sId:G!=null&&G.use&&(G!=null&&G.useSeriesOpacity)?ae=Z.length&&!Z.includes(j):ht(re)&&(ne!=null&&ne.useSeriesOpacity)&&(this.isExistGrp?ae=re!==j:ae=re!==j||me!==this.sId),typeof J!="string")s.fillStyle=ie.createGradient(s,n,{x:f,y:m,w:N,h:v},J,ae,t.unSelectedOpacity);else{const fe=J.includes("rgba")?Y.getOpacity(J):1,ke=ae?t.unSelectedOpacity:fe;s.fillStyle=Y.colorStringToRgba(J,ke)}this.drawBar({ctx:s,positions:{x:f,y:m,w:N,h:v}}),o.use&&this.drawValueLabels({context:s,data:q,positions:{x:f,y:m,h:v,w:N},isHighlight:!1,textColor:q.dataTextColor,index:j}),q.xp=f,q.yp=m,q.w=N,q.h=n?-v:v,q.index=j,this.data[K]=q}}}itemHighlight(t,n,o,s){const l=this.showValue,a=t.data,r=n,c=a.xp,d=a.yp,h=a.w,f=a.h;r.save(),r.shadowOffsetX=0,r.shadowOffsetY=0,r.shadowBlur=4;const m=t.data.dataColor||this.color;if(typeof m!="string"){const p=ie.createGradient(r,this.isHorizontal,{x:c,y:d,w:h,h:f},m,!1,s);r.fillStyle=p,r.shadowColor=m[m.length-1][1]}else r.fillStyle=m,r.shadowColor=m;r.beginPath(),this.drawBar({ctx:r,positions:{x:c,y:d,w:h,h:this.isHorizontal?-f:f}}),l.use&&this.drawValueLabels({context:r,data:a,positions:{x:c,y:d,h:f,w:h},isHighlight:!0,textColor:t.data.dataTextColor||t.dataTextColor,index:o}),r.restore()}findGraphData(t,n,o,s){if(typeof o=="number"&&this.show&&s){const l=this.data,a={data:null,hit:!1,color:this.color};return l[o]&&(a.data=l[o],a.index=o,a.hit=this.isPointInBar(t,l[o])),a}return n?this.findGraphRangeCount(t):this.findGraphRange(t)}binarySearchBar(t,n){const[o,s]=t,l={data:null,hit:!1,color:this.color},a=this.data,r=this.filteredCount??a.length;let c=0,d=r-1;for(;c<=d;){const h=Math.floor((c+d)/2),f=a[h],{xp:m,yp:p,w:g,h:u}=f,x=m+g,b=p+u;if(n?b<=s&&s<=p:m<=o&&o<=x)return l.data=f,l.index=f.index,l.hit=this.isPointInBar(t,f),l;(n?!(b<s):m+4<o)?c=h+1:d=h-1}return l}findGraphRange(t){return this.binarySearchBar(t,!1)}findGraphRangeCount(t){return this.binarySearchBar(t,!0)}drawValueLabels({context:t,data:n,positions:o,isHighlight:s,textColor:l,index:a}){const r=this.isHorizontal,{fontSize:c,textColor:d,align:h,formatter:f,decimalPoint:m}=this.showValue,{x:p,y:g,w:u,h:x}=o,b=t;b.save(),b.beginPath(),b.font=`normal normal normal ${c}px Roboto`,b.fillStyle=l||d,b.lineWidth=1,b.textBaseline="middle",b.textAlign=r&&h!=="center"?"left":"center";let y;const w=ht(this.stackIndex);w?y=n.o:y=(r?n.x:n.y)??"";let I;f&&(I=f(y,{label:r?n.y:n.x,index:a})),(!f||typeof I!="string")&&(I=Y.labelSignFormat(y,m)??"");const E=y<0,B=Math.round(b.measureText(I).width),_=c,C=10,S=E?p-C:p+C,M=E?g+C:g-C,k=p+u/2,T=s?g+x/2:g-x/2,R=Math.abs(u)-C,L=Math.abs(x)-C;switch(h){case"start":{if(r&&B<R){const N=E?S-B:S;b.fillText(I,N,T)}else if(!r&&_<L){const N=E?g+C:g-C;b.fillText(I,k,N)}break}case"center":{r&&B<R?b.fillText(I,k,T):!r&&_<L&&b.fillText(I,k,g+x/2);break}case"out":{if(w){console.warn("[EVUI][Bar Chart] In case of Stack Bar Chart, 'out' of 'showValue''s align is not supported.");return}if(r){const N=this.chartRect.x1+this.labelOffset.left,v=this.chartRect.x2-this.labelOffset.right;if(E){const O=p-C+u-B;O>N&&b.fillText(I,O,T)}else{const O=p+C+u;O+B<v&&b.fillText(I,O,T)}}else{const N=E?g+x+C:g+x-C;b.fillText(I,k,N)}break}default:case"end":{if(r&&B<R){const N=E?p+u+C:p+u-B-C;b.fillText(I,N,T)}else if(!r){if(E){const N=g+x-C;N>M&&b.fillText(I,k,N)}else if(_<L){const N=g+x+C;b.fillText(I,k,N)}}break}}b.restore()}calculateBarSize(t,n){return typeof t=="string"&&/[0-9]+px/.test(t)?Math.min(n,Number(t.replace("px",""))):typeof t=="number"&&t<=1&&t>=0?Math.ceil(n*t):n}drawBar({ctx:t,positions:n}){const{isHorizontal:o,borderRadius:s}=this,l="stackIndex"in this,a=s&&s>0,{x:r,y:c,w:d}=n,h=o?-n.h:n.h;if(!(d===0||h===0)){if(t.save(),a&&!l)try{this.drawRoundedRect(t,n)}catch{t.fillRect(r,c,d,h)}else t.fillRect(r,c,d,h);t.restore()}}isPointInBar(t,n){const[o,s]=t,{xp:l,yp:a,w:r,h:c}=n,d=l+r,h=a+c;return l<=o&&o<=d&&h<=s&&s<=a}drawRoundedRect(t,n){const{chartRect:o,labelOffset:s,isHorizontal:l,borderRadius:a}=this,{x:r,y:c}=n;let{w:d,h}=n,f=a;const m=new Path2D;m.rect(o.x1+s.left,o.y1,o.chartWidth-s.right,o.chartHeight-s.bottom),t.clip(m),t.beginPath(),t.moveTo(r,c),Math.abs(d)<f*2&&(f=Math.abs(d)/2),Math.abs(h)<f*2&&(f=Math.abs(h)/2),l?d<0?(d+=f,t.lineTo(r+d,c),t.arcTo(r+d-f,c,r+d-f,c-f,f),t.arcTo(r+d-f,c-h,r+d,c-h,f),t.lineTo(r,c-h),t.lineTo(r,c)):(d-=f,t.lineTo(r+d,c),t.arcTo(r+d+f,c,r+d+f,c-f,f),t.arcTo(r+d+f,c-h,r+d,c-h,f),t.lineTo(r,c-h),t.lineTo(r,c)):h>0?(h-=f,t.lineTo(r+d,c),t.lineTo(r+d,c+h),t.arcTo(r+d,c+h+f,r-d+f,c+h+f,f),t.arcTo(r,c+h+f,r,c+h,f),t.lineTo(r,c)):(h+=f,t.lineTo(r+d,c),t.lineTo(r+d,c+h),t.arcTo(r+d,c+h-f,r+d-f,c+h-f,f),t.arcTo(r,c+h-f,r,c+h,f),t.lineTo(r,c)),t.fill(),t.closePath()}}class IC extends Nr{draw(t){if(!this.show)return;const n=t.ctx,o=t.chartRect,s=t.labelOffset,l=t.axesSteps,a=t.showIndex,r=t.isHorizontal,c=t.thickness,d=t.showSeriesCount;let h,f;const m=l.x[this.xAxisIndex],p=l.y[this.yAxisIndex],g=o.chartWidth-(s.left+s.right),u=o.chartHeight-(s.top+s.bottom),x=o.x1+s.left,b=o.y2-s.bottom,y=o.x2-s.right,I=(r?u:g)/(this.data.length||1),E=2;let B;this.isExistGrp?B=I-E*2:B=(I-E*2)/d;const C=typeof c=="string"&&/[0-9]+px/.test(c)?Math.min(B,Number(c.replace("px",""))):typeof c=="number"&&c<=1&&c>=0?Math.ceil(B*c):B;let S=r?null:C,M=r?null:C,k=r?C:null;const T=r?(B-k)/2:(B-S)/2,R=this.isExistGrp?1:a+1;this.size.cat=I,this.size.bar=B,this.size.cPad=E,this.size.bPad=T,this.size.w=S,this.size.ix=R,this.chartRect=o,this.labelOffset=s,this.borderRadius=t.borderRadius,this.data.forEach((L,N)=>{if(n.beginPath(),r?(h=x,f=ie.calculateY(L.y,p.graphMin,p.graphMax,u,b)):(h=ie.calculateSubX(L.x,m.graphMin,m.graphMax,g,x),h<x?(M-=x-h,h=h+S<x?null:x):h+S>y&&(M-=M-(y-h)),h>=y&&(h=null),h!==null&&(h+=Math.ceil(B*R)-Math.round(S+T)),f=b),r?L.b?(S=ie.calculateX(L.x-L.b,m.graphMin,m.graphMax,g),h=ie.calculateX(L.b,m.graphMin,m.graphMax,g,x)):S=ie.calculateX(L.x,m.graphMin,m.graphMax,g):L.b?(k=ie.calculateY(L.y-L.b,p.graphMin,p.graphMax,u),f=ie.calculateY(L.b,p.graphMin,p.graphMax,u,b)):k=ie.calculateY(L.y,p.graphMin,p.graphMax,u),h!==null&&f!==null){const v=L.dataColor||this.color,O=v.includes("rgba")?Y.getOpacity(v):1,D=this.state==="downplay"?t.unSelectedOpacity:O;typeof v!="string"?(S=S!==M?M:S,n.fillStyle=ie.createGradient(n,r,{x:h,y:f,w:S,h:k},v,this.state==="downplay",t.unSelectedOpacity)):n.fillStyle=Y.colorStringToRgba(v,D),this.drawBar({ctx:n,positions:{x:h,y:f,w:S,h:k}}),this.showValue.use&&this.drawValueLabels({context:n,data:L,positions:{x:h,y:f,h:k,w:S},isHighlight:!1,index:N})}M=S,L.xp=h,L.yp=f,L.w=S,L.h=r?-k:k})}}class vC{constructor(t,n,o){const s=ys({},wC,n);Object.keys(s).forEach(l=>{this[l]=s[l]}),this.name===void 0&&(this.name=`series-${o}`),this.color===void 0&&(this.color=Nt[o%Nt.length]),this.sId=t,this.show=!0,this.data=[],this.type="pie",this.centerX=0,this.centerY=0,this.radius=0,this.doughnutHoleSize=0,this.startAngle=0,this.endAngle=0,this.ctx=null,this.isSelect=!1}draw(t,n,o){var h;const s=t??this.ctx,l=new Path2D,a=this.isSelect?this.radius+5:this.radius,r=this.color,c=r.includes("rgba")?Y.getOpacity(r):1,d=this.isDownplay?o:c;s.beginPath(),l.moveTo(this.centerX,this.centerY),l.arc(this.centerX,this.centerY,a,this.startAngle,this.endAngle),l.lineTo(this.centerX,this.centerY),s.fillStyle=Y.colorStringToRgba(r,d),s.fill(l),n.use&&(s.lineCap="round",s.lineWidth=n==null?void 0:n.lineWidth,s.strokeStyle=n==null?void 0:n.color,s.stroke(l)),(h=this.showValue)!=null&&h.use&&this.drawValueLabels(s),s.closePath(),this.ctx=s}findGraphData([t,n]){const o={data:null,hit:!1,color:null,index:-1},{radius:s,startAngle:l,endAngle:a,centerX:r,centerY:c}=this,d=Math.sqrt((t-r)**2+(n-c)**2),h=2.5*Math.PI-Math.atan2(t-r,n-c),f=s>d&&h>=l&&h<=a;return this.show&&f&&(o.type=this.type,o.data=this.data,o.hit=!0,o.color=this.color,o.index=0),o}itemHighlight(t,n){var a,r;const o=n,s=this.isSelect?this.radius+5:this.radius;o.save(),o.shadowOffsetX=0,o.shadowOffsetY=0,o.shadowBlur=4;const l=((a=t==null?void 0:t.data)==null?void 0:a.dataColor)||this.color;o.fillStyle=l,o.shadowColor=l,o.beginPath(),o.moveTo(this.centerX,this.centerY),o.arc(this.centerX,this.centerY,s,this.startAngle,this.endAngle),o.lineTo(this.centerX,this.centerY),o.fill(),(r=this.showValue)!=null&&r.use&&this.drawValueLabels(o),o.closePath(),o.restore()}drawValueLabels(t){const n=t,o=this.data.o,{fontSize:s,textColor:l,formatter:a}=this.showValue;let r;a&&(r=a({value:o,percentage:this.data.percentage})),(!a||typeof r!="string")&&(r=Y.labelSignFormat(o));const c=1.8,d=this.radius-this.doughnutHoleSize,h=(this.endAngle-this.startAngle)*180/Math.PI,f=s+4,m=Math.round(n.measureText(r).width);if(h>=m*c&&h>=f*c&&d>=m*c&&d>=f*c){n.save(),n.beginPath();const p=l.includes("rgba")?Y.getOpacity(l):1,g=this.state==="downplay"?this.unSelectedOpacity:p;n.font=`normal normal normal ${s}px Roboto`,n.fillStyle=Y.colorStringToRgba(l,g),n.lineWidth=1,n.textAlign="center",n.textBaseline="middle";const u=d/2+this.doughnutHoleSize,x=(this.endAngle-this.startAngle)/2+this.startAngle,b=u*Math.cos(x)+this.centerX,y=u*Math.sin(x)+this.centerY;n.fillText(r,b,y),n.restore()}}}class TC{constructor(t,n,o,s,l){const a=ys({},kC,n);Object.keys(a).forEach(r=>{this[r]=a[r]}),this.isHorizontal=s,this.isGradient=l,this.createColorState(o),this.sId=t,this.data=[],this.labels={x:[],y:[]},this.valueOpt={},this.size={w:0,h:0},this.type="heatMap",this.currentLabelInfo={x:{steps:0,min:0,max:0},y:{steps:0,min:0,max:0}}}createColorState(t){const n=[],o=/[^0-9]&[^,]/g,{min:s,max:l,rangeCount:a,colorsByRange:r,error:c,stroke:d}=t,h=s.includes("#")?Y.hexToRgb(s):s.replace(o,""),f=l.includes("#")?Y.hexToRgb(l):l.replace(o,""),[m,p,g]=h.split(","),[u,x,b]=f.split(",");if(this.isGradient)n.push({minColor:{minR:m,minG:p,minB:g},maxColor:{maxR:u,maxG:x,maxB:b},rangeCount:a,start:0,end:100,selectedValue:null});else if(r.length)r.forEach(({color:y,label:w},I)=>{n.push({id:`color#${I}`,color:y,label:w,state:"normal",show:!0})});else{const y=Math.floor((m-u)/(a-1)),w=Math.floor((p-x)/(a-1)),I=Math.floor((g-b)/(a-1));for(let E=0;E<a;E++){const B=+m-y*E,_=+p-w*E,C=+g-I*E;n.push({id:`color#${E}`,color:`rgb(${B},${_},${C})`,state:"normal",show:!0})}}this.colorState=n,this.errorColor=c,this.stroke=d}getColorForGradient(t){const{minColor:n,maxColor:o}=this.colorState[0],{minR:s,minG:l,minB:a}=n,{maxR:r,maxG:c,maxB:d}=o,h=+s-Math.floor((s-r)*t/100),f=+l-Math.floor((l-c)*t/100),m=+a-Math.floor((a-d)*t/100);return`rgb(${h},${f},${m})`}getColorIndexByValue(t){const{existError:n,min:o,interval:s,decimalPoint:l}=this.valueOpt,a=this.colorState.length-1;if(n&&t<0)return a;const r=Math.floor(+(t-o).toFixed(l)/s);return r>=a?n?a-1:a:r}getItemInfo(t){const{min:n,max:o}=this.valueOpt,s={show:!1,opacity:1,dataColor:null,id:null,isHighlight:null};if(this.isGradient){const l=We(t-n,o-n),{start:a,end:r,selectedValue:c}=this.colorState[0];(t<0||a<=l&&l<=r)&&(s.show=!0,s.isHighlight=c!==null&&Math.floor(t)===Math.floor(n+(o-n)*(c/100)),s.dataColor=t<0?this.errorColor:this.getColorForGradient(l))}else{const l=this.getColorIndexByValue(t),{show:a,state:r,color:c,id:d}=this.colorState[l];s.show=a,s.opacity=r==="downplay"?.1:1,s.dataColor=t<0?this.errorColor:c,s.id=d}return s}drawItem(t,n,o,s,l,a){if(t.beginPath(),!(s<0||l<0)){if(a.show){const{radius:r}=a;if(r>0){const c=Math.min(s,l);let d=r;d>c/2&&(d=Math.floor(c/2)),t.moveTo(n+d,o),t.arcTo(n+s,o,n+s,o+l,d),t.arcTo(n+s,o+l,n,o+l,d),t.arcTo(n,o+l,n,o,d),t.arcTo(n,o,n+s,o,d),t.stroke(),t.fill()}else t.strokeRect(n,o,s,l),t.fillRect(n,o,s,l)}else{const r=Y.aliasPixel(1);t.fillRect(n,o-r,s+r,l+r)}t.closePath()}}calculateXY(t,n,o,s){let l=null;if(this.labels[t]&&this.labels[t].length){let a=this.labels[t].findIndex(m=>m===n);a===-1&&(a=this.labels[t].findIndex(m=>+m==+n));const{minIndex:r,maxIndex:c,graphMin:d,graphMax:h}=s;if(ve(c)&&a>c||ve(r)&&a<r||Gi(r)&&Gi(c)&&(n<d||n>h))return null;const f=r??this.labels[t].findIndex(m=>+m==+d);a>-1&&(a-=f>-1?f:0,l=t==="x"?o+this.size.w*a:o-this.size.h*(a+1))}return l}draw(t){if(!this.show)return;const{ctx:n,chartRect:o,labelOffset:s,overlayCtx:l,selectLabel:a,legendHitInfo:r,selectItem:c,axesSteps:d}=t,h=o.chartWidth-(s.left+s.right),f=o.chartHeight-(s.top+s.bottom),m=o.x1+s.left,p=o.y2-s.bottom,g=d.x[this.xAxisIndex],u=d.y[this.yAxisIndex];this.size.w=h/g.oriSteps,this.size.h=f/u.oriSteps,this.currentLabelInfo={x:{steps:g.oriSteps,min:g.graphMin,max:g.graphMax},y:{steps:u.oriSteps,min:u.graphMin,max:u.graphMax}};const x=(b,y,w)=>{var I,E;if(!r){let B;const{option:_,selected:C}=c,{option:S,selected:M}=a,k=ht(C==null?void 0:C.dataIndex)&&(C==null?void 0:C.dataIndex)>-1,T=((I=M==null?void 0:M.label)==null?void 0:I.length)>0;return k?B=_.useSeriesOpacity?w!==(C==null?void 0:C.dataIndex):!1:T&&(B=S.useSeriesOpacity?!((E=M==null?void 0:M.label)!=null&&E.includes(this.getItemLabel(a,b))):!1),B?.1:y}return y};this.data.forEach((b,y)=>{var S;let I=this.calculateXY("x",b.x,m,g),E=this.calculateXY("y",b.y,p,u),B=this.size.w,_=this.size.h;const C=b.o;if(I!==null&&E!==null&&C!==null&&C!==void 0){const{show:M,opacity:k,dataColor:T,id:R,isHighlight:L}=this.getItemInfo(C);let N=k;k===1&&Y.getColorStringType(b.dataColor)==="RGBA"&&(N=Y.getOpacity(b.dataColor));const v=x(b,N,y);if(b.dataColor||(b.dataColor=T),b.cId=R,n.save(),M){n.fillStyle=Y.colorStringToRgba(b.dataColor,v);let O=this.stroke;const D=c==null?void 0:c.option,V=(D==null?void 0:D.use)&&(D==null?void 0:D.showBorder),P=y===((S=c==null?void 0:c.selected)==null?void 0:S.dataIndex);V&&P&&(O={show:D==null?void 0:D.showBorder,...D==null?void 0:D.borderStyle});let A=!1;if(O.show&&O.lineWidth>0){const{color:F,lineWidth:X,opacity:U}=O,H=X*2;A=H<Math.floor(B)&&H<Math.floor(_),n.strokeStyle=A?Y.colorStringToRgba(F,v===1?U:v):void 0,A?(n.lineWidth=X,I+=X,E+=X,B-=H,_-=H):n.lineWidth=0}I+=1,b.xp=I,b.yp=E,b.w=B,b.h=_,this.drawItem(n,I,E,B,_,{...O,show:A}),n.restore(),this.showValue.use&&this.drawValueLabels({context:n,data:b}),L&&this.itemHighlight({data:b},l)}}})}drawValueLabels({context:t,data:n}){const{fontSize:o,textColor:s,align:l,formatter:a,decimalPoint:r}=this.showValue,{xp:c,yp:d,w:h,h:f,o:m}=n,p=t;p.save(),p.beginPath(),p.font=`normal normal normal ${o}px Roboto`,p.fillStyle=s,p.lineWidth=1,p.textBaseline="middle",p.textAlign=l!=="center"?"left":"center";let g;a&&(g=a(m)),(!a||typeof g!="string")&&(g=Y.labelSignFormat(m,r));const u=Math.round(p.measureText(g).width),x=o,b=c+h/2,y=d+f/2;if(!(u>=h||x>=f||g<0)){switch(l){case"top":{const w=b-u/2,I=y-x/2;p.fillText(g,w,I);break}case"right":{const w=c+h-u;p.fillText(g,w,y);break}case"bottom":{const w=b-u/2,I=y+x/2;p.fillText(g,w,I);break}case"left":p.fillText(g,c,y);break;default:{const w=b-u/2;p.fillText(g,w,y);break}}p.restore()}}getAdjustedBounds({xp:t,yp:n,width:o,height:s}){const a=Math.max(0,o),r=Math.max(0,s);return{xsp:Math.floor(t*100)/100,xep:Math.ceil((t+a)*100)/100,ysp:Math.floor(n*100)/100,yep:Math.ceil((n+r)*100)/100}}findItems(t){const n=this.data,{xsp:o,xep:s,ysp:l,yep:a}=this.getAdjustedBounds({xp:t.xsp,yp:t.ysp,width:t.width,height:t.height});return n.filter(({xp:r,yp:c,w:d,h})=>{const{xsp:f,xep:m,ysp:p,yep:g}=this.getAdjustedBounds({xp:r,yp:c,width:d,height:h});return f>=o&&m<=s&&p>=l&&g<=a})}itemHighlight(t,n){var u;const o=t.data,s=n,{stroke:l,shadow:a}=this.highlight,r=o.xp,c=o.yp,d=o.w,h=o.h,f=o.cId;let m;if(this.isGradient){const{min:x,max:b}=this.valueOpt,y=We(o.o-x,b-x),{start:w,end:I}=this.colorState[0];m=w<=y&&y<=I||o.o===-1}else m=(u=this.colorState.find(({id:x})=>x===f))==null?void 0:u.show;if(r===null||c===null||!m)return;s.save();const p=Y.getColorStringType(o.dataColor)==="RGBA"?t.dataColor:Y.colorStringToRgba(o.dataColor,1);s.fillStyle=p,a.use&&(s.shadowOffsetX=a.offsetX,s.shadowOffsetY=a.offsetY,s.shadowBlur=a.blur,s.shadowColor=a.color);const g={color:"",lineWidth:1,opacity:1,radius:0,show:!0};if(l.use){const{color:x,width:b,radius:y}=l;g.show=!0,g.radius=y,s.lineWidth=b,g.lineWidth=b,s.strokeStyle=x||p,g.color=x||p}else g.show=!1,s.strokeStyle=p,g.color=p;this.drawItem(s,r-.5,c-.5,d+1,h+1,g),s.restore(),this.showValue.use&&this.drawValueLabels({context:s,data:o})}findGraphData(t){const n=t[0],o=t[1],s={data:null,hit:!1,color:null,dataColor:null,name:null},l=this.data,a=l.findIndex(r=>{const{xp:c,yp:d,w:h,h:f}=r;return c<=n&&n<=c+h&&d<=o&&o<=d+f});if(a>-1){const r=l[a];s.data=r,s.color=r.dataColor,s.dataColor=r.dataColor,s.index=a,s.hit=!0}return s}findBlockRange({xcp:t,xep:n,ycp:o,yep:s,range:l}){const a=this.labels,r=1,c={xsp:Math.min(t,n),ysp:Math.min(o,s),width:Math.ceil(Math.abs(n-t)),height:Math.ceil(Math.abs(s-o))};if(a.x.length&&a.y.length){const d=this.currentLabelInfo.x.steps||a.x.length,h=this.currentLabelInfo.y.steps||a.y.length,{x1:f,x2:m,y1:p,y2:g}=l,u=(m-f)/d,x=(g-p)/h,b={xsp:t,xep:n,ysp:o,yep:s},y=(w,I,E)=>{let B,_,C;w==="x"?(_=u,C=f+r):(_=x,C=p),a[w].findIndex((M,k)=>(B=C+_*k,B<=I&&I<=B+_))>-1?b[E]=["xsp","ysp"].includes(E)?B:B+_:I<C&&(b[E]=C)};y("x",Math.min(t,n),"xsp"),y("x",Math.max(t,n),"xep"),y("y",Math.min(o,s),"ysp"),y("y",Math.max(o,s),"yep"),c.xsp=Math.min(b.xsp,b.xep),c.ysp=Math.min(b.ysp,b.yep),c.width=Math.abs(b.xep-b.xsp),c.height=Math.abs(b.yep-b.ysp)}return c}getFilteredLabel(t,n,o,s){return t.length!==n?t.filter(l=>o<=l&&l<=s):t}findSelectionRange(t){const{xsp:n,ysp:o,width:s,height:l,range:a}=t;let r=null;const{x1:c,x2:d,y1:h,y2:f}=a,{x:m,y:p}=this.labels;if(m.length&&p.length){const{x:{steps:g,min:u,max:x},y:{steps:b,min:y,max:w}}=this.currentLabelInfo,I=g||m.length,E=b||p.length,B=(d-c)/I,_=(f-h)/E,C=n+s,S=o+l,M={min:Math.floor((n-c)/B),max:Math.floor((C-c-B)/B)},k=E-1,T={min:k-Math.round((S-h-_)/_),max:k-Math.round((o-h)/_)},R=this.getFilteredLabel(m,I,u,x),L=this.getFilteredLabel(p,E,y,w);r={xMin:R[M.min],xMax:R[M.max],yMin:L[T.min],yMax:L[T.max]}}return r}getItemLabel(t,n){const{option:o,selected:s}=t;let l=this.isHorizontal?n.y:n.x;return o!=null&&o.useBothAxis&&(s!=null&&s.targetAxis)&&(l=(s==null?void 0:s.targetAxis)==="yAxis"?n.y:n.x),l}}const Lr={Store:bC,Series:{createSeriesSet(e,t,n,o){let s=Object.keys(e);this.options.overlapping.use&&(s=this.getOverlappingSeriesKeys(e,t,o)),s.forEach((l,a)=>{const r=e[l].type||t;this.seriesList[l]=this.addSeries({type:r,id:l,opt:e[l],index:a,isHorizontal:n})})},getOverlappingSeriesKeys(e,t,n){const o=[],s=[],l=n.flat();return Object.keys(e).forEach(a=>{if((e[a].type||t)==="bar"&&l.length){const d=l.findIndex(h=>h===a);o.push({key:a,overlappingIdx:d})}else s.push({key:a})}),o.sort((a,r)=>r.overlappingIdx-a.overlappingIdx),[...o,...s].map(({key:a})=>a)},addSeries(e){var a;const{type:t,id:n,opt:o,index:s,isHorizontal:l}=e;if(t==="line")return this.seriesInfo.charts.line.push(n),new MC(n,o,s);if(t==="scatter")return this.seriesInfo.charts.scatter.push(n),new EC(n,o,s,(a=this.options.realTimeScatter)==null?void 0:a.use);if(t==="bar")return this.seriesInfo.charts.bar.push(n),o.timeMode?new IC(n,o,s,l):new Nr(n,o,s,l);if(t==="pie")return this.seriesInfo.charts.pie.push(n),new vC(n,o,s);if(t==="heatMap"){this.seriesInfo.charts.heatMap.push(n);const{heatMapColor:r,legend:c}=this.options,d=c.type==="gradient";return new TC(n,o,r,l,d)}return!1},addGroupInfo(e){e.forEach((t,n)=>{let o=0;t.reduce((s,l,a)=>{const r=this.seriesList[l];return r.stackIndex=a+o,r.groupIndex=n,r.isExistGrp=!0,r.bsId=s,r.bsIds=t.filter((c,d)=>c!==l&&a>d),r.isOverlapping=this.options.overlapping.use,r.show||o--,r.show?l:s},t[0])})}}};class oo{constructor(t,n,o,s){const l=Fe({},n,Br);Object.keys(l).forEach(a=>{this[a]=l[a]}),this.type=t,this.ctx=o,this.units=CC[this.type],this.options=s,this.position||(this.position=t==="x"?"bottom":"left")}calculateLabelRange(t,n,o,s){let l,a,r;t==="x"?(l=n.chartWidth,r=Math.floor(s*1.1),a=[o.left,o.right]):(l=n.chartHeight,a=[o.top,o.bottom],r=s+Math.floor(l*.1));const c=l-(a[0]+a[1]),d=1,h=Math.max(Math.floor(c/r)-1,1);return{min:d,max:h}}calculateScaleRange(t,n){var d;let o,s,l=!1;const a=n!=null&&n.use?n==null?void 0:n.range:this.range;Array.isArray(a)&&(a==null?void 0:a.length)===2?this.options.type==="heatMap"?(o=a[1]>+t.max?+t.max:a[1],s=a[0]<+t.min?+t.min:a[0]):(o=a[1],s=a[0]):typeof a=="function"?[s,o]=a(t.min,t.max):(o=t.max,s=t.min),this.autoScaleRatio&&(o=Math.ceil(o*(this.autoScaleRatio+1))),this.startToZero&&(s=0),o===s&&(o+=1,l=!0);const r=this.getLabelFormat(s),c=this.getLabelFormat(o,{isMaxValueSameAsMin:l});return{min:s,max:o,minLabel:r,maxLabel:c,size:Y.calcTextSizeCanvas(c,Y.getLabelStyle(this.labelStyle),(d=this.labelStyle)==null?void 0:d.padding)}}getLabelWidthHasMaxLength(t,n){return(t??[]).reduce((o,s)=>{var r;const l=this.getLabelFormat(s),a=((r=Y.calcTextSizeCanvas(l,Y.getLabelStyle(this.labelStyle)))==null?void 0:r.width)??0;return Math.max(o,a)},0)}calculateSteps(t){const{maxValue:n,minValue:o}=t;let{maxSteps:s}=t,l=this.getInterval(t),a=o,r;for(;a<n;)a+=l;const c=a,d=o,h=c-d;if(r=Math.round(h/l),n===1&&(this.decimalPoint?s>2?(l=.2,r=5,s=5):(l=.5,r=2,s=2):(l=1,r=1,s=1)),this.fixedSteps)return{steps:r,interval:l,graphMin:d,graphMax:c};for(;r>s;)l*=2,r=Math.round(h/l),l=Math.ceil(h/r);return c-d>r*l&&(l=Math.ceil((c-d)/r)),{steps:r,interval:l,graphMin:d,graphMax:c}}drawAxisTitle(t,n){const o=this.title;if(!(o!=null&&o.use)||isNaN(o.fontSize))return;const s=this.ctx;s.save(),s.font=Y.getLabelStyle(o),s.fillStyle=o.color,s.textAlign=o.textAlign;const l={xLeft:t.x1+n.left,xRight:t.x2-n.right,yTop:t.y1};let a,r;const c=10;this.type==="x"?(a=l.xRight,r=t.y2+o.fontSize+c):(r=l.yTop-o.fontSize-c,a=l.xLeft),a>0&&r>0&&s.fillText(o.text,a,r),s.restore()}draw(t,n,o,s,l,a){var I,E,B,_,C,S,M,k,T,R,L,N,v,O,D,V,P,A,F,X;const r=this.ctx,c=this.options,d={x1:t.x1+n.left,x2:t.x2-n.right,y1:t.y1+n.top,y2:t.y2-n.bottom},h=o.steps,f=o.graphMin,m=o.graphMax,p=o.interval,g=d[this.units.rectStart],u=d[this.units.rectEnd],x=d[this.units.rectOffset(this.position)],b=d[this.units.rectOffsetCounter(this.position)],y=5;let w;if(this.drawAxisTitle(t,n),r.font=Y.getLabelStyle(this.labelStyle),r.fillStyle=this.labelStyle.color,this.type==="x"?(r.textAlign="center",r.textBaseline=this.position==="top"?"bottom":"top"):(r.textAlign=this.position==="left"?"right":"left",r.textBaseline="middle"),this.showAxis&&(r.lineWidth=this.axisLineWidth,w=Y.aliasPixel(r.lineWidth),r.beginPath(),r.strokeStyle=this.axisLineColor,this.type==="x"?(r.moveTo(g,x+w),r.lineTo(u,x+w)):(r.moveTo(x+w,g),r.lineTo(x+w,u)),r.stroke(),r.closePath()),!(h===0||f===null)){if((I=this.labelStyle)!=null&&I.show){const U=u-g,H=U/h,$=[],j=o.interval;let K=null,q=null,Q=g,J=f;if(this.type==="x"&&(c!=null&&c.axesX[0].flow)&&a.length!==h+1){const G=Math.floor(f/j)*j;G!==+f&&(J=G+j,Q+=U/(m-f)*(J-f))}r.strokeStyle=this.gridLineColor,r.lineWidth=1,w=Y.aliasPixel(r.lineWidth);let ee;for(let G=0;G<=h;G++)if(K=Math.round(Q+H*G),K<=u||this.type!=="x"||!(c!=null&&c.axesX[0].flow)||a.length===h+1){r.beginPath(),$[G]=J+G*p,$[G]===0&&this.zeroLineColor?r.strokeStyle=this.zeroLineColor:r.strokeStyle=this.gridLineColor,q=K+w,ee=this.getLabelFormat(Math.min(m,$[G]),{prev:$[G-1]??""});const Z=((B=(E=this.options)==null?void 0:E.selectLabel)==null?void 0:B.use)&&((C=(_=this.options)==null?void 0:_.selectLabel)==null?void 0:C.useLabelOpacity)&&this.options.horizontal===(this.type==="y")&&((S=l==null?void 0:l.dataIndex)==null?void 0:S.length)&&!(l!=null&&l.label.map(fe=>this.getLabelFormat(Math.min(m,fe),{prev:$[G-1]??""})).includes(ee)),re=this.labelStyle.color;let me=1;Y.getColorStringType(re)==="RGBA"&&(me=Y.getOpacity(re)),r.fillStyle=Y.colorStringToRgba(re,Z?(M=this.options)==null?void 0:M.unSelectedOpacity:me);let ae;if(this.type==="x"){if(ae=this.position==="top"?x-10:x+10,((k=c==null?void 0:c.brush)!=null&&k.showLabel||!(c!=null&&c.brush))&&r.fillText(this.checkFixWidth(ee),K,ae),!Z&&((T=c==null?void 0:c.selectItem)!=null&&T.showLabelTip)&&(s!=null&&s.label)&&!((R=this.options)!=null&&R.horizontal)){const fe=this.getLabelFormat(Math.min(m,s.label+0*p));if(fe===ee){const ke=Math.round(r.measureText((L=this.labelStyle)==null?void 0:L.fontSize).width);Y.showLabelTip({ctx:this.ctx,width:Math.round(r.measureText(fe).width)+10,height:ke,x:K,y:ae+(ke-2),borderRadius:2,arrowSize:3,text:ee,backgroundColor:(v=(N=c==null?void 0:c.selectItem)==null?void 0:N.labelTipStyle)==null?void 0:v.backgroundColor,textColor:(D=(O=c==null?void 0:c.selectItem)==null?void 0:O.labelTipStyle)==null?void 0:D.textColor})}}this.showAxisTick&&(r.beginPath(),r.strokeStyle=this.axisLineColor,r.moveTo(q,x),r.lineTo(q,x+y),r.stroke(),r.closePath()),(G!==0||c!=null&&c.axesX[0].flow)&&this.showGrid&&(r.beginPath(),r.strokeStyle=this.gridLineColor,r.moveTo(q,x),r.lineTo(q,b),r.stroke(),r.closePath())}else ae=this.position==="left"?x-10:x+10,((V=c==null?void 0:c.brush)!=null&&V.showLabel||!(c!=null&&c.brush))&&r.fillText(this.checkFixWidth(ee),ae,K),G===h&&(q-=1),this.showAxisTick&&(r.beginPath(),r.strokeStyle=this.axisLineColor,r.moveTo(x+(this.axisLineWidth??1),q),r.lineTo(x-y,q),r.stroke(),r.closePath()),G!==0&&this.showGrid&&(r.beginPath(),r.strokeStyle=this.gridLineColor,r.moveTo(x,q),r.lineTo(b,q),r.stroke(),r.closePath())}}if((P=this.plotBands)!=null&&P.length||(A=this.plotLines)!=null&&A.length){const U=t.chartWidth-(n.left+n.right),H=t.chartHeight-(n.top+n.bottom),$=w+1,j=d.x1,K=d.x2+$,q=d.y1-$,Q=d.y2;(F=this.plotBands)==null||F.forEach(J=>{const ee=Fe({},J,Rr),{from:G,to:ne,label:Z}=ee,re=Y.isNullOrUndefined(G)?f:Math.max(G,f),me=Y.isNullOrUndefined(ne)?m:Math.min(ne,m);this.setPlotBandStyle(ee);let ae,fe;if(this.type==="x"){if(ae=ie.calculateX(re,f,m,U,j),fe=ie.calculateX(me,f,m,U,j),ae===null||fe===null)return;this.drawXPlotBand(ae,fe,j,K,q,Q)}else{if(ae=ie.calculateY(re,f,m,H,Q),fe=ie.calculateY(me,f,m,H,Q),ae===null||fe===null)return;this.drawYPlotBand(ae,fe,j,K,q,Q)}if(Z.show){const ke=this.getNormalizedLabelOptions(t,Z),jt=this.getPlotBandLabelPosition(ae,fe,ke,K,q);this.drawPlotLabel(ke,jt)}r.restore()}),(X=this.plotLines)==null||X.forEach(J=>{if(typeof+J.value!="number")return;const ee=Fe({},J,Or),{value:G,label:ne}=ee;let Z;if(this.type==="x"){if(Z=ie.calculateX(G,f,m,U,j),Z===null)return;this.setPlotLineStyle(ee),this.drawXPlotLine(Z,j,K,q,Q)}else{if(Z=ie.calculateY(G,f,m,H,Q),Z===null)return;this.setPlotLineStyle(ee),this.drawYPlotLine(Z,j,K,q,Q)}if(ne.show){const re=this.getNormalizedLabelOptions(t,ne),me=this.getPlotLineLabelPosition(Z,re,K,q);this.drawPlotLabel(re,me)}r.restore()})}}}setPlotLineStyle(t){const n=this.ctx,{color:o,lineWidth:s}=t;n.beginPath(),n.save(),n.lineWidth=s,n.strokeStyle=o,t.segments&&n.setLineDash(t.segments)}setPlotBandStyle(t){const n=this.ctx,{color:o}=t;n.beginPath(),n.save(),n.fillStyle=o}drawXPlotBand(t,n,o,s,l,a){const r=this.ctx,c=d=>d||d>o||d<s;if(!c(t)||!c(n)){r.closePath(),r.restore();return}r.moveTo(t,l),r.lineTo(t,a),r.lineTo(n,a),r.lineTo(n,l),r.lineTo(t,l),r.stroke(),r.fill(),r.restore(),r.closePath()}drawXPlotLine(t,n,o,s,l){const a=this.ctx;if(!t||t<n||t>o){a.closePath(),a.restore();return}let r=t;r+=Y.aliasPixel(a.lineWidth),a.moveTo(r,l),a.lineTo(r,s),a.stroke(),a.restore(),a.closePath()}drawYPlotLine(t,n,o,s,l){const a=this.ctx;if(!t||t>l||t<s){a.closePath(),a.restore();return}let r=t;r+=Y.aliasPixel(a.lineWidth),a.moveTo(n,r),a.lineTo(o,r),a.stroke(),a.restore(),a.closePath()}drawYPlotBand(t,n,o,s,l,a){const r=this.ctx,c=d=>d||d>l||d<a;if(!c(t)||!c(n)){r.closePath(),r.restore();return}r.moveTo(o,t),r.lineTo(o,n),r.lineTo(s,n),r.lineTo(s,t),r.lineTo(o,t),r.fill(),r.restore(),r.closePath()}getNormalizedLabelOptions(t,n){const o=Fe({},n,Dr),s=this.ctx,{maxWidth:l}=o,a=o.fontSize>20?20:o.fontSize;let r=o.text,c=l??s.measureText(r).width;const d=this.type==="y"?t.width-t.chartWidth:l??t.width;return d<s.measureText(r).width&&o.textOverflow==="ellipsis"&&(r=Y.truncateLabelWithEllipsis(o.text,d,s),c=s.measureText(r).width),{label:r,fontSize:a,labelWidth:c,labelBoxPadding:a/4,labelHalfWidth:c/2,labelHalfHeight:a/2,...o}}getPlotBandLabelPosition(t,n,o,s,l){const{fontSize:a,labelWidth:r,labelHalfWidth:c,labelHalfHeight:d,labelBoxPadding:h,textAlign:f,verticalAlign:m}=o;if(a<=0)return{textX:0,textY:0};let p,g;if(this.type==="x")switch(g=l-h-a,f){case"left":p=t+c+h;break;case"right":p=n-c-h;break;case"center":default:p=(n-t)/2+t;break}else switch(p=s+r+h,m){case"top":g=n+d+h;break;case"bottom":g=t-d-h;break;case"middle":default:g=(t-n)/2+n;break}return{textX:p,textY:g}}getPlotLineLabelPosition(t,n,o,s){const{fontSize:l,labelWidth:a,labelHalfWidth:r,labelHalfHeight:c,labelBoxPadding:d}=n;if(l<=0)return{textX:0,textY:0};let h,f;if(this.type==="x")switch(f=s-d-l,n.textAlign){case"left":h=t-r-d;break;case"right":h=t+r+d;break;case"center":default:h=t;break}else switch(h=o+a+d,n.verticalAlign){case"top":f=t-c-d;break;case"bottom":f=t+c+d;break;case"middle":default:f=t;break}return{textX:h,textY:f}}drawPlotLabel(t,n){if(!n)return;const{textX:o,textY:s}=n,{label:l,fontSize:a,fontColor:r,fillColor:c,lineColor:d,lineWidth:h,labelBoxPadding:f,labelWidth:m,labelHalfWidth:p,labelHalfHeight:g}=t;if(a<=0)return;const u=this.ctx;u.save(),u.beginPath(),u.font=Y.getLabelStyle(t);let x=0,b=0,y=0,w=0;this.type==="x"?(x=s-f,b=s+a,y=o-p-f,w=o+p+f):(x=s-g-f,b=s+g+f,y=o-m,w=o+f),u.fillStyle=c,u.strokeStyle=d,u.lineWidth=h,u.moveTo(y,b),u.lineTo(y,x),u.lineTo(w,x),u.lineTo(w,b),u.lineTo(y,b),u.fill(),h>0&&u.stroke(),u.fillStyle=r,u.fillText(l,o,s),u.closePath()}checkFixWidth(t){const{fixWidth:n,fitDir:o}=this.labelStyle;return ve(n)&&n>0?Y.truncateLabelWithEllipsis(t,n,this.ctx,o):t}}class BC extends oo{getLabelFormat(t,n={}){if(this.formatter){const o=this.formatter(t,n);if(typeof o=="string")return o}return at(t).format(this.timeFormat)}getInterval(t){const n=t.maxValue,o=t.minValue,s=t.maxSteps;if(this.interval){if(typeof this.interval=="string")return si[this.interval].size;if(typeof this.interval=="object")return this.interval.time*si[this.interval.unit].size;if(typeof this.interval=="number")return this.interval}return Math.ceil((n-o)/s)}}class DC extends oo{getTruthyValue(t){return ve(t)&&!this.fixedSteps?Number(t.toFixed(this.decimalPoint)):t}getLabelFormat(t,n={}){if(this.formatter){const o=this.getTruthyValue(t),s=this.formatter(o,{...n,prevOriginalValue:n==null?void 0:n.prev,prevDecimalPointValue:this.getTruthyValue(n==null?void 0:n.prev),currentOriginalValue:t,currentDecimalPointValue:o});if(typeof s=="string")return s}return Y.labelSignFormat(t,this.fixedSteps?null:this.decimalPoint)}getInterval(t){if(this.interval)return this.interval;let n=0;const o=t.maxValue,s=t.minValue,l=t.maxSteps;if(!l||l<=0)return 0;if(this.startToZero&&s<0){const a=Math.abs(s)+Math.abs(o),r=Math.abs(s)/a,c=Math.abs(o)/a;let d=Math.max(1,Math.round(r*l)),h=Math.max(1,l-d);d+h>l&&(r>c?d-=1:h-=1),n=Math.max(Math.abs(s)/(d||1),Math.abs(o)/(h||1))}else n=(o-s)/l;return this.decimalPoint?n:Math.ceil(n)}getDecimalPointFromRange({graphRange:t,numberOfSteps:n}){if(n<=0||t===0)return 0;const o=t/n;if(o===0)return 0;let s=0,l=o;for(;l<1&&(l*=10,s++,!(s>10)););return s}getNiceInterval(t){if(!Number.isFinite(t)||t===0)return 0;const n=Math.abs(t),o=Math.floor(Math.log10(n)),s=n/10**o;let l=10;for(let r=0;r<_s.length;r++)if(_s[r]>=s){l=_s[r];break}const a=l*10**o;return t<0?-a:a}getStepsWithNiceScale({max:t,min:n,maxSteps:o}){let s=1/0,l=n,a=0,r=0,c=1/0;const d=o>1?Math.max(2,o-1):1,h=o+1,f=[];for(let m=d;m<=h;m++)f.push(m);for(let m=0;m<f.length;m++){const p=f[m],g=(t-n)/p,u=this.getNiceInterval(g);if(u>0){const x=Math.abs(u),b=Math.floor(n/u)*u,y=b+u*p,w=y-t;w>=0&&w<c&&(s=y,l=b,a=x,c=w,r=p)}}return{max:s,min:l,interval:a,steps:r}}calculateSteps(t){var h,f,m;const{maxValue:n,minValue:o}=t;let{maxSteps:s=1}=t,l=this.getInterval(t),a=0,r=0;o>=0?(a=+o,r=Math.ceil(n/l)*l):n>=0?(a=Math.floor(o/l)*l,r=Math.ceil(n/l)*l):(r=+n,a=Math.floor(o/l)*l);const c=r-a;let d=Math.round(c/l);if(o>0&&n===1&&(this.decimalPoint?s>2?(l=.2,d=5,s=5):(l=.5,d=2,s=2):(l=1,d=1,s=1)),this.fixedSteps)return this.decimalPoint=(h=this==null?void 0:this.getDecimalPointFromRange)==null?void 0:h.call(this,{graphRange:c,numberOfSteps:d}),{steps:d,interval:l,graphMin:a,graphMax:r};for(;d>s;)l*=2,d=Math.round(c/l),l=Math.ceil(c/d);if(c>d*l){const p=c/d;l=this.decimalPoint?p:Math.ceil(p)}if(this.niceScale){const{max:p,min:g,steps:u,interval:x}=this.getStepsWithNiceScale({max:n,min:o,maxSteps:d});if(Number.isFinite(p)&&u!==0){const y=x.toString().includes(".");return this.decimalPoint=y&&this.decimalPoint==="auto"?(f=x.toString().split(".")[1])==null?void 0:f.length:this.decimalPoint,{steps:u,interval:x,graphMin:g,graphMax:p}}}return this.decimalPoint==="auto"&&(this.decimalPoint=(m=this==null?void 0:this.getDecimalPointFromRange)==null?void 0:m.call(this,{graphRange:c,numberOfSteps:d})),{steps:d,interval:l,graphMin:a,graphMax:r}}calculateScaleRange(t,n){var d;let o,s,l=!1;const a=n!=null&&n.use?n==null?void 0:n.range:this.range;if(Array.isArray(a)&&(a==null?void 0:a.length)===2?this.options.type==="heatMap"?(o=a[1]>+t.max?+t.max:a[1],s=a[0]<+t.min?+t.min:a[0]):(o=a[1],s=a[0]):typeof a=="function"?[s,o]=a(t.min,t.max):(o=t.max,s=t.min),this.autoScaleRatio){const h=o,f=o*(this.autoScaleRatio+1);if(o=this.decimalPoint?f:Math.ceil(f),o>0&&s<0){const m=h-o;s+=m}else if(o<0&&s<0){const m=s*(this.autoScaleRatio+1);s=this.decimalPoint?m:Math.ceil(m)}}this.startToZero&&(s>0&&(s=0),o<0&&(o=0)),o===s&&(o+=1,l=!0);const r=this.getLabelFormat(s),c=this.getLabelFormat(o,{isMaxValueSameAsMin:l});return{min:s,max:o,minLabel:r,maxLabel:c,size:Y.calcTextSizeCanvas(c,Y.getLabelStyle(this.labelStyle),(d=this.labelStyle)==null?void 0:d.padding)}}}class OC extends oo{calculateScaleRange(t){let n,o,s=!1;Array.isArray(this.range)&&this.range.length===2?(n=this.range[1],o=this.range[0]):typeof range=="function"?[o,n]=this.range(t.min,t.max):(n=t.max,o=t.min);const l=Y.calculateMagnitude(n-o);n=Math.ceil(n/10**l)*10**l,this.startToZero&&(o=0),n===o&&(n+=1,s=!0);const a=this.getLabelFormat(o),r=this.getLabelFormat(n,{isMaxValueSameAsMin:s});return{min:o,max:n,minLabel:a,maxLabel:r,size:Y.calcTextSize(r,Y.getLabelStyle(this.labelStyle))}}calculateSteps(t,n){const o=t.maxValue,s=t.minValue,l=t.maxSteps,a=Y.calculateMagnitude(o-s);let r=this.getInterval(t),c;const d=o,h=s,f=d-h;for(c=Math.round(f/r),o===1&&(r=.2,c=5);(c>l||c*2<l)&&!n;)if(c>l)r*=2,c=Math.ceil(f/r);else if(a>=0)if(r/2%1===0)r/=2,c=Math.ceil(f/r);else break;else r/=2,c=Math.ceil(f/r);return{steps:c,interval:r,graphMin:h,graphMax:Math.ceil(h+c*r)}}getLabelFormat(t,n={}){if(this.formatter){const o=this.formatter(t,n);if(typeof o=="string")return o}return Y.labelSignFormat(t,this.decimalPoint)}getInterval(t){const n=t.maxValue,o=t.minValue;return 10**Y.calculateMagnitude(n-o)}}class RC extends oo{constructor(t,n,o,s,l){super(t,n,o,l),this.labels=s}calculateScaleRange(t,n,o){var m;const s=this.labelStyle.alignToGridLine?t:Y.getStringMinMax(this.labels);let l=s.max,a=s.min,r=0,c=this.labels.length-1,d=this.labels.length;const h=n!=null&&n.use?n==null?void 0:n.range:this.range;if(Array.isArray(h)&&(h!=null&&h.length)){const[p,g]=h;ve(p)&&ve(g)&&(r=p<r?r:p,c=g>c?c:g,l=this.labels[c],a=this.labels[r],d=c-r+1)}else if(typeof h=="function"){const[p,g]=h(a,l);r=p<r?r:p,c=g>c?c:g,l=this.labels[c],a=this.labels[r],d=c-r+1}const f=((m=this.labelStyle)==null?void 0:m.maxWidth)??o.chartWidth/(d+2);return{min:a,max:l,minIndex:r,maxIndex:c,minLabel:this.getLabelFormat(a,f),maxLabel:this.getLabelFormat(l,f),size:Y.calcTextSizeCanvas(this.getLabelFormat(l,f),Y.getLabelStyle(this.labelStyle))}}getIndexInterval(t){const n=t.maxSteps;return this.interval?this.interval:Math.ceil(this.labels.length/n)}calculateSteps(t){const{minValue:n,maxValue:o,minIndex:s,maxIndex:l}=t,a=l-s+1;let r=1;const c=this.labels.every(d=>!isNaN(d));return this.labelStyle.alignToGridLine&&c&&(r=this.getIndexInterval(t)),{oriSteps:a,steps:a,indexInterval:r,graphMin:n,graphMax:o,minIndex:s,maxIndex:l}}draw(t,n,o,s,l){var y,w,I,E,B,_,C,S,M,k,T,R;const a=this.ctx,r=this.labels,c={x1:t.x1+n.left,x2:t.x2-n.right,y1:t.y1+n.top,y2:t.y2-n.bottom},d=o.steps,h=o.indexInterval,f=o.minIndex,m=c[this.units.rectStart],p=c[this.units.rectEnd],g=c[this.units.rectOffset(this.position)],u=c[this.units.rectOffsetCounter(this.position)],x=((y=this.labelStyle)==null?void 0:y.maxWidth)??t.chartWidth/(d+2),b=5;if(this.drawAxisTitle(t,n),(w=this.labelStyle)!=null&&w.show){a.font=Y.getLabelStyle(this.labelStyle),this.type==="x"?(a.textAlign="center",a.textBaseline=this.position==="top"?"bottom":"top"):(a.textAlign=this.position==="left"?"right":"left",a.textBaseline="middle"),a.fillStyle=this.labelStyle.color,a.lineWidth=this.axisLineWidth;const L=Y.aliasPixel(a.lineWidth);if(a.beginPath(),a.strokeStyle=this.axisLineColor,this.type==="x"?(a.moveTo(m,g+L),a.lineTo(p,g+L)):(a.moveTo(g+L,m),a.lineTo(g+L,p)),a.stroke(),d===0)return;const N=(p-m)/d,v=this.labelStyle.alignToGridLine;let O=null,D=null;a.beginPath(),a.strokeStyle=this.gridLineColor;let V,P,A;const F=[];for(A=0;A<d;A+=h){const X=f+A,U=this.labels[X];O=Math.round(m+N*A),D=O+L,V=this.getLabelFormat(U,x);const{selectLabel:H,selectItem:$,horizontal:j}=this.options;let K;l!=null&&l.targetAxis?K=(l==null?void 0:l.targetAxis)==="yAxis"?"y":"x":K=j?"y":"x";const q=(H==null?void 0:H.use)&&(H==null?void 0:H.useLabelOpacity)&&K===this.type&&((I=l==null?void 0:l.dataIndex)==null?void 0:I.length)&&!((E=l==null?void 0:l.dataIndex)!=null&&E.includes(X)),Q=this.labelStyle.color;let J=1;if(Y.getColorStringType(Q)==="RGBA"&&(J=Y.getOpacity(Q)),a.fillStyle=Y.colorStringToRgba(Q,q?(B=this.options)==null?void 0:B.unSelectedOpacity:J),this.type==="x"){P=this.position==="top"?g-10:g+10;const ee=v?O:O+N/2;if(a.fillText(this.checkFixWidth(V),ee,P),!q&&($!=null&&$.showLabelTip)&&(s!=null&&s.label)&&!j){const G=s.label;if(G===V){const ne=Math.round(a.measureText((_=this.labelStyle)==null?void 0:_.fontSize).width);Y.showLabelTip({ctx:this.ctx,width:Math.round(a.measureText(G).width)+10,height:ne,x:O+N/2,y:P+(ne-2),borderRadius:2,arrowSize:3,text:V,backgroundColor:(C=$==null?void 0:$.labelTipStyle)==null?void 0:C.backgroundColor,textColor:(S=$==null?void 0:$.labelTipStyle)==null?void 0:S.textColor})}}this.showAxisTick&&(a.beginPath(),a.strokeStyle=this.axisLineColor,a.moveTo(O+N/2,g),a.lineTo(O+N/2,g+b),a.stroke(),a.closePath()),A>0&&this.showGrid&&(a.beginPath(),a.strokeStyle=this.gridLineColor,a.moveTo(D,g),a.lineTo(D,u),a.stroke(),a.closePath())}else{P=this.position==="left"?g-10:g+10;const ee=v?O:O+N/2;a.fillText(this.checkFixWidth(V),P,ee),F.push(V),this.showAxisTick&&(a.beginPath(),a.strokeStyle=this.axisLineColor,a.moveTo(g+(this.axisLineWidth??1),ee),a.lineTo(g-b,ee),a.stroke(),a.closePath()),A>0&&this.showGrid&&(a.beginPath(),a.strokeStyle=this.gridLineColor,a.moveTo(g,D),a.lineTo(u,D),a.stroke(),a.closePath())}a.stroke()}if(v&&A>=this.labels.length){const X=Cr(+r[1],+r[0]),U=Rs(+r[r.length-1],X);if(isNaN(U)||h!==1&&Cr(U,F[F.length-1])<=X)return;O=Math.round(m+N*r.length),D=O+L;const H=this.getLabelFormat(`${U}`,x);this.type==="x"?(a.fillText(this.checkFixWidth(H),O,P),this.showGrid&&(a.moveTo(D,g),a.lineTo(D,u))):(a.fillText(this.checkFixWidth(H),P,O),this.showGrid&&(a.moveTo(g,D),a.lineTo(u,D))),a.stroke()}a.closePath()}if((M=this.plotBands)!=null&&M.length||(k=this.plotLines)!=null&&k.length){const L=Y.aliasPixel(a.lineWidth)+1,N=c.x1+L,v=c.x2,O=c.y1+L,D=c.y2,V=(p-m)/(this.labelStyle.show?r.length:1);(T=this.plotBands)==null||T.forEach(P=>{if(!P.from&&!P.to)return;const A=Fe({},P,Rr),{from:F=0,to:X=r.length,label:U}=A,H=Math.round(m+V*F),$=Math.round(m+V*X);if(this.setPlotBandStyle(A),this.type==="x"?this.drawXPlotBand(H,$,N,v,O,D):this.drawYPlotBand(H,$,N,v,O,D),U.show){const j=this.getNormalizedLabelOptions(t,U),K=this.getPlotBandLabelPosition(H,$,j,v,O);this.drawPlotLabel(j,K)}a.restore()}),(R=this.plotLines)==null||R.forEach(P=>{if(!P.value)return;const A=Fe({},P,Or),{value:F,label:X}=A,U=Math.round(m+V*F)+V/2;if(this.setPlotLineStyle(A),this.type==="x"?this.drawXPlotLine(U,N,v,O,D):this.drawYPlotLine(U,N,v,O,D),X.show){const H=this.getNormalizedLabelOptions(t,X),$=this.getPlotLineLabelPosition(U,H,v,O);this.drawPlotLabel(H,$)}a.restore()})}}getLabelFormat(t,n,o={}){if(this.formatter){const s=this.formatter(t,o);if(typeof s=="string")return s}return this.labelStyle.fitWidth?this.fittingString(t,n):t}fittingString(t,n){const o=this.ctx;o.save(),o.font=Y.getLabelStyle(this.labelStyle);const s=this.labelStyle.fitDir;return Y.truncateLabelWithEllipsis(t,n,o,s)}getLabelWidthHasMaxLength(t,n){var a;const o=Y.getLabelStyle(this.labelStyle),s=(t==null?void 0:t.length)??0,l=((a=this.labelStyle)==null?void 0:a.maxWidth)??(n==null?void 0:n.chartWidth)/(s+2);return(t??[]).reduce((r,c)=>{var f;const d=this.getLabelFormat(c,l),h=((f=Y.calcTextSizeCanvas(d,o))==null?void 0:f.width)??0;return Math.max(r,h)},0)}}class NC extends oo{constructor(t,n,o,s,l){super(t,n,o),this.labels=s,this.options=l}getLabelFormat(t,n={}){if(this.formatter){const o=this.formatter(t,n);if(typeof o=="string")return o}return at(t).format(this.timeFormat)}getInterval(t){const n=t.maxValue,o=t.minValue,s=t.maxSteps;if(this.interval){if(typeof this.interval=="string")return si[this.interval].size;if(typeof this.interval=="object")return this.interval.time*si[this.interval.unit].size;if(typeof this.interval=="number")return this.interval}return Math.ceil((n-o)/s)}calculateSteps(t){const{maxValue:n,minValue:o,maxSteps:s}=t,l=this.getInterval(t);let a=l,r=o,c;for(;r<n;)r+=a;const d=r>n?n:r,h=o,f=d-h;c=Math.round(f/a)+1;const m=c;for(n===1&&(a=.2,c=5);c>s;)a*=2,c=Math.round(f/a),a=Math.ceil(f/c);return d-h>c*a&&(a=Math.ceil((d-h)/c)),{steps:c,oriSteps:m,interval:a,rawInterval:l,graphMin:h,graphMax:d}}draw(t,n,o,s,l){var N,v,O,D,V,P,A,F,X,U,H,$,j,K,q,Q;const a=this.ctx,r=this.labels,c={x1:t.x1+n.left,x2:t.x2-n.right,y1:t.y1+n.top,y2:t.y2-n.bottom},d=o.steps,h=o.graphMin,f=o.graphMax,m=o.rawInterval,p=o.oriSteps;let g=c[this.units.rectStart];const u=c[this.units.rectEnd],x=c[this.units.rectOffset(this.position)],b=c[this.units.rectOffsetCounter(this.position)],y=5;this.drawAxisTitle(t,n),a.font=Y.getLabelStyle(this.labelStyle),this.type==="x"?(a.textAlign="center",a.textBaseline=this.position==="top"?"bottom":"top"):(a.textAlign=this.position==="left"?"right":"left",a.textBaseline="middle"),a.fillStyle=this.labelStyle.color,a.lineWidth=this.axisLineWidth;const w=Y.aliasPixel(a.lineWidth);if(a.beginPath(),a.strokeStyle=this.axisLineColor,this.type==="x"?(a.moveTo(g,x+w),a.lineTo(u,x+w)):(a.moveTo(x+w,g),a.lineTo(x+w,u)),a.stroke(),a.closePath(),d===0||h===null)return;const I=this.labelStyle.alignToGridLine,E=(u-g)/(p||1);this.categoryMode&&!I&&(g+=Math.ceil(E/2)-2);const B=[];let _=null,C=null;a.beginPath(),a.strokeStyle=this.gridLineColor;let S,M,k,T=d<=2?p:Math.round(p/d);const R=g>Math.ceil(c[this.units.rectStart]);this.type==="x"&&R&&T===p&&(T=1);const L=T===p?p:p-1;for(k=0;k<=L;k+=T){B[k]=at(h).valueOf()+k*m,_=Math.round(g+E*k),C=_+w;let J;for(let Z=0;Z<B.length;Z++)B[Z]!==void 0&&Z!==k&&(J=B[Z]);S=this.getLabelFormat(Math.min(f,B[k]),{prev:J});const ee=((v=(N=this.options)==null?void 0:N.selectLabel)==null?void 0:v.use)&&((D=(O=this.options)==null?void 0:O.selectLabel)==null?void 0:D.useLabelOpacity)&&this.options.horizontal===(this.type==="y")&&((V=l==null?void 0:l.dataIndex)==null?void 0:V.length)&&!(l!=null&&l.label.map(Z=>this.getLabelFormat(Math.min(f,Z),{prev:J})).includes(S)),G=this.labelStyle.color;let ne=1;if(Y.getColorStringType(G)==="RGBA"&&(ne=Y.getOpacity(G)),a.fillStyle=Y.colorStringToRgba(G,ee?(P=this.options)==null?void 0:P.unSelectedOpacity:ne),this.type==="x"){if(M=this.position==="top"?x-10:x+10,a.fillText(this.checkFixWidth(S),_,M),!ee&&((F=(A=this.options)==null?void 0:A.selectItem)!=null&&F.showLabelTip)&&(s!=null&&s.label)&&!((X=this.options)!=null&&X.horizontal)){const Z=this.getLabelFormat(Math.min(f,s.label+0*m));if(Z===S){const re=Math.round(a.measureText((U=this.labelStyle)==null?void 0:U.fontSize).width);Y.showLabelTip({ctx:this.ctx,width:Math.round(a.measureText(Z).width)+10,height:re,x:_,y:M+(re-2),borderRadius:2,arrowSize:3,text:S,backgroundColor:(j=($=(H=this.options)==null?void 0:H.selectItem)==null?void 0:$.labelTipStyle)==null?void 0:j.backgroundColor,textColor:(Q=(q=(K=this.options)==null?void 0:K.selectItem)==null?void 0:q.labelTipStyle)==null?void 0:Q.textColor})}}this.showAxisTick&&(a.beginPath(),a.strokeStyle=this.axisLineColor,a.moveTo(C,x),a.lineTo(C,x+y),a.stroke(),a.closePath()),k<p&&this.showGrid&&(R||!R&&k!==0)&&(a.beginPath(),a.strokeStyle=this.gridLineColor,a.moveTo(C,x),a.lineTo(C,b),a.stroke(),a.closePath())}else M=this.position==="left"?x-10:x+10,a.fillText(this.checkFixWidth(S),M,_),this.showAxisTick&&(a.beginPath(),a.strokeStyle=this.axisLineColor,a.moveTo(x+(this.axisLineWidth??1),C),a.lineTo(x-y,C),a.stroke(),a.closePath()),k<p&&this.showGrid&&(R||!R&&k!==0)&&(a.beginPath(),a.strokeStyle=this.gridLineColor,a.moveTo(x,C),a.lineTo(b,C),a.stroke(),a.closePath());a.stroke()}if(this.categoryMode&&I&&k*T===p){const J=at(r[1]).diff(at(r[0])),ee=this.getLabelFormat(at(B[p-1]+J));_=Math.round(g+E*p),C=_+w,this.type==="x"?(a.fillText(this.checkFixWidth(ee),_,M),this.showGrid&&(a.moveTo(C,x),a.lineTo(C,b))):(a.fillText(this.checkFixWidth(ee),M,_),this.showGrid&&(a.moveTo(x,C),a.lineTo(b,C))),a.stroke()}a.closePath()}}const LC={createTitle(){this.titleDOM=document.createElement("div"),this.titleDOM.className="ev-chart-title",this.wrapperDOM.appendChild(this.titleDOM)},initTitle(){this.isInitTitle||this.createTitle(),this.updateTitle(),this.isInitTitle=!0},showTitle(){this.titleDOM.style.display="block",this.wrapperDOM.style.paddingTop=`${this.options.title.height}px`},hideTitle(){this.titleDOM.style.display="none",this.wrapperDOM.style.paddingTop="0px"},updateTitle(){const e=this.options.title;Object.keys(e.style).forEach(t=>{this.titleDOM.style[t]=e.style[t]}),this.titleDOM.textContent=e.text,this.titleDOM.style.height=`${e.height}px`,this.titleDOM.style.lineHeight=`${e.height}px`}},_C={createLegendLayout(){var e,t;this.legendDOM=document.createElement("div"),this.legendDOM.className="ev-chart-legend",this.legendBoxDOM=document.createElement("div"),this.legendBoxDOM.className="ev-chart-legend-box",(t=(e=this.options)==null?void 0:e.legend)!=null&&t.allowResize&&(this.resizeDOM=document.createElement("div"),this.resizeDOM.className="ev-chart-resize-bar",this.ghostDOM=document.createElement("div"),this.ghostDOM.className="ev-chart-resize-ghost",this.wrapperDOM.appendChild(this.resizeDOM)),this.useTable?(this.legendTableDOM=document.createElement("table"),this.legendTableDOM.className="ev-chart-legend--table",this.setLegendColumnHeader(),this.legendBoxDOM.appendChild(this.legendTableDOM),this.legendDOM.style.overflow="auto"):(this.legendBoxDOM.style.overflowX="hidden",this.legendBoxDOM.style.overflowY="auto",this.legendBoxDOM.style.height="100%"),this.legendDOM.appendChild(this.legendBoxDOM),this.wrapperDOM.appendChild(this.legendDOM),this.options.legend.virtualScroll&&!this.useTable&&(this.legendTopSpacer=document.createElement("div"),this.legendTopSpacer.className="ev-chart-legend--top-spacer",this.legendTopSpacer.style.clear="both",this.legendTopSpacer.style.opacity=0,this.legendBottomSpacer=document.createElement("div"),this.legendBottomSpacer.className="ev-chart-legend--bottom-spacer",this.legendBottomSpacer.style.clear="both",this.legendBottomSpacer.style.opacity=0,this.legendBoxDOM.appendChild(this.legendTopSpacer),this.legendBoxDOM.appendChild(this.legendBottomSpacer),this.updateVisibleRowCountFrameId=requestAnimationFrame(()=>{this.updateVisibleRowCount()}))},setLegendColumnHeader(){var o;const e=(o=this.options.legend)==null?void 0:o.table,t=e.columns;["color",...Object.keys(t)].forEach(s=>{var a,r;const l=document.createElement("th");if(l.className="ev-chart-legend--table__column-name",(a=t[s])!=null&&a.use||s==="color"||s==="name"){const c=t[s],d=(c==null?void 0:c.title)??"";l.textContent=d,l.setAttribute("title",d),l.dataset.type=d,Y.setDOMStyle(l,(r=e==null?void 0:e.style)==null?void 0:r.header),this.legendTableDOM.append(l)}})},initLegend(){var e,t;this.isHeatMapType=this.options.type==="heatMap",this.useTable=!!((t=(e=this.options.legend)==null?void 0:e.table)!=null&&t.use)&&this.options.type!=="heatmap"&&this.options.type!=="scatter",this.legendItemHeight=18,this.isInitLegend||this.createLegendLayout(),this.isHeatMapType?(this.initEventForColorLegend(),this.addColorLegendList()):(this.initEvent(),this.addLegendList()),this.initResizeEvent(),this.isInitLegend=!0,this.isLegendMove=!1},updateVisibleRowCount(){const e=this.options.legend.position==="right"||this.options.legend.position==="left",t=this.legendBoxDOM.clientHeight,n=this.legendBoxDOM.clientWidth,o=Math.max(this.options.legend.width-8,1),s=Object.values(this.seriesList).filter(l=>l.showLegend!==!1).length;this.itemsPerRow=e?1:Math.floor(n/o),this.totalRowCount=Math.ceil(s/this.itemsPerRow),this.visibleRowCount=t>this.legendItemHeight?Math.round(t/this.legendItemHeight)+1:this.totalRowCount},updateStartEndRowIndex(){var t;const e=Math.max(Math.floor(((t=this.legendBoxDOM)==null?void 0:t.scrollTop)/this.legendItemHeight),0);this.startRowIndex=Math.min(e,Math.max(this.totalRowCount-this.visibleRowCount,0)),this.endRowIndex=this.startRowIndex+this.visibleRowCount+1},renderVisibleLegends(){this.updateStartEndRowIndex();const e=this.legendBoxDOM.querySelectorAll(".ev-chart-legend-container");if(e&&e.length)for(const c of e)c.remove();const t=this.totalRowCount*this.legendItemHeight,n=this.startRowIndex*this.legendItemHeight,o=Math.max(t-this.visibleRowCount*this.legendItemHeight-n,0);this.legendTopSpacer.style.height=`${n}px`,this.legendBottomSpacer.style.height=`${o}px`;const s=this.startRowIndex*this.itemsPerRow,l=this.endRowIndex*this.itemsPerRow,a=this.data.groups.at(0);let r=[];if(a?r=a.filter(c=>this.seriesList[c].showLegend).map(c=>[c,this.seriesList[c]]):r=Object.entries(this.seriesList).filter(([,c])=>c.showLegend),r&&r.length)for(let c=s;c<l&&c<r.length;c++){const[,d]=r[c];this.addLegend(d)}},addLegendList(){const{groups:e}=this.data,{seriesList:t}=this;this.options.legend.virtualScroll&&!this.useTable?this.renderVisibleLegendsFrameId=requestAnimationFrame(()=>{this.renderVisibleLegends()}):(this.addLegendForGroups(e,t,this.useTable),this.addStandaloneLegends(t,this.useTable))},addLegendForGroups(e,t,n){e==null||e.forEach(o=>{o==null||o.forEach(s=>{const l=t[s];l&&l.showLegend&&this.addLegendBasedOnType(l,n)})})},addStandaloneLegends(e,t){Object.values(e).forEach(n=>{!n.isExistGrp&&n.showLegend&&this.addLegendBasedOnType(n,t)})},addLegendBasedOnType(e,t){t?this.addLegendWithValues(e):this.addLegend(e)},addColorLegendList(){const e=this.seriesList;Object.values(e).forEach(t=>{if(!t.isExistGrp&&t.showLegend){const{colorState:n,valueOpt:o}=t,{min:s,max:l,interval:a,existError:r,decimalPoint:c}=o,d=n.length,h=r?d-2:d-1;for(let f=0;f<d;f++){const{id:m,color:p,label:g=""}=n[f],u=s+a*f;let x=u+a;f<h?x-=.1**c:x=l+.1**c;let b=g;if(!b)if(b=`${u.toFixed(c)} - ${x.toFixed(c)}`,s===void 0||l===void 0)if(f===0)b="0";else break;else{if(u>l)break;a<=1&&c===0&&(b=u)}this.addLegend({cId:m,color:p,name:b,show:!0})}}})},getContainerDOM(e){let t=null;const n=e.target.dataset.type;return n==="container"?t=e.target:["name","color","min","max","avg","total","last"].includes(n)&&(t=e.target.parentElement,t!=null&&t.series||(t=t.parentElement)),t},initEvent(){if(this.isInitLegend)return;const e={container:`ev-chart-legend${this.useTable?"--table__row":"-container"}`,color:`ev-chart-legend${this.useTable?"--table__color":"-color"}`,name:`ev-chart-legend${this.useTable?"--table__name":"-name"}`,value:`ev-chart-legend${this.useTable?"--table__value":"-value"}`},t=(l,a)=>{const r=l==null?void 0:l.getElementsByClassName(e.color)[0],c=l==null?void 0:l.getElementsByClassName(e.name)[0],d=l==null?void 0:l.getElementsByClassName(e.value),h=l==null?void 0:l.series;if(r.style.backgroundColor=a,r.style.borderColor=a,c.style.color=a,d&&d.length)for(const f of d)f.style.color=a;h.show=!1,l.dataset.inactive=!0},n=(l,a)=>{var m,p;let r;const c=l==null?void 0:l.getElementsByClassName(e.color)[0],d=l==null?void 0:l.getElementsByClassName(e.name)[0],h=l==null?void 0:l.getElementsByClassName(e.value),f=l==null?void 0:l.series;if(typeof f.color!="string"?r=f.color[f.color.length-1][1]:r=f.color,f.type==="line"&&f.fill?(c.style.height="8px",c.style.backgroundColor=Y.rgbaAdjustHalfOpacity(r),c.style.border=`1px solid ${r}`):c.style.backgroundColor=r,d.style.color=a,h&&h.length)for(const g of h){const u=(p=(m=this.options.legend.table)==null?void 0:m.columns[g.dataset.type])==null?void 0:p.style;g.style.color=u!=null&&u.color?u.color:a}f.show=!0,l.dataset.inactive=!1},o=()=>{(this.data.groups.at(0)?this.data.groups.at(0).slice().reverse().filter(a=>this.seriesList[a].showLegend).map(a=>[a,this.seriesList[a]]):Object.entries(this.seriesList).filter(([,a])=>a.showLegend)).forEach(([,a])=>{a.show=!1})},s=()=>{(this.data.groups.at(0)?this.data.groups.at(0).slice().reverse().filter(a=>this.seriesList[a].showLegend).map(a=>[a,this.seriesList[a]]):Object.entries(this.seriesList).filter(([,a])=>a.showLegend)).forEach(([,a])=>{a.show=!0})};this.onLegendBoxClick=l=>{var x;const{legend:a}=this.options;if(a!=null&&a.stopClickEvt)return;const{chartIdx:r}=this.data,c=this.getContainerDOM(l);if(!c)return;const d=c==null?void 0:c.getElementsByClassName(e.color)[0],h=c==null?void 0:c.getElementsByClassName(e.name)[0],f=(c==null?void 0:c.dataset.inactive)==="false";if(!d||!h)return;if(a.clickMode==="active"){const b=Array.from(this.legendBoxDOM.getElementsByClassName(e.container));b.every(I=>I.dataset.inactive==="false")?(b.forEach(I=>{t(I,a.inactive)}),o(),n(c,a.color),this.seriesInfo.count=1):f?(t(c,a.inactive),this.seriesInfo.count--):f||(n(c,a.color),this.seriesInfo.count++),b.every(I=>I.dataset.inactive==="true")&&(b.forEach(I=>{n(I,a.color)}),s(),this.seriesInfo.count=b.length)}if(a.clickMode!=="active"){if(f&&this.seriesInfo.count===1)return;f?(t(c,a.inactive),this.seriesInfo.count--):(n(c,a.color),this.seriesInfo.count++)}if(this.brushSeries){const b=[...this.brushSeries.list];b[r]=this.seriesList,this.brushSeries.list=b,this.brushSeries.chartIdx=r}((x=this.options.eventBehavior)==null?void 0:x.legendClick)!=="emitOnly"&&this.update({updateSeries:!1,updateSelTip:{update:!0,keepDomain:!0}});const p=Object.values(this.seriesList).filter(b=>b.show).map(b=>b.sId),g=p.length===Object.values(this.seriesList).length,u={e:l,data:{seriesIds:g?[]:p,isActiveAll:g}};typeof this.listeners["click-legend"]=="function"&&this.listeners["click-legend"](u)},this.onLegendBoxLeave=()=>{this.legendHover=null,this.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1},hitInfo:{legend:null},lightUpdate:!0})},this.onLegendBoxOver=l=>{var d;const a=this.getContainerDOM(l);if(!a){this.onLegendBoxLeave();return}const c={sId:(d=a==null?void 0:a.series)==null?void 0:d.sId,type:this.options.type};this.legendHover=c,this.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1},hitInfo:{legend:c},lightUpdate:!0})},this.legendBoxDOM.addEventListener("click",this.onLegendBoxClick),this.legendBoxDOM.addEventListener("mouseover",this.onLegendBoxOver),this.legendBoxDOM.addEventListener("mouseleave",this.onLegendBoxLeave),this.options.legend.virtualScroll&&!this.useTable&&(this.legendBoxDOM.addEventListener("resize",this.updateVisibleRowCount),this.legendBoxDOM.addEventListener("scroll",this.renderVisibleLegends.bind(this))),this.initResizeEvent()},initEventForColorLegend(){if(this.isInitLegend)return;const e={container:`ev-chart-legend${this.useTable?"--table__row":"-container"}`,color:`ev-chart-legend${this.useTable?"--table__color":"-color"}`,name:`ev-chart-legend${this.useTable?"--table__name":"-name"}`},t=(l,a)=>{var m;const r=l==null?void 0:l.getElementsByClassName(e.color)[0],c=l==null?void 0:l.getElementsByClassName(e.name)[0],d=Object.values(this.seriesList)[0],h=(m=l==null?void 0:l.series)==null?void 0:m.cId;r.style.backgroundColor=a,r.style.borderColor=a,c.style.color=a;const f=d.colorState.findIndex(p=>p.id===h);f>-1&&(d.colorState[f].show=!1),l.dataset.inactive=!0},n=(l,a)=>{var m,p;const r=l==null?void 0:l.getElementsByClassName(e.color)[0],c=l==null?void 0:l.getElementsByClassName(e.name)[0],d=Object.values(this.seriesList)[0],h=(m=l==null?void 0:l.series)==null?void 0:m.cId;r.style.backgroundColor=(p=l==null?void 0:l.series)==null?void 0:p.color,c.style.color=a;const f=d.colorState.findIndex(g=>g.id===h);f>-1&&(d.colorState[f].show=!0),l.dataset.inactive=!1},o=()=>{Object.values(this.seriesList)[0].colorState.forEach(a=>{a.show=!1})},s=()=>{Object.values(this.seriesList)[0].colorState.forEach(a=>{a.show=!0})};this.onLegendBoxClick=l=>{const a=this.options.legend;if(a!=null&&a.stopClickEvt)return;const r=Object.values(this.seriesList)[0],c=this.getContainerDOM(l);if(!c)return;const d=c==null?void 0:c.getElementsByClassName(e.color)[0],h=c==null?void 0:c.getElementsByClassName(e.name)[0],f=(c==null?void 0:c.dataset.inactive)==="false",m=r.colorState.filter(p=>p.show).length;if(!(!d||!h)){if(a.clickMode==="active"){const p=Array.from(this.legendBoxDOM.getElementsByClassName(e.container));p.every(x=>x.dataset.inactive==="false")?(p.forEach(x=>{t(x,a.inactive)}),o(),n(c,a.color)):f?t(c,a.inactive):f||n(c,a.color),p.every(x=>x.dataset.inactive==="true")&&(p.forEach(x=>{n(x,a.color)}),s())}if(a.clickMode!=="active"){if(f&&m===1)return;f?t(c,a.inactive):n(c,a.color)}this.update({updateSeries:!1,updateSelTip:{update:!0,keepDomain:!0}})}},this.onLegendBoxLeave=()=>{this.legendHover=null,Object.values(this.seriesList)[0].colorState.forEach(a=>{a.state="normal"}),this.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1},lightUpdate:!0})},this.onLegendBoxOver=l=>{var h,f;const a=(h=Object.values(this.seriesList))==null?void 0:h[0],r=this.getContainerDOM(l);if(!r){this.onLegendBoxLeave();return}const c=(f=r==null?void 0:r.series)==null?void 0:f.cId,d={sId:c,type:this.options.type};this.legendHover=d,a.colorState.forEach(m=>{m.state=m.id===c?"highlight":"downplay"}),this.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1},hitInfo:{legend:d},lightUpdate:!0})},this.legendBoxDOM.addEventListener("click",this.onLegendBoxClick),this.legendBoxDOM.addEventListener("mouseover",this.onLegendBoxOver),this.legendBoxDOM.addEventListener("mouseleave",this.onLegendBoxLeave),this.initResizeEvent()},initResizeEvent(){this.onResizeMouseDown=e=>{e.stopPropagation(),e.preventDefault();const t=this.options,n=t.legend.position,o=t.title.show?t.title.height:0,s=this.ghostDOM;this.resizeDOM.style.display="none",this.wrapperDOM.appendChild(s),n==="left"||n==="right"?(s.style.top=`${o}px`,s.style.left=this.resizeDOM.style.left,s.style.right=this.resizeDOM.style.right,s.style.height=this.resizeDOM.style.height):(s.classList.add("horizontal"),n==="top"?s.style.top=this.resizeDOM.style.top:n==="bottom"&&(s.style.bottom=this.resizeDOM.style.bottom)),this.wrapperDOM.addEventListener("mousemove",this.mouseMove,!1),this.wrapperDOM.addEventListener("mouseup",this.mouseUp,!1)},this.resizeDOM&&(this.resizeDOM.addEventListener("mousedown",this.onResizeMouseDown),this.mouseMove=this.onMouseMove.bind(this),this.mouseUp=this.onMouseUp.bind(this))},updateLegend(){this.resetLegend(),this.isHeatMapType?this.addColorLegendList():this.addLegendList()},updateLegendTableValues(){var o,s,l,a,r;const e=(l=(s=(o=this.options)==null?void 0:o.legend)==null?void 0:s.table)==null?void 0:l.columns,t=this.getAggregations(),n=(a=this.legendBoxDOM)==null?void 0:a.getElementsByClassName("ev-chart-legend--table__row");if(n&&n.length)for(const c of n){const d=c==null?void 0:c.getElementsByClassName("ev-chart-legend--table__value");if(d&&d.length)for(const h of d){const f=h.dataset.type;if(f!=="name"){const m=c.series.sId,p=(r=t==null?void 0:t[m])==null?void 0:r[f];h.textContent=this.getFormattedValue(e[f],p)}}}},forceUpdateLegend(){this.destroyLegend(),this.initLegend()},resetLegend(){var t,n;const e=this.legendBoxDOM;if(e){if(this.useTable){const o=this.legendTableDOM;for(;o.hasChildNodes();)o.removeChild(o.firstChild);this.setLegendColumnHeader()}else if(this.options.legend.virtualScroll)((n=(t=this.legendDOM)==null?void 0:t.style)==null?void 0:n.display)==="none"?this.legendNeedsUpdate=!0:(this.updateVisibleRowCount(),this.renderVisibleLegends());else for(;e.hasChildNodes();)e.removeChild(e.firstChild);this.seriesInfo.count=0}},destroyLegend(){const e=this.legendDOM;this.renderVisibleLegendsFrameId!=null&&(cancelAnimationFrame(this.renderVisibleLegendsFrameId),this.renderVisibleLegendsFrameId=null),this.updateVisibleRowCountFrameId!=null&&(cancelAnimationFrame(this.updateVisibleRowCountFrameId),this.updateVisibleRowCountFrameId=null),e&&(e.remove(),this.legendDOM=null,this.legendBoxDOM=null,this.resizeDOM=null,this.isInitLegend=!1,this.seriesInfo.count=0)},addLegend(e){const t=this.options.legend,n=document.createElement("div"),o=document.createElement("span"),s=document.createElement("div");n.className="ev-chart-legend-container",n.dataset.inactive=!e.show,n.series=e,o.className="ev-chart-legend-color",e.type==="line"&&e.point&&!e.fill&&(o.className+=" ev-chart-legend-color--point-line"),s.className="ev-chart-legend-name";let l;e.show?typeof e.color!="string"?l=e.color[e.color.length-1][1]:l=e.color:l=t.inactive,e.type==="line"&&e.fill?(o.style.height="8px",o.style.backgroundColor=e.show?Y.rgbaAdjustHalfOpacity(l):t.inactive,o.style.border=`1px solid ${l}`):o.style.backgroundColor=l,o.dataset.type="color",s.style.color=t.color,s.textContent=e.name,s.setAttribute("title",e.name),s.dataset.type="name",n.appendChild(o),n.appendChild(s),t.position==="top"||t.position==="bottom"?(n.style.width=`${t.width-8}px`,n.style.margin="0 4px"):n.style.width="100%",n.style.height=`${this.legendItemHeight}px`,n.style.display="inline-block",n.style.overflow="hidden",n.dataset.type="container",this.legendBoxDOM.insertBefore(n,this.legendBottomSpacer),e.show&&this.seriesInfo.count++},addLegendWithValues(e){var h,f,m,p,g;const t=this.options.legend,n=(h=t==null?void 0:t.table)==null?void 0:h.columns,o=(f=this.getAggregations())==null?void 0:f[e==null?void 0:e.sId];if(!o||!n)return;const s=document.createElement("tr");s.className="ev-chart-legend--table__row",s.dataset.inactive=!e.show,Y.setDOMStyle(s,(p=(m=t.table)==null?void 0:m.style)==null?void 0:p.row),s.series=e,s.dataset.type="container";const l=document.createElement("td");l.className="ev-chart-legend--table__color-wrapper",l.dataset.type="color";const a=document.createElement("div");a.className="ev-chart-legend--table__color",a.dataset.type="color";let r;switch(e.show?typeof e.color!="string"?r=e.color[e.color.length-1][1]:r=e.color:r=t.inactive,e.type){case"line":{e.fill?(a.style.backgroundColor=Y.rgbaAdjustHalfOpacity(r),a.style.border=`1px solid ${r}`):(e.point&&(a.className+=" ev-chart-legend--table__color--point-line"),a.className+=" ev-chart-legend--table__color--line",a.style.backgroundColor=r);break}case"bar":case"pie":default:{a.style.height="10px",a.style.backgroundColor=r;break}}e.type==="line"&&e.fill?(a.style.height="8px",a.style.backgroundColor=e.show?Y.rgbaAdjustHalfOpacity(r):t.inactive,a.style.border=`1px solid ${r}`):a.style.backgroundColor=r,l.appendChild(a),s.appendChild(l);const c=document.createElement("td");c.className="ev-chart-legend--table__name",c.style.color=e.show?t.color:t.inactive,c.textContent=e.name,c.setAttribute("title",e.name),c.dataset.type="name",Y.setDOMStyle(c,(g=n==null?void 0:n.name)==null?void 0:g.style),e.show||(c.style.color=t.inactive),s.appendChild(c);const d=Object.keys(n);d==null||d.forEach(u=>{var x;if(u!=="name"&&n[u].use){const b=this.getFormattedValue(n[u],o[u]),y=document.createElement("td");y.className="ev-chart-legend--table__value",y.style.color=e.show?t.color:t.inactive,y.textContent=b,y.dataset.type=u.toString(),Y.setDOMStyle(y,(x=n[u])==null?void 0:x.style),e.show||(y.style.color=t.inactive),s.appendChild(y)}}),this.legendTableDOM.appendChild(s),e.show&&this.seriesInfo.count++},setLegendPosition(){var g,u,x,b,y,w,I,E,B;const e=this.options,t=(g=e==null?void 0:e.legend)==null?void 0:g.position,n=(u=this.wrapperDOM)==null?void 0:u.style,o=(x=this.legendDOM)==null?void 0:x.style,s=(b=this.legendBoxDOM)==null?void 0:b.style,l=(y=this.resizeDOM)==null?void 0:y.style;let a,r;const c=(w=e==null?void 0:e.title)!=null&&w.show?(I=e==null?void 0:e.title)==null?void 0:I.height:0,d=c+((E=e==null?void 0:e.legend)==null?void 0:E.height),{top:h=0,bottom:f=0,left:m=0,right:p=0}=((B=e==null?void 0:e.legend)==null?void 0:B.padding)??{};if(!(!n||!o))switch(s.padding=`${h}px ${p}px ${f}px ${m}px`,t){case"top":n.padding=`${d}px 0 0 0`,a=this.chartDOM.getBoundingClientRect(),r=parseInt(o.paddingTop)+parseInt(o.paddingBottom),s.width="100%",s.height=`${e.legend.height-r}px`,o.top=`${c}px`,o.right="",o.bottom="",o.left="",o.width=`${a.width}px`,o.height=`${e.legend.height+(l?4:0)}px`,l&&(l.top=`${d}px`,l.right="",l.bottom="",l.left="",l.width=`${a.width}px`,l.height="4px",l.cursor="row-resize");break;case"right":n.padding=`${c}px ${e.legend.width}px 0 0`,a=this.chartDOM.getBoundingClientRect(),s.width=`${e.legend.width-10}px`,s.maxHeight=`${a.height}px`,o.paddingLeft="10px",o.top=`${c}px`,o.right="0px",o.bottom="",o.left="",o.width=`${e.legend.width}px`,o.height=`${a.height}px`,l&&(l.top=`${c}px`,l.right=`${e.legend.width}px`,l.bottom="",l.left="",l.width="4px",l.height=`${a.height}px`,l.cursor="col-resize");break;case"bottom":n.padding=`${c}px 0 ${e.legend.height}px 0`,a=this.chartDOM.getBoundingClientRect(),r=parseInt(o.paddingTop)+parseInt(o.paddingBottom),s.width="100%",s.height=`${e.legend.height-r}px`,o.top="",o.right="",o.bottom="0px",o.left="0px",o.width=`${a.width}px`,o.height=`${e.legend.height+(l?4:0)}px`,l&&(l.top="",l.right="",l.bottom=`${e.legend.height}px`,l.left="",l.width=`${a.width}px`,l.height="4px",l.cursor="row-resize");break;case"left":n.padding=`${c}px 0 0 ${e.legend.width}px`,a=this.chartDOM.getBoundingClientRect(),s.width=`${e.legend.width}px`,s.maxHeight=`${a.height}px`,s.display="absolute",s.bottom="0px",o.top=`${c}px`,o.right="",o.bottom="",o.left="0px",o.width=`${e.legend.width}px`,o.height=`${a.height}px`,l&&(l.top=`${c}px`,l.right="",l.bottom="",l.left=`${e.legend.width}px`,l.width="4px",l.height=`${a.height}px`,l.cursor="col-resize");break}},updateLegendContainerSize(){var n;if(!this.options||!this.legendBoxDOM)return;const e=(n=this.options)==null?void 0:n.legend,t=this.legendBoxDOM.getElementsByClassName("ev-chart-legend-container");if(t)for(let o=0;o<t.length;o++)e.position==="top"||e.position==="bottom"?(t[o].style.width=`${e.width-8}px`,t[o].style.margin="0 4px"):t[o].style.width="100%"},onMouseMove(e){e.stopPropagation(),e.preventDefault();const t=this.wrapperDOM.getBoundingClientRect(),n=this.wrapperDOM.offsetWidth,o=this.wrapperDOM.offsetHeight,s=this.options.title.show?this.options.title.height:0,l=this.options.legend.position,a=150,r=70,c=120,d=20;let h;switch(l){case"left":h=e.clientX-t.left,h<c?h=c:h>n-a&&(h=n-a),this.ghostDOM.style.left=`${h}px`;break;case"right":h=e.clientX-t.left,h<a?h=a:h>n-c&&(h=n-c),this.ghostDOM.style.left=`${h}px`;break;case"top":h=e.clientY-t.top,h<d+s?h=d+s:h>o-r&&(h=o-r),this.ghostDOM.style.top=`${h}px`;break;case"bottom":h=e.clientY-t.top,h<r+s?h=r+s:h>o-d&&(h=o-d),this.ghostDOM.style.bottom=`${this.wrapperDOM.offsetHeight-h}px`;break}this.isLegendMove=!0},onMouseUp(e){e.stopPropagation(),e.preventDefault(),this.wrapperDOM.removeEventListener("mousemove",this.mouseMove,!1),this.wrapperDOM.removeEventListener("mouseup",this.mouseUp,!1);const t=this.options,n=t.legend.position,o=this.resizeDOM.style,s=this.legendDOM.style,l=this.legendBoxDOM.style,a=this.ghostDOM.style,r=this.wrapperDOM.style,c=t.title.show?t.title.height:0,d=+this.legendDOM.style.paddingLeft.replace("px","");let h;if(this.isLegendMove)switch(n){case"top":o.top=a.top,h=+a.top.replace("px",""),s.height=`${h-c}px`,l.height=`${h-c-4}px`,t.legend.height=h-c-4,r.padding=`${h}px 0 0 0`;break;case"right":o.left=a.left,h=+a.left.replace("px",""),s.width=`${this.wrapperDOM.offsetWidth-h-4}px`,l.width=`${this.wrapperDOM.offsetWidth-h-4-d}px`,t.legend.width=this.wrapperDOM.offsetWidth-h-4,r.padding=`${c}px ${this.wrapperDOM.offsetWidth-h}px 0 0`;break;case"bottom":o.bottom=a.bottom,h=this.wrapperDOM.offsetHeight-+a.bottom.replace("px",""),s.height=`${this.wrapperDOM.offsetHeight-h}px`,l.height=`${h-c-4}px`,t.legend.height=this.wrapperDOM.offsetHeight-h,r.padding=`${c}px 0 ${this.wrapperDOM.offsetHeight-h}px 0`;break;case"left":o.left=a.left,h=+a.left.replace("px",""),s.width=`${h}px`,l.width=`${h}px`,t.legend.width=h,r.padding=`${c}px 0 0 ${h-4}px`;break}o.display="block",this.ghostDOM.remove(),this.isLegendMove&&(this.render(),this.isLegendMove=!1)},showLegend(){this.resizeDOM&&(this.resizeDOM.style.display="block"),this.legendDOM&&(this.legendDOM.style.display="block"),this.legendNeedsUpdate&&this.options.legend.virtualScroll&&!this.useTable&&(this.legendNeedsUpdate=!1,this.updateVisibleRowCount(),this.renderVisibleLegends())},hideLegend(){var l,a,r,c,d;const e=this.options,t=(l=this.wrapperDOM)==null?void 0:l.style,n=(a=this.resizeDOM)==null?void 0:a.style,o=(r=this.legendDOM)==null?void 0:r.style,s=(c=e==null?void 0:e.title)!=null&&c.show?(d=e==null?void 0:e.title)==null?void 0:d.height:0;!o||!t||(n&&(n.display="none"),o.display="none",o.width="0",o.height="0",t.padding=`${s}px 0 0 0`)},getFormattedValue({formatter:e,decimalPoint:t},n){if(n==null)return"Null";let o;return e&&(o=e(+n)),(!e||typeof o!="string")&&(o=Y.labelSignFormat(+n,t)),o}},_r=28,VC={width:70,height:60},PC={createLegendLayout(){this.legendDOM=document.createElement("div"),this.legendDOM.className="ev-chart-legend",this.legendBoxDOM=document.createElement("div"),this.legendBoxDOM.className="ev-chart-legend-box",this.containerDOM=document.createElement("div"),this.containerDOM.className="ev-chart-legend-container",this.legendBoxDOM.appendChild(this.containerDOM),this.legendDOM.appendChild(this.legendBoxDOM),this.wrapperDOM.appendChild(this.legendDOM)},initLegend(){this.isInitLegend||(this.createLegendLayout(),this.createLegend()),Object.values(this.seriesList).forEach(e=>{this.setLegendStyle(e)}),this.initEvent(),this.isInitLegend=!0,this.legendDragInfo={dragging:!1,isStart:!0}},initEvent(){this.isInitLegend||(this.onLegendMouseDown=e=>{e.stopPropagation(),e.preventDefault();const t=e.target.dataset.type;let n;if(t==="handle")n=e.target;else if(t==="handle-btn")n=e.target.parentElement;else if(t==="handle-btn-color")n=e.target.parentElement.parentElement;else return;const o=Object.values(this.seriesList);if(!o.length)return;const{colorState:s}=o[0],{start:l,end:a}=s[0];s[0].selectedValue=null,this.clearOverlay(),this.legendDragInfo.dragging=!0,this.legendDragInfo.isStart=l!==a?n.className.includes("start"):this.legendDragInfo.isStart,n.classList.add("dragging"),this.legendBoxDOM.addEventListener("mousemove",this.onLegendMouseMove,!1),this.legendBoxDOM.addEventListener("mouseup",this.onLegendMouseUp,!1)},this.onLegendMouseMove=e=>{e.stopPropagation(),e.preventDefault();const{dragging:t,isStart:n}=this.legendDragInfo;if(t){let o=this.getSelectedValue(e);o=this.isSide?100-o:o;const s=n?"start":"end",l=Object.values(this.seriesList);if(!l.length)return;const{colorState:a}=l[0],{start:r,end:c}=a[0];if(n&&o>c||!n&&o<r)return;a[0][s]=o,this.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1}})}},this.onLegendMouseUp=()=>{this.legendDragInfo.dragging=!1;const e=this.containerDOM.getElementsByClassName("ev-chart-legend-handle dragging")[0];e==null||e.classList.remove("dragging"),this.legendBoxDOM.removeEventListener("mouseup",this.onLegendMouseUp,!1)},this.onLegendBoxOver=e=>{const t=e.target.dataset.type,n=Object.values(this.seriesList);if(!n.length)return;const{colorState:o,valueOpt:s}=n[0],l=o[0];let a=this.getSelectedValue(e);if(a=this.isSide?100-a:a,["line","thumb","layer","overlay","overlay-item"].includes(t))if(l.start<=a&&a<=l.end)l.selectedValue=a,this.createLegendOverlay(a,s);else return;else if(["handle","handle-btn","handle-btn-color"].includes(t)){const r=e.target.className.includes("start");l.selectedValue=r?l.start:l.end,this.clearOverlay()}else return;this.legendHover={sId:"gradient",type:this.options.type},this.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1}})},this.onLegendBoxLeave=()=>{this.legendDragInfo.dragging=!1,this.legendHover=null,this.clearOverlay();const e=Object.values(this.seriesList);if(!e.length)return;const{colorState:t}=e[0];t[0].selectedValue=null,this.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1}})},this.legendBoxDOM.addEventListener("mousedown",this.onLegendMouseDown),this.legendBoxDOM.addEventListener("mouseover",this.onLegendBoxOver),this.legendBoxDOM.addEventListener("mouseleave",this.onLegendBoxLeave))},getSelectedValue(e){const{x:t,y:n,width:o,height:s}=this.containerDOM.getBoundingClientRect(),l=!this.isSide,a=l?t:n,r=l?o:s;let c=l?e.clientX:e.clientY;c<a?c=a:c>a+r&&(c=a+r);const d=c-a;return+We(d,r)},updateLegend(){this.resetLegend(),this.createLegend(),Object.values(this.seriesList).forEach(e=>{this.setLegendStyle(e)})},resetLegend(){const e=this.containerDOM;if(e)for(;e.hasChildNodes();)e.removeChild(e.firstChild)},clearOverlay(){const e=this.containerDOM.getElementsByClassName("ev-chart-legend-line")[0],t=e==null?void 0:e.getElementsByClassName("ev-chart-legend-overlay")[0];if(t){e.removeChild(t);const o=e.getElementsByClassName("ev-chart-legend-thumb")[0].children;if(o&&o.length)for(const s of o)s.style.opacity=1}},createLegendOverlay(e,t){this.clearOverlay();const n=this.legendHandleSize,{min:o,max:s}=t;if(o===void 0||s===void 0)return;const l=this.containerDOM.getElementsByClassName("ev-chart-legend-line")[0],a=document.createElement("div");a.className="ev-chart-legend-overlay",a.dataset.type="overlay";const r=document.createElement("div");r.className="ev-chart-legend-overlay-tooltip",r.innerText=Math.floor(o+(s-o)*(e/100));const c=document.createElement("span");c.className="ev-chart-legend-overlay-item",c.dataset.type="overlay-item";let d,h;const f=Math.floor(n/2)+14;this.isSide?(h=`top:${100-e}%;left:${f}px;transform:translateY(-50%);`,d=`top:${100-e}%;transform:translateY(-50%);`):(h=`top:-${f}px;left:${e}%;transform:translateX(-50%);`,d=`left:${e}%;transform:translateX(-50%);`),d+=`width:${n-10}px;height:${n-10}px;`,r.style.cssText=h,c.style.cssText=d,a.appendChild(r),a.appendChild(c),l==null||l.appendChild(a);const m=l==null?void 0:l.getElementsByClassName("ev-chart-legend-thumb")[0];if(m){const p=m.children;if(p&&p.length)for(const g of p)g.style.opacity=.2}},createLegendHandle(e){const t=document.createElement("span");t.className=`ev-chart-legend-handle-btn-color ${e}`,t.dataset.type="handle-btn-color";const n=document.createElement("div");n.className=`ev-chart-legend-handle-btn ${e}`,n.dataset.type="handle-btn",n.appendChild(t);const o=document.createElement("div");return o.className=`ev-chart-legend-handle ${e}`,o.dataset.type="handle",o.appendChild(n),o},createLegendLabel(){const e=document.createElement("span");e.className="ev-chart-legend-label-text";const t=document.createElement("div");return t.className="ev-chart-legend-label",t},createLegend(){if(!Object.values(this.seriesList).length)return;const e=this.options.legend;this.isSide=!["top","bottom"].includes(e.position);const t=this.isSide?e.width:e.height;this.legendHandleSize=t>_r?_r:t;const n=this.legendHandleSize,o=this.createLegendHandle(this.isSide?"end":"start",n),s=this.createLegendHandle(this.isSide?"start":"end",n),l=document.createElement("div");l.className="ev-chart-legend-line-layer",l.dataset.type="line-layer";const a=document.createElement("div");a.className="ev-chart-legend-thumb",a.dataset.type="thumb",a.appendChild(this.createLegendLabel()),a.appendChild(this.createLegendLabel());const r=document.createElement("div");r.className="ev-chart-legend-line",r.dataset.type="line",r.appendChild(l),r.appendChild(a),this.containerDOM.appendChild(r),this.containerDOM.appendChild(o),this.containerDOM.appendChild(s)},setLegendStyle(e){const t=this.isSide?"top":"right",n=this.legendHandleSize,{valueOpt:o,colorState:s}=e,{min:l,max:a,decimalPoint:r}=o,{start:c,end:d}=s[0],h=e.getColorForGradient(c),f=e.getColorForGradient(d);let m=`linear-gradient(to ${t}, `;m+=`${h}, ${f})`;const p=Math.floor(n/2)+14;let g=`width:${n}px;height:${n}px;`,u,x,b,y=`background:${m};`;this.isSide?(g+=`margin-top:-${n/2}px;`,u=`left:${p}px;transform:translateY(-50%);top:`,x=`top:${100-d}%;`,b=`top:${100-c}%;`,y+=`top:${100-d}%;height:${d-c}%;`):(g+=`margin-left:-${n/2}px;`,u=`top:-${p}px;transform:translateX(-50%);left:`,x=`left:${c}%;`,b=`left:${d}%;`,y+=`left:${c}%;width:${d-c}%;`);const w=(l+(a-l)*(c/100)).toFixed(r),I=(l+(a-l)*(d/100)).toFixed(r),E=this.containerDOM.getElementsByClassName("ev-chart-legend-thumb")[0];E.style.cssText=y;const B=E.getElementsByClassName("ev-chart-legend-label");B[0].style.cssText=`${u}0%;`,B[1].style.cssText=`${u}100%;`,l!==void 0&&a!==void 0&&(B[0].innerText=this.isSide?I:w,B[1].innerText=this.isSide?w:I);const _=this.containerDOM.getElementsByClassName("ev-chart-legend-handle");_[0].style.cssText=g+x,_[1].style.cssText=g+b;const C=this.containerDOM.getElementsByClassName("ev-chart-legend-handle-btn-color");C[0].style.backgroundColor=this.isSide?f:h,C[1].style.backgroundColor=this.isSide?h:f},setLegendPosition(){var x,b,y,w;const e=this.options,t=(x=e==null?void 0:e.legend)==null?void 0:x.position,{width:n,height:o}=VC,s=this.legendHandleSize,l=(b=e==null?void 0:e.title)!=null&&b.show?(y=e==null?void 0:e.title)==null?void 0:y.height:0,a=l+o,{top:r=0,bottom:c=0,left:d=0,right:h=0}=((w=e==null?void 0:e.legend)==null?void 0:w.padding)??{},f=this.wrapperDOM.style;if(!f)return;let m,p,g,u;switch(t){case"top":f.padding=`${a}px 0 0 0`,u=this.chartDOM.getBoundingClientRect(),p=`padding:${s+7}px ${h}px ${c}px ${d}px;`,p+="width:100%",p+=`height${o}px;`,m=`width:${u.width}px;`,m+=`height:${o}px;`,m+=`top:${l}px;`;break;case"right":f.padding=`${l}px ${n}px 0 0`,u=this.chartDOM.getBoundingClientRect(),p=`padding:${r}px ${h}px ${c}px ${d}px;`,p+=`width:${n}px;`,p+="height:100%;",p+=`max-height:${u.height}px;`,m=`width:${n}px;`,m+=`height:${u.height}px;`,m+=`top:${l}px;right:0px;`;break;case"bottom":f.padding=`${l}px 0 ${o}px 0`,u=this.chartDOM.getBoundingClientRect(),p=`padding:${s+7}px ${h}px ${c}px ${d}px;`,p+="width:100%;",p+=`height:${o}px;`,m=`width:${u.width}px;`,m+=`height:${o}px;`,m+="bottom:0px;left:0px;";break;case"left":f.padding=`${l}px 0 0 ${n}px`,u=this.chartDOM.getBoundingClientRect(),p=`padding:${r}px ${h}px ${c}px ${d}px;`,p+="display:absolute;",p+="bottom:0px;",p+=`width:${n}px;`,p+="height:100%;",p+=`maxHeight:${u.height}px;`,m=`width:${n}px;`,m+=`height:${u.height}px;`,m+=`top:${l}px;left:0px`;break}if(["top","bottom"].includes(t)){const I=u.width/2;g=`left:${u.width/2-I/2}px;`,g+=`width:${I}px;`,g+=`height:${s}px;`,g+="padding:4px 0;",g+="margin:0 4px;"}else{const I=u.height/2;g=`top:${u.height/2-I/2}px;`,g+="left:5px;",g+=`width:${s}px;`,g+=`height:${I}px;`,g+="padding:0 4px;",g+="margin:4px 0;"}this.containerDOM.style.cssText=g,this.legendBoxDOM.style.cssText=p,this.legendDOM.style.cssText=m},updateLegendContainerSize(){Object.values(this.seriesList).forEach(e=>{this.setLegendStyle(e)})},showLegend(){this.resizeDOM&&(this.resizeDOM.style.display="block"),this.legendDOM&&(this.legendDOM.style.display="block")},hideLegend(){var s,l,a,r;const e=this.options,t=(s=this.wrapperDOM)==null?void 0:s.style,n=(l=this.legendDOM)==null?void 0:l.style,o=(a=e==null?void 0:e.title)!=null&&a.show?(r=e==null?void 0:e.title)==null?void 0:r.height:0;!n||!t||(n.display="none",n.width="0",n.height="0",t.padding=`${o}px 0 0 0`)}},AC={initScrollbar(){var e,t,n,o,s,l;(n=(t=(e=this.options.axesX)==null?void 0:e[0])==null?void 0:t.scrollbar)!=null&&n.use&&this.initScrollbarInfo(this.options.axesX,"x"),(l=(s=(o=this.options.axesY)==null?void 0:o[0])==null?void 0:s.scrollbar)!=null&&l.use&&this.initScrollbarInfo(this.options.axesY,"y")},initScrollbarInfo(e,t){var s,l,a,r,c;const n=this.scrollbar[t],o=Fe({},(s=e==null?void 0:e[0])==null?void 0:s.scrollbar,Br.scrollbar);Object.keys(o).forEach(d=>{n[d]=o[d]}),n.isInit||(n.type=(l=e==null?void 0:e[0])==null?void 0:l.type,n.range=(r=(a=e==null?void 0:e[0])==null?void 0:a.range)!=null&&r.length?[...((c=e==null?void 0:e[0])==null?void 0:c.range)??[]]:null,this.initScrollbarRange(t),this.createScrollbarLayout(t),this.createScrollbar(t),this.createScrollEvent(t),n.isInit=!0)},initScrollbarRange(e){var s,l;const t=this.scrollbar[e],n=t.type,o=this.options.type==="heatMap"?this.data.labels[e]:this.data.labels;if((s=t.range)!=null&&s.length&&o.length){const[a,r]=t.range;let c,d;if(ve(a)&&ve(r)){if(n==="step")c=0,d=o.length-1;else{const m=(l=this.minMax[e])==null?void 0:l[0];c=+m.min,d=+m.max}const h=r-a,f=d-c;h>=f?(t.range[0]=c,t.range[1]=d):(t.range[0]=+a<c?c:+a,t.range[1]=+r>d?d:+r,t.range[1]-t.range[0]<h&&(t.range[0]=t.range[1]-h,t.range[0]<c&&(t.range[0]=c)))}}},updateScrollbar(e){this.updateScrollbarInfo("x",e),this.updateScrollbarInfo("y",e)},updateScrollbarInfo(e,t){var r,c,d,h,f,m,p,g,u,x,b,y,w,I,E,B,_;const{axesX:n,axesY:o}=this.options,s=e==="x"?n:o;if(!this.scrollbar[e].isInit&&((c=(r=s==null?void 0:s[0])==null?void 0:r.scrollbar)!=null&&c.use)&&((d=s==null?void 0:s[0])!=null&&d.range)){this.initScrollbarInfo(s,e);return}else if(!((h=s==null?void 0:s[0].scrollbar)!=null&&h.use)||Gi((f=s==null?void 0:s[0])==null?void 0:f.range)){this.destroyScrollbar(e);return}const l=e==="x"?this.axesX:this.axesY,a=!je((m=s==null?void 0:s[0])==null?void 0:m.range,(p=l==null?void 0:l[0])==null?void 0:p.range);if(a||t){const C=e==="x"?(x=(u=(g=this.options.axesX)==null?void 0:g[0])==null?void 0:u.scrollbar)==null?void 0:x.resetPosition:(w=(y=(b=this.options.axesY)==null?void 0:b[0])==null?void 0:y.scrollbar)==null?void 0:w.resetPosition;a||C?(this.scrollbar[e].range=(E=(I=s==null?void 0:s[0])==null?void 0:I.range)!=null&&E.length?[...((B=s==null?void 0:s[0])==null?void 0:B.range)??[]]:null,delete this.scrollbar[e].savedPosition):t&&delete this.scrollbar[e].savedPosition,this.initScrollbarRange(e)}this.scrollbar[e].use=!!((_=s==null?void 0:s[0].scrollbar)!=null&&_.use)},updateScrollbarPosition(){var e,t,n,o,s,l,a,r,c,d;if((e=this.scrollbar.x)!=null&&e.use&&((t=this.scrollbar.x)!=null&&t.isInit)){const h=!((s=(o=(n=this.options.axesX)==null?void 0:n[0])==null?void 0:o.scrollbar)!=null&&s.resetPosition);this.setScrollbarPosition("x",h)}if((l=this.scrollbar.y)!=null&&l.use&&((a=this.scrollbar.y)!=null&&a.isInit)){const h=!((d=(c=(r=this.options.axesY)==null?void 0:r[0])==null?void 0:c.scrollbar)!=null&&d.resetPosition);this.setScrollbarPosition("y",h)}},createScrollbarLayout(e){const t=this.scrollbar[e];t.dom=document.createElement("div"),t.dom.className="ev-chart-scrollbar",t.dom.dataset.type="scrollbar";const n=document.createElement("div");n.className="ev-chart-scrollbar-container",n.dataset.type=e,t.dom.appendChild(n),this.wrapperDOM.appendChild(t.dom)},createScrollbar(e){const t=this.scrollbar[e],n=t.dom.children[0];this.createScrollbarTrack(n),this.createScrollbarThumb(n),t.showButton&&this.createScrollbarButton(n)},createScrollbarTrack(e){const t=document.createElement("div");t.className="ev-chart-scrollbar-track",t.dataset.type="track",e.appendChild(t)},createScrollbarThumb(e){const t=document.createElement("div");t.className="ev-chart-scrollbar-thumb",t.dataset.type="thumb",e.appendChild(t)},createScrollbarButton(e){const t=document.createElement("div");t.className="ev-chart-scrollbar-button ev-chart-scrollbar-button-up",t.dataset.type="button";const n=document.createElement("i");n.className="ev-icon ev-icon-triangle-up ev-chart-scrollbar-button-icon",n.dataset.type="button-icon",t.appendChild(n);const o=document.createElement("div");o.className="ev-chart-scrollbar-button ev-chart-scrollbar-button-down",o.dataset.type="button";const s=document.createElement("i");s.className="ev-icon ev-icon-triangle-down ev-chart-scrollbar-button-icon",s.dataset.type="button-icon",o.appendChild(s),e.appendChild(t),e.appendChild(o)},setScrollbarPosition(e,t=!1){var _,C;const n=this.scrollbar[e];if(!n.use||!n.range)return;const o=n.dom,s=this.chartRect,l=this.labelOffset,a={x1:s.x1+l.left,x2:s.x2-l.right,y1:s.y1+l.top,y2:s.y2-l.bottom},r=(_=this.options.title)!=null&&_.show?(C=this.options.title)==null?void 0:C.height:0,c=e==="x",d=c?n.height:n.width,h=c?a.x2-a.x1:a.y2-a.y1,f=n.showButton?d:0,m=h-f*2;let p=null;t&&n.savedPosition!==void 0&&(p=n.savedPosition);const g=this.getScrollbarThumbSize(e,m,p);n.savedPosition=g.position;let u="display: block;",x,b,y,w,I=`width:${f}px;height:${f}px;`;c?(u=`top: ${s.y2+r+l.top}px;`,u+=`left: ${a.x1}px;`,u+=`width: ${h}px;`,u+=` height: ${d}px;`,x="top: 0;",x+=`left: ${f}px;`,x+=`width: ${m}px;`,x+="height: 100%;",b=`width: ${g.size}px;`,b+="height: 100%;",b+=`left: ${g.position+f}px`,I+="transform:rotate(90deg);top: 0;",y=`${I}right:0;`,w=`${I}left:0;`):(u=`top: ${a.y1+r}px;`,u+=`left: ${a.x2+10}px;`,u+=`width: ${d}px;`,u+=`height: ${h}px;`,x=`top: ${f}px;`,x+="left: 0;",x+="width: 100%;",x+=`height: ${m}px;`,b="width: 100%;",b+=`height: ${g.size}px;`,b+=`bottom: ${g.position+f}px`,I+="left:0;",y=`${I}top: 0;`,w=`${I}bottom: 0;`),o.style.cssText=u;const E=o.getElementsByClassName("ev-chart-scrollbar-track");E[0].style.cssText=x,E[0].style.backgroundColor=n.background;const B=o.getElementsByClassName("ev-chart-scrollbar-thumb");if(B[0].style.cssText=b,B[0].style.backgroundColor=n.thumbStyle.background,B[0].style.borderRadius=`${n.thumbStyle.radius}px`,n.showButton){const S=o.getElementsByClassName("ev-chart-scrollbar-button-up"),M=Math.floor(m-g.size),k=Math.floor(g.position)>M?.5:1;S[0].style.cssText=`background-color: ${n.background};${y}`,S[0].style.opacity=k,S[0].children[0].style.display="block";const T=o.getElementsByClassName("ev-chart-scrollbar-button-down");T[0].style.cssText=`background-color: ${n.background};${w}`,T[0].style.opacity=Math.floor(g.position)<0?.5:1,T[0].children[0].style.display="block"}},getScrollbarThumbSize(e,t,n){var m,p,g,u;const o=this.scrollbar[e],[s,l]=o.range,a=o.type;let r,c,d=1,h=0,f=0;if(a==="step"){const x=this.options.type==="heatMap"?this.data.labels[e]:this.data.labels,b=l-s+1;c=x.length;const y=t/c;r=y*b,f=y*s}else{const x=e==="x"?this.axesX:this.axesY,b=(m=this.minMax[e])==null?void 0:m[0],y=+b.max-+b.min,w=+l-+s;a==="time"&&(d=(u=x==null?void 0:x[0])==null?void 0:u.getInterval({minValue:b.min,maxValue:b.max,maxSteps:(g=(p=this.labelRange[e])==null?void 0:p[0])==null?void 0:g.max})),c=Math.ceil(y/d)+1,h=+b.min;const I=t/c,E=w/d+1,B=+s-h;r=I*E,f=I*(B/d)}return o.startValue=h,o.steps=c,o.interval=d,n!==null&&(f=n),{size:r,position:f}},getScrollbarContainerDOM(e){const t=["track","thumb","button"],n=e.dataset.type;return t.includes(n)?e.parentElement:n==="button-icon"?e.parentElement.parentElement:n==="scrollbar"?e.getElementsByClassName("ev-chart-scrollbar-container")[0]:e},updateScrollbarRange(e,t){const n=this.scrollbar[e],{startValue:o,range:s,interval:l,steps:a}=n,r=o+l*a,c=e==="x"?this.axesX[0]:this.axesY[0],[d,h]=s??[];(!ve(d)||!ve(h))&&(n.range=(c==null?void 0:c.range)||null);let f,m,p=!1;t?(f=d+l,m=h+l,p=m>=r):(f=d-l,m=h-l,p=f<o),p||(n.range=[f,m],delete n.savedPosition,this.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1},updateByScrollbar:!0,lightUpdate:f>1}))},createScrollEvent(){var t,n,o;this.onScrollbarClick=s=>{s.preventDefault();const l=s.target.dataset.type,a=this.getScrollbarContainerDOM(s.target),r=["button","button-icon"],c=a.dataset.type;let d;if(r.includes(l)){let h;l==="button"?h=s.target:l==="button-icon"&&(h=s.target.parentElement),d=h.className.includes("up")}else if(l==="track"){const h=a.getElementsByClassName("ev-chart-scrollbar-thumb"),{x:f,y:m}=h[0].getBoundingClientRect(),p=c==="x",g=p?s.clientX:-s.clientY,u=p?f:-m;d=g>u}else return;this.updateScrollbarRange(c,d)},this.onScrollbarDown=s=>{if(s.preventDefault(),s.target.dataset.type!=="thumb")return;const l=this.getScrollbarContainerDOM(s.target),a=l.dataset.type,r=l.getElementsByClassName("ev-chart-scrollbar-thumb"),{x:c,y:d,height:h}=r[0].getBoundingClientRect(),f=this.scrollbar[a];f.scrolling=!0,a==="x"?f.pointInThumb=s.clientX-c:f.pointInThumb=d+h-s.clientY;const m=f.dom;m.addEventListener("mousemove",this.onScrollbarMove),m.addEventListener("mouseup",this.onScrollbarUp)};const e=s=>{this.scrolling(s)};if(this.onScrollbarMove=xs(e,5),this.onScrollbarUp=s=>{s.preventDefault(),this.stopScrolling(s)},this.onScrollbarLeave=s=>{s.preventDefault(),this.scrolling(s),this.stopScrolling(s)},this.onScrollbarWheel=s=>{var h,f,m,p,g,u,x,b;const l=((f=(h=this.tooltipDOM)==null?void 0:h.style)==null?void 0:f.display)==="block",a=this.tooltipBodyDOM||((m=this.tooltipDOM)==null?void 0:m.querySelector(this.options.tooltip.htmlScrollTarget));if(l&&a){const{scrollTop:y,scrollHeight:w,clientHeight:I}=a,E=y<=0,B=y+I>=w,_=s.deltaY<0,C=s.deltaY>0;if(!(E&&_||B&&C))return}s.preventDefault();const r=1;if((p=this.scrollbar.x)!=null&&p.use&&s.shiftKey&&Math.abs(s.deltaY)>r){this.updateScrollbarRange("x",s.deltaY>0);return}const c=Math.abs(s.deltaX),d=Math.abs(s.deltaY);if(c>r&&d>r){c>d&&((g=this.scrollbar.x)!=null&&g.use)?this.updateScrollbarRange("x",s.deltaX>0):d>c&&((u=this.scrollbar.y)!=null&&u.use)&&this.updateScrollbarRange("y",s.deltaY<0);return}if((x=this.scrollbar.x)!=null&&x.use&&c>r){this.updateScrollbarRange("x",s.deltaX>0);return}(b=this.scrollbar.y)!=null&&b.use&&d>r&&this.updateScrollbarRange("y",s.deltaY<0)},this.scrollbar.x.use&&!this.scrollbar.x.isInit){const s=this.scrollbar.x.dom;s.addEventListener("click",this.onScrollbarClick),s.addEventListener("mousedown",this.onScrollbarDown),s.addEventListener("mouseleave",this.onScrollbarLeave)}if(this.scrollbar.y.use&&!this.scrollbar.y.isInit){const s=this.scrollbar.y.dom;s.addEventListener("click",this.onScrollbarClick),s.addEventListener("mousedown",this.onScrollbarDown),s.addEventListener("mouseleave",this.onScrollbarLeave)}((t=this.scrollbar.x)!=null&&t.use||(n=this.scrollbar.y)!=null&&n.use)&&((o=this.overlayCanvas)==null||o.addEventListener("wheel",this.onScrollbarWheel,{passive:!1}))},scrolling(e){const t=this.getScrollbarContainerDOM(e.target),n=t.dataset.type;if(!this.scrollbar[n].scrolling)return;const{steps:o,range:s,pointInThumb:l,startValue:a,interval:r}=this.scrollbar[n],c=t.getElementsByClassName("ev-chart-scrollbar-track"),{x:d,y:h,width:f,height:m}=c[0].getBoundingClientRect(),p=n==="x",g=p?d:h,u=p?f:m,x=u/o,b=a+(o-1)*r;let y=p?e.clientX:e.clientY;y<g?y=g:y>g+u&&(y=g+u);let w;if(p?w=y-g-l:w=g+u-y-l,w<=0)return;let I,E;const B=Math.round(Math.abs(w)/x)*r,[_,C]=s;if(w>0){const S=a+(B-+_);I=+_+S,E=I+(+C-+_)}I<a||E>b||(this.scrollbar[n].range=[I,E],delete this.scrollbar[n].savedPosition,this.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1}}))},stopScrolling(e){const n=this.getScrollbarContainerDOM(e.target).dataset.type,o=this.scrollbar[n];if(o.scrolling){o.scrolling=!1;const s=o.dom;s.removeEventListener("mousemove",this.onScrollbarMove,!1),s.removeEventListener("mouseup",this.onScrollbarUp,!1)}},hideScrollbar(e){const t=this.scrollbar[e].dom;if(!t)return;const n=t==null?void 0:t.style;n.display="none",n.width="0",n.height="0"},destroyScrollbar(e){var n,o,s;const t=this.scrollbar[e].dom;t&&(t.remove(),this.scrollbar[e]={isInit:!1},!((n=this.scrollbar.x)!=null&&n.use)&&!((o=this.scrollbar.y)!=null&&o.use)&&((s=this.overlayCanvas)==null||s.removeEventListener("wheel",this.onScrollbarWheel,{passive:!1})))}};function zC(e){const t=typeof e;return e!=null&&(t==="object"||t==="function")}function Vr(e,t,n){let o,s,l,a,r,c,d=0,h=!1,f=!1,m=!0;const p=!t&&t!==0&&typeof root.requestAnimationFrame=="function";if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0,zC(n)&&(h=!!n.leading,f="maxWait"in n,l=f?Math.max(+n.maxWait||0,t):l,m="trailing"in n?!!n.trailing:m);function g(M){const k=o,T=s;return o=s=void 0,d=M,a=e.apply(T,k),a}function u(M,k){return p?(window.cancelAnimationFrame(r),window.requestAnimationFrame(M)):setTimeout(M,k)}function x(M){if(p)return window.cancelAnimationFrame(M);clearTimeout(M)}function b(M){return d=M,r=u(I,t),h?g(M):a}function y(M){const k=M-c,T=M-d,R=t-k;return f?Math.min(R,l-T):R}function w(M){const k=M-c,T=M-d;return c===void 0||k>=t||k<0||f&&T>=l}function I(){const M=Date.now();if(w(M))return E(M);r=u(I,y(M))}function E(M){return r=void 0,m&&o?g(M):(o=s=void 0,a)}function B(){r!==void 0&&x(r),d=0,o=c=s=r=void 0}function _(){return r===void 0?a:E(Date.now())}function C(){return r!==void 0}function S(...M){const k=Date.now(),T=w(k);if(o=M,s=this,c=k,T){if(r===void 0)return b(c);if(f)return r=u(I,t),g(c)}return r===void 0&&(r=u(I,t)),a}return S.cancel=B,S.flush=_,S.pending=C,S}const FC="Expected a function";function HC(e,t,n){let o=!0,s=!0;if(typeof e!="function")throw new TypeError(FC);return Vr(e,t,{leading:o,maxWait:t,trailing:s})}const WC={createEventFunctions(){var e,t,n,o;this.onMouseMove=s=>{var m,p;if((m=this.dragInfo)!=null&&m.isMove||this.isMobile)return;const l={e:s},{indicator:a,tooltip:r,type:c}=this.options,d=this.getMousePosition(s),h=this.findHitItem(d);r!=null&&r.showAllValueInRange&&(h!=null&&h.items)&&this.addNotHitInfo(h);const f=this.overlayCtx;if(this.overlayClear(),Object.keys(h.items).length){if(r.use&&this.isInitTooltip)if(this.drawItemsHighlight(h,f),typeof(r==null?void 0:r.returnValue)=="function"){const u=[];Object.keys(h.items).forEach(x=>{u.push({sId:x,data:h.items[x].data,color:h.items[x].color,name:h.items[x].name,dataId:h.items[x].id,index:h.items[x].index})}),this.hideTooltipDOM(),r.returnValue(u,s)}else(p=r==null?void 0:r.formatter)!=null&&p.html?(this.drawCustomTooltip(h==null?void 0:h.items),this.setCustomTooltipLayoutPosition(h,s)):(this.setTooltipLayoutPosition(h,s),c==="scatter"?this.drawTooltipForScatter(h,this.tooltipCtx):c==="heatMap"?this.drawToolTipForHeatMap(h,this.tooltipCtx):this.drawTooltip(h,this.tooltipCtx));const g=Object.values(this.seriesList||{}).some(u=>u.type==="line");if(r.use&&(c==="line"||g)){const u=this.drawIndicatorForTooltip(h,a.color),x=u==null?void 0:u.labelValue,b=this.getTimeLabel(d);l.hoveredLabel={horizontal:this.options.horizontal,label:b,mousePosition:[s.clientX,s.clientY],dataLabel:x}}}else r.use&&this.isInitTooltip&&(typeof(r==null?void 0:r.returnValue)=="function"&&r.returnValue([],s),this.hideTooltipDOM());if(this.dragInfoBackup&&this.drawSelectionArea(this.dragInfoBackup),!l.hoveredLabel&&!this.isNotUseIndicator()){const g=Object.values(this.seriesList||{}).some(x=>x.type==="line");(c!=="line"&&!g||!r.use||!Object.keys(h.items).length)&&this.drawIndicator(d,a.color);const u=this.getTimeLabel(d);l.hoveredLabel={horizontal:this.options.horizontal,label:u,mousePosition:[s.clientX,s.clientY]}}else l.hoveredLabel||(l.hoveredLabel={label:""});typeof this.listeners["mouse-move"]=="function"&&(c!=="pie"&&(l.curMouseTargetVal=this.getCurMouseTargetVal(d,h)),this.listeners["mouse-move"](l))},this.onMouseLeave=s=>{const{tooltip:l,dragSelection:a}=this.options;l.throttledMove&&this.onMouseMove.cancel(),(!a.use||!a.keepDisplay)&&this.overlayClear(),l.use&&this.isInitTooltip&&(typeof(l==null?void 0:l.returnValue)=="function"&&l.returnValue([],s),this.tooltipClear()),this.listeners["mouse-leave"]()},this.onDblClick=s=>{const l={e:s},a=this.getMousePosition(s),{type:r,selectItem:c,selectLabel:d,selectSeries:h}=this.options,f=(c==null?void 0:c.use)&&(c==null?void 0:c.useClick),m=(d==null?void 0:d.use)&&(d==null?void 0:d.useClick),p=(h==null?void 0:h.use)&&(h==null?void 0:h.useClick);f?l.eventTarget="item":m?l.eventTarget="label":p&&(l.eventTarget="series");const g=()=>{var I,E;const b=this.findHitItem(a),y=b.hitId||Object.keys(b.items)[0],w=b.items[y];w&&(l.label=w.label,l.value=(I=w.data)==null?void 0:I.o,l.seriesId=y,l.dataIndex=w.index,l.acc=(E=w.data)==null?void 0:E.acc)},u=b=>{var _,C;const y=this.findHitItem(a),w=y.hitId||Object.keys(y.items)[0],I=y.items[w],{labelIndex:E}=this.getLabelInfoByPosition(a,b),{dataIndex:B}=this.regulateSelectedLabelInfo(E,b);this.defaultSelectInfo=this.getSelectedLabelInfoWithLabelData(B,b),I&&(l.label=I.label,l.seriesId=w,l.value=(_=I.data)==null?void 0:_.o,l.acc=(C=I.data)==null?void 0:C.acc,l.dataIndex=I.index)},x=()=>{var I,E,B;const b=this.findHitItem(a),y=b.hitId||Object.keys(b.items)[0],w=b.items[y];if(y!==null){const _=this.updateSelectedSeriesInfo(y,!0);w&&(l.label=w.label,l.value=(I=w.data)==null?void 0:I.o,l.seriesId=(E=_.seriesId)==null?void 0:E.at(0),l.acc=(B=w.data)==null?void 0:B.acc,l.dataIndex=w.index)}};switch(r){case"bar":{m?u(this.options.horizontal?"yAxis":"xAxis"):g();break}case"line":{f?g():m?u():p&&x();break}default:{g();break}}typeof this.listeners["dbl-click"]=="function"&&this.listeners["dbl-click"](l)},this.onClick=s=>{var b;if(this.isMouseMove){this.isMouseMove=!1;return}const l={e:s},a=this.getMousePosition(s),{type:r,selectItem:c,selectLabel:d,selectSeries:h}=this.options,f=(c==null?void 0:c.use)&&(c==null?void 0:c.useClick),m=(d==null?void 0:d.use)&&(d==null?void 0:d.useClick),p=(h==null?void 0:h.use)&&(h==null?void 0:h.useClick),g=()=>{const y=this.getItemByPosition(a,!1);({label:l.label,value:l.value,sId:l.seriesId,maxIndex:l.dataIndex,acc:l.acc}=y),y!=null&&y.sId&&(l.selected={eventTarget:"item",seriesId:this.isDeselectItem(y)?null:y.sId,dataIndex:this.isDeselectItem(y)?null:y.maxIndex})},u=y=>{var E,B,_,C;const{labelIndex:w}=this.getLabelInfoByPosition(a,y),{dataIndex:I}=this.regulateSelectedLabelInfo(w,y);this.defaultSelectInfo=this.getSelectedLabelInfoWithLabelData(I,y),y&&(this.defaultSelectInfo.targetAxis=I!=null&&I.length?y:null),l.selected={eventTarget:"label",...Se(this.defaultSelectInfo)},l.label=(B=(E=this.defaultSelectInfo)==null?void 0:E.label)==null?void 0:B.at(0),l.dataIndex=(C=(_=this.defaultSelectInfo)==null?void 0:_.dataIndex)==null?void 0:C.at(0)},x=()=>{const y=this.findHitItem(a),w=y.hitId||Object.keys(y.items)[0],I=y.items[w];if(w!==null){const E=this.updateSelectedSeriesInfo(w,!1);this.defaultSelectInfo.seriesId=E.seriesId,l.selected={eventTarget:"series",...Se(this.defaultSelectInfo)},l.label=I.label,l.dataIndex=I.index}};switch(r){default:case"bar":{f?g():m&&u(this.options.horizontal?"yAxis":"xAxis");break}case"line":{f?g():m?u():p&&x();break}case"heatMap":{const y=!!this.options.horizontal;if(f&&m){const{useBothAxis:w}=d,I=this.getCurMouseLocation(a);if(I==="chartBackground")this.clearSelectedLabelInfo(),l.deselected={eventTarget:"label"},g();else if(I==="yAxis"||I==="xAxis"){if(this.clearSelectedItemInfo(),l.deselected={eventTarget:"item"},!w&&I!==(y?"yAxis":"xAxis"))return;u(I)}}else if(f)g();else if(m){const{useBothAxis:w}=d,I=this.getCurMouseLocation(a);if((I==="yAxis"||I==="xAxis")&&!w&&I!==(y?"yAxis":"xAxis"))return;I!=="canvas"&&u(w?I:null)}break}case"pie":{f&&g();break}case"scatter":{if(f&&g(),(b=this.options.dragSelection)!=null&&b.use&&this.isMobile){let y=this.setTouchInfo(s);this.overlayClear(),this.options.dragSelection.keepDisplay&&(s.layerX<y.range.x1||s.layerY<y.range.y1||s.layerX>y.range.x2||s.layerY>y.range.y2)?this.isTouchOverlay=!1:(y=this.setTouchBoxDimensions(y),this.isTouchOverlay=!0,this.drawSelectionArea(y)),this.options.dragSelection.keepDisplay||setTimeout(()=>{this.isTouchOverlay=!1,this.overlayClear()},100),l.e=s,l.touchInfo=y,l.data=this.findSelectedItems(y),l.range=this.getSelectionRange(y),typeof this.listeners["drag-select"]=="function"&&this.listeners["drag-select"](l)}break}}typeof this.listeners.click=="function"&&(this.dragInfoBackup||this.listeners.click(l))},this.onMouseDown=s=>{const{dragSelection:l,type:a}=this.options;l.use&&(a==="scatter"||a==="line"||a==="heatMap")&&(this.removeSelectionArea(),this.dragStart(s,a))},this.onWheel=s=>{var r,c,d;const l=((c=(r=this.tooltipDOM)==null?void 0:r.style)==null?void 0:c.display)==="block",a=(d=this.tooltipDOM)==null?void 0:d.querySelector(this.options.tooltip.htmlScrollTarget);(l||a&&a.scrollHeight>a.clientHeight)&&(s.preventDefault(),l&&(this.tooltipBodyDOM.scrollTop+=s.deltaY),a&&(a.scrollTop+=s.deltaY))},(t=(e=this.options)==null?void 0:e.tooltip)!=null&&t.useScrollbar&&this.overlayCanvas.addEventListener("wheel",this.onWheel,{passive:!1}),(o=(n=this.options)==null?void 0:n.tooltip)!=null&&o.throttledMove&&(this.onMouseMove=HC(this.onMouseMove,30)),this.overlayCanvas.addEventListener("mousemove",this.onMouseMove),this.overlayCanvas.addEventListener("mouseleave",this.onMouseLeave),this.overlayCanvas.addEventListener("dblclick",this.onDblClick),this.overlayCanvas.addEventListener("click",this.onClick),this.overlayCanvas.addEventListener("mousedown",this.onMouseDown),this.dragTouchSelectionEvent=s=>this.dragTouchSelectionDestroy(s),window.addEventListener("click",this.dragTouchSelectionEvent)},dragStart(e,t){let[n,o]=this.getMousePosition(e);const s=this.chartRect,l=this.labelOffset,a={x1:s.x1+l.left,x2:s.x2-l.right,y1:s.y1+l.top,y2:s.y2-l.bottom};n<a.x1&&(n=a.x1),n>a.x2&&(n=a.x2),o<a.y1&&(o=a.y1),o>a.y2&&(o=a.y2),this.dragInfo={xcp:n,ycp:o,range:a};const r=d=>{d.preventDefault();const[h,f]=this.getMousePosition(d),m=this.dragInfo,{xcp:p,ycp:g,range:u}=m;let x,b;if(m.isMove=!0,this.isMouseMove=!0,h<u.x1?x=u.x1:h>u.x2?x=u.x2:x=h,f<u.y1?b=a.y1:f>u.y2?b=u.y2:b=f,t==="heatMap"){const y={xcp:p,xep:x,ycp:g,yep:b,range:u},{xsp:w,ysp:I,width:E,height:B}=this.getDragInfoForHeatMap(y);m.xsp=w,m.ysp=I,m.width=E,m.height=B}else m.xsp=Math.min(p,x),m.ysp=t==="scatter"?Math.min(g,b):u.y1,m.width=Math.ceil(Math.abs(x-p)),m.height=t==="scatter"?Math.ceil(Math.abs(b-g)):u.y2-u.y1;this.overlayClear(),this.drawSelectionArea(m)},c=d=>{var f,m;const h=this.dragInfo;if(h!=null&&h.isMove&&(h==null?void 0:h.width)>1&&(h==null?void 0:h.height)>1){const p={e:d,data:this.findSelectedItems(h),range:t==="heatMap"?this.getSelectionRangeForHeatMap(h):this.getSelectionRange(h)};if(this.dragInfoBackup=Fe({},h),typeof this.listeners["drag-select"]=="function"&&!((m=(f=this.options)==null?void 0:f.zoom)!=null&&m.use))this.listeners["drag-select"](p);else{const{xsp:g,range:u,width:x}=h,b=g-u.x1;p.range.dragSelectionInfo={dragXsp:b,dragXep:b+x,exceptAxesYChartWidth:u.x2-u.x1,exceptAxesXChartHeight:u.y2-u.y1,chartRange:u,chartTitle:this.options.title.text},this.options.zoom.getRangeInfo(p)}this.options.dragSelection.keepDisplay||this.removeSelectionArea()}this.dragInfo=null,window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",c)};window.addEventListener("mousemove",r),window.addEventListener("mouseup",c)},drawSelectionArea({xsp:e,ysp:t,width:n,height:o,range:s}){const l=this.overlayCtx,{fillColor:a,opacity:r}=this.options.dragSelection,c=this.chartRect,d=this.labelOffset,h={x1:c.x1+d.left,x2:c.x2-d.right,y1:c.y1+d.top,y2:c.y2-d.bottom};if(l.fillStyle=a,l.globalAlpha=r,je(h,s))l.fillRect(e,t,n,o);else{const f=s.x2-s.x1,m=s.y2-s.y1,p=h.x2-h.x1,g=h.y2-h.y1,u=(e-s.x1)/f,x=(t-s.y1)/m,b=h.x1+p*u,y=h.y1+g*x,w=n/f,I=o/m,E=p*w,B=g*I;l.fillRect(b,y,E,B)}l.globalAlpha=1},removeSelectionArea(){this.dragInfoBackup=null,this.overlayClear()},getMousePosition(e){const t=e.originalEvent||e,n=this.overlayCanvas.getBoundingClientRect();return[t.clientX-n.left,t.clientY-n.top,n.width,n.height]},getCurMouseTargetVal(e,t){const n=this.getCurMouseLocation(e),o={location:n,labelIdx:-1,labelVal:"",dataIdx:-1,maxDataVal:"",originVal:""};if(n==="chartBackground"){const{maxHighlight:s,items:l}=t;if(s!=null&&s.length){const[a,r]=s;l[a]&&(o.dataIdx=l[a].index,o.maxDataVal=r,o.originVal=t)}}else if(n==="xAxis"||n==="yAxis"){const{axesX:s,axesY:l}=this.options,a=(c,d,h)=>{o.labelIdx=d,o.labelVal=c[0].type==="time"?at(h).format(c[0].timeFormat):h,o.originVal=c[0].type==="time"?at(h):h};(c=>{const{labelIndex:d}=this.getLabelInfoByPosition(e,n),{labelVal:h,labelIdx:f}=this.getCurMouseLabelVal(c,e,d);a(c==="xAxis"?s:l,f,h)})(n)}return o},setTouchInfo(e){let[t,n]=this.getMousePosition(e);const o=this.chartRect,s=this.labelOffset,l={x1:o.x1+s.left,x2:o.x2-s.right,y1:o.y1+s.top,y2:o.y2-s.bottom};return t=Math.max(l.x1,Math.min(t,l.x2)),n=Math.max(l.y1,Math.min(n,l.y2)),{xcp:t,ycp:n,range:l}},setTouchBoxDimensions(e){var h;const t=((h=this.options.dragSelection)==null?void 0:h.size)||50,n=t/2,{xcp:o,ycp:s,range:l}=e;let a=o-n,r=s-n,c=t,d=t;return this.boxOverflow={x1:!1,x2:!1,y1:!1,y2:!1},o<l.x1+n&&(a=l.x1,c=n-(l.x1-o),this.boxOverflow.x1=!0),o>l.x2-n&&(c=n-(o-l.x2),this.boxOverflow.x2=!0),s<l.y1+n&&(r=l.y1,d=n-(l.y1-s),this.boxOverflow.y1=!0),s>l.y2-n&&(d=n-(s-l.y2),this.boxOverflow.y2=!0),e.xsp=a,e.ysp=r,e.width=c,e.height=d,e},dragTouchSelectionDestroy(e){var t;(t=this.options.dragSelection)!=null&&t.use&&e.target!==this.overlayCanvas&&this.isTouchOverlay&&(this.isTouchOverlay=!1,this.overlayClear())},findHitItem(e){var u,x;const t=Object.keys(this.seriesList),n={},o=!!this.options.horizontal,s=this.tooltipCtx;let l=null,a="",r=0,c="",d=null,h=null,f=1/0;const m=this.findClosestDataIndex(e,t);if(m===-1&&!this.isNotUseIndicator())return{items:n,hitId:l,maxTip:[a,c],maxHighlight:null};const p=t.every(b=>this.seriesList[b].type==="bar");for(let b=0;b<t.length;b++){const y=t[b],w=this.seriesList[y];if(w.findGraphData&&w.show){const I=w.findGraphData(e,o,m,!p);if(I!=null&&I.data){let E;if(I.data.o===null&&w.interpolation!=="zero"?w.isExistGrp||(E=o?I.data.x:I.data.y):isNaN(I.data.o)||(E=I.data.o),E!=null){const B=this.getFormattedTooltipLabel({dataId:w.id,seriesId:y,seriesName:w.name,itemData:I.data}),_=s?s.measureText(B).width:1;I.id=w.id,I.name=B,I.axis={x:w.xAxisIndex,y:w.yAxisIndex},I.label=o?(u=I.data)==null?void 0:u.y:(x=I.data)==null?void 0:x.x,n[y]=I;const C=this.getFormattedTooltipValue({dataId:w.id,seriesId:y,seriesName:B,value:E,itemData:I.data});if(I.data.formatted=C,r<_&&(a=B,r=_),c.length<=`${C}`.length&&(c=`${C}`),(d===null||d<=E)&&(d=E,h=y),I.hit&&I.data.xp!==void 0&&I.data.yp!==void 0){const S=(I.data.xp-e[0])**2+(I.data.yp-e[1])**2;S<f&&(f=S,l=y)}}}}}return l=l===null?Object.keys(n)[0]:l,{items:n,hitId:l,maxTip:[a,c],maxHighlight:d!==null?[h,d]:null}},findClosestDataIndex(e,t){var f;const[n,o]=e,s=!!this.options.horizontal,l=s?o:n,a=t.find(m=>{var p;return(p=this.seriesList[m])==null?void 0:p.show});if(!a||!((f=this.seriesList[a])!=null&&f.data))return-1;const r=this.seriesList[a].data;let c=50;if(r.length>1){const m=[];for(let p=1;p<r.length;p++){const g=r[p-1],u=r[p];if(g&&u){let x,b;s?(x=g.h?g.yp+g.h/2:g.yp,b=u.h?u.yp+u.h/2:u.yp):(x=g.w?g.xp+g.w/2:g.xp,b=u.w?u.xp+u.w/2:u.xp),x!==null&&b!==null&&m.push(Math.abs(b-x))}}m.length>0&&(c=m.reduce((p,g)=>p+g,0)/m.length)}let d=1/0,h=-1;for(let m=0;m<r.length;m++)if(t.some(g=>{var x,b,y,w;const u=this.seriesList[g];return(u==null?void 0:u.show)&&((b=(x=u.data)==null?void 0:x[m])==null?void 0:b.o)!==null&&((w=(y=u.data)==null?void 0:y[m])==null?void 0:w.o)!==void 0})){const g=r[m];if(g){let u;if(s?u=g.h?g.yp+g.h/2:g.yp:u=g.w?g.xp+g.w/2:g.xp,u!==null){const x=Math.abs(l-u);x<d&&(d=x,h=m)}}}return d>=c?t.some(p=>{const g=this.seriesList[p];if(g!=null&&g.show){const u=g.passingValue,x=g.interpolation,b=g.hasPassingValueInData;return x==="linear"||x==="none"&&!!u&&b}return!1})?h:-1:h},getFormattedTooltipLabel({dataId:e,seriesId:t,seriesName:n,itemData:o}){var c;const l=this.options.tooltip,a=(c=l==null?void 0:l.formatter)==null?void 0:c.label;let r=n;return a&&(r=a({dataId:e,seriesId:t,seriesName:n,itemData:o})),r},getFormattedTooltipValue({dataId:e,seriesId:t,seriesName:n,value:o,itemData:s}){var h;const l=this.options,a=!!l.horizontal,r=l.tooltip,c=typeof(r==null?void 0:r.formatter)=="function"?r==null?void 0:r.formatter:(h=r==null?void 0:r.formatter)==null?void 0:h.value;let d=o;return c&&(l.type==="pie"?d=c({value:o,name:n,percentage:s==null?void 0:s.percentage,seriesId:t,dataId:e}):l.type==="heatMap"?d=c({x:s==null?void 0:s.x,y:s==null?void 0:s.y,value:o>-1?o:"error",seriesId:t,dataId:e}):d=c({x:a?o:s==null?void 0:s.x,y:a?s==null?void 0:s.y:o,o:s==null?void 0:s.o,name:n,seriesId:t,dataId:e})),o&&(!c||typeof d!="string")&&(l.type==="heatMap"?d=o<0?"error":Ht(o):d=Ht(o)),d},addNotHitInfo(e){var c,d,h,f,m,p;const t=this.tooltipCtx,n=!!this.options.horizontal,o=Object.keys(e.items)[0],s=n?(h=(d=(c=e.items)==null?void 0:c[o])==null?void 0:d.data)==null?void 0:h.y:(p=(m=(f=e.items)==null?void 0:f[o])==null?void 0:m.data)==null?void 0:p.x;let l="",a="";const r=Object.keys(this.seriesList);for(let g=0;g<r.length;g++){const u=r[g],x=this.seriesList[u];if(x!=null&&x.show){const b=x.data.find(C=>n?(C==null?void 0:C.y)===s:(C==null?void 0:C.x)===s),y=this.getFormattedTooltipLabel({dataId:x.id,seriesId:u,seriesName:x.name,itemData:b}),w=this.getFormattedTooltipValue({dataId:x.id,seriesId:u,seriesName:y,value:b==null?void 0:b.o,itemData:b});if(b&&b.o!==null&&b.o!==void 0&&!e.items[u]){const C={};C.color=x.color,C.hit=!1,C.name=y,C.axis={x:x.xAxisIndex,y:x.yAxisIndex},C.index=n?x.yAxisIndex:x.xAxisIndex,C.data=b,C.data.formatted=w,e.items[u]=C}const I=t?t.measureText(l).width:1,E=t?t.measureText(y).width:1;I<E&&(l=y);const B=t?t.measureText(a).width:1,_=t?t.measureText(`${w}`).width:1;B<_&&(a=`${w}`)}}e.maxTip=[l,a]},selectItemByData(e,t){this.defaultSelectItemInfo=e;let n;t==="pie"?n={type:"pie",sId:e.seriesID}:n=isNaN(e==null?void 0:e.dataIndex)?null:this.getItem(e,!1),this.render(n)},selectLabelByData(e,t){this.defaultSelectInfo=this.getSelectedLabelInfoWithLabelData(e,t),this.render()},selectSeriesByData(e){this.defaultSelectInfo.seriesId=e,this.render()},getSelectedLabelInfoWithLabelData(e,t){const{selectLabel:n,type:o,horizontal:s}=this.options,l=Se(this.defaultSelectInfo);switch(l.dataIndex=e,o){default:case"bar":case"line":{l.dataIndex.splice(n.limit),l.label=l.dataIndex.map(r=>this.data.labels[r]);const a=Object.entries(this.data.data);l.data=l.dataIndex.map(r=>Object.fromEntries(a.map(([c,d])=>[c,d[r]])));break}case"heatMap":{const{limit:a,useBothAxis:r}=this.options.selectLabel;l.dataIndex.splice(a);let c;r?c=t==="yAxis"?"y":"x":c=s?"y":"x",l.label=l.dataIndex.map(h=>this.data.labels[c][h]);const d=Object.values(this.data.data)[0];l.data=d.filter(({x:h,y:f})=>l.label.includes(c==="y"?f:h));break}}return l},regulateSelectedLabelInfo(e,t){var l,a;const n=((l=this.options)==null?void 0:l.selectLabel)??{},o=t===null||((a=this.defaultSelectInfo)==null?void 0:a.targetAxis)===t?{...this.defaultSelectInfo,targetAxis:t}:{dataIndex:[],targetAxis:t},s=Se(o);if(o.dataIndex.includes(e)){const r=o.dataIndex.indexOf(e);s.dataIndex.splice(r,1)}else e>-1&&(s.dataIndex.push(e),n.limit>0&&n.limit<s.dataIndex.length&&(n.useDeselectOverflow?s.dataIndex.splice(0,1):s.dataIndex.pop()));return s},updateSelectedSeriesInfo(e,t){var l;const n=((l=this.options)==null?void 0:l.selectSeries)??{},o=this.defaultSelectInfo??{seriesId:[]};typeof o.seriesId=="string"&&(o.seriesId=[o.seriesId]);const s=Se(o);if(o.seriesId.includes(e)){if(!t){const a=o.seriesId.indexOf(e);s.seriesId.splice(a,1)}}else e&&(s.seriesId.push(e),n.limit>0&&n.limit<s.seriesId.length&&(n.useDeselectOverflow?s.seriesId.splice(0,1):s.seriesId.pop()));return s},drawIndicatorForTooltip(e,t){var d;if(!(e!=null&&e.items)||!Object.keys(e.items).length)return null;const n=this.overlayCtx,{horizontal:o}=this.options,s={x1:this.chartRect.x1+this.labelOffset.left,x2:this.chartRect.x2-this.labelOffset.right,y1:this.chartRect.y1+this.labelOffset.top,y2:this.chartRect.y2-this.labelOffset.bottom},l=Object.keys(e.items)[0],a=e.items[l];if(!(a!=null&&a.data))return null;const r=o?a.data.y:a.data.x;let c;if(o){const h=a.data.yp+(a.data.h?a.data.h/2:0);c=[s.x1,h]}else c=[a.data.xp+(a.data.w?a.data.w/2:0),s.y1];return n.beginPath(),n.save(),n.strokeStyle=t,n.lineWidth=1,(d=this.options.indicator)!=null&&d.segments&&n.setLineDash(this.options.indicator.segments),o?(n.moveTo(s.x1,c[1]+.5),n.lineTo(s.x2,c[1]+.5)):(n.moveTo(c[0]+.5,s.y1),n.lineTo(c[0]+.5,s.y2)),n.stroke(),n.restore(),n.closePath(),{labelValue:r,position:c}},findSelectedItems(e){const t=[],n=Object.keys(this.seriesList);for(let o=0;o<n.length;o++){const s=n[o],l=this.seriesList[s],a=l.findItems;if(a){const r=a.call(l,e);r&&r.length&&t.push({seriesName:l.name,seriesId:s,items:r})}}return t},getSelectionRange({xsp:e,ysp:t,width:n,height:o,range:s}){var w,I,E,B;const l=this.axesSteps.x.length?this.axesSteps.x[0]:null,a=this.axesSteps.y.length?this.axesSteps.y[0]:null;if(!l||!a)return null;const r=e+n,c=t+o,d=l.graphMax-l.graphMin,h=a.graphMax-a.graphMin,f=this.getRatioInRange(s.x1,s.x2,e),m=this.getRatioInRange(s.x1,s.x2,r),p=this.getRatioInRange(s.y1,s.y2,c),g=this.getRatioInRange(s.y1,s.y2,t),u=this.isMobile&&((w=this.boxOverflow)!=null&&w.x1)?Math.min(this.minMax.x[0].min,l.graphMin):Math.max(l.graphMin+d*f,l.graphMin),x=this.isMobile&&((I=this.boxOverflow)!=null&&I.x2)?Math.max(this.minMax.x[0].max,l.graphMax):Math.min(l.graphMin+d*m,l.graphMax),b=this.isMobile&&((E=this.boxOverflow)!=null&&E.y2)?Math.min(this.minMax.y[0].min,a.graphMin):Math.max(a.graphMin+h*(1-p),a.graphMin),y=this.isMobile&&((B=this.boxOverflow)!=null&&B.y1)?Math.max(this.minMax.y[0].max,a.graphMax):Math.min(a.graphMin+h*(1-g),a.graphMax);return{xMin:+u.toFixed(3),xMax:+x.toFixed(3),yMin:+b.toFixed(3),yMax:+y.toFixed(3)}},getRatioInRange(e,t,n){const o=t-e;return(n-e)/o},getDragInfoForHeatMap(e){const t=Object.keys(this.seriesList)[0];return this.seriesList[t].findBlockRange(e)},getSelectionRangeForHeatMap(e){const t=this.axesSteps.x.length?this.axesSteps.x[0]:null,n=this.axesSteps.y.length?this.axesSteps.y[0]:null;if(!t||!n)return null;const o=Object.keys(this.seriesList)[0],{xMin:s,xMax:l,yMin:a,yMax:r}=this.seriesList[o].findSelectionRange(e)??{};return{xMin:s??t.graphMin,xMax:l??t.graphMax,yMin:a??n.graphMin,yMax:r??n.graphMax}},isDeselectItem(e){var t,n;return this.options.selectItem.useDeselectItem&&(e==null?void 0:e.maxIndex)===((t=this.defaultSelectItemInfo)==null?void 0:t.dataIndex)&&(e==null?void 0:e.sId)===((n=this.defaultSelectItemInfo)==null?void 0:n.seriesID)&&!isNaN(e==null?void 0:e.maxIndex)},getCurMouseLocation(e){const[t,n]=e,o={x1:this.chartRect.x1+this.labelOffset.left,x2:this.chartRect.x2-this.labelOffset.right,y1:this.chartRect.y1+this.labelOffset.top,y2:this.chartRect.y2-this.labelOffset.bottom},s=o[this.axesX[0].units.rectStart],l=o[this.axesX[0].units.rectEnd],a=o[this.axesY[0].units.rectStart],r=o[this.axesY[0].units.rectEnd];return ut(t,this.chartRect.x1,o.x1)&&ut(n,a,r)?"yAxis":ut(t,s,l)&&ut(n,o.y2,this.chartRect.y2)?"xAxis":ut(t,o.x1,o.x2)&&ut(n,o.y1,o.y2)?"chartBackground":"canvas"},isNotUseIndicator(){return this.options.type==="pie"||this.options.type==="scatter"||this.options.type==="heatMap"},clearSelectedLabelInfo(){this.defaultSelectInfo={dataIndex:[]}},clearSelectedItemInfo(){this.defaultSelectItemInfo=null}},Vs=8,li=50,io=17,$C=8,XC={createTooltipDOM(){var e,t;this.tooltipDOM=document.createElement("div"),this.tooltipDOM.className="ev-chart-tooltip",this.tooltipHeaderDOM=document.createElement("div"),this.tooltipHeaderDOM.className="ev-chart-tooltip-header",this.tooltipBodyDOM=document.createElement("div"),this.tooltipBodyDOM.className="ev-chart-tooltip-body",this.tooltipCanvas=document.createElement("canvas"),this.tooltipCanvas.className="ev-chart-tooltip-canvas",this.tooltipCtx=this.tooltipCanvas.getContext("2d"),this.tooltipDOM.style.display="none",(t=(e=this.options.tooltip)==null?void 0:e.formatter)!=null&&t.html||this.setDefaultTooltipLayout(),document.body.appendChild(this.tooltipDOM),this.options.tooltip.debouncedHide?this.hideTooltipDOM=Vr(()=>{this.tooltipDOM.style.display="none"},200):this.hideTooltipDOM=()=>{this.tooltipDOM.style.display="none"},this.isInitTooltip=!0},setDefaultTooltipLayout(){this.tooltipBodyDOM.appendChild(this.tooltipCanvas),this.tooltipDOM.appendChild(this.tooltipHeaderDOM),this.tooltipDOM.appendChild(this.tooltipBodyDOM)},getFontStyle(e){var s,l;const t=(s=this.options)==null?void 0:s.tooltip,n=((l=t==null?void 0:t.fontSize)==null?void 0:l[e])??14,o=(t==null?void 0:t.fontFamily)??"Roboto";return`normal normal lighter ${Math.max(n,0)}px ${o}`},getTextHeight(){var e,t,n;return(((n=(t=(e=this.options)==null?void 0:e.tooltip)==null?void 0:t.fontSize)==null?void 0:n.contents)??14)+6},getColorMargin(){var e,t,n;return(((n=(t=(e=this.options)==null?void 0:e.tooltip)==null?void 0:t.fontSize)==null?void 0:n.contents)??14)+2},getBoxPadding(){var s,l;const{top:e=0,right:t=20,bottom:n=3,left:o=16}=((l=(s=this.options)==null?void 0:s.tooltip)==null?void 0:l.rowPadding)??{};return{t:e,l:o,b:n,r:t}},setTooltipLayoutPosition(e,t){var A,F,X,U,H,$,j;const n=this.tooltipCtx,o=t.pageX,s=t.pageY,l=e.items,[a,r]=e.maxTip,d=Object.keys(l).length,h=this.getBoxPadding(),f=this.options.tooltip,m=this.getColorMargin(),p=e.hitId,g=l[p].data,u=l[p].axis,x=(A=f.formatter)==null?void 0:A.title;this.axesX.length&&this.axesY.length&&f.showHeader&&(x?this.tooltipHeaderDOM.textContent=x({x:g.x,y:g.y}):this.tooltipHeaderDOM.textContent=this.options.horizontal?this.axesY[u.y].getLabelFormat(g.y):this.axesX[u.x].getLabelFormat(g.x)),f.textOverflow&&this.tooltipHeaderDOM.classList.add(`ev-chart-tooltip-header--${f.textOverflow}`),this.tooltipHeaderDOM.style.visibility="hidden",n.save(),n.font=this.getFontStyle("contents");const y=!!this.options.horizontal?(X=(F=l[e.hitId])==null?void 0:F.data)==null?void 0:X.y:(H=(U=l[e.hitId])==null?void 0:U.data)==null?void 0:H.x,w=(y==null?void 0:y.length)>a.length?y:a,I=Math.round(n.measureText(w).width),E=Math.round(n.measureText(r).width),B=I+E+h.l+h.r+m+li+io,_=B>f.maxWidth?f.maxWidth:B;let C=f.textOverflow==="wrap"?0:d;if(f.textOverflow==="wrap"){const K=f.maxWidth-(Math.round(n.measureText(r).width)+h.l+h.r+m+li+io);Object.values(l).map(Q=>Q.name).forEach(Q=>{if(n.measureText(Q).width>K){let J="";for(let ee=0;ee<Q.length;ee++){const G=Q[ee],ne=`${J}${G}`;n.measureText(ne).width>K?(J=G,C+=1):J=ne}}C+=1}),n.restore()}const S=h.t+C*this.getTextHeight()+d*Vs+h.b;let M;f.useScrollbar&&S>f.maxHeight?(this.tooltipBodyDOM.style.overflowY="auto",M=f.maxHeight):(this.tooltipBodyDOM.style.overflowY="hidden",M=S),this.tooltipCanvas.width=_*this.pixelRatio,this.tooltipCanvas.height=S*this.pixelRatio,this.tooltipCanvas.style.width=`${_}px`,this.tooltipCanvas.style.height=`${S}px`,this.tooltipHeaderDOM.style.width=`${_}px`,this.tooltipHeaderDOM.style.height="auto",this.tooltipDOM.style.height="auto",this.tooltipBodyDOM.style.height=`${M+6}px`,this.tooltipDOM.style.display="block";const k=document.body.clientWidth,T=document.body.clientHeight,R=20,L=(($=this.tooltipDOM)==null?void 0:$.offsetHeight)||((j=this.tooltipHeaderDOM)==null?void 0:j.offsetHeight)+M+$C,N=k-_-R,v=T-L-R,O=o+R,D=s+R,V=o-_-R,P=s-L-R;this.tooltipDOM.style.left=O>N?`${V}px`:`${O}px`,this.tooltipDOM.style.top=D>v?`${P}px`:`${D}px`},drawSeriesColorShape(e,t,n){var a,r;const o=(r=(a=this.options.tooltip)==null?void 0:a.fontSize)==null?void 0:r.contents,{x:s,y:l}=n;if(t==="circle"){e.beginPath();const c=o/2;e.arc(s,l-c/2,c,0,2*Math.PI),e.fill()}else{const c=o;e.fillRect(s-c/3,l-c/1.2,c,c)}},drawTooltip(e,t){const n=t,o=e.items,[,s]=e.maxTip,l=this.alignSeriesList(Object.keys(o)),a=this.getBoxPadding(),r=this.options.horizontal,c=this.options.tooltip,d=this.getTextHeight(),h=this.getColorMargin();this.axesX.length&&this.axesY.length&&c.showHeader?this.tooltipHeaderDOM.style.visibility="visible":this.tooltipHeaderDOM.style.display="none";let f=2,m=2;f+=Y.aliasPixel(f),m+=Y.aliasPixel(m),n.save(),n.scale(this.pixelRatio,this.pixelRatio),this.tooltipBodyDOM.style.overflowY==="auto"&&(a.r+=io),f+=a.l,m+=a.t,n.font=this.getFontStyle("contents");const p=[];l.forEach(u=>{p.push({id:u,data:o[u].data,color:o[u].color,name:o[u].name,dataId:o[u].id})}),c.sortByValue&&p.sort((u,x)=>{let b=u.data.o,y=x.data.o;return b==null&&(b=r?u.data.x:u.data.y),y==null&&(y=r?x.data.x:x.data.y),y-b}),this.setTooltipDOMStyle(c);let g=1;for(let u=0;u<p.length;u++){const x=p[u].data,b=p[u].color,y=p[u].name,w=x.formatted;let I=f+4,E=m+g*d;I+=Y.aliasPixel(I),E+=Y.aliasPixel(E),n.beginPath(),typeof b!="string"?n.fillStyle=ie.createGradient(n,r,{x:I-4,y:E,w:12,h:-12},b):n.fillStyle=b;const B={id:p[u].id,name:p[u].name,value:w,dataId:p[u].dataId};this.drawSeriesColorShape(n,c.colorShape,{x:I,y:E}),n.fillStyle=typeof c.fontColor.label=="function"?c.fontColor.label(B):c.fontColor.label??c.fontColor;const _=c.maxWidth-Math.round(n.measureText(s).width)-a.l-a.r-h-li,C=I+h,S=E;if(_>n.measureText(y).width)n.fillText(y,C,S);else if(c.textOverflow==="wrap"){let M="",k=S;for(let T=0;T<y.length;T++){const R=y[T],L=`${M}${R}`;n.measureText(L).width>_?(n.fillText(M,C,k),M=R,g+=1,k+=d):M=L}n.fillText(M,C,k)}else{const M=Y.truncateLabelWithEllipsis(y,_,n);n.fillText(M,C,S)}n.save(),n.fillStyle=typeof c.fontColor.value=="function"?c.fontColor.value(B):c.fontColor.value??c.fontColor,n.textAlign="right",n.fillText(w,this.tooltipDOM.offsetWidth-a.r,E),n.restore(),n.closePath(),m+=Vs,g+=1}n.restore()},drawToolTipForHeatMap(e,t){const n=t,o=e.items,s=e.hitId,l=o[s].data,a=o[s].axis,r=o[s].color,c=this.getBoxPadding(),d=this.options.horizontal,h=this.options.tooltip,f=Object.values(this.seriesList)[0],m=this.getTextHeight(),p=this.getColorMargin();let g=!1,u=l.formatted;const{colorState:x,isGradient:b}=f;if(b){const{min:E,max:B}=f.valueOpt,_=We(l.o-E,B-E),{start:C,end:S}=x[0];g=C<=_&&_<=S||l.o===-1}else{const E=x.find(({id:B})=>B===l.cId);g=E==null?void 0:E.show,u=(E==null?void 0:E.label)??u}if(!g){this.tooltipClear();return}this.axesX.length&&this.axesY.length&&h.showHeader?this.tooltipHeaderDOM.style.visibility="visible":this.tooltipHeaderDOM.style.display="none",this.setTooltipDOMStyle(h),n.save(),n.scale(this.pixelRatio,this.pixelRatio),this.tooltipBodyDOM.style.overflowY==="auto"&&(c.r+=io);const y=c.l+2,w=c.t+m+2;n.font=this.getFontStyle("contents"),n.beginPath(),typeof r!="string"?n.fillStyle=ie.createGradient(n,d,{x:y,y:w,w:12,h:-12},r):n.fillStyle=r;const I={id:e.hitId,name:l.y,value:u,dataId:o[s].id};this.drawSeriesColorShape(n,h.colorShape,{x:y,y:w}),n.fillStyle=typeof h.fontColor.label=="function"?h.fontColor.label(I):h.fontColor.label??h.fontColor,this.axesY.length&&n.fillText(this.axesY[a.y].getLabelFormat(l.y),y+p,w),n.textAlign="right",n.fillStyle=typeof h.fontColor.value=="function"?h.fontColor.value(I):h.fontColor.value??h.fontColor,n.fillText(u,this.tooltipDOM.offsetWidth-c.r,w),n.closePath()},drawTooltipForScatter(e,t){const n=t,o=e.items,[,s]=e.maxTip,l=this.alignSeriesList(Object.keys(o)),a=this.getBoxPadding(),r=this.options.tooltip,c=this.getTextHeight(),d=this.getColorMargin();this.axesX.length&&this.axesY.length&&r.showHeader?this.tooltipHeaderDOM.style.visibility="visible":this.tooltipHeaderDOM.style.display="none";let h=2,f=2;h+=Y.aliasPixel(h),f+=Y.aliasPixel(f),n.save(),n.scale(this.pixelRatio,this.pixelRatio),this.tooltipBodyDOM.style.overflowY==="auto"&&(a.r+=io),h+=a.l,f+=a.t,n.font=this.getFontStyle("contents");const m=[];l.forEach(g=>{m.push({data:o[g].data,color:o[g].color,name:o[g].name})}),r.sortByValue&&m.sort((g,u)=>{let x=g.data.o,b=u.data.o;return x==null&&(x=g.data.y),b==null&&(b=u.data.y),b-x}),this.setTooltipDOMStyle(r);let p=1;for(let g=0;g<m.length;g++){const u=m[g].data,x=m[g].color,b=m[g].name,y=u.formatted;let w=h+4,I=f+p*c;w+=Y.aliasPixel(w),I+=Y.aliasPixel(I),n.beginPath(),typeof x!="string"?n.fillStyle=ie.createGradient(n,!1,{x:w-4,y:I,w:12,h:-12},x):n.fillStyle=x;const E={id:e.hitId,name:m[g].name,value:y,dataId:m[g].dataId};this.drawSeriesColorShape(n,r.colorShape,{x:w,y:I}),n.fillStyle=typeof r.fontColor.label=="function"?r.fontColor.label(E):r.fontColor.label??r.fontColor;const B=r.maxWidth-Math.round(n.measureText(s).width)-a.l-a.r-d-li,_=w+d,C=I;if(B>n.measureText(b).width)n.fillText(b,_,C);else if(r.textOverflow==="wrap"){let S="",M=C;for(let k=0;k<b.length;k++){const T=b[k],R=`${S}${T}`;n.measureText(R).width>B?(n.fillText(S,_,M),S=T,p+=1,M+=c):S=R}n.fillText(S,_,M)}else{const S=Y.truncateLabelWithEllipsis(b,B,n);n.fillText(S,_,C)}n.save(),n.textAlign="right",n.fillStyle=typeof r.fontColor.value=="function"?r.fontColor.value(E):r.fontColor.value??r.fontColor,n.fillText(y,this.tooltipDOM.offsetWidth-a.r,I),n.restore(),n.closePath(),f+=Vs,p+=1}n.restore()},setCustomTooltipLayoutPosition(e,t){var b,y;const n=t.pageX,o=t.pageY,s=(b=this.tooltipDOM.getElementsByClassName("ev-chart-tooltip-custom"))==null?void 0:b[0];if(!s&&!this.tooltipDOM)return;this.tooltipDOM.style.display="block";const l=s.offsetWidth,a=s.offsetHeight;this.tooltipDOM.style.height="auto",this.tooltipBodyDOM.style.height=`${a+6}px`;const r=document.body.clientWidth,c=document.body.clientHeight,d=(y=this.tooltipDOM)==null?void 0:y.getBoundingClientRect(),h=20,f=r-l-h,m=c-(d==null?void 0:d.height)-h,p=n+h,g=o+h,u=n-l-h,x=o-(d==null?void 0:d.height)-h;this.tooltipDOM.style.left=p>f?`${u}px`:`${p}px`,this.tooltipDOM.style.top=g>m?`${x}px`:`${g}px`},drawCustomTooltip(e){var n,o,s,l;const t=(n=this.options)==null?void 0:n.tooltip;if((o=t.formatter)!=null&&o.html){this.tooltipDOM.innerHTML="";const a=[];Object.keys(e).forEach(c=>{a.push({sId:c,data:e[c].data,color:e[c].color,name:e[c].name,dataId:e[c].id,index:e[c].index})});const r=Y.htmlToElement((s=t==null?void 0:t.formatter)==null?void 0:s.html(a));r&&this.tooltipDOM.appendChild(r),this.tooltipDOM.style.overflowY="hidden",this.tooltipDOM.style.backgroundColor=t.backgroundColor,this.tooltipDOM.style.border=`1px solid ${t.borderColor}`,this.tooltipDOM.style.color=((l=t.fontColor)==null?void 0:l.title)??t.fontColor}},setTooltipDOMStyle(e){var t;if(this.tooltipDOM.style.overflowY="hidden",this.tooltipDOM.style.backgroundColor=e.backgroundColor,this.tooltipDOM.style.border=`1px solid ${e.borderColor}`,this.tooltipDOM.style.color=((t=e.fontColor)==null?void 0:t.title)??e.fontColor,this.tooltipHeaderDOM.style.fontSize=`${e.fontSize.title}px`,this.tooltipHeaderDOM.style.fontFamily=this.getFontStyle("title"),e.useShadow){const n=`rgba(0, 0, 0, ${e.shadowOpacity})`;this.tooltipDOM.style.boxShadow=`2px 2px 2px ${n}`}this.tooltipDOM.style.display="block"},drawItemsHighlight(e,t){Object.keys(e.items).forEach(n=>{var s;const o=this.seriesList[n];o.itemHighlight(e.items[n],t,e.items[n].index,(s=this.options)==null?void 0:s.unSelectedOpacity),Y.isDoughnutHole(o.type)&&this.drawDoughnutHole(t)})},drawIndicator(e,t){var d;const n=this.overlayCtx,[o,s]=e,l={x1:this.chartRect.x1+this.labelOffset.left,x2:this.chartRect.x2-this.labelOffset.right,y1:this.chartRect.y1+this.labelOffset.top,y2:this.chartRect.y2-this.labelOffset.bottom},a=15,r=15,c=this.options;o>=l.x1-a&&o<=l.x2+a&&s>=l.y1-r&&s<=l.y2+r&&(n.beginPath(),n.save(),n.strokeStyle=t,n.lineWidth=1,(d=c.indicator)!=null&&d.segments&&n.setLineDash(c.indicator.segments),c.horizontal?(n.moveTo(l.x1,s+.5),n.lineTo(l.x2,s+.5)):(n.moveTo(o+.5,l.y1),n.lineTo(o+.5,l.y2)),n.stroke(),n.restore(),n.closePath())},getTimeLabel(e){var h,f;const t=this.options;if(t.syncHover===!1||!t.horizontal&&!t.axesX.every(({type:m})=>m==="time")||t.horizontal&&!t.axesY.every(({type:m})=>m==="time"))return null;const n=+((h=this.data.labels)==null?void 0:h[0]),o=+((f=this.data.labels)==null?void 0:f[this.data.labels.length-1]);if(n==null||o==null)return null;const[s,l]=e,a={x1:this.chartRect.x1+this.labelOffset.left,x2:this.chartRect.x2-this.labelOffset.right,y1:this.chartRect.y1+this.labelOffset.top,y2:this.chartRect.y2-this.labelOffset.bottom};if(t.horizontal){const m=a.y2-a.y1,g=(l-a.y1)*(o-n)/m+n;return Math.round(g)}const r=a.x2-a.x1,d=(s-a.x1)*(o-n)/r+n;return Math.round(d)},drawSyncedIndicator({horizontal:e,label:t,mousePosition:n,dataLabel:o}){var g,u;if(!this._canDrawSyncedIndicator(e,n))return;if(o){this.drawSyncedIndicatorForTooltip({dataLabel:o,mousePosition:n});return}const s=+((g=this.data.labels)==null?void 0:g[0]),l=+((u=this.data.labels)==null?void 0:u[this.data.labels.length-1]),[a,r]=n,{top:c,bottom:d,left:h,right:f}=this.chartDOM.getBoundingClientRect();if(ut(a,h,f)&&ut(r,d,c))return;this.overlayClear();const p={x1:this.chartRect.x1+this.labelOffset.left,x2:this.chartRect.x2-this.labelOffset.right,y1:this.chartRect.y1+this.labelOffset.top,y2:this.chartRect.y2-this.labelOffset.bottom};if(e){const b=(p.y2-p.y1)*(t-s)/(l-s)+p.y1;this.drawIndicator([p.x2,b],this.options.indicator.color)}else{const b=(p.x2-p.x1)*(t-s)/(l-s)+p.x1;this.drawIndicator([b,p.y2],this.options.indicator.color)}},_canDrawSyncedIndicator(e,t){return!t||!!e!=!!this.options.horizontal?!1:this._isTimeBasedSyncEnabled(e)&&this._hasValidTimeRange()},_isTimeBasedSyncEnabled(e){var n,o;return this.options.syncHover===!1||!((o=(n=this.data)==null?void 0:n.labels)!=null&&o.length)?!1:e?this.options.axesY.every(({type:s})=>s==="time"):this.options.axesX.every(({type:s})=>s==="time")},_hasValidTimeRange(){var n,o;const e=+((n=this.data.labels)==null?void 0:n[0]),t=+((o=this.data.labels)==null?void 0:o[this.data.labels.length-1]);return e!=null&&t!=null},drawSyncedIndicatorForTooltip({dataLabel:e,mousePosition:t}){var f,m,p,g,u,x,b,y,w,I,E,B,_;if(!((f=this.data)!=null&&f.labels)||!e)return;const n=this.data.labels.findIndex(C=>(C==null?void 0:C.valueOf())===(e==null?void 0:e.valueOf()));if(n===-1){this.overlayClear();return}const{horizontal:o}=this.options,s=this.chartDOM.getBoundingClientRect(),[l,a]=t;if(ut(l,s.left,s.right)&&ut(a,s.bottom,s.top))return;this.overlayClear();const c={x1:this.chartRect.x1+this.labelOffset.left,x2:this.chartRect.x2-this.labelOffset.right,y1:this.chartRect.y1+this.labelOffset.top,y2:this.chartRect.y2-this.labelOffset.bottom},d=this.data.labels.length;let h;if(o){const C=c.y2-c.y1,S=(m=this.options.axesY)==null?void 0:m.some(T=>T.categoryMode),M=(p=this.options.axesY)==null?void 0:p.some(T=>T.type==="time");let k;if(S)k=c.y1+C*(n+.5)/d;else if(M){const T=(u=(g=this.axesSteps)==null?void 0:g.y)==null?void 0:u[0],R=(T==null?void 0:T.graphMin)??+((x=this.data.labels)==null?void 0:x[0]),L=(T==null?void 0:T.graphMax)??+((b=this.data.labels)==null?void 0:b[this.data.labels.length-1]);k=c.y1+C*(+e-R)/(L-R)}else k=c.y1+C*n/(d-1);h=[c.x2,k]}else{const C=c.x2-c.x1,S=(y=this.options.axesX)==null?void 0:y.some(T=>T.categoryMode),M=(w=this.options.axesX)==null?void 0:w.some(T=>T.type==="time");let k;if(S)k=c.x1+C*(n+.5)/d;else if(M){const T=(E=(I=this.axesSteps)==null?void 0:I.x)==null?void 0:E[0],R=(T==null?void 0:T.graphMin)??+((B=this.data.labels)==null?void 0:B[0]),L=(T==null?void 0:T.graphMax)??+((_=this.data.labels)==null?void 0:_[this.data.labels.length-1]);k=c.x1+C*(+e-R)/(L-R)}else k=c.x1+C*n/(d-1);h=[k,c.y2]}this.drawIndicator(h,this.options.indicator.color)},tooltipClear(){this.clearRectRatio=this.pixelRatio<1?this.pixelRatio:1,this.tooltipCtx.clearRect(0,0,this.tooltipCanvas.width/this.clearRectRatio,this.tooltipCanvas.height/this.clearRectRatio),this.tooltipDOM.style.display="none"},alignSeriesList(e){const t=this.data.groups,n=this.seriesList,o=[];return t.forEach(s=>{s.slice().reverse().forEach(l=>{const a=n[l];a&&a.showLegend&&e.includes(l)&&o.push(l)})}),Object.keys(n).forEach(s=>{const l=n[s];!l.isExistGrp&&l.showLegend&&e.includes(s)&&o.push(s)}),o},tooltipDestroy(){this.tooltipDOM&&(this.tooltipDOM.remove(),this.tooltipDOM=null),this.isInitTooltip=!1}},UC={pieDataSet:[],drawPie(e){var I;const t=this.bufferCtx,n=this.chartRect,o=this.pieDataSet,s=this.options,l=this.options.padding,a=!!s.doughnutHoleSize;let r,c,d,h=1.5*Math.PI,f,m,p;const g=n.width/2,u=n.height/2,x=g-(l.left+l.right),b=u-(l.bottom+l.top);if(typeof x=="number"&&x<0||typeof b=="number"&&b<0)return;const y=Math.min(x,b)*s.doughnutHoleSize,w=Math.min(x,b);for(let E=0;E<o.length;E++){const B=o[E];if(!B)return;let _=w-(w-y)/o.length*E;if((I=s==null?void 0:s.pieStroke)!=null&&I.use&&(_-=s.pieStroke.lineWidth),_<0)return;if(B.or=_,E<o.length-1?B.ir=w-(w-y)/o.length*(E+1):B.ir=1,B.total){for(let C=0;C<B.data.length;C++)if(r=B.data[C],c=r.value,p=c/B.total*100,d=2*Math.PI*(c/B.total),f=h+d,r.sa=h,r.ea=f,m=this.seriesList[r.id],c){const S={...s.pieStroke};B.data.length===1&&s.pieStroke.use&&(S.use=!1,t.lineWidth=s.pieStroke.lineWidth,t.strokeStyle=s.pieStroke.color,t.arc(g,u,_,0,2*Math.PI),t.stroke());const{selectInfo:M,legendHitInfo:k,unSelectedOpacity:T}=e;m.isSelect=(M==null?void 0:M.sId)===r.id,m.isDownplay=k&&k.sId!==r.id,m.type=a?"doughnut":"pie",m.centerX=g,m.centerY=u,m.radius=_,m.doughnutHoleSize=_*(s.doughnutHoleSize??0),m.startAngle=h,m.endAngle=f,m.data={o:c,percentage:p},m.draw(t,S,T),h+=d}}}},drawSunburst(e){var u;const t=this.bufferCtx,{width:n,height:o}=this.chartRect,s=this.pieDataSet,l=this.options,a=this.options.padding;this.calculateAngle();let r,c;const d=n/2,h=o/2,f=d-(a.left+a.right),m=h-(a.bottom+a.top);if(typeof f=="number"&&f<0||typeof m=="number"&&m<0)return;const p=Math.min(f,m)*l.doughnutHoleSize,g=Math.min(f,m);for(let x=0;x<s.length;x++){const b=s[x];if(!b)return;let y=g-(g-p)/s.length*x;if((u=l==null?void 0:l.pieStroke)!=null&&u.use&&(y-=l.pieStroke.lineWidth),y<0)return;b.or=y,x<s.length-1?b.ir=g-(g-p)/s.length*(x+1):b.ir=1;for(let w=0;w<b.data.length;w++)if(r=b.data[w],r.id==="dummy")t.save(),t.globalCompositeOperation="destination-out",t.beginPath(),t.fillStyle="#fff",t.lineWidth=2,t.strokeStyle="#fff",t.moveTo(d,h),t.arc(d,h,y,r.sa,r.ea),t.stroke(),t.fill(),t.closePath(),t.restore();else if(c=this.seriesList[r.id],r.value){const I={...l.pieStroke};b.data.length===1&&l.pieStroke.use&&(I.use=!1,t.lineWidth=l.pieStroke.lineWidth,t.strokeStyle=l.pieStroke.color,t.arc(d,h,y,0,2*Math.PI),t.stroke());const{selectInfo:E,legendHitInfo:B,unSelectedOpacity:_}=e;c.isSelect=(E==null?void 0:E.sId)===r.id,c.isDownplay=B&&B.sId!==r.id,c.type="sunburst",c.centerX=d,c.centerY=h,c.radius=y,c.doughnutHoleSize=y*(l.doughnutHoleSize??0),c.startAngle=r.sa,c.endAngle=r.ea,c.data={o:r.value},c.draw(t,I,_)}}},drawDoughnutHole(e=this.bufferCtx){var h;const t=this.options,{width:n,height:o}=this.chartRect,s=this.options.padding,l=n/2,a=o/2,r=l-(s.left+s.right),c=a-(s.bottom+s.top);if(typeof r=="number"&&r<0||typeof c=="number"&&c<0)return;const d=Math.min(r,c)*t.doughnutHoleSize;e.save(),e.globalCompositeOperation="destination-out",e.beginPath(),e.fillStyle="#fff",e.fillOpacity=0,e.arc(l,a,d,0,2*Math.PI),e.fill(),e.strokeStyle="#fff",e.stroke(),e.closePath(),e.restore(),(h=t==null?void 0:t.pieStroke)!=null&&h.use&&(e.beginPath(),e.strokeStyle=t.pieStroke.color,e.lineWidth=t.pieStroke.lineWidth,e.arc(l,a,d,0,Math.PI*2),e.stroke(),e.closePath()),this.pieDataSet[this.pieDataSet.length-1].ir=d}},YC={drawTips(e){var h,f,m,p,g,u;const t=this.options;let n=null;const o=!!t.horizontal,s=t.maxTip,l=t.selectItem,a=t.selectLabel;let r,c;typeof((h=t.tooltip)==null?void 0:h.formatter)=="function"?n=(f=t.tooltip)==null?void 0:f.formatter:typeof((p=(m=t.tooltip)==null?void 0:m.formatter)==null?void 0:p.value)=="function"&&(n=(u=(g=t.tooltip)==null?void 0:g.formatter)==null?void 0:u.value),a.use&&a.showTip&&(c=t.type==="heatMap"?this.drawLabelTipForHeatMap():this.drawTipForSelectedLabel());const d=x=>{e.forEach(b=>{if(b){const y=this.seriesList[b==null?void 0:b.sId];if(!(y!=null&&y.show))return;const w=this.calculateTipInfo(y,"sel",b);if(w){let I=!1;if(s.use&&(r==null?void 0:r.dp)===w.dp&&(I=!0),x.showTextTip||x.showTip){if(x.tipText==="label"){const E=o?t.axesY[0]:t.axesX[0],B=w.label;w.text=E.type==="time"?at(B).format(E.timeFormat):B}else w.text=Ht(w.value);this.drawTextTip({opt:x,tipType:"sel",seriesOpt:y,isSamePos:I,...w})}x.showIndicator&&this.drawFixedIndicator({opt:x,seriesOpt:y,...w})}b&&(b!=null&&b.label)&&(b==null?void 0:b.label)===0&&(this.lastHitInfo=b)}})};if(e&&!c&&(l.use?d(l):a.use&&t.type==="line"&&d(a)),s.use&&!c){const x=this.minMax[o?"x":"y"][0].maxSID,b=this.seriesList[x];r=this.calculateTipInfo(b,"max",null),s.use&&r&&(n?r.text=n({seriesId:b.sId,x:o?r.value:void 0,y:o?void 0:r.value}):r.text=Ht(r.value),this.drawTextTip({opt:s,tipType:"max",seriesOpt:b,...r}),s.showIndicator&&this.drawFixedIndicator({opt:s,seriesOpt:b,...r}))}},calculateTipInfo(e,t,n){if(!e)return!1;const o=!!this.options.horizontal,s=this.lastTip,l=this.chartRect,a=this.labelOffset,r={x1:l.x1+a.left,x2:l.x2-a.right,y1:l.y1+a.top,y2:l.y2-a.bottom},c=l.chartHeight-(a.top+a.bottom),d=l.chartWidth-(a.left+a.right),h=this.axesSteps.x[e.xAxisIndex],f=this.axesSteps.y[e.yAxisIndex],m=r.x1,p=r.x2,g=r.y2,{type:u,size:x}=e,{maxDomain:b,maxDomainIndex:y}=e.minMax;if(b===null||y<0)return!1;let w=u==="bar"?y:b;t==="sel"&&(n&&n.label!==null?(s.pos=u==="bar"?n.maxIndex:n.label,w=s.pos):s.pos!==null&&(w=s.pos));let I=o?e.minMax.maxX:e.minMax.maxY,E;if(t==="sel"){if(n&&n.value!==null)I=n.useStack?n.acc:n.value,E=n.label,s.value=I,s.label=E;else if(s.value!==null)I=s.value,E=s.label;else if(s.pos!==null){const k=u==="bar"?this.getItemByLabelIndex(s.pos):this.getItemByLabel(s.pos);I=k.useStack?k.acc:k.value,E=k.label,s.value=I,s.label=E}}let B,_,C;if(u==="bar"){const k=o?this.scrollbar.y:this.scrollbar.x;if(k!=null&&k.use){const[T,R]=(k==null?void 0:k.range)??[];if(w>=T&&w<=R)w-=T??0;else return!1}o?(_=Math.round(x.h/2),B=g-x.cat*w-x.cPad,C=B-(x.bar*x.ix-(x.h+x.bPad))-_):(_=Math.round(x.w/2),B=m+x.cat*w+x.cPad,C=B+(x.bar*x.ix-(x.w+x.bPad))+_)}else u==="line"?C=ie.calculateX(w,h.graphMin,h.graphMax,d-x.comboOffset,m+x.comboOffset/2):u==="scatter"&&(C=ie.calculateX(w,h.graphMin,h.graphMax,d,m));return{...{xArea:d,yArea:c,graphX:h,graphY:f,xsp:m,xep:p,ysp:g},...{dp:C,value:I,label:E,type:u}}},drawFixedIndicator(e){const t=!!this.options.horizontal,n=this.bufferCtx,{graphX:o,graphY:s,xArea:l,yArea:a,xsp:r,ysp:c,dp:d,type:h,value:f,opt:m,seriesOpt:p}=e;let g=0;h==="line"?g+=3:h==="scatter"&&(g+=(p==null?void 0:p.pointSize)??0);let u;m.fixedPosTop?t?u=ie.calculateX(o.graphMax,o.graphMin,o.graphMax,l,r):(u=ie.calculateY(s.graphMax,s.graphMin,s.graphMax,a,c),u-=g):t?u=ie.calculateX(f,o.graphMin,o.graphMax,l,r):(u=ie.calculateY(f,s.graphMin,s.graphMax,a,c),u-=g),d!==null&&(n.beginPath(),n.save(),n.strokeStyle=m.indicatorColor,n.lineWidth=2,t?(n.moveTo(r,d),n.lineTo(u,d)):(n.moveTo(d,c),n.lineTo(d,u)),n.stroke(),n.restore(),n.closePath())},drawTipForSelectedLabel(){var r,c;const e=this.options,t=!!e.horizontal,n=e.selectLabel,{dataIndex:o,data:s,label:l}=this.defaultSelectInfo;let a=!1;if(o.length){a=!0;const d=this.chartRect,h=this.labelOffset,f={x1:d.x1+h.left,x2:d.x2-h.right,y1:d.y1+h.top,y2:d.y2-h.bottom},m=t?this.axesY[0]:this.axesX[0],p=t?this.axesX[0]:this.axesY[0],g=t?this.axesSteps.x[0]:this.axesSteps.y[0],u=t?ie.calculateX:ie.calculateY,x=t?ie.calculateY:ie.calculateX,b=t?this.scrollbar.y:this.scrollbar.x,y=d.chartWidth-(h.left+h.right),w=d.chartHeight-(h.top+h.bottom),I=t?y:w,E=f[p.units.rectStart];let B=this.options.type==="bar"?4:6;B*=t?1:-1;const _=Object.keys(this.seriesList??{}),C=_.filter(F=>this.seriesList[F].show),S=_.some(F=>this.seriesList[F].isExistGrp&&!this.seriesList[F].isOverlapping),M=((r=this.data.groups)==null?void 0:r[0])??[];let k,T,R,L,N,v,O,D,V,P=0,A=(c=m.labels)==null?void 0:c.length;if(m.labels){let F=m.labels.length;if(b!=null&&b.use){const{range:X,interval:U,type:H}=b,[$,j]=X;ve($)&&ve(j)&&(F=Math.floor((+j-+$)/U)+1,P=H==="step"?$:m.labels.findIndex(K=>K===+$),A=H==="step"?j:m.labels.findIndex(K=>K===+j))}L=f[m.units.rectStart],N=f[m.units.rectEnd],v=(N-L)/F}else O=this.axesSteps.x[0],D=_.find(F=>{var X;return((X=this.seriesList[F])==null?void 0:X.type)==="line"}),V=this.seriesList[D].size;s.forEach((F,X)=>{var U;if(R=g.graphMax,!n.fixedPosTop){if(S){const H=C==null?void 0:C.reduce((K,q)=>{var Q,J;return M.includes(q)&&(((Q=F[q])==null?void 0:Q.value)??F[q])>0?K+(((J=F[q])==null?void 0:J.value)??F[q]):K},0),$=((U=C==null?void 0:C.filter(K=>!M.includes(K)))==null?void 0:U.map(K=>{var q;return((q=F[K])==null?void 0:q.value)??F[K]}))??[],j=($==null?void 0:$.length)>0?$.reduce((K,q)=>Math.max(K,q??-1/0),-1/0):-1/0;R=H>0?Math.max(j,H):Math.max(j,0)}else if(C.length){const H=C.map(j=>{var K;return((K=F[j])==null?void 0:K.value)??F[j]}),$=H.length>0?H.reduce((j,K)=>Math.max(j,K??-1/0),-1/0):-1/0;R=$>0||this.options.type!=="bar"?$:0}}if(m.labels){if(o[X]<P||o[X]>A)return;const H=o[X]-P;k=Math.round(L+v*H)+v/2}else k=x(l[X],O.graphMin,O.graphMax,y-V.comboOffset,f.x1+V.comboOffset/2);T=u(R,g.graphMin,g.graphMax,I,E)+B,this.showTip({context:this.bufferCtx,x:t?T:k,y:t?k:T,opt:n,isSamePos:!1})})}return a},drawLabelTipForHeatMap(){const e=this.options,t=!!e.horizontal,n=e.selectLabel,{dataIndex:o}=this.defaultSelectInfo;let s=!1;if(o){s=!0;const l=this.chartRect,a=this.labelOffset,r={x1:l.x1+a.left,x2:l.x2-a.right,y1:l.y1+a.top,y2:l.y2-a.bottom},c=t?this.axesY[0]:this.axesX[0],d=r[c.units.rectStart],f=(r[c.units.rectEnd]-d)/c.labels.length,m=t?this.axesX[0]:this.axesY[0],p=6*(t?1:-1),g=r[m.units.rectEnd]+p;o==null||o.forEach(u=>{const b=Math.round(d+f*u)+f/2;this.showTip({context:this.bufferCtx,x:t?g:b,y:t?b:g,opt:n,isSamePos:!1})})}return s},drawTextTip(e){const t=!!this.options.horizontal,n=this.bufferCtx,{graphX:o,graphY:s,xArea:l,yArea:a,xsp:r,xep:c,ysp:d}=e,{dp:h,value:f,text:m,opt:p,type:g,tipType:u,isSamePos:x,seriesOpt:b}=e,y=4,w=4,{fontSize:I,fontFamily:E,fontWeight:B,height:_}=p.tipStyle,C=`normal normal ${B} ${I}px ${E}`;let S=1;g==="line"?S+=6:g==="scatter"?S+=b==null?void 0:b.pointSize:g==="bar"&&(S+=4);let M,k=h;if(p.fixedPosTop)t?(M=ie.calculateX(o.graphMax,o.graphMin,o.graphMax,l,r),M+=S):(M=ie.calculateY(s.graphMax,s.graphMin,s.graphMax,a,d),M-=S);else if(t)M=ie.calculateX(f,o.graphMin,o.graphMax,l,r),M=f<0?M-S:M+S;else{const L=g==="bar"&&f<0?0:f;M=ie.calculateY(L,s.graphMin,s.graphMax,a,d),M=L<0?M+S:M-S}let T="center";n.save(),n.font=C;const R=Math.round(Math.max(n.measureText(m).width+12,40));t||(h+R/2>c-10?(T="right",k-=R/2-y*2):h-R/2<r+10&&(T="left",k+=R/2-y*2)),n.restore(),(p.showTextTip||u==="max")&&this.showTextTip({context:n,type:T,width:R,height:_,x:t?M+R/2:k,y:t?k+_/2:M,opt:p,arrowSize:y,borderRadius:w,text:m,textStyle:C,isNegative:f<0}),p.showTip&&u==="sel"&&this.showTip({context:n,x:t?M:h,y:t?h:M,opt:p,isSamePos:x})},showTextTip(e){const t=!!this.options.horizontal,{type:n,width:o,height:s,x:l,y:a,arrowSize:r,borderRadius:c,text:d,opt:h,textStyle:f,isNegative:m}=e,p=e.context;let g=l-o/2,u=l+o/2;const x=a-s,b=a;m&&t&&(g=l-o/2-o,u=l-o/2),p.save(),p.font=f,p.fillStyle=h.tipBackground??h.tipStyle.background,p.shadowBlur=0,p.beginPath(),p.moveTo(g+c,x),p.quadraticCurveTo(g,x,g,x+c),p.lineTo(g,b-c),p.quadraticCurveTo(g,b,g+c,b),p.lineTo(u-c,b),p.quadraticCurveTo(u,b,u,b-c),p.lineTo(u,x+c),p.quadraticCurveTo(u,x,u-c,x),p.lineTo(g+c,x),p.closePath(),p.fill(),p.beginPath(),t?(m?(p.moveTo(u,b),p.lineTo(u,x+c+r/2),p.lineTo(u+r,b-s/2),p.lineTo(u,b-c-r/2)):(p.moveTo(g,x),p.lineTo(g,x+c+r/2),p.lineTo(g-r,b-s/2),p.lineTo(g,b-c-r/2)),p.closePath(),p.fill()):(m?n==="left"?(p.lineTo(g+c+r,b+r),p.lineTo(g+c+r*2,b)):n==="right"?(p.lineTo(u-r*2-c,b),p.lineTo(u-r-c,b+r)):(p.lineTo(l-r,b),p.lineTo(l,b+r),p.lineTo(l+r,b)):m||(n==="left"?(p.moveTo(g,x),p.lineTo(g+c+r,b+r),p.lineTo(g+c+r*2,b)):n==="right"?(p.moveTo(u,x),p.lineTo(u-r*2-c,b),p.lineTo(u-r-c,b+r)):(p.lineTo(l-r,b),p.lineTo(l,b+r),p.lineTo(l+r,b))),p.closePath(),p.fill()),p.restore(),p.save(),p.font=f,p.fillStyle=h.tipTextColor??h.tipStyle.textColor,p.textBaseline="middle",p.textAlign="center",p.fillText(`${d}`,g+o/2,x+s/2),p.restore()},showTip(e){const t=!!this.options.horizontal,{x:n,y:o,opt:s,isSamePos:l}=e,a=e.context,c=o-(l?24:0);a.save(),a.fillStyle=s.tipBackground??s.tipStyle.background,a.beginPath(),a.moveTo(n,c),t?(a.lineTo(n+6,c-6),a.lineTo(n+6,c+6)):(a.lineTo(n+6,c-6),a.lineTo(n-6,c-6)),a.lineTo(n,c),a.closePath(),a.fill(),a.restore()}};let Pr=class{constructor(t,n,o,s,l,a,r){Object.keys(Lr).forEach(c=>Object.assign(this,Lr[c])),o.brush||(Object.assign(this,XC),Object.assign(this,WC),Object.assign(this,YC),Object.assign(this,_C),Object.assign(this,UC),Object.assign(this,LC),Object.assign(this,AC)),o.type==="heatMap"&&o.legend.type==="gradient"&&Object.assign(this,PC),this.isMobile=Sh(),this.brushSeries=r,this.target=t,this.data=n,this.options=o,this.listeners=s,this.wrapperDOM=document.createElement("div"),this.wrapperDOM.className=o.brush?"ev-chart-brush-wrapper":"ev-chart-wrapper",this.chartDOM=document.createElement("div"),this.chartDOM.className=o.brush?"ev-chart-brush-container":"ev-chart-container",this.wrapperDOM.appendChild(this.chartDOM),this.target.appendChild(this.wrapperDOM),this.displayCanvas=document.createElement("canvas"),this.displayCanvas.setAttribute("style","display: block;"),this.displayCtx=this.displayCanvas.getContext("2d"),this.bufferCanvas=document.createElement("canvas"),this.bufferCanvas.setAttribute("style","display: block;"),this.bufferCtx=this.bufferCanvas.getContext("2d"),this.pixelRatio=window.devicePixelRatio||1,this.oldPixelRatio=this.pixelRatio,this.chartDOM.appendChild(this.displayCanvas),o.brush||(this.overlayCanvas=document.createElement("canvas"),this.overlayCanvas.setAttribute("style","display: block; z-index: 2;"),this.overlayCanvas.setAttribute("class","overlay-canvas"),this.overlayCtx=this.overlayCanvas.getContext("2d"),this.chartDOM.appendChild(this.overlayCanvas),this.overlayCanvas.style.position="absolute",this.overlayCanvas.style.top="0px",this.overlayCanvas.style.left="0px"),this.isInitLegend=!1,this.isInitTitle=!1,this.isInit=!1,this.scrollbar={x:{isInit:!1},y:{isInit:!1}},this.seriesList={},this.lastTip={pos:null,value:null},this.seriesInfo={charts:{pie:[],bar:[],line:[],scatter:[],heatMap:[]},count:0},this.defaultSelectItemInfo=l,this.defaultSelectInfo=a,this.legendHover=null}init(){var f;const{series:t,data:n,labels:o,groups:s}=this.data,{type:l,axesX:a,axesY:r,tooltip:c,horizontal:d,realTimeScatter:h}=this.options;this.createSeriesSet(t,l,d,s),s.length&&this.addGroupInfo(s),h!=null&&h.use?(this.dataSet={},this.createRealTimeScatterDataSet(n)):this.createDataSet(n,o),this.minMax=this.getStoreMinMax(),this.initRect(),this.axesX=this.createAxes("x",a),this.axesY=this.createAxes("y",r),this.initDefaultSelectInfo(),this.drawChart(),c.use&&!this.isInitTooltip&&this.createTooltipDOM(),(f=this.createEventFunctions)==null||f.call(this),this.isInit=!0}initRect(){var n,o,s,l,a,r;const t=this.options;t.title.show&&(this.isInitTitle||this.initTitle(),this.showTitle()),t.legend.show&&(this.isInitLegend||this.initLegend(),this.setLegendPosition()),((s=(o=(n=t.axesX)==null?void 0:n[0])==null?void 0:o.scrollbar)!=null&&s.use||(r=(a=(l=t.axesY)==null?void 0:l[0])==null?void 0:a.scrollbar)!=null&&r.use)&&this.initScrollbar(),this.chartRect=this.getChartRect()}drawSyncedIndicator({horizontal:t,label:n,mousePosition:o}){this.drawSyncedIndicator({horizontal:t,label:n,mousePosition:o})}adjustXAndYAxisWidth(){var o,s,l,a;const t=(r,c,d)=>{const{interval:h,graphMin:f,graphMax:m,steps:p=0,minIndex:g,maxIndex:u,indexInterval:x}=r??{};let b=[];if((d==null?void 0:d.type)==="step"&&g!==void 0&&u!==void 0&&x!==void 0){const{labels:y}=this.data,w=c==="x"?(y==null?void 0:y.x)??y??[]:(y==null?void 0:y.y)??y??[];b=[];for(let I=g;I<=u;I+=x)w[I]!==void 0&&b.push(w[I])}else if(h)b=Array.from({length:p},(y,w)=>f+w*h),b.push(m);else{const{labels:y}=this.data;b=c==="x"?(y==null?void 0:y.x)??y??[]:(y==null?void 0:y.y)??y??[]}return b},n={x:(s=(o=this.axesRange)==null?void 0:o.x)==null?void 0:s.map((r,c)=>{var g,u,x;const d=this.axesX[c],h=(g=this.axesSteps)==null?void 0:g.x[c],f=t(h,"x",d),m=ve((u=d==null?void 0:d.labelStyle)==null?void 0:u.fixWidth)?d.labelStyle.fixWidth:0,p=((x=d==null?void 0:d.getLabelWidthHasMaxLength)==null?void 0:x.call(d,f,this.chartRect))??0;return{...r,size:{width:m||Math.max(p,r.size.width),height:r.size.height}}}),y:(a=(l=this.axesRange)==null?void 0:l.y)==null?void 0:a.map((r,c)=>{var g,u,x;const d=this.axesY[c],h=(g=this.axesSteps)==null?void 0:g.y[c],f=t(h,"y",d),m=ve((u=d==null?void 0:d.labelStyle)==null?void 0:u.fixWidth)?d.labelStyle.fixWidth:0,p=((x=d==null?void 0:d.getLabelWidthHasMaxLength)==null?void 0:x.call(d,f,this.chartRect))??0;return{...r,size:{width:m||Math.max(p,r.size.width),height:r.size.height}}})};this.axesRange=n,this.labelOffset=this.getLabelOffset(n),this.labelRange=this.getAxesLabelRange(),this.axesSteps=this.calculateSteps()}drawChart(t){var n,o,s,l,a,r;this.initScale(),this.axesRange=this.getAxesRange(),this.labelOffset=this.getLabelOffset(),this.labelRange=this.getAxesLabelRange(),this.axesSteps=this.calculateSteps(),this.adjustXAndYAxisWidth(),this.drawAxis(t),this.drawSeries(t),((o=(n=this.scrollbar)==null?void 0:n.x)!=null&&o.use||(l=(s=this.scrollbar)==null?void 0:s.y)!=null&&l.use)&&(this.initScrollbar(),this.updateScrollbarPosition()),this.drawTip(),this.bufferCanvas&&((a=this.bufferCanvas)==null?void 0:a.width)>1&&((r=this.bufferCanvas)==null?void 0:r.height)>1&&this.displayCtx.drawImage(this.bufferCanvas,0,0)}collectDuplicatePoints(t,n){var s,l,a;const o=!!this.options.seriesReverse;for(let r=o?n.length-1:0;o?r>=0:r<n.length;o?r--:r++){const c=this.seriesList[n[r]];if(!!(c!=null&&c.show))if((s=this.options.realTimeScatter)!=null&&s.use){const h=(l=c.data[c.sId])==null?void 0:l.dataGroup;for(let f=0;f<h.length;f++){const m=((a=h[f])==null?void 0:a.data)||[];for(let p=0;p<m.length;p++){const g=m[p];t.set(`${g.x}${g.y}`,c.sId)}}}else{const h=this.data.data[n[r]]??[];for(let f=0;f<h.length;f++){const m=h[f];t.set(`${m.x}${m.y}`,c.sId)}}}}drawSeries(t){var g;const{maxTip:n,selectLabel:o,selectItem:s,selectSeries:l,brush:a,displayOverflow:r,unSelectedOpacity:c}=this.options,d={ctx:this.bufferCtx,chartRect:this.chartRect,labelOffset:this.labelOffset,axesSteps:this.axesSteps,maxTipOpt:{background:n.background,color:n.color},selectLabel:{option:o,selected:this.defaultSelectInfo},selectSeries:{option:l,selected:this.defaultSelectInfo},selectItem:{option:s,selected:this.defaultSelectItemInfo},overlayCtx:this.overlayCtx,isBrush:!!a,displayOverflow:r,unSelectedOpacity:c};let h=0,f=0;this.seriesInfo.charts.bar.forEach(u=>{this.seriesList[u].show&&f++});const m=new Map,p=Object.keys(this.seriesInfo.charts);for(let u=0;u<p.length;u++){const x=p[u],b=this.seriesInfo.charts[x];x==="scatter"&&this.options.coordinateDedupe&&this.collectDuplicatePoints(m,b);for(let y=0;y<b.length;y++){let w=this.seriesList[b[y]];switch(x){case"line":{const I=t==null?void 0:t.legend;w.draw({legendHitInfo:I,...d});break}case"heatMap":{const I=t==null?void 0:t.legend;w.draw({legendHitInfo:I,...d});break}case"bar":{const I=t==null?void 0:t.legend,{thickness:E,cPadRatio:B,borderRadius:_}=this.options;w.draw({thickness:E,cPadRatio:B,borderRadius:_,showSeriesCount:f,showIndex:h,legendHitInfo:I,...d}),w.show&&h++;break}case"pie":{const I=this.lastHitInfo??{sId:(g=this.defaultSelectItemInfo)==null?void 0:g.seriesID},E=t==null?void 0:t.legend;this.options.sunburst?this.drawSunburst({selectInfo:I,legendHitInfo:E,unSelectedOpacity:d.unSelectedOpacity}):this.drawPie({selectInfo:I,legendHitInfo:E,unSelectedOpacity:d.unSelectedOpacity}),this.options.doughnutHoleSize>0&&this.drawDoughnutHole();break}case"scatter":{const I=t==null?void 0:t.legend;let E;if(s.use&&s.useSeriesOpacity){const B=this.lastHitInfo,_=this.defaultSelectItemInfo;B!=null&&B.maxIndex||(B==null?void 0:B.maxIndex)===0?E={seriesID:B.sId,dataIndex:B.maxIndex}:_!=null&&_.dataIndex||(_==null?void 0:_.dataIndex)===0?E={..._}:E=null}this.options.seriesReverse&&(w=this.seriesList[b.at(-1-y)]),w.draw({legendHitInfo:I,selectInfo:E,duple:m,coordinateDedupe:this.options.coordinateDedupe,...d});break}}}}}drawTip(){var n;let t;this.lastHitInfo?t=this.lastHitInfo:this.defaultSelectItemInfo?t=this.getItem(this.defaultSelectItemInfo,!1):this.defaultSelectInfo&&this.options.selectLabel.use?t=this.getItem(this.defaultSelectInfo,!1):t=null,(n=this.drawTips)==null||n.call(this,t)}createAxes(t,n=[]){const o=this.bufferCtx,l=this.options.type==="heatMap"?this.data.labels[t]:this.data.labels,a=this.options;return n.map(r=>{switch(r.type){case"linear":return new DC(t,r,o,a);case"time":return r.categoryMode?new NC(t,r,o,l,a):new BC(t,r,o,a);case"log":return new OC(t,r,o);case"step":return new RC(t,r,o,l,a);default:return!1}})}getAxesRange(){const t=this.axesX.map((o,s)=>o.calculateScaleRange(this.minMax.x[s],this.scrollbar.x,this.chartRect)),n=this.axesY.map((o,s)=>o.calculateScaleRange(this.minMax.y[s],this.scrollbar.y,this.chartRect));return{x:t,y:n}}drawAxis(t){this.axesX.forEach((n,o)=>{n.draw(this.chartRect,this.labelOffset,this.axesSteps.x[o],t,this.defaultSelectInfo,this.data.labels)}),this.axesY.forEach((n,o)=>{n.draw(this.chartRect,this.labelOffset,this.axesSteps.y[o],t,this.defaultSelectInfo)})}calculateSteps(){const t=this.axesX.map((o,s)=>{const l={minValue:this.axesRange.x[s].min,maxValue:this.axesRange.x[s].max,minIndex:this.axesRange.x[s].minIndex,maxIndex:this.axesRange.x[s].maxIndex,minSteps:this.labelRange.x[s].min,maxSteps:this.labelRange.x[s].max};return o.calculateSteps(l)}),n=this.axesY.map((o,s)=>{const l={minValue:this.axesRange.y[s].min,maxValue:this.axesRange.y[s].max,minIndex:this.axesRange.y[s].minIndex,maxIndex:this.axesRange.y[s].maxIndex,minSteps:this.labelRange.y[s].min,maxSteps:this.labelRange.y[s].max};return o.calculateSteps(l)});return{x:t,y:n}}getAxesLabelRange(){const t=this.axesX.map((o,s)=>{const l=this.axesRange.x[s].size;return o.calculateLabelRange("x",this.chartRect,this.labelOffset,l.width)}),n=this.axesY.map((o,s)=>{const l=this.axesRange.y[s].size;return o.calculateLabelRange("y",this.chartRect,this.labelOffset,l.height)});return{x:t,y:n}}initScale(){const t=window.devicePixelRatio||1,n=this.displayCtx.webkitBackingStorePixelRatio||this.displayCtx.mozBackingStorePixelRatio||this.displayCtx.msBackingStorePixelRatio||this.displayCtx.oBackingStorePixelRatio||this.displayCtx.backingStorePixelRatio||1;this.pixelRatio=t/n,this.oldPixelRatio!==this.pixelRatio&&(this.oldPixelRatio=this.pixelRatio),this.bufferCtx.scale(this.pixelRatio,this.pixelRatio),this.overlayCtx&&this.overlayCtx.scale(this.pixelRatio,this.pixelRatio)}getChartDOMRect(){var s;const t=(s=this.chartDOM)==null?void 0:s.getBoundingClientRect(),n=(t==null?void 0:t.width)||10,o=(t==null?void 0:t.height)||10;return this.setWidth(n),this.setHeight(o),{width:n,height:o}}getChartRect(){var E,B,_,C;const{width:t,height:n}=this.getChartDOMRect(),o=this.options.padding,s=(B=(E=this.options.axesX)==null?void 0:E[0])==null?void 0:B.title,l=(C=(_=this.options.axesY)==null?void 0:_[0])==null?void 0:C.title,a=10;let r=0;s!=null&&s.use&&(s!=null&&s.text)&&(r=(isNaN(s==null?void 0:s.fontSize)?12:s==null?void 0:s.fontSize)+a);let c=0;l!=null&&l.use&&(l!=null&&l.text)&&(c=(isNaN(l==null?void 0:l.fontSize)?12:l==null?void 0:l.fontSize)+a);const d=this.scrollbar.x,h=this.scrollbar.y;let f=0;d!=null&&d.use&&(f=d==null?void 0:d.height);let m=0;h!=null&&h.use&&(m=h==null?void 0:h.width);const p=o.left+o.right+m,g=o.top+o.bottom+r+c+f,u=t>p?t-p:t,x=n>g?n-g:n,b=o.left,y=Math.max(t-o.right-m,b+2),w=o.top+c,I=Math.max(n-o.bottom-r-f,w+2);return{x1:b,x2:y,y1:w,y2:I,chartWidth:u,chartHeight:x,width:t,height:n}}setWidth(t){this.displayCanvas&&(this.displayCanvas.width=t*this.pixelRatio,this.displayCanvas.style.width=`${t}px`,this.bufferCanvas.width=t*this.pixelRatio,this.bufferCanvas.style.width=`${t}px`,this.overlayCanvas&&(this.overlayCanvas.width=t*this.pixelRatio,this.overlayCanvas.style.width=`${t}px`))}setHeight(t){this.displayCanvas&&(this.displayCanvas.height=t*this.pixelRatio,this.displayCanvas.style.height=`${t}px`,this.bufferCanvas.height=t*this.pixelRatio,this.bufferCanvas.style.height=`${t}px`,this.overlayCanvas&&(this.overlayCanvas.height=t*this.pixelRatio,this.overlayCanvas.style.height=`${t}px`))}getLabelOffset(t=null){const n=this.axesX,o=this.axesY,s=t??this.axesRange,l={top:2,left:2,right:2,bottom:2},a={width:14,height:4};let r=0,c=0;return n.forEach((d,h)=>{var f;(f=d.labelStyle)!=null&&f.show&&(r=s.x[h].size.width+a.width,c=s.x[h].size.height+a.height,d.position==="bottom"?c>l.bottom&&(l.bottom=c):d.position==="top"&&c>l.top&&(l.top=c),l.left=r/2>l.left?r/2:l.left,l.right=r/2>l.right?r/2:l.right)}),o.forEach((d,h)=>{var f;(f=d.labelStyle)!=null&&f.show&&(r=s.y[h].size.width+a.width,d.position==="left"?r>l.left&&(l.left=r):d.position==="right"&&r>l.right&&(l.right=r),l.top=c/2>l.top?c/2:l.top,l.bottom=c/2>l.bottom?c/2:l.bottom)}),l}update(t){var x,b,y,w,I,E,B;const n=this.options,o=this.data.data,s=this.data.labels,l=this.data.groups,a=this.data.series,{updateSeries:r,updateSelTip:c,updateLegend:d,updateData:h,updateTooltip:f,updateByScrollbar:m,lightUpdate:p}=t;if(!this.isInit)return;if(m&&((x=this.updateScrollbar)==null||x.call(this,h)),this.resetProps(),this.updateSeries=r,r&&(this.seriesInfo=null,this.seriesList=null,this.lastTip=null,this.seriesInfo={charts:{pie:[],bar:[],line:[],scatter:[],heatMap:[]},count:0},this.seriesList={},this.lastTip={pos:null,value:null},this.createSeriesSet(a,n.type,n.horizontal,l),this.legendDOM&&this.updateLegend()),c.update&&(this.lastTip.value=null,c.keepDomain||(this.lastTip.pos=null,this.lastHitInfo=null)),!p)if(l.length&&this.addGroupInfo(l),(b=this.options.realTimeScatter)!=null&&b.use?(this.dataSet||(this.dataSet={}),this.createRealTimeScatterDataSet(o)):this.createDataSet(o,s),n.title.show?(this.isInitTitle?this.updateTitle():this.initTitle(),this.showTitle()):this.isInitTitle&&this.hideTitle(),n.legend.show){const _=!!((w=(y=n.legend)==null?void 0:y.table)!=null&&w.use)&&n.type!=="heatMap"&&n.type!=="scatter";this.isInitLegend?r?this.updateLegend():d?this.forceUpdateLegend():_&&h&&this.updateLegendTableValues():this.initLegend(),this.setLegendPosition(),this.updateLegendContainerSize(),this.showLegend()}else this.isInitLegend&&this.hideLegend();f&&(this.isInitTooltip||this.createTooltipDOM(),this.tooltipDOM.innerHTML="",(E=(I=n.tooltip)==null?void 0:I.formatter)!=null&&E.html||this.setDefaultTooltipLayout()),this.minMax=this.getStoreMinMax(),this.axesX=this.createAxes("x",n.axesX),this.axesY=this.createAxes("y",n.axesY),this.initDefaultSelectInfo();let g=t==null?void 0:t.hitInfo;!(g!=null&&g.legend)&&((B=this.legendHover)!=null&&B.sId)&&(g={...g||{},legend:this.legendHover}),this.render(g),this.dragInfo&&this.drawSelectionArea?this.drawSelectionArea(this.dragInfo):this.dragInfoBackup&&(this.dragInfoBackup=null)}resetProps(){this.axesX[0]=null,this.axesY[0]=null,this.axesX=null,this.axesY=null,this.minMax=null,this.axesRange=null,this.labelOffset=null,this.chartRect=null}overlayClear(){this.clearRectRatio=this.pixelRatio<1?this.pixelRatio:1,this.overlayCtx.clearRect(0,0,this.overlayCanvas.width/this.clearRectRatio,this.overlayCanvas.height/this.clearRectRatio)}clear(){this.clearRectRatio=this.pixelRatio<1?this.pixelRatio:1,this.displayCanvas&&this.displayCtx.clearRect(0,0,this.displayCanvas.width/this.clearRectRatio,this.displayCanvas.height/this.clearRectRatio),this.bufferCanvas&&this.bufferCtx.clearRect(0,0,this.bufferCanvas.width/this.clearRectRatio,this.bufferCanvas.height/this.clearRectRatio),this.overlayCanvas&&this.overlayCtx.clearRect(0,0,this.overlayCanvas.width/this.clearRectRatio,this.overlayCanvas.height/this.clearRectRatio)}resize(t){var n,o,s;(n=this.scrollbar)!=null&&n.x&&delete this.scrollbar.x.savedPosition,(o=this.scrollbar)!=null&&o.y&&delete this.scrollbar.y.savedPosition,this.clear(),this.bufferCtx.restore(),this.bufferCtx.save(),this.initRect(),this.initScale(),this.chartRect=this.getChartRect(),this.drawChart(),this.dragInfoBackup&&((s=this.drawSelectionArea)==null||s.call(this,this.dragInfoBackup)),t&&t(!0)}render(t){this.isInit&&(this.clear(),this.chartRect=this.getChartRect(),this.drawChart(t))}destroy(){if(!this.isInit)return;const t=this.target;for(this.options.legend.show&&(this.legendBoxDOM&&(this.legendBoxDOM.removeEventListener("click",this.onLegendBoxClick),this.legendBoxDOM.removeEventListener("mouseover",this.onLegendBoxOver),this.legendBoxDOM.removeEventListener("mouseleave",this.onLegendBoxLeave),this.options.legend.type==="gradient"&&this.legendBoxDOM.removeEventListener("mousedown",this.onLegendMouseDown),this.options.legend.virtualScroll&&!this.useTable&&(this.legendBoxDOM.removeEventListener("resize",this.updateVisibleRowCount),this.legendBoxDOM.removeEventListener("scroll",this.renderVisibleLegends))),this.resizeDOM&&this.resizeDOM.removeEventListener("mousedown",this.onResizeMouseDown)),this.overlayCanvas&&(this.overlayCanvas.removeEventListener("mousemove",this.onMouseMove),this.overlayCanvas.removeEventListener("mouseleave",this.onMouseLeave),this.overlayCanvas.removeEventListener("dblclick",this.onDblClick),this.overlayCanvas.removeEventListener("click",this.onClick),this.overlayCanvas.removeEventListener("mousedown",this.onMouseDown),this.overlayCanvas.removeEventListener("wheel",this.onWheel),window.removeEventListener("click",this.dragTouchSelectionEvent)),this.isInitTooltip&&this.tooltipDestroy(),this.renderVisibleLegendsFrameId!=null&&(cancelAnimationFrame(this.renderVisibleLegendsFrameId),this.renderVisibleLegendsFrameId=null),this.updateVisibleRowCountFrameId!=null&&(cancelAnimationFrame(this.updateVisibleRowCountFrameId),this.updateVisibleRowCountFrameId=null),this.wrapperDOM=null,this.chartDOM=null,this.legendDOM=null,this.legendBoxDOM=null,this.resizeDOM=null,this.ghostDOM=null,this.titleDOM=null,this.displayCanvas=null,this.bufferCanvas=null,this.overlayCanvas=null;t.hasChildNodes();)t.removeChild(t.firstChild)}hideTooltip(){var t;this.options.tooltip.use&&((t=this.tooltipDOM)!=null&&t.style)&&(this.tooltipDOM.style.display="none")}initDefaultSelectInfo(){var s,l;const{type:t,selectLabel:n,selectSeries:o}=this.options;if(n.use){let a=null;t==="heatMap"&&(n!=null&&n.useBothAxis)&&(a=(s=this.defaultSelectInfo)==null?void 0:s.targetAxis),this.defaultSelectInfo=(l=this.defaultSelectInfo)!=null&&l.dataIndex?this.getSelectedLabelInfoWithLabelData(this.defaultSelectInfo.dataIndex,a):{dataIndex:[],label:[],data:[]}}o.use&&!this.defaultSelectInfo&&(this.defaultSelectInfo={seriesId:[]})}};const jC={name:"EvChartToolbar",props:{toolbar:{type:Object,default:()=>({})}},emits:["onClickToolbar"]},GC={class:"ev-chart-toolbar"},ZC={class:"ev-chart-toolbar__icon"};function qC(e,t,n,o,s,l){const a=i.resolveComponent("ev-icon");return i.openBlock(),i.createElementBlock("div",GC,[i.createElementVNode("div",ZC,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.$props.toolbar.items,(r,c)=>(i.openBlock(),i.createBlock(a,{key:`${c}-${r.icon}`,class:i.normalizeClass(c),icon:r.icon,size:r.size,title:r.title,onClick:d=>e.$emit("onClickToolbar",d,c)},null,8,["class","icon","size","title","onClick"]))),128))])])}const Ar=le(jC,[["render",qC],["__scopeId","data-v-dfbffbab"]]);class KC{constructor(t,n,o,s,l,a,r){this.isExecuteZoom=l,this.evChartProps=t.props,this.evChartCloneData=n.data,this.brushIdx=a;const c=o.zoom;this.setEvChartZoomOptions(c),this.setIcon(s);const d=n.data[0].labels.length-1;this.cloneLabelsLastIdx=d,this.isAnimationFinish=!0,this.zoomAreaMemory={previous:[],current:[[0,d]],latest:[]},r&&(this.emitFunc=r,r.updateZoomStartIdx(0),r.updateZoomEndIdx(d)),c.useWheelMove&&(this.wrapWheelMoveZoomArea=this.wheelMoveZoomArea.bind(this)),this.evChartDomContainers=c.useAnimation?this.drawAnimationCanvas(t.dom):t.dom}setEvChartZoomOptions(t){this.evChartZoomOptions=t}setIcon(t){if(!t)return;const n=t.querySelector(".dragZoom");this.resetIcon=t.querySelector(".reset"),this.previousIcon=t.querySelector(".previous"),this.latestIcon=t.querySelector(".latest"),this.dragZoomIcon=n,this.iconStyle(n,"enable")}drawAnimationCanvas(t){return t.forEach(n=>{const o=document.createElement("canvas");o.setAttribute("style","display: block;"),o.setAttribute("class","animation-canvas"),o.style.position="absolute",n.appendChild(o)}),t}setEventListener(t){const n=t?"addEventListener":"removeEventListener";this.isUseZoomMode=t,this.evChartDomContainers.forEach(o=>{o[n]("wheel",this.wrapWheelMoveZoomArea)})}wheelMoveZoomArea(t){t.preventDefault();const[n,o]=this.zoomAreaMemory.current[0];if(n===o)return;let s,l;if(t.deltaY>0){if(!n)return;s=n-1,l=o-1}else{if(o===this.cloneLabelsLastIdx)return;s=n+1,l=o+1}this.isUseToolbar=!0,this.executeZoom(s,l),this.zoomAreaMemory.current[0]=[s,l]}clickMoveZoomArea(t){if(!this.zoomAreaMemory[t].length)return;const[n,o]=this.zoomAreaMemory[t].pop();this.isUseToolbar=!0,this.executeZoom(n,o),this.setZoomAreaMemory(n,o,t==="previous"?"latest":"previous")}dragZoom({data:t,range:{dragSelectionInfo:n}}){const{dragXsp:o,dragXep:s,exceptAxesYChartWidth:l,chartTitle:a}=n,{options:r,data:c}=this.evChartProps,d=r.length>1?r.findIndex(h=>{var f;return(((f=h==null?void 0:h.title)==null?void 0:f.text)??"")===a}):0;if(r[d].axesX[0].type==="time"){const h=t[0].items,f=h[0].x,m=h[h.length-1].x,p=c[d].labels,g=this.evChartCloneData[d].labels,[u,x]=this.zoomAreaMemory.current[0];let b=g.findIndex(B=>+B.$d==+f.$d),y=g.findLastIndex(B=>+B.$d==+m.$d);const w=B=>l/(p.length-1)*(B-u);let I=w(b);if(b===y&&(I-o>=s-I?b-=1:y+=1),b===u&&y===x)return;b-y===-1&&(I=w(b));const E=w(y);this.evChartZoomOptions.useAnimation?this.dragZoomAnimation(n,b,y,I,E):(this.executeZoom(b,y),this.setZoomAreaMemory(b,y))}}dragZoomAnimation(t,n,o,s,l){const{chartRange:a,exceptAxesYChartWidth:r,exceptAxesXChartHeight:c}=t,d=window.devicePixelRatio||1,h=Array.from(this.evChartDomContainers).map(f=>{const m=f.querySelector(".animation-canvas");return[f.children[0],m]});for(let f=0;f<h.length;f++){const[m,p]=h[f],g=p.getContext("2d");p.style.top=`${a.y1}px`,p.style.left=`${a.x1}px`,p.width=r*d,p.style.width=`${r}px`,p.height=c*d,p.style.height=`${c}px`,p.style.display==="none"&&(p.style.display="block"),this.isAnimationFinish=!1,this.isUseToolbar=!0,this.executeDragZoomAnimation(m,g,t,s,l).then(u=>{p.style.display="none",u&&f===h.length-1&&(this.isAnimationFinish=u,this.executeZoom(n,o),this.setZoomAreaMemory(n,o))})}}executeZoom(t,n){this.isExecuteZoom&&(this.isExecuteZoom.value=!0);for(let o=0;o<this.evChartCloneData.length;o++){const{data:s,labels:l,series:a}=this.evChartCloneData[o],r=this.evChartProps.data[o],c=Object.keys(a);for(let d=0;d<c.length;d++){const h=c[d];r.data[h]=s[h].filter((f,m)=>t<=m&&n>=m)}r.labels=l.filter((d,h)=>t<=h&&n>=h)}!this.brushIdx.isUseButton&&!this.brushIdx.isUseScroll&&(this.brushIdx.start=t,this.brushIdx.end=n),this.emitFunc&&(this.emitFunc.updateZoomStartIdx(t),this.emitFunc.updateZoomEndIdx(n))}setBrushIdx(t,n){this.brushIdx.end=-1;for(let o=0;o<n.value.length;o++){const s=t.data[n.value[o]];s.labels.length&&(this.brushIdx.start=0,this.brushIdx.end=s.labels.length-1)}}updateEvChartCloneData(t,n,o,s){const l=t.data[0].labels.length-1;if(this.cloneLabelsLastIdx=l,this.evChartCloneData=t.data,s){const a=this.zoomAreaMemory.current[0];let r=a[0],c=a[1];r===0&&c===-1&&(r=0,c=l,this.zoomAreaMemory={previous:[],current:[[r,c]],latest:[]}),this.emitFunc&&(this.emitFunc.updateZoomStartIdx(r),this.emitFunc.updateZoomEndIdx(c)),this.executeZoom(r,c)}else this.dragZoomIcon&&this.dragZoomIcon.classList.remove("active"),this.zoomAreaMemory={previous:[],current:[[0,l]],latest:[]},this.emitFunc&&(this.emitFunc.updateZoomStartIdx(0),this.emitFunc.updateZoomEndIdx(l)),this.setIconStyle(o),this.setBrushIdx(t,n)}setZoomAreaMemory(t,n,o){if(t<0||n<=0)return;const{previous:s,current:l,latest:a}=this.zoomAreaMemory,r=l.pop(),{bufferMemoryCnt:c}=this.evChartZoomOptions;o?(s.length>=c&&s.splice(0,s.length-c+1),this.zoomAreaMemory[o].push(r)):(t!==r[0]||n!==r[1])&&(r[0]===0&&r[1]===-1?s.push([0,this.cloneLabelsLastIdx]):s.push(r),a.length=0),l.push([t,n]),this.setIconStyle(this.isUseZoomMode)}executeDragZoomAnimation(t,n,o,s,l){const{chartRange:a,exceptAxesYChartWidth:r,exceptAxesXChartHeight:c}=o;let d=0,h=s,f=l-s,m=l,p=1;const g=.0015;let u=.5;const x=.1,b=.05,y=50,w=Math.ceil(y*(s/r)),I=Math.ceil(y*((r-l)/r)),E=B=>(n.clearRect(0,0,r,c),h<=0&&f>=r?(t.style.opacity="initial",B(!0)):(u>=x&&(t.style.opacity=u,u-=b),n.globalAlpha=p,n.drawImage(t,a.x1,a.y1,s,c,d,0,s,c),n.drawImage(t,a.x1+s,a.y1,l-s,c,h,0,f,c),n.drawImage(t,a.x1+l,a.y1,r,c,m,0,r,c),p-=g,d-=w,h-=w,f+=w+I,m+=I,requestAnimationFrame(()=>E(B))));return new Promise(B=>E(B))}setIconStyle(t){const n=(o,s)=>{s?this.iconStyle(o,"enable"):this.iconStyle(o,"disable")};if(t&&this.dragZoomIcon.classList.contains("active")){const{previous:o,latest:s}=this.zoomAreaMemory;n(this.previousIcon,o.length),n(this.latestIcon,s.length),this.iconStyle(this.resetIcon,"enable")}else n(this.resetIcon),n(this.previousIcon),n(this.latestIcon)}iconStyle(t,n){if(!t)return;const[o,s]=n==="enable"?[1,"initial"]:[.5,"none"];t.style.opacity=o,t.style.pointerEvents=s}initZoom(){if(!this.isAnimationFinish)return;const[t,n]=this.zoomAreaMemory.current[0],o=this.cloneLabelsLastIdx;(t!==0||n!==o)&&(this.isUseToolbar=!0,this.executeZoom(0,o),this.setZoomAreaMemory(0,o))}}const JC={padding:{top:20,right:2,left:2,bottom:4},border:2,title:{show:!1,height:40,text:"",style:{fontSize:15,color:"#000",fontFamily:"Roboto"}},legend:{show:!0,type:"icon",position:"right",color:"#353740",inactive:"#aaa",width:140,height:24,allowResize:!1,virtualScroll:!1,clickMode:"active",table:{use:!1,columns:{name:{title:"Name"},min:{title:"MIN",use:!1},max:{title:"MAX",use:!1},avg:{title:"AVG",use:!1},total:{title:"TOTAL",use:!1},last:{title:"LAST",use:!1}}}},itemHighlight:!0,seriesHighlight:!0,unSelectedOpacity:.3,useSelect:!1,doughnutHoleSize:0,pieStroke:{use:!0,lineWidth:2,color:"#FFFFFF"},reverse:!1,horizontal:!1,overlapping:{use:!1},width:"100%",height:"100%",thickness:1,cPadRatio:0,borderRadius:0,combo:!1,tooltip:{use:!0,sortByValue:!0,backgroundColor:"#4C4C4C",fontColor:"#FFFFFF",borderColor:"#666666",shadowOpacity:.25,useShadow:!1,throttledMove:!1,debouncedHide:!1,useScrollbar:!1,textOverflow:"wrap",fontFamily:"Roboto",colorShape:"rect",fontSize:{title:16,contents:14},rowPadding:{top:0,bottom:3,right:20,left:16},showHeader:!0},indicator:{use:!0,color:"#EE7F44",segments:null},maxTip:{use:!1,fixedPosTop:!1,showIndicator:!1,indicatorColor:"#000000",tipStyle:{height:20,background:"#000000",textColor:"#FFFFFF",fontSize:14,fontFamily:"Roboto",fontWeight:400}},selectItem:{use:!1,useClick:!0,showTextTip:!1,tipText:"value",showTip:!1,showIndicator:!1,fixedPosTop:!1,useApproximateValue:!1,indicatorColor:"#000000",tipStyle:{height:20,background:"#000000",textColor:"#FFFFFF",fontSize:14,fontFamily:"Roboto",fontWeight:400},useSeriesOpacity:!1,useDeselectItem:!1,showBorder:!1,borderStyle:{color:"#FFFFFF",lineWidth:1,opacity:1,radius:0}},selectLabel:{use:!1,useClick:!0,tipText:"value",limit:1,useDeselectOverflow:!1,showTip:!1,useSeriesOpacity:!0,useLabelOpacity:!0,fixedPosTop:!1,useApproximateValue:!1,tipBackground:"#000000",indicatorColor:"#000000",tipStyle:{height:20,background:"#000000",textColor:"#FFFFFF",fontSize:14,fontFamily:"Roboto",fontWeight:400},showTextTip:!1,showIndicator:!1,useBothAxis:!1},selectSeries:{use:!1,useClick:!0,limit:1,useDeselectOverflow:!1},dragSelection:{use:!1,keepDisplay:!0,size:50,fillColor:"#38ACEC",opacity:.65},zoom:{bufferMemoryCnt:100,keepZoomStatus:!1,useAnimation:!0,useWheelMove:!0,toolbar:{show:!1,items:{previous:{icon:"ev-icon-allow2-left",size:"medium",title:"Previous"},latest:{icon:"ev-icon-allow2-right",size:"medium",title:"Latest"},reset:{icon:"ev-icon-redo",size:"medium",title:"Reset"},dragZoom:{icon:"ev-icon-zoomin",size:"medium",title:"Drag Zoom"}}}},heatMapColor:{min:"#FFFFFF",max:"#0052FF",rangeCount:1,colorsByRange:[],stroke:{show:!1,color:"#FFFFFF",lineWidth:1,opacity:1,radius:0},error:"#FF0000",decimalPoint:0},seriesReverse:!1,coordinateDedupe:!0,eventBehavior:{legendClick:"update"}},QC={series:{},groups:[],labels:[],data:{}},eS=()=>{let e=null,t=0;const n=200;return{clickEventCallback:l=>{t++,t===1&&(e=setTimeout(()=>{t===1&&l(),t=0},n))},dblClickEventCallback:l=>{e&&(clearTimeout(e),e=null),l(),t=0}}},zr=(e,t)=>{const{props:n,emit:o}=i.getCurrentInstance(),s=m=>{const p=Fe({},m,JC);return(m.type==="scatter"||m.type==="heatMap")&&!(m!=null&&m.tooltip)&&(p.tooltip.use=!1),m.type==="pie"&&!(m!=null&&m.padding)&&(p.padding={top:2,right:2,left:2,bottom:4}),p},l=m=>Fe(m,QC),a=Se(n.selectedItem),r=Se(n.selectedLabel??(e==null?void 0:e.value)),c=Se(n.selectedSeries),{clickEventCallback:d,dblClickEventCallback:h}=eS();return{eventListeners:{click:async m=>{await i.nextTick(),d(()=>{const{seriesId:p,dataIndex:g,eventTarget:u,targetAxis:x}=(m==null?void 0:m.selected)??{},{eventTarget:b}=(m==null?void 0:m.deselected)??{};switch(u){case"item":{p!==null?(o("update:selectedItem",{seriesID:p,dataIndex:g}),b==="label"&&o("update:selectedLabel",{dataIndex:[]})):o("update:selectedItem",null);break}case"label":{e!=null&&e.value?e.value.dataIndex=g:(o("update:selectedLabel",{dataIndex:g,targetAxis:x}),b==="item"&&o("update:selectedItem",null));break}case"series":{o("update:selectedSeries",{seriesId:p});break}}o("click",m)})},"dbl-click":async m=>{await i.nextTick(),h(()=>{const{eventTarget:p}=m;switch(p){case"series":{o("update:selectedSeries",{seriesId:m.seriesId?[m.seriesId]:[]});break}}o("dbl-click",m)})},"drag-select":async m=>{await i.nextTick(),o("drag-select",m)},"mouse-move":async m=>{t!=null&&t.value&&(t.value=m.hoveredLabel),await i.nextTick(),o("mouse-move",m)},"mouse-leave":()=>{t!=null&&t.value&&(t.value.label=null)},"click-legend":async m=>{await i.nextTick(),o("click-legend",m)}},selectItemInfo:a,selectLabelInfo:r,selectSeriesInfo:c,getNormalizedData:l,getNormalizedOptions:s}},Fr=e=>{const t=i.ref(),n=i.computed(()=>{const o=s=>{let l;return s?l=s.unit?s.value+s.unit:`${s.value}px`:l=void 0,l};return{width:o(Kl(e.width)),height:o(Kl(e.height))}});return{wrapper:t,wrapperStyle:n}},Hr=(e,{wrapper:t,evChartGroupRef:n},o,s)=>{const{props:l,emit:a}=i.getCurrentInstance(),r=i.ref(!1),c=i.ref(!1),d=i.ref(!0),h=i.ref(),f=i.reactive({zoom:e.zoom}),m=i.reactive({start:0,end:-1,isUseButton:!1,isUseScroll:!1});let p=null;const g=i.reactive({dom:[],props:{data:[],options:[]}}),u=i.reactive({data:null,options:null}),x=i.ref([]),b=S=>{S.data.length&&S.range&&c.value&&p.dragZoom(S)},y=()=>{g.props.options.forEach((S,M)=>{if(S.zoom={...S.zoom,use:c.value,getRangeInfo:b},c.value)S.dragSelection={...S.dragSelection,use:!0,keepDisplay:!1};else{const{use:k,keepDisplay:T}=u.options[M].dragSelection??{};S.dragSelection={use:!!k,keepDisplay:!!T}}})},w=()=>{if(n!=null&&n.value?(g.dom=n.value.querySelectorAll(".ev-chart-container"),g.dom.length&&s.value.forEach(({data:S,options:M},k)=>{S.chartIdx=k,g.props.data.push(S),g.props.options.push(M),x.value.push(k)})):(g.dom=[t.value.querySelector(".ev-chart-container")],g.props.data.push(l.data),g.props.options.push(l.options)),g.props.data.length){u.data=Se(g.props.data),u.options=Se(g.props.options);const S={updateZoomStartIdx:M=>a("update:zoomStartIdx",M),updateZoomEndIdx:M=>a("update:zoomEndIdx",M)};p=new KC(g,u,f,h.value,r,m,S)}},I=S=>{u.data[0].labels.length<=1||(c.value=!c.value,S?S.classList.toggle("active"):h.value.querySelector(".dragZoom").classList.toggle("active"),y(),p.setIconStyle(c.value),p.setEventListener(c.value))},E=(S,M)=>{if(p.isAnimationFinish)switch(M){case"dragZoom":I(S.target);break;case"reset":p.initZoom();break;case"previous":case"latest":p.clickMoveZoomArea(M);break}};i.onUpdated(()=>{p&&h.value&&p.setIcon(h.value)});const B=S=>{!je(S.zoom,f.zoom)&&(f.zoom=S.zoom,p?(!f.zoom.toolbar.show&&c.value&&I(),p.setEvChartZoomOptions(f.zoom)):f.zoom.toolbar.show&&!n&&w())},_=S=>{d.value?(r.value||(u.data=n?Se(S):[Se(S)],f.zoom.keepZoomStatus?d.value=!1:(c.value=!1,y()),p&&p.updateEvChartCloneData(u,x,c.value,f.zoom.keepZoomStatus)),r.value=!1):d.value=!0},C=(S,M)=>{if(p.isUseToolbar){p.isUseToolbar=!1;return}c.value&&(p.executeZoom(S,M),p.setZoomAreaMemory(S,M))};return i.watch(()=>[m.start,m.end],([S,M],[k])=>{if(o!=null&&o.value)if(typeof o.value.dataIndex=="number")S>=(k??0)?o.value.dataIndex-=S-(k??0):o.value.dataIndex+=k-S;else for(let T=0;T<o.value.dataIndex.length;T++)S>=(k??0)?o.value.dataIndex[T]-=S-(k??0):o.value.dataIndex[T]+=k-S;(m.isUseButton||m.isUseScroll)&&p.executeZoom(S,M)}),i.watch(()=>[m.isUseButton,m.isUseScroll],([S,M],[k,T])=>{k&&!S?p.setZoomAreaMemory(m.start,m.end):T&&!M&&(p.zoomAreaMemory.current[0]=[m.start,m.end])}),{evChartZoomOptions:f,evChartInfo:g,evChartToolbarRef:h,evChartClone:u,brushIdx:m,createEvChartZoom:w,setOptionsForUseZoom:B,setDataForUseZoom:_,controlZoomIdx:C,onClickToolbar:E}},tS={name:"EvChart",components:{EvChartToolbar:Ar},directives:{resize:wn},props:{selectedItem:{type:Object,default:null},selectedLabel:{type:Object,default:null},selectedSeries:{type:Object,default:null},options:{type:Object,default:()=>({})},data:{type:Object,default:()=>({})},resizeTimeout:{type:Number,default:0},zoomStartIdx:{type:Number,default:0},zoomEndIdx:{type:Number,default:0},realTimeScatterReset:{type:Boolean,default:!1}},emits:["click","dbl-click","drag-select","mouse-move","update:selectedItem","update:selectedLabel","update:selectedSeries","update:zoomStartIdx","update:zoomEndIdx","update:realTimeScatterReset","click-legend"],setup(e,{emit:t}){let n=null;const o=i.ref(!1),s=i.inject("isChartGroup",!1),l=i.inject("brushSeries",{list:[],chartIdx:null}),a=i.inject("groupSelectedLabel",null),r=i.inject("groupHoveredLabel",null),c=i.inject("brushIdx",{start:0,end:-1}),d=i.inject("evChartPropsInGroup",[]),{eventListeners:h,selectItemInfo:f,selectLabelInfo:m,selectSeriesInfo:p,getNormalizedData:g,getNormalizedOptions:u}=zr(a,r),x=g(e.data),b=u(e.options),y=i.computed(()=>e.selectedLabel),w=i.computed(()=>e.selectedItem),{wrapper:I,wrapperStyle:E}=Fr(b),{evChartZoomOptions:B,evChartToolbarRef:_,createEvChartZoom:C,setOptionsForUseZoom:S,setDataForUseZoom:M,controlZoomIdx:k,onClickToolbar:T}=s?{}:Hr(b,{wrapper:I,evChartGroupRef:null},e.selectedLabel?y:w,d),R=()=>{var V;let O;b.selectLabel.use?O=m:b.selectSeries.use&&(O=p);const D=(V=e.options.realTimeScatter)!=null&&V.use?{...e.data,groups:[],labels:[]}:x;n=new Pr(I.value,D,b,h,f,O,l)},L=()=>{n&&(n.init(),!s&&b.zoom.toolbar.show&&C())};i.watch(()=>e.options,O=>{const D=u(O),V=!je(D.legend.table,n.options.legend.table),P=D.tooltip.use&&!je(D.tooltip,n.options.tooltip);n.options=Se(D),n.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1},updateLegend:V,updateTooltip:P}),s||S(D)},{deep:!0,flush:"post"}),i.watch(()=>e.data,O=>{var A,F;const D=(A=e.options.realTimeScatter)!=null&&A.use?{...O,groups:[],labels:[]}:g(O),V=!je(D.series,n.data.series)||!je(D.groups,n.data.groups)||e.options.type==="heatMap",P=!je(D,n.data);n.data=(F=e.options.realTimeScatter)!=null&&F.use?D:Se(D),n.update({updateSeries:V,updateSelTip:{update:!0,keepDomain:!1},updateData:P}),!s&&P&&M(D)},{deep:!0,flush:"post"}),s&&!(a!=null&&a.value)&&i.watch(()=>c.start,(O,D)=>{if(y!=null&&y.value)for(let V=0;V<y.value.dataIndex.length;V++)O>=(D??0)?y.value.dataIndex[V]-=O-(D??0):y.value.dataIndex[V]+=D-O;else w!=null&&w.value&&(O>=(D??0)?w.value.dataIndex-=O-(D??0):w.value.dataIndex+=D-O)}),i.watch(()=>w.value,O=>{const D=e.options.type;n.selectItemByData(O,D)},{deep:!0,flush:"post"}),i.watch(()=>(a==null?void 0:a.value)??y.value,O=>{O!=null&&O.dataIndex&&n.selectLabelByData(O.dataIndex,O==null?void 0:O.targetAxis)},{deep:!0,flush:"post"}),i.watch(()=>e.selectedSeries,O=>{var D;(D=b.selectSeries)!=null&&D.use?O.seriesId&&n.selectSeriesByData(O.seriesId):console.warn("[EVUI][Chart] selectSeries.use is false, so selectedSeries is not working")},{deep:!0,flush:"post"}),s||i.watch(()=>[e.zoomStartIdx,e.zoomEndIdx],([O,D])=>{k(O,D)}),i.watch(()=>e.realTimeScatterReset,O=>{O&&(Object.keys(n.dataSet??{}).forEach(D=>{n.dataSet[D]&&(n.dataSet[D].dataGroup=[])}),t("update:realTimeScatterReset",!1))}),i.watch(()=>{var O;return(O=e.options.realTimeScatter)==null?void 0:O.use},O=>{n.options.realTimeScatter.use=O??!1,n.update({updateSeries:!0,updateSelTip:{update:!1,keepDomain:!1},updateData:!1})}),i.watch(()=>r==null?void 0:r.value,O=>{O&&e.options.syncHover!==!1&&(O.label==null?n.overlayClear():n.drawSyncedIndicator(O))},{deep:!0,flush:"post"}),i.onMounted(async()=>{d!=null&&d.value&&d.value.push(e),await R(),await L(),o.value=!0}),i.onBeforeUnmount(()=>{var O;n&&"destroy"in n&&n.destroy(),(O=d==null?void 0:d.value)!=null&&O.length&&(d.value.length=0),o.value=!1}),i.onDeactivated(()=>{n&&"hideTooltip"in n&&n.hideTooltip()});const N=()=>{n&&"update"in n&&n.update({updateSeries:!0,updateSelTip:{update:!0,keepDomain:!1}})},v=jo(()=>{n&&"resize"in n&&n.resize()},e.resizeTimeout);return i.onActivated(()=>{o.value&&v()}),{wrapper:I,wrapperStyle:E,onResize:v,redraw:N,evChartToolbarRef:_,injectIsChartGroup:s,onClickToolbar:T,normalizedOptions:b,zoomOptions:i.toRef(B??{zoom:{}},"zoom")}}},nS={key:0,ref:"evChartToolbarRef"};function oS(e,t,n,o,s,l){var c;const a=i.resolveComponent("ev-chart-toolbar"),r=i.resolveDirective("resize");return i.openBlock(),i.createElementBlock(i.Fragment,null,[(c=o.zoomOptions.toolbar)!=null&&c.show&&!o.injectIsChartGroup?(i.openBlock(),i.createElementBlock("div",nS,[i.createVNode(a,{toolbar:o.zoomOptions.toolbar,onOnClickToolbar:o.onClickToolbar},null,8,["toolbar","onOnClickToolbar"])],512)):i.createCommentVNode("",!0),i.withDirectives(i.createElementVNode("div",{ref:"wrapper",style:i.normalizeStyle(o.wrapperStyle),class:"ev-chart"},null,4),[[r,o.onResize]])],64)}const so=le(tS,[["render",oS]]);so.install=e=>{e.component(so.name,so)};const iS={zoom:{bufferMemoryCnt:100,keepZoomStatus:!1,useAnimation:!0,useWheelMove:!0,toolbar:{show:!1,items:{previous:{icon:"ev-icon-allow2-left",size:"medium",title:"Previous"},latest:{icon:"ev-icon-allow2-right",size:"medium",title:"Latest"},reset:{icon:"ev-icon-redo",size:"medium",title:"Reset"},dragZoom:{icon:"ev-icon-zoomin",size:"medium",title:"Drag Zoom"}}}}},sS=()=>{const e=i.ref(!1),t=i.ref(),n=i.ref([]),o=i.reactive({list:[],chartIdx:null});return{getNormalizedOptions:l=>Fe({},l,iS),isExecuteZoom:e,brushSeries:o,evChartGroupRef:t,evChartPropsInGroup:n}},lS={name:"EvChartGroup",components:{evChartToolbar:Ar},props:{options:{type:Object,default:()=>({})},zoomStartIdx:{type:Number,default:0},zoomEndIdx:{type:Number,default:0},groupSelectedLabel:{type:Object,default:null}},emits:["update:groupSelectedLabel","update:zoomStartIdx","update:zoomEndIdx","update:groupHoveredLabel"],setup(e,{emit:t}){const{getNormalizedOptions:n,isExecuteZoom:o,brushSeries:s,evChartGroupRef:l,evChartPropsInGroup:a}=sS(),r=n(e.options);i.provide("isExecuteZoom",o),i.provide("isChartGroup",!0),i.provide("brushSeries",s),i.provide("evChartPropsInGroup",a);const c=i.computed({get:()=>e.groupSelectedLabel,set:I=>t("update:groupSelectedLabel",I)});i.provide("groupSelectedLabel",c);const d=i.ref(null);i.provide("groupHoveredLabel",d),i.watch(()=>e.options.syncHover,I=>{I?d.value={label:"",horizontal:!1}:d.value=null},{immediate:!0});const{evChartZoomOptions:h,evChartInfo:f,evChartToolbarRef:m,evChartClone:p,brushIdx:g,createEvChartZoom:u,setOptionsForUseZoom:x,setDataForUseZoom:b,controlZoomIdx:y,onClickToolbar:w}=Hr(r,{wrapper:null,evChartGroupRef:l},c,a);return i.provide("evChartClone",p),i.provide("evChartInfo",f),i.provide("brushIdx",g),i.onMounted(()=>{u()}),i.watch(()=>f.props.data,I=>{b(I)},{deep:!0}),i.watch(()=>e.options,I=>{const E=n(I);x(E)},{deep:!0}),i.watch(()=>[e.zoomStartIdx,e.zoomEndIdx],([I,E])=>{g.isUseButton||g.isUseScroll||y(I,E)}),{evChartGroupRef:l,evChartToolbarRef:m,zoomOptions:i.toRef(h,"zoom"),onClickToolbar:w}}},aS={key:0,ref:"evChartToolbarRef"},rS={ref:"evChartGroupRef",class:"ev-chart-group__wrapper"};function cS(e,t,n,o,s,l){const a=i.resolveComponent("ev-chart-toolbar");return i.openBlock(),i.createElementBlock(i.Fragment,null,[o.zoomOptions.toolbar.show?(i.openBlock(),i.createElementBlock("div",aS,[i.createVNode(a,{toolbar:o.zoomOptions.toolbar,onOnClickToolbar:o.onClickToolbar},null,8,["toolbar","onOnClickToolbar"])],512)):i.createCommentVNode("",!0),i.createElementVNode("div",rS,[i.renderSlot(e.$slots,"default",{},void 0,!0)],512)],64)}const lo=le(lS,[["render",cS],["__scopeId","data-v-b1c0c322"]]);lo.install=e=>{e.component(lo.name,lo)};const Ee={WHEEL:{UP:"MOVEUP_WHEEL",DOWN:"MOVEDOWN_WHEEL"},GRAB:{UP:"MOVEUP_GRAB",DOWN:"MOVEDOWN_GRAB"},BUTTON:{INCREASE:"INCREASE",DECREASE:"DECREASE"}},Re={LEFT:"leftX",RIGHT:"rightX"};let dS=class{constructor(t,n,o,s,l){this.evChart=t,this.evChartBrushOptions=o,this.evChartBrushRef=l,this.evChartData=n,this.brushIdx=s,o.value.useDebounce&&(this.debounceBrushIdx={start:s.start,end:s.end})}init(t){var n;if(this.brushIdx.start>this.brushIdx.end){this.removeBrushCanvas();return}if((n=this.evChartBrushRef)!=null&&n.value){const o=this.evChartBrushRef.value.querySelector(".brush-canvas");if(o)this.drawBrushRect({brushCanvas:o,isResize:t});else{const s=document.createElement("canvas");s.setAttribute("class","brush-canvas"),s.setAttribute("style","display: block; z-index: 1;");const l=this.evChartBrushRef.value.querySelector(".ev-chart-brush-container");l&&(this.brushCanvas=s,l.appendChild(s),this.evChartBrushContainer=l,this.drawBrushRect({brushCanvas:s}),this.addEvent(s))}}}drawBrushRect({brushCanvas:t,isResize:n,isDebounce:o,mode:s,offsetX:l}){const{chartRect:a,labelOffset:r}=this.evChart;if(!a&&!r)return;const c=this.evChartData.value.labels.length-1;this.labelEndIdx=c;const d={x1:a.x1+r.left,x2:a.x2-r.right,y1:a.y1+r.top,y2:a.y2-r.bottom},h=this.setCanvasWidthHeight(d,t);if(!(n&&this.isEqualWidth)&&c>=0){const f=this.setBrushXAndWidth(h,l,o,s);h&&f&&this.drawBrush(h,f,d,t)}}setCanvasWidthHeight(t,n){const s=t.x2-t.x1+6,l=t.y2-t.y1,a=(t.x2-t.x1)/this.labelEndIdx,r=window.devicePixelRatio||1;return this.isEqualWidth=n.width===Math.floor(s*r),{brushButtonWidth:6,brushCanvasHeight:l,brushCanvasWidth:s,axesXInterval:a,pixelRatio:r}}setBrushXAndWidth(t,n=0,o,s){const{brushButtonWidth:l,brushCanvasWidth:a,axesXInterval:r,pixelRatio:c}=t;!o&&this.debounceBrushIdx&&(this.debounceBrushIdx.start=this.brushIdx.start,this.debounceBrushIdx.end=this.brushIdx.end);const d=this.debounceBrushIdx??this.brushIdx;switch(s){case Ee.BUTTON.INCREASE:case Ee.BUTTON.DECREASE:this.brushRectWidth=a*c,this.curBrushButtonType===Re.LEFT?(this.brushRectWidth=this.beforeBrushRectWidth?this.beforeBrushRectWidth-n:this.brushRectWidth-n,this.brushRectWidth<=l?this.brushRectWidth=l:(this.brushRectX=n*c,this.beforeBrushRectX=this.brushRectX)):this.curBrushButtonType===Re.RIGHT&&(this.brushRectWidth=n-this.beforeBrushRectX,this.brushRectWidth<=l?this.brushRectWidth=l:(this.brushRectX=this.beforeBrushRectX,this.beforeBrushRectWidth=this.brushRectWidth+this.brushRectX));break;case Ee.GRAB.UP:case Ee.GRAB.DOWN:this.brushRectX<=0&&s===Ee.GRAB.DOWN||this.brushRectX+this.brushRectWidth>=a&&s===Ee.GRAB.UP?this.offsetXAndRectXInterval=null:(this.offsetXAndRectXInterval||(this.offsetXAndRectXInterval=n-this.brushRectX),this.brushRectX=n-this.offsetXAndRectXInterval);break;default:n||(this.brushRectX=d.start*r*c,this.brushRectWidth=(a-(this.labelEndIdx-(d.end-d.start))*r)*c,this.beforeBrushRectX=this.brushRectX,this.beforeBrushRectWidth=this.brushRectWidth+this.brushRectX);break}return{brushRectX:this.brushRectX,brushRectWidth:this.brushRectWidth}}drawBrush(t,n,o,s){const{brushButtonWidth:l,brushCanvasHeight:a,brushCanvasWidth:r,axesXInterval:c,pixelRatio:d}=t,{brushRectX:h,brushRectWidth:f}=n,{height:m,selection:{fillColor:p,opacity:g}}=this.evChartBrushOptions.value,u=m-o.y1,x=h,b=h+f;s.style.position||(s.style.position="absolute",s.style.top=`${o.y1}px`,s.style.left=`${o.x1-l/2}px`),this.isEqualWidth||(s.width=r*d,s.style.width=`${r}px`,s.height=a*d,s.style.height=`${a}px`);const y=s.getContext("2d");y.clearRect(0,0,r*d,a*d),y.fillStyle=p,y.globalAlpha=g,y.fillRect(h,0,f,u),y.fillRect(x,0,l,u),y.fillRect(b-l,0,l,u),this.brushPosInfo={leftX:x/d,rightX:b/d,buttonWidth:l,axesXInterval:c,...t,...n}}addEvent(){let t;this.onMouseDown=s=>{s.preventDefault(),t.isInsideButton?this.clickBrushInsideX=-1:t.isInsideBrush?this.clickBrushInsideX=s.offsetX:t.isOutsideBrush&&this.teleportBrush(s)};const n=s=>{this.clickBrushInsideX?this.mouseDownAndMove(s):(t=this.getMousePosition(s),this.changeCursor(t))};this.onMouseMove=xs(n,5),this.onWheel=s=>{s.preventDefault();const l=s.deltaY>0?Ee.WHEEL.DOWN:Ee.WHEEL.UP;this.updateBrushIdx(l),this.debounceBrushIdx&&this.drawBrushRect({brushCanvas:this.brushCanvas,isDebounce:!0,mode:l}),this.brushIdx.isUseScroll=!0},this.onMouseUp=()=>{this.initEventState()},this.onMouseLeave=()=>{this.clickBrushInsideX&&this.initEventState()};const o=()=>{this.initEventState()};this.onWheelDebounce=jo(o,100),this.setEventListener("addEventListener")}getMousePosition(t){const n=d=>Math.abs(this.brushPosInfo[d]-t.offsetX),o=n(Re.RIGHT)>n(Re.LEFT)?Re.LEFT:Re.RIGHT,s=d=>t.offsetX>this.brushPosInfo[d],l=d=>t.offsetX<this.brushPosInfo[d],a=l(Re.LEFT)||s(Re.RIGHT),r=s(Re.LEFT)&&l(Re.RIGHT),c=t.offsetX+this.brushPosInfo.buttonWidth>=this.brushPosInfo[o]&&t.offsetX-this.brushPosInfo.buttonWidth<=this.brushPosInfo[o];return this.curBrushButtonType=c&&o,{isInsideButton:c,isInsideBrush:r,isOutsideBrush:a}}destroy(){if(this.brushCanvas&&(this.setEventListener("removeEventListener"),this.brushCanvas=null),this.evChartBrushContainer){const t=this.evChartBrushContainer;for(;t.hasChildNodes();)t.removeChild(t.firstChild)}}setEventListener(t){this.brushCanvas[t]("mousemove",this.onMouseMove),this.brushCanvas[t]("mousedown",this.onMouseDown),this.brushCanvas[t]("mouseup",this.onMouseUp),this.brushCanvas[t]("mouseleave",this.onMouseLeave),this.evChartBrushOptions.value.useWheelMove&&(this.brushCanvas[t]("wheel",this.onWheel),this.brushCanvas[t]("wheel",this.onWheelDebounce))}removeBrushWrapper(){if(this.evChartBrushRef.value){const t=this.evChartBrushRef.value.querySelector(".ev-chart-brush-wrapper");t&&this.evChartBrushRef.value.removeChild(t)}}removeBrushCanvas(){if(this.evChartBrushContainer){const t=this.evChartBrushContainer.querySelector(".brush-canvas");t&&this.evChartBrushContainer.removeChild(t)}}teleportBrush(t){const n=this.debounceBrushIdx??this.brushIdx,o=(n.end-n.start)/2;let s,l,a;o>.5?(n.end-n.start)%2===0?(a=Math.round(t.offsetX/this.brushPosInfo.axesXInterval),s=Math.ceil(o),l=Math.floor(o)):(a=Math.ceil(t.offsetX/this.brushPosInfo.axesXInterval),s=Math.ceil(o),l=Math.floor(o)):(a=Math.floor(t.offsetX/this.brushPosInfo.axesXInterval),t.offsetX-a*this.brushPosInfo.axesXInterval>this.brushPosInfo.axesXInterval/2?(s=Math.floor(o),l=Math.ceil(o)):(s=Math.ceil(o),l=Math.floor(o),o<1&&(a+=1))),a-s<=0?(n.start=0,n.end=l+s):a+l>=this.labelEndIdx?(n.start=this.labelEndIdx-l-s,n.end=this.labelEndIdx):(n.start=a-s,n.end=a+l),this.brushIdx.isUseScroll=!0}changeCursor(t){t.isOutsideBrush?this.brushCanvas.style.cursor="pointer":t.isInsideBrush&&(t.isInsideButton?this.brushCanvas.style.cursor="ew-resize":this.brushCanvas.style.cursor="grab")}mouseDownAndMove(t){const n=this.debounceBrushIdx?0:this.brushPosInfo.axesXInterval/3;let o;t.offsetX>this.beforeMouseXPos?this.clickBrushInsideX>0?this.clickBrushInsideX<t.offsetX-n&&(o=Ee.GRAB.UP,this.isUseBrushGrab=!0,this.brushIdx.isUseScroll=!0,this.clickBrushInsideX=t.offsetX+n):t.offsetX-this.brushPosInfo[this.curBrushButtonType]>n&&(o=this.curBrushButtonType===Re.LEFT?Ee.BUTTON.DECREASE:Ee.BUTTON.INCREASE,this.brushIdx.isUseButton=!0):t.offsetX<this.beforeMouseXPos&&(this.clickBrushInsideX>0?this.clickBrushInsideX>t.offsetX+n&&(o=Ee.GRAB.DOWN,this.isUseBrushGrab=!0,this.brushIdx.isUseScroll=!0,this.clickBrushInsideX=t.offsetX-n):this.brushPosInfo[this.curBrushButtonType]-t.offsetX>n&&(o=this.curBrushButtonType===Re.LEFT?Ee.BUTTON.INCREASE:Ee.BUTTON.DECREASE,this.brushIdx.isUseButton=!0)),this.debounceBrushIdx?this.drawBrushRect({brushCanvas:this.brushCanvas,isDebounce:!0,mode:o,offsetX:t.offsetX}):this.updateBrushIdx(o),this.beforeMouseXPos=t.offsetX}updateBrushIdx(t){const n=this.debounceBrushIdx??this.brushIdx;switch(t){case Ee.WHEEL.UP:case Ee.GRAB.UP:if(n.end>=this.labelEndIdx)return;n.start+=1,n.end+=1;break;case Ee.WHEEL.DOWN:case Ee.GRAB.DOWN:if(n.start<=0)return;n.start-=1,n.end-=1;break;case Ee.BUTTON.INCREASE:if(this.curBrushButtonType===Re.LEFT){if(!n.start)return;n.start-=1}else{if(n.end===this.labelEndIdx)return;n.end+=1}break;case Ee.BUTTON.DECREASE:if(n.start===n.end-1)return;this.curBrushButtonType===Re.LEFT?n.start+=1:n.end-=1;break}}updateBrushIdxUseXPos(){if(!this.debounceBrushIdx)return;const t=()=>{let s,l;if(this.brushPosInfo){const{brushRectX:a,brushRectWidth:r,brushCanvasWidth:c,axesXInterval:d}=this.brushPosInfo;if(this.brushIdx.isUseButton||this.isUseBrushGrab){if(s=a/d,l=this.labelEndIdx-(c-(a+r))/d,this.curBrushButtonType===Re.LEFT?(s=Math.round(s),l=this.brushIdx.end,s===l&&(s-=1)):this.curBrushButtonType===Re.RIGHT?(s=this.brushIdx.start,l=Math.round(l),s===l&&(l+=1)):(s=Math.round(s),l=Math.round(l)),l>this.labelEndIdx){const h=l-this.labelEndIdx;s-=h,l-=h}if(s<0){const h=Math.abs(s);s=0,l+=h}}}return{brushStartIdx:s,brushEndIdx:l}},{brushStartIdx:n,brushEndIdx:o}=t();this.brushIdx.start===n&&this.brushIdx.end===o&&this.drawBrushRect({brushCanvas:this.brushCanvas}),this.brushIdx.start=n??this.debounceBrushIdx.start,this.brushIdx.end=o??this.debounceBrushIdx.end}initEventState(){new Promise(n=>{this.updateBrushIdxUseXPos(),n(!0)}).then(n=>{n&&(this.clickBrushInsideX=null,this.beforeMouseXPos=null,this.curBrushButtonType=null,this.isUseBrushGrab=!1,this.offsetXAndRectXInterval=null,this.brushIdx.isUseButton=!1,this.brushIdx.isUseScroll=!1)})}};const hS={show:!0,useDebounce:!0,chartIdx:0,height:100,showLabel:!1,selection:{fillColor:"#38ACEC",opacity:.65},useWheelMove:!0},fS=()=>({getNormalizedBrushOptions:t=>Fe({},t,hS)}),uS={name:"EvChartBrush",directives:{resize:wn},props:{options:{type:Object,default:()=>({})}},setup(e){let t=null,n=null;const o=i.ref(!1),s=i.inject("evChartClone",{data:[]}),l=i.inject("evChartInfo",{props:{options:[]}}),a=i.inject("brushIdx",{start:0,end:-1,isUseButton:!1,isUseScroll:!1}),r=i.inject("brushSeries",{list:[],chartIdx:null}),{getNormalizedBrushOptions:c}=fS(),d=i.computed(()=>c(e.options)),{eventListeners:h,selectItemInfo:f,selectLabelInfo:m,selectSeriesInfo:p,getNormalizedData:g,getNormalizedOptions:u}=zr(),x=i.computed(()=>g((s.data??[])[d.value.chartIdx])),b=i.computed(()=>{var k,T;const S=l.props.options[d.value.chartIdx],M={...S,brush:{use:!0,...d.value},height:d.value.height,zoom:{use:!1},dragSelection:{use:!1},title:{show:!1},tooltip:{use:!1},legend:{show:!1},selectLabel:{use:!1},selectSeries:{use:!1},axesX:[{...(k=S==null?void 0:S.axesX)==null?void 0:k[0],title:{use:!1}}],axesY:[{...(T=S==null?void 0:S.axesY)==null?void 0:T[0],title:{use:!1}}]};return u(M)}),{wrapper:y,wrapperStyle:w}=Fr(b.value);i.watch(()=>r.list,()=>{y.value&&r.chartIdx===d.value.chartIdx&&(t.seriesList=r.list[d.value.chartIdx],t.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1}}))}),i.watch(b,(S,M)=>{var k;S.brush.chartIdx<=((k=s.data)==null?void 0:k.length)-1?n&&!je(M.brush,S.brush)?n.removeBrushWrapper():t&&!je(S,M)&&(t.options=Se(S),t.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1}})):(t.data=Se(x.value),t.update({updateSeries:!0,updateSelTip:{update:!1,keepDomain:!1},updateData:!1}),n.removeBrushCanvas())}),i.watch(()=>s.data,S=>{if(t){const M=S[d.value.chartIdx];if(M){const k=!je(M.series,t.data.series),T=r.list[d.value.chartIdx];typeof T=="object"&&Object.keys(T).length&&Object.keys(M.series).forEach(R=>{var L;"show"in M.series[R]||(M.series[R].show=((L=T[R])==null?void 0:L.show)??!0)}),t.data=Se(M),t.update({updateSeries:k,updateSelTip:{update:!1,keepDomain:!1},updateData:!1})}}});const I=()=>{let S;b.value.selectLabel.use?S=m:b.value.selectSeries.use&&(S=p),t=new Pr(y.value,x.value,b.value,h,f,S)},E=()=>{n=new dS(t,x,d,a,y)},B=()=>{t&&t.init()},_=S=>{n&&n.init(S)};i.watch(()=>[a.start,a.end],()=>{var S;y.value&&d.value.chartIdx<=((S=s.data)==null?void 0:S.length)-1&&_()}),i.onMounted(async()=>{d.value.show&&(await I(),await B(),E(),_()),o.value=!0}),i.onUpdated(async()=>{var S;if(d.value.show&&d.value.chartIdx<=((S=s.data)==null?void 0:S.length)-1){const M=r.list[d.value.chartIdx];typeof M=="object"&&Object.keys(M).length&&Object.keys(x.value.series).forEach(k=>{var T;"show"in x.value.series[k]||(x.value.series[k].show=((T=M[k])==null?void 0:T.show)??!0)}),await I(),await B(),E(),_()}}),i.onBeforeUnmount(()=>{t&&"destroy"in t&&t.destroy(),n&&n.destroy(),o.value=!1}),i.onDeactivated(()=>{t&&"hideTooltip"in t&&t.hideTooltip()});const C=jo(()=>{t&&"resize"in t&&new Promise(M=>t.resize(M)).then(M=>{M&&_(M)})},0);return i.onActivated(()=>{o.value&&C()}),{evChartBrushOptions:d,evChartBrushRef:y,evChartBrushStyle:w,onResize:C}}};function mS(e,t,n,o,s,l){const a=i.resolveDirective("resize");return o.evChartBrushOptions.show?i.withDirectives((i.openBlock(),i.createElementBlock("div",{key:0,ref:"evChartBrushRef",style:i.normalizeStyle(o.evChartBrushStyle),class:"ev-chart-brush"},null,4)),[[a,o.onResize]]):i.createCommentVNode("",!0)}const ao=le(uS,[["render",mS]]);ao.install=e=>{e.component(ao.name,ao)};const gS={name:"TreeGridNode",components:{GridOptionButton:Ns},props:{dataIndex:{type:Number,default:0},nodeData:{type:Object,default:()=>({})},selectedData:{type:Object,default:()=>({})},useCheckbox:{type:Object,default:()=>({})},orderedColumns:{type:[Array],default:()=>[]},expandIcon:{type:String,default:""},collapseIcon:{type:String,default:""},parentIcon:{type:String,default:""},childIcon:{type:String,default:""},customContextMenu:{type:[Array],default:()=>[]},menuRef:{type:Object,default:null},rowHeight:{type:Number,default:35},minWidth:{type:Number,default:40},borderStyle:{type:String,default:""},highlightIndex:{type:Number,default:-1}},emits:{"check-tree-data":null,"expand-tree-data":null,"click-tree-data":null,"dbl-click-tree-data":null,"context-menu":null},setup(e,{emit:t}){const n=(y,w)=>{t("check-tree-data",y,w)},o=y=>{t("expand-tree-data",y)},s=(y,w)=>{t("click-tree-data",y,w)},l=(y,w)=>{t("dbl-click-tree-data",y,w)},a=y=>{t("context-menu",y)},r=y=>{const w=e.expandIcon?e.expandIcon:"",I=e.expandIcon?e.collapseIcon:"";return y.expand?I:w},c=i.computed(()=>e.nodeData||{}),d=i.computed(()=>e.parentIcon||"tree-parent-icon"),h=i.computed(()=>e.childIcon||"tree-child-icon"),f=i.computed(()=>d.value!=="none"||h.value!=="none"),m=i.computed(()=>{const y=e.orderedColumns||[],w=y.findIndex(E=>E.expandColumn&&!E.hide&&!E.hiddenDisplay);if(w!==-1)return w;const I=y.findIndex(E=>!E.hide&&!E.hiddenDisplay);return I!==-1?I:0}),p=y=>({row:!0,"tree-row":!0,[`tree-row--level-${y==null?void 0:y.level}`]:!0,highlight:(y==null?void 0:y.index)===e.highlightIndex,selected:y.selected,"non-border":!!e.borderStyle&&e.borderStyle!=="rows"}),g=i.computed(()=>({cell:!0,"row-checkbox":!0,"non-border":!!e.borderStyle}));return{parentIconMV:d,childIconMV:h,node:c,isDataIcon:f,checkboxClass:g,expandColumnIdx:m,onCheck:n,onExpand:o,onClick:s,onDblClick:l,onContextMenu:a,expandIconClasses:r,getRowClass:p,getColumnClass:(y,w)=>({cell:!0,"tree-td":w===0,[y.type]:y.type,[y.align]:y.align,[y.field]:y.field,"non-border":!!e.borderStyle}),getColumnStyle:(y,w)=>({width:`${y.width}px`,height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`,"min-width":`${e.minWidth}px`,"border-right":e.orderedColumns.length-1===w?"none":"1px solid #CFCFCF"}),getDepthStyle:y=>({"margin-left":`${y*13}px`})}}},pS=["data-index"],yS=["data-name","data-index"],xS={class:"td-content__wrapper"},bS=["title"],CS={class:"td-content"};function SS(e,t,n,o,s,l){var d;const a=i.resolveComponent("ev-checkbox"),r=i.resolveComponent("ev-icon"),c=i.resolveComponent("grid-option-button");return i.openBlock(),i.createElementBlock("tr",{"data-index":o.node.index,class:i.normalizeClass(o.getRowClass(o.node)),onClick:t[7]||(t[7]=h=>o.onClick(h,o.node)),onDblclick:t[8]||(t[8]=h=>o.onDblClick(h,o.node))},[n.useCheckbox.use?(i.openBlock(),i.createElementBlock("td",{key:0,class:i.normalizeClass(o.checkboxClass),style:i.normalizeStyle({width:`${n.minWidth}px`,height:`${n.rowHeight}px`,"border-right":"1px solid #CFCFCF"})},[i.createVNode(a,{modelValue:o.node.checked,"onUpdate:modelValue":t[0]||(t[0]=h=>o.node.checked=h),disabled:o.node.uncheckable,indeterminate:o.node.indeterminate,class:"row-checkbox-input",onChange:t[1]||(t[1]=h=>o.onCheck(h,o.node))},null,8,["modelValue","disabled","indeterminate"])],6)):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.orderedColumns,(h,f)=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:f},[!h.hide&&!h.hiddenDisplay?(i.openBlock(),i.createElementBlock("td",{key:0,"data-name":h.field,"data-index":o.node.index,class:i.normalizeClass(o.getColumnClass(h,f)),style:i.normalizeStyle(o.getColumnStyle(h,f))},[i.createElementVNode("div",xS,[f===o.expandColumnIdx?(i.openBlock(),i.createElementBlock("span",{key:0,style:i.normalizeStyle(o.getDepthStyle(o.node.level))},null,4)):i.createCommentVNode("",!0),f===o.expandColumnIdx?(i.openBlock(),i.createElementBlock("span",{key:1,class:i.normalizeClass({expand:o.node.expand,"ev-tree-toggle":!0})},[o.node.hasChild?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[o.expandIconClasses(o.node)?(i.openBlock(),i.createBlock(r,{key:0,icon:o.expandIconClasses(o.node),style:{display:"block"},onClick:t[2]||(t[2]=m=>o.onExpand(o.node))},null,8,["icon"])):(i.openBlock(),i.createElementBlock("button",{key:1,class:"tree-expand-icon",onClick:t[3]||(t[3]=i.withModifiers(m=>o.onExpand(o.node),["stop"]))},[...t[9]||(t[9]=[i.createElementVNode("i",null,null,-1)])]))],64)):i.createCommentVNode("",!0)],2)):i.createCommentVNode("",!0),f===o.expandColumnIdx&&o.isDataIcon?(i.openBlock(),i.createElementBlock("span",{key:2,title:o.node[h.field],class:i.normalizeClass({expand:o.node.expand,"ev-tree-toggle":!0})},[i.createElementVNode("span",{class:i.normalizeClass(o.node.hasChild?o.parentIconMV:o.childIconMV)},[...t[10]||(t[10]=[i.createElementVNode("i",null,null,-1)])],2)],10,bS)):i.createCommentVNode("",!0),i.createElementVNode("div",CS,[e.$slots[h.field+"Node"]?i.renderSlot(e.$slots,h.field+"Node",{key:0,item:{data:o.node.data}},void 0,!0):i.createCommentVNode("",!0)])])],14,yS)):i.createCommentVNode("",!0)],64))),128)),(d=n.customContextMenu)!=null&&d.length?(i.openBlock(),i.createElementBlock("td",{key:1,class:i.normalizeClass({"row-contextmenu":!0,"non-border":!!n.borderStyle}),style:i.normalizeStyle({position:"sticky",right:0,width:"30px",height:`${n.rowHeight}px`,"min-width":"30px","line-height":`${n.rowHeight}px`})},[e.$slots.contextmenuIconNode?(i.openBlock(),i.createElementBlock("span",{key:0,class:"row-contextmenu__btn",onClick:[t[4]||(t[4]=h=>o.onContextMenu(h)),t[5]||(t[5]=i.withModifiers((...h)=>n.menuRef.show&&n.menuRef.show(...h),["prevent"]))]},[i.renderSlot(e.$slots,"contextmenuIconNode",{},void 0,!0)])):(i.openBlock(),i.createBlock(c,{key:1,icon:"ev-icon-warning2",class:"row-contextmenu__btn",onClick:[t[6]||(t[6]=h=>o.onContextMenu(h)),i.withModifiers(n.menuRef.show,["prevent"])]},null,8,["onClick"]))],6)):i.createCommentVNode("",!0)],42,pS)}const wS=le(gS,[["render",SS],["__scopeId","data-v-faab3696"]]),kS={name:"EvTreeGridToolbar"},MS={class:"tree-grid-toolbar"};function ES(e,t,n,o,s,l){return i.openBlock(),i.createElementBlock("div",MS,[i.renderSlot(e.$slots,"toolbarWrapper")])}const IS=le(kS,[["render",ES]]),vS=e=>{const{props:t}=i.getCurrentInstance(),{checkInfo:n}=e;return{isRenderer:(d={})=>{var h;return!!((h=d==null?void 0:d.render)!=null&&h.use)},getComponentName:(d="")=>{const h=p=>p.charAt(0).toUpperCase()+p.slice(1),f="Renderer";let m="";if(d.indexOf("_")!==-1){const p=d.split("_");for(let g=0;g<p.length;g++)m+=h(p[g])}else m=h(d);return m+f},getConvertValue:(d,h)=>{let f=d.type==="number"||d.type==="float"?Number(h):h;return d.type==="number"?(f=Ht(h),f=f===!1?h:f):d.type==="float"&&(f=f.toFixed(d.decimal??3).replace(/\B(?=(\d{3})+(?!\d))/g,",")),f},getColumnIndex:d=>t.columns.findIndex(h=>h.field===d),setPixelUnit:d=>{let h=d;const f=h.toString().indexOf("px")>=0,m=h.toString().indexOf("%")>=0;return!f&&!m&&(h=`${h}px`),h},checkHeader:d=>{n.isHeaderChecked=!!d.length&&d.every(f=>f.checked);const h=d.filter(f=>f.uncheckable);if(h.length){const f=d.filter(p=>p.checked),m=d.every(p=>h.includes(p));n.isHeaderChecked=!m&&h.length+f.length===d.length,n.isHeaderUncheckable=m}n.isHeaderIndeterminate=!!d.length&&d.some(f=>f.checked||f.indeterminate)&&!n.isHeaderChecked}}},ai=e=>{const{originColumns:t,filteredColumns:n}=e;return t.map(o=>{const s=n.find(l=>l.index===o.index)??{};return{...o,...s}})},TS=e=>{const{scrollInfo:t,stores:n,elementInfo:o,resizeInfo:s,pageInfo:l,summaryScroll:a,getPagingData:r,updatePagingInfo:c}=e,d=m=>{let p=n.showTreeStore;l.isClientPaging&&(p=r());const g=o.body;if(g){const u=s.rowHeight,x=g.clientHeight>u?Math.ceil(g.clientHeight/u):p.length,b=p.length*u;let y=Math.floor(g.scrollTop/u);y>p.length-1&&(y=0);const w=y+x+1,I=Math.max(y,0),E=w,B=o.table;n.viewStore=p.slice(I,E),t.hasVerticalScrollBar=x<p.length||g.clientHeight<B.clientHeight,t.vScrollTopHeight=I*u,t.vScrollBottomHeight=b-n.viewStore.length*u-t.vScrollTopHeight,m&&l.isInfinite&&t.vScrollBottomHeight===0&&(l.prevPage=l.currentPage,l.currentPage=Math.ceil(E/l.perPage)+1,l.startIndex=E,c({onScrollEnd:!0}))}},h=()=>{const m=o.header,p=o.body,g=o.table;m.scrollLeft=p.scrollLeft,a.value=p.scrollLeft,t.hasHorizontalScrollBar=p.clientWidth<g.clientWidth};return{updateVScroll:d,updateHScroll:h,onScroll:()=>{const m=o.body,p=m.scrollTop,g=m.scrollLeft,u=t.lastScroll.top,x=t.lastScroll.left,b=g!==x;p!==u&&m.clientHeight&&d(!0),b&&h(),t.lastScroll.top=p,t.lastScroll.left=g}}},BS=e=>{const{props:t,emit:n}=i.getCurrentInstance(),{resizeInfo:o,elementInfo:s,checkInfo:l,stores:a,isRenderer:r,updateVScroll:c,updateHScroll:d,contextInfo:h}=e,f=()=>{a.viewStore=a.showTreeStore;const u=a.viewStore;let x=o.columnWidth;o.columnWidth>0&&(x=o.columnWidth),x=o.columnWidth;let b=0;if(o.adjust&&s.body){const y=s.body;let w=y.offsetWidth;const I=y.offsetHeight,E=a.orderedColumns.reduce((B,_)=>(_.hide||_.hiddenDisplay||(_.width?B.totalWidth+=_.width:B.emptyCount++),B),{totalWidth:h.customContextMenu.length?30:0,emptyCount:0});if(o.rowHeight*u.length>I-o.scrollWidth&&(w-=o.scrollWidth),l.useCheckbox.use&&(w-=o.minWidth),x=w-E.totalWidth,x>0){const B=E.emptyCount===0?0:Math.floor(x/E.emptyCount);b=x-B*E.emptyCount,x=E.emptyCount!==0?B:x}else x=o.columnWidth;x=x<o.minWidth?o.minWidth:x,o.columnWidth=x}if(a.orderedColumns.forEach(y=>{const w=r(y)?o.rendererMinWidth:o.minWidth;y.width&&y.width<w&&(y.width=w),!y.width&&!y.hide&&(y.width=x)}),b&&a.orderedColumns.length){let y=a.orderedColumns.length-1,w=a.orderedColumns[y];for(;y>0&&w&&(w.hide||w.hiddenDisplay);)y-=1,w=a.orderedColumns[y];w&&(w.width+=b)}o.isResize=!o.isResize},m=()=>{i.nextTick(()=>{var u,x;o.adjust&&a.orderedColumns.forEach(b=>{var w;const y=b;return!((w=t.columns[b.index])!=null&&w.width)&&!y.resized&&(y.width=0),y},void 0),f(),(u=s.body)!=null&&u.clientHeight&&c(),(x=s.body)!=null&&x.clientWidth&&d()})};return{calculatedColumn:f,onResize:m,onShow:u=>{u&&m()},onColumnResize:(u,x)=>{const b=s.header,y=s.body,w=b.getBoundingClientRect().left,I=b.querySelector(`li[data-index="${u}"]`),E=r(a.orderedColumns[u])?o.rendererMinWidth:o.minWidth,B=I.getBoundingClientRect(),_=y.getBoundingClientRect().right-w,C=s.resizeLine,S=B.left-w+E,M=B.right-w,k=x.clientX,T=B.left-w;y.style.overflow="auto",C.style.left=`${M}px`,o.showResizeLine=!0;const R=N=>{const v=N.clientX-k,O=M+v;let D=Math.max(S,O);D=Math.min(_,D),C.style.left=`${D}px`},L=()=>{const v=parseInt(C.style.left,10)-T;a.orderedColumns[u]&&(a.orderedColumns[u].width=v,a.orderedColumns[u].resized=!0),o.showResizeLine=!1,document.removeEventListener("mousemove",R),m();const O=ai(a);n("resize-column",{column:a.orderedColumns[u],columns:O}),n("change-column-info",{type:"resize",columns:O})};document.addEventListener("mousemove",R),document.addEventListener("mouseup",L,{once:!0})}}},DS=e=>{const{emit:t}=i.getCurrentInstance(),n=e,o=(r,c)=>{var f;const d=r.target.tagName.toLowerCase();let h={};return r.target.offsetParent&&(d==="td"?h=r.target.dataset:h=((f=r.target.closest("td"))==null?void 0:f.dataset)??{}),{event:r,rowData:c,rowIndex:c.index,cellName:h.name,cellIndex:h.index}};let s=null;return{onRowClick:(r,c)=>{var d,h;return r.target&&r.target.parentElement&&(r.target.parentElement.classList.contains("row-checkbox-input")||(h=(d=r.target.closest("td"))==null?void 0:d.classList)!=null&&h.contains("row-contextmenu"))?!1:(clearTimeout(s),s=setTimeout(()=>{n.useSelect&&(c.selected?(c.selected=!1,n.multiple?r.ctrlKey?n.selectedRow=n.selectedRow.filter(f=>f.index!==c.index):n.selectedRow=[c]:n.selectedRow=[]):(c.selected=!0,r.ctrlKey&&n.multiple&&(!n.limitCount||n.limitCount>n.selectedRow.length)?n.selectedRow.push(c):n.selectedRow=[c]),t("update:selected",n.selectedRow),t("click-row",o(r,c)))},100),!0)},onRowDblClick:(r,c)=>{clearTimeout(s),t("dblclick-row",o(r,c))}}},OS=e=>{const{checkInfo:t,stores:n,checkHeader:o,pageInfo:s,getPagingData:l}=e,{emit:a}=i.getCurrentInstance(),r=()=>t.useCheckbox.mode==="each",c=p=>{const g=n.treeStore.findIndex(u=>u.index===p.index);g!==-1&&(n.treeStore[g].checked=p.checked)},d=p=>{r()||p.hasChild&&p.children.forEach(g=>{const u=g;p.checked&&!u.checked&&!u.uncheckable&&t.checkedRows.push(u),p.checked||(t.checkedRows=t.checkedRows.filter(x=>x.index!==u.index)),u.checked=p.checked&&!u.uncheckable,u.hasChild&&d(u)})},h=p=>{if(r())return;const g=p.parent;if(g){const u=g.children.every(b=>b.checked);g.checked=u&&!g.uncheckable;const x=g.children.filter(b=>b.uncheckable);if(x.length){const b=g.children.filter(y=>y.checked);x.length+b.length===g.children.length&&(g.checked=!0)}g.indeterminate=!u&&g.children.some(b=>b.checked||b.indeterminate),g.checked?t.checkedRows.push(g):t.checkedRows=t.checkedRows.filter(b=>b.index!==g.index),g.parent&&h(g)}};return{onCheck:(p,g)=>{let u=n.store;s.isClientPaging&&(u=l());const x=()=>t.useCheckbox.mode==="single",b=()=>{t.isHeaderChecked&&(t.isHeaderChecked=!1)},y=()=>{x()&&t.checkedRows.length>0&&(t.prevCheckedRow.checked=!1,c(t.prevCheckedRow))},w=E=>{if(x()){t.checkedRows=[E];return}d(E),h(E),t.checkedRows.push(E),E.indeterminate=!1},I=E=>{if(x()){t.checkedRows=[];return}t.checkedRows=t.checkedRows.filter(B=>B.index!==E.index)};y(),g.checked?(w(g),o(u)):(b(),I(g),d(g),h(g)),t.prevCheckedRow=g,a("update:checked",t.checkedRows),a("check-row",p,g.index,g)},onCheckAll:p=>{var x;const g=t.isHeaderChecked;let u=(x=n.store)==null?void 0:x.filter(b=>b.isFilter);s.isClientPaging&&(u=l()),u.forEach(b=>{b.checked=g&&!b.uncheckable,b.checked?t.checkedRows.find(y=>y.index===b.index)||t.checkedRows.push(b):t.checkedRows=t.checkedRows.filter(y=>y.index!==b.index),b.indeterminate=!1}),t.isHeaderIndeterminate=!1,a("update:checked",t.checkedRows),a("check-all",p,t.checkedRows)}}},RS=e=>{const{emit:t}=i.getCurrentInstance(),{contextInfo:n,stores:o,selectInfo:s,useGridSetting:l,columnSettingInfo:a,setColumnHidden:r,onSort:c}=e,d=(p=!0)=>{const g=[];if(p&&n.customContextMenu.length){const u=s.selectedRow,x=n.customContextMenu.map(b=>{const y=b;return y.validate&&(y.disabled=!y.validate(y.itemId,u)),y.selectedRow=u??[],y});g.push(...x)}n.contextMenuItems=g};return{setContextMenu:d,onContextMenu:p=>{var x,b;const u=(b=(x=p.target.closest(".row"))==null?void 0:x.dataset)==null?void 0:b.index;if(u){const y=o.viewStore.findIndex(I=>I.index===Number(u)),w=o.viewStore[y];s.selectedRow=[w],d(),t("update:selected",s.selectedRow)}else s.selectedRow=[],d(!1),t("update:selected",[])},onColumnContextMenu:(p,g)=>{var u,x,b,y,w,I;if(p.target.className.includes("column-name")){const E=!!g.sortable;n.columnMenuItems=[{text:((u=n.columnMenuTextInfo)==null?void 0:u.hide)??"Hide",iconClass:"ev-icon-visibility-off",disabled:!l.value||o.orderedColumns.length===1||!!g.fixed,hidden:((x=n.hiddenColumnMenuItem)==null?void 0:x.hide)||!l.value,click:()=>{r(g.field),t("change-column-status",{columns:o.updatedColumns}),t("change-column-info",{type:"display",columns:o.updatedColumns})}},{text:((b=n.columnMenuTextInfo)==null?void 0:b.ascending)??"Ascending",iconClass:"ev-icon-allow2-up",disabled:!E,hidden:(y=n.hiddenColumnMenuItem)==null?void 0:y.ascending,click:()=>c(g,"asc")},{text:((w=n.columnMenuTextInfo)==null?void 0:w.descending)??"Descending",iconClass:"ev-icon-allow2-down",disabled:!E,hidden:(I=n.hiddenColumnMenuItem)==null?void 0:I.descending,click:()=>c(g,"desc")}]}else n.columnMenuItems.length=0},onGridSettingContextMenu:p=>{const{useDefaultColumnSetting:g,columnSettingTextInfo:u}=a,x={text:(u==null?void 0:u.title)??"Column List",isShowMenu:!0,click:()=>{a.isShowColumnSetting=!0,n.isShowMenuOnClick=!0}};n.customGridSettingContextMenu.length&&(n.gridSettingContextMenuItems=[...n.customGridSettingContextMenu]),g&&n.gridSettingContextMenuItems.push(x),n.gridSettingMenu.show(p)}}},NS=e=>{const{emit:t}=i.getCurrentInstance(),{stores:n,onResize:o}=e,s=()=>{let r=0;const c=[];function d(f){const m={};return Object.keys(f).forEach(p=>{p!=="children"&&(m[p]=f[p])}),m}function h(f){const{node:m,level:p,isShow:g,parent:u,uncheckable:x}=f;m!==null&&typeof m=="object"&&(m.index=r++,m.level=p,Object.hasOwnProperty.call(m,"checked")||(m.checked=!1),Object.hasOwnProperty.call(m,"selected")||(m.selected=!1),Object.hasOwnProperty.call(m,"show")||(m.show=g),Object.hasOwnProperty.call(m,"expand")||(m.expand=!0),Object.hasOwnProperty.call(m,"isFilter")||(m.isFilter=!1),Object.hasOwnProperty.call(m,"uncheckable")||(m.uncheckable=x),Object.hasOwnProperty.call(m,"indeterminate")||(m.indeterminate=!1),Object.hasOwnProperty.call(m,"data")||(m.data=d(m)),c.push(m),Object.hasOwnProperty.call(m,"parent")||(m.parent=u),m.children&&(m.hasChild=!0,m.children.forEach(b=>h({node:b,level:p+1,isShow:m.show&&m.expand,parent:m,uncheckable:m.uncheckable}))))}return n.treeRows.forEach(f=>{h({node:f,level:0,isShow:!0,parent:void 0,uncheckable:!1})}),c},l=(r,c,d)=>{r.forEach(h=>{const f=h;f.show=d&&c?f.isFilter:c,f.hasChild&&l(f.children,f.show&&f.expand,f.isFilter)})};return{setTreeNodeStore:s,handleExpand:r=>{const c=!r.expand,d=r;d.expand=!d.expand,l(d.children,d.expand,d.isFilter),t("toggle-row",{row:d,isExpand:c}),o()}}},LS=e=>{const{stores:t,filterInfo:n,pageInfo:o,getConvertValue:s,onResize:l,checkHeader:a,getPagingData:r,updatePagingInfo:c}=e,d=p=>{if(!(p!=null&&p.parent))return;const{parent:g}=p;g.show=!0,g.isFilter=!0,d(g)},h=p=>{if(!(p!=null&&p.children))return;const{children:g}=p;g.forEach(u=>{const x=u;x.parent.show&&x.parent.expand?x.show=!0:x.show=!1,x.isFilter=!0,x.hasChild&&h(x)})};let f=null;return{onSearch:p=>{f&&clearTimeout(f),f=setTimeout(()=>{n.isSearch=!1,n.searchWord=p;const g=t.treeStore;g.forEach(u=>{u.show=!1,u.isFilter=!1}),p?(g.filter(x=>{let b=!1;for(let y=0;y<t.orderedColumns.length;y++){const w=t.orderedColumns[y]||{};let I=x[w.field]??null;if(w.type=w.type||"string",I!==null&&!w.hide&&((w==null?void 0:w.searchable)===void 0||w!=null&&w.searchable)&&(I=s(w,I).toString(),b=I.toLowerCase().includes(p.toString().toLowerCase()),b))break}return b}).forEach(x=>{x.show=!0,x.parent&&!x.parent.expand&&(x.show=!1),x.isFilter=!0,d(x),h(x)}),n.isSearch=!0):(g.forEach(u=>{u.show=!0,u.isFilter=!1}),g.forEach(u=>{d(u),h(u)})),!p&&o.isClientPaging&&o.prevPage&&(o.currentPage=1,t.pagingStore=r()),c({onSearch:!0}),a(t.store),l()},500)}}},_S=e=>{const{emit:t}=i.getCurrentInstance(),{stores:n,pageInfo:o,sortInfo:s,filterInfo:l,elementInfo:a,clearCheckInfo:r}=e,c=()=>{const f=(o.currentPage-1)*o.perPage,m=parseInt(f,10)+parseInt(o.perPage,10);return n.showTreeStore.slice(f,m)},d=f=>{t("page-change",{eventName:f,pageInfo:{currentPage:o.currentPage,prevPage:o.prevPage,startIndex:o.startIndex,total:o.pageTotal,perPage:o.perPage},sortInfo:{field:s.sortField,order:s.sortOrder},searchInfo:{searchWord:l.searchWord,searchColumns:n.orderedColumns.filter(m=>!m.hide&&((m==null?void 0:m.searchable)===void 0||(m==null?void 0:m.searchable))).map(m=>m.field)}}),o.isInfinite&&(f!=null&&f.onSearch||f!=null&&f.onSort)&&(o.currentPage=1,a.body.scrollTop=0,r())};return{getPagingData:c,updatePagingInfo:d,changePage:f=>{if(o.isClientPaging)if(o.prevPage=f,n.showTreeStore.length<=o.perPage)n.pagingStore=n.showTreeStore;else{const m=(o.currentPage-1)*o.perPage,p=parseInt(m,10)+parseInt(o.perPage,10);n.pagingStore=n.showTreeStore.slice(m,p),a.body.scrollTop=0,o.startIndex=m}d({onChangePage:!0})}}},VS=({sortInfo:e,stores:t})=>{const{emit:n}=i.getCurrentInstance(),o=(f=!0)=>f?["asc","desc","init"]:["asc","desc"];function s(){this.orders=o(),this.dequeue=()=>this.orders.shift(),this.enqueue=f=>this.orders.push(f)}const l=(f,m="init")=>{t.orderedColumns.forEach(p=>{p.index===(f==null?void 0:f.index)&&m?p.sortOption={sortType:m}:p.sortOption={sortType:"init"}})},a=()=>{const f=t.originColumns.filter(m=>m.hiddenDisplay||m.hide);f.length&&f.forEach(m=>{m.sortOption={sortType:"init"}})},r=new s;return{onSort:(f,m)=>{if(f.sortable===void 0?!0:f.sortable){e.sortColumn=f,e.sortField!==(f==null?void 0:f.field)&&(r.orders=o(),e.sortField=f==null?void 0:f.field),m&&(r.orders=o(),m==="desc"&&(e.sortOrder=r.dequeue(),r.enqueue(e.sortOrder))),e.sortOrder=r.dequeue(),r.enqueue(e.sortOrder),a(),l(f,e.sortOrder);const g=ai(t);n("sort-column",{field:e.sortField,order:e.sortOrder,column:e.sortColumn,columns:g}),n("change-column-info",{type:"sort",columns:g})}},setSortInfo:(f,m=!0)=>{const p=f==null?void 0:f.findIndex(x=>{var b;return(x==null?void 0:x.sortable)&&((b=x==null?void 0:x.sortOption)==null?void 0:b.sortType)&&x.sortOption.sortType!=="init"}),g=f[p];p>-1&&(g.index=p);const{sortType:u}=(g==null?void 0:g.sortOption)||{};e.sortColumn=g,e.sortField=g==null?void 0:g.field,e.isSorting=!!u,e.sortOrder=u,l(g,u),m&&n("change-column-info",{type:"sort",columns:ai(t)})},initSortInfo:f=>{e.isSorting=!1,e.sortOrder="init",f.forEach(m=>{var p;(p=m==null?void 0:m.sortOption)!=null&&p.sortType&&m.sortOption.sortType!=="init"&&(m.sortOption.sortType="init")})}}},PS={name:"EvTreeGrid",components:{TreeGridNode:wS,Toolbar:IS,GridPagination:pr,GridSummary:wr,ColumnSetting:kr,GridSortButton:Mr,GridOptionButton:Ns},directives:{observeVisibility:$i,resize:wn},props:{columns:{type:[Array],default:()=>[]},rows:{type:[Array,Object],default:()=>null},width:{type:[String,Number],default:"100%"},height:{type:[String,Number],default:"100%"},selected:{type:[Array],default:()=>[]},checked:{type:[Array],default:()=>[]},option:{type:Object,default:()=>({})},expandIcon:{type:String,default:""},collapseIcon:{type:String,default:""}},emits:{"update:selected":null,"update:checked":null,"click-row":null,"dblclick-row":null,"check-row":null,"check-all":null,"page-change":null,"sort-column":null,"toggle-row":null,"resize-column":({column:e,columns:t})=>({column:e,columns:t}),"change-column-status":({columns:e})=>({columns:e}),"change-column-info":({type:e,columns:t})=>({type:e,columns:t})},setup(e){var ri,ci,di,hi,fi,ui,mi,qt,gn;const t=i.ref(null),n=i.computed(()=>{var W,oe;return((oe=(W=e.option)==null?void 0:W.useGridSetting)==null?void 0:oe.use)||!1}),o=i.computed(()=>{var W;return((W=e.option)==null?void 0:W.useSummary)||!1}),s=i.computed(()=>e.option.emptyText??"No records"),l=i.reactive({body:null,header:null,table:null,resizeLine:null,"grid-wrapper":null}),a=i.reactive({isSearch:!1,searchWord:""}),r=i.reactive({isShowColumnSetting:!1,isFilteringColumn:!1,visibleColumnIdx:[],hiddenColumn:"",columnSettingPosition:{top:0,left:0,columnListMenuWidth:0},useDefaultColumnSetting:i.computed(()=>{var W,oe;return((oe=(W=e.option)==null?void 0:W.useGridSetting)==null?void 0:oe.useDefaultColumnSetting)??!0}),columnSettingTextInfo:{title:((ci=(ri=e.option)==null?void 0:ri.useGridSetting)==null?void 0:ci.columnMenuText)??"Column List",search:((hi=(di=e.option)==null?void 0:di.useGridSetting)==null?void 0:hi.searchText)??"Search",empty:((ui=(fi=e.option)==null?void 0:fi.useGridSetting)==null?void 0:ui.emptyText)??"No records",ok:((qt=(mi=e.option)==null?void 0:mi.useGridSetting)==null?void 0:qt.okBtnText)??"OK"}}),c=i.reactive({treeStore:[],viewStore:[],filterStore:[],pagingStore:[],originStore:[],showTreeStore:i.computed(()=>c.treeStore.filter(W=>W.show)),searchStore:i.computed(()=>c.treeStore.filter(W=>W.isFilter)),store:i.computed(()=>a.isSearch?c.searchStore:c.treeStore),treeRows:e.rows,filteredColumns:[],originColumns:i.computed(()=>e.columns.map((W,oe)=>{var he;return{index:oe,hiddenDisplay:!1,...W,width:isFinite(W.width)?W.width:void 0,sortOption:{sortType:((he=W==null?void 0:W.sortOption)==null?void 0:he.sortType)||"init"}}})),orderedColumns:i.computed(()=>c.filteredColumns.length?c.filteredColumns:c.originColumns),updatedColumns:i.computed(()=>ai(c))}),d=i.reactive({usePage:i.computed(()=>{var W;return((W=e.option.page)==null?void 0:W.use)||!1}),useClient:((gn=e.option.page)==null?void 0:gn.useClient)||!1,isInfinite:i.computed(()=>{var W;return((W=e.option.page)==null?void 0:W.isInfinite)||!1}),startIndex:0,prevPage:0,currentPage:0,pageTotal:i.computed(()=>{var W;return((W=e.option.page)==null?void 0:W.total)||0}),perPage:i.computed(()=>{var W;return((W=e.option.page)==null?void 0:W.perPage)||20}),visiblePage:i.computed(()=>{var W;return((W=e.option.page)==null?void 0:W.visiblePage)||8}),order:i.computed(()=>{var W;return((W=e.option.page)==null?void 0:W.order)||"center"}),showPageInfo:i.computed(()=>{var W;return((W=e.option.page)==null?void 0:W.showPageInfo)||!1}),isClientPaging:i.computed(()=>d.useClient&&d.usePage&&!d.isInfinite),isHighlight:!1,highlightPage:0}),h=i.reactive({prevCheckedRow:[],isHeaderChecked:!1,isHeaderUncheckable:!1,isHeaderIndeterminate:!1,checkedRows:e.checked,useCheckbox:i.computed(()=>e.option.useCheckbox||{})}),{isRenderer:f,getComponentName:m,getConvertValue:p,getColumnIndex:g,setPixelUnit:u,checkHeader:x}=vS({checkInfo:h}),b=i.reactive({lastScroll:{top:0,left:0},vScrollTopHeight:0,vScrollBottomHeight:0,hasVerticalScrollBar:!1,hasHorizontalScrollBar:!1}),y=i.reactive({selectedRow:e.selected,useSelect:i.computed(()=>{var W,oe;return((oe=(W=e.option)==null?void 0:W.useSelection)==null?void 0:oe.use)??!0}),limitCount:i.computed(()=>{var oe,he;let W=(he=(oe=e.option)==null?void 0:oe.useSelection)==null?void 0:he.limitCount;return W=W&&W>=2?W:0,W}),multiple:i.computed(()=>{var W,oe;return((oe=(W=e.option)==null?void 0:W.useSelection)==null?void 0:oe.multiple)??!1})}),w=i.reactive({isSorting:!1,sortField:"",sortOrder:"",sortColumn:{},sortFunction:e.option.customAscFunction??{}}),I=i.reactive({menu:null,contextMenuItems:[],contextMenuClass:e.option.customContextMenuClass||"",columnMenu:null,columnMenuItems:[],columnMenuTextInfo:e.option.columnMenuText||{},hiddenColumnMenuItem:e.option.hiddenColumnMenuItem||{},customContextMenu:e.option.customContextMenu||[],gridSettingMenu:null,gridSettingContextMenuItems:[],customGridSettingContextMenu:i.computed(()=>{var W,oe;return((oe=(W=e.option)==null?void 0:W.useGridSetting)==null?void 0:oe.customContextMenu)||[]}),isShowMenuOnClick:!1}),E=i.reactive({minWidth:40,rendererMinWidth:80,showResizeLine:!1,adjust:e.option.adjust||!1,columnWidth:e.option.columnWidth||80,scrollWidth:e.option.scrollWidth||17,rowHeight:i.computed(()=>e.option.rowHeight||35),gridWidth:i.computed(()=>e.width?u(e.width):"100%"),gridHeight:i.computed(()=>e.height?u(e.height):"100%"),isResize:!1}),B=i.reactive({showHeader:i.computed(()=>e.option.showHeader===void 0?!0:e.option.showHeader),stripeStyle:i.computed(()=>{var W;return((W=e.option.style)==null?void 0:W.stripe)||!1}),borderStyle:i.computed(()=>{var W;return((W=e.option.style)==null?void 0:W.border)||""}),highlightIdx:i.computed(()=>{var W;return((W=e.option.style)==null?void 0:W.highlight)??-1})}),_=()=>{y.selectedRow.length=0,c.store.forEach(W=>{W.selected=!1})},C=()=>{h.isHeaderChecked=!1,h.isHeaderIndeterminate=!1,h.checkedRows.length=0,c.store.forEach(W=>{W.checked=!1,W.indeterminate=!1})},{getPagingData:S,updatePagingInfo:M,changePage:k}=_S({stores:c,pageInfo:d,sortInfo:w,filterInfo:a,elementInfo:l,clearCheckInfo:C}),T=i.ref(0),{updateVScroll:R,updateHScroll:L,onScroll:N}=TS({scrollInfo:b,stores:c,elementInfo:l,resizeInfo:E,pageInfo:d,summaryScroll:T,getPagingData:S,updatePagingInfo:M}),{onRowClick:v,onRowDblClick:O}=DS(y),{onCheck:D,onCheckAll:V}=OS({checkInfo:h,stores:c,checkHeader:x,pageInfo:d,getPagingData:S}),{calculatedColumn:P,onResize:A,onShow:F,onColumnResize:X}=BS({resizeInfo:E,elementInfo:l,checkInfo:h,stores:c,isRenderer:f,updateVScroll:R,updateHScroll:L,contextInfo:I}),{setTreeNodeStore:U,handleExpand:H}=NS({stores:c,onResize:A}),{onSort:$,initSortInfo:j,setSortInfo:K}=VS({sortInfo:w,stores:c}),{onSearch:q}=LS({stores:c,filterInfo:a,pageInfo:d,getConvertValue:p,onResize:A,checkHeader:x,getPagingData:S,updatePagingInfo:M}),{setPositionColumnSetting:Q,initColumnSettingInfo:J,onApplyColumn:ee,setColumnHidden:G}=Er({stores:c,columnSettingInfo:r,contextInfo:I,onSearch:q,onResize:A}),{setContextMenu:ne,onContextMenu:Z,onColumnContextMenu:re,onGridSettingContextMenu:me}=RS({contextInfo:I,stores:c,selectInfo:y,useGridSetting:n,columnSettingInfo:r,setColumnHidden:G,onSort:$}),ae=W=>{I.gridSettingContextMenuItems.length=0,I.customGridSettingContextMenu.length?me(W):r.isShowColumnSetting=!0},fe=W=>{var oe,he,xe,Me,Ve,Xe;W.type==="wheel"&&((oe=I.menu)==null||oe.hide(W)),W.type==="scroll"&&!((he=W.target.classList)!=null&&he.contains("table-body"))&&!((Me=(xe=W.target.offsetParent)==null?void 0:xe.classList)!=null&&Me.contains("ev-grid-column-setting"))&&(r.isShowColumnSetting=!1,I.isShowMenuOnClick=!1,(Ve=I.columnMenu)==null||Ve.hide(W),(Xe=I.gridSettingMenu)==null||Xe.hide())};i.onMounted(()=>{var W;if(c.treeStore=U(),c.originStore=Se(c.treeStore),(W=e.option)!=null&&W.useSort)K(e.columns,!1);else{const oe=I.hiddenColumnMenuItem;oe.ascending=!0,oe.descending=!0}document.addEventListener("wheel",fe,{capture:!1}),document.addEventListener("scroll",fe,{capture:!0})}),i.onUnmounted(()=>{document.removeEventListener("wheel",fe,{capture:!1}),document.removeEventListener("scroll",fe,{capture:!0})}),i.onActivated(()=>{A()}),i.watch(()=>{var W;return(W=e.option)==null?void 0:W.useSort},W=>{const oe=e.option.hiddenColumnMenuItem,he=I.hiddenColumnMenuItem;W?(he.ascending=(oe==null?void 0:oe.ascending)??!1,he.descending=(oe==null?void 0:oe.descending)??!1,K(e.columns,!1)):(he.ascending=!0,he.descending=!0,j(e.columns))}),i.watch(()=>r.isShowColumnSetting,W=>{var oe;if(!W){(oe=I.gridSettingMenu)==null||oe.hide();return}Q(t.value)}),i.watch(()=>e.columns,()=>{J()},{deep:!0,immediate:!0}),i.watch(()=>e.checked,W=>{h.checkedRows=W}),i.watch(()=>h.checkedRows,W=>{h.isHeaderChecked=!1;let oe=c.store;d.isClientPaging&&(oe=S()),oe.length&&(oe.forEach(he=>{he.checked=!!W.find(xe=>xe.index===he.index)}),x(oe)),R()}),i.watch(()=>e.selected,W=>{y.useSelect&&(y.selectedRow=W)}),i.watch(()=>y.selectedRow,W=>{y.useSelect&&(c.store.forEach(oe=>{oe.selected=!!W.find(he=>he.index===oe.index)}),R())},{deep:!0}),i.watch(()=>B.highlightIdx,async W=>{await i.nextTick();const oe=xe=>{if(!(xe!=null&&xe.children))return;const{children:Me}=xe;Me.forEach(Ve=>{const Xe=Ve;Xe.parent.show&&Xe.parent.expand?Xe.show=!0:Xe.show=!1,Xe.isFilter=!0,Xe.hasChild&&oe(Xe)})},he=xe=>{if(!(xe!=null&&xe.parent)){oe(xe);return}const{parent:Me}=xe;Me.show=!0,Me.isFilter=!0,Me.expand=!0,oe(Me),he(Me)};if(W>=0){const xe=c.store.find(Ve=>Ve.index===W);if(!xe)return;xe.show=!0,xe.isFilter=!0,he(xe);const Me=c.showTreeStore.map(Ve=>Ve.index).indexOf(xe.index);if(d.usePage&&!d.isInfinite){const Ve=Math.ceil(Me/d.perPage);if(d.highlightPage=Me===d.perPage?Ve+1:Ve||1,d.highlightPage!==d.currentPage){d.currentPage=d.highlightPage,d.isHighlight=!0;return}}l.body.scrollTop=E.rowHeight*Me}}),i.watch(()=>h.useCheckbox.mode,()=>{h.checkedRows=[],h.isHeaderChecked=!1}),i.watch(()=>y.useSelect,()=>{_()}),i.watch(()=>y.multiple,()=>{_()}),i.watch(()=>e.rows,W=>{c.treeRows=W,c.treeStore=U(),A()},{deep:!0}),i.watch(()=>c.treeStore.length,()=>{x(c.store)}),i.watch(()=>[e.width,e.height,e.option.columnWidth],()=>{e.option.columnWidth!=null&&(E.columnWidth=e.option.columnWidth),c.orderedColumns.map(W=>{var he;const oe=W;return!((he=e.columns[W.index])!=null&&he.width)&&!oe.resized&&(oe.width=0),oe}),A()}),i.watch(()=>e.option.searchValue,W=>{i.nextTick(()=>{W!==void 0&&(q((W==null?void 0:W.value)??W),d.isClientPaging&&(C(),_()))})},{immediate:!0}),i.watch(()=>{var W;return(W=e.option.page)==null?void 0:W.currentPage},W=>{var he;const oe=W||1;d.currentPage=(he=e.option.page)!=null&&he.isInfinite?1:oe},{immediate:!0}),i.watch(()=>d.currentPage,(W,oe)=>{i.nextTick(()=>{if(k(oe),d.isClientPaging&&W!==oe&&(C(),_()),R(),W===d.highlightPage&&d.isHighlight){const he=c.pagingStore.map(xe=>xe.index).indexOf(B.highlightIdx);l.body.scrollTop=E.rowHeight*he,d.isHighlight=!d.isHighlight}})});const ke=()=>({"column-sort__icon":!0,"column-sort__icon--asc":w.sortOrder==="asc","column-sort__icon--desc":w.sortOrder==="desc"}),jt=i.computed(()=>({width:E.gridWidth,height:E.gridHeight})),Gt=i.computed(()=>({"table-body":!0,stripe:B.stripeStyle,"bottom-border":!!c.viewStore.length,"non-border":!!B.borderStyle})),mt=i.computed(()=>({table:!0,"ev-grid":!0,"ev-tree-grid":!0,adjust:E.adjust,"non-header":!B.showHeader,"ev-tree-grid--empty":!c.viewStore.length})),ho=i.computed(()=>({"table-header":!0,"non-border":!!B.borderStyle})),fo=i.computed(()=>({column:!0,"checkbox-all":!0,"non-border":!!B.borderStyle})),uo=i.computed(()=>h.useCheckbox.use&&h.useCheckbox.headerCheck&&h.useCheckbox.mode!=="single"),Zt=W=>({column:!0,render:f(W),"non-border":!!B.borderStyle,[W.field]:W.field}),Ps=(W,oe)=>{const he=f(W);return{width:`${W.width}px`,"min-width":he?`${E.rendererMinWidth}px;`:`${E.minWidth}px`,"margin-right":c.orderedColumns.length-1===oe&&b.hasVerticalScrollBar&&b.hasHorizontalScrollBar?`${E.scrollWidth}px`:"0px","border-right":c.orderedColumns.length-1===oe?"none":"1px solid #CFCFCF"}},As=W=>`${W}Node`;return{summaryScroll:T,gridStyle:jt,gridClass:mt,headerClass:ho,headerCheckboxClass:fo,isHeaderCheckbox:uo,bodyStyle:Gt,useSummary:o,useGridSetting:n,toolbarRef:t,stores:c,emptyText:s,...i.toRefs(B),...i.toRefs(l),...i.toRefs(c),...i.toRefs(a),...i.toRefs(b),...i.toRefs(E),...i.toRefs(y),...i.toRefs(h),...i.toRefs(w),...i.toRefs(I),...i.toRefs(d),...i.toRefs(r),isRenderer:f,getComponentName:m,getConvertValue:p,getColumnIndex:g,setPixelUnit:u,updateVScroll:R,updateHScroll:L,onScroll:N,calculatedColumn:P,onResize:A,onShow:F,onColumnResize:X,onRowClick:v,onRowDblClick:O,onCheck:D,onCheckAll:V,setContextMenu:ne,onContextMenu:Z,onSearch:q,handleExpand:H,getColumnClass:Zt,getColumnStyle:Ps,getSlotName:As,setGridSetting:ae,onApplyColumn:ee,onColumnContextMenu:re,onSort:$,sortIconClass:ke}}},AS={class:"column-list"},zS=["data-index"],FS=["title","onClick"],HS=["onClick"],WS=["onMousedown"],$S={ref:"table"},XS=["title"],US={key:0},YS={class:"is-empty"},jS={ref:"resizeLine",class:"table-resize-line"};function GS(e,t,n,o,s,l){var b;const a=i.resolveComponent("grid-option-button"),r=i.resolveComponent("toolbar"),c=i.resolveComponent("ev-checkbox"),d=i.resolveComponent("grid-sort-button"),h=i.resolveComponent("tree-grid-node"),f=i.resolveComponent("ev-context-menu"),m=i.resolveComponent("grid-summary"),p=i.resolveComponent("grid-pagination"),g=i.resolveComponent("column-setting"),u=i.resolveDirective("resize"),x=i.resolveDirective("observe-visibility");return i.openBlock(),i.createElementBlock(i.Fragment,null,[e.$slots.toolbar||o.useGridSetting?(i.openBlock(),i.createElementBlock("div",{key:0,ref:"toolbarRef",class:"toolbar-wrapper",style:i.normalizeStyle(`width: ${e.gridWidth};`)},[i.createVNode(r,null,{toolbarWrapper:i.withCtx(()=>[o.useGridSetting?(i.openBlock(),i.createBlock(a,{key:0,class:"grid-setting__icon",onClick:o.setGridSetting},null,8,["onClick"])):i.createCommentVNode("",!0),i.renderSlot(e.$slots,"toolbar",{item:{onSearch:o.onSearch}},void 0,!0)]),_:3})],4)):i.createCommentVNode("",!0),i.withDirectives((i.openBlock(),i.createElementBlock("div",{ref:"grid-wrapper",style:i.normalizeStyle(o.gridStyle)},[i.createElementVNode("div",{ref:"grid",class:i.normalizeClass(o.gridClass)},[i.withDirectives(i.createElementVNode("div",{ref:"header",class:i.normalizeClass(o.headerClass)},[i.createElementVNode("ul",AS,[e.useCheckbox.use?(i.openBlock(),i.createElementBlock("li",{key:0,class:i.normalizeClass(o.headerCheckboxClass),style:i.normalizeStyle({width:`${e.minWidth}px`,"border-right":"1px solid #CFCFCF"})},[o.isHeaderCheckbox?(i.openBlock(),i.createBlock(c,{key:0,modelValue:e.isHeaderChecked,"onUpdate:modelValue":t[0]||(t[0]=y=>e.isHeaderChecked=y),disabled:e.isHeaderUncheckable,indeterminate:e.isHeaderIndeterminate,onChange:o.onCheckAll},null,8,["modelValue","disabled","indeterminate","onChange"])):i.createCommentVNode("",!0)],6)):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.orderedColumns,(y,w)=>{var I,E;return i.openBlock(),i.createElementBlock(i.Fragment,{key:w},[!y.hide&&!y.hiddenDisplay?(i.openBlock(),i.createElementBlock("li",{key:0,"data-index":w,class:i.normalizeClass(o.getColumnClass(y)),style:i.normalizeStyle(o.getColumnStyle(y,w))},[y.customHeader&&e.$slots.customHeader?i.renderSlot(e.$slots,"customHeader",{key:0},void 0,!0):(i.openBlock(),i.createElementBlock("span",{key:1,title:y.caption,class:i.normalizeClass(["column-name",{"column-name--click":o.useGridSetting}]),onClick:[B=>o.onColumnContextMenu(B,y),t[1]||(t[1]=i.withModifiers((...B)=>e.columnMenu.show&&e.columnMenu.show(...B),["prevent"]))]},[i.createTextVNode(i.toDisplayString(y.caption)+" ",1),i.createElementVNode("span",{onClick:i.withModifiers(B=>o.onSort(y),["stop"])},[e.$slots.sortIcon?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[(I=e.$props.option)!=null&&I.useSort&&(y!=null&&y.sortable)?(i.openBlock(),i.createElementBlock("span",{key:0,class:"column-sort__icon column-sort__icon--basic",style:i.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`})},[i.renderSlot(e.$slots,"sortIcon",{},void 0,!0)],4)):i.createCommentVNode("",!0),e.sortField===y.field?(i.openBlock(),i.createElementBlock("span",{key:1,class:i.normalizeClass(o.sortIconClass(y)),style:i.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`})},[i.renderSlot(e.$slots,`sortIcon_${e.sortOrder}`,{},void 0,!0)],6)):i.createCommentVNode("",!0)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[(E=e.$props.option)!=null&&E.useSort&&(y!=null&&y.sortable)?(i.openBlock(),i.createBlock(d,{key:0,class:"column-sort__icon column-sort__icon--basic",icon:"basic",style:i.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`})},null,8,["style"])):i.createCommentVNode("",!0),e.sortField===y.field?(i.openBlock(),i.createBlock(d,{key:1,class:i.normalizeClass(o.sortIconClass(y)),icon:e.sortOrder,style:i.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`,visibility:e.sortOrder?y.hidden:!0})},null,8,["class","icon","style"])):i.createCommentVNode("",!0)],64))],8,HS)],10,FS)),i.createElementVNode("span",{class:"column-resize",onMousedown:i.withModifiers(B=>o.onColumnResize(w,B),["stop","left"])},null,40,WS)],14,zS)):i.createCommentVNode("",!0)],64)}),128)),(b=e.$props.option.customContextMenu)!=null&&b.length?(i.openBlock(),i.createElementBlock("li",{key:1,class:i.normalizeClass({column:!0,"non-border":!!e.borderStyle}),style:i.normalizeStyle({width:"30px","min-width":"30px","margin-right":e.hasVerticalScrollBar||e.hasHorizontalScrollBar?`${e.scrollWidth}px`:"0px"})},null,6)):i.createCommentVNode("",!0)])],2),[[i.vShow,e.showHeader]]),i.createElementVNode("div",{ref:"body",class:i.normalizeClass(o.bodyStyle),onScroll:t[2]||(t[2]=(...y)=>o.onScroll&&o.onScroll(...y)),onContextmenu:[t[3]||(t[3]=y=>o.onContextMenu(y)),t[4]||(t[4]=i.withModifiers((...y)=>e.menu.show&&e.menu.show(...y),["prevent"]))]},[i.createElementVNode("div",{style:i.normalizeStyle(`height: ${e.vScrollTopHeight}px;`),class:"vscroll-spacer"},null,4),i.createElementVNode("table",$S,[i.createElementVNode("tbody",null,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.viewStore,(y,w)=>(i.openBlock(),i.createBlock(h,{key:w,"selected-data":e.selectedRow,"node-data":y,"use-checkbox":e.useCheckbox,"ordered-columns":e.orderedColumns,"expand-icon":n.option.expandIcon,"collapse-icon":n.option.collapseIcon,"parent-icon":n.option.parentIcon,"child-icon":n.option.childIcon,"custom-context-menu":e.customContextMenu,"menu-ref":e.menu,"is-resize":e.isResize,"row-height":e.rowHeight,"min-width":e.minWidth,"highlight-index":e.highlightIdx,"border-style":e.borderStyle,onCheckTreeData:o.onCheck,onExpandTreeData:o.handleExpand,onClickTreeData:o.onRowClick,onDblClickTreeData:o.onRowDblClick,onContextMenu:o.onContextMenu},i.createSlots({_:2},[i.renderList(e.orderedColumns,(I,E)=>({name:o.getSlotName(I.field),fn:i.withCtx(({item:B})=>[e.$slots[I.field]?i.renderSlot(e.$slots,I.field,{key:0,item:{data:B.data,fieldName:I.field}},void 0,!0):(i.openBlock(),i.createElementBlock("span",{key:1,title:o.getConvertValue(I,y[I.field])},i.toDisplayString(o.getConvertValue(I,y[I.field])),9,XS))])})),e.$slots.contextmenuIcon?{name:"contextmenuIconNode",fn:i.withCtx(()=>[i.renderSlot(e.$slots,"contextmenuIcon",{},void 0,!0)]),key:"0"}:void 0]),1032,["selected-data","node-data","use-checkbox","ordered-columns","expand-icon","collapse-icon","parent-icon","child-icon","custom-context-menu","menu-ref","is-resize","row-height","min-width","highlight-index","border-style","onCheckTreeData","onExpandTreeData","onClickTreeData","onDblClickTreeData","onContextMenu"]))),128)),e.viewStore.length?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("tr",US,[i.createElementVNode("td",YS,i.toDisplayString(o.emptyText),1)]))])],512),i.createElementVNode("div",{style:i.normalizeStyle(`height: ${e.vScrollBottomHeight}px;`),class:"vscroll-spacer"},null,4),i.createVNode(f,{ref:"menu","custom-class":e.contextMenuClass,items:e.contextMenuItems},null,8,["custom-class","items"]),i.createVNode(f,{ref:"columnMenu",items:e.columnMenuItems},null,8,["items"]),i.createVNode(f,{ref:"gridSettingMenu",items:e.gridSettingContextMenuItems,"is-show-menu-on-click":e.isShowMenuOnClick},null,8,["items","is-show-menu-on-click"])],34),i.withDirectives(i.createElementVNode("div",jS,null,512),[[i.vShow,e.showResizeLine]])],2)],4)),[[u,o.onResize],[x,{callback:o.onShow,once:!0}]]),o.useSummary?(i.openBlock(),i.createBlock(m,{key:1,"is-tree":!0,"ordered-columns":e.orderedColumns,stores:o.stores,"use-checkbox":e.useCheckbox.use,"style-option":{borderStyle:e.borderStyle,minWidth:e.minWidth,rowHeight:e.rowHeight},"scroll-left":o.summaryScroll},null,8,["ordered-columns","stores","use-checkbox","style-option","scroll-left"])):i.createCommentVNode("",!0),e.usePage&&!e.isInfinite?(i.openBlock(),i.createBlock(p,{key:2,modelValue:e.currentPage,"onUpdate:modelValue":t[5]||(t[5]=y=>e.currentPage=y),total:e.showTreeStore.length,"per-page":e.perPage,"visible-page":e.visiblePage,"show-page-info":e.showPageInfo,order:e.order},null,8,["modelValue","total","per-page","visible-page","show-page-info","order"])):i.createCommentVNode("",!0),i.createVNode(g,{"is-show":e.isShowColumnSetting,"onUpdate:isShow":t[6]||(t[6]=y=>e.isShowColumnSetting=y),"is-show-menu-on-click":e.isShowMenuOnClick,"onUpdate:isShowMenuOnClick":t[7]||(t[7]=y=>e.isShowMenuOnClick=y),columns:e.updatedColumns,"hidden-column":e.hiddenColumn,position:e.columnSettingPosition,"text-info":e.columnSettingTextInfo,onApplyColumn:o.onApplyColumn},null,8,["is-show","is-show-menu-on-click","columns","hidden-column","position","text-info","onApplyColumn"])],64)}const ro=le(PS,[["render",GS],["__scopeId","data-v-4721d54a"]]);ro.install=e=>{e.component(ro.name,ro)};const ZS={name:"PageButton",props:{page:{type:Object,required:!0},disabled:{type:Boolean,default:!1}}},qS=["aria-current"];function KS(e,t,n,o,s,l){return i.openBlock(),i.createElementBlock("span",i.mergeProps({class:{"is-current":n.page.isCurrent,"is-disabled":n.disabled||n.page.disabled,[n.page.class]:!0}},e.$attrs,{"aria-current":n.page.isCurrent,onClick:t[0]||(t[0]=i.withModifiers((...a)=>n.page.click&&n.page.click(...a),["stop"]))}),[i.renderSlot(e.$slots,"default",{},()=>[i.createTextVNode(i.toDisplayString(n.page.number),1)])],16,qS)}const JS={name:"EvPagination",components:{EvIcon:hn,pageButton:le(ZS,[["render",KS]])},props:{total:{type:[Number,String],default:0},visiblePage:{type:[Number,String],default:8},perPage:{type:[Number,String],default:20},modelValue:{type:[Number,String],default:1},showPageInfo:{type:Boolean,default:!1},order:{type:String,default:"left",validator:e=>["left","right","center"].includes(e)},pagePerJump:{type:[Number,void 0],default:void 0}},emits:{"update:modelValue":null,change:null},setup(e,{emit:t}){const n=i.computed(()=>e.visiblePage>7?e.visiblePage:7),o=i.computed(()=>e.modelValue),s=i.computed(()=>e.total===0?1:Math.ceil(e.total/e.perPage)),l=i.computed(()=>o.value>1),a=i.computed(()=>o.value<s.value),r=i.computed(()=>Math.max(o.value-e.pagePerJump,1)),c=i.computed(()=>Math.min(o.value+e.pagePerJump,s.value)),d=i.computed(()=>{const u=o.value*e.perPage-e.perPage+1;return u>=0?u:0}),h=(u,x)=>{o.value===u||u<1||u>s.value||(t("update:modelValue",u),t("change",u),x&&x.target&&i.nextTick(()=>x.target.focus()))},f=(u,x={})=>({number:u,isCurrent:x.isCurrent??o.value===u,click:b=>h(u,b),input:(b,y)=>h(+y,b),disabled:x.disabled||!1,class:x.class||""}),m=(u,x)=>{const b=[],y=u>0?u:1;for(let w=y;w<=x;w++)b.push(f(w));return b},p=i.computed(()=>{const u=parseInt(n.value,10);if(u===0)return[];const x=Math.min(Math.max(0,u)||s.value,s.value);if(s.value<=x)return m(1,s.value);const b=x%2===0?1:0,y=Math.floor(x/2),w=s.value-y+1+b;if(o.value>y&&o.value<w){const E=s.value,B=o.value-y+2,_=o.value+y-2-b,C=B-1===2?2:-1,S=_+1===E-1?_+1:-1;return[f(1),f(C),...m(B,_),f(S),f(s.value)]}else if(o.value===y){const I=o.value+y-1-b;return[...m(1,I),f(-1),f(s.value)]}else if(o.value===w){const I=o.value-y+1;return[f(1),f(-1),...m(I,s.value)]}return[...m(1,y),f(-1),...m(w,s.value)]}),g=i.computed(()=>({"justify-content":e.order,flex:"3 1 0%"}));return i.watch(()=>s.value,u=>{o.value>u&&h(u)}),i.watch(()=>o.value,(u,x)=>{s.value<u&&h(x)}),{pageCount:s,pagesInRange:p,hasPrev:l,hasNext:a,listClasses:g,firstData:d,current:o,changePage:h,getPage:f,prevJumpPage:r,nextJumpPage:c}}},QS={class:"pagination"},ew={key:0,class:"pagination-info"},tw={key:0,class:"pagination-ellipsis"},nw=["onClick"];function ow(e,t,n,o,s,l){const a=i.resolveComponent("ev-icon"),r=i.resolveComponent("page-button");return i.openBlock(),i.createElementBlock("nav",QS,[n.showPageInfo?(i.openBlock(),i.createElementBlock("small",ew,[n.perPage===1?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode(i.toDisplayString(o.firstData)+" / "+i.toDisplayString(n.total),1)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(o.firstData)+" - "+i.toDisplayString(Math.min(o.current*n.perPage,n.total))+" / "+i.toDisplayString(n.total),1)],64))])):i.createCommentVNode("",!0),i.createElementVNode("ul",{class:"pagination-list",style:i.normalizeStyle(o.listClasses)},[e.$props.pagePerJump?(i.openBlock(),i.createElementBlock("li",{key:0,class:i.normalizeClass(["step-button",{"is-disabled":!o.hasPrev}])},[i.createVNode(r,{class:"pagination-previous",disabled:!o.hasPrev,page:o.getPage(o.prevJumpPage,{isCurrent:!1})},{default:i.withCtx(()=>[i.createVNode(a,{icon:"ev-icon-s-double-left"})]),_:1},8,["disabled","page"])],2)):i.createCommentVNode("",!0),i.createElementVNode("li",{class:i.normalizeClass(["step-button",{"is-disabled":!o.hasPrev}])},[i.createVNode(r,{class:"pagination-previous",disabled:!o.hasPrev,page:o.getPage(o.current-1)},{default:i.withCtx(()=>[i.createVNode(a,{icon:"ev-icon-s-arrow-left"})]),_:1},8,["disabled","page"])],2),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.pagesInRange,(c,d)=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:d},[c.number===-1?(i.openBlock(),i.createElementBlock("li",tw,[...t[0]||(t[0]=[i.createElementVNode("span",null,"…",-1)])])):(i.openBlock(),i.createElementBlock("li",{key:1,class:i.normalizeClass({"is-current":c.isCurrent,"is-page":!0}),onClick:c.click},[i.createVNode(r,{page:c},null,8,["page"])],10,nw))],64))),128)),i.createElementVNode("li",{class:i.normalizeClass(["step-button",{"is-disabled":!o.hasNext}])},[i.createVNode(r,{class:"pagination-next",disabled:!o.hasNext,page:o.getPage(o.current+1)},{default:i.withCtx(()=>[i.createVNode(a,{icon:"ev-icon-s-arrow-right"})]),_:1},8,["disabled","page"])],2),e.$props.pagePerJump?(i.openBlock(),i.createElementBlock("li",{key:1,class:i.normalizeClass(["step-button",{"is-disabled":!o.hasNext}])},[i.createVNode(r,{class:"pagination-previous",disabled:!o.hasNext,page:o.getPage(o.nextJumpPage,{isCurrent:!1})},{default:i.withCtx(()=>[i.createVNode(a,{icon:"ev-icon-s-double-right"})]),_:1},8,["disabled","page"])],2)):i.createCommentVNode("",!0)],4)])}const co=le(JS,[["render",ow]]);co.install=e=>{e.component(co.name,co)};const iw="3.4.211",sw=[kn,Mn,sn,En,ln,an,In,vn,Bn,Dn,On,Ln,Wn,hn,Un,Yn,jn,Gn,Zn,qn,Kn,Jn,Qn,eo,no,so,lo,ao,Jo,ei,ti,ro,co],lw={version:iw,install:e=>{e&&sw.forEach(t=>{e.use(t)})}};se.EvButton=sn,se.EvButtonGroup=En,se.EvCalendar=Un,se.EvChart=so,se.EvChartBrush=ao,se.EvChartGroup=lo,se.EvCheckbox=ln,se.EvCheckboxGroup=an,se.EvContextMenu=Gn,se.EvDatePicker=Yn,se.EvGrid=no,se.EvIcon=hn,se.EvInputNumber=Ln,se.EvLoading=qn,se.EvMenu=Jn,se.EvMessage=Jo,se.EvMessageBox=ti,se.EvNotification=ei,se.EvPagination=co,se.EvProgress=Kn,se.EvRadio=In,se.EvRadioGroup=vn,se.EvScheduler=jn,se.EvSelect=Bn,se.EvSlider=Wn,se.EvTabPanel=Mn,se.EvTabs=kn,se.EvTextField=On,se.EvTimePicker=eo,se.EvToggle=Dn,se.EvTree=Qn,se.EvTreeGrid=ro,se.EvWindow=Zn,se.default=lw,Object.defineProperties(se,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
28
+ 15.998 11.998C15.998 11.1696 16.6696 10.498 17.498 10.498Z`,fill:"#ADB5BD"},null,-1)])])}const Ns=le(T0,[["render",D0]]),wt=0,mn=1,de=2,to=3,Ls=4,O0=()=>{const{props:e}=i.getCurrentInstance();return{isRenderer:(a={})=>{var r;return!!((r=a==null?void 0:a.render)!=null&&r.use)},getComponentName:(a="")=>{const r=h=>h.charAt(0).toUpperCase()+h.slice(1),c="Renderer";let d="";if(a.indexOf("_")!==-1){const h=a.split("_");for(let f=0;f<h.length;f++)d+=r(h[f])}else d=r(a);return d+c},getConvertValue:(a,r)=>{let c=a.type==="number"||a.type==="float"?Number(r):r;return a.type==="number"?(c=Ht(r),c=c===!1?r:c):a.type==="float"&&(c=c.toFixed(a.decimal??3).replace(/\B(?=(\d{3})+(?!\d))/g,",")),c},getColumnIndex:a=>e.columns.findIndex(r=>r.field===a),setPixelUnit:a=>{let r=a;const c=r.toString().indexOf("px")>=0,d=r.toString().indexOf("%")>=0;return!c&&!d&&(r=`${r}px`),r}}},ii=e=>{var o;const t=((o=e.movedColumns)!=null&&o.length?e.movedColumns:e.originColumns)??[],n=new Map((e.filteredColumns??[]).map(s=>[s.index,s]));return t.map(s=>{const l=n.get(s.index)??{};return{...s,...l}})},R0=e=>{const{scrollInfo:t,stores:n,elementInfo:o,resizeInfo:s,pageInfo:l,summaryScroll:a,getPagingData:r,updatePagingInfo:c,expandedInfo:d}=e,h=g=>{var y,w;const u=o.body,x=s.rowHeight,b=d.detailRowHeight??0;if(u){let I=n.store;l.isClientPaging&&(I=r());const E=((y=d.expandedRows)==null?void 0:y.length)??0,B=((w=d.expandedRows)==null?void 0:w.map(v=>I.findIndex(O=>O[de]===v)))??[],_=I.length*x+E*b;let C=0,S=0;if(E)for(C=0;S+x<u.scrollTop;C++)B.includes(C)&&(S+=b),S+=x;else C=Math.floor(u.scrollTop/x),S=Math.max(C,0)*x;C>I.length-1&&(C=0);let M=0,k=0;if(E)for(let v=C;k<=u.clientHeight;v++)B.includes(v)&&(k+=b),k+=x,M+=1;else M=u.clientHeight>x?Math.ceil(u.clientHeight/x):I.length,k=M*x;const T=C+M+1,R=Math.max(C,0),L=T,N=o.table;n.viewStore=I.slice(R,L),t.hasVerticalScrollBar=M<I.length||u.clientHeight<N.clientHeight,t.vScrollTopHeight=S,t.vScrollBottomHeight=_-k-t.vScrollTopHeight,g&&l.isInfinite&&t.vScrollBottomHeight===0&&(l.prevPage=l.currentPage,l.currentPage=Math.ceil(L/l.perPage)+1,l.startIndex=L,c({onScrollEnd:!0}))}},f=g=>{if(d.useRowDetail&&!d.detailRowHeight){let u=n.store;l.isClientPaging&&(u=r()),n.viewStore=[...u],t.vScrollTopHeight=0,t.vScrollBottomHeight=0}else h(g)},m=()=>{const g=o.header,u=o.body,x=o.table;g.scrollLeft=u.scrollLeft,a.value=u.scrollLeft,t.hasHorizontalScrollBar=u.clientWidth<x.clientWidth};return{updateVScroll:f,updateHScroll:m,onScroll:()=>{const g=o.body,u=g.scrollTop,x=g.scrollLeft,b=t.lastScroll.top,y=t.lastScroll.left,w=x!==y;u!==b&&(g!=null&&g.clientHeight)&&f(!0),w&&m(),t.lastScroll.top=u,t.lastScroll.left=x}}},N0=e=>{const{props:t,emit:n}=i.getCurrentInstance(),{resizeInfo:o,elementInfo:s,checkInfo:l,expandedInfo:a,stores:r,isRenderer:c,updateVScroll:d,updateHScroll:h,contextInfo:f}=e,m=()=>{var y;let x=o.columnWidth,b=0;if(o.adjust){const w=s.body;let I=w.offsetWidth;const E=w.offsetHeight,B=((y=w.querySelector("tr"))==null?void 0:y.offsetHeight)||o.rowHeight,_=I-w.clientWidth,C=r.orderedColumns.reduce((S,M)=>(M.hide||M.hiddenDisplay||(M.width?S.totalWidth+=M.width:S.emptyCount++),S),{totalWidth:f.customContextMenu.length?30:0,emptyCount:0});if(B*t.rows.length>E&&(I-=_),l.useCheckbox.use&&(I-=o.minWidth),a.useRowDetail&&(I-=o.minWidth),x=I-C.totalWidth,x>0){const S=C.emptyCount===0?0:Math.floor(x/C.emptyCount);b=x-S*C.emptyCount,x=C.emptyCount!==0?S:x}else x=o.columnWidth;x=x<o.minWidth?o.minWidth:x,o.columnWidth=x}if(r.orderedColumns.forEach(w=>{const I=c(w)?o.rendererMinWidth:o.minWidth;w.width&&w.width<I&&(w.width=I),!w.width&&!w.hide&&(w.width=x)}),b&&r.orderedColumns.length){let w=r.orderedColumns.length-1,I=r.orderedColumns[w];for(;w>0&&I&&(I.hide||I.hiddenDisplay);)w-=1,I=r.orderedColumns[w];I&&(I.width+=b)}},p=()=>{const x=new Map(t.columns.map(b=>[b.field,b.width]));i.nextTick(()=>{var b,y;o.adjust&&r.orderedColumns.forEach(w=>{const I=w;return I.resized||(I.width=x.get(I.field)??0),I},void 0),m(),(b=s.body)!=null&&b.clientHeight&&d(),(y=s.body)!=null&&y.clientWidth&&h()})};return{calculatedColumn:m,onResize:p,onShow:x=>{x&&p()},onColumnResize:(x,b)=>{b.preventDefault();const y=s.header,w=s.body,I=y.getBoundingClientRect().left,E=y.querySelector(`li[data-index="${x}"]`),B=c(r.orderedColumns[x])?o.rendererMinWidth:o.minWidth,_=E.getBoundingClientRect(),C=s.resizeLine,S=_.left-I+B,M=_.right-I,k=b.clientX,T=_.left-I;w.style.overflow="auto",C.style.left=`${M}px`,o.showResizeLine=!0;const R=N=>{const v=N.clientX-k,O=M+v,D=Math.max(S,O);C.style.left=`${D}px`},L=()=>{const v=parseInt(C.style.left,10)-T;r.orderedColumns[x]&&(r.orderedColumns[x].width=v,r.orderedColumns[x].resized=!0),o.showResizeLine=!1,document.removeEventListener("mousemove",R),p();const O=ii(r);n("resize-column",{column:r.orderedColumns[x],columns:O}),n("change-column-info",{type:"resize",columns:O})};document.addEventListener("mousemove",R),document.addEventListener("mouseup",L,{once:!0})}}},L0=e=>{const{emit:t}=i.getCurrentInstance(),{selectInfo:n,stores:o}=e,s=(d,h)=>{var p;const f=(p=d.target.tagName)==null?void 0:p.toLowerCase();let m={};return f==="td"?m=d.target.dataset:m=d.target.parentNode.dataset,{event:d,rowData:h[de],rowIndex:h[wt],cellName:m.name,cellIndex:m.index}};let l=null,a=-1;return{onRowClick:(d,h,f)=>{var g,u,x;if((g=d.target.parentElement.classList)!=null&&g.contains("row-checkbox-input"))return!1;const m=!!((x=(u=d.target.closest("td"))==null?void 0:u.classList)!=null&&x.contains("row-contextmenu")),p=(b,y,w)=>{if(b==="shift"){const I=h[wt];if(a>-1)for(let E=Math.min(I,a);E<=Math.max(I,a);E++)if(!y)o.originStore[E][to]=!0,a!==E&&n.selectedRow.push(o.originStore[E][de]);else{o.originStore[E][to]=!1;const B=n.selectedRow.indexOf(o.originStore[E][de]);B>-1&&n.selectedRow.splice(B,1)}}else b==="ctrl"&&(y?n.selectedRow.splice(n.selectedRow.indexOf(h[de]),1):n.selectedRow.push(w))};return l&&clearTimeout(l),l=setTimeout(()=>{if(n.useSelect){const b=h[de],y=h[to];h[to]=!h[to];let w="";d.shiftKey?w="shift":d.ctrlKey&&(w="ctrl"),n.multiple&&w?p(w,y,b):f||m?(n.selectedRow=[...n.selectedRow],n.selectedRow.includes(b)||(n.selectedRow=[b])):y?n.selectedRow=[]:n.selectedRow=[b],a=h[wt],t("update:selected",n.selectedRow),t("click-row",s(d,h))}},100),!0},onRowDblClick:(d,h)=>{l&&clearTimeout(l),t("dblclick-row",s(d,h))}}},_0=e=>{const{checkInfo:t,stores:n,pageInfo:o,getPagingData:s}=e,{props:l,emit:a}=i.getCurrentInstance(),r=h=>{const f=n.originStore.findIndex(m=>m[de]===h[de]);f!==-1&&(n.originStore[f][mn]=h[mn])};return{onCheck:(h,f)=>{if(t.useCheckbox.mode==="single"&&t.prevCheckedRow.length&&(t.prevCheckedRow=[],r(t.prevCheckedRow)),f[mn]){t.useCheckbox.mode==="single"?t.checkedRows=[f[de]]:t.checkedRows.push(f[de]);let m=n.store;o.isClientPaging&&(m=s());const p=m.filter(g=>!l.uncheckable.includes(g[de])).filter(g=>!l.disabledRows.includes(g[de])).every(g=>g[mn]);m.length&&p&&(t.isHeaderChecked=!0),t.isHeaderIndeterminate=m.length&&!p}else t.useCheckbox.mode==="single"?t.checkedRows=[]:t.checkedRows.splice(t.checkedRows.indexOf(f[de]),1),t.isHeaderChecked=!1,t.isHeaderIndeterminate=!!(n.store.length&&t.checkedRows.length);t.prevCheckedRow=f.slice(),a("update:checked",t.checkedRows),a("check-row",h,f[wt],f[de])},onCheckAll:h=>{const f=t.isHeaderChecked;let m=n.store;o.isClientPaging&&(m=s()),m.forEach(p=>{const g=l.uncheckable.includes(p[de])||l.disabledRows.includes(p[de]);f?!t.checkedRows.includes(p[de])&&!g&&t.checkedRows.push(p[de]):t.checkedRows.splice(t.checkedRows.indexOf(p[de]),1),g||(p[mn]=f)}),t.isHeaderIndeterminate=!1,a("update:checked",t.checkedRows),a("check-all",h,t.checkedRows)}}},V0=e=>{const{expandedInfo:t}=e,{emit:n}=i.getCurrentInstance();return{onExpanded:(s,l)=>{const a=l[de],r=t.expandedRows.indexOf(a);r===-1?t.expandedRows.push(a):t.expandedRows.splice(r,1),l[Ls]=!l[Ls],n("update:expanded",t.expandedRows),n("expand-row",s,l[de],l[Ls],l[wt])}}},P0=e=>{const{sortInfo:t,stores:n,updatePagingInfo:o}=e,{emit:s}=i.getCurrentInstance(),l=(u=!0)=>u?["asc","desc","init"]:["asc","desc"];function a(){this.orders=l(),this.dequeue=()=>this.orders.shift(),this.enqueue=u=>this.orders.push(u)}const r=(u,x="init")=>{n.orderedColumns.forEach(b=>{b.index===(u==null?void 0:u.index)&&x?b.sortOption={sortType:x}:b.sortOption={sortType:"init"}})},c=()=>{const u=n.originColumns.filter(x=>x.hiddenDisplay||x.hide);u.length&&u.forEach(x=>{x.sortOption={sortType:"init"}})},d=new a,h=(u,x=!0)=>{const{sortType:b}=(u==null?void 0:u.sortOption)||{};t.sortColumn=u,t.sortField=u==null?void 0:u.field,t.sortOrder=b,t.isSorting=!!b,x&&(r(u,b),s("change-column-info",{type:"sort",columns:ii(n)}))},f=(u,x)=>{if(u.sortable===void 0?!0:u.sortable){t.sortColumn=u,t.sortField!==(u==null?void 0:u.field)&&(d.orders=l(),t.sortField=u==null?void 0:u.field),x&&(d.orders=l(),x==="desc"&&(t.sortOrder=d.dequeue(),d.enqueue(t.sortOrder))),t.sortOrder=d.dequeue(),d.enqueue(t.sortOrder),t.isSorting=!0,o({onSort:!0}),c(),r(u,t.sortOrder);const y=ii(n);s("sort-column",{field:t.sortField,order:t.sortOrder,column:t.sortColumn,columns:y}),s("change-column-info",{type:"sort",columns:y})}},m=()=>{var M;const{field:u,index:x}=t.sortColumn||{},b=((M=t.sortFunction)==null?void 0:M[u])??null,y=(k,T)=>k>T?-1:1,w=(k,T)=>k<T?-1:1,I=(k,T)=>(k===null)-(T===null)||Number(T)-Number(k),E=(k,T)=>(k===null)-(T===null)||Number(k)-Number(T);if(t.sortOrder==="init"||!t.sortField&&!t.isSorting){n.store.sort((k,T)=>typeof k[wt]=="number"?w(k[wt],T[wt]):0);return}const B=t.sortColumn.type||"string",_=t.sortOrder==="desc"?y:w,C=t.sortOrder==="desc"?I:E,S=(k,T)=>{var N,v;let R=k[de][x],L=T[de][x];return k[de][x]&&typeof k[de][x]=="object"&&(R=k[de][x][(N=n.originColumns[x])==null?void 0:N.field],L=T[de][x][(v=n.originColumns[x])==null?void 0:v.field]),{aCol:R,bCol:L}};if(b){n.store.sort((k,T)=>{const R=k[de][x],L=T[de][x],N=b(R,L);return t.sortOrder==="desc"?-N:N});return}switch(B){case"string":n.store.sort((k,T)=>{let{aCol:R,bCol:L}=S(k,T);if((!R||typeof R=="string")&&(!L||typeof L=="string")){R=R||"",L=L||"";const N=R.toLowerCase(),v=L.toLowerCase();if(R!==L&&N===v){const O=Array.from(R).findIndex((D,V)=>D!==L[V]);return _(R[O],L[O])}return _(N,v)}return 0});break;case"stringNumber":n.store.sort((k,T)=>{let{aCol:R,bCol:L}=S(k,T);return!R||typeof R=="string"||typeof R=="number"?(R=R===""?null:R,L=L===""?null:L,C(R??null,L??null)):0});break;default:n.store.sort((k,T)=>{const{aCol:R,bCol:L}=S(k,T);return!R||typeof R=="number"||typeof R=="boolean"?C(R??null,L??null):0});break}},p=()=>{var u;return(u=n.orderedColumns)==null?void 0:u.find(x=>(x==null?void 0:x.sortOption)&&l(!1).includes(x.sortOption.sortType))};return{onSort:f,getSortTarget:p,setSort:m,setSortInfo:h,hasSortTarget:()=>!!p()}},A0=e=>{const{props:t}=i.getCurrentInstance(),{columnSettingInfo:n,filterInfo:o,stores:s,checkInfo:l,pageInfo:a,getConvertValue:r,updateVScroll:c,getPagingData:d,updatePagingInfo:h,getColumnIndex:f}=e,m=E=>{let B=0;E.forEach(_=>{const C=l.checkedRows.includes(_[de]);_[mn]=C,B+=C?1:0}),E.length&&(l.isHeaderChecked=E.length===B,l.isHeaderIndeterminate=E.length!==B&&B>0,l.isHeaderUncheckable=E.every(_=>t.uncheckable.includes(_[de])||t.disabledRows.includes(_[de])))},p=(E,B,_)=>{if(typeof E!="string"||B===null)return!1;const C=B==null?void 0:B.toLowerCase(),S=E==null?void 0:E.toLowerCase();let M=C.includes(S);return _&&(_==="start"?M=C.startsWith(S):_==="end"&&(M=C.endsWith(S))),M},g=(E,B)=>{const _=B.comparison,C=B.value;let S=E[de][B.index];(S||S===0)&&(S=`${E[de][B.index]}`);let M;return _==="="?M=(C==null?void 0:C.toLowerCase())===(S==null?void 0:S.toLowerCase()):_==="!="?M=(C==null?void 0:C.toLowerCase())!==(S==null?void 0:S.toLowerCase()):_==="%s%"?M=p(C,S):_==="notLike"?M=!p(C,S):_==="s%"?M=p(C,S,"start"):_==="%s"?M=p(C,S,"end"):_==="isEmpty"?M=S==null||S==="":_==="isNotEmpty"&&(M=!!S),M},u=(E,B,_)=>{const C=B.comparison,S=Number(B.value.replace(/,/g,""));let M=Number(E[de][B.index]),k;return _==="float"&&(M=Number(M.toFixed(3))),C==="="?k=M===S:C===">"?k=M>S:C==="<"?k=M<S:C==="<="?k=M<=S:C===">="?k=M>=S:C==="!="?k=M!==S:C==="isEmpty"?k=M==null||isNaN(M):C==="isNotEmpty"&&(k=!!M||M===0),k},x=(E,B)=>{const _=B.comparison,C=B.value,S=`${E[de][B.index]}`;let M;return _==="="&&(M=S===C),M},b=(E,B,_)=>{let C=B==="string"||B==="stringNumber"?g:u;return B==="boolean"&&(C=x),E.filter(S=>C(S,_,B))||[]},y=()=>{const E=o.filteringItemsByColumn,B=Object.keys(E),_=s.originStore;let C=[],S=!1,M=[];B.forEach((k,T)=>{const R=E[k],L=f(k),N=t.columns[L].type,v=o.columnOperator==="or",O=T>0&&o.columnOperator==="and";R.forEach((D,V)=>{!C.length&&!S?C=b(_,N,{...D,index:L}):O&&D.operator==="or"?V>0?C.push(...b(M,N,{...D,index:L})):C=b(M,N,{...D,index:L}):V===0&&v||V!==0&&D.operator==="or"?C.push(...b(_,N,{...D,index:L})):C=b(C,N,{...D,index:L}),S=!0}),M=JSON.parse(JSON.stringify(C))}),S?s.filterStore=qp(C,JSON.stringify):s.filterStore=_};let w=null;return{onSearch:E=>{w&&clearTimeout(w),w=setTimeout(()=>{o.isSearch=!1,o.searchWord=E,E&&(s.searchStore=s.store.filter(B=>{let _=!1;const C=n.isFilteringColumn?B[de].filter((S,M)=>n.visibleColumnIdx.includes(M)):B[de];for(let S=0;S<s.orderedColumns.length;S++){const M=s.orderedColumns[S]||{};let k=C[M.index]??null;if(M.type=M.type||"string",k!==null&&(k instanceof Array?k=JSON.stringify(k):typeof k=="object"&&(k=k[M.field]),!M.hide&&((M==null?void 0:M.searchable)===void 0||M!=null&&M.searchable)&&(k=r(M,k).toString(),_=k.toLowerCase().includes(E.toString().toLowerCase()),_)))break}return _}),o.isSearch=!0),m(s.store),!E&&a.isClientPaging&&a.prevPage&&(a.currentPage=1,s.pagingStore=d()),h({onSearch:!0}),c()},500)},setFilter:y,setHeaderCheckboxByFilter:m}},z0=e=>{const{contextInfo:t,stores:n,selectInfo:o,onSort:s,filterInfo:l,useGridSetting:a,columnSettingInfo:r,setColumnHidden:c}=e;let d=null;const{emit:h}=i.getCurrentInstance(),f=u=>{d&&clearTimeout(d);const x=[];d=setTimeout(()=>{if(t.customContextMenu.length){const b=t.customContextMenu.map(y=>{const w=y;return w.validate&&(w.disabled=!w.validate(w.itemId,o.selectedRow)),w.selectedRow=o.selectedRow??[],w.contextmenuInfo=o.contextmenuInfo??[],w});x.push(...b)}t.contextMenuItems=x,t.menu.show(u)},200)};return{setContextMenu:f,onContextMenu:u=>{var w,I,E;u.preventDefault();const b=(I=(w=u.target.closest(".row"))==null?void 0:w.dataset)==null?void 0:I.index;let y=null;b&&(y=(E=n.viewStore.find(B=>B[wt]===+b))==null?void 0:E[de]),y&&(o.contextmenuInfo=[y],f(u))},onColumnContextMenu:(u,x)=>{var b,y,w,I,E,B,_,C;if(u.target.className==="column-name"){const S=x.sortable===void 0?!0:x.sortable,M=l.isFiltering&&x.filterable===void 0?!0:x.filterable,k=[{text:((b=t.columnMenuTextInfo)==null?void 0:b.ascending)??"Ascending",iconClass:"ev-icon-allow2-up",disabled:!S,hidden:(y=t.hiddenColumnMenuItem)==null?void 0:y.ascending,click:()=>s(x,"asc")},{text:((w=t.columnMenuTextInfo)==null?void 0:w.descending)??"Descending",iconClass:"ev-icon-allow2-down",disabled:!S,hidden:(I=t.hiddenColumnMenuItem)==null?void 0:I.descending,click:()=>s(x,"desc")},{text:((E=t.columnMenuTextInfo)==null?void 0:E.filter)??"Filter",iconClass:"ev-icon-filter-list",click:()=>{const T=document.documentElement.clientWidth,R=t.columnMenu.menuStyle.clientX,L=t.columnMenu.menuStyle.pageX,N=350;T<R+N&&(t.columnMenu.menuStyle.left=`${L-N}px`),l.filterSettingPosition={top:t.columnMenu.menuStyle.top,left:t.columnMenu.menuStyle.left},l.isShowFilterSetting=!0,l.filteringColumn=x,h("change-column-info",{type:"filter",columns:n.updatedColumns})},disabled:!M,hidden:((B=t.hiddenColumnMenuItem)==null?void 0:B.filter)||!l.isFiltering},{text:((_=t.columnMenuTextInfo)==null?void 0:_.hide)??"Hide",iconClass:"ev-icon-visibility-off",disabled:!a.value||n.orderedColumns.length===1||x.fixed,hidden:((C=t.hiddenColumnMenuItem)==null?void 0:C.hide)||!a.value,click:()=>{c(x.field),h("change-column-status",{columns:n.updatedColumns}),h("change-column-info",{type:"display",columns:n.updatedColumns})}}];if(t.columnMenuItems=[],!S&&!M&&!a.value)return;t.columnMenuItems=k.filter(T=>!T.hidden)}},onGridSettingContextMenu:u=>{const{useDefaultColumnSetting:x,columnSettingTextInfo:b}=r,y={text:(b==null?void 0:b.title)??"Column List",isShowMenu:!0,click:()=>{r.isShowColumnSetting=!0,t.isShowMenuOnClick=!0}};t.customGridSettingContextMenu.length&&(t.gridSettingContextMenuItems=[...t.customGridSettingContextMenu]),x&&t.gridSettingContextMenuItems.push(y),t.gridSettingMenu.show(u)}}},F0=e=>{const{props:t}=i.getCurrentInstance(),{selectInfo:n,checkInfo:o,stores:s,sortInfo:l,elementInfo:a,filterInfo:r,expandedInfo:c,setSort:d,setSortInfo:h,updateVScroll:f,setFilter:m}=e;return{setStore:({rows:g,isMakeIndex:u=!0,isInit:x=!1})=>{var y,w,I;const b=s.orderedColumns.find(E=>(E==null?void 0:E.sortOption)&&["asc","desc"].includes(E.sortOption.sortType));if(u){const E=[];let B=!1;g.forEach((_,C)=>{const S=t.checked.includes(_),M=t.uncheckable.includes(_)||t.disabledRows.includes(_);let k=!1;n.useSelect&&(k=t.selected.includes(_)),!S&&!M&&(B=!0);let T=!1;c.useRowDetail&&(T=t.expanded.includes(_));const R=t.disabledRows.includes(_);E.push([C,S,_,k,T,M,R])}),g.length!==t.checked.length&&(g.length===((y=t.uncheckable)==null?void 0:y.length)||g.length===((w=t.disabledRows)==null?void 0:w.length))&&(B=!0),o.isHeaderChecked=g.length>0?!B:!1,o.isHeaderIndeterminate=B&&!!o.checkedRows.length,o.isHeaderUncheckable=g.every(_=>t.uncheckable.includes(_)||t.disabledRows.includes(_)),s.originStore=E}r.isFiltering&&m(),b&&x&&h(b,!1),l.sortField&&d(),(I=a.body)!=null&&I.clientHeight&&f()}}},H0=e=>{const{emit:t}=i.getCurrentInstance(),{stores:n,pageInfo:o,sortInfo:s,filterInfo:l,elementInfo:a,clearCheckInfo:r}=e,c=()=>{const f=(o.currentPage-1)*o.perPage,m=parseInt(f,10)+parseInt(o.perPage,10);return n.store.slice(f,m)},d=f=>{t("page-change",{eventName:f,pageInfo:{currentPage:o.currentPage,prevPage:o.prevPage,startIndex:o.startIndex,total:o.pageTotal,perPage:o.perPage},sortInfo:{field:s.sortField,order:s.sortOrder},searchInfo:{searchWord:l.searchWord,searchColumns:n.orderedColumns.filter(m=>!m.hide&&((m==null?void 0:m.searchable)===void 0||(m==null?void 0:m.searchable))).map(m=>m.field)}}),o.isInfinite&&(f!=null&&f.onSearch||f!=null&&f.onSort)&&(o.currentPage=1,a.body.scrollTop=0,r())};return{getPagingData:c,updatePagingInfo:d,changePage:f=>{if(o.isClientPaging)if(o.prevPage=f,n.store.length<=o.perPage)n.pagingStore=n.store;else{const m=(o.currentPage-1)*o.perPage,p=parseInt(m,10)+parseInt(o.perPage,10);n.pagingStore=n.store.slice(m,p),a.body.scrollTop=0,o.startIndex=m}d({onChangePage:!0})}}},Er=e=>{const{props:t,emit:n}=i.getCurrentInstance(),{stores:o,columnSettingInfo:s,contextInfo:l,onSearch:a,onResize:r}=e,c=u=>{var x,b,y;if(s.isShowColumnSetting)if(s.columnSettingPosition.columnListMenuWidth=0,l.gridSettingContextMenuItems.length){const w=l.gridSettingContextMenuItems.length-1,I=(y=(b=(x=l.gridSettingMenu)==null?void 0:x.rootMenuList)==null?void 0:b.$el)==null?void 0:y.children[0].children[w].getBoundingClientRect();s.columnSettingPosition.columnListMenuWidth=I.width,s.columnSettingPosition.top=I.top,s.columnSettingPosition.left=I.right}else{const w=u==null?void 0:u.getBoundingClientRect(),I=w==null?void 0:w.height;s.columnSettingPosition.top=(w==null?void 0:w.top)+I,s.columnSettingPosition.left=w==null?void 0:w.right}},d=()=>{o.filteredColumns.length=0,s.isFilteringColumn=!1,s.visibleColumnIdx=[],s.hiddenColumn=""},h=()=>Array.isArray(o.movedColumns)&&o.movedColumns.length?o.movedColumns:o.originColumns||[],f=(u,x)=>{var y;if(!u)return;u.hiddenDisplay=x;const b=(y=o.originColumns)==null?void 0:y.find(w=>w.index===u.index);if(b&&b!==u&&(b.hiddenDisplay=x),Array.isArray(o.movedColumns)){const w=o.movedColumns.find(I=>I.index===u.index);w&&w!==u&&(w.hiddenDisplay=x)}},m=()=>{s.visibleColumnIdx=o.filteredColumns.map(b=>b.index);const u=o.originColumns.filter(b=>!b.hide||b.hiddenDisplay).map(b=>b.index),x=s.visibleColumnIdx;s.isFilteringColumn=x.length!==u.length,t.option.searchValue&&a(t.option.searchValue),r()};return{setPositionColumnSetting:c,initColumnSettingInfo:d,onApplyColumn:u=>{const x=o.orderedColumns.filter(I=>!I.hide&&!I.hiddenDisplay);if(u.length===x.length&&x.every(I=>u.includes(I.field)))return;const y=h(),w=new Set(u);o.filteredColumns=y.filter(I=>{const E=w.has(I.field)||!I.caption;return f(I,!E),E}),s.hiddenColumn="",m(),n("change-column-status",{columns:o.updatedColumns}),n("change-column-info",{type:"display",columns:o.updatedColumns})},setColumnHidden:u=>{const x=o.orderedColumns.filter(y=>!y.hide&&!y.hiddenDisplay);if(x.length===1)return;o.filteredColumns=x.filter(y=>{const w=y.field===u;return f(y,w),!w}),h().forEach(y=>{y.field===u&&f(y,!0)}),s.hiddenColumn=u,m()}}},W0=({stores:e})=>{const{emit:t}=i.getCurrentInstance(),n=r=>{var f;const c=(f=e.movedColumns)!=null&&f.length?[...e.movedColumns]:[...e.originColumns],d=[...r],h=new Set(d.map(m=>m.index));e.movedColumns=c.map(m=>h.has(m.index)?d.shift():m)},o=(r,c)=>{const d=parseInt(r,10),h=parseInt(c,10);if(!Number.isInteger(d)||!Number.isInteger(h))return;const f=[...e.orderedColumns],m=f[d];f.splice(d,1),f.splice(h,0,m),e.filteredColumns.length&&(e.filteredColumns=f),n(f)};return{onDragStart:r=>{r.dataTransfer.setData("text/plain",r.currentTarget.dataset.index)},onDragOver:r=>{r.preventDefault()},onDrop:r=>{r.preventDefault();const c=r.dataTransfer.getData("text/plain"),d=r.target.parentNode.dataset.index;o(c,d),t("change-column-order",{column:e.orderedColumns[d],columns:e.updatedColumns}),t("change-column-info",{type:"order",columns:e.updatedColumns})}}},$0={name:"EvGrid",directives:{clickoutside:Ro,observeVisibility:$i,resize:wn},components:{Toolbar:Kb,GridPagination:pr,GridSummary:wr,ColumnSetting:kr,FilterSetting:w0,GridSortButton:Mr,GridOptionButton:Ns},props:{columns:{type:[Array],default:()=>[]},rows:{type:[Array],default:()=>[]},width:{type:[String,Number],default:"100%"},height:{type:[String,Number],default:"100%"},selected:{type:[Array],default:()=>[]},checked:{type:[Array],default:()=>[]},uncheckable:{type:[Array],default:()=>[]},expanded:{type:[Array],default:()=>[]},disabledRows:{type:[Array],default:()=>[]},option:{type:Object,default:()=>({})}},emits:{"update:selected":null,"update:checked":null,"update:expanded":null,"check-row":null,"check-all":null,"click-row":null,"dblclick-row":null,"page-change":null,"sort-column":null,"expand-row":null,"resize-column":({column:e,columns:t})=>({column:e,columns:t}),"change-column-order":({column:e,columns:t})=>({column:e,columns:t}),"change-column-status":({columns:e})=>({columns:e}),"change-column-info":({type:e,columns:t})=>({type:e,columns:t})},setup(e){var Wr,$r,Xr,Ur,Yr,jr,Gr,Zr,qr;const{isRenderer:a,getComponentName:r,getConvertValue:c,getColumnIndex:d,setPixelUnit:h}=O0(),f=i.ref(null),m=i.computed(()=>{var z,te;return((te=(z=e.option)==null?void 0:z.useGridSetting)==null?void 0:te.use)||!1}),p=i.computed(()=>e.option.showHeader??!0),g=i.computed(()=>{var z;return((z=e.option)==null?void 0:z.useSummary)||!1}),u=i.computed(()=>{var z;return((z=e.option.style)==null?void 0:z.stripe)||!1}),x=i.computed(()=>{var z;return((z=e.option.style)==null?void 0:z.border)||""}),b=i.computed(()=>{var z;return((z=e.option.style)==null?void 0:z.highlight)??-1}),y=i.computed(()=>e.option.emptyText??"No records"),w=e.option.rowMinHeight||35,I=i.ref(0),E=i.reactive({body:null,header:null,table:null,resizeLine:null,"grid-wrapper":null}),B=i.reactive({isSearch:!1,searchWord:"",isFiltering:i.computed(()=>e.option.useFilter??!1),isShowFilterSetting:!1,filterSettingPosition:{left:0,top:0},filteringColumn:null,filteringItemsByColumn:{},columnOperator:"and"}),_=i.reactive({isShowColumnSetting:!1,isFilteringColumn:!1,visibleColumnIdx:[],hiddenColumn:"",columnSettingPosition:{top:0,left:0,columnListMenuWidth:0},useDefaultColumnSetting:i.computed(()=>{var z,te;return((te=(z=e.option)==null?void 0:z.useGridSetting)==null?void 0:te.useDefaultColumnSetting)??!0}),columnSettingTextInfo:{title:(($r=(Wr=e.option)==null?void 0:Wr.useGridSetting)==null?void 0:$r.columnMenuText)??"Column List",search:((Ur=(Xr=e.option)==null?void 0:Xr.useGridSetting)==null?void 0:Ur.searchText)??"Search",empty:((jr=(Yr=e.option)==null?void 0:Yr.useGridSetting)==null?void 0:jr.emptyText)??"No records",ok:((Zr=(Gr=e.option)==null?void 0:Gr.useGridSetting)==null?void 0:Zr.okBtnText)??"OK"}}),C=i.reactive({viewStore:[],originStore:[],pagingStore:[],searchStore:[],filterStore:[],store:i.computed(()=>{const z=B.isFiltering?C.filterStore:C.originStore;return B.isSearch?C.searchStore:z}),filteredColumns:[],movedColumns:[],originColumns:i.computed(()=>e.columns.map((z,te)=>{var Ce;return{index:te,hiddenDisplay:!1,...z,width:isFinite(z.width)?z.width:void 0,sortOption:{sortType:((Ce=z==null?void 0:z.sortOption)==null?void 0:Ce.sortType)||"init"}}})),orderedColumns:i.computed(()=>{const z=C.movedColumns.length?C.movedColumns:C.originColumns;return C.filteredColumns.length?C.filteredColumns:z}),updatedColumns:i.computed(()=>ii(C))}),S=i.reactive({usePage:i.computed(()=>{var z;return((z=e.option.page)==null?void 0:z.use)||!1}),useClient:((qr=e.option.page)==null?void 0:qr.useClient)||!1,isInfinite:i.computed(()=>{var z;return((z=e.option.page)==null?void 0:z.isInfinite)||!1}),startIndex:0,prevPage:0,currentPage:0,pageTotal:i.computed(()=>{var z,te;return(z=e.option.page)!=null&&z.useClient?C.store.length:(te=e.option.page)==null?void 0:te.total}),perPage:i.computed(()=>{var z;return((z=e.option.page)==null?void 0:z.perPage)||20}),visiblePage:i.computed(()=>{var z;return((z=e.option.page)==null?void 0:z.visiblePage)||8}),order:i.computed(()=>{var z;return((z=e.option.page)==null?void 0:z.order)||"center"}),showPageInfo:i.computed(()=>{var z;return((z=e.option.page)==null?void 0:z.showPageInfo)||!1}),isClientPaging:i.computed(()=>S.useClient&&S.usePage&&!S.isInfinite),isHighlight:!1,highlightPage:0}),M=i.reactive({prevCheckedRow:[],isHeaderChecked:!1,isHeaderUncheckable:!1,isHeaderIndeterminate:!1,checkedRows:e.checked,useCheckbox:i.computed(()=>e.option.useCheckbox||{})}),k=i.reactive({expandedRows:e.expanded,useRowDetail:i.computed(()=>{var z,te;return((te=(z=e.option)==null?void 0:z.rowDetail)==null?void 0:te.use)??!1}),detailRowHeight:i.computed(()=>{var z,te;return(te=(z=e.option)==null?void 0:z.rowDetail)==null?void 0:te.detailRowHeight})}),T=i.reactive({lastScroll:{top:0,left:0},vScrollTopHeight:0,vScrollBottomHeight:0,hasVerticalScrollBar:!1,hasHorizontalScrollBar:!1}),R=i.reactive({contextmenuInfo:e.contextmenuInfo,selectedRow:e.selected,useSelect:i.computed(()=>{var z,te;return((te=(z=e.option)==null?void 0:z.useSelection)==null?void 0:te.use)??!0}),multiple:i.computed(()=>{var z,te;return((te=(z=e.option)==null?void 0:z.useSelection)==null?void 0:te.multiple)??!1})}),L=i.reactive({isSorting:!1,sortField:"",sortOrder:"",sortColumn:{},sortFunction:e.option.customAscFunction??{}}),N=i.reactive({menu:null,contextMenuItems:[],contextMenuClass:e.option.customContextMenuClass||"",columnMenu:null,columnMenuItems:[],columnMenuTextInfo:e.option.columnMenuText||{},hiddenColumnMenuItem:e.option.hiddenColumnMenuItem||{},customContextMenu:e.option.customContextMenu||[],gridSettingMenu:null,gridSettingContextMenuItems:[],customGridSettingContextMenu:i.computed(()=>{var z,te;return((te=(z=e.option)==null?void 0:z.useGridSetting)==null?void 0:te.customContextMenu)||[]}),isShowMenuOnClick:!1}),v=i.reactive({minWidth:40,rendererMinWidth:80,iconWidth:42,showResizeLine:!1,adjust:e.option.adjust||!1,columnWidth:e.option.columnWidth||80,scrollWidth:e.option.scrollWidth||17,rowHeight:i.computed(()=>e.option.rowHeight>w?e.option.rowHeight:w),gridWidth:i.computed(()=>e.width?h(e.width):"100%"),gridHeight:i.computed(()=>e.height?h(e.height):"100%")}),O=()=>{M.checkedRows=[],M.isHeaderChecked=!1,M.isHeaderIndeterminate=!1,C.store.forEach(z=>{z[1]=!1})},D=()=>{R.selectedRow=[],C.store.forEach(z=>{z[3]=!1})},V=()=>{C.store.forEach(z=>{z[4]=!1}),k.expandedRows=[]},{getPagingData:P,updatePagingInfo:A,changePage:F}=H0({stores:C,pageInfo:S,sortInfo:L,filterInfo:B,elementInfo:E,clearCheckInfo:O}),X=i.ref(0),{updateVScroll:U,updateHScroll:H,onScroll:$}=R0({scrollInfo:T,stores:C,elementInfo:E,resizeInfo:v,pageInfo:S,summaryScroll:X,expandedInfo:k,getPagingData:P,updatePagingInfo:A}),{onCheck:j,onCheckAll:K}=_0({checkInfo:M,stores:C,pageInfo:S,getPagingData:P}),{onExpanded:q}=V0({expandedInfo:k}),{onSort:Q,getSortTarget:J,setSort:ee,setSortInfo:G,hasSortTarget:ne}=P0({sortInfo:L,stores:C,updatePagingInfo:A}),{onSearch:Z,setFilter:re,setHeaderCheckboxByFilter:me}=A0({columnSettingInfo:_,filterInfo:B,stores:C,checkInfo:M,pageInfo:S,getConvertValue:c,updateVScroll:U,getPagingData:P,updatePagingInfo:A,getColumnIndex:d}),{setStore:ae}=F0({selectInfo:R,checkInfo:M,stores:C,sortInfo:L,elementInfo:E,filterInfo:B,expandedInfo:k,setSort:ee,setSortInfo:G,updateVScroll:U,setFilter:re}),{calculatedColumn:fe,onResize:ke,onShow:jt,onColumnResize:Gt}=N0({resizeInfo:v,elementInfo:E,checkInfo:M,expandedInfo:k,stores:C,isRenderer:a,updateVScroll:U,updateHScroll:H,contextInfo:N}),{setPositionColumnSetting:mt,initColumnSettingInfo:ho,onApplyColumn:fo,setColumnHidden:uo}=Er({stores:C,columnSettingInfo:_,contextInfo:N,onSearch:Z,onResize:ke}),{setContextMenu:Zt,onContextMenu:Ps,onColumnContextMenu:As,onGridSettingContextMenu:ri}=z0({contextInfo:N,stores:C,selectInfo:R,useGridSetting:m,filterInfo:B,columnSettingInfo:_,setColumnHidden:uo,onSort:Q}),{onRowClick:ci,onRowDblClick:di}=L0({selectInfo:R,stores:C}),{onDragStart:hi,onDragOver:fi,onDrop:ui}=W0({stores:C}),mi=z=>{N.gridSettingContextMenuItems.length=0,N.customGridSettingContextMenu.length?ri(z):_.isShowColumnSetting=!0},qt=z=>{var te,Ce,gt,Kt,mo,kt,Je,gi,pi,Kr;z.type==="wheel"&&((te=N.menu)==null||te.hide(z)),z.type==="scroll"&&!((Ce=z.target.classList)!=null&&Ce.contains("table-body"))&&!((Kt=(gt=z.target.offsetParent)==null?void 0:gt.classList)!=null&&Kt.contains("ev-select-dropbox"))&&!((kt=(mo=z.target.offsetParent)==null?void 0:mo.classList)!=null&&kt.contains("ev-grid-column-setting"))&&!((gi=(Je=z.target.offsetParent)==null?void 0:Je.classList)!=null&&gi.contains("ev-text-field-wrapper"))&&(B.isShowFilterSetting=!1,_.isShowColumnSetting=!1,N.isShowMenuOnClick=!1,(pi=N.columnMenu)==null||pi.hide(z),(Kr=N.gridSettingMenu)==null||Kr.hide())};i.onMounted(()=>{fe(),ae({rows:e.rows,isInit:!0}),document.addEventListener("wheel",qt,{capture:!1}),document.addEventListener("scroll",qt,{capture:!0})}),i.onUnmounted(()=>{document.removeEventListener("wheel",qt,{capture:!1}),document.removeEventListener("scroll",qt,{capture:!0})}),i.onActivated(()=>{ke()}),i.onUpdated(()=>{var z;I.value=((z=E["grid-wrapper"])==null?void 0:z.offsetWidth)/1.5||0}),i.watch(()=>_.isShowColumnSetting,z=>{var te;if(!z){(te=N.gridSettingMenu)==null||te.hide();return}mt(f.value)}),i.watch(()=>e.columns,()=>{ne()?G(J()):(G(J()),ee()),B.filteringColumn=null,B.filteringItemsByColumn={},C.filterStore=[],ae({rows:[],isMakeIndex:!1}),ho(),C.movedColumns.length=0},{deep:!0}),i.watch(()=>L.isSorting,z=>{z&&(ae({rows:C.originStore,isMakeIndex:!1}),L.isSorting=!z,S.isClientPaging&&(S.currentPage=1,C.pagingStore=P(),O()))}),i.watch(()=>e.rows,z=>{ae({rows:z}),B.isSearch&&Z(B.searchWord),ke()},{deep:!0}),i.watch(()=>e.uncheckable,()=>{ae({rows:e.rows})},{deep:!0}),i.watch(()=>e.checked,z=>{M.checkedRows=z}),i.watch(()=>e.disabledRows,()=>{C.store.length&&C.store.forEach(z=>{z[6]=e.disabledRows.includes(z[2])})},{deep:!0}),i.watch(()=>M.checkedRows,z=>{M.isHeaderChecked=!1;let te=C.store;S.isClientPaging&&(te=P()),te.length&&(te.forEach(Ce=>{Ce[1]=z.includes(Ce[2])}),M.isHeaderChecked=z.length===te.length),U()}),i.watch(()=>e.selected,z=>{R.useSelect&&(R.selectedRow=z)}),i.watch(()=>R.selectedRow,z=>{R.useSelect&&(C.store.forEach(te=>{te[3]=z.includes(te[2])&&!e.disabledRows.includes(te[2])}),U())}),i.watch(()=>b.value,async z=>{if(await i.nextTick(),z>=0){if(S.usePage&&!S.isInfinite&&(S.highlightPage=Math.ceil(z/S.perPage)||1,S.highlightPage!==S.currentPage)){S.currentPage=S.highlightPage,S.isHighlight=!0;return}E.body.scrollTop=v.rowHeight*b.value}}),i.watch(()=>M.useCheckbox.mode,()=>{O()}),i.watch(()=>R.useSelect,()=>{D()}),i.watch(()=>R.multiple,()=>{D()}),i.watch(()=>e.checked.length,z=>{z||O()}),i.watch(()=>e.expanded.length,z=>{z||V(),U()}),i.watch(()=>[e.option.columnWidth,v.gridWidth],async()=>{await i.nextTick(),v.columnWidth=e.option.columnWidth;const z=E["grid-wrapper"];z.style.width=v.gridWidth,z.style.height=v.gridHeight,C.orderedColumns.map(te=>{var gt;const Ce=te;return!((gt=e.columns[te.index])!=null&&gt.width)&&!Ce.resized&&(Ce.width=0),Ce}),ke()}),i.watch(()=>e.option.searchValue,z=>{z!==void 0&&(Z((z==null?void 0:z.value)??z),S.isClientPaging&&(O(),D()))},{immediate:!0}),i.watch(()=>{var z;return(z=e.option.page)==null?void 0:z.currentPage},z=>{var Ce;const te=z||1;S.currentPage=(Ce=e.option.page)!=null&&Ce.isInfinite?1:te},{immediate:!0}),i.watch(()=>S.currentPage,(z,te)=>{i.nextTick(()=>{F(te),S.isClientPaging&&z!==te&&(O(),D()),U(),z===S.highlightPage&&S.isHighlight&&(E.body.scrollTop=v.rowHeight*b.value,S.isHighlight=!S.isHighlight)})});const gn=i.reactive({boxTop:0,boxLeft:0}),W=i.ref(null),oe=i.ref(!1),he=i.ref(!1),xe=i.ref(null),Me=i.ref({}),Ve=i.reactive({caption:"",field:""}),Xe=i.ref([]),aw=[{name:"AND",value:"and"},{name:"OR",value:"or"}],zs=i.ref(0),rw=({caption:z,field:te},Ce)=>{if(Ve.caption=z,Ve.field=te,Xe.value=Ce,(Ce==null?void 0:Ce.length)>1){oe.value=!0;const gt=W.value.getBoundingClientRect().left,Kt=window.pageYOffset+W.value.getBoundingClientRect().top+W.value.getBoundingClientRect().height;gn.boxTop=`${Kt}px`,gn.boxLeft=`${gt}px`}},cw=()=>{C.filterStore=[],ae({rows:[],isMakeIndex:!1})},Fs=async z=>{var Kt,mo;z&&he.value&&(zs.value=0);const te=(Kt=W.value)==null?void 0:Kt.getElementsByClassName("filtering-items__item"),Ce=[];let gt=0;if(te){for(let kt=0;kt<te.length;kt++){const Je=te[kt];Je.classList.remove("non-display");const gi=(mo=W.value.getBoundingClientRect())==null?void 0:mo.width,{width:pi}=Je.getBoundingClientRect();gt+=pi+10,gi-150<=gt&&!Je.classList.contains("filtering-items__item--count")?(zs.value++,Ce.push(Je),Me.value={...Me.value,[Je.dataset.field]:Se(B.filteringItemsByColumn[Je.dataset.field])}):delete Me.value[Je.dataset.field]}te.forEach(kt=>{const Je=Ce.includes(kt);kt.classList.toggle("non-display",Je)})}},dw=async(z,te)=>{te!=null&&te.length?(B.filteringItemsByColumn[z]=te,he.value=!0):(delete Me.value[z],delete B.filteringItemsByColumn[z]),await i.nextTick(),Fs(!0),B.isShowFilterSetting=!1,C.filterStore=[],ae({rows:[],isMakeIndex:!1}),me(C.filterStore)};let Hs=null;const hw=()=>{Hs&&clearTimeout(Hs),Hs=setTimeout(()=>{he.value=!he.value,Fs(he.value)},150)},fw=()=>{B.filteringColumn=null,B.filteringItemsByColumn={},Me.value={},C.filterStore=[],ae({rows:[],isMakeIndex:!1})},uw=i.computed(()=>{var z;return{width:`${I.value}px`,top:`${((z=W.value)==null?void 0:z.getBoundingClientRect().height)||0}px`}}),mw=z=>{const te=B.filteringItemsByColumn[z];return te==null?void 0:te[te.length-1]},gw=()=>{const z=document.createElement("div");z.id="ev-grid-filtering-items-modal",z.setAttribute("style","position: absolute; top: 0; left: 0;"),document.getElementById("ev-grid-filtering-items-modal")||document.body.appendChild(z)};return i.onBeforeMount(()=>gw()),{idColIndex:i.computed(()=>{var z;return(z=C.orderedColumns.find(te=>te.field==="id"))==null?void 0:z.index}),summaryScroll:X,showHeader:p,stripeStyle:u,borderStyle:x,highlightIdx:b,useSummary:g,useGridSetting:m,toolbarRef:f,stores:C,emptyText:y,...i.toRefs(E),...i.toRefs(C),...i.toRefs(B),...i.toRefs(T),...i.toRefs(S),...i.toRefs(v),...i.toRefs(R),...i.toRefs(M),...i.toRefs(k),...i.toRefs(L),...i.toRefs(N),...i.toRefs(_),isRenderer:a,getComponentName:r,getConvertValue:c,getColumnIndex:d,setPixelUnit:h,updateVScroll:U,updateHScroll:H,onScroll:$,calculatedColumn:fe,onResize:ke,onShow:jt,onColumnResize:Gt,onRowClick:ci,onRowDblClick:di,onCheck:j,onCheckAll:K,onExpanded:q,onSort:Q,setSort:ee,setStore:ae,setContextMenu:Zt,onContextMenu:Ps,onSearch:Z,setGridSetting:mi,onApplyColumn:fo,onColumnContextMenu:As,filteringItemsWidth:I,isShowColumnFilteringItems:he,operatorItems:aw,selectedFilteringItems:Xe,selectedFilteringColumn:Ve,filteringItemsRef:W,isShowFilteringItemsBox:oe,filteringItemsStyle:uw,hiddenFilteringItemsCount:zs,...i.toRefs(gn),hiddenFilteringItemsRef:xe,hiddenFilteringItemsByColumn:Me,removeAllFiltering:fw,onExpandFilteringItems:hw,setColumnFilteringItems:Fs,onChangeOperator:cw,onApplyFilter:dw,onClickFilteringItem:rw,getFilteringItemByField:mw,onDragStart:hi,onDragOver:fi,onDrop:ui,ROW_DISABLED_INDEX:6}}},X0={key:0,class:"filtering-items filtering-items--used"},U0={key:1,ref:"filteringItemsRef",class:"filtering-items"},Y0=["data-field","onClick"],j0={class:"filtering-items__item--title"},G0=["title"],Z0={key:1,class:"filtering-items__item--value"},q0=["onClick"],K0={class:"filtering-items__item--title"},J0=["title"],Q0={key:1,class:"filtering-items__item--value"},eC={class:"column-list"},tC=["data-index"],nC=["title","onClick"],oC=["onClick"],iC=["onMousedown"],sC={ref:"table"},lC=["data-index","disabled","onClick","onContextmenu","onDblclick"],aC=["data-name","data-index","disabled"],rC={key:0},cC=["title"],dC=["disabled"],hC=["disabled"],fC={key:0},uC=["colspan"],mC={key:0},gC={class:"is-empty"},pC={ref:"resizeLine",class:"table-resize-line"};function yC(e,t,n,o,s,l){var I;const a=i.resolveComponent("ev-icon"),r=i.resolveComponent("ev-select"),c=i.resolveComponent("grid-option-button"),d=i.resolveComponent("toolbar"),h=i.resolveComponent("ev-checkbox"),f=i.resolveComponent("grid-sort-button"),m=i.resolveComponent("ev-context-menu"),p=i.resolveComponent("grid-summary"),g=i.resolveComponent("grid-pagination"),u=i.resolveComponent("filter-setting"),x=i.resolveComponent("column-setting"),b=i.resolveDirective("clickoutside"),y=i.resolveDirective("resize"),w=i.resolveDirective("observe-visibility");return i.openBlock(),i.createElementBlock(i.Fragment,null,[e.$slots.toolbar||o.useGridSetting?(i.openBlock(),i.createElementBlock("div",{key:0,ref:"toolbarRef",class:"toolbar-wrapper",style:i.normalizeStyle(`width: ${e.gridWidth};`)},[i.createVNode(d,null,{toolbarWrapper:i.withCtx(()=>[i.createElementVNode("div",{class:"filtering",style:i.normalizeStyle({width:`${o.filteringItemsWidth}px`})},[e.isFiltering&&!Object.keys(e.filteringItemsByColumn).length?(i.openBlock(),i.createElementBlock("div",X0,[i.createVNode(a,{icon:"ev-icon-filter-list"}),t[18]||(t[18]=i.createElementVNode("span",null,"Filter",-1))])):i.createCommentVNode("",!0),e.isFiltering&&Object.keys(e.filteringItemsByColumn).length?(i.openBlock(),i.createElementBlock("div",U0,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(Object.keys(e.filteringItemsByColumn),(E,B)=>{var _,C,S,M;return i.openBlock(),i.createElementBlock(i.Fragment,{key:B},[B===0?(i.openBlock(),i.createElementBlock("div",{key:0,class:"filtering-items__item filtering-items__item--filter",onClick:t[0]||(t[0]=i.withModifiers((...k)=>o.onExpandFilteringItems&&o.onExpandFilteringItems(...k),["stop"]))},[i.createVNode(a,{icon:"ev-icon-filter-list",class:"filtering-items-expand"}),i.createElementVNode("span",null," Filter ("+i.toDisplayString(Object.keys(e.filteringItemsByColumn).length)+") ",1),i.createVNode(a,{class:"filtering-items__item--remove",icon:"ev-icon-s-close",style:{"margin-left":"0"},onClick:i.withModifiers(o.removeAllFiltering,["stop"])},null,8,["onClick"])])):i.createCommentVNode("",!0),B===1?(i.openBlock(),i.createBlock(r,{key:1,modelValue:e.columnOperator,"onUpdate:modelValue":t[1]||(t[1]=k=>e.columnOperator=k),items:o.operatorItems,class:"filtering-items__item--operator",onChange:o.onChangeOperator},null,8,["modelValue","items","onChange"])):i.createCommentVNode("",!0),i.createElementVNode("div",{class:"filtering-items__item non-display","data-field":E,onClick:i.withModifiers(k=>{var T;return o.onClickFilteringItem({caption:(T=o.getFilteringItemByField(E))==null?void 0:T.caption,field:E},e.filteringItemsByColumn[E])},["stop"])},[i.createElementVNode("span",j0,i.toDisplayString((_=o.getFilteringItemByField(E))==null?void 0:_.caption)+" "+i.toDisplayString((C=o.getFilteringItemByField(E))==null?void 0:C.comparison),1),e.filteringItemsByColumn[E].length<2?(i.openBlock(),i.createElementBlock("span",{key:0,class:"filtering-items__item--value",title:(S=o.getFilteringItemByField(E))==null?void 0:S.value},i.toDisplayString((M=o.getFilteringItemByField(E))==null?void 0:M.value),9,G0)):(i.openBlock(),i.createElementBlock("span",Z0," + "+i.toDisplayString(e.filteringItemsByColumn[E].length),1)),i.createVNode(a,{class:"filtering-items__item--remove",icon:"ev-icon-s-close",onClick:k=>o.onApplyFilter(E,[])},null,8,["onClick"])],8,Y0)],64)}),128)),o.isShowColumnFilteringItems&&Object.keys(e.filteringItemsByColumn).length&&o.hiddenFilteringItemsCount>0?(i.openBlock(),i.createElementBlock("div",{key:0,class:"filtering-items__item filtering-items__item--count",onClick:t[2]||(t[2]=(...E)=>o.onExpandFilteringItems&&o.onExpandFilteringItems(...E))}," + "+i.toDisplayString(o.hiddenFilteringItemsCount),1)):i.createCommentVNode("",!0)],512)):i.createCommentVNode("",!0),!o.isShowColumnFilteringItems&&Object.keys(o.hiddenFilteringItemsByColumn).length?i.withDirectives((i.openBlock(),i.createElementBlock("div",{key:2,ref:"hiddenFilteringItemsRef",class:"filtering-items filtering-items__hidden-items",style:i.normalizeStyle(o.filteringItemsStyle)},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(Object.keys(o.hiddenFilteringItemsByColumn),(E,B)=>{var _,C,S,M;return i.openBlock(),i.createElementBlock("div",{key:B,class:"filtering-items__item",onClick:i.withModifiers(k=>{var T;return o.onClickFilteringItem({caption:(T=o.getFilteringItemByField(E))==null?void 0:T.caption,field:E},o.hiddenFilteringItemsByColumn[E])},["stop"])},[i.createElementVNode("span",K0,i.toDisplayString((_=o.getFilteringItemByField(E))==null?void 0:_.caption)+" "+i.toDisplayString((C=o.getFilteringItemByField(E))==null?void 0:C.comparison),1),o.hiddenFilteringItemsByColumn[E].length<2?(i.openBlock(),i.createElementBlock("span",{key:0,class:"filtering-items__item--value",title:(S=o.getFilteringItemByField(E))==null?void 0:S.value},i.toDisplayString((M=o.getFilteringItemByField(E))==null?void 0:M.value),9,J0)):(i.openBlock(),i.createElementBlock("span",Q0," + "+i.toDisplayString(o.hiddenFilteringItemsByColumn[E].length),1)),i.createVNode(a,{class:"filtering-items__item--remove",icon:"ev-icon-s-close",onClick:k=>o.onApplyFilter(E,[],!0)},null,8,["onClick"])],8,q0)}),128))],4)),[[b,()=>{o.isShowColumnFilteringItems||o.onExpandFilteringItems()}]]):i.createCommentVNode("",!0)],4),o.useGridSetting?(i.openBlock(),i.createBlock(c,{key:0,class:"grid-setting__icon",onClick:t[3]||(t[3]=E=>o.setGridSetting(E))})):i.createCommentVNode("",!0),i.renderSlot(e.$slots,"toolbar",{item:{onSearch:o.onSearch}},void 0,!0)]),_:3})],4)):i.createCommentVNode("",!0),i.withDirectives((i.openBlock(),i.createElementBlock("div",i.mergeProps({ref:"grid-wrapper"},e.$attrs,{class:"grid-wrapper",style:`width: ${e.gridWidth}; height: ${e.gridHeight};`}),[i.createElementVNode("div",{ref:"grid",class:i.normalizeClass({table:!0,adjust:e.adjust,"ev-grid":!0,"non-header":!o.showHeader,"ev-grid--empty":!e.viewStore.length})},[i.withDirectives(i.createElementVNode("div",{ref:"header",class:i.normalizeClass({"table-header":!0,"non-border":!!o.borderStyle})},[i.createElementVNode("ul",eC,[e.useCheckbox.use?(i.openBlock(),i.createElementBlock("li",{key:0,class:i.normalizeClass({column:!0,"checkbox-all":!0,"non-border":!!o.borderStyle}),style:i.normalizeStyle({width:`${e.minWidth}px`,"border-right":"1px solid #CFCFCF"})},[e.useCheckbox.use&&e.useCheckbox.headerCheck&&e.useCheckbox.mode!=="single"?(i.openBlock(),i.createBlock(h,{key:0,modelValue:e.isHeaderChecked,"onUpdate:modelValue":t[4]||(t[4]=E=>e.isHeaderChecked=E),disabled:e.isHeaderUncheckable,indeterminate:e.isHeaderIndeterminate,onChange:o.onCheckAll},null,8,["modelValue","disabled","indeterminate","onChange"])):i.createCommentVNode("",!0)],6)):i.createCommentVNode("",!0),e.useRowDetail?(i.openBlock(),i.createElementBlock("li",{key:1,class:i.normalizeClass({column:!0,"non-border":!!o.borderStyle}),style:i.normalizeStyle({width:`${e.minWidth}px`,"border-right":"1px solid #CFCFCF"})},null,6)):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.orderedColumns,(E,B)=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:B},[!E.hide&&!E.hiddenDisplay?(i.openBlock(),i.createElementBlock("li",{key:0,"data-index":B,class:i.normalizeClass({column:!0,render:o.isRenderer(E),"non-border":!!o.borderStyle,[E.field]:E.field}),style:i.normalizeStyle({width:`${E.width}px`,"min-width":`${o.isRenderer(E)?e.rendererMinWidth:e.minWidth}px`,"margin-right":e.orderedColumns.length-1===B&&(e.hasVerticalScrollBar||e.hasHorizontalScrollBar)?`${e.scrollWidth}px`:"0px","border-right":e.orderedColumns.length-1===B?"none":"1px solid #CFCFCF"}),draggable:!0,onDragstart:t[6]||(t[6]=(..._)=>o.onDragStart&&o.onDragStart(..._)),onDragover:t[7]||(t[7]=(..._)=>o.onDragOver&&o.onDragOver(..._)),onDrop:t[8]||(t[8]=(..._)=>o.onDrop&&o.onDrop(..._))},[E.customHeader&&e.$slots.customHeader?i.renderSlot(e.$slots,"customHeader",{key:0},void 0,!0):(i.openBlock(),i.createElementBlock("span",{key:1,title:E.caption,class:"column-name",onClick:[_=>o.onColumnContextMenu(_,E),t[5]||(t[5]=i.withModifiers((..._)=>e.columnMenu.show&&e.columnMenu.show(..._),["prevent"]))]},[i.createTextVNode(i.toDisplayString(E.caption)+" ",1),i.createElementVNode("span",{onClick:i.withModifiers(_=>o.onSort(E),["stop"])},[e.$slots.sortIcon?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[E.sortable===void 0||E.sortable?(i.openBlock(),i.createElementBlock("span",{key:0,class:"column-sort__icon column-sort__icon--basic",style:i.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`})},[i.renderSlot(e.$slots,"sortIcon",{},void 0,!0)],4)):i.createCommentVNode("",!0),e.sortField===E.field?(i.openBlock(),i.createElementBlock("span",{key:1,class:i.normalizeClass([{"column-sort__icon":!0,"column-sort__icon--asc":e.sortOrder==="asc","column-sort__icon--desc":e.sortOrder==="desc"}]),style:i.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`})},[i.renderSlot(e.$slots,`sortIcon_${e.sortOrder}`,{},void 0,!0)],6)):i.createCommentVNode("",!0)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[E.sortable===void 0||E.sortable?(i.openBlock(),i.createBlock(f,{key:0,class:"column-sort__icon column-sort__icon--basic",icon:"basic",style:i.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`})},null,8,["style"])):i.createCommentVNode("",!0),e.sortField===E.field?(i.openBlock(),i.createBlock(f,{key:1,class:i.normalizeClass([{"column-sort__icon":!0,"column-sort__icon--asc":e.sortOrder==="asc","column-sort__icon--desc":e.sortOrder==="desc"}]),icon:e.sortOrder,style:i.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`,visibility:e.sortOrder?E.hidden:!0})},null,8,["class","icon","style"])):i.createCommentVNode("",!0)],64))],8,oC)],8,nC)),i.createElementVNode("span",{class:"column-resize",onMousedown:i.withModifiers(_=>o.onColumnResize(B,_),["stop","left"])},null,40,iC)],46,tC)):i.createCommentVNode("",!0)],64))),128)),(I=e.$props.option.customContextMenu)!=null&&I.length?(i.openBlock(),i.createElementBlock("li",{key:2,class:i.normalizeClass({column:!0,"non-border":!!o.borderStyle}),style:i.normalizeStyle({width:"30px","min-width":"30px","margin-right":e.hasVerticalScrollBar||e.hasHorizontalScrollBar?`${e.scrollWidth}px`:"0px"})},null,6)):i.createCommentVNode("",!0)])],2),[[i.vShow,o.showHeader]]),i.createElementVNode("div",{ref:"body",class:i.normalizeClass({stripe:o.stripeStyle,"table-body":!0,"bottom-border":!!e.viewStore.length,"non-border":!!o.borderStyle}),onScroll:t[11]||(t[11]=(...E)=>o.onScroll&&o.onScroll(...E)),onContextmenu:t[12]||(t[12]=E=>o.onContextMenu(E))},[i.createElementVNode("div",{style:i.normalizeStyle(`height: ${e.vScrollTopHeight}px;`),class:"vscroll-spacer"},null,4),i.createElementVNode("table",sC,[i.createElementVNode("tbody",null,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.viewStore,(E,B)=>{var _,C;return i.openBlock(),i.createElementBlock(i.Fragment,{key:o.idColIndex!=null?E[2][o.idColIndex]:B},[i.createElementVNode("tr",{"data-index":E[0],class:i.normalizeClass({row:!0,selected:E[3],highlight:E[0]===o.highlightIdx,"non-border":!!o.borderStyle&&o.borderStyle!=="rows"}),disabled:E[o.ROW_DISABLED_INDEX],onClick:S=>o.onRowClick(S,E),onContextmenu:S=>o.onRowClick(S,E,!0),onDblclick:S=>o.onRowDblClick(S,E)},[e.useCheckbox.use?(i.openBlock(),i.createElementBlock("td",{key:0,class:i.normalizeClass({cell:!0,"row-checkbox":!0,"non-border":!!o.borderStyle}),style:i.normalizeStyle({width:`${e.minWidth}px`,height:`${e.rowHeight}px`,"border-right":"1px solid #CFCFCF"})},[i.createVNode(h,{modelValue:E[1],"onUpdate:modelValue":S=>E[1]=S,class:"row-checkbox-input",disabled:E[5]||E[o.ROW_DISABLED_INDEX],onChange:S=>o.onCheck(S,E)},null,8,["modelValue","onUpdate:modelValue","disabled","onChange"])],6)):i.createCommentVNode("",!0),e.useRowDetail?(i.openBlock(),i.createElementBlock("td",{key:1,class:i.normalizeClass({cell:!0,"row-detail-toggle":!0,"non-border":!!o.borderStyle,"row-detail-toggle--expanded":E[4]}),style:i.normalizeStyle({width:`${e.minWidth}px`,height:`${e.rowHeight}px`,"border-right":"1px solid #CFCFCF"})},[i.createVNode(a,{modelValue:E[4],"onUpdate:modelValue":S=>E[4]=S,icon:"ev-icon-s-play",class:"row-detail-toggle-icon",onClick:i.withModifiers(S=>o.onExpanded(S,E),["stop"])},null,8,["modelValue","onUpdate:modelValue","onClick"])],6)):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.orderedColumns,(S,M)=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:`${o.idColIndex!=null?E[2][o.idColIndex]:B}-${M}`},[!S.hide&&!S.hiddenDisplay?(i.openBlock(),i.createElementBlock("td",{key:0,"data-name":S.field,"data-index":S.index,class:i.normalizeClass({cell:!0,render:o.isRenderer(S),[S.type]:S.type,[S.align]:S.align,[S.field]:S.field,"non-border":!!o.borderStyle}),style:i.normalizeStyle({width:`${S.width}px`,height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`,"min-width":`${o.isRenderer(S)?e.rendererMinWidth:e.minWidth}px`,"border-right":e.orderedColumns.length-1===M?"none":"1px solid #CFCFCF"}),disabled:E[o.ROW_DISABLED_INDEX]},[e.$slots[S.field]?(i.openBlock(),i.createElementBlock("div",rC,[i.renderSlot(e.$slots,S.field,{item:{row:E,column:S},disabled:E[o.ROW_DISABLED_INDEX]},void 0,!0)])):(i.openBlock(),i.createElementBlock("div",{key:1,title:o.getConvertValue(S,E[2][S.index])},i.toDisplayString(o.getConvertValue(S,E[2][S.index])),9,cC))],14,aC)):i.createCommentVNode("",!0)],64))),128)),(_=e.$props.option.customContextMenu)!=null&&_.length?(i.openBlock(),i.createElementBlock("td",{key:2,class:i.normalizeClass({"row-contextmenu":!0,"non-border":!!o.borderStyle}),style:i.normalizeStyle({position:"sticky",right:0,width:"30px",height:`${e.rowHeight}px`,"min-width":"30px","line-height":`${e.rowHeight}px`}),disabled:E[o.ROW_DISABLED_INDEX]},[e.$slots.contextmenuIcon?(i.openBlock(),i.createElementBlock("span",{key:0,class:"row-contextmenu__btn",disabled:E[o.ROW_DISABLED_INDEX],onClick:t[9]||(t[9]=S=>o.onContextMenu(S))},[i.renderSlot(e.$slots,"contextmenuIcon",{},void 0,!0)],8,hC)):(i.openBlock(),i.createBlock(c,{key:1,icon:"ev-icon-warning2",class:"row-contextmenu__btn",disabled:E[o.ROW_DISABLED_INDEX],onClick:t[10]||(t[10]=S=>o.onContextMenu(S))},null,8,["disabled"]))],14,dC)):i.createCommentVNode("",!0)],42,lC),e.useRowDetail&&((C=e.$slots)!=null&&C.rowDetail)&&E[4]?(i.openBlock(),i.createElementBlock("tr",fC,[i.createElementVNode("td",{colspan:E.length},[i.createElementVNode("div",{style:i.normalizeStyle({width:"100%",height:`${e.detailRowHeight}px`,"min-height":`${e.detailRowHeight}px`,"max-height":`${e.detailRowHeight}px`})},[i.renderSlot(e.$slots,"rowDetail",{item:{row:E}},void 0,!0)],4)],8,uC)])):i.createCommentVNode("",!0)],64)}),128)),e.viewStore.length?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("tr",mC,[i.createElementVNode("td",gC,i.toDisplayString(o.emptyText),1)]))])],512),i.createElementVNode("div",{style:i.normalizeStyle(`height: ${e.vScrollBottomHeight}px;`),class:"vscroll-spacer"},null,4),i.createVNode(m,{ref:"menu","custom-class":e.contextMenuClass,items:e.contextMenuItems},null,8,["custom-class","items"]),i.createVNode(m,{ref:"columnMenu",items:e.columnMenuItems},null,8,["items"]),i.createVNode(m,{ref:"gridSettingMenu",items:e.gridSettingContextMenuItems,"is-show-menu-on-click":e.isShowMenuOnClick},null,8,["items","is-show-menu-on-click"])],34),i.withDirectives(i.createElementVNode("div",pC,null,512),[[i.vShow,e.showResizeLine]])],2)],16)),[[y,o.onResize],[w,{callback:o.onShow,once:!0}]]),o.useSummary?(i.openBlock(),i.createBlock(p,{key:1,"ordered-columns":e.orderedColumns,stores:o.stores,"use-checkbox":e.useCheckbox.use,"style-option":{borderStyle:o.borderStyle,minWidth:e.minWidth,rowHeight:e.rowHeight},"scroll-left":o.summaryScroll},null,8,["ordered-columns","stores","use-checkbox","style-option","scroll-left"])):i.createCommentVNode("",!0),e.usePage&&!e.isInfinite?(i.openBlock(),i.createBlock(g,{key:2,modelValue:e.currentPage,"onUpdate:modelValue":t[13]||(t[13]=E=>e.currentPage=E),total:e.pageTotal,"per-page":e.perPage,"visible-page":e.visiblePage,"show-page-info":e.showPageInfo,order:e.order},null,8,["modelValue","total","per-page","visible-page","show-page-info","order"])):i.createCommentVNode("",!0),i.createVNode(u,{"is-show":e.isShowFilterSetting,"onUpdate:isShow":t[14]||(t[14]=E=>e.isShowFilterSetting=E),items:e.filteringItemsByColumn,"onUpdate:items":t[15]||(t[15]=E=>e.filteringItemsByColumn=E),column:e.filteringColumn,position:e.filterSettingPosition,onApplyFiltering:o.onApplyFilter},null,8,["is-show","items","column","position","onApplyFiltering"]),i.createVNode(x,{"is-show":e.isShowColumnSetting,"onUpdate:isShow":t[16]||(t[16]=E=>e.isShowColumnSetting=E),"is-show-menu-on-click":e.isShowMenuOnClick,"onUpdate:isShowMenuOnClick":t[17]||(t[17]=E=>e.isShowMenuOnClick=E),columns:e.updatedColumns,"hidden-column":e.hiddenColumn,position:e.columnSettingPosition,"text-info":e.columnSettingTextInfo,onApplyColumn:o.onApplyColumn},null,8,["is-show","is-show-menu-on-click","columns","hidden-column","position","text-info","onApplyColumn"])],64)}const no=le($0,[["render",yC],["__scopeId","data-v-f8886e09"]]);no.install=e=>{e.component(no.name,no)};var Ir={exports:{}};(function(e,t){(function(n,o){e.exports=o()})(Xi,function(){var n=1e3,o=6e4,s=36e5,l="millisecond",a="second",r="minute",c="hour",d="day",h="week",f="month",m="quarter",p="year",g="date",u="Invalid Date",x=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,y={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(L){var N=["th","st","nd","rd"],v=L%100;return"["+L+(N[(v-20)%10]||N[v]||N[0])+"]"}},w=function(L,N,v){var O=String(L);return!O||O.length>=N?L:""+Array(N+1-O.length).join(v)+L},I={s:w,z:function(L){var N=-L.utcOffset(),v=Math.abs(N),O=Math.floor(v/60),D=v%60;return(N<=0?"+":"-")+w(O,2,"0")+":"+w(D,2,"0")},m:function L(N,v){if(N.date()<v.date())return-L(v,N);var O=12*(v.year()-N.year())+(v.month()-N.month()),D=N.clone().add(O,f),V=v-D<0,P=N.clone().add(O+(V?-1:1),f);return+(-(O+(v-D)/(V?D-P:P-D))||0)},a:function(L){return L<0?Math.ceil(L)||0:Math.floor(L)},p:function(L){return{M:f,y:p,w:h,d,D:g,h:c,m:r,s:a,ms:l,Q:m}[L]||String(L||"").toLowerCase().replace(/s$/,"")},u:function(L){return L===void 0}},E="en",B={};B[E]=y;var _="$isDayjsObject",C=function(L){return L instanceof T||!(!L||!L[_])},S=function L(N,v,O){var D;if(!N)return E;if(typeof N=="string"){var V=N.toLowerCase();B[V]&&(D=V),v&&(B[V]=v,D=V);var P=N.split("-");if(!D&&P.length>1)return L(P[0])}else{var A=N.name;B[A]=N,D=A}return!O&&D&&(E=D),D||!O&&E},M=function(L,N){if(C(L))return L.clone();var v=typeof N=="object"?N:{};return v.date=L,v.args=arguments,new T(v)},k=I;k.l=S,k.i=C,k.w=function(L,N){return M(L,{locale:N.$L,utc:N.$u,x:N.$x,$offset:N.$offset})};var T=function(){function L(v){this.$L=S(v.locale,null,!0),this.parse(v),this.$x=this.$x||v.x||{},this[_]=!0}var N=L.prototype;return N.parse=function(v){this.$d=function(O){var D=O.date,V=O.utc;if(D===null)return new Date(NaN);if(k.u(D))return new Date;if(D instanceof Date)return new Date(D);if(typeof D=="string"&&!/Z$/i.test(D)){var P=D.match(x);if(P){var A=P[2]-1||0,F=(P[7]||"0").substring(0,3);return V?new Date(Date.UTC(P[1],A,P[3]||1,P[4]||0,P[5]||0,P[6]||0,F)):new Date(P[1],A,P[3]||1,P[4]||0,P[5]||0,P[6]||0,F)}}return new Date(D)}(v),this.init()},N.init=function(){var v=this.$d;this.$y=v.getFullYear(),this.$M=v.getMonth(),this.$D=v.getDate(),this.$W=v.getDay(),this.$H=v.getHours(),this.$m=v.getMinutes(),this.$s=v.getSeconds(),this.$ms=v.getMilliseconds()},N.$utils=function(){return k},N.isValid=function(){return this.$d.toString()!==u},N.isSame=function(v,O){var D=M(v);return this.startOf(O)<=D&&D<=this.endOf(O)},N.isAfter=function(v,O){return M(v)<this.startOf(O)},N.isBefore=function(v,O){return this.endOf(O)<M(v)},N.$g=function(v,O,D){return k.u(v)?this[O]:this.set(D,v)},N.unix=function(){return Math.floor(this.valueOf()/1e3)},N.valueOf=function(){return this.$d.getTime()},N.startOf=function(v,O){var D=this,V=!!k.u(O)||O,P=k.p(v),A=function(q,Q){var J=k.w(D.$u?Date.UTC(D.$y,Q,q):new Date(D.$y,Q,q),D);return V?J:J.endOf(d)},F=function(q,Q){return k.w(D.toDate()[q].apply(D.toDate("s"),(V?[0,0,0,0]:[23,59,59,999]).slice(Q)),D)},X=this.$W,U=this.$M,H=this.$D,$="set"+(this.$u?"UTC":"");switch(P){case p:return V?A(1,0):A(31,11);case f:return V?A(1,U):A(0,U+1);case h:var j=this.$locale().weekStart||0,K=(X<j?X+7:X)-j;return A(V?H-K:H+(6-K),U);case d:case g:return F($+"Hours",0);case c:return F($+"Minutes",1);case r:return F($+"Seconds",2);case a:return F($+"Milliseconds",3);default:return this.clone()}},N.endOf=function(v){return this.startOf(v,!1)},N.$set=function(v,O){var D,V=k.p(v),P="set"+(this.$u?"UTC":""),A=(D={},D[d]=P+"Date",D[g]=P+"Date",D[f]=P+"Month",D[p]=P+"FullYear",D[c]=P+"Hours",D[r]=P+"Minutes",D[a]=P+"Seconds",D[l]=P+"Milliseconds",D)[V],F=V===d?this.$D+(O-this.$W):O;if(V===f||V===p){var X=this.clone().set(g,1);X.$d[A](F),X.init(),this.$d=X.set(g,Math.min(this.$D,X.daysInMonth())).$d}else A&&this.$d[A](F);return this.init(),this},N.set=function(v,O){return this.clone().$set(v,O)},N.get=function(v){return this[k.p(v)]()},N.add=function(v,O){var D,V=this;v=Number(v);var P=k.p(O),A=function(U){var H=M(V);return k.w(H.date(H.date()+Math.round(U*v)),V)};if(P===f)return this.set(f,this.$M+v);if(P===p)return this.set(p,this.$y+v);if(P===d)return A(1);if(P===h)return A(7);var F=(D={},D[r]=o,D[c]=s,D[a]=n,D)[P]||1,X=this.$d.getTime()+v*F;return k.w(X,this)},N.subtract=function(v,O){return this.add(-1*v,O)},N.format=function(v){var O=this,D=this.$locale();if(!this.isValid())return D.invalidDate||u;var V=v||"YYYY-MM-DDTHH:mm:ssZ",P=k.z(this),A=this.$H,F=this.$m,X=this.$M,U=D.weekdays,H=D.months,$=D.meridiem,j=function(Q,J,ee,G){return Q&&(Q[J]||Q(O,V))||ee[J].slice(0,G)},K=function(Q){return k.s(A%12||12,Q,"0")},q=$||function(Q,J,ee){var G=Q<12?"AM":"PM";return ee?G.toLowerCase():G};return V.replace(b,function(Q,J){return J||function(ee){switch(ee){case"YY":return String(O.$y).slice(-2);case"YYYY":return k.s(O.$y,4,"0");case"M":return X+1;case"MM":return k.s(X+1,2,"0");case"MMM":return j(D.monthsShort,X,H,3);case"MMMM":return j(H,X);case"D":return O.$D;case"DD":return k.s(O.$D,2,"0");case"d":return String(O.$W);case"dd":return j(D.weekdaysMin,O.$W,U,2);case"ddd":return j(D.weekdaysShort,O.$W,U,3);case"dddd":return U[O.$W];case"H":return String(A);case"HH":return k.s(A,2,"0");case"h":return K(1);case"hh":return K(2);case"a":return q(A,F,!0);case"A":return q(A,F,!1);case"m":return String(F);case"mm":return k.s(F,2,"0");case"s":return String(O.$s);case"ss":return k.s(O.$s,2,"0");case"SSS":return k.s(O.$ms,3,"0");case"Z":return P}return null}(Q)||P.replace(":","")})},N.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},N.diff=function(v,O,D){var V,P=this,A=k.p(O),F=M(v),X=(F.utcOffset()-this.utcOffset())*o,U=this-F,H=function(){return k.m(P,F)};switch(A){case p:V=H()/12;break;case f:V=H();break;case m:V=H()/3;break;case h:V=(U-X)/6048e5;break;case d:V=(U-X)/864e5;break;case c:V=U/s;break;case r:V=U/o;break;case a:V=U/n;break;default:V=U}return D?V:k.a(V)},N.daysInMonth=function(){return this.endOf(f).$D},N.$locale=function(){return B[this.$L]},N.locale=function(v,O){if(!v)return this.$L;var D=this.clone(),V=S(v,O,!0);return V&&(D.$L=V),D},N.clone=function(){return k.w(this.$d,this)},N.toDate=function(){return new Date(this.valueOf())},N.toJSON=function(){return this.isValid()?this.toISOString():null},N.toISOString=function(){return this.$d.toISOString()},N.toString=function(){return this.$d.toUTCString()},L}(),R=T.prototype;return M.prototype=R,[["$ms",l],["$s",a],["$m",r],["$H",c],["$W",d],["$M",f],["$y",p],["$D",g]].forEach(function(L){R[L[1]]=function(N){return this.$g(N,L[0],L[1])}}),M.extend=function(L,N){return L.$i||(L(N,T,M),L.$i=!0),M},M.locale=S,M.isDayjs=C,M.unix=function(L){return M(1e3*L)},M.en=B[E],M.Ls=B,M.p={},M})})(Ir);var xC=Ir.exports;const at=Hl(xC),vr=document.createElement("canvas").getContext("2d"),Y={hexToRgb(e){if(!e)return!1;const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e),n=parseInt(t[1],16),o=parseInt(t[2],16),s=parseInt(t[3],16);return`${n},${o},${s}`},getColorStringType(e){if(!e)return"";const t=e.replace(/ /g,""),n=/^#(?:[A-Fa-f0-9]{3}){1,2}$/.exec(t),o=/^rgb[(](?:\s*0*(?:\d\d?(?:\.\d+)?(?:\s*%)?|\.\d+\s*%|100(?:\.0*)?\s*%|(?:1\d\d|2[0-4]\d|25[0-5])(?:\.\d+)?)\s*(?:,(?![)])|(?=[)]))){3}[)]$/.exec(t),s=/^rgba[(](?:\s*0*(?:\d\d?(?:\.\d+)?(?:\s*%)?|\.\d+\s*%|100(?:\.0*)?\s*%|(?:1\d\d|2[0-4]\d|25[0-5])(?:\.\d+)?)\s*,){3}\s*0*(?:\.\d+|1?)\s*[)]$/.exec(t);let l="";return n?l="HEX":o?l="RGB":s?l="RGBA":l="NONE",l},colorStringToRgba(e,t=1){const n=e.replace(/ /g,""),o=this.getColorStringType(n);let s="";switch(o){case"HEX":s=`rgba(${this.hexToRgb(n)},${t})`;break;case"RGB":s=n.replace(")",`, ${t})`).replace("rgb","rgba");break;case"RGBA":s=n.replace(`${this.getOpacity(e)})`,`${t})`);break;default:s=`rgba(0, 0, 0, ${t})`;break}return s},getOpacity(e){const t=e==null?void 0:e.replace(/ /g,"");return this.getColorStringType(t)==="RGBA"?t.replace(/^.*,(.+)\)/,"$1"):"1"},calculateMagnitude(e){return Math.floor(Math.log(e)/Math.LN10)},aliasPixel(e){return e%2===0?0:.5},getLabelStyle(e){const{fontStyle:t="normal",fontWeight:n="normal",fontSize:o="12",fontFamily:s="Roboto"}=e;return`${t} normal ${n} ${o}px ${s}`},labelSignFormat(e,t=null){const n=Ch(1),o=bh(1),s=xh(1),l=yh(1),a=1e3;let r;if(!ht(e))return e;const c=e<0,d=Math.abs(e),h=(f,m,p)=>{let g;return f%m===0?g=xt(t)?`${f/m}${p}`:`${(f/m).toFixed(t)}${p}`:g=`${(f/m).toFixed(1)}${p}`,c?`-${g}`:g};if(d>=n)r=h(d,n,"P");else if(d>=o)r=h(d,o,"T");else if(d>=s)r=h(d,s,"G");else if(d>=l)r=h(d,l,"M");else if(d>=a)r=h(d,1e3,"K");else{const f=xt(t)?d:d.toFixed(t);r=c?`-${f}`:`${f}`}return r},calcTextSize(e,t,n=0){const o=document.createElement("span"),s=`visibility:hidden; position:absolute; top:-10000px; font: ${t}; padding: 0 ${n}px`;o.setAttribute("style",s),o.style.font=t,o.textContent=e,document.body.appendChild(o);const l=o.getBoundingClientRect(),a=l.width||2,r=l.height||2;return o.remove(),{width:a,height:r}},calcTextSizeCanvas(e,t){if(!e)return{width:2,height:2};vr.font=t;const n=vr.measureText(e),o=t.match(/(\d+(?:\.\d+)?)px/),l=(o?Number(o[1]):14)*1.2;return{width:Math.max(Math.ceil(n.width),2),height:Math.max(Math.ceil(l),2)}},getStringMinMax(e){const t={min:e[0],max:e[0]};return e.forEach(n=>{var o,s;((o=t==null?void 0:t.max)==null?void 0:o.length)<(n==null?void 0:n.length)&&(t.max=n),((s=t==null?void 0:t.min)==null?void 0:s.length)>(n==null?void 0:n.length)&&(t.min=n)}),t},truncateLabelWithEllipsis(e,t,n,o="right"){if(!e)return"";if(!t)return e;const s="…",l=n.measureText(s).width;let a=e,r=n.measureText(a).width;if(r<=t||r<=l)return e;let c=a.length;for(;r>=t-l&&c-- >0;)a=o==="right"?a.substring(0,c):a.substring(1,a.length),r=n.measureText(a).width;return o==="right"?a+s:s+a},showLabelTip(e){const{ctx:t,width:n,height:o,x:s,y:l,arrowSize:a,borderRadius:r,text:c,backgroundColor:d,textColor:h}=e,f=s-n/2,m=s+n/2,p=l-o,g=l;t.beginPath(),t.save(),t.fillStyle=d||"#E96E2C",t.strokeStyle=d||"#E96E2C",t.shadowBlur=0,t.moveTo(f+r,p),t.quadraticCurveTo(f,p,f,p+r),t.lineTo(f,g-r),t.quadraticCurveTo(f,g,f+r,g),t.lineTo(m-r,g),t.quadraticCurveTo(m,g,m,g-r),t.lineTo(m,p+r),t.quadraticCurveTo(m,p,m-r,p),t.lineTo(s-a,p),t.lineTo(s,p-a),t.lineTo(s+a,p),t.lineTo(f+r,p),t.closePath(),t.fill(),t.restore(),t.save(),t.font="normal normal bold 12px Roboto",t.fillStyle=h||"#FFF",t.textBaseline="middle",t.textAlign="center",t.fillText(`${c}`,s,p+o/2),t.restore(),t.beginPath()},isPieType(e){return e==="pie"||e==="doughnut"||e==="sunburst"},isDoughnutHole(e){return e==="doughnut"||e==="sunburst"},setDOMStyle(e,t){var n;!e||!t||(n=Object.keys(t))==null||n.forEach(o=>{e.style[o]=t[o]})},checkSafeInteger(e){return e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER},htmlToElement(e){const t=document.createElement("template");return t.innerHTML=e.trim(),t.content.firstChild},isNullOrUndefined(e){return e==null},rgbaAdjustHalfOpacity(e){const t=/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/,n=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)$/;if(t.test(e)){const[,o,s,l]=e.match(t);return`rgba(${o}, ${s}, ${l}, 0.5)`}if(n.test(e)){const[,o,s,l,a]=e.match(n),r=(parseFloat(a)/2).toFixed(2);return`rgba(${o}, ${s}, ${l}, ${r})`}return e.startsWith("#")&&e.length>7?e:`${e}80`}},bC={createDataSet(e,t){Object.keys(this.seriesInfo.charts).forEach(n=>{const o=this.seriesInfo.charts[n];o.length&&(n==="pie"?this.options.sunburst?this.createSunburstDataSet(e):this.createPieDataSet(e,o):n==="scatter"?o.forEach(s=>{const l=this.seriesList[s],a=e[s],r=l==null?void 0:l.passingValue;l&&a&&(l.data=this.addSeriesDSforScatter(a),l.minMax=this.getSeriesMinMax(l.data,r))}):n==="heatMap"?o.forEach(s=>{const l=this.seriesList[s],a=l==null?void 0:l.passingValue,r=e[s];l&&r&&(l.labels=t,l.data=this.addSeriesDSForHeatMap(r),l.minMax=this.getSeriesMinMax(l.data,a),l.valueOpt=this.getSeriesValueOptForHeatMap(l))}):o.forEach(s=>{var c,d;const l=this.seriesList[s],a=(c=e==null?void 0:e[s])==null?void 0:c.some(h=>h===l.passingValue);l.hasPassingValueInData=a;const r=(d=e==null?void 0:e[s])==null?void 0:d.map(h=>l.interpolation==="zero"&&!h?0:h===l.passingValue?null:h);l&&r&&(l.isExistGrp&&l.stackIndex&&!l.isOverlapping?l.data=this.addSeriesStackDS(r,t,l.bsIds,l.stackIndex):l.data=this.addSeriesDS(r,t,l.isExistGrp),l.minMax=this.getSeriesMinMax(l.data,l.passingValue))}))})},createRealTimeScatterDataSet(e){var o,s,l;const t=Object.keys(e),n={maxY:0,minY:1/0,fromTime:0,toTime:0};for(let a=0;a<t.length;a++){const r=t[a],c=e[r],d=c==null?void 0:c.length;let h=0;if(!this.isInit||this.updateSeries){const y={dataGroup:[],startIndex:0,endIndex:0,length:0,fromTime:0,toTime:0};this.dataSet[r]={...y,...this.dataSet[r]}}const f=this.dataSet[r],m=f.dataGroup;f.length=this.options.realTimeScatter.range||300;const p=f.length;for(let y=0;y<d;y++){const w=c[y];h<w.x&&(h=w.x)}h=Math.floor(h/1e3)*1e3;const g=((l=(s=(o=m.at(-1))==null?void 0:o.data)==null?void 0:s.at(-1))==null?void 0:l.x)||Date.now();if(f.toTime=h||(g?Math.floor(g/1e3)*1e3:0),f.fromTime=f.toTime-p*1e3,f.endIndex=p-1,(f.toTime-h)/1e3>p&&r==="")return;const u=(h-f.toTime)/1e3;u>0&&(f.toTime=h,f.fromTime=h-p*1e3);const x=y=>{y.data?y.data.length=0:y.data=[],y.max=0,y.min=1/0};for(let y=0;y<p;y++)m[y]||(m[y]={data:[],max:0,min:1/0});if(u>0)if(u>=p){for(let y=0;y<p;y++)x(m[y]);f.startIndex=0,f.endIndex=p-1}else{let y=f.startIndex,w=f.endIndex;for(let I=0;I<u;I++)x(m[y]),y=(y+1)%p,w=(w+1)%p;f.startIndex=y,f.endIndex=w}for(let y=0;y<d;y++){const w=c[y],I=Math.floor(w.x/1e3)*1e3;if(f.fromTime<=I){let E=f.endIndex-(f.toTime-I)/1e3;E<0&&(E=p+E),m[E].data.push({x:w.x,y:w.y,o:w.value??w.y,color:w.color}),m[E].max=Math.max(m[E].max,w.y),m[E].min=Math.min(m[E].min,w.y)}}const b={maxY:0,minY:1/0};for(let y=0;y<this.dataSet[r].length;y++)this.dataSet[r].dataGroup[y].max>b.maxY&&(b.maxY=this.dataSet[r].dataGroup[y].max),this.dataSet[r].dataGroup[y].min<b.minY&&(b.minY=this.dataSet[r].dataGroup[y].min);n.maxY=Math.max(n.maxY,b.maxY),n.minY=Math.min(n.minY,b.minY),n.fromTime=this.dataSet[r].fromTime,n.toTime=this.dataSet[r].toTime}this.seriesInfo.charts.scatter.forEach(a=>{const r=this.seriesList[a];r.data=this.dataSet,r.minMax={minX:at(n.fromTime),minY:n.minY,maxX:at(n.toTime),maxY:n.maxY}})},createSunburstDataSet(e){this.pieDataSet=[];const t=this.pieDataSet,n=[];for(let o=0;o<e.length;o++){const s=e[o],l=this.seriesList[s.id];let a=!1;if(t[0]||(t[0]={ir:0,or:0,total:0,data:[]}),l.show){if(t[0].total+=s.value||0,t[0].data.push({parent:"$ev-root",id:s.id,value:s.value,sa:0,ea:0}),s.children)for(let r=0;r<s.children.length;r++)this.seriesList[s.children[r].id].show&&(a=!0),n.push({parent:s.id,data:s.children[r],depth:1});else{const r={id:"dummy",value:s.value};n.push({parent:s.id,data:r,depth:1})}if(!a){const r={id:"dummy",value:s.value};n.push({parent:s.id,data:r,depth:1})}}}for(t[0].data.sort((o,s)=>s.value-o.value);n.length;){const o=n.shift(),s=o.parent,l=o.data,a=o.depth;let r=!1;t[a]||(t[a]={ir:0,or:0,total:{},data:[]}),t[a].total[s]||(t[a].total[s]=0);const c=this.seriesList[l.id];if(l.id==="dummy")t[a].data.push({parent:s,id:"dummy",value:l.value,sa:0,ea:0}),t[a].total[s]+=l.value;else if(c&&c.show){if(t[a].data.push({parent:s,id:l.id,value:l.value,sa:0,ea:0}),t[a].total[s]+=l.value,l.children)for(let d=0;d<l.children.length;d++)this.seriesList[l.children[d].id].show&&(r=!0),n.push({parent:l.id,data:l.children[d],depth:a+1});else{const d={id:"dummy",value:l.value};n.push({parent:l.id,data:d,depth:a+1})}if(!r){const d={id:"dummy",value:l.value};n.push({parent:l.id,data:d,depth:a+1})}}t[a].data.sort((d,h)=>h.value-d.value)}},createPieDataSet(e,t){this.pieDataSet=[];const n=this.pieDataSet;n[0]={data:[],ir:0,or:0,total:0},t.forEach(o=>{if(this.seriesList[o].show){const s=e[o][0]??0;n[0].total+=s,n[0].data.push({id:o,value:s,sa:0,ea:0})}}),n.forEach(o=>{o.data.sort((s,l)=>l.value-s.value)})},addSeriesStackDS(e,t,n,o=0){const s=this.seriesList,l=this.options.horizontal,a=[],r=new Map,c=(h,f,m)=>{const p=`${h}-${f}-${m>=0?"pos":"neg"}`;if(r.has(p))return r.get(p);let g=0,u=h;for(;u>=0;){const x=s[n[u]];if(x!=null&&x.show){const b=x.data[f],y=l?b==null?void 0:b.x:b==null?void 0:b.y,w=b==null?void 0:b.o,I=!Y.isNullOrUndefined(x.passingValue)&&x.passingValue===w,E=m>=0&&w>=0||m<0&&w<0;if(y!=null&&!I&&E){g=y;break}}u--}return r.set(p,g),g},d=n.length-1;return e.forEach((h,f)=>{const m=Math.max(0,d);let p=c(m,f,h),g=h,u=t[f],x=h;if(p!=null&&u!=null){x&&typeof x=="object"&&("x"in x||"y"in x)&&(g=l?h.x:h.y,u=l?h.y:h.x);const b=(g==null?void 0:g.value)??g;o>0?b!=null?x=p+b:x=g:(p=0,x=b),a.push(this.addData(x,u,g,p))}}),a},addSeriesDS(e,t,n){var a;const o=this.options.horizontal,s=[],l=(a=this.seriesList[Object.keys(this.seriesList)[0]])==null?void 0:a.passingValue;return e.forEach((r,c)=>{let d=r,h=t[c];if(d&&typeof d=="object"&&(r.x||r.y)&&(d=o?r.x:r.y,h=o?r.y:r.x),h!==null){const f=n&&!Y.isNullOrUndefined(l)&&d===l;s.push(this.addData(f?0:d,h,d))}}),s},addSeriesDSforScatter(e){return e.map(t=>{const n=t.x,o={value:t.y,color:(t==null?void 0:t.color)||null};return this.addData(o,n,o)})},addSeriesDSForHeatMap(e){return e.map(({x:t,y:n,value:o,color:s=null})=>({x:t,y:n,o,xp:null,yp:null,w:null,h:null,dataColor:s,cId:null}))},addData(e,t,n=null,o=null){let s,l=null,a=null,r=null,c=null,d=null;return e!==null&&typeof e=="object"?(l=e.value,r=e.color,d=e.textColor):l=e??null,n!==null&&typeof n=="object"?(a=n.value,c=n.color):a=n??null,this.options.horizontal?s={x:l,y:t,o:a,b:o}:s={x:t,y:l,o:a,b:o},s.xp=null,s.yp=null,s.w=null,s.h=null,s.dataColor=r??c,s.dataTextColor=d,s},getSeriesMinMax(e,t){const n={minX:null,minY:null,maxX:null,maxY:null,maxDomain:null},o=this.options.horizontal;if(e.length){const s=!Y.isNullOrUndefined(t);return e.reduce((l,a,r)=>{var m,p,g;const c=l,d=((m=a.x)==null?void 0:m.value)||a.x,h=((p=a.y)==null?void 0:p.value)||a.y,f=((g=a.o)==null?void 0:g.value)||a.o;return(s?f!==t&&d<=c.minX:d<=c.minX)&&(c.minX=d===null?0:d),(s?f!==t&&h<=c.minY:h<=c.minY)&&(c.minY=h===null?0:h),(s?f!==t&&d>=c.maxX:d>=c.maxX)&&(c.maxX=d===null?0:d,o&&d!==null&&(c.maxDomain=h,c.maxDomainIndex=r)),(s?f!==t&&h>=c.maxY:h>=c.maxY)&&(c.maxY=h===null?0:h,!o&&h!==null&&(c.maxDomain=d,c.maxDomainIndex=r)),c},{minX:e[0].x,minY:e[0].y,maxX:e[0].x,maxY:e[0].y,maxDomain:o?e[0].y:e[0].x,maxDomainIndex:0})}return n},getSeriesValueOptForHeatMap(e){const{data:t,colorState:n,isGradient:o}=e,s=this.options.heatMapColor,l=s.colorsByRange.length||s.rangeCount,a=s.decimalPoint;let r,c=0,d=!1;t.forEach(({o:f})=>{c<f&&(c=Math.max(c,f)),f<0?d=!0:r===void 0?r=f:r=Math.min(r,f)}),d&&!o&&n.length===l&&n.push({id:`color#${l}`,color:s.error,state:"normal",label:"Error",show:!0});let h=c>r?Math.floor((c-r)/l):1;return c-r<=l&&(a>0?h=+((c-r)/l).toFixed(a):h=1),{min:r,max:c,interval:h,existError:d,decimalPoint:a}},getItemByLabelIndex(e){if(e<0)return!1;const t=Object.keys(this.seriesList),n=!!this.options.horizontal;let o=null,s=null,l=null,a="",r=0,c=!1,d=!1;if(e>-1){for(let h=0;h<t.length;h++){const f=t[h],m=this.seriesList[f],p=m.data[e];if(p&&m.show&&m.showLegend){const g=n?p.y:p.x,u=n?p.yp:p.xp;if(g!=null){const x=n?p.o||p.x:p.o||p.y;m.stackIndex?(r+=isNaN(p.o)?0:p.o,c=!0):r+=p.y,(l===null||l<=x)&&(l=x,a=f,o=g,s=u)}}}d={label:o,pos:s,value:l===null?0:l,sId:a,acc:r,useStack:c,maxIndex:e}}return d},getItem(e,t=!1){const{seriesID:n,dataIndex:o}=e;let s;if("seriesID"in e){const l=this.getDataByValues(n,o);if(!l||!(l!=null&&l.xp)||!(l!=null&&l.yp))return null;s=[this.getItemByPosition([l.xp,l.yp],t,o,!0)]}else{const l=Object.entries(this.seriesList);let a;for(let r=0;r<l.length;r++){const[c,d]=l[r];if(d.show){a=c;break}}s=o==null?void 0:o.map(r=>{const c=this.getDataByValues(a,r);return c?this.getItemByPosition([(c==null?void 0:c.xp)??0,(c==null?void 0:c.yp)??0],t,r,!0):null})}return s},getDataByValues(e,t){const n=this.seriesList[e];return!n||isNaN(t)||t<0||(n==null?void 0:n.data.length)<=t?!1:n.data[t]},getItemByPosition(e,t=!1,n,o=!1){const s=Object.keys(this.seriesList),l=!!this.options.horizontal;let a=null,r=null,c=null,d=null,h="",f=0,m=!1,p=null;for(let g=0;g<s.length;g++){const u=s[g],x=this.seriesList[u],b=t?x.findApproximateData:x.findGraphData;if(b){const y=b.call(x,e,l,n,o),w=y.data,I=y.index;if(w)if(Y.isPieType(y.type))r=u,h=u,c=(w.ea-w.sa)/2,d=w.o,p=w.index,a=y.type;else{const E=l?w.y:w.x,B=l?w.yp:w.xp;if(E!=null){const _=l?w.o||w.x:w.o||w.y;x.stackIndex!=null?(f+=isNaN(w.o)?0:w.o,m=!0):f+=w.y,a==="bar"&&m?y.hit&&(d=_,h=u,p=I,r=E,c=B,a=x.type):(d===null||d<=_)&&(d=_,h=u,r=E,c=B,p=I,a=x.type)}}}}return{type:a,label:r,pos:c,value:d??0,sId:h,acc:f,useStack:m,maxIndex:p}},getLabelInfoByPosition(e,t){var u,x,b;const[n,o]=e,s={x1:this.chartRect.x1+this.labelOffset.left,x2:this.chartRect.x2-this.labelOffset.right,y1:this.chartRect.y1+this.labelOffset.top,y2:this.chartRect.y2-this.labelOffset.bottom},l=this.data.series,a=((u=Object.values(l).sort((y,w)=>w.pointSize??0-y.pointSize??0)[0])==null?void 0:u.pointSize)??3,{horizontal:r,selectLabel:c}=this.options;let d,h;t==="xAxis"?(d=this.axesX[0],h=this.scrollbar.x):t==="yAxis"?(d=this.axesY[0],h=this.scrollbar.y):(d=r?this.axesY[0]:this.axesX[0],h=r?this.scrollbar.y:this.scrollbar.x);const f=s[d.units.rectStart],m=s[d.units.rectEnd];let p,g;if(h!=null&&h.use&&((x=d==null?void 0:d.labels)!=null&&x.length)){const{type:y,range:w,interval:I=1}=h,[E,B]=w??[0,d.labels.length],_=Math.floor((+B-+E)/I)+1,C=(m-f)/_,M=Math.floor(((t==="yAxis"||r?o:n)-f)/C);y==="step"?p=E+M:p=(d==null?void 0:d.labels.findIndex(T=>T===+E))+M}else if((b=d==null?void 0:d.labels)!=null&&b.length){const y=(m-f)/d.labels.length,I=Math.floor(((t==="yAxis"?o:n)-f)/y);p=d.labels.length>I?I:-1}else{let y,w;n<f-a?(y=f,w=0):n>m+a?(y=m,w=this.data.labels.length-1):y=n,g=this.getItemByPosition([y,o],c==null?void 0:c.useApproximateValue,w,!0),p=g.maxIndex??-1}return{labelIndex:p,hitInfo:g}},getCurMouseLabelVal(e,t,n){const{type:o,horizontal:s}=this.options,l=e==="xAxis",a=l?"x":"y";let r="",c=-1;const d=()=>{let f="";switch(o){case"bar":case"line":{f=s&&!l||!s&&l?this.data.labels[n]:"";break}case"heatMap":{f=this.data.labels[a][n];break}}return f},h=()=>{let f="";const m={x1:this.chartRect.x1+this.labelOffset.left,x2:this.chartRect.x2-this.labelOffset.right,y1:this.chartRect.y1+this.labelOffset.top,y2:this.chartRect.y2-this.labelOffset.bottom},{steps:p,interval:g,graphMin:u}=this.axesSteps[a][0],{width:x,height:b}=this.axesRange[a][0].size,y=l?this.axesX:this.axesY,w=m[y[0].units.rectStart],I=m[y[0].units.rectEnd],E=Math.abs(t[l?0:1]-w),B=(l?x:b)/2,_=Math.abs(w-I)/p,C=Math.floor((E+B)/_);return _*C+B>E&&_*C-B<E&&(f=C*g+u),f};return typeof n=="number"&&(r=d(),c=n),r||(r=h(),c=-1),{labelVal:r,labelIdx:c}},getStoreMinMax(){const e=Object.keys(this.seriesList),t=this.options.horizontal,n={x:[{min:null,max:null}],y:[{min:null,max:null}]};return e.length?e.reduce((o,s)=>{const l=o,a=this.seriesList[s],r=a.minMax,c=a.xAxisIndex,d=a.yAxisIndex;if(l.x[c]||(l.x[c]={min:null,max:null,maxSID:null}),l.y[d]||(l.y[d]={min:null,max:null,maxSID:null}),r&&a.show){t?((l.x[c].min===null||r.minX<l.x[c].min)&&(l.x[c].min=r.minX),r.minY!==null&&(l.y[d].min===null||r.minY<l.y[d].min)&&(l.y[d].min=r.minY)):(r.minX!==null&&(l.x[c].min===null||r.minX<l.x[c].min)&&(l.x[c].min=r.minX),(l.y[d].min===null||r.minY<l.y[d].min)&&(l.y[d].min=r.minY));const h=this.seriesList[s].isExistGrp,f=l.x[c].max<0;(h&&f||!l.x[c].max||r.maxX>=l.x[c].max)&&(l.x[c].max=r.maxX,l.x[c].maxSID=s);const m=l.y[d].max<0;(h&&m||!l.y[d].max||r.maxY>=l.y[d].max)&&(l.y[d].max=r.maxY,l.y[d].maxSID=s)}return l},{x:[{min:null,max:null,maxSID:null}],y:[{min:null,max:null,maxSID:null}]}):n},calculateAngle(){const e=this.pieDataSet;let t,n,o,s,l,a,r,c,d;const h=[],f={"$ev-root":1.5*Math.PI};for(let m=0;m<e.length;m++){const p=e[m];d=!0;for(let g=0;g<p.data.length;g++)if(t=p.data[g],n=t.value,d&&(d=t.id==="dummy"),!m)a=f["$ev-root"],l=2*Math.PI*(n/p.total),r=a+l,t.sa=a,t.ea=r,f["$ev-root"]+=l;else{if(o=this.getParentInfo(m-1,t.parent),!o)break;f[t.parent]||(f[t.parent]=o.sa),a=f[t.parent],c=o.ea-o.sa,s=p.total[t.parent]||0,l=c*(n/s),r=a+l,t.sa=a,t.ea=r,f[t.parent]+=l}d&&h.push(m)}for(let m=0;m<h.length;m++)this.pieDataSet.splice(h,1);this.options.reverse&&(this.pieDataSet=Xp(this.pieDataSet))},getParentInfo(e,t){for(let n=e;n>=0;n--){const o=this.pieDataSet[n];for(let s=0;s<o.data.length;s++)if(o.data[s].id===t)return o.data[s]}return null},getAggregations(){const e=this.data.data,t=this.data.series,n={},o=Object.keys(t);return o==null||o.forEach(s=>{const l=e[s].map(m=>m!=null&&m.value?m.value:m),a=l[l.length-1],r=l.filter(m=>m!=null),c=Math.min(...r),d=Math.max(...r),h=r.reduce((m,p)=>m+p,0),f=h/r.length||0;(!Y.checkSafeInteger(c)||!Y.checkSafeInteger(d)||!Y.checkSafeInteger(f)||!Y.checkSafeInteger(h)||!Y.checkSafeInteger(a))&&console.warn("[EVUI][Chart] The aggregated value exceeds 9007199254740991 or less than -9007199254740991."),n[s]={min:c,max:d,avg:f,total:h,last:a}}),n}},CC={x:{rectStart:"x1",rectEnd:"x2",rectOffsetCounter:e=>e==="top"?"y2":"y1",rectOffset:e=>e==="top"?"y1":"y2"},y:{rectStart:"y2",rectEnd:"y1",rectOffsetCounter:e=>e==="left"?"x2":"x1",rectOffset:e=>e==="left"?"x1":"x2"}},Nt=["#2b99f0","#8ac449","#00C4C5","#ffde00","#ff7781","#8470ff","#75cd8e","#48d1cc","#fec64f","#fe984f","#0052ff","#00a48c","#83cfde","#dfe32d","#ff7d40","#99c7ff","#a5fee3","#0379c9","#eef093","#ffa891","#00c5cd","#009bc7","#cacaff","#ffc125","#df6264"],Tr={show:!0,highlight:{defaultSize:4,maxSize:6,maxShadowSize:10,maxShadowOpacity:.4},xAxisIndex:0,yAxisIndex:0,point:!0,pointHighlight:!0,pointSize:3,pointStyle:"",lineWidth:2,fill:!1,fillOpacity:.4,showLegend:!0,passingValue:null,interpolation:"none"},SC={show:!0,highlight:{pointSize:5},xAxisIndex:0,yAxisIndex:0,category:!0,showLegend:!0,showValue:{use:!1,fontSize:12,textColor:"#000000",formatter:null,decimalPoint:null}},wC={show:!0,showLegend:!0,stroke:{show:!0,color:"#FFFFFF",lineWidth:2},showValue:{use:!1,fontSize:12,textColor:"#000000",formatter:null}},Br={min:null,max:null,autoScaleRatio:null,startToZero:!1,showAxis:!0,axisLineColor:"#C9CFDC",axisLineWidth:1,showGrid:!0,gridLineColor:"#C9CFDC",showAxisTick:!0,showIndicator:!1,timeFormat:"mm:ss",range:null,interval:null,decimalPoint:"auto",fixedSteps:!1,niceScale:!1,labelStyle:{show:!0,fontSize:12,color:"#25262E",fontFamily:"Roboto",fontWeight:400,fitWidth:!1,fitDir:"right",alignToGridLine:!1,padding:0,fixWidth:void 0},title:{use:!1,text:null,fontWeight:400,fontSize:12,fontFamily:"Roboto",textAlign:"right",fontStyle:"normal",color:"#808080"},scrollbar:{use:!1,width:14,height:14,background:"#F2F2F2",showButton:!0,thumbStyle:{background:"#929292",radius:0}}},Dr={show:!1,fontSize:12,fontColor:"#FF0000",fillColor:"#FFFFFF",lineColor:"#FF0000",lineWidth:0,fontWeight:400,fontFamily:"Roboto",verticalAlign:"middle",textAlign:"center",textOverflow:"none",maxWidth:null},Or={color:"#FF0000",lineWidth:1,label:Dr},Rr={color:"#FAE59D"},kC={show:!0,xAxisIndex:0,yAxisIndex:0,showLegend:!0,showValue:{use:!1,fontSize:12,textColor:"#000000",formatter:null,decimalPoint:0},highlight:{stroke:{use:!1,color:null,width:1,radius:0},shadow:{use:!0,offsetX:0,offsetY:0,blur:4,color:"#959494"}}},si={millisecond:{common:!0,size:1,steps:[1,2,5,10,20,50,100,250,500]},second:{common:!0,size:1e3,steps:[1,2,5,10,30]},minute:{common:!0,size:6e4,steps:[1,2,5,10,30]},hour:{common:!0,size:36e5,steps:[1,2,3,6,12]},day:{common:!0,size:864e5,steps:[1,2,5]},week:{common:!1,size:6048e5,steps:[1,2,3,4]},month:{common:!0,size:26784e5,steps:[1,2,3]},quarter:{common:!1,size:7884e6,steps:[1,2,3,4]},year:{common:!0,size:3154e7}},_s=Object.freeze([1,2,2.5,5,10]),ie={calculateX(e,t,n,o,s=0){if(e==null||e>n||e<t)return null;const l=o/(n-t);return Math.ceil(s+l*(e-t))},calculateSubX(e,t,n,o,s=0){if(e==null)return null;const l=o/(n-t);return Math.ceil(s+l*(e-t))},calculateY(e,t,n,o,s=0){let l;if(e==null||e>n||e<t)return null;const a=o/(n-t);return s?l=s-a*(e-(t||0)):l=-(a*(e-(t||0))),Math.floor(l)},drawPoint(e,t,n,o,s){let l,a,r,c,d;if(isNaN(n)||n<=0)return;let h,f,m,p;switch(t){case"triangle":e.beginPath(),l=3*n/Math.sqrt(3),c=l*Math.sqrt(3)/2,e.moveTo(o-l/2,s+c/3),e.lineTo(o+l/2,s+c/3),e.lineTo(o,s-2*c/3),e.closePath(),e.fill();break;case"rect":d=1/Math.SQRT2*n,e.beginPath(),e.fillRect(o-d,s-d,2*d,2*d),e.strokeRect(o-d,s-d,2*d,2*d);break;case"rectRounded":h=n/Math.SQRT2,f=o-h,m=s-h,p=Math.SQRT2*n,e.beginPath(),this.roundedRect(e,f,m,p,p,n/2),e.closePath(),e.fill();break;case"rectRot":d=1/Math.SQRT2*n,e.beginPath(),e.moveTo(o-d,s),e.lineTo(o,s+d),e.lineTo(o+d,s),e.lineTo(o,s-d),e.closePath(),e.fill();break;case"cross":e.beginPath(),e.moveTo(o,s+n),e.lineTo(o,s-n),e.moveTo(o-n,s),e.lineTo(o+n,s),e.closePath();break;case"crossRot":e.beginPath(),a=Math.cos(Math.PI/4)*n,r=Math.sin(Math.PI/4)*n,e.moveTo(o-a,s-r),e.lineTo(o+a,s+r),e.moveTo(o-a,s+r),e.lineTo(o+a,s-r),e.closePath();break;case"star":e.beginPath(),e.moveTo(o,s+n),e.lineTo(o,s-n),e.moveTo(o-n,s),e.lineTo(o+n,s),a=Math.cos(Math.PI/4)*n,r=Math.sin(Math.PI/4)*n,e.moveTo(o-a,s-r),e.lineTo(o+a,s+r),e.moveTo(o-a,s+r),e.lineTo(o+a,s-r),e.closePath();break;case"line":e.beginPath(),e.moveTo(o-n,s),e.lineTo(o+n,s),e.closePath();break;default:e.beginPath(),e.arc(o,s,n,0,Math.PI*2),e.closePath(),e.fill();break}e.stroke()},roundedRect(e,t,n,o,s,l){const a=Math.PI,r=a/2;if(l){const c=Math.min(l,s/2,o/2),d=t+c,h=n+c,f=t+o-c,m=n+s-c;e.moveTo(t,h),d<f&&h<m?(e.arc(d,h,c,-a,-r),e.arc(f,h,c,-r,0),e.arc(f,m,c,0,r),e.arc(d,m,c,r,a)):d<f?(e.moveTo(d,n),e.arc(f,h,c,-r,r),e.arc(d,h,c,r,a+r)):h<m?(e.arc(d,h,c,-a,0),e.arc(d,m,c,0,a)):e.arc(d,h,c,-a,a),e.closePath(),e.moveTo(t,n)}else e.rect(t,n,o,s)},createGradient(e,t,n,o,s,l){const{x:a,y:r,w:c,h:d}=n;let h;t?h=e.createLinearGradient(a,0,a+c,0):h=e.createLinearGradient(0,r,0,r+d);for(let f=0;f<o.length;f++){const m=o[f][0]??0,p=o[f][1]??"rgba(255, 255, 255, 0)",g=p.includes("rgba")?Y.getOpacity(p):1,u=s?l:g;h.addColorStop(m,Y.colorStringToRgba(p,u))}return h}};class MC{constructor(t,n,o){const s=Fe({},n,Tr);Object.keys(s).forEach(l=>{this[l]=s[l]}),this.name===void 0&&(this.name=`series-${o}`),["color","pointFill","fillColor"].forEach(l=>{this[l]===void 0&&(this[l]=l==="pointFill"?this.color:Nt[o%Nt.length])}),this.type="line",this.sId=t,this.extent={downplay:{opacity:.3,lineWidth:1},normal:{opacity:1,lineWidth:1},highlight:{opacity:1,lineWidth:2}},this.data=[],this.beforeMouseXp=0,this.beforeMouseYp=0,this.beforeFindItemIndex=-1,this.size={comboOffset:0}}useLinearInterpolation(){return this.interpolation==="linear"||this.interpolation==="none"&&!!this.passingValue&&this.hasPassingValueInData}draw(t){var V,P,A,F,X,U,H;if(!this.show)return;const{ctx:n,chartRect:o,labelOffset:s,axesSteps:l,selectLabel:a,selectSeries:r,legendHitInfo:c,isBrush:d,unSelectedOpacity:h}=t,f=a==null?void 0:a.option,m=(f==null?void 0:f.use)&&(f==null?void 0:f.useSeriesOpacity),p=((V=a==null?void 0:a.selected)==null?void 0:V.dataIndex)??[];let g;if(c)g=this.extent[(c==null?void 0:c.sId)===this.sId?"highlight":"downplay"];else if((P=r==null?void 0:r.option)!=null&&P.use&&((F=(A=r==null?void 0:r.selected)==null?void 0:A.seriesId)!=null&&F.length)){const $=(U=(X=r==null?void 0:r.selected)==null?void 0:X.seriesId)==null?void 0:U.includes(this.sId);g=this.extent[$?"highlight":"downplay"]}else m&&p.length?g=this.extent.downplay:g=this.extent.normal;g===this.extent.downplay&&(g={...g,opacity:h});const u=$=>$!=null&&$.includes("rgba")?Y.getOpacity($):g.opacity,x=this.color,b=u(x),y=this.pointFill,w=u(y),I=this.extent.downplay?this.fillOpacity*g.opacity:this.fillOpacity,E=this.lineWidth*g.lineWidth;n.beginPath(),n.save(),n.lineJoin="round",n.lineWidth=E,n.strokeStyle=Y.colorStringToRgba(x,b),this.segments&&n.setLineDash(this.segments);const B=this.useLinearInterpolation();let _=0;const C=l.x[this.xAxisIndex],S=l.y[this.yAxisIndex];let M=o.chartWidth-(s.left+s.right);const k=o.chartHeight-(s.top+s.bottom);this.combo&&(_=M/(this.data.length||1),M-=_,this.size.comboOffset=_);const T=o.x1+s.left+_/2,R=o.y2-s.bottom,L=$=>ie.calculateX($,C.graphMin,C.graphMax,M,T),N=$=>ie.calculateY($,S.graphMin,S.graphMax,k,R),v=this.data.some($=>$.o<0),O=v?N(0):o.y2-s.bottom;let D;if(this.data.forEach($=>{let j=L($.x),K=N($.y);this.isExistGrp&&B&&$.o===null&&(K=N($.b??0)),j!==null&&(j+=Y.aliasPixel(j)),$.xp=j,$.yp=K,!(B&&$.o===null)&&(xt(D==null?void 0:D.y)&&!this.isExistGrp||!B&&(xt(D==null?void 0:D.y)||xt($.o))?n.moveTo(j,K):n.lineTo(j,K),D=$)}),n.stroke(),this.segments&&n.setLineDash([]),this.fill&&this.data.length){n.beginPath();const $=Y.colorStringToRgba(this.fillColor||x,I);if((H=this.fill)!=null&&H.gradient){let J=this.data[0].yp,ee=this.data[0].y;this.data.forEach(Z=>{Z.yp&&Z.yp<=J?J=Z.yp:Z.y&&Z.y>=ee&&(ee=Z.y)});const G=n.createLinearGradient(0,o.y2,0,J),ne=g.opacity<1?$:x;G.addColorStop(0,v?ne:$),G.addColorStop(.5,$),G.addColorStop(1,ne),n.fillStyle=G}else n.fillStyle=$;let j=null,K=null;const q=this.data.map(J=>J==null?void 0:J.o),Q=[];for(let J=0;J<q.length+1;J++)if(B&&Hp(q[J])||!B&&xt(q[J])){if(j!==null&&K!==null){const G=q.slice(j,J).findLastIndex(ne=>!xt(ne)&&ne!==null);Q.push([j,j+G]),j=null,K=null}}else B&&q[J]===null||(j=j===null?J:j),K=J;Q.forEach(([J,ee])=>{if(J===ee){const G=this.data[J];n.moveTo(G.xp-E,G.yp),n.lineTo(G.xp+E,G.yp),n.lineTo(G.xp+E,N(G.b)??O),n.closePath();return}for(let G=J;G<=ee;G++){const ne=this.data[G];if(G===J?n.moveTo(ne.xp,ne.yp):ne.o!==null&&n.lineTo(ne.xp,ne.yp),G===ee){for(let Z=ee;Z>=J;Z--){const re=this.data[Z],me=L(re.x);if(re.o!==null){const ae=N(re.b)??N(0);n.lineTo(me,ae)}}n.closePath()}}}),n.fill()}if(!d){n.strokeStyle=Y.colorStringToRgba(x,b);const $=Y.colorStringToRgba(y,1),j=Y.colorStringToRgba(y,w),K=this.interpolation==="linear"&&this.data.filter(q=>q.o!==null).length===1;this.data.forEach((q,Q)=>{var Z,re;if(q.xp===null||q.yp===null||q.o===null)return;const J=(Z=this.data[Q-1])==null?void 0:Z.o,ee=(re=this.data[Q+1])==null?void 0:re.o,G=!B&&xt(J)&&xt(ee)||K,ne=p.includes(Q);(this.point||G||ne)&&(n.fillStyle=ne&&!c?$:j,ie.drawPoint(n,this.pointStyle,this.pointSize,q.xp,q.yp))})}n.restore()}itemHighlight(t,n){const o=t.data,s=n,{xp:l,yp:a,o:r}=o;s.save(),l!==null&&a!==null&&r!==null&&this.pointHighlight&&(s.strokeStyle=Y.colorStringToRgba(this.color,0),s.fillStyle=Y.colorStringToRgba(this.color,this.highlight.maxShadowOpacity),ie.drawPoint(s,this.pointStyle,this.highlight.maxShadowSize,l,a),s.fillStyle=this.color,ie.drawPoint(s,this.pointStyle,this.highlight.maxSize,l,a),s.fillStyle="#fff",ie.drawPoint(s,this.pointStyle,this.highlight.defaultSize,l,a)),s.restore()}findGraphData(t,n,o,s){var h;const l=t[0],a=t[1],r={data:null,hit:!1,color:this.color},c=this.data.filter(f=>!Y.isNullOrUndefined(f.x)),d=this.useLinearInterpolation();if(c!=null&&c.length)if(typeof o=="number"&&this.show){if(r.data=c[o],r.index=o,r.data){const f=c[o];Math.abs(a-f.yp)<=15&&(r.hit=!0)}}else if(typeof this.beforeFindItemIndex=="number"&&this.beforeFindItemIndex!==-1&&this.show&&s)r.data=c[this.beforeFindItemIndex],r.index=this.beforeFindItemIndex;else{let f=1/0,m=-1;const p=[];c.forEach((b,y)=>{b.xp!==null&&b.yp!==null&&b.o!==null&&p.push({...b,originalIndex:y})}),p.length===0&&c.forEach((b,y)=>{p.push({...b,originalIndex:y})});let g=0,u=p.length-1;for(;g<=u;){const b=Math.floor((g+u)/2),y=p[b],w=Math.abs(l-y.xp);if(w<f&&(f=w,m=y.originalIndex),y.xp<l){if(g=b+1,g<p.length){const I=Math.abs(l-p[g].xp);I<f&&(f=I,m=p[g].originalIndex)}}else if(y.xp>l){if(u=b-1,u>=0){const I=Math.abs(l-p[u].xp);I<f&&(f=I,m=p[u].originalIndex)}}else break}const x=p.findIndex(b=>b.originalIndex===m);if(x!==-1)for(let b=Math.max(0,x-2);b<=Math.min(p.length-1,x+2);b++){const y=p[b],w=Math.abs(l-y.xp);w<f&&(f=w,m=y.originalIndex)}if(m!==-1){let b=50;if(c.length>1){const w=[];for(let I=1;I<c.length;I++)c[I].xp!==null&&c[I-1].xp!==null&&w.push(Math.abs(c[I].xp-c[I-1].xp));w.length>0&&(b=w.reduce((I,E)=>I+E,0)/w.length)}const y=Math.max(b,1);if(f<=y)r.data=c[m],r.index=m;else{let w=!1,I=d?1/0:y;const E=d?p:c;for(let B=0;B<E.length;B++){const _=Math.abs(l-E[B].xp);_<=I&&(w=!0,I=_,m=d?E[B].originalIndex:B)}w&&(r.data=c[m],r.index=m)}if(r.data){const w=c[m];Math.abs(a-w.yp)<=15&&(r.hit=!0)}}}return s||(this.beforeMouseXp=l,this.beforeMouseYp=a,typeof r.index=="number"&&(this.beforeFindItemIndex=r.index)),d&&((h=r==null?void 0:r.data)==null?void 0:h.o)===null&&(r.data=null),r}findApproximateData(t){var m,p;const n=t[0],o=t[1],s={data:null,hit:!1,color:this.color},l=this.data.filter(g=>!Y.isNullOrUndefined(g.x));if(!l.length)return s;const a=l.length>1?Math.abs(((m=l[1])==null?void 0:m.xp)-((p=l[0])==null?void 0:p.xp)):50,r=Math.max(a*.4,10);let c=0,d=l.length-1,h=-1,f=1/0;for(;c<=d;){const g=Math.floor((c+d)/2),u=l[g].xp;if(u-r<=n&&n<=u+r){const x=Math.max(0,g-2),b=Math.min(l.length-1,g+2);for(let y=x;y<=b;y++)if(l[y].xp!==null&&l[y].yp!==null){const w=Math.sqrt((n-l[y].xp)**2+(o-l[y].yp)**2);w<f&&(f=w,h=y)}return h!==-1&&(s.data=l[h],s.index=h,f<5&&(s.hit=!0)),s}else if(u+r<n){if(g<d&&n<l[g+1].xp){const x=Math.abs(l[g].xp-n),b=Math.abs(l[g+1].xp-n);s.data=x>b?l[g+1]:l[g],s.index=x>b?g+1:g;const y=s.data;return Math.abs(o-y.yp)<10&&(s.hit=!0),s}c=g+1}else{if(g>0&&n>l[g-1].xp){const x=Math.abs(l[g-1].xp-n),b=Math.abs(l[g].xp-n);s.data=x>b?l[g]:l[g-1],s.index=x>b?g:g-1;const y=s.data;return Math.abs(o-y.yp)<10&&(s.hit=!0),s}d=g-1}}return s}findItems({xsp:t,width:n}){const o=t+n;return this.data.filter(s=>t-1<=s.xp&&s.xp<=o+1)}}class EC{constructor(t,n,o,s=!1){const l=ys({},Tr,n);Object.keys(l).forEach(a=>{this[a]=l[a]}),this.name===void 0&&(this.name=`series-${o}`),["color","pointFill","fillColor","overflowColor"].forEach(a=>{this[a]===void 0&&(this[a]=Nt[o%Nt.length])}),this.sId=t,this.data=[],this.type="scatter",this.realTimeScatter=s,this._rtTotalCount=0,this._colorCache=new Map}getCachedColor(t,n){const o=`${t}_${n}`;if(this._colorCache.has(o))return this._colorCache.get(o);const s=Y.colorStringToRgba(t,n);if(this._colorCache.size>100){const l=this._colorCache.keys().next().value;this._colorCache.delete(l)}return this._colorCache.set(o,s),s}draw(t){this.show&&(this.realTimeScatter?this.realTimeScatterDraw(t):this.defaultScatterDraw(t))}getOpacity(t,n,o){const s=n.includes("rgba")?Y.getOpacity(n):1;let l=!1;const{selectInfo:a,legendHitInfo:r,unSelectedOpacity:c}=t;return r?l=r.sId!==this.sId:a&&(l=(a==null?void 0:a.seriesID)!==this.sId||(a==null?void 0:a.dataIndex)!==o),l?c:s}calcItem(t,n){const{chartRect:o,labelOffset:s,axesSteps:l,displayOverflow:a}=n;let r;const c=l.x[this.xAxisIndex],d=l.y[this.yAxisIndex],h=o.chartWidth-(s.left+s.right),f=o.chartHeight-(s.top+s.bottom),m=o.x1+s.left,p=o.y2-s.bottom;let g=ie.calculateX(t.x,c.graphMin,c.graphMax,h,m);const u=ie.calculateY(a&&t.y>d.graphMax?d.graphMax:t.y,d.graphMin,d.graphMax,f,p);g!==null&&(r=Y.aliasPixel(g),g+=r),t.xp=g,t.yp=u}defaultScatterDraw(t){const{ctx:n,axesSteps:o,duple:s,legendHitInfo:l,coordinateDedupe:a}=t,r=o.y[this.yAxisIndex];for(let c=0;c<this.data.length;c++){const d=this.data[c],h=c,f=a!==!1;let m;if(l?m=l.sId===this.sId:f?m=s.get(`${d.x}${d.y}`)===this.sId:m=!0,m&&(this.calcItem(d,t),d.xp!==null&&d.yp!==null)){const g=d.y>r.graphMax&&this.overflowColor||d.dataColor||this.color,u=this.getOpacity(t,g,h);n.strokeStyle=this.getCachedColor(g,u);const x=d.dataColor||this.pointFill,b=this.getOpacity(t,x,h);n.fillStyle=this.getCachedColor(x,b),ie.drawPoint(n,this.pointStyle,this.pointSize,d.xp,d.yp)}}}realTimeScatterDraw(t){var f,m,p,g,u,x;const{ctx:n,axesSteps:o,duple:s,legendHitInfo:l,coordinateDedupe:a}=t,r=o.y[this.yAxisIndex],c=typeof this.pointStyle=="string"?this.pointStyle:this.pointStyle.value,d=typeof this.pointSize=="number"?this.pointSize:this.pointSize.value;let h=0;for(let b=0;b<((m=(f=this.data[this.sId])==null?void 0:f.dataGroup)==null?void 0:m.length);b++)for(let y=0;y<((g=(p=this.data[this.sId])==null?void 0:p.dataGroup[b])==null?void 0:g.data.length);y++){const w=(x=(u=this.data[this.sId])==null?void 0:u.dataGroup[b])==null?void 0:x.data[y];h++;const I=a!==!1;let E;if(l?E=l.sId===this.sId:I?E=s.get(`${w.x}${w.y}`)===this.sId:E=!0,E&&(this.calcItem(w,t),w.xp!==null&&w.yp!==null)){const B=w.y>r.graphMax&&this.overflowColor,_=B||w.color||this.color,C=B||w.color||this.pointFill||this.color,S=this.getOpacity(t,_,y),M=this.getOpacity(t,C,y);n.strokeStyle=this.getCachedColor(_,S),n.fillStyle=this.getCachedColor(C,M),ie.drawPoint(n,c,d,w.xp,w.yp)}}this._rtTotalCount=h}findItemsInRange(t,n,o,s,l){return t.filter(a=>n-1<=a.xp&&a.xp<=s+1&&o-1<=a.yp&&a.yp<=l+1)}defaultScatterFindItems(t,n,o,s,l){return this.findItemsInRange(t,n,o,s,l)}realTimeScatterFindItems(t,n,o,s,l){const a=[];for(let r=0;r<t[this.sId].dataGroup.length;r++){const c=t[this.sId].dataGroup[r];a.push(...this.findItemsInRange(c.data,n,o,s,l))}return a}findItems({xsp:t,ysp:n,width:o,height:s}){const l=this.data,a=t+o,r=n+s;let c=[];return this.realTimeScatter?c=this.realTimeScatterFindItems(l,t,n,a,r):c=this.defaultScatterFindItems(l,t,n,a,r),c}itemHighlight(t,n){const o=t.data,s=n,l=o.xp,a=o.yp;if(s.save(),l!==null&&a!==null){const r=o.dataColor||this.color,c=o.dataColor||this.pointFill;s.strokeStyle=this.getCachedColor(r,0),s.fillStyle=this.getCachedColor(c,this.highlight.maxShadowOpacity),ie.drawPoint(s,this.pointStyle,this.highlight.maxShadowSize,l,a),s.fillStyle=r,ie.drawPoint(s,this.pointStyle,this.highlight.maxSize,l,a),s.fillStyle="#fff",ie.drawPoint(s,this.pointStyle,this.highlight.defaultSize,l,a)}s.restore()}findGraphData(t){var c;const n=t[0],o=t[1],s={data:null,hit:!1,color:this.color,index:null},l=this.pointSize;if(this.realTimeScatter){const d=(c=this.data[this.sId])==null?void 0:c.dataGroup;if(!d)return s;let f=this._rtTotalCount-1;for(let m=d.length-1;m>=0;m--){const p=d[m];if(p!=null&&p.data)for(let g=p.data.length-1;g>=0;g--){const u=p.data[g];if(u.xp!==null&&u.yp!==null){const x=u.xp,b=u.yp;if(x-l<=n&&n<=x+l&&b-l<=o&&o<=b+l)return s.data=u,s.index=f,s.hit=!0,s}f--}}return s}const a=this.data,r=a.findIndex(d=>{const h=d.xp,f=d.yp;return h-l<=n&&n<=h+l&&f-l<=o&&o<=f+l});return r>-1&&(s.data=a[r],s.index=r,s.hit=!0),s}}class Nr{constructor(t,n,o,s){const l=Fe({},n,SC);Object.keys(l).forEach(a=>{this[a]=l[a]}),this.name===void 0&&(this.name=`series-${o}`),this.color===void 0&&(this.color=Nt[o%Nt.length]),this.type="bar",this.sId=t,this.data=[],this.isHorizontal=s,this.size={cat:0,bar:0,cPad:0,bPad:0,w:0,h:0,ix:0}}draw(t){var F,X,U,H,$;if(!this.show)return;const{isHorizontal:n,showValue:o}=this,s=t.ctx,l=t.chartRect,a=t.labelOffset,r=t.axesSteps,c=t.showIndex,d=t.thickness,h=t.showSeriesCount;let f,m;const p=r.x[this.xAxisIndex],g=r.y[this.yAxisIndex];let u=this.data.length;const[x,b]=n?[g.minIndex,g.maxIndex]:[p.minIndex,p.maxIndex];ve(x)&&ve(b)&&(u=b-x+1);const y=l.chartWidth-(a.left+a.right),w=l.chartHeight-(a.top+a.bottom),I=l.x1+a.left,E=l.y2-a.bottom,B=ie.calculateX(0,p.graphMin,p.graphMax,y),_=ie.calculateY(0,g.graphMin,g.graphMax,w),C=n?I+B:I,S=n?E:E+_,M=n?w:y,k=M/(u||1);let T;t.cPadRatio>=1||t.cPadRatio<=0?T=2:T=Math.max(M*(t.cPadRatio/2)/u,2);let L,N,v;L=k>T*2?k-T*2:k,L=this.isExistGrp?L:L/h;const O=this.calculateBarSize(d,L);N=n?null:O,v=n?O:null;const D=n?(L-v)/2:(L-N)/2,V=this.isExistGrp?1:c+1;this.size.cat=k,this.size.bar=L,this.size.cPad=T,this.size.bPad=D,this.size.w=N,this.size.h=v,this.size.ix=V,this.chartRect=l,this.labelOffset=a,this.borderRadius=t.borderRadius,this.filteredCount=u;const P=ve(x)?x:0,A=ve(b)?b:this.data.length-1;for(let j=P;j<=A;j++){const K=j-P,q=this.data[j];if(q){const Q=n?S-k*K-T:C+k*K+T;if(n?(f=C,m=Math.round(Q-(L*V-(v+D)))):(f=Math.round(Q+(L*V-(N+D))),m=S),n){const fe=q.b?q.o:q.x;N=ie.calculateX(fe,p.graphMin,p.graphMax,y,-B),q.b&&(f=ie.calculateX(q.b,p.graphMin,p.graphMax,y,C-B));const ke=fe>0?-1:1;N=fe&&Math.abs(N)===0?ke:N}else{const fe=q.b?q.o:q.y;v=ie.calculateY(fe,g.graphMin,g.graphMax,w,-_),q.b&&(m=ie.calculateY(q.b,g.graphMin,g.graphMax,w,S-_));const ke=fe>0?-1:1;v=fe&&Math.abs(v)===0?ke:v}const J=q.dataColor||this.color,ee=t==null?void 0:t.legendHitInfo,G=(F=t==null?void 0:t.selectLabel)==null?void 0:F.option,ne=(X=t==null?void 0:t.selectItem)==null?void 0:X.option,Z=((H=(U=t==null?void 0:t.selectLabel)==null?void 0:U.selected)==null?void 0:H.dataIndex)??[],{dataIndex:re,seriesID:me}=(($=t==null?void 0:t.selectItem)==null?void 0:$.selected)??{};let ae=!1;if(ee?ae=(ee==null?void 0:ee.sId)!==this.sId:G!=null&&G.use&&(G!=null&&G.useSeriesOpacity)?ae=Z.length&&!Z.includes(j):ht(re)&&(ne!=null&&ne.useSeriesOpacity)&&(this.isExistGrp?ae=re!==j:ae=re!==j||me!==this.sId),typeof J!="string")s.fillStyle=ie.createGradient(s,n,{x:f,y:m,w:N,h:v},J,ae,t.unSelectedOpacity);else{const fe=J.includes("rgba")?Y.getOpacity(J):1,ke=ae?t.unSelectedOpacity:fe;s.fillStyle=Y.colorStringToRgba(J,ke)}this.drawBar({ctx:s,positions:{x:f,y:m,w:N,h:v}}),o.use&&this.drawValueLabels({context:s,data:q,positions:{x:f,y:m,h:v,w:N},isHighlight:!1,textColor:q.dataTextColor,index:j}),q.xp=f,q.yp=m,q.w=N,q.h=n?-v:v,q.index=j,this.data[K]=q}}}itemHighlight(t,n,o,s){const l=this.showValue,a=t.data,r=n,c=a.xp,d=a.yp,h=a.w,f=a.h;r.save(),r.shadowOffsetX=0,r.shadowOffsetY=0,r.shadowBlur=4;const m=t.data.dataColor||this.color;if(typeof m!="string"){const p=ie.createGradient(r,this.isHorizontal,{x:c,y:d,w:h,h:f},m,!1,s);r.fillStyle=p,r.shadowColor=m[m.length-1][1]}else r.fillStyle=m,r.shadowColor=m;r.beginPath(),this.drawBar({ctx:r,positions:{x:c,y:d,w:h,h:this.isHorizontal?-f:f}}),l.use&&this.drawValueLabels({context:r,data:a,positions:{x:c,y:d,h:f,w:h},isHighlight:!0,textColor:t.data.dataTextColor||t.dataTextColor,index:o}),r.restore()}findGraphData(t,n,o,s){if(typeof o=="number"&&this.show&&s){const l=this.data,a={data:null,hit:!1,color:this.color};return l[o]&&(a.data=l[o],a.index=o,a.hit=this.isPointInBar(t,l[o])),a}return n?this.findGraphRangeCount(t):this.findGraphRange(t)}binarySearchBar(t,n){const[o,s]=t,l={data:null,hit:!1,color:this.color},a=this.data,r=this.filteredCount??a.length;let c=0,d=r-1;for(;c<=d;){const h=Math.floor((c+d)/2),f=a[h],{xp:m,yp:p,w:g,h:u}=f,x=m+g,b=p+u;if(n?b<=s&&s<=p:m<=o&&o<=x)return l.data=f,l.index=f.index,l.hit=this.isPointInBar(t,f),l;(n?!(b<s):m+4<o)?c=h+1:d=h-1}return l}findGraphRange(t){return this.binarySearchBar(t,!1)}findGraphRangeCount(t){return this.binarySearchBar(t,!0)}drawValueLabels({context:t,data:n,positions:o,isHighlight:s,textColor:l,index:a}){const r=this.isHorizontal,{fontSize:c,textColor:d,align:h,formatter:f,decimalPoint:m}=this.showValue,{x:p,y:g,w:u,h:x}=o,b=t;b.save(),b.beginPath(),b.font=`normal normal normal ${c}px Roboto`,b.fillStyle=l||d,b.lineWidth=1,b.textBaseline="middle",b.textAlign=r&&h!=="center"?"left":"center";let y;const w=ht(this.stackIndex);w?y=n.o:y=(r?n.x:n.y)??"";let I;f&&(I=f(y,{label:r?n.y:n.x,index:a})),(!f||typeof I!="string")&&(I=Y.labelSignFormat(y,m)??"");const E=y<0,B=Math.round(b.measureText(I).width),_=c,C=10,S=E?p-C:p+C,M=E?g+C:g-C,k=p+u/2,T=s?g+x/2:g-x/2,R=Math.abs(u)-C,L=Math.abs(x)-C;switch(h){case"start":{if(r&&B<R){const N=E?S-B:S;b.fillText(I,N,T)}else if(!r&&_<L){const N=E?g+C:g-C;b.fillText(I,k,N)}break}case"center":{r&&B<R?b.fillText(I,k,T):!r&&_<L&&b.fillText(I,k,g+x/2);break}case"out":{if(w){console.warn("[EVUI][Bar Chart] In case of Stack Bar Chart, 'out' of 'showValue''s align is not supported.");return}if(r){const N=this.chartRect.x1+this.labelOffset.left,v=this.chartRect.x2-this.labelOffset.right;if(E){const O=p-C+u-B;O>N&&b.fillText(I,O,T)}else{const O=p+C+u;O+B<v&&b.fillText(I,O,T)}}else{const N=E?g+x+C:g+x-C;b.fillText(I,k,N)}break}default:case"end":{if(r&&B<R){const N=E?p+u+C:p+u-B-C;b.fillText(I,N,T)}else if(!r){if(E){const N=g+x-C;N>M&&b.fillText(I,k,N)}else if(_<L){const N=g+x+C;b.fillText(I,k,N)}}break}}b.restore()}calculateBarSize(t,n){return typeof t=="string"&&/[0-9]+px/.test(t)?Math.min(n,Number(t.replace("px",""))):typeof t=="number"&&t<=1&&t>=0?Math.ceil(n*t):n}drawBar({ctx:t,positions:n}){const{isHorizontal:o,borderRadius:s}=this,l="stackIndex"in this,a=s&&s>0,{x:r,y:c,w:d}=n,h=o?-n.h:n.h;if(!(d===0||h===0)){if(t.save(),a&&!l)try{this.drawRoundedRect(t,n)}catch{t.fillRect(r,c,d,h)}else t.fillRect(r,c,d,h);t.restore()}}isPointInBar(t,n){const[o,s]=t,{xp:l,yp:a,w:r,h:c}=n,d=l+r,h=a+c;return l<=o&&o<=d&&h<=s&&s<=a}drawRoundedRect(t,n){const{chartRect:o,labelOffset:s,isHorizontal:l,borderRadius:a}=this,{x:r,y:c}=n;let{w:d,h}=n,f=a;const m=new Path2D;m.rect(o.x1+s.left,o.y1,o.chartWidth-s.right,o.chartHeight-s.bottom),t.clip(m),t.beginPath(),t.moveTo(r,c),Math.abs(d)<f*2&&(f=Math.abs(d)/2),Math.abs(h)<f*2&&(f=Math.abs(h)/2),l?d<0?(d+=f,t.lineTo(r+d,c),t.arcTo(r+d-f,c,r+d-f,c-f,f),t.arcTo(r+d-f,c-h,r+d,c-h,f),t.lineTo(r,c-h),t.lineTo(r,c)):(d-=f,t.lineTo(r+d,c),t.arcTo(r+d+f,c,r+d+f,c-f,f),t.arcTo(r+d+f,c-h,r+d,c-h,f),t.lineTo(r,c-h),t.lineTo(r,c)):h>0?(h-=f,t.lineTo(r+d,c),t.lineTo(r+d,c+h),t.arcTo(r+d,c+h+f,r-d+f,c+h+f,f),t.arcTo(r,c+h+f,r,c+h,f),t.lineTo(r,c)):(h+=f,t.lineTo(r+d,c),t.lineTo(r+d,c+h),t.arcTo(r+d,c+h-f,r+d-f,c+h-f,f),t.arcTo(r,c+h-f,r,c+h,f),t.lineTo(r,c)),t.fill(),t.closePath()}}class IC extends Nr{draw(t){if(!this.show)return;const n=t.ctx,o=t.chartRect,s=t.labelOffset,l=t.axesSteps,a=t.showIndex,r=t.isHorizontal,c=t.thickness,d=t.showSeriesCount;let h,f;const m=l.x[this.xAxisIndex],p=l.y[this.yAxisIndex],g=o.chartWidth-(s.left+s.right),u=o.chartHeight-(s.top+s.bottom),x=o.x1+s.left,b=o.y2-s.bottom,y=o.x2-s.right,I=(r?u:g)/(this.data.length||1),E=2;let B;this.isExistGrp?B=I-E*2:B=(I-E*2)/d;const C=typeof c=="string"&&/[0-9]+px/.test(c)?Math.min(B,Number(c.replace("px",""))):typeof c=="number"&&c<=1&&c>=0?Math.ceil(B*c):B;let S=r?null:C,M=r?null:C,k=r?C:null;const T=r?(B-k)/2:(B-S)/2,R=this.isExistGrp?1:a+1;this.size.cat=I,this.size.bar=B,this.size.cPad=E,this.size.bPad=T,this.size.w=S,this.size.ix=R,this.chartRect=o,this.labelOffset=s,this.borderRadius=t.borderRadius,this.data.forEach((L,N)=>{if(n.beginPath(),r?(h=x,f=ie.calculateY(L.y,p.graphMin,p.graphMax,u,b)):(h=ie.calculateSubX(L.x,m.graphMin,m.graphMax,g,x),h<x?(M-=x-h,h=h+S<x?null:x):h+S>y&&(M-=M-(y-h)),h>=y&&(h=null),h!==null&&(h+=Math.ceil(B*R)-Math.round(S+T)),f=b),r?L.b?(S=ie.calculateX(L.x-L.b,m.graphMin,m.graphMax,g),h=ie.calculateX(L.b,m.graphMin,m.graphMax,g,x)):S=ie.calculateX(L.x,m.graphMin,m.graphMax,g):L.b?(k=ie.calculateY(L.y-L.b,p.graphMin,p.graphMax,u),f=ie.calculateY(L.b,p.graphMin,p.graphMax,u,b)):k=ie.calculateY(L.y,p.graphMin,p.graphMax,u),h!==null&&f!==null){const v=L.dataColor||this.color,O=v.includes("rgba")?Y.getOpacity(v):1,D=this.state==="downplay"?t.unSelectedOpacity:O;typeof v!="string"?(S=S!==M?M:S,n.fillStyle=ie.createGradient(n,r,{x:h,y:f,w:S,h:k},v,this.state==="downplay",t.unSelectedOpacity)):n.fillStyle=Y.colorStringToRgba(v,D),this.drawBar({ctx:n,positions:{x:h,y:f,w:S,h:k}}),this.showValue.use&&this.drawValueLabels({context:n,data:L,positions:{x:h,y:f,h:k,w:S},isHighlight:!1,index:N})}M=S,L.xp=h,L.yp=f,L.w=S,L.h=r?-k:k})}}class vC{constructor(t,n,o){const s=ys({},wC,n);Object.keys(s).forEach(l=>{this[l]=s[l]}),this.name===void 0&&(this.name=`series-${o}`),this.color===void 0&&(this.color=Nt[o%Nt.length]),this.sId=t,this.show=!0,this.data=[],this.type="pie",this.centerX=0,this.centerY=0,this.radius=0,this.doughnutHoleSize=0,this.startAngle=0,this.endAngle=0,this.ctx=null,this.isSelect=!1}draw(t,n,o){var h;const s=t??this.ctx,l=new Path2D,a=this.isSelect?this.radius+5:this.radius,r=this.color,c=r.includes("rgba")?Y.getOpacity(r):1,d=this.isDownplay?o:c;s.beginPath(),l.moveTo(this.centerX,this.centerY),l.arc(this.centerX,this.centerY,a,this.startAngle,this.endAngle),l.lineTo(this.centerX,this.centerY),s.fillStyle=Y.colorStringToRgba(r,d),s.fill(l),n.use&&(s.lineCap="round",s.lineWidth=n==null?void 0:n.lineWidth,s.strokeStyle=n==null?void 0:n.color,s.stroke(l)),(h=this.showValue)!=null&&h.use&&this.drawValueLabels(s),s.closePath(),this.ctx=s}findGraphData([t,n]){const o={data:null,hit:!1,color:null,index:-1},{radius:s,startAngle:l,endAngle:a,centerX:r,centerY:c}=this,d=Math.sqrt((t-r)**2+(n-c)**2),h=2.5*Math.PI-Math.atan2(t-r,n-c),f=s>d&&h>=l&&h<=a;return this.show&&f&&(o.type=this.type,o.data=this.data,o.hit=!0,o.color=this.color,o.index=0),o}itemHighlight(t,n){var a,r;const o=n,s=this.isSelect?this.radius+5:this.radius;o.save(),o.shadowOffsetX=0,o.shadowOffsetY=0,o.shadowBlur=4;const l=((a=t==null?void 0:t.data)==null?void 0:a.dataColor)||this.color;o.fillStyle=l,o.shadowColor=l,o.beginPath(),o.moveTo(this.centerX,this.centerY),o.arc(this.centerX,this.centerY,s,this.startAngle,this.endAngle),o.lineTo(this.centerX,this.centerY),o.fill(),(r=this.showValue)!=null&&r.use&&this.drawValueLabels(o),o.closePath(),o.restore()}drawValueLabels(t){const n=t,o=this.data.o,{fontSize:s,textColor:l,formatter:a}=this.showValue;let r;a&&(r=a({value:o,percentage:this.data.percentage})),(!a||typeof r!="string")&&(r=Y.labelSignFormat(o));const c=1.8,d=this.radius-this.doughnutHoleSize,h=(this.endAngle-this.startAngle)*180/Math.PI,f=s+4,m=Math.round(n.measureText(r).width);if(h>=m*c&&h>=f*c&&d>=m*c&&d>=f*c){n.save(),n.beginPath();const p=l.includes("rgba")?Y.getOpacity(l):1,g=this.state==="downplay"?this.unSelectedOpacity:p;n.font=`normal normal normal ${s}px Roboto`,n.fillStyle=Y.colorStringToRgba(l,g),n.lineWidth=1,n.textAlign="center",n.textBaseline="middle";const u=d/2+this.doughnutHoleSize,x=(this.endAngle-this.startAngle)/2+this.startAngle,b=u*Math.cos(x)+this.centerX,y=u*Math.sin(x)+this.centerY;n.fillText(r,b,y),n.restore()}}}class TC{constructor(t,n,o,s,l){const a=ys({},kC,n);Object.keys(a).forEach(r=>{this[r]=a[r]}),this.isHorizontal=s,this.isGradient=l,this.createColorState(o),this.sId=t,this.data=[],this.labels={x:[],y:[]},this.valueOpt={},this.size={w:0,h:0},this.type="heatMap",this.currentLabelInfo={x:{steps:0,min:0,max:0},y:{steps:0,min:0,max:0}}}createColorState(t){const n=[],o=/[^0-9]&[^,]/g,{min:s,max:l,rangeCount:a,colorsByRange:r,error:c,stroke:d}=t,h=s.includes("#")?Y.hexToRgb(s):s.replace(o,""),f=l.includes("#")?Y.hexToRgb(l):l.replace(o,""),[m,p,g]=h.split(","),[u,x,b]=f.split(",");if(this.isGradient)n.push({minColor:{minR:m,minG:p,minB:g},maxColor:{maxR:u,maxG:x,maxB:b},rangeCount:a,start:0,end:100,selectedValue:null});else if(r.length)r.forEach(({color:y,label:w},I)=>{n.push({id:`color#${I}`,color:y,label:w,state:"normal",show:!0})});else{const y=Math.floor((m-u)/(a-1)),w=Math.floor((p-x)/(a-1)),I=Math.floor((g-b)/(a-1));for(let E=0;E<a;E++){const B=+m-y*E,_=+p-w*E,C=+g-I*E;n.push({id:`color#${E}`,color:`rgb(${B},${_},${C})`,state:"normal",show:!0})}}this.colorState=n,this.errorColor=c,this.stroke=d}getColorForGradient(t){const{minColor:n,maxColor:o}=this.colorState[0],{minR:s,minG:l,minB:a}=n,{maxR:r,maxG:c,maxB:d}=o,h=+s-Math.floor((s-r)*t/100),f=+l-Math.floor((l-c)*t/100),m=+a-Math.floor((a-d)*t/100);return`rgb(${h},${f},${m})`}getColorIndexByValue(t){const{existError:n,min:o,interval:s,decimalPoint:l}=this.valueOpt,a=this.colorState.length-1;if(n&&t<0)return a;const r=Math.floor(+(t-o).toFixed(l)/s);return r>=a?n?a-1:a:r}getItemInfo(t){const{min:n,max:o}=this.valueOpt,s={show:!1,opacity:1,dataColor:null,id:null,isHighlight:null};if(this.isGradient){const l=We(t-n,o-n),{start:a,end:r,selectedValue:c}=this.colorState[0];(t<0||a<=l&&l<=r)&&(s.show=!0,s.isHighlight=c!==null&&Math.floor(t)===Math.floor(n+(o-n)*(c/100)),s.dataColor=t<0?this.errorColor:this.getColorForGradient(l))}else{const l=this.getColorIndexByValue(t),{show:a,state:r,color:c,id:d}=this.colorState[l];s.show=a,s.opacity=r==="downplay"?.1:1,s.dataColor=t<0?this.errorColor:c,s.id=d}return s}drawItem(t,n,o,s,l,a){if(t.beginPath(),!(s<0||l<0)){if(a.show){const{radius:r}=a;if(r>0){const c=Math.min(s,l);let d=r;d>c/2&&(d=Math.floor(c/2)),t.moveTo(n+d,o),t.arcTo(n+s,o,n+s,o+l,d),t.arcTo(n+s,o+l,n,o+l,d),t.arcTo(n,o+l,n,o,d),t.arcTo(n,o,n+s,o,d),t.stroke(),t.fill()}else t.strokeRect(n,o,s,l),t.fillRect(n,o,s,l)}else{const r=Y.aliasPixel(1);t.fillRect(n,o-r,s+r,l+r)}t.closePath()}}calculateXY(t,n,o,s){let l=null;if(this.labels[t]&&this.labels[t].length){let a=this.labels[t].findIndex(m=>m===n);a===-1&&(a=this.labels[t].findIndex(m=>+m==+n));const{minIndex:r,maxIndex:c,graphMin:d,graphMax:h}=s;if(ve(c)&&a>c||ve(r)&&a<r||Gi(r)&&Gi(c)&&(n<d||n>h))return null;const f=r??this.labels[t].findIndex(m=>+m==+d);a>-1&&(a-=f>-1?f:0,l=t==="x"?o+this.size.w*a:o-this.size.h*(a+1))}return l}draw(t){if(!this.show)return;const{ctx:n,chartRect:o,labelOffset:s,overlayCtx:l,selectLabel:a,legendHitInfo:r,selectItem:c,axesSteps:d}=t,h=o.chartWidth-(s.left+s.right),f=o.chartHeight-(s.top+s.bottom),m=o.x1+s.left,p=o.y2-s.bottom,g=d.x[this.xAxisIndex],u=d.y[this.yAxisIndex];this.size.w=h/g.oriSteps,this.size.h=f/u.oriSteps,this.currentLabelInfo={x:{steps:g.oriSteps,min:g.graphMin,max:g.graphMax},y:{steps:u.oriSteps,min:u.graphMin,max:u.graphMax}};const x=(b,y,w)=>{var I,E;if(!r){let B;const{option:_,selected:C}=c,{option:S,selected:M}=a,k=ht(C==null?void 0:C.dataIndex)&&(C==null?void 0:C.dataIndex)>-1,T=((I=M==null?void 0:M.label)==null?void 0:I.length)>0;return k?B=_.useSeriesOpacity?w!==(C==null?void 0:C.dataIndex):!1:T&&(B=S.useSeriesOpacity?!((E=M==null?void 0:M.label)!=null&&E.includes(this.getItemLabel(a,b))):!1),B?.1:y}return y};this.data.forEach((b,y)=>{var S;let I=this.calculateXY("x",b.x,m,g),E=this.calculateXY("y",b.y,p,u),B=this.size.w,_=this.size.h;const C=b.o;if(I!==null&&E!==null&&C!==null&&C!==void 0){const{show:M,opacity:k,dataColor:T,id:R,isHighlight:L}=this.getItemInfo(C);let N=k;k===1&&Y.getColorStringType(b.dataColor)==="RGBA"&&(N=Y.getOpacity(b.dataColor));const v=x(b,N,y);if(b.dataColor||(b.dataColor=T),b.cId=R,n.save(),M){n.fillStyle=Y.colorStringToRgba(b.dataColor,v);let O=this.stroke;const D=c==null?void 0:c.option,V=(D==null?void 0:D.use)&&(D==null?void 0:D.showBorder),P=y===((S=c==null?void 0:c.selected)==null?void 0:S.dataIndex);V&&P&&(O={show:D==null?void 0:D.showBorder,...D==null?void 0:D.borderStyle});let A=!1;if(O.show&&O.lineWidth>0){const{color:F,lineWidth:X,opacity:U}=O,H=X*2;A=H<Math.floor(B)&&H<Math.floor(_),n.strokeStyle=A?Y.colorStringToRgba(F,v===1?U:v):void 0,A?(n.lineWidth=X,I+=X,E+=X,B-=H,_-=H):n.lineWidth=0}I+=1,b.xp=I,b.yp=E,b.w=B,b.h=_,this.drawItem(n,I,E,B,_,{...O,show:A}),n.restore(),this.showValue.use&&this.drawValueLabels({context:n,data:b}),L&&this.itemHighlight({data:b},l)}}})}drawValueLabels({context:t,data:n}){const{fontSize:o,textColor:s,align:l,formatter:a,decimalPoint:r}=this.showValue,{xp:c,yp:d,w:h,h:f,o:m}=n,p=t;p.save(),p.beginPath(),p.font=`normal normal normal ${o}px Roboto`,p.fillStyle=s,p.lineWidth=1,p.textBaseline="middle",p.textAlign=l!=="center"?"left":"center";let g;a&&(g=a(m)),(!a||typeof g!="string")&&(g=Y.labelSignFormat(m,r));const u=Math.round(p.measureText(g).width),x=o,b=c+h/2,y=d+f/2;if(!(u>=h||x>=f||g<0)){switch(l){case"top":{const w=b-u/2,I=y-x/2;p.fillText(g,w,I);break}case"right":{const w=c+h-u;p.fillText(g,w,y);break}case"bottom":{const w=b-u/2,I=y+x/2;p.fillText(g,w,I);break}case"left":p.fillText(g,c,y);break;default:{const w=b-u/2;p.fillText(g,w,y);break}}p.restore()}}getAdjustedBounds({xp:t,yp:n,width:o,height:s}){const a=Math.max(0,o),r=Math.max(0,s);return{xsp:Math.floor(t*100)/100,xep:Math.ceil((t+a)*100)/100,ysp:Math.floor(n*100)/100,yep:Math.ceil((n+r)*100)/100}}findItems(t){const n=this.data,{xsp:o,xep:s,ysp:l,yep:a}=this.getAdjustedBounds({xp:t.xsp,yp:t.ysp,width:t.width,height:t.height});return n.filter(({xp:r,yp:c,w:d,h})=>{const{xsp:f,xep:m,ysp:p,yep:g}=this.getAdjustedBounds({xp:r,yp:c,width:d,height:h});return f>=o&&m<=s&&p>=l&&g<=a})}itemHighlight(t,n){var u;const o=t.data,s=n,{stroke:l,shadow:a}=this.highlight,r=o.xp,c=o.yp,d=o.w,h=o.h,f=o.cId;let m;if(this.isGradient){const{min:x,max:b}=this.valueOpt,y=We(o.o-x,b-x),{start:w,end:I}=this.colorState[0];m=w<=y&&y<=I||o.o===-1}else m=(u=this.colorState.find(({id:x})=>x===f))==null?void 0:u.show;if(r===null||c===null||!m)return;s.save();const p=Y.getColorStringType(o.dataColor)==="RGBA"?t.dataColor:Y.colorStringToRgba(o.dataColor,1);s.fillStyle=p,a.use&&(s.shadowOffsetX=a.offsetX,s.shadowOffsetY=a.offsetY,s.shadowBlur=a.blur,s.shadowColor=a.color);const g={color:"",lineWidth:1,opacity:1,radius:0,show:!0};if(l.use){const{color:x,width:b,radius:y}=l;g.show=!0,g.radius=y,s.lineWidth=b,g.lineWidth=b,s.strokeStyle=x||p,g.color=x||p}else g.show=!1,s.strokeStyle=p,g.color=p;this.drawItem(s,r-.5,c-.5,d+1,h+1,g),s.restore(),this.showValue.use&&this.drawValueLabels({context:s,data:o})}findGraphData(t){const n=t[0],o=t[1],s={data:null,hit:!1,color:null,dataColor:null,name:null},l=this.data,a=l.findIndex(r=>{const{xp:c,yp:d,w:h,h:f}=r;return c<=n&&n<=c+h&&d<=o&&o<=d+f});if(a>-1){const r=l[a];s.data=r,s.color=r.dataColor,s.dataColor=r.dataColor,s.index=a,s.hit=!0}return s}findBlockRange({xcp:t,xep:n,ycp:o,yep:s,range:l}){const a=this.labels,r=1,c={xsp:Math.min(t,n),ysp:Math.min(o,s),width:Math.ceil(Math.abs(n-t)),height:Math.ceil(Math.abs(s-o))};if(a.x.length&&a.y.length){const d=this.currentLabelInfo.x.steps||a.x.length,h=this.currentLabelInfo.y.steps||a.y.length,{x1:f,x2:m,y1:p,y2:g}=l,u=(m-f)/d,x=(g-p)/h,b={xsp:t,xep:n,ysp:o,yep:s},y=(w,I,E)=>{let B,_,C;w==="x"?(_=u,C=f+r):(_=x,C=p),a[w].findIndex((M,k)=>(B=C+_*k,B<=I&&I<=B+_))>-1?b[E]=["xsp","ysp"].includes(E)?B:B+_:I<C&&(b[E]=C)};y("x",Math.min(t,n),"xsp"),y("x",Math.max(t,n),"xep"),y("y",Math.min(o,s),"ysp"),y("y",Math.max(o,s),"yep"),c.xsp=Math.min(b.xsp,b.xep),c.ysp=Math.min(b.ysp,b.yep),c.width=Math.abs(b.xep-b.xsp),c.height=Math.abs(b.yep-b.ysp)}return c}getFilteredLabel(t,n,o,s){return t.length!==n?t.filter(l=>o<=l&&l<=s):t}findSelectionRange(t){const{xsp:n,ysp:o,width:s,height:l,range:a}=t;let r=null;const{x1:c,x2:d,y1:h,y2:f}=a,{x:m,y:p}=this.labels;if(m.length&&p.length){const{x:{steps:g,min:u,max:x},y:{steps:b,min:y,max:w}}=this.currentLabelInfo,I=g||m.length,E=b||p.length,B=(d-c)/I,_=(f-h)/E,C=n+s,S=o+l,M={min:Math.floor((n-c)/B),max:Math.floor((C-c-B)/B)},k=E-1,T={min:k-Math.round((S-h-_)/_),max:k-Math.round((o-h)/_)},R=this.getFilteredLabel(m,I,u,x),L=this.getFilteredLabel(p,E,y,w);r={xMin:R[M.min],xMax:R[M.max],yMin:L[T.min],yMax:L[T.max]}}return r}getItemLabel(t,n){const{option:o,selected:s}=t;let l=this.isHorizontal?n.y:n.x;return o!=null&&o.useBothAxis&&(s!=null&&s.targetAxis)&&(l=(s==null?void 0:s.targetAxis)==="yAxis"?n.y:n.x),l}}const Lr={Store:bC,Series:{createSeriesSet(e,t,n,o){let s=Object.keys(e);this.options.overlapping.use&&(s=this.getOverlappingSeriesKeys(e,t,o)),s.forEach((l,a)=>{const r=e[l].type||t;this.seriesList[l]=this.addSeries({type:r,id:l,opt:e[l],index:a,isHorizontal:n})})},getOverlappingSeriesKeys(e,t,n){const o=[],s=[],l=n.flat();return Object.keys(e).forEach(a=>{if((e[a].type||t)==="bar"&&l.length){const d=l.findIndex(h=>h===a);o.push({key:a,overlappingIdx:d})}else s.push({key:a})}),o.sort((a,r)=>r.overlappingIdx-a.overlappingIdx),[...o,...s].map(({key:a})=>a)},addSeries(e){var a;const{type:t,id:n,opt:o,index:s,isHorizontal:l}=e;if(t==="line")return this.seriesInfo.charts.line.push(n),new MC(n,o,s);if(t==="scatter")return this.seriesInfo.charts.scatter.push(n),new EC(n,o,s,(a=this.options.realTimeScatter)==null?void 0:a.use);if(t==="bar")return this.seriesInfo.charts.bar.push(n),o.timeMode?new IC(n,o,s,l):new Nr(n,o,s,l);if(t==="pie")return this.seriesInfo.charts.pie.push(n),new vC(n,o,s);if(t==="heatMap"){this.seriesInfo.charts.heatMap.push(n);const{heatMapColor:r,legend:c}=this.options,d=c.type==="gradient";return new TC(n,o,r,l,d)}return!1},addGroupInfo(e){e.forEach((t,n)=>{let o=0;t.reduce((s,l,a)=>{const r=this.seriesList[l];return r.stackIndex=a+o,r.groupIndex=n,r.isExistGrp=!0,r.bsId=s,r.bsIds=t.filter((c,d)=>c!==l&&a>d),r.isOverlapping=this.options.overlapping.use,r.show||o--,r.show?l:s},t[0])})}}};class oo{constructor(t,n,o,s){const l=Fe({},n,Br);Object.keys(l).forEach(a=>{this[a]=l[a]}),this.type=t,this.ctx=o,this.units=CC[this.type],this.options=s,this.position||(this.position=t==="x"?"bottom":"left")}calculateLabelRange(t,n,o,s){let l,a,r;t==="x"?(l=n.chartWidth,r=Math.floor(s*1.1),a=[o.left,o.right]):(l=n.chartHeight,a=[o.top,o.bottom],r=s+Math.floor(l*.1));const c=l-(a[0]+a[1]),d=1,h=Math.max(Math.floor(c/r)-1,1);return{min:d,max:h}}calculateScaleRange(t,n){var d;let o,s,l=!1;const a=n!=null&&n.use?n==null?void 0:n.range:this.range;Array.isArray(a)&&(a==null?void 0:a.length)===2?this.options.type==="heatMap"?(o=a[1]>+t.max?+t.max:a[1],s=a[0]<+t.min?+t.min:a[0]):(o=a[1],s=a[0]):typeof a=="function"?[s,o]=a(t.min,t.max):(o=t.max,s=t.min),this.autoScaleRatio&&(o=Math.ceil(o*(this.autoScaleRatio+1))),this.startToZero&&(s=0),o===s&&(o+=1,l=!0);const r=this.getLabelFormat(s),c=this.getLabelFormat(o,{isMaxValueSameAsMin:l});return{min:s,max:o,minLabel:r,maxLabel:c,size:Y.calcTextSizeCanvas(c,Y.getLabelStyle(this.labelStyle),(d=this.labelStyle)==null?void 0:d.padding)}}getLabelWidthHasMaxLength(t,n){return(t??[]).reduce((o,s)=>{var r;const l=this.getLabelFormat(s),a=((r=Y.calcTextSizeCanvas(l,Y.getLabelStyle(this.labelStyle)))==null?void 0:r.width)??0;return Math.max(o,a)},0)}calculateSteps(t){const{maxValue:n,minValue:o}=t;let{maxSteps:s}=t,l=this.getInterval(t),a=o,r;for(;a<n;)a+=l;const c=a,d=o,h=c-d;if(r=Math.round(h/l),n===1&&(this.decimalPoint?s>2?(l=.2,r=5,s=5):(l=.5,r=2,s=2):(l=1,r=1,s=1)),this.fixedSteps)return{steps:r,interval:l,graphMin:d,graphMax:c};for(;r>s;)l*=2,r=Math.round(h/l),l=Math.ceil(h/r);return c-d>r*l&&(l=Math.ceil((c-d)/r)),{steps:r,interval:l,graphMin:d,graphMax:c}}drawAxisTitle(t,n){const o=this.title;if(!(o!=null&&o.use)||isNaN(o.fontSize))return;const s=this.ctx;s.save(),s.font=Y.getLabelStyle(o),s.fillStyle=o.color,s.textAlign=o.textAlign;const l={xLeft:t.x1+n.left,xRight:t.x2-n.right,yTop:t.y1};let a,r;const c=10;this.type==="x"?(a=l.xRight,r=t.y2+o.fontSize+c):(r=l.yTop-o.fontSize-c,a=l.xLeft),a>0&&r>0&&s.fillText(o.text,a,r),s.restore()}draw(t,n,o,s,l,a){var I,E,B,_,C,S,M,k,T,R,L,N,v,O,D,V,P,A,F,X;const r=this.ctx,c=this.options,d={x1:t.x1+n.left,x2:t.x2-n.right,y1:t.y1+n.top,y2:t.y2-n.bottom},h=o.steps,f=o.graphMin,m=o.graphMax,p=o.interval,g=d[this.units.rectStart],u=d[this.units.rectEnd],x=d[this.units.rectOffset(this.position)],b=d[this.units.rectOffsetCounter(this.position)],y=5;let w;if(this.drawAxisTitle(t,n),r.font=Y.getLabelStyle(this.labelStyle),r.fillStyle=this.labelStyle.color,this.type==="x"?(r.textAlign="center",r.textBaseline=this.position==="top"?"bottom":"top"):(r.textAlign=this.position==="left"?"right":"left",r.textBaseline="middle"),this.showAxis&&(r.lineWidth=this.axisLineWidth,w=Y.aliasPixel(r.lineWidth),r.beginPath(),r.strokeStyle=this.axisLineColor,this.type==="x"?(r.moveTo(g,x+w),r.lineTo(u,x+w)):(r.moveTo(x+w,g),r.lineTo(x+w,u)),r.stroke(),r.closePath()),!(h===0||f===null)){if((I=this.labelStyle)!=null&&I.show){const U=u-g,H=U/h,$=[],j=o.interval;let K=null,q=null,Q=g,J=f;if(this.type==="x"&&(c!=null&&c.axesX[0].flow)&&a.length!==h+1){const G=Math.floor(f/j)*j;G!==+f&&(J=G+j,Q+=U/(m-f)*(J-f))}r.strokeStyle=this.gridLineColor,r.lineWidth=1,w=Y.aliasPixel(r.lineWidth);let ee;for(let G=0;G<=h;G++)if(K=Math.round(Q+H*G),K<=u||this.type!=="x"||!(c!=null&&c.axesX[0].flow)||a.length===h+1){r.beginPath(),$[G]=J+G*p,$[G]===0&&this.zeroLineColor?r.strokeStyle=this.zeroLineColor:r.strokeStyle=this.gridLineColor,q=K+w,ee=this.getLabelFormat(Math.min(m,$[G]),{prev:$[G-1]??""});const Z=((B=(E=this.options)==null?void 0:E.selectLabel)==null?void 0:B.use)&&((C=(_=this.options)==null?void 0:_.selectLabel)==null?void 0:C.useLabelOpacity)&&this.options.horizontal===(this.type==="y")&&((S=l==null?void 0:l.dataIndex)==null?void 0:S.length)&&!(l!=null&&l.label.map(fe=>this.getLabelFormat(Math.min(m,fe),{prev:$[G-1]??""})).includes(ee)),re=this.labelStyle.color;let me=1;Y.getColorStringType(re)==="RGBA"&&(me=Y.getOpacity(re)),r.fillStyle=Y.colorStringToRgba(re,Z?(M=this.options)==null?void 0:M.unSelectedOpacity:me);let ae;if(this.type==="x"){if(ae=this.position==="top"?x-10:x+10,((k=c==null?void 0:c.brush)!=null&&k.showLabel||!(c!=null&&c.brush))&&r.fillText(this.checkFixWidth(ee),K,ae),!Z&&((T=c==null?void 0:c.selectItem)!=null&&T.showLabelTip)&&(s!=null&&s.label)&&!((R=this.options)!=null&&R.horizontal)){const fe=this.getLabelFormat(Math.min(m,s.label+0*p));if(fe===ee){const ke=Math.round(r.measureText((L=this.labelStyle)==null?void 0:L.fontSize).width);Y.showLabelTip({ctx:this.ctx,width:Math.round(r.measureText(fe).width)+10,height:ke,x:K,y:ae+(ke-2),borderRadius:2,arrowSize:3,text:ee,backgroundColor:(v=(N=c==null?void 0:c.selectItem)==null?void 0:N.labelTipStyle)==null?void 0:v.backgroundColor,textColor:(D=(O=c==null?void 0:c.selectItem)==null?void 0:O.labelTipStyle)==null?void 0:D.textColor})}}this.showAxisTick&&(r.beginPath(),r.strokeStyle=this.axisLineColor,r.moveTo(q,x),r.lineTo(q,x+y),r.stroke(),r.closePath()),(G!==0||c!=null&&c.axesX[0].flow)&&this.showGrid&&(r.beginPath(),r.strokeStyle=this.gridLineColor,r.moveTo(q,x),r.lineTo(q,b),r.stroke(),r.closePath())}else ae=this.position==="left"?x-10:x+10,((V=c==null?void 0:c.brush)!=null&&V.showLabel||!(c!=null&&c.brush))&&r.fillText(this.checkFixWidth(ee),ae,K),G===h&&(q-=1),this.showAxisTick&&(r.beginPath(),r.strokeStyle=this.axisLineColor,r.moveTo(x+(this.axisLineWidth??1),q),r.lineTo(x-y,q),r.stroke(),r.closePath()),G!==0&&this.showGrid&&(r.beginPath(),r.strokeStyle=this.gridLineColor,r.moveTo(x,q),r.lineTo(b,q),r.stroke(),r.closePath())}}if((P=this.plotBands)!=null&&P.length||(A=this.plotLines)!=null&&A.length){const U=t.chartWidth-(n.left+n.right),H=t.chartHeight-(n.top+n.bottom),$=w+1,j=d.x1,K=d.x2+$,q=d.y1-$,Q=d.y2;(F=this.plotBands)==null||F.forEach(J=>{const ee=Fe({},J,Rr),{from:G,to:ne,label:Z}=ee,re=Y.isNullOrUndefined(G)?f:Math.max(G,f),me=Y.isNullOrUndefined(ne)?m:Math.min(ne,m);this.setPlotBandStyle(ee);let ae,fe;if(this.type==="x"){if(ae=ie.calculateX(re,f,m,U,j),fe=ie.calculateX(me,f,m,U,j),ae===null||fe===null)return;this.drawXPlotBand(ae,fe,j,K,q,Q)}else{if(ae=ie.calculateY(re,f,m,H,Q),fe=ie.calculateY(me,f,m,H,Q),ae===null||fe===null)return;this.drawYPlotBand(ae,fe,j,K,q,Q)}if(Z.show){const ke=this.getNormalizedLabelOptions(t,Z),jt=this.getPlotBandLabelPosition(ae,fe,ke,K,q);this.drawPlotLabel(ke,jt)}r.restore()}),(X=this.plotLines)==null||X.forEach(J=>{if(typeof+J.value!="number")return;const ee=Fe({},J,Or),{value:G,label:ne}=ee;let Z;if(this.type==="x"){if(Z=ie.calculateX(G,f,m,U,j),Z===null)return;this.setPlotLineStyle(ee),this.drawXPlotLine(Z,j,K,q,Q)}else{if(Z=ie.calculateY(G,f,m,H,Q),Z===null)return;this.setPlotLineStyle(ee),this.drawYPlotLine(Z,j,K,q,Q)}if(ne.show){const re=this.getNormalizedLabelOptions(t,ne),me=this.getPlotLineLabelPosition(Z,re,K,q);this.drawPlotLabel(re,me)}r.restore()})}}}setPlotLineStyle(t){const n=this.ctx,{color:o,lineWidth:s}=t;n.beginPath(),n.save(),n.lineWidth=s,n.strokeStyle=o,t.segments&&n.setLineDash(t.segments)}setPlotBandStyle(t){const n=this.ctx,{color:o}=t;n.beginPath(),n.save(),n.fillStyle=o}drawXPlotBand(t,n,o,s,l,a){const r=this.ctx,c=d=>d||d>o||d<s;if(!c(t)||!c(n)){r.closePath(),r.restore();return}r.moveTo(t,l),r.lineTo(t,a),r.lineTo(n,a),r.lineTo(n,l),r.lineTo(t,l),r.stroke(),r.fill(),r.restore(),r.closePath()}drawXPlotLine(t,n,o,s,l){const a=this.ctx;if(!t||t<n||t>o){a.closePath(),a.restore();return}let r=t;r+=Y.aliasPixel(a.lineWidth),a.moveTo(r,l),a.lineTo(r,s),a.stroke(),a.restore(),a.closePath()}drawYPlotLine(t,n,o,s,l){const a=this.ctx;if(!t||t>l||t<s){a.closePath(),a.restore();return}let r=t;r+=Y.aliasPixel(a.lineWidth),a.moveTo(n,r),a.lineTo(o,r),a.stroke(),a.restore(),a.closePath()}drawYPlotBand(t,n,o,s,l,a){const r=this.ctx,c=d=>d||d>l||d<a;if(!c(t)||!c(n)){r.closePath(),r.restore();return}r.moveTo(o,t),r.lineTo(o,n),r.lineTo(s,n),r.lineTo(s,t),r.lineTo(o,t),r.fill(),r.restore(),r.closePath()}getNormalizedLabelOptions(t,n){const o=Fe({},n,Dr),s=this.ctx,{maxWidth:l}=o,a=o.fontSize>20?20:o.fontSize;let r=o.text,c=l??s.measureText(r).width;const d=this.type==="y"?t.width-t.chartWidth:l??t.width;return d<s.measureText(r).width&&o.textOverflow==="ellipsis"&&(r=Y.truncateLabelWithEllipsis(o.text,d,s),c=s.measureText(r).width),{label:r,fontSize:a,labelWidth:c,labelBoxPadding:a/4,labelHalfWidth:c/2,labelHalfHeight:a/2,...o}}getPlotBandLabelPosition(t,n,o,s,l){const{fontSize:a,labelWidth:r,labelHalfWidth:c,labelHalfHeight:d,labelBoxPadding:h,textAlign:f,verticalAlign:m}=o;if(a<=0)return{textX:0,textY:0};let p,g;if(this.type==="x")switch(g=l-h-a,f){case"left":p=t+c+h;break;case"right":p=n-c-h;break;case"center":default:p=(n-t)/2+t;break}else switch(p=s+r+h,m){case"top":g=n+d+h;break;case"bottom":g=t-d-h;break;case"middle":default:g=(t-n)/2+n;break}return{textX:p,textY:g}}getPlotLineLabelPosition(t,n,o,s){const{fontSize:l,labelWidth:a,labelHalfWidth:r,labelHalfHeight:c,labelBoxPadding:d}=n;if(l<=0)return{textX:0,textY:0};let h,f;if(this.type==="x")switch(f=s-d-l,n.textAlign){case"left":h=t-r-d;break;case"right":h=t+r+d;break;case"center":default:h=t;break}else switch(h=o+a+d,n.verticalAlign){case"top":f=t-c-d;break;case"bottom":f=t+c+d;break;case"middle":default:f=t;break}return{textX:h,textY:f}}drawPlotLabel(t,n){if(!n)return;const{textX:o,textY:s}=n,{label:l,fontSize:a,fontColor:r,fillColor:c,lineColor:d,lineWidth:h,labelBoxPadding:f,labelWidth:m,labelHalfWidth:p,labelHalfHeight:g}=t;if(a<=0)return;const u=this.ctx;u.save(),u.beginPath(),u.font=Y.getLabelStyle(t);let x=0,b=0,y=0,w=0;this.type==="x"?(x=s-f,b=s+a,y=o-p-f,w=o+p+f):(x=s-g-f,b=s+g+f,y=o-m,w=o+f),u.fillStyle=c,u.strokeStyle=d,u.lineWidth=h,u.moveTo(y,b),u.lineTo(y,x),u.lineTo(w,x),u.lineTo(w,b),u.lineTo(y,b),u.fill(),h>0&&u.stroke(),u.fillStyle=r,u.fillText(l,o,s),u.closePath()}checkFixWidth(t){const{fixWidth:n,fitDir:o}=this.labelStyle;return ve(n)&&n>0?Y.truncateLabelWithEllipsis(t,n,this.ctx,o):t}}class BC extends oo{getLabelFormat(t,n={}){if(this.formatter){const o=this.formatter(t,n);if(typeof o=="string")return o}return at(t).format(this.timeFormat)}getInterval(t){const n=t.maxValue,o=t.minValue,s=t.maxSteps;if(this.interval){if(typeof this.interval=="string")return si[this.interval].size;if(typeof this.interval=="object")return this.interval.time*si[this.interval.unit].size;if(typeof this.interval=="number")return this.interval}return Math.ceil((n-o)/s)}}class DC extends oo{getTruthyValue(t){return ve(t)&&!this.fixedSteps?Number(t.toFixed(this.decimalPoint)):t}getLabelFormat(t,n={}){if(this.formatter){const o=this.getTruthyValue(t),s=this.formatter(o,{...n,prevOriginalValue:n==null?void 0:n.prev,prevDecimalPointValue:this.getTruthyValue(n==null?void 0:n.prev),currentOriginalValue:t,currentDecimalPointValue:o});if(typeof s=="string")return s}return Y.labelSignFormat(t,this.fixedSteps?null:this.decimalPoint)}getInterval(t){if(this.interval)return this.interval;let n=0;const o=t.maxValue,s=t.minValue,l=t.maxSteps;if(!l||l<=0)return 0;if(this.startToZero&&s<0){const a=Math.abs(s)+Math.abs(o),r=Math.abs(s)/a,c=Math.abs(o)/a;let d=Math.max(1,Math.round(r*l)),h=Math.max(1,l-d);d+h>l&&(r>c?d-=1:h-=1),n=Math.max(Math.abs(s)/(d||1),Math.abs(o)/(h||1))}else n=(o-s)/l;return this.decimalPoint?n:Math.ceil(n)}getDecimalPointFromRange({graphRange:t,numberOfSteps:n}){if(n<=0||t===0)return 0;const o=t/n;if(o===0)return 0;let s=0,l=o;for(;l<1&&(l*=10,s++,!(s>10)););return s}getNiceInterval(t){if(!Number.isFinite(t)||t===0)return 0;const n=Math.abs(t),o=Math.floor(Math.log10(n)),s=n/10**o;let l=10;for(let r=0;r<_s.length;r++)if(_s[r]>=s){l=_s[r];break}const a=l*10**o;return t<0?-a:a}getStepsWithNiceScale({max:t,min:n,maxSteps:o}){let s=1/0,l=n,a=0,r=0,c=1/0;const d=o>1?Math.max(2,o-1):1,h=o+1,f=[];for(let m=d;m<=h;m++)f.push(m);for(let m=0;m<f.length;m++){const p=f[m],g=(t-n)/p,u=this.getNiceInterval(g);if(u>0){const x=Math.abs(u),b=Math.floor(n/u)*u,y=b+u*p,w=y-t;w>=0&&w<c&&(s=y,l=b,a=x,c=w,r=p)}}return{max:s,min:l,interval:a,steps:r}}calculateSteps(t){var h,f,m;const{maxValue:n,minValue:o}=t;let{maxSteps:s=1}=t,l=this.getInterval(t),a=0,r=0;o>=0?(a=+o,r=Math.ceil(n/l)*l):n>=0?(a=Math.floor(o/l)*l,r=Math.ceil(n/l)*l):(r=+n,a=Math.floor(o/l)*l);const c=r-a;let d=Math.round(c/l);if(o>0&&n===1&&(this.decimalPoint?s>2?(l=.2,d=5,s=5):(l=.5,d=2,s=2):(l=1,d=1,s=1)),this.fixedSteps)return this.decimalPoint=(h=this==null?void 0:this.getDecimalPointFromRange)==null?void 0:h.call(this,{graphRange:c,numberOfSteps:d}),{steps:d,interval:l,graphMin:a,graphMax:r};for(;d>s;)l*=2,d=Math.round(c/l),l=Math.ceil(c/d);if(c>d*l){const p=c/d;l=this.decimalPoint?p:Math.ceil(p)}if(this.niceScale){const{max:p,min:g,steps:u,interval:x}=this.getStepsWithNiceScale({max:n,min:o,maxSteps:d});if(Number.isFinite(p)&&u!==0){const y=x.toString().includes(".");return this.decimalPoint=y&&this.decimalPoint==="auto"?(f=x.toString().split(".")[1])==null?void 0:f.length:this.decimalPoint,{steps:u,interval:x,graphMin:g,graphMax:p}}}return this.decimalPoint==="auto"&&(this.decimalPoint=(m=this==null?void 0:this.getDecimalPointFromRange)==null?void 0:m.call(this,{graphRange:c,numberOfSteps:d})),{steps:d,interval:l,graphMin:a,graphMax:r}}calculateScaleRange(t,n){var d;let o,s,l=!1;const a=n!=null&&n.use?n==null?void 0:n.range:this.range;if(Array.isArray(a)&&(a==null?void 0:a.length)===2?this.options.type==="heatMap"?(o=a[1]>+t.max?+t.max:a[1],s=a[0]<+t.min?+t.min:a[0]):(o=a[1],s=a[0]):typeof a=="function"?[s,o]=a(t.min,t.max):(o=t.max,s=t.min),this.autoScaleRatio){const h=o,f=o*(this.autoScaleRatio+1);if(o=this.decimalPoint?f:Math.ceil(f),o>0&&s<0){const m=h-o;s+=m}else if(o<0&&s<0){const m=s*(this.autoScaleRatio+1);s=this.decimalPoint?m:Math.ceil(m)}}this.startToZero&&(s>0&&(s=0),o<0&&(o=0)),o===s&&(o+=1,l=!0);const r=this.getLabelFormat(s),c=this.getLabelFormat(o,{isMaxValueSameAsMin:l});return{min:s,max:o,minLabel:r,maxLabel:c,size:Y.calcTextSizeCanvas(c,Y.getLabelStyle(this.labelStyle),(d=this.labelStyle)==null?void 0:d.padding)}}}class OC extends oo{calculateScaleRange(t){let n,o,s=!1;Array.isArray(this.range)&&this.range.length===2?(n=this.range[1],o=this.range[0]):typeof range=="function"?[o,n]=this.range(t.min,t.max):(n=t.max,o=t.min);const l=Y.calculateMagnitude(n-o);n=Math.ceil(n/10**l)*10**l,this.startToZero&&(o=0),n===o&&(n+=1,s=!0);const a=this.getLabelFormat(o),r=this.getLabelFormat(n,{isMaxValueSameAsMin:s});return{min:o,max:n,minLabel:a,maxLabel:r,size:Y.calcTextSize(r,Y.getLabelStyle(this.labelStyle))}}calculateSteps(t,n){const o=t.maxValue,s=t.minValue,l=t.maxSteps,a=Y.calculateMagnitude(o-s);let r=this.getInterval(t),c;const d=o,h=s,f=d-h;for(c=Math.round(f/r),o===1&&(r=.2,c=5);(c>l||c*2<l)&&!n;)if(c>l)r*=2,c=Math.ceil(f/r);else if(a>=0)if(r/2%1===0)r/=2,c=Math.ceil(f/r);else break;else r/=2,c=Math.ceil(f/r);return{steps:c,interval:r,graphMin:h,graphMax:Math.ceil(h+c*r)}}getLabelFormat(t,n={}){if(this.formatter){const o=this.formatter(t,n);if(typeof o=="string")return o}return Y.labelSignFormat(t,this.decimalPoint)}getInterval(t){const n=t.maxValue,o=t.minValue;return 10**Y.calculateMagnitude(n-o)}}class RC extends oo{constructor(t,n,o,s,l){super(t,n,o,l),this.labels=s}calculateScaleRange(t,n,o){var m;const s=this.labelStyle.alignToGridLine?t:Y.getStringMinMax(this.labels);let l=s.max,a=s.min,r=0,c=this.labels.length-1,d=this.labels.length;const h=n!=null&&n.use?n==null?void 0:n.range:this.range;if(Array.isArray(h)&&(h!=null&&h.length)){const[p,g]=h;ve(p)&&ve(g)&&(r=p<r?r:p,c=g>c?c:g,l=this.labels[c],a=this.labels[r],d=c-r+1)}else if(typeof h=="function"){const[p,g]=h(a,l);r=p<r?r:p,c=g>c?c:g,l=this.labels[c],a=this.labels[r],d=c-r+1}const f=((m=this.labelStyle)==null?void 0:m.maxWidth)??o.chartWidth/(d+2);return{min:a,max:l,minIndex:r,maxIndex:c,minLabel:this.getLabelFormat(a,f),maxLabel:this.getLabelFormat(l,f),size:Y.calcTextSizeCanvas(this.getLabelFormat(l,f),Y.getLabelStyle(this.labelStyle))}}getIndexInterval(t){const n=t.maxSteps;return this.interval?this.interval:Math.ceil(this.labels.length/n)}calculateSteps(t){const{minValue:n,maxValue:o,minIndex:s,maxIndex:l}=t,a=l-s+1;let r=1;const c=this.labels.every(d=>!isNaN(d));return this.labelStyle.alignToGridLine&&c&&(r=this.getIndexInterval(t)),{oriSteps:a,steps:a,indexInterval:r,graphMin:n,graphMax:o,minIndex:s,maxIndex:l}}draw(t,n,o,s,l){var y,w,I,E,B,_,C,S,M,k,T,R;const a=this.ctx,r=this.labels,c={x1:t.x1+n.left,x2:t.x2-n.right,y1:t.y1+n.top,y2:t.y2-n.bottom},d=o.steps,h=o.indexInterval,f=o.minIndex,m=c[this.units.rectStart],p=c[this.units.rectEnd],g=c[this.units.rectOffset(this.position)],u=c[this.units.rectOffsetCounter(this.position)],x=((y=this.labelStyle)==null?void 0:y.maxWidth)??t.chartWidth/(d+2),b=5;if(this.drawAxisTitle(t,n),(w=this.labelStyle)!=null&&w.show){a.font=Y.getLabelStyle(this.labelStyle),this.type==="x"?(a.textAlign="center",a.textBaseline=this.position==="top"?"bottom":"top"):(a.textAlign=this.position==="left"?"right":"left",a.textBaseline="middle"),a.fillStyle=this.labelStyle.color,a.lineWidth=this.axisLineWidth;const L=Y.aliasPixel(a.lineWidth);if(a.beginPath(),a.strokeStyle=this.axisLineColor,this.type==="x"?(a.moveTo(m,g+L),a.lineTo(p,g+L)):(a.moveTo(g+L,m),a.lineTo(g+L,p)),a.stroke(),d===0)return;const N=(p-m)/d,v=this.labelStyle.alignToGridLine;let O=null,D=null;a.beginPath(),a.strokeStyle=this.gridLineColor;let V,P,A;const F=[];for(A=0;A<d;A+=h){const X=f+A,U=this.labels[X];O=Math.round(m+N*A),D=O+L,V=this.getLabelFormat(U,x);const{selectLabel:H,selectItem:$,horizontal:j}=this.options;let K;l!=null&&l.targetAxis?K=(l==null?void 0:l.targetAxis)==="yAxis"?"y":"x":K=j?"y":"x";const q=(H==null?void 0:H.use)&&(H==null?void 0:H.useLabelOpacity)&&K===this.type&&((I=l==null?void 0:l.dataIndex)==null?void 0:I.length)&&!((E=l==null?void 0:l.dataIndex)!=null&&E.includes(X)),Q=this.labelStyle.color;let J=1;if(Y.getColorStringType(Q)==="RGBA"&&(J=Y.getOpacity(Q)),a.fillStyle=Y.colorStringToRgba(Q,q?(B=this.options)==null?void 0:B.unSelectedOpacity:J),this.type==="x"){P=this.position==="top"?g-10:g+10;const ee=v?O:O+N/2;if(a.fillText(this.checkFixWidth(V),ee,P),!q&&($!=null&&$.showLabelTip)&&(s!=null&&s.label)&&!j){const G=s.label;if(G===V){const ne=Math.round(a.measureText((_=this.labelStyle)==null?void 0:_.fontSize).width);Y.showLabelTip({ctx:this.ctx,width:Math.round(a.measureText(G).width)+10,height:ne,x:O+N/2,y:P+(ne-2),borderRadius:2,arrowSize:3,text:V,backgroundColor:(C=$==null?void 0:$.labelTipStyle)==null?void 0:C.backgroundColor,textColor:(S=$==null?void 0:$.labelTipStyle)==null?void 0:S.textColor})}}this.showAxisTick&&(a.beginPath(),a.strokeStyle=this.axisLineColor,a.moveTo(O+N/2,g),a.lineTo(O+N/2,g+b),a.stroke(),a.closePath()),A>0&&this.showGrid&&(a.beginPath(),a.strokeStyle=this.gridLineColor,a.moveTo(D,g),a.lineTo(D,u),a.stroke(),a.closePath())}else{P=this.position==="left"?g-10:g+10;const ee=v?O:O+N/2;a.fillText(this.checkFixWidth(V),P,ee),F.push(V),this.showAxisTick&&(a.beginPath(),a.strokeStyle=this.axisLineColor,a.moveTo(g+(this.axisLineWidth??1),ee),a.lineTo(g-b,ee),a.stroke(),a.closePath()),A>0&&this.showGrid&&(a.beginPath(),a.strokeStyle=this.gridLineColor,a.moveTo(g,D),a.lineTo(u,D),a.stroke(),a.closePath())}a.stroke()}if(v&&A>=this.labels.length){const X=Cr(+r[1],+r[0]),U=Rs(+r[r.length-1],X);if(isNaN(U)||h!==1&&Cr(U,F[F.length-1])<=X)return;O=Math.round(m+N*r.length),D=O+L;const H=this.getLabelFormat(`${U}`,x);this.type==="x"?(a.fillText(this.checkFixWidth(H),O,P),this.showGrid&&(a.moveTo(D,g),a.lineTo(D,u))):(a.fillText(this.checkFixWidth(H),P,O),this.showGrid&&(a.moveTo(g,D),a.lineTo(u,D))),a.stroke()}a.closePath()}if((M=this.plotBands)!=null&&M.length||(k=this.plotLines)!=null&&k.length){const L=Y.aliasPixel(a.lineWidth)+1,N=c.x1+L,v=c.x2,O=c.y1+L,D=c.y2,V=(p-m)/(this.labelStyle.show?r.length:1);(T=this.plotBands)==null||T.forEach(P=>{if(!P.from&&!P.to)return;const A=Fe({},P,Rr),{from:F=0,to:X=r.length,label:U}=A,H=Math.round(m+V*F),$=Math.round(m+V*X);if(this.setPlotBandStyle(A),this.type==="x"?this.drawXPlotBand(H,$,N,v,O,D):this.drawYPlotBand(H,$,N,v,O,D),U.show){const j=this.getNormalizedLabelOptions(t,U),K=this.getPlotBandLabelPosition(H,$,j,v,O);this.drawPlotLabel(j,K)}a.restore()}),(R=this.plotLines)==null||R.forEach(P=>{if(!P.value)return;const A=Fe({},P,Or),{value:F,label:X}=A,U=Math.round(m+V*F)+V/2;if(this.setPlotLineStyle(A),this.type==="x"?this.drawXPlotLine(U,N,v,O,D):this.drawYPlotLine(U,N,v,O,D),X.show){const H=this.getNormalizedLabelOptions(t,X),$=this.getPlotLineLabelPosition(U,H,v,O);this.drawPlotLabel(H,$)}a.restore()})}}getLabelFormat(t,n,o={}){if(this.formatter){const s=this.formatter(t,o);if(typeof s=="string")return s}return this.labelStyle.fitWidth?this.fittingString(t,n):t}fittingString(t,n){const o=this.ctx;o.save(),o.font=Y.getLabelStyle(this.labelStyle);const s=this.labelStyle.fitDir;return Y.truncateLabelWithEllipsis(t,n,o,s)}getLabelWidthHasMaxLength(t,n){var a;const o=Y.getLabelStyle(this.labelStyle),s=(t==null?void 0:t.length)??0,l=((a=this.labelStyle)==null?void 0:a.maxWidth)??(n==null?void 0:n.chartWidth)/(s+2);return(t??[]).reduce((r,c)=>{var f;const d=this.getLabelFormat(c,l),h=((f=Y.calcTextSizeCanvas(d,o))==null?void 0:f.width)??0;return Math.max(r,h)},0)}}class NC extends oo{constructor(t,n,o,s,l){super(t,n,o),this.labels=s,this.options=l}getLabelFormat(t,n={}){if(this.formatter){const o=this.formatter(t,n);if(typeof o=="string")return o}return at(t).format(this.timeFormat)}getInterval(t){const n=t.maxValue,o=t.minValue,s=t.maxSteps;if(this.interval){if(typeof this.interval=="string")return si[this.interval].size;if(typeof this.interval=="object")return this.interval.time*si[this.interval.unit].size;if(typeof this.interval=="number")return this.interval}return Math.ceil((n-o)/s)}calculateSteps(t){const{maxValue:n,minValue:o,maxSteps:s}=t,l=this.getInterval(t);let a=l,r=o,c;for(;r<n;)r+=a;const d=r>n?n:r,h=o,f=d-h;c=Math.round(f/a)+1;const m=c;for(n===1&&(a=.2,c=5);c>s;)a*=2,c=Math.round(f/a),a=Math.ceil(f/c);return d-h>c*a&&(a=Math.ceil((d-h)/c)),{steps:c,oriSteps:m,interval:a,rawInterval:l,graphMin:h,graphMax:d}}draw(t,n,o,s,l){var N,v,O,D,V,P,A,F,X,U,H,$,j,K,q,Q;const a=this.ctx,r=this.labels,c={x1:t.x1+n.left,x2:t.x2-n.right,y1:t.y1+n.top,y2:t.y2-n.bottom},d=o.steps,h=o.graphMin,f=o.graphMax,m=o.rawInterval,p=o.oriSteps;let g=c[this.units.rectStart];const u=c[this.units.rectEnd],x=c[this.units.rectOffset(this.position)],b=c[this.units.rectOffsetCounter(this.position)],y=5;this.drawAxisTitle(t,n),a.font=Y.getLabelStyle(this.labelStyle),this.type==="x"?(a.textAlign="center",a.textBaseline=this.position==="top"?"bottom":"top"):(a.textAlign=this.position==="left"?"right":"left",a.textBaseline="middle"),a.fillStyle=this.labelStyle.color,a.lineWidth=this.axisLineWidth;const w=Y.aliasPixel(a.lineWidth);if(a.beginPath(),a.strokeStyle=this.axisLineColor,this.type==="x"?(a.moveTo(g,x+w),a.lineTo(u,x+w)):(a.moveTo(x+w,g),a.lineTo(x+w,u)),a.stroke(),a.closePath(),d===0||h===null)return;const I=this.labelStyle.alignToGridLine,E=(u-g)/(p||1);this.categoryMode&&!I&&(g+=Math.ceil(E/2)-2);const B=[];let _=null,C=null;a.beginPath(),a.strokeStyle=this.gridLineColor;let S,M,k,T=d<=2?p:Math.round(p/d);const R=g>Math.ceil(c[this.units.rectStart]);this.type==="x"&&R&&T===p&&(T=1);const L=T===p?p:p-1;for(k=0;k<=L;k+=T){B[k]=at(h).valueOf()+k*m,_=Math.round(g+E*k),C=_+w;let J;for(let Z=0;Z<B.length;Z++)B[Z]!==void 0&&Z!==k&&(J=B[Z]);S=this.getLabelFormat(Math.min(f,B[k]),{prev:J});const ee=((v=(N=this.options)==null?void 0:N.selectLabel)==null?void 0:v.use)&&((D=(O=this.options)==null?void 0:O.selectLabel)==null?void 0:D.useLabelOpacity)&&this.options.horizontal===(this.type==="y")&&((V=l==null?void 0:l.dataIndex)==null?void 0:V.length)&&!(l!=null&&l.label.map(Z=>this.getLabelFormat(Math.min(f,Z),{prev:J})).includes(S)),G=this.labelStyle.color;let ne=1;if(Y.getColorStringType(G)==="RGBA"&&(ne=Y.getOpacity(G)),a.fillStyle=Y.colorStringToRgba(G,ee?(P=this.options)==null?void 0:P.unSelectedOpacity:ne),this.type==="x"){if(M=this.position==="top"?x-10:x+10,a.fillText(this.checkFixWidth(S),_,M),!ee&&((F=(A=this.options)==null?void 0:A.selectItem)!=null&&F.showLabelTip)&&(s!=null&&s.label)&&!((X=this.options)!=null&&X.horizontal)){const Z=this.getLabelFormat(Math.min(f,s.label+0*m));if(Z===S){const re=Math.round(a.measureText((U=this.labelStyle)==null?void 0:U.fontSize).width);Y.showLabelTip({ctx:this.ctx,width:Math.round(a.measureText(Z).width)+10,height:re,x:_,y:M+(re-2),borderRadius:2,arrowSize:3,text:S,backgroundColor:(j=($=(H=this.options)==null?void 0:H.selectItem)==null?void 0:$.labelTipStyle)==null?void 0:j.backgroundColor,textColor:(Q=(q=(K=this.options)==null?void 0:K.selectItem)==null?void 0:q.labelTipStyle)==null?void 0:Q.textColor})}}this.showAxisTick&&(a.beginPath(),a.strokeStyle=this.axisLineColor,a.moveTo(C,x),a.lineTo(C,x+y),a.stroke(),a.closePath()),k<p&&this.showGrid&&(R||!R&&k!==0)&&(a.beginPath(),a.strokeStyle=this.gridLineColor,a.moveTo(C,x),a.lineTo(C,b),a.stroke(),a.closePath())}else M=this.position==="left"?x-10:x+10,a.fillText(this.checkFixWidth(S),M,_),this.showAxisTick&&(a.beginPath(),a.strokeStyle=this.axisLineColor,a.moveTo(x+(this.axisLineWidth??1),C),a.lineTo(x-y,C),a.stroke(),a.closePath()),k<p&&this.showGrid&&(R||!R&&k!==0)&&(a.beginPath(),a.strokeStyle=this.gridLineColor,a.moveTo(x,C),a.lineTo(b,C),a.stroke(),a.closePath());a.stroke()}if(this.categoryMode&&I&&k*T===p){const J=at(r[1]).diff(at(r[0])),ee=this.getLabelFormat(at(B[p-1]+J));_=Math.round(g+E*p),C=_+w,this.type==="x"?(a.fillText(this.checkFixWidth(ee),_,M),this.showGrid&&(a.moveTo(C,x),a.lineTo(C,b))):(a.fillText(this.checkFixWidth(ee),M,_),this.showGrid&&(a.moveTo(x,C),a.lineTo(b,C))),a.stroke()}a.closePath()}}const LC={createTitle(){this.titleDOM=document.createElement("div"),this.titleDOM.className="ev-chart-title",this.wrapperDOM.appendChild(this.titleDOM)},initTitle(){this.isInitTitle||this.createTitle(),this.updateTitle(),this.isInitTitle=!0},showTitle(){this.titleDOM.style.display="block",this.wrapperDOM.style.paddingTop=`${this.options.title.height}px`},hideTitle(){this.titleDOM.style.display="none",this.wrapperDOM.style.paddingTop="0px"},updateTitle(){const e=this.options.title;Object.keys(e.style).forEach(t=>{this.titleDOM.style[t]=e.style[t]}),this.titleDOM.textContent=e.text,this.titleDOM.style.height=`${e.height}px`,this.titleDOM.style.lineHeight=`${e.height}px`}},_C={createLegendLayout(){var e,t;this.legendDOM=document.createElement("div"),this.legendDOM.className="ev-chart-legend",this.legendBoxDOM=document.createElement("div"),this.legendBoxDOM.className="ev-chart-legend-box",(t=(e=this.options)==null?void 0:e.legend)!=null&&t.allowResize&&(this.resizeDOM=document.createElement("div"),this.resizeDOM.className="ev-chart-resize-bar",this.ghostDOM=document.createElement("div"),this.ghostDOM.className="ev-chart-resize-ghost",this.wrapperDOM.appendChild(this.resizeDOM)),this.useTable?(this.legendTableDOM=document.createElement("table"),this.legendTableDOM.className="ev-chart-legend--table",this.setLegendColumnHeader(),this.legendBoxDOM.appendChild(this.legendTableDOM),this.legendDOM.style.overflow="auto"):(this.legendBoxDOM.style.overflowX="hidden",this.legendBoxDOM.style.overflowY="auto",this.legendBoxDOM.style.height="100%"),this.legendDOM.appendChild(this.legendBoxDOM),this.wrapperDOM.appendChild(this.legendDOM),this.options.legend.virtualScroll&&!this.useTable&&(this.legendTopSpacer=document.createElement("div"),this.legendTopSpacer.className="ev-chart-legend--top-spacer",this.legendTopSpacer.style.clear="both",this.legendTopSpacer.style.opacity=0,this.legendBottomSpacer=document.createElement("div"),this.legendBottomSpacer.className="ev-chart-legend--bottom-spacer",this.legendBottomSpacer.style.clear="both",this.legendBottomSpacer.style.opacity=0,this.legendBoxDOM.appendChild(this.legendTopSpacer),this.legendBoxDOM.appendChild(this.legendBottomSpacer),this.updateVisibleRowCountFrameId=requestAnimationFrame(()=>{this.updateVisibleRowCount()}))},setLegendColumnHeader(){var o;const e=(o=this.options.legend)==null?void 0:o.table,t=e.columns;["color",...Object.keys(t)].forEach(s=>{var a,r;const l=document.createElement("th");if(l.className="ev-chart-legend--table__column-name",(a=t[s])!=null&&a.use||s==="color"||s==="name"){const c=t[s],d=(c==null?void 0:c.title)??"";l.textContent=d,l.setAttribute("title",d),l.dataset.type=d,Y.setDOMStyle(l,(r=e==null?void 0:e.style)==null?void 0:r.header),this.legendTableDOM.append(l)}})},initLegend(){var e,t;this.isHeatMapType=this.options.type==="heatMap",this.useTable=!!((t=(e=this.options.legend)==null?void 0:e.table)!=null&&t.use)&&this.options.type!=="heatmap"&&this.options.type!=="scatter",this.legendItemHeight=18,this.isInitLegend||this.createLegendLayout(),this.isHeatMapType?(this.initEventForColorLegend(),this.addColorLegendList()):(this.initEvent(),this.addLegendList()),this.initResizeEvent(),this.isInitLegend=!0,this.isLegendMove=!1},updateVisibleRowCount(){const e=this.options.legend.position==="right"||this.options.legend.position==="left",t=this.legendBoxDOM.clientHeight,n=this.legendBoxDOM.clientWidth,o=Math.max(this.options.legend.width-8,1),s=Object.values(this.seriesList).filter(l=>l.showLegend!==!1).length;this.itemsPerRow=e?1:Math.floor(n/o),this.totalRowCount=Math.ceil(s/this.itemsPerRow),this.visibleRowCount=t>this.legendItemHeight?Math.round(t/this.legendItemHeight)+1:this.totalRowCount},updateStartEndRowIndex(){var t;const e=Math.max(Math.floor(((t=this.legendBoxDOM)==null?void 0:t.scrollTop)/this.legendItemHeight),0);this.startRowIndex=Math.min(e,Math.max(this.totalRowCount-this.visibleRowCount,0)),this.endRowIndex=this.startRowIndex+this.visibleRowCount+1},renderVisibleLegends(){this.updateStartEndRowIndex();const e=this.legendBoxDOM.querySelectorAll(".ev-chart-legend-container");if(e&&e.length)for(const c of e)c.remove();const t=this.totalRowCount*this.legendItemHeight,n=this.startRowIndex*this.legendItemHeight,o=Math.max(t-this.visibleRowCount*this.legendItemHeight-n,0);this.legendTopSpacer.style.height=`${n}px`,this.legendBottomSpacer.style.height=`${o}px`;const s=this.startRowIndex*this.itemsPerRow,l=this.endRowIndex*this.itemsPerRow,a=this.data.groups.at(0);let r=[];if(a?r=a.filter(c=>this.seriesList[c].showLegend).map(c=>[c,this.seriesList[c]]):r=Object.entries(this.seriesList).filter(([,c])=>c.showLegend),r&&r.length)for(let c=s;c<l&&c<r.length;c++){const[,d]=r[c];this.addLegend(d)}},addLegendList(){const{groups:e}=this.data,{seriesList:t}=this;this.options.legend.virtualScroll&&!this.useTable?this.renderVisibleLegendsFrameId=requestAnimationFrame(()=>{this.renderVisibleLegends()}):(this.addLegendForGroups(e,t,this.useTable),this.addStandaloneLegends(t,this.useTable))},addLegendForGroups(e,t,n){e==null||e.forEach(o=>{o==null||o.forEach(s=>{const l=t[s];l&&l.showLegend&&this.addLegendBasedOnType(l,n)})})},addStandaloneLegends(e,t){Object.values(e).forEach(n=>{!n.isExistGrp&&n.showLegend&&this.addLegendBasedOnType(n,t)})},addLegendBasedOnType(e,t){t?this.addLegendWithValues(e):this.addLegend(e)},addColorLegendList(){const e=this.seriesList;Object.values(e).forEach(t=>{if(!t.isExistGrp&&t.showLegend){const{colorState:n,valueOpt:o}=t,{min:s,max:l,interval:a,existError:r,decimalPoint:c}=o,d=n.length,h=r?d-2:d-1;for(let f=0;f<d;f++){const{id:m,color:p,label:g=""}=n[f],u=s+a*f;let x=u+a;f<h?x-=.1**c:x=l+.1**c;let b=g;if(!b)if(b=`${u.toFixed(c)} - ${x.toFixed(c)}`,s===void 0||l===void 0)if(f===0)b="0";else break;else{if(u>l)break;a<=1&&c===0&&(b=u)}this.addLegend({cId:m,color:p,name:b,show:!0})}}})},getContainerDOM(e){let t=null;const n=e.target.dataset.type;return n==="container"?t=e.target:["name","color","min","max","avg","total","last"].includes(n)&&(t=e.target.parentElement,t!=null&&t.series||(t=t.parentElement)),t},initEvent(){if(this.isInitLegend)return;const e={container:`ev-chart-legend${this.useTable?"--table__row":"-container"}`,color:`ev-chart-legend${this.useTable?"--table__color":"-color"}`,name:`ev-chart-legend${this.useTable?"--table__name":"-name"}`,value:`ev-chart-legend${this.useTable?"--table__value":"-value"}`},t=(l,a)=>{const r=l==null?void 0:l.getElementsByClassName(e.color)[0],c=l==null?void 0:l.getElementsByClassName(e.name)[0],d=l==null?void 0:l.getElementsByClassName(e.value),h=l==null?void 0:l.series;if(r.style.backgroundColor=a,r.style.borderColor=a,c.style.color=a,d&&d.length)for(const f of d)f.style.color=a;h.show=!1,l.dataset.inactive=!0},n=(l,a)=>{var m,p;let r;const c=l==null?void 0:l.getElementsByClassName(e.color)[0],d=l==null?void 0:l.getElementsByClassName(e.name)[0],h=l==null?void 0:l.getElementsByClassName(e.value),f=l==null?void 0:l.series;if(typeof f.color!="string"?r=f.color[f.color.length-1][1]:r=f.color,f.type==="line"&&f.fill?(c.style.height="8px",c.style.backgroundColor=Y.rgbaAdjustHalfOpacity(r),c.style.border=`1px solid ${r}`):c.style.backgroundColor=r,d.style.color=a,h&&h.length)for(const g of h){const u=(p=(m=this.options.legend.table)==null?void 0:m.columns[g.dataset.type])==null?void 0:p.style;g.style.color=u!=null&&u.color?u.color:a}f.show=!0,l.dataset.inactive=!1},o=()=>{(this.data.groups.at(0)?this.data.groups.at(0).slice().reverse().filter(a=>this.seriesList[a].showLegend).map(a=>[a,this.seriesList[a]]):Object.entries(this.seriesList).filter(([,a])=>a.showLegend)).forEach(([,a])=>{a.show=!1})},s=()=>{(this.data.groups.at(0)?this.data.groups.at(0).slice().reverse().filter(a=>this.seriesList[a].showLegend).map(a=>[a,this.seriesList[a]]):Object.entries(this.seriesList).filter(([,a])=>a.showLegend)).forEach(([,a])=>{a.show=!0})};this.onLegendBoxClick=l=>{var x;const{legend:a}=this.options;if(a!=null&&a.stopClickEvt)return;const{chartIdx:r}=this.data,c=this.getContainerDOM(l);if(!c)return;const d=c==null?void 0:c.getElementsByClassName(e.color)[0],h=c==null?void 0:c.getElementsByClassName(e.name)[0],f=(c==null?void 0:c.dataset.inactive)==="false";if(!d||!h)return;if(a.clickMode==="active"){const b=Array.from(this.legendBoxDOM.getElementsByClassName(e.container));b.every(I=>I.dataset.inactive==="false")?(b.forEach(I=>{t(I,a.inactive)}),o(),n(c,a.color),this.seriesInfo.count=1):f?(t(c,a.inactive),this.seriesInfo.count--):f||(n(c,a.color),this.seriesInfo.count++),b.every(I=>I.dataset.inactive==="true")&&(b.forEach(I=>{n(I,a.color)}),s(),this.seriesInfo.count=b.length)}if(a.clickMode!=="active"){if(f&&this.seriesInfo.count===1)return;f?(t(c,a.inactive),this.seriesInfo.count--):(n(c,a.color),this.seriesInfo.count++)}if(this.brushSeries){const b=[...this.brushSeries.list];b[r]=this.seriesList,this.brushSeries.list=b,this.brushSeries.chartIdx=r}((x=this.options.eventBehavior)==null?void 0:x.legendClick)!=="emitOnly"&&this.update({updateSeries:!1,updateSelTip:{update:!0,keepDomain:!0}});const p=Object.values(this.seriesList).filter(b=>b.show).map(b=>b.sId),g=p.length===Object.values(this.seriesList).length,u={e:l,data:{seriesIds:g?[]:p,isActiveAll:g}};typeof this.listeners["click-legend"]=="function"&&this.listeners["click-legend"](u)},this.onLegendBoxLeave=()=>{this.legendHover=null,this.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1},hitInfo:{legend:null},lightUpdate:!0})},this.onLegendBoxOver=l=>{var d;const a=this.getContainerDOM(l);if(!a){this.onLegendBoxLeave();return}const c={sId:(d=a==null?void 0:a.series)==null?void 0:d.sId,type:this.options.type};this.legendHover=c,this.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1},hitInfo:{legend:c},lightUpdate:!0})},this.legendBoxDOM.addEventListener("click",this.onLegendBoxClick),this.legendBoxDOM.addEventListener("mouseover",this.onLegendBoxOver),this.legendBoxDOM.addEventListener("mouseleave",this.onLegendBoxLeave),this.options.legend.virtualScroll&&!this.useTable&&(this.legendBoxDOM.addEventListener("resize",this.updateVisibleRowCount),this.legendBoxDOM.addEventListener("scroll",this.renderVisibleLegends.bind(this))),this.initResizeEvent()},initEventForColorLegend(){if(this.isInitLegend)return;const e={container:`ev-chart-legend${this.useTable?"--table__row":"-container"}`,color:`ev-chart-legend${this.useTable?"--table__color":"-color"}`,name:`ev-chart-legend${this.useTable?"--table__name":"-name"}`},t=(l,a)=>{var m;const r=l==null?void 0:l.getElementsByClassName(e.color)[0],c=l==null?void 0:l.getElementsByClassName(e.name)[0],d=Object.values(this.seriesList)[0],h=(m=l==null?void 0:l.series)==null?void 0:m.cId;r.style.backgroundColor=a,r.style.borderColor=a,c.style.color=a;const f=d.colorState.findIndex(p=>p.id===h);f>-1&&(d.colorState[f].show=!1),l.dataset.inactive=!0},n=(l,a)=>{var m,p;const r=l==null?void 0:l.getElementsByClassName(e.color)[0],c=l==null?void 0:l.getElementsByClassName(e.name)[0],d=Object.values(this.seriesList)[0],h=(m=l==null?void 0:l.series)==null?void 0:m.cId;r.style.backgroundColor=(p=l==null?void 0:l.series)==null?void 0:p.color,c.style.color=a;const f=d.colorState.findIndex(g=>g.id===h);f>-1&&(d.colorState[f].show=!0),l.dataset.inactive=!1},o=()=>{Object.values(this.seriesList)[0].colorState.forEach(a=>{a.show=!1})},s=()=>{Object.values(this.seriesList)[0].colorState.forEach(a=>{a.show=!0})};this.onLegendBoxClick=l=>{const a=this.options.legend;if(a!=null&&a.stopClickEvt)return;const r=Object.values(this.seriesList)[0],c=this.getContainerDOM(l);if(!c)return;const d=c==null?void 0:c.getElementsByClassName(e.color)[0],h=c==null?void 0:c.getElementsByClassName(e.name)[0],f=(c==null?void 0:c.dataset.inactive)==="false",m=r.colorState.filter(p=>p.show).length;if(!(!d||!h)){if(a.clickMode==="active"){const p=Array.from(this.legendBoxDOM.getElementsByClassName(e.container));p.every(x=>x.dataset.inactive==="false")?(p.forEach(x=>{t(x,a.inactive)}),o(),n(c,a.color)):f?t(c,a.inactive):f||n(c,a.color),p.every(x=>x.dataset.inactive==="true")&&(p.forEach(x=>{n(x,a.color)}),s())}if(a.clickMode!=="active"){if(f&&m===1)return;f?t(c,a.inactive):n(c,a.color)}this.update({updateSeries:!1,updateSelTip:{update:!0,keepDomain:!0}})}},this.onLegendBoxLeave=()=>{this.legendHover=null,Object.values(this.seriesList)[0].colorState.forEach(a=>{a.state="normal"}),this.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1},lightUpdate:!0})},this.onLegendBoxOver=l=>{var h,f;const a=(h=Object.values(this.seriesList))==null?void 0:h[0],r=this.getContainerDOM(l);if(!r){this.onLegendBoxLeave();return}const c=(f=r==null?void 0:r.series)==null?void 0:f.cId,d={sId:c,type:this.options.type};this.legendHover=d,a.colorState.forEach(m=>{m.state=m.id===c?"highlight":"downplay"}),this.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1},hitInfo:{legend:d},lightUpdate:!0})},this.legendBoxDOM.addEventListener("click",this.onLegendBoxClick),this.legendBoxDOM.addEventListener("mouseover",this.onLegendBoxOver),this.legendBoxDOM.addEventListener("mouseleave",this.onLegendBoxLeave),this.initResizeEvent()},initResizeEvent(){this.onResizeMouseDown=e=>{e.stopPropagation(),e.preventDefault();const t=this.options,n=t.legend.position,o=t.title.show?t.title.height:0,s=this.ghostDOM;this.resizeDOM.style.display="none",this.wrapperDOM.appendChild(s),n==="left"||n==="right"?(s.style.top=`${o}px`,s.style.left=this.resizeDOM.style.left,s.style.right=this.resizeDOM.style.right,s.style.height=this.resizeDOM.style.height):(s.classList.add("horizontal"),n==="top"?s.style.top=this.resizeDOM.style.top:n==="bottom"&&(s.style.bottom=this.resizeDOM.style.bottom)),this.wrapperDOM.addEventListener("mousemove",this.mouseMove,!1),this.wrapperDOM.addEventListener("mouseup",this.mouseUp,!1)},this.resizeDOM&&(this.resizeDOM.addEventListener("mousedown",this.onResizeMouseDown),this.mouseMove=this.onMouseMove.bind(this),this.mouseUp=this.onMouseUp.bind(this))},updateLegend(){this.resetLegend(),this.isHeatMapType?this.addColorLegendList():this.addLegendList()},updateLegendTableValues(){var o,s,l,a,r;const e=(l=(s=(o=this.options)==null?void 0:o.legend)==null?void 0:s.table)==null?void 0:l.columns,t=this.getAggregations(),n=(a=this.legendBoxDOM)==null?void 0:a.getElementsByClassName("ev-chart-legend--table__row");if(n&&n.length)for(const c of n){const d=c==null?void 0:c.getElementsByClassName("ev-chart-legend--table__value");if(d&&d.length)for(const h of d){const f=h.dataset.type;if(f!=="name"){const m=c.series.sId,p=(r=t==null?void 0:t[m])==null?void 0:r[f];h.textContent=this.getFormattedValue(e[f],p)}}}},forceUpdateLegend(){this.destroyLegend(),this.initLegend()},resetLegend(){var t,n;const e=this.legendBoxDOM;if(e){if(this.useTable){const o=this.legendTableDOM;for(;o.hasChildNodes();)o.removeChild(o.firstChild);this.setLegendColumnHeader()}else if(this.options.legend.virtualScroll)((n=(t=this.legendDOM)==null?void 0:t.style)==null?void 0:n.display)==="none"?this.legendNeedsUpdate=!0:(this.updateVisibleRowCount(),this.renderVisibleLegends());else for(;e.hasChildNodes();)e.removeChild(e.firstChild);this.seriesInfo.count=0}},destroyLegend(){const e=this.legendDOM;this.renderVisibleLegendsFrameId!=null&&(cancelAnimationFrame(this.renderVisibleLegendsFrameId),this.renderVisibleLegendsFrameId=null),this.updateVisibleRowCountFrameId!=null&&(cancelAnimationFrame(this.updateVisibleRowCountFrameId),this.updateVisibleRowCountFrameId=null),e&&(e.remove(),this.legendDOM=null,this.legendBoxDOM=null,this.resizeDOM=null,this.isInitLegend=!1,this.seriesInfo.count=0)},addLegend(e){const t=this.options.legend,n=document.createElement("div"),o=document.createElement("span"),s=document.createElement("div");n.className="ev-chart-legend-container",n.dataset.inactive=!e.show,n.series=e,o.className="ev-chart-legend-color",e.type==="line"&&e.point&&!e.fill&&(o.className+=" ev-chart-legend-color--point-line"),s.className="ev-chart-legend-name";let l;e.show?typeof e.color!="string"?l=e.color[e.color.length-1][1]:l=e.color:l=t.inactive,e.type==="line"&&e.fill?(o.style.height="8px",o.style.backgroundColor=e.show?Y.rgbaAdjustHalfOpacity(l):t.inactive,o.style.border=`1px solid ${l}`):o.style.backgroundColor=l,o.dataset.type="color",s.style.color=t.color,s.textContent=e.name,s.setAttribute("title",e.name),s.dataset.type="name",n.appendChild(o),n.appendChild(s),t.position==="top"||t.position==="bottom"?(n.style.width=`${t.width-8}px`,n.style.margin="0 4px"):n.style.width="100%",n.style.height=`${this.legendItemHeight}px`,n.style.display="inline-block",n.style.overflow="hidden",n.dataset.type="container",this.legendBoxDOM.insertBefore(n,this.legendBottomSpacer),e.show&&this.seriesInfo.count++},addLegendWithValues(e){var h,f,m,p,g;const t=this.options.legend,n=(h=t==null?void 0:t.table)==null?void 0:h.columns,o=(f=this.getAggregations())==null?void 0:f[e==null?void 0:e.sId];if(!o||!n)return;const s=document.createElement("tr");s.className="ev-chart-legend--table__row",s.dataset.inactive=!e.show,Y.setDOMStyle(s,(p=(m=t.table)==null?void 0:m.style)==null?void 0:p.row),s.series=e,s.dataset.type="container";const l=document.createElement("td");l.className="ev-chart-legend--table__color-wrapper",l.dataset.type="color";const a=document.createElement("div");a.className="ev-chart-legend--table__color",a.dataset.type="color";let r;switch(e.show?typeof e.color!="string"?r=e.color[e.color.length-1][1]:r=e.color:r=t.inactive,e.type){case"line":{e.fill?(a.style.backgroundColor=Y.rgbaAdjustHalfOpacity(r),a.style.border=`1px solid ${r}`):(e.point&&(a.className+=" ev-chart-legend--table__color--point-line"),a.className+=" ev-chart-legend--table__color--line",a.style.backgroundColor=r);break}case"bar":case"pie":default:{a.style.height="10px",a.style.backgroundColor=r;break}}e.type==="line"&&e.fill?(a.style.height="8px",a.style.backgroundColor=e.show?Y.rgbaAdjustHalfOpacity(r):t.inactive,a.style.border=`1px solid ${r}`):a.style.backgroundColor=r,l.appendChild(a),s.appendChild(l);const c=document.createElement("td");c.className="ev-chart-legend--table__name",c.style.color=e.show?t.color:t.inactive,c.textContent=e.name,c.setAttribute("title",e.name),c.dataset.type="name",Y.setDOMStyle(c,(g=n==null?void 0:n.name)==null?void 0:g.style),e.show||(c.style.color=t.inactive),s.appendChild(c);const d=Object.keys(n);d==null||d.forEach(u=>{var x;if(u!=="name"&&n[u].use){const b=this.getFormattedValue(n[u],o[u]),y=document.createElement("td");y.className="ev-chart-legend--table__value",y.style.color=e.show?t.color:t.inactive,y.textContent=b,y.dataset.type=u.toString(),Y.setDOMStyle(y,(x=n[u])==null?void 0:x.style),e.show||(y.style.color=t.inactive),s.appendChild(y)}}),this.legendTableDOM.appendChild(s),e.show&&this.seriesInfo.count++},setLegendPosition(){var g,u,x,b,y,w,I,E,B;const e=this.options,t=(g=e==null?void 0:e.legend)==null?void 0:g.position,n=(u=this.wrapperDOM)==null?void 0:u.style,o=(x=this.legendDOM)==null?void 0:x.style,s=(b=this.legendBoxDOM)==null?void 0:b.style,l=(y=this.resizeDOM)==null?void 0:y.style;let a,r;const c=(w=e==null?void 0:e.title)!=null&&w.show?(I=e==null?void 0:e.title)==null?void 0:I.height:0,d=c+((E=e==null?void 0:e.legend)==null?void 0:E.height),{top:h=0,bottom:f=0,left:m=0,right:p=0}=((B=e==null?void 0:e.legend)==null?void 0:B.padding)??{};if(!(!n||!o))switch(s.padding=`${h}px ${p}px ${f}px ${m}px`,t){case"top":n.padding=`${d}px 0 0 0`,a=this.chartDOM.getBoundingClientRect(),r=parseInt(o.paddingTop)+parseInt(o.paddingBottom),s.width="100%",s.height=`${e.legend.height-r}px`,o.top=`${c}px`,o.right="",o.bottom="",o.left="",o.width=`${a.width}px`,o.height=`${e.legend.height+(l?4:0)}px`,l&&(l.top=`${d}px`,l.right="",l.bottom="",l.left="",l.width=`${a.width}px`,l.height="4px",l.cursor="row-resize");break;case"right":n.padding=`${c}px ${e.legend.width}px 0 0`,a=this.chartDOM.getBoundingClientRect(),s.width=`${e.legend.width-10}px`,s.maxHeight=`${a.height}px`,o.paddingLeft="10px",o.top=`${c}px`,o.right="0px",o.bottom="",o.left="",o.width=`${e.legend.width}px`,o.height=`${a.height}px`,l&&(l.top=`${c}px`,l.right=`${e.legend.width}px`,l.bottom="",l.left="",l.width="4px",l.height=`${a.height}px`,l.cursor="col-resize");break;case"bottom":n.padding=`${c}px 0 ${e.legend.height}px 0`,a=this.chartDOM.getBoundingClientRect(),r=parseInt(o.paddingTop)+parseInt(o.paddingBottom),s.width="100%",s.height=`${e.legend.height-r}px`,o.top="",o.right="",o.bottom="0px",o.left="0px",o.width=`${a.width}px`,o.height=`${e.legend.height+(l?4:0)}px`,l&&(l.top="",l.right="",l.bottom=`${e.legend.height}px`,l.left="",l.width=`${a.width}px`,l.height="4px",l.cursor="row-resize");break;case"left":n.padding=`${c}px 0 0 ${e.legend.width}px`,a=this.chartDOM.getBoundingClientRect(),s.width=`${e.legend.width}px`,s.maxHeight=`${a.height}px`,s.display="absolute",s.bottom="0px",o.top=`${c}px`,o.right="",o.bottom="",o.left="0px",o.width=`${e.legend.width}px`,o.height=`${a.height}px`,l&&(l.top=`${c}px`,l.right="",l.bottom="",l.left=`${e.legend.width}px`,l.width="4px",l.height=`${a.height}px`,l.cursor="col-resize");break}},updateLegendContainerSize(){var n;if(!this.options||!this.legendBoxDOM)return;const e=(n=this.options)==null?void 0:n.legend,t=this.legendBoxDOM.getElementsByClassName("ev-chart-legend-container");if(t)for(let o=0;o<t.length;o++)e.position==="top"||e.position==="bottom"?(t[o].style.width=`${e.width-8}px`,t[o].style.margin="0 4px"):t[o].style.width="100%"},onMouseMove(e){e.stopPropagation(),e.preventDefault();const t=this.wrapperDOM.getBoundingClientRect(),n=this.wrapperDOM.offsetWidth,o=this.wrapperDOM.offsetHeight,s=this.options.title.show?this.options.title.height:0,l=this.options.legend.position,a=150,r=70,c=120,d=20;let h;switch(l){case"left":h=e.clientX-t.left,h<c?h=c:h>n-a&&(h=n-a),this.ghostDOM.style.left=`${h}px`;break;case"right":h=e.clientX-t.left,h<a?h=a:h>n-c&&(h=n-c),this.ghostDOM.style.left=`${h}px`;break;case"top":h=e.clientY-t.top,h<d+s?h=d+s:h>o-r&&(h=o-r),this.ghostDOM.style.top=`${h}px`;break;case"bottom":h=e.clientY-t.top,h<r+s?h=r+s:h>o-d&&(h=o-d),this.ghostDOM.style.bottom=`${this.wrapperDOM.offsetHeight-h}px`;break}this.isLegendMove=!0},onMouseUp(e){e.stopPropagation(),e.preventDefault(),this.wrapperDOM.removeEventListener("mousemove",this.mouseMove,!1),this.wrapperDOM.removeEventListener("mouseup",this.mouseUp,!1);const t=this.options,n=t.legend.position,o=this.resizeDOM.style,s=this.legendDOM.style,l=this.legendBoxDOM.style,a=this.ghostDOM.style,r=this.wrapperDOM.style,c=t.title.show?t.title.height:0,d=+this.legendDOM.style.paddingLeft.replace("px","");let h;if(this.isLegendMove)switch(n){case"top":o.top=a.top,h=+a.top.replace("px",""),s.height=`${h-c}px`,l.height=`${h-c-4}px`,t.legend.height=h-c-4,r.padding=`${h}px 0 0 0`;break;case"right":o.left=a.left,h=+a.left.replace("px",""),s.width=`${this.wrapperDOM.offsetWidth-h-4}px`,l.width=`${this.wrapperDOM.offsetWidth-h-4-d}px`,t.legend.width=this.wrapperDOM.offsetWidth-h-4,r.padding=`${c}px ${this.wrapperDOM.offsetWidth-h}px 0 0`;break;case"bottom":o.bottom=a.bottom,h=this.wrapperDOM.offsetHeight-+a.bottom.replace("px",""),s.height=`${this.wrapperDOM.offsetHeight-h}px`,l.height=`${h-c-4}px`,t.legend.height=this.wrapperDOM.offsetHeight-h,r.padding=`${c}px 0 ${this.wrapperDOM.offsetHeight-h}px 0`;break;case"left":o.left=a.left,h=+a.left.replace("px",""),s.width=`${h}px`,l.width=`${h}px`,t.legend.width=h,r.padding=`${c}px 0 0 ${h-4}px`;break}o.display="block",this.ghostDOM.remove(),this.isLegendMove&&(this.render(),this.isLegendMove=!1)},showLegend(){this.resizeDOM&&(this.resizeDOM.style.display="block"),this.legendDOM&&(this.legendDOM.style.display="block"),this.legendNeedsUpdate&&this.options.legend.virtualScroll&&!this.useTable&&(this.legendNeedsUpdate=!1,this.updateVisibleRowCount(),this.renderVisibleLegends())},hideLegend(){var l,a,r,c,d;const e=this.options,t=(l=this.wrapperDOM)==null?void 0:l.style,n=(a=this.resizeDOM)==null?void 0:a.style,o=(r=this.legendDOM)==null?void 0:r.style,s=(c=e==null?void 0:e.title)!=null&&c.show?(d=e==null?void 0:e.title)==null?void 0:d.height:0;!o||!t||(n&&(n.display="none"),o.display="none",o.width="0",o.height="0",t.padding=`${s}px 0 0 0`)},getFormattedValue({formatter:e,decimalPoint:t},n){if(n==null)return"Null";let o;return e&&(o=e(+n)),(!e||typeof o!="string")&&(o=Y.labelSignFormat(+n,t)),o}},_r=28,VC={width:70,height:60},PC={createLegendLayout(){this.legendDOM=document.createElement("div"),this.legendDOM.className="ev-chart-legend",this.legendBoxDOM=document.createElement("div"),this.legendBoxDOM.className="ev-chart-legend-box",this.containerDOM=document.createElement("div"),this.containerDOM.className="ev-chart-legend-container",this.legendBoxDOM.appendChild(this.containerDOM),this.legendDOM.appendChild(this.legendBoxDOM),this.wrapperDOM.appendChild(this.legendDOM)},initLegend(){this.isInitLegend||(this.createLegendLayout(),this.createLegend()),Object.values(this.seriesList).forEach(e=>{this.setLegendStyle(e)}),this.initEvent(),this.isInitLegend=!0,this.legendDragInfo={dragging:!1,isStart:!0}},initEvent(){this.isInitLegend||(this.onLegendMouseDown=e=>{e.stopPropagation(),e.preventDefault();const t=e.target.dataset.type;let n;if(t==="handle")n=e.target;else if(t==="handle-btn")n=e.target.parentElement;else if(t==="handle-btn-color")n=e.target.parentElement.parentElement;else return;const o=Object.values(this.seriesList);if(!o.length)return;const{colorState:s}=o[0],{start:l,end:a}=s[0];s[0].selectedValue=null,this.clearOverlay(),this.legendDragInfo.dragging=!0,this.legendDragInfo.isStart=l!==a?n.className.includes("start"):this.legendDragInfo.isStart,n.classList.add("dragging"),this.legendBoxDOM.addEventListener("mousemove",this.onLegendMouseMove,!1),this.legendBoxDOM.addEventListener("mouseup",this.onLegendMouseUp,!1)},this.onLegendMouseMove=e=>{e.stopPropagation(),e.preventDefault();const{dragging:t,isStart:n}=this.legendDragInfo;if(t){let o=this.getSelectedValue(e);o=this.isSide?100-o:o;const s=n?"start":"end",l=Object.values(this.seriesList);if(!l.length)return;const{colorState:a}=l[0],{start:r,end:c}=a[0];if(n&&o>c||!n&&o<r)return;a[0][s]=o,this.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1}})}},this.onLegendMouseUp=()=>{this.legendDragInfo.dragging=!1;const e=this.containerDOM.getElementsByClassName("ev-chart-legend-handle dragging")[0];e==null||e.classList.remove("dragging"),this.legendBoxDOM.removeEventListener("mouseup",this.onLegendMouseUp,!1)},this.onLegendBoxOver=e=>{const t=e.target.dataset.type,n=Object.values(this.seriesList);if(!n.length)return;const{colorState:o,valueOpt:s}=n[0],l=o[0];let a=this.getSelectedValue(e);if(a=this.isSide?100-a:a,["line","thumb","layer","overlay","overlay-item"].includes(t))if(l.start<=a&&a<=l.end)l.selectedValue=a,this.createLegendOverlay(a,s);else return;else if(["handle","handle-btn","handle-btn-color"].includes(t)){const r=e.target.className.includes("start");l.selectedValue=r?l.start:l.end,this.clearOverlay()}else return;this.legendHover={sId:"gradient",type:this.options.type},this.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1}})},this.onLegendBoxLeave=()=>{this.legendDragInfo.dragging=!1,this.legendHover=null,this.clearOverlay();const e=Object.values(this.seriesList);if(!e.length)return;const{colorState:t}=e[0];t[0].selectedValue=null,this.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1}})},this.legendBoxDOM.addEventListener("mousedown",this.onLegendMouseDown),this.legendBoxDOM.addEventListener("mouseover",this.onLegendBoxOver),this.legendBoxDOM.addEventListener("mouseleave",this.onLegendBoxLeave))},getSelectedValue(e){const{x:t,y:n,width:o,height:s}=this.containerDOM.getBoundingClientRect(),l=!this.isSide,a=l?t:n,r=l?o:s;let c=l?e.clientX:e.clientY;c<a?c=a:c>a+r&&(c=a+r);const d=c-a;return+We(d,r)},updateLegend(){this.resetLegend(),this.createLegend(),Object.values(this.seriesList).forEach(e=>{this.setLegendStyle(e)})},resetLegend(){const e=this.containerDOM;if(e)for(;e.hasChildNodes();)e.removeChild(e.firstChild)},clearOverlay(){const e=this.containerDOM.getElementsByClassName("ev-chart-legend-line")[0],t=e==null?void 0:e.getElementsByClassName("ev-chart-legend-overlay")[0];if(t){e.removeChild(t);const o=e.getElementsByClassName("ev-chart-legend-thumb")[0].children;if(o&&o.length)for(const s of o)s.style.opacity=1}},createLegendOverlay(e,t){this.clearOverlay();const n=this.legendHandleSize,{min:o,max:s}=t;if(o===void 0||s===void 0)return;const l=this.containerDOM.getElementsByClassName("ev-chart-legend-line")[0],a=document.createElement("div");a.className="ev-chart-legend-overlay",a.dataset.type="overlay";const r=document.createElement("div");r.className="ev-chart-legend-overlay-tooltip",r.innerText=Math.floor(o+(s-o)*(e/100));const c=document.createElement("span");c.className="ev-chart-legend-overlay-item",c.dataset.type="overlay-item";let d,h;const f=Math.floor(n/2)+14;this.isSide?(h=`top:${100-e}%;left:${f}px;transform:translateY(-50%);`,d=`top:${100-e}%;transform:translateY(-50%);`):(h=`top:-${f}px;left:${e}%;transform:translateX(-50%);`,d=`left:${e}%;transform:translateX(-50%);`),d+=`width:${n-10}px;height:${n-10}px;`,r.style.cssText=h,c.style.cssText=d,a.appendChild(r),a.appendChild(c),l==null||l.appendChild(a);const m=l==null?void 0:l.getElementsByClassName("ev-chart-legend-thumb")[0];if(m){const p=m.children;if(p&&p.length)for(const g of p)g.style.opacity=.2}},createLegendHandle(e){const t=document.createElement("span");t.className=`ev-chart-legend-handle-btn-color ${e}`,t.dataset.type="handle-btn-color";const n=document.createElement("div");n.className=`ev-chart-legend-handle-btn ${e}`,n.dataset.type="handle-btn",n.appendChild(t);const o=document.createElement("div");return o.className=`ev-chart-legend-handle ${e}`,o.dataset.type="handle",o.appendChild(n),o},createLegendLabel(){const e=document.createElement("span");e.className="ev-chart-legend-label-text";const t=document.createElement("div");return t.className="ev-chart-legend-label",t},createLegend(){if(!Object.values(this.seriesList).length)return;const e=this.options.legend;this.isSide=!["top","bottom"].includes(e.position);const t=this.isSide?e.width:e.height;this.legendHandleSize=t>_r?_r:t;const n=this.legendHandleSize,o=this.createLegendHandle(this.isSide?"end":"start",n),s=this.createLegendHandle(this.isSide?"start":"end",n),l=document.createElement("div");l.className="ev-chart-legend-line-layer",l.dataset.type="line-layer";const a=document.createElement("div");a.className="ev-chart-legend-thumb",a.dataset.type="thumb",a.appendChild(this.createLegendLabel()),a.appendChild(this.createLegendLabel());const r=document.createElement("div");r.className="ev-chart-legend-line",r.dataset.type="line",r.appendChild(l),r.appendChild(a),this.containerDOM.appendChild(r),this.containerDOM.appendChild(o),this.containerDOM.appendChild(s)},setLegendStyle(e){const t=this.isSide?"top":"right",n=this.legendHandleSize,{valueOpt:o,colorState:s}=e,{min:l,max:a,decimalPoint:r}=o,{start:c,end:d}=s[0],h=e.getColorForGradient(c),f=e.getColorForGradient(d);let m=`linear-gradient(to ${t}, `;m+=`${h}, ${f})`;const p=Math.floor(n/2)+14;let g=`width:${n}px;height:${n}px;`,u,x,b,y=`background:${m};`;this.isSide?(g+=`margin-top:-${n/2}px;`,u=`left:${p}px;transform:translateY(-50%);top:`,x=`top:${100-d}%;`,b=`top:${100-c}%;`,y+=`top:${100-d}%;height:${d-c}%;`):(g+=`margin-left:-${n/2}px;`,u=`top:-${p}px;transform:translateX(-50%);left:`,x=`left:${c}%;`,b=`left:${d}%;`,y+=`left:${c}%;width:${d-c}%;`);const w=(l+(a-l)*(c/100)).toFixed(r),I=(l+(a-l)*(d/100)).toFixed(r),E=this.containerDOM.getElementsByClassName("ev-chart-legend-thumb")[0];E.style.cssText=y;const B=E.getElementsByClassName("ev-chart-legend-label");B[0].style.cssText=`${u}0%;`,B[1].style.cssText=`${u}100%;`,l!==void 0&&a!==void 0&&(B[0].innerText=this.isSide?I:w,B[1].innerText=this.isSide?w:I);const _=this.containerDOM.getElementsByClassName("ev-chart-legend-handle");_[0].style.cssText=g+x,_[1].style.cssText=g+b;const C=this.containerDOM.getElementsByClassName("ev-chart-legend-handle-btn-color");C[0].style.backgroundColor=this.isSide?f:h,C[1].style.backgroundColor=this.isSide?h:f},setLegendPosition(){var x,b,y,w;const e=this.options,t=(x=e==null?void 0:e.legend)==null?void 0:x.position,{width:n,height:o}=VC,s=this.legendHandleSize,l=(b=e==null?void 0:e.title)!=null&&b.show?(y=e==null?void 0:e.title)==null?void 0:y.height:0,a=l+o,{top:r=0,bottom:c=0,left:d=0,right:h=0}=((w=e==null?void 0:e.legend)==null?void 0:w.padding)??{},f=this.wrapperDOM.style;if(!f)return;let m,p,g,u;switch(t){case"top":f.padding=`${a}px 0 0 0`,u=this.chartDOM.getBoundingClientRect(),p=`padding:${s+7}px ${h}px ${c}px ${d}px;`,p+="width:100%",p+=`height${o}px;`,m=`width:${u.width}px;`,m+=`height:${o}px;`,m+=`top:${l}px;`;break;case"right":f.padding=`${l}px ${n}px 0 0`,u=this.chartDOM.getBoundingClientRect(),p=`padding:${r}px ${h}px ${c}px ${d}px;`,p+=`width:${n}px;`,p+="height:100%;",p+=`max-height:${u.height}px;`,m=`width:${n}px;`,m+=`height:${u.height}px;`,m+=`top:${l}px;right:0px;`;break;case"bottom":f.padding=`${l}px 0 ${o}px 0`,u=this.chartDOM.getBoundingClientRect(),p=`padding:${s+7}px ${h}px ${c}px ${d}px;`,p+="width:100%;",p+=`height:${o}px;`,m=`width:${u.width}px;`,m+=`height:${o}px;`,m+="bottom:0px;left:0px;";break;case"left":f.padding=`${l}px 0 0 ${n}px`,u=this.chartDOM.getBoundingClientRect(),p=`padding:${r}px ${h}px ${c}px ${d}px;`,p+="display:absolute;",p+="bottom:0px;",p+=`width:${n}px;`,p+="height:100%;",p+=`maxHeight:${u.height}px;`,m=`width:${n}px;`,m+=`height:${u.height}px;`,m+=`top:${l}px;left:0px`;break}if(["top","bottom"].includes(t)){const I=u.width/2;g=`left:${u.width/2-I/2}px;`,g+=`width:${I}px;`,g+=`height:${s}px;`,g+="padding:4px 0;",g+="margin:0 4px;"}else{const I=u.height/2;g=`top:${u.height/2-I/2}px;`,g+="left:5px;",g+=`width:${s}px;`,g+=`height:${I}px;`,g+="padding:0 4px;",g+="margin:4px 0;"}this.containerDOM.style.cssText=g,this.legendBoxDOM.style.cssText=p,this.legendDOM.style.cssText=m},updateLegendContainerSize(){Object.values(this.seriesList).forEach(e=>{this.setLegendStyle(e)})},showLegend(){this.resizeDOM&&(this.resizeDOM.style.display="block"),this.legendDOM&&(this.legendDOM.style.display="block")},hideLegend(){var s,l,a,r;const e=this.options,t=(s=this.wrapperDOM)==null?void 0:s.style,n=(l=this.legendDOM)==null?void 0:l.style,o=(a=e==null?void 0:e.title)!=null&&a.show?(r=e==null?void 0:e.title)==null?void 0:r.height:0;!n||!t||(n.display="none",n.width="0",n.height="0",t.padding=`${o}px 0 0 0`)}},AC={initScrollbar(){var e,t,n,o,s,l;(n=(t=(e=this.options.axesX)==null?void 0:e[0])==null?void 0:t.scrollbar)!=null&&n.use&&this.initScrollbarInfo(this.options.axesX,"x"),(l=(s=(o=this.options.axesY)==null?void 0:o[0])==null?void 0:s.scrollbar)!=null&&l.use&&this.initScrollbarInfo(this.options.axesY,"y")},initScrollbarInfo(e,t){var s,l,a,r,c;const n=this.scrollbar[t],o=Fe({},(s=e==null?void 0:e[0])==null?void 0:s.scrollbar,Br.scrollbar);Object.keys(o).forEach(d=>{n[d]=o[d]}),n.isInit||(n.type=(l=e==null?void 0:e[0])==null?void 0:l.type,n.range=(r=(a=e==null?void 0:e[0])==null?void 0:a.range)!=null&&r.length?[...((c=e==null?void 0:e[0])==null?void 0:c.range)??[]]:null,this.initScrollbarRange(t),this.createScrollbarLayout(t),this.createScrollbar(t),this.createScrollEvent(t),n.isInit=!0)},initScrollbarRange(e){var s,l;const t=this.scrollbar[e],n=t.type,o=this.options.type==="heatMap"?this.data.labels[e]:this.data.labels;if((s=t.range)!=null&&s.length&&o.length){const[a,r]=t.range;let c,d;if(ve(a)&&ve(r)){if(n==="step")c=0,d=o.length-1;else{const m=(l=this.minMax[e])==null?void 0:l[0];c=+m.min,d=+m.max}const h=r-a,f=d-c;h>=f?(t.range[0]=c,t.range[1]=d):(t.range[0]=+a<c?c:+a,t.range[1]=+r>d?d:+r,t.range[1]-t.range[0]<h&&(t.range[0]=t.range[1]-h,t.range[0]<c&&(t.range[0]=c)))}}},updateScrollbar(e){this.updateScrollbarInfo("x",e),this.updateScrollbarInfo("y",e)},updateScrollbarInfo(e,t){var r,c,d,h,f,m,p,g,u,x,b,y,w,I,E,B,_;const{axesX:n,axesY:o}=this.options,s=e==="x"?n:o;if(!this.scrollbar[e].isInit&&((c=(r=s==null?void 0:s[0])==null?void 0:r.scrollbar)!=null&&c.use)&&((d=s==null?void 0:s[0])!=null&&d.range)){this.initScrollbarInfo(s,e);return}else if(!((h=s==null?void 0:s[0].scrollbar)!=null&&h.use)||Gi((f=s==null?void 0:s[0])==null?void 0:f.range)){this.destroyScrollbar(e);return}const l=e==="x"?this.axesX:this.axesY,a=!je((m=s==null?void 0:s[0])==null?void 0:m.range,(p=l==null?void 0:l[0])==null?void 0:p.range);if(a||t){const C=e==="x"?(x=(u=(g=this.options.axesX)==null?void 0:g[0])==null?void 0:u.scrollbar)==null?void 0:x.resetPosition:(w=(y=(b=this.options.axesY)==null?void 0:b[0])==null?void 0:y.scrollbar)==null?void 0:w.resetPosition;a||C?(this.scrollbar[e].range=(E=(I=s==null?void 0:s[0])==null?void 0:I.range)!=null&&E.length?[...((B=s==null?void 0:s[0])==null?void 0:B.range)??[]]:null,delete this.scrollbar[e].savedPosition):t&&delete this.scrollbar[e].savedPosition,this.initScrollbarRange(e)}this.scrollbar[e].use=!!((_=s==null?void 0:s[0].scrollbar)!=null&&_.use)},updateScrollbarPosition(){var e,t,n,o,s,l,a,r,c,d;if((e=this.scrollbar.x)!=null&&e.use&&((t=this.scrollbar.x)!=null&&t.isInit)){const h=!((s=(o=(n=this.options.axesX)==null?void 0:n[0])==null?void 0:o.scrollbar)!=null&&s.resetPosition);this.setScrollbarPosition("x",h)}if((l=this.scrollbar.y)!=null&&l.use&&((a=this.scrollbar.y)!=null&&a.isInit)){const h=!((d=(c=(r=this.options.axesY)==null?void 0:r[0])==null?void 0:c.scrollbar)!=null&&d.resetPosition);this.setScrollbarPosition("y",h)}},createScrollbarLayout(e){const t=this.scrollbar[e];t.dom=document.createElement("div"),t.dom.className="ev-chart-scrollbar",t.dom.dataset.type="scrollbar";const n=document.createElement("div");n.className="ev-chart-scrollbar-container",n.dataset.type=e,t.dom.appendChild(n),this.wrapperDOM.appendChild(t.dom)},createScrollbar(e){const t=this.scrollbar[e],n=t.dom.children[0];this.createScrollbarTrack(n),this.createScrollbarThumb(n),t.showButton&&this.createScrollbarButton(n)},createScrollbarTrack(e){const t=document.createElement("div");t.className="ev-chart-scrollbar-track",t.dataset.type="track",e.appendChild(t)},createScrollbarThumb(e){const t=document.createElement("div");t.className="ev-chart-scrollbar-thumb",t.dataset.type="thumb",e.appendChild(t)},createScrollbarButton(e){const t=document.createElement("div");t.className="ev-chart-scrollbar-button ev-chart-scrollbar-button-up",t.dataset.type="button";const n=document.createElement("i");n.className="ev-icon ev-icon-triangle-up ev-chart-scrollbar-button-icon",n.dataset.type="button-icon",t.appendChild(n);const o=document.createElement("div");o.className="ev-chart-scrollbar-button ev-chart-scrollbar-button-down",o.dataset.type="button";const s=document.createElement("i");s.className="ev-icon ev-icon-triangle-down ev-chart-scrollbar-button-icon",s.dataset.type="button-icon",o.appendChild(s),e.appendChild(t),e.appendChild(o)},setScrollbarPosition(e,t=!1){var _,C;const n=this.scrollbar[e];if(!n.use||!n.range)return;const o=n.dom,s=this.chartRect,l=this.labelOffset,a={x1:s.x1+l.left,x2:s.x2-l.right,y1:s.y1+l.top,y2:s.y2-l.bottom},r=(_=this.options.title)!=null&&_.show?(C=this.options.title)==null?void 0:C.height:0,c=e==="x",d=c?n.height:n.width,h=c?a.x2-a.x1:a.y2-a.y1,f=n.showButton?d:0,m=h-f*2;let p=null;t&&n.savedPosition!==void 0&&(p=n.savedPosition);const g=this.getScrollbarThumbSize(e,m,p);n.savedPosition=g.position;let u="display: block;",x,b,y,w,I=`width:${f}px;height:${f}px;`;c?(u=`top: ${s.y2+r+l.top}px;`,u+=`left: ${a.x1}px;`,u+=`width: ${h}px;`,u+=` height: ${d}px;`,x="top: 0;",x+=`left: ${f}px;`,x+=`width: ${m}px;`,x+="height: 100%;",b=`width: ${g.size}px;`,b+="height: 100%;",b+=`left: ${g.position+f}px`,I+="transform:rotate(90deg);top: 0;",y=`${I}right:0;`,w=`${I}left:0;`):(u=`top: ${a.y1+r}px;`,u+=`left: ${a.x2+10}px;`,u+=`width: ${d}px;`,u+=`height: ${h}px;`,x=`top: ${f}px;`,x+="left: 0;",x+="width: 100%;",x+=`height: ${m}px;`,b="width: 100%;",b+=`height: ${g.size}px;`,b+=`bottom: ${g.position+f}px`,I+="left:0;",y=`${I}top: 0;`,w=`${I}bottom: 0;`),o.style.cssText=u;const E=o.getElementsByClassName("ev-chart-scrollbar-track");E[0].style.cssText=x,E[0].style.backgroundColor=n.background;const B=o.getElementsByClassName("ev-chart-scrollbar-thumb");if(B[0].style.cssText=b,B[0].style.backgroundColor=n.thumbStyle.background,B[0].style.borderRadius=`${n.thumbStyle.radius}px`,n.showButton){const S=o.getElementsByClassName("ev-chart-scrollbar-button-up"),M=Math.floor(m-g.size),k=Math.floor(g.position)>M?.5:1;S[0].style.cssText=`background-color: ${n.background};${y}`,S[0].style.opacity=k,S[0].children[0].style.display="block";const T=o.getElementsByClassName("ev-chart-scrollbar-button-down");T[0].style.cssText=`background-color: ${n.background};${w}`,T[0].style.opacity=Math.floor(g.position)<0?.5:1,T[0].children[0].style.display="block"}},getScrollbarThumbSize(e,t,n){var m,p,g,u;const o=this.scrollbar[e],[s,l]=o.range,a=o.type;let r,c,d=1,h=0,f=0;if(a==="step"){const x=this.options.type==="heatMap"?this.data.labels[e]:this.data.labels,b=l-s+1;c=x.length;const y=t/c;r=y*b,f=y*s}else{const x=e==="x"?this.axesX:this.axesY,b=(m=this.minMax[e])==null?void 0:m[0],y=+b.max-+b.min,w=+l-+s;a==="time"&&(d=(u=x==null?void 0:x[0])==null?void 0:u.getInterval({minValue:b.min,maxValue:b.max,maxSteps:(g=(p=this.labelRange[e])==null?void 0:p[0])==null?void 0:g.max})),c=Math.ceil(y/d)+1,h=+b.min;const I=t/c,E=w/d+1,B=+s-h;r=I*E,f=I*(B/d)}return o.startValue=h,o.steps=c,o.interval=d,n!==null&&(f=n),{size:r,position:f}},getScrollbarContainerDOM(e){const t=["track","thumb","button"],n=e.dataset.type;return t.includes(n)?e.parentElement:n==="button-icon"?e.parentElement.parentElement:n==="scrollbar"?e.getElementsByClassName("ev-chart-scrollbar-container")[0]:e},updateScrollbarRange(e,t){const n=this.scrollbar[e],{startValue:o,range:s,interval:l,steps:a}=n,r=o+l*a,c=e==="x"?this.axesX[0]:this.axesY[0],[d,h]=s??[];(!ve(d)||!ve(h))&&(n.range=(c==null?void 0:c.range)||null);let f,m,p=!1;t?(f=d+l,m=h+l,p=m>=r):(f=d-l,m=h-l,p=f<o),p||(n.range=[f,m],delete n.savedPosition,this.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1},updateByScrollbar:!0,lightUpdate:f>1}))},createScrollEvent(){var t,n,o;this.onScrollbarClick=s=>{s.preventDefault();const l=s.target.dataset.type,a=this.getScrollbarContainerDOM(s.target),r=["button","button-icon"],c=a.dataset.type;let d;if(r.includes(l)){let h;l==="button"?h=s.target:l==="button-icon"&&(h=s.target.parentElement),d=h.className.includes("up")}else if(l==="track"){const h=a.getElementsByClassName("ev-chart-scrollbar-thumb"),{x:f,y:m}=h[0].getBoundingClientRect(),p=c==="x",g=p?s.clientX:-s.clientY,u=p?f:-m;d=g>u}else return;this.updateScrollbarRange(c,d)},this.onScrollbarDown=s=>{if(s.preventDefault(),s.target.dataset.type!=="thumb")return;const l=this.getScrollbarContainerDOM(s.target),a=l.dataset.type,r=l.getElementsByClassName("ev-chart-scrollbar-thumb"),{x:c,y:d,height:h}=r[0].getBoundingClientRect(),f=this.scrollbar[a];f.scrolling=!0,a==="x"?f.pointInThumb=s.clientX-c:f.pointInThumb=d+h-s.clientY;const m=f.dom;m.addEventListener("mousemove",this.onScrollbarMove),m.addEventListener("mouseup",this.onScrollbarUp)};const e=s=>{this.scrolling(s)};if(this.onScrollbarMove=xs(e,5),this.onScrollbarUp=s=>{s.preventDefault(),this.stopScrolling(s)},this.onScrollbarLeave=s=>{s.preventDefault(),this.scrolling(s),this.stopScrolling(s)},this.onScrollbarWheel=s=>{var h,f,m,p,g,u,x,b;const l=((f=(h=this.tooltipDOM)==null?void 0:h.style)==null?void 0:f.display)==="block",a=this.tooltipBodyDOM||((m=this.tooltipDOM)==null?void 0:m.querySelector(this.options.tooltip.htmlScrollTarget));if(l&&a){const{scrollTop:y,scrollHeight:w,clientHeight:I}=a,E=y<=0,B=y+I>=w,_=s.deltaY<0,C=s.deltaY>0;if(!(E&&_||B&&C))return}s.preventDefault();const r=1;if((p=this.scrollbar.x)!=null&&p.use&&s.shiftKey&&Math.abs(s.deltaY)>r){this.updateScrollbarRange("x",s.deltaY>0);return}const c=Math.abs(s.deltaX),d=Math.abs(s.deltaY);if(c>r&&d>r){c>d&&((g=this.scrollbar.x)!=null&&g.use)?this.updateScrollbarRange("x",s.deltaX>0):d>c&&((u=this.scrollbar.y)!=null&&u.use)&&this.updateScrollbarRange("y",s.deltaY<0);return}if((x=this.scrollbar.x)!=null&&x.use&&c>r){this.updateScrollbarRange("x",s.deltaX>0);return}(b=this.scrollbar.y)!=null&&b.use&&d>r&&this.updateScrollbarRange("y",s.deltaY<0)},this.scrollbar.x.use&&!this.scrollbar.x.isInit){const s=this.scrollbar.x.dom;s.addEventListener("click",this.onScrollbarClick),s.addEventListener("mousedown",this.onScrollbarDown),s.addEventListener("mouseleave",this.onScrollbarLeave)}if(this.scrollbar.y.use&&!this.scrollbar.y.isInit){const s=this.scrollbar.y.dom;s.addEventListener("click",this.onScrollbarClick),s.addEventListener("mousedown",this.onScrollbarDown),s.addEventListener("mouseleave",this.onScrollbarLeave)}((t=this.scrollbar.x)!=null&&t.use||(n=this.scrollbar.y)!=null&&n.use)&&((o=this.overlayCanvas)==null||o.addEventListener("wheel",this.onScrollbarWheel,{passive:!1}))},scrolling(e){const t=this.getScrollbarContainerDOM(e.target),n=t.dataset.type;if(!this.scrollbar[n].scrolling)return;const{steps:o,range:s,pointInThumb:l,startValue:a,interval:r}=this.scrollbar[n],c=t.getElementsByClassName("ev-chart-scrollbar-track"),{x:d,y:h,width:f,height:m}=c[0].getBoundingClientRect(),p=n==="x",g=p?d:h,u=p?f:m,x=u/o,b=a+(o-1)*r;let y=p?e.clientX:e.clientY;y<g?y=g:y>g+u&&(y=g+u);let w;if(p?w=y-g-l:w=g+u-y-l,w<=0)return;let I,E;const B=Math.round(Math.abs(w)/x)*r,[_,C]=s;if(w>0){const S=a+(B-+_);I=+_+S,E=I+(+C-+_)}I<a||E>b||(this.scrollbar[n].range=[I,E],delete this.scrollbar[n].savedPosition,this.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1}}))},stopScrolling(e){const n=this.getScrollbarContainerDOM(e.target).dataset.type,o=this.scrollbar[n];if(o.scrolling){o.scrolling=!1;const s=o.dom;s.removeEventListener("mousemove",this.onScrollbarMove,!1),s.removeEventListener("mouseup",this.onScrollbarUp,!1)}},hideScrollbar(e){const t=this.scrollbar[e].dom;if(!t)return;const n=t==null?void 0:t.style;n.display="none",n.width="0",n.height="0"},destroyScrollbar(e){var n,o,s;const t=this.scrollbar[e].dom;t&&(t.remove(),this.scrollbar[e]={isInit:!1},!((n=this.scrollbar.x)!=null&&n.use)&&!((o=this.scrollbar.y)!=null&&o.use)&&((s=this.overlayCanvas)==null||s.removeEventListener("wheel",this.onScrollbarWheel,{passive:!1})))}};function zC(e){const t=typeof e;return e!=null&&(t==="object"||t==="function")}function Vr(e,t,n){let o,s,l,a,r,c,d=0,h=!1,f=!1,m=!0;const p=!t&&t!==0&&typeof root.requestAnimationFrame=="function";if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0,zC(n)&&(h=!!n.leading,f="maxWait"in n,l=f?Math.max(+n.maxWait||0,t):l,m="trailing"in n?!!n.trailing:m);function g(M){const k=o,T=s;return o=s=void 0,d=M,a=e.apply(T,k),a}function u(M,k){return p?(window.cancelAnimationFrame(r),window.requestAnimationFrame(M)):setTimeout(M,k)}function x(M){if(p)return window.cancelAnimationFrame(M);clearTimeout(M)}function b(M){return d=M,r=u(I,t),h?g(M):a}function y(M){const k=M-c,T=M-d,R=t-k;return f?Math.min(R,l-T):R}function w(M){const k=M-c,T=M-d;return c===void 0||k>=t||k<0||f&&T>=l}function I(){const M=Date.now();if(w(M))return E(M);r=u(I,y(M))}function E(M){return r=void 0,m&&o?g(M):(o=s=void 0,a)}function B(){r!==void 0&&x(r),d=0,o=c=s=r=void 0}function _(){return r===void 0?a:E(Date.now())}function C(){return r!==void 0}function S(...M){const k=Date.now(),T=w(k);if(o=M,s=this,c=k,T){if(r===void 0)return b(c);if(f)return r=u(I,t),g(c)}return r===void 0&&(r=u(I,t)),a}return S.cancel=B,S.flush=_,S.pending=C,S}const FC="Expected a function";function HC(e,t,n){let o=!0,s=!0;if(typeof e!="function")throw new TypeError(FC);return Vr(e,t,{leading:o,maxWait:t,trailing:s})}const WC={createEventFunctions(){var e,t,n,o;this.onMouseMove=s=>{var m,p;if((m=this.dragInfo)!=null&&m.isMove||this.isMobile)return;const l={e:s},{indicator:a,tooltip:r,type:c}=this.options,d=this.getMousePosition(s),h=this.findHitItem(d);r!=null&&r.showAllValueInRange&&(h!=null&&h.items)&&this.addNotHitInfo(h);const f=this.overlayCtx;if(this.overlayClear(),Object.keys(h.items).length){if(r.use&&this.isInitTooltip)if(this.drawItemsHighlight(h,f),typeof(r==null?void 0:r.returnValue)=="function"){const u=[];Object.keys(h.items).forEach(x=>{u.push({sId:x,data:h.items[x].data,color:h.items[x].color,name:h.items[x].name,dataId:h.items[x].id,index:h.items[x].index})}),this.hideTooltipDOM(),r.returnValue(u,s)}else(p=r==null?void 0:r.formatter)!=null&&p.html?(this.drawCustomTooltip(h==null?void 0:h.items),this.setCustomTooltipLayoutPosition(h,s)):(this.setTooltipLayoutPosition(h,s),c==="scatter"?this.drawTooltipForScatter(h,this.tooltipCtx):c==="heatMap"?this.drawToolTipForHeatMap(h,this.tooltipCtx):this.drawTooltip(h,this.tooltipCtx));const g=Object.values(this.seriesList||{}).some(u=>u.type==="line");if(r.use&&(c==="line"||g)){const u=this.drawIndicatorForTooltip(h,a.color),x=u==null?void 0:u.labelValue,b=this.getTimeLabel(d);l.hoveredLabel={horizontal:this.options.horizontal,label:b,mousePosition:[s.clientX,s.clientY],dataLabel:x}}}else r.use&&this.isInitTooltip&&(typeof(r==null?void 0:r.returnValue)=="function"&&r.returnValue([],s),this.hideTooltipDOM());if(this.dragInfoBackup&&this.drawSelectionArea(this.dragInfoBackup),!l.hoveredLabel&&!this.isNotUseIndicator()){const g=Object.values(this.seriesList||{}).some(x=>x.type==="line");(c!=="line"&&!g||!r.use||!Object.keys(h.items).length)&&this.drawIndicator(d,a.color);const u=this.getTimeLabel(d);l.hoveredLabel={horizontal:this.options.horizontal,label:u,mousePosition:[s.clientX,s.clientY]}}else l.hoveredLabel||(l.hoveredLabel={label:""});typeof this.listeners["mouse-move"]=="function"&&(c!=="pie"&&(l.curMouseTargetVal=this.getCurMouseTargetVal(d,h)),this.listeners["mouse-move"](l))},this.onMouseLeave=s=>{const{tooltip:l,dragSelection:a}=this.options;l.throttledMove&&this.onMouseMove.cancel(),(!a.use||!a.keepDisplay)&&this.overlayClear(),l.use&&this.isInitTooltip&&(typeof(l==null?void 0:l.returnValue)=="function"&&l.returnValue([],s),this.tooltipClear()),this.listeners["mouse-leave"]()},this.onDblClick=s=>{const l={e:s},a=this.getMousePosition(s),{type:r,selectItem:c,selectLabel:d,selectSeries:h}=this.options,f=(c==null?void 0:c.use)&&(c==null?void 0:c.useClick),m=(d==null?void 0:d.use)&&(d==null?void 0:d.useClick),p=(h==null?void 0:h.use)&&(h==null?void 0:h.useClick);f?l.eventTarget="item":m?l.eventTarget="label":p&&(l.eventTarget="series");const g=()=>{var I,E;const b=this.findHitItem(a),y=b.hitId||Object.keys(b.items)[0],w=b.items[y];w&&(l.label=w.label,l.value=(I=w.data)==null?void 0:I.o,l.seriesId=y,l.dataIndex=w.index,l.acc=(E=w.data)==null?void 0:E.acc)},u=b=>{var _,C;const y=this.findHitItem(a),w=y.hitId||Object.keys(y.items)[0],I=y.items[w],{labelIndex:E}=this.getLabelInfoByPosition(a,b),{dataIndex:B}=this.regulateSelectedLabelInfo(E,b);this.defaultSelectInfo=this.getSelectedLabelInfoWithLabelData(B,b),I&&(l.label=I.label,l.seriesId=w,l.value=(_=I.data)==null?void 0:_.o,l.acc=(C=I.data)==null?void 0:C.acc,l.dataIndex=I.index)},x=()=>{var I,E,B;const b=this.findHitItem(a),y=b.hitId||Object.keys(b.items)[0],w=b.items[y];if(y!==null){const _=this.updateSelectedSeriesInfo(y,!0);w&&(l.label=w.label,l.value=(I=w.data)==null?void 0:I.o,l.seriesId=(E=_.seriesId)==null?void 0:E.at(0),l.acc=(B=w.data)==null?void 0:B.acc,l.dataIndex=w.index)}};switch(r){case"bar":{m?u(this.options.horizontal?"yAxis":"xAxis"):g();break}case"line":{f?g():m?u():p&&x();break}default:{g();break}}typeof this.listeners["dbl-click"]=="function"&&this.listeners["dbl-click"](l)},this.onClick=s=>{var b;if(this.isMouseMove){this.isMouseMove=!1;return}const l={e:s},a=this.getMousePosition(s),{type:r,selectItem:c,selectLabel:d,selectSeries:h}=this.options,f=(c==null?void 0:c.use)&&(c==null?void 0:c.useClick),m=(d==null?void 0:d.use)&&(d==null?void 0:d.useClick),p=(h==null?void 0:h.use)&&(h==null?void 0:h.useClick),g=()=>{const y=this.getItemByPosition(a,!1);({label:l.label,value:l.value,sId:l.seriesId,maxIndex:l.dataIndex,acc:l.acc}=y),y!=null&&y.sId&&(l.selected={eventTarget:"item",seriesId:this.isDeselectItem(y)?null:y.sId,dataIndex:this.isDeselectItem(y)?null:y.maxIndex})},u=y=>{var E,B,_,C;const{labelIndex:w}=this.getLabelInfoByPosition(a,y),{dataIndex:I}=this.regulateSelectedLabelInfo(w,y);this.defaultSelectInfo=this.getSelectedLabelInfoWithLabelData(I,y),y&&(this.defaultSelectInfo.targetAxis=I!=null&&I.length?y:null),l.selected={eventTarget:"label",...Se(this.defaultSelectInfo)},l.label=(B=(E=this.defaultSelectInfo)==null?void 0:E.label)==null?void 0:B.at(0),l.dataIndex=(C=(_=this.defaultSelectInfo)==null?void 0:_.dataIndex)==null?void 0:C.at(0)},x=()=>{const y=this.findHitItem(a),w=y.hitId||Object.keys(y.items)[0],I=y.items[w];if(w!==null){const E=this.updateSelectedSeriesInfo(w,!1);this.defaultSelectInfo.seriesId=E.seriesId,l.selected={eventTarget:"series",...Se(this.defaultSelectInfo)},l.label=I.label,l.dataIndex=I.index}};switch(r){default:case"bar":{f?g():m&&u(this.options.horizontal?"yAxis":"xAxis");break}case"line":{f?g():m?u():p&&x();break}case"heatMap":{const y=!!this.options.horizontal;if(f&&m){const{useBothAxis:w}=d,I=this.getCurMouseLocation(a);if(I==="chartBackground")this.clearSelectedLabelInfo(),l.deselected={eventTarget:"label"},g();else if(I==="yAxis"||I==="xAxis"){if(this.clearSelectedItemInfo(),l.deselected={eventTarget:"item"},!w&&I!==(y?"yAxis":"xAxis"))return;u(I)}}else if(f)g();else if(m){const{useBothAxis:w}=d,I=this.getCurMouseLocation(a);if((I==="yAxis"||I==="xAxis")&&!w&&I!==(y?"yAxis":"xAxis"))return;I!=="canvas"&&u(w?I:null)}break}case"pie":{f&&g();break}case"scatter":{if(f&&g(),(b=this.options.dragSelection)!=null&&b.use&&this.isMobile){let y=this.setTouchInfo(s);this.overlayClear(),this.options.dragSelection.keepDisplay&&(s.layerX<y.range.x1||s.layerY<y.range.y1||s.layerX>y.range.x2||s.layerY>y.range.y2)?this.isTouchOverlay=!1:(y=this.setTouchBoxDimensions(y),this.isTouchOverlay=!0,this.drawSelectionArea(y)),this.options.dragSelection.keepDisplay||setTimeout(()=>{this.isTouchOverlay=!1,this.overlayClear()},100),l.e=s,l.touchInfo=y,l.data=this.findSelectedItems(y),l.range=this.getSelectionRange(y),typeof this.listeners["drag-select"]=="function"&&this.listeners["drag-select"](l)}break}}typeof this.listeners.click=="function"&&(this.dragInfoBackup||this.listeners.click(l))},this.onMouseDown=s=>{const{dragSelection:l,type:a}=this.options;l.use&&(a==="scatter"||a==="line"||a==="heatMap")&&(this.removeSelectionArea(),this.dragStart(s,a))},this.onWheel=s=>{var r,c,d;const l=((c=(r=this.tooltipDOM)==null?void 0:r.style)==null?void 0:c.display)==="block",a=(d=this.tooltipDOM)==null?void 0:d.querySelector(this.options.tooltip.htmlScrollTarget);(l||a&&a.scrollHeight>a.clientHeight)&&(s.preventDefault(),l&&(this.tooltipBodyDOM.scrollTop+=s.deltaY),a&&(a.scrollTop+=s.deltaY))},(t=(e=this.options)==null?void 0:e.tooltip)!=null&&t.useScrollbar&&this.overlayCanvas.addEventListener("wheel",this.onWheel,{passive:!1}),(o=(n=this.options)==null?void 0:n.tooltip)!=null&&o.throttledMove&&(this.onMouseMove=HC(this.onMouseMove,30)),this.overlayCanvas.addEventListener("mousemove",this.onMouseMove),this.overlayCanvas.addEventListener("mouseleave",this.onMouseLeave),this.overlayCanvas.addEventListener("dblclick",this.onDblClick),this.overlayCanvas.addEventListener("click",this.onClick),this.overlayCanvas.addEventListener("mousedown",this.onMouseDown),this.dragTouchSelectionEvent=s=>this.dragTouchSelectionDestroy(s),window.addEventListener("click",this.dragTouchSelectionEvent)},dragStart(e,t){let[n,o]=this.getMousePosition(e);const s=this.chartRect,l=this.labelOffset,a={x1:s.x1+l.left,x2:s.x2-l.right,y1:s.y1+l.top,y2:s.y2-l.bottom};n<a.x1&&(n=a.x1),n>a.x2&&(n=a.x2),o<a.y1&&(o=a.y1),o>a.y2&&(o=a.y2),this.dragInfo={xcp:n,ycp:o,range:a};const r=d=>{d.preventDefault();const[h,f]=this.getMousePosition(d),m=this.dragInfo,{xcp:p,ycp:g,range:u}=m;let x,b;if(m.isMove=!0,this.isMouseMove=!0,h<u.x1?x=u.x1:h>u.x2?x=u.x2:x=h,f<u.y1?b=a.y1:f>u.y2?b=u.y2:b=f,t==="heatMap"){const y={xcp:p,xep:x,ycp:g,yep:b,range:u},{xsp:w,ysp:I,width:E,height:B}=this.getDragInfoForHeatMap(y);m.xsp=w,m.ysp=I,m.width=E,m.height=B}else m.xsp=Math.min(p,x),m.ysp=t==="scatter"?Math.min(g,b):u.y1,m.width=Math.ceil(Math.abs(x-p)),m.height=t==="scatter"?Math.ceil(Math.abs(b-g)):u.y2-u.y1;this.overlayClear(),this.drawSelectionArea(m)},c=d=>{var f,m;const h=this.dragInfo;if(h!=null&&h.isMove&&(h==null?void 0:h.width)>1&&(h==null?void 0:h.height)>1){const p={e:d,data:this.findSelectedItems(h),range:t==="heatMap"?this.getSelectionRangeForHeatMap(h):this.getSelectionRange(h)};if(this.dragInfoBackup=Fe({},h),typeof this.listeners["drag-select"]=="function"&&!((m=(f=this.options)==null?void 0:f.zoom)!=null&&m.use))this.listeners["drag-select"](p);else{const{xsp:g,range:u,width:x}=h,b=g-u.x1;p.range.dragSelectionInfo={dragXsp:b,dragXep:b+x,exceptAxesYChartWidth:u.x2-u.x1,exceptAxesXChartHeight:u.y2-u.y1,chartRange:u,chartTitle:this.options.title.text},this.options.zoom.getRangeInfo(p)}this.options.dragSelection.keepDisplay||this.removeSelectionArea()}this.dragInfo=null,window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",c)};window.addEventListener("mousemove",r),window.addEventListener("mouseup",c)},drawSelectionArea({xsp:e,ysp:t,width:n,height:o,range:s}){const l=this.overlayCtx,{fillColor:a,opacity:r}=this.options.dragSelection,c=this.chartRect,d=this.labelOffset,h={x1:c.x1+d.left,x2:c.x2-d.right,y1:c.y1+d.top,y2:c.y2-d.bottom};if(l.fillStyle=a,l.globalAlpha=r,je(h,s))l.fillRect(e,t,n,o);else{const f=s.x2-s.x1,m=s.y2-s.y1,p=h.x2-h.x1,g=h.y2-h.y1,u=(e-s.x1)/f,x=(t-s.y1)/m,b=h.x1+p*u,y=h.y1+g*x,w=n/f,I=o/m,E=p*w,B=g*I;l.fillRect(b,y,E,B)}l.globalAlpha=1},removeSelectionArea(){this.dragInfoBackup=null,this.overlayClear()},getMousePosition(e){const t=e.originalEvent||e,n=this.overlayCanvas.getBoundingClientRect();return[t.clientX-n.left,t.clientY-n.top,n.width,n.height]},getCurMouseTargetVal(e,t){const n=this.getCurMouseLocation(e),o={location:n,labelIdx:-1,labelVal:"",dataIdx:-1,maxDataVal:"",originVal:""};if(n==="chartBackground"){const{maxHighlight:s,items:l}=t;if(s!=null&&s.length){const[a,r]=s;l[a]&&(o.dataIdx=l[a].index,o.maxDataVal=r,o.originVal=t)}}else if(n==="xAxis"||n==="yAxis"){const{axesX:s,axesY:l}=this.options,a=(c,d,h)=>{o.labelIdx=d,o.labelVal=c[0].type==="time"?at(h).format(c[0].timeFormat):h,o.originVal=c[0].type==="time"?at(h):h};(c=>{const{labelIndex:d}=this.getLabelInfoByPosition(e,n),{labelVal:h,labelIdx:f}=this.getCurMouseLabelVal(c,e,d);a(c==="xAxis"?s:l,f,h)})(n)}return o},setTouchInfo(e){let[t,n]=this.getMousePosition(e);const o=this.chartRect,s=this.labelOffset,l={x1:o.x1+s.left,x2:o.x2-s.right,y1:o.y1+s.top,y2:o.y2-s.bottom};return t=Math.max(l.x1,Math.min(t,l.x2)),n=Math.max(l.y1,Math.min(n,l.y2)),{xcp:t,ycp:n,range:l}},setTouchBoxDimensions(e){var h;const t=((h=this.options.dragSelection)==null?void 0:h.size)||50,n=t/2,{xcp:o,ycp:s,range:l}=e;let a=o-n,r=s-n,c=t,d=t;return this.boxOverflow={x1:!1,x2:!1,y1:!1,y2:!1},o<l.x1+n&&(a=l.x1,c=n-(l.x1-o),this.boxOverflow.x1=!0),o>l.x2-n&&(c=n-(o-l.x2),this.boxOverflow.x2=!0),s<l.y1+n&&(r=l.y1,d=n-(l.y1-s),this.boxOverflow.y1=!0),s>l.y2-n&&(d=n-(s-l.y2),this.boxOverflow.y2=!0),e.xsp=a,e.ysp=r,e.width=c,e.height=d,e},dragTouchSelectionDestroy(e){var t;(t=this.options.dragSelection)!=null&&t.use&&e.target!==this.overlayCanvas&&this.isTouchOverlay&&(this.isTouchOverlay=!1,this.overlayClear())},findHitItem(e){var u,x;const t=Object.keys(this.seriesList),n={},o=!!this.options.horizontal,s=this.tooltipCtx;let l=null,a="",r=0,c="",d=null,h=null,f=1/0;const m=this.findClosestDataIndex(e,t);if(m===-1&&!this.isNotUseIndicator())return{items:n,hitId:l,maxTip:[a,c],maxHighlight:null};const p=t.every(b=>this.seriesList[b].type==="bar");for(let b=0;b<t.length;b++){const y=t[b],w=this.seriesList[y];if(w.findGraphData&&w.show){const I=w.findGraphData(e,o,m,!p);if(I!=null&&I.data){let E;if(I.data.o===null&&w.interpolation!=="zero"?w.isExistGrp||(E=o?I.data.x:I.data.y):isNaN(I.data.o)||(E=I.data.o),E!=null){const B=this.getFormattedTooltipLabel({dataId:w.id,seriesId:y,seriesName:w.name,itemData:I.data}),_=s?s.measureText(B).width:1;I.id=w.id,I.name=B,I.axis={x:w.xAxisIndex,y:w.yAxisIndex},I.label=o?(u=I.data)==null?void 0:u.y:(x=I.data)==null?void 0:x.x,n[y]=I;const C=this.getFormattedTooltipValue({dataId:w.id,seriesId:y,seriesName:B,value:E,itemData:I.data});if(I.data.formatted=C,r<_&&(a=B,r=_),c.length<=`${C}`.length&&(c=`${C}`),(d===null||d<=E)&&(d=E,h=y),I.hit&&I.data.xp!==void 0&&I.data.yp!==void 0){const S=(I.data.xp-e[0])**2+(I.data.yp-e[1])**2;S<f&&(f=S,l=y)}}}}}return l=l===null?Object.keys(n)[0]:l,{items:n,hitId:l,maxTip:[a,c],maxHighlight:d!==null?[h,d]:null}},findClosestDataIndex(e,t){var f;const[n,o]=e,s=!!this.options.horizontal,l=s?o:n,a=t.find(m=>{var p;return(p=this.seriesList[m])==null?void 0:p.show});if(!a||!((f=this.seriesList[a])!=null&&f.data))return-1;const r=this.seriesList[a].data;let c=50;if(r.length>1){const m=[];for(let p=1;p<r.length;p++){const g=r[p-1],u=r[p];if(g&&u){let x,b;s?(x=g.h?g.yp+g.h/2:g.yp,b=u.h?u.yp+u.h/2:u.yp):(x=g.w?g.xp+g.w/2:g.xp,b=u.w?u.xp+u.w/2:u.xp),x!==null&&b!==null&&m.push(Math.abs(b-x))}}m.length>0&&(c=m.reduce((p,g)=>p+g,0)/m.length)}let d=1/0,h=-1;for(let m=0;m<r.length;m++)if(t.some(g=>{var x,b,y,w;const u=this.seriesList[g];return(u==null?void 0:u.show)&&((b=(x=u.data)==null?void 0:x[m])==null?void 0:b.o)!==null&&((w=(y=u.data)==null?void 0:y[m])==null?void 0:w.o)!==void 0})){const g=r[m];if(g){let u;if(s?u=g.h?g.yp+g.h/2:g.yp:u=g.w?g.xp+g.w/2:g.xp,u!==null){const x=Math.abs(l-u);x<d&&(d=x,h=m)}}}return d>=c?t.some(p=>{const g=this.seriesList[p];if(g!=null&&g.show){const u=g.passingValue,x=g.interpolation,b=g.hasPassingValueInData;return x==="linear"||x==="none"&&!!u&&b}return!1})?h:-1:h},getFormattedTooltipLabel({dataId:e,seriesId:t,seriesName:n,itemData:o}){var c;const l=this.options.tooltip,a=(c=l==null?void 0:l.formatter)==null?void 0:c.label;let r=n;return a&&(r=a({dataId:e,seriesId:t,seriesName:n,itemData:o})),r},getFormattedTooltipValue({dataId:e,seriesId:t,seriesName:n,value:o,itemData:s}){var h;const l=this.options,a=!!l.horizontal,r=l.tooltip,c=typeof(r==null?void 0:r.formatter)=="function"?r==null?void 0:r.formatter:(h=r==null?void 0:r.formatter)==null?void 0:h.value;let d=o;return c&&(l.type==="pie"?d=c({value:o,name:n,percentage:s==null?void 0:s.percentage,seriesId:t,dataId:e}):l.type==="heatMap"?d=c({x:s==null?void 0:s.x,y:s==null?void 0:s.y,value:o>-1?o:"error",seriesId:t,dataId:e}):d=c({x:a?o:s==null?void 0:s.x,y:a?s==null?void 0:s.y:o,o:s==null?void 0:s.o,name:n,seriesId:t,dataId:e})),o&&(!c||typeof d!="string")&&(l.type==="heatMap"?d=o<0?"error":Ht(o):d=Ht(o)),d},addNotHitInfo(e){var c,d,h,f,m,p;const t=this.tooltipCtx,n=!!this.options.horizontal,o=Object.keys(e.items)[0],s=n?(h=(d=(c=e.items)==null?void 0:c[o])==null?void 0:d.data)==null?void 0:h.y:(p=(m=(f=e.items)==null?void 0:f[o])==null?void 0:m.data)==null?void 0:p.x;let l="",a="";const r=Object.keys(this.seriesList);for(let g=0;g<r.length;g++){const u=r[g],x=this.seriesList[u];if(x!=null&&x.show){const b=x.data.find(C=>n?(C==null?void 0:C.y)===s:(C==null?void 0:C.x)===s),y=this.getFormattedTooltipLabel({dataId:x.id,seriesId:u,seriesName:x.name,itemData:b}),w=this.getFormattedTooltipValue({dataId:x.id,seriesId:u,seriesName:y,value:b==null?void 0:b.o,itemData:b});if(b&&b.o!==null&&b.o!==void 0&&!e.items[u]){const C={};C.color=x.color,C.hit=!1,C.name=y,C.axis={x:x.xAxisIndex,y:x.yAxisIndex},C.index=n?x.yAxisIndex:x.xAxisIndex,C.data=b,C.data.formatted=w,e.items[u]=C}const I=t?t.measureText(l).width:1,E=t?t.measureText(y).width:1;I<E&&(l=y);const B=t?t.measureText(a).width:1,_=t?t.measureText(`${w}`).width:1;B<_&&(a=`${w}`)}}e.maxTip=[l,a]},selectItemByData(e,t){this.defaultSelectItemInfo=e;let n;t==="pie"?n={type:"pie",sId:e.seriesID}:n=isNaN(e==null?void 0:e.dataIndex)?null:this.getItem(e,!1),this.render(n)},selectLabelByData(e,t){this.defaultSelectInfo=this.getSelectedLabelInfoWithLabelData(e,t),this.render()},selectSeriesByData(e){this.defaultSelectInfo.seriesId=e,this.render()},getSelectedLabelInfoWithLabelData(e,t){const{selectLabel:n,type:o,horizontal:s}=this.options,l=Se(this.defaultSelectInfo);switch(l.dataIndex=e,o){default:case"bar":case"line":{l.dataIndex.splice(n.limit),l.label=l.dataIndex.map(r=>this.data.labels[r]);const a=Object.entries(this.data.data);l.data=l.dataIndex.map(r=>Object.fromEntries(a.map(([c,d])=>[c,d[r]])));break}case"heatMap":{const{limit:a,useBothAxis:r}=this.options.selectLabel;l.dataIndex.splice(a);let c;r?c=t==="yAxis"?"y":"x":c=s?"y":"x",l.label=l.dataIndex.map(h=>this.data.labels[c][h]);const d=Object.values(this.data.data)[0];l.data=d.filter(({x:h,y:f})=>l.label.includes(c==="y"?f:h));break}}return l},regulateSelectedLabelInfo(e,t){var l,a;const n=((l=this.options)==null?void 0:l.selectLabel)??{},o=t===null||((a=this.defaultSelectInfo)==null?void 0:a.targetAxis)===t?{...this.defaultSelectInfo,targetAxis:t}:{dataIndex:[],targetAxis:t},s=Se(o);if(o.dataIndex.includes(e)){const r=o.dataIndex.indexOf(e);s.dataIndex.splice(r,1)}else e>-1&&(s.dataIndex.push(e),n.limit>0&&n.limit<s.dataIndex.length&&(n.useDeselectOverflow?s.dataIndex.splice(0,1):s.dataIndex.pop()));return s},updateSelectedSeriesInfo(e,t){var l;const n=((l=this.options)==null?void 0:l.selectSeries)??{},o=this.defaultSelectInfo??{seriesId:[]};typeof o.seriesId=="string"&&(o.seriesId=[o.seriesId]);const s=Se(o);if(o.seriesId.includes(e)){if(!t){const a=o.seriesId.indexOf(e);s.seriesId.splice(a,1)}}else e&&(s.seriesId.push(e),n.limit>0&&n.limit<s.seriesId.length&&(n.useDeselectOverflow?s.seriesId.splice(0,1):s.seriesId.pop()));return s},drawIndicatorForTooltip(e,t){var d;if(!(e!=null&&e.items)||!Object.keys(e.items).length)return null;const n=this.overlayCtx,{horizontal:o}=this.options,s={x1:this.chartRect.x1+this.labelOffset.left,x2:this.chartRect.x2-this.labelOffset.right,y1:this.chartRect.y1+this.labelOffset.top,y2:this.chartRect.y2-this.labelOffset.bottom},l=Object.keys(e.items)[0],a=e.items[l];if(!(a!=null&&a.data))return null;const r=o?a.data.y:a.data.x;let c;if(o){const h=a.data.yp+(a.data.h?a.data.h/2:0);c=[s.x1,h]}else c=[a.data.xp+(a.data.w?a.data.w/2:0),s.y1];return n.beginPath(),n.save(),n.strokeStyle=t,n.lineWidth=1,(d=this.options.indicator)!=null&&d.segments&&n.setLineDash(this.options.indicator.segments),o?(n.moveTo(s.x1,c[1]+.5),n.lineTo(s.x2,c[1]+.5)):(n.moveTo(c[0]+.5,s.y1),n.lineTo(c[0]+.5,s.y2)),n.stroke(),n.restore(),n.closePath(),{labelValue:r,position:c}},findSelectedItems(e){const t=[],n=Object.keys(this.seriesList);for(let o=0;o<n.length;o++){const s=n[o],l=this.seriesList[s],a=l.findItems;if(a){const r=a.call(l,e);r&&r.length&&t.push({seriesName:l.name,seriesId:s,items:r})}}return t},getSelectionRange({xsp:e,ysp:t,width:n,height:o,range:s}){var w,I,E,B;const l=this.axesSteps.x.length?this.axesSteps.x[0]:null,a=this.axesSteps.y.length?this.axesSteps.y[0]:null;if(!l||!a)return null;const r=e+n,c=t+o,d=l.graphMax-l.graphMin,h=a.graphMax-a.graphMin,f=this.getRatioInRange(s.x1,s.x2,e),m=this.getRatioInRange(s.x1,s.x2,r),p=this.getRatioInRange(s.y1,s.y2,c),g=this.getRatioInRange(s.y1,s.y2,t),u=this.isMobile&&((w=this.boxOverflow)!=null&&w.x1)?Math.min(this.minMax.x[0].min,l.graphMin):Math.max(l.graphMin+d*f,l.graphMin),x=this.isMobile&&((I=this.boxOverflow)!=null&&I.x2)?Math.max(this.minMax.x[0].max,l.graphMax):Math.min(l.graphMin+d*m,l.graphMax),b=this.isMobile&&((E=this.boxOverflow)!=null&&E.y2)?Math.min(this.minMax.y[0].min,a.graphMin):Math.max(a.graphMin+h*(1-p),a.graphMin),y=this.isMobile&&((B=this.boxOverflow)!=null&&B.y1)?Math.max(this.minMax.y[0].max,a.graphMax):Math.min(a.graphMin+h*(1-g),a.graphMax);return{xMin:+u.toFixed(3),xMax:+x.toFixed(3),yMin:+b.toFixed(3),yMax:+y.toFixed(3)}},getRatioInRange(e,t,n){const o=t-e;return(n-e)/o},getDragInfoForHeatMap(e){const t=Object.keys(this.seriesList)[0];return this.seriesList[t].findBlockRange(e)},getSelectionRangeForHeatMap(e){const t=this.axesSteps.x.length?this.axesSteps.x[0]:null,n=this.axesSteps.y.length?this.axesSteps.y[0]:null;if(!t||!n)return null;const o=Object.keys(this.seriesList)[0],{xMin:s,xMax:l,yMin:a,yMax:r}=this.seriesList[o].findSelectionRange(e)??{};return{xMin:s??t.graphMin,xMax:l??t.graphMax,yMin:a??n.graphMin,yMax:r??n.graphMax}},isDeselectItem(e){var t,n;return this.options.selectItem.useDeselectItem&&(e==null?void 0:e.maxIndex)===((t=this.defaultSelectItemInfo)==null?void 0:t.dataIndex)&&(e==null?void 0:e.sId)===((n=this.defaultSelectItemInfo)==null?void 0:n.seriesID)&&!isNaN(e==null?void 0:e.maxIndex)},getCurMouseLocation(e){const[t,n]=e,o={x1:this.chartRect.x1+this.labelOffset.left,x2:this.chartRect.x2-this.labelOffset.right,y1:this.chartRect.y1+this.labelOffset.top,y2:this.chartRect.y2-this.labelOffset.bottom},s=o[this.axesX[0].units.rectStart],l=o[this.axesX[0].units.rectEnd],a=o[this.axesY[0].units.rectStart],r=o[this.axesY[0].units.rectEnd];return ut(t,this.chartRect.x1,o.x1)&&ut(n,a,r)?"yAxis":ut(t,s,l)&&ut(n,o.y2,this.chartRect.y2)?"xAxis":ut(t,o.x1,o.x2)&&ut(n,o.y1,o.y2)?"chartBackground":"canvas"},isNotUseIndicator(){return this.options.type==="pie"||this.options.type==="scatter"||this.options.type==="heatMap"},clearSelectedLabelInfo(){this.defaultSelectInfo={dataIndex:[]}},clearSelectedItemInfo(){this.defaultSelectItemInfo=null}},Vs=8,li=50,io=17,$C=8,XC={createTooltipDOM(){var e,t;this.tooltipDOM=document.createElement("div"),this.tooltipDOM.className="ev-chart-tooltip",this.tooltipHeaderDOM=document.createElement("div"),this.tooltipHeaderDOM.className="ev-chart-tooltip-header",this.tooltipBodyDOM=document.createElement("div"),this.tooltipBodyDOM.className="ev-chart-tooltip-body",this.tooltipCanvas=document.createElement("canvas"),this.tooltipCanvas.className="ev-chart-tooltip-canvas",this.tooltipCtx=this.tooltipCanvas.getContext("2d"),this.tooltipDOM.style.display="none",(t=(e=this.options.tooltip)==null?void 0:e.formatter)!=null&&t.html||this.setDefaultTooltipLayout(),document.body.appendChild(this.tooltipDOM),this.options.tooltip.debouncedHide?this.hideTooltipDOM=Vr(()=>{this.tooltipDOM.style.display="none"},200):this.hideTooltipDOM=()=>{this.tooltipDOM.style.display="none"},this.isInitTooltip=!0},setDefaultTooltipLayout(){this.tooltipBodyDOM.appendChild(this.tooltipCanvas),this.tooltipDOM.appendChild(this.tooltipHeaderDOM),this.tooltipDOM.appendChild(this.tooltipBodyDOM)},getFontStyle(e){var s,l;const t=(s=this.options)==null?void 0:s.tooltip,n=((l=t==null?void 0:t.fontSize)==null?void 0:l[e])??14,o=(t==null?void 0:t.fontFamily)??"Roboto";return`normal normal lighter ${Math.max(n,0)}px ${o}`},getTextHeight(){var e,t,n;return(((n=(t=(e=this.options)==null?void 0:e.tooltip)==null?void 0:t.fontSize)==null?void 0:n.contents)??14)+6},getColorMargin(){var e,t,n;return(((n=(t=(e=this.options)==null?void 0:e.tooltip)==null?void 0:t.fontSize)==null?void 0:n.contents)??14)+2},getBoxPadding(){var s,l;const{top:e=0,right:t=20,bottom:n=3,left:o=16}=((l=(s=this.options)==null?void 0:s.tooltip)==null?void 0:l.rowPadding)??{};return{t:e,l:o,b:n,r:t}},setTooltipLayoutPosition(e,t){var A,F,X,U,H,$,j;const n=this.tooltipCtx,o=t.pageX,s=t.pageY,l=e.items,[a,r]=e.maxTip,d=Object.keys(l).length,h=this.getBoxPadding(),f=this.options.tooltip,m=this.getColorMargin(),p=e.hitId,g=l[p].data,u=l[p].axis,x=(A=f.formatter)==null?void 0:A.title;this.axesX.length&&this.axesY.length&&f.showHeader&&(x?this.tooltipHeaderDOM.textContent=x({x:g.x,y:g.y}):this.tooltipHeaderDOM.textContent=this.options.horizontal?this.axesY[u.y].getLabelFormat(g.y):this.axesX[u.x].getLabelFormat(g.x)),f.textOverflow&&this.tooltipHeaderDOM.classList.add(`ev-chart-tooltip-header--${f.textOverflow}`),this.tooltipHeaderDOM.style.visibility="hidden",n.save(),n.font=this.getFontStyle("contents");const y=!!this.options.horizontal?(X=(F=l[e.hitId])==null?void 0:F.data)==null?void 0:X.y:(H=(U=l[e.hitId])==null?void 0:U.data)==null?void 0:H.x,w=(y==null?void 0:y.length)>a.length?y:a,I=Math.round(n.measureText(w).width),E=Math.round(n.measureText(r).width),B=I+E+h.l+h.r+m+li+io,_=B>f.maxWidth?f.maxWidth:B;let C=f.textOverflow==="wrap"?0:d;if(f.textOverflow==="wrap"){const K=f.maxWidth-(Math.round(n.measureText(r).width)+h.l+h.r+m+li+io);Object.values(l).map(Q=>Q.name).forEach(Q=>{if(n.measureText(Q).width>K){let J="";for(let ee=0;ee<Q.length;ee++){const G=Q[ee],ne=`${J}${G}`;n.measureText(ne).width>K?(J=G,C+=1):J=ne}}C+=1}),n.restore()}const S=h.t+C*this.getTextHeight()+d*Vs+h.b;let M;f.useScrollbar&&S>f.maxHeight?(this.tooltipBodyDOM.style.overflowY="auto",M=f.maxHeight):(this.tooltipBodyDOM.style.overflowY="hidden",M=S),this.tooltipCanvas.width=_*this.pixelRatio,this.tooltipCanvas.height=S*this.pixelRatio,this.tooltipCanvas.style.width=`${_}px`,this.tooltipCanvas.style.height=`${S}px`,this.tooltipHeaderDOM.style.width=`${_}px`,this.tooltipHeaderDOM.style.height="auto",this.tooltipDOM.style.height="auto",this.tooltipBodyDOM.style.height=`${M+6}px`,this.tooltipDOM.style.display="block";const k=document.body.clientWidth,T=document.body.clientHeight,R=20,L=(($=this.tooltipDOM)==null?void 0:$.offsetHeight)||((j=this.tooltipHeaderDOM)==null?void 0:j.offsetHeight)+M+$C,N=k-_-R,v=T-L-R,O=o+R,D=s+R,V=o-_-R,P=s-L-R;this.tooltipDOM.style.left=O>N?`${V}px`:`${O}px`,this.tooltipDOM.style.top=D>v?`${P}px`:`${D}px`},drawSeriesColorShape(e,t,n){var a,r;const o=(r=(a=this.options.tooltip)==null?void 0:a.fontSize)==null?void 0:r.contents,{x:s,y:l}=n;if(t==="circle"){e.beginPath();const c=o/2;e.arc(s,l-c/2,c,0,2*Math.PI),e.fill()}else{const c=o;e.fillRect(s-c/3,l-c/1.2,c,c)}},drawTooltip(e,t){const n=t,o=e.items,[,s]=e.maxTip,l=this.alignSeriesList(Object.keys(o)),a=this.getBoxPadding(),r=this.options.horizontal,c=this.options.tooltip,d=this.getTextHeight(),h=this.getColorMargin();this.axesX.length&&this.axesY.length&&c.showHeader?this.tooltipHeaderDOM.style.visibility="visible":this.tooltipHeaderDOM.style.display="none";let f=2,m=2;f+=Y.aliasPixel(f),m+=Y.aliasPixel(m),n.save(),n.scale(this.pixelRatio,this.pixelRatio),this.tooltipBodyDOM.style.overflowY==="auto"&&(a.r+=io),f+=a.l,m+=a.t,n.font=this.getFontStyle("contents");const p=[];l.forEach(u=>{p.push({id:u,data:o[u].data,color:o[u].color,name:o[u].name,dataId:o[u].id})}),c.sortByValue&&p.sort((u,x)=>{let b=u.data.o,y=x.data.o;return b==null&&(b=r?u.data.x:u.data.y),y==null&&(y=r?x.data.x:x.data.y),y-b}),this.setTooltipDOMStyle(c);let g=1;for(let u=0;u<p.length;u++){const x=p[u].data,b=p[u].color,y=p[u].name,w=x.formatted;let I=f+4,E=m+g*d;I+=Y.aliasPixel(I),E+=Y.aliasPixel(E),n.beginPath(),typeof b!="string"?n.fillStyle=ie.createGradient(n,r,{x:I-4,y:E,w:12,h:-12},b):n.fillStyle=b;const B={id:p[u].id,name:p[u].name,value:w,dataId:p[u].dataId};this.drawSeriesColorShape(n,c.colorShape,{x:I,y:E}),n.fillStyle=typeof c.fontColor.label=="function"?c.fontColor.label(B):c.fontColor.label??c.fontColor;const _=c.maxWidth-Math.round(n.measureText(s).width)-a.l-a.r-h-li,C=I+h,S=E;if(_>n.measureText(y).width)n.fillText(y,C,S);else if(c.textOverflow==="wrap"){let M="",k=S;for(let T=0;T<y.length;T++){const R=y[T],L=`${M}${R}`;n.measureText(L).width>_?(n.fillText(M,C,k),M=R,g+=1,k+=d):M=L}n.fillText(M,C,k)}else{const M=Y.truncateLabelWithEllipsis(y,_,n);n.fillText(M,C,S)}n.save(),n.fillStyle=typeof c.fontColor.value=="function"?c.fontColor.value(B):c.fontColor.value??c.fontColor,n.textAlign="right",n.fillText(w,this.tooltipDOM.offsetWidth-a.r,E),n.restore(),n.closePath(),m+=Vs,g+=1}n.restore()},drawToolTipForHeatMap(e,t){const n=t,o=e.items,s=e.hitId,l=o[s].data,a=o[s].axis,r=o[s].color,c=this.getBoxPadding(),d=this.options.horizontal,h=this.options.tooltip,f=Object.values(this.seriesList)[0],m=this.getTextHeight(),p=this.getColorMargin();let g=!1,u=l.formatted;const{colorState:x,isGradient:b}=f;if(b){const{min:E,max:B}=f.valueOpt,_=We(l.o-E,B-E),{start:C,end:S}=x[0];g=C<=_&&_<=S||l.o===-1}else{const E=x.find(({id:B})=>B===l.cId);g=E==null?void 0:E.show,u=(E==null?void 0:E.label)??u}if(!g){this.tooltipClear();return}this.axesX.length&&this.axesY.length&&h.showHeader?this.tooltipHeaderDOM.style.visibility="visible":this.tooltipHeaderDOM.style.display="none",this.setTooltipDOMStyle(h),n.save(),n.scale(this.pixelRatio,this.pixelRatio),this.tooltipBodyDOM.style.overflowY==="auto"&&(c.r+=io);const y=c.l+2,w=c.t+m+2;n.font=this.getFontStyle("contents"),n.beginPath(),typeof r!="string"?n.fillStyle=ie.createGradient(n,d,{x:y,y:w,w:12,h:-12},r):n.fillStyle=r;const I={id:e.hitId,name:l.y,value:u,dataId:o[s].id};this.drawSeriesColorShape(n,h.colorShape,{x:y,y:w}),n.fillStyle=typeof h.fontColor.label=="function"?h.fontColor.label(I):h.fontColor.label??h.fontColor,this.axesY.length&&n.fillText(this.axesY[a.y].getLabelFormat(l.y),y+p,w),n.textAlign="right",n.fillStyle=typeof h.fontColor.value=="function"?h.fontColor.value(I):h.fontColor.value??h.fontColor,n.fillText(u,this.tooltipDOM.offsetWidth-c.r,w),n.closePath()},drawTooltipForScatter(e,t){const n=t,o=e.items,[,s]=e.maxTip,l=this.alignSeriesList(Object.keys(o)),a=this.getBoxPadding(),r=this.options.tooltip,c=this.getTextHeight(),d=this.getColorMargin();this.axesX.length&&this.axesY.length&&r.showHeader?this.tooltipHeaderDOM.style.visibility="visible":this.tooltipHeaderDOM.style.display="none";let h=2,f=2;h+=Y.aliasPixel(h),f+=Y.aliasPixel(f),n.save(),n.scale(this.pixelRatio,this.pixelRatio),this.tooltipBodyDOM.style.overflowY==="auto"&&(a.r+=io),h+=a.l,f+=a.t,n.font=this.getFontStyle("contents");const m=[];l.forEach(g=>{m.push({data:o[g].data,color:o[g].color,name:o[g].name})}),r.sortByValue&&m.sort((g,u)=>{let x=g.data.o,b=u.data.o;return x==null&&(x=g.data.y),b==null&&(b=u.data.y),b-x}),this.setTooltipDOMStyle(r);let p=1;for(let g=0;g<m.length;g++){const u=m[g].data,x=m[g].color,b=m[g].name,y=u.formatted;let w=h+4,I=f+p*c;w+=Y.aliasPixel(w),I+=Y.aliasPixel(I),n.beginPath(),typeof x!="string"?n.fillStyle=ie.createGradient(n,!1,{x:w-4,y:I,w:12,h:-12},x):n.fillStyle=x;const E={id:e.hitId,name:m[g].name,value:y,dataId:m[g].dataId};this.drawSeriesColorShape(n,r.colorShape,{x:w,y:I}),n.fillStyle=typeof r.fontColor.label=="function"?r.fontColor.label(E):r.fontColor.label??r.fontColor;const B=r.maxWidth-Math.round(n.measureText(s).width)-a.l-a.r-d-li,_=w+d,C=I;if(B>n.measureText(b).width)n.fillText(b,_,C);else if(r.textOverflow==="wrap"){let S="",M=C;for(let k=0;k<b.length;k++){const T=b[k],R=`${S}${T}`;n.measureText(R).width>B?(n.fillText(S,_,M),S=T,p+=1,M+=c):S=R}n.fillText(S,_,M)}else{const S=Y.truncateLabelWithEllipsis(b,B,n);n.fillText(S,_,C)}n.save(),n.textAlign="right",n.fillStyle=typeof r.fontColor.value=="function"?r.fontColor.value(E):r.fontColor.value??r.fontColor,n.fillText(y,this.tooltipDOM.offsetWidth-a.r,I),n.restore(),n.closePath(),f+=Vs,p+=1}n.restore()},setCustomTooltipLayoutPosition(e,t){var b,y;const n=t.pageX,o=t.pageY,s=(b=this.tooltipDOM.getElementsByClassName("ev-chart-tooltip-custom"))==null?void 0:b[0];if(!s&&!this.tooltipDOM)return;this.tooltipDOM.style.display="block";const l=s.offsetWidth,a=s.offsetHeight;this.tooltipDOM.style.height="auto",this.tooltipBodyDOM.style.height=`${a+6}px`;const r=document.body.clientWidth,c=document.body.clientHeight,d=(y=this.tooltipDOM)==null?void 0:y.getBoundingClientRect(),h=20,f=r-l-h,m=c-(d==null?void 0:d.height)-h,p=n+h,g=o+h,u=n-l-h,x=o-(d==null?void 0:d.height)-h;this.tooltipDOM.style.left=p>f?`${u}px`:`${p}px`,this.tooltipDOM.style.top=g>m?`${x}px`:`${g}px`},drawCustomTooltip(e){var n,o,s,l;const t=(n=this.options)==null?void 0:n.tooltip;if((o=t.formatter)!=null&&o.html){this.tooltipDOM.innerHTML="";const a=[];Object.keys(e).forEach(c=>{a.push({sId:c,data:e[c].data,color:e[c].color,name:e[c].name,dataId:e[c].id,index:e[c].index})});const r=Y.htmlToElement((s=t==null?void 0:t.formatter)==null?void 0:s.html(a));r&&this.tooltipDOM.appendChild(r),this.tooltipDOM.style.overflowY="hidden",this.tooltipDOM.style.backgroundColor=t.backgroundColor,this.tooltipDOM.style.border=`1px solid ${t.borderColor}`,this.tooltipDOM.style.color=((l=t.fontColor)==null?void 0:l.title)??t.fontColor}},setTooltipDOMStyle(e){var t;if(this.tooltipDOM.style.overflowY="hidden",this.tooltipDOM.style.backgroundColor=e.backgroundColor,this.tooltipDOM.style.border=`1px solid ${e.borderColor}`,this.tooltipDOM.style.color=((t=e.fontColor)==null?void 0:t.title)??e.fontColor,this.tooltipHeaderDOM.style.fontSize=`${e.fontSize.title}px`,this.tooltipHeaderDOM.style.fontFamily=this.getFontStyle("title"),e.useShadow){const n=`rgba(0, 0, 0, ${e.shadowOpacity})`;this.tooltipDOM.style.boxShadow=`2px 2px 2px ${n}`}this.tooltipDOM.style.display="block"},drawItemsHighlight(e,t){Object.keys(e.items).forEach(n=>{var s;const o=this.seriesList[n];o.itemHighlight(e.items[n],t,e.items[n].index,(s=this.options)==null?void 0:s.unSelectedOpacity),Y.isDoughnutHole(o.type)&&this.drawDoughnutHole(t)})},drawIndicator(e,t){var d;const n=this.overlayCtx,[o,s]=e,l={x1:this.chartRect.x1+this.labelOffset.left,x2:this.chartRect.x2-this.labelOffset.right,y1:this.chartRect.y1+this.labelOffset.top,y2:this.chartRect.y2-this.labelOffset.bottom},a=15,r=15,c=this.options;o>=l.x1-a&&o<=l.x2+a&&s>=l.y1-r&&s<=l.y2+r&&(n.beginPath(),n.save(),n.strokeStyle=t,n.lineWidth=1,(d=c.indicator)!=null&&d.segments&&n.setLineDash(c.indicator.segments),c.horizontal?(n.moveTo(l.x1,s+.5),n.lineTo(l.x2,s+.5)):(n.moveTo(o+.5,l.y1),n.lineTo(o+.5,l.y2)),n.stroke(),n.restore(),n.closePath())},getTimeLabel(e){var h,f;const t=this.options;if(t.syncHover===!1||!t.horizontal&&!t.axesX.every(({type:m})=>m==="time")||t.horizontal&&!t.axesY.every(({type:m})=>m==="time"))return null;const n=+((h=this.data.labels)==null?void 0:h[0]),o=+((f=this.data.labels)==null?void 0:f[this.data.labels.length-1]);if(n==null||o==null)return null;const[s,l]=e,a={x1:this.chartRect.x1+this.labelOffset.left,x2:this.chartRect.x2-this.labelOffset.right,y1:this.chartRect.y1+this.labelOffset.top,y2:this.chartRect.y2-this.labelOffset.bottom};if(t.horizontal){const m=a.y2-a.y1,g=(l-a.y1)*(o-n)/m+n;return Math.round(g)}const r=a.x2-a.x1,d=(s-a.x1)*(o-n)/r+n;return Math.round(d)},drawSyncedIndicator({horizontal:e,label:t,mousePosition:n,dataLabel:o}){var g,u;if(!this._canDrawSyncedIndicator(e,n))return;if(o){this.drawSyncedIndicatorForTooltip({dataLabel:o,mousePosition:n});return}const s=+((g=this.data.labels)==null?void 0:g[0]),l=+((u=this.data.labels)==null?void 0:u[this.data.labels.length-1]),[a,r]=n,{top:c,bottom:d,left:h,right:f}=this.chartDOM.getBoundingClientRect();if(ut(a,h,f)&&ut(r,d,c))return;this.overlayClear();const p={x1:this.chartRect.x1+this.labelOffset.left,x2:this.chartRect.x2-this.labelOffset.right,y1:this.chartRect.y1+this.labelOffset.top,y2:this.chartRect.y2-this.labelOffset.bottom};if(e){const b=(p.y2-p.y1)*(t-s)/(l-s)+p.y1;this.drawIndicator([p.x2,b],this.options.indicator.color)}else{const b=(p.x2-p.x1)*(t-s)/(l-s)+p.x1;this.drawIndicator([b,p.y2],this.options.indicator.color)}},_canDrawSyncedIndicator(e,t){return!t||!!e!=!!this.options.horizontal?!1:this._isTimeBasedSyncEnabled(e)&&this._hasValidTimeRange()},_isTimeBasedSyncEnabled(e){var n,o;return this.options.syncHover===!1||!((o=(n=this.data)==null?void 0:n.labels)!=null&&o.length)?!1:e?this.options.axesY.every(({type:s})=>s==="time"):this.options.axesX.every(({type:s})=>s==="time")},_hasValidTimeRange(){var n,o;const e=+((n=this.data.labels)==null?void 0:n[0]),t=+((o=this.data.labels)==null?void 0:o[this.data.labels.length-1]);return e!=null&&t!=null},drawSyncedIndicatorForTooltip({dataLabel:e,mousePosition:t}){var f,m,p,g,u,x,b,y,w,I,E,B,_;if(!((f=this.data)!=null&&f.labels)||!e)return;const n=this.data.labels.findIndex(C=>(C==null?void 0:C.valueOf())===(e==null?void 0:e.valueOf()));if(n===-1){this.overlayClear();return}const{horizontal:o}=this.options,s=this.chartDOM.getBoundingClientRect(),[l,a]=t;if(ut(l,s.left,s.right)&&ut(a,s.bottom,s.top))return;this.overlayClear();const c={x1:this.chartRect.x1+this.labelOffset.left,x2:this.chartRect.x2-this.labelOffset.right,y1:this.chartRect.y1+this.labelOffset.top,y2:this.chartRect.y2-this.labelOffset.bottom},d=this.data.labels.length;let h;if(o){const C=c.y2-c.y1,S=(m=this.options.axesY)==null?void 0:m.some(T=>T.categoryMode),M=(p=this.options.axesY)==null?void 0:p.some(T=>T.type==="time");let k;if(S)k=c.y1+C*(n+.5)/d;else if(M){const T=(u=(g=this.axesSteps)==null?void 0:g.y)==null?void 0:u[0],R=(T==null?void 0:T.graphMin)??+((x=this.data.labels)==null?void 0:x[0]),L=(T==null?void 0:T.graphMax)??+((b=this.data.labels)==null?void 0:b[this.data.labels.length-1]);k=c.y1+C*(+e-R)/(L-R)}else k=c.y1+C*n/(d-1);h=[c.x2,k]}else{const C=c.x2-c.x1,S=(y=this.options.axesX)==null?void 0:y.some(T=>T.categoryMode),M=(w=this.options.axesX)==null?void 0:w.some(T=>T.type==="time");let k;if(S)k=c.x1+C*(n+.5)/d;else if(M){const T=(E=(I=this.axesSteps)==null?void 0:I.x)==null?void 0:E[0],R=(T==null?void 0:T.graphMin)??+((B=this.data.labels)==null?void 0:B[0]),L=(T==null?void 0:T.graphMax)??+((_=this.data.labels)==null?void 0:_[this.data.labels.length-1]);k=c.x1+C*(+e-R)/(L-R)}else k=c.x1+C*n/(d-1);h=[k,c.y2]}this.drawIndicator(h,this.options.indicator.color)},tooltipClear(){this.clearRectRatio=this.pixelRatio<1?this.pixelRatio:1,this.tooltipCtx.clearRect(0,0,this.tooltipCanvas.width/this.clearRectRatio,this.tooltipCanvas.height/this.clearRectRatio),this.tooltipDOM.style.display="none"},alignSeriesList(e){const t=this.data.groups,n=this.seriesList,o=[];return t.forEach(s=>{s.slice().reverse().forEach(l=>{const a=n[l];a&&a.showLegend&&e.includes(l)&&o.push(l)})}),Object.keys(n).forEach(s=>{const l=n[s];!l.isExistGrp&&l.showLegend&&e.includes(s)&&o.push(s)}),o},tooltipDestroy(){this.tooltipDOM&&(this.tooltipDOM.remove(),this.tooltipDOM=null),this.isInitTooltip=!1}},UC={pieDataSet:[],drawPie(e){var I;const t=this.bufferCtx,n=this.chartRect,o=this.pieDataSet,s=this.options,l=this.options.padding,a=!!s.doughnutHoleSize;let r,c,d,h=1.5*Math.PI,f,m,p;const g=n.width/2,u=n.height/2,x=g-(l.left+l.right),b=u-(l.bottom+l.top);if(typeof x=="number"&&x<0||typeof b=="number"&&b<0)return;const y=Math.min(x,b)*s.doughnutHoleSize,w=Math.min(x,b);for(let E=0;E<o.length;E++){const B=o[E];if(!B)return;let _=w-(w-y)/o.length*E;if((I=s==null?void 0:s.pieStroke)!=null&&I.use&&(_-=s.pieStroke.lineWidth),_<0)return;if(B.or=_,E<o.length-1?B.ir=w-(w-y)/o.length*(E+1):B.ir=1,B.total){for(let C=0;C<B.data.length;C++)if(r=B.data[C],c=r.value,p=c/B.total*100,d=2*Math.PI*(c/B.total),f=h+d,r.sa=h,r.ea=f,m=this.seriesList[r.id],c){const S={...s.pieStroke};B.data.length===1&&s.pieStroke.use&&(S.use=!1,t.lineWidth=s.pieStroke.lineWidth,t.strokeStyle=s.pieStroke.color,t.arc(g,u,_,0,2*Math.PI),t.stroke());const{selectInfo:M,legendHitInfo:k,unSelectedOpacity:T}=e;m.isSelect=(M==null?void 0:M.sId)===r.id,m.isDownplay=k&&k.sId!==r.id,m.type=a?"doughnut":"pie",m.centerX=g,m.centerY=u,m.radius=_,m.doughnutHoleSize=_*(s.doughnutHoleSize??0),m.startAngle=h,m.endAngle=f,m.data={o:c,percentage:p},m.draw(t,S,T),h+=d}}}},drawSunburst(e){var u;const t=this.bufferCtx,{width:n,height:o}=this.chartRect,s=this.pieDataSet,l=this.options,a=this.options.padding;this.calculateAngle();let r,c;const d=n/2,h=o/2,f=d-(a.left+a.right),m=h-(a.bottom+a.top);if(typeof f=="number"&&f<0||typeof m=="number"&&m<0)return;const p=Math.min(f,m)*l.doughnutHoleSize,g=Math.min(f,m);for(let x=0;x<s.length;x++){const b=s[x];if(!b)return;let y=g-(g-p)/s.length*x;if((u=l==null?void 0:l.pieStroke)!=null&&u.use&&(y-=l.pieStroke.lineWidth),y<0)return;b.or=y,x<s.length-1?b.ir=g-(g-p)/s.length*(x+1):b.ir=1;for(let w=0;w<b.data.length;w++)if(r=b.data[w],r.id==="dummy")t.save(),t.globalCompositeOperation="destination-out",t.beginPath(),t.fillStyle="#fff",t.lineWidth=2,t.strokeStyle="#fff",t.moveTo(d,h),t.arc(d,h,y,r.sa,r.ea),t.stroke(),t.fill(),t.closePath(),t.restore();else if(c=this.seriesList[r.id],r.value){const I={...l.pieStroke};b.data.length===1&&l.pieStroke.use&&(I.use=!1,t.lineWidth=l.pieStroke.lineWidth,t.strokeStyle=l.pieStroke.color,t.arc(d,h,y,0,2*Math.PI),t.stroke());const{selectInfo:E,legendHitInfo:B,unSelectedOpacity:_}=e;c.isSelect=(E==null?void 0:E.sId)===r.id,c.isDownplay=B&&B.sId!==r.id,c.type="sunburst",c.centerX=d,c.centerY=h,c.radius=y,c.doughnutHoleSize=y*(l.doughnutHoleSize??0),c.startAngle=r.sa,c.endAngle=r.ea,c.data={o:r.value},c.draw(t,I,_)}}},drawDoughnutHole(e=this.bufferCtx){var h;const t=this.options,{width:n,height:o}=this.chartRect,s=this.options.padding,l=n/2,a=o/2,r=l-(s.left+s.right),c=a-(s.bottom+s.top);if(typeof r=="number"&&r<0||typeof c=="number"&&c<0)return;const d=Math.min(r,c)*t.doughnutHoleSize;e.save(),e.globalCompositeOperation="destination-out",e.beginPath(),e.fillStyle="#fff",e.fillOpacity=0,e.arc(l,a,d,0,2*Math.PI),e.fill(),e.strokeStyle="#fff",e.stroke(),e.closePath(),e.restore(),(h=t==null?void 0:t.pieStroke)!=null&&h.use&&(e.beginPath(),e.strokeStyle=t.pieStroke.color,e.lineWidth=t.pieStroke.lineWidth,e.arc(l,a,d,0,Math.PI*2),e.stroke(),e.closePath()),this.pieDataSet[this.pieDataSet.length-1].ir=d}},YC={drawTips(e){var h,f,m,p,g,u;const t=this.options;let n=null;const o=!!t.horizontal,s=t.maxTip,l=t.selectItem,a=t.selectLabel;let r,c;typeof((h=t.tooltip)==null?void 0:h.formatter)=="function"?n=(f=t.tooltip)==null?void 0:f.formatter:typeof((p=(m=t.tooltip)==null?void 0:m.formatter)==null?void 0:p.value)=="function"&&(n=(u=(g=t.tooltip)==null?void 0:g.formatter)==null?void 0:u.value),a.use&&a.showTip&&(c=t.type==="heatMap"?this.drawLabelTipForHeatMap():this.drawTipForSelectedLabel());const d=x=>{e.forEach(b=>{if(b){const y=this.seriesList[b==null?void 0:b.sId];if(!(y!=null&&y.show))return;const w=this.calculateTipInfo(y,"sel",b);if(w){let I=!1;if(s.use&&(r==null?void 0:r.dp)===w.dp&&(I=!0),x.showTextTip||x.showTip){if(x.tipText==="label"){const E=o?t.axesY[0]:t.axesX[0],B=w.label;w.text=E.type==="time"?at(B).format(E.timeFormat):B}else w.text=Ht(w.value);this.drawTextTip({opt:x,tipType:"sel",seriesOpt:y,isSamePos:I,...w})}x.showIndicator&&this.drawFixedIndicator({opt:x,seriesOpt:y,...w})}b&&(b!=null&&b.label)&&(b==null?void 0:b.label)===0&&(this.lastHitInfo=b)}})};if(e&&!c&&(l.use?d(l):a.use&&t.type==="line"&&d(a)),s.use&&!c){const x=this.minMax[o?"x":"y"][0].maxSID,b=this.seriesList[x];r=this.calculateTipInfo(b,"max",null),s.use&&r&&(n?r.text=n({seriesId:b.sId,x:o?r.value:void 0,y:o?void 0:r.value}):r.text=Ht(r.value),this.drawTextTip({opt:s,tipType:"max",seriesOpt:b,...r}),s.showIndicator&&this.drawFixedIndicator({opt:s,seriesOpt:b,...r}))}},calculateTipInfo(e,t,n){if(!e)return!1;const o=!!this.options.horizontal,s=this.lastTip,l=this.chartRect,a=this.labelOffset,r={x1:l.x1+a.left,x2:l.x2-a.right,y1:l.y1+a.top,y2:l.y2-a.bottom},c=l.chartHeight-(a.top+a.bottom),d=l.chartWidth-(a.left+a.right),h=this.axesSteps.x[e.xAxisIndex],f=this.axesSteps.y[e.yAxisIndex],m=r.x1,p=r.x2,g=r.y2,{type:u,size:x}=e,{maxDomain:b,maxDomainIndex:y}=e.minMax;if(b===null||y<0)return!1;let w=u==="bar"?y:b;t==="sel"&&(n&&n.label!==null?(s.pos=u==="bar"?n.maxIndex:n.label,w=s.pos):s.pos!==null&&(w=s.pos));let I=o?e.minMax.maxX:e.minMax.maxY,E;if(t==="sel"){if(n&&n.value!==null)I=n.useStack?n.acc:n.value,E=n.label,s.value=I,s.label=E;else if(s.value!==null)I=s.value,E=s.label;else if(s.pos!==null){const k=u==="bar"?this.getItemByLabelIndex(s.pos):this.getItemByLabel(s.pos);I=k.useStack?k.acc:k.value,E=k.label,s.value=I,s.label=E}}let B,_,C;if(u==="bar"){const k=o?this.scrollbar.y:this.scrollbar.x;if(k!=null&&k.use){const[T,R]=(k==null?void 0:k.range)??[];if(w>=T&&w<=R)w-=T??0;else return!1}o?(_=Math.round(x.h/2),B=g-x.cat*w-x.cPad,C=B-(x.bar*x.ix-(x.h+x.bPad))-_):(_=Math.round(x.w/2),B=m+x.cat*w+x.cPad,C=B+(x.bar*x.ix-(x.w+x.bPad))+_)}else u==="line"?C=ie.calculateX(w,h.graphMin,h.graphMax,d-x.comboOffset,m+x.comboOffset/2):u==="scatter"&&(C=ie.calculateX(w,h.graphMin,h.graphMax,d,m));return{...{xArea:d,yArea:c,graphX:h,graphY:f,xsp:m,xep:p,ysp:g},...{dp:C,value:I,label:E,type:u}}},drawFixedIndicator(e){const t=!!this.options.horizontal,n=this.bufferCtx,{graphX:o,graphY:s,xArea:l,yArea:a,xsp:r,ysp:c,dp:d,type:h,value:f,opt:m,seriesOpt:p}=e;let g=0;h==="line"?g+=3:h==="scatter"&&(g+=(p==null?void 0:p.pointSize)??0);let u;m.fixedPosTop?t?u=ie.calculateX(o.graphMax,o.graphMin,o.graphMax,l,r):(u=ie.calculateY(s.graphMax,s.graphMin,s.graphMax,a,c),u-=g):t?u=ie.calculateX(f,o.graphMin,o.graphMax,l,r):(u=ie.calculateY(f,s.graphMin,s.graphMax,a,c),u-=g),d!==null&&(n.beginPath(),n.save(),n.strokeStyle=m.indicatorColor,n.lineWidth=2,t?(n.moveTo(r,d),n.lineTo(u,d)):(n.moveTo(d,c),n.lineTo(d,u)),n.stroke(),n.restore(),n.closePath())},drawTipForSelectedLabel(){var r,c;const e=this.options,t=!!e.horizontal,n=e.selectLabel,{dataIndex:o,data:s,label:l}=this.defaultSelectInfo;let a=!1;if(o.length){a=!0;const d=this.chartRect,h=this.labelOffset,f={x1:d.x1+h.left,x2:d.x2-h.right,y1:d.y1+h.top,y2:d.y2-h.bottom},m=t?this.axesY[0]:this.axesX[0],p=t?this.axesX[0]:this.axesY[0],g=t?this.axesSteps.x[0]:this.axesSteps.y[0],u=t?ie.calculateX:ie.calculateY,x=t?ie.calculateY:ie.calculateX,b=t?this.scrollbar.y:this.scrollbar.x,y=d.chartWidth-(h.left+h.right),w=d.chartHeight-(h.top+h.bottom),I=t?y:w,E=f[p.units.rectStart];let B=this.options.type==="bar"?4:6;B*=t?1:-1;const _=Object.keys(this.seriesList??{}),C=_.filter(F=>this.seriesList[F].show),S=_.some(F=>this.seriesList[F].isExistGrp&&!this.seriesList[F].isOverlapping),M=((r=this.data.groups)==null?void 0:r[0])??[];let k,T,R,L,N,v,O,D,V,P=0,A=(c=m.labels)==null?void 0:c.length;if(m.labels){let F=m.labels.length;if(b!=null&&b.use){const{range:X,interval:U,type:H}=b,[$,j]=X;ve($)&&ve(j)&&(F=Math.floor((+j-+$)/U)+1,P=H==="step"?$:m.labels.findIndex(K=>K===+$),A=H==="step"?j:m.labels.findIndex(K=>K===+j))}L=f[m.units.rectStart],N=f[m.units.rectEnd],v=(N-L)/F}else O=this.axesSteps.x[0],D=_.find(F=>{var X;return((X=this.seriesList[F])==null?void 0:X.type)==="line"}),V=this.seriesList[D].size;s.forEach((F,X)=>{var U;if(R=g.graphMax,!n.fixedPosTop){if(S){const H=C==null?void 0:C.reduce((K,q)=>{var Q,J;return M.includes(q)&&(((Q=F[q])==null?void 0:Q.value)??F[q])>0?K+(((J=F[q])==null?void 0:J.value)??F[q]):K},0),$=((U=C==null?void 0:C.filter(K=>!M.includes(K)))==null?void 0:U.map(K=>{var q;return((q=F[K])==null?void 0:q.value)??F[K]}))??[],j=($==null?void 0:$.length)>0?$.reduce((K,q)=>Math.max(K,q??-1/0),-1/0):-1/0;R=H>0?Math.max(j,H):Math.max(j,0)}else if(C.length){const H=C.map(j=>{var K;return((K=F[j])==null?void 0:K.value)??F[j]}),$=H.length>0?H.reduce((j,K)=>Math.max(j,K??-1/0),-1/0):-1/0;R=$>0||this.options.type!=="bar"?$:0}}if(m.labels){if(o[X]<P||o[X]>A)return;const H=o[X]-P;k=Math.round(L+v*H)+v/2}else k=x(l[X],O.graphMin,O.graphMax,y-V.comboOffset,f.x1+V.comboOffset/2);T=u(R,g.graphMin,g.graphMax,I,E)+B,this.showTip({context:this.bufferCtx,x:t?T:k,y:t?k:T,opt:n,isSamePos:!1})})}return a},drawLabelTipForHeatMap(){const e=this.options,t=!!e.horizontal,n=e.selectLabel,{dataIndex:o}=this.defaultSelectInfo;let s=!1;if(o){s=!0;const l=this.chartRect,a=this.labelOffset,r={x1:l.x1+a.left,x2:l.x2-a.right,y1:l.y1+a.top,y2:l.y2-a.bottom},c=t?this.axesY[0]:this.axesX[0],d=r[c.units.rectStart],f=(r[c.units.rectEnd]-d)/c.labels.length,m=t?this.axesX[0]:this.axesY[0],p=6*(t?1:-1),g=r[m.units.rectEnd]+p;o==null||o.forEach(u=>{const b=Math.round(d+f*u)+f/2;this.showTip({context:this.bufferCtx,x:t?g:b,y:t?b:g,opt:n,isSamePos:!1})})}return s},drawTextTip(e){const t=!!this.options.horizontal,n=this.bufferCtx,{graphX:o,graphY:s,xArea:l,yArea:a,xsp:r,xep:c,ysp:d}=e,{dp:h,value:f,text:m,opt:p,type:g,tipType:u,isSamePos:x,seriesOpt:b}=e,y=4,w=4,{fontSize:I,fontFamily:E,fontWeight:B,height:_}=p.tipStyle,C=`normal normal ${B} ${I}px ${E}`;let S=1;g==="line"?S+=6:g==="scatter"?S+=b==null?void 0:b.pointSize:g==="bar"&&(S+=4);let M,k=h;if(p.fixedPosTop)t?(M=ie.calculateX(o.graphMax,o.graphMin,o.graphMax,l,r),M+=S):(M=ie.calculateY(s.graphMax,s.graphMin,s.graphMax,a,d),M-=S);else if(t)M=ie.calculateX(f,o.graphMin,o.graphMax,l,r),M=f<0?M-S:M+S;else{const L=g==="bar"&&f<0?0:f;M=ie.calculateY(L,s.graphMin,s.graphMax,a,d),M=L<0?M+S:M-S}let T="center";n.save(),n.font=C;const R=Math.round(Math.max(n.measureText(m).width+12,40));t||(h+R/2>c-10?(T="right",k-=R/2-y*2):h-R/2<r+10&&(T="left",k+=R/2-y*2)),n.restore(),(p.showTextTip||u==="max")&&this.showTextTip({context:n,type:T,width:R,height:_,x:t?M+R/2:k,y:t?k+_/2:M,opt:p,arrowSize:y,borderRadius:w,text:m,textStyle:C,isNegative:f<0}),p.showTip&&u==="sel"&&this.showTip({context:n,x:t?M:h,y:t?h:M,opt:p,isSamePos:x})},showTextTip(e){const t=!!this.options.horizontal,{type:n,width:o,height:s,x:l,y:a,arrowSize:r,borderRadius:c,text:d,opt:h,textStyle:f,isNegative:m}=e,p=e.context;let g=l-o/2,u=l+o/2;const x=a-s,b=a;m&&t&&(g=l-o/2-o,u=l-o/2),p.save(),p.font=f,p.fillStyle=h.tipBackground??h.tipStyle.background,p.shadowBlur=0,p.beginPath(),p.moveTo(g+c,x),p.quadraticCurveTo(g,x,g,x+c),p.lineTo(g,b-c),p.quadraticCurveTo(g,b,g+c,b),p.lineTo(u-c,b),p.quadraticCurveTo(u,b,u,b-c),p.lineTo(u,x+c),p.quadraticCurveTo(u,x,u-c,x),p.lineTo(g+c,x),p.closePath(),p.fill(),p.beginPath(),t?(m?(p.moveTo(u,b),p.lineTo(u,x+c+r/2),p.lineTo(u+r,b-s/2),p.lineTo(u,b-c-r/2)):(p.moveTo(g,x),p.lineTo(g,x+c+r/2),p.lineTo(g-r,b-s/2),p.lineTo(g,b-c-r/2)),p.closePath(),p.fill()):(m?n==="left"?(p.lineTo(g+c+r,b+r),p.lineTo(g+c+r*2,b)):n==="right"?(p.lineTo(u-r*2-c,b),p.lineTo(u-r-c,b+r)):(p.lineTo(l-r,b),p.lineTo(l,b+r),p.lineTo(l+r,b)):m||(n==="left"?(p.moveTo(g,x),p.lineTo(g+c+r,b+r),p.lineTo(g+c+r*2,b)):n==="right"?(p.moveTo(u,x),p.lineTo(u-r*2-c,b),p.lineTo(u-r-c,b+r)):(p.lineTo(l-r,b),p.lineTo(l,b+r),p.lineTo(l+r,b))),p.closePath(),p.fill()),p.restore(),p.save(),p.font=f,p.fillStyle=h.tipTextColor??h.tipStyle.textColor,p.textBaseline="middle",p.textAlign="center",p.fillText(`${d}`,g+o/2,x+s/2),p.restore()},showTip(e){const t=!!this.options.horizontal,{x:n,y:o,opt:s,isSamePos:l}=e,a=e.context,c=o-(l?24:0);a.save(),a.fillStyle=s.tipBackground??s.tipStyle.background,a.beginPath(),a.moveTo(n,c),t?(a.lineTo(n+6,c-6),a.lineTo(n+6,c+6)):(a.lineTo(n+6,c-6),a.lineTo(n-6,c-6)),a.lineTo(n,c),a.closePath(),a.fill(),a.restore()}};let Pr=class{constructor(t,n,o,s,l,a,r){Object.keys(Lr).forEach(c=>Object.assign(this,Lr[c])),o.brush||(Object.assign(this,XC),Object.assign(this,WC),Object.assign(this,YC),Object.assign(this,_C),Object.assign(this,UC),Object.assign(this,LC),Object.assign(this,AC)),o.type==="heatMap"&&o.legend.type==="gradient"&&Object.assign(this,PC),this.isMobile=Sh(),this.brushSeries=r,this.target=t,this.data=n,this.options=o,this.listeners=s,this.wrapperDOM=document.createElement("div"),this.wrapperDOM.className=o.brush?"ev-chart-brush-wrapper":"ev-chart-wrapper",this.chartDOM=document.createElement("div"),this.chartDOM.className=o.brush?"ev-chart-brush-container":"ev-chart-container",this.wrapperDOM.appendChild(this.chartDOM),this.target.appendChild(this.wrapperDOM),this.displayCanvas=document.createElement("canvas"),this.displayCanvas.setAttribute("style","display: block;"),this.displayCtx=this.displayCanvas.getContext("2d"),this.bufferCanvas=document.createElement("canvas"),this.bufferCanvas.setAttribute("style","display: block;"),this.bufferCtx=this.bufferCanvas.getContext("2d"),this.pixelRatio=window.devicePixelRatio||1,this.oldPixelRatio=this.pixelRatio,this.chartDOM.appendChild(this.displayCanvas),o.brush||(this.overlayCanvas=document.createElement("canvas"),this.overlayCanvas.setAttribute("style","display: block; z-index: 2;"),this.overlayCanvas.setAttribute("class","overlay-canvas"),this.overlayCtx=this.overlayCanvas.getContext("2d"),this.chartDOM.appendChild(this.overlayCanvas),this.overlayCanvas.style.position="absolute",this.overlayCanvas.style.top="0px",this.overlayCanvas.style.left="0px"),this.isInitLegend=!1,this.isInitTitle=!1,this.isInit=!1,this.scrollbar={x:{isInit:!1},y:{isInit:!1}},this.seriesList={},this.lastTip={pos:null,value:null},this.seriesInfo={charts:{pie:[],bar:[],line:[],scatter:[],heatMap:[]},count:0},this.defaultSelectItemInfo=l,this.defaultSelectInfo=a,this.legendHover=null}init(){var f;const{series:t,data:n,labels:o,groups:s}=this.data,{type:l,axesX:a,axesY:r,tooltip:c,horizontal:d,realTimeScatter:h}=this.options;this.createSeriesSet(t,l,d,s),s.length&&this.addGroupInfo(s),h!=null&&h.use?(this.dataSet={},this.createRealTimeScatterDataSet(n)):this.createDataSet(n,o),this.minMax=this.getStoreMinMax(),this.initRect(),this.axesX=this.createAxes("x",a),this.axesY=this.createAxes("y",r),this.initDefaultSelectInfo(),this.drawChart(),c.use&&!this.isInitTooltip&&this.createTooltipDOM(),(f=this.createEventFunctions)==null||f.call(this),this.isInit=!0}initRect(){var n,o,s,l,a,r;const t=this.options;t.title.show&&(this.isInitTitle||this.initTitle(),this.showTitle()),t.legend.show&&(this.isInitLegend||this.initLegend(),this.setLegendPosition()),((s=(o=(n=t.axesX)==null?void 0:n[0])==null?void 0:o.scrollbar)!=null&&s.use||(r=(a=(l=t.axesY)==null?void 0:l[0])==null?void 0:a.scrollbar)!=null&&r.use)&&this.initScrollbar(),this.chartRect=this.getChartRect()}drawSyncedIndicator({horizontal:t,label:n,mousePosition:o}){this.drawSyncedIndicator({horizontal:t,label:n,mousePosition:o})}adjustXAndYAxisWidth(){var o,s,l,a;const t=(r,c,d)=>{const{interval:h,graphMin:f,graphMax:m,steps:p=0,minIndex:g,maxIndex:u,indexInterval:x}=r??{};let b=[];if((d==null?void 0:d.type)==="step"&&g!==void 0&&u!==void 0&&x!==void 0){const{labels:y}=this.data,w=c==="x"?(y==null?void 0:y.x)??y??[]:(y==null?void 0:y.y)??y??[];b=[];for(let I=g;I<=u;I+=x)w[I]!==void 0&&b.push(w[I])}else if(h)b=Array.from({length:p},(y,w)=>f+w*h),b.push(m);else{const{labels:y}=this.data;b=c==="x"?(y==null?void 0:y.x)??y??[]:(y==null?void 0:y.y)??y??[]}return b},n={x:(s=(o=this.axesRange)==null?void 0:o.x)==null?void 0:s.map((r,c)=>{var g,u,x;const d=this.axesX[c],h=(g=this.axesSteps)==null?void 0:g.x[c],f=t(h,"x",d),m=ve((u=d==null?void 0:d.labelStyle)==null?void 0:u.fixWidth)?d.labelStyle.fixWidth:0,p=((x=d==null?void 0:d.getLabelWidthHasMaxLength)==null?void 0:x.call(d,f,this.chartRect))??0;return{...r,size:{width:m||Math.max(p,r.size.width),height:r.size.height}}}),y:(a=(l=this.axesRange)==null?void 0:l.y)==null?void 0:a.map((r,c)=>{var g,u,x;const d=this.axesY[c],h=(g=this.axesSteps)==null?void 0:g.y[c],f=t(h,"y",d),m=ve((u=d==null?void 0:d.labelStyle)==null?void 0:u.fixWidth)?d.labelStyle.fixWidth:0,p=((x=d==null?void 0:d.getLabelWidthHasMaxLength)==null?void 0:x.call(d,f,this.chartRect))??0;return{...r,size:{width:m||Math.max(p,r.size.width),height:r.size.height}}})};this.axesRange=n,this.labelOffset=this.getLabelOffset(n),this.labelRange=this.getAxesLabelRange(),this.axesSteps=this.calculateSteps()}drawChart(t){var n,o,s,l,a,r;this.initScale(),this.axesRange=this.getAxesRange(),this.labelOffset=this.getLabelOffset(),this.labelRange=this.getAxesLabelRange(),this.axesSteps=this.calculateSteps(),this.adjustXAndYAxisWidth(),this.drawAxis(t),this.drawSeries(t),((o=(n=this.scrollbar)==null?void 0:n.x)!=null&&o.use||(l=(s=this.scrollbar)==null?void 0:s.y)!=null&&l.use)&&(this.initScrollbar(),this.updateScrollbarPosition()),this.drawTip(),this.bufferCanvas&&((a=this.bufferCanvas)==null?void 0:a.width)>1&&((r=this.bufferCanvas)==null?void 0:r.height)>1&&this.displayCtx.drawImage(this.bufferCanvas,0,0)}collectDuplicatePoints(t,n){var s,l,a;const o=!!this.options.seriesReverse;for(let r=o?n.length-1:0;o?r>=0:r<n.length;o?r--:r++){const c=this.seriesList[n[r]];if(!!(c!=null&&c.show))if((s=this.options.realTimeScatter)!=null&&s.use){const h=(l=c.data[c.sId])==null?void 0:l.dataGroup;for(let f=0;f<h.length;f++){const m=((a=h[f])==null?void 0:a.data)||[];for(let p=0;p<m.length;p++){const g=m[p];t.set(`${g.x}${g.y}`,c.sId)}}}else{const h=this.data.data[n[r]]??[];for(let f=0;f<h.length;f++){const m=h[f];t.set(`${m.x}${m.y}`,c.sId)}}}}drawSeries(t){var g;const{maxTip:n,selectLabel:o,selectItem:s,selectSeries:l,brush:a,displayOverflow:r,unSelectedOpacity:c}=this.options,d={ctx:this.bufferCtx,chartRect:this.chartRect,labelOffset:this.labelOffset,axesSteps:this.axesSteps,maxTipOpt:{background:n.background,color:n.color},selectLabel:{option:o,selected:this.defaultSelectInfo},selectSeries:{option:l,selected:this.defaultSelectInfo},selectItem:{option:s,selected:this.defaultSelectItemInfo},overlayCtx:this.overlayCtx,isBrush:!!a,displayOverflow:r,unSelectedOpacity:c};let h=0,f=0;this.seriesInfo.charts.bar.forEach(u=>{this.seriesList[u].show&&f++});const m=new Map,p=Object.keys(this.seriesInfo.charts);for(let u=0;u<p.length;u++){const x=p[u],b=this.seriesInfo.charts[x];x==="scatter"&&this.options.coordinateDedupe&&this.collectDuplicatePoints(m,b);for(let y=0;y<b.length;y++){let w=this.seriesList[b[y]];switch(x){case"line":{const I=t==null?void 0:t.legend;w.draw({legendHitInfo:I,...d});break}case"heatMap":{const I=t==null?void 0:t.legend;w.draw({legendHitInfo:I,...d});break}case"bar":{const I=t==null?void 0:t.legend,{thickness:E,cPadRatio:B,borderRadius:_}=this.options;w.draw({thickness:E,cPadRatio:B,borderRadius:_,showSeriesCount:f,showIndex:h,legendHitInfo:I,...d}),w.show&&h++;break}case"pie":{const I=this.lastHitInfo??{sId:(g=this.defaultSelectItemInfo)==null?void 0:g.seriesID},E=t==null?void 0:t.legend;this.options.sunburst?this.drawSunburst({selectInfo:I,legendHitInfo:E,unSelectedOpacity:d.unSelectedOpacity}):this.drawPie({selectInfo:I,legendHitInfo:E,unSelectedOpacity:d.unSelectedOpacity}),this.options.doughnutHoleSize>0&&this.drawDoughnutHole();break}case"scatter":{const I=t==null?void 0:t.legend;let E;if(s.use&&s.useSeriesOpacity){const B=this.lastHitInfo,_=this.defaultSelectItemInfo;B!=null&&B.maxIndex||(B==null?void 0:B.maxIndex)===0?E={seriesID:B.sId,dataIndex:B.maxIndex}:_!=null&&_.dataIndex||(_==null?void 0:_.dataIndex)===0?E={..._}:E=null}this.options.seriesReverse&&(w=this.seriesList[b.at(-1-y)]),w.draw({legendHitInfo:I,selectInfo:E,duple:m,coordinateDedupe:this.options.coordinateDedupe,...d});break}}}}}drawTip(){var n;let t;this.lastHitInfo?t=this.lastHitInfo:this.defaultSelectItemInfo?t=this.getItem(this.defaultSelectItemInfo,!1):this.defaultSelectInfo&&this.options.selectLabel.use?t=this.getItem(this.defaultSelectInfo,!1):t=null,(n=this.drawTips)==null||n.call(this,t)}createAxes(t,n=[]){const o=this.bufferCtx,l=this.options.type==="heatMap"?this.data.labels[t]:this.data.labels,a=this.options;return n.map(r=>{switch(r.type){case"linear":return new DC(t,r,o,a);case"time":return r.categoryMode?new NC(t,r,o,l,a):new BC(t,r,o,a);case"log":return new OC(t,r,o);case"step":return new RC(t,r,o,l,a);default:return!1}})}getAxesRange(){const t=this.axesX.map((o,s)=>o.calculateScaleRange(this.minMax.x[s],this.scrollbar.x,this.chartRect)),n=this.axesY.map((o,s)=>o.calculateScaleRange(this.minMax.y[s],this.scrollbar.y,this.chartRect));return{x:t,y:n}}drawAxis(t){this.axesX.forEach((n,o)=>{n.draw(this.chartRect,this.labelOffset,this.axesSteps.x[o],t,this.defaultSelectInfo,this.data.labels)}),this.axesY.forEach((n,o)=>{n.draw(this.chartRect,this.labelOffset,this.axesSteps.y[o],t,this.defaultSelectInfo)})}calculateSteps(){const t=this.axesX.map((o,s)=>{const l={minValue:this.axesRange.x[s].min,maxValue:this.axesRange.x[s].max,minIndex:this.axesRange.x[s].minIndex,maxIndex:this.axesRange.x[s].maxIndex,minSteps:this.labelRange.x[s].min,maxSteps:this.labelRange.x[s].max};return o.calculateSteps(l)}),n=this.axesY.map((o,s)=>{const l={minValue:this.axesRange.y[s].min,maxValue:this.axesRange.y[s].max,minIndex:this.axesRange.y[s].minIndex,maxIndex:this.axesRange.y[s].maxIndex,minSteps:this.labelRange.y[s].min,maxSteps:this.labelRange.y[s].max};return o.calculateSteps(l)});return{x:t,y:n}}getAxesLabelRange(){const t=this.axesX.map((o,s)=>{const l=this.axesRange.x[s].size;return o.calculateLabelRange("x",this.chartRect,this.labelOffset,l.width)}),n=this.axesY.map((o,s)=>{const l=this.axesRange.y[s].size;return o.calculateLabelRange("y",this.chartRect,this.labelOffset,l.height)});return{x:t,y:n}}initScale(){const t=window.devicePixelRatio||1,n=this.displayCtx.webkitBackingStorePixelRatio||this.displayCtx.mozBackingStorePixelRatio||this.displayCtx.msBackingStorePixelRatio||this.displayCtx.oBackingStorePixelRatio||this.displayCtx.backingStorePixelRatio||1;this.pixelRatio=t/n,this.oldPixelRatio!==this.pixelRatio&&(this.oldPixelRatio=this.pixelRatio),this.bufferCtx.scale(this.pixelRatio,this.pixelRatio),this.overlayCtx&&this.overlayCtx.scale(this.pixelRatio,this.pixelRatio)}getChartDOMRect(){var s;const t=(s=this.chartDOM)==null?void 0:s.getBoundingClientRect(),n=(t==null?void 0:t.width)||10,o=(t==null?void 0:t.height)||10;return this.setWidth(n),this.setHeight(o),{width:n,height:o}}getChartRect(){var E,B,_,C;const{width:t,height:n}=this.getChartDOMRect(),o=this.options.padding,s=(B=(E=this.options.axesX)==null?void 0:E[0])==null?void 0:B.title,l=(C=(_=this.options.axesY)==null?void 0:_[0])==null?void 0:C.title,a=10;let r=0;s!=null&&s.use&&(s!=null&&s.text)&&(r=(isNaN(s==null?void 0:s.fontSize)?12:s==null?void 0:s.fontSize)+a);let c=0;l!=null&&l.use&&(l!=null&&l.text)&&(c=(isNaN(l==null?void 0:l.fontSize)?12:l==null?void 0:l.fontSize)+a);const d=this.scrollbar.x,h=this.scrollbar.y;let f=0;d!=null&&d.use&&(f=d==null?void 0:d.height);let m=0;h!=null&&h.use&&(m=h==null?void 0:h.width);const p=o.left+o.right+m,g=o.top+o.bottom+r+c+f,u=t>p?t-p:t,x=n>g?n-g:n,b=o.left,y=Math.max(t-o.right-m,b+2),w=o.top+c,I=Math.max(n-o.bottom-r-f,w+2);return{x1:b,x2:y,y1:w,y2:I,chartWidth:u,chartHeight:x,width:t,height:n}}setWidth(t){this.displayCanvas&&(this.displayCanvas.width=t*this.pixelRatio,this.displayCanvas.style.width=`${t}px`,this.bufferCanvas.width=t*this.pixelRatio,this.bufferCanvas.style.width=`${t}px`,this.overlayCanvas&&(this.overlayCanvas.width=t*this.pixelRatio,this.overlayCanvas.style.width=`${t}px`))}setHeight(t){this.displayCanvas&&(this.displayCanvas.height=t*this.pixelRatio,this.displayCanvas.style.height=`${t}px`,this.bufferCanvas.height=t*this.pixelRatio,this.bufferCanvas.style.height=`${t}px`,this.overlayCanvas&&(this.overlayCanvas.height=t*this.pixelRatio,this.overlayCanvas.style.height=`${t}px`))}getLabelOffset(t=null){const n=this.axesX,o=this.axesY,s=t??this.axesRange,l={top:2,left:2,right:2,bottom:2},a={width:14,height:4};let r=0,c=0;return n.forEach((d,h)=>{var f;(f=d.labelStyle)!=null&&f.show&&(r=s.x[h].size.width+a.width,c=s.x[h].size.height+a.height,d.position==="bottom"?c>l.bottom&&(l.bottom=c):d.position==="top"&&c>l.top&&(l.top=c),l.left=r/2>l.left?r/2:l.left,l.right=r/2>l.right?r/2:l.right)}),o.forEach((d,h)=>{var f;(f=d.labelStyle)!=null&&f.show&&(r=s.y[h].size.width+a.width,d.position==="left"?r>l.left&&(l.left=r):d.position==="right"&&r>l.right&&(l.right=r),l.top=c/2>l.top?c/2:l.top,l.bottom=c/2>l.bottom?c/2:l.bottom)}),l}update(t){var x,b,y,w,I,E,B;const n=this.options,o=this.data.data,s=this.data.labels,l=this.data.groups,a=this.data.series,{updateSeries:r,updateSelTip:c,updateLegend:d,updateData:h,updateTooltip:f,updateByScrollbar:m,lightUpdate:p}=t;if(!this.isInit)return;if(m&&((x=this.updateScrollbar)==null||x.call(this,h)),this.resetProps(),this.updateSeries=r,r&&(this.seriesInfo=null,this.seriesList=null,this.lastTip=null,this.seriesInfo={charts:{pie:[],bar:[],line:[],scatter:[],heatMap:[]},count:0},this.seriesList={},this.lastTip={pos:null,value:null},this.createSeriesSet(a,n.type,n.horizontal,l),this.legendDOM&&this.updateLegend()),c.update&&(this.lastTip.value=null,c.keepDomain||(this.lastTip.pos=null,this.lastHitInfo=null)),!p)if(l.length&&this.addGroupInfo(l),(b=this.options.realTimeScatter)!=null&&b.use?(this.dataSet||(this.dataSet={}),this.createRealTimeScatterDataSet(o)):this.createDataSet(o,s),n.title.show?(this.isInitTitle?this.updateTitle():this.initTitle(),this.showTitle()):this.isInitTitle&&this.hideTitle(),n.legend.show){const _=!!((w=(y=n.legend)==null?void 0:y.table)!=null&&w.use)&&n.type!=="heatMap"&&n.type!=="scatter";this.isInitLegend?r?this.updateLegend():d?this.forceUpdateLegend():_&&h&&this.updateLegendTableValues():this.initLegend(),this.setLegendPosition(),this.updateLegendContainerSize(),this.showLegend()}else this.isInitLegend&&this.hideLegend();f&&(this.isInitTooltip||this.createTooltipDOM(),this.tooltipDOM.innerHTML="",(E=(I=n.tooltip)==null?void 0:I.formatter)!=null&&E.html||this.setDefaultTooltipLayout()),this.minMax=this.getStoreMinMax(),this.axesX=this.createAxes("x",n.axesX),this.axesY=this.createAxes("y",n.axesY),this.initDefaultSelectInfo();let g=t==null?void 0:t.hitInfo;!(g!=null&&g.legend)&&((B=this.legendHover)!=null&&B.sId)&&(g={...g||{},legend:this.legendHover}),this.render(g),this.dragInfo&&this.drawSelectionArea?this.drawSelectionArea(this.dragInfo):this.dragInfoBackup&&(this.dragInfoBackup=null)}resetProps(){this.axesX[0]=null,this.axesY[0]=null,this.axesX=null,this.axesY=null,this.minMax=null,this.axesRange=null,this.labelOffset=null,this.chartRect=null}overlayClear(){this.clearRectRatio=this.pixelRatio<1?this.pixelRatio:1,this.overlayCtx.clearRect(0,0,this.overlayCanvas.width/this.clearRectRatio,this.overlayCanvas.height/this.clearRectRatio)}clear(){this.clearRectRatio=this.pixelRatio<1?this.pixelRatio:1,this.displayCanvas&&this.displayCtx.clearRect(0,0,this.displayCanvas.width/this.clearRectRatio,this.displayCanvas.height/this.clearRectRatio),this.bufferCanvas&&this.bufferCtx.clearRect(0,0,this.bufferCanvas.width/this.clearRectRatio,this.bufferCanvas.height/this.clearRectRatio),this.overlayCanvas&&this.overlayCtx.clearRect(0,0,this.overlayCanvas.width/this.clearRectRatio,this.overlayCanvas.height/this.clearRectRatio)}resize(t){var n,o,s;(n=this.scrollbar)!=null&&n.x&&delete this.scrollbar.x.savedPosition,(o=this.scrollbar)!=null&&o.y&&delete this.scrollbar.y.savedPosition,this.clear(),this.bufferCtx.restore(),this.bufferCtx.save(),this.initRect(),this.initScale(),this.chartRect=this.getChartRect(),this.drawChart(),this.dragInfoBackup&&((s=this.drawSelectionArea)==null||s.call(this,this.dragInfoBackup)),t&&t(!0)}render(t){this.isInit&&(this.clear(),this.chartRect=this.getChartRect(),this.drawChart(t))}destroy(){if(!this.isInit)return;const t=this.target;for(this.options.legend.show&&(this.legendBoxDOM&&(this.legendBoxDOM.removeEventListener("click",this.onLegendBoxClick),this.legendBoxDOM.removeEventListener("mouseover",this.onLegendBoxOver),this.legendBoxDOM.removeEventListener("mouseleave",this.onLegendBoxLeave),this.options.legend.type==="gradient"&&this.legendBoxDOM.removeEventListener("mousedown",this.onLegendMouseDown),this.options.legend.virtualScroll&&!this.useTable&&(this.legendBoxDOM.removeEventListener("resize",this.updateVisibleRowCount),this.legendBoxDOM.removeEventListener("scroll",this.renderVisibleLegends))),this.resizeDOM&&this.resizeDOM.removeEventListener("mousedown",this.onResizeMouseDown)),this.overlayCanvas&&(this.overlayCanvas.removeEventListener("mousemove",this.onMouseMove),this.overlayCanvas.removeEventListener("mouseleave",this.onMouseLeave),this.overlayCanvas.removeEventListener("dblclick",this.onDblClick),this.overlayCanvas.removeEventListener("click",this.onClick),this.overlayCanvas.removeEventListener("mousedown",this.onMouseDown),this.overlayCanvas.removeEventListener("wheel",this.onWheel),window.removeEventListener("click",this.dragTouchSelectionEvent)),this.isInitTooltip&&this.tooltipDestroy(),this.renderVisibleLegendsFrameId!=null&&(cancelAnimationFrame(this.renderVisibleLegendsFrameId),this.renderVisibleLegendsFrameId=null),this.updateVisibleRowCountFrameId!=null&&(cancelAnimationFrame(this.updateVisibleRowCountFrameId),this.updateVisibleRowCountFrameId=null),this.wrapperDOM=null,this.chartDOM=null,this.legendDOM=null,this.legendBoxDOM=null,this.resizeDOM=null,this.ghostDOM=null,this.titleDOM=null,this.displayCanvas=null,this.bufferCanvas=null,this.overlayCanvas=null;t.hasChildNodes();)t.removeChild(t.firstChild)}hideTooltip(){var t;this.options.tooltip.use&&((t=this.tooltipDOM)!=null&&t.style)&&(this.tooltipDOM.style.display="none")}initDefaultSelectInfo(){var s,l;const{type:t,selectLabel:n,selectSeries:o}=this.options;if(n.use){let a=null;t==="heatMap"&&(n!=null&&n.useBothAxis)&&(a=(s=this.defaultSelectInfo)==null?void 0:s.targetAxis),this.defaultSelectInfo=(l=this.defaultSelectInfo)!=null&&l.dataIndex?this.getSelectedLabelInfoWithLabelData(this.defaultSelectInfo.dataIndex,a):{dataIndex:[],label:[],data:[]}}o.use&&!this.defaultSelectInfo&&(this.defaultSelectInfo={seriesId:[]})}};const jC={name:"EvChartToolbar",props:{toolbar:{type:Object,default:()=>({})}},emits:["onClickToolbar"]},GC={class:"ev-chart-toolbar"},ZC={class:"ev-chart-toolbar__icon"};function qC(e,t,n,o,s,l){const a=i.resolveComponent("ev-icon");return i.openBlock(),i.createElementBlock("div",GC,[i.createElementVNode("div",ZC,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.$props.toolbar.items,(r,c)=>(i.openBlock(),i.createBlock(a,{key:`${c}-${r.icon}`,class:i.normalizeClass(c),icon:r.icon,size:r.size,title:r.title,onClick:d=>e.$emit("onClickToolbar",d,c)},null,8,["class","icon","size","title","onClick"]))),128))])])}const Ar=le(jC,[["render",qC],["__scopeId","data-v-dfbffbab"]]);class KC{constructor(t,n,o,s,l,a,r){this.isExecuteZoom=l,this.evChartProps=t.props,this.evChartCloneData=n.data,this.brushIdx=a;const c=o.zoom;this.setEvChartZoomOptions(c),this.setIcon(s);const d=n.data[0].labels.length-1;this.cloneLabelsLastIdx=d,this.isAnimationFinish=!0,this.zoomAreaMemory={previous:[],current:[[0,d]],latest:[]},r&&(this.emitFunc=r,r.updateZoomStartIdx(0),r.updateZoomEndIdx(d)),c.useWheelMove&&(this.wrapWheelMoveZoomArea=this.wheelMoveZoomArea.bind(this)),this.evChartDomContainers=c.useAnimation?this.drawAnimationCanvas(t.dom):t.dom}setEvChartZoomOptions(t){this.evChartZoomOptions=t}setIcon(t){if(!t)return;const n=t.querySelector(".dragZoom");this.resetIcon=t.querySelector(".reset"),this.previousIcon=t.querySelector(".previous"),this.latestIcon=t.querySelector(".latest"),this.dragZoomIcon=n,this.iconStyle(n,"enable")}drawAnimationCanvas(t){return t.forEach(n=>{const o=document.createElement("canvas");o.setAttribute("style","display: block;"),o.setAttribute("class","animation-canvas"),o.style.position="absolute",n.appendChild(o)}),t}setEventListener(t){const n=t?"addEventListener":"removeEventListener";this.isUseZoomMode=t,this.evChartDomContainers.forEach(o=>{o[n]("wheel",this.wrapWheelMoveZoomArea)})}wheelMoveZoomArea(t){t.preventDefault();const[n,o]=this.zoomAreaMemory.current[0];if(n===o)return;let s,l;if(t.deltaY>0){if(!n)return;s=n-1,l=o-1}else{if(o===this.cloneLabelsLastIdx)return;s=n+1,l=o+1}this.isUseToolbar=!0,this.executeZoom(s,l),this.zoomAreaMemory.current[0]=[s,l]}clickMoveZoomArea(t){if(!this.zoomAreaMemory[t].length)return;const[n,o]=this.zoomAreaMemory[t].pop();this.isUseToolbar=!0,this.executeZoom(n,o),this.setZoomAreaMemory(n,o,t==="previous"?"latest":"previous")}dragZoom({data:t,range:{dragSelectionInfo:n}}){const{dragXsp:o,dragXep:s,exceptAxesYChartWidth:l,chartTitle:a}=n,{options:r,data:c}=this.evChartProps,d=r.length>1?r.findIndex(h=>{var f;return(((f=h==null?void 0:h.title)==null?void 0:f.text)??"")===a}):0;if(r[d].axesX[0].type==="time"){const h=t[0].items,f=h[0].x,m=h[h.length-1].x,p=c[d].labels,g=this.evChartCloneData[d].labels,[u,x]=this.zoomAreaMemory.current[0];let b=g.findIndex(B=>+B.$d==+f.$d),y=g.findLastIndex(B=>+B.$d==+m.$d);const w=B=>l/(p.length-1)*(B-u);let I=w(b);if(b===y&&(I-o>=s-I?b-=1:y+=1),b===u&&y===x)return;b-y===-1&&(I=w(b));const E=w(y);this.evChartZoomOptions.useAnimation?this.dragZoomAnimation(n,b,y,I,E):(this.executeZoom(b,y),this.setZoomAreaMemory(b,y))}}dragZoomAnimation(t,n,o,s,l){const{chartRange:a,exceptAxesYChartWidth:r,exceptAxesXChartHeight:c}=t,d=window.devicePixelRatio||1,h=Array.from(this.evChartDomContainers).map(f=>{const m=f.querySelector(".animation-canvas");return[f.children[0],m]});for(let f=0;f<h.length;f++){const[m,p]=h[f],g=p.getContext("2d");p.style.top=`${a.y1}px`,p.style.left=`${a.x1}px`,p.width=r*d,p.style.width=`${r}px`,p.height=c*d,p.style.height=`${c}px`,p.style.display==="none"&&(p.style.display="block"),this.isAnimationFinish=!1,this.isUseToolbar=!0,this.executeDragZoomAnimation(m,g,t,s,l).then(u=>{p.style.display="none",u&&f===h.length-1&&(this.isAnimationFinish=u,this.executeZoom(n,o),this.setZoomAreaMemory(n,o))})}}executeZoom(t,n){this.isExecuteZoom&&(this.isExecuteZoom.value=!0);for(let o=0;o<this.evChartCloneData.length;o++){const{data:s,labels:l,series:a}=this.evChartCloneData[o],r=this.evChartProps.data[o],c=Object.keys(a);for(let d=0;d<c.length;d++){const h=c[d];r.data[h]=s[h].filter((f,m)=>t<=m&&n>=m)}r.labels=l.filter((d,h)=>t<=h&&n>=h)}!this.brushIdx.isUseButton&&!this.brushIdx.isUseScroll&&(this.brushIdx.start=t,this.brushIdx.end=n),this.emitFunc&&(this.emitFunc.updateZoomStartIdx(t),this.emitFunc.updateZoomEndIdx(n))}setBrushIdx(t,n){this.brushIdx.end=-1;for(let o=0;o<n.value.length;o++){const s=t.data[n.value[o]];s.labels.length&&(this.brushIdx.start=0,this.brushIdx.end=s.labels.length-1)}}updateEvChartCloneData(t,n,o,s){const l=t.data[0].labels.length-1;if(this.cloneLabelsLastIdx=l,this.evChartCloneData=t.data,s){const a=this.zoomAreaMemory.current[0];let r=a[0],c=a[1];r===0&&c===-1&&(r=0,c=l,this.zoomAreaMemory={previous:[],current:[[r,c]],latest:[]}),this.emitFunc&&(this.emitFunc.updateZoomStartIdx(r),this.emitFunc.updateZoomEndIdx(c)),this.executeZoom(r,c)}else this.dragZoomIcon&&this.dragZoomIcon.classList.remove("active"),this.zoomAreaMemory={previous:[],current:[[0,l]],latest:[]},this.emitFunc&&(this.emitFunc.updateZoomStartIdx(0),this.emitFunc.updateZoomEndIdx(l)),this.setIconStyle(o),this.setBrushIdx(t,n)}setZoomAreaMemory(t,n,o){if(t<0||n<=0)return;const{previous:s,current:l,latest:a}=this.zoomAreaMemory,r=l.pop(),{bufferMemoryCnt:c}=this.evChartZoomOptions;o?(s.length>=c&&s.splice(0,s.length-c+1),this.zoomAreaMemory[o].push(r)):(t!==r[0]||n!==r[1])&&(r[0]===0&&r[1]===-1?s.push([0,this.cloneLabelsLastIdx]):s.push(r),a.length=0),l.push([t,n]),this.setIconStyle(this.isUseZoomMode)}executeDragZoomAnimation(t,n,o,s,l){const{chartRange:a,exceptAxesYChartWidth:r,exceptAxesXChartHeight:c}=o;let d=0,h=s,f=l-s,m=l,p=1;const g=.0015;let u=.5;const x=.1,b=.05,y=50,w=Math.ceil(y*(s/r)),I=Math.ceil(y*((r-l)/r)),E=B=>(n.clearRect(0,0,r,c),h<=0&&f>=r?(t.style.opacity="initial",B(!0)):(u>=x&&(t.style.opacity=u,u-=b),n.globalAlpha=p,n.drawImage(t,a.x1,a.y1,s,c,d,0,s,c),n.drawImage(t,a.x1+s,a.y1,l-s,c,h,0,f,c),n.drawImage(t,a.x1+l,a.y1,r,c,m,0,r,c),p-=g,d-=w,h-=w,f+=w+I,m+=I,requestAnimationFrame(()=>E(B))));return new Promise(B=>E(B))}setIconStyle(t){const n=(o,s)=>{s?this.iconStyle(o,"enable"):this.iconStyle(o,"disable")};if(t&&this.dragZoomIcon.classList.contains("active")){const{previous:o,latest:s}=this.zoomAreaMemory;n(this.previousIcon,o.length),n(this.latestIcon,s.length),this.iconStyle(this.resetIcon,"enable")}else n(this.resetIcon),n(this.previousIcon),n(this.latestIcon)}iconStyle(t,n){if(!t)return;const[o,s]=n==="enable"?[1,"initial"]:[.5,"none"];t.style.opacity=o,t.style.pointerEvents=s}initZoom(){if(!this.isAnimationFinish)return;const[t,n]=this.zoomAreaMemory.current[0],o=this.cloneLabelsLastIdx;(t!==0||n!==o)&&(this.isUseToolbar=!0,this.executeZoom(0,o),this.setZoomAreaMemory(0,o))}}const JC={padding:{top:20,right:2,left:2,bottom:4},border:2,title:{show:!1,height:40,text:"",style:{fontSize:15,color:"#000",fontFamily:"Roboto"}},legend:{show:!0,type:"icon",position:"right",color:"#353740",inactive:"#aaa",width:140,height:24,allowResize:!1,virtualScroll:!1,clickMode:"active",table:{use:!1,columns:{name:{title:"Name"},min:{title:"MIN",use:!1},max:{title:"MAX",use:!1},avg:{title:"AVG",use:!1},total:{title:"TOTAL",use:!1},last:{title:"LAST",use:!1}}}},itemHighlight:!0,seriesHighlight:!0,unSelectedOpacity:.3,useSelect:!1,doughnutHoleSize:0,pieStroke:{use:!0,lineWidth:2,color:"#FFFFFF"},reverse:!1,horizontal:!1,overlapping:{use:!1},width:"100%",height:"100%",thickness:1,cPadRatio:0,borderRadius:0,combo:!1,tooltip:{use:!0,sortByValue:!0,backgroundColor:"#4C4C4C",fontColor:"#FFFFFF",borderColor:"#666666",shadowOpacity:.25,useShadow:!1,throttledMove:!1,debouncedHide:!1,useScrollbar:!1,textOverflow:"wrap",fontFamily:"Roboto",colorShape:"rect",fontSize:{title:16,contents:14},rowPadding:{top:0,bottom:3,right:20,left:16},showHeader:!0},indicator:{use:!0,color:"#EE7F44",segments:null},maxTip:{use:!1,fixedPosTop:!1,showIndicator:!1,indicatorColor:"#000000",tipStyle:{height:20,background:"#000000",textColor:"#FFFFFF",fontSize:14,fontFamily:"Roboto",fontWeight:400}},selectItem:{use:!1,useClick:!0,showTextTip:!1,tipText:"value",showTip:!1,showIndicator:!1,fixedPosTop:!1,useApproximateValue:!1,indicatorColor:"#000000",tipStyle:{height:20,background:"#000000",textColor:"#FFFFFF",fontSize:14,fontFamily:"Roboto",fontWeight:400},useSeriesOpacity:!1,useDeselectItem:!1,showBorder:!1,borderStyle:{color:"#FFFFFF",lineWidth:1,opacity:1,radius:0}},selectLabel:{use:!1,useClick:!0,tipText:"value",limit:1,useDeselectOverflow:!1,showTip:!1,useSeriesOpacity:!0,useLabelOpacity:!0,fixedPosTop:!1,useApproximateValue:!1,tipBackground:"#000000",indicatorColor:"#000000",tipStyle:{height:20,background:"#000000",textColor:"#FFFFFF",fontSize:14,fontFamily:"Roboto",fontWeight:400},showTextTip:!1,showIndicator:!1,useBothAxis:!1},selectSeries:{use:!1,useClick:!0,limit:1,useDeselectOverflow:!1},dragSelection:{use:!1,keepDisplay:!0,size:50,fillColor:"#38ACEC",opacity:.65},zoom:{bufferMemoryCnt:100,keepZoomStatus:!1,useAnimation:!0,useWheelMove:!0,toolbar:{show:!1,items:{previous:{icon:"ev-icon-allow2-left",size:"medium",title:"Previous"},latest:{icon:"ev-icon-allow2-right",size:"medium",title:"Latest"},reset:{icon:"ev-icon-redo",size:"medium",title:"Reset"},dragZoom:{icon:"ev-icon-zoomin",size:"medium",title:"Drag Zoom"}}}},heatMapColor:{min:"#FFFFFF",max:"#0052FF",rangeCount:1,colorsByRange:[],stroke:{show:!1,color:"#FFFFFF",lineWidth:1,opacity:1,radius:0},error:"#FF0000",decimalPoint:0},seriesReverse:!1,coordinateDedupe:!0,eventBehavior:{legendClick:"update"}},QC={series:{},groups:[],labels:[],data:{}},eS=()=>{let e=null,t=0;const n=200;return{clickEventCallback:l=>{t++,t===1&&(e=setTimeout(()=>{t===1&&l(),t=0},n))},dblClickEventCallback:l=>{e&&(clearTimeout(e),e=null),l(),t=0}}},zr=(e,t)=>{const{props:n,emit:o}=i.getCurrentInstance(),s=m=>{const p=Fe({},m,JC);return(m.type==="scatter"||m.type==="heatMap")&&!(m!=null&&m.tooltip)&&(p.tooltip.use=!1),m.type==="pie"&&!(m!=null&&m.padding)&&(p.padding={top:2,right:2,left:2,bottom:4}),p},l=m=>Fe(m,QC),a=Se(n.selectedItem),r=Se(n.selectedLabel??(e==null?void 0:e.value)),c=Se(n.selectedSeries),{clickEventCallback:d,dblClickEventCallback:h}=eS();return{eventListeners:{click:async m=>{await i.nextTick(),d(()=>{const{seriesId:p,dataIndex:g,eventTarget:u,targetAxis:x}=(m==null?void 0:m.selected)??{},{eventTarget:b}=(m==null?void 0:m.deselected)??{};switch(u){case"item":{p!==null?(o("update:selectedItem",{seriesID:p,dataIndex:g}),b==="label"&&o("update:selectedLabel",{dataIndex:[]})):o("update:selectedItem",null);break}case"label":{e!=null&&e.value?e.value.dataIndex=g:(o("update:selectedLabel",{dataIndex:g,targetAxis:x}),b==="item"&&o("update:selectedItem",null));break}case"series":{o("update:selectedSeries",{seriesId:p});break}}o("click",m)})},"dbl-click":async m=>{await i.nextTick(),h(()=>{const{eventTarget:p}=m;switch(p){case"series":{o("update:selectedSeries",{seriesId:m.seriesId?[m.seriesId]:[]});break}}o("dbl-click",m)})},"drag-select":async m=>{await i.nextTick(),o("drag-select",m)},"mouse-move":async m=>{t!=null&&t.value&&(t.value=m.hoveredLabel),await i.nextTick(),o("mouse-move",m)},"mouse-leave":()=>{t!=null&&t.value&&(t.value.label=null)},"click-legend":async m=>{await i.nextTick(),o("click-legend",m)}},selectItemInfo:a,selectLabelInfo:r,selectSeriesInfo:c,getNormalizedData:l,getNormalizedOptions:s}},Fr=e=>{const t=i.ref(),n=i.computed(()=>{const o=s=>{let l;return s?l=s.unit?s.value+s.unit:`${s.value}px`:l=void 0,l};return{width:o(Kl(e.width)),height:o(Kl(e.height))}});return{wrapper:t,wrapperStyle:n}},Hr=(e,{wrapper:t,evChartGroupRef:n},o,s)=>{const{props:l,emit:a}=i.getCurrentInstance(),r=i.ref(!1),c=i.ref(!1),d=i.ref(!0),h=i.ref(),f=i.reactive({zoom:e.zoom}),m=i.reactive({start:0,end:-1,isUseButton:!1,isUseScroll:!1});let p=null;const g=i.reactive({dom:[],props:{data:[],options:[]}}),u=i.reactive({data:null,options:null}),x=i.ref([]),b=S=>{S.data.length&&S.range&&c.value&&p.dragZoom(S)},y=()=>{g.props.options.forEach((S,M)=>{if(S.zoom={...S.zoom,use:c.value,getRangeInfo:b},c.value)S.dragSelection={...S.dragSelection,use:!0,keepDisplay:!1};else{const{use:k,keepDisplay:T}=u.options[M].dragSelection??{};S.dragSelection={use:!!k,keepDisplay:!!T}}})},w=()=>{if(n!=null&&n.value?(g.dom=n.value.querySelectorAll(".ev-chart-container"),g.dom.length&&s.value.forEach(({data:S,options:M},k)=>{S.chartIdx=k,g.props.data.push(S),g.props.options.push(M),x.value.push(k)})):(g.dom=[t.value.querySelector(".ev-chart-container")],g.props.data.push(l.data),g.props.options.push(l.options)),g.props.data.length){u.data=Se(g.props.data),u.options=Se(g.props.options);const S={updateZoomStartIdx:M=>a("update:zoomStartIdx",M),updateZoomEndIdx:M=>a("update:zoomEndIdx",M)};p=new KC(g,u,f,h.value,r,m,S)}},I=S=>{u.data[0].labels.length<=1||(c.value=!c.value,S?S.classList.toggle("active"):h.value.querySelector(".dragZoom").classList.toggle("active"),y(),p.setIconStyle(c.value),p.setEventListener(c.value))},E=(S,M)=>{if(p.isAnimationFinish)switch(M){case"dragZoom":I(S.target);break;case"reset":p.initZoom();break;case"previous":case"latest":p.clickMoveZoomArea(M);break}};i.onUpdated(()=>{p&&h.value&&p.setIcon(h.value)});const B=S=>{!je(S.zoom,f.zoom)&&(f.zoom=S.zoom,p?(!f.zoom.toolbar.show&&c.value&&I(),p.setEvChartZoomOptions(f.zoom)):f.zoom.toolbar.show&&!n&&w())},_=S=>{d.value?(r.value||(u.data=n?Se(S):[Se(S)],f.zoom.keepZoomStatus?d.value=!1:(c.value=!1,y()),p&&p.updateEvChartCloneData(u,x,c.value,f.zoom.keepZoomStatus)),r.value=!1):d.value=!0},C=(S,M)=>{if(p.isUseToolbar){p.isUseToolbar=!1;return}c.value&&(p.executeZoom(S,M),p.setZoomAreaMemory(S,M))};return i.watch(()=>[m.start,m.end],([S,M],[k])=>{if(o!=null&&o.value)if(typeof o.value.dataIndex=="number")S>=(k??0)?o.value.dataIndex-=S-(k??0):o.value.dataIndex+=k-S;else for(let T=0;T<o.value.dataIndex.length;T++)S>=(k??0)?o.value.dataIndex[T]-=S-(k??0):o.value.dataIndex[T]+=k-S;(m.isUseButton||m.isUseScroll)&&p.executeZoom(S,M)}),i.watch(()=>[m.isUseButton,m.isUseScroll],([S,M],[k,T])=>{k&&!S?p.setZoomAreaMemory(m.start,m.end):T&&!M&&(p.zoomAreaMemory.current[0]=[m.start,m.end])}),{evChartZoomOptions:f,evChartInfo:g,evChartToolbarRef:h,evChartClone:u,brushIdx:m,createEvChartZoom:w,setOptionsForUseZoom:B,setDataForUseZoom:_,controlZoomIdx:C,onClickToolbar:E}},tS={name:"EvChart",components:{EvChartToolbar:Ar},directives:{resize:wn},props:{selectedItem:{type:Object,default:null},selectedLabel:{type:Object,default:null},selectedSeries:{type:Object,default:null},options:{type:Object,default:()=>({})},data:{type:Object,default:()=>({})},resizeTimeout:{type:Number,default:0},zoomStartIdx:{type:Number,default:0},zoomEndIdx:{type:Number,default:0},realTimeScatterReset:{type:Boolean,default:!1}},emits:["click","dbl-click","drag-select","mouse-move","update:selectedItem","update:selectedLabel","update:selectedSeries","update:zoomStartIdx","update:zoomEndIdx","update:realTimeScatterReset","click-legend"],setup(e,{emit:t}){let n=null;const o=i.ref(!1),s=i.inject("isChartGroup",!1),l=i.inject("brushSeries",{list:[],chartIdx:null}),a=i.inject("groupSelectedLabel",null),r=i.inject("groupHoveredLabel",null),c=i.inject("brushIdx",{start:0,end:-1}),d=i.inject("evChartPropsInGroup",[]),{eventListeners:h,selectItemInfo:f,selectLabelInfo:m,selectSeriesInfo:p,getNormalizedData:g,getNormalizedOptions:u}=zr(a,r),x=g(e.data),b=u(e.options),y=i.computed(()=>e.selectedLabel),w=i.computed(()=>e.selectedItem),{wrapper:I,wrapperStyle:E}=Fr(b),{evChartZoomOptions:B,evChartToolbarRef:_,createEvChartZoom:C,setOptionsForUseZoom:S,setDataForUseZoom:M,controlZoomIdx:k,onClickToolbar:T}=s?{}:Hr(b,{wrapper:I,evChartGroupRef:null},e.selectedLabel?y:w,d),R=()=>{var V;let O;b.selectLabel.use?O=m:b.selectSeries.use&&(O=p);const D=(V=e.options.realTimeScatter)!=null&&V.use?{...e.data,groups:[],labels:[]}:x;n=new Pr(I.value,D,b,h,f,O,l)},L=()=>{n&&(n.init(),!s&&b.zoom.toolbar.show&&C())};i.watch(()=>e.options,O=>{const D=u(O),V=!je(D.legend.table,n.options.legend.table),P=D.tooltip.use&&!je(D.tooltip,n.options.tooltip);n.options=Se(D),n.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1},updateLegend:V,updateTooltip:P}),s||S(D)},{deep:!0,flush:"post"}),i.watch(()=>e.data,O=>{var A,F;const D=(A=e.options.realTimeScatter)!=null&&A.use?{...O,groups:[],labels:[]}:g(O),V=!je(D.series,n.data.series)||!je(D.groups,n.data.groups)||e.options.type==="heatMap",P=!je(D,n.data);n.data=(F=e.options.realTimeScatter)!=null&&F.use?D:Se(D),n.update({updateSeries:V,updateSelTip:{update:!0,keepDomain:!1},updateData:P}),!s&&P&&M(D)},{deep:!0,flush:"post"}),s&&!(a!=null&&a.value)&&i.watch(()=>c.start,(O,D)=>{if(y!=null&&y.value)for(let V=0;V<y.value.dataIndex.length;V++)O>=(D??0)?y.value.dataIndex[V]-=O-(D??0):y.value.dataIndex[V]+=D-O;else w!=null&&w.value&&(O>=(D??0)?w.value.dataIndex-=O-(D??0):w.value.dataIndex+=D-O)}),i.watch(()=>w.value,O=>{const D=e.options.type;n.selectItemByData(O,D)},{deep:!0,flush:"post"}),i.watch(()=>(a==null?void 0:a.value)??y.value,O=>{O!=null&&O.dataIndex&&n.selectLabelByData(O.dataIndex,O==null?void 0:O.targetAxis)},{deep:!0,flush:"post"}),i.watch(()=>e.selectedSeries,O=>{var D;(D=b.selectSeries)!=null&&D.use?O.seriesId&&n.selectSeriesByData(O.seriesId):console.warn("[EVUI][Chart] selectSeries.use is false, so selectedSeries is not working")},{deep:!0,flush:"post"}),s||i.watch(()=>[e.zoomStartIdx,e.zoomEndIdx],([O,D])=>{k(O,D)}),i.watch(()=>e.realTimeScatterReset,O=>{O&&(Object.keys(n.dataSet??{}).forEach(D=>{n.dataSet[D]&&(n.dataSet[D].dataGroup=[])}),t("update:realTimeScatterReset",!1))}),i.watch(()=>{var O;return(O=e.options.realTimeScatter)==null?void 0:O.use},O=>{n.options.realTimeScatter.use=O??!1,n.update({updateSeries:!0,updateSelTip:{update:!1,keepDomain:!1},updateData:!1})}),i.watch(()=>r==null?void 0:r.value,O=>{O&&e.options.syncHover!==!1&&(O.label==null?n.overlayClear():n.drawSyncedIndicator(O))},{deep:!0,flush:"post"}),i.onMounted(async()=>{d!=null&&d.value&&d.value.push(e),await R(),await L(),o.value=!0}),i.onBeforeUnmount(()=>{var O;n&&"destroy"in n&&n.destroy(),(O=d==null?void 0:d.value)!=null&&O.length&&(d.value.length=0),o.value=!1}),i.onDeactivated(()=>{n&&"hideTooltip"in n&&n.hideTooltip()});const N=()=>{n&&"update"in n&&n.update({updateSeries:!0,updateSelTip:{update:!0,keepDomain:!1}})},v=jo(()=>{n&&"resize"in n&&n.resize()},e.resizeTimeout);return i.onActivated(()=>{o.value&&v()}),{wrapper:I,wrapperStyle:E,onResize:v,redraw:N,evChartToolbarRef:_,injectIsChartGroup:s,onClickToolbar:T,normalizedOptions:b,zoomOptions:i.toRef(B??{zoom:{}},"zoom")}}},nS={key:0,ref:"evChartToolbarRef"};function oS(e,t,n,o,s,l){var c;const a=i.resolveComponent("ev-chart-toolbar"),r=i.resolveDirective("resize");return i.openBlock(),i.createElementBlock(i.Fragment,null,[(c=o.zoomOptions.toolbar)!=null&&c.show&&!o.injectIsChartGroup?(i.openBlock(),i.createElementBlock("div",nS,[i.createVNode(a,{toolbar:o.zoomOptions.toolbar,onOnClickToolbar:o.onClickToolbar},null,8,["toolbar","onOnClickToolbar"])],512)):i.createCommentVNode("",!0),i.withDirectives(i.createElementVNode("div",{ref:"wrapper",style:i.normalizeStyle(o.wrapperStyle),class:"ev-chart"},null,4),[[r,o.onResize]])],64)}const so=le(tS,[["render",oS]]);so.install=e=>{e.component(so.name,so)};const iS={zoom:{bufferMemoryCnt:100,keepZoomStatus:!1,useAnimation:!0,useWheelMove:!0,toolbar:{show:!1,items:{previous:{icon:"ev-icon-allow2-left",size:"medium",title:"Previous"},latest:{icon:"ev-icon-allow2-right",size:"medium",title:"Latest"},reset:{icon:"ev-icon-redo",size:"medium",title:"Reset"},dragZoom:{icon:"ev-icon-zoomin",size:"medium",title:"Drag Zoom"}}}}},sS=()=>{const e=i.ref(!1),t=i.ref(),n=i.ref([]),o=i.reactive({list:[],chartIdx:null});return{getNormalizedOptions:l=>Fe({},l,iS),isExecuteZoom:e,brushSeries:o,evChartGroupRef:t,evChartPropsInGroup:n}},lS={name:"EvChartGroup",components:{evChartToolbar:Ar},props:{options:{type:Object,default:()=>({})},zoomStartIdx:{type:Number,default:0},zoomEndIdx:{type:Number,default:0},groupSelectedLabel:{type:Object,default:null}},emits:["update:groupSelectedLabel","update:zoomStartIdx","update:zoomEndIdx","update:groupHoveredLabel"],setup(e,{emit:t}){const{getNormalizedOptions:n,isExecuteZoom:o,brushSeries:s,evChartGroupRef:l,evChartPropsInGroup:a}=sS(),r=n(e.options);i.provide("isExecuteZoom",o),i.provide("isChartGroup",!0),i.provide("brushSeries",s),i.provide("evChartPropsInGroup",a);const c=i.computed({get:()=>e.groupSelectedLabel,set:I=>t("update:groupSelectedLabel",I)});i.provide("groupSelectedLabel",c);const d=i.ref(null);i.provide("groupHoveredLabel",d),i.watch(()=>e.options.syncHover,I=>{I?d.value={label:"",horizontal:!1}:d.value=null},{immediate:!0});const{evChartZoomOptions:h,evChartInfo:f,evChartToolbarRef:m,evChartClone:p,brushIdx:g,createEvChartZoom:u,setOptionsForUseZoom:x,setDataForUseZoom:b,controlZoomIdx:y,onClickToolbar:w}=Hr(r,{wrapper:null,evChartGroupRef:l},c,a);return i.provide("evChartClone",p),i.provide("evChartInfo",f),i.provide("brushIdx",g),i.onMounted(()=>{u()}),i.watch(()=>f.props.data,I=>{b(I)},{deep:!0}),i.watch(()=>e.options,I=>{const E=n(I);x(E)},{deep:!0}),i.watch(()=>[e.zoomStartIdx,e.zoomEndIdx],([I,E])=>{g.isUseButton||g.isUseScroll||y(I,E)}),{evChartGroupRef:l,evChartToolbarRef:m,zoomOptions:i.toRef(h,"zoom"),onClickToolbar:w}}},aS={key:0,ref:"evChartToolbarRef"},rS={ref:"evChartGroupRef",class:"ev-chart-group__wrapper"};function cS(e,t,n,o,s,l){const a=i.resolveComponent("ev-chart-toolbar");return i.openBlock(),i.createElementBlock(i.Fragment,null,[o.zoomOptions.toolbar.show?(i.openBlock(),i.createElementBlock("div",aS,[i.createVNode(a,{toolbar:o.zoomOptions.toolbar,onOnClickToolbar:o.onClickToolbar},null,8,["toolbar","onOnClickToolbar"])],512)):i.createCommentVNode("",!0),i.createElementVNode("div",rS,[i.renderSlot(e.$slots,"default",{},void 0,!0)],512)],64)}const lo=le(lS,[["render",cS],["__scopeId","data-v-b1c0c322"]]);lo.install=e=>{e.component(lo.name,lo)};const Ee={WHEEL:{UP:"MOVEUP_WHEEL",DOWN:"MOVEDOWN_WHEEL"},GRAB:{UP:"MOVEUP_GRAB",DOWN:"MOVEDOWN_GRAB"},BUTTON:{INCREASE:"INCREASE",DECREASE:"DECREASE"}},Re={LEFT:"leftX",RIGHT:"rightX"};let dS=class{constructor(t,n,o,s,l){this.evChart=t,this.evChartBrushOptions=o,this.evChartBrushRef=l,this.evChartData=n,this.brushIdx=s,o.value.useDebounce&&(this.debounceBrushIdx={start:s.start,end:s.end})}init(t){var n;if(this.brushIdx.start>this.brushIdx.end){this.removeBrushCanvas();return}if((n=this.evChartBrushRef)!=null&&n.value){const o=this.evChartBrushRef.value.querySelector(".brush-canvas");if(o)this.drawBrushRect({brushCanvas:o,isResize:t});else{const s=document.createElement("canvas");s.setAttribute("class","brush-canvas"),s.setAttribute("style","display: block; z-index: 1;");const l=this.evChartBrushRef.value.querySelector(".ev-chart-brush-container");l&&(this.brushCanvas=s,l.appendChild(s),this.evChartBrushContainer=l,this.drawBrushRect({brushCanvas:s}),this.addEvent(s))}}}drawBrushRect({brushCanvas:t,isResize:n,isDebounce:o,mode:s,offsetX:l}){const{chartRect:a,labelOffset:r}=this.evChart;if(!a&&!r)return;const c=this.evChartData.value.labels.length-1;this.labelEndIdx=c;const d={x1:a.x1+r.left,x2:a.x2-r.right,y1:a.y1+r.top,y2:a.y2-r.bottom},h=this.setCanvasWidthHeight(d,t);if(!(n&&this.isEqualWidth)&&c>=0){const f=this.setBrushXAndWidth(h,l,o,s);h&&f&&this.drawBrush(h,f,d,t)}}setCanvasWidthHeight(t,n){const s=t.x2-t.x1+6,l=t.y2-t.y1,a=(t.x2-t.x1)/this.labelEndIdx,r=window.devicePixelRatio||1;return this.isEqualWidth=n.width===Math.floor(s*r),{brushButtonWidth:6,brushCanvasHeight:l,brushCanvasWidth:s,axesXInterval:a,pixelRatio:r}}setBrushXAndWidth(t,n=0,o,s){const{brushButtonWidth:l,brushCanvasWidth:a,axesXInterval:r,pixelRatio:c}=t;!o&&this.debounceBrushIdx&&(this.debounceBrushIdx.start=this.brushIdx.start,this.debounceBrushIdx.end=this.brushIdx.end);const d=this.debounceBrushIdx??this.brushIdx;switch(s){case Ee.BUTTON.INCREASE:case Ee.BUTTON.DECREASE:this.brushRectWidth=a*c,this.curBrushButtonType===Re.LEFT?(this.brushRectWidth=this.beforeBrushRectWidth?this.beforeBrushRectWidth-n:this.brushRectWidth-n,this.brushRectWidth<=l?this.brushRectWidth=l:(this.brushRectX=n*c,this.beforeBrushRectX=this.brushRectX)):this.curBrushButtonType===Re.RIGHT&&(this.brushRectWidth=n-this.beforeBrushRectX,this.brushRectWidth<=l?this.brushRectWidth=l:(this.brushRectX=this.beforeBrushRectX,this.beforeBrushRectWidth=this.brushRectWidth+this.brushRectX));break;case Ee.GRAB.UP:case Ee.GRAB.DOWN:this.brushRectX<=0&&s===Ee.GRAB.DOWN||this.brushRectX+this.brushRectWidth>=a&&s===Ee.GRAB.UP?this.offsetXAndRectXInterval=null:(this.offsetXAndRectXInterval||(this.offsetXAndRectXInterval=n-this.brushRectX),this.brushRectX=n-this.offsetXAndRectXInterval);break;default:n||(this.brushRectX=d.start*r*c,this.brushRectWidth=(a-(this.labelEndIdx-(d.end-d.start))*r)*c,this.beforeBrushRectX=this.brushRectX,this.beforeBrushRectWidth=this.brushRectWidth+this.brushRectX);break}return{brushRectX:this.brushRectX,brushRectWidth:this.brushRectWidth}}drawBrush(t,n,o,s){const{brushButtonWidth:l,brushCanvasHeight:a,brushCanvasWidth:r,axesXInterval:c,pixelRatio:d}=t,{brushRectX:h,brushRectWidth:f}=n,{height:m,selection:{fillColor:p,opacity:g}}=this.evChartBrushOptions.value,u=m-o.y1,x=h,b=h+f;s.style.position||(s.style.position="absolute",s.style.top=`${o.y1}px`,s.style.left=`${o.x1-l/2}px`),this.isEqualWidth||(s.width=r*d,s.style.width=`${r}px`,s.height=a*d,s.style.height=`${a}px`);const y=s.getContext("2d");y.clearRect(0,0,r*d,a*d),y.fillStyle=p,y.globalAlpha=g,y.fillRect(h,0,f,u),y.fillRect(x,0,l,u),y.fillRect(b-l,0,l,u),this.brushPosInfo={leftX:x/d,rightX:b/d,buttonWidth:l,axesXInterval:c,...t,...n}}addEvent(){let t;this.onMouseDown=s=>{s.preventDefault(),t.isInsideButton?this.clickBrushInsideX=-1:t.isInsideBrush?this.clickBrushInsideX=s.offsetX:t.isOutsideBrush&&this.teleportBrush(s)};const n=s=>{this.clickBrushInsideX?this.mouseDownAndMove(s):(t=this.getMousePosition(s),this.changeCursor(t))};this.onMouseMove=xs(n,5),this.onWheel=s=>{s.preventDefault();const l=s.deltaY>0?Ee.WHEEL.DOWN:Ee.WHEEL.UP;this.updateBrushIdx(l),this.debounceBrushIdx&&this.drawBrushRect({brushCanvas:this.brushCanvas,isDebounce:!0,mode:l}),this.brushIdx.isUseScroll=!0},this.onMouseUp=()=>{this.initEventState()},this.onMouseLeave=()=>{this.clickBrushInsideX&&this.initEventState()};const o=()=>{this.initEventState()};this.onWheelDebounce=jo(o,100),this.setEventListener("addEventListener")}getMousePosition(t){const n=d=>Math.abs(this.brushPosInfo[d]-t.offsetX),o=n(Re.RIGHT)>n(Re.LEFT)?Re.LEFT:Re.RIGHT,s=d=>t.offsetX>this.brushPosInfo[d],l=d=>t.offsetX<this.brushPosInfo[d],a=l(Re.LEFT)||s(Re.RIGHT),r=s(Re.LEFT)&&l(Re.RIGHT),c=t.offsetX+this.brushPosInfo.buttonWidth>=this.brushPosInfo[o]&&t.offsetX-this.brushPosInfo.buttonWidth<=this.brushPosInfo[o];return this.curBrushButtonType=c&&o,{isInsideButton:c,isInsideBrush:r,isOutsideBrush:a}}destroy(){if(this.brushCanvas&&(this.setEventListener("removeEventListener"),this.brushCanvas=null),this.evChartBrushContainer){const t=this.evChartBrushContainer;for(;t.hasChildNodes();)t.removeChild(t.firstChild)}}setEventListener(t){this.brushCanvas[t]("mousemove",this.onMouseMove),this.brushCanvas[t]("mousedown",this.onMouseDown),this.brushCanvas[t]("mouseup",this.onMouseUp),this.brushCanvas[t]("mouseleave",this.onMouseLeave),this.evChartBrushOptions.value.useWheelMove&&(this.brushCanvas[t]("wheel",this.onWheel),this.brushCanvas[t]("wheel",this.onWheelDebounce))}removeBrushWrapper(){if(this.evChartBrushRef.value){const t=this.evChartBrushRef.value.querySelector(".ev-chart-brush-wrapper");t&&this.evChartBrushRef.value.removeChild(t)}}removeBrushCanvas(){if(this.evChartBrushContainer){const t=this.evChartBrushContainer.querySelector(".brush-canvas");t&&this.evChartBrushContainer.removeChild(t)}}teleportBrush(t){const n=this.debounceBrushIdx??this.brushIdx,o=(n.end-n.start)/2;let s,l,a;o>.5?(n.end-n.start)%2===0?(a=Math.round(t.offsetX/this.brushPosInfo.axesXInterval),s=Math.ceil(o),l=Math.floor(o)):(a=Math.ceil(t.offsetX/this.brushPosInfo.axesXInterval),s=Math.ceil(o),l=Math.floor(o)):(a=Math.floor(t.offsetX/this.brushPosInfo.axesXInterval),t.offsetX-a*this.brushPosInfo.axesXInterval>this.brushPosInfo.axesXInterval/2?(s=Math.floor(o),l=Math.ceil(o)):(s=Math.ceil(o),l=Math.floor(o),o<1&&(a+=1))),a-s<=0?(n.start=0,n.end=l+s):a+l>=this.labelEndIdx?(n.start=this.labelEndIdx-l-s,n.end=this.labelEndIdx):(n.start=a-s,n.end=a+l),this.brushIdx.isUseScroll=!0}changeCursor(t){t.isOutsideBrush?this.brushCanvas.style.cursor="pointer":t.isInsideBrush&&(t.isInsideButton?this.brushCanvas.style.cursor="ew-resize":this.brushCanvas.style.cursor="grab")}mouseDownAndMove(t){const n=this.debounceBrushIdx?0:this.brushPosInfo.axesXInterval/3;let o;t.offsetX>this.beforeMouseXPos?this.clickBrushInsideX>0?this.clickBrushInsideX<t.offsetX-n&&(o=Ee.GRAB.UP,this.isUseBrushGrab=!0,this.brushIdx.isUseScroll=!0,this.clickBrushInsideX=t.offsetX+n):t.offsetX-this.brushPosInfo[this.curBrushButtonType]>n&&(o=this.curBrushButtonType===Re.LEFT?Ee.BUTTON.DECREASE:Ee.BUTTON.INCREASE,this.brushIdx.isUseButton=!0):t.offsetX<this.beforeMouseXPos&&(this.clickBrushInsideX>0?this.clickBrushInsideX>t.offsetX+n&&(o=Ee.GRAB.DOWN,this.isUseBrushGrab=!0,this.brushIdx.isUseScroll=!0,this.clickBrushInsideX=t.offsetX-n):this.brushPosInfo[this.curBrushButtonType]-t.offsetX>n&&(o=this.curBrushButtonType===Re.LEFT?Ee.BUTTON.INCREASE:Ee.BUTTON.DECREASE,this.brushIdx.isUseButton=!0)),this.debounceBrushIdx?this.drawBrushRect({brushCanvas:this.brushCanvas,isDebounce:!0,mode:o,offsetX:t.offsetX}):this.updateBrushIdx(o),this.beforeMouseXPos=t.offsetX}updateBrushIdx(t){const n=this.debounceBrushIdx??this.brushIdx;switch(t){case Ee.WHEEL.UP:case Ee.GRAB.UP:if(n.end>=this.labelEndIdx)return;n.start+=1,n.end+=1;break;case Ee.WHEEL.DOWN:case Ee.GRAB.DOWN:if(n.start<=0)return;n.start-=1,n.end-=1;break;case Ee.BUTTON.INCREASE:if(this.curBrushButtonType===Re.LEFT){if(!n.start)return;n.start-=1}else{if(n.end===this.labelEndIdx)return;n.end+=1}break;case Ee.BUTTON.DECREASE:if(n.start===n.end-1)return;this.curBrushButtonType===Re.LEFT?n.start+=1:n.end-=1;break}}updateBrushIdxUseXPos(){if(!this.debounceBrushIdx)return;const t=()=>{let s,l;if(this.brushPosInfo){const{brushRectX:a,brushRectWidth:r,brushCanvasWidth:c,axesXInterval:d}=this.brushPosInfo;if(this.brushIdx.isUseButton||this.isUseBrushGrab){if(s=a/d,l=this.labelEndIdx-(c-(a+r))/d,this.curBrushButtonType===Re.LEFT?(s=Math.round(s),l=this.brushIdx.end,s===l&&(s-=1)):this.curBrushButtonType===Re.RIGHT?(s=this.brushIdx.start,l=Math.round(l),s===l&&(l+=1)):(s=Math.round(s),l=Math.round(l)),l>this.labelEndIdx){const h=l-this.labelEndIdx;s-=h,l-=h}if(s<0){const h=Math.abs(s);s=0,l+=h}}}return{brushStartIdx:s,brushEndIdx:l}},{brushStartIdx:n,brushEndIdx:o}=t();this.brushIdx.start===n&&this.brushIdx.end===o&&this.drawBrushRect({brushCanvas:this.brushCanvas}),this.brushIdx.start=n??this.debounceBrushIdx.start,this.brushIdx.end=o??this.debounceBrushIdx.end}initEventState(){new Promise(n=>{this.updateBrushIdxUseXPos(),n(!0)}).then(n=>{n&&(this.clickBrushInsideX=null,this.beforeMouseXPos=null,this.curBrushButtonType=null,this.isUseBrushGrab=!1,this.offsetXAndRectXInterval=null,this.brushIdx.isUseButton=!1,this.brushIdx.isUseScroll=!1)})}};const hS={show:!0,useDebounce:!0,chartIdx:0,height:100,showLabel:!1,selection:{fillColor:"#38ACEC",opacity:.65},useWheelMove:!0},fS=()=>({getNormalizedBrushOptions:t=>Fe({},t,hS)}),uS={name:"EvChartBrush",directives:{resize:wn},props:{options:{type:Object,default:()=>({})}},setup(e){let t=null,n=null;const o=i.ref(!1),s=i.inject("evChartClone",{data:[]}),l=i.inject("evChartInfo",{props:{options:[]}}),a=i.inject("brushIdx",{start:0,end:-1,isUseButton:!1,isUseScroll:!1}),r=i.inject("brushSeries",{list:[],chartIdx:null}),{getNormalizedBrushOptions:c}=fS(),d=i.computed(()=>c(e.options)),{eventListeners:h,selectItemInfo:f,selectLabelInfo:m,selectSeriesInfo:p,getNormalizedData:g,getNormalizedOptions:u}=zr(),x=i.computed(()=>g((s.data??[])[d.value.chartIdx])),b=i.computed(()=>{var k,T;const S=l.props.options[d.value.chartIdx],M={...S,brush:{use:!0,...d.value},height:d.value.height,zoom:{use:!1},dragSelection:{use:!1},title:{show:!1},tooltip:{use:!1},legend:{show:!1},selectLabel:{use:!1},selectSeries:{use:!1},axesX:[{...(k=S==null?void 0:S.axesX)==null?void 0:k[0],title:{use:!1}}],axesY:[{...(T=S==null?void 0:S.axesY)==null?void 0:T[0],title:{use:!1}}]};return u(M)}),{wrapper:y,wrapperStyle:w}=Fr(b.value);i.watch(()=>r.list,()=>{y.value&&r.chartIdx===d.value.chartIdx&&(t.seriesList=r.list[d.value.chartIdx],t.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1}}))}),i.watch(b,(S,M)=>{var k;S.brush.chartIdx<=((k=s.data)==null?void 0:k.length)-1?n&&!je(M.brush,S.brush)?n.removeBrushWrapper():t&&!je(S,M)&&(t.options=Se(S),t.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1}})):(t.data=Se(x.value),t.update({updateSeries:!0,updateSelTip:{update:!1,keepDomain:!1},updateData:!1}),n.removeBrushCanvas())}),i.watch(()=>s.data,S=>{if(t){const M=S[d.value.chartIdx];if(M){const k=!je(M.series,t.data.series),T=r.list[d.value.chartIdx];typeof T=="object"&&Object.keys(T).length&&Object.keys(M.series).forEach(R=>{var L;"show"in M.series[R]||(M.series[R].show=((L=T[R])==null?void 0:L.show)??!0)}),t.data=Se(M),t.update({updateSeries:k,updateSelTip:{update:!1,keepDomain:!1},updateData:!1})}}});const I=()=>{let S;b.value.selectLabel.use?S=m:b.value.selectSeries.use&&(S=p),t=new Pr(y.value,x.value,b.value,h,f,S)},E=()=>{n=new dS(t,x,d,a,y)},B=()=>{t&&t.init()},_=S=>{n&&n.init(S)};i.watch(()=>[a.start,a.end],()=>{var S;y.value&&d.value.chartIdx<=((S=s.data)==null?void 0:S.length)-1&&_()}),i.onMounted(async()=>{d.value.show&&(await I(),await B(),E(),_()),o.value=!0}),i.onUpdated(async()=>{var S;if(d.value.show&&d.value.chartIdx<=((S=s.data)==null?void 0:S.length)-1){const M=r.list[d.value.chartIdx];typeof M=="object"&&Object.keys(M).length&&Object.keys(x.value.series).forEach(k=>{var T;"show"in x.value.series[k]||(x.value.series[k].show=((T=M[k])==null?void 0:T.show)??!0)}),await I(),await B(),E(),_()}}),i.onBeforeUnmount(()=>{t&&"destroy"in t&&t.destroy(),n&&n.destroy(),o.value=!1}),i.onDeactivated(()=>{t&&"hideTooltip"in t&&t.hideTooltip()});const C=jo(()=>{t&&"resize"in t&&new Promise(M=>t.resize(M)).then(M=>{M&&_(M)})},0);return i.onActivated(()=>{o.value&&C()}),{evChartBrushOptions:d,evChartBrushRef:y,evChartBrushStyle:w,onResize:C}}};function mS(e,t,n,o,s,l){const a=i.resolveDirective("resize");return o.evChartBrushOptions.show?i.withDirectives((i.openBlock(),i.createElementBlock("div",{key:0,ref:"evChartBrushRef",style:i.normalizeStyle(o.evChartBrushStyle),class:"ev-chart-brush"},null,4)),[[a,o.onResize]]):i.createCommentVNode("",!0)}const ao=le(uS,[["render",mS]]);ao.install=e=>{e.component(ao.name,ao)};const gS={name:"TreeGridNode",components:{GridOptionButton:Ns},props:{dataIndex:{type:Number,default:0},nodeData:{type:Object,default:()=>({})},selectedData:{type:Object,default:()=>({})},useCheckbox:{type:Object,default:()=>({})},orderedColumns:{type:[Array],default:()=>[]},expandIcon:{type:String,default:""},collapseIcon:{type:String,default:""},parentIcon:{type:String,default:""},childIcon:{type:String,default:""},customContextMenu:{type:[Array],default:()=>[]},menuRef:{type:Object,default:null},rowHeight:{type:Number,default:35},minWidth:{type:Number,default:40},borderStyle:{type:String,default:""},highlightIndex:{type:Number,default:-1}},emits:{"check-tree-data":null,"expand-tree-data":null,"click-tree-data":null,"dbl-click-tree-data":null,"context-menu":null},setup(e,{emit:t}){const n=(y,w)=>{t("check-tree-data",y,w)},o=y=>{t("expand-tree-data",y)},s=(y,w)=>{t("click-tree-data",y,w)},l=(y,w)=>{t("dbl-click-tree-data",y,w)},a=y=>{t("context-menu",y)},r=y=>{const w=e.expandIcon?e.expandIcon:"",I=e.expandIcon?e.collapseIcon:"";return y.expand?I:w},c=i.computed(()=>e.nodeData||{}),d=i.computed(()=>e.parentIcon||"tree-parent-icon"),h=i.computed(()=>e.childIcon||"tree-child-icon"),f=i.computed(()=>d.value!=="none"||h.value!=="none"),m=i.computed(()=>{const y=e.orderedColumns||[],w=y.findIndex(E=>E.expandColumn&&!E.hide&&!E.hiddenDisplay);if(w!==-1)return w;const I=y.findIndex(E=>!E.hide&&!E.hiddenDisplay);return I!==-1?I:0}),p=y=>({row:!0,"tree-row":!0,[`tree-row--level-${y==null?void 0:y.level}`]:!0,highlight:(y==null?void 0:y.index)===e.highlightIndex,selected:y.selected,"non-border":!!e.borderStyle&&e.borderStyle!=="rows"}),g=i.computed(()=>({cell:!0,"row-checkbox":!0,"non-border":!!e.borderStyle}));return{parentIconMV:d,childIconMV:h,node:c,isDataIcon:f,checkboxClass:g,expandColumnIdx:m,onCheck:n,onExpand:o,onClick:s,onDblClick:l,onContextMenu:a,expandIconClasses:r,getRowClass:p,getColumnClass:(y,w)=>({cell:!0,"tree-td":w===0,[y.type]:y.type,[y.align]:y.align,[y.field]:y.field,"non-border":!!e.borderStyle}),getColumnStyle:(y,w)=>({width:`${y.width}px`,height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`,"min-width":`${e.minWidth}px`,"border-right":e.orderedColumns.length-1===w?"none":"1px solid #CFCFCF"}),getDepthStyle:y=>({"margin-left":`${y*13}px`})}}},pS=["data-index"],yS=["data-name","data-index"],xS={class:"td-content__wrapper"},bS=["title"],CS={class:"td-content"};function SS(e,t,n,o,s,l){var d;const a=i.resolveComponent("ev-checkbox"),r=i.resolveComponent("ev-icon"),c=i.resolveComponent("grid-option-button");return i.openBlock(),i.createElementBlock("tr",{"data-index":o.node.index,class:i.normalizeClass(o.getRowClass(o.node)),onClick:t[7]||(t[7]=h=>o.onClick(h,o.node)),onDblclick:t[8]||(t[8]=h=>o.onDblClick(h,o.node))},[n.useCheckbox.use?(i.openBlock(),i.createElementBlock("td",{key:0,class:i.normalizeClass(o.checkboxClass),style:i.normalizeStyle({width:`${n.minWidth}px`,height:`${n.rowHeight}px`,"border-right":"1px solid #CFCFCF"})},[i.createVNode(a,{modelValue:o.node.checked,"onUpdate:modelValue":t[0]||(t[0]=h=>o.node.checked=h),disabled:o.node.uncheckable,indeterminate:o.node.indeterminate,class:"row-checkbox-input",onChange:t[1]||(t[1]=h=>o.onCheck(h,o.node))},null,8,["modelValue","disabled","indeterminate"])],6)):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.orderedColumns,(h,f)=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:f},[!h.hide&&!h.hiddenDisplay?(i.openBlock(),i.createElementBlock("td",{key:0,"data-name":h.field,"data-index":o.node.index,class:i.normalizeClass(o.getColumnClass(h,f)),style:i.normalizeStyle(o.getColumnStyle(h,f))},[i.createElementVNode("div",xS,[f===o.expandColumnIdx?(i.openBlock(),i.createElementBlock("span",{key:0,style:i.normalizeStyle(o.getDepthStyle(o.node.level))},null,4)):i.createCommentVNode("",!0),f===o.expandColumnIdx?(i.openBlock(),i.createElementBlock("span",{key:1,class:i.normalizeClass({expand:o.node.expand,"ev-tree-toggle":!0})},[o.node.hasChild?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[o.expandIconClasses(o.node)?(i.openBlock(),i.createBlock(r,{key:0,icon:o.expandIconClasses(o.node),style:{display:"block"},onClick:t[2]||(t[2]=m=>o.onExpand(o.node))},null,8,["icon"])):(i.openBlock(),i.createElementBlock("button",{key:1,class:"tree-expand-icon",onClick:t[3]||(t[3]=i.withModifiers(m=>o.onExpand(o.node),["stop"]))},[...t[9]||(t[9]=[i.createElementVNode("i",null,null,-1)])]))],64)):i.createCommentVNode("",!0)],2)):i.createCommentVNode("",!0),f===o.expandColumnIdx&&o.isDataIcon?(i.openBlock(),i.createElementBlock("span",{key:2,title:o.node[h.field],class:i.normalizeClass({expand:o.node.expand,"ev-tree-toggle":!0})},[i.createElementVNode("span",{class:i.normalizeClass(o.node.hasChild?o.parentIconMV:o.childIconMV)},[...t[10]||(t[10]=[i.createElementVNode("i",null,null,-1)])],2)],10,bS)):i.createCommentVNode("",!0),i.createElementVNode("div",CS,[e.$slots[h.field+"Node"]?i.renderSlot(e.$slots,h.field+"Node",{key:0,item:{data:o.node.data}},void 0,!0):i.createCommentVNode("",!0)])])],14,yS)):i.createCommentVNode("",!0)],64))),128)),(d=n.customContextMenu)!=null&&d.length?(i.openBlock(),i.createElementBlock("td",{key:1,class:i.normalizeClass({"row-contextmenu":!0,"non-border":!!n.borderStyle}),style:i.normalizeStyle({position:"sticky",right:0,width:"30px",height:`${n.rowHeight}px`,"min-width":"30px","line-height":`${n.rowHeight}px`})},[e.$slots.contextmenuIconNode?(i.openBlock(),i.createElementBlock("span",{key:0,class:"row-contextmenu__btn",onClick:[t[4]||(t[4]=h=>o.onContextMenu(h)),t[5]||(t[5]=i.withModifiers((...h)=>n.menuRef.show&&n.menuRef.show(...h),["prevent"]))]},[i.renderSlot(e.$slots,"contextmenuIconNode",{},void 0,!0)])):(i.openBlock(),i.createBlock(c,{key:1,icon:"ev-icon-warning2",class:"row-contextmenu__btn",onClick:[t[6]||(t[6]=h=>o.onContextMenu(h)),i.withModifiers(n.menuRef.show,["prevent"])]},null,8,["onClick"]))],6)):i.createCommentVNode("",!0)],42,pS)}const wS=le(gS,[["render",SS],["__scopeId","data-v-faab3696"]]),kS={name:"EvTreeGridToolbar"},MS={class:"tree-grid-toolbar"};function ES(e,t,n,o,s,l){return i.openBlock(),i.createElementBlock("div",MS,[i.renderSlot(e.$slots,"toolbarWrapper")])}const IS=le(kS,[["render",ES]]),vS=e=>{const{props:t}=i.getCurrentInstance(),{checkInfo:n}=e;return{isRenderer:(d={})=>{var h;return!!((h=d==null?void 0:d.render)!=null&&h.use)},getComponentName:(d="")=>{const h=p=>p.charAt(0).toUpperCase()+p.slice(1),f="Renderer";let m="";if(d.indexOf("_")!==-1){const p=d.split("_");for(let g=0;g<p.length;g++)m+=h(p[g])}else m=h(d);return m+f},getConvertValue:(d,h)=>{let f=d.type==="number"||d.type==="float"?Number(h):h;return d.type==="number"?(f=Ht(h),f=f===!1?h:f):d.type==="float"&&(f=f.toFixed(d.decimal??3).replace(/\B(?=(\d{3})+(?!\d))/g,",")),f},getColumnIndex:d=>t.columns.findIndex(h=>h.field===d),setPixelUnit:d=>{let h=d;const f=h.toString().indexOf("px")>=0,m=h.toString().indexOf("%")>=0;return!f&&!m&&(h=`${h}px`),h},checkHeader:d=>{n.isHeaderChecked=!!d.length&&d.every(f=>f.checked);const h=d.filter(f=>f.uncheckable);if(h.length){const f=d.filter(p=>p.checked),m=d.every(p=>h.includes(p));n.isHeaderChecked=!m&&h.length+f.length===d.length,n.isHeaderUncheckable=m}n.isHeaderIndeterminate=!!d.length&&d.some(f=>f.checked||f.indeterminate)&&!n.isHeaderChecked}}},ai=e=>{const{originColumns:t,filteredColumns:n}=e;return t.map(o=>{const s=n.find(l=>l.index===o.index)??{};return{...o,...s}})},TS=e=>{const{scrollInfo:t,stores:n,elementInfo:o,resizeInfo:s,pageInfo:l,summaryScroll:a,getPagingData:r,updatePagingInfo:c}=e,d=m=>{let p=n.showTreeStore;l.isClientPaging&&(p=r());const g=o.body;if(g){const u=s.rowHeight,x=g.clientHeight>u?Math.ceil(g.clientHeight/u):p.length,b=p.length*u;let y=Math.floor(g.scrollTop/u);y>p.length-1&&(y=0);const w=y+x+1,I=Math.max(y,0),E=w,B=o.table;n.viewStore=p.slice(I,E),t.hasVerticalScrollBar=x<p.length||g.clientHeight<B.clientHeight,t.vScrollTopHeight=I*u,t.vScrollBottomHeight=b-n.viewStore.length*u-t.vScrollTopHeight,m&&l.isInfinite&&t.vScrollBottomHeight===0&&(l.prevPage=l.currentPage,l.currentPage=Math.ceil(E/l.perPage)+1,l.startIndex=E,c({onScrollEnd:!0}))}},h=()=>{const m=o.header,p=o.body,g=o.table;m.scrollLeft=p.scrollLeft,a.value=p.scrollLeft,t.hasHorizontalScrollBar=p.clientWidth<g.clientWidth};return{updateVScroll:d,updateHScroll:h,onScroll:()=>{const m=o.body,p=m.scrollTop,g=m.scrollLeft,u=t.lastScroll.top,x=t.lastScroll.left,b=g!==x;p!==u&&m.clientHeight&&d(!0),b&&h(),t.lastScroll.top=p,t.lastScroll.left=g}}},BS=e=>{const{props:t,emit:n}=i.getCurrentInstance(),{resizeInfo:o,elementInfo:s,checkInfo:l,stores:a,isRenderer:r,updateVScroll:c,updateHScroll:d,contextInfo:h}=e,f=()=>{a.viewStore=a.showTreeStore;const u=a.viewStore;let x=o.columnWidth;o.columnWidth>0&&(x=o.columnWidth),x=o.columnWidth;let b=0;if(o.adjust&&s.body){const y=s.body;let w=y.offsetWidth;const I=y.offsetHeight,E=a.orderedColumns.reduce((B,_)=>(_.hide||_.hiddenDisplay||(_.width?B.totalWidth+=_.width:B.emptyCount++),B),{totalWidth:h.customContextMenu.length?30:0,emptyCount:0});if(o.rowHeight*u.length>I-o.scrollWidth&&(w-=o.scrollWidth),l.useCheckbox.use&&(w-=o.minWidth),x=w-E.totalWidth,x>0){const B=E.emptyCount===0?0:Math.floor(x/E.emptyCount);b=x-B*E.emptyCount,x=E.emptyCount!==0?B:x}else x=o.columnWidth;x=x<o.minWidth?o.minWidth:x,o.columnWidth=x}if(a.orderedColumns.forEach(y=>{const w=r(y)?o.rendererMinWidth:o.minWidth;y.width&&y.width<w&&(y.width=w),!y.width&&!y.hide&&(y.width=x)}),b&&a.orderedColumns.length){let y=a.orderedColumns.length-1,w=a.orderedColumns[y];for(;y>0&&w&&(w.hide||w.hiddenDisplay);)y-=1,w=a.orderedColumns[y];w&&(w.width+=b)}o.isResize=!o.isResize},m=()=>{i.nextTick(()=>{var u,x;o.adjust&&a.orderedColumns.forEach(b=>{var w;const y=b;return!((w=t.columns[b.index])!=null&&w.width)&&!y.resized&&(y.width=0),y},void 0),f(),(u=s.body)!=null&&u.clientHeight&&c(),(x=s.body)!=null&&x.clientWidth&&d()})};return{calculatedColumn:f,onResize:m,onShow:u=>{u&&m()},onColumnResize:(u,x)=>{const b=s.header,y=s.body,w=b.getBoundingClientRect().left,I=b.querySelector(`li[data-index="${u}"]`),E=r(a.orderedColumns[u])?o.rendererMinWidth:o.minWidth,B=I.getBoundingClientRect(),_=y.getBoundingClientRect().right-w,C=s.resizeLine,S=B.left-w+E,M=B.right-w,k=x.clientX,T=B.left-w;y.style.overflow="auto",C.style.left=`${M}px`,o.showResizeLine=!0;const R=N=>{const v=N.clientX-k,O=M+v;let D=Math.max(S,O);D=Math.min(_,D),C.style.left=`${D}px`},L=()=>{const v=parseInt(C.style.left,10)-T;a.orderedColumns[u]&&(a.orderedColumns[u].width=v,a.orderedColumns[u].resized=!0),o.showResizeLine=!1,document.removeEventListener("mousemove",R),m();const O=ai(a);n("resize-column",{column:a.orderedColumns[u],columns:O}),n("change-column-info",{type:"resize",columns:O})};document.addEventListener("mousemove",R),document.addEventListener("mouseup",L,{once:!0})}}},DS=e=>{const{emit:t}=i.getCurrentInstance(),n=e,o=(r,c)=>{var f;const d=r.target.tagName.toLowerCase();let h={};return r.target.offsetParent&&(d==="td"?h=r.target.dataset:h=((f=r.target.closest("td"))==null?void 0:f.dataset)??{}),{event:r,rowData:c,rowIndex:c.index,cellName:h.name,cellIndex:h.index}};let s=null;return{onRowClick:(r,c)=>{var d,h;return r.target&&r.target.parentElement&&(r.target.parentElement.classList.contains("row-checkbox-input")||(h=(d=r.target.closest("td"))==null?void 0:d.classList)!=null&&h.contains("row-contextmenu"))?!1:(clearTimeout(s),s=setTimeout(()=>{n.useSelect&&(c.selected?(c.selected=!1,n.multiple?r.ctrlKey?n.selectedRow=n.selectedRow.filter(f=>f.index!==c.index):n.selectedRow=[c]:n.selectedRow=[]):(c.selected=!0,r.ctrlKey&&n.multiple&&(!n.limitCount||n.limitCount>n.selectedRow.length)?n.selectedRow.push(c):n.selectedRow=[c]),t("update:selected",n.selectedRow),t("click-row",o(r,c)))},100),!0)},onRowDblClick:(r,c)=>{clearTimeout(s),t("dblclick-row",o(r,c))}}},OS=e=>{const{checkInfo:t,stores:n,checkHeader:o,pageInfo:s,getPagingData:l}=e,{emit:a}=i.getCurrentInstance(),r=()=>t.useCheckbox.mode==="each",c=p=>{const g=n.treeStore.findIndex(u=>u.index===p.index);g!==-1&&(n.treeStore[g].checked=p.checked)},d=p=>{r()||p.hasChild&&p.children.forEach(g=>{const u=g;p.checked&&!u.checked&&!u.uncheckable&&t.checkedRows.push(u),p.checked||(t.checkedRows=t.checkedRows.filter(x=>x.index!==u.index)),u.checked=p.checked&&!u.uncheckable,u.hasChild&&d(u)})},h=p=>{if(r())return;const g=p.parent;if(g){const u=g.children.every(b=>b.checked);g.checked=u&&!g.uncheckable;const x=g.children.filter(b=>b.uncheckable);if(x.length){const b=g.children.filter(y=>y.checked);x.length+b.length===g.children.length&&(g.checked=!0)}g.indeterminate=!u&&g.children.some(b=>b.checked||b.indeterminate),g.checked?t.checkedRows.push(g):t.checkedRows=t.checkedRows.filter(b=>b.index!==g.index),g.parent&&h(g)}};return{onCheck:(p,g)=>{let u=n.store;s.isClientPaging&&(u=l());const x=()=>t.useCheckbox.mode==="single",b=()=>{t.isHeaderChecked&&(t.isHeaderChecked=!1)},y=()=>{x()&&t.checkedRows.length>0&&(t.prevCheckedRow.checked=!1,c(t.prevCheckedRow))},w=E=>{if(x()){t.checkedRows=[E];return}d(E),h(E),t.checkedRows.push(E),E.indeterminate=!1},I=E=>{if(x()){t.checkedRows=[];return}t.checkedRows=t.checkedRows.filter(B=>B.index!==E.index)};y(),g.checked?(w(g),o(u)):(b(),I(g),d(g),h(g)),t.prevCheckedRow=g,a("update:checked",t.checkedRows),a("check-row",p,g.index,g)},onCheckAll:p=>{var x;const g=t.isHeaderChecked;let u=(x=n.store)==null?void 0:x.filter(b=>b.isFilter);s.isClientPaging&&(u=l()),u.forEach(b=>{b.checked=g&&!b.uncheckable,b.checked?t.checkedRows.find(y=>y.index===b.index)||t.checkedRows.push(b):t.checkedRows=t.checkedRows.filter(y=>y.index!==b.index),b.indeterminate=!1}),t.isHeaderIndeterminate=!1,a("update:checked",t.checkedRows),a("check-all",p,t.checkedRows)}}},RS=e=>{const{emit:t}=i.getCurrentInstance(),{contextInfo:n,stores:o,selectInfo:s,useGridSetting:l,columnSettingInfo:a,setColumnHidden:r,onSort:c}=e,d=(p=!0)=>{const g=[];if(p&&n.customContextMenu.length){const u=s.selectedRow,x=n.customContextMenu.map(b=>{const y=b;return y.validate&&(y.disabled=!y.validate(y.itemId,u)),y.selectedRow=u??[],y});g.push(...x)}n.contextMenuItems=g};return{setContextMenu:d,onContextMenu:p=>{var x,b;const u=(b=(x=p.target.closest(".row"))==null?void 0:x.dataset)==null?void 0:b.index;if(u){const y=o.viewStore.findIndex(I=>I.index===Number(u)),w=o.viewStore[y];s.selectedRow=[w],d(),t("update:selected",s.selectedRow)}else s.selectedRow=[],d(!1),t("update:selected",[])},onColumnContextMenu:(p,g)=>{var u,x,b,y,w,I;if(p.target.className.includes("column-name")){const E=!!g.sortable;n.columnMenuItems=[{text:((u=n.columnMenuTextInfo)==null?void 0:u.hide)??"Hide",iconClass:"ev-icon-visibility-off",disabled:!l.value||o.orderedColumns.length===1||!!g.fixed,hidden:((x=n.hiddenColumnMenuItem)==null?void 0:x.hide)||!l.value,click:()=>{r(g.field),t("change-column-status",{columns:o.updatedColumns}),t("change-column-info",{type:"display",columns:o.updatedColumns})}},{text:((b=n.columnMenuTextInfo)==null?void 0:b.ascending)??"Ascending",iconClass:"ev-icon-allow2-up",disabled:!E,hidden:(y=n.hiddenColumnMenuItem)==null?void 0:y.ascending,click:()=>c(g,"asc")},{text:((w=n.columnMenuTextInfo)==null?void 0:w.descending)??"Descending",iconClass:"ev-icon-allow2-down",disabled:!E,hidden:(I=n.hiddenColumnMenuItem)==null?void 0:I.descending,click:()=>c(g,"desc")}]}else n.columnMenuItems.length=0},onGridSettingContextMenu:p=>{const{useDefaultColumnSetting:g,columnSettingTextInfo:u}=a,x={text:(u==null?void 0:u.title)??"Column List",isShowMenu:!0,click:()=>{a.isShowColumnSetting=!0,n.isShowMenuOnClick=!0}};n.customGridSettingContextMenu.length&&(n.gridSettingContextMenuItems=[...n.customGridSettingContextMenu]),g&&n.gridSettingContextMenuItems.push(x),n.gridSettingMenu.show(p)}}},NS=e=>{const{emit:t}=i.getCurrentInstance(),{stores:n,onResize:o}=e,s=()=>{let r=0;const c=[];function d(f){const m={};return Object.keys(f).forEach(p=>{p!=="children"&&(m[p]=f[p])}),m}function h(f){const{node:m,level:p,isShow:g,parent:u,uncheckable:x}=f;m!==null&&typeof m=="object"&&(m.index=r++,m.level=p,Object.hasOwnProperty.call(m,"checked")||(m.checked=!1),Object.hasOwnProperty.call(m,"selected")||(m.selected=!1),Object.hasOwnProperty.call(m,"show")||(m.show=g),Object.hasOwnProperty.call(m,"expand")||(m.expand=!0),Object.hasOwnProperty.call(m,"isFilter")||(m.isFilter=!1),Object.hasOwnProperty.call(m,"uncheckable")||(m.uncheckable=x),Object.hasOwnProperty.call(m,"indeterminate")||(m.indeterminate=!1),Object.hasOwnProperty.call(m,"data")||(m.data=d(m)),c.push(m),Object.hasOwnProperty.call(m,"parent")||(m.parent=u),m.children&&(m.hasChild=!0,m.children.forEach(b=>h({node:b,level:p+1,isShow:m.show&&m.expand,parent:m,uncheckable:m.uncheckable}))))}return n.treeRows.forEach(f=>{h({node:f,level:0,isShow:!0,parent:void 0,uncheckable:!1})}),c},l=(r,c,d)=>{r.forEach(h=>{const f=h;f.show=d&&c?f.isFilter:c,f.hasChild&&l(f.children,f.show&&f.expand,f.isFilter)})};return{setTreeNodeStore:s,handleExpand:r=>{const c=!r.expand,d=r;d.expand=!d.expand,l(d.children,d.expand,d.isFilter),t("toggle-row",{row:d,isExpand:c}),o()}}},LS=e=>{const{stores:t,filterInfo:n,pageInfo:o,getConvertValue:s,onResize:l,checkHeader:a,getPagingData:r,updatePagingInfo:c}=e,d=p=>{if(!(p!=null&&p.parent))return;const{parent:g}=p;g.show=!0,g.isFilter=!0,d(g)},h=p=>{if(!(p!=null&&p.children))return;const{children:g}=p;g.forEach(u=>{const x=u;x.parent.show&&x.parent.expand?x.show=!0:x.show=!1,x.isFilter=!0,x.hasChild&&h(x)})};let f=null;return{onSearch:p=>{f&&clearTimeout(f),f=setTimeout(()=>{n.isSearch=!1,n.searchWord=p;const g=t.treeStore;g.forEach(u=>{u.show=!1,u.isFilter=!1}),p?(g.filter(x=>{let b=!1;for(let y=0;y<t.orderedColumns.length;y++){const w=t.orderedColumns[y]||{};let I=x[w.field]??null;if(w.type=w.type||"string",I!==null&&!w.hide&&((w==null?void 0:w.searchable)===void 0||w!=null&&w.searchable)&&(I=s(w,I).toString(),b=I.toLowerCase().includes(p.toString().toLowerCase()),b))break}return b}).forEach(x=>{x.show=!0,x.parent&&!x.parent.expand&&(x.show=!1),x.isFilter=!0,d(x),h(x)}),n.isSearch=!0):(g.forEach(u=>{u.show=!0,u.isFilter=!1}),g.forEach(u=>{d(u),h(u)})),!p&&o.isClientPaging&&o.prevPage&&(o.currentPage=1,t.pagingStore=r()),c({onSearch:!0}),a(t.store),l()},500)}}},_S=e=>{const{emit:t}=i.getCurrentInstance(),{stores:n,pageInfo:o,sortInfo:s,filterInfo:l,elementInfo:a,clearCheckInfo:r}=e,c=()=>{const f=(o.currentPage-1)*o.perPage,m=parseInt(f,10)+parseInt(o.perPage,10);return n.showTreeStore.slice(f,m)},d=f=>{t("page-change",{eventName:f,pageInfo:{currentPage:o.currentPage,prevPage:o.prevPage,startIndex:o.startIndex,total:o.pageTotal,perPage:o.perPage},sortInfo:{field:s.sortField,order:s.sortOrder},searchInfo:{searchWord:l.searchWord,searchColumns:n.orderedColumns.filter(m=>!m.hide&&((m==null?void 0:m.searchable)===void 0||(m==null?void 0:m.searchable))).map(m=>m.field)}}),o.isInfinite&&(f!=null&&f.onSearch||f!=null&&f.onSort)&&(o.currentPage=1,a.body.scrollTop=0,r())};return{getPagingData:c,updatePagingInfo:d,changePage:f=>{if(o.isClientPaging)if(o.prevPage=f,n.showTreeStore.length<=o.perPage)n.pagingStore=n.showTreeStore;else{const m=(o.currentPage-1)*o.perPage,p=parseInt(m,10)+parseInt(o.perPage,10);n.pagingStore=n.showTreeStore.slice(m,p),a.body.scrollTop=0,o.startIndex=m}d({onChangePage:!0})}}},VS=({sortInfo:e,stores:t})=>{const{emit:n}=i.getCurrentInstance(),o=(f=!0)=>f?["asc","desc","init"]:["asc","desc"];function s(){this.orders=o(),this.dequeue=()=>this.orders.shift(),this.enqueue=f=>this.orders.push(f)}const l=(f,m="init")=>{t.orderedColumns.forEach(p=>{p.index===(f==null?void 0:f.index)&&m?p.sortOption={sortType:m}:p.sortOption={sortType:"init"}})},a=()=>{const f=t.originColumns.filter(m=>m.hiddenDisplay||m.hide);f.length&&f.forEach(m=>{m.sortOption={sortType:"init"}})},r=new s;return{onSort:(f,m)=>{if(f.sortable===void 0?!0:f.sortable){e.sortColumn=f,e.sortField!==(f==null?void 0:f.field)&&(r.orders=o(),e.sortField=f==null?void 0:f.field),m&&(r.orders=o(),m==="desc"&&(e.sortOrder=r.dequeue(),r.enqueue(e.sortOrder))),e.sortOrder=r.dequeue(),r.enqueue(e.sortOrder),a(),l(f,e.sortOrder);const g=ai(t);n("sort-column",{field:e.sortField,order:e.sortOrder,column:e.sortColumn,columns:g}),n("change-column-info",{type:"sort",columns:g})}},setSortInfo:(f,m=!0)=>{const p=f==null?void 0:f.findIndex(x=>{var b;return(x==null?void 0:x.sortable)&&((b=x==null?void 0:x.sortOption)==null?void 0:b.sortType)&&x.sortOption.sortType!=="init"}),g=f[p];p>-1&&(g.index=p);const{sortType:u}=(g==null?void 0:g.sortOption)||{};e.sortColumn=g,e.sortField=g==null?void 0:g.field,e.isSorting=!!u,e.sortOrder=u,l(g,u),m&&n("change-column-info",{type:"sort",columns:ai(t)})},initSortInfo:f=>{e.isSorting=!1,e.sortOrder="init",f.forEach(m=>{var p;(p=m==null?void 0:m.sortOption)!=null&&p.sortType&&m.sortOption.sortType!=="init"&&(m.sortOption.sortType="init")})}}},PS={name:"EvTreeGrid",components:{TreeGridNode:wS,Toolbar:IS,GridPagination:pr,GridSummary:wr,ColumnSetting:kr,GridSortButton:Mr,GridOptionButton:Ns},directives:{observeVisibility:$i,resize:wn},props:{columns:{type:[Array],default:()=>[]},rows:{type:[Array,Object],default:()=>null},width:{type:[String,Number],default:"100%"},height:{type:[String,Number],default:"100%"},selected:{type:[Array],default:()=>[]},checked:{type:[Array],default:()=>[]},option:{type:Object,default:()=>({})},expandIcon:{type:String,default:""},collapseIcon:{type:String,default:""}},emits:{"update:selected":null,"update:checked":null,"click-row":null,"dblclick-row":null,"check-row":null,"check-all":null,"page-change":null,"sort-column":null,"toggle-row":null,"resize-column":({column:e,columns:t})=>({column:e,columns:t}),"change-column-status":({columns:e})=>({columns:e}),"change-column-info":({type:e,columns:t})=>({type:e,columns:t})},setup(e){var ri,ci,di,hi,fi,ui,mi,qt,gn;const t=i.ref(null),n=i.computed(()=>{var W,oe;return((oe=(W=e.option)==null?void 0:W.useGridSetting)==null?void 0:oe.use)||!1}),o=i.computed(()=>{var W;return((W=e.option)==null?void 0:W.useSummary)||!1}),s=i.computed(()=>e.option.emptyText??"No records"),l=i.reactive({body:null,header:null,table:null,resizeLine:null,"grid-wrapper":null}),a=i.reactive({isSearch:!1,searchWord:""}),r=i.reactive({isShowColumnSetting:!1,isFilteringColumn:!1,visibleColumnIdx:[],hiddenColumn:"",columnSettingPosition:{top:0,left:0,columnListMenuWidth:0},useDefaultColumnSetting:i.computed(()=>{var W,oe;return((oe=(W=e.option)==null?void 0:W.useGridSetting)==null?void 0:oe.useDefaultColumnSetting)??!0}),columnSettingTextInfo:{title:((ci=(ri=e.option)==null?void 0:ri.useGridSetting)==null?void 0:ci.columnMenuText)??"Column List",search:((hi=(di=e.option)==null?void 0:di.useGridSetting)==null?void 0:hi.searchText)??"Search",empty:((ui=(fi=e.option)==null?void 0:fi.useGridSetting)==null?void 0:ui.emptyText)??"No records",ok:((qt=(mi=e.option)==null?void 0:mi.useGridSetting)==null?void 0:qt.okBtnText)??"OK"}}),c=i.reactive({treeStore:[],viewStore:[],filterStore:[],pagingStore:[],originStore:[],showTreeStore:i.computed(()=>c.treeStore.filter(W=>W.show)),searchStore:i.computed(()=>c.treeStore.filter(W=>W.isFilter)),store:i.computed(()=>a.isSearch?c.searchStore:c.treeStore),treeRows:e.rows,filteredColumns:[],originColumns:i.computed(()=>e.columns.map((W,oe)=>{var he;return{index:oe,hiddenDisplay:!1,...W,width:isFinite(W.width)?W.width:void 0,sortOption:{sortType:((he=W==null?void 0:W.sortOption)==null?void 0:he.sortType)||"init"}}})),orderedColumns:i.computed(()=>c.filteredColumns.length?c.filteredColumns:c.originColumns),updatedColumns:i.computed(()=>ai(c))}),d=i.reactive({usePage:i.computed(()=>{var W;return((W=e.option.page)==null?void 0:W.use)||!1}),useClient:((gn=e.option.page)==null?void 0:gn.useClient)||!1,isInfinite:i.computed(()=>{var W;return((W=e.option.page)==null?void 0:W.isInfinite)||!1}),startIndex:0,prevPage:0,currentPage:0,pageTotal:i.computed(()=>{var W;return((W=e.option.page)==null?void 0:W.total)||0}),perPage:i.computed(()=>{var W;return((W=e.option.page)==null?void 0:W.perPage)||20}),visiblePage:i.computed(()=>{var W;return((W=e.option.page)==null?void 0:W.visiblePage)||8}),order:i.computed(()=>{var W;return((W=e.option.page)==null?void 0:W.order)||"center"}),showPageInfo:i.computed(()=>{var W;return((W=e.option.page)==null?void 0:W.showPageInfo)||!1}),isClientPaging:i.computed(()=>d.useClient&&d.usePage&&!d.isInfinite),isHighlight:!1,highlightPage:0}),h=i.reactive({prevCheckedRow:[],isHeaderChecked:!1,isHeaderUncheckable:!1,isHeaderIndeterminate:!1,checkedRows:e.checked,useCheckbox:i.computed(()=>e.option.useCheckbox||{})}),{isRenderer:f,getComponentName:m,getConvertValue:p,getColumnIndex:g,setPixelUnit:u,checkHeader:x}=vS({checkInfo:h}),b=i.reactive({lastScroll:{top:0,left:0},vScrollTopHeight:0,vScrollBottomHeight:0,hasVerticalScrollBar:!1,hasHorizontalScrollBar:!1}),y=i.reactive({selectedRow:e.selected,useSelect:i.computed(()=>{var W,oe;return((oe=(W=e.option)==null?void 0:W.useSelection)==null?void 0:oe.use)??!0}),limitCount:i.computed(()=>{var oe,he;let W=(he=(oe=e.option)==null?void 0:oe.useSelection)==null?void 0:he.limitCount;return W=W&&W>=2?W:0,W}),multiple:i.computed(()=>{var W,oe;return((oe=(W=e.option)==null?void 0:W.useSelection)==null?void 0:oe.multiple)??!1})}),w=i.reactive({isSorting:!1,sortField:"",sortOrder:"",sortColumn:{},sortFunction:e.option.customAscFunction??{}}),I=i.reactive({menu:null,contextMenuItems:[],contextMenuClass:e.option.customContextMenuClass||"",columnMenu:null,columnMenuItems:[],columnMenuTextInfo:e.option.columnMenuText||{},hiddenColumnMenuItem:e.option.hiddenColumnMenuItem||{},customContextMenu:e.option.customContextMenu||[],gridSettingMenu:null,gridSettingContextMenuItems:[],customGridSettingContextMenu:i.computed(()=>{var W,oe;return((oe=(W=e.option)==null?void 0:W.useGridSetting)==null?void 0:oe.customContextMenu)||[]}),isShowMenuOnClick:!1}),E=i.reactive({minWidth:40,rendererMinWidth:80,showResizeLine:!1,adjust:e.option.adjust||!1,columnWidth:e.option.columnWidth||80,scrollWidth:e.option.scrollWidth||17,rowHeight:i.computed(()=>e.option.rowHeight||35),gridWidth:i.computed(()=>e.width?u(e.width):"100%"),gridHeight:i.computed(()=>e.height?u(e.height):"100%"),isResize:!1}),B=i.reactive({showHeader:i.computed(()=>e.option.showHeader===void 0?!0:e.option.showHeader),stripeStyle:i.computed(()=>{var W;return((W=e.option.style)==null?void 0:W.stripe)||!1}),borderStyle:i.computed(()=>{var W;return((W=e.option.style)==null?void 0:W.border)||""}),highlightIdx:i.computed(()=>{var W;return((W=e.option.style)==null?void 0:W.highlight)??-1})}),_=()=>{y.selectedRow.length=0,c.store.forEach(W=>{W.selected=!1})},C=()=>{h.isHeaderChecked=!1,h.isHeaderIndeterminate=!1,h.checkedRows.length=0,c.store.forEach(W=>{W.checked=!1,W.indeterminate=!1})},{getPagingData:S,updatePagingInfo:M,changePage:k}=_S({stores:c,pageInfo:d,sortInfo:w,filterInfo:a,elementInfo:l,clearCheckInfo:C}),T=i.ref(0),{updateVScroll:R,updateHScroll:L,onScroll:N}=TS({scrollInfo:b,stores:c,elementInfo:l,resizeInfo:E,pageInfo:d,summaryScroll:T,getPagingData:S,updatePagingInfo:M}),{onRowClick:v,onRowDblClick:O}=DS(y),{onCheck:D,onCheckAll:V}=OS({checkInfo:h,stores:c,checkHeader:x,pageInfo:d,getPagingData:S}),{calculatedColumn:P,onResize:A,onShow:F,onColumnResize:X}=BS({resizeInfo:E,elementInfo:l,checkInfo:h,stores:c,isRenderer:f,updateVScroll:R,updateHScroll:L,contextInfo:I}),{setTreeNodeStore:U,handleExpand:H}=NS({stores:c,onResize:A}),{onSort:$,initSortInfo:j,setSortInfo:K}=VS({sortInfo:w,stores:c}),{onSearch:q}=LS({stores:c,filterInfo:a,pageInfo:d,getConvertValue:p,onResize:A,checkHeader:x,getPagingData:S,updatePagingInfo:M}),{setPositionColumnSetting:Q,initColumnSettingInfo:J,onApplyColumn:ee,setColumnHidden:G}=Er({stores:c,columnSettingInfo:r,contextInfo:I,onSearch:q,onResize:A}),{setContextMenu:ne,onContextMenu:Z,onColumnContextMenu:re,onGridSettingContextMenu:me}=RS({contextInfo:I,stores:c,selectInfo:y,useGridSetting:n,columnSettingInfo:r,setColumnHidden:G,onSort:$}),ae=W=>{I.gridSettingContextMenuItems.length=0,I.customGridSettingContextMenu.length?me(W):r.isShowColumnSetting=!0},fe=W=>{var oe,he,xe,Me,Ve,Xe;W.type==="wheel"&&((oe=I.menu)==null||oe.hide(W)),W.type==="scroll"&&!((he=W.target.classList)!=null&&he.contains("table-body"))&&!((Me=(xe=W.target.offsetParent)==null?void 0:xe.classList)!=null&&Me.contains("ev-grid-column-setting"))&&(r.isShowColumnSetting=!1,I.isShowMenuOnClick=!1,(Ve=I.columnMenu)==null||Ve.hide(W),(Xe=I.gridSettingMenu)==null||Xe.hide())};i.onMounted(()=>{var W;if(c.treeStore=U(),c.originStore=Se(c.treeStore),(W=e.option)!=null&&W.useSort)K(e.columns,!1);else{const oe=I.hiddenColumnMenuItem;oe.ascending=!0,oe.descending=!0}document.addEventListener("wheel",fe,{capture:!1}),document.addEventListener("scroll",fe,{capture:!0})}),i.onUnmounted(()=>{document.removeEventListener("wheel",fe,{capture:!1}),document.removeEventListener("scroll",fe,{capture:!0})}),i.onActivated(()=>{A()}),i.watch(()=>{var W;return(W=e.option)==null?void 0:W.useSort},W=>{const oe=e.option.hiddenColumnMenuItem,he=I.hiddenColumnMenuItem;W?(he.ascending=(oe==null?void 0:oe.ascending)??!1,he.descending=(oe==null?void 0:oe.descending)??!1,K(e.columns,!1)):(he.ascending=!0,he.descending=!0,j(e.columns))}),i.watch(()=>r.isShowColumnSetting,W=>{var oe;if(!W){(oe=I.gridSettingMenu)==null||oe.hide();return}Q(t.value)}),i.watch(()=>e.columns,()=>{J()},{deep:!0,immediate:!0}),i.watch(()=>e.checked,W=>{h.checkedRows=W}),i.watch(()=>h.checkedRows,W=>{h.isHeaderChecked=!1;let oe=c.store;d.isClientPaging&&(oe=S()),oe.length&&(oe.forEach(he=>{he.checked=!!W.find(xe=>xe.index===he.index)}),x(oe)),R()}),i.watch(()=>e.selected,W=>{y.useSelect&&(y.selectedRow=W)}),i.watch(()=>y.selectedRow,W=>{y.useSelect&&(c.store.forEach(oe=>{oe.selected=!!W.find(he=>he.index===oe.index)}),R())},{deep:!0}),i.watch(()=>B.highlightIdx,async W=>{await i.nextTick();const oe=xe=>{if(!(xe!=null&&xe.children))return;const{children:Me}=xe;Me.forEach(Ve=>{const Xe=Ve;Xe.parent.show&&Xe.parent.expand?Xe.show=!0:Xe.show=!1,Xe.isFilter=!0,Xe.hasChild&&oe(Xe)})},he=xe=>{if(!(xe!=null&&xe.parent)){oe(xe);return}const{parent:Me}=xe;Me.show=!0,Me.isFilter=!0,Me.expand=!0,oe(Me),he(Me)};if(W>=0){const xe=c.store.find(Ve=>Ve.index===W);if(!xe)return;xe.show=!0,xe.isFilter=!0,he(xe);const Me=c.showTreeStore.map(Ve=>Ve.index).indexOf(xe.index);if(d.usePage&&!d.isInfinite){const Ve=Math.ceil(Me/d.perPage);if(d.highlightPage=Me===d.perPage?Ve+1:Ve||1,d.highlightPage!==d.currentPage){d.currentPage=d.highlightPage,d.isHighlight=!0;return}}l.body.scrollTop=E.rowHeight*Me}}),i.watch(()=>h.useCheckbox.mode,()=>{h.checkedRows=[],h.isHeaderChecked=!1}),i.watch(()=>y.useSelect,()=>{_()}),i.watch(()=>y.multiple,()=>{_()}),i.watch(()=>e.rows,W=>{c.treeRows=W,c.treeStore=U(),A()},{deep:!0}),i.watch(()=>c.treeStore.length,()=>{x(c.store)}),i.watch(()=>[e.width,e.height,e.option.columnWidth],()=>{e.option.columnWidth!=null&&(E.columnWidth=e.option.columnWidth),c.orderedColumns.map(W=>{var he;const oe=W;return!((he=e.columns[W.index])!=null&&he.width)&&!oe.resized&&(oe.width=0),oe}),A()}),i.watch(()=>e.option.searchValue,W=>{i.nextTick(()=>{W!==void 0&&(q((W==null?void 0:W.value)??W),d.isClientPaging&&(C(),_()))})},{immediate:!0}),i.watch(()=>{var W;return(W=e.option.page)==null?void 0:W.currentPage},W=>{var he;const oe=W||1;d.currentPage=(he=e.option.page)!=null&&he.isInfinite?1:oe},{immediate:!0}),i.watch(()=>d.currentPage,(W,oe)=>{i.nextTick(()=>{if(k(oe),d.isClientPaging&&W!==oe&&(C(),_()),R(),W===d.highlightPage&&d.isHighlight){const he=c.pagingStore.map(xe=>xe.index).indexOf(B.highlightIdx);l.body.scrollTop=E.rowHeight*he,d.isHighlight=!d.isHighlight}})});const ke=()=>({"column-sort__icon":!0,"column-sort__icon--asc":w.sortOrder==="asc","column-sort__icon--desc":w.sortOrder==="desc"}),jt=i.computed(()=>({width:E.gridWidth,height:E.gridHeight})),Gt=i.computed(()=>({"table-body":!0,stripe:B.stripeStyle,"bottom-border":!!c.viewStore.length,"non-border":!!B.borderStyle})),mt=i.computed(()=>({table:!0,"ev-grid":!0,"ev-tree-grid":!0,adjust:E.adjust,"non-header":!B.showHeader,"ev-tree-grid--empty":!c.viewStore.length})),ho=i.computed(()=>({"table-header":!0,"non-border":!!B.borderStyle})),fo=i.computed(()=>({column:!0,"checkbox-all":!0,"non-border":!!B.borderStyle})),uo=i.computed(()=>h.useCheckbox.use&&h.useCheckbox.headerCheck&&h.useCheckbox.mode!=="single"),Zt=W=>({column:!0,render:f(W),"non-border":!!B.borderStyle,[W.field]:W.field}),Ps=(W,oe)=>{const he=f(W);return{width:`${W.width}px`,"min-width":he?`${E.rendererMinWidth}px;`:`${E.minWidth}px`,"margin-right":c.orderedColumns.length-1===oe&&b.hasVerticalScrollBar&&b.hasHorizontalScrollBar?`${E.scrollWidth}px`:"0px","border-right":c.orderedColumns.length-1===oe?"none":"1px solid #CFCFCF"}},As=W=>`${W}Node`;return{summaryScroll:T,gridStyle:jt,gridClass:mt,headerClass:ho,headerCheckboxClass:fo,isHeaderCheckbox:uo,bodyStyle:Gt,useSummary:o,useGridSetting:n,toolbarRef:t,stores:c,emptyText:s,...i.toRefs(B),...i.toRefs(l),...i.toRefs(c),...i.toRefs(a),...i.toRefs(b),...i.toRefs(E),...i.toRefs(y),...i.toRefs(h),...i.toRefs(w),...i.toRefs(I),...i.toRefs(d),...i.toRefs(r),isRenderer:f,getComponentName:m,getConvertValue:p,getColumnIndex:g,setPixelUnit:u,updateVScroll:R,updateHScroll:L,onScroll:N,calculatedColumn:P,onResize:A,onShow:F,onColumnResize:X,onRowClick:v,onRowDblClick:O,onCheck:D,onCheckAll:V,setContextMenu:ne,onContextMenu:Z,onSearch:q,handleExpand:H,getColumnClass:Zt,getColumnStyle:Ps,getSlotName:As,setGridSetting:ae,onApplyColumn:ee,onColumnContextMenu:re,onSort:$,sortIconClass:ke}}},AS={class:"column-list"},zS=["data-index"],FS=["title","onClick"],HS=["onClick"],WS=["onMousedown"],$S={ref:"table"},XS=["title"],US={key:0},YS={class:"is-empty"},jS={ref:"resizeLine",class:"table-resize-line"};function GS(e,t,n,o,s,l){var b;const a=i.resolveComponent("grid-option-button"),r=i.resolveComponent("toolbar"),c=i.resolveComponent("ev-checkbox"),d=i.resolveComponent("grid-sort-button"),h=i.resolveComponent("tree-grid-node"),f=i.resolveComponent("ev-context-menu"),m=i.resolveComponent("grid-summary"),p=i.resolveComponent("grid-pagination"),g=i.resolveComponent("column-setting"),u=i.resolveDirective("resize"),x=i.resolveDirective("observe-visibility");return i.openBlock(),i.createElementBlock(i.Fragment,null,[e.$slots.toolbar||o.useGridSetting?(i.openBlock(),i.createElementBlock("div",{key:0,ref:"toolbarRef",class:"toolbar-wrapper",style:i.normalizeStyle(`width: ${e.gridWidth};`)},[i.createVNode(r,null,{toolbarWrapper:i.withCtx(()=>[o.useGridSetting?(i.openBlock(),i.createBlock(a,{key:0,class:"grid-setting__icon",onClick:o.setGridSetting},null,8,["onClick"])):i.createCommentVNode("",!0),i.renderSlot(e.$slots,"toolbar",{item:{onSearch:o.onSearch}},void 0,!0)]),_:3})],4)):i.createCommentVNode("",!0),i.withDirectives((i.openBlock(),i.createElementBlock("div",{ref:"grid-wrapper",style:i.normalizeStyle(o.gridStyle)},[i.createElementVNode("div",{ref:"grid",class:i.normalizeClass(o.gridClass)},[i.withDirectives(i.createElementVNode("div",{ref:"header",class:i.normalizeClass(o.headerClass)},[i.createElementVNode("ul",AS,[e.useCheckbox.use?(i.openBlock(),i.createElementBlock("li",{key:0,class:i.normalizeClass(o.headerCheckboxClass),style:i.normalizeStyle({width:`${e.minWidth}px`,"border-right":"1px solid #CFCFCF"})},[o.isHeaderCheckbox?(i.openBlock(),i.createBlock(c,{key:0,modelValue:e.isHeaderChecked,"onUpdate:modelValue":t[0]||(t[0]=y=>e.isHeaderChecked=y),disabled:e.isHeaderUncheckable,indeterminate:e.isHeaderIndeterminate,onChange:o.onCheckAll},null,8,["modelValue","disabled","indeterminate","onChange"])):i.createCommentVNode("",!0)],6)):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.orderedColumns,(y,w)=>{var I,E;return i.openBlock(),i.createElementBlock(i.Fragment,{key:w},[!y.hide&&!y.hiddenDisplay?(i.openBlock(),i.createElementBlock("li",{key:0,"data-index":w,class:i.normalizeClass(o.getColumnClass(y)),style:i.normalizeStyle(o.getColumnStyle(y,w))},[y.customHeader&&e.$slots.customHeader?i.renderSlot(e.$slots,"customHeader",{key:0},void 0,!0):(i.openBlock(),i.createElementBlock("span",{key:1,title:y.caption,class:i.normalizeClass(["column-name",{"column-name--click":o.useGridSetting}]),onClick:[B=>o.onColumnContextMenu(B,y),t[1]||(t[1]=i.withModifiers((...B)=>e.columnMenu.show&&e.columnMenu.show(...B),["prevent"]))]},[i.createTextVNode(i.toDisplayString(y.caption)+" ",1),i.createElementVNode("span",{onClick:i.withModifiers(B=>o.onSort(y),["stop"])},[e.$slots.sortIcon?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[(I=e.$props.option)!=null&&I.useSort&&(y!=null&&y.sortable)?(i.openBlock(),i.createElementBlock("span",{key:0,class:"column-sort__icon column-sort__icon--basic",style:i.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`})},[i.renderSlot(e.$slots,"sortIcon",{},void 0,!0)],4)):i.createCommentVNode("",!0),e.sortField===y.field?(i.openBlock(),i.createElementBlock("span",{key:1,class:i.normalizeClass(o.sortIconClass(y)),style:i.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`})},[i.renderSlot(e.$slots,`sortIcon_${e.sortOrder}`,{},void 0,!0)],6)):i.createCommentVNode("",!0)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[(E=e.$props.option)!=null&&E.useSort&&(y!=null&&y.sortable)?(i.openBlock(),i.createBlock(d,{key:0,class:"column-sort__icon column-sort__icon--basic",icon:"basic",style:i.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`})},null,8,["style"])):i.createCommentVNode("",!0),e.sortField===y.field?(i.openBlock(),i.createBlock(d,{key:1,class:i.normalizeClass(o.sortIconClass(y)),icon:e.sortOrder,style:i.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`,visibility:e.sortOrder?y.hidden:!0})},null,8,["class","icon","style"])):i.createCommentVNode("",!0)],64))],8,HS)],10,FS)),i.createElementVNode("span",{class:"column-resize",onMousedown:i.withModifiers(B=>o.onColumnResize(w,B),["stop","left"])},null,40,WS)],14,zS)):i.createCommentVNode("",!0)],64)}),128)),(b=e.$props.option.customContextMenu)!=null&&b.length?(i.openBlock(),i.createElementBlock("li",{key:1,class:i.normalizeClass({column:!0,"non-border":!!e.borderStyle}),style:i.normalizeStyle({width:"30px","min-width":"30px","margin-right":e.hasVerticalScrollBar||e.hasHorizontalScrollBar?`${e.scrollWidth}px`:"0px"})},null,6)):i.createCommentVNode("",!0)])],2),[[i.vShow,e.showHeader]]),i.createElementVNode("div",{ref:"body",class:i.normalizeClass(o.bodyStyle),onScroll:t[2]||(t[2]=(...y)=>o.onScroll&&o.onScroll(...y)),onContextmenu:[t[3]||(t[3]=y=>o.onContextMenu(y)),t[4]||(t[4]=i.withModifiers((...y)=>e.menu.show&&e.menu.show(...y),["prevent"]))]},[i.createElementVNode("div",{style:i.normalizeStyle(`height: ${e.vScrollTopHeight}px;`),class:"vscroll-spacer"},null,4),i.createElementVNode("table",$S,[i.createElementVNode("tbody",null,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.viewStore,(y,w)=>(i.openBlock(),i.createBlock(h,{key:w,"selected-data":e.selectedRow,"node-data":y,"use-checkbox":e.useCheckbox,"ordered-columns":e.orderedColumns,"expand-icon":n.option.expandIcon,"collapse-icon":n.option.collapseIcon,"parent-icon":n.option.parentIcon,"child-icon":n.option.childIcon,"custom-context-menu":e.customContextMenu,"menu-ref":e.menu,"is-resize":e.isResize,"row-height":e.rowHeight,"min-width":e.minWidth,"highlight-index":e.highlightIdx,"border-style":e.borderStyle,onCheckTreeData:o.onCheck,onExpandTreeData:o.handleExpand,onClickTreeData:o.onRowClick,onDblClickTreeData:o.onRowDblClick,onContextMenu:o.onContextMenu},i.createSlots({_:2},[i.renderList(e.orderedColumns,(I,E)=>({name:o.getSlotName(I.field),fn:i.withCtx(({item:B})=>[e.$slots[I.field]?i.renderSlot(e.$slots,I.field,{key:0,item:{data:B.data,fieldName:I.field}},void 0,!0):(i.openBlock(),i.createElementBlock("span",{key:1,title:o.getConvertValue(I,y[I.field])},i.toDisplayString(o.getConvertValue(I,y[I.field])),9,XS))])})),e.$slots.contextmenuIcon?{name:"contextmenuIconNode",fn:i.withCtx(()=>[i.renderSlot(e.$slots,"contextmenuIcon",{},void 0,!0)]),key:"0"}:void 0]),1032,["selected-data","node-data","use-checkbox","ordered-columns","expand-icon","collapse-icon","parent-icon","child-icon","custom-context-menu","menu-ref","is-resize","row-height","min-width","highlight-index","border-style","onCheckTreeData","onExpandTreeData","onClickTreeData","onDblClickTreeData","onContextMenu"]))),128)),e.viewStore.length?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("tr",US,[i.createElementVNode("td",YS,i.toDisplayString(o.emptyText),1)]))])],512),i.createElementVNode("div",{style:i.normalizeStyle(`height: ${e.vScrollBottomHeight}px;`),class:"vscroll-spacer"},null,4),i.createVNode(f,{ref:"menu","custom-class":e.contextMenuClass,items:e.contextMenuItems},null,8,["custom-class","items"]),i.createVNode(f,{ref:"columnMenu",items:e.columnMenuItems},null,8,["items"]),i.createVNode(f,{ref:"gridSettingMenu",items:e.gridSettingContextMenuItems,"is-show-menu-on-click":e.isShowMenuOnClick},null,8,["items","is-show-menu-on-click"])],34),i.withDirectives(i.createElementVNode("div",jS,null,512),[[i.vShow,e.showResizeLine]])],2)],4)),[[u,o.onResize],[x,{callback:o.onShow,once:!0}]]),o.useSummary?(i.openBlock(),i.createBlock(m,{key:1,"is-tree":!0,"ordered-columns":e.orderedColumns,stores:o.stores,"use-checkbox":e.useCheckbox.use,"style-option":{borderStyle:e.borderStyle,minWidth:e.minWidth,rowHeight:e.rowHeight},"scroll-left":o.summaryScroll},null,8,["ordered-columns","stores","use-checkbox","style-option","scroll-left"])):i.createCommentVNode("",!0),e.usePage&&!e.isInfinite?(i.openBlock(),i.createBlock(p,{key:2,modelValue:e.currentPage,"onUpdate:modelValue":t[5]||(t[5]=y=>e.currentPage=y),total:e.showTreeStore.length,"per-page":e.perPage,"visible-page":e.visiblePage,"show-page-info":e.showPageInfo,order:e.order},null,8,["modelValue","total","per-page","visible-page","show-page-info","order"])):i.createCommentVNode("",!0),i.createVNode(g,{"is-show":e.isShowColumnSetting,"onUpdate:isShow":t[6]||(t[6]=y=>e.isShowColumnSetting=y),"is-show-menu-on-click":e.isShowMenuOnClick,"onUpdate:isShowMenuOnClick":t[7]||(t[7]=y=>e.isShowMenuOnClick=y),columns:e.updatedColumns,"hidden-column":e.hiddenColumn,position:e.columnSettingPosition,"text-info":e.columnSettingTextInfo,onApplyColumn:o.onApplyColumn},null,8,["is-show","is-show-menu-on-click","columns","hidden-column","position","text-info","onApplyColumn"])],64)}const ro=le(PS,[["render",GS],["__scopeId","data-v-4721d54a"]]);ro.install=e=>{e.component(ro.name,ro)};const ZS={name:"PageButton",props:{page:{type:Object,required:!0},disabled:{type:Boolean,default:!1}}},qS=["aria-current"];function KS(e,t,n,o,s,l){return i.openBlock(),i.createElementBlock("span",i.mergeProps({class:{"is-current":n.page.isCurrent,"is-disabled":n.disabled||n.page.disabled,[n.page.class]:!0}},e.$attrs,{"aria-current":n.page.isCurrent,onClick:t[0]||(t[0]=i.withModifiers((...a)=>n.page.click&&n.page.click(...a),["stop"]))}),[i.renderSlot(e.$slots,"default",{},()=>[i.createTextVNode(i.toDisplayString(n.page.number),1)])],16,qS)}const JS={name:"EvPagination",components:{EvIcon:hn,pageButton:le(ZS,[["render",KS]])},props:{total:{type:[Number,String],default:0},visiblePage:{type:[Number,String],default:8},perPage:{type:[Number,String],default:20},modelValue:{type:[Number,String],default:1},showPageInfo:{type:Boolean,default:!1},order:{type:String,default:"left",validator:e=>["left","right","center"].includes(e)},pagePerJump:{type:[Number,void 0],default:void 0}},emits:{"update:modelValue":null,change:null},setup(e,{emit:t}){const n=i.computed(()=>e.visiblePage>7?e.visiblePage:7),o=i.computed(()=>e.modelValue),s=i.computed(()=>e.total===0?1:Math.ceil(e.total/e.perPage)),l=i.computed(()=>o.value>1),a=i.computed(()=>o.value<s.value),r=i.computed(()=>Math.max(o.value-e.pagePerJump,1)),c=i.computed(()=>Math.min(o.value+e.pagePerJump,s.value)),d=i.computed(()=>{const u=o.value*e.perPage-e.perPage+1;return u>=0?u:0}),h=(u,x)=>{o.value===u||u<1||u>s.value||(t("update:modelValue",u),t("change",u),x&&x.target&&i.nextTick(()=>x.target.focus()))},f=(u,x={})=>({number:u,isCurrent:x.isCurrent??o.value===u,click:b=>h(u,b),input:(b,y)=>h(+y,b),disabled:x.disabled||!1,class:x.class||""}),m=(u,x)=>{const b=[],y=u>0?u:1;for(let w=y;w<=x;w++)b.push(f(w));return b},p=i.computed(()=>{const u=parseInt(n.value,10);if(u===0)return[];const x=Math.min(Math.max(0,u)||s.value,s.value);if(s.value<=x)return m(1,s.value);const b=x%2===0?1:0,y=Math.floor(x/2),w=s.value-y+1+b;if(o.value>y&&o.value<w){const E=s.value,B=o.value-y+2,_=o.value+y-2-b,C=B-1===2?2:-1,S=_+1===E-1?_+1:-1;return[f(1),f(C),...m(B,_),f(S),f(s.value)]}else if(o.value===y){const I=o.value+y-1-b;return[...m(1,I),f(-1),f(s.value)]}else if(o.value===w){const I=o.value-y+1;return[f(1),f(-1),...m(I,s.value)]}return[...m(1,y),f(-1),...m(w,s.value)]}),g=i.computed(()=>({"justify-content":e.order,flex:"3 1 0%"}));return i.watch(()=>s.value,u=>{o.value>u&&h(u)}),i.watch(()=>o.value,(u,x)=>{s.value<u&&h(x)}),{pageCount:s,pagesInRange:p,hasPrev:l,hasNext:a,listClasses:g,firstData:d,current:o,changePage:h,getPage:f,prevJumpPage:r,nextJumpPage:c}}},QS={class:"pagination"},ew={key:0,class:"pagination-info"},tw={key:0,class:"pagination-ellipsis"},nw=["onClick"];function ow(e,t,n,o,s,l){const a=i.resolveComponent("ev-icon"),r=i.resolveComponent("page-button");return i.openBlock(),i.createElementBlock("nav",QS,[n.showPageInfo?(i.openBlock(),i.createElementBlock("small",ew,[n.perPage===1?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode(i.toDisplayString(o.firstData)+" / "+i.toDisplayString(n.total),1)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(o.firstData)+" - "+i.toDisplayString(Math.min(o.current*n.perPage,n.total))+" / "+i.toDisplayString(n.total),1)],64))])):i.createCommentVNode("",!0),i.createElementVNode("ul",{class:"pagination-list",style:i.normalizeStyle(o.listClasses)},[e.$props.pagePerJump?(i.openBlock(),i.createElementBlock("li",{key:0,class:i.normalizeClass(["step-button",{"is-disabled":!o.hasPrev}])},[i.createVNode(r,{class:"pagination-previous",disabled:!o.hasPrev,page:o.getPage(o.prevJumpPage,{isCurrent:!1})},{default:i.withCtx(()=>[i.createVNode(a,{icon:"ev-icon-s-double-left"})]),_:1},8,["disabled","page"])],2)):i.createCommentVNode("",!0),i.createElementVNode("li",{class:i.normalizeClass(["step-button",{"is-disabled":!o.hasPrev}])},[i.createVNode(r,{class:"pagination-previous",disabled:!o.hasPrev,page:o.getPage(o.current-1)},{default:i.withCtx(()=>[i.createVNode(a,{icon:"ev-icon-s-arrow-left"})]),_:1},8,["disabled","page"])],2),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.pagesInRange,(c,d)=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:d},[c.number===-1?(i.openBlock(),i.createElementBlock("li",tw,[...t[0]||(t[0]=[i.createElementVNode("span",null,"…",-1)])])):(i.openBlock(),i.createElementBlock("li",{key:1,class:i.normalizeClass({"is-current":c.isCurrent,"is-page":!0}),onClick:c.click},[i.createVNode(r,{page:c},null,8,["page"])],10,nw))],64))),128)),i.createElementVNode("li",{class:i.normalizeClass(["step-button",{"is-disabled":!o.hasNext}])},[i.createVNode(r,{class:"pagination-next",disabled:!o.hasNext,page:o.getPage(o.current+1)},{default:i.withCtx(()=>[i.createVNode(a,{icon:"ev-icon-s-arrow-right"})]),_:1},8,["disabled","page"])],2),e.$props.pagePerJump?(i.openBlock(),i.createElementBlock("li",{key:1,class:i.normalizeClass(["step-button",{"is-disabled":!o.hasNext}])},[i.createVNode(r,{class:"pagination-previous",disabled:!o.hasNext,page:o.getPage(o.nextJumpPage,{isCurrent:!1})},{default:i.withCtx(()=>[i.createVNode(a,{icon:"ev-icon-s-double-right"})]),_:1},8,["disabled","page"])],2)):i.createCommentVNode("",!0)],4)])}const co=le(JS,[["render",ow]]);co.install=e=>{e.component(co.name,co)};const iw="3.4.212",sw=[kn,Mn,sn,En,ln,an,In,vn,Bn,Dn,On,Ln,Wn,hn,Un,Yn,jn,Gn,Zn,qn,Kn,Jn,Qn,eo,no,so,lo,ao,Jo,ei,ti,ro,co],lw={version:iw,install:e=>{e&&sw.forEach(t=>{e.use(t)})}};se.EvButton=sn,se.EvButtonGroup=En,se.EvCalendar=Un,se.EvChart=so,se.EvChartBrush=ao,se.EvChartGroup=lo,se.EvCheckbox=ln,se.EvCheckboxGroup=an,se.EvContextMenu=Gn,se.EvDatePicker=Yn,se.EvGrid=no,se.EvIcon=hn,se.EvInputNumber=Ln,se.EvLoading=qn,se.EvMenu=Jn,se.EvMessage=Jo,se.EvMessageBox=ti,se.EvNotification=ei,se.EvPagination=co,se.EvProgress=Kn,se.EvRadio=In,se.EvRadioGroup=vn,se.EvScheduler=jn,se.EvSelect=Bn,se.EvSlider=Wn,se.EvTabPanel=Mn,se.EvTabs=kn,se.EvTextField=On,se.EvTimePicker=eo,se.EvToggle=Dn,se.EvTree=Qn,se.EvTreeGrid=ro,se.EvWindow=Zn,se.default=lw,Object.defineProperties(se,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});