evui 3.12.0 → 3.12.1

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.
@@ -14,4 +14,4 @@ Component that was made reactive: `,e=ye(e)),function(c,d=null,h=null,u=0,f=null
14
14
  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
15
15
  4.795L5.41508 5.5L7.00008 3.915Z" fill="#DEE2E6"></path></svg>`,1)])])):o.createCommentVNode("",!0)}const Xr=de(Y0,[["render",F0]]),A0={name:"GridOptionButton"},K0={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function _0(e,t,n,i,s,l){return o.openBlock(),o.createElementBlock("svg",K0,[...t[0]||(t[0]=[o.createElementVNode("circle",{cx:"6.49805",cy:"11.998",r:"1.5",transform:"rotate(-90 6.49805 11.998)",fill:"#ADB5BD"},null,-1),o.createElementVNode("circle",{cx:"11.998",cy:"11.998",r:"1.5",transform:"rotate(-90 11.998 11.998)",fill:"#ADB5BD"},null,-1),o.createElementVNode("path",{d:`M17.498 10.498C18.3265 10.498 18.998 11.1696 18.998 11.998C18.998
16
16
  12.8265 18.3265 13.498 17.498 13.498C16.6696 13.498 15.998 12.8265
17
- 15.998 11.998C15.998 11.1696 16.6696 10.498 17.498 10.498Z`,fill:"#ADB5BD"},null,-1)])])}const zo=de(A0,[["render",_0]]),vt=0,wn=1,me=2,di=3,Fo=4,U0=()=>{const{props:e}=o.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 u=0;u<h.length;u++)d+=r(h[u])}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=Qt(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}}},us=e=>{var i;const t=((i=e.movedColumns)!=null&&i.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}})},J0=e=>{const{scrollInfo:t,stores:n,elementInfo:i,resizeInfo:s,pageInfo:l,summaryScroll:a,getPagingData:r,updatePagingInfo:c,expandedInfo:d}=e,h=g=>{var b,w;const m=i.body,y=s.rowHeight,C=d.detailRowHeight??0;if(m){let T=n.store;l.isClientPaging&&(T=r());const k=((b=d.expandedRows)==null?void 0:b.length)??0,M=((w=d.expandedRows)==null?void 0:w.map(v=>T.findIndex(X=>X[me]===v)))??[],Z=T.length*y+k*C;let S=0,x=0;if(k)for(S=0;x+y<m.scrollTop;S++)M.includes(S)&&(x+=C),x+=y;else S=Math.floor(m.scrollTop/y),x=Math.max(S,0)*y;S>T.length-1&&(S=0);let I=0,L=0;if(k)for(let v=S;L<=m.clientHeight;v++)M.includes(v)&&(L+=C),L+=y,I+=1;else I=m.clientHeight>y?Math.ceil(m.clientHeight/y):T.length,L=I*y;const V=S+I+1,R=Math.max(S,0),E=V,G=i.table;n.viewStore=T.slice(R,E),t.hasVerticalScrollBar=I<T.length||m.clientHeight<G.clientHeight,t.vScrollTopHeight=x,t.vScrollBottomHeight=Z-L-t.vScrollTopHeight,g&&l.isInfinite&&t.vScrollBottomHeight===0&&(l.prevPage=l.currentPage,l.currentPage=Math.ceil(E/l.perPage)+1,l.startIndex=E,c({onScrollEnd:!0}))}},u=g=>{if(d.useRowDetail&&!d.detailRowHeight){let m=n.store;l.isClientPaging&&(m=r()),n.viewStore=[...m],t.vScrollTopHeight=0,t.vScrollBottomHeight=0}else h(g)},f=()=>{const g=i.header,m=i.body,y=i.table;g.scrollLeft=m.scrollLeft,a.value=m.scrollLeft,t.hasHorizontalScrollBar=m.clientWidth<y.clientWidth};return{updateVScroll:u,updateHScroll:f,onScroll:()=>{const g=i.body,m=g.scrollTop,y=g.scrollLeft,C=t.lastScroll.top,b=t.lastScroll.left,w=y!==b;m!==C&&(g!=null&&g.clientHeight)&&u(!0),w&&f(),t.lastScroll.top=m,t.lastScroll.left=y}}},j0=e=>{const{props:t,emit:n}=o.getCurrentInstance(),{resizeInfo:i,elementInfo:s,checkInfo:l,expandedInfo:a,stores:r,isRenderer:c,updateVScroll:d,updateHScroll:h,contextInfo:u}=e,f=()=>{var b;let y=i.columnWidth,C=0;if(i.adjust){const w=s.body;let T=w.offsetWidth;const k=w.offsetHeight,M=((b=w.querySelector("tr"))==null?void 0:b.offsetHeight)||i.rowHeight,Z=T-w.clientWidth,S=r.orderedColumns.reduce((x,I)=>(I.hide||I.hiddenDisplay||(I.width?x.totalWidth+=I.width:x.emptyCount++),x),{totalWidth:u.customContextMenu.length?30:0,emptyCount:0});if(M*t.rows.length>k&&(T-=Z),l.useCheckbox.use&&(T-=i.minWidth),a.useRowDetail&&(T-=i.minWidth),y=T-S.totalWidth,y>0){const x=S.emptyCount===0?0:Math.floor(y/S.emptyCount);C=y-x*S.emptyCount,y=S.emptyCount!==0?x:y}else y=i.columnWidth;y=y<i.minWidth?i.minWidth:y,i.columnWidth=y}if(r.orderedColumns.forEach(w=>{const T=c(w)?i.rendererMinWidth:i.minWidth;w.width&&w.width<T&&(w.width=T),!w.width&&!w.hide&&(w.width=y)}),C&&r.orderedColumns.length){let w=r.orderedColumns.length-1,T=r.orderedColumns[w];for(;w>0&&T&&(T.hide||T.hiddenDisplay);)w-=1,T=r.orderedColumns[w];T&&(T.width+=C)}},p=()=>{const y=new Map(t.columns.map(C=>[C.field,C.width]));o.nextTick(()=>{var C,b;i.adjust&&r.orderedColumns.forEach(w=>{const T=w;return T.resized||(T.width=y.get(T.field)??0),T},void 0),f(),(C=s.body)!=null&&C.clientHeight&&d(),(b=s.body)!=null&&b.clientWidth&&h()})};return{calculatedColumn:f,onResize:p,onShow:y=>{y&&p()},onColumnResize:(y,C)=>{C.preventDefault();const b=s.header,w=s.body,T=b.getBoundingClientRect().left,k=b.querySelector(`li[data-index="${y}"]`),M=c(r.orderedColumns[y])?i.rendererMinWidth:i.minWidth,Z=k.getBoundingClientRect(),S=s.resizeLine,x=Z.left-T+M,I=Z.right-T,L=C.clientX,V=Z.left-T;w.style.overflow="auto",S.style.left=`${I}px`,i.showResizeLine=!0;const R=G=>{const v=G.clientX-L,X=I+v,W=Math.max(x,X);S.style.left=`${W}px`},E=()=>{const v=parseInt(S.style.left,10)-V;r.orderedColumns[y]&&(r.orderedColumns[y].width=v,r.orderedColumns[y].resized=!0),i.showResizeLine=!1,document.removeEventListener("mousemove",R),p();const X=us(r);n("resize-column",{column:r.orderedColumns[y],columns:X}),n("change-column-info",{type:"resize",columns:X})};document.addEventListener("mousemove",R),document.addEventListener("mouseup",E,{once:!0})}}},Q0=e=>{const{emit:t}=o.getCurrentInstance(),{selectInfo:n,stores:i}=e,s=(d,h)=>{var p;const u=(p=d.target.tagName)==null?void 0:p.toLowerCase();let f={};return u==="td"?f=d.target.dataset:f=d.target.parentNode.dataset,{event:d,rowData:h[me],rowIndex:h[vt],cellName:f.name,cellIndex:f.index}};let l=null,a=-1;return{onRowClick:(d,h,u)=>{var g,m,y;if((g=d.target.parentElement.classList)!=null&&g.contains("row-checkbox-input"))return!1;const f=!!((y=(m=d.target.closest("td"))==null?void 0:m.classList)!=null&&y.contains("row-contextmenu")),p=(C,b,w)=>{if(C==="shift"){const T=h[vt];if(a>-1)for(let k=Math.min(T,a);k<=Math.max(T,a);k++)if(!b)i.originStore[k][di]=!0,a!==k&&n.selectedRow.push(i.originStore[k][me]);else{i.originStore[k][di]=!1;const M=n.selectedRow.indexOf(i.originStore[k][me]);M>-1&&n.selectedRow.splice(M,1)}}else C==="ctrl"&&(b?n.selectedRow.splice(n.selectedRow.indexOf(h[me]),1):n.selectedRow.push(w))};return l&&clearTimeout(l),l=setTimeout(()=>{if(n.useSelect){const C=h[me],b=h[di];h[di]=!h[di];let w="";d.shiftKey?w="shift":d.ctrlKey&&(w="ctrl"),n.multiple&&w?p(w,b,C):u||f?(n.selectedRow=[...n.selectedRow],n.selectedRow.includes(C)||(n.selectedRow=[C])):b?n.selectedRow=[]:n.selectedRow=[C],a=h[vt],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:i,getPagingData:s}=e,{props:l,emit:a}=o.getCurrentInstance(),r=h=>{const u=n.originStore.findIndex(f=>f[me]===h[me]);u!==-1&&(n.originStore[u][wn]=h[wn])};return{onCheck:(h,u)=>{if(t.useCheckbox.mode==="single"&&t.prevCheckedRow.length&&(t.prevCheckedRow=[],r(t.prevCheckedRow)),u[wn]){t.useCheckbox.mode==="single"?t.checkedRows=[u[me]]:t.checkedRows.push(u[me]);let f=n.store;i.isClientPaging&&(f=s());const p=f.filter(g=>!l.uncheckable.includes(g[me])).filter(g=>!l.disabledRows.includes(g[me])).every(g=>g[wn]);f.length&&p&&(t.isHeaderChecked=!0),t.isHeaderIndeterminate=f.length&&!p}else t.useCheckbox.mode==="single"?t.checkedRows=[]:t.checkedRows.splice(t.checkedRows.indexOf(u[me]),1),t.isHeaderChecked=!1,t.isHeaderIndeterminate=!!(n.store.length&&t.checkedRows.length);t.prevCheckedRow=u.slice(),a("update:checked",t.checkedRows),a("check-row",h,u[vt],u[me])},onCheckAll:h=>{const u=t.isHeaderChecked;let f=n.store;i.isClientPaging&&(f=s()),f.forEach(p=>{const g=l.uncheckable.includes(p[me])||l.disabledRows.includes(p[me]);u?!t.checkedRows.includes(p[me])&&!g&&t.checkedRows.push(p[me]):t.checkedRows.splice(t.checkedRows.indexOf(p[me]),1),g||(p[wn]=u)}),t.isHeaderIndeterminate=!1,a("update:checked",t.checkedRows),a("check-all",h,t.checkedRows)}}},q0=e=>{const{expandedInfo:t}=e,{emit:n}=o.getCurrentInstance();return{onExpanded:(s,l)=>{const a=l[me],r=t.expandedRows.indexOf(a);r===-1?t.expandedRows.push(a):t.expandedRows.splice(r,1),l[Fo]=!l[Fo],n("update:expanded",t.expandedRows),n("expand-row",s,l[me],l[Fo],l[vt])}}},eS=e=>{const{sortInfo:t,stores:n,updatePagingInfo:i}=e,{emit:s}=o.getCurrentInstance(),l=(m=!0)=>m?["asc","desc","init"]:["asc","desc"];function a(){this.orders=l(),this.dequeue=()=>this.orders.shift(),this.enqueue=m=>this.orders.push(m)}const r=(m,y="init")=>{n.orderedColumns.forEach(C=>{C.index===(m==null?void 0:m.index)&&y?C.sortOption={sortType:y}:C.sortOption={sortType:"init"}})},c=()=>{const m=n.originColumns.filter(y=>y.hiddenDisplay||y.hide);m.length&&m.forEach(y=>{y.sortOption={sortType:"init"}})},d=new a,h=(m,y=!0)=>{const{sortType:C}=(m==null?void 0:m.sortOption)||{};t.sortColumn=m,t.sortField=m==null?void 0:m.field,t.sortOrder=C,t.isSorting=!!C,y&&(r(m,C),s("change-column-info",{type:"sort",columns:us(n)}))},u=(m,y)=>{if(m.sortable===void 0?!0:m.sortable){t.sortColumn=m,t.sortField!==(m==null?void 0:m.field)&&(d.orders=l(),t.sortField=m==null?void 0:m.field),y&&(d.orders=l(),y==="desc"&&(t.sortOrder=d.dequeue(),d.enqueue(t.sortOrder))),t.sortOrder=d.dequeue(),d.enqueue(t.sortOrder),t.isSorting=!0,i({onSort:!0}),c(),r(m,t.sortOrder);const b=us(n);s("sort-column",{field:t.sortField,order:t.sortOrder,column:t.sortColumn,columns:b}),s("change-column-info",{type:"sort",columns:b})}},f=()=>{var I;const{field:m,index:y}=t.sortColumn||{},C=((I=t.sortFunction)==null?void 0:I[m])??null,b=(L,V)=>L>V?-1:1,w=(L,V)=>L<V?-1:1,T=(L,V)=>(L===null)-(V===null)||Number(V)-Number(L),k=(L,V)=>(L===null)-(V===null)||Number(L)-Number(V);if(t.sortOrder==="init"||!t.sortField&&!t.isSorting){n.store.sort((L,V)=>typeof L[vt]=="number"?w(L[vt],V[vt]):0);return}const M=t.sortColumn.type||"string",Z=t.sortOrder==="desc"?b:w,S=t.sortOrder==="desc"?T:k,x=(L,V)=>{var G,v;let R=L[me][y],E=V[me][y];return L[me][y]&&typeof L[me][y]=="object"&&(R=L[me][y][(G=n.originColumns[y])==null?void 0:G.field],E=V[me][y][(v=n.originColumns[y])==null?void 0:v.field]),{aCol:R,bCol:E}};if(C){n.store.sort((L,V)=>{const R=L[me][y],E=V[me][y],G=C(R,E);return t.sortOrder==="desc"?-G:G});return}switch(M){case"string":n.store.sort((L,V)=>{let{aCol:R,bCol:E}=x(L,V);if((!R||typeof R=="string")&&(!E||typeof E=="string")){R=R||"",E=E||"";const G=R.toLowerCase(),v=E.toLowerCase();if(R!==E&&G===v){const X=Array.from(R).findIndex((W,N)=>W!==E[N]);return Z(R[X],E[X])}return Z(G,v)}return 0});break;case"stringNumber":n.store.sort((L,V)=>{let{aCol:R,bCol:E}=x(L,V);return!R||typeof R=="string"||typeof R=="number"?(R=R===""?null:R,E=E===""?null:E,S(R??null,E??null)):0});break;default:n.store.sort((L,V)=>{const{aCol:R,bCol:E}=x(L,V);return!R||typeof R=="number"||typeof R=="boolean"?S(R??null,E??null):0});break}},p=()=>{var m;return(m=n.orderedColumns)==null?void 0:m.find(y=>(y==null?void 0:y.sortOption)&&l(!1).includes(y.sortOption.sortType))};return{onSort:u,getSortTarget:p,setSort:f,setSortInfo:h,hasSortTarget:()=>!!p()}},tS=e=>{const{props:t}=o.getCurrentInstance(),{columnSettingInfo:n,filterInfo:i,stores:s,checkInfo:l,pageInfo:a,getConvertValue:r,updateVScroll:c,getPagingData:d,updatePagingInfo:h,getColumnIndex:u}=e,f=k=>{let M=0;k.forEach(Z=>{const S=l.checkedRows.includes(Z[me]);Z[wn]=S,M+=S?1:0}),k.length&&(l.isHeaderChecked=k.length===M,l.isHeaderIndeterminate=k.length!==M&&M>0,l.isHeaderUncheckable=k.every(Z=>t.uncheckable.includes(Z[me])||t.disabledRows.includes(Z[me])))},p=(k,M,Z)=>{if(typeof k!="string"||M===null)return!1;const S=M==null?void 0:M.toLowerCase(),x=k==null?void 0:k.toLowerCase();let I=S.includes(x);return Z&&(Z==="start"?I=S.startsWith(x):Z==="end"&&(I=S.endsWith(x))),I},g=(k,M)=>{const Z=M.comparison,S=M.value;let x=k[me][M.index];(x||x===0)&&(x=`${k[me][M.index]}`);let I;return Z==="="?I=(S==null?void 0:S.toLowerCase())===(x==null?void 0:x.toLowerCase()):Z==="!="?I=(S==null?void 0:S.toLowerCase())!==(x==null?void 0:x.toLowerCase()):Z==="%s%"?I=p(S,x):Z==="notLike"?I=!p(S,x):Z==="s%"?I=p(S,x,"start"):Z==="%s"?I=p(S,x,"end"):Z==="isEmpty"?I=x==null||x==="":Z==="isNotEmpty"&&(I=!!x),I},m=(k,M,Z)=>{const S=M.comparison,x=Number(M.value.replace(/,/g,""));let I=Number(k[me][M.index]),L;return Z==="float"&&(I=Number(I.toFixed(3))),S==="="?L=I===x:S===">"?L=I>x:S==="<"?L=I<x:S==="<="?L=I<=x:S===">="?L=I>=x:S==="!="?L=I!==x:S==="isEmpty"?L=I==null||isNaN(I):S==="isNotEmpty"&&(L=!!I||I===0),L},y=(k,M)=>{const Z=M.comparison,S=M.value,x=`${k[me][M.index]}`;let I;return Z==="="&&(I=x===S),I},C=(k,M,Z)=>{let S=M==="string"||M==="stringNumber"?g:m;return M==="boolean"&&(S=y),k.filter(x=>S(x,Z,M))||[]},b=()=>{const k=i.filteringItemsByColumn,M=Object.keys(k),Z=s.originStore;let S=[],x=!1,I=[];M.forEach((L,V)=>{const R=k[L],E=u(L),G=t.columns[E].type,v=i.columnOperator==="or",X=V>0&&i.columnOperator==="and";R.forEach((W,N)=>{!S.length&&!x?S=C(Z,G,{...W,index:E}):X&&W.operator==="or"?N>0?S.push(...C(I,G,{...W,index:E})):S=C(I,G,{...W,index:E}):N===0&&v||N!==0&&W.operator==="or"?S.push(...C(Z,G,{...W,index:E})):S=C(S,G,{...W,index:E}),x=!0}),I=JSON.parse(JSON.stringify(S))}),x?s.filterStore=ub(S,JSON.stringify):s.filterStore=Z};let w=null;return{onSearch:k=>{w&&clearTimeout(w),w=setTimeout(()=>{i.isSearch=!1,i.searchWord=k,k&&(s.searchStore=s.store.filter(M=>{let Z=!1;const S=n.isFilteringColumn?M[me].filter((x,I)=>n.visibleColumnIdx.includes(I)):M[me];for(let x=0;x<s.orderedColumns.length;x++){const I=s.orderedColumns[x]||{};let L=S[I.index]??null;if(I.type=I.type||"string",L!==null&&(L instanceof Array?L=JSON.stringify(L):typeof L=="object"&&(L=L[I.field]),!I.hide&&((I==null?void 0:I.searchable)===void 0||I!=null&&I.searchable)&&(L=r(I,L).toString(),Z=L.toLowerCase().includes(k.toString().toLowerCase()),Z)))break}return Z}),i.isSearch=!0),f(s.store),!k&&a.isClientPaging&&a.prevPage&&(a.currentPage=1,s.pagingStore=d()),h({onSearch:!0}),c()},500)},setFilter:b,setHeaderCheckboxByFilter:f}},nS=e=>{const{contextInfo:t,stores:n,selectInfo:i,onSort:s,filterInfo:l,useGridSetting:a,columnSettingInfo:r,setColumnHidden:c}=e;let d=null;const{emit:h}=o.getCurrentInstance(),u=m=>{d&&clearTimeout(d);const y=[];d=setTimeout(()=>{if(t.customContextMenu.length){const C=t.customContextMenu.map(b=>{const w=b;return w.validate&&(w.disabled=!w.validate(w.itemId,i.selectedRow)),w.selectedRow=i.selectedRow??[],w.contextmenuInfo=i.contextmenuInfo??[],w});y.push(...C)}t.contextMenuItems=y,t.menu.show(m)},200)};return{setContextMenu:u,onContextMenu:m=>{var w,T,k;m.preventDefault();const C=(T=(w=m.target.closest(".row"))==null?void 0:w.dataset)==null?void 0:T.index;let b=null;C&&(b=(k=n.viewStore.find(M=>M[vt]===+C))==null?void 0:k[me]),b&&(i.contextmenuInfo=[b],u(m))},onColumnContextMenu:(m,y)=>{var C,b,w,T,k,M,Z,S;if(m.target.className==="column-name"){const x=y.sortable===void 0?!0:y.sortable,I=l.isFiltering&&y.filterable===void 0?!0:y.filterable,L=[{text:((C=t.columnMenuTextInfo)==null?void 0:C.ascending)??"Ascending",iconClass:"ev-icon-allow2-up",disabled:!x,hidden:(b=t.hiddenColumnMenuItem)==null?void 0:b.ascending,click:()=>s(y,"asc")},{text:((w=t.columnMenuTextInfo)==null?void 0:w.descending)??"Descending",iconClass:"ev-icon-allow2-down",disabled:!x,hidden:(T=t.hiddenColumnMenuItem)==null?void 0:T.descending,click:()=>s(y,"desc")},{text:((k=t.columnMenuTextInfo)==null?void 0:k.filter)??"Filter",iconClass:"ev-icon-filter-list",click:()=>{const V=document.documentElement.clientWidth,R=t.columnMenu.menuStyle.clientX,E=t.columnMenu.menuStyle.pageX,G=350;V<R+G&&(t.columnMenu.menuStyle.left=`${E-G}px`),l.filterSettingPosition={top:t.columnMenu.menuStyle.top,left:t.columnMenu.menuStyle.left},l.isShowFilterSetting=!0,l.filteringColumn=y,h("change-column-info",{type:"filter",columns:n.updatedColumns})},disabled:!I,hidden:((M=t.hiddenColumnMenuItem)==null?void 0:M.filter)||!l.isFiltering},{text:((Z=t.columnMenuTextInfo)==null?void 0:Z.hide)??"Hide",iconClass:"ev-icon-visibility-off",disabled:!a.value||n.orderedColumns.length===1||y.fixed,hidden:((S=t.hiddenColumnMenuItem)==null?void 0:S.hide)||!a.value,click:()=>{c(y.field),h("change-column-status",{columns:n.updatedColumns}),h("change-column-info",{type:"display",columns:n.updatedColumns})}}];if(t.columnMenuItems=[],!x&&!I&&!a.value)return;t.columnMenuItems=L.filter(V=>!V.hidden)}},onGridSettingContextMenu:m=>{const{useDefaultColumnSetting:y,columnSettingTextInfo:C}=r,b={text:(C==null?void 0:C.title)??"Column List",isShowMenu:!0,click:()=>{r.isShowColumnSetting=!0,t.isShowMenuOnClick=!0}};t.customGridSettingContextMenu.length&&(t.gridSettingContextMenuItems=[...t.customGridSettingContextMenu]),y&&t.gridSettingContextMenuItems.push(b),t.gridSettingMenu.show(m)}}},iS=e=>{const{props:t}=o.getCurrentInstance(),{selectInfo:n,checkInfo:i,stores:s,sortInfo:l,elementInfo:a,filterInfo:r,expandedInfo:c,setSort:d,setSortInfo:h,updateVScroll:u,setFilter:f}=e;return{setStore:({rows:g,isMakeIndex:m=!0,isInit:y=!1})=>{var b,w,T;const C=s.orderedColumns.find(k=>(k==null?void 0:k.sortOption)&&["asc","desc"].includes(k.sortOption.sortType));if(m){const k=[];let M=!1;g.forEach((Z,S)=>{const x=t.checked.includes(Z),I=t.uncheckable.includes(Z)||t.disabledRows.includes(Z);let L=!1;n.useSelect&&(L=t.selected.includes(Z)),!x&&!I&&(M=!0);let V=!1;c.useRowDetail&&(V=t.expanded.includes(Z));const R=t.disabledRows.includes(Z);k.push([S,x,Z,L,V,I,R])}),g.length!==t.checked.length&&(g.length===((b=t.uncheckable)==null?void 0:b.length)||g.length===((w=t.disabledRows)==null?void 0:w.length))&&(M=!0),i.isHeaderChecked=g.length>0?!M:!1,i.isHeaderIndeterminate=M&&!!i.checkedRows.length,i.isHeaderUncheckable=g.every(Z=>t.uncheckable.includes(Z)||t.disabledRows.includes(Z)),s.originStore=k}r.isFiltering&&f(),C&&y&&h(C,!1),l.sortField&&d(),(T=a.body)!=null&&T.clientHeight&&u()}}},sS=e=>{const{emit:t}=o.getCurrentInstance(),{stores:n,pageInfo:i,sortInfo:s,filterInfo:l,elementInfo:a,clearCheckInfo:r}=e,c=()=>{const u=(i.currentPage-1)*i.perPage,f=parseInt(u,10)+parseInt(i.perPage,10);return n.store.slice(u,f)},d=u=>{t("page-change",{eventName:u,pageInfo:{currentPage:i.currentPage,prevPage:i.prevPage,startIndex:i.startIndex,total:i.pageTotal,perPage:i.perPage},sortInfo:{field:s.sortField,order:s.sortOrder},searchInfo:{searchWord:l.searchWord,searchColumns:n.orderedColumns.filter(f=>!f.hide&&((f==null?void 0:f.searchable)===void 0||(f==null?void 0:f.searchable))).map(f=>f.field)}}),i.isInfinite&&(u!=null&&u.onSearch||u!=null&&u.onSort)&&(i.currentPage=1,a.body.scrollTop=0,r())};return{getPagingData:c,updatePagingInfo:d,changePage:u=>{if(i.isClientPaging)if(i.prevPage=u,n.store.length<=i.perPage)n.pagingStore=n.store;else{const f=(i.currentPage-1)*i.perPage,p=parseInt(f,10)+parseInt(i.perPage,10);n.pagingStore=n.store.slice(f,p),a.body.scrollTop=0,i.startIndex=f}d({onChangePage:!0})}}},Nr=e=>{const{props:t,emit:n}=o.getCurrentInstance(),{stores:i,columnSettingInfo:s,contextInfo:l,onSearch:a,onResize:r}=e,c=m=>{var y,C,b;if(s.isShowColumnSetting)if(s.columnSettingPosition.columnListMenuWidth=0,l.gridSettingContextMenuItems.length){const w=l.gridSettingContextMenuItems.length-1,T=(b=(C=(y=l.gridSettingMenu)==null?void 0:y.rootMenuList)==null?void 0:C.$el)==null?void 0:b.children[0].children[w].getBoundingClientRect();s.columnSettingPosition.columnListMenuWidth=T.width,s.columnSettingPosition.top=T.top,s.columnSettingPosition.left=T.right}else{const w=m==null?void 0:m.getBoundingClientRect(),T=w==null?void 0:w.height;s.columnSettingPosition.top=(w==null?void 0:w.top)+T,s.columnSettingPosition.left=w==null?void 0:w.right}},d=()=>{i.filteredColumns.length=0,s.isFilteringColumn=!1,s.visibleColumnIdx=[],s.hiddenColumn=""},h=()=>Array.isArray(i.movedColumns)&&i.movedColumns.length?i.movedColumns:i.originColumns||[],u=(m,y)=>{var b;if(!m)return;m.hiddenDisplay=y;const C=(b=i.originColumns)==null?void 0:b.find(w=>w.index===m.index);if(C&&C!==m&&(C.hiddenDisplay=y),Array.isArray(i.movedColumns)){const w=i.movedColumns.find(T=>T.index===m.index);w&&w!==m&&(w.hiddenDisplay=y)}},f=()=>{s.visibleColumnIdx=i.filteredColumns.map(C=>C.index);const m=i.originColumns.filter(C=>!C.hide||C.hiddenDisplay).map(C=>C.index),y=s.visibleColumnIdx;s.isFilteringColumn=y.length!==m.length,t.option.searchValue&&a(t.option.searchValue),r()};return{setPositionColumnSetting:c,initColumnSettingInfo:d,onApplyColumn:m=>{const y=i.orderedColumns.filter(T=>!T.hide&&!T.hiddenDisplay);if(m.length===y.length&&y.every(T=>m.includes(T.field)))return;const b=h(),w=new Set(m);i.filteredColumns=b.filter(T=>{const k=w.has(T.field)||!T.caption;return u(T,!k),k}),s.hiddenColumn="",f(),n("change-column-status",{columns:i.updatedColumns}),n("change-column-info",{type:"display",columns:i.updatedColumns})},setColumnHidden:m=>{const y=i.orderedColumns.filter(b=>!b.hide&&!b.hiddenDisplay);if(y.length===1)return;i.filteredColumns=y.filter(b=>{const w=b.field===m;return u(b,w),!w}),h().forEach(b=>{b.field===m&&u(b,!0)}),s.hiddenColumn=m,f()}}},oS=({stores:e})=>{const{emit:t}=o.getCurrentInstance(),n=r=>{var u;const c=(u=e.movedColumns)!=null&&u.length?[...e.movedColumns]:[...e.originColumns],d=[...r],h=new Set(d.map(f=>f.index));e.movedColumns=c.map(f=>h.has(f.index)?d.shift():f)},i=(r,c)=>{const d=parseInt(r,10),h=parseInt(c,10);if(!Number.isInteger(d)||!Number.isInteger(h))return;const u=[...e.orderedColumns],f=u[d];u.splice(d,1),u.splice(h,0,f),e.filteredColumns.length&&(e.filteredColumns=u),n(u)};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;i(c,d),t("change-column-order",{column:e.orderedColumns[d],columns:e.updatedColumns}),t("change-column-info",{type:"order",columns:e.updatedColumns})}}},lS={name:"EvGrid",directives:{clickoutside:Yi,observeVisibility:Qs,resize:En},components:{Toolbar:f0,GridPagination:Rr,GridSummary:Wr,ColumnSetting:Zr,FilterSetting:D0,GridSortButton:Xr,GridOptionButton:zo},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 nc,ic,sc,oc,lc,ac,rc,cc,dc;const{isRenderer:a,getComponentName:r,getConvertValue:c,getColumnIndex:d,setPixelUnit:h}=U0(),u=o.ref(null),f=o.computed(()=>{var K,ie;return((ie=(K=e.option)==null?void 0:K.useGridSetting)==null?void 0:ie.use)||!1}),p=o.computed(()=>e.option.showHeader??!0),g=o.computed(()=>{var K;return((K=e.option)==null?void 0:K.useSummary)||!1}),m=o.computed(()=>{var K;return((K=e.option.style)==null?void 0:K.stripe)||!1}),y=o.computed(()=>{var K;return((K=e.option.style)==null?void 0:K.border)||""}),C=o.computed(()=>{var K;return((K=e.option.style)==null?void 0:K.highlight)??-1}),b=o.computed(()=>e.option.emptyText??"No records"),w=e.option.rowMinHeight||35,T=o.ref(0),k=o.reactive({body:null,header:null,table:null,resizeLine:null,"grid-wrapper":null}),M=o.reactive({isSearch:!1,searchWord:"",isFiltering:o.computed(()=>e.option.useFilter??!1),isShowFilterSetting:!1,filterSettingPosition:{left:0,top:0},filteringColumn:null,filteringItemsByColumn:{},columnOperator:"and"}),Z=o.reactive({isShowColumnSetting:!1,isFilteringColumn:!1,visibleColumnIdx:[],hiddenColumn:"",columnSettingPosition:{top:0,left:0,columnListMenuWidth:0},useDefaultColumnSetting:o.computed(()=>{var K,ie;return((ie=(K=e.option)==null?void 0:K.useGridSetting)==null?void 0:ie.useDefaultColumnSetting)??!0}),columnSettingTextInfo:{title:((ic=(nc=e.option)==null?void 0:nc.useGridSetting)==null?void 0:ic.columnMenuText)??"Column List",search:((oc=(sc=e.option)==null?void 0:sc.useGridSetting)==null?void 0:oc.searchText)??"Search",empty:((ac=(lc=e.option)==null?void 0:lc.useGridSetting)==null?void 0:ac.emptyText)??"No records",ok:((cc=(rc=e.option)==null?void 0:rc.useGridSetting)==null?void 0:cc.okBtnText)??"OK"}}),S=o.reactive({viewStore:[],originStore:[],pagingStore:[],searchStore:[],filterStore:[],store:o.computed(()=>{const K=M.isFiltering?S.filterStore:S.originStore;return M.isSearch?S.searchStore:K}),filteredColumns:[],movedColumns:[],originColumns:o.computed(()=>e.columns.map((K,ie)=>{var Le;return{index:ie,hiddenDisplay:!1,...K,width:isFinite(K.width)?K.width:void 0,sortOption:{sortType:((Le=K==null?void 0:K.sortOption)==null?void 0:Le.sortType)||"init"}}})),orderedColumns:o.computed(()=>{const K=S.movedColumns.length?S.movedColumns:S.originColumns;return S.filteredColumns.length?S.filteredColumns:K}),updatedColumns:o.computed(()=>us(S))}),x=o.reactive({usePage:o.computed(()=>{var K;return((K=e.option.page)==null?void 0:K.use)||!1}),useClient:((dc=e.option.page)==null?void 0:dc.useClient)||!1,isInfinite:o.computed(()=>{var K;return((K=e.option.page)==null?void 0:K.isInfinite)||!1}),startIndex:0,prevPage:0,currentPage:0,pageTotal:o.computed(()=>{var K,ie;return(K=e.option.page)!=null&&K.useClient?S.store.length:(ie=e.option.page)==null?void 0:ie.total}),perPage:o.computed(()=>{var K;return((K=e.option.page)==null?void 0:K.perPage)||20}),visiblePage:o.computed(()=>{var K;return((K=e.option.page)==null?void 0:K.visiblePage)||8}),order:o.computed(()=>{var K;return((K=e.option.page)==null?void 0:K.order)||"center"}),showPageInfo:o.computed(()=>{var K;return((K=e.option.page)==null?void 0:K.showPageInfo)||!1}),isClientPaging:o.computed(()=>x.useClient&&x.usePage&&!x.isInfinite),isHighlight:!1,highlightPage:0}),I=o.reactive({prevCheckedRow:[],isHeaderChecked:!1,isHeaderUncheckable:!1,isHeaderIndeterminate:!1,checkedRows:e.checked,useCheckbox:o.computed(()=>e.option.useCheckbox||{})}),L=o.reactive({expandedRows:e.expanded,useRowDetail:o.computed(()=>{var K,ie;return((ie=(K=e.option)==null?void 0:K.rowDetail)==null?void 0:ie.use)??!1}),detailRowHeight:o.computed(()=>{var K,ie;return(ie=(K=e.option)==null?void 0:K.rowDetail)==null?void 0:ie.detailRowHeight})}),V=o.reactive({lastScroll:{top:0,left:0},vScrollTopHeight:0,vScrollBottomHeight:0,hasVerticalScrollBar:!1,hasHorizontalScrollBar:!1}),R=o.reactive({contextmenuInfo:e.contextmenuInfo,selectedRow:e.selected,useSelect:o.computed(()=>{var K,ie;return((ie=(K=e.option)==null?void 0:K.useSelection)==null?void 0:ie.use)??!0}),multiple:o.computed(()=>{var K,ie;return((ie=(K=e.option)==null?void 0:K.useSelection)==null?void 0:ie.multiple)??!1})}),E=o.reactive({isSorting:!1,sortField:"",sortOrder:"",sortColumn:{},sortFunction:e.option.customAscFunction??{}}),G=o.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:o.computed(()=>{var K,ie;return((ie=(K=e.option)==null?void 0:K.useGridSetting)==null?void 0:ie.customContextMenu)||[]}),isShowMenuOnClick:!1}),v=o.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:o.computed(()=>e.option.rowHeight>w?e.option.rowHeight:w),gridWidth:o.computed(()=>e.width?h(e.width):"100%"),gridHeight:o.computed(()=>e.height?h(e.height):"100%")}),X=()=>{I.checkedRows=[],I.isHeaderChecked=!1,I.isHeaderIndeterminate=!1,S.store.forEach(K=>{K[1]=!1})},W=()=>{R.selectedRow=[],S.store.forEach(K=>{K[3]=!1})},N=()=>{S.store.forEach(K=>{K[4]=!1}),L.expandedRows=[]},{getPagingData:P,updatePagingInfo:D,changePage:O}=sS({stores:S,pageInfo:x,sortInfo:E,filterInfo:M,elementInfo:k,clearCheckInfo:X}),Y=o.ref(0),{updateVScroll:H,updateHScroll:B,onScroll:z}=J0({scrollInfo:V,stores:S,elementInfo:k,resizeInfo:v,pageInfo:x,summaryScroll:Y,expandedInfo:L,getPagingData:P,updatePagingInfo:D}),{onCheck:F,onCheckAll:Q}=$0({checkInfo:I,stores:S,pageInfo:x,getPagingData:P}),{onExpanded:U}=q0({expandedInfo:L}),{onSort:ee,getSortTarget:j,setSort:te,setSortInfo:J,hasSortTarget:q}=eS({sortInfo:E,stores:S,updatePagingInfo:D}),{onSearch:$,setFilter:ae,setHeaderCheckboxByFilter:he}=tS({columnSettingInfo:Z,filterInfo:M,stores:S,checkInfo:I,pageInfo:x,getConvertValue:c,updateVScroll:H,getPagingData:P,updatePagingInfo:D,getColumnIndex:d}),{setStore:se}=iS({selectInfo:R,checkInfo:I,stores:S,sortInfo:E,elementInfo:k,filterInfo:M,expandedInfo:L,setSort:te,setSortInfo:J,updateVScroll:H,setFilter:ae}),{calculatedColumn:fe,onResize:ge,onShow:le,onColumnResize:ce}=j0({resizeInfo:v,elementInfo:k,checkInfo:I,expandedInfo:L,stores:S,isRenderer:a,updateVScroll:H,updateHScroll:B,contextInfo:G}),{setPositionColumnSetting:be,initColumnSettingInfo:Ie,onApplyColumn:Ve,setColumnHidden:kt}=Nr({stores:S,columnSettingInfo:Z,contextInfo:G,onSearch:$,onResize:ge}),{setContextMenu:Vt,onContextMenu:jo,onColumnContextMenu:Qo,onGridSettingContextMenu:gs}=nS({contextInfo:G,stores:S,selectInfo:R,useGridSetting:f,filterInfo:M,columnSettingInfo:Z,setColumnHidden:kt,onSort:ee}),{onRowClick:bs,onRowDblClick:ys}=Q0({selectInfo:R,stores:S}),{onDragStart:xs,onDragOver:Ss,onDrop:Cs}=oS({stores:S}),ks=K=>{G.gridSettingContextMenuItems.length=0,G.customGridSettingContextMenu.length?gs(K):Z.isShowColumnSetting=!0},sn=K=>{var ie,Le,wt,on,ki,Et,ot,ws,Is,hc;K.type==="wheel"&&((ie=G.menu)==null||ie.hide(K)),K.type==="scroll"&&!((Le=K.target.classList)!=null&&Le.contains("table-body"))&&!((on=(wt=K.target.offsetParent)==null?void 0:wt.classList)!=null&&on.contains("ev-select-dropbox"))&&!((Et=(ki=K.target.offsetParent)==null?void 0:ki.classList)!=null&&Et.contains("ev-grid-column-setting"))&&!((ws=(ot=K.target.offsetParent)==null?void 0:ot.classList)!=null&&ws.contains("ev-text-field-wrapper"))&&(M.isShowFilterSetting=!1,Z.isShowColumnSetting=!1,G.isShowMenuOnClick=!1,(Is=G.columnMenu)==null||Is.hide(K),(hc=G.gridSettingMenu)==null||hc.hide())};o.onMounted(()=>{fe(),se({rows:e.rows,isInit:!0}),document.addEventListener("wheel",sn,{capture:!1}),document.addEventListener("scroll",sn,{capture:!0})}),o.onUnmounted(()=>{document.removeEventListener("wheel",sn,{capture:!1}),document.removeEventListener("scroll",sn,{capture:!0})}),o.onActivated(()=>{ge()}),o.onUpdated(()=>{var K;T.value=((K=k["grid-wrapper"])==null?void 0:K.offsetWidth)/1.5||0}),o.watch(()=>Z.isShowColumnSetting,K=>{var ie;if(!K){(ie=G.gridSettingMenu)==null||ie.hide();return}be(u.value)}),o.watch(()=>e.columns,()=>{q()?J(j()):(J(j()),te()),M.filteringColumn=null,M.filteringItemsByColumn={},S.filterStore=[],se({rows:[],isMakeIndex:!1}),Ie(),S.movedColumns.length=0},{deep:!0}),o.watch(()=>E.isSorting,K=>{K&&(se({rows:S.originStore,isMakeIndex:!1}),E.isSorting=!K,x.isClientPaging&&(x.currentPage=1,S.pagingStore=P(),X()))}),o.watch(()=>e.rows,K=>{se({rows:K}),M.isSearch&&$(M.searchWord),ge()},{deep:!0}),o.watch(()=>e.uncheckable,()=>{se({rows:e.rows})},{deep:!0}),o.watch(()=>e.checked,K=>{I.checkedRows=K}),o.watch(()=>e.disabledRows,()=>{S.store.length&&S.store.forEach(K=>{K[6]=e.disabledRows.includes(K[2])})},{deep:!0}),o.watch(()=>I.checkedRows,K=>{I.isHeaderChecked=!1;let ie=S.store;x.isClientPaging&&(ie=P()),ie.length&&(ie.forEach(Le=>{Le[1]=K.includes(Le[2])}),I.isHeaderChecked=K.length===ie.length),H()}),o.watch(()=>e.selected,K=>{R.useSelect&&(R.selectedRow=K)}),o.watch(()=>R.selectedRow,K=>{R.useSelect&&(S.store.forEach(ie=>{ie[3]=K.includes(ie[2])&&!e.disabledRows.includes(ie[2])}),H())}),o.watch(()=>C.value,async K=>{if(await o.nextTick(),K>=0){if(x.usePage&&!x.isInfinite&&(x.highlightPage=Math.ceil(K/x.perPage)||1,x.highlightPage!==x.currentPage)){x.currentPage=x.highlightPage,x.isHighlight=!0;return}k.body.scrollTop=v.rowHeight*C.value}}),o.watch(()=>I.useCheckbox.mode,()=>{X()}),o.watch(()=>R.useSelect,()=>{W()}),o.watch(()=>R.multiple,()=>{W()}),o.watch(()=>e.checked.length,K=>{K||X()}),o.watch(()=>e.expanded.length,K=>{K||N(),H()}),o.watch(()=>[e.option.columnWidth,v.gridWidth],async()=>{await o.nextTick(),v.columnWidth=e.option.columnWidth;const K=k["grid-wrapper"];K.style.width=v.gridWidth,K.style.height=v.gridHeight,S.orderedColumns.map(ie=>{var wt;const Le=ie;return!((wt=e.columns[ie.index])!=null&&wt.width)&&!Le.resized&&(Le.width=0),Le}),ge()}),o.watch(()=>e.option.searchValue,K=>{K!==void 0&&($((K==null?void 0:K.value)??K),x.isClientPaging&&(X(),W()))},{immediate:!0}),o.watch(()=>{var K;return(K=e.option.page)==null?void 0:K.currentPage},K=>{var Le;const ie=K||1;x.currentPage=(Le=e.option.page)!=null&&Le.isInfinite?1:ie},{immediate:!0}),o.watch(()=>x.currentPage,(K,ie)=>{o.nextTick(()=>{O(ie),x.isClientPaging&&K!==ie&&(X(),W()),H(),K===x.highlightPage&&x.isHighlight&&(k.body.scrollTop=v.rowHeight*C.value,x.isHighlight=!x.isHighlight)})});const In=o.reactive({boxTop:0,boxLeft:0}),_=o.ref(null),oe=o.ref(!1),pe=o.ref(!1),ke=o.ref(null),ve=o.ref({}),ze=o.reactive({caption:"",field:""}),Qe=o.ref([]),rk=[{name:"AND",value:"and"},{name:"OR",value:"or"}],$o=o.ref(0),ck=({caption:K,field:ie},Le)=>{if(ze.caption=K,ze.field=ie,Qe.value=Le,(Le==null?void 0:Le.length)>1){oe.value=!0;const wt=_.value.getBoundingClientRect().left,on=window.pageYOffset+_.value.getBoundingClientRect().top+_.value.getBoundingClientRect().height;In.boxTop=`${on}px`,In.boxLeft=`${wt}px`}},dk=()=>{S.filterStore=[],se({rows:[],isMakeIndex:!1})},qo=async K=>{var on,ki;K&&pe.value&&($o.value=0);const ie=(on=_.value)==null?void 0:on.getElementsByClassName("filtering-items__item"),Le=[];let wt=0;if(ie){for(let Et=0;Et<ie.length;Et++){const ot=ie[Et];ot.classList.remove("non-display");const ws=(ki=_.value.getBoundingClientRect())==null?void 0:ki.width,{width:Is}=ot.getBoundingClientRect();wt+=Is+10,ws-150<=wt&&!ot.classList.contains("filtering-items__item--count")?($o.value++,Le.push(ot),ve.value={...ve.value,[ot.dataset.field]:Ze(M.filteringItemsByColumn[ot.dataset.field])}):delete ve.value[ot.dataset.field]}ie.forEach(Et=>{const ot=Le.includes(Et);Et.classList.toggle("non-display",ot)})}},hk=async(K,ie)=>{ie!=null&&ie.length?(M.filteringItemsByColumn[K]=ie,pe.value=!0):(delete ve.value[K],delete M.filteringItemsByColumn[K]),await o.nextTick(),qo(!0),M.isShowFilterSetting=!1,S.filterStore=[],se({rows:[],isMakeIndex:!1}),he(S.filterStore)};let el=null;const uk=()=>{el&&clearTimeout(el),el=setTimeout(()=>{pe.value=!pe.value,qo(pe.value)},150)},fk=()=>{M.filteringColumn=null,M.filteringItemsByColumn={},ve.value={},S.filterStore=[],se({rows:[],isMakeIndex:!1})},mk=o.computed(()=>{var K;return{width:`${T.value}px`,top:`${((K=_.value)==null?void 0:K.getBoundingClientRect().height)||0}px`}}),pk=K=>{const ie=M.filteringItemsByColumn[K];return ie==null?void 0:ie[ie.length-1]},gk=()=>{const K=document.createElement("div");K.id="ev-grid-filtering-items-modal",K.setAttribute("style","position: absolute; top: 0; left: 0;"),document.getElementById("ev-grid-filtering-items-modal")||document.body.appendChild(K)};return o.onBeforeMount(()=>gk()),{idColIndex:o.computed(()=>{var K;return(K=S.orderedColumns.find(ie=>ie.field==="id"))==null?void 0:K.index}),summaryScroll:Y,showHeader:p,stripeStyle:m,borderStyle:y,highlightIdx:C,useSummary:g,useGridSetting:f,toolbarRef:u,stores:S,emptyText:b,...o.toRefs(k),...o.toRefs(S),...o.toRefs(M),...o.toRefs(V),...o.toRefs(x),...o.toRefs(v),...o.toRefs(R),...o.toRefs(I),...o.toRefs(L),...o.toRefs(E),...o.toRefs(G),...o.toRefs(Z),isRenderer:a,getComponentName:r,getConvertValue:c,getColumnIndex:d,setPixelUnit:h,updateVScroll:H,updateHScroll:B,onScroll:z,calculatedColumn:fe,onResize:ge,onShow:le,onColumnResize:ce,onRowClick:bs,onRowDblClick:ys,onCheck:F,onCheckAll:Q,onExpanded:U,onSort:ee,setSort:te,setStore:se,setContextMenu:Vt,onContextMenu:jo,onSearch:$,setGridSetting:ks,onApplyColumn:Ve,onColumnContextMenu:Qo,filteringItemsWidth:T,isShowColumnFilteringItems:pe,operatorItems:rk,selectedFilteringItems:Qe,selectedFilteringColumn:ze,filteringItemsRef:_,isShowFilteringItemsBox:oe,filteringItemsStyle:mk,hiddenFilteringItemsCount:$o,...o.toRefs(In),hiddenFilteringItemsRef:ke,hiddenFilteringItemsByColumn:ve,removeAllFiltering:fk,onExpandFilteringItems:uk,setColumnFilteringItems:qo,onChangeOperator:dk,onApplyFilter:hk,onClickFilteringItem:ck,getFilteringItemByField:pk,onDragStart:xs,onDragOver:Ss,onDrop:Cs,ROW_DISABLED_INDEX:6}}},aS={key:0,class:"filtering-items filtering-items--used"},rS={key:1,ref:"filteringItemsRef",class:"filtering-items"},cS=["data-field","onClick"],dS={class:"filtering-items__item--title"},hS=["title"],uS={key:1,class:"filtering-items__item--value"},fS=["onClick"],mS={class:"filtering-items__item--title"},pS=["title"],gS={key:1,class:"filtering-items__item--value"},bS={class:"column-list"},yS=["data-index"],xS=["title","onClick"],SS=["onClick"],CS=["onMousedown"],kS={ref:"table"},wS=["data-index","disabled","onClick","onContextmenu","onDblclick"],IS=["data-name","data-index","disabled"],LS={key:0},TS=["title"],MS=["disabled"],RS=["disabled"],vS={key:0},VS=["colspan"],ES={key:0},GS={class:"is-empty"},WS={ref:"resizeLine",class:"table-resize-line"};function ZS(e,t,n,i,s,l){var T;const a=o.resolveComponent("ev-icon"),r=o.resolveComponent("ev-select"),c=o.resolveComponent("grid-option-button"),d=o.resolveComponent("toolbar"),h=o.resolveComponent("ev-checkbox"),u=o.resolveComponent("grid-sort-button"),f=o.resolveComponent("ev-context-menu"),p=o.resolveComponent("grid-summary"),g=o.resolveComponent("grid-pagination"),m=o.resolveComponent("filter-setting"),y=o.resolveComponent("column-setting"),C=o.resolveDirective("clickoutside"),b=o.resolveDirective("resize"),w=o.resolveDirective("observe-visibility");return o.openBlock(),o.createElementBlock(o.Fragment,null,[e.$slots.toolbar||i.useGridSetting?(o.openBlock(),o.createElementBlock("div",{key:0,ref:"toolbarRef",class:"toolbar-wrapper",style:o.normalizeStyle(`width: ${e.gridWidth};`)},[o.createVNode(d,null,{toolbarWrapper:o.withCtx(()=>[o.createElementVNode("div",{class:"filtering",style:o.normalizeStyle({width:`${i.filteringItemsWidth}px`})},[e.isFiltering&&!Object.keys(e.filteringItemsByColumn).length?(o.openBlock(),o.createElementBlock("div",aS,[o.createVNode(a,{icon:"ev-icon-filter-list"}),t[18]||(t[18]=o.createElementVNode("span",null,"Filter",-1))])):o.createCommentVNode("",!0),e.isFiltering&&Object.keys(e.filteringItemsByColumn).length?(o.openBlock(),o.createElementBlock("div",rS,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(Object.keys(e.filteringItemsByColumn),(k,M)=>{var Z,S,x,I;return o.openBlock(),o.createElementBlock(o.Fragment,{key:M},[M===0?(o.openBlock(),o.createElementBlock("div",{key:0,class:"filtering-items__item filtering-items__item--filter",onClick:t[0]||(t[0]=o.withModifiers((...L)=>i.onExpandFilteringItems&&i.onExpandFilteringItems(...L),["stop"]))},[o.createVNode(a,{icon:"ev-icon-filter-list",class:"filtering-items-expand"}),o.createElementVNode("span",null," Filter ("+o.toDisplayString(Object.keys(e.filteringItemsByColumn).length)+") ",1),o.createVNode(a,{class:"filtering-items__item--remove",icon:"ev-icon-s-close",style:{"margin-left":"0"},onClick:o.withModifiers(i.removeAllFiltering,["stop"])},null,8,["onClick"])])):o.createCommentVNode("",!0),M===1?(o.openBlock(),o.createBlock(r,{key:1,modelValue:e.columnOperator,"onUpdate:modelValue":t[1]||(t[1]=L=>e.columnOperator=L),items:i.operatorItems,class:"filtering-items__item--operator",onChange:i.onChangeOperator},null,8,["modelValue","items","onChange"])):o.createCommentVNode("",!0),o.createElementVNode("div",{class:"filtering-items__item non-display","data-field":k,onClick:o.withModifiers(L=>{var V;return i.onClickFilteringItem({caption:(V=i.getFilteringItemByField(k))==null?void 0:V.caption,field:k},e.filteringItemsByColumn[k])},["stop"])},[o.createElementVNode("span",dS,o.toDisplayString((Z=i.getFilteringItemByField(k))==null?void 0:Z.caption)+" "+o.toDisplayString((S=i.getFilteringItemByField(k))==null?void 0:S.comparison),1),e.filteringItemsByColumn[k].length<2?(o.openBlock(),o.createElementBlock("span",{key:0,class:"filtering-items__item--value",title:(x=i.getFilteringItemByField(k))==null?void 0:x.value},o.toDisplayString((I=i.getFilteringItemByField(k))==null?void 0:I.value),9,hS)):(o.openBlock(),o.createElementBlock("span",uS," + "+o.toDisplayString(e.filteringItemsByColumn[k].length),1)),o.createVNode(a,{class:"filtering-items__item--remove",icon:"ev-icon-s-close",onClick:L=>i.onApplyFilter(k,[])},null,8,["onClick"])],8,cS)],64)}),128)),i.isShowColumnFilteringItems&&Object.keys(e.filteringItemsByColumn).length&&i.hiddenFilteringItemsCount>0?(o.openBlock(),o.createElementBlock("div",{key:0,class:"filtering-items__item filtering-items__item--count",onClick:t[2]||(t[2]=(...k)=>i.onExpandFilteringItems&&i.onExpandFilteringItems(...k))}," + "+o.toDisplayString(i.hiddenFilteringItemsCount),1)):o.createCommentVNode("",!0)],512)):o.createCommentVNode("",!0),!i.isShowColumnFilteringItems&&Object.keys(i.hiddenFilteringItemsByColumn).length?o.withDirectives((o.openBlock(),o.createElementBlock("div",{key:2,ref:"hiddenFilteringItemsRef",class:"filtering-items filtering-items__hidden-items",style:o.normalizeStyle(i.filteringItemsStyle)},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(Object.keys(i.hiddenFilteringItemsByColumn),(k,M)=>{var Z,S,x,I;return o.openBlock(),o.createElementBlock("div",{key:M,class:"filtering-items__item",onClick:o.withModifiers(L=>{var V;return i.onClickFilteringItem({caption:(V=i.getFilteringItemByField(k))==null?void 0:V.caption,field:k},i.hiddenFilteringItemsByColumn[k])},["stop"])},[o.createElementVNode("span",mS,o.toDisplayString((Z=i.getFilteringItemByField(k))==null?void 0:Z.caption)+" "+o.toDisplayString((S=i.getFilteringItemByField(k))==null?void 0:S.comparison),1),i.hiddenFilteringItemsByColumn[k].length<2?(o.openBlock(),o.createElementBlock("span",{key:0,class:"filtering-items__item--value",title:(x=i.getFilteringItemByField(k))==null?void 0:x.value},o.toDisplayString((I=i.getFilteringItemByField(k))==null?void 0:I.value),9,pS)):(o.openBlock(),o.createElementBlock("span",gS," + "+o.toDisplayString(i.hiddenFilteringItemsByColumn[k].length),1)),o.createVNode(a,{class:"filtering-items__item--remove",icon:"ev-icon-s-close",onClick:L=>i.onApplyFilter(k,[],!0)},null,8,["onClick"])],8,fS)}),128))],4)),[[C,()=>{i.isShowColumnFilteringItems||i.onExpandFilteringItems()}]]):o.createCommentVNode("",!0)],4),i.useGridSetting?(o.openBlock(),o.createBlock(c,{key:0,class:"grid-setting__icon",onClick:t[3]||(t[3]=k=>i.setGridSetting(k))})):o.createCommentVNode("",!0),o.renderSlot(e.$slots,"toolbar",{item:{onSearch:i.onSearch}},void 0,!0)]),_:3})],4)):o.createCommentVNode("",!0),o.withDirectives((o.openBlock(),o.createElementBlock("div",o.mergeProps({ref:"grid-wrapper"},e.$attrs,{class:"grid-wrapper",style:`width: ${e.gridWidth}; height: ${e.gridHeight};`}),[o.createElementVNode("div",{ref:"grid",class:o.normalizeClass({table:!0,adjust:e.adjust,"ev-grid":!0,"non-header":!i.showHeader,"ev-grid--empty":!e.viewStore.length})},[o.withDirectives(o.createElementVNode("div",{ref:"header",class:o.normalizeClass({"table-header":!0,"non-border":!!i.borderStyle})},[o.createElementVNode("ul",bS,[e.useCheckbox.use?(o.openBlock(),o.createElementBlock("li",{key:0,class:o.normalizeClass({column:!0,"checkbox-all":!0,"non-border":!!i.borderStyle}),style:o.normalizeStyle({width:`${e.minWidth}px`,"border-right":"1px solid #CFCFCF"})},[e.useCheckbox.use&&e.useCheckbox.headerCheck&&e.useCheckbox.mode!=="single"?(o.openBlock(),o.createBlock(h,{key:0,modelValue:e.isHeaderChecked,"onUpdate:modelValue":t[4]||(t[4]=k=>e.isHeaderChecked=k),disabled:e.isHeaderUncheckable,indeterminate:e.isHeaderIndeterminate,onChange:i.onCheckAll},null,8,["modelValue","disabled","indeterminate","onChange"])):o.createCommentVNode("",!0)],6)):o.createCommentVNode("",!0),e.useRowDetail?(o.openBlock(),o.createElementBlock("li",{key:1,class:o.normalizeClass({column:!0,"non-border":!!i.borderStyle}),style:o.normalizeStyle({width:`${e.minWidth}px`,"border-right":"1px solid #CFCFCF"})},null,6)):o.createCommentVNode("",!0),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.orderedColumns,(k,M)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:M},[!k.hide&&!k.hiddenDisplay?(o.openBlock(),o.createElementBlock("li",{key:0,"data-index":M,class:o.normalizeClass({column:!0,render:i.isRenderer(k),"non-border":!!i.borderStyle,[k.field]:k.field}),style:o.normalizeStyle({width:`${k.width}px`,"min-width":`${i.isRenderer(k)?e.rendererMinWidth:e.minWidth}px`,"margin-right":e.orderedColumns.length-1===M&&(e.hasVerticalScrollBar||e.hasHorizontalScrollBar)?`${e.scrollWidth}px`:"0px","border-right":e.orderedColumns.length-1===M?"none":"1px solid #CFCFCF"}),draggable:!0,onDragstart:t[6]||(t[6]=(...Z)=>i.onDragStart&&i.onDragStart(...Z)),onDragover:t[7]||(t[7]=(...Z)=>i.onDragOver&&i.onDragOver(...Z)),onDrop:t[8]||(t[8]=(...Z)=>i.onDrop&&i.onDrop(...Z))},[k.customHeader&&e.$slots.customHeader?o.renderSlot(e.$slots,"customHeader",{key:0},void 0,!0):(o.openBlock(),o.createElementBlock("span",{key:1,title:k.caption,class:"column-name",onClick:[Z=>i.onColumnContextMenu(Z,k),t[5]||(t[5]=o.withModifiers((...Z)=>e.columnMenu.show&&e.columnMenu.show(...Z),["prevent"]))]},[o.createTextVNode(o.toDisplayString(k.caption)+" ",1),o.createElementVNode("span",{onClick:o.withModifiers(Z=>i.onSort(k),["stop"])},[e.$slots.sortIcon?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[k.sortable===void 0||k.sortable?(o.openBlock(),o.createElementBlock("span",{key:0,class:"column-sort__icon column-sort__icon--basic",style:o.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`})},[o.renderSlot(e.$slots,"sortIcon",{},void 0,!0)],4)):o.createCommentVNode("",!0),e.sortField===k.field?(o.openBlock(),o.createElementBlock("span",{key:1,class:o.normalizeClass([{"column-sort__icon":!0,"column-sort__icon--asc":e.sortOrder==="asc","column-sort__icon--desc":e.sortOrder==="desc"}]),style:o.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`})},[o.renderSlot(e.$slots,`sortIcon_${e.sortOrder}`,{},void 0,!0)],6)):o.createCommentVNode("",!0)],64)):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[k.sortable===void 0||k.sortable?(o.openBlock(),o.createBlock(u,{key:0,class:"column-sort__icon column-sort__icon--basic",icon:"basic",style:o.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`})},null,8,["style"])):o.createCommentVNode("",!0),e.sortField===k.field?(o.openBlock(),o.createBlock(u,{key:1,class:o.normalizeClass([{"column-sort__icon":!0,"column-sort__icon--asc":e.sortOrder==="asc","column-sort__icon--desc":e.sortOrder==="desc"}]),icon:e.sortOrder,style:o.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`,visibility:e.sortOrder?k.hidden:!0})},null,8,["class","icon","style"])):o.createCommentVNode("",!0)],64))],8,SS)],8,xS)),o.createElementVNode("span",{class:"column-resize",onMousedown:o.withModifiers(Z=>i.onColumnResize(M,Z),["stop","left"])},null,40,CS)],46,yS)):o.createCommentVNode("",!0)],64))),128)),(T=e.$props.option.customContextMenu)!=null&&T.length?(o.openBlock(),o.createElementBlock("li",{key:2,class:o.normalizeClass({column:!0,"non-border":!!i.borderStyle}),style:o.normalizeStyle({width:"30px","min-width":"30px","margin-right":e.hasVerticalScrollBar||e.hasHorizontalScrollBar?`${e.scrollWidth}px`:"0px"})},null,6)):o.createCommentVNode("",!0)])],2),[[o.vShow,i.showHeader]]),o.createElementVNode("div",{ref:"body",class:o.normalizeClass({stripe:i.stripeStyle,"table-body":!0,"bottom-border":!!e.viewStore.length,"non-border":!!i.borderStyle}),onScroll:t[11]||(t[11]=(...k)=>i.onScroll&&i.onScroll(...k)),onContextmenu:t[12]||(t[12]=k=>i.onContextMenu(k))},[o.createElementVNode("div",{style:o.normalizeStyle(`height: ${e.vScrollTopHeight}px;`),class:"vscroll-spacer"},null,4),o.createElementVNode("table",kS,[o.createElementVNode("tbody",null,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.viewStore,(k,M)=>{var Z,S;return o.openBlock(),o.createElementBlock(o.Fragment,{key:i.idColIndex!=null?k[2][i.idColIndex]:M},[o.createElementVNode("tr",{"data-index":k[0],class:o.normalizeClass({row:!0,selected:k[3],highlight:k[0]===i.highlightIdx,"non-border":!!i.borderStyle&&i.borderStyle!=="rows"}),disabled:k[i.ROW_DISABLED_INDEX],onClick:x=>i.onRowClick(x,k),onContextmenu:x=>i.onRowClick(x,k,!0),onDblclick:x=>i.onRowDblClick(x,k)},[e.useCheckbox.use?(o.openBlock(),o.createElementBlock("td",{key:0,class:o.normalizeClass({cell:!0,"row-checkbox":!0,"non-border":!!i.borderStyle}),style:o.normalizeStyle({width:`${e.minWidth}px`,height:`${e.rowHeight}px`,"border-right":"1px solid #CFCFCF"})},[o.createVNode(h,{modelValue:k[1],"onUpdate:modelValue":x=>k[1]=x,class:"row-checkbox-input",disabled:k[5]||k[i.ROW_DISABLED_INDEX],onChange:x=>i.onCheck(x,k)},null,8,["modelValue","onUpdate:modelValue","disabled","onChange"])],6)):o.createCommentVNode("",!0),e.useRowDetail?(o.openBlock(),o.createElementBlock("td",{key:1,class:o.normalizeClass({cell:!0,"row-detail-toggle":!0,"non-border":!!i.borderStyle,"row-detail-toggle--expanded":k[4]}),style:o.normalizeStyle({width:`${e.minWidth}px`,height:`${e.rowHeight}px`,"border-right":"1px solid #CFCFCF"})},[o.createVNode(a,{modelValue:k[4],"onUpdate:modelValue":x=>k[4]=x,icon:"ev-icon-s-play",class:"row-detail-toggle-icon",onClick:o.withModifiers(x=>i.onExpanded(x,k),["stop"])},null,8,["modelValue","onUpdate:modelValue","onClick"])],6)):o.createCommentVNode("",!0),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.orderedColumns,(x,I)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:`${i.idColIndex!=null?k[2][i.idColIndex]:M}-${I}`},[!x.hide&&!x.hiddenDisplay?(o.openBlock(),o.createElementBlock("td",{key:0,"data-name":x.field,"data-index":x.index,class:o.normalizeClass({cell:!0,render:i.isRenderer(x),[x.type]:x.type,[x.align]:x.align,[x.field]:x.field,"non-border":!!i.borderStyle}),style:o.normalizeStyle({width:`${x.width}px`,height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`,"min-width":`${i.isRenderer(x)?e.rendererMinWidth:e.minWidth}px`,"border-right":e.orderedColumns.length-1===I?"none":"1px solid #CFCFCF"}),disabled:k[i.ROW_DISABLED_INDEX]},[e.$slots[x.field]?(o.openBlock(),o.createElementBlock("div",LS,[o.renderSlot(e.$slots,x.field,{item:{row:k,column:x},disabled:k[i.ROW_DISABLED_INDEX]},void 0,!0)])):(o.openBlock(),o.createElementBlock("div",{key:1,title:i.getConvertValue(x,k[2][x.index])},o.toDisplayString(i.getConvertValue(x,k[2][x.index])),9,TS))],14,IS)):o.createCommentVNode("",!0)],64))),128)),(Z=e.$props.option.customContextMenu)!=null&&Z.length?(o.openBlock(),o.createElementBlock("td",{key:2,class:o.normalizeClass({"row-contextmenu":!0,"non-border":!!i.borderStyle}),style:o.normalizeStyle({position:"sticky",right:0,width:"30px",height:`${e.rowHeight}px`,"min-width":"30px","line-height":`${e.rowHeight}px`}),disabled:k[i.ROW_DISABLED_INDEX]},[e.$slots.contextmenuIcon?(o.openBlock(),o.createElementBlock("span",{key:0,class:"row-contextmenu__btn",disabled:k[i.ROW_DISABLED_INDEX],onClick:t[9]||(t[9]=x=>i.onContextMenu(x))},[o.renderSlot(e.$slots,"contextmenuIcon",{},void 0,!0)],8,RS)):(o.openBlock(),o.createBlock(c,{key:1,icon:"ev-icon-warning2",class:"row-contextmenu__btn",disabled:k[i.ROW_DISABLED_INDEX],onClick:t[10]||(t[10]=x=>i.onContextMenu(x))},null,8,["disabled"]))],14,MS)):o.createCommentVNode("",!0)],42,wS),e.useRowDetail&&((S=e.$slots)!=null&&S.rowDetail)&&k[4]?(o.openBlock(),o.createElementBlock("tr",vS,[o.createElementVNode("td",{colspan:k.length},[o.createElementVNode("div",{style:o.normalizeStyle({width:"100%",height:`${e.detailRowHeight}px`,"min-height":`${e.detailRowHeight}px`,"max-height":`${e.detailRowHeight}px`})},[o.renderSlot(e.$slots,"rowDetail",{item:{row:k}},void 0,!0)],4)],8,VS)])):o.createCommentVNode("",!0)],64)}),128)),e.viewStore.length?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("tr",ES,[o.createElementVNode("td",GS,o.toDisplayString(i.emptyText),1)]))])],512),o.createElementVNode("div",{style:o.normalizeStyle(`height: ${e.vScrollBottomHeight}px;`),class:"vscroll-spacer"},null,4),o.createVNode(f,{ref:"menu","custom-class":e.contextMenuClass,items:e.contextMenuItems},null,8,["custom-class","items"]),o.createVNode(f,{ref:"columnMenu",items:e.columnMenuItems},null,8,["items"]),o.createVNode(f,{ref:"gridSettingMenu",items:e.gridSettingContextMenuItems,"is-show-menu-on-click":e.isShowMenuOnClick},null,8,["items","is-show-menu-on-click"])],34),o.withDirectives(o.createElementVNode("div",WS,null,512),[[o.vShow,e.showResizeLine]])],2)],16)),[[b,i.onResize],[w,{callback:i.onShow,once:!0}]]),i.useSummary?(o.openBlock(),o.createBlock(p,{key:1,"ordered-columns":e.orderedColumns,stores:i.stores,"use-checkbox":e.useCheckbox.use,"style-option":{borderStyle:i.borderStyle,minWidth:e.minWidth,rowHeight:e.rowHeight},"scroll-left":i.summaryScroll},null,8,["ordered-columns","stores","use-checkbox","style-option","scroll-left"])):o.createCommentVNode("",!0),e.usePage&&!e.isInfinite?(o.openBlock(),o.createBlock(g,{key:2,modelValue:e.currentPage,"onUpdate:modelValue":t[13]||(t[13]=k=>e.currentPage=k),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"])):o.createCommentVNode("",!0),o.createVNode(m,{"is-show":e.isShowFilterSetting,"onUpdate:isShow":t[14]||(t[14]=k=>e.isShowFilterSetting=k),items:e.filteringItemsByColumn,"onUpdate:items":t[15]||(t[15]=k=>e.filteringItemsByColumn=k),column:e.filteringColumn,position:e.filterSettingPosition,onApplyFiltering:i.onApplyFilter},null,8,["is-show","items","column","position","onApplyFiltering"]),o.createVNode(y,{"is-show":e.isShowColumnSetting,"onUpdate:isShow":t[16]||(t[16]=k=>e.isShowColumnSetting=k),"is-show-menu-on-click":e.isShowMenuOnClick,"onUpdate:isShowMenuOnClick":t[17]||(t[17]=k=>e.isShowMenuOnClick=k),columns:e.updatedColumns,"hidden-column":e.hiddenColumn,position:e.columnSettingPosition,"text-info":e.columnSettingTextInfo,onApplyColumn:i.onApplyColumn},null,8,["is-show","is-show-menu-on-click","columns","hidden-column","position","text-info","onApplyColumn"])],64)}const hi=de(lS,[["render",ZS],["__scopeId","data-v-22cd2bf6"]]);hi.install=e=>{e.component(hi.name,hi)};let ui=null;function XS(){return ui||(typeof document<"u"?ui=document.createElement("canvas").getContext("2d"):typeof OffscreenCanvas<"u"&&(ui=new OffscreenCanvas(1,1).getContext("2d")),ui)}const fi=new Map,NS=512,A={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),i=parseInt(t[2],16),s=parseInt(t[3],16);return`${n},${i},${s}`},getColorStringType(e){if(!e)return"";const t=e.replace(/ /g,""),n=/^#(?:[A-Fa-f0-9]{3}){1,2}$/.exec(t),i=/^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":i?l="RGB":s?l="RGBA":l="NONE",l},colorStringToRgba(e,t=1){const n=`${e}|${t}`,i=fi.get(n);if(i!==void 0)return i;const s=e.replace(/ /g,""),l=this.getColorStringType(s);let a="";switch(l){case"HEX":a=`rgba(${this.hexToRgb(s)},${t})`;break;case"RGB":a=s.replace(")",`, ${t})`).replace("rgb","rgba");break;case"RGBA":{const r=s.replace(/^.*,(.+)\)/,"$1");a=s.replace(`${r})`,`${t})`);break}default:a=`rgba(0, 0, 0, ${t})`;break}return fi.size>=NS&&fi.delete(fi.keys().next().value),fi.set(n,a),a},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},coordinateKey(e,t){return`${e}|${t}`},getLabelStyle(e){const{fontStyle:t="normal",fontWeight:n="normal",fontSize:i="12",fontFamily:s="Roboto"}=e;return`${t} normal ${n} ${i}px ${s}`},labelSignFormat(e,t=null){const n=Wh(1),i=Gh(1),s=Eh(1),l=Vh(1),a=1e3;let r;if(!yt(e))return e;const c=e<0,d=Math.abs(e),h=(u,f,p)=>{let g;return u%f===0?g=Yt(t)?`${u/f}${p}`:`${(u/f).toFixed(t)}${p}`:g=`${(u/f).toFixed(1)}${p}`,c?`-${g}`:g};if(d>=n)r=h(d,n,"P");else if(d>=i)r=h(d,i,"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 u=Yt(t)?d:d.toFixed(t);r=c?`-${u}`:`${u}`}return r},calcTextSize(e,t,n=0){const i=document.createElement("span"),s=`visibility:hidden; position:absolute; top:-10000px; font: ${t}; padding: 0 ${n}px`;i.setAttribute("style",s),i.style.font=t,i.textContent=e,document.body.appendChild(i);const l=i.getBoundingClientRect(),a=l.width||2,r=l.height||2;return i.remove(),{width:a,height:r}},calcTextSizeCanvas(e,t){if(!e)return{width:2,height:2};const n=XS();n.save(),n.font=t;const i=n.measureText(e),s=t.match(/(\d+(?:\.\d+)?)px/),a=(s?Number(s[1]):14)*1.2;return n.restore(),{width:Math.max(Math.ceil(i.width),2),height:Math.max(Math.ceil(a),2)}},getStringMinMax(e){const t={min:e[0],max:e[0]};return e.forEach(n=>{var i,s;((i=t==null?void 0:t.max)==null?void 0:i.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,i="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=i==="right"?a.substring(0,c):a.substring(1,a.length),r=n.measureText(a).width;return i==="right"?a+s:s+a},showLabelTip(e){const{ctx:t,width:n,height:i,x:s,y:l,arrowSize:a,borderRadius:r,text:c,backgroundColor:d,textColor:h}=e,u=s-n/2,f=s+n/2,p=l-i,g=l;t.beginPath(),t.save(),t.fillStyle=d||"#E96E2C",t.strokeStyle=d||"#E96E2C",t.shadowBlur=0,t.moveTo(u+r,p),t.quadraticCurveTo(u,p,u,p+r),t.lineTo(u,g-r),t.quadraticCurveTo(u,g,u+r,g),t.lineTo(f-r,g),t.quadraticCurveTo(f,g,f,g-r),t.lineTo(f,p+r),t.quadraticCurveTo(f,p,f-r,p),t.lineTo(s-a,p),t.lineTo(s,p-a),t.lineTo(s+a,p),t.lineTo(u+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+i/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(i=>{e.style[i]=t[i]})},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[,i,s,l]=e.match(t);return`rgba(${i}, ${s}, ${l}, 0.5)`}if(n.test(e)){const[,i,s,l,a]=e.match(n),r=(parseFloat(a)/2).toFixed(2);return`rgba(${i}, ${s}, ${l}, ${r})`}return e.startsWith("#")&&e.length>7?e:`${e}80`},calcBoxDistance(e,t,n){if(e.w!==null&&e.w!==void 0&&e.h!==null&&e.h!==void 0){const i=e.xp,s=e.yp,l=Math.min(i,i+e.w),a=Math.max(i,i+e.w),r=Math.min(s,s+e.h),c=Math.max(s,s+e.h),d=Math.max(0,l-t,t-a),h=Math.max(0,r-n,n-c);return d*d+h*h}return(e.xp-t)**2+(e.yp-n)**2}};function PS(e){const t=(String(e).split(".")[1]??"").length;return e.toFixed(t+1)}var BS=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function DS(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Pr={exports:{}};(function(e,t){(function(n,i){e.exports=i()})(BS,function(){var n=1e3,i=6e4,s=36e5,l="millisecond",a="second",r="minute",c="hour",d="day",h="week",u="month",f="quarter",p="year",g="date",m="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,C=/\[([^\]]+)]|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,b={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(E){var G=["th","st","nd","rd"],v=E%100;return"["+E+(G[(v-20)%10]||G[v]||G[0])+"]"}},w=function(E,G,v){var X=String(E);return!X||X.length>=G?E:""+Array(G+1-X.length).join(v)+E},T={s:w,z:function(E){var G=-E.utcOffset(),v=Math.abs(G),X=Math.floor(v/60),W=v%60;return(G<=0?"+":"-")+w(X,2,"0")+":"+w(W,2,"0")},m:function E(G,v){if(G.date()<v.date())return-E(v,G);var X=12*(v.year()-G.year())+(v.month()-G.month()),W=G.clone().add(X,u),N=v-W<0,P=G.clone().add(X+(N?-1:1),u);return+(-(X+(v-W)/(N?W-P:P-W))||0)},a:function(E){return E<0?Math.ceil(E)||0:Math.floor(E)},p:function(E){return{M:u,y:p,w:h,d,D:g,h:c,m:r,s:a,ms:l,Q:f}[E]||String(E||"").toLowerCase().replace(/s$/,"")},u:function(E){return E===void 0}},k="en",M={};M[k]=b;var Z="$isDayjsObject",S=function(E){return E instanceof V||!(!E||!E[Z])},x=function E(G,v,X){var W;if(!G)return k;if(typeof G=="string"){var N=G.toLowerCase();M[N]&&(W=N),v&&(M[N]=v,W=N);var P=G.split("-");if(!W&&P.length>1)return E(P[0])}else{var D=G.name;M[D]=G,W=D}return!X&&W&&(k=W),W||!X&&k},I=function(E,G){if(S(E))return E.clone();var v=typeof G=="object"?G:{};return v.date=E,v.args=arguments,new V(v)},L=T;L.l=x,L.i=S,L.w=function(E,G){return I(E,{locale:G.$L,utc:G.$u,x:G.$x,$offset:G.$offset})};var V=function(){function E(v){this.$L=x(v.locale,null,!0),this.parse(v),this.$x=this.$x||v.x||{},this[Z]=!0}var G=E.prototype;return G.parse=function(v){this.$d=function(X){var W=X.date,N=X.utc;if(W===null)return new Date(NaN);if(L.u(W))return new Date;if(W instanceof Date)return new Date(W);if(typeof W=="string"&&!/Z$/i.test(W)){var P=W.match(y);if(P){var D=P[2]-1||0,O=(P[7]||"0").substring(0,3);return N?new Date(Date.UTC(P[1],D,P[3]||1,P[4]||0,P[5]||0,P[6]||0,O)):new Date(P[1],D,P[3]||1,P[4]||0,P[5]||0,P[6]||0,O)}}return new Date(W)}(v),this.init()},G.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()},G.$utils=function(){return L},G.isValid=function(){return this.$d.toString()!==m},G.isSame=function(v,X){var W=I(v);return this.startOf(X)<=W&&W<=this.endOf(X)},G.isAfter=function(v,X){return I(v)<this.startOf(X)},G.isBefore=function(v,X){return this.endOf(X)<I(v)},G.$g=function(v,X,W){return L.u(v)?this[X]:this.set(W,v)},G.unix=function(){return Math.floor(this.valueOf()/1e3)},G.valueOf=function(){return this.$d.getTime()},G.startOf=function(v,X){var W=this,N=!!L.u(X)||X,P=L.p(v),D=function(U,ee){var j=L.w(W.$u?Date.UTC(W.$y,ee,U):new Date(W.$y,ee,U),W);return N?j:j.endOf(d)},O=function(U,ee){return L.w(W.toDate()[U].apply(W.toDate("s"),(N?[0,0,0,0]:[23,59,59,999]).slice(ee)),W)},Y=this.$W,H=this.$M,B=this.$D,z="set"+(this.$u?"UTC":"");switch(P){case p:return N?D(1,0):D(31,11);case u:return N?D(1,H):D(0,H+1);case h:var F=this.$locale().weekStart||0,Q=(Y<F?Y+7:Y)-F;return D(N?B-Q:B+(6-Q),H);case d:case g:return O(z+"Hours",0);case c:return O(z+"Minutes",1);case r:return O(z+"Seconds",2);case a:return O(z+"Milliseconds",3);default:return this.clone()}},G.endOf=function(v){return this.startOf(v,!1)},G.$set=function(v,X){var W,N=L.p(v),P="set"+(this.$u?"UTC":""),D=(W={},W[d]=P+"Date",W[g]=P+"Date",W[u]=P+"Month",W[p]=P+"FullYear",W[c]=P+"Hours",W[r]=P+"Minutes",W[a]=P+"Seconds",W[l]=P+"Milliseconds",W)[N],O=N===d?this.$D+(X-this.$W):X;if(N===u||N===p){var Y=this.clone().set(g,1);Y.$d[D](O),Y.init(),this.$d=Y.set(g,Math.min(this.$D,Y.daysInMonth())).$d}else D&&this.$d[D](O);return this.init(),this},G.set=function(v,X){return this.clone().$set(v,X)},G.get=function(v){return this[L.p(v)]()},G.add=function(v,X){var W,N=this;v=Number(v);var P=L.p(X),D=function(H){var B=I(N);return L.w(B.date(B.date()+Math.round(H*v)),N)};if(P===u)return this.set(u,this.$M+v);if(P===p)return this.set(p,this.$y+v);if(P===d)return D(1);if(P===h)return D(7);var O=(W={},W[r]=i,W[c]=s,W[a]=n,W)[P]||1,Y=this.$d.getTime()+v*O;return L.w(Y,this)},G.subtract=function(v,X){return this.add(-1*v,X)},G.format=function(v){var X=this,W=this.$locale();if(!this.isValid())return W.invalidDate||m;var N=v||"YYYY-MM-DDTHH:mm:ssZ",P=L.z(this),D=this.$H,O=this.$m,Y=this.$M,H=W.weekdays,B=W.months,z=W.meridiem,F=function(ee,j,te,J){return ee&&(ee[j]||ee(X,N))||te[j].slice(0,J)},Q=function(ee){return L.s(D%12||12,ee,"0")},U=z||function(ee,j,te){var J=ee<12?"AM":"PM";return te?J.toLowerCase():J};return N.replace(C,function(ee,j){return j||function(te){switch(te){case"YY":return String(X.$y).slice(-2);case"YYYY":return L.s(X.$y,4,"0");case"M":return Y+1;case"MM":return L.s(Y+1,2,"0");case"MMM":return F(W.monthsShort,Y,B,3);case"MMMM":return F(B,Y);case"D":return X.$D;case"DD":return L.s(X.$D,2,"0");case"d":return String(X.$W);case"dd":return F(W.weekdaysMin,X.$W,H,2);case"ddd":return F(W.weekdaysShort,X.$W,H,3);case"dddd":return H[X.$W];case"H":return String(D);case"HH":return L.s(D,2,"0");case"h":return Q(1);case"hh":return Q(2);case"a":return U(D,O,!0);case"A":return U(D,O,!1);case"m":return String(O);case"mm":return L.s(O,2,"0");case"s":return String(X.$s);case"ss":return L.s(X.$s,2,"0");case"SSS":return L.s(X.$ms,3,"0");case"Z":return P}return null}(ee)||P.replace(":","")})},G.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},G.diff=function(v,X,W){var N,P=this,D=L.p(X),O=I(v),Y=(O.utcOffset()-this.utcOffset())*i,H=this-O,B=function(){return L.m(P,O)};switch(D){case p:N=B()/12;break;case u:N=B();break;case f:N=B()/3;break;case h:N=(H-Y)/6048e5;break;case d:N=(H-Y)/864e5;break;case c:N=H/s;break;case r:N=H/i;break;case a:N=H/n;break;default:N=H}return W?N:L.a(N)},G.daysInMonth=function(){return this.endOf(u).$D},G.$locale=function(){return M[this.$L]},G.locale=function(v,X){if(!v)return this.$L;var W=this.clone(),N=x(v,X,!0);return N&&(W.$L=N),W},G.clone=function(){return L.w(this.$d,this)},G.toDate=function(){return new Date(this.valueOf())},G.toJSON=function(){return this.isValid()?this.toISOString():null},G.toISOString=function(){return this.$d.toISOString()},G.toString=function(){return this.$d.toUTCString()},E}(),R=V.prototype;return I.prototype=R,[["$ms",l],["$s",a],["$m",r],["$H",c],["$W",d],["$M",u],["$y",p],["$D",g]].forEach(function(E){R[E[1]]=function(G){return this.$g(G,E[0],E[1])}}),I.extend=function(E,G){return E.$i||(E(G,V,I),E.$i=!0),I},I.locale=x,I.isDayjs=S,I.unix=function(E){return I(1e3*E)},I.en=M[k],I.Ls=M,I.p={},I})})(Pr);var YS=Pr.exports;const Ne=DS(YS),OS={createDataSet(e,t){var n;this._dataEpoch=(this._dataEpoch??0)+1,Object.keys(this.seriesInfo.charts).forEach(i=>{var l;const s=this.seriesInfo.charts[i];if(s.length)if(i==="pie")this.options.sunburst?this.createSunburstDataSet(e):this.createPieDataSet(e,s);else if(i==="scatter")s.forEach(a=>{const r=this.seriesList[a],c=e[a],d=r==null?void 0:r.passingValue;r&&c&&(r.data=this.addSeriesDSforScatter(c),r.minMax=this.getSeriesMinMax(r.data,d))});else if(i==="heatMap")s.forEach(a=>{const r=this.seriesList[a],c=r==null?void 0:r.passingValue,d=e[a];r&&d&&(r.labels=t,r.data=this.addSeriesDSForHeatMap(d),r.minMax=this.getSeriesMinMax(r.data,c),r.valueOpt=this.getSeriesValueOptForHeatMap(r))});else{const a=s[0],r=(l=this.seriesList[a])==null?void 0:l.passingValue,c=new Map;for(let d=0;d<s.length;d++){const h=s[d],u=this.seriesList[h];if(u&&u.show!==!1){const f=e==null?void 0:e[h],{passingValue:p,interpolation:g}=u,m=g==="zero"||p!=null&&p!==void 0;let y=!1,C;if(!f)C=f;else if(!m)C=f;else{C=new Array(f.length);for(let b=0;b<f.length;b++){const w=f[b];g==="zero"&&!w?C[b]=0:w===p?(y=!0,C[b]=null):C[b]=w}}if(u.hasPassingValueInData=y,C){const b=u.isExistGrp&&!u.isOverlapping;let w=null;b&&(w=c.get(u.groupIndex),w||(w={pos:[],neg:[]},c.set(u.groupIndex,w))),b&&u.stackIndex?u.data=this.addSeriesStackDS(C,t,u.stackIndex,w,u.data):u.data=this.addSeriesDS(C,t,u.isExistGrp,r,u.data),u.minMax=this.getSeriesMinMax(u.data,u.passingValue),b&&this.updateStackTops(w,u)}}}}}),(n=this.buildLabelValidMask)==null||n.call(this)},createRealTimeScatterDataSet(e){var i,s,l,a;const t=Object.keys(e),n={maxY:-1/0,minY:1/0,fromTime:0,toTime:0};for(let r=0;r<t.length;r++){const c=t[r],d=e[c],h=d==null?void 0:d.length;if(!this.isInit||this.updateSeries||!this.dataSet[c]){const R={dataGroup:[],startIndex:0,endIndex:null,length:0,fromTime:0,toTime:0};this.dataSet[c]={...R,...this.dataSet[c]}}const u=this.dataSet[c],f=u.dataGroup,p=this.options.realTimeScatter.range||300,g=u.length!==p;u.length=p;const m=u.length;let y=0;for(let R=0;R<h;R++){const E=d[R];E&&y<E.x&&(y=E.x)}y=y?Math.floor(y/1e3)*1e3:0;const C=((l=(s=(i=f.at(-1))==null?void 0:i.data)==null?void 0:s.at(-1))==null?void 0:l.x)||Date.now(),b=Math.floor(C/1e3)*1e3,w=u.toTime||b,T=y||w,k=R=>{R.data.length=0,R.dataKeys?R.dataKeys.clear():R.dataKeys=new Set,R.max=0,R.min=1/0};if(u.endIndex==null||g){u.startIndex=0,u.endIndex=m-1,f.length=m;for(let R=0;R<m;R++)f[R]=f[R]||{data:[],dataKeys:new Set,max:0,min:1/0},k(f[R]);u.toTime=T,u.fromTime=u.toTime-m*1e3}const M=(T-w)/1e3,Z=Number.isFinite(M)?Math.max(0,Math.floor(M)):0;if(u.toTime=T,u.fromTime=u.toTime-m*1e3,y&&(u.toTime-y)/1e3>m&&c==="")return;for(let R=0;R<m;R++)f[R]?f[R].data?f[R].dataKeys||(f[R].dataKeys=new Set):(f[R].data=[],f[R].dataKeys=new Set,f[R].max=0,f[R].min=1/0):f[R]={data:[],dataKeys:new Set,max:0,min:1/0};if(Z>0)if(Z>=m){for(let R=0;R<m;R++)k(f[R]);u.startIndex=0,u.endIndex=m-1}else{let R=u.startIndex,E=u.endIndex;for(let G=0;G<Z;G++)k(f[R]),R=(R+1)%m,E=(E+1)%m;u.startIndex=R,u.endIndex=E}const S=this.options.coordinateDedupe!==!1;let x=-1;for(let R=0;R<h;R++){const E=d[R];if(E){const G=Math.floor(E.x/1e3)*1e3;if(u.fromTime<=G){let v=u.endIndex-(u.toTime-G)/1e3;v<0&&(v=m+v);const X=f[v],W=A.coordinateKey(E.x,E.y);if(!(S&&X.dataKeys.has(W))){S&&X.dataKeys.add(W),X.data.push({x:E.x,y:E.y,o:E.value??E.y,color:E.color,k:S&&this.seriesInfo.charts.scatter.length>1?W:void 0}),X.max=Math.max(X.max,E.y),X.min=Math.min(X.min,E.y);const P=(u.toTime-G)/1e3;P>x&&(x=P)}}}}u.lastTick={seq:(((a=u.lastTick)==null?void 0:a.seq)??0)+1,gapCount:Z,prevToTime:w,toTime:u.toTime,length:m,startIndex:u.startIndex,endIndex:u.endIndex,maxDirtyAge:x};const I=1e3,L={maxY:-1/0,minY:1/0};for(let R=0;R<m;R++){const E=f[R];for(let G=0;G<E.data.length;G++){const v=E.data[G],X=Math.floor(v.x/I)*I;X>=u.fromTime&&X<=u.toTime&&Number.isFinite(v.y)&&(v.y>L.maxY&&(L.maxY=v.y),v.y<L.minY&&(L.minY=v.y))}}Number.isFinite(L.minY)&&(n.maxY=Math.max(n.maxY,L.maxY),n.minY=Math.min(n.minY,L.minY)),n.fromTime=u.fromTime,n.toTime=u.toTime}Number.isFinite(n.minY)||(n.minY=0,n.maxY=0),this.seriesInfo.charts.scatter.forEach(r=>{const c=this.seriesList[r];c.data=this.dataSet,c.minMax={minX:Ne(n.fromTime),minY:n.minY,maxX:Ne(n.toTime),maxY:n.maxY}})},createSunburstDataSet(e){this.pieDataSet=[];const t=this.pieDataSet,n=[];for(let i=0;i<e.length;i++){const s=e[i],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((i,s)=>s.value-i.value);n.length;){const i=n.shift(),s=i.parent,l=i.data,a=i.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(i=>{if(this.seriesList[i].show){const s=e[i][0]??0;n[0].total+=s,n[0].data.push({id:i,value:s,sa:0,ea:0})}}),n.forEach(i=>{i.data.sort((s,l)=>l.value-s.value)})},addSeriesStackDS(e,t,n=0,i=null,s){const l=this.options.horizontal,a=[],r=i==null?void 0:i.pos,c=i==null?void 0:i.neg,d=Array.isArray(s)?s:null;return e.forEach((h,u)=>{let f=(h>=0?r==null?void 0:r[u]:c==null?void 0:c[u])??0,p=h,g=t[u],m=h;if(f!=null&&g!=null){m&&typeof m=="object"&&("x"in m||"y"in m)&&(p=l?h.x:h.y,g=l?h.y:h.x);const y=(p==null?void 0:p.value)??p;n>0?y!=null?m=f+y:m=p:(f=0,m=y);const C=d&&d[a.length];a.push(this.addData(m,g,p,f,C||null))}}),a},updateStackTops(e,t){if(!t.show)return;const n=this.options.horizontal,i=t.passingValue,s=!A.isNullOrUndefined(i),l=t.data,a=e.pos,r=e.neg;for(let c=0;c<l.length;c++){const d=l[c],h=n?d.x:d.y,u=d.o,f=s&&u===i;h!=null&&!f&&(u>=0?a[c]=h:r[c]=h)}},addSeriesDS(e,t,n,i,s){const l=this.options.horizontal,a=[],r=n&&!A.isNullOrUndefined(i),c=Array.isArray(s)?s:null;for(let d=0;d<e.length;d++){let h=e[d],u=t[d];if(h&&typeof h=="object"&&(h.x||h.y)&&(h=l?h.x:h.y,u=l?e[d].y:e[d].x),u!==null){const f=r&&h===i?0:h;if(f!==null&&typeof f=="object"||h!==null&&typeof h=="object")a.push(this.addData(f,u,h));else{const p=f??null,g=h??null,m=c&&c[a.length];m&&typeof m=="object"?(m.x=l?p:u,m.y=l?u:p,m.o=g,m.b=null,m.xp=null,m.yp=null,m.w=null,m.h=null,m.dataColor=null,m.dataTextColor=null,a.push(m)):a.push(l?{x:p,y:u,o:g,b:null,xp:null,yp:null,w:null,h:null,dataColor:null,dataTextColor:null}:{x:u,y:p,o:g,b:null,xp:null,yp:null,w:null,h:null,dataColor:null,dataTextColor:null})}}}return a},addSeriesDSforScatter(e){return e.map(t=>{const n=t.x,i={value:t.y,color:(t==null?void 0:t.color)||null};return this.addData(i,n,i)})},addSeriesDSForHeatMap(e){return e.map(({x:t,y:n,value:i,color:s=null})=>({x:t,y:n,o:i,xp:null,yp:null,w:null,h:null,dataColor:s,cId:null}))},addData(e,t,n=null,i=null,s=null){let l=null,a=null,r=null,c=null,d=null;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;const h=s||{};return this.options.horizontal?(h.x=l,h.y=t):(h.x=t,h.y=l),h.o=a,h.b=i,h.xp=null,h.yp=null,h.w=null,h.h=null,h.dataColor=r??c,h.dataTextColor=d,h},getSeriesMinMax(e,t){const n={minX:null,minY:null,maxX:null,maxY:null,maxDomain:null},i=this.options.horizontal;if(e.length){const s=!A.isNullOrUndefined(t),l={minX:e[0].x,minY:e[0].y,maxX:e[0].x,maxY:e[0].y,maxDomain:i?e[0].y:e[0].x,maxDomainIndex:0};for(let a=0;a<e.length;a++){const r=e[a],c=r.x,d=r.y,h=r.o;(!s||h!==t)&&(c<=l.minX&&(l.minX=c===null?0:c),d<=l.minY&&(l.minY=d===null?0:d),c>=l.maxX&&(l.maxX=c===null?0:c,i&&c!==null&&(l.maxDomain=d,l.maxDomainIndex=a)),d>=l.maxY&&(l.maxY=d===null?0:d,!i&&d!==null&&(l.maxDomain=c,l.maxDomainIndex=a)))}return l}return n},getVisibleWindowMaxSeries(e,t){var l;if(!Number.isFinite(e)||!Number.isFinite(t)||t<e)return null;const n=this.options.horizontal;let i=null;const s=Object.keys(this.seriesList);for(let a=0;a<s.length;a+=1){const r=this.seriesList[s[a]];if(r!=null&&r.show&&((l=r.data)!=null&&l.length)){const c=Math.max(0,e),d=Math.min(r.data.length-1,t);for(let h=c;h<=d;h+=1){const u=r.data[h],f=n?u==null?void 0:u.x:u==null?void 0:u.y;Number.isFinite(f)&&(!i||f>i.value)&&(i={sId:r.sId,value:f,index:h,domain:n?u==null?void 0:u.y:u==null?void 0:u.x})}}}return i},getSeriesValueOptForHeatMap(e){const{data:t,colorState:n,isGradient:i}=e,s=this.options.heatMapColor,l=s.colorsByRange.length||s.rangeCount,a=s.decimalPoint;let r,c=0,d=!1;t.forEach(({o:u})=>{c<u&&(c=Math.max(c,u)),u<0?d=!0:r===void 0?r=u:r=Math.min(r,u)}),d&&!i&&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 i=null,s=null,l=null,a="",r=0,c=!1,d=!1;if(e>-1){for(let h=0;h<t.length;h++){const u=t[h],f=this.seriesList[u],p=f.data[e];if(p&&f.show&&f.showLegend){const g=n?p.y:p.x,m=n?p.yp:p.xp;if(g!=null){const y=n?p.o||p.x:p.o||p.y;f.stackIndex?(r+=isNaN(p.o)?0:p.o,c=!0):r+=p.y,(l===null||l<=y)&&(l=y,a=u,i=g,s=m)}}}d={label:i,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:i}=e;let s;if("seriesID"in e){const l=this.getDataByValues(n,i);if(!l||!(l!=null&&l.xp)||!(l!=null&&l.yp))return null;s=[this.getHitItemByPosition([l.xp,l.yp],t,i,!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=i==null?void 0:i.map(r=>{var h,u;const c=this.getDataByValues(a,r);if(!c)return null;const d=this.getHitItemByPosition([(c==null?void 0:c.xp)??0,(c==null?void 0:c.yp)??0],t,r,!0);return d&&!d.sId&&(d.sId=a,d.label=((u=(h=this.data)==null?void 0:h.labels)==null?void 0:u[r])??d.label,d.dataIndex=r),d})}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]},getHitItemByPosition(e,t=!1,n,i=!1,s=!1){var V;const l=Object.keys(this.seriesList),a=!!this.options.horizontal,[r,c]=e;let d=n;if(d===void 0&&!t){const R=l.find(E=>{var v;const G=this.seriesList[E];return(G==null?void 0:G.show)&&((v=G==null?void 0:G.data)==null?void 0:v.length)>0});if(R){const E=this.seriesList[R].data,G=a?e[1]:e[0];let v=1/0,X=-1;for(let W=0;W<E.length;W++){const N=s||l.some(D=>{var Y,H,B,z;const O=this.seriesList[D];return(O==null?void 0:O.show)&&((H=(Y=O.data)==null?void 0:Y[W])==null?void 0:H.o)!==null&&((z=(B=O.data)==null?void 0:B[W])==null?void 0:z.o)!==void 0}),P=E[W];if(N&&P){let D;if(a?D=P.h?P.yp+P.h/2:P.yp:D=P.w?P.xp+P.w/2:P.xp,D!=null){const O=Math.abs(G-D);O<v&&(v=O,X=W)}}}X!==-1&&(d=X)}}let h=null,u=null,f=null,p=null,g="",m=null,y=1/0,C=!1,b=null,w=null,T=null,k=null,M="",Z=null,S=1/0,x=0,I=!1;for(let R=0;R<l.length;R++){const E=l[R],G=this.seriesList[E],v=t?G.findApproximateData:G.findGraphData;if(v){const X=v.call(G,e,a,d,i),W=X.data,N=X.index;if(W)if(A.isPieType(X.type))h=X.type,u=E,g=E,f=(W.ea-W.sa)/2,p=W.o,m=W.index;else{const P=a?W.y:W.x,D=a?W.yp:W.xp;if(P!=null){const O=a?W.o||W.x:W.o||W.y;G.stackIndex!=null?(x+=isNaN(W.o)?0:W.o,I=!0):x+=W.y;const Y=O!=null&&!Number.isNaN(O),H=W.xp!==null&&W.xp!==void 0&&W.yp!==null&&W.yp!==void 0;if(Y&&H){const B=A.calcBoxDistance(W,r,c);(M===""||B<S)&&(S=B,b=G.type,w=P,T=D,k=O,M=E,Z=N)}else Y&&M===""&&(b=G.type,w=P,T=D,k=O,M=E,Z=N);if(X.hit&&W.xp!==void 0&&W.yp!==void 0){const B=(W.xp-e[0])**2+(W.yp-e[1])**2;X.directHit?((!C||B<y)&&(y=B,h=G.type,u=P,f=D,p=O,g=E,m=N),C=!0):C||B<y&&(y=B,h=G.type,u=P,f=D,p=O,g=E,m=N)}}}}}if(s&&g===""&&M===""&&d!==void 0&&d>=0){const R=l.find(G=>{var X;const v=this.seriesList[G];return(v==null?void 0:v.show)&&((X=v==null?void 0:v.data)==null?void 0:X.length)>0}),E=R?(V=this.seriesList[R].data)==null?void 0:V[d]:null;E&&(w=a?E.y:E.x,Z=d)}const L=g!=="";return{type:L?h:b,label:L?u:w,pos:L?f:T,value:L?p:k,sId:L?g:M,acc:x,useStack:I,dataIndex:L?m:Z}},getLabelInfoByPosition(e,t){var m,y,C;const[n,i]=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=((m=Object.values(l).sort((b,w)=>w.pointSize??0-b.pointSize??0)[0])==null?void 0:m.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 u=s[d.units.rectStart],f=s[d.units.rectEnd];let p,g;if(h!=null&&h.use&&((y=d==null?void 0:d.labels)!=null&&y.length)){const{type:b,range:w,interval:T=1}=h,[k,M]=w??[0,d.labels.length],Z=Math.floor((+M-+k)/T)+1,S=(f-u)/Z,I=Math.floor(((t==="yAxis"||r?i:n)-u)/S);b==="step"?p=k+I:p=(d==null?void 0:d.labels.findIndex(V=>V===+k))+I}else if((C=d==null?void 0:d.labels)!=null&&C.length){const b=(f-u)/d.labels.length,T=Math.floor(((t==="yAxis"?i:n)-u)/b);p=d.labels.length>T?T:-1}else{let b,w;n<u-a?(b=u,w=0):n>f+a?(b=f,w=this.data.labels.length-1):b=n,g=this.getHitItemByPosition([b,i],c==null?void 0:c.useApproximateValue,w,!0,!0),p=g.dataIndex??-1}return{labelIndex:p,hitInfo:g}},getCurMouseLabelVal(e,t,n){const{type:i,horizontal:s}=this.options,l=e==="xAxis",a=l?"x":"y";let r="",c=-1;const d=()=>{let u="";switch(i){case"bar":case"line":{u=s&&!l||!s&&l?this.data.labels[n]:"";break}case"heatMap":{u=this.data.labels[a][n];break}}return u},h=()=>{let u="";const f={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:m}=this.axesSteps[a][0],{width:y,height:C}=this.axesRange[a][0].size,b=l?this.axesX:this.axesY,w=f[b[0].units.rectStart],T=f[b[0].units.rectEnd],k=Math.abs(t[l?0:1]-w),M=(l?y:C)/2,Z=Math.abs(w-T)/p,S=Math.floor((k+M)/Z);return Z*S+M>k&&Z*S-M<k&&(u=S*g+m),u};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((i,s)=>{const l=i,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!==null&&r.minX<l.x[c].min)&&(l.x[c].min=r.minX),r.minY!==null&&(l.y[d].min===null||r.minY!==null&&r.minY<l.y[d].min)&&(l.y[d].min=r.minY)):(r.minX!==null&&(l.x[c].min===null||r.minX!==null&&r.minX<l.x[c].min)&&(l.x[c].min=r.minX),(l.y[d].min===null||r.minY!==null&&r.minY<l.y[d].min)&&(l.y[d].min=r.minY));const h=this.seriesList[s].isExistGrp,u=l.x[c].max<0;(h&&u||!l.x[c].max||r.maxX>=l.x[c].max)&&(l.x[c].max=r.maxX,l.x[c].maxSID=s);const f=l.y[d].max<0;(h&&f||!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,i,s,l,a,r,c,d;const h=[],u={"$ev-root":1.5*Math.PI};for(let f=0;f<e.length;f++){const p=e[f];d=!0;for(let g=0;g<p.data.length;g++)if(t=p.data[g],n=t.value,d&&(d=t.id==="dummy"),!f)a=u["$ev-root"],l=2*Math.PI*(n/p.total),r=a+l,t.sa=a,t.ea=r,u["$ev-root"]+=l;else{if(i=this.getParentInfo(f-1,t.parent),!i)break;u[t.parent]||(u[t.parent]=i.sa),a=u[t.parent],c=i.ea-i.sa,s=p.total[t.parent]||0,l=c*(n/s),r=a+l,t.sa=a,t.ea=r,u[t.parent]+=l}d&&h.push(f)}for(let f=0;f<h.length;f++)this.pieDataSet.splice(h,1);this.options.reverse&&(this.pieDataSet=lb(this.pieDataSet))},getParentInfo(e,t){for(let n=e;n>=0;n--){const i=this.pieDataSet[n];for(let s=0;s<i.data.length;s++)if(i.data[s].id===t)return i.data[s]}return null},getAggregations(){const e=this.data.data,t=this.data.series,n={},i=Object.keys(t);return i==null||i.forEach(s=>{const l=e[s].map(f=>f!=null&&f.value?f.value:f),a=l[l.length-1],r=l.filter(f=>f!=null),c=Math.min(...r),d=Math.max(...r),h=r.reduce((f,p)=>f+p,0),u=h/r.length||0;(!A.checkSafeInteger(c)||!A.checkSafeInteger(d)||!A.checkSafeInteger(u)||!A.checkSafeInteger(h)||!A.checkSafeInteger(a))&&console.warn("[EVUI][Chart] The aggregated value exceeds 9007199254740991 or less than -9007199254740991."),n[s]={min:c,max:d,avg:u,total:h,last:a}}),n}},HS={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"}},Ht=["#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"],mi={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"},zS={show:!0,highlight:{pointSize:5},xAxisIndex:0,yAxisIndex:0,category:!0,showLegend:!0,showValue:{use:!1,fontSize:12,textColor:"#000000",formatter:null,decimalPoint:null}},FS={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,scaleChange:!1,labelStyle:{show:!0,fontSize:12,color:"#25262E",fontFamily:"Roboto",fontWeight:400,fitWidth:!1,fitDir:"right",alignToGridLine:!1,padding:0,fixWidth:void 0},showLastLabel:!1,lastLabelFontStyle:null,firstLabelFontStyle:null,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},Ao={color:"#FF0000",lineWidth:1,label:Dr},Ko={color:"#FAE59D"},AS={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"}}},Ct={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}},KS=Object.freeze([1,2,5]),Yr=["cross","crossRot","star","line"],ne={calculateX(e,t,n,i,s=0){if(e==null||e>n||e<t)return null;const l=i/(n-t);return Math.ceil(s+l*(e-t))},calculateSubX(e,t,n,i,s=0){if(e==null)return null;const l=i/(n-t);return Math.ceil(s+l*(e-t))},calculateY(e,t,n,i,s=0){let l;if(e==null||e>n||e<t)return null;const a=i/(n-t);return s?l=s-a*(e-(t||0)):l=-(a*(e-(t||0))),Math.floor(l)},drawPoint(e,t,n,i,s){if(!(isNaN(n)||n<=0)){if(t==="rect"){const l=1/Math.SQRT2*n;e.fillRect(i-l,s-l,2*l,2*l),e.strokeRect(i-l,s-l,2*l,2*l);return}e.beginPath(),this._appendPointPath(e,t,n,i,s),Yr.includes(t)||e.fill(),e.stroke()}},_appendPointPath(e,t,n,i,s){let l,a,r,c,d,h,u,f,p;switch(t){case"triangle":l=3*n/Math.sqrt(3),c=l*Math.sqrt(3)/2,e.moveTo(i-l/2,s+c/3),e.lineTo(i+l/2,s+c/3),e.lineTo(i,s-2*c/3),e.closePath();break;case"rectRounded":h=n/Math.SQRT2,u=i-h,f=s-h,p=Math.SQRT2*n,this.roundedRect(e,u,f,p,p,n/2),e.closePath();break;case"rectRot":d=1/Math.SQRT2*n,e.moveTo(i-d,s),e.lineTo(i,s+d),e.lineTo(i+d,s),e.lineTo(i,s-d),e.closePath();break;case"cross":e.moveTo(i,s+n),e.lineTo(i,s-n),e.moveTo(i-n,s),e.lineTo(i+n,s),e.closePath();break;case"crossRot":a=Math.cos(Math.PI/4)*n,r=Math.sin(Math.PI/4)*n,e.moveTo(i-a,s-r),e.lineTo(i+a,s+r),e.moveTo(i-a,s+r),e.lineTo(i+a,s-r),e.closePath();break;case"star":e.moveTo(i,s+n),e.lineTo(i,s-n),e.moveTo(i-n,s),e.lineTo(i+n,s),a=Math.cos(Math.PI/4)*n,r=Math.sin(Math.PI/4)*n,e.moveTo(i-a,s-r),e.lineTo(i+a,s+r),e.moveTo(i-a,s+r),e.lineTo(i+a,s-r),e.closePath();break;case"line":e.moveTo(i-n,s),e.lineTo(i+n,s),e.closePath();break;default:e.moveTo(i+n,s),e.arc(i,s,n,0,Math.PI*2);break}},drawPointBatch(e,t,n,i){if(!(isNaN(n)||n<=0||!i||!i.length)){if(t==="rect"){const s=1/Math.SQRT2*n;for(let l=0;l<i.length;l++)e.fillRect(i[l].xp-s,i[l].yp-s,2*s,2*s),e.strokeRect(i[l].xp-s,i[l].yp-s,2*s,2*s);return}e.beginPath();for(let s=0;s<i.length;s++)this._appendPointPath(e,t,n,i[s].xp,i[s].yp);Yr.includes(t)||e.fill(),e.stroke()}},roundedRect(e,t,n,i,s,l){const a=Math.PI,r=a/2;if(l){const c=Math.min(l,s/2,i/2),d=t+c,h=n+c,u=t+i-c,f=n+s-c;e.moveTo(t,h),d<u&&h<f?(e.arc(d,h,c,-a,-r),e.arc(u,h,c,-r,0),e.arc(u,f,c,0,r),e.arc(d,f,c,r,a)):d<u?(e.moveTo(d,n),e.arc(u,h,c,-r,r),e.arc(d,h,c,r,a+r)):h<f?(e.arc(d,h,c,-a,0),e.arc(d,f,c,0,a)):e.arc(d,h,c,-a,a),e.closePath(),e.moveTo(t,n)}else e.rect(t,n,i,s)},createGradient(e,t,n,i,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 u=0;u<i.length;u++){const f=i[u][0]??0,p=i[u][1]??"rgba(255, 255, 255, 0)",g=p.includes("rgba")?A.getOpacity(p):1,m=s?l:g;h.addColorStop(f,A.colorStringToRgba(p,m))}return h}},_S=new Set(["triangle","rect","rectRounded","rectRot","cross","crossRot","star","line"]),Or=Math.PI*2;class US{constructor(t,n,i){const s=He({},n,mi);Object.keys(s).forEach(l=>{this[l]=s[l]}),this.name===void 0&&(this.name=`series-${i}`),["color","pointFill","fillColor"].forEach(l=>{this[l]===void 0&&(this[l]=l==="pointFill"?this.color:Ht[i%Ht.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}_getValidGData(){const t=this.data,n=this._validGDataCache;if(n&&n.src===t&&n.length===t.length)return n.value;const i=t.filter(s=>!A.isNullOrUndefined(s.x));return this._validGDataCache={src:t,length:t.length,value:i},i}computeGeometry(t){if(!this.show)return;const n=t.scaleVersion!=null&&t.dataEpoch!=null;if(n&&this._lastDataEpoch===t.dataEpoch&&this._lastScaleVersion===t.scaleVersion&&this._lastGeomData===this.data)return;const{chartRect:i,labelOffset:s,axesSteps:l,displayOverflow:a}=t,r=this.useLinearInterpolation();let c=0;const d=l.x[this.xAxisIndex],h=l.y[this.yAxisIndex];let u=i.chartWidth-(s.left+s.right);const f=i.chartHeight-(s.top+s.bottom);this.combo&&(c=u/(this.data.length||1),u-=c,this.size.comboOffset=c);const p=i.x1+s.left+c/2,g=i.y2-s.bottom,m=d.graphMin,y=d.graphMax,C=h.graphMin,b=h.graphMax,w=u/(y-m),T=f/(b-C),k=C||0,M=S=>S==null||S<m||S>y?null:Math.ceil(p+w*(S-m)),Z=S=>{const x=a&&S>b?b:S;return x==null||x<C||x>b?null:Math.floor(g?g-T*(x-k):-(T*(x-k)))};for(let S=0;S<this.data.length;S++){const x=this.data[S];let I=M(x.x),L=Z(x.y);this.isExistGrp&&r&&x.o===null&&(L=Z(x.b??0)),I!==null&&(I+=A.aliasPixel(I)),x.xp=I,x.yp=L}n&&(this._lastDataEpoch=t.dataEpoch,this._lastScaleVersion=t.scaleVersion,this._lastGeomData=this.data)}hasRenderableValue(){return this.data.some(t=>t.o!==null&&t.o!==void 0)}draw(t){var O,Y,H,B,z,F,Q,U,ee;if(!this.show)return;const{ctx:n,chartRect:i,labelOffset:s,axesSteps:l,selectLabel:a,selectSeries:r,legendHitInfo:c,isBrush:d,unSelectedOpacity:h,displayOverflow:u}=t;if(this.computeGeometry(t),!this.hasRenderableValue()&&!this.isExistGrp)return;const f=a==null?void 0:a.option,p=(f==null?void 0:f.use)&&(f==null?void 0:f.useSeriesOpacity),g=((O=a==null?void 0:a.selected)==null?void 0:O.dataIndex)??[];let m;if(c)m=this.extent[(c==null?void 0:c.sId)===this.sId?"highlight":"downplay"];else if((Y=r==null?void 0:r.option)!=null&&Y.use&&((B=(H=r==null?void 0:r.selected)==null?void 0:H.seriesId)!=null&&B.length)){const j=(F=(z=r==null?void 0:r.selected)==null?void 0:z.seriesId)==null?void 0:F.includes(this.sId);m=this.extent[j?"highlight":"downplay"]}else p&&g.length?m=this.extent.downplay:m=this.extent.normal;m===this.extent.downplay&&(m={...m,opacity:h});const y=j=>j!=null&&j.includes("rgba")?A.getOpacity(j):m.opacity,C=this.color,b=y(C),w=this.pointFill,T=y(w),k=this.extent.downplay?this.fillOpacity*m.opacity:this.fillOpacity,M=this.lineWidth*m.lineWidth,Z=this._rgbaCache||(this._rgbaCache={}),S=(j,te,J)=>{const q=Z[j];if(q!==void 0&&q.s===te&&q.o===J)return q.v;const $=A.colorStringToRgba(te,J);return Z[j]={s:te,o:J,v:$},$};n.beginPath(),n.save(),n.lineJoin="round",n.lineWidth=M,n.strokeStyle=S("stroke",C,b),this.segments&&n.setLineDash(this.segments);const x=this.useLinearInterpolation();let I=0;const L=l.x[this.xAxisIndex],V=l.y[this.yAxisIndex];let R=i.chartWidth-(s.left+s.right);const E=i.chartHeight-(s.top+s.bottom);this.combo&&(I=R/(this.data.length||1),R-=I,this.size.comboOffset=I);const G=i.x1+s.left+I/2,v=i.y2-s.bottom,X=j=>ne.calculateX(j,L.graphMin,L.graphMax,R,G),W=j=>ne.calculateY(u&&j>V.graphMax?V.graphMax:j,V.graphMin,V.graphMax,E,v);let N,P=null,D=null;for(let j=0;j<this.data.length;j++){const te=this.data[j],J=te.xp,q=te.yp;x&&te.o===null||(J===null||q===null?N=void 0:(Yt(N==null?void 0:N.y)&&!this.isExistGrp||!x&&(Yt(N==null?void 0:N.y)||Yt(te.o))?(n.moveTo(J,q),P=J,D=q):(J!==P||q!==D)&&(n.lineTo(J,q),P=J,D=q),N=te))}if(n.stroke(),this.segments&&n.setLineDash([]),this.fill&&this.data.length){n.beginPath();const j=this.data.some(se=>se.o<0),te=j?W(0):i.y2-s.bottom,J=S("fill",this.fillColor||C,k);if((Q=this.fill)!=null&&Q.gradient){let se=this.data[0].yp,fe=this.data[0].y;this.data.forEach(ce=>{ce.yp&&ce.yp<=se?se=ce.yp:ce.y&&ce.y>=fe&&(fe=ce.y)});const ge=n.createLinearGradient(0,i.y2,0,se),le=m.opacity<1?J:C;ge.addColorStop(0,j?le:J),ge.addColorStop(.5,J),ge.addColorStop(1,le),n.fillStyle=ge}else n.fillStyle=J;let q=null,$=null;const ae=[],he=this.data.length;for(let se=0;se<he+1;se++){const fe=(U=this.data[se])==null?void 0:U.o;if(x&&ib(fe)||!x&&Yt(fe)){if(q!==null&&$!==null){let ge=q-1;for(let le=se-1;le>=q;le--){const ce=(ee=this.data[le])==null?void 0:ee.o;if(!Yt(ce)&&ce!==null){ge=le;break}}ae.push([q,ge]),q=null,$=null}}else x&&fe===null||(q=q===null?se:q),$=se}ae.forEach(([se,fe])=>{if(se===fe){const le=this.data[se];if(le.xp===null||le.yp===null)return;n.moveTo(le.xp-M,le.yp),n.lineTo(le.xp+M,le.yp),n.lineTo(le.xp+M,W(le.b)??te);return}let ge=!1;for(let le=se;le<=fe;le++){const ce=this.data[le];if(ce.xp!==null&&ce.yp!==null&&(ge?ce.o!==null&&n.lineTo(ce.xp,ce.yp):(n.moveTo(ce.xp,ce.yp),ge=!0)),le===fe)for(let Ie=fe;Ie>=se;Ie--){const Ve=this.data[Ie],kt=X(Ve.x);if(kt!==null&&Ve.o!==null){const Vt=W(Ve.b)??W(0);n.lineTo(kt,Vt)}}}}),n.fill()}if(!d){n.strokeStyle=S("stroke",C,b);const j=S("focus",w,1),te=S("blur",w,T);let J=!1;if(this.interpolation==="linear"){let le=0;for(let ce=0;ce<this.data.length&&!(this.data[ce].o!==null&&(le++,le>1));ce++);J=le===1}const q=g.length?new Set(g):null,$=this.pointSize,ae=this.pointStyle,he=this.data,se=he.length,fe=!_S.has(ae),ge=le=>{const ce=he[le];if(ce.xp===null||ce.yp===null||ce.o===null)return 0;let be;if(J)be=!0;else if(x)be=!1;else{const Ve=le>0?he[le-1].o:null,kt=le+1<se?he[le+1].o:null;be=Ve==null&&kt==null}const Ie=q?q.has(le):!1;return this.point||be||Ie?Ie&&!c?2:1:0};if(fe){let le=!1,ce=null;for(let be=0;be<se;be++){const Ie=ge(be);if(Ie!==0){const Ve=he[be];Ie===2?(ce===null&&(ce=[]),ce.push(Ve)):(le||(n.beginPath(),le=!0),n.moveTo(Ve.xp+$,Ve.yp),n.arc(Ve.xp,Ve.yp,$,0,Or))}}if(le&&(n.fillStyle=te,n.fill(),n.stroke()),ce!==null){n.beginPath();for(let be=0;be<ce.length;be++){const Ie=ce[be];n.moveTo(Ie.xp+$,Ie.yp),n.arc(Ie.xp,Ie.yp,$,0,Or)}n.fillStyle=j,n.fill(),n.stroke()}}else{let le=null,ce=null;for(let be=0;be<se;be++){const Ie=ge(be);if(Ie!==0){const Ve=he[be];Ie===2?(ce===null&&(ce=[]),ce.push(Ve)):(le===null&&(le=[]),le.push(Ve))}}le!==null&&(n.fillStyle=te,ne.drawPointBatch(n,ae,$,le)),ce!==null&&(n.fillStyle=j,ne.drawPointBatch(n,ae,$,ce))}}n.restore()}itemHighlight(t,n){const i=t.data,s=n,{xp:l,yp:a,o:r}=i;s.save(),l!==null&&a!==null&&r!==null&&this.pointHighlight&&(s.strokeStyle=A.colorStringToRgba(this.color,0),s.fillStyle=A.colorStringToRgba(this.color,this.highlight.maxShadowOpacity),ne.drawPoint(s,this.pointStyle,this.highlight.maxShadowSize,l,a),s.fillStyle=this.color,ne.drawPoint(s,this.pointStyle,this.highlight.maxSize,l,a),s.fillStyle="#fff",ne.drawPoint(s,this.pointStyle,this.highlight.defaultSize,l,a)),s.restore()}findGraphData(t,n,i,s){var f;const l=t[0],a=t[1],r={data:null,hit:!1,color:this.color},c=this._getValidGData(),d=this.useLinearInterpolation(),h=Math.max((this.pointSize??mi.pointSize)+mi.pointSize,mi.highlight.maxSize),u=p=>{if(!p||p.xp===void 0||p.yp===void 0)return!1;const g=l-p.xp,m=a-p.yp;return g*g+m*m<=h*h};if(c!=null&&c.length)if(typeof i=="number"&&this.show){if(r.data=c[i],r.index=i,r.data){const p=c[i];p.o!==null&&p.o!==void 0&&p.yp!==null&&p.yp!==void 0&&(Math.abs(a-p.yp)<=15&&(r.hit=!0),u(p)&&(r.hit=!0,r.directHit=!0))}}else if(typeof this.beforeFindItemIndex=="number"&&this.beforeFindItemIndex!==-1&&this.show&&s)r.data=c[this.beforeFindItemIndex],r.index=this.beforeFindItemIndex;else{let p=1/0,g=-1;const m=[];c.forEach((w,T)=>{w.xp!==null&&w.yp!==null&&w.o!==null&&m.push({...w,originalIndex:T})}),m.length===0&&c.forEach((w,T)=>{m.push({...w,originalIndex:T})});let y=0,C=m.length-1;for(;y<=C;){const w=Math.floor((y+C)/2),T=m[w],k=Math.abs(l-T.xp);if(k<p&&(p=k,g=T.originalIndex),T.xp<l){if(y=w+1,y<m.length){const M=Math.abs(l-m[y].xp);M<p&&(p=M,g=m[y].originalIndex)}}else if(T.xp>l){if(C=w-1,C>=0){const M=Math.abs(l-m[C].xp);M<p&&(p=M,g=m[C].originalIndex)}}else break}const b=m.findIndex(w=>w.originalIndex===g);if(b!==-1)for(let w=Math.max(0,b-2);w<=Math.min(m.length-1,b+2);w++){const T=m[w],k=Math.abs(l-T.xp);k<p&&(p=k,g=T.originalIndex)}if(g!==-1){let w=50;if(c.length>1){const k=[];for(let M=1;M<c.length;M++)c[M].xp!==null&&c[M-1].xp!==null&&k.push(Math.abs(c[M].xp-c[M-1].xp));k.length>0&&(w=k.reduce((M,Z)=>M+Z,0)/k.length)}const T=Math.max(w,1);if(p<=T)r.data=c[g],r.index=g;else{let k=!1,M=d?1/0:T;const Z=d?m:c;for(let S=0;S<Z.length;S++){const x=Math.abs(l-Z[S].xp);x<=M&&(k=!0,M=x,g=d?Z[S].originalIndex:S)}k&&(r.data=c[g],r.index=g)}if(r.data){const k=c[g];Math.abs(a-k.yp)<=15&&(r.hit=!0),u(k)&&(r.hit=!0,r.directHit=!0)}}}return s||(this.beforeMouseXp=l,this.beforeMouseYp=a,typeof r.index=="number"&&(this.beforeFindItemIndex=r.index)),d&&((f=r==null?void 0:r.data)==null?void 0:f.o)===null&&(r.data=null),r}findApproximateData(t){var f,p;const n=t[0],i=t[1],s={data:null,hit:!1,color:this.color},l=this.data.filter(g=>!A.isNullOrUndefined(g.x));if(!l.length)return s;const a=l.length>1?Math.abs(((f=l[1])==null?void 0:f.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,u=1/0;for(;c<=d;){const g=Math.floor((c+d)/2),m=l[g].xp;if(m-r<=n&&n<=m+r){const y=Math.max(0,g-2),C=Math.min(l.length-1,g+2);for(let b=y;b<=C;b++)if(l[b].xp!==null&&l[b].yp!==null){const w=Math.sqrt((n-l[b].xp)**2+(i-l[b].yp)**2);w<u&&(u=w,h=b)}return h!==-1&&(s.data=l[h],s.index=h,u<5&&(s.hit=!0)),s}else if(m+r<n){if(g<d&&n<l[g+1].xp){const y=Math.abs(l[g].xp-n),C=Math.abs(l[g+1].xp-n);s.data=y>C?l[g+1]:l[g],s.index=y>C?g+1:g;const b=s.data;return Math.abs(i-b.yp)<10&&(s.hit=!0),s}c=g+1}else{if(g>0&&n>l[g-1].xp){const y=Math.abs(l[g-1].xp-n),C=Math.abs(l[g].xp-n);s.data=y>C?l[g]:l[g-1],s.index=y>C?g:g-1;const b=s.data;return Math.abs(i-b.yp)<10&&(s.hit=!0),s}d=g-1}}return s}findItems({xsp:t,width:n}){const i=t+n;return this.data.filter(s=>t-1<=s.xp&&s.xp<=i+1)}}class JS{constructor(t,n,i,s=!1){const l=Ro({},mi,n);Object.keys(l).forEach(a=>{this[a]=l[a]}),this.name===void 0&&(this.name=`series-${i}`),["color","pointFill","fillColor","overflowColor"].forEach(a=>{this[a]===void 0&&(this[a]=Ht[i%Ht.length])}),this.sId=t,this.data=[],this.type="scatter",this.realTimeScatter=s,this._rtTotalCount=0,this._colorCache=new Map}getCachedColor(t,n){const i=`${t}_${n}`;if(this._colorCache.has(i))return this._colorCache.get(i);const s=A.colorStringToRgba(t,n);if(this._colorCache.size>100){const l=this._colorCache.keys().next().value;this._colorCache.delete(l)}return this._colorCache.set(i,s),s}draw(t){this.show&&(this.computeGeometry(t),this.realTimeScatter?this.realTimeScatterDraw(t):this.defaultScatterDraw(t))}computeGeometry(t){this.show&&(this.realTimeScatter?this.computeRealTimeGeometry(t):this.computeDefaultGeometry(t))}computeDefaultGeometry(t){const{duple:n,legendHitInfo:i,coordinateDedupe:s}=t,l=new Set,a=s!==!1;for(let r=0;r<this.data.length;r++){const c=this.data[r],d=A.coordinateKey(c.x,c.y);let h;i?h=i.sId===this.sId:a?h=n.get(d)===this.sId&&!l.has(d):h=!0,h&&(this.calcItem(c,t),c.xp!==null&&c.yp!==null&&a&&!i&&l.add(d))}}computeRealTimeGeometry(t){var r,c,d,h,u,f;const{duple:n,legendHitInfo:i,coordinateDedupe:s}=t,l=s!==!1;let a=0;for(let p=0;p<((c=(r=this.data[this.sId])==null?void 0:r.dataGroup)==null?void 0:c.length);p++)for(let g=0;g<((h=(d=this.data[this.sId])==null?void 0:d.dataGroup[p])==null?void 0:h.data.length);g++){const m=(f=(u=this.data[this.sId])==null?void 0:u.dataGroup[p])==null?void 0:f.data[g];a++;let y;i?y=i.sId===this.sId:l?y=n.get(A.coordinateKey(m.x,m.y))===this.sId:y=!0,y&&this.calcItem(m,t)}this._rtTotalCount=a}getOpacity(t,n,i){const s=n.includes("rgba")?A.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)!==i),l?c:s}calcItem(t,n){const{chartRect:i,labelOffset:s,axesSteps:l,displayOverflow:a}=n;let r;const c=l.x[this.xAxisIndex],d=l.y[this.yAxisIndex],h=i.chartWidth-(s.left+s.right),u=i.chartHeight-(s.top+s.bottom),f=i.x1+s.left,p=i.y2-s.bottom;let g=ne.calculateX(t.x,c.graphMin,c.graphMax,h,f);const m=ne.calculateY(a&&t.y>d.graphMax?d.graphMax:t.y,d.graphMin,d.graphMax,u,p);g!==null&&(r=A.aliasPixel(g),g+=r),t.xp=g,t.yp=m}defaultScatterDraw(t){const{ctx:n,axesSteps:i,duple:s,legendHitInfo:l,coordinateDedupe:a}=t,r=i.y[this.yAxisIndex],c=new Set,d=a!==!1,h=d&&!l,u=h?new Map:null;for(let f=0;f<this.data.length;f++){const p=this.data[f],g=f,m=A.coordinateKey(p.x,p.y);let y;if(l?y=l.sId===this.sId:d?y=s.get(m)===this.sId&&!c.has(m):y=!0,y&&p.xp!==null&&p.yp!==null){const b=p.y>r.graphMax&&this.overflowColor||p.dataColor||this.color,w=this.getOpacity(t,b,g),T=this.getCachedColor(b,w),k=p.dataColor||this.pointFill,M=this.getOpacity(t,k,g),Z=this.getCachedColor(k,M);if(h){const S=`${T} ${Z}`;let x=u.get(S);x||(x={strokeStyle:T,fillStyle:Z,points:[]},u.set(S,x)),x.points.push(p),c.add(m)}else n.strokeStyle=T,n.fillStyle=Z,ne.drawPoint(n,this.pointStyle,this.pointSize,p.xp,p.yp)}}h&&u.forEach(f=>{n.strokeStyle=f.strokeStyle,n.fillStyle=f.fillStyle,ne.drawPointBatch(n,this.pointStyle,this.pointSize,f.points)})}realTimeScatterDraw(t){var g,m,y,C,b,w;const{ctx:n,axesSteps:i,duple:s,legendHitInfo:l,coordinateDedupe:a}=t,r=i.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;const u=a!==!1,f=u&&!l,p=f?new Map:null;for(let T=0;T<((m=(g=this.data[this.sId])==null?void 0:g.dataGroup)==null?void 0:m.length);T++)for(let k=0;k<((C=(y=this.data[this.sId])==null?void 0:y.dataGroup[T])==null?void 0:C.data.length);k++){const M=(w=(b=this.data[this.sId])==null?void 0:b.dataGroup[T])==null?void 0:w.data[k];h++;let Z;if(l?Z=l.sId===this.sId:u?Z=s.get(M.k??A.coordinateKey(M.x,M.y))===this.sId:Z=!0,Z&&M.xp!==null&&M.yp!==null){const S=M.y>r.graphMax&&this.overflowColor,x=S||M.color||this.color,I=S||M.color||this.pointFill||this.color,L=this.getOpacity(t,x,k),V=this.getOpacity(t,I,k),R=this.getCachedColor(x,L),E=this.getCachedColor(I,V);if(f){const G=`${R} ${E}`;let v=p.get(G);v||(v={strokeStyle:R,fillStyle:E,points:[]},p.set(G,v)),v.points.push(M)}else n.strokeStyle=R,n.fillStyle=E,ne.drawPoint(n,c,d,M.xp,M.yp)}}f&&p.forEach(T=>{n.strokeStyle=T.strokeStyle,n.fillStyle=T.fillStyle,ne.drawPointBatch(n,c,d,T.points)}),this._rtTotalCount=h}realTimeScatterDrawStrip(t,n,i){var u;if(!this.show)return;const s=(u=this.data[this.sId])==null?void 0:u.dataGroup;if(!s)return;const{duple:l,coordinateDedupe:a}=i,r=a!==!1&&!!l,c=i.axesSteps.y[this.yAxisIndex],d=typeof this.pointStyle=="string"?this.pointStyle:this.pointStyle.value,h=typeof this.pointSize=="number"?this.pointSize:this.pointSize.value;for(let f=0;f<n.length;f++){const p=s[n[f]];if(p!=null&&p.data)for(let g=0;g<p.data.length;g++){const m=p.data[g];if(!(r&&l.get(m.k??A.coordinateKey(m.x,m.y))!==this.sId)&&(this.calcItem(m,i),m.xp!==null&&m.yp!==null)){const y=m.y>c.graphMax&&this.overflowColor,C=y||m.color||this.color,b=y||m.color||this.pointFill||this.color,w=this.getOpacity(i,C,g),T=this.getOpacity(i,b,g);t.strokeStyle=this.getCachedColor(C,w),t.fillStyle=this.getCachedColor(b,T),ne.drawPoint(t,d,h,m.xp,m.yp)}}}}refreshRtHitCoords(t){var i,s;const n=(i=this.data[this.sId])==null?void 0:i.dataGroup;if(n)for(let l=0;l<n.length;l++){const a=(s=n[l])==null?void 0:s.data;if(a)for(let r=0;r<a.length;r++)this.calcItem(a[r],t)}}refreshRtTotalCount(){var i,s,l;let t=0;const n=(i=this.data[this.sId])==null?void 0:i.dataGroup;if(n)for(let a=0;a<n.length;a++)t+=((l=(s=n[a])==null?void 0:s.data)==null?void 0:l.length)??0;return this._rtTotalCount=t,t}findItemsInRange(t,n,i,s,l){return t.filter(a=>n-1<=a.xp&&a.xp<=s+1&&i-1<=a.yp&&a.yp<=l+1)}defaultScatterFindItems(t,n,i,s,l){return this.findItemsInRange(t,n,i,s,l)}realTimeScatterFindItems(t,n,i,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,i,s,l))}return a}findItems({xsp:t,ysp:n,width:i,height:s}){const l=this.data,a=t+i,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 i=t.data,s=n,l=i.xp,a=i.yp;if(s.save(),l!==null&&a!==null){const r=i.dataColor||this.color,c=i.dataColor||this.pointFill;s.strokeStyle=this.getCachedColor(r,0),s.fillStyle=this.getCachedColor(c,this.highlight.maxShadowOpacity),ne.drawPoint(s,this.pointStyle,this.highlight.maxShadowSize,l,a),s.fillStyle=r,ne.drawPoint(s,this.pointStyle,this.highlight.maxSize,l,a),s.fillStyle="#fff",ne.drawPoint(s,this.pointStyle,this.highlight.defaultSize,l,a)}s.restore()}findGraphData(t){var c;const n=t[0],i=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 u=this._rtTotalCount-1;for(let f=d.length-1;f>=0;f--){const p=d[f];if(p!=null&&p.data)for(let g=p.data.length-1;g>=0;g--){const m=p.data[g];if(m.xp!==null&&m.yp!==null){const y=m.xp,C=m.yp;if(y-l<=n&&n<=y+l&&C-l<=i&&i<=C+l)return s.data=m,s.index=u,s.hit=!0,s}u--}}return s}const a=this.data,r=a.findIndex(d=>{const h=d.xp,u=d.yp;return h-l<=n&&n<=h+l&&u-l<=i&&i<=u+l});return r>-1&&(s.data=a[r],s.index=r,s.hit=!0),s}}class Hr{constructor(t,n,i,s){const l=He({},n,zS);Object.keys(l).forEach(a=>{this[a]=l[a]}),this.name===void 0&&(this.name=`series-${i}`),this.color===void 0&&(this.color=Ht[i%Ht.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}}computeGeometry(t){if(!this.show)return;const n=t.scaleVersion!=null&&t.dataEpoch!=null,i=t.showIndex??0,s=t.showSeriesCount??0;if(n&&this._lastDataEpoch===t.dataEpoch&&this._lastScaleVersion===t.scaleVersion&&this._lastShowIndex===i&&this._lastShowSeriesCount===s&&this._lastGeomData===this.data)return;const l=t.chartRect,a=t.labelOffset,r=t.axesSteps,c=t.showIndex,d=t.thickness,h=t.showSeriesCount;this.isHorizontal=t.isHorizontal;const{isHorizontal:u}=this;let f,p;const g=r.x[this.xAxisIndex],m=r.y[this.yAxisIndex];let y=this.data.length;const[C,b]=u?[m.minIndex,m.maxIndex]:[g.minIndex,g.maxIndex];Re(C)&&Re(b)&&(y=b-C+1);const w=l.chartWidth-(a.left+a.right),T=l.chartHeight-(a.top+a.bottom),k=l.x1+a.left,M=l.y2-a.bottom,Z=ne.calculateX(0,g.graphMin,g.graphMax,w),S=ne.calculateY(0,m.graphMin,m.graphMax,T),x=u?k+Z:k,I=u?M:M+S,L=u?T:w,V=L/(y||1);let R;t.cPadRatio>=1||t.cPadRatio<=0?R=2:R=Math.max(L*(t.cPadRatio/2)/y,2);let G,v,X;G=V>R*2?V-R*2:V,G=this.isExistGrp?G:G/h;const W=this.calculateBarSize(d,G);v=u?null:W,X=u?W:null;const N=u?(G-X)/2:(G-v)/2,P=this.isExistGrp?1:c+1;this.size.cat=V,this.size.bar=G,this.size.cPad=R,this.size.bPad=N,this.size.w=v,this.size.h=X,this.size.ix=P,this.chartRect=l,this.labelOffset=a,this.borderRadius=t.borderRadius,this.filteredCount=y;const D=Re(C)?C:0,O=Re(b)?b:this.data.length-1;this.visibleStartIndex=D;for(let Y=D;Y<=O;Y++){const H=Y-D,B=this.data[Y];if(B){const z=u?I-V*H-R:x+V*H+R;if(u?(f=x,p=Math.round(z-(G*P-(X+N)))):(f=Math.round(z+(G*P-(v+N))),p=I),u){const F=B.b?B.o:B.x,Q=t.displayOverflow&&F>g.graphMax?g.graphMax:F;v=ne.calculateX(Q,g.graphMin,g.graphMax,w,-Z),B.b&&(f=ne.calculateX(B.b,g.graphMin,g.graphMax,w,x-Z));const U=F>0?-1:1;v=F&&v!==null&&Math.abs(v)===0?U:v}else{const F=B.b?B.o:B.y,Q=t.displayOverflow&&F>m.graphMax?m.graphMax:F;X=ne.calculateY(Q,m.graphMin,m.graphMax,T,-S),B.b&&(p=ne.calculateY(B.b,m.graphMin,m.graphMax,T,I-S));const U=F>0?-1:1;X=F&&X!==null&&Math.abs(X)===0?U:X}B.xp=f,B.yp=p,B.w=v,B.h=u?-X:X,B.index=Y}}n&&(this._lastDataEpoch=t.dataEpoch,this._lastScaleVersion=t.scaleVersion,this._lastShowIndex=i,this._lastShowSeriesCount=s,this._lastGeomData=this.data)}draw(t){var H,B,z,F,Q;if(!this.show)return;this.computeGeometry(t);const n=t.ctx,i=t.chartRect,s=t.labelOffset,l=t.axesSteps,a=t.showIndex,r=t.thickness,c=t.showSeriesCount,d=t.displayOverflow;this.isHorizontal=t.isHorizontal;const{isHorizontal:h,showValue:u}=this;let f,p;const g=l.x[this.xAxisIndex],m=l.y[this.yAxisIndex],[y,C]=h?[m.minIndex,m.maxIndex]:[g.minIndex,g.maxIndex],b=Re(y)&&Re(C),w=b?y:0,T=b?C:this.data.length-1,k=T-w+1,M=i.chartWidth-(s.left+s.right),Z=i.chartHeight-(s.top+s.bottom),S=i.x1+s.left,x=i.y2-s.bottom,I=ne.calculateX(0,g.graphMin,g.graphMax,M),L=ne.calculateY(0,m.graphMin,m.graphMax,Z),V=h?S+I:S,R=h?x:x+L,E=h?Z:M,G=E/(k||1);let v;t.cPadRatio>=1||t.cPadRatio<=0?v=2:v=Math.max(E*(t.cPadRatio/2)/k,2);let W,N,P;W=G>v*2?G-v*2:G,W=this.isExistGrp?W:W/c;const D=this.calculateBarSize(r,W);N=h?null:D,P=h?D:null;const O=h?(W-P)/2:(W-N)/2,Y=this.isExistGrp?1:a+1;this.size.cat=G,this.size.bar=W,this.size.cPad=v,this.size.bPad=O,this.size.w=N,this.size.h=P,this.size.ix=Y,this.chartRect=i,this.labelOffset=s,this.borderRadius=t.borderRadius,this.filteredCount=k,this.visibleStartIndex=w;for(let U=w;U<=T;U++){const ee=U-w,j=this.data[U];if(j){const te=h?R-G*ee-v:V+G*ee+v;if(h?(f=V,p=Math.round(te-(W*Y-(P+O)))):(f=Math.round(te+(W*Y-(N+O))),p=R),h){const le=j.b?j.o:j.x,ce=d&&le>g.graphMax?g.graphMax:le;N=ne.calculateX(ce,g.graphMin,g.graphMax,M,-I),j.b&&(f=ne.calculateX(j.b,g.graphMin,g.graphMax,M,V-I));const be=le>0?-1:1;N=le&&N!==null&&Math.abs(N)===0?be:N}else{const le=j.b?j.o:j.y,ce=d&&le>m.graphMax?m.graphMax:le;P=ne.calculateY(ce,m.graphMin,m.graphMax,Z,-L),j.b&&(p=ne.calculateY(j.b,m.graphMin,m.graphMax,Z,R-L));const be=le>0?-1:1;P=le&&P!==null&&Math.abs(P)===0?be:P}const J=j.dataColor||this.color,q=t==null?void 0:t.legendHitInfo,$=(H=t==null?void 0:t.selectLabel)==null?void 0:H.option,ae=(B=t==null?void 0:t.selectItem)==null?void 0:B.option,he=((F=(z=t==null?void 0:t.selectLabel)==null?void 0:z.selected)==null?void 0:F.dataIndex)??[],{dataIndex:se,seriesID:fe}=((Q=t==null?void 0:t.selectItem)==null?void 0:Q.selected)??{};let ge=!1;if(q?ge=(q==null?void 0:q.sId)!==this.sId:$!=null&&$.use&&($!=null&&$.useSeriesOpacity)?ge=he.length&&!he.includes(U):yt(se)&&(ae!=null&&ae.useSeriesOpacity)&&(this.isExistGrp?ge=se!==U:ge=se!==U||fe!==this.sId),typeof J!="string")n.fillStyle=ne.createGradient(n,h,{x:f,y:p,w:N,h:P},J,ge,t.unSelectedOpacity);else{const le=J.includes("rgba")?A.getOpacity(J):1,ce=ge?t.unSelectedOpacity:le;n.fillStyle=A.colorStringToRgba(J,ce)}this.drawBar({ctx:n,positions:{x:f,y:p,w:N,h:P}}),u.use&&this.drawValueLabels({context:n,data:j,positions:{x:f,y:p,h:P,w:N},isHighlight:!1,textColor:j.dataTextColor,index:U})}}}itemHighlight(t,n,i,s){const l=this.showValue,a=t.data,r=n,c=a.xp,d=a.yp,h=a.w,u=a.h;r.save(),r.shadowOffsetX=0,r.shadowOffsetY=0,r.shadowBlur=4;const f=t.data.dataColor||this.color;if(typeof f!="string"){const p=ne.createGradient(r,this.isHorizontal,{x:c,y:d,w:h,h:u},f,!1,s);r.fillStyle=p,r.shadowColor=f[f.length-1][1]}else r.fillStyle=f,r.shadowColor=f;r.beginPath(),this.drawBar({ctx:r,positions:{x:c,y:d,w:h,h:this.isHorizontal?-u:u}}),l.use&&this.drawValueLabels({context:r,data:a,positions:{x:c,y:d,h:u,w:h},isHighlight:!0,textColor:t.data.dataTextColor||t.dataTextColor,index:i}),r.restore()}findGraphData(t,n,i,s){if(typeof i=="number"&&this.show&&s){const l=this.data,a={data:null,hit:!1,color:this.color},r=this.visibleStartIndex??0,c=r+(this.filteredCount??l.length)-1,d=Math.max(r,Math.min(i,c));return l[d]&&(a.data=l[d],a.index=d,a.hit=this.isPointInBar(t,l[d]),a.directHit=a.hit),a}return n?this.findGraphRangeCount(t):this.findGraphRange(t)}binarySearchBar(t,n){const[i,s]=t,l={data:null,hit:!1,color:this.color},a=this.data,r=this.visibleStartIndex??0,c=this.filteredCount??a.length;let d=r,h=Math.min(r+c-1,a.length-1);for(;d<=h;){const u=Math.floor((d+h)/2),f=a[u];if(!f){console.warn(`[EVUI][Bar] binarySearchBar: gdata[${u}] is falsy`);break}const{xp:p,yp:g,w:m,h:y}=f,C=p+m,b=g+y;if(n?b<=s&&s<=g:p<=i&&i<=C)return l.data=f,l.index=f.index,l.hit=this.isPointInBar(t,f),l.directHit=l.hit,l;(n?!(b<s):p+4<i)?d=u+1:h=u-1}return l}findGraphRange(t){return this.binarySearchBar(t,!1)}findGraphRangeCount(t){return this.binarySearchBar(t,!0)}drawValueLabels({context:t,data:n,positions:i,isHighlight:s,textColor:l,index:a}){const r=this.isHorizontal,{fontSize:c,textColor:d,align:h,formatter:u,decimalPoint:f}=this.showValue,{x:p,y:g,w:m,h:y}=i,C=t;C.save(),C.beginPath(),C.font=`normal normal normal ${c}px Roboto`,C.fillStyle=l||d,C.lineWidth=1,C.textBaseline="middle",C.textAlign=r&&h!=="center"?"left":"center";let b;const w=yt(this.stackIndex);w?b=n.o:b=(r?n.x:n.y)??"";let T;u&&(T=u(b,{label:r?n.y:n.x,index:a})),(!u||typeof T!="string")&&(T=A.labelSignFormat(b,f)??"");const k=b<0,M=Math.round(C.measureText(T).width),Z=c,S=r&&h!=="end"?10:4,x=k?p-S:p+S,I=k?g+S:g-S,L=p+m/2,V=s?g+y/2:g-y/2,R=r?V+c*.1:V,E=Math.abs(m),G=Math.abs(y),v=E-S,X=G-S,W=M<=E&&E>=Z;switch(h){case"start":{if(r){if(M<v&&Z<G){const N=k?x-M:x;C.fillText(T,N,R)}}else if(W&&Z+S<=G){const N=k?g+Z/2+S:g-Z/2-S;C.fillText(T,L,N)}break}case"center":{r?M<v&&Z<G&&C.fillText(T,L,R):W&&Z<X&&C.fillText(T,L,g+y/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,P=this.chartRect.x2-this.labelOffset.right;if(Z<this.size.bar)if(k){const D=p-S+m-M;D>N&&C.fillText(T,D,R)}else{const D=p+S+m;D+M<P&&C.fillText(T,D,R)}}else{const N=this.chartRect.y1+this.labelOffset.top,P=this.chartRect.y2-this.labelOffset.bottom;if(M<=this.size.bar)if(k){const D=g+y+S+Z/2;D+Z/2<=P&&C.fillText(T,L,D)}else{const D=g+y-S-Z/2;D-Z/2>=N&&C.fillText(T,L,D)}}break}default:case"end":{if(r){if(M<v&&Z<G){const N=k?p+m+S:p+m-M-S;C.fillText(T,N,R)}}else if(k){const N=g+y-Z/2-S;N>I&&W&&Z+S<=G&&C.fillText(T,L,N)}else W&&Z+S<=G&&C.fillText(T,L,g+y+Z/2+S);break}}C.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:i,borderRadius:s}=this,l="stackIndex"in this,a=s&&s>0,{x:r,y:c,w:d}=n,h=i?-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[i,s]=t,{xp:l,yp:a,w:r,h:c}=n,d=l+r,h=a+c;return l<=i&&i<=d&&h<=s&&s<=a}drawRoundedRect(t,n){const{chartRect:i,labelOffset:s,isHorizontal:l,borderRadius:a}=this,{x:r,y:c}=n;let{w:d,h}=n,u=a;const f=new Path2D;f.rect(i.x1+s.left,i.y1,i.chartWidth-s.right,i.chartHeight-s.bottom),t.clip(f),t.beginPath(),t.moveTo(r,c),Math.abs(d)<u*2&&(u=Math.abs(d)/2),Math.abs(h)<u*2&&(u=Math.abs(h)/2),l?d<0?(d+=u,t.lineTo(r+d,c),t.arcTo(r+d-u,c,r+d-u,c-u,u),t.arcTo(r+d-u,c-h,r+d,c-h,u),t.lineTo(r,c-h),t.lineTo(r,c)):(d-=u,t.lineTo(r+d,c),t.arcTo(r+d+u,c,r+d+u,c-u,u),t.arcTo(r+d+u,c-h,r+d,c-h,u),t.lineTo(r,c-h),t.lineTo(r,c)):h>0?(h-=u,t.lineTo(r+d,c),t.lineTo(r+d,c+h),t.arcTo(r+d,c+h+u,r-d+u,c+h+u,u),t.arcTo(r,c+h+u,r,c+h,u),t.lineTo(r,c)):(h+=u,t.lineTo(r+d,c),t.lineTo(r+d,c+h),t.arcTo(r+d,c+h-u,r+d-u,c+h-u,u),t.arcTo(r,c+h-u,r,c+h,u),t.lineTo(r,c)),t.fill(),t.closePath()}}class jS extends Hr{computeGeometry(t){if(!this.show)return;const n=t.chartRect,i=t.labelOffset,s=t.axesSteps,l=t.showIndex,a=t.isHorizontal,r=t.thickness,c=t.showSeriesCount;let d,h;const u=s.x[this.xAxisIndex],f=s.y[this.yAxisIndex],p=n.chartWidth-(i.left+i.right),g=n.chartHeight-(i.top+i.bottom),m=n.x1+i.left,y=n.y2-i.bottom,C=n.x2-i.right,w=(a?g:p)/(this.data.length||1),T=2;let k;this.isExistGrp?k=w-T*2:k=(w-T*2)/c;const Z=typeof r=="string"&&/[0-9]+px/.test(r)?Math.min(k,Number(r.replace("px",""))):typeof r=="number"&&r<=1&&r>=0?Math.ceil(k*r):k;let S=a?null:Z,x=a?null:Z,I=a?Z:null;const L=a?(k-I)/2:(k-S)/2,V=this.isExistGrp?1:l+1;this.size.cat=w,this.size.bar=k,this.size.cPad=T,this.size.bPad=L,this.size.w=S,this.size.ix=V,this.chartRect=n,this.labelOffset=i,this.borderRadius=t.borderRadius,this.data.forEach(R=>{a?(d=m,h=ne.calculateY(R.y,f.graphMin,f.graphMax,g,y)):(d=ne.calculateSubX(R.x,u.graphMin,u.graphMax,p,m),d<m?(x-=m-d,d=d+S<m?null:m):d+S>C&&(x-=x-(C-d)),d>=C&&(d=null),d!==null&&(d+=Math.ceil(k*V)-Math.round(S+L)),h=y),a?R.b?(S=ne.calculateX(R.x-R.b,u.graphMin,u.graphMax,p),d=ne.calculateX(R.b,u.graphMin,u.graphMax,p,m)):S=ne.calculateX(R.x,u.graphMin,u.graphMax,p):R.b?(I=ne.calculateY(R.y-R.b,f.graphMin,f.graphMax,g),h=ne.calculateY(R.b,f.graphMin,f.graphMax,g,y)):I=ne.calculateY(R.y,f.graphMin,f.graphMax,g),d!==null&&h!==null&&typeof(R.dataColor||this.color)!="string"&&(S=S!==x?x:S),x=S,R.xp=d,R.yp=h,R.w=S,R.h=a?-I:I})}draw(t){if(!this.show)return;this.computeGeometry(t);const n=t.ctx,i=t.chartRect,s=t.labelOffset,l=t.axesSteps,a=t.showIndex,r=t.isHorizontal,c=t.thickness,d=t.showSeriesCount;let h,u;const f=l.x[this.xAxisIndex],p=l.y[this.yAxisIndex],g=i.chartWidth-(s.left+s.right),m=i.chartHeight-(s.top+s.bottom),y=i.x1+s.left,C=i.y2-s.bottom,b=i.x2-s.right,T=(r?m:g)/(this.data.length||1),k=2;let M;this.isExistGrp?M=T-k*2:M=(T-k*2)/d;const S=typeof c=="string"&&/[0-9]+px/.test(c)?Math.min(M,Number(c.replace("px",""))):typeof c=="number"&&c<=1&&c>=0?Math.ceil(M*c):M;let x=r?null:S,I=r?null:S,L=r?S:null;const V=r?(M-L)/2:(M-x)/2,R=this.isExistGrp?1:a+1;this.size.cat=T,this.size.bar=M,this.size.cPad=k,this.size.bPad=V,this.size.w=x,this.size.ix=R,this.chartRect=i,this.labelOffset=s,this.borderRadius=t.borderRadius,this.data.forEach((E,G)=>{if(n.beginPath(),r?(h=y,u=ne.calculateY(E.y,p.graphMin,p.graphMax,m,C)):(h=ne.calculateSubX(E.x,f.graphMin,f.graphMax,g,y),h<y?(I-=y-h,h=h+x<y?null:y):h+x>b&&(I-=I-(b-h)),h>=b&&(h=null),h!==null&&(h+=Math.ceil(M*R)-Math.round(x+V)),u=C),r?E.b?(x=ne.calculateX(E.x-E.b,f.graphMin,f.graphMax,g),h=ne.calculateX(E.b,f.graphMin,f.graphMax,g,y)):x=ne.calculateX(E.x,f.graphMin,f.graphMax,g):E.b?(L=ne.calculateY(E.y-E.b,p.graphMin,p.graphMax,m),u=ne.calculateY(E.b,p.graphMin,p.graphMax,m,C)):L=ne.calculateY(E.y,p.graphMin,p.graphMax,m),h!==null&&u!==null){const v=E.dataColor||this.color,X=v.includes("rgba")?A.getOpacity(v):1,W=this.state==="downplay"?t.unSelectedOpacity:X;typeof v!="string"?(x=x!==I?I:x,n.fillStyle=ne.createGradient(n,r,{x:h,y:u,w:x,h:L},v,this.state==="downplay",t.unSelectedOpacity)):n.fillStyle=A.colorStringToRgba(v,W),this.drawBar({ctx:n,positions:{x:h,y:u,w:x,h:L}}),this.showValue.use&&this.drawValueLabels({context:n,data:E,positions:{x:h,y:u,h:L,w:x},isHighlight:!1,index:G})}I=x})}}class QS{constructor(t,n,i){const s=Ro({},FS,n);Object.keys(s).forEach(l=>{this[l]=s[l]}),this.name===void 0&&(this.name=`series-${i}`),this.color===void 0&&(this.color=Ht[i%Ht.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,i){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")?A.getOpacity(r):1,d=this.isDownplay?i: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=A.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 i={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),u=s>d&&h>=l&&h<=a;return this.show&&u&&(i.type=this.type,i.data=this.data,i.hit=!0,i.color=this.color,i.index=0),i}itemHighlight(t,n){var a,r;const i=n,s=this.isSelect?this.radius+5:this.radius;i.save(),i.shadowOffsetX=0,i.shadowOffsetY=0,i.shadowBlur=4;const l=((a=t==null?void 0:t.data)==null?void 0:a.dataColor)||this.color;i.fillStyle=l,i.shadowColor=l,i.beginPath(),i.moveTo(this.centerX,this.centerY),i.arc(this.centerX,this.centerY,s,this.startAngle,this.endAngle),i.lineTo(this.centerX,this.centerY),i.fill(),(r=this.showValue)!=null&&r.use&&this.drawValueLabels(i),i.closePath(),i.restore()}drawValueLabels(t){const n=t,i=this.data.o,{fontSize:s,textColor:l,formatter:a}=this.showValue;let r;a&&(r=a({value:i,percentage:this.data.percentage})),(!a||typeof r!="string")&&(r=A.labelSignFormat(i));const c=1.8,d=this.radius-this.doughnutHoleSize,h=(this.endAngle-this.startAngle)*180/Math.PI,u=s+4,f=Math.round(n.measureText(r).width);if(h>=f*c&&h>=u*c&&d>=f*c&&d>=u*c){n.save(),n.beginPath();const p=l.includes("rgba")?A.getOpacity(l):1,g=this.state==="downplay"?this.unSelectedOpacity:p;n.font=`normal normal normal ${s}px Roboto`,n.fillStyle=A.colorStringToRgba(l,g),n.lineWidth=1,n.textAlign="center",n.textBaseline="middle";const m=d/2+this.doughnutHoleSize,y=(this.endAngle-this.startAngle)/2+this.startAngle,C=m*Math.cos(y)+this.centerX,b=m*Math.sin(y)+this.centerY;n.fillText(r,C,b),n.restore()}}}class $S{constructor(t,n,i,s,l){const a=Ro({},AS,n);Object.keys(a).forEach(r=>{this[r]=a[r]}),this.isHorizontal=s,this.isGradient=l,this.createColorState(i),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=[],i=/[^0-9]&[^,]/g,{min:s,max:l,rangeCount:a,colorsByRange:r,error:c,stroke:d}=t,h=s.includes("#")?A.hexToRgb(s):s.replace(i,""),u=l.includes("#")?A.hexToRgb(l):l.replace(i,""),[f,p,g]=h.split(","),[m,y,C]=u.split(",");if(this.isGradient)n.push({minColor:{minR:f,minG:p,minB:g},maxColor:{maxR:m,maxG:y,maxB:C},rangeCount:a,start:0,end:100,selectedValue:null});else if(r.length)r.forEach(({color:b,label:w},T)=>{n.push({id:`color#${T}`,color:b,label:w,state:"normal",show:!0})});else{const b=Math.floor((f-m)/(a-1)),w=Math.floor((p-y)/(a-1)),T=Math.floor((g-C)/(a-1));for(let k=0;k<a;k++){const M=+f-b*k,Z=+p-w*k,S=+g-T*k;n.push({id:`color#${k}`,color:`rgb(${M},${Z},${S})`,state:"normal",show:!0})}}this.colorState=n,this.errorColor=c,this.stroke=d}getColorForGradient(t){const{minColor:n,maxColor:i}=this.colorState[0],{minR:s,minG:l,minB:a}=n,{maxR:r,maxG:c,maxB:d}=i,h=+s-Math.floor((s-r)*t/100),u=+l-Math.floor((l-c)*t/100),f=+a-Math.floor((a-d)*t/100);return`rgb(${h},${u},${f})`}getColorIndexByValue(t){const{existError:n,min:i,interval:s,decimalPoint:l}=this.valueOpt,a=this.colorState.length-1;if(n&&t<0)return a;const r=Math.floor(+(t-i).toFixed(l)/s);return r>=a?n?a-1:a:r}getItemInfo(t){const{min:n,max:i}=this.valueOpt,s={show:!1,opacity:1,dataColor:null,id:null,isHighlight:null};if(this.isGradient){const l=Je(t-n,i-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+(i-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,i,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,i),t.arcTo(n+s,i,n+s,i+l,d),t.arcTo(n+s,i+l,n,i+l,d),t.arcTo(n,i+l,n,i,d),t.arcTo(n,i,n+s,i,d),t.stroke(),t.fill()}else t.strokeRect(n,i,s,l),t.fillRect(n,i,s,l)}else{const r=A.aliasPixel(1);t.fillRect(n,i-r,s+r,l+r)}t.closePath()}}calculateXY(t,n,i,s){let l=null;if(this.labels[t]&&this.labels[t].length){let a=this.labels[t].findIndex(f=>f===n);a===-1&&(a=this.labels[t].findIndex(f=>+f==+n));const{minIndex:r,maxIndex:c,graphMin:d,graphMax:h}=s;if(Re(c)&&a>c||Re(r)&&a<r||no(r)&&no(c)&&(n<d||n>h))return null;const u=r??this.labels[t].findIndex(f=>+f==+d);a>-1&&(a-=u>-1?u:0,l=t==="x"?i+this.size.w*a:i-this.size.h*(a+1))}return l}computeGeometry(t){if(!this.show)return;const{chartRect:n,labelOffset:i,selectItem:s,axesSteps:l}=t,a=n.chartWidth-(i.left+i.right),r=n.chartHeight-(i.top+i.bottom),c=n.x1+i.left,d=n.y2-i.bottom,h=l.x[this.xAxisIndex],u=l.y[this.yAxisIndex];this.size.w=a/h.oriSteps,this.size.h=r/u.oriSteps,this.currentLabelInfo={x:{steps:h.oriSteps,min:h.graphMin,max:h.graphMax},y:{steps:u.oriSteps,min:u.graphMin,max:u.graphMax}},this.data.forEach((f,p)=>{var T;let m=this.calculateXY("x",f.x,c,h),y=this.calculateXY("y",f.y,d,u),C=this.size.w,b=this.size.h;const w=f.o;if(m!==null&&y!==null&&w!==null&&w!==void 0){const{show:k,dataColor:M,id:Z}=this.getItemInfo(w);if(f.dataColor||(f.dataColor=M),f.cId=Z,k){let S=this.stroke;const x=s==null?void 0:s.option,I=(x==null?void 0:x.use)&&(x==null?void 0:x.showBorder),L=p===((T=s==null?void 0:s.selected)==null?void 0:T.dataIndex);if(I&&L&&(S={show:x==null?void 0:x.showBorder,...x==null?void 0:x.borderStyle}),S.show&&S.lineWidth>0){const{lineWidth:V}=S,R=V*2;R<Math.floor(C)&&R<Math.floor(b)&&(m+=V,y+=V,C-=R,b-=R)}m+=1,f.xp=m,f.yp=y,f.w=C,f.h=b}}})}draw(t){if(!this.show)return;this.computeGeometry(t);const{ctx:n,chartRect:i,labelOffset:s,selectLabel:l,legendHitInfo:a,selectItem:r,axesSteps:c}=t,d=i.chartWidth-(s.left+s.right),h=i.chartHeight-(s.top+s.bottom),u=i.x1+s.left,f=i.y2-s.bottom,p=c.x[this.xAxisIndex],g=c.y[this.yAxisIndex];this.size.w=d/p.oriSteps,this.size.h=h/g.oriSteps,this.currentLabelInfo={x:{steps:p.oriSteps,min:p.graphMin,max:p.graphMax},y:{steps:g.oriSteps,min:g.graphMin,max:g.graphMax}};const m=(y,C,b)=>{var w,T;if(!a){let k;const{option:M,selected:Z}=r,{option:S,selected:x}=l,I=yt(Z==null?void 0:Z.dataIndex)&&(Z==null?void 0:Z.dataIndex)>-1,L=((w=x==null?void 0:x.label)==null?void 0:w.length)>0;return I?k=M.useSeriesOpacity?b!==(Z==null?void 0:Z.dataIndex):!1:L&&(k=S.useSeriesOpacity?!((T=x==null?void 0:x.label)!=null&&T.includes(this.getItemLabel(l,y))):!1),k?.1:C}return C};this.data.forEach((y,C)=>{var S;let w=this.calculateXY("x",y.x,u,p),T=this.calculateXY("y",y.y,f,g),k=this.size.w,M=this.size.h;const Z=y.o;if(w!==null&&T!==null&&Z!==null&&Z!==void 0){const{show:x,opacity:I,dataColor:L,id:V}=this.getItemInfo(Z);let R=I;I===1&&A.getColorStringType(y.dataColor)==="RGBA"&&(R=A.getOpacity(y.dataColor));const E=m(y,R,C);if(y.dataColor||(y.dataColor=L),y.cId=V,n.save(),x){n.fillStyle=A.colorStringToRgba(y.dataColor,E);let G=this.stroke;const v=r==null?void 0:r.option,X=(v==null?void 0:v.use)&&(v==null?void 0:v.showBorder),W=C===((S=r==null?void 0:r.selected)==null?void 0:S.dataIndex);X&&W&&(G={show:v==null?void 0:v.showBorder,...v==null?void 0:v.borderStyle});let N=!1;if(G.show&&G.lineWidth>0){const{color:P,lineWidth:D,opacity:O}=G,Y=D*2;N=Y<Math.floor(k)&&Y<Math.floor(M),n.strokeStyle=N?A.colorStringToRgba(P,E===1?O:E):void 0,N?(n.lineWidth=D,w+=D,T+=D,k-=Y,M-=Y):n.lineWidth=0}w+=1,this.drawItem(n,w,T,k,M,{...G,show:N}),n.restore(),this.showValue.use&&this.drawValueLabels({context:n,data:y})}}})}drawOverlay(t){if(!this.show)return;const{overlayCtx:n,chartRect:i,labelOffset:s,axesSteps:l}=t;if(!n)return;const a=i.x1+s.left,r=i.y2-s.bottom,c=l.x[this.xAxisIndex],d=l.y[this.yAxisIndex];this.data.forEach(h=>{const u=this.calculateXY("x",h.x,a,c),f=this.calculateXY("y",h.y,r,d),p=h.o;if(u!==null&&f!==null&&p!==null&&p!==void 0){const{show:g,isHighlight:m}=this.getItemInfo(p);g&&m&&this.itemHighlight({data:h},n)}})}drawValueLabels({context:t,data:n}){const{fontSize:i,textColor:s,align:l,formatter:a,decimalPoint:r}=this.showValue,{xp:c,yp:d,w:h,h:u,o:f}=n,p=t;p.save(),p.beginPath(),p.font=`normal normal normal ${i}px Roboto`,p.fillStyle=s,p.lineWidth=1,p.textBaseline="middle",p.textAlign=l!=="center"?"left":"center";let g;a&&(g=a(f)),(!a||typeof g!="string")&&(g=A.labelSignFormat(f,r));const m=Math.round(p.measureText(g).width),y=i,C=c+h/2,b=d+u/2;if(!(m>=h||y>=u||g<0)){switch(l){case"top":{const w=C-m/2,T=b-y/2;p.fillText(g,w,T);break}case"right":{const w=c+h-m;p.fillText(g,w,b);break}case"bottom":{const w=C-m/2,T=b+y/2;p.fillText(g,w,T);break}case"left":p.fillText(g,c,b);break;default:{const w=C-m/2;p.fillText(g,w,b);break}}p.restore()}}getAdjustedBounds({xp:t,yp:n,width:i,height:s}){const a=Math.max(0,i),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:i,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:u,xep:f,ysp:p,yep:g}=this.getAdjustedBounds({xp:r,yp:c,width:d,height:h});return u>=i&&f<=s&&p>=l&&g<=a})}itemHighlight(t,n){var m;const i=t.data,s=n,{stroke:l,shadow:a}=this.highlight,r=i.xp,c=i.yp,d=i.w,h=i.h,u=i.cId;let f;if(this.isGradient){const{min:y,max:C}=this.valueOpt,b=Je(i.o-y,C-y),{start:w,end:T}=this.colorState[0];f=w<=b&&b<=T||i.o===-1}else f=(m=this.colorState.find(({id:y})=>y===u))==null?void 0:m.show;if(r===null||c===null||!f)return;s.save();const p=A.getColorStringType(i.dataColor)==="RGBA"?t.dataColor:A.colorStringToRgba(i.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:y,width:C,radius:b}=l;g.show=!0,g.radius=b,s.lineWidth=C,g.lineWidth=C,s.strokeStyle=y||p,g.color=y||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:i})}findGraphData(t){const n=t[0],i=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:u}=r;return c<=n&&n<=c+h&&d<=i&&i<=d+u});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:i,yep:s,range:l}){const a=this.labels,r=1,c={xsp:Math.min(t,n),ysp:Math.min(i,s),width:Math.ceil(Math.abs(n-t)),height:Math.ceil(Math.abs(s-i))};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:u,x2:f,y1:p,y2:g}=l,m=(f-u)/d,y=(g-p)/h,C={xsp:t,xep:n,ysp:i,yep:s},b=(w,T,k)=>{let M,Z,S;w==="x"?(Z=m,S=u+r):(Z=y,S=p),a[w].findIndex((I,L)=>(M=S+Z*L,M<=T&&T<=M+Z))>-1?C[k]=["xsp","ysp"].includes(k)?M:M+Z:T<S&&(C[k]=S)};b("x",Math.min(t,n),"xsp"),b("x",Math.max(t,n),"xep"),b("y",Math.min(i,s),"ysp"),b("y",Math.max(i,s),"yep"),c.xsp=Math.min(C.xsp,C.xep),c.ysp=Math.min(C.ysp,C.yep),c.width=Math.abs(C.xep-C.xsp),c.height=Math.abs(C.yep-C.ysp)}return c}getFilteredLabel(t,n,i,s){return t.length!==n?t.filter(l=>i<=l&&l<=s):t}findSelectionRange(t){const{xsp:n,ysp:i,width:s,height:l,range:a}=t;let r=null;const{x1:c,x2:d,y1:h,y2:u}=a,{x:f,y:p}=this.labels;if(f.length&&p.length){const{x:{steps:g,min:m,max:y},y:{steps:C,min:b,max:w}}=this.currentLabelInfo,T=g||f.length,k=C||p.length,M=(d-c)/T,Z=(u-h)/k,S=n+s,x=i+l,I={min:Math.floor((n-c)/M),max:Math.floor((S-c-M)/M)},L=k-1,V={min:L-Math.round((x-h-Z)/Z),max:L-Math.round((i-h)/Z)},R=this.getFilteredLabel(f,T,m,y),E=this.getFilteredLabel(p,k,b,w);r={xMin:R[I.min],xMax:R[I.max],yMin:E[V.min],yMax:E[V.max]}}return r}getItemLabel(t,n){const{option:i,selected:s}=t;let l=this.isHorizontal?n.y:n.x;return i!=null&&i.useBothAxis&&(s!=null&&s.targetAxis)&&(l=(s==null?void 0:s.targetAxis)==="yAxis"?n.y:n.x),l}}const zr={Store:OS,Series:{createSeriesSet(e,t,n,i){let s=Object.keys(e);this.options.overlapping.use&&(s=this.getOverlappingSeriesKeys(e,t,i)),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})})},reconcileSeriesSet(e,t,n,i,s){let l=Object.keys(e);this.options.overlapping.use&&(l=this.getOverlappingSeriesKeys(e,t,i));const a=s||{},r={};for(let c=0;c<l.length;c++){const d=l[c],h=e[d],u=h.type||t,f=a[d];f&&this.canReuseSeries(f,u,h,n)?(this.seriesInfo.charts[u].push(d),f.show=f._freshShow,this.resetSeriesGroupMeta(f),r[d]=f):r[d]=this.addSeries({type:u,id:d,opt:h,index:c,isHorizontal:n})}this.seriesList=r},computeReconcileKey(e,t,n){var i,s;return{type:e,isHorizontal:n,timeMode:e==="bar"&&!!t.timeMode,realTime:e==="scatter"&&!!((i=this.options.realTimeScatter)!=null&&i.use),heatMapColor:e==="heatMap"?this.options.heatMapColor:null,isGradient:e==="heatMap"&&((s=this.options.legend)==null?void 0:s.type)==="gradient"}},canReuseSeries(e,t,n,i){const s=e._reconcileKey;if(!s||e._optSnapshot===void 0)return!1;const l=this.computeReconcileKey(t,n,i);return s.type!==l.type||s.isHorizontal!==l.isHorizontal||s.timeMode!==l.timeMode||s.realTime!==l.realTime||s.heatMapColor!==l.heatMapColor||s.isGradient!==l.isGradient?!1:_e(e._optSnapshot,n)},resetSeriesGroupMeta(e){e.isExistGrp=!1,e.stackIndex=0,e.groupIndex=null,e.bsId=null,e.bsIds=[],e.isOverlapping=!1},getOverlappingSeriesKeys(e,t,n){const i=[],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);i.push({key:a,overlappingIdx:d})}else s.push({key:a})}),i.sort((a,r)=>r.overlappingIdx-a.overlappingIdx),[...i,...s].map(({key:a})=>a)},addSeries(e){var r;const{type:t,id:n,opt:i,index:s,isHorizontal:l}=e;let a=!1;if(t==="line")this.seriesInfo.charts.line.push(n),a=new US(n,i,s);else if(t==="scatter")this.seriesInfo.charts.scatter.push(n),a=new JS(n,i,s,(r=this.options.realTimeScatter)==null?void 0:r.use);else if(t==="bar")this.seriesInfo.charts.bar.push(n),i.timeMode?a=new jS(n,i,s,l):a=new Hr(n,i,s,l);else if(t==="pie")this.seriesInfo.charts.pie.push(n),a=new QS(n,i,s);else if(t==="heatMap"){this.seriesInfo.charts.heatMap.push(n);const{heatMapColor:c,legend:d}=this.options,h=d.type==="gradient";a=new $S(n,i,c,l,h)}return a&&(a._reconcileKey=this.computeReconcileKey(t,i,l),a._optSnapshot=i,a._freshShow=a.show),a},addGroupInfo(e){e.forEach((t,n)=>{let i=0;t.reduce((s,l,a)=>{const r=this.seriesList[l];return r.stackIndex=a+i,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||i--,r.show?l:s},t[0])})}}};class pi{constructor(t,n,i,s){const l=He({},n,Br);Object.keys(l).forEach(a=>{this[a]=l[a]}),this.type=t,this.ctx=i,this.units=HS[this.type],this.options=s,this.position||(this.position=t==="x"?"bottom":"left")}calculateLabelRange(t,n,i,s){let l,a,r;t==="x"?(l=n.chartWidth,r=Math.floor(s*1.2),a=[i.left,i.right]):(l=n.chartHeight,a=[i.top,i.bottom],r=s+Math.floor(l*.1));const c=l-(a[0]+a[1]),d=1,h=Math.max(Math.floor(c/r),1);return{min:d,max:h}}calculateScaleRange(t,n){var d;let i,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"?(i=a[1]>+t.max?+t.max:a[1],s=a[0]<+t.min?+t.min:a[0]):(i=a[1],s=a[0]):typeof a=="function"?[s,i]=a(t.min,t.max):(i=t.max,s=t.min),this.autoScaleRatio&&(i=Math.ceil(i*(this.autoScaleRatio+1))),this.startToZero&&(s=0),i===s&&(i+=1,l=!0);const r=this.getLabelFormat(s),c=this.getLabelFormat(i,{isMaxValueSameAsMin:l});return{min:s,max:i,minLabel:r,maxLabel:c,size:A.calcTextSizeCanvas(c,A.getLabelStyle(this.labelStyle),(d=this.labelStyle)==null?void 0:d.padding)}}getLabelWidthHasMaxLength(t,n,i=[]){const s=A.getLabelStyle(this.labelStyle);return[...(t??[]).map(r=>this.getLabelFormat(r)),...i].reduce((r,c)=>{var h;const d=((h=A.calcTextSizeCanvas(c,s))==null?void 0:h.width)??0;return Math.max(r,d)},0)}calculateSteps(t){const{maxValue:n,minValue:i}=t;let{maxSteps:s}=t,l=this.getInterval(t),a=i,r;for(;a<n;)a+=l;const c=a,d=i,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 i=this.title;if(!(i!=null&&i.use)||isNaN(i.fontSize))return;const s=this.ctx;s.save(),s.font=A.getLabelStyle(i),s.fillStyle=i.color,s.textAlign=i.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+i.fontSize+c):(r=l.yTop-i.fontSize-c,a=l.xLeft),a>0&&r>0&&s.fillText(i.text,a,r),s.restore()}draw(t,n,i,s,l,a){var T,k,M,Z,S,x,I,L,V,R,E,G,v,X,W,N,P,D,O,Y;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=i.steps,u=i.graphMin,f=i.graphMax,p=i.interval,g=d[this.units.rectStart],m=d[this.units.rectEnd],y=d[this.units.rectOffset(this.position)],C=d[this.units.rectOffsetCounter(this.position)],b=5;let w;if(this.drawAxisTitle(t,n),r.font=A.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=A.aliasPixel(r.lineWidth),r.beginPath(),r.strokeStyle=this.axisLineColor,this.type==="x"?(r.moveTo(g,y+w),r.lineTo(m,y+w)):(r.moveTo(y+w,g),r.lineTo(y+w,m)),r.stroke(),r.closePath()),!(h===0||u===null)){if((T=this.labelStyle)!=null&&T.show){const H=m-g,B=H/h,z=[],F=i.interval;let Q=null,U=null,ee=g,j=u;if(this.type==="x"&&(c!=null&&c.axesX[0].flow)&&a.length!==h+1){const J=Math.floor(u/F)*F;J!==+u&&(j=J+F,ee+=H/(f-u)*(j-u))}r.strokeStyle=this.gridLineColor,r.lineWidth=1,w=A.aliasPixel(r.lineWidth);let te;for(let J=0;J<=h;J++)if(Q=Math.round(ee+B*J),Q<=m||this.type!=="x"||!(c!=null&&c.axesX[0].flow)||a.length===h+1){r.beginPath(),z[J]=j+J*p,z[J]===0&&this.zeroLineColor?r.strokeStyle=this.zeroLineColor:r.strokeStyle=this.gridLineColor,U=Q+w,te=this.getLabelFormat(Math.min(f,z[J]),{prev:z[J-1]??""});const $=((M=(k=this.options)==null?void 0:k.selectLabel)==null?void 0:M.use)&&((S=(Z=this.options)==null?void 0:Z.selectLabel)==null?void 0:S.useLabelOpacity)&&this.options.horizontal===(this.type==="y")&&((x=l==null?void 0:l.dataIndex)==null?void 0:x.length)&&!(l!=null&&l.label.map(fe=>this.getLabelFormat(Math.min(f,fe),{prev:z[J-1]??""})).includes(te));let ae;J===h&&this.lastLabelFontStyle?(r.font=A.getLabelStyle(this.lastLabelFontStyle),ae=this.lastLabelFontStyle.color):J===0&&this.firstLabelFontStyle?(r.font=A.getLabelStyle(this.firstLabelFontStyle),ae=this.firstLabelFontStyle.color):(r.font=A.getLabelStyle(this.labelStyle),ae=this.labelStyle.color);let he=1;A.getColorStringType(ae)==="RGBA"&&(he=A.getOpacity(ae)),r.fillStyle=A.colorStringToRgba(ae,$?(I=this.options)==null?void 0:I.unSelectedOpacity:he);let se;if(this.type==="x"){if(se=this.position==="top"?y-10:y+10,((L=c==null?void 0:c.brush)!=null&&L.showLabel||!(c!=null&&c.brush))&&r.fillText(this.checkFixWidth(te),Q,se),!$&&((V=c==null?void 0:c.selectItem)!=null&&V.showLabelTip)&&(s!=null&&s.label)&&!((R=this.options)!=null&&R.horizontal)){const fe=this.getLabelFormat(Math.min(f,s.label+0*p));if(fe===te){const ge=Math.round(r.measureText((E=this.labelStyle)==null?void 0:E.fontSize).width);A.showLabelTip({ctx:this.ctx,width:Math.round(r.measureText(fe).width)+10,height:ge,x:Q,y:se+(ge-2),borderRadius:2,arrowSize:3,text:te,backgroundColor:(v=(G=c==null?void 0:c.selectItem)==null?void 0:G.labelTipStyle)==null?void 0:v.backgroundColor,textColor:(W=(X=c==null?void 0:c.selectItem)==null?void 0:X.labelTipStyle)==null?void 0:W.textColor})}}this.showAxisTick&&(r.beginPath(),r.strokeStyle=this.axisLineColor,r.moveTo(U,y),r.lineTo(U,y+b),r.stroke(),r.closePath()),(J!==0||c!=null&&c.axesX[0].flow)&&this.showGrid&&(r.beginPath(),r.strokeStyle=this.gridLineColor,r.moveTo(U,y),r.lineTo(U,C),r.stroke(),r.closePath())}else se=this.position==="left"?y-10:y+10,((N=c==null?void 0:c.brush)!=null&&N.showLabel||!(c!=null&&c.brush))&&r.fillText(this.checkFixWidth(te),se,Q),J===h&&(U-=1),this.showAxisTick&&(r.beginPath(),r.strokeStyle=this.axisLineColor,r.moveTo(y+(this.axisLineWidth??1),U),r.lineTo(y-b,U),r.stroke(),r.closePath()),J!==0&&this.showGrid&&(r.beginPath(),r.strokeStyle=this.gridLineColor,r.moveTo(y,U),r.lineTo(C,U),r.stroke(),r.closePath())}}if((P=this.plotBands)!=null&&P.length||(D=this.plotLines)!=null&&D.length){const H=t.chartWidth-(n.left+n.right),B=t.chartHeight-(n.top+n.bottom),z=w+1,F=d.x1,Q=d.x2+z,U=d.y1-z,ee=d.y2;(O=this.plotBands)==null||O.forEach(j=>{const te=He({},j,Ko),{from:J,to:q,label:$}=te,ae=A.isNullOrUndefined(J)?u:Math.max(J,u),he=A.isNullOrUndefined(q)?f:Math.min(q,f);this.setPlotBandStyle(te);let se,fe;if(this.type==="x"){if(se=ne.calculateX(ae,u,f,H,F),fe=ne.calculateX(he,u,f,H,F),se===null||fe===null)return;this.drawXPlotBand(se,fe,F,Q,U,ee)}else{if(se=ne.calculateY(ae,u,f,B,ee),fe=ne.calculateY(he,u,f,B,ee),se===null||fe===null)return;this.drawYPlotBand(se,fe,F,Q,U,ee)}if($.show){const ge=this.getNormalizedLabelOptions(t,$),le=this.getPlotBandLabelPosition(se,fe,ge,Q,U);this.drawPlotLabel(ge,le)}r.restore()}),(Y=this.plotLines)==null||Y.forEach(j=>{if(typeof+j.value!="number")return;const te=He({},j,Ao),{value:J,label:q}=te;let $;if(this.type==="x"){if($=ne.calculateX(J,u,f,H,F),$===null)return;this.setPlotLineStyle(te),this.drawXPlotLine($,F,Q,U,ee)}else{if($=ne.calculateY(J,u,f,B,ee),$===null)return;this.setPlotLineStyle(te),this.drawYPlotLine($,F,Q,U,ee)}if(q.show){const ae=this.getNormalizedLabelOptions(t,q),he=this.getPlotLineLabelPosition($,ae,Q,U);this.drawPlotLabel(ae,he)}r.restore()})}}}setPlotLineStyle(t){const n=this.ctx,{color:i,lineWidth:s}=t;n.beginPath(),n.save(),n.lineWidth=s,n.strokeStyle=i,t.segments&&n.setLineDash(t.segments)}setPlotBandStyle(t){const n=this.ctx,{color:i}=t;n.beginPath(),n.save(),n.fillStyle=i}drawXPlotBand(t,n,i,s,l,a){const r=this.ctx,c=d=>d||d>i||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,i,s,l){const a=this.ctx;if(!t||t<n||t>i){a.closePath(),a.restore();return}let r=t;r+=A.aliasPixel(a.lineWidth),a.moveTo(r,l),a.lineTo(r,s),a.stroke(),a.restore(),a.closePath()}drawYPlotLine(t,n,i,s,l){const a=this.ctx;if(!t||t>l||t<s){a.closePath(),a.restore();return}let r=t;r+=A.aliasPixel(a.lineWidth),a.moveTo(n,r),a.lineTo(i,r),a.stroke(),a.restore(),a.closePath()}drawYPlotBand(t,n,i,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(i,t),r.lineTo(i,n),r.lineTo(s,n),r.lineTo(s,t),r.lineTo(i,t),r.fill(),r.restore(),r.closePath()}getNormalizedLabelOptions(t,n){const i=He({},n,Dr),s=this.ctx,{maxWidth:l}=i,a=i.fontSize>20?20:i.fontSize;let r=i.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&&i.textOverflow==="ellipsis"&&(r=A.truncateLabelWithEllipsis(i.text,d,s),c=s.measureText(r).width),{label:r,fontSize:a,labelWidth:c,labelBoxPadding:a/4,labelHalfWidth:c/2,labelHalfHeight:a/2,...i}}getPlotBandLabelPosition(t,n,i,s,l){const{fontSize:a,labelWidth:r,labelHalfWidth:c,labelHalfHeight:d,labelBoxPadding:h,textAlign:u,verticalAlign:f}=i;if(a<=0)return{textX:0,textY:0};let p,g;if(this.type==="x")switch(g=l-h-a,u){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,f){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,i,s){const{fontSize:l,labelWidth:a,labelHalfWidth:r,labelHalfHeight:c,labelBoxPadding:d}=n;if(l<=0)return{textX:0,textY:0};let h,u;if(this.type==="x")switch(u=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=i+a+d,n.verticalAlign){case"top":u=t-c-d;break;case"bottom":u=t+c+d;break;case"middle":default:u=t;break}return{textX:h,textY:u}}drawPlotLabel(t,n){if(!n)return;const{textX:i,textY:s}=n,{label:l,fontSize:a,fontColor:r,fillColor:c,lineColor:d,lineWidth:h,labelBoxPadding:u,labelWidth:f,labelHalfWidth:p,labelHalfHeight:g}=t;if(a<=0)return;const m=this.ctx;m.save(),m.beginPath(),m.font=A.getLabelStyle(t);let y=0,C=0,b=0,w=0;this.type==="x"?(y=s-u,C=s+a,b=i-p-u,w=i+p+u):(y=s-g-u,C=s+g+u,b=i-f,w=i+u),m.fillStyle=c,m.strokeStyle=d,m.lineWidth=h,m.moveTo(b,C),m.lineTo(b,y),m.lineTo(w,y),m.lineTo(w,C),m.lineTo(b,C),m.fill(),h>0&&m.stroke(),m.fillStyle=r,m.fillText(l,i,s),m.closePath()}checkFixWidth(t){const{fixWidth:n,fitDir:i}=this.labelStyle;return Re(n)&&n>0?A.truncateLabelWithEllipsis(t,n,this.ctx,i):t}}function qS(e){if(typeof e=="string"&&Ct[e])return{ms:Ct[e].size,unit:e,time:1};if(typeof e=="object"&&e!==null&&e.unit&&e.time>0){const t=Ct[e.unit];return t?{ms:e.time*t.size,unit:e.unit,time:e.time}:null}return typeof e=="number"&&e>0&&Number.isFinite(e)?{ms:e,unit:null,time:null}:null}function eC(e,t){if(!t.unit)return Ne(e.valueOf()+t.ms);const n=t.time||1;switch(t.unit){case"month":return e.add(n,"month");case"quarter":return e.add(n*3,"month");case"year":return e.add(n,"year");case"week":return e.add(n*7,"day");default:return Ne(e.valueOf()+t.ms)}}function tC(e,t){return t.unit?eC(Ne(e),t).valueOf():e+t.ms}function nC(e,t){if(!t.unit)return Math.ceil(e/t.ms)*t.ms;const n=t.time||1,i=Ne(e);if(["millisecond","second","minute","hour"].includes(t.unit)){const s=i.startOf("day").valueOf(),l=Ct[t.unit].size*n,a=e-s;return s+Math.ceil(a/l)*l}if(t.unit==="day"){const s=i.startOf("year").valueOf(),l=Ct.day.size*n,a=e-s;return s+Math.ceil(a/l)*l}if(t.unit==="week"){let s=i.startOf("year");const l=s.day();s=s.subtract((l+6)%7,"day");const a=s.valueOf(),r=Ct.week.size*n,c=e-a;return a+Math.ceil(c/r)*r}if(t.unit==="month"){const s=i.startOf("year"),l=i.startOf("month"),a=i.month(),r=l.valueOf()>=e?a:a+1,c=Math.ceil(r/n)*n;return s.add(c,"month").valueOf()}if(t.unit==="quarter"){const s=i.startOf("year"),l=Math.floor(i.month()/3),r=i.month(l*3).startOf("month").valueOf()>=e?l:l+1,c=Math.ceil(r/n)*n;return s.add(c*3,"month").valueOf()}if(t.unit==="year"){const s=i.startOf("year"),l=2e3,a=s.valueOf()>=e?i.year()-l:i.year()+1-l,r=Math.ceil(a/n)*n;return Ne(`${l+r}-01-01`).startOf("day").valueOf()}return e}function iC(e,t,n){const i=[];let s=nC(e,n);const l=1e4;for(;s<=t&&i.length<l;)i.push(s),s=tC(s,n);return i}function Fr(e){if(e==null)return null;if(typeof e=="number")return Number.isFinite(e)?e:null;const t=Ne(e).valueOf();return Number.isFinite(t)?t:null}class sC extends pi{normalizeTimeValue(t){return Fr(t)}calculateScaleRange(t,n){const i=n!=null&&n.use?n==null?void 0:n.range:this.range;if(!(Array.isArray(i)||typeof i=="function")&&((t==null?void 0:t.min)==null||(t==null?void 0:t.max)==null))return{min:null,max:null,minLabel:"",maxLabel:"",size:A.calcTextSizeCanvas("",A.getLabelStyle(this.labelStyle))};let l=i;Array.isArray(i)&&i.length===2?l=[this.normalizeTimeValue(i[0]),this.normalizeTimeValue(i[1])]:typeof i=="function"&&(l=(...h)=>{const[u,f]=i(...h);return[this.normalizeTimeValue(u),this.normalizeTimeValue(f)]});const a=this.range,r=n!=null&&n.use?{...n,range:l}:n,c={...t,min:this.normalizeTimeValue(t==null?void 0:t.min),max:this.normalizeTimeValue(t==null?void 0:t.max)};let d;try{n!=null&&n.use||(this.range=l),d=super.calculateScaleRange(c,r)}finally{this.range=a}return{...d,min:this.normalizeTimeValue(d.min),max:this.normalizeTimeValue(d.max)}}getLabelFormat(t,n={}){if(this.formatter){const i=this.formatter(t,n);if(typeof i=="string")return i}return Ne(t).format(this.timeFormat)}getInterval(t){const n=this.normalizeTimeValue(t.maxValue),i=this.normalizeTimeValue(t.minValue),s=t.maxSteps;if(this.interval){let l;if(typeof this.interval=="string"?l=Ct[this.interval].size:typeof this.interval=="object"?l=this.interval.time*Ct[this.interval.unit].size:typeof this.interval=="number"&&(l=this.interval),l>0&&Number.isFinite(l))return l}return Math.ceil((n-i)/s)}calculateSteps(t){const n=this.normalizeTimeValue(t.minValue),i=this.normalizeTimeValue(t.maxValue),s=Math.max(1,t.maxSteps??1);if(n==null||i==null)return{steps:0,interval:0,baseInterval:0,graphMin:null,graphMax:null,ticks:[]};const l=+n,a=+i;if(l>=a)return{steps:0,interval:0,baseInterval:0,graphMin:l,graphMax:a,ticks:[]};const r=qS(this.interval);let c;r?c=r:c={ms:Math.max(1,Math.ceil((a-l)/Math.max(1,s))),unit:null,time:null};const d=Math.ceil((a-l)/c.ms);let h=!this.fixedSteps&&d>s?Math.max(1,Math.floor(d/s)):1,u,f;const p=h+1e4;for(;h<=p;){const g=c.unit?{ms:c.ms*h,unit:c.unit,time:(c.time||1)*h}:{ms:c.ms*h,unit:null,time:null};if(f=g.ms,u=iC(l,a,g),u.length<=s||this.fixedSteps)break;h++}return{steps:Math.max(0,u.length-1),interval:f,baseInterval:c.ms,graphMin:l,graphMax:a,ticks:u}}draw(t,n,i,s,l){var b,w,T,k,M,Z,S,x,I,L,V,R,E,G,v,X,W,N,P,D;const a=this.ctx,r=this.options,c={x1:t.x1+n.left,x2:t.x2-n.right,y1:t.y1+n.top,y2:t.y2-n.bottom},d=i.graphMin,h=i.graphMax,u=i.ticks,f=c[this.units.rectStart],p=c[this.units.rectEnd],g=c[this.units.rectOffset(this.position)],m=c[this.units.rectOffsetCounter(this.position)],y=5;let C=0;if(this.drawAxisTitle(t,n),a.font=A.getLabelStyle(this.labelStyle),a.fillStyle=this.labelStyle.color,this.type==="x"?(a.textAlign="center",a.textBaseline=this.position==="top"?"bottom":"top"):(a.textAlign=this.position==="left"?"right":"left",a.textBaseline="middle"),this.showAxis&&(a.lineWidth=this.axisLineWidth,C=A.aliasPixel(a.lineWidth),a.beginPath(),a.strokeStyle=this.axisLineColor,this.type==="x"?(a.moveTo(f,g+C),a.lineTo(p,g+C)):(a.moveTo(g+C,f),a.lineTo(g+C,p)),a.stroke(),a.closePath()),!(!(u!=null&&u.length)||d===null)){if((b=this.labelStyle)!=null&&b.show){const O=c.x2-c.x1,Y=c.y2-c.y1;a.strokeStyle=this.gridLineColor,a.lineWidth=1,C=A.aliasPixel(a.lineWidth);let H;for(let B=0;B<u.length;B++){const z=u[B];let F;if(this.type==="x"?F=ne.calculateX(z,d,h,O,c.x1):F=ne.calculateY(z,d,h,Y,c.y2),F===null)continue;z===0&&this.zeroLineColor?a.strokeStyle=this.zeroLineColor:a.strokeStyle=this.gridLineColor;const U=F+C;H=this.getLabelFormat(z,{prev:u[B-1]??""});const ee=((T=(w=this.options)==null?void 0:w.selectLabel)==null?void 0:T.use)&&((M=(k=this.options)==null?void 0:k.selectLabel)==null?void 0:M.useLabelOpacity)&&this.options.horizontal===(this.type==="y")&&((Z=l==null?void 0:l.dataIndex)==null?void 0:Z.length)&&!(l!=null&&l.label.map(q=>this.getLabelFormat(q,{prev:u[B-1]??""})).includes(H));let j;B===u.length-1&&this.lastLabelFontStyle?(a.font=A.getLabelStyle(this.lastLabelFontStyle),j=this.lastLabelFontStyle.color):B===0&&this.firstLabelFontStyle?(a.font=A.getLabelStyle(this.firstLabelFontStyle),j=this.firstLabelFontStyle.color):(a.font=A.getLabelStyle(this.labelStyle),j=this.labelStyle.color);let te=1;A.getColorStringType(j)==="RGBA"&&(te=A.getOpacity(j)),a.fillStyle=A.colorStringToRgba(j,ee?(S=this.options)==null?void 0:S.unSelectedOpacity:te);let J;if(this.type==="x"){if(J=this.position==="top"?g-10:g+10,((x=r==null?void 0:r.brush)!=null&&x.showLabel||!(r!=null&&r.brush))&&a.fillText(this.checkFixWidth(H),F,J),!ee&&((I=r==null?void 0:r.selectItem)!=null&&I.showLabelTip)&&(s!=null&&s.label)&&!((L=this.options)!=null&&L.horizontal)){const q=this.getLabelFormat(s.label);if(q===H){const $=Math.round(a.measureText((V=this.labelStyle)==null?void 0:V.fontSize).width);A.showLabelTip({ctx:this.ctx,width:Math.round(a.measureText(q).width)+10,height:$,x:F,y:J+($-2),borderRadius:2,arrowSize:3,text:H,backgroundColor:(E=(R=r==null?void 0:r.selectItem)==null?void 0:R.labelTipStyle)==null?void 0:E.backgroundColor,textColor:(v=(G=r==null?void 0:r.selectItem)==null?void 0:G.labelTipStyle)==null?void 0:v.textColor})}}this.showAxisTick&&(a.beginPath(),a.strokeStyle=this.axisLineColor,a.moveTo(U,g),a.lineTo(U,g+y),a.stroke(),a.closePath()),this.showGrid&&(a.beginPath(),a.strokeStyle=this.gridLineColor,a.moveTo(U,g),a.lineTo(U,m),a.stroke(),a.closePath())}else{J=this.position==="left"?g-10:g+10,((X=r==null?void 0:r.brush)!=null&&X.showLabel||!(r!=null&&r.brush))&&a.fillText(this.checkFixWidth(H),J,F);let q=U;B===u.length-1&&(q-=1),this.showAxisTick&&(a.beginPath(),a.strokeStyle=this.axisLineColor,a.moveTo(g+(this.axisLineWidth??1),q),a.lineTo(g-y,q),a.stroke(),a.closePath()),this.showGrid&&(a.beginPath(),a.strokeStyle=this.gridLineColor,a.moveTo(g,q),a.lineTo(m,q),a.stroke(),a.closePath())}}}if((W=this.plotBands)!=null&&W.length||(N=this.plotLines)!=null&&N.length){const O=t.chartWidth-(n.left+n.right),Y=t.chartHeight-(n.top+n.bottom),H=C+1,B=c.x1,z=c.x2+H,F=c.y1-H,Q=c.y2;(P=this.plotBands)==null||P.forEach(U=>{const ee=He({},U,Ko),{from:j,to:te,label:J}=ee,q=A.isNullOrUndefined(j)?d:Math.max(j,d),$=A.isNullOrUndefined(te)?h:Math.min(te,h);this.setPlotBandStyle(ee);let ae,he;if(this.type==="x"){if(ae=ne.calculateX(q,d,h,O,B),he=ne.calculateX($,d,h,O,B),ae===null||he===null)return;this.drawXPlotBand(ae,he,B,z,F,Q)}else{if(ae=ne.calculateY(q,d,h,Y,Q),he=ne.calculateY($,d,h,Y,Q),ae===null||he===null)return;this.drawYPlotBand(ae,he,B,z,F,Q)}if(J.show){const se=this.getNormalizedLabelOptions(t,J),fe=this.getPlotBandLabelPosition(ae,he,se,z,F);this.drawPlotLabel(se,fe)}a.restore()}),(D=this.plotLines)==null||D.forEach(U=>{if(!Number.isFinite(+U.value))return;const ee=He({},U,Ao),{value:j,label:te}=ee;let J;if(this.type==="x"){if(J=ne.calculateX(j,d,h,O,B),J===null)return;this.setPlotLineStyle(ee),this.drawXPlotLine(J,B,z,F,Q)}else{if(J=ne.calculateY(j,d,h,Y,Q),J===null)return;this.setPlotLineStyle(ee),this.drawYPlotLine(J,B,z,F,Q)}if(te.show){const q=this.getNormalizedLabelOptions(t,te),$=this.getPlotLineLabelPosition(J,q,z,F);this.drawPlotLabel(q,$)}a.restore()})}}}}class oC extends pi{getTruthyValue(t){const n=this.adjustedDecimalPoint??this.decimalPoint;return Re(t)?Number(t.toFixed(n)):t}getLabelFormat(t,n={}){if(this.formatter){const s=this.getTruthyValue(t),l=this.formatter(s,{...n,prevOriginalValue:n==null?void 0:n.prev,prevDecimalPointValue:this.getTruthyValue(n==null?void 0:n.prev),currentOriginalValue:t,currentDecimalPointValue:s});if(typeof l=="string")return l}const i=this.adjustedDecimalPoint??this.decimalPoint;return A.labelSignFormat(t,i)}getInterval(t){if(this.interval)return this.interval;let n=0;const i=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(i),r=Math.abs(s)/a,c=Math.abs(i)/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(i)/(h||1))}else n=(i-s)/l;return this.decimalPoint?n:Math.ceil(n)}getExactInterval(t,n){if(!Number.isFinite(t)||t<=0)return{interval:1,steps:1};const i=Math.max(1,n);let s=null,l=0,a=1/0;for(let r=i;r>=1;r--){const c=t/r;let d=1;for(let h=0;h<=12;h++,d*=10){const u=c*d;if(Math.abs(u-Math.round(u))<1e-6){h<a&&c<t&&(a=h,s=Math.round(u)/d,l=r);break}}if(a===0)break}return l>0?{interval:s,steps:l}:{interval:parseFloat((t/i).toFixed(12)),steps:i}}getStepsWithNiceScale({max:t,min:n,maxSteps:i}){const s=t-n;if(!Number.isFinite(s)||s<=0)return{max:n+1,min:n,interval:1,steps:1};const l=s/i,a=Math.floor(Math.log10(l)),r=Math.ceil(Math.log10(s));let c=t,d=n,h=0,u=0,f=1/0;for(let p=a;p<=r;p++){const g=10**p;for(const m of KS){const y=m*g;if(y>=l){const C=y*1e-10,b=Math.floor((n+C)/y)*y,w=Math.ceil((t-b-C)/y),T=b+y*w;if(w<=i&&T>=t-C){const k=n-b+(T-t);k<f&&(c=T,d=b,h=y,u=w,f=k)}}}}if(!(h>0)||u<=0){const p=Math.max(1,i),g=s/p||1;return{max:t,min:n,interval:g,steps:p}}return{max:c,min:d,interval:h,steps:u}}getDecimalPointFromInterval(t){if(!Number.isFinite(t)||t===0)return 0;const n=Math.abs(t),i=10,s=1e-10,l=(c,d=0)=>{const h=10**d;return Math.round((c+Number.EPSILON)*h)/h},a=(c,d)=>{const h=l(c,d);return Math.abs(c-h)<s};if(n>=1&&a(n,0))return 0;const r=n>=1?0:Math.max(0,Math.ceil(-Math.log10(n)));for(let c=r;c<=i;c+=1)if(a(n,c))return c;return i}getLegacyOneMaxScale(t){return this.decimalPoint?t>2?{interval:.2,steps:5}:{interval:.5,steps:2}:{interval:1,steps:1}}calculateSteps(t){const{minValue:n,maxValue:i}=t,s=Math.max(1,t.maxSteps??1),l=Array.isArray(this.range)&&this.range.length===2,r=typeof this.interval=="number"||typeof this.interval=="object"&&this.interval!==null?this.getInterval(t):null,c=r!=null&&r>0&&Number.isFinite(r),d=l?+this.range[0]:null,h=l?+this.range[1]:null,u=1e-10,f=b=>{if(this.decimalPoint==="auto"){const w=this.getDecimalPointFromInterval(b);w!=null&&!Number.isNaN(w)?this.adjustedDecimalPoint=w:typeof this.getAutoDecimalPointFromInterval=="function"?this.adjustedDecimalPoint=this.getAutoDecimalPointFromInterval(b):this.adjustedDecimalPoint=0}else this.adjustedDecimalPoint=this.decimalPoint},p=(b,w)=>Math.max(1,Math.round(b/w+u)),g=({min:b,max:w,interval:T})=>{let k=0,M=0;return b>=0?(k=+b,M=Math.ceil(w/T)*T):w>=0?(k=Math.floor(b/T)*T,M=Math.ceil(w/T)*T):(M=+w,k=Math.floor(b/T)*T),{graphMin:k,graphMax:M}};if(l&&c){const b=d,w=h,T=r,M=(w-b)/T;if(Math.abs(M-Math.round(M))<u&&M<=s||this.fixedSteps){const S=Math.round(M);return f(T),{steps:S,interval:T,graphMin:b,graphMax:w}}}if(l){const b=d,w=h,T=w-b,{interval:k,steps:M}=this.getExactInterval(T,s);return f(k),{steps:M,interval:k,graphMin:b,graphMax:w}}if(c){let b=r,w=0,T=0,k=0,M=0;for({graphMin:w,graphMax:T}=g({min:n,max:i,interval:b}),k=T-w,M=p(k,b);M>s;)b+=r,{graphMin:w,graphMax:T}=g({min:n,max:i,interval:b}),k=T-w,M=p(k,b);return f(b),{steps:M,interval:b,graphMin:w,graphMax:T}}const m=this.startToZero&&n>=0?0:n,y=this.startToZero&&i<=0?0:i;if(m===0&&y===1){const b=this.getLegacyOneMaxScale(s);return f(b.interval),{steps:b.steps,interval:b.interval,graphMin:m,graphMax:y}}const C=this.getStepsWithNiceScale({min:m,max:y,maxSteps:s});return f(C.interval),{steps:C.steps,interval:C.interval,graphMin:C.min,graphMax:C.max}}calculateScaleRange(t,n){var u;let i,s,l=!1;const a=n!=null&&n.use?n==null?void 0:n.range:this.range;if(!(Array.isArray(a)||typeof a=="function")&&((t==null?void 0:t.min)==null||(t==null?void 0:t.max)==null)){const f=this.getLabelFormat(0),p=this.getLabelFormat(1,{isMaxValueSameAsMin:!0});return{min:0,max:1,minLabel:f,maxLabel:p,size:A.calcTextSizeCanvas(p,A.getLabelStyle(this.labelStyle))}}Array.isArray(a)&&(a==null?void 0:a.length)===2?this.options.type==="heatMap"?(i=a[1]>+t.max?+t.max:a[1],s=a[0]<+t.min?+t.min:a[0]):(i=a[1],s=a[0]):typeof a=="function"?[s,i]=a(t.min,t.max):(i=t.max,s=t.min);const c=Array.isArray(this.range)&&this.range.length===2;if(this.autoScaleRatio&&!c){const f=i,p=i*(this.autoScaleRatio+1);if(i=this.decimalPoint?p:Math.ceil(p),i>0&&s<0){const g=f-i;s+=g}else if(i<0&&s<0){const g=s*(this.autoScaleRatio+1);s=this.decimalPoint?g:Math.ceil(g)}}this.startToZero&&!c&&(s>0&&(s=0),i<0&&(i=0)),i===s&&(i+=1,l=!0);const d=this.getLabelFormat(s),h=this.getLabelFormat(i,{isMaxValueSameAsMin:l});return{min:s,max:i,minLabel:d,maxLabel:h,size:A.calcTextSizeCanvas(h,A.getLabelStyle(this.labelStyle),(u=this.labelStyle)==null?void 0:u.padding)}}}class lC extends pi{calculateScaleRange(t){let n,i,s=!1;Array.isArray(this.range)&&this.range.length===2?(n=this.range[1],i=this.range[0]):typeof range=="function"?[i,n]=this.range(t.min,t.max):(n=t.max,i=t.min);const l=A.calculateMagnitude(n-i);n=Math.ceil(n/10**l)*10**l,this.startToZero&&(i=0),n===i&&(n+=1,s=!0);const a=this.getLabelFormat(i),r=this.getLabelFormat(n,{isMaxValueSameAsMin:s});return{min:i,max:n,minLabel:a,maxLabel:r,size:A.calcTextSizeCanvas(r,A.getLabelStyle(this.labelStyle))}}calculateSteps(t,n){const i=t.maxValue,s=t.minValue,l=t.maxSteps,a=A.calculateMagnitude(i-s);let r=this.getInterval(t),c;const d=i,h=s,u=d-h;for(c=Math.round(u/r),i===1&&(r=.2,c=5);(c>l||c*2<l)&&!n;)if(c>l)r*=2,c=Math.ceil(u/r);else if(a>=0)if(r/2%1===0)r/=2,c=Math.ceil(u/r);else break;else r/=2,c=Math.ceil(u/r);return{steps:c,interval:r,graphMin:h,graphMax:Math.ceil(h+c*r)}}getLabelFormat(t,n={}){if(this.formatter){const i=this.formatter(t,n);if(typeof i=="string")return i}return A.labelSignFormat(t,this.decimalPoint)}getInterval(t){const n=t.maxValue,i=t.minValue;return 10**A.calculateMagnitude(n-i)}}const _o=new WeakMap;class aC extends pi{constructor(t,n,i,s,l){super(t,n,i,l),this.labels=s}getMaxWidth(t,n){var s;const i=(s=this.labelStyle)==null?void 0:s.maxWidth;if(i==null)return n;if(typeof i=="string"){const l=i.trim();if(l.includes("%")){const r=Number.parseFloat(l.replace("%",""));return Number.isNaN(r)?n:t.chartWidth*(r/100)}const a=Number.parseFloat(l);return Number.isNaN(a)?n:a}return i}getStepMinMax(t,n){return this.labelStyle.alignToGridLine?t:n!=null&&n.use?(_o.has(this.labels)||_o.set(this.labels,A.getStringMinMax(this.labels)),_o.get(this.labels)):A.getStringMinMax(this.labels)}calculateScaleRange(t,n,i){const s=this.getStepMinMax(t,n);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[f,p]=h;Re(f)&&Re(p)&&(r=f<r?r:f,c=p>c?c:p,l=this.labels[c],a=this.labels[r],d=c-r+1)}else if(typeof h=="function"){const[f,p]=h(a,l);r=f<r?r:f,c=p>c?c:p,l=this.labels[c],a=this.labels[r],d=c-r+1}const u=this.getMaxWidth(i,i.chartWidth/(d+2));return{min:a,max:l,minIndex:r,maxIndex:c,minLabel:this.getLabelFormat(a,u),maxLabel:this.getLabelFormat(l,u),size:A.calcTextSizeCanvas(this.getLabelFormat(l,u),A.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:i,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:i,minIndex:s,maxIndex:l}}draw(t,n,i,s,l){var b,w,T,k,M,Z,S,x,I,L,V;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=i.steps,h=i.indexInterval,u=i.minIndex,f=c[this.units.rectStart],p=c[this.units.rectEnd],g=c[this.units.rectOffset(this.position)],m=c[this.units.rectOffsetCounter(this.position)],y=this.getMaxWidth(t,t.chartWidth/(d+2)),C=5;if(this.drawAxisTitle(t,n),(b=this.labelStyle)!=null&&b.show){a.font=A.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 R=A.aliasPixel(a.lineWidth);if(a.beginPath(),a.strokeStyle=this.axisLineColor,this.type==="x"?(a.moveTo(f,g+R),a.lineTo(p,g+R)):(a.moveTo(g+R,f),a.lineTo(g+R,p)),a.stroke(),d===0)return;const E=(p-f)/d,G=this.labelStyle.alignToGridLine;let v=null,X=null;a.beginPath(),a.strokeStyle=this.gridLineColor;let W,N,P;for(P=0;P<d;P+=h){const D=u+P,O=this.labels[D];v=Math.round(f+E*P),X=v+R,W=this.getLabelFormat(O,y);const{selectLabel:Y,selectItem:H,horizontal:B}=this.options;let z;l!=null&&l.targetAxis?z=(l==null?void 0:l.targetAxis)==="yAxis"?"y":"x":z=B?"y":"x";const F=(Y==null?void 0:Y.use)&&(Y==null?void 0:Y.useLabelOpacity)&&z===this.type&&((w=l==null?void 0:l.dataIndex)==null?void 0:w.length)&&!((T=l==null?void 0:l.dataIndex)!=null&&T.includes(D));let Q;P===d-1&&this.lastLabelFontStyle?(a.font=A.getLabelStyle(this.lastLabelFontStyle),Q=this.lastLabelFontStyle.color):P===0&&this.firstLabelFontStyle?(a.font=A.getLabelStyle(this.firstLabelFontStyle),Q=this.firstLabelFontStyle.color):(a.font=A.getLabelStyle(this.labelStyle),Q=this.labelStyle.color);let U=1;if(A.getColorStringType(Q)==="RGBA"&&(U=A.getOpacity(Q)),a.fillStyle=A.colorStringToRgba(Q,F?(k=this.options)==null?void 0:k.unSelectedOpacity:U),this.type==="x"){N=this.position==="top"?g-10:g+10;const ee=G?v:v+E/2;if(a.fillText(this.checkFixWidth(W),ee,N),!F&&(H!=null&&H.showLabelTip)&&(s!=null&&s.label)&&!B){const j=s.label;if(j===W){const te=Math.round(a.measureText((M=this.labelStyle)==null?void 0:M.fontSize).width);A.showLabelTip({ctx:this.ctx,width:Math.round(a.measureText(j).width)+10,height:te,x:v+E/2,y:N+(te-2),borderRadius:2,arrowSize:3,text:W,backgroundColor:(Z=H==null?void 0:H.labelTipStyle)==null?void 0:Z.backgroundColor,textColor:(S=H==null?void 0:H.labelTipStyle)==null?void 0:S.textColor})}}this.showAxisTick&&(a.beginPath(),a.strokeStyle=this.axisLineColor,a.moveTo(v+E/2,g),a.lineTo(v+E/2,g+C),a.stroke(),a.closePath()),P>0&&this.showGrid&&(a.beginPath(),a.strokeStyle=this.gridLineColor,a.moveTo(X,g),a.lineTo(X,m),a.stroke(),a.closePath())}else{N=this.position==="left"?g-10:g+10;const ee=G?v:v+E/2;a.fillText(this.checkFixWidth(W),N,ee),this.showAxisTick&&(a.beginPath(),a.strokeStyle=this.axisLineColor,a.moveTo(g+(this.axisLineWidth??1),ee),a.lineTo(g-C,ee),a.stroke(),a.closePath()),P>0&&this.showGrid&&(a.beginPath(),a.strokeStyle=this.gridLineColor,a.moveTo(g,X),a.lineTo(m,X),a.stroke(),a.closePath())}a.stroke()}if(this.showLastLabel){const D=u+d-1;if(u+Math.floor((d-1)/h)*h!==D){const Y=Math.round(f+E*(d-1)),H=G?Y:Y+E/2,B=this.getLabelFormat(r[D],y);a.font=this.lastLabelFontStyle?A.getLabelStyle(this.lastLabelFontStyle):A.getLabelStyle(this.labelStyle),a.fillStyle=this.lastLabelFontStyle?this.lastLabelFontStyle.color:this.labelStyle.color,this.type==="x"?a.fillText(this.checkFixWidth(B),H,N):a.fillText(this.checkFixWidth(B),N,H),this.showAxisTick&&(a.beginPath(),a.strokeStyle=this.axisLineColor,this.type==="x"?(a.moveTo(H,g),a.lineTo(H,g+C)):(a.moveTo(g+(this.axisLineWidth??1),H),a.lineTo(g-C,H)),a.stroke(),a.closePath())}}if(G&&!this.showLastLabel){const D=y0(+r[1],+r[0]),O=Ho(+r[r.length-1],D);if(isNaN(O))return;v=Math.round(f+E*this.labels.length),X=v+R;const Y=this.getLabelFormat(`${O}`,y),H=v+E/2;a.font=A.getLabelStyle(this.labelStyle),a.fillStyle=this.labelStyle.color,this.type==="x"?a.fillText(this.checkFixWidth(Y),v,N):a.fillText(this.checkFixWidth(Y),N,v),this.showAxisTick&&(a.beginPath(),a.strokeStyle=this.axisLineColor,this.type==="x"?(a.moveTo(H,g),a.lineTo(H,g+C)):(a.moveTo(g+(this.axisLineWidth??1),X),a.lineTo(g-C,X)),a.stroke(),a.closePath())}a.closePath()}if((x=this.plotBands)!=null&&x.length||(I=this.plotLines)!=null&&I.length){const R=A.aliasPixel(a.lineWidth)+1,E=c.x1+R,G=c.x2,v=c.y1+R,X=c.y2,W=(p-f)/(this.labelStyle.show?r.length:1);(L=this.plotBands)==null||L.forEach(N=>{if(!N.from&&!N.to)return;const P=He({},N,Ko),{from:D=0,to:O=r.length,label:Y}=P,H=Math.round(f+W*D),B=Math.round(f+W*O);if(this.setPlotBandStyle(P),this.type==="x"?this.drawXPlotBand(H,B,E,G,v,X):this.drawYPlotBand(H,B,E,G,v,X),Y.show){const z=this.getNormalizedLabelOptions(t,Y),F=this.getPlotBandLabelPosition(H,B,z,G,v);this.drawPlotLabel(z,F)}a.restore()}),(V=this.plotLines)==null||V.forEach(N=>{if(!N.value)return;const P=He({},N,Ao),{value:D,label:O}=P,Y=Math.round(f+W*D)+W/2;if(this.setPlotLineStyle(P),this.type==="x"?this.drawXPlotLine(Y,E,G,v,X):this.drawYPlotLine(Y,E,G,v,X),O.show){const H=this.getNormalizedLabelOptions(t,O),B=this.getPlotLineLabelPosition(Y,H,G,v);this.drawPlotLabel(H,B)}a.restore()})}}getLabelFormat(t,n,i={}){if(this.formatter){const s=this.formatter(t,i);if(typeof s=="string")return s}return this.labelStyle.fitWidth?this.fittingString(t,n):t}fittingString(t,n){const i=this.ctx;i.save(),i.font=A.getLabelStyle(this.labelStyle);const s=this.labelStyle.fitDir;return A.truncateLabelWithEllipsis(t,n,i,s)}getLabelWidthHasMaxLength(t,n,i=[]){const s=A.getLabelStyle(this.labelStyle),l=(t==null?void 0:t.length)??0,a=this.getMaxWidth(n,(n==null?void 0:n.chartWidth)/(l+2));return[...(t??[]).map(d=>this.getLabelFormat(d,a)),...i].reduce((d,h)=>{var f;const u=((f=A.calcTextSizeCanvas(h,s))==null?void 0:f.width)??0;return Math.max(d,u)},0)}}class rC extends pi{constructor(t,n,i,s,l){super(t,n,i),this.labels=s,this.options=l}getLabelFormat(t,n={}){if(this.formatter){const i=this.formatter(t,n);if(typeof i=="string")return i}return Ne(t).format(this.timeFormat)}calculateScaleRange(t,n,i){const s=super.calculateScaleRange(t,n,i),l=this.labels;if(!(l!=null&&l.length))return{...s,minIndex:0,maxIndex:-1};let a=0,r=l.length-1;const{min:c,max:d}=s;if(Number.isFinite(c)&&Number.isFinite(d)){const h=l.findIndex(f=>f>=c);let u=-1;for(let f=l.length-1;f>=0;f-=1)if(l[f]<=d){u=f;break}h===-1||u===-1||u<h?(a=0,r=-1):(a=h,r=u)}else{const h=n!=null&&n.use?n==null?void 0:n.range:this.range;h!=null&&console.warn("[EVUI][TimeCategoryScale] axis range가 유효한 min/max 숫자로 해석되지 않아 전체 라벨 범위로 폴백합니다. range 설정을 확인하세요:",h)}return{...s,minIndex:a,maxIndex:r}}getInterval(t){const n=t.maxValue,i=t.minValue,s=t.maxSteps;if(this.interval){if(typeof this.interval=="string")return Ct[this.interval].size;if(typeof this.interval=="object")return this.interval.time*Ct[this.interval.unit].size;if(typeof this.interval=="number")return this.interval}return Math.ceil((n-i)/s)}calculateSteps(t){const{maxValue:n,minValue:i,maxSteps:s,minIndex:l,maxIndex:a}=t,r=this.getInterval(t);let c=r,d=i,h;for(;d<n;)d+=c;const u=d>n?n:d,f=i,p=u-f;h=Math.round(p/c)+1;const g=h;for(n===1&&(c=.2,h=5);h>s;)c*=2,h=Math.round(p/c),c=Math.ceil(p/h);return u-f>h*c&&(c=Math.ceil((u-f)/h)),{steps:h,oriSteps:g,interval:c,rawInterval:r,graphMin:f,graphMax:u,minIndex:l,maxIndex:a}}draw(t,n,i,s,l){var E,G,v,X,W,N,P,D,O,Y,H,B,z,F,Q,U;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=i.steps,h=i.graphMin,u=i.graphMax,f=i.rawInterval,p=i.oriSteps;let g=c[this.units.rectStart];const m=c[this.units.rectEnd],y=c[this.units.rectOffset(this.position)],C=c[this.units.rectOffsetCounter(this.position)],b=5;this.drawAxisTitle(t,n),a.font=A.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=A.aliasPixel(a.lineWidth);if(a.beginPath(),a.strokeStyle=this.axisLineColor,this.type==="x"?(a.moveTo(g,y+w),a.lineTo(m,y+w)):(a.moveTo(y+w,g),a.lineTo(y+w,m)),a.stroke(),a.closePath(),d===0||h===null)return;const T=this.labelStyle.alignToGridLine,k=(m-g)/(p||1);this.categoryMode&&!T&&(g+=Math.ceil(k/2)-2);const M=[];let Z=null,S=null;a.beginPath(),a.strokeStyle=this.gridLineColor;let x,I,L;const V=d<=2?Math.max(1,p-1):Math.round(p/d),R=V===p?p:p-1;for(L=0;L<=R;L+=V){M[L]=Ne(h).valueOf()+L*f,Z=Math.round(g+k*L),S=Z+w;let ee;for(let q=0;q<M.length;q++)M[q]!==void 0&&q!==L&&(ee=M[q]);x=this.getLabelFormat(Math.min(u,M[L]),{prev:ee});const j=((G=(E=this.options)==null?void 0:E.selectLabel)==null?void 0:G.use)&&((X=(v=this.options)==null?void 0:v.selectLabel)==null?void 0:X.useLabelOpacity)&&this.options.horizontal===(this.type==="y")&&((W=l==null?void 0:l.dataIndex)==null?void 0:W.length)&&!(l!=null&&l.label.map(q=>this.getLabelFormat(Math.min(u,q),{prev:ee})).includes(x)),te=this.labelStyle.color;let J=1;if(A.getColorStringType(te)==="RGBA"&&(J=A.getOpacity(te)),a.fillStyle=A.colorStringToRgba(te,j?(N=this.options)==null?void 0:N.unSelectedOpacity:J),this.type==="x"){if(I=this.position==="top"?y-10:y+10,a.fillText(this.checkFixWidth(x),Z,I),!j&&((D=(P=this.options)==null?void 0:P.selectItem)!=null&&D.showLabelTip)&&(s!=null&&s.label)&&!((O=this.options)!=null&&O.horizontal)){const q=this.getLabelFormat(Math.min(u,s.label+0*f));if(q===x){const $=Math.round(a.measureText((Y=this.labelStyle)==null?void 0:Y.fontSize).width);A.showLabelTip({ctx:this.ctx,width:Math.round(a.measureText(q).width)+10,height:$,x:Z,y:I+($-2),borderRadius:2,arrowSize:3,text:x,backgroundColor:(z=(B=(H=this.options)==null?void 0:H.selectItem)==null?void 0:B.labelTipStyle)==null?void 0:z.backgroundColor,textColor:(U=(Q=(F=this.options)==null?void 0:F.selectItem)==null?void 0:Q.labelTipStyle)==null?void 0:U.textColor})}}this.showAxisTick&&(a.beginPath(),a.strokeStyle=this.axisLineColor,a.moveTo(S,y),a.lineTo(S,y+b),a.stroke(),a.closePath()),L<p&&this.showGrid&&(a.beginPath(),a.strokeStyle=this.gridLineColor,a.moveTo(S,y),a.lineTo(S,C),a.stroke(),a.closePath())}else I=this.position==="left"?y-10:y+10,a.fillText(this.checkFixWidth(x),I,Z),this.showAxisTick&&(a.beginPath(),a.strokeStyle=this.axisLineColor,a.moveTo(y+(this.axisLineWidth??1),S),a.lineTo(y-b,S),a.stroke(),a.closePath()),L<p&&this.showGrid&&(a.beginPath(),a.strokeStyle=this.gridLineColor,a.moveTo(y,S),a.lineTo(C,S),a.stroke(),a.closePath());a.stroke()}if(this.categoryMode&&T&&L*V===p){const ee=Ne(r[1]).diff(Ne(r[0])),j=this.getLabelFormat(Ne(M[p-1]+ee));Z=Math.round(g+k*p),S=Z+w,this.type==="x"?(a.fillText(this.checkFixWidth(j),Z,I),this.showGrid&&(a.moveTo(S,y),a.lineTo(S,C))):(a.fillText(this.checkFixWidth(j),I,Z),this.showGrid&&(a.moveTo(y,S),a.lineTo(C,S))),a.stroke()}a.closePath()}}const cC={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`}},dC={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 i;const e=(i=this.options.legend)==null?void 0:i.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,A.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,i=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/i),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,i=Math.max(t-this.visibleRowCount*this.legendItemHeight-n,0);this.legendTopSpacer.style.height=`${n}px`,this.legendBottomSpacer.style.height=`${i}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(i=>{i==null||i.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:i}=t,{min:s,max:l,interval:a,existError:r,decimalPoint:c}=i,d=n.length,h=r?d-2:d-1;for(let u=0;u<d;u++){const{id:f,color:p,label:g=""}=n[u],m=s+a*u;let y=m+a;u<h?y-=.1**c:y=l+.1**c;let C=g;if(!C)if(C=`${m.toFixed(c)} - ${y.toFixed(c)}`,s===void 0||l===void 0)if(u===0)C="0";else break;else{if(m>l)break;a<=1&&c===0&&(C=m)}this.addLegend({cId:f,color:p,name:C,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 u of d)u.style.color=a;h.show=!1,l.dataset.inactive=!0},n=(l,a)=>{var f,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),u=l==null?void 0:l.series;if(typeof u.color!="string"?r=u.color[u.color.length-1][1]:r=u.color,u.type==="line"&&u.fill?(c.style.height="8px",c.style.backgroundColor=A.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 m=(p=(f=this.options.legend.table)==null?void 0:f.columns[g.dataset.type])==null?void 0:p.style;g.style.color=m!=null&&m.color?m.color:a}u.show=!0,l.dataset.inactive=!1},i=()=>{(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 y;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],u=(c==null?void 0:c.dataset.inactive)==="false";if(!d||!h)return;if(a.clickMode==="active"){const C=Array.from(this.legendBoxDOM.getElementsByClassName(e.container));C.every(T=>T.dataset.inactive==="false")?(C.forEach(T=>{t(T,a.inactive)}),i(),n(c,a.color),this.seriesInfo.count=1):u?(t(c,a.inactive),this.seriesInfo.count--):u||(n(c,a.color),this.seriesInfo.count++),C.every(T=>T.dataset.inactive==="true")&&(C.forEach(T=>{n(T,a.color)}),s(),this.seriesInfo.count=C.length)}if(a.clickMode!=="active"){if(u&&this.seriesInfo.count===1)return;u?(t(c,a.inactive),this.seriesInfo.count--):(n(c,a.color),this.seriesInfo.count++)}if(this.brushSeries){const C=[...this.brushSeries.list];C[r]=this.seriesList,this.brushSeries.list=C,this.brushSeries.chartIdx=r}((y=this.options.eventBehavior)==null?void 0:y.legendClick)!=="emitOnly"&&this.update({updateSeries:!1,updateSelTip:{update:!0,keepDomain:!0}});const p=Object.values(this.seriesList).filter(C=>C.show).map(C=>C.sId),g=p.length===Object.values(this.seriesList).length,m={e:l,data:{seriesIds:g?[]:p,isActiveAll:g}};typeof this.listeners["click-legend"]=="function"&&this.listeners["click-legend"](m)},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 f;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=(f=l==null?void 0:l.series)==null?void 0:f.cId;r.style.backgroundColor=a,r.style.borderColor=a,c.style.color=a;const u=d.colorState.findIndex(p=>p.id===h);u>-1&&(d.colorState[u].show=!1),l.dataset.inactive=!0},n=(l,a)=>{var f,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=(f=l==null?void 0:l.series)==null?void 0:f.cId;r.style.backgroundColor=(p=l==null?void 0:l.series)==null?void 0:p.color,c.style.color=a;const u=d.colorState.findIndex(g=>g.id===h);u>-1&&(d.colorState[u].show=!0),l.dataset.inactive=!1},i=()=>{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=>{var C;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],u=(c==null?void 0:c.dataset.inactive)==="false",f=r.colorState.filter(b=>b.show).length;if(!d||!h)return;if(a.clickMode==="active"){const b=Array.from(this.legendBoxDOM.getElementsByClassName(e.container));b.every(k=>k.dataset.inactive==="false")?(b.forEach(k=>{t(k,a.inactive)}),i(),n(c,a.color)):u?t(c,a.inactive):u||n(c,a.color),b.every(k=>k.dataset.inactive==="true")&&(b.forEach(k=>{n(k,a.color)}),s())}if(a.clickMode!=="active"){if(u&&f===1)return;u?t(c,a.inactive):n(c,a.color)}((C=this.options.eventBehavior)==null?void 0:C.legendClick)!=="emitOnly"&&this.update({updateSeries:!1,updateSelTip:{update:!0,keepDomain:!0}});const p=r.colorState.filter(b=>b.show),g=p.map(b=>+b.id.split("#")[1]),m=r.colorState.length===p.length,y={e:l,data:{seriesIndices:m?[]:g,isActiveAll:m}};typeof this.listeners["click-legend"]=="function"&&this.listeners["click-legend"](y)},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,u;const a=(h=Object.values(this.seriesList))==null?void 0:h[0],r=this.getContainerDOM(l);if(!r){this.onLegendBoxLeave();return}const c=(u=r==null?void 0:r.series)==null?void 0:u.cId,d={sId:c,type:this.options.type};this.legendHover=d,a.colorState.forEach(f=>{f.state=f.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,i=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=`${i}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 i,s,l,a,r;const e=(l=(s=(i=this.options)==null?void 0:i.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 u=h.dataset.type;if(u!=="name"){const f=c.series.sId,p=(r=t==null?void 0:t[f])==null?void 0:r[u];h.textContent=this.getFormattedValue(e[u],p)}}}},forceUpdateLegend(){this.destroyLegend(),this.initLegend()},resetLegend(){var t,n;const e=this.legendBoxDOM;if(e){if(this.useTable){const i=this.legendTableDOM;for(;i.hasChildNodes();)i.removeChild(i.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"),i=document.createElement("span"),s=document.createElement("div");n.className="ev-chart-legend-container",n.dataset.inactive=!e.show,n.series=e,i.className="ev-chart-legend-color",e.type==="line"&&e.point&&!e.fill&&(i.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?(i.style.height="8px",i.style.backgroundColor=e.show?A.rgbaAdjustHalfOpacity(l):t.inactive,i.style.border=`1px solid ${l}`):i.style.backgroundColor=l,i.dataset.type="color",s.style.color=t.color,s.textContent=e.name,s.setAttribute("title",e.name),s.dataset.type="name",n.appendChild(i),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,u,f,p,g;const t=this.options.legend,n=(h=t==null?void 0:t.table)==null?void 0:h.columns,i=(u=this.getAggregations())==null?void 0:u[e==null?void 0:e.sId];if(!i||!n)return;const s=document.createElement("tr");s.className="ev-chart-legend--table__row",s.dataset.inactive=!e.show,A.setDOMStyle(s,(p=(f=t.table)==null?void 0:f.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=A.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?A.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",A.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(m=>{var y;if(m!=="name"&&n[m].use){const C=this.getFormattedValue(n[m],i[m]),b=document.createElement("td");b.className="ev-chart-legend--table__value",b.style.color=e.show?t.color:t.inactive,b.textContent=C,b.dataset.type=m.toString(),A.setDOMStyle(b,(y=n[m])==null?void 0:y.style),e.show||(b.style.color=t.inactive),s.appendChild(b)}}),this.legendTableDOM.appendChild(s),e.show&&this.seriesInfo.count++},setLegendPosition(){var g,m,y,C,b,w,T,k,M;const e=this.options,t=(g=e==null?void 0:e.legend)==null?void 0:g.position,n=(m=this.wrapperDOM)==null?void 0:m.style,i=(y=this.legendDOM)==null?void 0:y.style,s=(C=this.legendBoxDOM)==null?void 0:C.style,l=(b=this.resizeDOM)==null?void 0:b.style;let a,r;const c=(w=e==null?void 0:e.title)!=null&&w.show?(T=e==null?void 0:e.title)==null?void 0:T.height:0,d=c+((k=e==null?void 0:e.legend)==null?void 0:k.height),{top:h=0,bottom:u=0,left:f=0,right:p=0}=((M=e==null?void 0:e.legend)==null?void 0:M.padding)??{};if(!(!n||!i))switch(s.padding=`${h}px ${p}px ${u}px ${f}px`,t){case"top":n.padding=`${d}px 0 0 0`,a=this.chartDOM.getBoundingClientRect(),r=parseInt(i.paddingTop)+parseInt(i.paddingBottom),s.width="100%",s.height=`${e.legend.height-r}px`,i.top=`${c}px`,i.right="",i.bottom="",i.left="",i.width=`${a.width}px`,i.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`,i.paddingLeft="10px",i.top=`${c}px`,i.right="0px",i.bottom="",i.left="",i.width=`${e.legend.width}px`,i.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(i.paddingTop)+parseInt(i.paddingBottom),s.width="100%",s.height=`${e.legend.height-r}px`,i.top="",i.right="",i.bottom="0px",i.left="0px",i.width=`${a.width}px`,i.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",i.top=`${c}px`,i.right="",i.bottom="",i.left="0px",i.width=`${e.legend.width}px`,i.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 i=0;i<t.length;i++)e.position==="top"||e.position==="bottom"?(t[i].style.width=`${e.width-8}px`,t[i].style.margin="0 4px"):t[i].style.width="100%"},onMouseMove(e){e.stopPropagation(),e.preventDefault();const t=this.wrapperDOM.getBoundingClientRect(),n=this.wrapperDOM.offsetWidth,i=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>i-r&&(h=i-r),this.ghostDOM.style.top=`${h}px`;break;case"bottom":h=e.clientY-t.top,h<r+s?h=r+s:h>i-d&&(h=i-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,i=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":i.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":i.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":i.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":i.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}i.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,i=(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;!i||!t||(n&&(n.display="none"),i.display="none",i.width="0",i.height="0",t.padding=`${s}px 0 0 0`)},getFormattedValue({formatter:e,decimalPoint:t},n){if(n==null)return"Null";let i;return e&&(i=e(+n)),(!e||typeof i!="string")&&(i=A.labelSignFormat(+n,t)),i}},Ar=28,hC={width:70,height:60},uC={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 i=Object.values(this.seriesList);if(!i.length)return;const{colorState:s}=i[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 i=this.getSelectedValue(e);i=this.isSide?100-i:i;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&&i>c||!n&&i<r)return;a[0][s]=i,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:i,valueOpt:s}=n[0],l=i[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:i,height:s}=this.containerDOM.getBoundingClientRect(),l=!this.isSide,a=l?t:n,r=l?i:s;let c=l?e.clientX:e.clientY;c<a?c=a:c>a+r&&(c=a+r);const d=c-a;return+Je(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 i=e.getElementsByClassName("ev-chart-legend-thumb")[0].children;if(i&&i.length)for(const s of i)s.style.opacity=1}},createLegendOverlay(e,t){this.clearOverlay();const n=this.legendHandleSize,{min:i,max:s}=t;if(i===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(i+(s-i)*(e/100));const c=document.createElement("span");c.className="ev-chart-legend-overlay-item",c.dataset.type="overlay-item";let d,h;const u=Math.floor(n/2)+14;this.isSide?(h=`top:${100-e}%;left:${u}px;transform:translateY(-50%);`,d=`top:${100-e}%;transform:translateY(-50%);`):(h=`top:-${u}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 f=l==null?void 0:l.getElementsByClassName("ev-chart-legend-thumb")[0];if(f){const p=f.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 i=document.createElement("div");return i.className=`ev-chart-legend-handle ${e}`,i.dataset.type="handle",i.appendChild(n),i},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>Ar?Ar:t;const n=this.legendHandleSize,i=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(i),this.containerDOM.appendChild(s)},setLegendStyle(e){const t=this.isSide?"top":"right",n=this.legendHandleSize,{valueOpt:i,colorState:s}=e,{min:l,max:a,decimalPoint:r}=i,{start:c,end:d}=s[0],h=e.getColorForGradient(c),u=e.getColorForGradient(d);let f=`linear-gradient(to ${t}, `;f+=`${h}, ${u})`;const p=Math.floor(n/2)+14;let g=`width:${n}px;height:${n}px;`,m,y,C,b=`background:${f};`;this.isSide?(g+=`margin-top:-${n/2}px;`,m=`left:${p}px;transform:translateY(-50%);top:`,y=`top:${100-d}%;`,C=`top:${100-c}%;`,b+=`top:${100-d}%;height:${d-c}%;`):(g+=`margin-left:-${n/2}px;`,m=`top:-${p}px;transform:translateX(-50%);left:`,y=`left:${c}%;`,C=`left:${d}%;`,b+=`left:${c}%;width:${d-c}%;`);const w=(l+(a-l)*(c/100)).toFixed(r),T=(l+(a-l)*(d/100)).toFixed(r),k=this.containerDOM.getElementsByClassName("ev-chart-legend-thumb")[0];k.style.cssText=b;const M=k.getElementsByClassName("ev-chart-legend-label");M[0].style.cssText=`${m}0%;`,M[1].style.cssText=`${m}100%;`,l!==void 0&&a!==void 0&&(M[0].innerText=this.isSide?T:w,M[1].innerText=this.isSide?w:T);const Z=this.containerDOM.getElementsByClassName("ev-chart-legend-handle");Z[0].style.cssText=g+y,Z[1].style.cssText=g+C;const S=this.containerDOM.getElementsByClassName("ev-chart-legend-handle-btn-color");S[0].style.backgroundColor=this.isSide?u:h,S[1].style.backgroundColor=this.isSide?h:u},setLegendPosition(){var y,C,b,w;const e=this.options,t=(y=e==null?void 0:e.legend)==null?void 0:y.position,{width:n,height:i}=hC,s=this.legendHandleSize,l=(C=e==null?void 0:e.title)!=null&&C.show?(b=e==null?void 0:e.title)==null?void 0:b.height:0,a=l+i,{top:r=0,bottom:c=0,left:d=0,right:h=0}=((w=e==null?void 0:e.legend)==null?void 0:w.padding)??{},u=this.wrapperDOM.style;if(!u)return;let f,p,g,m;switch(t){case"top":u.padding=`${a}px 0 0 0`,m=this.chartDOM.getBoundingClientRect(),p=`padding:${s+7}px ${h}px ${c}px ${d}px;`,p+="width:100%",p+=`height${i}px;`,f=`width:${m.width}px;`,f+=`height:${i}px;`,f+=`top:${l}px;`;break;case"right":u.padding=`${l}px ${n}px 0 0`,m=this.chartDOM.getBoundingClientRect(),p=`padding:${r}px ${h}px ${c}px ${d}px;`,p+=`width:${n}px;`,p+="height:100%;",p+=`max-height:${m.height}px;`,f=`width:${n}px;`,f+=`height:${m.height}px;`,f+=`top:${l}px;right:0px;`;break;case"bottom":u.padding=`${l}px 0 ${i}px 0`,m=this.chartDOM.getBoundingClientRect(),p=`padding:${s+7}px ${h}px ${c}px ${d}px;`,p+="width:100%;",p+=`height:${i}px;`,f=`width:${m.width}px;`,f+=`height:${i}px;`,f+="bottom:0px;left:0px;";break;case"left":u.padding=`${l}px 0 0 ${n}px`,m=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:${m.height}px;`,f=`width:${n}px;`,f+=`height:${m.height}px;`,f+=`top:${l}px;left:0px`;break}if(["top","bottom"].includes(t)){const T=m.width/2;g=`left:${m.width/2-T/2}px;`,g+=`width:${T}px;`,g+=`height:${s}px;`,g+="padding:4px 0;",g+="margin:0 4px;"}else{const T=m.height/2;g=`top:${m.height/2-T/2}px;`,g+="left:5px;",g+=`width:${s}px;`,g+=`height:${T}px;`,g+="padding:0 4px;",g+="margin:4px 0;"}this.containerDOM.style.cssText=g,this.legendBoxDOM.style.cssText=p,this.legendDOM.style.cssText=f},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,i=(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=`${i}px 0 0 0`)}},fC={initScrollbar(){var e,t,n,i,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=(i=this.options.axesY)==null?void 0:i[0])==null?void 0:s.scrollbar)!=null&&l.use&&this.initScrollbarInfo(this.options.axesY,"y")},initScrollbarInfo(e,t){var s,l,a,r,c,d;const n=this.scrollbar[t],i=He({},(s=e==null?void 0:e[0])==null?void 0:s.scrollbar,Br.scrollbar);Object.keys(i).forEach(h=>{n[h]=i[h]}),n.resetPosition&&(n.range=(a=(l=e==null?void 0:e[0])==null?void 0:l.range)!=null&&a.length?[...e[0].range]:null,this.updateScrollbarAnchorEdge(t)),n.isInit||(n.type=(r=e==null?void 0:e[0])==null?void 0:r.type,n.range=(d=(c=e==null?void 0:e[0])==null?void 0:c.range)!=null&&d.length?[...e[0].range]:null,this.initScrollbarRange(t),this.updateScrollbarAnchorEdge(t),this.createScrollbarLayout(t),this.createScrollbar(t),this.createScrollEvent(t),n.isInit=!0)},initScrollbarRange(e){var i;const t=this.scrollbar[e],n=this.options.type==="heatMap"?this.data.labels[e]:this.data.labels;if((i=t.range)!=null&&i.length&&n.length){const[s,l]=t.range;if(Re(s)&&Re(l)){const a=this.getScrollbarLimits(e);if(!a)return;const{limitMin:r,limitMax:c}=a,d=l-s,h=c-r;if(d>=h)t.range[0]=r,t.range[1]=c;else{let u=+s<r?r:+s,f=u+d;f>c&&(f=c,u=f-d,u<r&&(u=r)),t.range[0]=u,t.range[1]=f}}}},updateScrollbarInfo(e,t){var r,c,d,h,u,f,p,g,m,y,C,b,w,T,k;const{axesX:n,axesY:i}=this.options,s=e==="x"?n:i;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)||no((u=s==null?void 0:s[0])==null?void 0:u.range)){this.destroyScrollbar(e);return}const l=e==="x"?this.axesX:this.axesY,a=!_e((f=s==null?void 0:s[0])==null?void 0:f.range,(p=l==null?void 0:l[0])==null?void 0:p.range);if(a||t){const M=e==="x"?(y=(m=(g=this.options.axesX)==null?void 0:g[0])==null?void 0:m.scrollbar)==null?void 0:y.resetPosition:(w=(b=(C=this.options.axesY)==null?void 0:C[0])==null?void 0:b.scrollbar)==null?void 0:w.resetPosition;if(a){const Z=(T=s==null?void 0:s[0])==null?void 0:T.range,S=this.scrollbar[e].range;if(!M&&(Z!=null&&Z.length)&&(S!=null&&S.length)){const x=Z[1]-Z[0],I=this.scrollbar[e].anchorEdge,L=I?this.getScrollbarLimits(e):null;I==="start"&&L?this.scrollbar[e].range=[L.limitMin,L.limitMin+x]:I==="end"&&L?this.scrollbar[e].range=[L.limitMax-x,L.limitMax]:this.scrollbar[e].range=[S[0],S[0]+x]}else this.scrollbar[e].range=Z!=null&&Z.length?[...Z]:null}this.initScrollbarRange(e),a&&this.updateScrollbarAnchorEdge(e)}this.scrollbar[e].use=!!((k=s==null?void 0:s[0].scrollbar)!=null&&k.use)},updateScrollbarPosition(e){var t,n,i,s;(t=this.scrollbar.x)!=null&&t.use&&((n=this.scrollbar.x)!=null&&n.isInit)&&this.setScrollbarPosition("x",e),(i=this.scrollbar.y)!=null&&i.use&&((s=this.scrollbar.y)!=null&&s.isInit)&&this.setScrollbarPosition("y",e)},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 i=document.createElement("div");i.className="ev-chart-scrollbar-button ev-chart-scrollbar-button-down",i.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",i.appendChild(s),e.appendChild(t),e.appendChild(i)},setScrollbarPosition(e,t){var Z,S;const n=this.scrollbar[e];if(!n.use||!n.range)return;const i=n.dom,s=this.chartRect,l=t??this.labelOffset,a={x1:s.x1+l.left,x2:s.x2-l.right,y1:s.y1+l.top,y2:s.y2-l.bottom},r=(Z=this.options.title)!=null&&Z.show?(S=this.options.title)==null?void 0:S.height:0,c=e==="x",d=c?n.height:n.width,h=c?a.x2-a.x1:a.y2-a.y1,u=n.showButton?d:0,f=h-u*2,p=this.getScrollbarThumbSize(e,f),g=Math.max(0,f-p.size);p.position=Math.min(Math.max(p.position,0),g);let m="display: block;",y,C,b,w,T=`width:${u}px;height:${u}px;`;c?(m=`top: ${s.y2+r+l.top}px;`,m+=`left: ${a.x1}px;`,m+=`width: ${h}px;`,m+=` height: ${d}px;`,y="top: 0;",y+=`left: ${u}px;`,y+=`width: ${f}px;`,y+="height: 100%;",C=`width: ${p.size}px;`,C+="height: 100%;",C+=`left: ${p.position+u}px`,T+="transform:rotate(90deg);top: 0;",b=`${T}right:0;`,w=`${T}left:0;`):(m=`top: ${a.y1+r}px;`,m+=`left: ${a.x2+10}px;`,m+=`width: ${d}px;`,m+=`height: ${h}px;`,y=`top: ${u}px;`,y+="left: 0;",y+="width: 100%;",y+=`height: ${f}px;`,C="width: 100%;",C+=`height: ${p.size}px;`,C+=`bottom: ${p.position+u}px`,T+="left:0;",b=`${T}top: 0;`,w=`${T}bottom: 0;`),i.style.cssText=m;const k=i.getElementsByClassName("ev-chart-scrollbar-track");k[0].style.cssText=y,k[0].style.backgroundColor=n.background;const M=i.getElementsByClassName("ev-chart-scrollbar-thumb");if(M[0].style.cssText=C,M[0].style.backgroundColor=n.thumbStyle.background,M[0].style.borderRadius=`${n.thumbStyle.radius}px`,n.showButton){const x=i.getElementsByClassName("ev-chart-scrollbar-button-up"),I=Math.floor(f-p.size),L=Math.floor(p.position)>I?.5:1;x[0].style.cssText=`background-color: ${n.background};${b}`,x[0].style.opacity=L,x[0].children[0].style.display="block";const V=i.getElementsByClassName("ev-chart-scrollbar-button-down");V[0].style.cssText=`background-color: ${n.background};${w}`,V[0].style.opacity=Math.floor(p.position)<0?.5:1,V[0].children[0].style.display="block"}},getScrollbarThumbSize(e,t){var u,f,p,g;const n=this.scrollbar[e],[i,s]=n.range,l=n.type;let a,r,c=1,d=0,h=0;if(l==="step"){const m=this.options.type==="heatMap"?this.data.labels[e]:this.data.labels,y=s-i+1;r=m.length;const C=t/r;a=C*y,h=C*i}else{const m=e==="x"?this.axesX:this.axesY,y=(u=this.minMax[e])==null?void 0:u[0],C=+y.max-+y.min,b=+s-+i;l==="time"&&(c=(g=m==null?void 0:m[0])==null?void 0:g.getInterval({minValue:y.min,maxValue:y.max,maxSteps:(p=(f=this.labelRange[e])==null?void 0:f[0])==null?void 0:p.max})),r=Math.ceil(C/c)+1,d=+y.min;const w=t/r,T=b/c+1,k=+i-d;a=w*T,h=w*(k/c)}return n.startValue=d,n.steps=r,n.interval=c,{size:a,position:h}},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:i,range:s,interval:l,steps:a}=n,r=i+l*a,c=e==="x"?this.axesX[0]:this.axesY[0],[d,h]=s??[];(!Re(d)||!Re(h))&&(n.range=(c==null?void 0:c.range)||null);let u,f,p=!1;t?(u=d+l,f=h+l,p=f>=r):(u=d-l,f=h-l,p=u<i),p||(n.range=[u,f],this.updateScrollbarAnchorEdge(e),this.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1},lightUpdate:u>1,updateByScrollbar:!0}))},getScrollbarLimits(e){var l,a;const t=this.scrollbar[e];if((t==null?void 0:t.type)==="step"){const r=this.options.type==="heatMap"?this.data.labels[e]:this.data.labels;return r!=null&&r.length?{limitMin:0,limitMax:r.length-1}:null}const n=(a=(l=this.minMax)==null?void 0:l[e])==null?void 0:a[0];if((n==null?void 0:n.min)==null||(n==null?void 0:n.max)==null)return null;const i=+n.min,s=+n.max;return!Number.isFinite(i)||!Number.isFinite(s)?null:{limitMin:i,limitMax:s}},updateScrollbarAnchorEdge(e){const t=this.scrollbar[e];if(!t)return;const n=t.range,i=this.getScrollbarLimits(e);if(!Array.isArray(n)||n.length!==2||!i){t.anchorEdge=null;return}n[0]<=i.limitMin?t.anchorEdge="start":n[1]>=i.limitMax?t.anchorEdge="end":t.anchorEdge=null},createScrollEvent(){var t,n,i;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:u,y:f}=h[0].getBoundingClientRect(),p=c==="x",g=p?s.clientX:-s.clientY,m=p?u:-f;d=g>m}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(),u=this.scrollbar[a];u.scrolling=!0,a==="x"?u.pointInThumb=s.clientX-c:u.pointInThumb=d+h-s.clientY;const f=u.dom;f.addEventListener("mousemove",this.onScrollbarMove),f.addEventListener("mouseup",this.onScrollbarUp)};const e=s=>{this.scrolling(s)};if(this.onScrollbarMove=ns(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,u,f,p,g,m,y,C;const l=((u=(h=this.tooltipDOM)==null?void 0:h.style)==null?void 0:u.display)==="block",a=this.tooltipBodyDOM||((f=this.tooltipDOM)==null?void 0:f.querySelector(this.options.tooltip.htmlScrollTarget));if(l&&a){const{scrollTop:b,scrollHeight:w,clientHeight:T}=a,k=b<=0,M=Math.ceil(b)+T>=w,Z=s.deltaY<0,S=s.deltaY>0;if(!(k&&Z||M&&S))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&&((m=this.scrollbar.y)!=null&&m.use)&&this.updateScrollbarRange("y",s.deltaY<0);return}if((y=this.scrollbar.x)!=null&&y.use&&c>r){this.updateScrollbarRange("x",s.deltaX>0);return}(C=this.scrollbar.y)!=null&&C.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)&&((i=this.overlayCanvas)==null||i.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:i,range:s,pointInThumb:l,startValue:a,interval:r}=this.scrollbar[n],c=t.getElementsByClassName("ev-chart-scrollbar-track"),{x:d,y:h,width:u,height:f}=c[0].getBoundingClientRect(),p=n==="x",g=p?d:h,m=p?u:f,y=m/i,C=a+(i-1)*r;let b=p?e.clientX:e.clientY;b<g?b=g:b>g+m&&(b=g+m);let w;if(p?w=b-g-l:w=g+m-b-l,w<=0)return;let T,k;const M=Math.round(Math.abs(w)/y)*r,[Z,S]=s;if(w>0){const x=a+(M-+Z);T=+Z+x,k=T+(+S-+Z)}T<a||k>C||(this.scrollbar[n].range=[T,k],this.updateScrollbarAnchorEdge(n),this.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1},lightUpdate:T>1,updateByScrollbar:!0}))},stopScrolling(e){const n=this.getScrollbarContainerDOM(e.target).dataset.type,i=this.scrollbar[n];if(i.scrolling){i.scrolling=!1;const s=i.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,i,s;const t=this.scrollbar[e].dom;t&&(t.remove(),this.scrollbar[e]={isInit:!1},!((n=this.scrollbar.x)!=null&&n.use)&&!((i=this.scrollbar.y)!=null&&i.use)&&((s=this.overlayCanvas)==null||s.removeEventListener("wheel",this.onScrollbarWheel,{passive:!1})))}};function mC(e){const t=typeof e;return e!=null&&(t==="object"||t==="function")}function Kr(e,t,n){let i,s,l,a,r,c,d=0,h=!1,u=!1,f=!0;const p=!t&&t!==0&&typeof root.requestAnimationFrame=="function";if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0,mC(n)&&(h=!!n.leading,u="maxWait"in n,l=u?Math.max(+n.maxWait||0,t):l,f="trailing"in n?!!n.trailing:f);function g(I){const L=i,V=s;return i=s=void 0,d=I,a=e.apply(V,L),a}function m(I,L){return p?(window.cancelAnimationFrame(r),window.requestAnimationFrame(I)):setTimeout(I,L)}function y(I){if(p)return window.cancelAnimationFrame(I);clearTimeout(I)}function C(I){return d=I,r=m(T,t),h?g(I):a}function b(I){const L=I-c,V=I-d,R=t-L;return u?Math.min(R,l-V):R}function w(I){const L=I-c,V=I-d;return c===void 0||L>=t||L<0||u&&V>=l}function T(){const I=Date.now();if(w(I))return k(I);r=m(T,b(I))}function k(I){return r=void 0,f&&i?g(I):(i=s=void 0,a)}function M(){r!==void 0&&y(r),d=0,i=c=s=r=void 0}function Z(){return r===void 0?a:k(Date.now())}function S(){return r!==void 0}function x(...I){const L=Date.now(),V=w(L);if(i=I,s=this,c=L,V){if(r===void 0)return C(c);if(u)return r=m(T,t),g(c)}return r===void 0&&(r=m(T,t)),a}return x.cancel=M,x.flush=Z,x.pending=S,x}const pC="Expected a function";function gC(e,t,n){let i=!0,s=!0;if(typeof e!="function")throw new TypeError(pC);return Kr(e,t,{leading:i,maxWait:t,trailing:s})}const bC={createEventFunctions(){var n,i,s,l;this.onMouseMove=a=>{var b,w;if((b=this.dragInfo)!=null&&b.isMove||this.isMobile)return;const r={e:a},{indicator:c,tooltip:d,type:h}=this.options,u=this.getMousePosition(a),f=this.findHitItem(u);d!=null&&d.showAllValueInRange&&(f!=null&&f.items)&&this.addNotHitInfo(f);const p=this.overlayCtx,g=Object.keys(f.items),m=g.length>0;let y="";if(m){y=`h=${f.hitId}`;const T=g.slice().sort();for(let k=0;k<T.length;k++){const M=T[k];y+=`|${M}:${f.items[M].index}`}}const C=y!==""&&y===this._lastHoverSig&&this.tooltipDOM&&this.tooltipDOM.style.display!=="none";if(this.overlayClear(),m){if(d.use&&this.isInitTooltip)if(this.drawItemsHighlight(f,p),typeof(d==null?void 0:d.returnValue)=="function"){const k=[];for(let M=0;M<g.length;M++){const Z=g[M],S=f.items[Z];k.push({sId:Z,data:S.data,color:S.color,name:S.name,dataId:S.id,index:S.index})}this.hideTooltipDOM(),d.returnValue(k,a)}else(w=d==null?void 0:d.formatter)!=null&&w.html?(C||this.drawCustomTooltip(f==null?void 0:f.items),this.setCustomTooltipLayoutPosition(f,a)):(this.setTooltipLayoutPosition(f,a),h==="scatter"?this.drawTooltipForScatter(f,this.tooltipCtx):h==="heatMap"?this.drawToolTipForHeatMap(f,this.tooltipCtx):this.drawTooltip(f,this.tooltipCtx));const T=Object.values(this.seriesList||{}).some(k=>k.type==="line");if(d.use&&(h==="line"||T)){const k=this.drawIndicatorForTooltip(f,c.color),M=k==null?void 0:k.labelValue,Z=this.getTimeLabel(u);r.hoveredLabel={horizontal:this.options.horizontal,label:Z,mousePosition:[a.clientX,a.clientY],dataLabel:M}}}else d.use&&this.isInitTooltip&&(typeof(d==null?void 0:d.returnValue)=="function"&&d.returnValue([],a),this.hideTooltipDOM());if(this._lastHoverSig=y,this.dragInfoBackup&&this.drawSelectionArea(this.dragInfoBackup),!r.hoveredLabel&&!this.isNotUseIndicator()){const T=Object.values(this.seriesList||{}).some(M=>M.type==="line");(h!=="line"&&!T||!d.use||!Object.keys(f.items).length)&&this.drawIndicator(u,c.color);const k=this.getTimeLabel(u);r.hoveredLabel={horizontal:this.options.horizontal,label:k,mousePosition:[a.clientX,a.clientY]}}else r.hoveredLabel||(r.hoveredLabel={label:""});typeof this.listeners["mouse-move"]=="function"&&(h!=="pie"&&(r.curMouseTargetVal=this.getCurMouseTargetVal(u,f)),this.listeners["mouse-move"](r))},this.onMouseLeave=a=>{const{tooltip:r,dragSelection:c}=this.options;r.throttledMove&&this.onMouseMove.cancel(),(!c.use||!c.keepDisplay)&&this.overlayClear(),r.use&&this.isInitTooltip&&(typeof(r==null?void 0:r.returnValue)=="function"&&r.returnValue([],a),this.tooltipClear()),this._lastHoverSig="",this.invalidateClientRectCache(),this.listeners["mouse-leave"]()},this.onDblClick=a=>{const r={e:a},c=this.getMousePosition(a),{type:d,selectItem:h,selectLabel:u,selectSeries:f}=this.options,p=(h==null?void 0:h.use)&&(h==null?void 0:h.useClick),g=(u==null?void 0:u.use)&&(u==null?void 0:u.useClick),m=(f==null?void 0:f.use)&&(f==null?void 0:f.useClick);p?r.eventTarget="item":g?r.eventTarget="label":m&&(r.eventTarget="series");const y=()=>{var M,Z;const w=this.findHitItem(c,!0),T=w.hitId??Object.keys(w.items)[0],k=w.items[T];k&&(r.label=k.label,r.value=(M=k.data)==null?void 0:M.o,r.seriesId=T,r.dataIndex=k.index,r.acc=(Z=k.data)==null?void 0:Z.acc)},C=w=>{var x,I;const T=this.findHitItem(c,!0),k=T.hitId??Object.keys(T.items)[0],M=T.items[k],{labelIndex:Z}=this.getLabelInfoByPosition(c,w),{dataIndex:S}=this.regulateSelectedLabelInfo(Z,w);this.defaultSelectInfo=this.getSelectedLabelInfoWithLabelData(S,w),M&&(r.label=M.label,r.seriesId=k,r.value=(x=M.data)==null?void 0:x.o,r.acc=(I=M.data)==null?void 0:I.acc,r.dataIndex=M.index)},b=()=>{var M,Z,S;const w=this.findHitItem(c,!0),T=w.hitId??Object.keys(w.items)[0],k=w.items[T];if(T!==null){const x=this.updateSelectedSeriesInfo(T,!0);k&&(r.label=k.label,r.value=(M=k.data)==null?void 0:M.o,r.seriesId=(Z=x.seriesId)==null?void 0:Z.at(0),r.acc=(S=k.data)==null?void 0:S.acc,r.dataIndex=k.index)}};switch(d){case"bar":{g?C(this.options.horizontal?"yAxis":"xAxis"):y();break}case"line":{p?y():g?C():m&&b();break}default:{y();break}}typeof this.listeners["dbl-click"]=="function"&&this.listeners["dbl-click"](r)},this.onClick=a=>{var w;if(this.isMouseMove){this.isMouseMove=!1;return}const r={e:a},c=this.getMousePosition(a),{type:d,selectItem:h,selectLabel:u,selectSeries:f}=this.options,p=(h==null?void 0:h.use)&&(h==null?void 0:h.useClick),g=(u==null?void 0:u.use)&&(u==null?void 0:u.useClick),m=(f==null?void 0:f.use)&&(f==null?void 0:f.useClick),y=()=>{const T=this.getHitItemByPosition(c,!1,void 0,!1,!0);({label:r.label,value:r.value,sId:r.seriesId,dataIndex:r.dataIndex,acc:r.acc}=T),T!=null&&T.sId&&(r.selected={eventTarget:"item",seriesId:this.isDeselectItem(T)?null:T.sId,dataIndex:this.isDeselectItem(T)?null:T.dataIndex})},C=T=>{var Z,S,x,I;const{labelIndex:k}=this.getLabelInfoByPosition(c,T),{dataIndex:M}=this.regulateSelectedLabelInfo(k,T);this.defaultSelectInfo=this.getSelectedLabelInfoWithLabelData(M,T),T&&(this.defaultSelectInfo.targetAxis=M!=null&&M.length?T:null),r.selected={eventTarget:"label",...Ze(this.defaultSelectInfo)},r.label=(S=(Z=this.defaultSelectInfo)==null?void 0:Z.label)==null?void 0:S.at(0),r.dataIndex=(I=(x=this.defaultSelectInfo)==null?void 0:x.dataIndex)==null?void 0:I.at(0)},b=()=>{const T=this.findHitItem(c,!0),k=T.hitId??Object.keys(T.items)[0],M=T.items[k];if(!Yt(k)){const Z=this.updateSelectedSeriesInfo(k,!1);this.defaultSelectInfo.seriesId=Z.seriesId,r.selected={eventTarget:"series",...Ze(this.defaultSelectInfo)},r.label=M.label,r.dataIndex=M.index}};switch(d){default:case"bar":{p?y():g&&C(this.options.horizontal?"yAxis":"xAxis");break}case"line":{p?y():g?C():m&&b();break}case"heatMap":{const T=!!this.options.horizontal;if(p&&g){const{useBothAxis:k}=u,M=this.getCurMouseLocation(c);if(M==="chartBackground")this.clearSelectedLabelInfo(),r.deselected={eventTarget:"label"},y();else if(M==="yAxis"||M==="xAxis"){if(this.clearSelectedItemInfo(),r.deselected={eventTarget:"item"},!k&&M!==(T?"yAxis":"xAxis"))return;C(M)}}else if(p)y();else if(g){const{useBothAxis:k}=u,M=this.getCurMouseLocation(c);if((M==="yAxis"||M==="xAxis")&&!k&&M!==(T?"yAxis":"xAxis"))return;M!=="canvas"&&C(k?M:null)}break}case"pie":{p&&y();break}case"scatter":{if(p&&y(),(w=this.options.dragSelection)!=null&&w.use&&this.isMobile){let T=this.setTouchInfo(a);this.overlayClear(),this.options.dragSelection.keepDisplay&&(a.layerX<T.range.x1||a.layerY<T.range.y1||a.layerX>T.range.x2||a.layerY>T.range.y2)?this.isTouchOverlay=!1:(T=this.setTouchBoxDimensions(T),this.isTouchOverlay=!0,this.drawSelectionArea(T)),this.options.dragSelection.keepDisplay||setTimeout(()=>{this.isTouchOverlay=!1,this.overlayClear()},100),r.e=a,r.touchInfo=T,r.data=this.findSelectedItems(T),r.range=this.getSelectionRange(T),typeof this.listeners["drag-select"]=="function"&&this.listeners["drag-select"](r)}break}}typeof this.listeners.click=="function"&&(this.dragInfoBackup||this.listeners.click(r))},this.onMouseDown=a=>{const{dragSelection:r,type:c}=this.options;r.use&&(c==="scatter"||c==="line"||c==="heatMap")&&(this.removeSelectionArea(),this.dragStart(a,c))},this.onWheel=a=>{var y,C,b,w;if(!(((C=(y=this.tooltipDOM)==null?void 0:y.style)==null?void 0:C.display)==="block"))return;const c=((b=this.vsState)==null?void 0:b.scrollEl)||(this.options.tooltip.htmlScrollTarget?(w=this.tooltipDOM)==null?void 0:w.querySelector(this.options.tooltip.htmlScrollTarget):null)||this.tooltipBodyDOM;if(!c||c.scrollHeight<=c.clientHeight){this.hideTooltipDOM();return}const{scrollTop:d,scrollHeight:h,clientHeight:u}=c,f=d<=0,p=Math.ceil(d)+u>=h,g=a.deltaY<0,m=a.deltaY>0;a.preventDefault(),!(f&&g)&&!(p&&m)&&(c.scrollTop+=a.deltaY)};const e=(n=this.options)==null?void 0:n.tooltip,t=!!((i=e==null?void 0:e.formatter)!=null&&i.html)&&!!(e!=null&&e.virtualScroll)&&e.virtualScroll.use!==!1;(e!=null&&e.useScrollbar||t)&&this.overlayCanvas.addEventListener("wheel",this.onWheel,{passive:!1}),(l=(s=this.options)==null?void 0:s.tooltip)!=null&&l.throttledMove&&(this.onMouseMove=gC(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=a=>this.dragTouchSelectionDestroy(a),window.addEventListener("click",this.dragTouchSelectionEvent),this.invalidateRectOnScroll=()=>this.invalidateClientRectCache(),window.addEventListener("scroll",this.invalidateRectOnScroll,{capture:!0,passive:!0})},dragStart(e,t){let[n,i]=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),i<a.y1&&(i=a.y1),i>a.y2&&(i=a.y2),this.dragInfo={xcp:n,ycp:i,range:a};const r=d=>{d.preventDefault();const[h,u]=this.getMousePosition(d),f=this.dragInfo,{xcp:p,ycp:g,range:m}=f;let y,C;if(f.isMove=!0,this.isMouseMove=!0,h<m.x1?y=m.x1:h>m.x2?y=m.x2:y=h,u<m.y1?C=a.y1:u>m.y2?C=m.y2:C=u,t==="heatMap"){const b={xcp:p,xep:y,ycp:g,yep:C,range:m},{xsp:w,ysp:T,width:k,height:M}=this.getDragInfoForHeatMap(b);f.xsp=w,f.ysp=T,f.width=k,f.height=M}else f.xsp=Math.min(p,y),f.ysp=t==="scatter"?Math.min(g,C):m.y1,f.width=Math.ceil(Math.abs(y-p)),f.height=t==="scatter"?Math.ceil(Math.abs(C-g)):m.y2-m.y1;this.overlayClear(),this.drawSelectionArea(f)},c=d=>{var u,f;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=He({},h),typeof this.listeners["drag-select"]=="function"&&!((f=(u=this.options)==null?void 0:u.zoom)!=null&&f.use))this.listeners["drag-select"](p);else{const{xsp:g,range:m,width:y}=h,C=g-m.x1;p.range.dragSelectionInfo={dragXsp:C,dragXep:C+y,exceptAxesYChartWidth:m.x2-m.x1,exceptAxesXChartHeight:m.y2-m.y1,chartRange:m,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:i,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,_e(h,s))l.fillRect(e,t,n,i);else{const u=s.x2-s.x1,f=s.y2-s.y1,p=h.x2-h.x1,g=h.y2-h.y1,m=(e-s.x1)/u,y=(t-s.y1)/f,C=h.x1+p*m,b=h.y1+g*y,w=n/u,T=i/f,k=p*w,M=g*T;l.fillRect(C,b,k,M)}l.globalAlpha=1},removeSelectionArea(){this.dragInfoBackup=null,this.overlayClear()},getMousePosition(e){const t=e.originalEvent||e,n=this.getOverlayClientRect();return[t.clientX-n.left,t.clientY-n.top,n.width,n.height]},getCurMouseTargetVal(e,t){const n=this.getCurMouseLocation(e),i={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]&&(i.dataIdx=l[a].index,i.maxDataVal=r,i.originVal=t)}}else if(n==="xAxis"||n==="yAxis"){const{axesX:s,axesY:l}=this.options,a=(c,d,h)=>{i.labelIdx=d,i.labelVal=c[0].type==="time"?Ne(h).format(c[0].timeFormat):h,i.originVal=c[0].type==="time"?Ne(h):h};(c=>{const{labelIndex:d}=this.getLabelInfoByPosition(e,n),{labelVal:h,labelIdx:u}=this.getCurMouseLabelVal(c,e,d);a(c==="xAxis"?s:l,u,h)})(n)}return i},setTouchInfo(e){let[t,n]=this.getMousePosition(e);const i=this.chartRect,s=this.labelOffset,l={x1:i.x1+s.left,x2:i.x2-s.right,y1:i.y1+s.top,y2:i.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:i,ycp:s,range:l}=e;let a=i-n,r=s-n,c=t,d=t;return this.boxOverflow={x1:!1,x2:!1,y1:!1,y2:!1},i<l.x1+n&&(a=l.x1,c=n-(l.x1-i),this.boxOverflow.x1=!0),i>l.x2-n&&(c=n-(i-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,t=!1){var k,M,Z,S;(k=this.ensureHitCoordsFresh)==null||k.call(this);const n=Object.keys(this.seriesList),i={},s=!!this.options.horizontal,l=this.tooltipCtx,[a,r]=e;let c=null,d="",h=0,u="",f=null,p=null,g=1/0,m=!1,y=null,C=1/0;const b=this.findClosestDataIndex(e,n,t);if(b===-1&&!this.isNotUseIndicator())return{items:i,hitId:c,maxTip:[d,u],maxHighlight:null};const w=n.every(x=>this.seriesList[x].type==="bar");for(let x=0;x<n.length;x++){const I=n[x],L=this.seriesList[I];if(L.findGraphData&&L.show){const V=L.findGraphData(e,s,b,!w);if(V!=null&&V.data){let R;if(V.data.o===null&&L.interpolation!=="zero"?L.isExistGrp||(R=s?V.data.x:V.data.y):isNaN(V.data.o)||(R=V.data.o),R!=null){const E=this.getFormattedTooltipLabel({dataId:L.id,seriesId:I,seriesName:L.name,itemData:V.data}),G=l?l.measureText(E).width:1;V.id=L.id,V.name=E,V.axis={x:L.xAxisIndex,y:L.yAxisIndex},V.label=s?(M=V.data)==null?void 0:M.y:(Z=V.data)==null?void 0:Z.x,i[I]=V;const v=this.getFormattedTooltipValue({dataId:L.id,seriesId:I,seriesName:E,value:R,itemData:V.data});if(V.data.formatted=v,h<G&&(d=E,h=G),u.length<=`${v}`.length&&(u=`${v}`),(f===null||f<=R)&&(f=R,p=I),V.hit&&V.data.xp!==void 0&&V.data.yp!==void 0){const X=(V.data.xp-e[0])**2+(V.data.yp-e[1])**2;V.directHit?((!m||X<g)&&(g=X,c=I),m=!0):!m&&X<g&&(g=X,c=I)}if(c===null&&V.data.xp!==void 0&&V.data.yp!==void 0&&V.data.xp!==null&&V.data.yp!==null){const X=A.calcBoxDistance(V.data,a,r);X<C&&(C=X,y=I)}}}}}c===null&&(c=y!==null?y:Object.keys(i)[0]);const T=f!==null?[p,f]:null;if(t&&Object.keys(i).length===0&&b!==-1){const x=n.find(L=>{var R;const V=this.seriesList[L];return(V==null?void 0:V.show)&&((R=V==null?void 0:V.data)==null?void 0:R.length)>0}),I=x?(S=this.seriesList[x].data)==null?void 0:S[b]:null;I&&(i[""]={id:"",name:"",label:s?I.y:I.x,index:b,axis:{x:0,y:0},data:{o:void 0,x:I.x,y:I.y}},c="")}return{items:i,hitId:c,maxTip:[d,u],maxHighlight:T}},buildLabelValidMask(e){var s,l;const t=e??Object.keys(this.seriesList);let n=0;for(let a=0;a<t.length;a++){const r=this.seriesList[t[a]];r!=null&&r.show&&((s=r.data)==null?void 0:s.length)>n&&(n=r.data.length)}const i=new Uint8Array(n);for(let a=0;a<t.length;a++){const r=this.seriesList[t[a]];if(r!=null&&r.show&&r.data){const{data:c}=r;for(let d=0;d<c.length;d++){const h=(l=c[d])==null?void 0:l.o;h!=null&&(i[d]=1)}}}return this.labelValidMask=i,i},findClosestDataIndex(e,t,n=!1){var m;const[i,s]=e,l=!!this.options.horizontal,a=l?s:i,r=t.find(y=>{var b;const C=this.seriesList[y];return(C==null?void 0:C.show)&&((b=C==null?void 0:C.data)==null?void 0:b.length)>0});if(!r||!((m=this.seriesList[r])!=null&&m.data))return-1;const c=this.seriesList[r].data;let d=50;if(c.length>1){const y=[];for(let C=1;C<c.length;C++){const b=c[C-1],w=c[C];if(b&&w){let T,k;l?(T=b.h?b.yp+b.h/2:b.yp,k=w.h?w.yp+w.h/2:w.yp):(T=b.w?b.xp+b.w/2:b.xp,k=w.w?w.xp+w.w/2:w.xp),T!==null&&k!==null&&y.push(Math.abs(k-T))}}y.length>0&&(d=y.reduce((C,b)=>C+b,0)/y.length)}let h=1/0,u=-1,f=this.labelValidMask;!n&&(!f||f.length<c.length)&&(f=this.buildLabelValidMask(t));for(let y=0;y<c.length;y++)if(n||f[y]===1){const b=c[y];if(b){let w;if(l?w=b.h?b.yp+b.h/2:b.yp:w=b.w?b.xp+b.w/2:b.xp,w!==null){const T=Math.abs(a-w);T<h&&(h=T,u=y)}}}if(u===-1)return-1;const g=Math.max(d,6);return h>=g?t.some(C=>{const b=this.seriesList[C];if(b!=null&&b.show){const w=b.passingValue,T=b.interpolation,k=b.hasPassingValueInData;return T==="linear"||T==="none"&&!!w&&k}return!1})?u:-1:u},getFormattedTooltipLabel({dataId:e,seriesId:t,seriesName:n,itemData:i}){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:i})),r},getFormattedTooltipValue({dataId:e,seriesId:t,seriesName:n,value:i,itemData:s}){var u;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:(u=r==null?void 0:r.formatter)==null?void 0:u.value,d=s!==null&&typeof s=="object"&&c;if(d){this._tooltipValueCache||(this._tooltipValueCache=new WeakMap);const f=this._tooltipValueCache.get(s);if(f!==void 0){const p=f[t];if(p!==void 0)return p}}let h=i;if(c&&(l.type==="pie"?h=c({value:i,name:n,percentage:s==null?void 0:s.percentage,seriesId:t,dataId:e}):l.type==="heatMap"?h=c({x:s==null?void 0:s.x,y:s==null?void 0:s.y,value:i>-1?i:"error",seriesId:t,dataId:e}):h=c({x:a?i:s==null?void 0:s.x,y:a?s==null?void 0:s.y:i,o:s==null?void 0:s.o,name:n,seriesId:t,dataId:e})),i&&(!c||typeof h!="string")&&(l.type==="heatMap"?h=i<0?"error":Qt(i):h=Qt(i)),d){let f=this._tooltipValueCache.get(s);f||(f=Object.create(null),this._tooltipValueCache.set(s,f)),f[t]=h}return h},addNotHitInfo(e){var c,d,h,u,f,p;const t=this.tooltipCtx,n=!!this.options.horizontal,i=Object.keys(e.items)[0],s=n?(h=(d=(c=e.items)==null?void 0:c[i])==null?void 0:d.data)==null?void 0:h.y:(p=(f=(u=e.items)==null?void 0:u[i])==null?void 0:f.data)==null?void 0:p.x;let l="",a="";const r=Object.keys(this.seriesList);for(let g=0;g<r.length;g++){const m=r[g],y=this.seriesList[m];if(y!=null&&y.show){const C=y.data.find(S=>n?(S==null?void 0:S.y)===s:(S==null?void 0:S.x)===s),b=this.getFormattedTooltipLabel({dataId:y.id,seriesId:m,seriesName:y.name,itemData:C}),w=this.getFormattedTooltipValue({dataId:y.id,seriesId:m,seriesName:b,value:C==null?void 0:C.o,itemData:C});if(C&&C.o!==null&&C.o!==void 0&&!e.items[m]){const S={};S.color=y.color,S.hit=!1,S.name=b,S.axis={x:y.xAxisIndex,y:y.yAxisIndex},S.index=n?y.yAxisIndex:y.xAxisIndex,S.data=C,S.data.formatted=w,e.items[m]=S}const T=t?t.measureText(l).width:1,k=t?t.measureText(b).width:1;T<k&&(l=b);const M=t?t.measureText(a).width:1,Z=t?t.measureText(`${w}`).width:1;M<Z&&(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){const t=e??[],n=this._renderedSelectSeriesIds;n&&n.length===t.length&&n.every((i,s)=>i===t[s])||(this.defaultSelectInfo.seriesId=e,this._renderedSelectSeriesIds=[...t],this.render())},getSelectedLabelInfoWithLabelData(e,t){const{selectLabel:n,type:i,horizontal:s}=this.options,l=Ze(this.defaultSelectInfo);switch(l.dataIndex=e,i){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:u})=>l.label.includes(c==="y"?u:h));break}}return l},regulateSelectedLabelInfo(e,t){var l,a;const n=((l=this.options)==null?void 0:l.selectLabel)??{},i=t===null||((a=this.defaultSelectInfo)==null?void 0:a.targetAxis)===t?{...this.defaultSelectInfo,targetAxis:t}:{dataIndex:[],targetAxis:t},s=Ze(i);if(i.dataIndex.includes(e)){const r=i.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)??{},i=this.defaultSelectInfo??{seriesId:[]};typeof i.seriesId=="string"&&(i.seriesId=[i.seriesId]);const s=Ze(i);if(i.seriesId.includes(e)){if(!t){const a=i.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:i}=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=i?a.data.y:a.data.x;let c;if(i){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),i?(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){var i;(i=this.ensureHitCoordsFresh)==null||i.call(this);const t=[],n=Object.keys(this.seriesList);for(let s=0;s<n.length;s++){const l=n[s],a=this.seriesList[l],r=a.findItems;if(r){const c=r.call(a,e);c&&c.length&&t.push({seriesName:a.name,seriesId:l,items:c})}}return t},getSelectionRange({xsp:e,ysp:t,width:n,height:i,range:s}){var w,T,k,M;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+i,d=l.graphMax-l.graphMin,h=a.graphMax-a.graphMin,u=this.getRatioInRange(s.x1,s.x2,e),f=this.getRatioInRange(s.x1,s.x2,r),p=this.getRatioInRange(s.y1,s.y2,c),g=this.getRatioInRange(s.y1,s.y2,t),m=this.isMobile&&((w=this.boxOverflow)!=null&&w.x1)?Math.min(this.minMax.x[0].min,l.graphMin):Math.max(l.graphMin+d*u,l.graphMin),y=this.isMobile&&((T=this.boxOverflow)!=null&&T.x2)?Math.max(this.minMax.x[0].max,l.graphMax):Math.min(l.graphMin+d*f,l.graphMax),C=this.isMobile&&((k=this.boxOverflow)!=null&&k.y2)?Math.min(this.minMax.y[0].min,a.graphMin):Math.max(a.graphMin+h*(1-p),a.graphMin),b=this.isMobile&&((M=this.boxOverflow)!=null&&M.y1)?Math.max(this.minMax.y[0].max,a.graphMax):Math.min(a.graphMin+h*(1-g),a.graphMax);return{xMin:+m.toFixed(3),xMax:+y.toFixed(3),yMin:+C.toFixed(3),yMax:+b.toFixed(3)}},getRatioInRange(e,t,n){const i=t-e;return(n-e)/i},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 i=Object.keys(this.seriesList)[0],{xMin:s,xMax:l,yMin:a,yMax:r}=this.seriesList[i].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.dataIndex)===((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.dataIndex)},getCurMouseLocation(e){const[t,n]=e,i={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=i[this.axesX[0].units.rectStart],l=i[this.axesX[0].units.rectEnd],a=i[this.axesY[0].units.rectStart],r=i[this.axesY[0].units.rectEnd];return St(t,this.chartRect.x1,i.x1)&&St(n,a,r)?"yAxis":St(t,s,l)&&St(n,i.y2,this.chartRect.y2)?"xAxis":St(t,i.x1,i.x2)&&St(n,i.y1,i.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}},Uo=8,fs=50,gi=17,yC=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=Kr(()=>{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,i=(t==null?void 0:t.fontFamily)??"Roboto";return`normal normal lighter ${Math.max(n,0)}px ${i}`},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:i=16}=((l=(s=this.options)==null?void 0:s.tooltip)==null?void 0:l.rowPadding)??{};return{t:e,l:i,b:n,r:t}},setTooltipLayoutPosition(e,t){var Y,H,B,z,F,Q,U;const n=this.tooltipCtx,i=t.pageX,s=t.pageY,l=e.items,[a,r]=e.maxTip,d=Object.keys(l).length,h=this.getBoxPadding(),u=this.options.tooltip,f=this.getColorMargin(),p=e.hitId,g=l[p].data,m=l[p].axis,y=(Y=u.formatter)==null?void 0:Y.title;this.axesX.length&&this.axesY.length&&u.showHeader&&(y?this.tooltipHeaderDOM.textContent=y({x:g.x,y:g.y}):this.tooltipHeaderDOM.textContent=this.options.horizontal?this.axesY[m.y].getLabelFormat(g.y):this.axesX[m.x].getLabelFormat(g.x)),u.textOverflow&&this.tooltipHeaderDOM.classList.add(`ev-chart-tooltip-header--${u.textOverflow}`),this.tooltipHeaderDOM.style.visibility="hidden",n.save(),n.font=this.getFontStyle("contents");const b=!!this.options.horizontal?(B=(H=l[e.hitId])==null?void 0:H.data)==null?void 0:B.y:(F=(z=l[e.hitId])==null?void 0:z.data)==null?void 0:F.x,w=(b==null?void 0:b.length)>a.length?b:a,T=Math.round(n.measureText(w).width),k=Math.round(n.measureText(r).width),M=T+k+h.l+h.r+f+fs+gi,Z=M>u.maxWidth?u.maxWidth:M;let S=u.textOverflow==="wrap"?0:d;if(u.textOverflow==="wrap"){const ee=u.maxWidth-(Math.round(n.measureText(r).width)+h.l+h.r+f+fs+gi);Object.values(l).map(te=>te.name).forEach(te=>{if(n.measureText(te).width>ee){let J="";for(let q=0;q<te.length;q++){const $=te[q],ae=`${J}${$}`;n.measureText(ae).width>ee?(J=$,S+=1):J=ae}}S+=1}),n.restore()}const x=h.t+S*this.getTextHeight()+d*Uo+h.b;let I;u.useScrollbar&&x>u.maxHeight?(this.tooltipBodyDOM.style.overflowY="auto",I=u.maxHeight):(this.tooltipBodyDOM.style.overflowY="hidden",I=x),this.tooltipCanvas.width=Z*this.pixelRatio,this.tooltipCanvas.height=x*this.pixelRatio,this.tooltipCanvas.style.width=`${Z}px`,this.tooltipCanvas.style.height=`${x}px`,this.tooltipHeaderDOM.style.width=`${Z}px`,this.tooltipHeaderDOM.style.height="auto",this.tooltipDOM.style.height="auto",this.tooltipBodyDOM.style.height=`${I+6}px`,this.tooltipDOM.style.display="block";const L=document.body.clientWidth,V=document.body.clientHeight,R=20,E=((Q=this.tooltipDOM)==null?void 0:Q.offsetHeight)||((U=this.tooltipHeaderDOM)==null?void 0:U.offsetHeight)+I+yC,G=L-Z-R,v=V-E-R,X=i+R,W=s+R,N=i-Z-R,P=s-E-R,D=X>G?N:X,O=W>v?P:W;this.tooltipDOM.style.transform=`translate3d(${D}px, ${O}px, 0)`},drawSeriesColorShape(e,t,n){var a,r;const i=(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=i/2;e.arc(s,l-c/2,c,0,2*Math.PI),e.fill()}else{const c=i;e.fillRect(s-c/3,l-c/1.2,c,c)}},drawTooltip(e,t){const n=t,i=e.items,[,s]=e.maxTip,l=this.alignSeriesList(Object.keys(i)),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 u=2,f=2;u+=A.aliasPixel(u),f+=A.aliasPixel(f),n.save(),n.scale(this.pixelRatio,this.pixelRatio),this.tooltipBodyDOM.style.overflowY==="auto"&&(a.r+=gi),u+=a.l,f+=a.t,n.font=this.getFontStyle("contents");const p=[];l.forEach(y=>{p.push({id:y,data:i[y].data,color:i[y].color,name:i[y].name,dataId:i[y].id})}),c.sortByValue&&p.sort((y,C)=>{let b=y.data.o,w=C.data.o;return b==null&&(b=r?y.data.x:y.data.y),w==null&&(w=r?C.data.x:C.data.y),w-b}),this.setTooltipDOMStyle(c);const g=this.tooltipDOM.offsetWidth;let m=1;for(let y=0;y<p.length;y++){const C=p[y].data,b=p[y].color,w=p[y].name,T=C.formatted;let k=u+4,M=f+m*d;k+=A.aliasPixel(k),M+=A.aliasPixel(M),n.beginPath(),typeof b!="string"?n.fillStyle=ne.createGradient(n,r,{x:k-4,y:M,w:12,h:-12},b):n.fillStyle=b;const Z={id:p[y].id,name:p[y].name,value:T,dataId:p[y].dataId};this.drawSeriesColorShape(n,c.colorShape,{x:k,y:M}),n.fillStyle=typeof c.fontColor.label=="function"?c.fontColor.label(Z):c.fontColor.label??c.fontColor;const S=c.maxWidth-Math.round(n.measureText(s).width)-a.l-a.r-h-fs,x=k+h,I=M;if(S>n.measureText(w).width)n.fillText(w,x,I);else if(c.textOverflow==="wrap"){let L="",V=I;for(let R=0;R<w.length;R++){const E=w[R],G=`${L}${E}`;n.measureText(G).width>S?(n.fillText(L,x,V),L=E,m+=1,V+=d):L=G}n.fillText(L,x,V)}else{const L=A.truncateLabelWithEllipsis(w,S,n);n.fillText(L,x,I)}n.save(),n.fillStyle=typeof c.fontColor.value=="function"?c.fontColor.value(Z):c.fontColor.value??c.fontColor,n.textAlign="right",n.fillText(T,g-a.r,M),n.restore(),n.closePath(),f+=Uo,m+=1}n.restore()},drawToolTipForHeatMap(e,t){const n=t,i=e.items,s=e.hitId,l=i[s].data,a=i[s].axis,r=i[s].color,c=this.getBoxPadding(),d=this.options.horizontal,h=this.options.tooltip,u=Object.values(this.seriesList)[0],f=this.getTextHeight(),p=this.getColorMargin();let g=!1,m=l.formatted;const{colorState:y,isGradient:C}=u;if(C){const{min:M,max:Z}=u.valueOpt,S=Je(l.o-M,Z-M),{start:x,end:I}=y[0];g=x<=S&&S<=I||l.o===-1}else{const M=y.find(({id:Z})=>Z===l.cId);g=M==null?void 0:M.show,m=(M==null?void 0:M.label)??m}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);const b=this.tooltipDOM.offsetWidth;n.save(),n.scale(this.pixelRatio,this.pixelRatio),this.tooltipBodyDOM.style.overflowY==="auto"&&(c.r+=gi);const w=c.l+2,T=c.t+f+2;n.font=this.getFontStyle("contents"),n.beginPath(),typeof r!="string"?n.fillStyle=ne.createGradient(n,d,{x:w,y:T,w:12,h:-12},r):n.fillStyle=r;const k={id:e.hitId,name:l.y,value:m,dataId:i[s].id};this.drawSeriesColorShape(n,h.colorShape,{x:w,y:T}),n.fillStyle=typeof h.fontColor.label=="function"?h.fontColor.label(k):h.fontColor.label??h.fontColor,this.axesY.length&&n.fillText(this.axesY[a.y].getLabelFormat(l.y),w+p,T),n.textAlign="right",n.fillStyle=typeof h.fontColor.value=="function"?h.fontColor.value(k):h.fontColor.value??h.fontColor,n.fillText(m,b-c.r,T),n.closePath()},drawTooltipForScatter(e,t){const n=t,i=e.items,[,s]=e.maxTip,l=this.alignSeriesList(Object.keys(i)),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,u=2;h+=A.aliasPixel(h),u+=A.aliasPixel(u),n.save(),n.scale(this.pixelRatio,this.pixelRatio),this.tooltipBodyDOM.style.overflowY==="auto"&&(a.r+=gi),h+=a.l,u+=a.t,n.font=this.getFontStyle("contents");const f=[];l.forEach(m=>{f.push({data:i[m].data,color:i[m].color,name:i[m].name})}),r.sortByValue&&f.sort((m,y)=>{let C=m.data.o,b=y.data.o;return C==null&&(C=m.data.y),b==null&&(b=y.data.y),b-C}),this.setTooltipDOMStyle(r);const p=this.tooltipDOM.offsetWidth;let g=1;for(let m=0;m<f.length;m++){const y=f[m].data,C=f[m].color,b=f[m].name,w=y.formatted;let T=h+4,k=u+g*c;T+=A.aliasPixel(T),k+=A.aliasPixel(k),n.beginPath(),typeof C!="string"?n.fillStyle=ne.createGradient(n,!1,{x:T-4,y:k,w:12,h:-12},C):n.fillStyle=C;const M={id:e.hitId,name:f[m].name,value:w,dataId:f[m].dataId};this.drawSeriesColorShape(n,r.colorShape,{x:T,y:k}),n.fillStyle=typeof r.fontColor.label=="function"?r.fontColor.label(M):r.fontColor.label??r.fontColor;const Z=r.maxWidth-Math.round(n.measureText(s).width)-a.l-a.r-d-fs,S=T+d,x=k;if(Z>n.measureText(b).width)n.fillText(b,S,x);else if(r.textOverflow==="wrap"){let I="",L=x;for(let V=0;V<b.length;V++){const R=b[V],E=`${I}${R}`;n.measureText(E).width>Z?(n.fillText(I,S,L),I=R,g+=1,L+=c):I=E}n.fillText(I,S,L)}else{const I=A.truncateLabelWithEllipsis(b,Z,n);n.fillText(I,S,x)}n.save(),n.textAlign="right",n.fillStyle=typeof r.fontColor.value=="function"?r.fontColor.value(M):r.fontColor.value??r.fontColor,n.fillText(w,p-a.r,k),n.restore(),n.closePath(),u+=Uo,g+=1}n.restore()},setCustomTooltipLayoutPosition(e,t){var w,T;const n=t.pageX,i=t.pageY,s=(w=this.tooltipDOM.getElementsByClassName("ev-chart-tooltip-custom"))==null?void 0:w[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=(T=this.tooltipDOM)==null?void 0:T.getBoundingClientRect(),h=20,u=r-l-h,f=c-(d==null?void 0:d.height)-h,p=n+h,g=i+h,m=n-l-h,y=i-(d==null?void 0:d.height)-h,C=p>u?m:p,b=g>f?y:g;this.tooltipDOM.style.transform=`translate3d(${C}px, ${b}px, 0)`},drawCustomTooltip(e){var l,a,r,c,d;const t=(l=this.options)==null?void 0:l.tooltip;if(!((a=t==null?void 0:t.formatter)!=null&&a.html))return;const n=Object.keys(e).length;if((r=this._shouldVirtualizeCustomTooltip)!=null&&r.call(this,n)&&this.drawCustomTooltipVirtual(e))return;(c=this._teardownCustomTooltipVirtualScroll)==null||c.call(this),this.tooltipDOM.innerHTML="";const i=[];Object.keys(e).forEach(h=>{i.push({sId:h,data:e[h].data,color:e[h].color,name:e[h].name,dataId:e[h].id,index:e[h].index})});const s=A.htmlToElement(t.formatter.html(i));s&&this.tooltipDOM.appendChild(s),this.tooltipDOM.style.overflowY="hidden",this.tooltipDOM.style.backgroundColor=t.backgroundColor,this.tooltipDOM.style.border=`1px solid ${t.borderColor}`,this.tooltipDOM.style.color=((d=t.fontColor)==null?void 0:d.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 i=this.seriesList[n];i.itemHighlight(e.items[n],t,e.items[n].index,(s=this.options)==null?void 0:s.unSelectedOpacity),A.isDoughnutHole(i.type)&&this.drawDoughnutHole(t)})},drawIndicator(e,t){var d;const n=this.overlayCtx,[i,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;i>=l.x1-a&&i<=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(i+.5,l.y1),n.lineTo(i+.5,l.y2)),n.stroke(),n.restore(),n.closePath())},getTimeLabel(e){var u,f,p,g;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=+((u=this.data.labels)==null?void 0:u[0]),i=+((f=this.data.labels)==null?void 0:f[this.data.labels.length-1]);if(n==null||i==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?(p=t.axesY)==null?void 0:p.every(m=>m.categoryMode):(g=t.axesX)==null?void 0:g.every(m=>m.categoryMode)){const m=this.data.labels.length;if(!m)return null;let y;if(t.horizontal){const b=a.y2-a.y1;y=(l-a.y1)/b}else{const b=a.x2-a.x1;y=(s-a.x1)/b}const C=Math.min(Math.max(Math.floor(y*m),0),m-1);return+this.data.labels[C]}if(t.horizontal){const m=a.y2-a.y1,C=(l-a.y1)*(i-n)/m+n;return Math.round(C)}const c=a.x2-a.x1,h=(s-a.x1)*(i-n)/c+n;return Math.round(h)},drawSyncedIndicator({horizontal:e,label:t,mousePosition:n,dataLabel:i}){var g,m;if(!this._canDrawSyncedIndicator(e,n))return;if(i){this.drawSyncedIndicatorForTooltip({dataLabel:i,mousePosition:n});return}const s=+((g=this.data.labels)==null?void 0:g[0]),l=+((m=this.data.labels)==null?void 0:m[this.data.labels.length-1]),[a,r]=n,{top:c,bottom:d,left:h,right:u}=this.getChartDOMClientRect();if(St(a,h,u)&&St(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 C=(p.y2-p.y1)*(t-s)/(l-s)+p.y1;this.drawIndicator([p.x2,C],this.options.indicator.color)}else{const C=(p.x2-p.x1)*(t-s)/(l-s)+p.x1;this.drawIndicator([C,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,i;return this.options.syncHover===!1||!((i=(n=this.data)==null?void 0:n.labels)!=null&&i.length)?!1:e?this.options.axesY.every(({type:s})=>s==="time"):this.options.axesX.every(({type:s})=>s==="time")},_hasValidTimeRange(){var n,i;const e=+((n=this.data.labels)==null?void 0:n[0]),t=+((i=this.data.labels)==null?void 0:i[this.data.labels.length-1]);return e!=null&&t!=null},drawSyncedIndicatorForTooltip({dataLabel:e,mousePosition:t}){var u,f,p,g,m,y,C,b,w,T,k,M,Z;if(!((u=this.data)!=null&&u.labels)||!e)return;const n=this.data.labels.findIndex(S=>(S==null?void 0:S.valueOf())===(e==null?void 0:e.valueOf()));if(n===-1){this.overlayClear();return}const{horizontal:i}=this.options,s=this.getChartDOMClientRect(),[l,a]=t;if(St(l,s.left,s.right)&&St(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(i){const S=c.y2-c.y1,x=(f=this.options.axesY)==null?void 0:f.some(V=>V.categoryMode),I=(p=this.options.axesY)==null?void 0:p.some(V=>V.type==="time");let L;if(x)L=c.y1+S*(n+.5)/d;else if(I){const V=(m=(g=this.axesSteps)==null?void 0:g.y)==null?void 0:m[0],R=(V==null?void 0:V.graphMin)??+((y=this.data.labels)==null?void 0:y[0]),E=(V==null?void 0:V.graphMax)??+((C=this.data.labels)==null?void 0:C[this.data.labels.length-1]);L=c.y1+S*(+e-R)/(E-R)}else L=c.y1+S*n/(d-1);h=[c.x2,L]}else{const S=c.x2-c.x1,x=(b=this.options.axesX)==null?void 0:b.some(V=>V.categoryMode),I=(w=this.options.axesX)==null?void 0:w.some(V=>V.type==="time");let L;if(x)L=c.x1+S*(n+.5)/d;else if(I){const V=(k=(T=this.axesSteps)==null?void 0:T.x)==null?void 0:k[0],R=(V==null?void 0:V.graphMin)??+((M=this.data.labels)==null?void 0:M[0]),E=(V==null?void 0:V.graphMax)??+((Z=this.data.labels)==null?void 0:Z[this.data.labels.length-1]);L=c.x1+S*(+e-R)/(E-R)}else L=c.x1+S*n/(d-1);h=[L,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,i=[];return t.forEach(s=>{s.slice().reverse().forEach(l=>{const a=n[l];a&&a.showLegend&&e.includes(l)&&i.push(l)})}),Object.keys(n).forEach(s=>{const l=n[s];!l.isExistGrp&&l.showLegend&&e.includes(s)&&i.push(s)}),i},tooltipDestroy(){var e;(e=this._teardownCustomTooltipVirtualScroll)==null||e.call(this),this.tooltipDOM&&(this.tooltipDOM.remove(),this.tooltipDOM=null),this.isInitTooltip=!1}},SC=480,CC=28,kC=5,wC=50,IC={_shouldVirtualizeCustomTooltip(e){var i,s;if(this._vsDetectFailed)return!1;const t=(i=this.options)==null?void 0:i.tooltip;if(!((s=t==null?void 0:t.formatter)!=null&&s.html))return!1;const n=t.virtualScroll;return!n||n.use===!1?!1:n.use===!0?e>0:e>=(n.threshold??wC)},_findCustomTooltipContainer(e,t){if(!e||!e.querySelectorAll)return null;const n=e.querySelectorAll("[data-evui-tooltip-row]");if(n.length===t&&n.length>0){const s=n[0].parentElement;let l=!!s;for(let a=1;a<n.length;a++)if(n[a].parentElement!==s){l=!1;break}if(l)return s}const i=[e];for(;i.length;){const s=i.shift();if(s.children&&s.children.length===t)return s;if(s.children)for(let l=0;l<s.children.length;l++)i.push(s.children[l])}return null},_createVirtualScrollAnatomy(){const e=document.createElement("div");e.className="ev-chart-tooltip-virtual__spacer",e.setAttribute("aria-hidden","true");const t=document.createElement("div");t.className="ev-chart-tooltip-virtual__viewport";const n=document.createElement("div");return n.className="ev-chart-tooltip-virtual__spacer",n.setAttribute("aria-hidden","true"),{topSpacer:e,viewport:t,bottomSpacer:n}},_recomputeCustomTooltipPrefixSums(){const e=this.vsState,t=e.heights.length;e.prefixSums.length!==t+1&&(e.prefixSums=new Array(t+1));let n=0;e.prefixSums[0]=0;for(let i=0;i<t;i++)n+=e.heights[i],e.prefixSums[i+1]=n;e.totalHeight=n},_computeCustomTooltipVisibleRange(){const e=this.vsState,t=e.heights.length;if(!t)return{start:0,end:-1};const n=e.scrollEl.clientHeight||e.maxHeight,i=e.scrollEl.scrollTop;let s=0,l=t;for(;s<l;){const d=s+l>>>1;e.prefixSums[d+1]>i?l=d:s=d+1}const a=Math.max(0,s-e.overscan),r=i+n;for(s=a,l=t;s<l;){const d=s+l>>>1;e.prefixSums[d]>=r?l=d:s=d+1}const c=Math.min(t-1,s+e.overscan);return{start:a,end:c}},_syncCustomTooltipSpacers(){const e=this.vsState,t=e.prefixSums[e.range.start]||0,n=Math.max(0,e.totalHeight-(e.prefixSums[e.range.end+1]||e.totalHeight)),i=`${t}px`,s=`${n}px`;e.topSpacer.style.height!==i&&(e.topSpacer.style.height=i),e.bottomSpacer.style.height!==s&&(e.bottomSpacer.style.height=s)},_renderVisibleCustomTooltipRows(){const e=this.vsState;if(!e||!e.items.length)return;const t=this._computeCustomTooltipVisibleRange();if(e.range.start===t.start&&e.range.end===t.end)e.range=t;else{for(;e.viewport.firstChild;)e.viewport.removeChild(e.viewport.firstChild);const s=document.createDocumentFragment();for(let l=t.start;l<=t.end;l++){const a=e.items[l];a&&s.appendChild(a)}e.viewport.appendChild(s),e.range=t}this._syncCustomTooltipSpacers();let i=!1;for(let s=t.start;s<=t.end;s++)if(!e.measured[s]){i=!0;break}if(i){const s=e.measureDepth||0;if(s<2){e.measureDepth=s+1;try{this._measureVisibleCustomTooltipRows()}finally{e.measureDepth=s}}}},_measureVisibleCustomTooltipRows(){const e=this.vsState;if(!e||!e.viewport)return;const t=e.viewport.children,n=t.length;if(!n)return;const i=e.range.start,s=e.prefixSums[i]||0;let l=!1,a=0,r=0;for(let c=0;c<n;c++){const d=e.range.start+c,h=t[c].offsetHeight;h>0&&(h!==e.heights[d]&&(e.heights[d]=h,l=!0),e.measured[d]=!0),e.isRow[d]&&h>0&&(a+=h,r+=1)}if(r>0){const c=a/r;if(e.learnedAverageHeight=c,c>0&&Math.abs(c-e.estimatedRowHeight)>.5){e.estimatedRowHeight=c;for(let d=0;d<e.heights.length;d++)e.isRow[d]&&!e.measured[d]&&e.heights[d]!==c&&(e.heights[d]=c,l=!0)}}if(l){this._recomputeCustomTooltipPrefixSums();const d=(e.prefixSums[i]||0)-s;d!==0&&(e.suppressScroll=!0,e.scrollEl.scrollTop+=d,requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.vsState&&(this.vsState.suppressScroll=!1)})})),this._renderVisibleCustomTooltipRows()}else this._syncCustomTooltipSpacers()},drawCustomTooltipVirtual(e){var b,w,T;const t=(b=this.options)==null?void 0:b.tooltip;if(!((w=t==null?void 0:t.formatter)!=null&&w.html))return!1;const n=[];Object.keys(e).forEach(k=>{n.push({sId:k,data:e[k].data,color:e[k].color,name:e[k].name,dataId:e[k].id,index:e[k].index})});let i;try{i=t.formatter.html(n)}catch(k){return console.warn("[evui] tooltip.formatter.html threw, falling back:",k),!1}const s=A.htmlToElement(i);if(!s||!s.children)return!1;const l=this._findCustomTooltipContainer(s,n.length);if(!l)return this._vsDetectFailed=!0,this._vsWarnedFallback||(this._vsWarnedFallback=!0,console.warn("[evui] tooltip.virtualScroll: formatter.html 반환 구조에서 row를 식별하지 못해 가상 스크롤을 건너뜁니다. 시리즈당 wrapper element에 `data-evui-tooltip-row` 속성을 추가하거나, row 컨테이너 직속 자식이 시리즈 수와 일치하도록 마크업을 정리하세요.")),!1;const a=Array.from(l.children);if(!a.length)return!1;const r=k=>!!(k.hasAttribute&&k.hasAttribute("data-evui-tooltip-row")),c=a.some(r),d=a.map(k=>c?r(k):!0);for(let k=0;k<a.length;k++){const M=a[k];M.parentNode&&M.parentNode.removeChild(M)}for(;l.firstChild;)l.removeChild(l.firstChild);const{topSpacer:h,viewport:u,bottomSpacer:f}=this._createVirtualScrollAnatomy();l.appendChild(h),l.appendChild(u),l.appendChild(f);const p=t.maxHeight||SC;l.style.maxHeight=`${p}px`,l.style.overflowY="auto",l.style.overflowX="hidden",l.style.overflowAnchor="none",this._teardownCustomTooltipVirtualScroll();const g=t.virtualScroll||{},m=this._vsLearnedAverageHeight,y=m??g.estimatedRowHeight??CC;this.vsState={scrollEl:l,topSpacer:h,viewport:u,bottomSpacer:f,items:a,isRow:d,heights:new Array(a.length).fill(y),measured:new Array(a.length).fill(!1),prefixSums:[],totalHeight:0,range:{start:0,end:-1},estimatedRowHeight:y,overscan:g.overscan??kC,maxHeight:p,rafPending:!1,suppressScroll:!1,learnedAverageHeight:m,resizeObserver:null,onScroll:null},this._recomputeCustomTooltipPrefixSums();const C=()=>{this.vsState&&(this.vsState.suppressScroll||this.vsState.rafPending||(this.vsState.rafPending=!0,requestAnimationFrame(()=>{this.vsState&&(this.vsState.rafPending=!1,this._renderVisibleCustomTooltipRows())})))};if(l.addEventListener("scroll",C,{passive:!0}),this.vsState.onScroll=C,typeof ResizeObserver<"u"){let k=l.clientWidth;const M=new ResizeObserver(()=>{if(!this.vsState)return;const Z=l.clientWidth;Z!==k&&(k=Z,this.vsState.measured.fill(!1),this.vsState.heights.fill(this.vsState.estimatedRowHeight),this._recomputeCustomTooltipPrefixSums(),this._renderVisibleCustomTooltipRows())});M.observe(l),this.vsState.resizeObserver=M}for(;this.tooltipDOM.firstChild;)this.tooltipDOM.removeChild(this.tooltipDOM.firstChild);return this.tooltipDOM.appendChild(s),this.tooltipDOM.style.overflowY="hidden",this.tooltipDOM.style.backgroundColor=t.backgroundColor,this.tooltipDOM.style.border=`1px solid ${t.borderColor}`,this.tooltipDOM.style.color=((T=t.fontColor)==null?void 0:T.title)??t.fontColor,this._renderVisibleCustomTooltipRows(),!0},_teardownCustomTooltipVirtualScroll(){const e=this.vsState;e&&(e.scrollEl&&e.onScroll&&e.scrollEl.removeEventListener("scroll",e.onScroll),e.resizeObserver&&e.resizeObserver.disconnect(),e.learnedAverageHeight&&(this._vsLearnedAverageHeight=e.learnedAverageHeight),this.vsState=null)}},LC={pieDataSet:[],drawPie(e,t=this.bufferCtx){var T;const n=this.chartRect,i=this.pieDataSet,s=this.options,l=this.options.padding,a=!!s.doughnutHoleSize;let r,c,d,h=1.5*Math.PI,u,f,p;const g=n.width/2,m=n.height/2,y=g-(l.left+l.right),C=m-(l.bottom+l.top);if(typeof y=="number"&&y<0||typeof C=="number"&&C<0)return;const b=Math.min(y,C)*s.doughnutHoleSize,w=Math.min(y,C);for(let k=0;k<i.length;k++){const M=i[k];if(!M)return;let Z=w-(w-b)/i.length*k;if((T=s==null?void 0:s.pieStroke)!=null&&T.use&&(Z-=s.pieStroke.lineWidth),Z<0)return;if(M.or=Z,k<i.length-1?M.ir=w-(w-b)/i.length*(k+1):M.ir=1,M.total){for(let S=0;S<M.data.length;S++)if(r=M.data[S],c=r.value,p=c/M.total*100,d=2*Math.PI*(c/M.total),u=h+d,r.sa=h,r.ea=u,f=this.seriesList[r.id],c){const x={...s.pieStroke};M.data.length===1&&s.pieStroke.use&&(x.use=!1,t.lineWidth=s.pieStroke.lineWidth,t.strokeStyle=s.pieStroke.color,t.arc(g,m,Z,0,2*Math.PI),t.stroke());const{selectInfo:I,legendHitInfo:L,unSelectedOpacity:V}=e;f.isSelect=(I==null?void 0:I.sId)===r.id,f.isDownplay=L&&L.sId!==r.id,f.type=a?"doughnut":"pie",f.centerX=g,f.centerY=m,f.radius=Z,f.doughnutHoleSize=Z*(s.doughnutHoleSize??0),f.startAngle=h,f.endAngle=u,f.data={o:c,percentage:p},f.draw(t,x,V),h+=d}}}},drawSunburst(e,t=this.bufferCtx){var m;const{width:n,height:i}=this.chartRect,s=this.pieDataSet,l=this.options,a=this.options.padding;this.calculateAngle();let r,c;const d=n/2,h=i/2,u=d-(a.left+a.right),f=h-(a.bottom+a.top);if(typeof u=="number"&&u<0||typeof f=="number"&&f<0)return;const p=Math.min(u,f)*l.doughnutHoleSize,g=Math.min(u,f);for(let y=0;y<s.length;y++){const C=s[y];if(!C)return;let b=g-(g-p)/s.length*y;if((m=l==null?void 0:l.pieStroke)!=null&&m.use&&(b-=l.pieStroke.lineWidth),b<0)return;C.or=b,y<s.length-1?C.ir=g-(g-p)/s.length*(y+1):C.ir=1;for(let w=0;w<C.data.length;w++)if(r=C.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,b,r.sa,r.ea),t.stroke(),t.fill(),t.closePath(),t.restore();else if(c=this.seriesList[r.id],r.value){const T={...l.pieStroke};C.data.length===1&&l.pieStroke.use&&(T.use=!1,t.lineWidth=l.pieStroke.lineWidth,t.strokeStyle=l.pieStroke.color,t.arc(d,h,b,0,2*Math.PI),t.stroke());const{selectInfo:k,legendHitInfo:M,unSelectedOpacity:Z}=e;c.isSelect=(k==null?void 0:k.sId)===r.id,c.isDownplay=M&&M.sId!==r.id,c.type="sunburst",c.centerX=d,c.centerY=h,c.radius=b,c.doughnutHoleSize=b*(l.doughnutHoleSize??0),c.startAngle=r.sa,c.endAngle=r.ea,c.data={o:r.value},c.draw(t,T,Z)}}},drawDoughnutHole(e=this.bufferCtx){var h;const t=this.options,{width:n,height:i}=this.chartRect,s=this.options.padding,l=n/2,a=i/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}},TC={drawTips(e,t=this.bufferCtx){var u,f,p,g,m,y,C,b;const n=this.options;let i=null;const s=!!n.horizontal,l=n.maxTip,a=n.selectItem,r=n.selectLabel;let c,d;typeof((u=n.tooltip)==null?void 0:u.formatter)=="function"?i=(f=n.tooltip)==null?void 0:f.formatter:typeof((g=(p=n.tooltip)==null?void 0:p.formatter)==null?void 0:g.value)=="function"&&(i=(y=(m=n.tooltip)==null?void 0:m.formatter)==null?void 0:y.value),r.use&&r.showTip&&(d=n.type==="heatMap"?this.drawLabelTipForHeatMap(t):this.drawTipForSelectedLabel(t));const h=w=>{e.forEach(T=>{if(T){const k=this.seriesList[T==null?void 0:T.sId];if(!(k!=null&&k.show))return;const M=this.calculateTipInfo(k,"sel",T);if(M&&M.dp!==null){let Z=!1;if(l.use&&(c==null?void 0:c.dp)===M.dp&&(Z=!0),w.showTextTip||w.showTip){if(w.tipText==="label"){const S=s?n.axesY[0]:n.axesX[0],x=M.label;M.text=S.type==="time"?Ne(x).format(S.timeFormat):x}else M.text=Qt(M.value);this.drawTextTip({opt:w,tipType:"sel",seriesOpt:k,isSamePos:Z,ctx:t,...M})}w.showIndicator&&this.drawFixedIndicator({opt:w,seriesOpt:k,ctx:t,...M})}T&&(T!=null&&T.label)&&(T==null?void 0:T.label)===0&&(this.lastHitInfo=T)}})};if(e&&!d&&(a.use?h(a):r.use&&n.type==="line"&&h(r)),l.use&&!d){const w=s?this.axesSteps.y[0]:this.axesSteps.x[0],T=w==null?void 0:w.minIndex,k=w==null?void 0:w.maxIndex,M=(b=(C=s?this.axesY[0]:this.axesX[0])==null?void 0:C.labels)==null?void 0:b.length,Z=Number.isFinite(M)?M-1:k,S=Number.isFinite(T)&&Number.isFinite(k),x=S&&k<T,I=S&&(T>0||k<Z);let L,V=null;x?L=void 0:I?(V=this.getVisibleWindowMaxSeries(T,k),L=V==null?void 0:V.sId):L=this.minMax[s?"x":"y"][0].maxSID;const R=L?this.seriesList[L]:null;R&&(c=this.calculateTipInfo(R,"max",V),l.use&&c&&c.dp!==null&&(i?c.text=i({seriesId:R.sId,x:s?c.value:void 0,y:s?void 0:c.value}):c.text=Qt(c.value),this.drawTextTip({opt:l,tipType:"max",seriesOpt:R,ctx:t,...c}),l.showIndicator&&this.drawFixedIndicator({opt:l,seriesOpt:R,ctx:t,...c})))}},calculateTipInfo(e,t,n){if(!e)return!1;const i=!!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],u=this.axesSteps.y[e.yAxisIndex],f=r.x1,p=r.x2,g=r.y2,{type:m,size:y}=e,{maxDomain:C,maxDomainIndex:b}=e.minMax;if(C===null||b<0)return!1;const w=m==="bar"?n==null?void 0:n.index:n==null?void 0:n.domain,T=t==="max"&&n&&Number.isFinite(w)&&Number.isFinite(n.value);let k;T?k=w:k=m==="bar"?b:C,t==="sel"&&(n&&n.label!==null?(s.pos=m==="bar"?n.dataIndex:n.label,k=s.pos):s.pos!==null&&(k=s.pos));let M;T?M=n.value:M=i?e.minMax.maxX:e.minMax.maxY;let Z;if(t==="sel"){if(n&&n.label!==null)Z=n.label,n.value!==null?(M=n.useStack?n.acc:n.value,s.value=M):s.value!==null&&(M=s.value),s.label=Z;else if(s.value!==null)M=s.value,Z=s.label;else if(s.pos!==null){const E=m==="bar"?"getItemByLabelIndex":"getItemByLabel";if(typeof this[E]=="function"){const G=this[E](s.pos);M=G.useStack?G.acc:G.value,Z=G.label,s.value=M,s.label=Z}}}const S=i?h.graphMax:u.graphMax;if((t==="max"||t==="sel")&&M>S&&!this.options.displayOverflow)return!1;let x,I,L;if(m==="bar"){const E=i?this.scrollbar.y:this.scrollbar.x;if(E!=null&&E.use){const[G,v]=(E==null?void 0:E.range)??[];if(k>=G&&k<=v)k-=G??0;else return!1}else{const G=i?u:h,{minIndex:v,maxIndex:X}=G??{};if(Number.isFinite(v)&&Number.isFinite(X))if(k>=v&&k<=X)k-=v;else return!1}i?(I=Math.round(y.h/2),x=g-y.cat*k-y.cPad,L=x-(y.bar*y.ix-(y.h+y.bPad))-I):(I=Math.round(y.w/2),x=f+y.cat*k+y.cPad,L=x+(y.bar*y.ix-(y.w+y.bPad))+I)}else m==="line"?L=ne.calculateX(k,h.graphMin,h.graphMax,d-y.comboOffset,f+y.comboOffset/2):m==="scatter"&&(L=ne.calculateX(k,h.graphMin,h.graphMax,d,f));return{...{xArea:d,yArea:c,graphX:h,graphY:u,xsp:f,xep:p,ysp:g},...{dp:L,value:M,label:Z,type:m}}},drawFixedIndicator(e){const t=!!this.options.horizontal,n=e.ctx??this.bufferCtx,{graphX:i,graphY:s,xArea:l,yArea:a,xsp:r,ysp:c,dp:d,type:h,value:u,opt:f,seriesOpt:p}=e;let g=0;h==="line"?g+=3:h==="scatter"&&(g+=(p==null?void 0:p.pointSize)??0);let m;if(f.fixedPosTop)t?m=ne.calculateX(i.graphMax,i.graphMin,i.graphMax,l,r):(m=ne.calculateY(s.graphMax,s.graphMin,s.graphMax,a,c),m-=g);else if(t){const y=Math.min(Math.max(u,i.graphMin),i.graphMax);m=ne.calculateX(y,i.graphMin,i.graphMax,l,r)}else{const y=Math.min(Math.max(u,s.graphMin),s.graphMax);m=ne.calculateY(y,s.graphMin,s.graphMax,a,c),m-=g}d!==null&&(n.beginPath(),n.save(),n.strokeStyle=f.indicatorColor,n.lineWidth=2,t?(n.moveTo(r,d),n.lineTo(m,d)):(n.moveTo(d,c),n.lineTo(d,m)),n.stroke(),n.restore(),n.closePath())},drawTipForSelectedLabel(e=this.bufferCtx){var c,d;const t=this.options,n=!!t.horizontal,i=t.selectLabel,{dataIndex:s,data:l,label:a}=this.defaultSelectInfo;let r=!1;if(s.length){r=!0;const h=this.chartRect,u=this.labelOffset,f={x1:h.x1+u.left,x2:h.x2-u.right,y1:h.y1+u.top,y2:h.y2-u.bottom},p=n?this.axesY[0]:this.axesX[0],g=n?this.axesX[0]:this.axesY[0],m=n?this.axesSteps.x[0]:this.axesSteps.y[0],y=n?ne.calculateX:ne.calculateY,C=n?ne.calculateY:ne.calculateX,b=n?this.scrollbar.y:this.scrollbar.x,w=h.chartWidth-(u.left+u.right),T=h.chartHeight-(u.top+u.bottom),k=n?w:T,M=f[g.units.rectStart];let Z=this.options.type==="bar"?4:6;Z*=n?1:-1;const S=Object.keys(this.seriesList??{}),x=S.filter(Y=>this.seriesList[Y].show),I=S.some(Y=>this.seriesList[Y].isExistGrp&&!this.seriesList[Y].isOverlapping),L=((c=this.data.groups)==null?void 0:c[0])??[];let V,R,E,G,v,X,W,N,P,D=0,O=(d=p.labels)==null?void 0:d.length;if(p.labels){let Y=p.labels.length;if(b!=null&&b.use){const{range:H,interval:B,type:z}=b,[F,Q]=H??[];if(Re(F)&&Re(Q))Y=Math.floor((+Q-+F)/B)+1,D=z==="step"?F:p.labels.findIndex(U=>U===+F),O=z==="step"?Q:p.labels.findIndex(U=>U===+Q);else{const U=n?this.axesSteps.y[0]:this.axesSteps.x[0];Number.isFinite(U==null?void 0:U.minIndex)&&Number.isFinite(U==null?void 0:U.maxIndex)&&U.minIndex<U.maxIndex&&(D=U.minIndex,O=U.maxIndex,Y=O-D+1)}}G=f[p.units.rectStart],v=f[p.units.rectEnd],X=(v-G)/Y}else W=this.axesSteps.x[0],N=S.find(Y=>{var H;return((H=this.seriesList[Y])==null?void 0:H.type)==="line"}),P=this.seriesList[N].size;l.forEach((Y,H)=>{var B;if(E=m.graphMax,!i.fixedPosTop){if(I){const z=x==null?void 0:x.reduce((U,ee)=>{var j,te;return L.includes(ee)&&(((j=Y[ee])==null?void 0:j.value)??Y[ee])>0?U+(((te=Y[ee])==null?void 0:te.value)??Y[ee]):U},0),F=((B=x==null?void 0:x.filter(U=>!L.includes(U)))==null?void 0:B.map(U=>{var ee;return((ee=Y[U])==null?void 0:ee.value)??Y[U]}))??[],Q=(F==null?void 0:F.length)>0?F.reduce((U,ee)=>Math.max(U,ee??-1/0),-1/0):-1/0;E=z>0?Math.max(Q,z):Math.max(Q,0)}else if(x.length){const z=x.map(Q=>{var U;return((U=Y[Q])==null?void 0:U.value)??Y[Q]}),F=z.length>0?z.reduce((Q,U)=>Math.max(Q,U??-1/0),-1/0):-1/0;E=F>0||this.options.type!=="bar"?F:0}}if(p.labels){if(s[H]<D||s[H]>O)return;const z=s[H]-D;V=Math.round(G+X*z)+X/2}else V=C(a[H],W.graphMin,W.graphMax,w-P.comboOffset,f.x1+P.comboOffset/2);R=y(E,m.graphMin,m.graphMax,k,M)+Z,this.showTip({context:e,x:n?R:V,y:n?V:R,opt:i,isSamePos:!1})})}return r},drawLabelTipForHeatMap(e=this.bufferCtx){const t=this.options,n=!!t.horizontal,i=t.selectLabel,{dataIndex:s}=this.defaultSelectInfo;let l=!1;if(s){l=!0;const a=this.chartRect,r=this.labelOffset,c={x1:a.x1+r.left,x2:a.x2-r.right,y1:a.y1+r.top,y2:a.y2-r.bottom},d=n?this.axesY[0]:this.axesX[0],h=c[d.units.rectStart],f=(c[d.units.rectEnd]-h)/d.labels.length,p=n?this.axesX[0]:this.axesY[0],g=6*(n?1:-1),m=c[p.units.rectEnd]+g;s==null||s.forEach(y=>{const b=Math.round(h+f*y)+f/2;this.showTip({context:e,x:n?m:b,y:n?b:m,opt:i,isSamePos:!1})})}return l},drawTextTip(e){const t=!!this.options.horizontal,n=e.ctx??this.bufferCtx,{graphX:i,graphY:s,xArea:l,yArea:a,xsp:r,xep:c,ysp:d}=e,{dp:h,value:u,text:f,opt:p,type:g,tipType:m,isSamePos:y,seriesOpt:C}=e,b=4,w=4,{fontSize:T,fontFamily:k,fontWeight:M,height:Z}=p.tipStyle,S=`normal normal ${M} ${T}px ${k}`;let x=1;g==="line"?x+=6:g==="scatter"?x+=C==null?void 0:C.pointSize:g==="bar"&&(x+=4);let I,L=h;if(p.fixedPosTop)t?(I=ne.calculateX(i.graphMax,i.graphMin,i.graphMax,l,r),I+=x):(I=ne.calculateY(s.graphMax,s.graphMin,s.graphMax,a,d),I-=x);else if(t){const E=Math.min(Math.max(u,i.graphMin),i.graphMax);I=ne.calculateX(E,i.graphMin,i.graphMax,l,r),I=u<0?I-x:I+x}else{const E=g==="bar"&&u<0?0:u,G=Math.min(Math.max(E,s.graphMin),s.graphMax);I=ne.calculateY(G,s.graphMin,s.graphMax,a,d),I=E<0?I+x:I-x}let V="center";n.save(),n.font=S;const R=Math.round(Math.max(n.measureText(f).width+12,40));t||(h+R/2>c-10?(V="right",L-=R/2-b*2):h-R/2<r+10&&(V="left",L+=R/2-b*2)),n.restore(),(p.showTextTip||m==="max")&&this.showTextTip({context:n,type:V,width:R,height:Z,x:t?I+R/2:L,y:t?L+Z/2:I,opt:p,arrowSize:b,borderRadius:w,text:f,textStyle:S,isNegative:u<0}),p.showTip&&m==="sel"&&this.showTip({context:n,x:t?I:h,y:t?h:I,opt:p,isSamePos:y})},showTextTip(e){const t=!!this.options.horizontal,{type:n,width:i,height:s,x:l,y:a,arrowSize:r,borderRadius:c,text:d,opt:h,textStyle:u,isNegative:f}=e,p=e.context;let g=l-i/2,m=l+i/2;const y=a-s,C=a;f&&t&&(g=l-i/2-i,m=l-i/2),p.save(),p.font=u,p.fillStyle=h.tipBackground??h.tipStyle.background,p.shadowBlur=0,p.beginPath(),p.moveTo(g+c,y),p.quadraticCurveTo(g,y,g,y+c),p.lineTo(g,C-c),p.quadraticCurveTo(g,C,g+c,C),p.lineTo(m-c,C),p.quadraticCurveTo(m,C,m,C-c),p.lineTo(m,y+c),p.quadraticCurveTo(m,y,m-c,y),p.lineTo(g+c,y),p.closePath(),p.fill(),p.beginPath(),t?(f?(p.moveTo(m,C),p.lineTo(m,y+c+r/2),p.lineTo(m+r,C-s/2),p.lineTo(m,C-c-r/2)):(p.moveTo(g,y),p.lineTo(g,y+c+r/2),p.lineTo(g-r,C-s/2),p.lineTo(g,C-c-r/2)),p.closePath(),p.fill()):(f?n==="left"?(p.lineTo(g+c+r,C+r),p.lineTo(g+c+r*2,C)):n==="right"?(p.lineTo(m-r*2-c,C),p.lineTo(m-r-c,C+r)):(p.lineTo(l-r,C),p.lineTo(l,C+r),p.lineTo(l+r,C)):f||(n==="left"?(p.moveTo(g,y),p.lineTo(g+c+r,C+r),p.lineTo(g+c+r*2,C)):n==="right"?(p.moveTo(m,y),p.lineTo(m-r*2-c,C),p.lineTo(m-r-c,C+r)):(p.lineTo(l-r,C),p.lineTo(l,C+r),p.lineTo(l+r,C))),p.closePath(),p.fill()),p.restore(),p.save(),p.font=u,p.fillStyle=h.tipTextColor??h.tipStyle.textColor,p.textBaseline="middle",p.textAlign="center",p.fillText(`${d}`,g+i/2,y+s/2),p.restore()},showTip(e){const t=!!this.options.horizontal,{x:n,y:i,opt:s,isSamePos:l}=e,a=e.context,c=i-(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()}},MC={initBlitState(){var e;this._blitPrev=null,this._blitDiag=null,this.pointsLayerA=null,this.pointsLayerB=null,this.pointsLayerACtx=null,this.pointsLayerBCtx=null,this.curPointsLayer="A",this.pointsLayerValid=!1,this._blitCarry=0,this._framesSinceFullRedraw=0,this._pointsLayerStamp=null,this._pointsLayerOptionsRef=null,this._hitCoordsDirty=!1,(e=this.options.realTimeScatter)!=null&&e.use&&this.createPointsLayers()},createPointsLayers(){this.pointsLayerA||(this.pointsLayerA=document.createElement("canvas"),this.pointsLayerB=document.createElement("canvas"),this.pointsLayerACtx=this.pointsLayerA.getContext("2d"),this.pointsLayerBCtx=this.pointsLayerB.getContext("2d"),this.curPointsLayer="A",this.pointsLayerValid=!1)},getPointsLayers(){const e=this.curPointsLayer==="A";return{src:e?this.pointsLayerA:this.pointsLayerB,srcCtx:e?this.pointsLayerACtx:this.pointsLayerBCtx,dst:e?this.pointsLayerB:this.pointsLayerA,dstCtx:e?this.pointsLayerBCtx:this.pointsLayerACtx,dstName:e?"B":"A"}},pointsLayersSized(){return!this.pointsLayerA||!this.bufferCanvas?!1:this.pointsLayerA.width===this.bufferCanvas.width&&this.pointsLayerA.height===this.bufferCanvas.height&&this.pointsLayerA.width>1&&this.pointsLayerA.height>1},collectStripDuplicatePoints(e,t){var s,l,a;const n=((l=(s=this.seriesInfo)==null?void 0:s.charts)==null?void 0:l.scatter)??[],i=!!this.options.seriesReverse;for(let r=i?n.length-1:0;i?r>=0:r<n.length;i?r--:r++){const c=this.seriesList[n[r]];if(!(c!=null&&c.show))continue;const d=(a=c.data[c.sId])==null?void 0:a.dataGroup;if(d)for(let h=0;h<t.length;h++){const u=d[t[h]];if(u!=null&&u.data)for(let f=0;f<u.data.length;f++){const p=u.data[f];e.set(p.k??A.coordinateKey(p.x,p.y),c.sId)}}}},getBlitScatterSeriesList(){var n,i;const e=((i=(n=this.seriesInfo)==null?void 0:n.charts)==null?void 0:i.scatter)??[],t=[];for(let s=0;s<e.length;s++){const l=this.seriesList[e[s]];l!=null&&l.show&&t.push({sId:e[s],series:l,xi:l.xAxisIndex??0,yi:l.yAxisIndex??0})}return t},getBlitScatterSeries(){return this.getBlitScatterSeriesList()[0]??null},areBlitSeriesAligned(e){var n,i,s,l;if(!e||e.length<1)return!1;const t=(i=(n=this.dataSet)==null?void 0:n[e[0].sId])==null?void 0:i.lastTick;if(!t)return!1;for(let a=1;a<e.length;a++){const r=(l=(s=this.dataSet)==null?void 0:s[e[a].sId])==null?void 0:l.lastTick;if(!r||r.gapCount!==t.gapCount||r.toTime!==t.toTime||r.endIndex!==t.endIndex||r.length!==t.length)return!1}return!0},evaluateBlitGate(e){var m,y,C,b,w,T,k,M,Z,S,x,I,L,V,R;const t=this.options,n=this._blitPrev,i=this.isInit===!0&&((m=t.realTimeScatter)==null?void 0:m.use)===!0&&!t.brush&&this.updateSeries!==!0&&!e&&!((C=(y=this.scrollbar)==null?void 0:y.x)!=null&&C.use||(w=(b=this.scrollbar)==null?void 0:b.y)!=null&&w.use),s=this.getBlitScatterSeriesList(),l=this.areBlitSeriesAligned(s),a=!((T=t.selectItem)!=null&&T.use&&(((k=this.defaultSelectItemInfo)==null?void 0:k.dataIndex)!=null||((M=this.lastHitInfo)==null?void 0:M.dataIndex)!=null))&&!((Z=t.selectSeries)!=null&&Z.use&&this.defaultSelectInfo)&&!this.legendHover,r={modeOk:i,seriesAligned:l,selectionOk:a,scatterOnly:this.hasOnlyVisibleScatter(),hasPrev:!!n,optionsStable:!!n&&n.optionsRef===this.options,yFixed:!1,xWidthStable:!1,xAreaStable:!1,labelOffsetStable:!1,xMonotonic:!1,deviceStable:!1,gapOk:!1};let c=0,d=0,h=0;const u=s[0]??null,f=u?(x=(S=this.axesSteps)==null?void 0:S.x)==null?void 0:x[u.xi]:null,p=u?(L=(I=this.axesSteps)==null?void 0:I.y)==null?void 0:L[u.yi]:null;if(u&&f&&p&&this.chartRect&&this.labelOffset){const E=this.chartRect,G=E.chartWidth-(this.labelOffset.left+this.labelOffset.right);n&&(r.yFixed=p.graphMin===n.graphMinY&&p.graphMax===n.graphMaxY,r.xWidthStable=f.graphMax-f.graphMin===n.graphMaxX-n.graphMinX,r.xAreaStable=G===n.xArea,r.labelOffsetStable=this.labelOffset.left===n.labelOffsetLeft&&this.labelOffset.right===n.labelOffsetRight,c=f.graphMin-n.graphMinX,r.xMonotonic=Number.isFinite(c)&&c>0,r.deviceStable=this.pixelRatio===n.pixelRatio&&E.chartWidth===n.chartWidth&&E.chartHeight===n.chartHeight&&E.x1===n.x1&&E.y2===n.y2);const v=(R=(V=this.dataSet)==null?void 0:V[u.sId])==null?void 0:R.lastTick;v&&(d=v.gapCount??0,h=v.length??0,r.gapOk=d>0&&d<h)}return{ok:r.modeOk&&r.seriesAligned&&r.selectionOk&&r.scatterOnly&&r.hasPrev&&r.optionsStable&&r.yFixed&&r.xWidthStable&&r.xAreaStable&&r.labelOffsetStable&&r.xMonotonic&&r.deviceStable&&r.gapOk,parts:r,shiftMs:c,gapCount:d,length:h,scatterList:s}},hasOnlyVisibleScatter(){var n,i;const e=((n=this.seriesInfo)==null?void 0:n.charts)??{},t=Object.keys(e);for(let s=0;s<t.length;s++){if(t[s]==="scatter")continue;const l=e[t[s]];for(let a=0;a<l.length;a++)if((i=this.seriesList[l[a]])!=null&&i.show)return!1}return!0},snapshotBlitState(){var s,l,a,r,c;if(!((s=this.options.realTimeScatter)!=null&&s.use))return null;const e=this.getBlitScatterSeries();if(!e)return null;const t=(a=(l=this.axesSteps)==null?void 0:l.x)==null?void 0:a[e.xi],n=(c=(r=this.axesSteps)==null?void 0:r.y)==null?void 0:c[e.yi];if(!t||!n||!this.chartRect||!this.labelOffset)return null;const i=this.chartRect;return{sId:e.sId,graphMinX:t.graphMin,graphMaxX:t.graphMax,graphMinY:n.graphMin,graphMaxY:n.graphMax,xArea:i.chartWidth-(this.labelOffset.left+this.labelOffset.right),labelOffsetLeft:this.labelOffset.left,labelOffsetRight:this.labelOffset.right,pixelRatio:this.pixelRatio,chartWidth:i.chartWidth,chartHeight:i.chartHeight,x1:i.x1,y2:i.y2,optionsRef:this.options}},recordBlitDiag(e,t,n){var s;if(typeof window>"u"||!window.__EVUI_BLIT_DEBUG__)return;(s=this.options.realTimeScatter)!=null&&s.use&&(window.__EVUI_BLIT_CHART__=this),this._blitDiag||(this._blitDiag={ticks:0,eligible:0,blitted:0,fail:{},rate:0,lastShiftMs:0,lastGap:0});const i=this._blitDiag;if(i.ticks++,i.lastShiftMs=e.shiftMs,i.lastGap=e.gapCount,e.ok)i.eligible++;else{const l=Object.keys(e.parts);for(let a=0;a<l.length;a++)e.parts[l[a]]||(i.fail[l[a]]=(i.fail[l[a]]||0)+1)}if(e.ok&&!t&&n){const l=Object.keys(n);for(let a=0;a<l.length;a++)n[l[a]]&&(i.fail[l[a]]=(i.fail[l[a]]||0)+1)}t&&i.blitted++,i.rate=i.blitted/i.ticks,window.__EVUI_BLIT_DIAG__=i},drawChartBlitFastPath(e,t){var Y,H,B,z;const n=t.scatterList??this.getBlitScatterSeriesList(),i=n[0]??null,s=(H=(Y=this.dataSet)==null?void 0:Y[i==null?void 0:i.sId])==null?void 0:H.lastTick;if(!i||!s)return!1;const l=this.pixelRatio,a=this.chartRect,r=this.labelOffset,c=this.axesSteps.x[i.xi],d=a.chartWidth-(r.left+r.right),h=c.graphMax-c.graphMin;if(!(h>0)||!(d>0))return!1;const p=d/h*t.shiftMs*l+this._blitCarry,g=Math.floor(p);if(g<1)return!1;let m=s.maxDirtyAge,y=typeof i.series.pointSize=="number"?i.series.pointSize:i.series.pointSize.value;for(let F=1;F<n.length;F++){const Q=(z=(B=this.dataSet)==null?void 0:B[n[F].sId])==null?void 0:z.lastTick;Q&&Q.maxDirtyAge>m&&(m=Q.maxDirtyAge);const U=n[F].series.pointSize,ee=typeof U=="number"?U:U.value;ee>y&&(y=ee)}if(m>s.gapCount+1)return!1;const C=this.bufferCanvas.width,b=this.bufferCanvas.height;if(g>=C)return!1;this._blitCarry=p-g;const{src:w,dst:T,dstCtx:k,dstName:M}=this.getPointsLayers();k.setTransform(1,0,0,1,0,0),k.clearRect(0,0,C,b),k.drawImage(w,g,0,C-g,b,0,0,C-g,b);const Z=Math.ceil(y*l)+1,S=(a.x1+r.left+d)*l,x=d/h*1e3*l,{gapCount:I,endIndex:L,length:V}=s,R=Z+Math.ceil(4*l),E=Math.max(2,Math.ceil((R+Z+2)/Math.max(1e-6,x))),G=Math.min(V,I+E),v=S-G*x,X=Math.max(0,Math.floor(v+R));k.clearRect(X,0,C-X,b);const W=new Array(G);for(let F=0;F<G;F++){let Q=(L-F)%V;Q<0&&(Q+=V),W[F]=Q}const N=this.options.coordinateDedupe!==!1&&n.length>1,P=N?new Map:null;N&&this.collectStripDuplicatePoints(P,W);const D={chartRect:a,labelOffset:r,axesSteps:this.axesSteps,displayOverflow:this.options.displayOverflow,selectInfo:null,legendHitInfo:null,unSelectedOpacity:this.options.unSelectedOpacity,duple:P,coordinateDedupe:N};k.save(),k.beginPath(),k.rect(X,0,C-X,b),k.clip(),k.setTransform(l,0,0,l,0,0);const O=!!this.options.seriesReverse;for(let F=0;F<n.length;F++)(O?n[n.length-1-F]:n[F]).series.realTimeScatterDrawStrip(k,W,D);k.restore(),k.setTransform(1,0,0,1,0,0),this.curPointsLayer=M;for(let F=0;F<n.length;F++)n[F].series.refreshRtTotalCount();return this.drawStaticLayer(this.bufferCtx,e),this.compositePointsLayer(T,y),!0},compositePointsLayer(e,t){const n=this.pixelRatio,i=this.chartRect,s=this.labelOffset,l=i.chartWidth-(s.left+s.right),a=i.chartHeight-(s.top+s.bottom),r=i.x1+s.left,c=i.y2-s.bottom,d=c-a,h=r+l,u=(r-t)*n,f=(d-t)*n,p=(h+t)*n,g=(c+t)*n;this.bufferCtx.save(),this.bufferCtx.setTransform(1,0,0,1,0,0),this.bufferCtx.beginPath(),this.bufferCtx.rect(u,f,p-u,g-f),this.bufferCtx.clip(),this.bufferCtx.drawImage(e,0,0),this.bufferCtx.restore()},computePointsLayerStamp(){var s,l,a,r,c,d,h;if(!((s=this.options.realTimeScatter)!=null&&s.use))return null;const e=this.getBlitScatterSeriesList();if(!e.length||!this.chartRect||!this.labelOffset||!this.axesSteps)return null;const t=this.chartRect,n=this.labelOffset,i=[this.pixelRatio,(l=this.bufferCanvas)==null?void 0:l.width,(a=this.bufferCanvas)==null?void 0:a.height,t.chartWidth,t.chartHeight,t.x1,t.y2,n.left,n.right,n.top,n.bottom];for(let u=0;u<e.length;u++){const{sId:f,xi:p,yi:g}=e[u],m=(c=(r=this.dataSet)==null?void 0:r[f])==null?void 0:c.lastTick,y=(d=this.axesSteps.x)==null?void 0:d[p],C=(h=this.axesSteps.y)==null?void 0:h[g];if(!y||!C)return null;i.push(f,m?`${m.seq}/${m.toTime}/${m.endIndex}/${m.length}`:"nt",y.graphMin,y.graphMax,C.graphMin,C.graphMax)}return i.join("|")},maybeRebuildPointsLayer(e=!1){var n;if(!((n=this.options.realTimeScatter)!=null&&n.use))return!1;const t=this.computePointsLayerStamp();return!e&&t&&this.pointsLayerValid&&this._pointsLayerStamp===t&&this._pointsLayerOptionsRef===this.options?!1:(this.rebuildPointsLayer(),this._pointsLayerStamp=this.pointsLayerValid?t:null,this._pointsLayerOptionsRef=this.pointsLayerValid?this.options:null,this.pointsLayerValid)},canRouteFallbackViaLayer(e){var n,i,s,l,a;const t=this.options;return!((n=t.realTimeScatter)!=null&&n.use)||e||(i=t.selectItem)!=null&&i.use&&(((s=this.defaultSelectItemInfo)==null?void 0:s.dataIndex)!=null||((l=this.lastHitInfo)==null?void 0:l.dataIndex)!=null)||(a=t.selectSeries)!=null&&a.use&&this.defaultSelectInfo||!this.pointsLayersSized()||!this.hasOnlyVisibleScatter()?!1:this.getBlitScatterSeriesList().length>0},ensureHitCoordsFresh(){var n,i,s;if(!this._hitCoordsDirty||!((n=this.options.realTimeScatter)!=null&&n.use)||!this.chartRect||!this.labelOffset||!this.axesSteps)return;const e=this.getBlitScatterSeriesList(),t={chartRect:this.chartRect,labelOffset:this.labelOffset,axesSteps:this.axesSteps,displayOverflow:this.options.displayOverflow};for(let l=0;l<e.length;l++)(s=(i=e[l].series).refreshRtHitCoords)==null||s.call(i,t);this._hitCoordsDirty=!1},getMaxVisibleScatterPointSize(){const e=this.getBlitScatterSeriesList();let t=0;for(let n=0;n<e.length;n++){const i=e[n].series.pointSize,s=typeof i=="number"?i:(i==null?void 0:i.value)??0;s>t&&(t=s)}return t},rebuildPointsLayer(){var h,u,f;if(!((h=this.options.realTimeScatter)!=null&&h.use)||!this.pointsLayersSized()){this.pointsLayerValid=!1;return}const e=this.getBlitScatterSeriesList();if(!e.length){this.pointsLayerValid=!1;return}const t=this.pixelRatio,n=this.curPointsLayer==="A",i=n?this.pointsLayerA:this.pointsLayerB,s=n?this.pointsLayerACtx:this.pointsLayerBCtx;s.setTransform(1,0,0,1,0,0),s.clearRect(0,0,i.width,i.height),s.setTransform(t,0,0,t,0,0);const l=((f=(u=this.seriesInfo)==null?void 0:u.charts)==null?void 0:f.scatter)??[],a=this.options.coordinateDedupe!==!1&&!this.canSkipRealtimeScatterDedupe(l),r=new Map;a&&this.collectDuplicatePoints(r,l);const c={ctx:s,chartRect:this.chartRect,labelOffset:this.labelOffset,axesSteps:this.axesSteps,displayOverflow:this.options.displayOverflow,duple:r,coordinateDedupe:a,selectInfo:null,legendHitInfo:null,unSelectedOpacity:this.options.unSelectedOpacity},d=!!this.options.seriesReverse;for(let p=0;p<e.length;p++){const g=d?e[e.length-1-p]:e[p];g.series.computeGeometry(c),g.series.realTimeScatterDraw(c)}s.setTransform(1,0,0,1,0,0),this.pointsLayerValid=!0}},RC={selectedSeriesAllLineSafe(){var t;const e=((t=this.defaultSelectInfo)==null?void 0:t.seriesId)??[];for(let n=0;n<e.length;n++){const i=this.seriesList[e[n]];if(!i||i.type!=="line"||i.fill||i.isExistGrp)return!1}return!0},shouldDrawSelectedOnTop(e){var n,i,s,l;const t=this.options;return!((n=t.selectSeries)!=null&&n.use)||t.brush||(i=t.realTimeScatter)!=null&&i.use||t.workerRender||e!=null&&e.legend||this.legendHover||!((l=(s=this.defaultSelectInfo)==null?void 0:s.seriesId)!=null&&l.length)?!1:this.selectedSeriesAllLineSafe()},drawSelectedSeriesOnly(){var d;const{maxTip:e,selectLabel:t,selectItem:n,selectSeries:i,brush:s,displayOverflow:l,unSelectedOpacity:a}=this.options,r={ctx:this.bufferCtx,chartRect:this.chartRect,labelOffset:this.labelOffset,axesSteps:this.axesSteps,maxTipOpt:{background:e.background,color:e.color},selectLabel:{option:t,selected:this.defaultSelectInfo},selectSeries:{option:i,selected:this.defaultSelectInfo},selectItem:{option:n,selected:this.defaultSelectItemInfo},isBrush:!!s,displayOverflow:l,unSelectedOpacity:a,isHorizontal:this.options.horizontal,dataEpoch:this._dataEpoch,scaleVersion:this._scaleVersion},c=((d=this.defaultSelectInfo)==null?void 0:d.seriesId)??[];for(let h=0;h<c.length;h++){const u=this.seriesList[c[h]];u&&u.show&&u.draw({...r})}}},_r=2,vC=["type","horizontal","sunburst","coordinateDedupe","unSelectedOpacity","displayOverflow","thickness","cPadRatio","borderRadius","seriesReverse","maxTip","padding","heatMapColor"],VC=["sId","type","name","show","color","fill","fillColor","fillOpacity","pointFill","point","lineWidth","thickness","pointSize","pointStyle","interpolation","passingValue","hasPassingValueInData","segments","combo","xAxisIndex","yAxisIndex","stackIndex","groupIndex","isExistGrp","showValue"];function st(e){if(e===null)return null;const t=typeof e;if(t==="number"||t==="string"||t==="boolean")return e;if(t==="function"||t==="undefined"||t==="symbol"||t==="bigint")return;if(Array.isArray(e))return e.map(i=>st(i)??null);const n=Object.getPrototypeOf(e);if(n===Object.prototype||n===null){const i={};return Object.keys(e).forEach(s=>{const l=st(e[s]);l!==void 0&&(i[s]=l)}),i}}function Ur(e,t){const n={};return e&&t.forEach(i=>{const s=st(e[i]);s!==void 0&&(n[i]=s)}),n}function Jr(e,t){if(t==="time")return Fr(e);if(typeof e=="number")return e;if(t==="step"){const n=Number(e);return Number.isFinite(n)?n:null}return null}function EC(e,t={}){const n=e.data??[];if(e.type==="pie")return{value:n.map(d=>typeof(d==null?void 0:d.value)=="number"?d.value:null)};const i=t.x??"linear",s=t.y??"linear",l=new Array(n.length),a=new Array(n.length),r=new Array(n.length),c=new Array(n.length);for(let d=0;d<n.length;d++){const h=n[d]??{};l[d]=Jr(h.x,i),a[d]=Jr(h.y,s),r[d]=typeof h.o=="number"?h.o:null,c[d]=typeof h.b=="number"?h.b:null}return{x:l,y:a,o:r,b:c}}function GC(e){var s,l,a,r,c,d,h,u;const t=e.options??{},n=e.defaultSelectInfo,i=e.defaultSelectItemInfo;return{selectSeries:{use:!!((s=t.selectSeries)!=null&&s.use),selected:{seriesId:st(n==null?void 0:n.seriesId)??[]}},selectItem:{use:!!((l=t.selectItem)!=null&&l.use),useSeriesOpacity:!!((a=t.selectItem)!=null&&a.useSeriesOpacity),showBorder:!!((r=t.selectItem)!=null&&r.showBorder),borderStyle:st((c=t.selectItem)==null?void 0:c.borderStyle)??null,selected:i?{dataIndex:i.dataIndex??null,seriesID:i.seriesID??null}:null},selectLabel:{use:!!((d=t.selectLabel)!=null&&d.use),useSeriesOpacity:!!((h=t.selectLabel)!=null&&h.useSeriesOpacity),useBothAxis:!!((u=t.selectLabel)!=null&&u.useBothAxis),selected:{dataIndex:st(n==null?void 0:n.dataIndex)??[],label:st(n==null?void 0:n.label)??[],targetAxis:(n==null?void 0:n.targetAxis)??null}}}}function WC(e,t=0){var a,r,c,d,h;const n={},i=e.seriesList??{};Object.keys(i).forEach(u=>{var m,y,C,b,w,T;const f=i[u];if(!f||typeof f.hasRenderableValue=="function"&&!f.isExistGrp&&!f.hasRenderableValue())return;const p=((C=(y=(m=e.options)==null?void 0:m.axesX)==null?void 0:y[f.xAxisIndex??0])==null?void 0:C.type)??"linear",g=((T=(w=(b=e.options)==null?void 0:b.axesY)==null?void 0:w[f.yAxisIndex??0])==null?void 0:T.type)??"linear";n[u]={...Ur(f,VC),data:EC(f,{x:p,y:g})},f.type==="heatMap"&&f.labels&&(n[u].labels=st(f.labels)??{})});const s={},l=((a=e.seriesInfo)==null?void 0:a.charts)??{};return Object.keys(l).forEach(u=>{s[u]=(l[u]??[]).filter(f=>n[f])}),{version:_r,epoch:t,pixelRatio:e.pixelRatio??1,chartRect:st(e.chartRect)??{},labelOffset:st(e.labelOffset)??{},axesSteps:{x:st((r=e.axesSteps)==null?void 0:r.x)??[],y:st((c=e.axesSteps)==null?void 0:c.y)??[]},options:{...Ur(e.options,vC),isGradient:((h=(d=e.options)==null?void 0:d.legend)==null?void 0:h.type)==="gradient"},selection:GC(e),seriesOrder:s,series:n}}function ZC(e){const t={},n=[],i=e.series??{};return Object.keys(i).forEach(s=>{const l=i[s].data??{},a={};let r=0;Object.keys(l).forEach(c=>{const d=l[c]??[];r=d.length;const h=new Float64Array(d.length);for(let u=0;u<d.length;u++)h[u]=typeof d[u]=="number"?d[u]:NaN;a[c]=h,n.push(h.buffer)}),a.length=r,t[s]=a}),{columns:t,transferList:n}}const jr="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3ZhciB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WgsZD1wZXJmb3JtYW5jZS5ub3coKSx1PXd0LnRyYW5zZmVyVG9JbWFnZUJpdG1hcCgpLHg9cGVyZm9ybWFuY2Uubm93KCktZDtzZWxmLnBvc3RNZXNzYWdlKHt0eXBlOiJyZW5kZXJlZCIsZXBvY2g6dCxiaXRtYXA6dSxkcmF3TXM6cCxiaXRtYXBNczp4fSxbdV0pfXNlbGYub25tZXNzYWdlPWU9Pntjb25zdCB0PWUuZGF0YTtpZih0KXtpZih0LnR5cGU9PT0iaW5pdCIpe2xldCBuPXR5cGVvZiBPZmZzY3JlZW5DYW52YXM8InUiO2lmKG4pdHJ5e249ISFuZXcgT2Zmc2NyZWVuQ2FudmFzKDEsMSkuZ2V0Q29udGV4dCgiMmQiKX1jYXRjaHtuPSExfXNlbGYucG9zdE1lc3NhZ2Uoe3R5cGU6bj8icmVhZHkiOiJ1bnN1cHBvcnRlZCIsdmVyc2lvbjpnc30pO3JldHVybn1pZih0LnR5cGU9PT0icmVuZGVyIil0cnl7SXModCl9Y2F0Y2gobil7c2VsZi5wb3N0TWVzc2FnZSh7dHlwZToicmVuZGVyLWVycm9yIixlcG9jaDp0LmVwb2NoLG1lc3NhZ2U6U3RyaW5nKG4mJm4ubWVzc2FnZXx8biksbmFtZTpuJiZuLm5hbWUsc3RhY2s6biYmbi5zdGFja30pfX19fSkoKTsK",XC=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),Qr=typeof self<"u"&&self.Blob&&new Blob([XC(jr)],{type:"text/javascript;charset=utf-8"});function NC(e){let t;try{if(t=Qr&&(self.URL||self.webkitURL).createObjectURL(Qr),!t)throw"";const n=new Worker(t,{name:e==null?void 0:e.name});return n.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker("data:text/javascript;base64,"+jr,{name:e==null?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}const mt={IDLE:"idle",INITIALIZING:"initializing",READY:"ready",FAILED:"failed"},PC=3e3,BC=2,DC=3,zt=()=>{},YC={onInitFailure:zt,onTimeout:zt,onRenderException:zt,onFallback:zt};function OC(){return typeof Worker<"u"&&typeof OffscreenCanvas<"u"&&typeof OffscreenCanvas.prototype.transferToImageBitmap=="function"}function HC(e){if(typeof structuredClone!="function")return!1;try{return structuredClone(e),!0}catch{return!1}}function zC(){return new NC}class FC{constructor(t={}){this.state=mt.IDLE,this.worker=null,this.version=t.version??_r,this.initTimeoutMs=t.initTimeoutMs??PC,this.maxInFlight=t.maxInFlight??BC,this.maxRenderErrors=t.maxRenderErrors??DC,this.hooks={...YC,...t.hooks||{}},this._timer=null,this._frameHandler=zt,this._errorHandler=zt,this._inFlight=0,this._renderErrorStreak=0,this._isEnabled=t.isEnabled||(()=>!1),this._isSupported=t.isSupported||OC,this._createWorker=t.createWorker||zC}start(){if(this.state!==mt.IDLE)return this.state;if(!this._isEnabled())return this.hooks.onFallback("opt-in-off"),this.state;if(!this._isSupported())return this.hooks.onFallback("unsupported"),this.state;let t;try{t=this._createWorker()}catch(n){return this.state=mt.FAILED,this.hooks.onInitFailure(n),this.hooks.onFallback("worker-create-failed"),this.state}return t?(this.worker=t,this.state=mt.INITIALIZING,t.onmessage=n=>this._handleMessage(n),t.onerror=()=>this._fail("worker-error"),this._timer=setTimeout(()=>this._handleTimeout(),this.initTimeoutMs),t.postMessage({type:"init",version:this.version}),this.state):(this.state=mt.FAILED,this.hooks.onInitFailure("worker-create-failed"),this.hooks.onFallback("worker-create-failed"),this.state)}isReady(){return this.state===mt.READY}shouldRenderOnWorker(t){return this.isReady()&&HC(t)}setFrameHandler(t){this._frameHandler=t||zt}setErrorHandler(t){this._errorHandler=t||zt}canAcceptRender(){return this.isReady()&&this._inFlight<this.maxInFlight}render(t,n,i){if(!this.canAcceptRender()||!this.worker)return!1;this._inFlight+=1;try{this.worker.postMessage({type:"render",epoch:t.epoch,snapshot:t,columns:n},i||[])}catch(s){return this._inFlight=0,this.hooks.onRenderException(s),this._fail("post-message-failed"),!1}return!0}destroy(){this._clearTimer(),this.worker&&(this.worker.terminate(),this.worker=null),this.state=mt.IDLE}_handleMessage(t){const n=t&&t.data;if(n)if(n.type==="ready"&&this.state===mt.INITIALIZING){if(n.version!==this.version){this._fail("version-mismatch");return}this._clearTimer(),this.state=mt.READY}else n.type==="unsupported"?this._fail("worker-unsupported"):n.type==="rendered"?(this._inFlight=Math.max(0,this._inFlight-1),this._renderErrorStreak=0,this._frameHandler(n)):n.type==="render-error"&&(this._inFlight=Math.max(0,this._inFlight-1),this.hooks.onRenderException(n),this._errorHandler(n),this._renderErrorStreak+=1,this._renderErrorStreak>=this.maxRenderErrors&&(this._inFlight=0,this._fail("render-error-threshold")))}_handleTimeout(){this.state===mt.INITIALIZING&&(this.hooks.onTimeout("init-timeout"),this._fail("init-timeout"))}_fail(t){this._clearTimer(),this.state=mt.FAILED,this.worker&&(this.worker.terminate(),this.worker=null);const n=this._inFlight>0;this._inFlight=0,this.hooks.onInitFailure(t),this.hooks.onFallback(t),n&&this._errorHandler()}_clearTimer(){this._timer&&(clearTimeout(this._timer),this._timer=null)}}const AC=300;let ms=class{constructor(t,n,i,s,l,a,r){Object.keys(zr).forEach(d=>Object.assign(this,zr[d])),i.brush||(Object.assign(this,xC),Object.assign(this,IC),Object.assign(this,bC),Object.assign(this,TC),Object.assign(this,dC),Object.assign(this,LC),Object.assign(this,cC),Object.assign(this,fC)),i.type==="heatMap"&&i.legend.type==="gradient"&&Object.assign(this,uC),this.isMobile=Zh(),this.brushSeries=r,this.target=t,this.data=n,this.options=i,this.listeners=s,this.wrapperDOM=document.createElement("div"),this.wrapperDOM.className=i.brush?"ev-chart-brush-wrapper":"ev-chart-wrapper",this.chartDOM=document.createElement("div"),this.chartDOM.className=i.brush?"ev-chart-brush-container":"ev-chart-container",this.wrapperDOM.appendChild(this.chartDOM),this.target.appendChild(this.wrapperDOM);const c=i.type==="pie";this.displayCanvas=document.createElement("canvas"),this.displayCanvas.setAttribute("style","display: block;"),this.displayCtx=this.displayCanvas.getContext("2d",{willReadFrequently:c}),this.bufferCanvas=document.createElement("canvas"),this.bufferCanvas.setAttribute("style","display: block;"),this.bufferCtx=this.bufferCanvas.getContext("2d",{willReadFrequently:c}),this.pixelRatio=window.devicePixelRatio||1,this.oldPixelRatio=this.pixelRatio,this.chartDOM.appendChild(this.displayCanvas),i.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",{willReadFrequently:c}),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,this.initBlitState(),this.renderWorkerGate=new FC({isEnabled:()=>!!this.options.workerRender,hooks:{onInitFailure:d=>to.warn("[EvChart] workerRender 비활성화 — main 렌더로 fallback:",d),onRenderException:d=>to.warn("[EvChart] workerRender 렌더 예외 — main 렌더로 fallback:",d),onFallback:d=>{d==="unsupported"&&to.warn("[EvChart] workerRender 미지원 환경 — main 렌더 사용")}}}),this.renderEpoch=0,this.renderWorkerGate.setFrameHandler(d=>this.commitWorkerFrame(d)),this.renderWorkerGate.setErrorHandler(d=>this.drawSeriesLayerFallback(d)),this.renderWorkerGate.start()}init(){var u,f,p,g,m;const{series:t,data:n,labels:i,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,i),this.minMax=this.getStoreMinMax(),this.initRect(),this.axesX=this.createAxes("x",a),this.axesY=this.createAxes("y",r),((f=(u=a==null?void 0:a[0])==null?void 0:u.scrollbar)!=null&&f.use||(g=(p=r==null?void 0:r[0])==null?void 0:p.scrollbar)!=null&&g.use)&&this.initScrollbar(),this.initDefaultSelectInfo(),this.drawChart(),c.use&&!this.isInitTooltip&&this.createTooltipDOM(),(m=this.createEventFunctions)==null||m.call(this),this.isInit=!0}_updateSeriesCount(){this.seriesInfo.count=Object.values(this.seriesList).filter(t=>t.show).length}initRect(){const t=this.options;t.title.show&&(this.isInitTitle||this.initTitle(),this.showTitle()),t.legend.show&&!t.legend.external?(this.isInitLegend||this.initLegend(),this.setLegendPosition()):t.legend.show&&t.legend.external&&this._updateSeriesCount(),this.chartRect=this.getChartRect()}drawSyncedIndicator({horizontal:t,label:n,mousePosition:i}){this.drawSyncedIndicator({horizontal:t,label:n,mousePosition:i})}adjustXAndYAxisWidth(){var i,s,l,a;const t=(r,c,d)=>{const{interval:h,graphMin:u,graphMax:f,steps:p=0,minIndex:g,maxIndex:m,indexInterval:y}=r??{};let C=[];if((d==null?void 0:d.type)==="step"&&g!==void 0&&m!==void 0&&y!==void 0){const{labels:b}=this.data,w=c==="x"?(b==null?void 0:b.x)??b??[]:(b==null?void 0:b.y)??b??[];C=[];for(let T=g;T<=m;T+=y)w[T]!==void 0&&C.push(w[T])}else if(h)C=Array.from({length:p},(b,w)=>u+w*h),C.push(f);else{const{labels:b}=this.data;C=c==="x"?(b==null?void 0:b.x)??b??[]:(b==null?void 0:b.y)??b??[]}return C},n={x:(s=(i=this.axesRange)==null?void 0:i.x)==null?void 0:s.map((r,c)=>{var y,C,b,w;const d=this.axesX[c],h=(y=this.axesSteps)==null?void 0:y.x[c],u=t(h,"x",d),f=Re((C=d==null?void 0:d.labelStyle)==null?void 0:C.fixWidth)?d.labelStyle.fixWidth:0;let p=[];const g=(b=this.axesSteps)==null?void 0:b.x[c];if((d==null?void 0:d.type)==="linear"&&g!=null){const{graphMin:T,graphMax:k}=g;if(typeof T=="number"&&typeof k=="number"){const M=Math.abs(T)>=Math.abs(k)?T:k;p=[PS(M)]}}const m=((w=d==null?void 0:d.getLabelWidthHasMaxLength)==null?void 0:w.call(d,u,this.chartRect,p))??0;return{...r,size:{width:f||Math.max(m,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,m,y;const d=this.axesY[c],h=(g=this.axesSteps)==null?void 0:g.y[c],u=t(h,"y",d),f=Re((m=d==null?void 0:d.labelStyle)==null?void 0:m.fixWidth)?d.labelStyle.fixWidth:0,p=((y=d==null?void 0:d.getLabelWidthHasMaxLength)==null?void 0:y.call(d,u,this.chartRect))??0;return{...r,size:{width:f||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()}computeAxesScaleChange(){var r;if(typeof((r=this.listeners)==null?void 0:r["axes-scale-change"])!="function")return null;const t=this._lastEmittedAxesRange,n=this.labelRange,i=(c,d)=>(c==null?void 0:c.min)===(d==null?void 0:d.min)&&(c==null?void 0:c.max)===(d==null?void 0:d.max),s=({min:c,max:d})=>({minSteps:c,maxSteps:d}),l=n.x.every((c,d)=>{var u;return!!!((u=this.options.axesX[d])!=null&&u.scaleChange)||!!t&&i(c,t.x[d])}),a=n.y.every((c,d)=>{var u;return!!!((u=this.options.axesY[d])!=null&&u.scaleChange)||!!t&&i(c,t.y[d])});return l&&a?null:(this._lastEmittedAxesRange=n,{x:n.x.map(s),y:n.y.map(s)})}emitDataMaxChange(){var i;const t=(i=this.listeners)==null?void 0:i["axes-data-max-change"];if(typeof t!="function")return;let n=-1/0;Object.values(this.seriesList).forEach(s=>{if(!(s!=null&&s.show)||!s.minMax)return;const l=s.minMax.maxY;Number.isFinite(l)&&l>n&&(n=l)}),t(Number.isFinite(n)?n:null)}prepareScale(){this.axesRange=this.getAxesRange(),this.labelOffset=this.getLabelOffset(),this.labelRange=this.getAxesLabelRange();const t=this.labelOffset;return this.axesSteps=this.calculateSteps(),this.adjustXAndYAxisWidth(),{scaleChange:this.computeAxesScaleChange(),scrollbarLabelOffset:t}}drawChart(t,n){var l,a,r,c,d,h;this.renderEpoch+=1,this.initScale();const{scaleChange:i,scrollbarLabelOffset:s}=this.prepareScale();this.computeScaleVersion(),((a=(l=this.scrollbar)==null?void 0:l.x)!=null&&a.use||(c=(r=this.scrollbar)==null?void 0:r.y)!=null&&c.use)&&this.updateScrollbarPosition(s),i&&typeof((d=this.listeners)==null?void 0:d["axes-scale-change"])=="function"&&this.listeners["axes-scale-change"](i),this.emitDataMaxChange(),!(!n&&this.tryDrawSeriesOnWorker(t))&&((h=this.options.realTimeScatter)!=null&&h.use?this.drawAxisAndSeries(t):(this.drawStaticLayer(this.bufferCtx,t),this.drawSeriesLayer(this.bufferCtx,t),this.shouldDrawSelectedOnTop(t)&&this.drawSelectedSeriesOnly()),this.drawSeriesOverlay(),this.drawTip(),this.commitToDisplay(this.displayCtx,this.bufferCanvas))}tryDrawSeriesOnWorker(t){var r;if(!((r=this.renderWorkerGate)!=null&&r.canAcceptRender())||!this.canRenderSeriesOnWorker(t).ok)return!1;const n=this.renderEpoch,i=WC(this,n),{columns:s,transferList:l}=ZC(i);return this.drawStaticLayer(this.bufferCtx,t),this.computeSeriesGeometry(),this.renderWorkerGate.render(i,s,l)?this.drawSeriesOverlay():(this.drawSeriesLayer(this.bufferCtx,t),this.drawSeriesOverlay(),this.drawTip(),this.commitToDisplay(this.displayCtx,this.bufferCanvas)),!0}canRenderSeriesOnWorker(t){var a;if(t||this.lastHitInfo)return{ok:!1,reason:"hit-info"};const n=((a=this.seriesInfo)==null?void 0:a.charts)??{},i={line:!0,bar:!0,heatMap:!0},s=Object.keys(n).find(r=>!i[r]&&(n[r]??[]).some(c=>{var d;return((d=this.seriesList[c])==null?void 0:d.show)!==!1}));return s?{ok:!1,reason:`unsupported-type:${s}`}:(n.bar??[]).some(r=>{const c=this.seriesList[r];return(c==null?void 0:c.show)!==!1&&(c==null?void 0:c.timeMode)})?{ok:!1,reason:"time-bar"}:{ok:!0}}commitWorkerFrame(t){const n=t==null?void 0:t.bitmap;if(!n)return;if(t.epoch!==this.renderEpoch){n.close();return}const i=this.displayCtx;this.commitToDisplay(i,this.bufferCanvas),i.drawImage(n,0,0),n.close(),i.save(),i.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0),this.drawTip(i),i.restore()}drawSeriesLayerFallback(t){t&&t.epoch!==this.renderEpoch||(this.drawSeriesLayer(this.bufferCtx,void 0),this.commitToDisplay(this.displayCtx,this.bufferCanvas))}commitToDisplay(t,n){if(this.displayCanvas){const i=this.pixelRatio<1?this.pixelRatio:1;t.clearRect(0,0,this.displayCanvas.width/i,this.displayCanvas.height/i)}n&&(n==null?void 0:n.width)>1&&(n==null?void 0:n.height)>1&&t.drawImage(n,0,0),this._blitPrev=this.snapshotBlitState()}drawAxisAndSeries(t){const n=this.evaluateBlitGate(t),i=typeof window<"u"&&window.__EVUI_BLIT_FORCE_OFF__===!0,s=typeof window<"u"?window.__EVUI_BLIT_REFRESH_INTERVAL__:void 0,l=Number.isFinite(s)?s:this._blitRefreshInterval||AC,a=n.ok&&!i&&this.pointsLayerValid&&this.pointsLayersSized()&&this._framesSinceFullRedraw<l,r={blockedByForceOff:i,blockedByLayerInvalid:!this.pointsLayerValid,blockedByLayerUnsized:!this.pointsLayersSized(),blockedByRefreshDue:this._framesSinceFullRedraw>=l};let c=!1;if(a&&(c=this.drawChartBlitFastPath(t,n)),this.recordBlitDiag(n,c,r),c)this._framesSinceFullRedraw++,this._pointsLayerStamp=this.computePointsLayerStamp(),this._pointsLayerOptionsRef=this.options,this._hitCoordsDirty=!0;else{this.drawStaticLayer(this.bufferCtx,t);let d=!1,h=!1;!i&&this.canRouteFallbackViaLayer(t)?(d=this.maybeRebuildPointsLayer(r.blockedByRefreshDue),this.pointsLayerValid?this.compositePointsLayer(this.getPointsLayers().src,this.getMaxVisibleScatterPointSize()):(this.drawSeriesLayer(this.bufferCtx,t),h=!0)):(this.drawSeriesLayer(this.bufferCtx,t),d=this.maybeRebuildPointsLayer(!1),h=!(t!=null&&t.legend)),(d||h)&&(this._hitCoordsDirty=!1),d&&(this._framesSinceFullRedraw=0,this._blitCarry=0)}}collectDuplicatePoints(t,n){var s,l,a;const i=!!this.options.seriesReverse;for(let r=i?n.length-1:0;i?r>=0:r<n.length;i?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 u=0;u<h.length;u++){const f=((a=h[u])==null?void 0:a.data)||[];for(let p=0;p<f.length;p++){const g=f[p];t.set(g.k??A.coordinateKey(g.x,g.y),c.sId)}}}else{const h=this.data.data[n[r]]??[];for(let u=0;u<h.length;u++){const f=h[u];t.set(A.coordinateKey(f.x,f.y),c.sId)}}}}canSkipRealtimeScatterDedupe(t){var i,s;if(!((i=this.options.realTimeScatter)!=null&&i.use))return!1;let n=0;for(let l=0;l<t.length;l++)if((s=this.seriesList[t[l]])!=null&&s.show&&(n++,n>1))return!1;return n===1}computeScaleVersion(){var r,c;const t=this.chartRect??{},n=this.labelOffset??{},i=this.options??{},s=((r=this.axesSteps)==null?void 0:r.x)??[],l=((c=this.axesSteps)==null?void 0:c.y)??[];let a=`${t.x1},${t.x2},${t.y1},${t.y2},${t.chartWidth},${t.chartHeight}|${n.left},${n.right},${n.top},${n.bottom}|${this.pixelRatio}|${i.horizontal?1:0}|${i.thickness},${i.cPadRatio},${i.borderRadius}|`;for(let d=0;d<s.length;d++){const h=s[d];a+=`${h==null?void 0:h.graphMin}:${h==null?void 0:h.graphMax}:${h==null?void 0:h.minIndex}:${h==null?void 0:h.maxIndex}:${h==null?void 0:h.oriSteps};`}a+="|";for(let d=0;d<l.length;d++){const h=l[d];a+=`${h==null?void 0:h.graphMin}:${h==null?void 0:h.graphMax}:${h==null?void 0:h.minIndex}:${h==null?void 0:h.maxIndex}:${h==null?void 0:h.oriSteps};`}a!==this._scaleKey&&(this._scaleKey=a,this._scaleVersion=(this._scaleVersion??0)+1)}computeSeriesGeometry(){const t={chartRect:this.chartRect,labelOffset:this.labelOffset,axesSteps:this.axesSteps,isHorizontal:this.options.horizontal,dataEpoch:this._dataEpoch,scaleVersion:this._scaleVersion};let n=0;this.seriesInfo.charts.bar.forEach(r=>{var c;(c=this.seriesList[r])!=null&&c.show&&n++}),["line","heatMap"].forEach(r=>{this.seriesInfo.charts[r].forEach(c=>{var d,h;(h=(d=this.seriesList[c])==null?void 0:d.computeGeometry)==null||h.call(d,t)})});const{thickness:i,cPadRatio:s,borderRadius:l}=this.options;let a=0;this.seriesInfo.charts.bar.forEach(r=>{var d;const c=this.seriesList[r];c&&((d=c.computeGeometry)==null||d.call(c,{...t,thickness:i,cPadRatio:s,borderRadius:l,showSeriesCount:n,showIndex:a}),c.show&&a++)})}drawSeriesLayer(t,n){var m;const{maxTip:i,selectLabel:s,selectItem:l,selectSeries:a,brush:r,displayOverflow:c,unSelectedOpacity:d}=this.options,h={ctx:t,chartRect:this.chartRect,labelOffset:this.labelOffset,axesSteps:this.axesSteps,maxTipOpt:{background:i.background,color:i.color},selectLabel:{option:s,selected:this.defaultSelectInfo},selectSeries:{option:a,selected:this.defaultSelectInfo},selectItem:{option:l,selected:this.defaultSelectItemInfo},isBrush:!!r,displayOverflow:c,unSelectedOpacity:d,isHorizontal:this.options.horizontal,dataEpoch:this._dataEpoch,scaleVersion:this._scaleVersion};let u=0,f=0;this.seriesInfo.charts.bar.forEach(y=>{this.seriesList[y].show&&f++});const p=new Map,g=Object.keys(this.seriesInfo.charts);for(let y=0;y<g.length;y++){const C=g[y],b=this.seriesInfo.charts[C];let w=!1;C==="scatter"&&(w=this.options.coordinateDedupe!==!1&&!this.canSkipRealtimeScatterDedupe(b),w&&this.collectDuplicatePoints(p,b));for(let T=0;T<b.length;T++){let k=this.seriesList[b[T]];switch(C){case"line":{const M=n==null?void 0:n.legend;k.draw({legendHitInfo:M,...h});break}case"heatMap":{const M=n==null?void 0:n.legend;k.draw({legendHitInfo:M,...h});break}case"bar":{const M=n==null?void 0:n.legend,{thickness:Z,cPadRatio:S,borderRadius:x}=this.options;k.draw({thickness:Z,cPadRatio:S,borderRadius:x,showSeriesCount:f,showIndex:u,legendHitInfo:M,...h}),k.show&&u++;break}case"pie":{const M=this.lastHitInfo??{sId:(m=this.defaultSelectItemInfo)==null?void 0:m.seriesID},Z=n==null?void 0:n.legend;this.options.sunburst?this.drawSunburst({selectInfo:M,legendHitInfo:Z,unSelectedOpacity:h.unSelectedOpacity},t):this.drawPie({selectInfo:M,legendHitInfo:Z,unSelectedOpacity:h.unSelectedOpacity},t),this.options.doughnutHoleSize>0&&this.drawDoughnutHole(t);break}case"scatter":{const M=n==null?void 0:n.legend;let Z;if(l.use&&l.useSeriesOpacity){const S=this.lastHitInfo,x=this.defaultSelectItemInfo;S!=null&&S.dataIndex||(S==null?void 0:S.dataIndex)===0?Z={seriesID:S.sId,dataIndex:S.dataIndex}:x!=null&&x.dataIndex||(x==null?void 0:x.dataIndex)===0?Z={...x}:Z=null}this.options.seriesReverse&&(k=this.seriesList[b.at(-1-T)]),k.draw({legendHitInfo:M,selectInfo:Z,duple:p,coordinateDedupe:w,...h});break}}}}}drawSeriesOverlay(){var s,l;const t=this.overlayCtx;if(!t)return;const n={overlayCtx:t,chartRect:this.chartRect,labelOffset:this.labelOffset,axesSteps:this.axesSteps},i=this.seriesInfo.charts.heatMap;for(let a=0;a<i.length;a++)(l=(s=this.seriesList[i[a]])==null?void 0:s.drawOverlay)==null||l.call(s,n)}drawTip(t){var i;let n;this.lastHitInfo?n=this.lastHitInfo:this.defaultSelectItemInfo?n=this.getItem(this.defaultSelectItemInfo,!1):this.defaultSelectInfo&&this.options.selectLabel.use?n=this.getItem(this.defaultSelectInfo,!1):n=null,(i=this.drawTips)==null||i.call(this,n,t)}createAxes(t,n=[]){const i=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 oC(t,r,i,a);case"time":return r.categoryMode?new rC(t,r,i,l,a):new sC(t,r,i,a);case"log":return new lC(t,r,i);case"step":return new aC(t,r,i,l,a);default:return!1}})}getAxesRange(){const t=this.axesX.map((i,s)=>i.calculateScaleRange(this.minMax.x[s],this.scrollbar.x,this.chartRect)),n=this.axesY.map((i,s)=>i.calculateScaleRange(this.minMax.y[s],this.scrollbar.y,this.chartRect));return{x:t,y:n}}drawStaticLayer(t,n){this.axesX.forEach((i,s)=>{i.ctx=t,i.draw(this.chartRect,this.labelOffset,this.axesSteps.x[s],n,this.defaultSelectInfo,this.data.labels)}),this.axesY.forEach((i,s)=>{i.ctx=t,i.draw(this.chartRect,this.labelOffset,this.axesSteps.y[s],n,this.defaultSelectInfo)})}calculateSteps(){const t=this.axesX.map((i,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 i.calculateSteps(l)}),n=this.axesY.map((i,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 i.calculateSteps(l)});return{x:t,y:n}}getAxesLabelRange(){const t=this.axesX.map((i,s)=>{const l=this.axesRange.x[s].size;return i.calculateLabelRange("x",this.chartRect,this.labelOffset,l.width)}),n=this.axesY.map((i,s)=>{const l=this.axesRange.y[s].size;return i.calculateLabelRange("y",this.chartRect,this.labelOffset,l.height)});return{x:t,y:n}}computePixelRatio(){const t=window.devicePixelRatio||1,n=this.displayCtx.webkitBackingStorePixelRatio||this.displayCtx.mozBackingStorePixelRatio||this.displayCtx.msBackingStorePixelRatio||this.displayCtx.oBackingStorePixelRatio||this.displayCtx.backingStorePixelRatio||1;return t/n}prepareLayout(t){this.pixelRatio=t,this.oldPixelRatio!==this.pixelRatio&&(this.oldPixelRatio=this.pixelRatio),this.bufferCtx.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}initScale(){const t=this.computePixelRatio();this.prepareLayout(t),this.overlayCtx&&this.overlayCtx.setTransform(t,0,0,t,0,0)}getChartDOMRect(){var s;const t=(s=this.chartDOM)==null?void 0:s.getBoundingClientRect(),n=(t==null?void 0:t.width)||10,i=(t==null?void 0:t.height)||10;return this.setWidth(n),this.setHeight(i),{width:n,height:i}}getOverlayClientRect(){return!this.cachedOverlayRect&&this.overlayCanvas&&(this.cachedOverlayRect=this.overlayCanvas.getBoundingClientRect()),this.cachedOverlayRect}getChartDOMClientRect(){return!this.cachedChartDOMRect&&this.chartDOM&&(this.cachedChartDOMRect=this.chartDOM.getBoundingClientRect()),this.cachedChartDOMRect}invalidateClientRectCache(){this.cachedOverlayRect=null,this.cachedChartDOMRect=null}getChartRect(){var k,M,Z,S;const{width:t,height:n}=this.getChartDOMRect(),i=this.options.padding,s=(M=(k=this.options.axesX)==null?void 0:k[0])==null?void 0:M.title,l=(S=(Z=this.options.axesY)==null?void 0:Z[0])==null?void 0:S.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 u=0;d!=null&&d.use&&(u=d==null?void 0:d.height);let f=0;h!=null&&h.use&&(f=h==null?void 0:h.width);const p=i.left+i.right+f,g=i.top+i.bottom+r+c+u,m=t>p?t-p:t,y=n>g?n-g:n,C=i.left,b=Math.max(t-i.right-f,C+2),w=i.top+c,T=Math.max(n-i.bottom-r-u,w+2);return{x1:C,x2:b,y1:w,y2:T,chartWidth:m,chartHeight:y,width:t,height:n}}setWidth(t){if(!this.displayCanvas)return;const n=t*this.pixelRatio;if(this._deviceWidth!==n&&(this._deviceWidth=n,this.displayCanvas.width=n,this.displayCanvas.style.width=`${t}px`,this.bufferCanvas.width=n,this.bufferCanvas.style.width=`${t}px`,this.overlayCanvas&&(this.overlayCanvas.width=n,this.overlayCanvas.style.width=`${t}px`),this.pointsLayerA)){const i=Math.floor(t*this.pixelRatio);this.pointsLayerA.width!==i&&(this.pointsLayerA.width=i,this.pointsLayerB.width=i,this.pointsLayerValid=!1)}}setHeight(t){if(!this.displayCanvas)return;const n=t*this.pixelRatio;if(this._deviceHeight!==n&&(this._deviceHeight=n,this.displayCanvas.height=n,this.displayCanvas.style.height=`${t}px`,this.bufferCanvas.height=n,this.bufferCanvas.style.height=`${t}px`,this.overlayCanvas&&(this.overlayCanvas.height=n,this.overlayCanvas.style.height=`${t}px`),this.pointsLayerA)){const i=Math.floor(t*this.pixelRatio);this.pointsLayerA.height!==i&&(this.pointsLayerA.height=i,this.pointsLayerB.height=i,this.pointsLayerValid=!1)}}getLabelOffset(t=null){const n=this.axesX,i=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 u;(u=d.labelStyle)!=null&&u.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)}),i.forEach((d,h)=>{var u;(u=d.labelStyle)!=null&&u.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}updateScrollbar(t,n){var c,d,h,u,f,p,g,m,y,C;const i=n||t,s=((h=(d=(c=this.options.axesX)==null?void 0:c[0])==null?void 0:d.scrollbar)==null?void 0:h.use)??!1,l=((p=(f=(u=this.options.axesY)==null?void 0:u[0])==null?void 0:f.scrollbar)==null?void 0:p.use)??!1,a=((m=(g=this.scrollbar)==null?void 0:g.x)==null?void 0:m.use)??!1,r=((C=(y=this.scrollbar)==null?void 0:y.y)==null?void 0:C.use)??!1;(s!==a||s||i&&s)&&this.updateScrollbarInfo("x",t),(l!==r||l||i&&l)&&this.updateScrollbarInfo("y",t)}update(t){var y,C,b,w,T,k,M;const n=this.options,i=this.data.data,s=this.data.labels,l=this.data.groups,a=this.data.series,{updateSeries:r,updateSelTip:c,updateLegend:d,updateData:h,updateTooltip:u,lightUpdate:f,updateByScrollbar:p}=t;if(!this.isInit)return;if((h||r)&&(this._lastHoverSig=""),this.updateScrollbar(h,p),this.resetProps(),this.updateSeries=r,r&&(this.pointsLayerValid=!1),(y=this.options.realTimeScatter)!=null&&y.use&&!this.pointsLayerA&&this.createPointsLayers(),r){const Z=this.seriesList;this.seriesInfo={charts:{pie:[],bar:[],line:[],scatter:[],heatMap:[]},count:0},this.lastTip={pos:null,value:null},this.reconcileSeriesSet(a,n.type,n.horizontal,l,Z),this.legendDOM&&!n.legend.external&&this.updateLegend()}if(c.update&&(this.lastTip.value=null,c.keepDomain||(this.lastTip.pos=null,this.lastHitInfo=null)),!f)if(l.length&&this.addGroupInfo(l),(C=this.options.realTimeScatter)!=null&&C.use?(this.dataSet||(this.dataSet={}),this.createRealTimeScatterDataSet(i)):this.createDataSet(i,s),n.title.show?(this.isInitTitle?this.updateTitle():this.initTitle(),this.showTitle()):this.isInitTitle&&this.hideTitle(),n.legend.show&&!n.legend.external){const Z=!!((w=(b=n.legend)==null?void 0:b.table)!=null&&w.use)&&n.type!=="heatMap"&&n.type!=="scatter";this.isInitLegend?r?this.updateLegend():d?this.forceUpdateLegend():Z&&h&&this.updateLegendTableValues():this.initLegend(),this.setLegendPosition(),this.updateLegendContainerSize(),this.showLegend()}else n.legend.show&&n.legend.external?(r||h)&&(this._updateSeriesCount(),this.emitLegendData()):this.isInitLegend&&this.hideLegend();u&&(this.isInitTooltip||this.createTooltipDOM(),this.tooltipDOM.innerHTML="",(k=(T=n.tooltip)==null?void 0:T.formatter)!=null&&k.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)&&((M=this.legendHover)!=null&&M.sId)&&(g={...g||{},legend:this.legendHover}),this.render(g),this.dragInfo&&this.drawSelectionArea?this.drawSelectionArea(this.dragInfo):this.dragInfoBackup&&(f?this.drawSelectionArea(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.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,i,s,l,a,r,c;this.invalidateClientRectCache(),this.clear(),this.bufferCtx.restore(),this.bufferCtx.save(),this.pointsLayerValid=!1,((s=(i=(n=this.options.axesX)==null?void 0:n[0])==null?void 0:i.scrollbar)!=null&&s.use||(r=(a=(l=this.options.axesY)==null?void 0:l[0])==null?void 0:a.scrollbar)!=null&&r.use)&&this.initScrollbar(),this.initRect(),this.initScale(),this.chartRect=this.getChartRect(),this.drawChart(void 0,!0),this.dragInfoBackup&&((c=this.drawSelectionArea)==null||c.call(this,this.dragInfoBackup)),t&&t(!0)}render(t){this.isInit&&(this.invalidateClientRectCache(),this._vsDetectFailed=!1,this.clear(),this.chartRect=this.getChartRect(),this.drawChart(t))}_getLegendSeries(){var n;const t=(n=this.data.groups)==null?void 0:n.at(0);return t?t.filter(i=>{var s;return(s=this.seriesList[i])==null?void 0:s.showLegend}).map(i=>[i,this.seriesList[i]]):Object.entries(this.seriesList).filter(([,i])=>i.showLegend)}_seriesToLegendItem(t){const n=typeof t.color!="string"?t.color[t.color.length-1][1]:t.color;return{sId:t.sId,name:t.name,color:n,type:t.type,show:t.show,fill:t.fill,fillColor:t.fillColor}}buildLegendData(){return this._getLegendSeries().map(([,t])=>this._seriesToLegendItem(t))}emitLegendData(){typeof this.listeners["update:legendData"]=="function"&&this.listeners["update:legendData"](this.buildLegendData())}toggleSeries(t){var d;const n=this.seriesList[t];if(!n)return;const i=this.options.legend,s=this._getLegendSeries();if(i.clickMode==="active")s.every(([,f])=>f.show)?(s.forEach(([,f])=>{f.show=!1}),n.show=!0,this.seriesInfo.count=1):n.show?(n.show=!1,this.seriesInfo.count--):(n.show=!0,this.seriesInfo.count++),s.every(([,f])=>!f.show)&&(s.forEach(([,f])=>{f.show=!0}),this.seriesInfo.count=s.length);else{if(n.show&&this.seriesInfo.count===1)return;n.show?(n.show=!1,this.seriesInfo.count--):(n.show=!0,this.seriesInfo.count++)}if(this.brushSeries){const{chartIdx:h}=this.data,u=[...this.brushSeries.list];u[h]=this.seriesList,this.brushSeries.list=u,this.brushSeries.chartIdx=h}((d=this.options.eventBehavior)==null?void 0:d.legendClick)!=="emitOnly"&&this.update({updateSeries:!1,updateSelTip:{update:!0,keepDomain:!0}});const a=Object.values(this.seriesList).filter(h=>h.show).map(h=>h.sId),r=a.length===Object.values(this.seriesList).length,c={data:{seriesIds:r?[]:a,isActiveAll:r}};typeof this.listeners["click-legend"]=="function"&&this.listeners["click-legend"](c),this.options.legend.show&&this.options.legend.external&&this.emitLegendData()}highlightSeries(t){const n={sId:t,type:this.options.type};this.legendHover=n,this.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1},hitInfo:{legend:n},lightUpdate:!0})}unhighlightSeries(){this.legendHover=null,this.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1},hitInfo:{legend:null},lightUpdate:!0})}destroy(){if(!this.isInit)return;const t=this.target;for(this.options.legend.show&&!this.options.legend.external&&(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.invalidateRectOnScroll&&window.removeEventListener("scroll",this.invalidateRectOnScroll,{capture:!0})),this.isInitTooltip&&this.tooltipDestroy(),this.renderWorkerGate&&this.renderWorkerGate.destroy(),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:i}=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:[]}}i.use&&!this.defaultSelectInfo&&(this.defaultSelectInfo={seriesId:[]})}};Object.assign(ms.prototype,MC),Object.assign(ms.prototype,RC);const KC={name:"EvChartToolbar",props:{toolbar:{type:Object,default:()=>({})}},emits:["onClickToolbar"]},_C={class:"ev-chart-toolbar"},UC={class:"ev-chart-toolbar__icon"};function JC(e,t,n,i,s,l){const a=o.resolveComponent("ev-icon");return o.openBlock(),o.createElementBlock("div",_C,[o.createElementVNode("div",UC,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.$props.toolbar.items,(r,c)=>(o.openBlock(),o.createBlock(a,{key:`${c}-${r.icon}`,class:o.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 $r=de(KC,[["render",JC],["__scopeId","data-v-dfbffbab"]]);class jC{constructor(t,n,i,s,l,a,r){this.isExecuteZoom=l,this.evChartProps=t.props,this.evChartCloneData=n.data,this.brushIdx=a;const c=i.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 i=document.createElement("canvas");i.setAttribute("style","display: block;"),i.setAttribute("class","animation-canvas"),i.style.position="absolute",n.appendChild(i)}),t}setEventListener(t){const n=t?"addEventListener":"removeEventListener";this.isUseZoomMode=t,this.evChartDomContainers.forEach(i=>{i[n]("wheel",this.wrapWheelMoveZoomArea)})}wheelMoveZoomArea(t){t.preventDefault();const[n,i]=this.zoomAreaMemory.current[0];if(n===i)return;let s,l;if(t.deltaY>0){if(!n)return;s=n-1,l=i-1}else{if(i===this.cloneLabelsLastIdx)return;s=n+1,l=i+1}this.isUseToolbar=!0,this.executeZoom(s,l),this.zoomAreaMemory.current[0]=[s,l]}clickMoveZoomArea(t){if(!this.zoomAreaMemory[t].length)return;const[n,i]=this.zoomAreaMemory[t].pop();this.isUseToolbar=!0,this.executeZoom(n,i),this.setZoomAreaMemory(n,i,t==="previous"?"latest":"previous")}dragZoom({data:t,range:{dragSelectionInfo:n}}){const{dragXsp:i,dragXep:s,exceptAxesYChartWidth:l,chartTitle:a}=n,{options:r,data:c}=this.evChartProps,d=r.length>1?r.findIndex(h=>{var u;return(((u=h==null?void 0:h.title)==null?void 0:u.text)??"")===a}):0;if(r[d].axesX[0].type==="time"){const h=t[0].items,u=h[0].x,f=h[h.length-1].x,p=c[d].labels,g=this.evChartCloneData[d].labels,[m,y]=this.zoomAreaMemory.current[0];let C=g.findIndex(M=>+M.$d==+u.$d),b=g.findLastIndex(M=>+M.$d==+f.$d);const w=M=>l/(p.length-1)*(M-m);let T=w(C);if(C===b&&(T-i>=s-T?C-=1:b+=1),C===m&&b===y)return;C-b===-1&&(T=w(C));const k=w(b);this.evChartZoomOptions.useAnimation?this.dragZoomAnimation(n,C,b,T,k):(this.executeZoom(C,b),this.setZoomAreaMemory(C,b))}}dragZoomAnimation(t,n,i,s,l){const{chartRange:a,exceptAxesYChartWidth:r,exceptAxesXChartHeight:c}=t,d=window.devicePixelRatio||1,h=Array.from(this.evChartDomContainers).map(u=>{const f=u.querySelector(".animation-canvas");return[u.children[0],f]});for(let u=0;u<h.length;u++){const[f,p]=h[u],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(f,g,t,s,l).then(m=>{p.style.display="none",m&&u===h.length-1&&(this.isAnimationFinish=m,this.executeZoom(n,i),this.setZoomAreaMemory(n,i))})}}executeZoom(t,n){this.isExecuteZoom&&(this.isExecuteZoom.value=!0);for(let i=0;i<this.evChartCloneData.length;i++){const{data:s,labels:l,series:a}=this.evChartCloneData[i],r=this.evChartProps.data[i],c=Object.keys(a);for(let d=0;d<c.length;d++){const h=c[d];r.data[h]=s[h].filter((u,f)=>t<=f&&n>=f)}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 i=0;i<n.value.length;i++){const s=t.data[n.value[i]];s.labels.length&&(this.brushIdx.start=0,this.brushIdx.end=s.labels.length-1)}}updateEvChartCloneData(t,n,i,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(i),this.setBrushIdx(t,n)}setZoomAreaMemory(t,n,i){if(t<0||n<=0)return;const{previous:s,current:l,latest:a}=this.zoomAreaMemory,r=l.pop(),{bufferMemoryCnt:c}=this.evChartZoomOptions;i?(s.length>=c&&s.splice(0,s.length-c+1),this.zoomAreaMemory[i].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,i,s,l){const{chartRange:a,exceptAxesYChartWidth:r,exceptAxesXChartHeight:c}=i;let d=0,h=s,u=l-s,f=l,p=1;const g=.0015;let m=.5;const y=.1,C=.05,b=50,w=Math.ceil(b*(s/r)),T=Math.ceil(b*((r-l)/r)),k=M=>(n.clearRect(0,0,r,c),h<=0&&u>=r?(t.style.opacity="initial",M(!0)):(m>=y&&(t.style.opacity=m,m-=C),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,u,c),n.drawImage(t,a.x1+l,a.y1,r,c,f,0,r,c),p-=g,d-=w,h-=w,u+=w+T,f+=T,requestAnimationFrame(()=>k(M))));return new Promise(M=>k(M))}setIconStyle(t){const n=(i,s)=>{s?this.iconStyle(i,"enable"):this.iconStyle(i,"disable")};if(t&&this.dragZoomIcon.classList.contains("active")){const{previous:i,latest:s}=this.zoomAreaMemory;n(this.previousIcon,i.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[i,s]=n==="enable"?[1,"initial"]:[.5,"none"];t.style.opacity=i,t.style.pointerEvents=s}initZoom(){if(!this.isAnimationFinish)return;const[t,n]=this.zoomAreaMemory.current[0],i=this.cloneLabelsLastIdx;(t!==0||n!==i)&&(this.isUseToolbar=!0,this.executeZoom(0,i),this.setZoomAreaMemory(0,i))}}const QC={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",external:!1,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,displayOverflow:!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:!0,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,virtualScroll:{use:"auto",threshold:50,estimatedRowHeight:28,overscan:5}},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"},workerRender:!1,shallowDataWatch:!1,shallowOptionsWatch:!1},$C={series:{},groups:[],labels:[],data:{}},qC=e=>_g({...e},$C),e1=e=>e instanceof Date||e!==null&&typeof e=="object"&&typeof e.toDate=="function"&&typeof e.format=="function",Jo=e=>or(e,function t(n){if(e1(n))return n;if(o.isReactive(n))return or(o.toRaw(n),t)}),t1=()=>{let e=null;const t=200;return{clickEventCallback:s=>{e&&(clearTimeout(e),e=null),e=setTimeout(()=>{s(),e=null},t)},dblClickEventCallback:s=>{e&&(clearTimeout(e),e=null),s()}}},qr=(e,t)=>{var p;const n=o.getCurrentInstance(),{props:i,emit:s}=n,l=g=>{const m=He({},g,QC);return(g.type==="scatter"||g.type==="heatMap")&&!(g!=null&&g.tooltip)&&(m.tooltip.use=!1),g.type==="pie"&&!(g!=null&&g.padding)&&(m.padding={top:2,right:2,left:2,bottom:4}),m},a=qC,r=Ze(i.selectedItem),c=Ze(i.selectedLabel??(e==null?void 0:e.value)),d=Ze(i.selectedSeries),{clickEventCallback:h,dblClickEventCallback:u}=t1(),f={click:async g=>{await o.nextTick(),h(()=>{const{seriesId:m,dataIndex:y,eventTarget:C,targetAxis:b}=(g==null?void 0:g.selected)??{},{eventTarget:w}=(g==null?void 0:g.deselected)??{};switch(C){case"item":{m!==null?(s("update:selectedItem",{seriesID:m,dataIndex:y}),w==="label"&&s("update:selectedLabel",{dataIndex:[]})):s("update:selectedItem",null);break}case"label":{e!=null&&e.value?e.value.dataIndex=y:(s("update:selectedLabel",{dataIndex:y,targetAxis:b}),w==="item"&&s("update:selectedItem",null));break}case"series":{s("update:selectedSeries",{seriesId:m});break}}s("click",g)})},"dbl-click":async g=>{await o.nextTick(),u(()=>{const{eventTarget:m}=g;switch(m){case"series":{s("update:selectedSeries",{seriesId:g.seriesId?[g.seriesId]:[]});break}}s("dbl-click",g)})},"drag-select":async g=>{await o.nextTick(),s("drag-select",g)},"mouse-move":async g=>{t!=null&&t.value&&(t.value=g.hoveredLabel),await o.nextTick(),s("mouse-move",g)},"mouse-leave":()=>{t!=null&&t.value&&(t.value.label=null)},"click-legend":async g=>{await o.nextTick(),s("click-legend",g)},"update:legendData":async g=>{await o.nextTick(),s("update:legendData",g)},"axes-scale-change":g=>{s("axes-scale-change",g)}};return(p=n.vnode.props)!=null&&p.onAxesDataMaxChange&&(f["axes-data-max-change"]=g=>{s("axes-data-max-change",g)}),{eventListeners:f,selectItemInfo:r,selectLabelInfo:c,selectSeriesInfo:d,getNormalizedData:a,getNormalizedOptions:l}},ec=e=>{const t=o.ref(),n=o.computed(()=>{const i=s=>{let l;return s?l=s.unit?s.value+s.unit:`${s.value}px`:l=void 0,l};return{width:i(ra(e.width)),height:i(ra(e.height))}});return{wrapper:t,wrapperStyle:n}},tc=(e,{wrapper:t,evChartGroupRef:n},i,s)=>{const{props:l,emit:a}=o.getCurrentInstance(),r=o.ref(!1),c=o.ref(!1),d=o.ref(!0),h=o.ref(),u=o.reactive({zoom:e.zoom}),f=o.reactive({start:0,end:-1,isUseButton:!1,isUseScroll:!1});let p=null;const g=o.reactive({dom:[],props:{data:[],options:[]}}),m=o.reactive({data:null,options:null}),y=o.ref([]),C=x=>{x.data.length&&x.range&&c.value&&p.dragZoom(x)},b=()=>{g.props.options.forEach((x,I)=>{if(x.zoom={...x.zoom,use:c.value,getRangeInfo:C},c.value)x.dragSelection={...x.dragSelection,use:!0,keepDisplay:!1};else{const{use:L,keepDisplay:V}=m.options[I].dragSelection??{};x.dragSelection={use:!!L,keepDisplay:!!V}}})},w=()=>{if(n!=null&&n.value?(g.dom=n.value.querySelectorAll(".ev-chart-container"),g.dom.length&&s.value.forEach(({data:x,options:I},L)=>{x.chartIdx=L,g.props.data.push(x),g.props.options.push(I),y.value.push(L)})):(g.dom=[t.value.querySelector(".ev-chart-container")],g.props.data.push(l.data),g.props.options.push(l.options)),g.props.data.length){m.data=Ze(g.props.data),m.options=Ze(g.props.options);const x={updateZoomStartIdx:I=>a("update:zoomStartIdx",I),updateZoomEndIdx:I=>a("update:zoomEndIdx",I)};p=new jC(g,m,u,h.value,r,f,x)}},T=x=>{m.data[0].labels.length<=1||(c.value=!c.value,x?x.classList.toggle("active"):h.value.querySelector(".dragZoom").classList.toggle("active"),b(),p.setIconStyle(c.value),p.setEventListener(c.value))},k=(x,I)=>{if(p.isAnimationFinish)switch(I){case"dragZoom":T(x.target);break;case"reset":p.initZoom();break;case"previous":case"latest":p.clickMoveZoomArea(I);break}};o.onUpdated(()=>{p&&h.value&&p.setIcon(h.value)});const M=x=>{!_e(x.zoom,u.zoom)&&(u.zoom=x.zoom,p?(!u.zoom.toolbar.show&&c.value&&T(),p.setEvChartZoomOptions(u.zoom)):u.zoom.toolbar.show&&!n&&w())},Z=x=>{d.value?(r.value||(m.data=n?Jo(x):[Jo(x)],u.zoom.keepZoomStatus?d.value=!1:(c.value=!1,b()),p&&p.updateEvChartCloneData(m,y,c.value,u.zoom.keepZoomStatus)),r.value=!1):d.value=!0},S=(x,I)=>{if(p.isUseToolbar){p.isUseToolbar=!1;return}c.value&&(p.executeZoom(x,I),p.setZoomAreaMemory(x,I))};return o.watch(()=>[f.start,f.end],([x,I],[L])=>{if(i!=null&&i.value)if(typeof i.value.dataIndex=="number")x>=(L??0)?i.value.dataIndex-=x-(L??0):i.value.dataIndex+=L-x;else for(let V=0;V<i.value.dataIndex.length;V++)x>=(L??0)?i.value.dataIndex[V]-=x-(L??0):i.value.dataIndex[V]+=L-x;(f.isUseButton||f.isUseScroll)&&p.executeZoom(x,I)}),o.watch(()=>[f.isUseButton,f.isUseScroll],([x,I],[L,V])=>{L&&!x?p.setZoomAreaMemory(f.start,f.end):V&&!I&&(p.zoomAreaMemory.current[0]=[f.start,f.end])}),{evChartZoomOptions:u,evChartInfo:g,evChartToolbarRef:h,evChartClone:m,brushIdx:f,createEvChartZoom:w,setOptionsForUseZoom:M,setDataForUseZoom:Z,controlZoomIdx:S,onClickToolbar:k}},n1={name:"EvChart",components:{EvChartToolbar:$r},directives:{resize:En},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},legendData:{type:Array,default:()=>[]}},emits:["click","dbl-click","drag-select","mouse-move","update:selectedItem","update:selectedLabel","update:selectedSeries","update:zoomStartIdx","update:zoomEndIdx","update:realTimeScatterReset","click-legend","update:legendData","axes-scale-change","axes-data-max-change"],setup(e,{emit:t}){let n=null;const i=o.ref(!1),s=o.inject("isChartGroup",!1),l=o.inject("brushSeries",{list:[],chartIdx:null}),a=o.inject("groupSelectedLabel",null),r=o.inject("groupHoveredLabel",null),c=o.inject("brushIdx",{start:0,end:-1}),d=o.inject("evChartPropsInGroup",[]),h=o.inject("groupInteraction",null),{eventListeners:u,selectItemInfo:f,selectLabelInfo:p,selectSeriesInfo:g,getNormalizedData:m,getNormalizedOptions:y}=qr(a,r),C=m(e.data),b=y(e.options),w=o.computed(()=>e.selectedLabel),T=o.computed(()=>e.selectedItem),{wrapper:k,wrapperStyle:M}=ec(b),{evChartZoomOptions:Z,evChartToolbarRef:S,createEvChartZoom:x,setOptionsForUseZoom:I,setDataForUseZoom:L,controlZoomIdx:V,onClickToolbar:R}=s?{}:tc(b,{wrapper:k,evChartGroupRef:null},e.selectedLabel?w:T,d),E=()=>typeof performance<"u"?performance.now():Date.now();let G=null,v=null;const X=B=>{var ee;G?(B.updateSeries&&(G.updateSeries=!0),B.updateData&&(G.updateData=!0),B.updateLegend&&(G.updateLegend=!0),B.updateTooltip&&(G.updateTooltip=!0),(ee=B.updateSelTip)!=null&&ee.update&&(G.updateSelTip??(G.updateSelTip={}),G.updateSelTip.update=!0)):G={...B};const z=()=>{const te=((h==null?void 0:h.deferUntil)??0)-E();if(te>0){v=setTimeout(z,te);return}G&&n&&n.update(G),G=null,v=null};clearTimeout(v);const F=E(),Q=(h==null?void 0:h.deferUntil)??0,U=Q>F?Q-F:0;v=setTimeout(z,U)},W=()=>{var F;let B;b.selectLabel.use?B=p:b.selectSeries.use&&(B=g);const z=(F=e.options.realTimeScatter)!=null&&F.use?{...e.data,groups:[],labels:[]}:C;n=new ms(k.value,z,b,u,f,B,l)},N=()=>{n&&(n.init(),!s&&b.zoom.toolbar.show&&x(),b.legend.show&&b.legend.external&&n.emitLegendData())};o.watch(()=>e.options,B=>{var ee,j;const z=y(B),F=((j=(ee=n.options)==null?void 0:ee.legend)==null?void 0:j.show)??!1,Q=!_e(z.legend.table,n.options.legend.table),U=z.tooltip.use&&!_e(z.tooltip,n.options.tooltip);n.options=z,X({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1},updateLegend:Q,updateTooltip:U}),z.legend.show&&z.legend.external&&!F&&n.emitLegendData(),s||I(z)},{deep:!b.shallowOptionsWatch,flush:"post"}),o.watch(()=>e.data,B=>{var j,te;const z=(j=e.options.realTimeScatter)!=null&&j.use?{...B,groups:[],labels:[]}:m(B),F=!_e(z.series,n.data.series),Q=!_e(z.groups,n.data.groups),U=F||Q||e.options.type==="heatMap",ee=F||Q||!_e(z.labels,n.data.labels)||!_e(z.data,n.data.data);n.data=(te=e.options.realTimeScatter)!=null&&te.use?z:Jo(z),X({updateSeries:U,updateSelTip:{update:!0,keepDomain:!1},updateData:ee}),!s&&ee&&L(z)},{deep:!b.shallowDataWatch,flush:"post"}),s&&!(a!=null&&a.value)&&o.watch(()=>c.start,(B,z)=>{if(w!=null&&w.value)for(let F=0;F<w.value.dataIndex.length;F++)B>=(z??0)?w.value.dataIndex[F]-=B-(z??0):w.value.dataIndex[F]+=z-B;else T!=null&&T.value&&(B>=(z??0)?T.value.dataIndex-=B-(z??0):T.value.dataIndex+=z-B)}),o.watch(()=>T.value,B=>{const z=e.options.type;n.selectItemByData(B,z)},{deep:!0,flush:"post"}),o.watch(()=>(a==null?void 0:a.value)??w.value,B=>{B!=null&&B.dataIndex&&n.selectLabelByData(B.dataIndex,B==null?void 0:B.targetAxis)},{deep:!0,flush:"post"}),o.watch(()=>e.selectedSeries,B=>{var z;(z=b.selectSeries)!=null&&z.use?B.seriesId&&n.selectSeriesByData(B.seriesId):console.warn("[EVUI][Chart] selectSeries.use is false, so selectedSeries is not working")},{deep:!0,flush:"post"}),s||o.watch(()=>[e.zoomStartIdx,e.zoomEndIdx],([B,z])=>{V(B,z)}),o.watch(()=>e.realTimeScatterReset,B=>{B&&(Object.keys(n.dataSet??{}).forEach(z=>{n.dataSet[z]&&(n.dataSet[z].dataGroup=[])}),t("update:realTimeScatterReset",!1))}),o.watch(()=>{var B;return(B=e.options.realTimeScatter)==null?void 0:B.use},B=>{n.options.realTimeScatter.use=B??!1,n.update({updateSeries:!0,updateSelTip:{update:!1,keepDomain:!1},updateData:!1})}),o.watch(()=>r==null?void 0:r.value,B=>{B&&e.options.syncHover!==!1&&(B.label==null?n.overlayClear():n.drawSyncedIndicator(B))},{deep:!0,flush:"post"}),o.onMounted(async()=>{d!=null&&d.value&&d.value.push(e),await W(),await N(),i.value=!0}),o.onBeforeUnmount(()=>{var B;clearTimeout(v),G=null,v=null,n&&"destroy"in n&&n.destroy(),(B=d==null?void 0:d.value)!=null&&B.length&&(d.value.length=0),i.value=!1}),o.onDeactivated(()=>{n&&"hideTooltip"in n&&n.hideTooltip()});const P=B=>{n==null||n.toggleSeries(B)},D=B=>{n==null||n.highlightSeries(B)},O=()=>{n==null||n.unhighlightSeries()},Y=()=>{n&&"update"in n&&n.update({updateSeries:!0,updateSelTip:{update:!0,keepDomain:!1}})},H=es(()=>{n&&"resize"in n&&n.resize()},e.resizeTimeout);return o.onActivated(()=>{i.value&&H()}),{wrapper:k,wrapperStyle:M,onResize:H,redraw:Y,toggleSeries:P,highlightSeries:D,unhighlightSeries:O,evChartToolbarRef:S,injectIsChartGroup:s,onClickToolbar:R,normalizedOptions:b,zoomOptions:o.toRef(Z??{zoom:{}},"zoom")}}},i1={key:0,ref:"evChartToolbarRef"};function s1(e,t,n,i,s,l){var c;const a=o.resolveComponent("ev-chart-toolbar"),r=o.resolveDirective("resize");return o.openBlock(),o.createElementBlock(o.Fragment,null,[(c=i.zoomOptions.toolbar)!=null&&c.show&&!i.injectIsChartGroup?(o.openBlock(),o.createElementBlock("div",i1,[o.createVNode(a,{toolbar:i.zoomOptions.toolbar,onOnClickToolbar:i.onClickToolbar},null,8,["toolbar","onOnClickToolbar"])],512)):o.createCommentVNode("",!0),o.withDirectives(o.createElementVNode("div",{ref:"wrapper",style:o.normalizeStyle(i.wrapperStyle),class:"ev-chart"},null,4),[[r,i.onResize]])],64)}const bi=de(n1,[["render",s1]]);bi.install=e=>{e.component(bi.name,bi)};const o1={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"}}}}},l1=()=>{const e=o.ref(!1),t=o.ref(),n=o.ref([]),i=o.reactive({list:[],chartIdx:null});return{getNormalizedOptions:a=>He({},a,o1),isExecuteZoom:e,brushSeries:i,evChartGroupRef:t,evChartPropsInGroup:n,groupInteraction:{deferUntil:0}}},a1={name:"EvChartGroup",components:{evChartToolbar:$r},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:i,brushSeries:s,evChartGroupRef:l,evChartPropsInGroup:a,groupInteraction:r}=l1(),c=n(e.options);o.provide("isExecuteZoom",i),o.provide("isChartGroup",!0),o.provide("brushSeries",s),o.provide("evChartPropsInGroup",a),o.provide("groupInteraction",r);const d=2e3,h=800,u=()=>typeof performance<"u"?performance.now():Date.now(),f=(x=h)=>{const I=Number.isFinite(x)?Math.min(Math.max(x,0),d):h,L=u();r.deferUntil=Math.min(Math.max(r.deferUntil,L+I),L+d)};o.provide("deferPollingRedraw",f);const p=o.computed({get:()=>e.groupSelectedLabel,set:x=>t("update:groupSelectedLabel",x)});o.provide("groupSelectedLabel",p);const g=o.ref(null);o.provide("groupHoveredLabel",g),o.watch(()=>e.options.syncHover,x=>{x?g.value={label:"",horizontal:!1}:g.value=null},{immediate:!0});const{evChartZoomOptions:m,evChartInfo:y,evChartToolbarRef:C,evChartClone:b,brushIdx:w,createEvChartZoom:T,setOptionsForUseZoom:k,setDataForUseZoom:M,controlZoomIdx:Z,onClickToolbar:S}=tc(c,{wrapper:null,evChartGroupRef:l},p,a);return o.provide("evChartClone",b),o.provide("evChartInfo",y),o.provide("brushIdx",w),o.onMounted(()=>{T()}),o.watch(()=>y.props.data,x=>{M(x)},{deep:!0}),o.watch(()=>e.options,x=>{const I=n(x);k(I)},{deep:!0}),o.watch(()=>[e.zoomStartIdx,e.zoomEndIdx],([x,I])=>{w.isUseButton||w.isUseScroll||Z(x,I)}),{evChartGroupRef:l,evChartToolbarRef:C,zoomOptions:o.toRef(m,"zoom"),onClickToolbar:S,deferPollingRedraw:f}}},r1={key:0,ref:"evChartToolbarRef"},c1={ref:"evChartGroupRef",class:"ev-chart-group__wrapper"};function d1(e,t,n,i,s,l){const a=o.resolveComponent("ev-chart-toolbar");return o.openBlock(),o.createElementBlock(o.Fragment,null,[i.zoomOptions.toolbar.show?(o.openBlock(),o.createElementBlock("div",r1,[o.createVNode(a,{toolbar:i.zoomOptions.toolbar,onOnClickToolbar:i.onClickToolbar},null,8,["toolbar","onOnClickToolbar"])],512)):o.createCommentVNode("",!0),o.createElementVNode("div",c1,[o.renderSlot(e.$slots,"default",{},void 0,!0)],512)],64)}const yi=de(a1,[["render",d1],["__scopeId","data-v-dda98b9e"]]);yi.install=e=>{e.component(yi.name,yi)};const Me={WHEEL:{UP:"MOVEUP_WHEEL",DOWN:"MOVEDOWN_WHEEL"},GRAB:{UP:"MOVEUP_GRAB",DOWN:"MOVEDOWN_GRAB"},BUTTON:{INCREASE:"INCREASE",DECREASE:"DECREASE"}},Be={LEFT:"leftX",RIGHT:"rightX"};let h1=class{constructor(t,n,i,s,l){this.evChart=t,this.evChartBrushOptions=i,this.evChartBrushRef=l,this.evChartData=n,this.brushIdx=s,i.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 i=this.evChartBrushRef.value.querySelector(".brush-canvas");if(i)this.drawBrushRect({brushCanvas:i,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:i,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 u=this.setBrushXAndWidth(h,l,i,s);h&&u&&this.drawBrush(h,u,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,i,s){const{brushButtonWidth:l,brushCanvasWidth:a,axesXInterval:r,pixelRatio:c}=t;!i&&this.debounceBrushIdx&&(this.debounceBrushIdx.start=this.brushIdx.start,this.debounceBrushIdx.end=this.brushIdx.end);const d=this.debounceBrushIdx??this.brushIdx;switch(s){case Me.BUTTON.INCREASE:case Me.BUTTON.DECREASE:this.brushRectWidth=a*c,this.curBrushButtonType===Be.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===Be.RIGHT&&(this.brushRectWidth=n-this.beforeBrushRectX,this.brushRectWidth<=l?this.brushRectWidth=l:(this.brushRectX=this.beforeBrushRectX,this.beforeBrushRectWidth=this.brushRectWidth+this.brushRectX));break;case Me.GRAB.UP:case Me.GRAB.DOWN:this.brushRectX<=0&&s===Me.GRAB.DOWN||this.brushRectX+this.brushRectWidth>=a&&s===Me.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}const h=a*c;return s===Me.BUTTON.INCREASE||s===Me.BUTTON.DECREASE?(this.brushRectX<0&&(this.brushRectWidth+=this.brushRectX,this.brushRectX=0),this.brushRectX+this.brushRectWidth>h&&(this.brushRectWidth=h-this.brushRectX)):this.brushRectX<0?this.brushRectX=0:this.brushRectX+this.brushRectWidth>h&&(this.brushRectX=h-this.brushRectWidth),this.brushRectWidth>h&&(this.brushRectWidth=h),{brushRectX:this.brushRectX,brushRectWidth:this.brushRectWidth}}drawBrush(t,n,i,s){const{brushButtonWidth:l,brushCanvasHeight:a,brushCanvasWidth:r,axesXInterval:c,pixelRatio:d}=t,{brushRectX:h,brushRectWidth:u}=n,{height:f,selection:{fillColor:p,opacity:g}}=this.evChartBrushOptions.value,m=f-i.y1,y=h,C=h+u;s.style.position||(s.style.position="absolute",s.style.top=`${i.y1}px`,s.style.left=`${i.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 b=s.getContext("2d");b.clearRect(0,0,r*d,a*d),b.fillStyle=p,b.globalAlpha=g,b.fillRect(h,0,u,m),b.fillRect(y,0,l,m),b.fillRect(C-l,0,l,m),this.brushPosInfo={leftX:y/d,rightX:C/d,buttonWidth:l,axesXInterval:c,...t,...n}}getCanvasOffsetX(t){const n=this.brushCanvas.getBoundingClientRect();return t.clientX-n.left}addEvent(){let t;const n=l=>{if(this.isDragMode){const a=this.getCanvasOffsetX(l);this.mouseDownAndMove({offsetX:a})}};this.onDocumentMouseMove=ns(n,5),this.onDocumentMouseUp=()=>{document.removeEventListener("mousemove",this.onDocumentMouseMove),document.removeEventListener("mouseup",this.onDocumentMouseUp),this.initEventState()},this.onMouseDown=l=>{l.preventDefault(),t.isInsideButton?this.isDragMode="button":t.isInsideBrush?(this.clickBrushInsideX=l.offsetX,this.isDragMode="grab"):t.isOutsideBrush&&this.teleportBrush(l),this.isDragMode&&(document.addEventListener("mousemove",this.onDocumentMouseMove),document.addEventListener("mouseup",this.onDocumentMouseUp))};const i=l=>{this.isDragMode||(t=this.getMousePosition(l),this.changeCursor(t))};this.onMouseMove=ns(i,5),this.onWheel=l=>{l.preventDefault();const a=l.deltaY>0?Me.WHEEL.DOWN:Me.WHEEL.UP;this.updateBrushIdx(a),this.debounceBrushIdx&&this.drawBrushRect({brushCanvas:this.brushCanvas,isDebounce:!0,mode:a}),this.brushIdx.isUseScroll=!0},this.onMouseUp=()=>{this.initEventState()};const s=()=>{this.initEventState()};this.onWheelDebounce=es(s,100),this.setEventListener("addEventListener")}getMousePosition(t){const n=d=>Math.abs(this.brushPosInfo[d]-t.offsetX),i=n(Be.RIGHT)>n(Be.LEFT)?Be.LEFT:Be.RIGHT,s=d=>t.offsetX>this.brushPosInfo[d],l=d=>t.offsetX<this.brushPosInfo[d],a=l(Be.LEFT)||s(Be.RIGHT),r=s(Be.LEFT)&&l(Be.RIGHT),c=t.offsetX+this.brushPosInfo.buttonWidth>=this.brushPosInfo[i]&&t.offsetX-this.brushPosInfo.buttonWidth<=this.brushPosInfo[i];return this.curBrushButtonType=c&&i,{isInsideButton:c,isInsideBrush:r,isOutsideBrush:a}}destroy(){if(this.brushCanvas&&(this.setEventListener("removeEventListener"),document.removeEventListener("mousemove",this.onDocumentMouseMove),document.removeEventListener("mouseup",this.onDocumentMouseUp),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.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,i=(n.end-n.start)/2;let s,l,a;i>.5?(n.end-n.start)%2===0?(a=Math.round(t.offsetX/this.brushPosInfo.axesXInterval),s=Math.ceil(i),l=Math.floor(i)):(a=Math.ceil(t.offsetX/this.brushPosInfo.axesXInterval),s=Math.ceil(i),l=Math.floor(i)):(a=Math.floor(t.offsetX/this.brushPosInfo.axesXInterval),t.offsetX-a*this.brushPosInfo.axesXInterval>this.brushPosInfo.axesXInterval/2?(s=Math.floor(i),l=Math.ceil(i)):(s=Math.ceil(i),l=Math.floor(i),i<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 i;t.offsetX>this.beforeMouseXPos?this.isDragMode==="grab"?this.clickBrushInsideX<t.offsetX-n&&(i=Me.GRAB.UP,this.isUseBrushGrab=!0,this.brushIdx.isUseScroll=!0,this.clickBrushInsideX=t.offsetX+n):t.offsetX-this.brushPosInfo[this.curBrushButtonType]>n&&(i=this.curBrushButtonType===Be.LEFT?Me.BUTTON.DECREASE:Me.BUTTON.INCREASE,this.brushIdx.isUseButton=!0):t.offsetX<this.beforeMouseXPos&&(this.isDragMode==="grab"?this.clickBrushInsideX>t.offsetX+n&&(i=Me.GRAB.DOWN,this.isUseBrushGrab=!0,this.brushIdx.isUseScroll=!0,this.clickBrushInsideX=t.offsetX-n):this.brushPosInfo[this.curBrushButtonType]-t.offsetX>n&&(i=this.curBrushButtonType===Be.LEFT?Me.BUTTON.INCREASE:Me.BUTTON.DECREASE,this.brushIdx.isUseButton=!0)),this.debounceBrushIdx?this.drawBrushRect({brushCanvas:this.brushCanvas,isDebounce:!0,mode:i,offsetX:t.offsetX}):this.updateBrushIdx(i),this.beforeMouseXPos=t.offsetX}updateBrushIdx(t){const n=this.debounceBrushIdx??this.brushIdx;switch(t){case Me.WHEEL.UP:case Me.GRAB.UP:if(n.end>=this.labelEndIdx)return;n.start+=1,n.end+=1;break;case Me.WHEEL.DOWN:case Me.GRAB.DOWN:if(n.start<=0)return;n.start-=1,n.end-=1;break;case Me.BUTTON.INCREASE:if(this.curBrushButtonType===Be.LEFT){if(!n.start)return;n.start-=1}else{if(n.end===this.labelEndIdx)return;n.end+=1}break;case Me.BUTTON.DECREASE:if(n.start===n.end-1)return;this.curBrushButtonType===Be.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===Be.LEFT?(s=Math.round(s),l=this.brushIdx.end,s===l&&(s-=1)):this.curBrushButtonType===Be.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:i}=t();this.brushIdx.start===n&&this.brushIdx.end===i&&this.drawBrushRect({brushCanvas:this.brushCanvas}),this.brushIdx.start=n??this.debounceBrushIdx.start,this.brushIdx.end=i??this.debounceBrushIdx.end}initEventState(){if(this.isCleaningUp)return;this.isCleaningUp=!0,new Promise(n=>{this.updateBrushIdxUseXPos(),n(!0)}).then(n=>{n&&(this.clickBrushInsideX=null,this.isDragMode=null,this.beforeMouseXPos=null,this.curBrushButtonType=null,this.isUseBrushGrab=!1,this.offsetXAndRectXInterval=null,this.brushIdx.isUseButton=!1,this.brushIdx.isUseScroll=!1),this.isCleaningUp=!1})}};const u1={show:!0,useDebounce:!0,chartIdx:0,height:100,showLabel:!1,selection:{fillColor:"#38ACEC",opacity:.65},useWheelMove:!0},f1=()=>({getNormalizedBrushOptions:t=>He({},t,u1)}),m1={name:"EvChartBrush",directives:{resize:En},props:{options:{type:Object,default:()=>({})}},setup(e){let t=null,n=null;const i=o.ref(!1),s=o.inject("evChartClone",{data:[]}),l=o.inject("evChartInfo",{props:{options:[]}}),a=o.inject("brushIdx",{start:0,end:-1,isUseButton:!1,isUseScroll:!1}),r=o.inject("brushSeries",{list:[],chartIdx:null}),{getNormalizedBrushOptions:c}=f1(),d=o.computed(()=>c(e.options)),{eventListeners:h,selectItemInfo:u,selectLabelInfo:f,selectSeriesInfo:p,getNormalizedData:g,getNormalizedOptions:m}=qr(),y=o.computed(()=>g((s.data??[])[d.value.chartIdx])),C=o.computed(()=>{var L,V;const x=l.props.options[d.value.chartIdx],I={...x,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:[{...(L=x==null?void 0:x.axesX)==null?void 0:L[0],title:{use:!1}}],axesY:[{...(V=x==null?void 0:x.axesY)==null?void 0:V[0],title:{use:!1}}]};return m(I)}),{wrapper:b,wrapperStyle:w}=ec(C.value);o.watch(()=>r.list,()=>{b.value&&r.chartIdx===d.value.chartIdx&&(t.seriesList=r.list[d.value.chartIdx],t.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1}}))}),o.watch(C,(x,I)=>{var L;x.brush.chartIdx<=((L=s.data)==null?void 0:L.length)-1?n&&!_e(I.brush,x.brush)?n.removeBrushWrapper():t&&!_e(x,I)&&(t.options=Ze(x),t.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1}})):(t.data=Ze(y.value),t.update({updateSeries:!0,updateSelTip:{update:!1,keepDomain:!1},updateData:!1}),n.removeBrushCanvas())}),o.watch(()=>s.data,x=>{if(t){const I=x[d.value.chartIdx];if(I){const L=!_e(I.series,t.data.series),V=r.list[d.value.chartIdx];typeof V=="object"&&Object.keys(V).length&&Object.keys(I.series).forEach(R=>{var E;"show"in I.series[R]||(I.series[R].show=((E=V[R])==null?void 0:E.show)??!0)}),t.data=Ze(g(I)),t.update({updateSeries:L,updateSelTip:{update:!1,keepDomain:!1},updateData:!1})}}});const T=()=>{let x;C.value.selectLabel.use?x=f:C.value.selectSeries.use&&(x=p),t=new ms(b.value,y.value,C.value,h,u,x)},k=()=>{n=new h1(t,y,d,a,b)},M=()=>{t&&t.init()},Z=x=>{n&&n.init(x)};o.watch(()=>[a.start,a.end],()=>{var x;b.value&&d.value.chartIdx<=((x=s.data)==null?void 0:x.length)-1&&Z()}),o.onMounted(async()=>{d.value.show&&(await T(),await M(),k(),Z()),i.value=!0}),o.onUpdated(async()=>{var x;if(d.value.show&&d.value.chartIdx<=((x=s.data)==null?void 0:x.length)-1){const I=r.list[d.value.chartIdx];typeof I=="object"&&Object.keys(I).length&&Object.keys(y.value.series).forEach(L=>{var V;"show"in y.value.series[L]||(y.value.series[L].show=((V=I[L])==null?void 0:V.show)??!0)}),await T(),await M(),k(),Z()}}),o.onBeforeUnmount(()=>{t&&"destroy"in t&&t.destroy(),n&&n.destroy(),i.value=!1}),o.onDeactivated(()=>{t&&"hideTooltip"in t&&t.hideTooltip()});const S=es(()=>{t&&"resize"in t&&new Promise(I=>t.resize(I)).then(I=>{I&&Z(I)})},0);return o.onActivated(()=>{i.value&&S()}),{evChartBrushOptions:d,evChartBrushRef:b,evChartBrushStyle:w,onResize:S}}};function p1(e,t,n,i,s,l){const a=o.resolveDirective("resize");return i.evChartBrushOptions.show?o.withDirectives((o.openBlock(),o.createElementBlock("div",{key:0,ref:"evChartBrushRef",style:o.normalizeStyle(i.evChartBrushStyle),class:"ev-chart-brush"},null,4)),[[a,i.onResize]]):o.createCommentVNode("",!0)}const xi=de(m1,[["render",p1]]);xi.install=e=>{e.component(xi.name,xi)};const g1={name:"TreeGridNode",components:{GridOptionButton:zo},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=(b,w)=>{t("check-tree-data",b,w)},i=b=>{t("expand-tree-data",b)},s=(b,w)=>{t("click-tree-data",b,w)},l=(b,w)=>{t("dbl-click-tree-data",b,w)},a=b=>{t("context-menu",b)},r=b=>{const w=e.expandIcon?e.expandIcon:"",T=e.expandIcon?e.collapseIcon:"";return b.expand?T:w},c=o.computed(()=>e.nodeData||{}),d=o.computed(()=>e.parentIcon||"tree-parent-icon"),h=o.computed(()=>e.childIcon||"tree-child-icon"),u=o.computed(()=>d.value!=="none"||h.value!=="none"),f=o.computed(()=>{const b=e.orderedColumns||[],w=b.findIndex(k=>k.expandColumn&&!k.hide&&!k.hiddenDisplay);if(w!==-1)return w;const T=b.findIndex(k=>!k.hide&&!k.hiddenDisplay);return T!==-1?T:0}),p=b=>({row:!0,"tree-row":!0,[`tree-row--level-${b==null?void 0:b.level}`]:!0,highlight:(b==null?void 0:b.index)===e.highlightIndex,selected:b.selected,"non-border":!!e.borderStyle&&e.borderStyle!=="rows"}),g=o.computed(()=>({cell:!0,"row-checkbox":!0,"non-border":!!e.borderStyle}));return{parentIconMV:d,childIconMV:h,node:c,isDataIcon:u,checkboxClass:g,expandColumnIdx:f,onCheck:n,onExpand:i,onClick:s,onDblClick:l,onContextMenu:a,expandIconClasses:r,getRowClass:p,getColumnClass:(b,w)=>({cell:!0,"tree-td":w===0,[b.type]:b.type,[b.align]:b.align,[b.field]:b.field,"non-border":!!e.borderStyle}),getColumnStyle:(b,w)=>({width:`${b.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:b=>({"margin-left":`${b*13}px`})}}},b1=["data-index"],y1=["data-name","data-index"],x1={class:"td-content__wrapper"},S1=["title"],C1={class:"td-content"};function k1(e,t,n,i,s,l){var d;const a=o.resolveComponent("ev-checkbox"),r=o.resolveComponent("ev-icon"),c=o.resolveComponent("grid-option-button");return o.openBlock(),o.createElementBlock("tr",{"data-index":i.node.index,class:o.normalizeClass(i.getRowClass(i.node)),onClick:t[7]||(t[7]=h=>i.onClick(h,i.node)),onDblclick:t[8]||(t[8]=h=>i.onDblClick(h,i.node))},[n.useCheckbox.use?(o.openBlock(),o.createElementBlock("td",{key:0,class:o.normalizeClass(i.checkboxClass),style:o.normalizeStyle({width:`${n.minWidth}px`,height:`${n.rowHeight}px`,"border-right":"1px solid #CFCFCF"})},[o.createVNode(a,{modelValue:i.node.checked,"onUpdate:modelValue":t[0]||(t[0]=h=>i.node.checked=h),disabled:i.node.uncheckable,indeterminate:i.node.indeterminate,class:"row-checkbox-input",onChange:t[1]||(t[1]=h=>i.onCheck(h,i.node))},null,8,["modelValue","disabled","indeterminate"])],6)):o.createCommentVNode("",!0),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(n.orderedColumns,(h,u)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:u},[!h.hide&&!h.hiddenDisplay?(o.openBlock(),o.createElementBlock("td",{key:0,"data-name":h.field,"data-index":i.node.index,class:o.normalizeClass(i.getColumnClass(h,u)),style:o.normalizeStyle(i.getColumnStyle(h,u))},[o.createElementVNode("div",x1,[u===i.expandColumnIdx?(o.openBlock(),o.createElementBlock("span",{key:0,style:o.normalizeStyle(i.getDepthStyle(i.node.level))},null,4)):o.createCommentVNode("",!0),u===i.expandColumnIdx?(o.openBlock(),o.createElementBlock("span",{key:1,class:o.normalizeClass({expand:i.node.expand,"ev-tree-toggle":!0})},[i.node.hasChild?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[i.expandIconClasses(i.node)?(o.openBlock(),o.createBlock(r,{key:0,icon:i.expandIconClasses(i.node),style:{display:"block"},onClick:t[2]||(t[2]=f=>i.onExpand(i.node))},null,8,["icon"])):(o.openBlock(),o.createElementBlock("button",{key:1,class:"tree-expand-icon",onClick:t[3]||(t[3]=o.withModifiers(f=>i.onExpand(i.node),["stop"]))},[...t[9]||(t[9]=[o.createElementVNode("i",null,null,-1)])]))],64)):o.createCommentVNode("",!0)],2)):o.createCommentVNode("",!0),u===i.expandColumnIdx&&i.isDataIcon?(o.openBlock(),o.createElementBlock("span",{key:2,title:i.node[h.field],class:o.normalizeClass({expand:i.node.expand,"ev-tree-toggle":!0})},[o.createElementVNode("span",{class:o.normalizeClass(i.node.hasChild?i.parentIconMV:i.childIconMV)},[...t[10]||(t[10]=[o.createElementVNode("i",null,null,-1)])],2)],10,S1)):o.createCommentVNode("",!0),o.createElementVNode("div",C1,[e.$slots[h.field+"Node"]?o.renderSlot(e.$slots,h.field+"Node",{key:0,item:{data:i.node.data}},void 0,!0):o.createCommentVNode("",!0)])])],14,y1)):o.createCommentVNode("",!0)],64))),128)),(d=n.customContextMenu)!=null&&d.length?(o.openBlock(),o.createElementBlock("td",{key:1,class:o.normalizeClass({"row-contextmenu":!0,"non-border":!!n.borderStyle}),style:o.normalizeStyle({position:"sticky",right:0,width:"30px",height:`${n.rowHeight}px`,"min-width":"30px","line-height":`${n.rowHeight}px`})},[e.$slots.contextmenuIconNode?(o.openBlock(),o.createElementBlock("span",{key:0,class:"row-contextmenu__btn",onClick:[t[4]||(t[4]=h=>i.onContextMenu(h)),t[5]||(t[5]=o.withModifiers((...h)=>n.menuRef.show&&n.menuRef.show(...h),["prevent"]))]},[o.renderSlot(e.$slots,"contextmenuIconNode",{},void 0,!0)])):(o.openBlock(),o.createBlock(c,{key:1,icon:"ev-icon-warning2",class:"row-contextmenu__btn",onClick:[t[6]||(t[6]=h=>i.onContextMenu(h)),o.withModifiers(n.menuRef.show,["prevent"])]},null,8,["onClick"]))],6)):o.createCommentVNode("",!0)],42,b1)}const w1=de(g1,[["render",k1],["__scopeId","data-v-faab3696"]]),I1={name:"EvTreeGridToolbar"},L1={class:"tree-grid-toolbar"};function T1(e,t,n,i,s,l){return o.openBlock(),o.createElementBlock("div",L1,[o.renderSlot(e.$slots,"toolbarWrapper")])}const M1=de(I1,[["render",T1]]),R1=e=>{const{props:t}=o.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),u="Renderer";let f="";if(d.indexOf("_")!==-1){const p=d.split("_");for(let g=0;g<p.length;g++)f+=h(p[g])}else f=h(d);return f+u},getConvertValue:(d,h)=>{let u=d.type==="number"||d.type==="float"?Number(h):h;return d.type==="number"?(u=Qt(h),u=u===!1?h:u):d.type==="float"&&(u=u.toFixed(d.decimal??3).replace(/\B(?=(\d{3})+(?!\d))/g,",")),u},getColumnIndex:d=>t.columns.findIndex(h=>h.field===d),setPixelUnit:d=>{let h=d;const u=h.toString().indexOf("px")>=0,f=h.toString().indexOf("%")>=0;return!u&&!f&&(h=`${h}px`),h},checkHeader:d=>{n.isHeaderChecked=!!d.length&&d.every(u=>u.checked);const h=d.filter(u=>u.uncheckable);if(h.length){const u=d.filter(p=>p.checked),f=d.every(p=>h.includes(p));n.isHeaderChecked=!f&&h.length+u.length===d.length,n.isHeaderUncheckable=f}n.isHeaderIndeterminate=!!d.length&&d.some(u=>u.checked||u.indeterminate)&&!n.isHeaderChecked}}},ps=e=>{const{originColumns:t,filteredColumns:n}=e;return t.map(i=>{const s=n.find(l=>l.index===i.index)??{};return{...i,...s}})},v1=e=>{const{scrollInfo:t,stores:n,elementInfo:i,resizeInfo:s,pageInfo:l,summaryScroll:a,getPagingData:r,updatePagingInfo:c}=e,d=f=>{let p=n.showTreeStore;l.isClientPaging&&(p=r());const g=i.body;if(g){const m=s.rowHeight,y=g.clientHeight>m?Math.ceil(g.clientHeight/m):p.length,C=p.length*m;let b=Math.floor(g.scrollTop/m);b>p.length-1&&(b=0);const w=b+y+1,T=Math.max(b,0),k=w,M=i.table;n.viewStore=p.slice(T,k),t.hasVerticalScrollBar=y<p.length||g.clientHeight<M.clientHeight,t.vScrollTopHeight=T*m,t.vScrollBottomHeight=C-n.viewStore.length*m-t.vScrollTopHeight,f&&l.isInfinite&&t.vScrollBottomHeight===0&&(l.prevPage=l.currentPage,l.currentPage=Math.ceil(k/l.perPage)+1,l.startIndex=k,c({onScrollEnd:!0}))}},h=()=>{const f=i.header,p=i.body,g=i.table;f.scrollLeft=p.scrollLeft,a.value=p.scrollLeft,t.hasHorizontalScrollBar=p.clientWidth<g.clientWidth};return{updateVScroll:d,updateHScroll:h,onScroll:()=>{const f=i.body,p=f.scrollTop,g=f.scrollLeft,m=t.lastScroll.top,y=t.lastScroll.left,C=g!==y;p!==m&&f.clientHeight&&d(!0),C&&h(),t.lastScroll.top=p,t.lastScroll.left=g}}},V1=e=>{const{props:t,emit:n}=o.getCurrentInstance(),{resizeInfo:i,elementInfo:s,checkInfo:l,stores:a,isRenderer:r,updateVScroll:c,updateHScroll:d,contextInfo:h}=e,u=()=>{a.viewStore=a.showTreeStore;const m=a.viewStore;let y=i.columnWidth;i.columnWidth>0&&(y=i.columnWidth),y=i.columnWidth;let C=0;if(i.adjust&&s.body){const b=s.body;let w=b.offsetWidth;const T=b.offsetHeight,k=a.orderedColumns.reduce((M,Z)=>(Z.hide||Z.hiddenDisplay||(Z.width?M.totalWidth+=Z.width:M.emptyCount++),M),{totalWidth:h.customContextMenu.length?30:0,emptyCount:0});if(i.rowHeight*m.length>T-i.scrollWidth&&(w-=i.scrollWidth),l.useCheckbox.use&&(w-=i.minWidth),y=w-k.totalWidth,y>0){const M=k.emptyCount===0?0:Math.floor(y/k.emptyCount);C=y-M*k.emptyCount,y=k.emptyCount!==0?M:y}else y=i.columnWidth;y=y<i.minWidth?i.minWidth:y,i.columnWidth=y}if(a.orderedColumns.forEach(b=>{const w=r(b)?i.rendererMinWidth:i.minWidth;b.width&&b.width<w&&(b.width=w),!b.width&&!b.hide&&(b.width=y)}),C&&a.orderedColumns.length){let b=a.orderedColumns.length-1,w=a.orderedColumns[b];for(;b>0&&w&&(w.hide||w.hiddenDisplay);)b-=1,w=a.orderedColumns[b];w&&(w.width+=C)}i.isResize=!i.isResize},f=()=>{o.nextTick(()=>{var m,y;i.adjust&&a.orderedColumns.forEach(C=>{var w;const b=C;return!((w=t.columns[C.index])!=null&&w.width)&&!b.resized&&(b.width=0),b},void 0),u(),(m=s.body)!=null&&m.clientHeight&&c(),(y=s.body)!=null&&y.clientWidth&&d()})};return{calculatedColumn:u,onResize:f,onShow:m=>{m&&f()},onColumnResize:(m,y)=>{const C=s.header,b=s.body,w=C.getBoundingClientRect().left,T=C.querySelector(`li[data-index="${m}"]`),k=r(a.orderedColumns[m])?i.rendererMinWidth:i.minWidth,M=T.getBoundingClientRect(),Z=b.getBoundingClientRect().right-w,S=s.resizeLine,x=M.left-w+k,I=M.right-w,L=y.clientX,V=M.left-w;b.style.overflow="auto",S.style.left=`${I}px`,i.showResizeLine=!0;const R=G=>{const v=G.clientX-L,X=I+v;let W=Math.max(x,X);W=Math.min(Z,W),S.style.left=`${W}px`},E=()=>{const v=parseInt(S.style.left,10)-V;a.orderedColumns[m]&&(a.orderedColumns[m].width=v,a.orderedColumns[m].resized=!0),i.showResizeLine=!1,document.removeEventListener("mousemove",R),f();const X=ps(a);n("resize-column",{column:a.orderedColumns[m],columns:X}),n("change-column-info",{type:"resize",columns:X})};document.addEventListener("mousemove",R),document.addEventListener("mouseup",E,{once:!0})}}},E1=e=>{const{emit:t}=o.getCurrentInstance(),n=e,i=(r,c)=>{var u;const d=r.target.tagName.toLowerCase();let h={};return r.target.offsetParent&&(d==="td"?h=r.target.dataset:h=((u=r.target.closest("td"))==null?void 0:u.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(u=>u.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",i(r,c)))},100),!0)},onRowDblClick:(r,c)=>{clearTimeout(s),t("dblclick-row",i(r,c))}}},G1=e=>{const{checkInfo:t,stores:n,checkHeader:i,pageInfo:s,getPagingData:l}=e,{emit:a}=o.getCurrentInstance(),r=()=>t.useCheckbox.mode==="each",c=p=>{const g=n.treeStore.findIndex(m=>m.index===p.index);g!==-1&&(n.treeStore[g].checked=p.checked)},d=p=>{r()||p.hasChild&&p.children.forEach(g=>{const m=g;p.checked&&!m.checked&&!m.uncheckable&&t.checkedRows.push(m),p.checked||(t.checkedRows=t.checkedRows.filter(y=>y.index!==m.index)),m.checked=p.checked&&!m.uncheckable,m.hasChild&&d(m)})},h=p=>{if(r())return;const g=p.parent;if(g){const m=g.children.every(C=>C.checked);g.checked=m&&!g.uncheckable;const y=g.children.filter(C=>C.uncheckable);if(y.length){const C=g.children.filter(b=>b.checked);y.length+C.length===g.children.length&&(g.checked=!0)}g.indeterminate=!m&&g.children.some(C=>C.checked||C.indeterminate),g.checked?t.checkedRows.push(g):t.checkedRows=t.checkedRows.filter(C=>C.index!==g.index),g.parent&&h(g)}};return{onCheck:(p,g)=>{let m=n.store;s.isClientPaging&&(m=l());const y=()=>t.useCheckbox.mode==="single",C=()=>{t.isHeaderChecked&&(t.isHeaderChecked=!1)},b=()=>{y()&&t.checkedRows.length>0&&(t.prevCheckedRow.checked=!1,c(t.prevCheckedRow))},w=k=>{if(y()){t.checkedRows=[k];return}d(k),h(k),t.checkedRows.push(k),k.indeterminate=!1},T=k=>{if(y()){t.checkedRows=[];return}t.checkedRows=t.checkedRows.filter(M=>M.index!==k.index)};b(),g.checked?(w(g),i(m)):(C(),T(g),d(g),h(g)),t.prevCheckedRow=g,a("update:checked",t.checkedRows),a("check-row",p,g.index,g)},onCheckAll:p=>{var y;const g=t.isHeaderChecked;let m=(y=n.store)==null?void 0:y.filter(C=>C.isFilter);s.isClientPaging&&(m=l()),m.forEach(C=>{C.checked=g&&!C.uncheckable,C.checked?t.checkedRows.find(b=>b.index===C.index)||t.checkedRows.push(C):t.checkedRows=t.checkedRows.filter(b=>b.index!==C.index),C.indeterminate=!1}),t.isHeaderIndeterminate=!1,a("update:checked",t.checkedRows),a("check-all",p,t.checkedRows)}}},W1=e=>{const{emit:t}=o.getCurrentInstance(),{contextInfo:n,stores:i,selectInfo:s,useGridSetting:l,columnSettingInfo:a,setColumnHidden:r,onSort:c}=e,d=(p=!0)=>{const g=[];if(p&&n.customContextMenu.length){const m=s.selectedRow,y=n.customContextMenu.map(C=>{const b=C;return b.validate&&(b.disabled=!b.validate(b.itemId,m)),b.selectedRow=m??[],b});g.push(...y)}n.contextMenuItems=g};return{setContextMenu:d,onContextMenu:p=>{var y,C;const m=(C=(y=p.target.closest(".row"))==null?void 0:y.dataset)==null?void 0:C.index;if(m){const b=i.viewStore.findIndex(T=>T.index===Number(m)),w=i.viewStore[b];s.selectedRow=[w],d(),t("update:selected",s.selectedRow)}else s.selectedRow=[],d(!1),t("update:selected",[])},onColumnContextMenu:(p,g)=>{var m,y,C,b,w,T;if(p.target.className.includes("column-name")){const k=!!g.sortable;n.columnMenuItems=[{text:((m=n.columnMenuTextInfo)==null?void 0:m.hide)??"Hide",iconClass:"ev-icon-visibility-off",disabled:!l.value||i.orderedColumns.length===1||!!g.fixed,hidden:((y=n.hiddenColumnMenuItem)==null?void 0:y.hide)||!l.value,click:()=>{r(g.field),t("change-column-status",{columns:i.updatedColumns}),t("change-column-info",{type:"display",columns:i.updatedColumns})}},{text:((C=n.columnMenuTextInfo)==null?void 0:C.ascending)??"Ascending",iconClass:"ev-icon-allow2-up",disabled:!k,hidden:(b=n.hiddenColumnMenuItem)==null?void 0:b.ascending,click:()=>c(g,"asc")},{text:((w=n.columnMenuTextInfo)==null?void 0:w.descending)??"Descending",iconClass:"ev-icon-allow2-down",disabled:!k,hidden:(T=n.hiddenColumnMenuItem)==null?void 0:T.descending,click:()=>c(g,"desc")}]}else n.columnMenuItems.length=0},onGridSettingContextMenu:p=>{const{useDefaultColumnSetting:g,columnSettingTextInfo:m}=a,y={text:(m==null?void 0:m.title)??"Column List",isShowMenu:!0,click:()=>{a.isShowColumnSetting=!0,n.isShowMenuOnClick=!0}};n.customGridSettingContextMenu.length&&(n.gridSettingContextMenuItems=[...n.customGridSettingContextMenu]),g&&n.gridSettingContextMenuItems.push(y),n.gridSettingMenu.show(p)}}},Z1=e=>{const{emit:t}=o.getCurrentInstance(),{stores:n,onResize:i}=e,s=()=>{let r=0;const c=[];function d(u){const f={};return Object.keys(u).forEach(p=>{p!=="children"&&(f[p]=u[p])}),f}function h(u){const{node:f,level:p,isShow:g,parent:m,uncheckable:y}=u;f!==null&&typeof f=="object"&&(f.index=r++,f.level=p,Object.hasOwnProperty.call(f,"checked")||(f.checked=!1),Object.hasOwnProperty.call(f,"selected")||(f.selected=!1),Object.hasOwnProperty.call(f,"show")||(f.show=g),Object.hasOwnProperty.call(f,"expand")||(f.expand=!0),Object.hasOwnProperty.call(f,"isFilter")||(f.isFilter=!1),Object.hasOwnProperty.call(f,"uncheckable")||(f.uncheckable=y),Object.hasOwnProperty.call(f,"indeterminate")||(f.indeterminate=!1),Object.hasOwnProperty.call(f,"data")||(f.data=d(f)),c.push(f),Object.hasOwnProperty.call(f,"parent")||(f.parent=m),f.children&&(f.hasChild=!0,f.children.forEach(C=>h({node:C,level:p+1,isShow:f.show&&f.expand,parent:f,uncheckable:f.uncheckable}))))}return n.treeRows.forEach(u=>{h({node:u,level:0,isShow:!0,parent:void 0,uncheckable:!1})}),c},l=(r,c,d)=>{r.forEach(h=>{const u=h;u.show=d&&c?u.isFilter:c,u.hasChild&&l(u.children,u.show&&u.expand,u.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}),i()}}},X1=e=>{const{stores:t,filterInfo:n,pageInfo:i,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(m=>{const y=m;y.parent.show&&y.parent.expand?y.show=!0:y.show=!1,y.isFilter=!0,y.hasChild&&h(y)})};let u=null;return{onSearch:p=>{u&&clearTimeout(u),u=setTimeout(()=>{n.isSearch=!1,n.searchWord=p;const g=t.treeStore;g.forEach(m=>{m.show=!1,m.isFilter=!1}),p?(g.filter(y=>{let C=!1;for(let b=0;b<t.orderedColumns.length;b++){const w=t.orderedColumns[b]||{};let T=y[w.field]??null;if(w.type=w.type||"string",T!==null&&!w.hide&&((w==null?void 0:w.searchable)===void 0||w!=null&&w.searchable)&&(T=s(w,T).toString(),C=T.toLowerCase().includes(p.toString().toLowerCase()),C))break}return C}).forEach(y=>{y.show=!0,y.parent&&!y.parent.expand&&(y.show=!1),y.isFilter=!0,d(y),h(y)}),n.isSearch=!0):(g.forEach(m=>{m.show=!0,m.isFilter=!1}),g.forEach(m=>{d(m),h(m)})),!p&&i.isClientPaging&&i.prevPage&&(i.currentPage=1,t.pagingStore=r()),c({onSearch:!0}),a(t.store),l()},500)}}},N1=e=>{const{emit:t}=o.getCurrentInstance(),{stores:n,pageInfo:i,sortInfo:s,filterInfo:l,elementInfo:a,clearCheckInfo:r}=e,c=()=>{const u=(i.currentPage-1)*i.perPage,f=parseInt(u,10)+parseInt(i.perPage,10);return n.showTreeStore.slice(u,f)},d=u=>{t("page-change",{eventName:u,pageInfo:{currentPage:i.currentPage,prevPage:i.prevPage,startIndex:i.startIndex,total:i.pageTotal,perPage:i.perPage},sortInfo:{field:s.sortField,order:s.sortOrder},searchInfo:{searchWord:l.searchWord,searchColumns:n.orderedColumns.filter(f=>!f.hide&&((f==null?void 0:f.searchable)===void 0||(f==null?void 0:f.searchable))).map(f=>f.field)}}),i.isInfinite&&(u!=null&&u.onSearch||u!=null&&u.onSort)&&(i.currentPage=1,a.body.scrollTop=0,r())};return{getPagingData:c,updatePagingInfo:d,changePage:u=>{if(i.isClientPaging)if(i.prevPage=u,n.showTreeStore.length<=i.perPage)n.pagingStore=n.showTreeStore;else{const f=(i.currentPage-1)*i.perPage,p=parseInt(f,10)+parseInt(i.perPage,10);n.pagingStore=n.showTreeStore.slice(f,p),a.body.scrollTop=0,i.startIndex=f}d({onChangePage:!0})}}},P1=({sortInfo:e,stores:t})=>{const{emit:n}=o.getCurrentInstance(),i=(u=!0)=>u?["asc","desc","init"]:["asc","desc"];function s(){this.orders=i(),this.dequeue=()=>this.orders.shift(),this.enqueue=u=>this.orders.push(u)}const l=(u,f="init")=>{t.orderedColumns.forEach(p=>{p.index===(u==null?void 0:u.index)&&f?p.sortOption={sortType:f}:p.sortOption={sortType:"init"}})},a=()=>{const u=t.originColumns.filter(f=>f.hiddenDisplay||f.hide);u.length&&u.forEach(f=>{f.sortOption={sortType:"init"}})},r=new s;return{onSort:(u,f)=>{if(u.sortable===void 0?!0:u.sortable){e.sortColumn=u,e.sortField!==(u==null?void 0:u.field)&&(r.orders=i(),e.sortField=u==null?void 0:u.field),f&&(r.orders=i(),f==="desc"&&(e.sortOrder=r.dequeue(),r.enqueue(e.sortOrder))),e.sortOrder=r.dequeue(),r.enqueue(e.sortOrder),a(),l(u,e.sortOrder);const g=ps(t);n("sort-column",{field:e.sortField,order:e.sortOrder,column:e.sortColumn,columns:g}),n("change-column-info",{type:"sort",columns:g})}},setSortInfo:(u,f=!0)=>{const p=u==null?void 0:u.findIndex(y=>{var C;return(y==null?void 0:y.sortable)&&((C=y==null?void 0:y.sortOption)==null?void 0:C.sortType)&&y.sortOption.sortType!=="init"}),g=u[p];p>-1&&(g.index=p);const{sortType:m}=(g==null?void 0:g.sortOption)||{};e.sortColumn=g,e.sortField=g==null?void 0:g.field,e.isSorting=!!m,e.sortOrder=m,l(g,m),f&&n("change-column-info",{type:"sort",columns:ps(t)})},initSortInfo:u=>{e.isSorting=!1,e.sortOrder="init",u.forEach(f=>{var p;(p=f==null?void 0:f.sortOption)!=null&&p.sortType&&f.sortOption.sortType!=="init"&&(f.sortOption.sortType="init")})}}},B1={name:"EvTreeGrid",components:{TreeGridNode:w1,Toolbar:M1,GridPagination:Rr,GridSummary:Wr,ColumnSetting:Zr,GridSortButton:Xr,GridOptionButton:zo},directives:{observeVisibility:Qs,resize:En},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 gs,bs,ys,xs,Ss,Cs,ks,sn,In;const t=o.ref(null),n=o.computed(()=>{var _,oe;return((oe=(_=e.option)==null?void 0:_.useGridSetting)==null?void 0:oe.use)||!1}),i=o.computed(()=>{var _;return((_=e.option)==null?void 0:_.useSummary)||!1}),s=o.computed(()=>e.option.emptyText??"No records"),l=o.reactive({body:null,header:null,table:null,resizeLine:null,"grid-wrapper":null}),a=o.reactive({isSearch:!1,searchWord:""}),r=o.reactive({isShowColumnSetting:!1,isFilteringColumn:!1,visibleColumnIdx:[],hiddenColumn:"",columnSettingPosition:{top:0,left:0,columnListMenuWidth:0},useDefaultColumnSetting:o.computed(()=>{var _,oe;return((oe=(_=e.option)==null?void 0:_.useGridSetting)==null?void 0:oe.useDefaultColumnSetting)??!0}),columnSettingTextInfo:{title:((bs=(gs=e.option)==null?void 0:gs.useGridSetting)==null?void 0:bs.columnMenuText)??"Column List",search:((xs=(ys=e.option)==null?void 0:ys.useGridSetting)==null?void 0:xs.searchText)??"Search",empty:((Cs=(Ss=e.option)==null?void 0:Ss.useGridSetting)==null?void 0:Cs.emptyText)??"No records",ok:((sn=(ks=e.option)==null?void 0:ks.useGridSetting)==null?void 0:sn.okBtnText)??"OK"}}),c=o.reactive({treeStore:[],viewStore:[],filterStore:[],pagingStore:[],originStore:[],showTreeStore:o.computed(()=>c.treeStore.filter(_=>_.show)),searchStore:o.computed(()=>c.treeStore.filter(_=>_.isFilter)),store:o.computed(()=>a.isSearch?c.searchStore:c.treeStore),treeRows:e.rows,filteredColumns:[],originColumns:o.computed(()=>e.columns.map((_,oe)=>{var pe;return{index:oe,hiddenDisplay:!1,..._,width:isFinite(_.width)?_.width:void 0,sortOption:{sortType:((pe=_==null?void 0:_.sortOption)==null?void 0:pe.sortType)||"init"}}})),orderedColumns:o.computed(()=>c.filteredColumns.length?c.filteredColumns:c.originColumns),updatedColumns:o.computed(()=>ps(c))}),d=o.reactive({usePage:o.computed(()=>{var _;return((_=e.option.page)==null?void 0:_.use)||!1}),useClient:((In=e.option.page)==null?void 0:In.useClient)||!1,isInfinite:o.computed(()=>{var _;return((_=e.option.page)==null?void 0:_.isInfinite)||!1}),startIndex:0,prevPage:0,currentPage:0,pageTotal:o.computed(()=>{var _;return((_=e.option.page)==null?void 0:_.total)||0}),perPage:o.computed(()=>{var _;return((_=e.option.page)==null?void 0:_.perPage)||20}),visiblePage:o.computed(()=>{var _;return((_=e.option.page)==null?void 0:_.visiblePage)||8}),order:o.computed(()=>{var _;return((_=e.option.page)==null?void 0:_.order)||"center"}),showPageInfo:o.computed(()=>{var _;return((_=e.option.page)==null?void 0:_.showPageInfo)||!1}),isClientPaging:o.computed(()=>d.useClient&&d.usePage&&!d.isInfinite),isHighlight:!1,highlightPage:0}),h=o.reactive({prevCheckedRow:[],isHeaderChecked:!1,isHeaderUncheckable:!1,isHeaderIndeterminate:!1,checkedRows:e.checked,useCheckbox:o.computed(()=>e.option.useCheckbox||{})}),{isRenderer:u,getComponentName:f,getConvertValue:p,getColumnIndex:g,setPixelUnit:m,checkHeader:y}=R1({checkInfo:h}),C=o.reactive({lastScroll:{top:0,left:0},vScrollTopHeight:0,vScrollBottomHeight:0,hasVerticalScrollBar:!1,hasHorizontalScrollBar:!1}),b=o.reactive({selectedRow:e.selected,useSelect:o.computed(()=>{var _,oe;return((oe=(_=e.option)==null?void 0:_.useSelection)==null?void 0:oe.use)??!0}),limitCount:o.computed(()=>{var oe,pe;let _=(pe=(oe=e.option)==null?void 0:oe.useSelection)==null?void 0:pe.limitCount;return _=_&&_>=2?_:0,_}),multiple:o.computed(()=>{var _,oe;return((oe=(_=e.option)==null?void 0:_.useSelection)==null?void 0:oe.multiple)??!1})}),w=o.reactive({isSorting:!1,sortField:"",sortOrder:"",sortColumn:{},sortFunction:e.option.customAscFunction??{}}),T=o.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:o.computed(()=>{var _,oe;return((oe=(_=e.option)==null?void 0:_.useGridSetting)==null?void 0:oe.customContextMenu)||[]}),isShowMenuOnClick:!1}),k=o.reactive({minWidth:40,rendererMinWidth:80,showResizeLine:!1,adjust:e.option.adjust||!1,columnWidth:e.option.columnWidth||80,scrollWidth:e.option.scrollWidth||17,rowHeight:o.computed(()=>e.option.rowHeight||35),gridWidth:o.computed(()=>e.width?m(e.width):"100%"),gridHeight:o.computed(()=>e.height?m(e.height):"100%"),isResize:!1}),M=o.reactive({showHeader:o.computed(()=>e.option.showHeader===void 0?!0:e.option.showHeader),stripeStyle:o.computed(()=>{var _;return((_=e.option.style)==null?void 0:_.stripe)||!1}),borderStyle:o.computed(()=>{var _;return((_=e.option.style)==null?void 0:_.border)||""}),highlightIdx:o.computed(()=>{var _;return((_=e.option.style)==null?void 0:_.highlight)??-1})}),Z=()=>{b.selectedRow.length=0,c.store.forEach(_=>{_.selected=!1})},S=()=>{h.isHeaderChecked=!1,h.isHeaderIndeterminate=!1,h.checkedRows.length=0,c.store.forEach(_=>{_.checked=!1,_.indeterminate=!1})},{getPagingData:x,updatePagingInfo:I,changePage:L}=N1({stores:c,pageInfo:d,sortInfo:w,filterInfo:a,elementInfo:l,clearCheckInfo:S}),V=o.ref(0),{updateVScroll:R,updateHScroll:E,onScroll:G}=v1({scrollInfo:C,stores:c,elementInfo:l,resizeInfo:k,pageInfo:d,summaryScroll:V,getPagingData:x,updatePagingInfo:I}),{onRowClick:v,onRowDblClick:X}=E1(b),{onCheck:W,onCheckAll:N}=G1({checkInfo:h,stores:c,checkHeader:y,pageInfo:d,getPagingData:x}),{calculatedColumn:P,onResize:D,onShow:O,onColumnResize:Y}=V1({resizeInfo:k,elementInfo:l,checkInfo:h,stores:c,isRenderer:u,updateVScroll:R,updateHScroll:E,contextInfo:T}),{setTreeNodeStore:H,handleExpand:B}=Z1({stores:c,onResize:D}),{onSort:z,initSortInfo:F,setSortInfo:Q}=P1({sortInfo:w,stores:c}),{onSearch:U}=X1({stores:c,filterInfo:a,pageInfo:d,getConvertValue:p,onResize:D,checkHeader:y,getPagingData:x,updatePagingInfo:I}),{setPositionColumnSetting:ee,initColumnSettingInfo:j,onApplyColumn:te,setColumnHidden:J}=Nr({stores:c,columnSettingInfo:r,contextInfo:T,onSearch:U,onResize:D}),{setContextMenu:q,onContextMenu:$,onColumnContextMenu:ae,onGridSettingContextMenu:he}=W1({contextInfo:T,stores:c,selectInfo:b,useGridSetting:n,columnSettingInfo:r,setColumnHidden:J,onSort:z}),se=_=>{T.gridSettingContextMenuItems.length=0,T.customGridSettingContextMenu.length?he(_):r.isShowColumnSetting=!0},fe=_=>{var oe,pe,ke,ve,ze,Qe;_.type==="wheel"&&((oe=T.menu)==null||oe.hide(_)),_.type==="scroll"&&!((pe=_.target.classList)!=null&&pe.contains("table-body"))&&!((ve=(ke=_.target.offsetParent)==null?void 0:ke.classList)!=null&&ve.contains("ev-grid-column-setting"))&&(r.isShowColumnSetting=!1,T.isShowMenuOnClick=!1,(ze=T.columnMenu)==null||ze.hide(_),(Qe=T.gridSettingMenu)==null||Qe.hide())};o.onMounted(()=>{var _;if(c.treeStore=H(),c.originStore=Ze(c.treeStore),(_=e.option)!=null&&_.useSort)Q(e.columns,!1);else{const oe=T.hiddenColumnMenuItem;oe.ascending=!0,oe.descending=!0}document.addEventListener("wheel",fe,{capture:!1}),document.addEventListener("scroll",fe,{capture:!0})}),o.onUnmounted(()=>{document.removeEventListener("wheel",fe,{capture:!1}),document.removeEventListener("scroll",fe,{capture:!0})}),o.onActivated(()=>{D()}),o.watch(()=>{var _;return(_=e.option)==null?void 0:_.useSort},_=>{const oe=e.option.hiddenColumnMenuItem,pe=T.hiddenColumnMenuItem;_?(pe.ascending=(oe==null?void 0:oe.ascending)??!1,pe.descending=(oe==null?void 0:oe.descending)??!1,Q(e.columns,!1)):(pe.ascending=!0,pe.descending=!0,F(e.columns))}),o.watch(()=>r.isShowColumnSetting,_=>{var oe;if(!_){(oe=T.gridSettingMenu)==null||oe.hide();return}ee(t.value)}),o.watch(()=>e.columns,()=>{j()},{deep:!0,immediate:!0}),o.watch(()=>e.checked,_=>{h.checkedRows=_}),o.watch(()=>h.checkedRows,_=>{h.isHeaderChecked=!1;let oe=c.store;d.isClientPaging&&(oe=x()),oe.length&&(oe.forEach(pe=>{pe.checked=!!_.find(ke=>ke.index===pe.index)}),y(oe)),R()}),o.watch(()=>e.selected,_=>{b.useSelect&&(b.selectedRow=_)}),o.watch(()=>b.selectedRow,_=>{b.useSelect&&(c.store.forEach(oe=>{oe.selected=!!_.find(pe=>pe.index===oe.index)}),R())},{deep:!0}),o.watch(()=>M.highlightIdx,async _=>{await o.nextTick();const oe=ke=>{if(!(ke!=null&&ke.children))return;const{children:ve}=ke;ve.forEach(ze=>{const Qe=ze;Qe.parent.show&&Qe.parent.expand?Qe.show=!0:Qe.show=!1,Qe.isFilter=!0,Qe.hasChild&&oe(Qe)})},pe=ke=>{if(!(ke!=null&&ke.parent)){oe(ke);return}const{parent:ve}=ke;ve.show=!0,ve.isFilter=!0,ve.expand=!0,oe(ve),pe(ve)};if(_>=0){const ke=c.store.find(ze=>ze.index===_);if(!ke)return;ke.show=!0,ke.isFilter=!0,pe(ke);const ve=c.showTreeStore.map(ze=>ze.index).indexOf(ke.index);if(d.usePage&&!d.isInfinite){const ze=Math.ceil(ve/d.perPage);if(d.highlightPage=ve===d.perPage?ze+1:ze||1,d.highlightPage!==d.currentPage){d.currentPage=d.highlightPage,d.isHighlight=!0;return}}l.body.scrollTop=k.rowHeight*ve}}),o.watch(()=>h.useCheckbox.mode,()=>{h.checkedRows=[],h.isHeaderChecked=!1}),o.watch(()=>b.useSelect,()=>{Z()}),o.watch(()=>b.multiple,()=>{Z()}),o.watch(()=>e.rows,_=>{c.treeRows=_,c.treeStore=H(),D()},{deep:!0}),o.watch(()=>c.treeStore.length,()=>{y(c.store)}),o.watch(()=>[e.width,e.height,e.option.columnWidth],()=>{e.option.columnWidth!=null&&(k.columnWidth=e.option.columnWidth),c.orderedColumns.map(_=>{var pe;const oe=_;return!((pe=e.columns[_.index])!=null&&pe.width)&&!oe.resized&&(oe.width=0),oe}),D()}),o.watch(()=>e.option.searchValue,_=>{o.nextTick(()=>{_!==void 0&&(U((_==null?void 0:_.value)??_),d.isClientPaging&&(S(),Z()))})},{immediate:!0}),o.watch(()=>{var _;return(_=e.option.page)==null?void 0:_.currentPage},_=>{var pe;const oe=_||1;d.currentPage=(pe=e.option.page)!=null&&pe.isInfinite?1:oe},{immediate:!0}),o.watch(()=>d.currentPage,(_,oe)=>{o.nextTick(()=>{if(L(oe),d.isClientPaging&&_!==oe&&(S(),Z()),R(),_===d.highlightPage&&d.isHighlight){const pe=c.pagingStore.map(ke=>ke.index).indexOf(M.highlightIdx);l.body.scrollTop=k.rowHeight*pe,d.isHighlight=!d.isHighlight}})});const ge=()=>({"column-sort__icon":!0,"column-sort__icon--asc":w.sortOrder==="asc","column-sort__icon--desc":w.sortOrder==="desc"}),le=o.computed(()=>({width:k.gridWidth,height:k.gridHeight})),ce=o.computed(()=>({"table-body":!0,stripe:M.stripeStyle,"bottom-border":!!c.viewStore.length,"non-border":!!M.borderStyle})),be=o.computed(()=>({table:!0,"ev-grid":!0,"ev-tree-grid":!0,adjust:k.adjust,"non-header":!M.showHeader,"ev-tree-grid--empty":!c.viewStore.length})),Ie=o.computed(()=>({"table-header":!0,"non-border":!!M.borderStyle})),Ve=o.computed(()=>({column:!0,"checkbox-all":!0,"non-border":!!M.borderStyle})),kt=o.computed(()=>h.useCheckbox.use&&h.useCheckbox.headerCheck&&h.useCheckbox.mode!=="single"),Vt=_=>({column:!0,render:u(_),"non-border":!!M.borderStyle,[_.field]:_.field}),jo=(_,oe)=>{const pe=u(_);return{width:`${_.width}px`,"min-width":pe?`${k.rendererMinWidth}px;`:`${k.minWidth}px`,"margin-right":c.orderedColumns.length-1===oe&&C.hasVerticalScrollBar&&C.hasHorizontalScrollBar?`${k.scrollWidth}px`:"0px","border-right":c.orderedColumns.length-1===oe?"none":"1px solid #CFCFCF"}},Qo=_=>`${_}Node`;return{summaryScroll:V,gridStyle:le,gridClass:be,headerClass:Ie,headerCheckboxClass:Ve,isHeaderCheckbox:kt,bodyStyle:ce,useSummary:i,useGridSetting:n,toolbarRef:t,stores:c,emptyText:s,...o.toRefs(M),...o.toRefs(l),...o.toRefs(c),...o.toRefs(a),...o.toRefs(C),...o.toRefs(k),...o.toRefs(b),...o.toRefs(h),...o.toRefs(w),...o.toRefs(T),...o.toRefs(d),...o.toRefs(r),isRenderer:u,getComponentName:f,getConvertValue:p,getColumnIndex:g,setPixelUnit:m,updateVScroll:R,updateHScroll:E,onScroll:G,calculatedColumn:P,onResize:D,onShow:O,onColumnResize:Y,onRowClick:v,onRowDblClick:X,onCheck:W,onCheckAll:N,setContextMenu:q,onContextMenu:$,onSearch:U,handleExpand:B,getColumnClass:Vt,getColumnStyle:jo,getSlotName:Qo,setGridSetting:se,onApplyColumn:te,onColumnContextMenu:ae,onSort:z,sortIconClass:ge}}},D1={class:"column-list"},Y1=["data-index"],O1=["title","onClick"],H1=["onClick"],z1=["onMousedown"],F1={ref:"table"},A1=["title"],K1={key:0},_1={class:"is-empty"},U1={ref:"resizeLine",class:"table-resize-line"};function J1(e,t,n,i,s,l){var C;const a=o.resolveComponent("grid-option-button"),r=o.resolveComponent("toolbar"),c=o.resolveComponent("ev-checkbox"),d=o.resolveComponent("grid-sort-button"),h=o.resolveComponent("tree-grid-node"),u=o.resolveComponent("ev-context-menu"),f=o.resolveComponent("grid-summary"),p=o.resolveComponent("grid-pagination"),g=o.resolveComponent("column-setting"),m=o.resolveDirective("resize"),y=o.resolveDirective("observe-visibility");return o.openBlock(),o.createElementBlock(o.Fragment,null,[e.$slots.toolbar||i.useGridSetting?(o.openBlock(),o.createElementBlock("div",{key:0,ref:"toolbarRef",class:"toolbar-wrapper",style:o.normalizeStyle(`width: ${e.gridWidth};`)},[o.createVNode(r,null,{toolbarWrapper:o.withCtx(()=>[i.useGridSetting?(o.openBlock(),o.createBlock(a,{key:0,class:"grid-setting__icon",onClick:i.setGridSetting},null,8,["onClick"])):o.createCommentVNode("",!0),o.renderSlot(e.$slots,"toolbar",{item:{onSearch:i.onSearch}},void 0,!0)]),_:3})],4)):o.createCommentVNode("",!0),o.withDirectives((o.openBlock(),o.createElementBlock("div",{ref:"grid-wrapper",style:o.normalizeStyle(i.gridStyle)},[o.createElementVNode("div",{ref:"grid",class:o.normalizeClass(i.gridClass)},[o.withDirectives(o.createElementVNode("div",{ref:"header",class:o.normalizeClass(i.headerClass)},[o.createElementVNode("ul",D1,[e.useCheckbox.use?(o.openBlock(),o.createElementBlock("li",{key:0,class:o.normalizeClass(i.headerCheckboxClass),style:o.normalizeStyle({width:`${e.minWidth}px`,"border-right":"1px solid #CFCFCF"})},[i.isHeaderCheckbox?(o.openBlock(),o.createBlock(c,{key:0,modelValue:e.isHeaderChecked,"onUpdate:modelValue":t[0]||(t[0]=b=>e.isHeaderChecked=b),disabled:e.isHeaderUncheckable,indeterminate:e.isHeaderIndeterminate,onChange:i.onCheckAll},null,8,["modelValue","disabled","indeterminate","onChange"])):o.createCommentVNode("",!0)],6)):o.createCommentVNode("",!0),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.orderedColumns,(b,w)=>{var T,k;return o.openBlock(),o.createElementBlock(o.Fragment,{key:w},[!b.hide&&!b.hiddenDisplay?(o.openBlock(),o.createElementBlock("li",{key:0,"data-index":w,class:o.normalizeClass(i.getColumnClass(b)),style:o.normalizeStyle(i.getColumnStyle(b,w))},[b.customHeader&&e.$slots.customHeader?o.renderSlot(e.$slots,"customHeader",{key:0},void 0,!0):(o.openBlock(),o.createElementBlock("span",{key:1,title:b.caption,class:o.normalizeClass(["column-name",{"column-name--click":i.useGridSetting}]),onClick:[M=>i.onColumnContextMenu(M,b),t[1]||(t[1]=o.withModifiers((...M)=>e.columnMenu.show&&e.columnMenu.show(...M),["prevent"]))]},[o.createTextVNode(o.toDisplayString(b.caption)+" ",1),o.createElementVNode("span",{onClick:o.withModifiers(M=>i.onSort(b),["stop"])},[e.$slots.sortIcon?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[(T=e.$props.option)!=null&&T.useSort&&(b!=null&&b.sortable)?(o.openBlock(),o.createElementBlock("span",{key:0,class:"column-sort__icon column-sort__icon--basic",style:o.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`})},[o.renderSlot(e.$slots,"sortIcon",{},void 0,!0)],4)):o.createCommentVNode("",!0),e.sortField===b.field?(o.openBlock(),o.createElementBlock("span",{key:1,class:o.normalizeClass(i.sortIconClass(b)),style:o.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`})},[o.renderSlot(e.$slots,`sortIcon_${e.sortOrder}`,{},void 0,!0)],6)):o.createCommentVNode("",!0)],64)):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[(k=e.$props.option)!=null&&k.useSort&&(b!=null&&b.sortable)?(o.openBlock(),o.createBlock(d,{key:0,class:"column-sort__icon column-sort__icon--basic",icon:"basic",style:o.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`})},null,8,["style"])):o.createCommentVNode("",!0),e.sortField===b.field?(o.openBlock(),o.createBlock(d,{key:1,class:o.normalizeClass(i.sortIconClass(b)),icon:e.sortOrder,style:o.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`,visibility:e.sortOrder?b.hidden:!0})},null,8,["class","icon","style"])):o.createCommentVNode("",!0)],64))],8,H1)],10,O1)),o.createElementVNode("span",{class:"column-resize",onMousedown:o.withModifiers(M=>i.onColumnResize(w,M),["stop","left"])},null,40,z1)],14,Y1)):o.createCommentVNode("",!0)],64)}),128)),(C=e.$props.option.customContextMenu)!=null&&C.length?(o.openBlock(),o.createElementBlock("li",{key:1,class:o.normalizeClass({column:!0,"non-border":!!e.borderStyle}),style:o.normalizeStyle({width:"30px","min-width":"30px","margin-right":e.hasVerticalScrollBar||e.hasHorizontalScrollBar?`${e.scrollWidth}px`:"0px"})},null,6)):o.createCommentVNode("",!0)])],2),[[o.vShow,e.showHeader]]),o.createElementVNode("div",{ref:"body",class:o.normalizeClass(i.bodyStyle),onScroll:t[2]||(t[2]=(...b)=>i.onScroll&&i.onScroll(...b)),onContextmenu:[t[3]||(t[3]=b=>i.onContextMenu(b)),t[4]||(t[4]=o.withModifiers((...b)=>e.menu.show&&e.menu.show(...b),["prevent"]))]},[o.createElementVNode("div",{style:o.normalizeStyle(`height: ${e.vScrollTopHeight}px;`),class:"vscroll-spacer"},null,4),o.createElementVNode("table",F1,[o.createElementVNode("tbody",null,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.viewStore,(b,w)=>(o.openBlock(),o.createBlock(h,{key:w,"selected-data":e.selectedRow,"node-data":b,"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:i.onCheck,onExpandTreeData:i.handleExpand,onClickTreeData:i.onRowClick,onDblClickTreeData:i.onRowDblClick,onContextMenu:i.onContextMenu},o.createSlots({_:2},[o.renderList(e.orderedColumns,(T,k)=>({name:i.getSlotName(T.field),fn:o.withCtx(({item:M})=>[e.$slots[T.field]?o.renderSlot(e.$slots,T.field,{key:0,item:{data:M.data,fieldName:T.field}},void 0,!0):(o.openBlock(),o.createElementBlock("span",{key:1,title:i.getConvertValue(T,b[T.field])},o.toDisplayString(i.getConvertValue(T,b[T.field])),9,A1))])})),e.$slots.contextmenuIcon?{name:"contextmenuIconNode",fn:o.withCtx(()=>[o.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?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("tr",K1,[o.createElementVNode("td",_1,o.toDisplayString(i.emptyText),1)]))])],512),o.createElementVNode("div",{style:o.normalizeStyle(`height: ${e.vScrollBottomHeight}px;`),class:"vscroll-spacer"},null,4),o.createVNode(u,{ref:"menu","custom-class":e.contextMenuClass,items:e.contextMenuItems},null,8,["custom-class","items"]),o.createVNode(u,{ref:"columnMenu",items:e.columnMenuItems},null,8,["items"]),o.createVNode(u,{ref:"gridSettingMenu",items:e.gridSettingContextMenuItems,"is-show-menu-on-click":e.isShowMenuOnClick},null,8,["items","is-show-menu-on-click"])],34),o.withDirectives(o.createElementVNode("div",U1,null,512),[[o.vShow,e.showResizeLine]])],2)],4)),[[m,i.onResize],[y,{callback:i.onShow,once:!0}]]),i.useSummary?(o.openBlock(),o.createBlock(f,{key:1,"is-tree":!0,"ordered-columns":e.orderedColumns,stores:i.stores,"use-checkbox":e.useCheckbox.use,"style-option":{borderStyle:e.borderStyle,minWidth:e.minWidth,rowHeight:e.rowHeight},"scroll-left":i.summaryScroll},null,8,["ordered-columns","stores","use-checkbox","style-option","scroll-left"])):o.createCommentVNode("",!0),e.usePage&&!e.isInfinite?(o.openBlock(),o.createBlock(p,{key:2,modelValue:e.currentPage,"onUpdate:modelValue":t[5]||(t[5]=b=>e.currentPage=b),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"])):o.createCommentVNode("",!0),o.createVNode(g,{"is-show":e.isShowColumnSetting,"onUpdate:isShow":t[6]||(t[6]=b=>e.isShowColumnSetting=b),"is-show-menu-on-click":e.isShowMenuOnClick,"onUpdate:isShowMenuOnClick":t[7]||(t[7]=b=>e.isShowMenuOnClick=b),columns:e.updatedColumns,"hidden-column":e.hiddenColumn,position:e.columnSettingPosition,"text-info":e.columnSettingTextInfo,onApplyColumn:i.onApplyColumn},null,8,["is-show","is-show-menu-on-click","columns","hidden-column","position","text-info","onApplyColumn"])],64)}const Si=de(B1,[["render",J1],["__scopeId","data-v-9ed705b7"]]);Si.install=e=>{e.component(Si.name,Si)};const j1={name:"PageButton",props:{page:{type:Object,required:!0},disabled:{type:Boolean,default:!1}}},Q1=["aria-current"];function $1(e,t,n,i,s,l){return o.openBlock(),o.createElementBlock("span",o.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]=o.withModifiers((...a)=>n.page.click&&n.page.click(...a),["stop"]))}),[o.renderSlot(e.$slots,"default",{},()=>[o.createTextVNode(o.toDisplayString(n.page.number),1)])],16,Q1)}const q1={name:"EvPagination",components:{EvIcon:Sn,pageButton:de(j1,[["render",$1]])},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=o.computed(()=>e.visiblePage>7?e.visiblePage:7),i=o.computed(()=>e.modelValue),s=o.computed(()=>e.total===0?1:Math.ceil(e.total/e.perPage)),l=o.computed(()=>i.value>1),a=o.computed(()=>i.value<s.value),r=o.computed(()=>Math.max(i.value-e.pagePerJump,1)),c=o.computed(()=>Math.min(i.value+e.pagePerJump,s.value)),d=o.computed(()=>{const m=i.value*e.perPage-e.perPage+1;return m>=0?m:0}),h=(m,y)=>{i.value===m||m<1||m>s.value||(t("update:modelValue",m),t("change",m),y&&y.target&&o.nextTick(()=>y.target.focus()))},u=(m,y={})=>({number:m,isCurrent:y.isCurrent??i.value===m,click:C=>h(m,C),input:(C,b)=>h(+b,C),disabled:y.disabled||!1,class:y.class||""}),f=(m,y)=>{const C=[],b=m>0?m:1;for(let w=b;w<=y;w++)C.push(u(w));return C},p=o.computed(()=>{const m=parseInt(n.value,10);if(m===0)return[];const y=Math.min(Math.max(0,m)||s.value,s.value);if(s.value<=y)return f(1,s.value);const C=y%2===0?1:0,b=Math.floor(y/2),w=s.value-b+1+C;if(i.value>b&&i.value<w){const k=s.value,M=i.value-b+2,Z=i.value+b-2-C,S=M-1===2?2:-1,x=Z+1===k-1?Z+1:-1;return[u(1),u(S),...f(M,Z),u(x),u(s.value)]}else if(i.value===b){const T=i.value+b-1-C;return[...f(1,T),u(-1),u(s.value)]}else if(i.value===w){const T=i.value-b+1;return[u(1),u(-1),...f(T,s.value)]}return[...f(1,b),u(-1),...f(w,s.value)]}),g=o.computed(()=>({"justify-content":e.order,flex:"3 1 0%"}));return o.watch(()=>s.value,m=>{i.value>m&&h(m)}),o.watch(()=>i.value,(m,y)=>{s.value<m&&h(y)}),{pageCount:s,pagesInRange:p,hasPrev:l,hasNext:a,listClasses:g,firstData:d,current:i,changePage:h,getPage:u,prevJumpPage:r,nextJumpPage:c}}},ek={class:"pagination"},tk={key:0,class:"pagination-info"},nk={key:0,class:"pagination-ellipsis"},ik=["onClick"];function sk(e,t,n,i,s,l){const a=o.resolveComponent("ev-icon"),r=o.resolveComponent("page-button");return o.openBlock(),o.createElementBlock("nav",ek,[n.showPageInfo?(o.openBlock(),o.createElementBlock("small",tk,[n.perPage===1?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[o.createTextVNode(o.toDisplayString(i.firstData)+" / "+o.toDisplayString(n.total),1)],64)):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createTextVNode(o.toDisplayString(i.firstData)+" - "+o.toDisplayString(Math.min(i.current*n.perPage,n.total))+" / "+o.toDisplayString(n.total),1)],64))])):o.createCommentVNode("",!0),o.createElementVNode("ul",{class:"pagination-list",style:o.normalizeStyle(i.listClasses)},[e.$props.pagePerJump?(o.openBlock(),o.createElementBlock("li",{key:0,class:o.normalizeClass(["step-button",{"is-disabled":!i.hasPrev}])},[o.createVNode(r,{class:"pagination-previous",disabled:!i.hasPrev,page:i.getPage(i.prevJumpPage,{isCurrent:!1})},{default:o.withCtx(()=>[o.createVNode(a,{icon:"ev-icon-s-double-left"})]),_:1},8,["disabled","page"])],2)):o.createCommentVNode("",!0),o.createElementVNode("li",{class:o.normalizeClass(["step-button",{"is-disabled":!i.hasPrev}])},[o.createVNode(r,{class:"pagination-previous",disabled:!i.hasPrev,page:i.getPage(i.current-1)},{default:o.withCtx(()=>[o.createVNode(a,{icon:"ev-icon-s-arrow-left"})]),_:1},8,["disabled","page"])],2),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.pagesInRange,(c,d)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:d},[c.number===-1?(o.openBlock(),o.createElementBlock("li",nk,[...t[0]||(t[0]=[o.createElementVNode("span",null,"…",-1)])])):(o.openBlock(),o.createElementBlock("li",{key:1,class:o.normalizeClass({"is-current":c.isCurrent,"is-page":!0}),onClick:c.click},[o.createVNode(r,{page:c},null,8,["page"])],10,ik))],64))),128)),o.createElementVNode("li",{class:o.normalizeClass(["step-button",{"is-disabled":!i.hasNext}])},[o.createVNode(r,{class:"pagination-next",disabled:!i.hasNext,page:i.getPage(i.current+1)},{default:o.withCtx(()=>[o.createVNode(a,{icon:"ev-icon-s-arrow-right"})]),_:1},8,["disabled","page"])],2),e.$props.pagePerJump?(o.openBlock(),o.createElementBlock("li",{key:1,class:o.normalizeClass(["step-button",{"is-disabled":!i.hasNext}])},[o.createVNode(r,{class:"pagination-previous",disabled:!i.hasNext,page:i.getPage(i.nextJumpPage,{isCurrent:!1})},{default:o.withCtx(()=>[o.createVNode(a,{icon:"ev-icon-s-double-right"})]),_:1},8,["disabled","page"])],2)):o.createCommentVNode("",!0)],4)])}const Ci=de(q1,[["render",sk]]);Ci.install=e=>{e.component(Ci.name,Ci)};const ok="3.11.0",lk=[Gn,Wn,un,Zn,fn,mn,Xn,Nn,Bn,Dn,Yn,zn,Qn,Sn,ei,ti,ni,ii,si,oi,li,ai,ri,ci,hi,bi,yi,xi,ls,rs,cs,Si,Ci],ak={version:ok,install:e=>{e&&lk.forEach(t=>{e.use(t)})}};re.EvButton=un,re.EvButtonGroup=Zn,re.EvCalendar=ei,re.EvChart=bi,re.EvChartBrush=xi,re.EvChartGroup=yi,re.EvCheckbox=fn,re.EvCheckboxGroup=mn,re.EvContextMenu=ii,re.EvDatePicker=ti,re.EvGrid=hi,re.EvIcon=Sn,re.EvInputNumber=zn,re.EvLoading=oi,re.EvMenu=ai,re.EvMessage=ls,re.EvMessageBox=cs,re.EvNotification=rs,re.EvPagination=Ci,re.EvProgress=li,re.EvRadio=Xn,re.EvRadioGroup=Nn,re.EvScheduler=ni,re.EvSelect=Bn,re.EvSlider=Qn,re.EvTabPanel=Wn,re.EvTabs=Gn,re.EvTextField=Yn,re.EvTimePicker=ci,re.EvToggle=Dn,re.EvTree=ri,re.EvTreeGrid=Si,re.EvWindow=si,re.default=ak,Object.defineProperties(re,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
17
+ 15.998 11.998C15.998 11.1696 16.6696 10.498 17.498 10.498Z`,fill:"#ADB5BD"},null,-1)])])}const zo=de(A0,[["render",_0]]),vt=0,wn=1,me=2,di=3,Fo=4,U0=()=>{const{props:e}=o.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 u=0;u<h.length;u++)d+=r(h[u])}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=Qt(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}}},us=e=>{var i;const t=((i=e.movedColumns)!=null&&i.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}})},J0=e=>{const{scrollInfo:t,stores:n,elementInfo:i,resizeInfo:s,pageInfo:l,summaryScroll:a,getPagingData:r,updatePagingInfo:c,expandedInfo:d}=e,h=g=>{var b,w;const m=i.body,y=s.rowHeight,C=d.detailRowHeight??0;if(m){let T=n.store;l.isClientPaging&&(T=r());const k=((b=d.expandedRows)==null?void 0:b.length)??0,M=((w=d.expandedRows)==null?void 0:w.map(v=>T.findIndex(X=>X[me]===v)))??[],Z=T.length*y+k*C;let S=0,x=0;if(k)for(S=0;x+y<m.scrollTop;S++)M.includes(S)&&(x+=C),x+=y;else S=Math.floor(m.scrollTop/y),x=Math.max(S,0)*y;S>T.length-1&&(S=0);let I=0,L=0;if(k)for(let v=S;L<=m.clientHeight;v++)M.includes(v)&&(L+=C),L+=y,I+=1;else I=m.clientHeight>y?Math.ceil(m.clientHeight/y):T.length,L=I*y;const V=S+I+1,R=Math.max(S,0),E=V,G=i.table;n.viewStore=T.slice(R,E),t.hasVerticalScrollBar=I<T.length||m.clientHeight<G.clientHeight,t.vScrollTopHeight=x,t.vScrollBottomHeight=Z-L-t.vScrollTopHeight,g&&l.isInfinite&&t.vScrollBottomHeight===0&&(l.prevPage=l.currentPage,l.currentPage=Math.ceil(E/l.perPage)+1,l.startIndex=E,c({onScrollEnd:!0}))}},u=g=>{if(d.useRowDetail&&!d.detailRowHeight){let m=n.store;l.isClientPaging&&(m=r()),n.viewStore=[...m],t.vScrollTopHeight=0,t.vScrollBottomHeight=0}else h(g)},f=()=>{const g=i.header,m=i.body,y=i.table;g.scrollLeft=m.scrollLeft,a.value=m.scrollLeft,t.hasHorizontalScrollBar=m.clientWidth<y.clientWidth};return{updateVScroll:u,updateHScroll:f,onScroll:()=>{const g=i.body,m=g.scrollTop,y=g.scrollLeft,C=t.lastScroll.top,b=t.lastScroll.left,w=y!==b;m!==C&&(g!=null&&g.clientHeight)&&u(!0),w&&f(),t.lastScroll.top=m,t.lastScroll.left=y}}},j0=e=>{const{props:t,emit:n}=o.getCurrentInstance(),{resizeInfo:i,elementInfo:s,checkInfo:l,expandedInfo:a,stores:r,isRenderer:c,updateVScroll:d,updateHScroll:h,contextInfo:u}=e,f=()=>{var b;let y=i.columnWidth,C=0;if(i.adjust){const w=s.body;let T=w.offsetWidth;const k=w.offsetHeight,M=((b=w.querySelector("tr"))==null?void 0:b.offsetHeight)||i.rowHeight,Z=T-w.clientWidth,S=r.orderedColumns.reduce((x,I)=>(I.hide||I.hiddenDisplay||(I.width?x.totalWidth+=I.width:x.emptyCount++),x),{totalWidth:u.customContextMenu.length?30:0,emptyCount:0});if(M*t.rows.length>k&&(T-=Z),l.useCheckbox.use&&(T-=i.minWidth),a.useRowDetail&&(T-=i.minWidth),y=T-S.totalWidth,y>0){const x=S.emptyCount===0?0:Math.floor(y/S.emptyCount);C=y-x*S.emptyCount,y=S.emptyCount!==0?x:y}else y=i.columnWidth;y=y<i.minWidth?i.minWidth:y,i.columnWidth=y}if(r.orderedColumns.forEach(w=>{const T=c(w)?i.rendererMinWidth:i.minWidth;w.width&&w.width<T&&(w.width=T),!w.width&&!w.hide&&(w.width=y)}),C&&r.orderedColumns.length){let w=r.orderedColumns.length-1,T=r.orderedColumns[w];for(;w>0&&T&&(T.hide||T.hiddenDisplay);)w-=1,T=r.orderedColumns[w];T&&(T.width+=C)}},p=()=>{const y=new Map(t.columns.map(C=>[C.field,C.width]));o.nextTick(()=>{var C,b;i.adjust&&r.orderedColumns.forEach(w=>{const T=w;return T.resized||(T.width=y.get(T.field)??0),T},void 0),f(),(C=s.body)!=null&&C.clientHeight&&d(),(b=s.body)!=null&&b.clientWidth&&h()})};return{calculatedColumn:f,onResize:p,onShow:y=>{y&&p()},onColumnResize:(y,C)=>{C.preventDefault();const b=s.header,w=s.body,T=b.getBoundingClientRect().left,k=b.querySelector(`li[data-index="${y}"]`),M=c(r.orderedColumns[y])?i.rendererMinWidth:i.minWidth,Z=k.getBoundingClientRect(),S=s.resizeLine,x=Z.left-T+M,I=Z.right-T,L=C.clientX,V=Z.left-T;w.style.overflow="auto",S.style.left=`${I}px`,i.showResizeLine=!0;const R=G=>{const v=G.clientX-L,X=I+v,W=Math.max(x,X);S.style.left=`${W}px`},E=()=>{const v=parseInt(S.style.left,10)-V;r.orderedColumns[y]&&(r.orderedColumns[y].width=v,r.orderedColumns[y].resized=!0),i.showResizeLine=!1,document.removeEventListener("mousemove",R),p();const X=us(r);n("resize-column",{column:r.orderedColumns[y],columns:X}),n("change-column-info",{type:"resize",columns:X})};document.addEventListener("mousemove",R),document.addEventListener("mouseup",E,{once:!0})}}},Q0=e=>{const{emit:t}=o.getCurrentInstance(),{selectInfo:n,stores:i}=e,s=(d,h)=>{var p;const u=(p=d.target.tagName)==null?void 0:p.toLowerCase();let f={};return u==="td"?f=d.target.dataset:f=d.target.parentNode.dataset,{event:d,rowData:h[me],rowIndex:h[vt],cellName:f.name,cellIndex:f.index}};let l=null,a=-1;return{onRowClick:(d,h,u)=>{var g,m,y;if((g=d.target.parentElement.classList)!=null&&g.contains("row-checkbox-input"))return!1;const f=!!((y=(m=d.target.closest("td"))==null?void 0:m.classList)!=null&&y.contains("row-contextmenu")),p=(C,b,w)=>{if(C==="shift"){const T=h[vt];if(a>-1)for(let k=Math.min(T,a);k<=Math.max(T,a);k++)if(!b)i.originStore[k][di]=!0,a!==k&&n.selectedRow.push(i.originStore[k][me]);else{i.originStore[k][di]=!1;const M=n.selectedRow.indexOf(i.originStore[k][me]);M>-1&&n.selectedRow.splice(M,1)}}else C==="ctrl"&&(b?n.selectedRow.splice(n.selectedRow.indexOf(h[me]),1):n.selectedRow.push(w))};return l&&clearTimeout(l),l=setTimeout(()=>{if(n.useSelect){const C=h[me],b=h[di];h[di]=!h[di];let w="";d.shiftKey?w="shift":d.ctrlKey&&(w="ctrl"),n.multiple&&w?p(w,b,C):u||f?(n.selectedRow=[...n.selectedRow],n.selectedRow.includes(C)||(n.selectedRow=[C])):b?n.selectedRow=[]:n.selectedRow=[C],a=h[vt],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:i,getPagingData:s}=e,{props:l,emit:a}=o.getCurrentInstance(),r=h=>{const u=n.originStore.findIndex(f=>f[me]===h[me]);u!==-1&&(n.originStore[u][wn]=h[wn])};return{onCheck:(h,u)=>{if(t.useCheckbox.mode==="single"&&t.prevCheckedRow.length&&(t.prevCheckedRow=[],r(t.prevCheckedRow)),u[wn]){t.useCheckbox.mode==="single"?t.checkedRows=[u[me]]:t.checkedRows.push(u[me]);let f=n.store;i.isClientPaging&&(f=s());const p=f.filter(g=>!l.uncheckable.includes(g[me])).filter(g=>!l.disabledRows.includes(g[me])).every(g=>g[wn]);f.length&&p&&(t.isHeaderChecked=!0),t.isHeaderIndeterminate=f.length&&!p}else t.useCheckbox.mode==="single"?t.checkedRows=[]:t.checkedRows.splice(t.checkedRows.indexOf(u[me]),1),t.isHeaderChecked=!1,t.isHeaderIndeterminate=!!(n.store.length&&t.checkedRows.length);t.prevCheckedRow=u.slice(),a("update:checked",t.checkedRows),a("check-row",h,u[vt],u[me])},onCheckAll:h=>{const u=t.isHeaderChecked;let f=n.store;i.isClientPaging&&(f=s()),f.forEach(p=>{const g=l.uncheckable.includes(p[me])||l.disabledRows.includes(p[me]);u?!t.checkedRows.includes(p[me])&&!g&&t.checkedRows.push(p[me]):t.checkedRows.splice(t.checkedRows.indexOf(p[me]),1),g||(p[wn]=u)}),t.isHeaderIndeterminate=!1,a("update:checked",t.checkedRows),a("check-all",h,t.checkedRows)}}},q0=e=>{const{expandedInfo:t}=e,{emit:n}=o.getCurrentInstance();return{onExpanded:(s,l)=>{const a=l[me],r=t.expandedRows.indexOf(a);r===-1?t.expandedRows.push(a):t.expandedRows.splice(r,1),l[Fo]=!l[Fo],n("update:expanded",t.expandedRows),n("expand-row",s,l[me],l[Fo],l[vt])}}},eS=e=>{const{sortInfo:t,stores:n,updatePagingInfo:i}=e,{emit:s}=o.getCurrentInstance(),l=(m=!0)=>m?["asc","desc","init"]:["asc","desc"];function a(){this.orders=l(),this.dequeue=()=>this.orders.shift(),this.enqueue=m=>this.orders.push(m)}const r=(m,y="init")=>{n.orderedColumns.forEach(C=>{C.index===(m==null?void 0:m.index)&&y?C.sortOption={sortType:y}:C.sortOption={sortType:"init"}})},c=()=>{const m=n.originColumns.filter(y=>y.hiddenDisplay||y.hide);m.length&&m.forEach(y=>{y.sortOption={sortType:"init"}})},d=new a,h=(m,y=!0)=>{const{sortType:C}=(m==null?void 0:m.sortOption)||{};t.sortColumn=m,t.sortField=m==null?void 0:m.field,t.sortOrder=C,t.isSorting=!!C,y&&(r(m,C),s("change-column-info",{type:"sort",columns:us(n)}))},u=(m,y)=>{if(m.sortable===void 0?!0:m.sortable){t.sortColumn=m,t.sortField!==(m==null?void 0:m.field)&&(d.orders=l(),t.sortField=m==null?void 0:m.field),y&&(d.orders=l(),y==="desc"&&(t.sortOrder=d.dequeue(),d.enqueue(t.sortOrder))),t.sortOrder=d.dequeue(),d.enqueue(t.sortOrder),t.isSorting=!0,i({onSort:!0}),c(),r(m,t.sortOrder);const b=us(n);s("sort-column",{field:t.sortField,order:t.sortOrder,column:t.sortColumn,columns:b}),s("change-column-info",{type:"sort",columns:b})}},f=()=>{var I;const{field:m,index:y}=t.sortColumn||{},C=((I=t.sortFunction)==null?void 0:I[m])??null,b=(L,V)=>L>V?-1:1,w=(L,V)=>L<V?-1:1,T=(L,V)=>(L===null)-(V===null)||Number(V)-Number(L),k=(L,V)=>(L===null)-(V===null)||Number(L)-Number(V);if(t.sortOrder==="init"||!t.sortField&&!t.isSorting){n.store.sort((L,V)=>typeof L[vt]=="number"?w(L[vt],V[vt]):0);return}const M=t.sortColumn.type||"string",Z=t.sortOrder==="desc"?b:w,S=t.sortOrder==="desc"?T:k,x=(L,V)=>{var G,v;let R=L[me][y],E=V[me][y];return L[me][y]&&typeof L[me][y]=="object"&&(R=L[me][y][(G=n.originColumns[y])==null?void 0:G.field],E=V[me][y][(v=n.originColumns[y])==null?void 0:v.field]),{aCol:R,bCol:E}};if(C){n.store.sort((L,V)=>{const R=L[me][y],E=V[me][y],G=C(R,E);return t.sortOrder==="desc"?-G:G});return}switch(M){case"string":n.store.sort((L,V)=>{let{aCol:R,bCol:E}=x(L,V);if((!R||typeof R=="string")&&(!E||typeof E=="string")){R=R||"",E=E||"";const G=R.toLowerCase(),v=E.toLowerCase();if(R!==E&&G===v){const X=Array.from(R).findIndex((W,N)=>W!==E[N]);return Z(R[X],E[X])}return Z(G,v)}return 0});break;case"stringNumber":n.store.sort((L,V)=>{let{aCol:R,bCol:E}=x(L,V);return!R||typeof R=="string"||typeof R=="number"?(R=R===""?null:R,E=E===""?null:E,S(R??null,E??null)):0});break;default:n.store.sort((L,V)=>{const{aCol:R,bCol:E}=x(L,V);return!R||typeof R=="number"||typeof R=="boolean"?S(R??null,E??null):0});break}},p=()=>{var m;return(m=n.orderedColumns)==null?void 0:m.find(y=>(y==null?void 0:y.sortOption)&&l(!1).includes(y.sortOption.sortType))};return{onSort:u,getSortTarget:p,setSort:f,setSortInfo:h,hasSortTarget:()=>!!p()}},tS=e=>{const{props:t}=o.getCurrentInstance(),{columnSettingInfo:n,filterInfo:i,stores:s,checkInfo:l,pageInfo:a,getConvertValue:r,updateVScroll:c,getPagingData:d,updatePagingInfo:h,getColumnIndex:u}=e,f=k=>{let M=0;k.forEach(Z=>{const S=l.checkedRows.includes(Z[me]);Z[wn]=S,M+=S?1:0}),k.length&&(l.isHeaderChecked=k.length===M,l.isHeaderIndeterminate=k.length!==M&&M>0,l.isHeaderUncheckable=k.every(Z=>t.uncheckable.includes(Z[me])||t.disabledRows.includes(Z[me])))},p=(k,M,Z)=>{if(typeof k!="string"||M===null)return!1;const S=M==null?void 0:M.toLowerCase(),x=k==null?void 0:k.toLowerCase();let I=S.includes(x);return Z&&(Z==="start"?I=S.startsWith(x):Z==="end"&&(I=S.endsWith(x))),I},g=(k,M)=>{const Z=M.comparison,S=M.value;let x=k[me][M.index];(x||x===0)&&(x=`${k[me][M.index]}`);let I;return Z==="="?I=(S==null?void 0:S.toLowerCase())===(x==null?void 0:x.toLowerCase()):Z==="!="?I=(S==null?void 0:S.toLowerCase())!==(x==null?void 0:x.toLowerCase()):Z==="%s%"?I=p(S,x):Z==="notLike"?I=!p(S,x):Z==="s%"?I=p(S,x,"start"):Z==="%s"?I=p(S,x,"end"):Z==="isEmpty"?I=x==null||x==="":Z==="isNotEmpty"&&(I=!!x),I},m=(k,M,Z)=>{const S=M.comparison,x=Number(M.value.replace(/,/g,""));let I=Number(k[me][M.index]),L;return Z==="float"&&(I=Number(I.toFixed(3))),S==="="?L=I===x:S===">"?L=I>x:S==="<"?L=I<x:S==="<="?L=I<=x:S===">="?L=I>=x:S==="!="?L=I!==x:S==="isEmpty"?L=I==null||isNaN(I):S==="isNotEmpty"&&(L=!!I||I===0),L},y=(k,M)=>{const Z=M.comparison,S=M.value,x=`${k[me][M.index]}`;let I;return Z==="="&&(I=x===S),I},C=(k,M,Z)=>{let S=M==="string"||M==="stringNumber"?g:m;return M==="boolean"&&(S=y),k.filter(x=>S(x,Z,M))||[]},b=()=>{const k=i.filteringItemsByColumn,M=Object.keys(k),Z=s.originStore;let S=[],x=!1,I=[];M.forEach((L,V)=>{const R=k[L],E=u(L),G=t.columns[E].type,v=i.columnOperator==="or",X=V>0&&i.columnOperator==="and";R.forEach((W,N)=>{!S.length&&!x?S=C(Z,G,{...W,index:E}):X&&W.operator==="or"?N>0?S.push(...C(I,G,{...W,index:E})):S=C(I,G,{...W,index:E}):N===0&&v||N!==0&&W.operator==="or"?S.push(...C(Z,G,{...W,index:E})):S=C(S,G,{...W,index:E}),x=!0}),I=JSON.parse(JSON.stringify(S))}),x?s.filterStore=ub(S,JSON.stringify):s.filterStore=Z};let w=null;return{onSearch:k=>{w&&clearTimeout(w),w=setTimeout(()=>{i.isSearch=!1,i.searchWord=k,k&&(s.searchStore=s.store.filter(M=>{let Z=!1;const S=n.isFilteringColumn?M[me].filter((x,I)=>n.visibleColumnIdx.includes(I)):M[me];for(let x=0;x<s.orderedColumns.length;x++){const I=s.orderedColumns[x]||{};let L=S[I.index]??null;if(I.type=I.type||"string",L!==null&&(L instanceof Array?L=JSON.stringify(L):typeof L=="object"&&(L=L[I.field]),!I.hide&&((I==null?void 0:I.searchable)===void 0||I!=null&&I.searchable)&&(L=r(I,L).toString(),Z=L.toLowerCase().includes(k.toString().toLowerCase()),Z)))break}return Z}),i.isSearch=!0),f(s.store),!k&&a.isClientPaging&&a.prevPage&&(a.currentPage=1,s.pagingStore=d()),h({onSearch:!0}),c()},500)},setFilter:b,setHeaderCheckboxByFilter:f}},nS=e=>{const{contextInfo:t,stores:n,selectInfo:i,onSort:s,filterInfo:l,useGridSetting:a,columnSettingInfo:r,setColumnHidden:c}=e;let d=null;const{emit:h}=o.getCurrentInstance(),u=m=>{d&&clearTimeout(d);const y=[];d=setTimeout(()=>{if(t.customContextMenu.length){const C=t.customContextMenu.map(b=>{const w=b;return w.validate&&(w.disabled=!w.validate(w.itemId,i.selectedRow)),w.selectedRow=i.selectedRow??[],w.contextmenuInfo=i.contextmenuInfo??[],w});y.push(...C)}t.contextMenuItems=y,t.menu.show(m)},200)};return{setContextMenu:u,onContextMenu:m=>{var w,T,k;m.preventDefault();const C=(T=(w=m.target.closest(".row"))==null?void 0:w.dataset)==null?void 0:T.index;let b=null;C&&(b=(k=n.viewStore.find(M=>M[vt]===+C))==null?void 0:k[me]),b&&(i.contextmenuInfo=[b],u(m))},onColumnContextMenu:(m,y)=>{var C,b,w,T,k,M,Z,S;if(m.target.className==="column-name"){const x=y.sortable===void 0?!0:y.sortable,I=l.isFiltering&&y.filterable===void 0?!0:y.filterable,L=[{text:((C=t.columnMenuTextInfo)==null?void 0:C.ascending)??"Ascending",iconClass:"ev-icon-allow2-up",disabled:!x,hidden:(b=t.hiddenColumnMenuItem)==null?void 0:b.ascending,click:()=>s(y,"asc")},{text:((w=t.columnMenuTextInfo)==null?void 0:w.descending)??"Descending",iconClass:"ev-icon-allow2-down",disabled:!x,hidden:(T=t.hiddenColumnMenuItem)==null?void 0:T.descending,click:()=>s(y,"desc")},{text:((k=t.columnMenuTextInfo)==null?void 0:k.filter)??"Filter",iconClass:"ev-icon-filter-list",click:()=>{const V=document.documentElement.clientWidth,R=t.columnMenu.menuStyle.clientX,E=t.columnMenu.menuStyle.pageX,G=350;V<R+G&&(t.columnMenu.menuStyle.left=`${E-G}px`),l.filterSettingPosition={top:t.columnMenu.menuStyle.top,left:t.columnMenu.menuStyle.left},l.isShowFilterSetting=!0,l.filteringColumn=y,h("change-column-info",{type:"filter",columns:n.updatedColumns})},disabled:!I,hidden:((M=t.hiddenColumnMenuItem)==null?void 0:M.filter)||!l.isFiltering},{text:((Z=t.columnMenuTextInfo)==null?void 0:Z.hide)??"Hide",iconClass:"ev-icon-visibility-off",disabled:!a.value||n.orderedColumns.length===1||y.fixed,hidden:((S=t.hiddenColumnMenuItem)==null?void 0:S.hide)||!a.value,click:()=>{c(y.field),h("change-column-status",{columns:n.updatedColumns}),h("change-column-info",{type:"display",columns:n.updatedColumns})}}];if(t.columnMenuItems=[],!x&&!I&&!a.value)return;t.columnMenuItems=L.filter(V=>!V.hidden)}},onGridSettingContextMenu:m=>{const{useDefaultColumnSetting:y,columnSettingTextInfo:C}=r,b={text:(C==null?void 0:C.title)??"Column List",isShowMenu:!0,click:()=>{r.isShowColumnSetting=!0,t.isShowMenuOnClick=!0}};t.customGridSettingContextMenu.length&&(t.gridSettingContextMenuItems=[...t.customGridSettingContextMenu]),y&&t.gridSettingContextMenuItems.push(b),t.gridSettingMenu.show(m)}}},iS=e=>{const{props:t}=o.getCurrentInstance(),{selectInfo:n,checkInfo:i,stores:s,sortInfo:l,elementInfo:a,filterInfo:r,expandedInfo:c,setSort:d,setSortInfo:h,updateVScroll:u,setFilter:f}=e;return{setStore:({rows:g,isMakeIndex:m=!0,isInit:y=!1})=>{var b,w,T;const C=s.orderedColumns.find(k=>(k==null?void 0:k.sortOption)&&["asc","desc"].includes(k.sortOption.sortType));if(m){const k=[];let M=!1;g.forEach((Z,S)=>{const x=t.checked.includes(Z),I=t.uncheckable.includes(Z)||t.disabledRows.includes(Z);let L=!1;n.useSelect&&(L=t.selected.includes(Z)),!x&&!I&&(M=!0);let V=!1;c.useRowDetail&&(V=t.expanded.includes(Z));const R=t.disabledRows.includes(Z);k.push([S,x,Z,L,V,I,R])}),g.length!==t.checked.length&&(g.length===((b=t.uncheckable)==null?void 0:b.length)||g.length===((w=t.disabledRows)==null?void 0:w.length))&&(M=!0),i.isHeaderChecked=g.length>0?!M:!1,i.isHeaderIndeterminate=M&&!!i.checkedRows.length,i.isHeaderUncheckable=g.every(Z=>t.uncheckable.includes(Z)||t.disabledRows.includes(Z)),s.originStore=k}r.isFiltering&&f(),C&&y&&h(C,!1),l.sortField&&d(),(T=a.body)!=null&&T.clientHeight&&u()}}},sS=e=>{const{emit:t}=o.getCurrentInstance(),{stores:n,pageInfo:i,sortInfo:s,filterInfo:l,elementInfo:a,clearCheckInfo:r}=e,c=()=>{const u=(i.currentPage-1)*i.perPage,f=parseInt(u,10)+parseInt(i.perPage,10);return n.store.slice(u,f)},d=u=>{t("page-change",{eventName:u,pageInfo:{currentPage:i.currentPage,prevPage:i.prevPage,startIndex:i.startIndex,total:i.pageTotal,perPage:i.perPage},sortInfo:{field:s.sortField,order:s.sortOrder},searchInfo:{searchWord:l.searchWord,searchColumns:n.orderedColumns.filter(f=>!f.hide&&((f==null?void 0:f.searchable)===void 0||(f==null?void 0:f.searchable))).map(f=>f.field)}}),i.isInfinite&&(u!=null&&u.onSearch||u!=null&&u.onSort)&&(i.currentPage=1,a.body.scrollTop=0,r())};return{getPagingData:c,updatePagingInfo:d,changePage:u=>{if(i.isClientPaging)if(i.prevPage=u,n.store.length<=i.perPage)n.pagingStore=n.store;else{const f=(i.currentPage-1)*i.perPage,p=parseInt(f,10)+parseInt(i.perPage,10);n.pagingStore=n.store.slice(f,p),a.body.scrollTop=0,i.startIndex=f}d({onChangePage:!0})}}},Nr=e=>{const{props:t,emit:n}=o.getCurrentInstance(),{stores:i,columnSettingInfo:s,contextInfo:l,onSearch:a,onResize:r}=e,c=m=>{var y,C,b;if(s.isShowColumnSetting)if(s.columnSettingPosition.columnListMenuWidth=0,l.gridSettingContextMenuItems.length){const w=l.gridSettingContextMenuItems.length-1,T=(b=(C=(y=l.gridSettingMenu)==null?void 0:y.rootMenuList)==null?void 0:C.$el)==null?void 0:b.children[0].children[w].getBoundingClientRect();s.columnSettingPosition.columnListMenuWidth=T.width,s.columnSettingPosition.top=T.top,s.columnSettingPosition.left=T.right}else{const w=m==null?void 0:m.getBoundingClientRect(),T=w==null?void 0:w.height;s.columnSettingPosition.top=(w==null?void 0:w.top)+T,s.columnSettingPosition.left=w==null?void 0:w.right}},d=()=>{i.filteredColumns.length=0,s.isFilteringColumn=!1,s.visibleColumnIdx=[],s.hiddenColumn=""},h=()=>Array.isArray(i.movedColumns)&&i.movedColumns.length?i.movedColumns:i.originColumns||[],u=(m,y)=>{var b;if(!m)return;m.hiddenDisplay=y;const C=(b=i.originColumns)==null?void 0:b.find(w=>w.index===m.index);if(C&&C!==m&&(C.hiddenDisplay=y),Array.isArray(i.movedColumns)){const w=i.movedColumns.find(T=>T.index===m.index);w&&w!==m&&(w.hiddenDisplay=y)}},f=()=>{s.visibleColumnIdx=i.filteredColumns.map(C=>C.index);const m=i.originColumns.filter(C=>!C.hide||C.hiddenDisplay).map(C=>C.index),y=s.visibleColumnIdx;s.isFilteringColumn=y.length!==m.length,t.option.searchValue&&a(t.option.searchValue),r()};return{setPositionColumnSetting:c,initColumnSettingInfo:d,onApplyColumn:m=>{const y=i.orderedColumns.filter(T=>!T.hide&&!T.hiddenDisplay);if(m.length===y.length&&y.every(T=>m.includes(T.field)))return;const b=h(),w=new Set(m);i.filteredColumns=b.filter(T=>{const k=w.has(T.field)||!T.caption;return u(T,!k),k}),s.hiddenColumn="",f(),n("change-column-status",{columns:i.updatedColumns}),n("change-column-info",{type:"display",columns:i.updatedColumns})},setColumnHidden:m=>{const y=i.orderedColumns.filter(b=>!b.hide&&!b.hiddenDisplay);if(y.length===1)return;i.filteredColumns=y.filter(b=>{const w=b.field===m;return u(b,w),!w}),h().forEach(b=>{b.field===m&&u(b,!0)}),s.hiddenColumn=m,f()}}},oS=({stores:e})=>{const{emit:t}=o.getCurrentInstance(),n=r=>{var u;const c=(u=e.movedColumns)!=null&&u.length?[...e.movedColumns]:[...e.originColumns],d=[...r],h=new Set(d.map(f=>f.index));e.movedColumns=c.map(f=>h.has(f.index)?d.shift():f)},i=(r,c)=>{const d=parseInt(r,10),h=parseInt(c,10);if(!Number.isInteger(d)||!Number.isInteger(h))return;const u=[...e.orderedColumns],f=u[d];u.splice(d,1),u.splice(h,0,f),e.filteredColumns.length&&(e.filteredColumns=u),n(u)};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;i(c,d),t("change-column-order",{column:e.orderedColumns[d],columns:e.updatedColumns}),t("change-column-info",{type:"order",columns:e.updatedColumns})}}},lS={name:"EvGrid",directives:{clickoutside:Yi,observeVisibility:Qs,resize:En},components:{Toolbar:f0,GridPagination:Rr,GridSummary:Wr,ColumnSetting:Zr,FilterSetting:D0,GridSortButton:Xr,GridOptionButton:zo},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 nc,ic,sc,oc,lc,ac,rc,cc,dc;const{isRenderer:a,getComponentName:r,getConvertValue:c,getColumnIndex:d,setPixelUnit:h}=U0(),u=o.ref(null),f=o.computed(()=>{var K,ie;return((ie=(K=e.option)==null?void 0:K.useGridSetting)==null?void 0:ie.use)||!1}),p=o.computed(()=>e.option.showHeader??!0),g=o.computed(()=>{var K;return((K=e.option)==null?void 0:K.useSummary)||!1}),m=o.computed(()=>{var K;return((K=e.option.style)==null?void 0:K.stripe)||!1}),y=o.computed(()=>{var K;return((K=e.option.style)==null?void 0:K.border)||""}),C=o.computed(()=>{var K;return((K=e.option.style)==null?void 0:K.highlight)??-1}),b=o.computed(()=>e.option.emptyText??"No records"),w=e.option.rowMinHeight||35,T=o.ref(0),k=o.reactive({body:null,header:null,table:null,resizeLine:null,"grid-wrapper":null}),M=o.reactive({isSearch:!1,searchWord:"",isFiltering:o.computed(()=>e.option.useFilter??!1),isShowFilterSetting:!1,filterSettingPosition:{left:0,top:0},filteringColumn:null,filteringItemsByColumn:{},columnOperator:"and"}),Z=o.reactive({isShowColumnSetting:!1,isFilteringColumn:!1,visibleColumnIdx:[],hiddenColumn:"",columnSettingPosition:{top:0,left:0,columnListMenuWidth:0},useDefaultColumnSetting:o.computed(()=>{var K,ie;return((ie=(K=e.option)==null?void 0:K.useGridSetting)==null?void 0:ie.useDefaultColumnSetting)??!0}),columnSettingTextInfo:{title:((ic=(nc=e.option)==null?void 0:nc.useGridSetting)==null?void 0:ic.columnMenuText)??"Column List",search:((oc=(sc=e.option)==null?void 0:sc.useGridSetting)==null?void 0:oc.searchText)??"Search",empty:((ac=(lc=e.option)==null?void 0:lc.useGridSetting)==null?void 0:ac.emptyText)??"No records",ok:((cc=(rc=e.option)==null?void 0:rc.useGridSetting)==null?void 0:cc.okBtnText)??"OK"}}),S=o.reactive({viewStore:[],originStore:[],pagingStore:[],searchStore:[],filterStore:[],store:o.computed(()=>{const K=M.isFiltering?S.filterStore:S.originStore;return M.isSearch?S.searchStore:K}),filteredColumns:[],movedColumns:[],originColumns:o.computed(()=>e.columns.map((K,ie)=>{var Le;return{index:ie,hiddenDisplay:!1,...K,width:isFinite(K.width)?K.width:void 0,sortOption:{sortType:((Le=K==null?void 0:K.sortOption)==null?void 0:Le.sortType)||"init"}}})),orderedColumns:o.computed(()=>{const K=S.movedColumns.length?S.movedColumns:S.originColumns;return S.filteredColumns.length?S.filteredColumns:K}),updatedColumns:o.computed(()=>us(S))}),x=o.reactive({usePage:o.computed(()=>{var K;return((K=e.option.page)==null?void 0:K.use)||!1}),useClient:((dc=e.option.page)==null?void 0:dc.useClient)||!1,isInfinite:o.computed(()=>{var K;return((K=e.option.page)==null?void 0:K.isInfinite)||!1}),startIndex:0,prevPage:0,currentPage:0,pageTotal:o.computed(()=>{var K,ie;return(K=e.option.page)!=null&&K.useClient?S.store.length:(ie=e.option.page)==null?void 0:ie.total}),perPage:o.computed(()=>{var K;return((K=e.option.page)==null?void 0:K.perPage)||20}),visiblePage:o.computed(()=>{var K;return((K=e.option.page)==null?void 0:K.visiblePage)||8}),order:o.computed(()=>{var K;return((K=e.option.page)==null?void 0:K.order)||"center"}),showPageInfo:o.computed(()=>{var K;return((K=e.option.page)==null?void 0:K.showPageInfo)||!1}),isClientPaging:o.computed(()=>x.useClient&&x.usePage&&!x.isInfinite),isHighlight:!1,highlightPage:0}),I=o.reactive({prevCheckedRow:[],isHeaderChecked:!1,isHeaderUncheckable:!1,isHeaderIndeterminate:!1,checkedRows:e.checked,useCheckbox:o.computed(()=>e.option.useCheckbox||{})}),L=o.reactive({expandedRows:e.expanded,useRowDetail:o.computed(()=>{var K,ie;return((ie=(K=e.option)==null?void 0:K.rowDetail)==null?void 0:ie.use)??!1}),detailRowHeight:o.computed(()=>{var K,ie;return(ie=(K=e.option)==null?void 0:K.rowDetail)==null?void 0:ie.detailRowHeight})}),V=o.reactive({lastScroll:{top:0,left:0},vScrollTopHeight:0,vScrollBottomHeight:0,hasVerticalScrollBar:!1,hasHorizontalScrollBar:!1}),R=o.reactive({contextmenuInfo:e.contextmenuInfo,selectedRow:e.selected,useSelect:o.computed(()=>{var K,ie;return((ie=(K=e.option)==null?void 0:K.useSelection)==null?void 0:ie.use)??!0}),multiple:o.computed(()=>{var K,ie;return((ie=(K=e.option)==null?void 0:K.useSelection)==null?void 0:ie.multiple)??!1})}),E=o.reactive({isSorting:!1,sortField:"",sortOrder:"",sortColumn:{},sortFunction:e.option.customAscFunction??{}}),G=o.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:o.computed(()=>{var K,ie;return((ie=(K=e.option)==null?void 0:K.useGridSetting)==null?void 0:ie.customContextMenu)||[]}),isShowMenuOnClick:!1}),v=o.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:o.computed(()=>e.option.rowHeight>w?e.option.rowHeight:w),gridWidth:o.computed(()=>e.width?h(e.width):"100%"),gridHeight:o.computed(()=>e.height?h(e.height):"100%")}),X=()=>{I.checkedRows=[],I.isHeaderChecked=!1,I.isHeaderIndeterminate=!1,S.store.forEach(K=>{K[1]=!1})},W=()=>{R.selectedRow=[],S.store.forEach(K=>{K[3]=!1})},N=()=>{S.store.forEach(K=>{K[4]=!1}),L.expandedRows=[]},{getPagingData:P,updatePagingInfo:D,changePage:O}=sS({stores:S,pageInfo:x,sortInfo:E,filterInfo:M,elementInfo:k,clearCheckInfo:X}),Y=o.ref(0),{updateVScroll:H,updateHScroll:B,onScroll:z}=J0({scrollInfo:V,stores:S,elementInfo:k,resizeInfo:v,pageInfo:x,summaryScroll:Y,expandedInfo:L,getPagingData:P,updatePagingInfo:D}),{onCheck:F,onCheckAll:Q}=$0({checkInfo:I,stores:S,pageInfo:x,getPagingData:P}),{onExpanded:U}=q0({expandedInfo:L}),{onSort:ee,getSortTarget:j,setSort:te,setSortInfo:J,hasSortTarget:q}=eS({sortInfo:E,stores:S,updatePagingInfo:D}),{onSearch:$,setFilter:ae,setHeaderCheckboxByFilter:he}=tS({columnSettingInfo:Z,filterInfo:M,stores:S,checkInfo:I,pageInfo:x,getConvertValue:c,updateVScroll:H,getPagingData:P,updatePagingInfo:D,getColumnIndex:d}),{setStore:se}=iS({selectInfo:R,checkInfo:I,stores:S,sortInfo:E,elementInfo:k,filterInfo:M,expandedInfo:L,setSort:te,setSortInfo:J,updateVScroll:H,setFilter:ae}),{calculatedColumn:fe,onResize:ge,onShow:le,onColumnResize:ce}=j0({resizeInfo:v,elementInfo:k,checkInfo:I,expandedInfo:L,stores:S,isRenderer:a,updateVScroll:H,updateHScroll:B,contextInfo:G}),{setPositionColumnSetting:be,initColumnSettingInfo:Ie,onApplyColumn:Ve,setColumnHidden:kt}=Nr({stores:S,columnSettingInfo:Z,contextInfo:G,onSearch:$,onResize:ge}),{setContextMenu:Vt,onContextMenu:jo,onColumnContextMenu:Qo,onGridSettingContextMenu:gs}=nS({contextInfo:G,stores:S,selectInfo:R,useGridSetting:f,filterInfo:M,columnSettingInfo:Z,setColumnHidden:kt,onSort:ee}),{onRowClick:bs,onRowDblClick:ys}=Q0({selectInfo:R,stores:S}),{onDragStart:xs,onDragOver:Ss,onDrop:Cs}=oS({stores:S}),ks=K=>{G.gridSettingContextMenuItems.length=0,G.customGridSettingContextMenu.length?gs(K):Z.isShowColumnSetting=!0},sn=K=>{var ie,Le,wt,on,ki,Et,ot,ws,Is,hc;K.type==="wheel"&&((ie=G.menu)==null||ie.hide(K)),K.type==="scroll"&&!((Le=K.target.classList)!=null&&Le.contains("table-body"))&&!((on=(wt=K.target.offsetParent)==null?void 0:wt.classList)!=null&&on.contains("ev-select-dropbox"))&&!((Et=(ki=K.target.offsetParent)==null?void 0:ki.classList)!=null&&Et.contains("ev-grid-column-setting"))&&!((ws=(ot=K.target.offsetParent)==null?void 0:ot.classList)!=null&&ws.contains("ev-text-field-wrapper"))&&(M.isShowFilterSetting=!1,Z.isShowColumnSetting=!1,G.isShowMenuOnClick=!1,(Is=G.columnMenu)==null||Is.hide(K),(hc=G.gridSettingMenu)==null||hc.hide())};o.onMounted(()=>{fe(),se({rows:e.rows,isInit:!0}),document.addEventListener("wheel",sn,{capture:!1}),document.addEventListener("scroll",sn,{capture:!0})}),o.onUnmounted(()=>{document.removeEventListener("wheel",sn,{capture:!1}),document.removeEventListener("scroll",sn,{capture:!0})}),o.onActivated(()=>{ge()}),o.onUpdated(()=>{var K;T.value=((K=k["grid-wrapper"])==null?void 0:K.offsetWidth)/1.5||0}),o.watch(()=>Z.isShowColumnSetting,K=>{var ie;if(!K){(ie=G.gridSettingMenu)==null||ie.hide();return}be(u.value)}),o.watch(()=>e.columns,()=>{q()?J(j()):(J(j()),te()),M.filteringColumn=null,M.filteringItemsByColumn={},S.filterStore=[],se({rows:[],isMakeIndex:!1}),Ie(),S.movedColumns.length=0},{deep:!0}),o.watch(()=>E.isSorting,K=>{K&&(se({rows:S.originStore,isMakeIndex:!1}),E.isSorting=!K,x.isClientPaging&&(x.currentPage=1,S.pagingStore=P(),X()))}),o.watch(()=>e.rows,K=>{se({rows:K}),M.isSearch&&$(M.searchWord),ge()},{deep:!0}),o.watch(()=>e.uncheckable,()=>{se({rows:e.rows})},{deep:!0}),o.watch(()=>e.checked,K=>{I.checkedRows=K}),o.watch(()=>e.disabledRows,()=>{S.store.length&&S.store.forEach(K=>{K[6]=e.disabledRows.includes(K[2])})},{deep:!0}),o.watch(()=>I.checkedRows,K=>{I.isHeaderChecked=!1;let ie=S.store;x.isClientPaging&&(ie=P()),ie.length&&(ie.forEach(Le=>{Le[1]=K.includes(Le[2])}),I.isHeaderChecked=K.length===ie.length),H()}),o.watch(()=>e.selected,K=>{R.useSelect&&(R.selectedRow=K)}),o.watch(()=>R.selectedRow,K=>{R.useSelect&&(S.store.forEach(ie=>{ie[3]=K.includes(ie[2])&&!e.disabledRows.includes(ie[2])}),H())}),o.watch(()=>C.value,async K=>{if(await o.nextTick(),K>=0){if(x.usePage&&!x.isInfinite&&(x.highlightPage=Math.ceil(K/x.perPage)||1,x.highlightPage!==x.currentPage)){x.currentPage=x.highlightPage,x.isHighlight=!0;return}k.body.scrollTop=v.rowHeight*C.value}}),o.watch(()=>I.useCheckbox.mode,()=>{X()}),o.watch(()=>R.useSelect,()=>{W()}),o.watch(()=>R.multiple,()=>{W()}),o.watch(()=>e.checked.length,K=>{K||X()}),o.watch(()=>e.expanded.length,K=>{K||N(),H()}),o.watch(()=>[e.option.columnWidth,v.gridWidth],async()=>{await o.nextTick(),v.columnWidth=e.option.columnWidth;const K=k["grid-wrapper"];K.style.width=v.gridWidth,K.style.height=v.gridHeight,S.orderedColumns.map(ie=>{var wt;const Le=ie;return!((wt=e.columns[ie.index])!=null&&wt.width)&&!Le.resized&&(Le.width=0),Le}),ge()}),o.watch(()=>e.option.searchValue,K=>{K!==void 0&&($((K==null?void 0:K.value)??K),x.isClientPaging&&(X(),W()))},{immediate:!0}),o.watch(()=>{var K;return(K=e.option.page)==null?void 0:K.currentPage},K=>{var Le;const ie=K||1;x.currentPage=(Le=e.option.page)!=null&&Le.isInfinite?1:ie},{immediate:!0}),o.watch(()=>x.currentPage,(K,ie)=>{o.nextTick(()=>{O(ie),x.isClientPaging&&K!==ie&&(X(),W()),H(),K===x.highlightPage&&x.isHighlight&&(k.body.scrollTop=v.rowHeight*C.value,x.isHighlight=!x.isHighlight)})});const In=o.reactive({boxTop:0,boxLeft:0}),_=o.ref(null),oe=o.ref(!1),pe=o.ref(!1),ke=o.ref(null),ve=o.ref({}),ze=o.reactive({caption:"",field:""}),Qe=o.ref([]),rk=[{name:"AND",value:"and"},{name:"OR",value:"or"}],$o=o.ref(0),ck=({caption:K,field:ie},Le)=>{if(ze.caption=K,ze.field=ie,Qe.value=Le,(Le==null?void 0:Le.length)>1){oe.value=!0;const wt=_.value.getBoundingClientRect().left,on=window.pageYOffset+_.value.getBoundingClientRect().top+_.value.getBoundingClientRect().height;In.boxTop=`${on}px`,In.boxLeft=`${wt}px`}},dk=()=>{S.filterStore=[],se({rows:[],isMakeIndex:!1})},qo=async K=>{var on,ki;K&&pe.value&&($o.value=0);const ie=(on=_.value)==null?void 0:on.getElementsByClassName("filtering-items__item"),Le=[];let wt=0;if(ie){for(let Et=0;Et<ie.length;Et++){const ot=ie[Et];ot.classList.remove("non-display");const ws=(ki=_.value.getBoundingClientRect())==null?void 0:ki.width,{width:Is}=ot.getBoundingClientRect();wt+=Is+10,ws-150<=wt&&!ot.classList.contains("filtering-items__item--count")?($o.value++,Le.push(ot),ve.value={...ve.value,[ot.dataset.field]:Ze(M.filteringItemsByColumn[ot.dataset.field])}):delete ve.value[ot.dataset.field]}ie.forEach(Et=>{const ot=Le.includes(Et);Et.classList.toggle("non-display",ot)})}},hk=async(K,ie)=>{ie!=null&&ie.length?(M.filteringItemsByColumn[K]=ie,pe.value=!0):(delete ve.value[K],delete M.filteringItemsByColumn[K]),await o.nextTick(),qo(!0),M.isShowFilterSetting=!1,S.filterStore=[],se({rows:[],isMakeIndex:!1}),he(S.filterStore)};let el=null;const uk=()=>{el&&clearTimeout(el),el=setTimeout(()=>{pe.value=!pe.value,qo(pe.value)},150)},fk=()=>{M.filteringColumn=null,M.filteringItemsByColumn={},ve.value={},S.filterStore=[],se({rows:[],isMakeIndex:!1})},mk=o.computed(()=>{var K;return{width:`${T.value}px`,top:`${((K=_.value)==null?void 0:K.getBoundingClientRect().height)||0}px`}}),pk=K=>{const ie=M.filteringItemsByColumn[K];return ie==null?void 0:ie[ie.length-1]},gk=()=>{const K=document.createElement("div");K.id="ev-grid-filtering-items-modal",K.setAttribute("style","position: absolute; top: 0; left: 0;"),document.getElementById("ev-grid-filtering-items-modal")||document.body.appendChild(K)};return o.onBeforeMount(()=>gk()),{idColIndex:o.computed(()=>{var K;return(K=S.orderedColumns.find(ie=>ie.field==="id"))==null?void 0:K.index}),summaryScroll:Y,showHeader:p,stripeStyle:m,borderStyle:y,highlightIdx:C,useSummary:g,useGridSetting:f,toolbarRef:u,stores:S,emptyText:b,...o.toRefs(k),...o.toRefs(S),...o.toRefs(M),...o.toRefs(V),...o.toRefs(x),...o.toRefs(v),...o.toRefs(R),...o.toRefs(I),...o.toRefs(L),...o.toRefs(E),...o.toRefs(G),...o.toRefs(Z),isRenderer:a,getComponentName:r,getConvertValue:c,getColumnIndex:d,setPixelUnit:h,updateVScroll:H,updateHScroll:B,onScroll:z,calculatedColumn:fe,onResize:ge,onShow:le,onColumnResize:ce,onRowClick:bs,onRowDblClick:ys,onCheck:F,onCheckAll:Q,onExpanded:U,onSort:ee,setSort:te,setStore:se,setContextMenu:Vt,onContextMenu:jo,onSearch:$,setGridSetting:ks,onApplyColumn:Ve,onColumnContextMenu:Qo,filteringItemsWidth:T,isShowColumnFilteringItems:pe,operatorItems:rk,selectedFilteringItems:Qe,selectedFilteringColumn:ze,filteringItemsRef:_,isShowFilteringItemsBox:oe,filteringItemsStyle:mk,hiddenFilteringItemsCount:$o,...o.toRefs(In),hiddenFilteringItemsRef:ke,hiddenFilteringItemsByColumn:ve,removeAllFiltering:fk,onExpandFilteringItems:uk,setColumnFilteringItems:qo,onChangeOperator:dk,onApplyFilter:hk,onClickFilteringItem:ck,getFilteringItemByField:pk,onDragStart:xs,onDragOver:Ss,onDrop:Cs,ROW_DISABLED_INDEX:6}}},aS={key:0,class:"filtering-items filtering-items--used"},rS={key:1,ref:"filteringItemsRef",class:"filtering-items"},cS=["data-field","onClick"],dS={class:"filtering-items__item--title"},hS=["title"],uS={key:1,class:"filtering-items__item--value"},fS=["onClick"],mS={class:"filtering-items__item--title"},pS=["title"],gS={key:1,class:"filtering-items__item--value"},bS={class:"column-list"},yS=["data-index"],xS=["title","onClick"],SS=["onClick"],CS=["onMousedown"],kS={ref:"table"},wS=["data-index","disabled","onClick","onContextmenu","onDblclick"],IS=["data-name","data-index","disabled"],LS={key:0},TS=["title"],MS=["disabled"],RS=["disabled"],vS={key:0},VS=["colspan"],ES={key:0},GS={class:"is-empty"},WS={ref:"resizeLine",class:"table-resize-line"};function ZS(e,t,n,i,s,l){var T;const a=o.resolveComponent("ev-icon"),r=o.resolveComponent("ev-select"),c=o.resolveComponent("grid-option-button"),d=o.resolveComponent("toolbar"),h=o.resolveComponent("ev-checkbox"),u=o.resolveComponent("grid-sort-button"),f=o.resolveComponent("ev-context-menu"),p=o.resolveComponent("grid-summary"),g=o.resolveComponent("grid-pagination"),m=o.resolveComponent("filter-setting"),y=o.resolveComponent("column-setting"),C=o.resolveDirective("clickoutside"),b=o.resolveDirective("resize"),w=o.resolveDirective("observe-visibility");return o.openBlock(),o.createElementBlock(o.Fragment,null,[e.$slots.toolbar||i.useGridSetting?(o.openBlock(),o.createElementBlock("div",{key:0,ref:"toolbarRef",class:"toolbar-wrapper",style:o.normalizeStyle(`width: ${e.gridWidth};`)},[o.createVNode(d,null,{toolbarWrapper:o.withCtx(()=>[o.createElementVNode("div",{class:"filtering",style:o.normalizeStyle({width:`${i.filteringItemsWidth}px`})},[e.isFiltering&&!Object.keys(e.filteringItemsByColumn).length?(o.openBlock(),o.createElementBlock("div",aS,[o.createVNode(a,{icon:"ev-icon-filter-list"}),t[18]||(t[18]=o.createElementVNode("span",null,"Filter",-1))])):o.createCommentVNode("",!0),e.isFiltering&&Object.keys(e.filteringItemsByColumn).length?(o.openBlock(),o.createElementBlock("div",rS,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(Object.keys(e.filteringItemsByColumn),(k,M)=>{var Z,S,x,I;return o.openBlock(),o.createElementBlock(o.Fragment,{key:M},[M===0?(o.openBlock(),o.createElementBlock("div",{key:0,class:"filtering-items__item filtering-items__item--filter",onClick:t[0]||(t[0]=o.withModifiers((...L)=>i.onExpandFilteringItems&&i.onExpandFilteringItems(...L),["stop"]))},[o.createVNode(a,{icon:"ev-icon-filter-list",class:"filtering-items-expand"}),o.createElementVNode("span",null," Filter ("+o.toDisplayString(Object.keys(e.filteringItemsByColumn).length)+") ",1),o.createVNode(a,{class:"filtering-items__item--remove",icon:"ev-icon-s-close",style:{"margin-left":"0"},onClick:o.withModifiers(i.removeAllFiltering,["stop"])},null,8,["onClick"])])):o.createCommentVNode("",!0),M===1?(o.openBlock(),o.createBlock(r,{key:1,modelValue:e.columnOperator,"onUpdate:modelValue":t[1]||(t[1]=L=>e.columnOperator=L),items:i.operatorItems,class:"filtering-items__item--operator",onChange:i.onChangeOperator},null,8,["modelValue","items","onChange"])):o.createCommentVNode("",!0),o.createElementVNode("div",{class:"filtering-items__item non-display","data-field":k,onClick:o.withModifiers(L=>{var V;return i.onClickFilteringItem({caption:(V=i.getFilteringItemByField(k))==null?void 0:V.caption,field:k},e.filteringItemsByColumn[k])},["stop"])},[o.createElementVNode("span",dS,o.toDisplayString((Z=i.getFilteringItemByField(k))==null?void 0:Z.caption)+" "+o.toDisplayString((S=i.getFilteringItemByField(k))==null?void 0:S.comparison),1),e.filteringItemsByColumn[k].length<2?(o.openBlock(),o.createElementBlock("span",{key:0,class:"filtering-items__item--value",title:(x=i.getFilteringItemByField(k))==null?void 0:x.value},o.toDisplayString((I=i.getFilteringItemByField(k))==null?void 0:I.value),9,hS)):(o.openBlock(),o.createElementBlock("span",uS," + "+o.toDisplayString(e.filteringItemsByColumn[k].length),1)),o.createVNode(a,{class:"filtering-items__item--remove",icon:"ev-icon-s-close",onClick:L=>i.onApplyFilter(k,[])},null,8,["onClick"])],8,cS)],64)}),128)),i.isShowColumnFilteringItems&&Object.keys(e.filteringItemsByColumn).length&&i.hiddenFilteringItemsCount>0?(o.openBlock(),o.createElementBlock("div",{key:0,class:"filtering-items__item filtering-items__item--count",onClick:t[2]||(t[2]=(...k)=>i.onExpandFilteringItems&&i.onExpandFilteringItems(...k))}," + "+o.toDisplayString(i.hiddenFilteringItemsCount),1)):o.createCommentVNode("",!0)],512)):o.createCommentVNode("",!0),!i.isShowColumnFilteringItems&&Object.keys(i.hiddenFilteringItemsByColumn).length?o.withDirectives((o.openBlock(),o.createElementBlock("div",{key:2,ref:"hiddenFilteringItemsRef",class:"filtering-items filtering-items__hidden-items",style:o.normalizeStyle(i.filteringItemsStyle)},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(Object.keys(i.hiddenFilteringItemsByColumn),(k,M)=>{var Z,S,x,I;return o.openBlock(),o.createElementBlock("div",{key:M,class:"filtering-items__item",onClick:o.withModifiers(L=>{var V;return i.onClickFilteringItem({caption:(V=i.getFilteringItemByField(k))==null?void 0:V.caption,field:k},i.hiddenFilteringItemsByColumn[k])},["stop"])},[o.createElementVNode("span",mS,o.toDisplayString((Z=i.getFilteringItemByField(k))==null?void 0:Z.caption)+" "+o.toDisplayString((S=i.getFilteringItemByField(k))==null?void 0:S.comparison),1),i.hiddenFilteringItemsByColumn[k].length<2?(o.openBlock(),o.createElementBlock("span",{key:0,class:"filtering-items__item--value",title:(x=i.getFilteringItemByField(k))==null?void 0:x.value},o.toDisplayString((I=i.getFilteringItemByField(k))==null?void 0:I.value),9,pS)):(o.openBlock(),o.createElementBlock("span",gS," + "+o.toDisplayString(i.hiddenFilteringItemsByColumn[k].length),1)),o.createVNode(a,{class:"filtering-items__item--remove",icon:"ev-icon-s-close",onClick:L=>i.onApplyFilter(k,[],!0)},null,8,["onClick"])],8,fS)}),128))],4)),[[C,()=>{i.isShowColumnFilteringItems||i.onExpandFilteringItems()}]]):o.createCommentVNode("",!0)],4),i.useGridSetting?(o.openBlock(),o.createBlock(c,{key:0,class:"grid-setting__icon",onClick:t[3]||(t[3]=k=>i.setGridSetting(k))})):o.createCommentVNode("",!0),o.renderSlot(e.$slots,"toolbar",{item:{onSearch:i.onSearch}},void 0,!0)]),_:3})],4)):o.createCommentVNode("",!0),o.withDirectives((o.openBlock(),o.createElementBlock("div",o.mergeProps({ref:"grid-wrapper"},e.$attrs,{class:"grid-wrapper",style:`width: ${e.gridWidth}; height: ${e.gridHeight};`}),[o.createElementVNode("div",{ref:"grid",class:o.normalizeClass({table:!0,adjust:e.adjust,"ev-grid":!0,"non-header":!i.showHeader,"ev-grid--empty":!e.viewStore.length})},[o.withDirectives(o.createElementVNode("div",{ref:"header",class:o.normalizeClass({"table-header":!0,"non-border":!!i.borderStyle})},[o.createElementVNode("ul",bS,[e.useCheckbox.use?(o.openBlock(),o.createElementBlock("li",{key:0,class:o.normalizeClass({column:!0,"checkbox-all":!0,"non-border":!!i.borderStyle}),style:o.normalizeStyle({width:`${e.minWidth}px`,"border-right":"1px solid #CFCFCF"})},[e.useCheckbox.use&&e.useCheckbox.headerCheck&&e.useCheckbox.mode!=="single"?(o.openBlock(),o.createBlock(h,{key:0,modelValue:e.isHeaderChecked,"onUpdate:modelValue":t[4]||(t[4]=k=>e.isHeaderChecked=k),disabled:e.isHeaderUncheckable,indeterminate:e.isHeaderIndeterminate,onChange:i.onCheckAll},null,8,["modelValue","disabled","indeterminate","onChange"])):o.createCommentVNode("",!0)],6)):o.createCommentVNode("",!0),e.useRowDetail?(o.openBlock(),o.createElementBlock("li",{key:1,class:o.normalizeClass({column:!0,"non-border":!!i.borderStyle}),style:o.normalizeStyle({width:`${e.minWidth}px`,"border-right":"1px solid #CFCFCF"})},null,6)):o.createCommentVNode("",!0),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.orderedColumns,(k,M)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:M},[!k.hide&&!k.hiddenDisplay?(o.openBlock(),o.createElementBlock("li",{key:0,"data-index":M,class:o.normalizeClass({column:!0,render:i.isRenderer(k),"non-border":!!i.borderStyle,[k.field]:k.field}),style:o.normalizeStyle({width:`${k.width}px`,"min-width":`${i.isRenderer(k)?e.rendererMinWidth:e.minWidth}px`,"margin-right":e.orderedColumns.length-1===M&&(e.hasVerticalScrollBar||e.hasHorizontalScrollBar)?`${e.scrollWidth}px`:"0px","border-right":e.orderedColumns.length-1===M?"none":"1px solid #CFCFCF"}),draggable:!0,onDragstart:t[6]||(t[6]=(...Z)=>i.onDragStart&&i.onDragStart(...Z)),onDragover:t[7]||(t[7]=(...Z)=>i.onDragOver&&i.onDragOver(...Z)),onDrop:t[8]||(t[8]=(...Z)=>i.onDrop&&i.onDrop(...Z))},[k.customHeader&&e.$slots.customHeader?o.renderSlot(e.$slots,"customHeader",{key:0},void 0,!0):(o.openBlock(),o.createElementBlock("span",{key:1,title:k.caption,class:"column-name",onClick:[Z=>i.onColumnContextMenu(Z,k),t[5]||(t[5]=o.withModifiers((...Z)=>e.columnMenu.show&&e.columnMenu.show(...Z),["prevent"]))]},[o.createTextVNode(o.toDisplayString(k.caption)+" ",1),o.createElementVNode("span",{onClick:o.withModifiers(Z=>i.onSort(k),["stop"])},[e.$slots.sortIcon?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[k.sortable===void 0||k.sortable?(o.openBlock(),o.createElementBlock("span",{key:0,class:"column-sort__icon column-sort__icon--basic",style:o.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`})},[o.renderSlot(e.$slots,"sortIcon",{},void 0,!0)],4)):o.createCommentVNode("",!0),e.sortField===k.field?(o.openBlock(),o.createElementBlock("span",{key:1,class:o.normalizeClass([{"column-sort__icon":!0,"column-sort__icon--asc":e.sortOrder==="asc","column-sort__icon--desc":e.sortOrder==="desc"}]),style:o.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`})},[o.renderSlot(e.$slots,`sortIcon_${e.sortOrder}`,{},void 0,!0)],6)):o.createCommentVNode("",!0)],64)):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[k.sortable===void 0||k.sortable?(o.openBlock(),o.createBlock(u,{key:0,class:"column-sort__icon column-sort__icon--basic",icon:"basic",style:o.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`})},null,8,["style"])):o.createCommentVNode("",!0),e.sortField===k.field?(o.openBlock(),o.createBlock(u,{key:1,class:o.normalizeClass([{"column-sort__icon":!0,"column-sort__icon--asc":e.sortOrder==="asc","column-sort__icon--desc":e.sortOrder==="desc"}]),icon:e.sortOrder,style:o.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`,visibility:e.sortOrder?k.hidden:!0})},null,8,["class","icon","style"])):o.createCommentVNode("",!0)],64))],8,SS)],8,xS)),o.createElementVNode("span",{class:"column-resize",onMousedown:o.withModifiers(Z=>i.onColumnResize(M,Z),["stop","left"])},null,40,CS)],46,yS)):o.createCommentVNode("",!0)],64))),128)),(T=e.$props.option.customContextMenu)!=null&&T.length?(o.openBlock(),o.createElementBlock("li",{key:2,class:o.normalizeClass({column:!0,"non-border":!!i.borderStyle}),style:o.normalizeStyle({width:"30px","min-width":"30px","margin-right":e.hasVerticalScrollBar||e.hasHorizontalScrollBar?`${e.scrollWidth}px`:"0px"})},null,6)):o.createCommentVNode("",!0)])],2),[[o.vShow,i.showHeader]]),o.createElementVNode("div",{ref:"body",class:o.normalizeClass({stripe:i.stripeStyle,"table-body":!0,"bottom-border":!!e.viewStore.length,"non-border":!!i.borderStyle}),onScroll:t[11]||(t[11]=(...k)=>i.onScroll&&i.onScroll(...k)),onContextmenu:t[12]||(t[12]=k=>i.onContextMenu(k))},[o.createElementVNode("div",{style:o.normalizeStyle(`height: ${e.vScrollTopHeight}px;`),class:"vscroll-spacer"},null,4),o.createElementVNode("table",kS,[o.createElementVNode("tbody",null,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.viewStore,(k,M)=>{var Z,S;return o.openBlock(),o.createElementBlock(o.Fragment,{key:i.idColIndex!=null?k[2][i.idColIndex]:M},[o.createElementVNode("tr",{"data-index":k[0],class:o.normalizeClass({row:!0,selected:k[3],highlight:k[0]===i.highlightIdx,"non-border":!!i.borderStyle&&i.borderStyle!=="rows"}),disabled:k[i.ROW_DISABLED_INDEX],onClick:x=>i.onRowClick(x,k),onContextmenu:x=>i.onRowClick(x,k,!0),onDblclick:x=>i.onRowDblClick(x,k)},[e.useCheckbox.use?(o.openBlock(),o.createElementBlock("td",{key:0,class:o.normalizeClass({cell:!0,"row-checkbox":!0,"non-border":!!i.borderStyle}),style:o.normalizeStyle({width:`${e.minWidth}px`,height:`${e.rowHeight}px`,"border-right":"1px solid #CFCFCF"})},[o.createVNode(h,{modelValue:k[1],"onUpdate:modelValue":x=>k[1]=x,class:"row-checkbox-input",disabled:k[5]||k[i.ROW_DISABLED_INDEX],onChange:x=>i.onCheck(x,k)},null,8,["modelValue","onUpdate:modelValue","disabled","onChange"])],6)):o.createCommentVNode("",!0),e.useRowDetail?(o.openBlock(),o.createElementBlock("td",{key:1,class:o.normalizeClass({cell:!0,"row-detail-toggle":!0,"non-border":!!i.borderStyle,"row-detail-toggle--expanded":k[4]}),style:o.normalizeStyle({width:`${e.minWidth}px`,height:`${e.rowHeight}px`,"border-right":"1px solid #CFCFCF"})},[o.createVNode(a,{modelValue:k[4],"onUpdate:modelValue":x=>k[4]=x,icon:"ev-icon-s-play",class:"row-detail-toggle-icon",onClick:o.withModifiers(x=>i.onExpanded(x,k),["stop"])},null,8,["modelValue","onUpdate:modelValue","onClick"])],6)):o.createCommentVNode("",!0),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.orderedColumns,(x,I)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:`${i.idColIndex!=null?k[2][i.idColIndex]:M}-${I}`},[!x.hide&&!x.hiddenDisplay?(o.openBlock(),o.createElementBlock("td",{key:0,"data-name":x.field,"data-index":x.index,class:o.normalizeClass({cell:!0,render:i.isRenderer(x),[x.type]:x.type,[x.align]:x.align,[x.field]:x.field,"non-border":!!i.borderStyle}),style:o.normalizeStyle({width:`${x.width}px`,height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`,"min-width":`${i.isRenderer(x)?e.rendererMinWidth:e.minWidth}px`,"border-right":e.orderedColumns.length-1===I?"none":"1px solid #CFCFCF"}),disabled:k[i.ROW_DISABLED_INDEX]},[e.$slots[x.field]?(o.openBlock(),o.createElementBlock("div",LS,[o.renderSlot(e.$slots,x.field,{item:{row:k,column:x},disabled:k[i.ROW_DISABLED_INDEX]},void 0,!0)])):(o.openBlock(),o.createElementBlock("div",{key:1,title:i.getConvertValue(x,k[2][x.index])},o.toDisplayString(i.getConvertValue(x,k[2][x.index])),9,TS))],14,IS)):o.createCommentVNode("",!0)],64))),128)),(Z=e.$props.option.customContextMenu)!=null&&Z.length?(o.openBlock(),o.createElementBlock("td",{key:2,class:o.normalizeClass({"row-contextmenu":!0,"non-border":!!i.borderStyle}),style:o.normalizeStyle({position:"sticky",right:0,width:"30px",height:`${e.rowHeight}px`,"min-width":"30px","line-height":`${e.rowHeight}px`}),disabled:k[i.ROW_DISABLED_INDEX]},[e.$slots.contextmenuIcon?(o.openBlock(),o.createElementBlock("span",{key:0,class:"row-contextmenu__btn",disabled:k[i.ROW_DISABLED_INDEX],onClick:t[9]||(t[9]=x=>i.onContextMenu(x))},[o.renderSlot(e.$slots,"contextmenuIcon",{},void 0,!0)],8,RS)):(o.openBlock(),o.createBlock(c,{key:1,icon:"ev-icon-warning2",class:"row-contextmenu__btn",disabled:k[i.ROW_DISABLED_INDEX],onClick:t[10]||(t[10]=x=>i.onContextMenu(x))},null,8,["disabled"]))],14,MS)):o.createCommentVNode("",!0)],42,wS),e.useRowDetail&&((S=e.$slots)!=null&&S.rowDetail)&&k[4]?(o.openBlock(),o.createElementBlock("tr",vS,[o.createElementVNode("td",{colspan:k.length},[o.createElementVNode("div",{style:o.normalizeStyle({width:"100%",height:`${e.detailRowHeight}px`,"min-height":`${e.detailRowHeight}px`,"max-height":`${e.detailRowHeight}px`})},[o.renderSlot(e.$slots,"rowDetail",{item:{row:k}},void 0,!0)],4)],8,VS)])):o.createCommentVNode("",!0)],64)}),128)),e.viewStore.length?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("tr",ES,[o.createElementVNode("td",GS,o.toDisplayString(i.emptyText),1)]))])],512),o.createElementVNode("div",{style:o.normalizeStyle(`height: ${e.vScrollBottomHeight}px;`),class:"vscroll-spacer"},null,4),o.createVNode(f,{ref:"menu","custom-class":e.contextMenuClass,items:e.contextMenuItems},null,8,["custom-class","items"]),o.createVNode(f,{ref:"columnMenu",items:e.columnMenuItems},null,8,["items"]),o.createVNode(f,{ref:"gridSettingMenu",items:e.gridSettingContextMenuItems,"is-show-menu-on-click":e.isShowMenuOnClick},null,8,["items","is-show-menu-on-click"])],34),o.withDirectives(o.createElementVNode("div",WS,null,512),[[o.vShow,e.showResizeLine]])],2)],16)),[[b,i.onResize],[w,{callback:i.onShow,once:!0}]]),i.useSummary?(o.openBlock(),o.createBlock(p,{key:1,"ordered-columns":e.orderedColumns,stores:i.stores,"use-checkbox":e.useCheckbox.use,"style-option":{borderStyle:i.borderStyle,minWidth:e.minWidth,rowHeight:e.rowHeight},"scroll-left":i.summaryScroll},null,8,["ordered-columns","stores","use-checkbox","style-option","scroll-left"])):o.createCommentVNode("",!0),e.usePage&&!e.isInfinite?(o.openBlock(),o.createBlock(g,{key:2,modelValue:e.currentPage,"onUpdate:modelValue":t[13]||(t[13]=k=>e.currentPage=k),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"])):o.createCommentVNode("",!0),o.createVNode(m,{"is-show":e.isShowFilterSetting,"onUpdate:isShow":t[14]||(t[14]=k=>e.isShowFilterSetting=k),items:e.filteringItemsByColumn,"onUpdate:items":t[15]||(t[15]=k=>e.filteringItemsByColumn=k),column:e.filteringColumn,position:e.filterSettingPosition,onApplyFiltering:i.onApplyFilter},null,8,["is-show","items","column","position","onApplyFiltering"]),o.createVNode(y,{"is-show":e.isShowColumnSetting,"onUpdate:isShow":t[16]||(t[16]=k=>e.isShowColumnSetting=k),"is-show-menu-on-click":e.isShowMenuOnClick,"onUpdate:isShowMenuOnClick":t[17]||(t[17]=k=>e.isShowMenuOnClick=k),columns:e.updatedColumns,"hidden-column":e.hiddenColumn,position:e.columnSettingPosition,"text-info":e.columnSettingTextInfo,onApplyColumn:i.onApplyColumn},null,8,["is-show","is-show-menu-on-click","columns","hidden-column","position","text-info","onApplyColumn"])],64)}const hi=de(lS,[["render",ZS],["__scopeId","data-v-22cd2bf6"]]);hi.install=e=>{e.component(hi.name,hi)};let ui=null;function XS(){return ui||(typeof document<"u"?ui=document.createElement("canvas").getContext("2d"):typeof OffscreenCanvas<"u"&&(ui=new OffscreenCanvas(1,1).getContext("2d")),ui)}const fi=new Map,NS=512,A={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),i=parseInt(t[2],16),s=parseInt(t[3],16);return`${n},${i},${s}`},getColorStringType(e){if(!e)return"";const t=e.replace(/ /g,""),n=/^#(?:[A-Fa-f0-9]{3}){1,2}$/.exec(t),i=/^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":i?l="RGB":s?l="RGBA":l="NONE",l},colorStringToRgba(e,t=1){const n=`${e}|${t}`,i=fi.get(n);if(i!==void 0)return i;const s=e.replace(/ /g,""),l=this.getColorStringType(s);let a="";switch(l){case"HEX":a=`rgba(${this.hexToRgb(s)},${t})`;break;case"RGB":a=s.replace(")",`, ${t})`).replace("rgb","rgba");break;case"RGBA":{const r=s.replace(/^.*,(.+)\)/,"$1");a=s.replace(`${r})`,`${t})`);break}default:a=`rgba(0, 0, 0, ${t})`;break}return fi.size>=NS&&fi.delete(fi.keys().next().value),fi.set(n,a),a},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},coordinateKey(e,t){return`${e}|${t}`},getLabelStyle(e){const{fontStyle:t="normal",fontWeight:n="normal",fontSize:i="12",fontFamily:s="Roboto"}=e;return`${t} normal ${n} ${i}px ${s}`},labelSignFormat(e,t=null){const n=Wh(1),i=Gh(1),s=Eh(1),l=Vh(1),a=1e3;let r;if(!yt(e))return e;const c=e<0,d=Math.abs(e),h=(u,f,p)=>{let g;return u%f===0?g=Yt(t)?`${u/f}${p}`:`${(u/f).toFixed(t)}${p}`:g=`${(u/f).toFixed(1)}${p}`,c?`-${g}`:g};if(d>=n)r=h(d,n,"P");else if(d>=i)r=h(d,i,"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 u=Yt(t)?d:d.toFixed(t);r=c?`-${u}`:`${u}`}return r},calcTextSize(e,t,n=0){const i=document.createElement("span"),s=`visibility:hidden; position:absolute; top:-10000px; font: ${t}; padding: 0 ${n}px`;i.setAttribute("style",s),i.style.font=t,i.textContent=e,document.body.appendChild(i);const l=i.getBoundingClientRect(),a=l.width||2,r=l.height||2;return i.remove(),{width:a,height:r}},calcTextSizeCanvas(e,t){if(!e)return{width:2,height:2};const n=XS();n.save(),n.font=t;const i=n.measureText(e),s=t.match(/(\d+(?:\.\d+)?)px/),a=(s?Number(s[1]):14)*1.2;return n.restore(),{width:Math.max(Math.ceil(i.width),2),height:Math.max(Math.ceil(a),2)}},getStringMinMax(e){const t={min:e[0],max:e[0]};return e.forEach(n=>{var i,s;((i=t==null?void 0:t.max)==null?void 0:i.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,i="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=i==="right"?a.substring(0,c):a.substring(1,a.length),r=n.measureText(a).width;return i==="right"?a+s:s+a},showLabelTip(e){const{ctx:t,width:n,height:i,x:s,y:l,arrowSize:a,borderRadius:r,text:c,backgroundColor:d,textColor:h}=e,u=s-n/2,f=s+n/2,p=l-i,g=l;t.beginPath(),t.save(),t.fillStyle=d||"#E96E2C",t.strokeStyle=d||"#E96E2C",t.shadowBlur=0,t.moveTo(u+r,p),t.quadraticCurveTo(u,p,u,p+r),t.lineTo(u,g-r),t.quadraticCurveTo(u,g,u+r,g),t.lineTo(f-r,g),t.quadraticCurveTo(f,g,f,g-r),t.lineTo(f,p+r),t.quadraticCurveTo(f,p,f-r,p),t.lineTo(s-a,p),t.lineTo(s,p-a),t.lineTo(s+a,p),t.lineTo(u+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+i/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(i=>{e.style[i]=t[i]})},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[,i,s,l]=e.match(t);return`rgba(${i}, ${s}, ${l}, 0.5)`}if(n.test(e)){const[,i,s,l,a]=e.match(n),r=(parseFloat(a)/2).toFixed(2);return`rgba(${i}, ${s}, ${l}, ${r})`}return e.startsWith("#")&&e.length>7?e:`${e}80`},calcBoxDistance(e,t,n){if(e.w!==null&&e.w!==void 0&&e.h!==null&&e.h!==void 0){const i=e.xp,s=e.yp,l=Math.min(i,i+e.w),a=Math.max(i,i+e.w),r=Math.min(s,s+e.h),c=Math.max(s,s+e.h),d=Math.max(0,l-t,t-a),h=Math.max(0,r-n,n-c);return d*d+h*h}return(e.xp-t)**2+(e.yp-n)**2}};function PS(e){const t=(String(e).split(".")[1]??"").length;return e.toFixed(t+1)}var BS=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function DS(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Pr={exports:{}};(function(e,t){(function(n,i){e.exports=i()})(BS,function(){var n=1e3,i=6e4,s=36e5,l="millisecond",a="second",r="minute",c="hour",d="day",h="week",u="month",f="quarter",p="year",g="date",m="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,C=/\[([^\]]+)]|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,b={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(E){var G=["th","st","nd","rd"],v=E%100;return"["+E+(G[(v-20)%10]||G[v]||G[0])+"]"}},w=function(E,G,v){var X=String(E);return!X||X.length>=G?E:""+Array(G+1-X.length).join(v)+E},T={s:w,z:function(E){var G=-E.utcOffset(),v=Math.abs(G),X=Math.floor(v/60),W=v%60;return(G<=0?"+":"-")+w(X,2,"0")+":"+w(W,2,"0")},m:function E(G,v){if(G.date()<v.date())return-E(v,G);var X=12*(v.year()-G.year())+(v.month()-G.month()),W=G.clone().add(X,u),N=v-W<0,P=G.clone().add(X+(N?-1:1),u);return+(-(X+(v-W)/(N?W-P:P-W))||0)},a:function(E){return E<0?Math.ceil(E)||0:Math.floor(E)},p:function(E){return{M:u,y:p,w:h,d,D:g,h:c,m:r,s:a,ms:l,Q:f}[E]||String(E||"").toLowerCase().replace(/s$/,"")},u:function(E){return E===void 0}},k="en",M={};M[k]=b;var Z="$isDayjsObject",S=function(E){return E instanceof V||!(!E||!E[Z])},x=function E(G,v,X){var W;if(!G)return k;if(typeof G=="string"){var N=G.toLowerCase();M[N]&&(W=N),v&&(M[N]=v,W=N);var P=G.split("-");if(!W&&P.length>1)return E(P[0])}else{var D=G.name;M[D]=G,W=D}return!X&&W&&(k=W),W||!X&&k},I=function(E,G){if(S(E))return E.clone();var v=typeof G=="object"?G:{};return v.date=E,v.args=arguments,new V(v)},L=T;L.l=x,L.i=S,L.w=function(E,G){return I(E,{locale:G.$L,utc:G.$u,x:G.$x,$offset:G.$offset})};var V=function(){function E(v){this.$L=x(v.locale,null,!0),this.parse(v),this.$x=this.$x||v.x||{},this[Z]=!0}var G=E.prototype;return G.parse=function(v){this.$d=function(X){var W=X.date,N=X.utc;if(W===null)return new Date(NaN);if(L.u(W))return new Date;if(W instanceof Date)return new Date(W);if(typeof W=="string"&&!/Z$/i.test(W)){var P=W.match(y);if(P){var D=P[2]-1||0,O=(P[7]||"0").substring(0,3);return N?new Date(Date.UTC(P[1],D,P[3]||1,P[4]||0,P[5]||0,P[6]||0,O)):new Date(P[1],D,P[3]||1,P[4]||0,P[5]||0,P[6]||0,O)}}return new Date(W)}(v),this.init()},G.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()},G.$utils=function(){return L},G.isValid=function(){return this.$d.toString()!==m},G.isSame=function(v,X){var W=I(v);return this.startOf(X)<=W&&W<=this.endOf(X)},G.isAfter=function(v,X){return I(v)<this.startOf(X)},G.isBefore=function(v,X){return this.endOf(X)<I(v)},G.$g=function(v,X,W){return L.u(v)?this[X]:this.set(W,v)},G.unix=function(){return Math.floor(this.valueOf()/1e3)},G.valueOf=function(){return this.$d.getTime()},G.startOf=function(v,X){var W=this,N=!!L.u(X)||X,P=L.p(v),D=function(U,ee){var j=L.w(W.$u?Date.UTC(W.$y,ee,U):new Date(W.$y,ee,U),W);return N?j:j.endOf(d)},O=function(U,ee){return L.w(W.toDate()[U].apply(W.toDate("s"),(N?[0,0,0,0]:[23,59,59,999]).slice(ee)),W)},Y=this.$W,H=this.$M,B=this.$D,z="set"+(this.$u?"UTC":"");switch(P){case p:return N?D(1,0):D(31,11);case u:return N?D(1,H):D(0,H+1);case h:var F=this.$locale().weekStart||0,Q=(Y<F?Y+7:Y)-F;return D(N?B-Q:B+(6-Q),H);case d:case g:return O(z+"Hours",0);case c:return O(z+"Minutes",1);case r:return O(z+"Seconds",2);case a:return O(z+"Milliseconds",3);default:return this.clone()}},G.endOf=function(v){return this.startOf(v,!1)},G.$set=function(v,X){var W,N=L.p(v),P="set"+(this.$u?"UTC":""),D=(W={},W[d]=P+"Date",W[g]=P+"Date",W[u]=P+"Month",W[p]=P+"FullYear",W[c]=P+"Hours",W[r]=P+"Minutes",W[a]=P+"Seconds",W[l]=P+"Milliseconds",W)[N],O=N===d?this.$D+(X-this.$W):X;if(N===u||N===p){var Y=this.clone().set(g,1);Y.$d[D](O),Y.init(),this.$d=Y.set(g,Math.min(this.$D,Y.daysInMonth())).$d}else D&&this.$d[D](O);return this.init(),this},G.set=function(v,X){return this.clone().$set(v,X)},G.get=function(v){return this[L.p(v)]()},G.add=function(v,X){var W,N=this;v=Number(v);var P=L.p(X),D=function(H){var B=I(N);return L.w(B.date(B.date()+Math.round(H*v)),N)};if(P===u)return this.set(u,this.$M+v);if(P===p)return this.set(p,this.$y+v);if(P===d)return D(1);if(P===h)return D(7);var O=(W={},W[r]=i,W[c]=s,W[a]=n,W)[P]||1,Y=this.$d.getTime()+v*O;return L.w(Y,this)},G.subtract=function(v,X){return this.add(-1*v,X)},G.format=function(v){var X=this,W=this.$locale();if(!this.isValid())return W.invalidDate||m;var N=v||"YYYY-MM-DDTHH:mm:ssZ",P=L.z(this),D=this.$H,O=this.$m,Y=this.$M,H=W.weekdays,B=W.months,z=W.meridiem,F=function(ee,j,te,J){return ee&&(ee[j]||ee(X,N))||te[j].slice(0,J)},Q=function(ee){return L.s(D%12||12,ee,"0")},U=z||function(ee,j,te){var J=ee<12?"AM":"PM";return te?J.toLowerCase():J};return N.replace(C,function(ee,j){return j||function(te){switch(te){case"YY":return String(X.$y).slice(-2);case"YYYY":return L.s(X.$y,4,"0");case"M":return Y+1;case"MM":return L.s(Y+1,2,"0");case"MMM":return F(W.monthsShort,Y,B,3);case"MMMM":return F(B,Y);case"D":return X.$D;case"DD":return L.s(X.$D,2,"0");case"d":return String(X.$W);case"dd":return F(W.weekdaysMin,X.$W,H,2);case"ddd":return F(W.weekdaysShort,X.$W,H,3);case"dddd":return H[X.$W];case"H":return String(D);case"HH":return L.s(D,2,"0");case"h":return Q(1);case"hh":return Q(2);case"a":return U(D,O,!0);case"A":return U(D,O,!1);case"m":return String(O);case"mm":return L.s(O,2,"0");case"s":return String(X.$s);case"ss":return L.s(X.$s,2,"0");case"SSS":return L.s(X.$ms,3,"0");case"Z":return P}return null}(ee)||P.replace(":","")})},G.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},G.diff=function(v,X,W){var N,P=this,D=L.p(X),O=I(v),Y=(O.utcOffset()-this.utcOffset())*i,H=this-O,B=function(){return L.m(P,O)};switch(D){case p:N=B()/12;break;case u:N=B();break;case f:N=B()/3;break;case h:N=(H-Y)/6048e5;break;case d:N=(H-Y)/864e5;break;case c:N=H/s;break;case r:N=H/i;break;case a:N=H/n;break;default:N=H}return W?N:L.a(N)},G.daysInMonth=function(){return this.endOf(u).$D},G.$locale=function(){return M[this.$L]},G.locale=function(v,X){if(!v)return this.$L;var W=this.clone(),N=x(v,X,!0);return N&&(W.$L=N),W},G.clone=function(){return L.w(this.$d,this)},G.toDate=function(){return new Date(this.valueOf())},G.toJSON=function(){return this.isValid()?this.toISOString():null},G.toISOString=function(){return this.$d.toISOString()},G.toString=function(){return this.$d.toUTCString()},E}(),R=V.prototype;return I.prototype=R,[["$ms",l],["$s",a],["$m",r],["$H",c],["$W",d],["$M",u],["$y",p],["$D",g]].forEach(function(E){R[E[1]]=function(G){return this.$g(G,E[0],E[1])}}),I.extend=function(E,G){return E.$i||(E(G,V,I),E.$i=!0),I},I.locale=x,I.isDayjs=S,I.unix=function(E){return I(1e3*E)},I.en=M[k],I.Ls=M,I.p={},I})})(Pr);var YS=Pr.exports;const Ne=DS(YS),OS={createDataSet(e,t){var n;this._dataEpoch=(this._dataEpoch??0)+1,Object.keys(this.seriesInfo.charts).forEach(i=>{var l;const s=this.seriesInfo.charts[i];if(s.length)if(i==="pie")this.options.sunburst?this.createSunburstDataSet(e):this.createPieDataSet(e,s);else if(i==="scatter")s.forEach(a=>{const r=this.seriesList[a],c=e[a],d=r==null?void 0:r.passingValue;r&&c&&(r.data=this.addSeriesDSforScatter(c),r.minMax=this.getSeriesMinMax(r.data,d))});else if(i==="heatMap")s.forEach(a=>{const r=this.seriesList[a],c=r==null?void 0:r.passingValue,d=e[a];r&&d&&(r.labels=t,r.data=this.addSeriesDSForHeatMap(d),r.minMax=this.getSeriesMinMax(r.data,c),r.valueOpt=this.getSeriesValueOptForHeatMap(r))});else{const a=s[0],r=(l=this.seriesList[a])==null?void 0:l.passingValue,c=new Map;for(let d=0;d<s.length;d++){const h=s[d],u=this.seriesList[h];if(u&&u.show!==!1){const f=e==null?void 0:e[h],{passingValue:p,interpolation:g}=u,m=g==="zero"||p!=null&&p!==void 0;let y=!1,C;if(!f)C=f;else if(!m)C=f;else{C=new Array(f.length);for(let b=0;b<f.length;b++){const w=f[b];g==="zero"&&!w?C[b]=0:w===p?(y=!0,C[b]=null):C[b]=w}}if(u.hasPassingValueInData=y,C){const b=u.isExistGrp&&!u.isOverlapping;let w=null;b&&(w=c.get(u.groupIndex),w||(w={pos:[],neg:[]},c.set(u.groupIndex,w))),b&&u.stackIndex?u.data=this.addSeriesStackDS(C,t,u.stackIndex,w,u.data):u.data=this.addSeriesDS(C,t,u.isExistGrp,r,u.data),u.minMax=this.getSeriesMinMax(u.data,u.passingValue),b&&this.updateStackTops(w,u)}}}}}),(n=this.buildLabelValidMask)==null||n.call(this)},createRealTimeScatterDataSet(e){var i,s,l,a;const t=Object.keys(e),n={maxY:-1/0,minY:1/0,fromTime:0,toTime:0};for(let r=0;r<t.length;r++){const c=t[r],d=e[c],h=d==null?void 0:d.length;if(!this.isInit||this.updateSeries||!this.dataSet[c]){const R={dataGroup:[],startIndex:0,endIndex:null,length:0,fromTime:0,toTime:0};this.dataSet[c]={...R,...this.dataSet[c]}}const u=this.dataSet[c],f=u.dataGroup,p=this.options.realTimeScatter.range||300,g=u.length!==p;u.length=p;const m=u.length;let y=0;for(let R=0;R<h;R++){const E=d[R];E&&y<E.x&&(y=E.x)}y=y?Math.floor(y/1e3)*1e3:0;const C=((l=(s=(i=f.at(-1))==null?void 0:i.data)==null?void 0:s.at(-1))==null?void 0:l.x)||Date.now(),b=Math.floor(C/1e3)*1e3,w=u.toTime||b,T=y||w,k=R=>{R.data.length=0,R.dataKeys?R.dataKeys.clear():R.dataKeys=new Set,R.max=0,R.min=1/0};if(u.endIndex==null||g){u.startIndex=0,u.endIndex=m-1,f.length=m;for(let R=0;R<m;R++)f[R]=f[R]||{data:[],dataKeys:new Set,max:0,min:1/0},k(f[R]);u.toTime=T,u.fromTime=u.toTime-m*1e3}const M=(T-w)/1e3,Z=Number.isFinite(M)?Math.max(0,Math.floor(M)):0;if(u.toTime=T,u.fromTime=u.toTime-m*1e3,y&&(u.toTime-y)/1e3>m&&c==="")return;for(let R=0;R<m;R++)f[R]?f[R].data?f[R].dataKeys||(f[R].dataKeys=new Set):(f[R].data=[],f[R].dataKeys=new Set,f[R].max=0,f[R].min=1/0):f[R]={data:[],dataKeys:new Set,max:0,min:1/0};if(Z>0)if(Z>=m){for(let R=0;R<m;R++)k(f[R]);u.startIndex=0,u.endIndex=m-1}else{let R=u.startIndex,E=u.endIndex;for(let G=0;G<Z;G++)k(f[R]),R=(R+1)%m,E=(E+1)%m;u.startIndex=R,u.endIndex=E}const S=this.options.coordinateDedupe!==!1;let x=-1;for(let R=0;R<h;R++){const E=d[R];if(E){const G=Math.floor(E.x/1e3)*1e3;if(u.fromTime<=G){let v=u.endIndex-(u.toTime-G)/1e3;v<0&&(v=m+v);const X=f[v],W=A.coordinateKey(E.x,E.y);if(!(S&&X.dataKeys.has(W))){S&&X.dataKeys.add(W),X.data.push({x:E.x,y:E.y,o:E.value??E.y,color:E.color,k:S&&this.seriesInfo.charts.scatter.length>1?W:void 0}),X.max=Math.max(X.max,E.y),X.min=Math.min(X.min,E.y);const P=(u.toTime-G)/1e3;P>x&&(x=P)}}}}u.lastTick={seq:(((a=u.lastTick)==null?void 0:a.seq)??0)+1,gapCount:Z,prevToTime:w,toTime:u.toTime,length:m,startIndex:u.startIndex,endIndex:u.endIndex,maxDirtyAge:x};const I=1e3,L={maxY:-1/0,minY:1/0};for(let R=0;R<m;R++){const E=f[R];for(let G=0;G<E.data.length;G++){const v=E.data[G],X=Math.floor(v.x/I)*I;X>=u.fromTime&&X<=u.toTime&&Number.isFinite(v.y)&&(v.y>L.maxY&&(L.maxY=v.y),v.y<L.minY&&(L.minY=v.y))}}Number.isFinite(L.minY)&&(n.maxY=Math.max(n.maxY,L.maxY),n.minY=Math.min(n.minY,L.minY)),n.fromTime=u.fromTime,n.toTime=u.toTime}Number.isFinite(n.minY)||(n.minY=0,n.maxY=0),this.seriesInfo.charts.scatter.forEach(r=>{const c=this.seriesList[r];c.data=this.dataSet,c.minMax={minX:Ne(n.fromTime),minY:n.minY,maxX:Ne(n.toTime),maxY:n.maxY}})},createSunburstDataSet(e){this.pieDataSet=[];const t=this.pieDataSet,n=[];for(let i=0;i<e.length;i++){const s=e[i],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((i,s)=>s.value-i.value);n.length;){const i=n.shift(),s=i.parent,l=i.data,a=i.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(i=>{if(this.seriesList[i].show){const s=e[i][0]??0;n[0].total+=s,n[0].data.push({id:i,value:s,sa:0,ea:0})}}),n.forEach(i=>{i.data.sort((s,l)=>l.value-s.value)})},addSeriesStackDS(e,t,n=0,i=null,s){const l=this.options.horizontal,a=[],r=i==null?void 0:i.pos,c=i==null?void 0:i.neg,d=Array.isArray(s)?s:null;return e.forEach((h,u)=>{let f=(h>=0?r==null?void 0:r[u]:c==null?void 0:c[u])??0,p=h,g=t[u],m=h;if(f!=null&&g!=null){m&&typeof m=="object"&&("x"in m||"y"in m)&&(p=l?h.x:h.y,g=l?h.y:h.x);const y=(p==null?void 0:p.value)??p;n>0?y!=null?m=f+y:m=p:(f=0,m=y);const C=d&&d[a.length];a.push(this.addData(m,g,p,f,C||null))}}),a},updateStackTops(e,t){if(!t.show)return;const n=this.options.horizontal,i=t.passingValue,s=!A.isNullOrUndefined(i),l=t.data,a=e.pos,r=e.neg;for(let c=0;c<l.length;c++){const d=l[c],h=n?d.x:d.y,u=d.o,f=s&&u===i;h!=null&&!f&&(u>=0?a[c]=h:r[c]=h)}},addSeriesDS(e,t,n,i,s){const l=this.options.horizontal,a=[],r=n&&!A.isNullOrUndefined(i),c=Array.isArray(s)?s:null;for(let d=0;d<e.length;d++){let h=e[d],u=t[d];if(h&&typeof h=="object"&&(h.x||h.y)&&(h=l?h.x:h.y,u=l?e[d].y:e[d].x),u!==null){const f=r&&h===i?0:h;if(f!==null&&typeof f=="object"||h!==null&&typeof h=="object")a.push(this.addData(f,u,h));else{const p=f??null,g=h??null,m=c&&c[a.length];m&&typeof m=="object"?(m.x=l?p:u,m.y=l?u:p,m.o=g,m.b=null,m.xp=null,m.yp=null,m.w=null,m.h=null,m.dataColor=null,m.dataTextColor=null,a.push(m)):a.push(l?{x:p,y:u,o:g,b:null,xp:null,yp:null,w:null,h:null,dataColor:null,dataTextColor:null}:{x:u,y:p,o:g,b:null,xp:null,yp:null,w:null,h:null,dataColor:null,dataTextColor:null})}}}return a},addSeriesDSforScatter(e){return e.map(t=>{const n=t.x,i={value:t.y,color:(t==null?void 0:t.color)||null};return this.addData(i,n,i)})},addSeriesDSForHeatMap(e){return e.map(({x:t,y:n,value:i,color:s=null})=>({x:t,y:n,o:i,xp:null,yp:null,w:null,h:null,dataColor:s,cId:null}))},addData(e,t,n=null,i=null,s=null){let l=null,a=null,r=null,c=null,d=null;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;const h=s||{};return this.options.horizontal?(h.x=l,h.y=t):(h.x=t,h.y=l),h.o=a,h.b=i,h.xp=null,h.yp=null,h.w=null,h.h=null,h.dataColor=r??c,h.dataTextColor=d,h},getSeriesMinMax(e,t){const n={minX:null,minY:null,maxX:null,maxY:null,maxDomain:null},i=this.options.horizontal;if(e.length){const s=!A.isNullOrUndefined(t),l={minX:e[0].x,minY:e[0].y,maxX:e[0].x,maxY:e[0].y,maxDomain:i?e[0].y:e[0].x,maxDomainIndex:0};for(let a=0;a<e.length;a++){const r=e[a],c=r.x,d=r.y,h=r.o;(!s||h!==t)&&(c<=l.minX&&(l.minX=c===null?0:c),d<=l.minY&&(l.minY=d===null?0:d),c>=l.maxX&&(l.maxX=c===null?0:c,i&&c!==null&&(l.maxDomain=d,l.maxDomainIndex=a)),d>=l.maxY&&(l.maxY=d===null?0:d,!i&&d!==null&&(l.maxDomain=c,l.maxDomainIndex=a)))}return l}return n},getVisibleWindowMaxSeries(e,t){var l;if(!Number.isFinite(e)||!Number.isFinite(t)||t<e)return null;const n=this.options.horizontal;let i=null;const s=Object.keys(this.seriesList);for(let a=0;a<s.length;a+=1){const r=this.seriesList[s[a]];if(r!=null&&r.show&&((l=r.data)!=null&&l.length)){const c=Math.max(0,e),d=Math.min(r.data.length-1,t);for(let h=c;h<=d;h+=1){const u=r.data[h],f=n?u==null?void 0:u.x:u==null?void 0:u.y;Number.isFinite(f)&&(!i||f>i.value)&&(i={sId:r.sId,value:f,index:h,domain:n?u==null?void 0:u.y:u==null?void 0:u.x})}}}return i},getSeriesValueOptForHeatMap(e){const{data:t,colorState:n,isGradient:i}=e,s=this.options.heatMapColor,l=s.colorsByRange.length||s.rangeCount,a=s.decimalPoint;let r,c=0,d=!1;t.forEach(({o:u})=>{c<u&&(c=Math.max(c,u)),u<0?d=!0:r===void 0?r=u:r=Math.min(r,u)}),d&&!i&&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 i=null,s=null,l=null,a="",r=0,c=!1,d=!1;if(e>-1){for(let h=0;h<t.length;h++){const u=t[h],f=this.seriesList[u],p=f.data[e];if(p&&f.show&&f.showLegend){const g=n?p.y:p.x,m=n?p.yp:p.xp;if(g!=null){const y=n?p.o||p.x:p.o||p.y;f.stackIndex?(r+=isNaN(p.o)?0:p.o,c=!0):r+=p.y,(l===null||l<=y)&&(l=y,a=u,i=g,s=m)}}}d={label:i,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:i}=e;let s;if("seriesID"in e){const l=this.getDataByValues(n,i);if(!l||!(l!=null&&l.xp)||!(l!=null&&l.yp))return null;s=[this.getHitItemByPosition([l.xp,l.yp],t,i,!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=i==null?void 0:i.map(r=>{var h,u;const c=this.getDataByValues(a,r);if(!c)return null;const d=this.getHitItemByPosition([(c==null?void 0:c.xp)??0,(c==null?void 0:c.yp)??0],t,r,!0);return d&&!d.sId&&(d.sId=a,d.label=((u=(h=this.data)==null?void 0:h.labels)==null?void 0:u[r])??d.label,d.dataIndex=r),d})}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]},getHitItemByPosition(e,t=!1,n,i=!1,s=!1){var V;const l=Object.keys(this.seriesList),a=!!this.options.horizontal,[r,c]=e;let d=n;if(d===void 0&&!t){const R=l.find(E=>{var v;const G=this.seriesList[E];return(G==null?void 0:G.show)&&((v=G==null?void 0:G.data)==null?void 0:v.length)>0});if(R){const E=this.seriesList[R].data,G=a?e[1]:e[0];let v=1/0,X=-1;for(let W=0;W<E.length;W++){const N=s||l.some(D=>{var Y,H,B,z;const O=this.seriesList[D];return(O==null?void 0:O.show)&&((H=(Y=O.data)==null?void 0:Y[W])==null?void 0:H.o)!==null&&((z=(B=O.data)==null?void 0:B[W])==null?void 0:z.o)!==void 0}),P=E[W];if(N&&P){let D;if(a?D=P.h?P.yp+P.h/2:P.yp:D=P.w?P.xp+P.w/2:P.xp,D!=null){const O=Math.abs(G-D);O<v&&(v=O,X=W)}}}X!==-1&&(d=X)}}let h=null,u=null,f=null,p=null,g="",m=null,y=1/0,C=!1,b=null,w=null,T=null,k=null,M="",Z=null,S=1/0,x=0,I=!1;for(let R=0;R<l.length;R++){const E=l[R],G=this.seriesList[E],v=t?G.findApproximateData:G.findGraphData;if(v){const X=v.call(G,e,a,d,i),W=X.data,N=X.index;if(W)if(A.isPieType(X.type))h=X.type,u=E,g=E,f=(W.ea-W.sa)/2,p=W.o,m=W.index;else{const P=a?W.y:W.x,D=a?W.yp:W.xp;if(P!=null){const O=a?W.o||W.x:W.o||W.y;G.stackIndex!=null?(x+=isNaN(W.o)?0:W.o,I=!0):x+=W.y;const Y=O!=null&&!Number.isNaN(O),H=W.xp!==null&&W.xp!==void 0&&W.yp!==null&&W.yp!==void 0;if(Y&&H){const B=A.calcBoxDistance(W,r,c);(M===""||B<S)&&(S=B,b=G.type,w=P,T=D,k=O,M=E,Z=N)}else Y&&M===""&&(b=G.type,w=P,T=D,k=O,M=E,Z=N);if(X.hit&&W.xp!==void 0&&W.yp!==void 0){const B=(W.xp-e[0])**2+(W.yp-e[1])**2;X.directHit?((!C||B<y)&&(y=B,h=G.type,u=P,f=D,p=O,g=E,m=N),C=!0):C||B<y&&(y=B,h=G.type,u=P,f=D,p=O,g=E,m=N)}}}}}if(s&&g===""&&M===""&&d!==void 0&&d>=0){const R=l.find(G=>{var X;const v=this.seriesList[G];return(v==null?void 0:v.show)&&((X=v==null?void 0:v.data)==null?void 0:X.length)>0}),E=R?(V=this.seriesList[R].data)==null?void 0:V[d]:null;E&&(w=a?E.y:E.x,Z=d)}const L=g!=="";return{type:L?h:b,label:L?u:w,pos:L?f:T,value:L?p:k,sId:L?g:M,acc:x,useStack:I,dataIndex:L?m:Z}},getLabelInfoByPosition(e,t){var m,y,C;const[n,i]=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=((m=Object.values(l).sort((b,w)=>w.pointSize??0-b.pointSize??0)[0])==null?void 0:m.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 u=s[d.units.rectStart],f=s[d.units.rectEnd];let p,g;if(h!=null&&h.use&&((y=d==null?void 0:d.labels)!=null&&y.length)){const{type:b,range:w,interval:T=1}=h,[k,M]=w??[0,d.labels.length],Z=Math.floor((+M-+k)/T)+1,S=(f-u)/Z,I=Math.floor(((t==="yAxis"||r?i:n)-u)/S);b==="step"?p=k+I:p=(d==null?void 0:d.labels.findIndex(V=>V===+k))+I}else if((C=d==null?void 0:d.labels)!=null&&C.length){const b=(f-u)/d.labels.length,T=Math.floor(((t==="yAxis"?i:n)-u)/b);p=d.labels.length>T?T:-1}else{let b,w;n<u-a?(b=u,w=0):n>f+a?(b=f,w=this.data.labels.length-1):b=n,g=this.getHitItemByPosition([b,i],c==null?void 0:c.useApproximateValue,w,!0,!0),p=g.dataIndex??-1}return{labelIndex:p,hitInfo:g}},getCurMouseLabelVal(e,t,n){const{type:i,horizontal:s}=this.options,l=e==="xAxis",a=l?"x":"y";let r="",c=-1;const d=()=>{let u="";switch(i){case"bar":case"line":{u=s&&!l||!s&&l?this.data.labels[n]:"";break}case"heatMap":{u=this.data.labels[a][n];break}}return u},h=()=>{let u="";const f={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:m}=this.axesSteps[a][0],{width:y,height:C}=this.axesRange[a][0].size,b=l?this.axesX:this.axesY,w=f[b[0].units.rectStart],T=f[b[0].units.rectEnd],k=Math.abs(t[l?0:1]-w),M=(l?y:C)/2,Z=Math.abs(w-T)/p,S=Math.floor((k+M)/Z);return Z*S+M>k&&Z*S-M<k&&(u=S*g+m),u};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((i,s)=>{const l=i,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!==null&&r.minX<l.x[c].min)&&(l.x[c].min=r.minX),r.minY!==null&&(l.y[d].min===null||r.minY!==null&&r.minY<l.y[d].min)&&(l.y[d].min=r.minY)):(r.minX!==null&&(l.x[c].min===null||r.minX!==null&&r.minX<l.x[c].min)&&(l.x[c].min=r.minX),(l.y[d].min===null||r.minY!==null&&r.minY<l.y[d].min)&&(l.y[d].min=r.minY));const h=this.seriesList[s].isExistGrp,u=l.x[c].max<0;(h&&u||!l.x[c].max||r.maxX>=l.x[c].max)&&(l.x[c].max=r.maxX,l.x[c].maxSID=s);const f=l.y[d].max<0;(h&&f||!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,i,s,l,a,r,c,d;const h=[],u={"$ev-root":1.5*Math.PI};for(let f=0;f<e.length;f++){const p=e[f];d=!0;for(let g=0;g<p.data.length;g++)if(t=p.data[g],n=t.value,d&&(d=t.id==="dummy"),!f)a=u["$ev-root"],l=2*Math.PI*(n/p.total),r=a+l,t.sa=a,t.ea=r,u["$ev-root"]+=l;else{if(i=this.getParentInfo(f-1,t.parent),!i)break;u[t.parent]||(u[t.parent]=i.sa),a=u[t.parent],c=i.ea-i.sa,s=p.total[t.parent]||0,l=c*(n/s),r=a+l,t.sa=a,t.ea=r,u[t.parent]+=l}d&&h.push(f)}for(let f=0;f<h.length;f++)this.pieDataSet.splice(h,1);this.options.reverse&&(this.pieDataSet=lb(this.pieDataSet))},getParentInfo(e,t){for(let n=e;n>=0;n--){const i=this.pieDataSet[n];for(let s=0;s<i.data.length;s++)if(i.data[s].id===t)return i.data[s]}return null},getAggregations(){const e=this.data.data,t=this.data.series,n={},i=Object.keys(t);return i==null||i.forEach(s=>{const l=e[s].map(f=>f!=null&&f.value?f.value:f),a=l[l.length-1],r=l.filter(f=>f!=null),c=Math.min(...r),d=Math.max(...r),h=r.reduce((f,p)=>f+p,0),u=h/r.length||0;(!A.checkSafeInteger(c)||!A.checkSafeInteger(d)||!A.checkSafeInteger(u)||!A.checkSafeInteger(h)||!A.checkSafeInteger(a))&&console.warn("[EVUI][Chart] The aggregated value exceeds 9007199254740991 or less than -9007199254740991."),n[s]={min:c,max:d,avg:u,total:h,last:a}}),n}},HS={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"}},Ht=["#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"],mi={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"},zS={show:!0,highlight:{pointSize:5},xAxisIndex:0,yAxisIndex:0,category:!0,showLegend:!0,showValue:{use:!1,fontSize:12,textColor:"#000000",formatter:null,decimalPoint:null}},FS={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,scaleChange:!1,labelStyle:{show:!0,fontSize:12,color:"#25262E",fontFamily:"Roboto",fontWeight:400,fitWidth:!1,fitDir:"right",alignToGridLine:!1,padding:0,fixWidth:void 0},showLastLabel:!1,lastLabelFontStyle:null,firstLabelFontStyle:null,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},Ao={color:"#FF0000",lineWidth:1,label:Dr},Ko={color:"#FAE59D"},AS={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"}}},Ct={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}},KS=Object.freeze([1,2,5]),Yr=["cross","crossRot","star","line"],ne={calculateX(e,t,n,i,s=0){if(e==null||e>n||e<t)return null;const l=i/(n-t);return Math.ceil(s+l*(e-t))},calculateSubX(e,t,n,i,s=0){if(e==null)return null;const l=i/(n-t);return Math.ceil(s+l*(e-t))},calculateY(e,t,n,i,s=0){let l;if(e==null||e>n||e<t)return null;const a=i/(n-t);return s?l=s-a*(e-(t||0)):l=-(a*(e-(t||0))),Math.floor(l)},drawPoint(e,t,n,i,s){if(!(isNaN(n)||n<=0)){if(t==="rect"){const l=1/Math.SQRT2*n;e.fillRect(i-l,s-l,2*l,2*l),e.strokeRect(i-l,s-l,2*l,2*l);return}e.beginPath(),this._appendPointPath(e,t,n,i,s),Yr.includes(t)||e.fill(),e.stroke()}},_appendPointPath(e,t,n,i,s){let l,a,r,c,d,h,u,f,p;switch(t){case"triangle":l=3*n/Math.sqrt(3),c=l*Math.sqrt(3)/2,e.moveTo(i-l/2,s+c/3),e.lineTo(i+l/2,s+c/3),e.lineTo(i,s-2*c/3),e.closePath();break;case"rectRounded":h=n/Math.SQRT2,u=i-h,f=s-h,p=Math.SQRT2*n,this.roundedRect(e,u,f,p,p,n/2),e.closePath();break;case"rectRot":d=1/Math.SQRT2*n,e.moveTo(i-d,s),e.lineTo(i,s+d),e.lineTo(i+d,s),e.lineTo(i,s-d),e.closePath();break;case"cross":e.moveTo(i,s+n),e.lineTo(i,s-n),e.moveTo(i-n,s),e.lineTo(i+n,s),e.closePath();break;case"crossRot":a=Math.cos(Math.PI/4)*n,r=Math.sin(Math.PI/4)*n,e.moveTo(i-a,s-r),e.lineTo(i+a,s+r),e.moveTo(i-a,s+r),e.lineTo(i+a,s-r),e.closePath();break;case"star":e.moveTo(i,s+n),e.lineTo(i,s-n),e.moveTo(i-n,s),e.lineTo(i+n,s),a=Math.cos(Math.PI/4)*n,r=Math.sin(Math.PI/4)*n,e.moveTo(i-a,s-r),e.lineTo(i+a,s+r),e.moveTo(i-a,s+r),e.lineTo(i+a,s-r),e.closePath();break;case"line":e.moveTo(i-n,s),e.lineTo(i+n,s),e.closePath();break;default:e.moveTo(i+n,s),e.arc(i,s,n,0,Math.PI*2);break}},drawPointBatch(e,t,n,i){if(!(isNaN(n)||n<=0||!i||!i.length)){if(t==="rect"){const s=1/Math.SQRT2*n;for(let l=0;l<i.length;l++)e.fillRect(i[l].xp-s,i[l].yp-s,2*s,2*s),e.strokeRect(i[l].xp-s,i[l].yp-s,2*s,2*s);return}e.beginPath();for(let s=0;s<i.length;s++)this._appendPointPath(e,t,n,i[s].xp,i[s].yp);Yr.includes(t)||e.fill(),e.stroke()}},roundedRect(e,t,n,i,s,l){const a=Math.PI,r=a/2;if(l){const c=Math.min(l,s/2,i/2),d=t+c,h=n+c,u=t+i-c,f=n+s-c;e.moveTo(t,h),d<u&&h<f?(e.arc(d,h,c,-a,-r),e.arc(u,h,c,-r,0),e.arc(u,f,c,0,r),e.arc(d,f,c,r,a)):d<u?(e.moveTo(d,n),e.arc(u,h,c,-r,r),e.arc(d,h,c,r,a+r)):h<f?(e.arc(d,h,c,-a,0),e.arc(d,f,c,0,a)):e.arc(d,h,c,-a,a),e.closePath(),e.moveTo(t,n)}else e.rect(t,n,i,s)},createGradient(e,t,n,i,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 u=0;u<i.length;u++){const f=i[u][0]??0,p=i[u][1]??"rgba(255, 255, 255, 0)",g=p.includes("rgba")?A.getOpacity(p):1,m=s?l:g;h.addColorStop(f,A.colorStringToRgba(p,m))}return h}},_S=new Set(["triangle","rect","rectRounded","rectRot","cross","crossRot","star","line"]),Or=Math.PI*2;class US{constructor(t,n,i){const s=He({},n,mi);Object.keys(s).forEach(l=>{this[l]=s[l]}),this.name===void 0&&(this.name=`series-${i}`),["color","pointFill","fillColor"].forEach(l=>{this[l]===void 0&&(this[l]=l==="pointFill"?this.color:Ht[i%Ht.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}_getValidGData(){const t=this.data,n=this._validGDataCache;if(n&&n.src===t&&n.length===t.length)return n.value;const i=t.filter(s=>!A.isNullOrUndefined(s.x));return this._validGDataCache={src:t,length:t.length,value:i},i}computeGeometry(t){if(!this.show)return;const n=t.scaleVersion!=null&&t.dataEpoch!=null;if(n&&this._lastDataEpoch===t.dataEpoch&&this._lastScaleVersion===t.scaleVersion&&this._lastGeomData===this.data)return;const{chartRect:i,labelOffset:s,axesSteps:l,displayOverflow:a}=t,r=this.useLinearInterpolation();let c=0;const d=l.x[this.xAxisIndex],h=l.y[this.yAxisIndex];let u=i.chartWidth-(s.left+s.right);const f=i.chartHeight-(s.top+s.bottom);this.combo&&(c=u/(this.data.length||1),u-=c,this.size.comboOffset=c);const p=i.x1+s.left+c/2,g=i.y2-s.bottom,m=d.graphMin,y=d.graphMax,C=h.graphMin,b=h.graphMax,w=u/(y-m),T=f/(b-C),k=C||0,M=S=>S==null||S<m||S>y?null:Math.ceil(p+w*(S-m)),Z=S=>{const x=a&&S>b?b:S;return x==null||x<C||x>b?null:Math.floor(g?g-T*(x-k):-(T*(x-k)))};for(let S=0;S<this.data.length;S++){const x=this.data[S];let I=M(x.x),L=Z(x.y);this.isExistGrp&&r&&x.o===null&&(L=Z(x.b??0)),I!==null&&(I+=A.aliasPixel(I)),x.xp=I,x.yp=L}n&&(this._lastDataEpoch=t.dataEpoch,this._lastScaleVersion=t.scaleVersion,this._lastGeomData=this.data)}hasRenderableValue(){return this.data.some(t=>t.o!==null&&t.o!==void 0)}draw(t){var O,Y,H,B,z,F,Q,U,ee;if(!this.show)return;const{ctx:n,chartRect:i,labelOffset:s,axesSteps:l,selectLabel:a,selectSeries:r,legendHitInfo:c,isBrush:d,unSelectedOpacity:h,displayOverflow:u}=t;if(this.computeGeometry(t),!this.hasRenderableValue()&&!this.isExistGrp)return;const f=a==null?void 0:a.option,p=(f==null?void 0:f.use)&&(f==null?void 0:f.useSeriesOpacity),g=((O=a==null?void 0:a.selected)==null?void 0:O.dataIndex)??[];let m;if(c)m=this.extent[(c==null?void 0:c.sId)===this.sId?"highlight":"downplay"];else if((Y=r==null?void 0:r.option)!=null&&Y.use&&((B=(H=r==null?void 0:r.selected)==null?void 0:H.seriesId)!=null&&B.length)){const j=(F=(z=r==null?void 0:r.selected)==null?void 0:z.seriesId)==null?void 0:F.includes(this.sId);m=this.extent[j?"highlight":"downplay"]}else p&&g.length?m=this.extent.downplay:m=this.extent.normal;m===this.extent.downplay&&(m={...m,opacity:h});const y=j=>j!=null&&j.includes("rgba")?A.getOpacity(j):m.opacity,C=this.color,b=y(C),w=this.pointFill,T=y(w),k=this.extent.downplay?this.fillOpacity*m.opacity:this.fillOpacity,M=this.lineWidth*m.lineWidth,Z=this._rgbaCache||(this._rgbaCache={}),S=(j,te,J)=>{const q=Z[j];if(q!==void 0&&q.s===te&&q.o===J)return q.v;const $=A.colorStringToRgba(te,J);return Z[j]={s:te,o:J,v:$},$};n.beginPath(),n.save(),n.lineJoin="round",n.lineWidth=M,n.strokeStyle=S("stroke",C,b),this.segments&&n.setLineDash(this.segments);const x=this.useLinearInterpolation();let I=0;const L=l.x[this.xAxisIndex],V=l.y[this.yAxisIndex];let R=i.chartWidth-(s.left+s.right);const E=i.chartHeight-(s.top+s.bottom);this.combo&&(I=R/(this.data.length||1),R-=I,this.size.comboOffset=I);const G=i.x1+s.left+I/2,v=i.y2-s.bottom,X=j=>ne.calculateX(j,L.graphMin,L.graphMax,R,G),W=j=>ne.calculateY(u&&j>V.graphMax?V.graphMax:j,V.graphMin,V.graphMax,E,v);let N,P=null,D=null;for(let j=0;j<this.data.length;j++){const te=this.data[j],J=te.xp,q=te.yp;x&&te.o===null||(J===null||q===null?N=void 0:(Yt(N==null?void 0:N.y)&&!this.isExistGrp||!x&&(Yt(N==null?void 0:N.y)||Yt(te.o))?(n.moveTo(J,q),P=J,D=q):(J!==P||q!==D)&&(n.lineTo(J,q),P=J,D=q),N=te))}if(n.stroke(),this.segments&&n.setLineDash([]),this.fill&&this.data.length){n.beginPath();const j=this.data.some(se=>se.o<0),te=j?W(0):i.y2-s.bottom,J=S("fill",this.fillColor||C,k);if((Q=this.fill)!=null&&Q.gradient){let se=this.data[0].yp,fe=this.data[0].y;this.data.forEach(ce=>{ce.yp&&ce.yp<=se?se=ce.yp:ce.y&&ce.y>=fe&&(fe=ce.y)});const ge=n.createLinearGradient(0,i.y2,0,se),le=m.opacity<1?J:C;ge.addColorStop(0,j?le:J),ge.addColorStop(.5,J),ge.addColorStop(1,le),n.fillStyle=ge}else n.fillStyle=J;let q=null,$=null;const ae=[],he=this.data.length;for(let se=0;se<he+1;se++){const fe=(U=this.data[se])==null?void 0:U.o;if(x&&ib(fe)||!x&&Yt(fe)){if(q!==null&&$!==null){let ge=q-1;for(let le=se-1;le>=q;le--){const ce=(ee=this.data[le])==null?void 0:ee.o;if(!Yt(ce)&&ce!==null){ge=le;break}}ae.push([q,ge]),q=null,$=null}}else x&&fe===null||(q=q===null?se:q),$=se}ae.forEach(([se,fe])=>{if(se===fe){const le=this.data[se];if(le.xp===null||le.yp===null)return;n.moveTo(le.xp-M,le.yp),n.lineTo(le.xp+M,le.yp),n.lineTo(le.xp+M,W(le.b)??te);return}let ge=!1;for(let le=se;le<=fe;le++){const ce=this.data[le];if(ce.xp!==null&&ce.yp!==null&&(ge?ce.o!==null&&n.lineTo(ce.xp,ce.yp):(n.moveTo(ce.xp,ce.yp),ge=!0)),le===fe)for(let Ie=fe;Ie>=se;Ie--){const Ve=this.data[Ie],kt=X(Ve.x);if(kt!==null&&Ve.o!==null){const Vt=W(Ve.b)??W(0);n.lineTo(kt,Vt)}}}}),n.fill()}if(!d){n.strokeStyle=S("stroke",C,b);const j=S("focus",w,1),te=S("blur",w,T);let J=!1;if(this.interpolation==="linear"){let le=0;for(let ce=0;ce<this.data.length&&!(this.data[ce].o!==null&&(le++,le>1));ce++);J=le===1}const q=g.length?new Set(g):null,$=this.pointSize,ae=this.pointStyle,he=this.data,se=he.length,fe=!_S.has(ae),ge=le=>{const ce=he[le];if(ce.xp===null||ce.yp===null||ce.o===null)return 0;let be;if(J)be=!0;else if(x)be=!1;else{const Ve=le>0?he[le-1].o:null,kt=le+1<se?he[le+1].o:null;be=Ve==null&&kt==null}const Ie=q?q.has(le):!1;return this.point||be||Ie?Ie&&!c?2:1:0};if(fe){let le=!1,ce=null;for(let be=0;be<se;be++){const Ie=ge(be);if(Ie!==0){const Ve=he[be];Ie===2?(ce===null&&(ce=[]),ce.push(Ve)):(le||(n.beginPath(),le=!0),n.moveTo(Ve.xp+$,Ve.yp),n.arc(Ve.xp,Ve.yp,$,0,Or))}}if(le&&(n.fillStyle=te,n.fill(),n.stroke()),ce!==null){n.beginPath();for(let be=0;be<ce.length;be++){const Ie=ce[be];n.moveTo(Ie.xp+$,Ie.yp),n.arc(Ie.xp,Ie.yp,$,0,Or)}n.fillStyle=j,n.fill(),n.stroke()}}else{let le=null,ce=null;for(let be=0;be<se;be++){const Ie=ge(be);if(Ie!==0){const Ve=he[be];Ie===2?(ce===null&&(ce=[]),ce.push(Ve)):(le===null&&(le=[]),le.push(Ve))}}le!==null&&(n.fillStyle=te,ne.drawPointBatch(n,ae,$,le)),ce!==null&&(n.fillStyle=j,ne.drawPointBatch(n,ae,$,ce))}}n.restore()}itemHighlight(t,n){const i=t.data,s=n,{xp:l,yp:a,o:r}=i;s.save(),l!==null&&a!==null&&r!==null&&this.pointHighlight&&(s.strokeStyle=A.colorStringToRgba(this.color,0),s.fillStyle=A.colorStringToRgba(this.color,this.highlight.maxShadowOpacity),ne.drawPoint(s,this.pointStyle,this.highlight.maxShadowSize,l,a),s.fillStyle=this.color,ne.drawPoint(s,this.pointStyle,this.highlight.maxSize,l,a),s.fillStyle="#fff",ne.drawPoint(s,this.pointStyle,this.highlight.defaultSize,l,a)),s.restore()}findGraphData(t,n,i,s){var f;const l=t[0],a=t[1],r={data:null,hit:!1,color:this.color},c=this._getValidGData(),d=this.useLinearInterpolation(),h=Math.max((this.pointSize??mi.pointSize)+mi.pointSize,mi.highlight.maxSize),u=p=>{if(!p||p.xp===void 0||p.yp===void 0)return!1;const g=l-p.xp,m=a-p.yp;return g*g+m*m<=h*h};if(c!=null&&c.length)if(typeof i=="number"&&this.show){if(r.data=c[i],r.index=i,r.data){const p=c[i];p.o!==null&&p.o!==void 0&&p.yp!==null&&p.yp!==void 0&&(Math.abs(a-p.yp)<=15&&(r.hit=!0),u(p)&&(r.hit=!0,r.directHit=!0))}}else if(typeof this.beforeFindItemIndex=="number"&&this.beforeFindItemIndex!==-1&&this.show&&s)r.data=c[this.beforeFindItemIndex],r.index=this.beforeFindItemIndex;else{let p=1/0,g=-1;const m=[];c.forEach((w,T)=>{w.xp!==null&&w.yp!==null&&w.o!==null&&m.push({...w,originalIndex:T})}),m.length===0&&c.forEach((w,T)=>{m.push({...w,originalIndex:T})});let y=0,C=m.length-1;for(;y<=C;){const w=Math.floor((y+C)/2),T=m[w],k=Math.abs(l-T.xp);if(k<p&&(p=k,g=T.originalIndex),T.xp<l){if(y=w+1,y<m.length){const M=Math.abs(l-m[y].xp);M<p&&(p=M,g=m[y].originalIndex)}}else if(T.xp>l){if(C=w-1,C>=0){const M=Math.abs(l-m[C].xp);M<p&&(p=M,g=m[C].originalIndex)}}else break}const b=m.findIndex(w=>w.originalIndex===g);if(b!==-1)for(let w=Math.max(0,b-2);w<=Math.min(m.length-1,b+2);w++){const T=m[w],k=Math.abs(l-T.xp);k<p&&(p=k,g=T.originalIndex)}if(g!==-1){let w=50;if(c.length>1){const k=[];for(let M=1;M<c.length;M++)c[M].xp!==null&&c[M-1].xp!==null&&k.push(Math.abs(c[M].xp-c[M-1].xp));k.length>0&&(w=k.reduce((M,Z)=>M+Z,0)/k.length)}const T=Math.max(w,1);if(p<=T)r.data=c[g],r.index=g;else{let k=!1,M=d?1/0:T;const Z=d?m:c;for(let S=0;S<Z.length;S++){const x=Math.abs(l-Z[S].xp);x<=M&&(k=!0,M=x,g=d?Z[S].originalIndex:S)}k&&(r.data=c[g],r.index=g)}if(r.data){const k=c[g];Math.abs(a-k.yp)<=15&&(r.hit=!0),u(k)&&(r.hit=!0,r.directHit=!0)}}}return s||(this.beforeMouseXp=l,this.beforeMouseYp=a,typeof r.index=="number"&&(this.beforeFindItemIndex=r.index)),d&&((f=r==null?void 0:r.data)==null?void 0:f.o)===null&&(r.data=null),r}findApproximateData(t){var f,p;const n=t[0],i=t[1],s={data:null,hit:!1,color:this.color},l=this.data.filter(g=>!A.isNullOrUndefined(g.x));if(!l.length)return s;const a=l.length>1?Math.abs(((f=l[1])==null?void 0:f.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,u=1/0;for(;c<=d;){const g=Math.floor((c+d)/2),m=l[g].xp;if(m-r<=n&&n<=m+r){const y=Math.max(0,g-2),C=Math.min(l.length-1,g+2);for(let b=y;b<=C;b++)if(l[b].xp!==null&&l[b].yp!==null){const w=Math.sqrt((n-l[b].xp)**2+(i-l[b].yp)**2);w<u&&(u=w,h=b)}return h!==-1&&(s.data=l[h],s.index=h,u<5&&(s.hit=!0)),s}else if(m+r<n){if(g<d&&n<l[g+1].xp){const y=Math.abs(l[g].xp-n),C=Math.abs(l[g+1].xp-n);s.data=y>C?l[g+1]:l[g],s.index=y>C?g+1:g;const b=s.data;return Math.abs(i-b.yp)<10&&(s.hit=!0),s}c=g+1}else{if(g>0&&n>l[g-1].xp){const y=Math.abs(l[g-1].xp-n),C=Math.abs(l[g].xp-n);s.data=y>C?l[g]:l[g-1],s.index=y>C?g:g-1;const b=s.data;return Math.abs(i-b.yp)<10&&(s.hit=!0),s}d=g-1}}return s}findItems({xsp:t,width:n}){const i=t+n;return this.data.filter(s=>t-1<=s.xp&&s.xp<=i+1)}}class JS{constructor(t,n,i,s=!1){const l=Ro({},mi,n);Object.keys(l).forEach(a=>{this[a]=l[a]}),this.name===void 0&&(this.name=`series-${i}`),["color","pointFill","fillColor","overflowColor"].forEach(a=>{this[a]===void 0&&(this[a]=Ht[i%Ht.length])}),this.sId=t,this.data=[],this.type="scatter",this.realTimeScatter=s,this._rtTotalCount=0,this._colorCache=new Map}getCachedColor(t,n){const i=`${t}_${n}`;if(this._colorCache.has(i))return this._colorCache.get(i);const s=A.colorStringToRgba(t,n);if(this._colorCache.size>100){const l=this._colorCache.keys().next().value;this._colorCache.delete(l)}return this._colorCache.set(i,s),s}draw(t){this.show&&(this.computeGeometry(t),this.realTimeScatter?this.realTimeScatterDraw(t):this.defaultScatterDraw(t))}computeGeometry(t){this.show&&(this.realTimeScatter?this.computeRealTimeGeometry(t):this.computeDefaultGeometry(t))}computeDefaultGeometry(t){const{duple:n,legendHitInfo:i,coordinateDedupe:s}=t,l=new Set,a=s!==!1;for(let r=0;r<this.data.length;r++){const c=this.data[r],d=A.coordinateKey(c.x,c.y);let h;i?h=i.sId===this.sId:a?h=n.get(d)===this.sId&&!l.has(d):h=!0,h&&(this.calcItem(c,t),c.xp!==null&&c.yp!==null&&a&&!i&&l.add(d))}}computeRealTimeGeometry(t){var r,c,d,h,u,f;const{duple:n,legendHitInfo:i,coordinateDedupe:s}=t,l=s!==!1;let a=0;for(let p=0;p<((c=(r=this.data[this.sId])==null?void 0:r.dataGroup)==null?void 0:c.length);p++)for(let g=0;g<((h=(d=this.data[this.sId])==null?void 0:d.dataGroup[p])==null?void 0:h.data.length);g++){const m=(f=(u=this.data[this.sId])==null?void 0:u.dataGroup[p])==null?void 0:f.data[g];a++;let y;i?y=i.sId===this.sId:l?y=n.get(A.coordinateKey(m.x,m.y))===this.sId:y=!0,y&&this.calcItem(m,t)}this._rtTotalCount=a}getOpacity(t,n,i){const s=n.includes("rgba")?A.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)!==i),l?c:s}calcItem(t,n){const{chartRect:i,labelOffset:s,axesSteps:l,displayOverflow:a}=n;let r;const c=l.x[this.xAxisIndex],d=l.y[this.yAxisIndex],h=i.chartWidth-(s.left+s.right),u=i.chartHeight-(s.top+s.bottom),f=i.x1+s.left,p=i.y2-s.bottom;let g=ne.calculateX(t.x,c.graphMin,c.graphMax,h,f);const m=ne.calculateY(a&&t.y>d.graphMax?d.graphMax:t.y,d.graphMin,d.graphMax,u,p);g!==null&&(r=A.aliasPixel(g),g+=r),t.xp=g,t.yp=m}defaultScatterDraw(t){const{ctx:n,axesSteps:i,duple:s,legendHitInfo:l,coordinateDedupe:a}=t,r=i.y[this.yAxisIndex],c=new Set,d=a!==!1,h=d&&!l,u=h?new Map:null;for(let f=0;f<this.data.length;f++){const p=this.data[f],g=f,m=A.coordinateKey(p.x,p.y);let y;if(l?y=l.sId===this.sId:d?y=s.get(m)===this.sId&&!c.has(m):y=!0,y&&p.xp!==null&&p.yp!==null){const b=p.y>r.graphMax&&this.overflowColor||p.dataColor||this.color,w=this.getOpacity(t,b,g),T=this.getCachedColor(b,w),k=p.dataColor||this.pointFill,M=this.getOpacity(t,k,g),Z=this.getCachedColor(k,M);if(h){const S=`${T} ${Z}`;let x=u.get(S);x||(x={strokeStyle:T,fillStyle:Z,points:[]},u.set(S,x)),x.points.push(p),c.add(m)}else n.strokeStyle=T,n.fillStyle=Z,ne.drawPoint(n,this.pointStyle,this.pointSize,p.xp,p.yp)}}h&&u.forEach(f=>{n.strokeStyle=f.strokeStyle,n.fillStyle=f.fillStyle,ne.drawPointBatch(n,this.pointStyle,this.pointSize,f.points)})}realTimeScatterDraw(t){var g,m,y,C,b,w;const{ctx:n,axesSteps:i,duple:s,legendHitInfo:l,coordinateDedupe:a}=t,r=i.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;const u=a!==!1,f=u&&!l,p=f?new Map:null;for(let T=0;T<((m=(g=this.data[this.sId])==null?void 0:g.dataGroup)==null?void 0:m.length);T++)for(let k=0;k<((C=(y=this.data[this.sId])==null?void 0:y.dataGroup[T])==null?void 0:C.data.length);k++){const M=(w=(b=this.data[this.sId])==null?void 0:b.dataGroup[T])==null?void 0:w.data[k];h++;let Z;if(l?Z=l.sId===this.sId:u?Z=s.get(M.k??A.coordinateKey(M.x,M.y))===this.sId:Z=!0,Z&&M.xp!==null&&M.yp!==null){const S=M.y>r.graphMax&&this.overflowColor,x=S||M.color||this.color,I=S||M.color||this.pointFill||this.color,L=this.getOpacity(t,x,k),V=this.getOpacity(t,I,k),R=this.getCachedColor(x,L),E=this.getCachedColor(I,V);if(f){const G=`${R} ${E}`;let v=p.get(G);v||(v={strokeStyle:R,fillStyle:E,points:[]},p.set(G,v)),v.points.push(M)}else n.strokeStyle=R,n.fillStyle=E,ne.drawPoint(n,c,d,M.xp,M.yp)}}f&&p.forEach(T=>{n.strokeStyle=T.strokeStyle,n.fillStyle=T.fillStyle,ne.drawPointBatch(n,c,d,T.points)}),this._rtTotalCount=h}realTimeScatterDrawStrip(t,n,i){var u;if(!this.show)return;const s=(u=this.data[this.sId])==null?void 0:u.dataGroup;if(!s)return;const{duple:l,coordinateDedupe:a}=i,r=a!==!1&&!!l,c=i.axesSteps.y[this.yAxisIndex],d=typeof this.pointStyle=="string"?this.pointStyle:this.pointStyle.value,h=typeof this.pointSize=="number"?this.pointSize:this.pointSize.value;for(let f=0;f<n.length;f++){const p=s[n[f]];if(p!=null&&p.data)for(let g=0;g<p.data.length;g++){const m=p.data[g];if(!(r&&l.get(m.k??A.coordinateKey(m.x,m.y))!==this.sId)&&(this.calcItem(m,i),m.xp!==null&&m.yp!==null)){const y=m.y>c.graphMax&&this.overflowColor,C=y||m.color||this.color,b=y||m.color||this.pointFill||this.color,w=this.getOpacity(i,C,g),T=this.getOpacity(i,b,g);t.strokeStyle=this.getCachedColor(C,w),t.fillStyle=this.getCachedColor(b,T),ne.drawPoint(t,d,h,m.xp,m.yp)}}}}refreshRtHitCoords(t){var i,s;const n=(i=this.data[this.sId])==null?void 0:i.dataGroup;if(n)for(let l=0;l<n.length;l++){const a=(s=n[l])==null?void 0:s.data;if(a)for(let r=0;r<a.length;r++)this.calcItem(a[r],t)}}refreshRtTotalCount(){var i,s,l;let t=0;const n=(i=this.data[this.sId])==null?void 0:i.dataGroup;if(n)for(let a=0;a<n.length;a++)t+=((l=(s=n[a])==null?void 0:s.data)==null?void 0:l.length)??0;return this._rtTotalCount=t,t}findItemsInRange(t,n,i,s,l){return t.filter(a=>n-1<=a.xp&&a.xp<=s+1&&i-1<=a.yp&&a.yp<=l+1)}defaultScatterFindItems(t,n,i,s,l){return this.findItemsInRange(t,n,i,s,l)}realTimeScatterFindItems(t,n,i,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,i,s,l))}return a}findItems({xsp:t,ysp:n,width:i,height:s}){const l=this.data,a=t+i,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 i=t.data,s=n,l=i.xp,a=i.yp;if(s.save(),l!==null&&a!==null){const r=i.dataColor||this.color,c=i.dataColor||this.pointFill;s.strokeStyle=this.getCachedColor(r,0),s.fillStyle=this.getCachedColor(c,this.highlight.maxShadowOpacity),ne.drawPoint(s,this.pointStyle,this.highlight.maxShadowSize,l,a),s.fillStyle=r,ne.drawPoint(s,this.pointStyle,this.highlight.maxSize,l,a),s.fillStyle="#fff",ne.drawPoint(s,this.pointStyle,this.highlight.defaultSize,l,a)}s.restore()}findGraphData(t){var c;const n=t[0],i=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 u=this._rtTotalCount-1;for(let f=d.length-1;f>=0;f--){const p=d[f];if(p!=null&&p.data)for(let g=p.data.length-1;g>=0;g--){const m=p.data[g];if(m.xp!==null&&m.yp!==null){const y=m.xp,C=m.yp;if(y-l<=n&&n<=y+l&&C-l<=i&&i<=C+l)return s.data=m,s.index=u,s.hit=!0,s}u--}}return s}const a=this.data,r=a.findIndex(d=>{const h=d.xp,u=d.yp;return h-l<=n&&n<=h+l&&u-l<=i&&i<=u+l});return r>-1&&(s.data=a[r],s.index=r,s.hit=!0),s}}class Hr{constructor(t,n,i,s){const l=He({},n,zS);Object.keys(l).forEach(a=>{this[a]=l[a]}),this.name===void 0&&(this.name=`series-${i}`),this.color===void 0&&(this.color=Ht[i%Ht.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}}computeGeometry(t){if(!this.show)return;const n=t.scaleVersion!=null&&t.dataEpoch!=null,i=t.showIndex??0,s=t.showSeriesCount??0;if(n&&this._lastDataEpoch===t.dataEpoch&&this._lastScaleVersion===t.scaleVersion&&this._lastShowIndex===i&&this._lastShowSeriesCount===s&&this._lastGeomData===this.data)return;const l=t.chartRect,a=t.labelOffset,r=t.axesSteps,c=t.showIndex,d=t.thickness,h=t.showSeriesCount;this.isHorizontal=t.isHorizontal;const{isHorizontal:u}=this;let f,p;const g=r.x[this.xAxisIndex],m=r.y[this.yAxisIndex];let y=this.data.length;const[C,b]=u?[m.minIndex,m.maxIndex]:[g.minIndex,g.maxIndex];Re(C)&&Re(b)&&(y=b-C+1);const w=l.chartWidth-(a.left+a.right),T=l.chartHeight-(a.top+a.bottom),k=l.x1+a.left,M=l.y2-a.bottom,Z=ne.calculateX(0,g.graphMin,g.graphMax,w),S=ne.calculateY(0,m.graphMin,m.graphMax,T),x=u?k+Z:k,I=u?M:M+S,L=u?T:w,V=L/(y||1);let R;t.cPadRatio>=1||t.cPadRatio<=0?R=2:R=Math.max(L*(t.cPadRatio/2)/y,2);let G,v,X;G=V>R*2?V-R*2:V,G=this.isExistGrp?G:G/h;const W=this.calculateBarSize(d,G);v=u?null:W,X=u?W:null;const N=u?(G-X)/2:(G-v)/2,P=this.isExistGrp?1:c+1;this.size.cat=V,this.size.bar=G,this.size.cPad=R,this.size.bPad=N,this.size.w=v,this.size.h=X,this.size.ix=P,this.chartRect=l,this.labelOffset=a,this.borderRadius=t.borderRadius,this.filteredCount=y;const D=Re(C)?C:0,O=Re(b)?b:this.data.length-1;this.visibleStartIndex=D;for(let Y=D;Y<=O;Y++){const H=Y-D,B=this.data[Y];if(B){const z=u?I-V*H-R:x+V*H+R;if(u?(f=x,p=Math.round(z-(G*P-(X+N)))):(f=Math.round(z+(G*P-(v+N))),p=I),u){const F=B.b?B.o:B.x,Q=t.displayOverflow&&F>g.graphMax?g.graphMax:F;v=ne.calculateX(Q,g.graphMin,g.graphMax,w,-Z),B.b&&(f=ne.calculateX(B.b,g.graphMin,g.graphMax,w,x-Z));const U=F>0?-1:1;v=F&&v!==null&&Math.abs(v)===0?U:v}else{const F=B.b?B.o:B.y,Q=t.displayOverflow&&F>m.graphMax?m.graphMax:F;X=ne.calculateY(Q,m.graphMin,m.graphMax,T,-S),B.b&&(p=ne.calculateY(B.b,m.graphMin,m.graphMax,T,I-S));const U=F>0?-1:1;X=F&&X!==null&&Math.abs(X)===0?U:X}B.xp=f,B.yp=p,B.w=v,B.h=u?-X:X,B.index=Y}}n&&(this._lastDataEpoch=t.dataEpoch,this._lastScaleVersion=t.scaleVersion,this._lastShowIndex=i,this._lastShowSeriesCount=s,this._lastGeomData=this.data)}draw(t){var H,B,z,F,Q;if(!this.show)return;this.computeGeometry(t);const n=t.ctx,i=t.chartRect,s=t.labelOffset,l=t.axesSteps,a=t.showIndex,r=t.thickness,c=t.showSeriesCount,d=t.displayOverflow;this.isHorizontal=t.isHorizontal;const{isHorizontal:h,showValue:u}=this;let f,p;const g=l.x[this.xAxisIndex],m=l.y[this.yAxisIndex],[y,C]=h?[m.minIndex,m.maxIndex]:[g.minIndex,g.maxIndex],b=Re(y)&&Re(C),w=b?y:0,T=b?C:this.data.length-1,k=T-w+1,M=i.chartWidth-(s.left+s.right),Z=i.chartHeight-(s.top+s.bottom),S=i.x1+s.left,x=i.y2-s.bottom,I=ne.calculateX(0,g.graphMin,g.graphMax,M),L=ne.calculateY(0,m.graphMin,m.graphMax,Z),V=h?S+I:S,R=h?x:x+L,E=h?Z:M,G=E/(k||1);let v;t.cPadRatio>=1||t.cPadRatio<=0?v=2:v=Math.max(E*(t.cPadRatio/2)/k,2);let W,N,P;W=G>v*2?G-v*2:G,W=this.isExistGrp?W:W/c;const D=this.calculateBarSize(r,W);N=h?null:D,P=h?D:null;const O=h?(W-P)/2:(W-N)/2,Y=this.isExistGrp?1:a+1;this.size.cat=G,this.size.bar=W,this.size.cPad=v,this.size.bPad=O,this.size.w=N,this.size.h=P,this.size.ix=Y,this.chartRect=i,this.labelOffset=s,this.borderRadius=t.borderRadius,this.filteredCount=k,this.visibleStartIndex=w;for(let U=w;U<=T;U++){const ee=U-w,j=this.data[U];if(j){const te=h?R-G*ee-v:V+G*ee+v;if(h?(f=V,p=Math.round(te-(W*Y-(P+O)))):(f=Math.round(te+(W*Y-(N+O))),p=R),h){const le=j.b?j.o:j.x,ce=d&&le>g.graphMax?g.graphMax:le;N=ne.calculateX(ce,g.graphMin,g.graphMax,M,-I),j.b&&(f=ne.calculateX(j.b,g.graphMin,g.graphMax,M,V-I));const be=le>0?-1:1;N=le&&N!==null&&Math.abs(N)===0?be:N}else{const le=j.b?j.o:j.y,ce=d&&le>m.graphMax?m.graphMax:le;P=ne.calculateY(ce,m.graphMin,m.graphMax,Z,-L),j.b&&(p=ne.calculateY(j.b,m.graphMin,m.graphMax,Z,R-L));const be=le>0?-1:1;P=le&&P!==null&&Math.abs(P)===0?be:P}const J=j.dataColor||this.color,q=t==null?void 0:t.legendHitInfo,$=(H=t==null?void 0:t.selectLabel)==null?void 0:H.option,ae=(B=t==null?void 0:t.selectItem)==null?void 0:B.option,he=((F=(z=t==null?void 0:t.selectLabel)==null?void 0:z.selected)==null?void 0:F.dataIndex)??[],{dataIndex:se,seriesID:fe}=((Q=t==null?void 0:t.selectItem)==null?void 0:Q.selected)??{};let ge=!1;if(q?ge=(q==null?void 0:q.sId)!==this.sId:$!=null&&$.use&&($!=null&&$.useSeriesOpacity)?ge=he.length&&!he.includes(U):yt(se)&&(ae!=null&&ae.useSeriesOpacity)&&(this.isExistGrp?ge=se!==U:ge=se!==U||fe!==this.sId),typeof J!="string")n.fillStyle=ne.createGradient(n,h,{x:f,y:p,w:N,h:P},J,ge,t.unSelectedOpacity);else{const le=J.includes("rgba")?A.getOpacity(J):1,ce=ge?t.unSelectedOpacity:le;n.fillStyle=A.colorStringToRgba(J,ce)}this.drawBar({ctx:n,positions:{x:f,y:p,w:N,h:P}}),u.use&&this.drawValueLabels({context:n,data:j,positions:{x:f,y:p,h:P,w:N},isHighlight:!1,textColor:j.dataTextColor,index:U})}}}itemHighlight(t,n,i,s){const l=this.showValue,a=t.data,r=n,c=a.xp,d=a.yp,h=a.w,u=a.h;r.save(),r.shadowOffsetX=0,r.shadowOffsetY=0,r.shadowBlur=4;const f=t.data.dataColor||this.color;if(typeof f!="string"){const p=ne.createGradient(r,this.isHorizontal,{x:c,y:d,w:h,h:u},f,!1,s);r.fillStyle=p,r.shadowColor=f[f.length-1][1]}else r.fillStyle=f,r.shadowColor=f;r.beginPath(),this.drawBar({ctx:r,positions:{x:c,y:d,w:h,h:this.isHorizontal?-u:u}}),l.use&&this.drawValueLabels({context:r,data:a,positions:{x:c,y:d,h:u,w:h},isHighlight:!0,textColor:t.data.dataTextColor||t.dataTextColor,index:i}),r.restore()}findGraphData(t,n,i,s){if(typeof i=="number"&&this.show&&s){const l=this.data,a={data:null,hit:!1,color:this.color},r=this.visibleStartIndex??0,c=r+(this.filteredCount??l.length)-1,d=Math.max(r,Math.min(i,c));return l[d]&&(a.data=l[d],a.index=d,a.hit=this.isPointInBar(t,l[d]),a.directHit=a.hit),a}return n?this.findGraphRangeCount(t):this.findGraphRange(t)}binarySearchBar(t,n){const[i,s]=t,l={data:null,hit:!1,color:this.color},a=this.data,r=this.visibleStartIndex??0,c=this.filteredCount??a.length;let d=r,h=Math.min(r+c-1,a.length-1);for(;d<=h;){const u=Math.floor((d+h)/2),f=a[u];if(!f){console.warn(`[EVUI][Bar] binarySearchBar: gdata[${u}] is falsy`);break}const{xp:p,yp:g,w:m,h:y}=f,C=p+m,b=g+y;if(n?b<=s&&s<=g:p<=i&&i<=C)return l.data=f,l.index=f.index,l.hit=this.isPointInBar(t,f),l.directHit=l.hit,l;(n?!(b<s):p+4<i)?d=u+1:h=u-1}return l}findGraphRange(t){return this.binarySearchBar(t,!1)}findGraphRangeCount(t){return this.binarySearchBar(t,!0)}drawValueLabels({context:t,data:n,positions:i,isHighlight:s,textColor:l,index:a}){const r=this.isHorizontal,{fontSize:c,textColor:d,align:h,formatter:u,decimalPoint:f}=this.showValue,{x:p,y:g,w:m,h:y}=i,C=t;C.save(),C.beginPath(),C.font=`normal normal normal ${c}px Roboto`,C.fillStyle=l||d,C.lineWidth=1,C.textBaseline="middle",C.textAlign=r&&h!=="center"?"left":"center";let b;const w=yt(this.stackIndex);w?b=n.o:b=(r?n.x:n.y)??"";let T;u&&(T=u(b,{label:r?n.y:n.x,index:a})),(!u||typeof T!="string")&&(T=A.labelSignFormat(b,f)??"");const k=b<0,M=Math.round(C.measureText(T).width),Z=c,S=r&&h!=="end"?10:4,x=k?p-S:p+S,I=k?g+S:g-S,L=p+m/2,V=s?g+y/2:g-y/2,R=r?V+c*.1:V,E=Math.abs(m),G=Math.abs(y),v=E-S,X=G-S,W=M<=E&&E>=Z;switch(h){case"start":{if(r){if(M<v&&Z<G){const N=k?x-M:x;C.fillText(T,N,R)}}else if(W&&Z+S<=G){const N=k?g+Z/2+S:g-Z/2-S;C.fillText(T,L,N)}break}case"center":{r?M<v&&Z<G&&C.fillText(T,L,R):W&&Z<X&&C.fillText(T,L,g+y/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,P=this.chartRect.x2-this.labelOffset.right;if(Z<this.size.bar)if(k){const D=p-S+m-M;D>N&&C.fillText(T,D,R)}else{const D=p+S+m;D+M<P&&C.fillText(T,D,R)}}else{const N=this.chartRect.y1+this.labelOffset.top,P=this.chartRect.y2-this.labelOffset.bottom;if(M<=this.size.bar)if(k){const D=g+y+S+Z/2;D+Z/2<=P&&C.fillText(T,L,D)}else{const D=g+y-S-Z/2;D-Z/2>=N&&C.fillText(T,L,D)}}break}default:case"end":{if(r){if(M<v&&Z<G){const N=k?p+m+S:p+m-M-S;C.fillText(T,N,R)}}else if(k){const N=g+y-Z/2-S;N>I&&W&&Z+S<=G&&C.fillText(T,L,N)}else W&&Z+S<=G&&C.fillText(T,L,g+y+Z/2+S);break}}C.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:i,borderRadius:s}=this,l="stackIndex"in this,a=s&&s>0,{x:r,y:c,w:d}=n,h=i?-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[i,s]=t,{xp:l,yp:a,w:r,h:c}=n,d=l+r,h=a+c;return l<=i&&i<=d&&h<=s&&s<=a}drawRoundedRect(t,n){const{chartRect:i,labelOffset:s,isHorizontal:l,borderRadius:a}=this,{x:r,y:c}=n;let{w:d,h}=n,u=a;const f=new Path2D;f.rect(i.x1+s.left,i.y1,i.chartWidth-s.right,i.chartHeight-s.bottom),t.clip(f),t.beginPath(),t.moveTo(r,c),Math.abs(d)<u*2&&(u=Math.abs(d)/2),Math.abs(h)<u*2&&(u=Math.abs(h)/2),l?d<0?(d+=u,t.lineTo(r+d,c),t.arcTo(r+d-u,c,r+d-u,c-u,u),t.arcTo(r+d-u,c-h,r+d,c-h,u),t.lineTo(r,c-h),t.lineTo(r,c)):(d-=u,t.lineTo(r+d,c),t.arcTo(r+d+u,c,r+d+u,c-u,u),t.arcTo(r+d+u,c-h,r+d,c-h,u),t.lineTo(r,c-h),t.lineTo(r,c)):h>0?(h-=u,t.lineTo(r+d,c),t.lineTo(r+d,c+h),t.arcTo(r+d,c+h+u,r-d+u,c+h+u,u),t.arcTo(r,c+h+u,r,c+h,u),t.lineTo(r,c)):(h+=u,t.lineTo(r+d,c),t.lineTo(r+d,c+h),t.arcTo(r+d,c+h-u,r+d-u,c+h-u,u),t.arcTo(r,c+h-u,r,c+h,u),t.lineTo(r,c)),t.fill(),t.closePath()}}class jS extends Hr{computeGeometry(t){if(!this.show)return;const n=t.chartRect,i=t.labelOffset,s=t.axesSteps,l=t.showIndex,a=t.isHorizontal,r=t.thickness,c=t.showSeriesCount;let d,h;const u=s.x[this.xAxisIndex],f=s.y[this.yAxisIndex],p=n.chartWidth-(i.left+i.right),g=n.chartHeight-(i.top+i.bottom),m=n.x1+i.left,y=n.y2-i.bottom,C=n.x2-i.right,w=(a?g:p)/(this.data.length||1),T=2;let k;this.isExistGrp?k=w-T*2:k=(w-T*2)/c;const Z=typeof r=="string"&&/[0-9]+px/.test(r)?Math.min(k,Number(r.replace("px",""))):typeof r=="number"&&r<=1&&r>=0?Math.ceil(k*r):k;let S=a?null:Z,x=a?null:Z,I=a?Z:null;const L=a?(k-I)/2:(k-S)/2,V=this.isExistGrp?1:l+1;this.size.cat=w,this.size.bar=k,this.size.cPad=T,this.size.bPad=L,this.size.w=S,this.size.ix=V,this.chartRect=n,this.labelOffset=i,this.borderRadius=t.borderRadius,this.data.forEach(R=>{a?(d=m,h=ne.calculateY(R.y,f.graphMin,f.graphMax,g,y)):(d=ne.calculateSubX(R.x,u.graphMin,u.graphMax,p,m),d<m?(x-=m-d,d=d+S<m?null:m):d+S>C&&(x-=x-(C-d)),d>=C&&(d=null),d!==null&&(d+=Math.ceil(k*V)-Math.round(S+L)),h=y),a?R.b?(S=ne.calculateX(R.x-R.b,u.graphMin,u.graphMax,p),d=ne.calculateX(R.b,u.graphMin,u.graphMax,p,m)):S=ne.calculateX(R.x,u.graphMin,u.graphMax,p):R.b?(I=ne.calculateY(R.y-R.b,f.graphMin,f.graphMax,g),h=ne.calculateY(R.b,f.graphMin,f.graphMax,g,y)):I=ne.calculateY(R.y,f.graphMin,f.graphMax,g),d!==null&&h!==null&&typeof(R.dataColor||this.color)!="string"&&(S=S!==x?x:S),x=S,R.xp=d,R.yp=h,R.w=S,R.h=a?-I:I})}draw(t){if(!this.show)return;this.computeGeometry(t);const n=t.ctx,i=t.chartRect,s=t.labelOffset,l=t.axesSteps,a=t.showIndex,r=t.isHorizontal,c=t.thickness,d=t.showSeriesCount;let h,u;const f=l.x[this.xAxisIndex],p=l.y[this.yAxisIndex],g=i.chartWidth-(s.left+s.right),m=i.chartHeight-(s.top+s.bottom),y=i.x1+s.left,C=i.y2-s.bottom,b=i.x2-s.right,T=(r?m:g)/(this.data.length||1),k=2;let M;this.isExistGrp?M=T-k*2:M=(T-k*2)/d;const S=typeof c=="string"&&/[0-9]+px/.test(c)?Math.min(M,Number(c.replace("px",""))):typeof c=="number"&&c<=1&&c>=0?Math.ceil(M*c):M;let x=r?null:S,I=r?null:S,L=r?S:null;const V=r?(M-L)/2:(M-x)/2,R=this.isExistGrp?1:a+1;this.size.cat=T,this.size.bar=M,this.size.cPad=k,this.size.bPad=V,this.size.w=x,this.size.ix=R,this.chartRect=i,this.labelOffset=s,this.borderRadius=t.borderRadius,this.data.forEach((E,G)=>{if(n.beginPath(),r?(h=y,u=ne.calculateY(E.y,p.graphMin,p.graphMax,m,C)):(h=ne.calculateSubX(E.x,f.graphMin,f.graphMax,g,y),h<y?(I-=y-h,h=h+x<y?null:y):h+x>b&&(I-=I-(b-h)),h>=b&&(h=null),h!==null&&(h+=Math.ceil(M*R)-Math.round(x+V)),u=C),r?E.b?(x=ne.calculateX(E.x-E.b,f.graphMin,f.graphMax,g),h=ne.calculateX(E.b,f.graphMin,f.graphMax,g,y)):x=ne.calculateX(E.x,f.graphMin,f.graphMax,g):E.b?(L=ne.calculateY(E.y-E.b,p.graphMin,p.graphMax,m),u=ne.calculateY(E.b,p.graphMin,p.graphMax,m,C)):L=ne.calculateY(E.y,p.graphMin,p.graphMax,m),h!==null&&u!==null){const v=E.dataColor||this.color,X=v.includes("rgba")?A.getOpacity(v):1,W=this.state==="downplay"?t.unSelectedOpacity:X;typeof v!="string"?(x=x!==I?I:x,n.fillStyle=ne.createGradient(n,r,{x:h,y:u,w:x,h:L},v,this.state==="downplay",t.unSelectedOpacity)):n.fillStyle=A.colorStringToRgba(v,W),this.drawBar({ctx:n,positions:{x:h,y:u,w:x,h:L}}),this.showValue.use&&this.drawValueLabels({context:n,data:E,positions:{x:h,y:u,h:L,w:x},isHighlight:!1,index:G})}I=x})}}class QS{constructor(t,n,i){const s=Ro({},FS,n);Object.keys(s).forEach(l=>{this[l]=s[l]}),this.name===void 0&&(this.name=`series-${i}`),this.color===void 0&&(this.color=Ht[i%Ht.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,i){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")?A.getOpacity(r):1,d=this.isDownplay?i: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=A.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 i={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),u=s>d&&h>=l&&h<=a;return this.show&&u&&(i.type=this.type,i.data=this.data,i.hit=!0,i.color=this.color,i.index=0),i}itemHighlight(t,n){var a,r;const i=n,s=this.isSelect?this.radius+5:this.radius;i.save(),i.shadowOffsetX=0,i.shadowOffsetY=0,i.shadowBlur=4;const l=((a=t==null?void 0:t.data)==null?void 0:a.dataColor)||this.color;i.fillStyle=l,i.shadowColor=l,i.beginPath(),i.moveTo(this.centerX,this.centerY),i.arc(this.centerX,this.centerY,s,this.startAngle,this.endAngle),i.lineTo(this.centerX,this.centerY),i.fill(),(r=this.showValue)!=null&&r.use&&this.drawValueLabels(i),i.closePath(),i.restore()}drawValueLabels(t){const n=t,i=this.data.o,{fontSize:s,textColor:l,formatter:a}=this.showValue;let r;a&&(r=a({value:i,percentage:this.data.percentage})),(!a||typeof r!="string")&&(r=A.labelSignFormat(i));const c=1.8,d=this.radius-this.doughnutHoleSize,h=(this.endAngle-this.startAngle)*180/Math.PI,u=s+4,f=Math.round(n.measureText(r).width);if(h>=f*c&&h>=u*c&&d>=f*c&&d>=u*c){n.save(),n.beginPath();const p=l.includes("rgba")?A.getOpacity(l):1,g=this.state==="downplay"?this.unSelectedOpacity:p;n.font=`normal normal normal ${s}px Roboto`,n.fillStyle=A.colorStringToRgba(l,g),n.lineWidth=1,n.textAlign="center",n.textBaseline="middle";const m=d/2+this.doughnutHoleSize,y=(this.endAngle-this.startAngle)/2+this.startAngle,C=m*Math.cos(y)+this.centerX,b=m*Math.sin(y)+this.centerY;n.fillText(r,C,b),n.restore()}}}class $S{constructor(t,n,i,s,l){const a=Ro({},AS,n);Object.keys(a).forEach(r=>{this[r]=a[r]}),this.isHorizontal=s,this.isGradient=l,this.createColorState(i),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=[],i=/[^0-9]&[^,]/g,{min:s,max:l,rangeCount:a,colorsByRange:r,error:c,stroke:d}=t,h=s.includes("#")?A.hexToRgb(s):s.replace(i,""),u=l.includes("#")?A.hexToRgb(l):l.replace(i,""),[f,p,g]=h.split(","),[m,y,C]=u.split(",");if(this.isGradient)n.push({minColor:{minR:f,minG:p,minB:g},maxColor:{maxR:m,maxG:y,maxB:C},rangeCount:a,start:0,end:100,selectedValue:null});else if(r.length)r.forEach(({color:b,label:w},T)=>{n.push({id:`color#${T}`,color:b,label:w,state:"normal",show:!0})});else{const b=Math.floor((f-m)/(a-1)),w=Math.floor((p-y)/(a-1)),T=Math.floor((g-C)/(a-1));for(let k=0;k<a;k++){const M=+f-b*k,Z=+p-w*k,S=+g-T*k;n.push({id:`color#${k}`,color:`rgb(${M},${Z},${S})`,state:"normal",show:!0})}}this.colorState=n,this.errorColor=c,this.stroke=d}getColorForGradient(t){const{minColor:n,maxColor:i}=this.colorState[0],{minR:s,minG:l,minB:a}=n,{maxR:r,maxG:c,maxB:d}=i,h=+s-Math.floor((s-r)*t/100),u=+l-Math.floor((l-c)*t/100),f=+a-Math.floor((a-d)*t/100);return`rgb(${h},${u},${f})`}getColorIndexByValue(t){const{existError:n,min:i,interval:s,decimalPoint:l}=this.valueOpt,a=this.colorState.length-1;if(n&&t<0)return a;const r=Math.floor(+(t-i).toFixed(l)/s);return r>=a?n?a-1:a:r}getItemInfo(t){const{min:n,max:i}=this.valueOpt,s={show:!1,opacity:1,dataColor:null,id:null,isHighlight:null};if(this.isGradient){const l=Je(t-n,i-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+(i-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,i,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,i),t.arcTo(n+s,i,n+s,i+l,d),t.arcTo(n+s,i+l,n,i+l,d),t.arcTo(n,i+l,n,i,d),t.arcTo(n,i,n+s,i,d),t.stroke(),t.fill()}else t.strokeRect(n,i,s,l),t.fillRect(n,i,s,l)}else{const r=A.aliasPixel(1);t.fillRect(n,i-r,s+r,l+r)}t.closePath()}}calculateXY(t,n,i,s){let l=null;if(this.labels[t]&&this.labels[t].length){let a=this.labels[t].findIndex(f=>f===n);a===-1&&(a=this.labels[t].findIndex(f=>+f==+n));const{minIndex:r,maxIndex:c,graphMin:d,graphMax:h}=s;if(Re(c)&&a>c||Re(r)&&a<r||no(r)&&no(c)&&(n<d||n>h))return null;const u=r??this.labels[t].findIndex(f=>+f==+d);a>-1&&(a-=u>-1?u:0,l=t==="x"?i+this.size.w*a:i-this.size.h*(a+1))}return l}computeGeometry(t){if(!this.show)return;const{chartRect:n,labelOffset:i,selectItem:s,axesSteps:l}=t,a=n.chartWidth-(i.left+i.right),r=n.chartHeight-(i.top+i.bottom),c=n.x1+i.left,d=n.y2-i.bottom,h=l.x[this.xAxisIndex],u=l.y[this.yAxisIndex];this.size.w=a/h.oriSteps,this.size.h=r/u.oriSteps,this.currentLabelInfo={x:{steps:h.oriSteps,min:h.graphMin,max:h.graphMax},y:{steps:u.oriSteps,min:u.graphMin,max:u.graphMax}},this.data.forEach((f,p)=>{var T;let m=this.calculateXY("x",f.x,c,h),y=this.calculateXY("y",f.y,d,u),C=this.size.w,b=this.size.h;const w=f.o;if(m!==null&&y!==null&&w!==null&&w!==void 0){const{show:k,dataColor:M,id:Z}=this.getItemInfo(w);if(f.dataColor||(f.dataColor=M),f.cId=Z,k){let S=this.stroke;const x=s==null?void 0:s.option,I=(x==null?void 0:x.use)&&(x==null?void 0:x.showBorder),L=p===((T=s==null?void 0:s.selected)==null?void 0:T.dataIndex);if(I&&L&&(S={show:x==null?void 0:x.showBorder,...x==null?void 0:x.borderStyle}),S.show&&S.lineWidth>0){const{lineWidth:V}=S,R=V*2;R<Math.floor(C)&&R<Math.floor(b)&&(m+=V,y+=V,C-=R,b-=R)}m+=1,f.xp=m,f.yp=y,f.w=C,f.h=b}}})}draw(t){if(!this.show)return;this.computeGeometry(t);const{ctx:n,chartRect:i,labelOffset:s,selectLabel:l,legendHitInfo:a,selectItem:r,axesSteps:c}=t,d=i.chartWidth-(s.left+s.right),h=i.chartHeight-(s.top+s.bottom),u=i.x1+s.left,f=i.y2-s.bottom,p=c.x[this.xAxisIndex],g=c.y[this.yAxisIndex];this.size.w=d/p.oriSteps,this.size.h=h/g.oriSteps,this.currentLabelInfo={x:{steps:p.oriSteps,min:p.graphMin,max:p.graphMax},y:{steps:g.oriSteps,min:g.graphMin,max:g.graphMax}};const m=(y,C,b)=>{var w,T;if(!a){let k;const{option:M,selected:Z}=r,{option:S,selected:x}=l,I=yt(Z==null?void 0:Z.dataIndex)&&(Z==null?void 0:Z.dataIndex)>-1,L=((w=x==null?void 0:x.label)==null?void 0:w.length)>0;return I?k=M.useSeriesOpacity?b!==(Z==null?void 0:Z.dataIndex):!1:L&&(k=S.useSeriesOpacity?!((T=x==null?void 0:x.label)!=null&&T.includes(this.getItemLabel(l,y))):!1),k?.1:C}return C};this.data.forEach((y,C)=>{var S;let w=this.calculateXY("x",y.x,u,p),T=this.calculateXY("y",y.y,f,g),k=this.size.w,M=this.size.h;const Z=y.o;if(w!==null&&T!==null&&Z!==null&&Z!==void 0){const{show:x,opacity:I,dataColor:L,id:V}=this.getItemInfo(Z);let R=I;I===1&&A.getColorStringType(y.dataColor)==="RGBA"&&(R=A.getOpacity(y.dataColor));const E=m(y,R,C);if(y.dataColor||(y.dataColor=L),y.cId=V,n.save(),x){n.fillStyle=A.colorStringToRgba(y.dataColor,E);let G=this.stroke;const v=r==null?void 0:r.option,X=(v==null?void 0:v.use)&&(v==null?void 0:v.showBorder),W=C===((S=r==null?void 0:r.selected)==null?void 0:S.dataIndex);X&&W&&(G={show:v==null?void 0:v.showBorder,...v==null?void 0:v.borderStyle});let N=!1;if(G.show&&G.lineWidth>0){const{color:P,lineWidth:D,opacity:O}=G,Y=D*2;N=Y<Math.floor(k)&&Y<Math.floor(M),n.strokeStyle=N?A.colorStringToRgba(P,E===1?O:E):void 0,N?(n.lineWidth=D,w+=D,T+=D,k-=Y,M-=Y):n.lineWidth=0}w+=1,this.drawItem(n,w,T,k,M,{...G,show:N}),n.restore(),this.showValue.use&&this.drawValueLabels({context:n,data:y})}}})}drawOverlay(t){if(!this.show)return;const{overlayCtx:n,chartRect:i,labelOffset:s,axesSteps:l}=t;if(!n)return;const a=i.x1+s.left,r=i.y2-s.bottom,c=l.x[this.xAxisIndex],d=l.y[this.yAxisIndex];this.data.forEach(h=>{const u=this.calculateXY("x",h.x,a,c),f=this.calculateXY("y",h.y,r,d),p=h.o;if(u!==null&&f!==null&&p!==null&&p!==void 0){const{show:g,isHighlight:m}=this.getItemInfo(p);g&&m&&this.itemHighlight({data:h},n)}})}drawValueLabels({context:t,data:n}){const{fontSize:i,textColor:s,align:l,formatter:a,decimalPoint:r}=this.showValue,{xp:c,yp:d,w:h,h:u,o:f}=n,p=t;p.save(),p.beginPath(),p.font=`normal normal normal ${i}px Roboto`,p.fillStyle=s,p.lineWidth=1,p.textBaseline="middle",p.textAlign=l!=="center"?"left":"center";let g;a&&(g=a(f)),(!a||typeof g!="string")&&(g=A.labelSignFormat(f,r));const m=Math.round(p.measureText(g).width),y=i,C=c+h/2,b=d+u/2;if(!(m>=h||y>=u||g<0)){switch(l){case"top":{const w=C-m/2,T=b-y/2;p.fillText(g,w,T);break}case"right":{const w=c+h-m;p.fillText(g,w,b);break}case"bottom":{const w=C-m/2,T=b+y/2;p.fillText(g,w,T);break}case"left":p.fillText(g,c,b);break;default:{const w=C-m/2;p.fillText(g,w,b);break}}p.restore()}}getAdjustedBounds({xp:t,yp:n,width:i,height:s}){const a=Math.max(0,i),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:i,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:u,xep:f,ysp:p,yep:g}=this.getAdjustedBounds({xp:r,yp:c,width:d,height:h});return u>=i&&f<=s&&p>=l&&g<=a})}itemHighlight(t,n){var m;const i=t.data,s=n,{stroke:l,shadow:a}=this.highlight,r=i.xp,c=i.yp,d=i.w,h=i.h,u=i.cId;let f;if(this.isGradient){const{min:y,max:C}=this.valueOpt,b=Je(i.o-y,C-y),{start:w,end:T}=this.colorState[0];f=w<=b&&b<=T||i.o===-1}else f=(m=this.colorState.find(({id:y})=>y===u))==null?void 0:m.show;if(r===null||c===null||!f)return;s.save();const p=A.getColorStringType(i.dataColor)==="RGBA"?t.dataColor:A.colorStringToRgba(i.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:y,width:C,radius:b}=l;g.show=!0,g.radius=b,s.lineWidth=C,g.lineWidth=C,s.strokeStyle=y||p,g.color=y||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:i})}findGraphData(t){const n=t[0],i=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:u}=r;return c<=n&&n<=c+h&&d<=i&&i<=d+u});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:i,yep:s,range:l}){const a=this.labels,r=1,c={xsp:Math.min(t,n),ysp:Math.min(i,s),width:Math.ceil(Math.abs(n-t)),height:Math.ceil(Math.abs(s-i))};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:u,x2:f,y1:p,y2:g}=l,m=(f-u)/d,y=(g-p)/h,C={xsp:t,xep:n,ysp:i,yep:s},b=(w,T,k)=>{let M,Z,S;w==="x"?(Z=m,S=u+r):(Z=y,S=p),a[w].findIndex((I,L)=>(M=S+Z*L,M<=T&&T<=M+Z))>-1?C[k]=["xsp","ysp"].includes(k)?M:M+Z:T<S&&(C[k]=S)};b("x",Math.min(t,n),"xsp"),b("x",Math.max(t,n),"xep"),b("y",Math.min(i,s),"ysp"),b("y",Math.max(i,s),"yep"),c.xsp=Math.min(C.xsp,C.xep),c.ysp=Math.min(C.ysp,C.yep),c.width=Math.abs(C.xep-C.xsp),c.height=Math.abs(C.yep-C.ysp)}return c}getFilteredLabel(t,n,i,s){return t.length!==n?t.filter(l=>i<=l&&l<=s):t}findSelectionRange(t){const{xsp:n,ysp:i,width:s,height:l,range:a}=t;let r=null;const{x1:c,x2:d,y1:h,y2:u}=a,{x:f,y:p}=this.labels;if(f.length&&p.length){const{x:{steps:g,min:m,max:y},y:{steps:C,min:b,max:w}}=this.currentLabelInfo,T=g||f.length,k=C||p.length,M=(d-c)/T,Z=(u-h)/k,S=n+s,x=i+l,I={min:Math.floor((n-c)/M),max:Math.floor((S-c-M)/M)},L=k-1,V={min:L-Math.round((x-h-Z)/Z),max:L-Math.round((i-h)/Z)},R=this.getFilteredLabel(f,T,m,y),E=this.getFilteredLabel(p,k,b,w);r={xMin:R[I.min],xMax:R[I.max],yMin:E[V.min],yMax:E[V.max]}}return r}getItemLabel(t,n){const{option:i,selected:s}=t;let l=this.isHorizontal?n.y:n.x;return i!=null&&i.useBothAxis&&(s!=null&&s.targetAxis)&&(l=(s==null?void 0:s.targetAxis)==="yAxis"?n.y:n.x),l}}const zr={Store:OS,Series:{createSeriesSet(e,t,n,i){let s=Object.keys(e);this.options.overlapping.use&&(s=this.getOverlappingSeriesKeys(e,t,i)),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})})},reconcileSeriesSet(e,t,n,i,s){let l=Object.keys(e);this.options.overlapping.use&&(l=this.getOverlappingSeriesKeys(e,t,i));const a=s||{},r={};for(let c=0;c<l.length;c++){const d=l[c],h=e[d],u=h.type||t,f=a[d];f&&this.canReuseSeries(f,u,h,n)?(this.seriesInfo.charts[u].push(d),f.show=f._freshShow,this.resetSeriesGroupMeta(f),r[d]=f):r[d]=this.addSeries({type:u,id:d,opt:h,index:c,isHorizontal:n})}this.seriesList=r},computeReconcileKey(e,t,n){var i,s;return{type:e,isHorizontal:n,timeMode:e==="bar"&&!!t.timeMode,realTime:e==="scatter"&&!!((i=this.options.realTimeScatter)!=null&&i.use),heatMapColor:e==="heatMap"?this.options.heatMapColor:null,isGradient:e==="heatMap"&&((s=this.options.legend)==null?void 0:s.type)==="gradient"}},canReuseSeries(e,t,n,i){const s=e._reconcileKey;if(!s||e._optSnapshot===void 0)return!1;const l=this.computeReconcileKey(t,n,i);return s.type!==l.type||s.isHorizontal!==l.isHorizontal||s.timeMode!==l.timeMode||s.realTime!==l.realTime||s.heatMapColor!==l.heatMapColor||s.isGradient!==l.isGradient?!1:_e(e._optSnapshot,n)},resetSeriesGroupMeta(e){e.isExistGrp=!1,e.stackIndex=0,e.groupIndex=null,e.bsId=null,e.bsIds=[],e.isOverlapping=!1},getOverlappingSeriesKeys(e,t,n){const i=[],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);i.push({key:a,overlappingIdx:d})}else s.push({key:a})}),i.sort((a,r)=>r.overlappingIdx-a.overlappingIdx),[...i,...s].map(({key:a})=>a)},addSeries(e){var r;const{type:t,id:n,opt:i,index:s,isHorizontal:l}=e;let a=!1;if(t==="line")this.seriesInfo.charts.line.push(n),a=new US(n,i,s);else if(t==="scatter")this.seriesInfo.charts.scatter.push(n),a=new JS(n,i,s,(r=this.options.realTimeScatter)==null?void 0:r.use);else if(t==="bar")this.seriesInfo.charts.bar.push(n),i.timeMode?a=new jS(n,i,s,l):a=new Hr(n,i,s,l);else if(t==="pie")this.seriesInfo.charts.pie.push(n),a=new QS(n,i,s);else if(t==="heatMap"){this.seriesInfo.charts.heatMap.push(n);const{heatMapColor:c,legend:d}=this.options,h=d.type==="gradient";a=new $S(n,i,c,l,h)}return a&&(a._reconcileKey=this.computeReconcileKey(t,i,l),a._optSnapshot=i,a._freshShow=a.show),a},addGroupInfo(e){e.forEach((t,n)=>{let i=0;t.reduce((s,l,a)=>{const r=this.seriesList[l];return r.stackIndex=a+i,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||i--,r.show?l:s},t[0])})}}};class pi{constructor(t,n,i,s){const l=He({},n,Br);Object.keys(l).forEach(a=>{this[a]=l[a]}),this.type=t,this.ctx=i,this.units=HS[this.type],this.options=s,this.position||(this.position=t==="x"?"bottom":"left")}calculateLabelRange(t,n,i,s){let l,a,r;t==="x"?(l=n.chartWidth,r=Math.floor(s*1.2),a=[i.left,i.right]):(l=n.chartHeight,a=[i.top,i.bottom],r=s+Math.floor(l*.1));const c=l-(a[0]+a[1]),d=1,h=Math.max(Math.floor(c/r),1);return{min:d,max:h}}calculateScaleRange(t,n){var d;let i,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"?(i=a[1]>+t.max?+t.max:a[1],s=a[0]<+t.min?+t.min:a[0]):(i=a[1],s=a[0]):typeof a=="function"?[s,i]=a(t.min,t.max):(i=t.max,s=t.min),this.autoScaleRatio&&(i=Math.ceil(i*(this.autoScaleRatio+1))),this.startToZero&&(s=0),i===s&&(i+=1,l=!0);const r=this.getLabelFormat(s),c=this.getLabelFormat(i,{isMaxValueSameAsMin:l});return{min:s,max:i,minLabel:r,maxLabel:c,size:A.calcTextSizeCanvas(c,A.getLabelStyle(this.labelStyle),(d=this.labelStyle)==null?void 0:d.padding)}}getLabelWidthHasMaxLength(t,n,i=[]){const s=A.getLabelStyle(this.labelStyle);return[...(t??[]).map(r=>this.getLabelFormat(r)),...i].reduce((r,c)=>{var h;const d=((h=A.calcTextSizeCanvas(c,s))==null?void 0:h.width)??0;return Math.max(r,d)},0)}calculateSteps(t){const{maxValue:n,minValue:i}=t;let{maxSteps:s}=t,l=this.getInterval(t),a=i,r;for(;a<n;)a+=l;const c=a,d=i,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 i=this.title;if(!(i!=null&&i.use)||isNaN(i.fontSize))return;const s=this.ctx;s.save(),s.font=A.getLabelStyle(i),s.fillStyle=i.color,s.textAlign=i.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+i.fontSize+c):(r=l.yTop-i.fontSize-c,a=l.xLeft),a>0&&r>0&&s.fillText(i.text,a,r),s.restore()}draw(t,n,i,s,l,a){var T,k,M,Z,S,x,I,L,V,R,E,G,v,X,W,N,P,D,O,Y;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=i.steps,u=i.graphMin,f=i.graphMax,p=i.interval,g=d[this.units.rectStart],m=d[this.units.rectEnd],y=d[this.units.rectOffset(this.position)],C=d[this.units.rectOffsetCounter(this.position)],b=5;let w;if(this.drawAxisTitle(t,n),r.font=A.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=A.aliasPixel(r.lineWidth),r.beginPath(),r.strokeStyle=this.axisLineColor,this.type==="x"?(r.moveTo(g,y+w),r.lineTo(m,y+w)):(r.moveTo(y+w,g),r.lineTo(y+w,m)),r.stroke(),r.closePath()),!(h===0||u===null)){if((T=this.labelStyle)!=null&&T.show){const H=m-g,B=H/h,z=[],F=i.interval;let Q=null,U=null,ee=g,j=u;if(this.type==="x"&&(c!=null&&c.axesX[0].flow)&&a.length!==h+1){const J=Math.floor(u/F)*F;J!==+u&&(j=J+F,ee+=H/(f-u)*(j-u))}r.strokeStyle=this.gridLineColor,r.lineWidth=1,w=A.aliasPixel(r.lineWidth);let te;for(let J=0;J<=h;J++)if(Q=Math.round(ee+B*J),Q<=m||this.type!=="x"||!(c!=null&&c.axesX[0].flow)||a.length===h+1){r.beginPath(),z[J]=j+J*p,z[J]===0&&this.zeroLineColor?r.strokeStyle=this.zeroLineColor:r.strokeStyle=this.gridLineColor,U=Q+w,te=this.getLabelFormat(Math.min(f,z[J]),{prev:z[J-1]??""});const $=((M=(k=this.options)==null?void 0:k.selectLabel)==null?void 0:M.use)&&((S=(Z=this.options)==null?void 0:Z.selectLabel)==null?void 0:S.useLabelOpacity)&&this.options.horizontal===(this.type==="y")&&((x=l==null?void 0:l.dataIndex)==null?void 0:x.length)&&!(l!=null&&l.label.map(fe=>this.getLabelFormat(Math.min(f,fe),{prev:z[J-1]??""})).includes(te));let ae;J===h&&this.lastLabelFontStyle?(r.font=A.getLabelStyle(this.lastLabelFontStyle),ae=this.lastLabelFontStyle.color):J===0&&this.firstLabelFontStyle?(r.font=A.getLabelStyle(this.firstLabelFontStyle),ae=this.firstLabelFontStyle.color):(r.font=A.getLabelStyle(this.labelStyle),ae=this.labelStyle.color);let he=1;A.getColorStringType(ae)==="RGBA"&&(he=A.getOpacity(ae)),r.fillStyle=A.colorStringToRgba(ae,$?(I=this.options)==null?void 0:I.unSelectedOpacity:he);let se;if(this.type==="x"){if(se=this.position==="top"?y-10:y+10,((L=c==null?void 0:c.brush)!=null&&L.showLabel||!(c!=null&&c.brush))&&r.fillText(this.checkFixWidth(te),Q,se),!$&&((V=c==null?void 0:c.selectItem)!=null&&V.showLabelTip)&&(s!=null&&s.label)&&!((R=this.options)!=null&&R.horizontal)){const fe=this.getLabelFormat(Math.min(f,s.label+0*p));if(fe===te){const ge=Math.round(r.measureText((E=this.labelStyle)==null?void 0:E.fontSize).width);A.showLabelTip({ctx:this.ctx,width:Math.round(r.measureText(fe).width)+10,height:ge,x:Q,y:se+(ge-2),borderRadius:2,arrowSize:3,text:te,backgroundColor:(v=(G=c==null?void 0:c.selectItem)==null?void 0:G.labelTipStyle)==null?void 0:v.backgroundColor,textColor:(W=(X=c==null?void 0:c.selectItem)==null?void 0:X.labelTipStyle)==null?void 0:W.textColor})}}this.showAxisTick&&(r.beginPath(),r.strokeStyle=this.axisLineColor,r.moveTo(U,y),r.lineTo(U,y+b),r.stroke(),r.closePath()),(J!==0||c!=null&&c.axesX[0].flow)&&this.showGrid&&(r.beginPath(),r.strokeStyle=this.gridLineColor,r.moveTo(U,y),r.lineTo(U,C),r.stroke(),r.closePath())}else se=this.position==="left"?y-10:y+10,((N=c==null?void 0:c.brush)!=null&&N.showLabel||!(c!=null&&c.brush))&&r.fillText(this.checkFixWidth(te),se,Q),J===h&&(U-=1),this.showAxisTick&&(r.beginPath(),r.strokeStyle=this.axisLineColor,r.moveTo(y+(this.axisLineWidth??1),U),r.lineTo(y-b,U),r.stroke(),r.closePath()),J!==0&&this.showGrid&&(r.beginPath(),r.strokeStyle=this.gridLineColor,r.moveTo(y,U),r.lineTo(C,U),r.stroke(),r.closePath())}}if((P=this.plotBands)!=null&&P.length||(D=this.plotLines)!=null&&D.length){const H=t.chartWidth-(n.left+n.right),B=t.chartHeight-(n.top+n.bottom),z=w+1,F=d.x1,Q=d.x2+z,U=d.y1-z,ee=d.y2;(O=this.plotBands)==null||O.forEach(j=>{const te=He({},j,Ko),{from:J,to:q,label:$}=te,ae=A.isNullOrUndefined(J)?u:Math.max(J,u),he=A.isNullOrUndefined(q)?f:Math.min(q,f);this.setPlotBandStyle(te);let se,fe;if(this.type==="x"){if(se=ne.calculateX(ae,u,f,H,F),fe=ne.calculateX(he,u,f,H,F),se===null||fe===null)return;this.drawXPlotBand(se,fe,F,Q,U,ee)}else{if(se=ne.calculateY(ae,u,f,B,ee),fe=ne.calculateY(he,u,f,B,ee),se===null||fe===null)return;this.drawYPlotBand(se,fe,F,Q,U,ee)}if($.show){const ge=this.getNormalizedLabelOptions(t,$),le=this.getPlotBandLabelPosition(se,fe,ge,Q,U);this.drawPlotLabel(ge,le)}r.restore()}),(Y=this.plotLines)==null||Y.forEach(j=>{if(typeof+j.value!="number")return;const te=He({},j,Ao),{value:J,label:q}=te;let $;if(this.type==="x"){if($=ne.calculateX(J,u,f,H,F),$===null)return;this.setPlotLineStyle(te),this.drawXPlotLine($,F,Q,U,ee)}else{if($=ne.calculateY(J,u,f,B,ee),$===null)return;this.setPlotLineStyle(te),this.drawYPlotLine($,F,Q,U,ee)}if(q.show){const ae=this.getNormalizedLabelOptions(t,q),he=this.getPlotLineLabelPosition($,ae,Q,U);this.drawPlotLabel(ae,he)}r.restore()})}}}setPlotLineStyle(t){const n=this.ctx,{color:i,lineWidth:s}=t;n.beginPath(),n.save(),n.lineWidth=s,n.strokeStyle=i,t.segments&&n.setLineDash(t.segments)}setPlotBandStyle(t){const n=this.ctx,{color:i}=t;n.beginPath(),n.save(),n.fillStyle=i}drawXPlotBand(t,n,i,s,l,a){const r=this.ctx,c=d=>d||d>i||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,i,s,l){const a=this.ctx;if(!t||t<n||t>i){a.closePath(),a.restore();return}let r=t;r+=A.aliasPixel(a.lineWidth),a.moveTo(r,l),a.lineTo(r,s),a.stroke(),a.restore(),a.closePath()}drawYPlotLine(t,n,i,s,l){const a=this.ctx;if(!t||t>l||t<s){a.closePath(),a.restore();return}let r=t;r+=A.aliasPixel(a.lineWidth),a.moveTo(n,r),a.lineTo(i,r),a.stroke(),a.restore(),a.closePath()}drawYPlotBand(t,n,i,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(i,t),r.lineTo(i,n),r.lineTo(s,n),r.lineTo(s,t),r.lineTo(i,t),r.fill(),r.restore(),r.closePath()}getNormalizedLabelOptions(t,n){const i=He({},n,Dr),s=this.ctx,{maxWidth:l}=i,a=i.fontSize>20?20:i.fontSize;let r=i.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&&i.textOverflow==="ellipsis"&&(r=A.truncateLabelWithEllipsis(i.text,d,s),c=s.measureText(r).width),{label:r,fontSize:a,labelWidth:c,labelBoxPadding:a/4,labelHalfWidth:c/2,labelHalfHeight:a/2,...i}}getPlotBandLabelPosition(t,n,i,s,l){const{fontSize:a,labelWidth:r,labelHalfWidth:c,labelHalfHeight:d,labelBoxPadding:h,textAlign:u,verticalAlign:f}=i;if(a<=0)return{textX:0,textY:0};let p,g;if(this.type==="x")switch(g=l-h-a,u){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,f){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,i,s){const{fontSize:l,labelWidth:a,labelHalfWidth:r,labelHalfHeight:c,labelBoxPadding:d}=n;if(l<=0)return{textX:0,textY:0};let h,u;if(this.type==="x")switch(u=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=i+a+d,n.verticalAlign){case"top":u=t-c-d;break;case"bottom":u=t+c+d;break;case"middle":default:u=t;break}return{textX:h,textY:u}}drawPlotLabel(t,n){if(!n)return;const{textX:i,textY:s}=n,{label:l,fontSize:a,fontColor:r,fillColor:c,lineColor:d,lineWidth:h,labelBoxPadding:u,labelWidth:f,labelHalfWidth:p,labelHalfHeight:g}=t;if(a<=0)return;const m=this.ctx;m.save(),m.beginPath(),m.font=A.getLabelStyle(t);let y=0,C=0,b=0,w=0;this.type==="x"?(y=s-u,C=s+a,b=i-p-u,w=i+p+u):(y=s-g-u,C=s+g+u,b=i-f,w=i+u),m.fillStyle=c,m.strokeStyle=d,m.lineWidth=h,m.moveTo(b,C),m.lineTo(b,y),m.lineTo(w,y),m.lineTo(w,C),m.lineTo(b,C),m.fill(),h>0&&m.stroke(),m.fillStyle=r,m.fillText(l,i,s),m.closePath()}checkFixWidth(t){const{fixWidth:n,fitDir:i}=this.labelStyle;return Re(n)&&n>0?A.truncateLabelWithEllipsis(t,n,this.ctx,i):t}}function qS(e){if(typeof e=="string"&&Ct[e])return{ms:Ct[e].size,unit:e,time:1};if(typeof e=="object"&&e!==null&&e.unit&&e.time>0){const t=Ct[e.unit];return t?{ms:e.time*t.size,unit:e.unit,time:e.time}:null}return typeof e=="number"&&e>0&&Number.isFinite(e)?{ms:e,unit:null,time:null}:null}function eC(e,t){if(!t.unit)return Ne(e.valueOf()+t.ms);const n=t.time||1;switch(t.unit){case"month":return e.add(n,"month");case"quarter":return e.add(n*3,"month");case"year":return e.add(n,"year");case"week":return e.add(n*7,"day");default:return Ne(e.valueOf()+t.ms)}}function tC(e,t){return t.unit?eC(Ne(e),t).valueOf():e+t.ms}function nC(e,t){if(!t.unit)return Math.ceil(e/t.ms)*t.ms;const n=t.time||1,i=Ne(e);if(["millisecond","second","minute","hour"].includes(t.unit)){const s=i.startOf("day").valueOf(),l=Ct[t.unit].size*n,a=e-s;return s+Math.ceil(a/l)*l}if(t.unit==="day"){const s=i.startOf("year").valueOf(),l=Ct.day.size*n,a=e-s;return s+Math.ceil(a/l)*l}if(t.unit==="week"){let s=i.startOf("year");const l=s.day();s=s.subtract((l+6)%7,"day");const a=s.valueOf(),r=Ct.week.size*n,c=e-a;return a+Math.ceil(c/r)*r}if(t.unit==="month"){const s=i.startOf("year"),l=i.startOf("month"),a=i.month(),r=l.valueOf()>=e?a:a+1,c=Math.ceil(r/n)*n;return s.add(c,"month").valueOf()}if(t.unit==="quarter"){const s=i.startOf("year"),l=Math.floor(i.month()/3),r=i.month(l*3).startOf("month").valueOf()>=e?l:l+1,c=Math.ceil(r/n)*n;return s.add(c*3,"month").valueOf()}if(t.unit==="year"){const s=i.startOf("year"),l=2e3,a=s.valueOf()>=e?i.year()-l:i.year()+1-l,r=Math.ceil(a/n)*n;return Ne(`${l+r}-01-01`).startOf("day").valueOf()}return e}function iC(e,t,n){const i=[];let s=nC(e,n);const l=1e4;for(;s<=t&&i.length<l;)i.push(s),s=tC(s,n);return i}function Fr(e){if(e==null)return null;if(typeof e=="number")return Number.isFinite(e)?e:null;const t=Ne(e).valueOf();return Number.isFinite(t)?t:null}class sC extends pi{normalizeTimeValue(t){return Fr(t)}calculateScaleRange(t,n){const i=n!=null&&n.use?n==null?void 0:n.range:this.range;if(!(Array.isArray(i)||typeof i=="function")&&((t==null?void 0:t.min)==null||(t==null?void 0:t.max)==null))return{min:null,max:null,minLabel:"",maxLabel:"",size:A.calcTextSizeCanvas("",A.getLabelStyle(this.labelStyle))};let l=i;Array.isArray(i)&&i.length===2?l=[this.normalizeTimeValue(i[0]),this.normalizeTimeValue(i[1])]:typeof i=="function"&&(l=(...h)=>{const[u,f]=i(...h);return[this.normalizeTimeValue(u),this.normalizeTimeValue(f)]});const a=this.range,r=n!=null&&n.use?{...n,range:l}:n,c={...t,min:this.normalizeTimeValue(t==null?void 0:t.min),max:this.normalizeTimeValue(t==null?void 0:t.max)};let d;try{n!=null&&n.use||(this.range=l),d=super.calculateScaleRange(c,r)}finally{this.range=a}return{...d,min:this.normalizeTimeValue(d.min),max:this.normalizeTimeValue(d.max)}}getLabelFormat(t,n={}){if(this.formatter){const i=this.formatter(t,n);if(typeof i=="string")return i}return Ne(t).format(this.timeFormat)}getInterval(t){const n=this.normalizeTimeValue(t.maxValue),i=this.normalizeTimeValue(t.minValue),s=t.maxSteps;if(this.interval){let l;if(typeof this.interval=="string"?l=Ct[this.interval].size:typeof this.interval=="object"?l=this.interval.time*Ct[this.interval.unit].size:typeof this.interval=="number"&&(l=this.interval),l>0&&Number.isFinite(l))return l}return Math.ceil((n-i)/s)}calculateSteps(t){const n=this.normalizeTimeValue(t.minValue),i=this.normalizeTimeValue(t.maxValue),s=Math.max(1,t.maxSteps??1);if(n==null||i==null)return{steps:0,interval:0,baseInterval:0,graphMin:null,graphMax:null,ticks:[]};const l=+n,a=+i;if(l>=a)return{steps:0,interval:0,baseInterval:0,graphMin:l,graphMax:a,ticks:[]};const r=qS(this.interval);let c;r?c=r:c={ms:Math.max(1,Math.ceil((a-l)/Math.max(1,s))),unit:null,time:null};const d=Math.ceil((a-l)/c.ms);let h=!this.fixedSteps&&d>s?Math.max(1,Math.floor(d/s)):1,u,f;const p=h+1e4;for(;h<=p;){const g=c.unit?{ms:c.ms*h,unit:c.unit,time:(c.time||1)*h}:{ms:c.ms*h,unit:null,time:null};if(f=g.ms,u=iC(l,a,g),u.length<=s||this.fixedSteps)break;h++}return{steps:Math.max(0,u.length-1),interval:f,baseInterval:c.ms,graphMin:l,graphMax:a,ticks:u}}draw(t,n,i,s,l){var b,w,T,k,M,Z,S,x,I,L,V,R,E,G,v,X,W,N,P,D;const a=this.ctx,r=this.options,c={x1:t.x1+n.left,x2:t.x2-n.right,y1:t.y1+n.top,y2:t.y2-n.bottom},d=i.graphMin,h=i.graphMax,u=i.ticks,f=c[this.units.rectStart],p=c[this.units.rectEnd],g=c[this.units.rectOffset(this.position)],m=c[this.units.rectOffsetCounter(this.position)],y=5;let C=0;if(this.drawAxisTitle(t,n),a.font=A.getLabelStyle(this.labelStyle),a.fillStyle=this.labelStyle.color,this.type==="x"?(a.textAlign="center",a.textBaseline=this.position==="top"?"bottom":"top"):(a.textAlign=this.position==="left"?"right":"left",a.textBaseline="middle"),this.showAxis&&(a.lineWidth=this.axisLineWidth,C=A.aliasPixel(a.lineWidth),a.beginPath(),a.strokeStyle=this.axisLineColor,this.type==="x"?(a.moveTo(f,g+C),a.lineTo(p,g+C)):(a.moveTo(g+C,f),a.lineTo(g+C,p)),a.stroke(),a.closePath()),!(!(u!=null&&u.length)||d===null)){if((b=this.labelStyle)!=null&&b.show){const O=c.x2-c.x1,Y=c.y2-c.y1;a.strokeStyle=this.gridLineColor,a.lineWidth=1,C=A.aliasPixel(a.lineWidth);let H;for(let B=0;B<u.length;B++){const z=u[B];let F;if(this.type==="x"?F=ne.calculateX(z,d,h,O,c.x1):F=ne.calculateY(z,d,h,Y,c.y2),F===null)continue;z===0&&this.zeroLineColor?a.strokeStyle=this.zeroLineColor:a.strokeStyle=this.gridLineColor;const U=F+C;H=this.getLabelFormat(z,{prev:u[B-1]??""});const ee=((T=(w=this.options)==null?void 0:w.selectLabel)==null?void 0:T.use)&&((M=(k=this.options)==null?void 0:k.selectLabel)==null?void 0:M.useLabelOpacity)&&this.options.horizontal===(this.type==="y")&&((Z=l==null?void 0:l.dataIndex)==null?void 0:Z.length)&&!(l!=null&&l.label.map(q=>this.getLabelFormat(q,{prev:u[B-1]??""})).includes(H));let j;B===u.length-1&&this.lastLabelFontStyle?(a.font=A.getLabelStyle(this.lastLabelFontStyle),j=this.lastLabelFontStyle.color):B===0&&this.firstLabelFontStyle?(a.font=A.getLabelStyle(this.firstLabelFontStyle),j=this.firstLabelFontStyle.color):(a.font=A.getLabelStyle(this.labelStyle),j=this.labelStyle.color);let te=1;A.getColorStringType(j)==="RGBA"&&(te=A.getOpacity(j)),a.fillStyle=A.colorStringToRgba(j,ee?(S=this.options)==null?void 0:S.unSelectedOpacity:te);let J;if(this.type==="x"){if(J=this.position==="top"?g-10:g+10,((x=r==null?void 0:r.brush)!=null&&x.showLabel||!(r!=null&&r.brush))&&a.fillText(this.checkFixWidth(H),F,J),!ee&&((I=r==null?void 0:r.selectItem)!=null&&I.showLabelTip)&&(s!=null&&s.label)&&!((L=this.options)!=null&&L.horizontal)){const q=this.getLabelFormat(s.label);if(q===H){const $=Math.round(a.measureText((V=this.labelStyle)==null?void 0:V.fontSize).width);A.showLabelTip({ctx:this.ctx,width:Math.round(a.measureText(q).width)+10,height:$,x:F,y:J+($-2),borderRadius:2,arrowSize:3,text:H,backgroundColor:(E=(R=r==null?void 0:r.selectItem)==null?void 0:R.labelTipStyle)==null?void 0:E.backgroundColor,textColor:(v=(G=r==null?void 0:r.selectItem)==null?void 0:G.labelTipStyle)==null?void 0:v.textColor})}}this.showAxisTick&&(a.beginPath(),a.strokeStyle=this.axisLineColor,a.moveTo(U,g),a.lineTo(U,g+y),a.stroke(),a.closePath()),this.showGrid&&(a.beginPath(),a.strokeStyle=this.gridLineColor,a.moveTo(U,g),a.lineTo(U,m),a.stroke(),a.closePath())}else{J=this.position==="left"?g-10:g+10,((X=r==null?void 0:r.brush)!=null&&X.showLabel||!(r!=null&&r.brush))&&a.fillText(this.checkFixWidth(H),J,F);let q=U;B===u.length-1&&(q-=1),this.showAxisTick&&(a.beginPath(),a.strokeStyle=this.axisLineColor,a.moveTo(g+(this.axisLineWidth??1),q),a.lineTo(g-y,q),a.stroke(),a.closePath()),this.showGrid&&(a.beginPath(),a.strokeStyle=this.gridLineColor,a.moveTo(g,q),a.lineTo(m,q),a.stroke(),a.closePath())}}}if((W=this.plotBands)!=null&&W.length||(N=this.plotLines)!=null&&N.length){const O=t.chartWidth-(n.left+n.right),Y=t.chartHeight-(n.top+n.bottom),H=C+1,B=c.x1,z=c.x2+H,F=c.y1-H,Q=c.y2;(P=this.plotBands)==null||P.forEach(U=>{const ee=He({},U,Ko),{from:j,to:te,label:J}=ee,q=A.isNullOrUndefined(j)?d:Math.max(j,d),$=A.isNullOrUndefined(te)?h:Math.min(te,h);this.setPlotBandStyle(ee);let ae,he;if(this.type==="x"){if(ae=ne.calculateX(q,d,h,O,B),he=ne.calculateX($,d,h,O,B),ae===null||he===null)return;this.drawXPlotBand(ae,he,B,z,F,Q)}else{if(ae=ne.calculateY(q,d,h,Y,Q),he=ne.calculateY($,d,h,Y,Q),ae===null||he===null)return;this.drawYPlotBand(ae,he,B,z,F,Q)}if(J.show){const se=this.getNormalizedLabelOptions(t,J),fe=this.getPlotBandLabelPosition(ae,he,se,z,F);this.drawPlotLabel(se,fe)}a.restore()}),(D=this.plotLines)==null||D.forEach(U=>{if(!Number.isFinite(+U.value))return;const ee=He({},U,Ao),{value:j,label:te}=ee;let J;if(this.type==="x"){if(J=ne.calculateX(j,d,h,O,B),J===null)return;this.setPlotLineStyle(ee),this.drawXPlotLine(J,B,z,F,Q)}else{if(J=ne.calculateY(j,d,h,Y,Q),J===null)return;this.setPlotLineStyle(ee),this.drawYPlotLine(J,B,z,F,Q)}if(te.show){const q=this.getNormalizedLabelOptions(t,te),$=this.getPlotLineLabelPosition(J,q,z,F);this.drawPlotLabel(q,$)}a.restore()})}}}}class oC extends pi{getTruthyValue(t){const n=this.adjustedDecimalPoint??this.decimalPoint;return Re(t)?Number(t.toFixed(n)):t}getLabelFormat(t,n={}){if(this.formatter){const s=this.getTruthyValue(t),l=this.formatter(s,{...n,prevOriginalValue:n==null?void 0:n.prev,prevDecimalPointValue:this.getTruthyValue(n==null?void 0:n.prev),currentOriginalValue:t,currentDecimalPointValue:s});if(typeof l=="string")return l}const i=this.adjustedDecimalPoint??this.decimalPoint;return A.labelSignFormat(t,i)}getInterval(t){if(this.interval)return this.interval;let n=0;const i=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(i),r=Math.abs(s)/a,c=Math.abs(i)/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(i)/(h||1))}else n=(i-s)/l;return this.decimalPoint?n:Math.ceil(n)}getExactInterval(t,n){if(!Number.isFinite(t)||t<=0)return{interval:1,steps:1};const i=Math.max(1,n);let s=null,l=0,a=1/0;for(let r=i;r>=1;r--){const c=t/r;let d=1;for(let h=0;h<=12;h++,d*=10){const u=c*d;if(Math.abs(u-Math.round(u))<1e-6){h<a&&c<t&&(a=h,s=Math.round(u)/d,l=r);break}}if(a===0)break}return l>0?{interval:s,steps:l}:{interval:parseFloat((t/i).toFixed(12)),steps:i}}getStepsWithNiceScale({max:t,min:n,maxSteps:i}){const s=t-n;if(!Number.isFinite(s)||s<=0)return{max:n+1,min:n,interval:1,steps:1};const l=s/i,a=Math.floor(Math.log10(l)),r=Math.ceil(Math.log10(s));let c=t,d=n,h=0,u=0,f=1/0;for(let p=a;p<=r;p++){const g=10**p;for(const m of KS){const y=m*g;if(y>=l){const C=y*1e-10,b=Math.floor((n+C)/y)*y,w=Math.ceil((t-b-C)/y),T=b+y*w;if(w<=i&&T>=t-C){const k=n-b+(T-t);k<f&&(c=T,d=b,h=y,u=w,f=k)}}}}if(!(h>0)||u<=0){const p=Math.max(1,i),g=s/p||1;return{max:t,min:n,interval:g,steps:p}}return{max:c,min:d,interval:h,steps:u}}getDecimalPointFromInterval(t){if(!Number.isFinite(t)||t===0)return 0;const n=Math.abs(t),i=10,s=1e-10,l=(c,d=0)=>{const h=10**d;return Math.round((c+Number.EPSILON)*h)/h},a=(c,d)=>{const h=l(c,d);return Math.abs(c-h)<s};if(n>=1&&a(n,0))return 0;const r=n>=1?0:Math.max(0,Math.ceil(-Math.log10(n)));for(let c=r;c<=i;c+=1)if(a(n,c))return c;return i}getLegacyOneMaxScale(t){return this.decimalPoint?t>2?{interval:.2,steps:5}:{interval:.5,steps:2}:{interval:1,steps:1}}calculateSteps(t){const{minValue:n,maxValue:i}=t,s=Math.max(1,t.maxSteps??1),l=Array.isArray(this.range)&&this.range.length===2,r=typeof this.interval=="number"||typeof this.interval=="object"&&this.interval!==null?this.getInterval(t):null,c=r!=null&&r>0&&Number.isFinite(r),d=l?+this.range[0]:null,h=l?+this.range[1]:null,u=1e-10,f=b=>{if(this.decimalPoint==="auto"){const w=this.getDecimalPointFromInterval(b);w!=null&&!Number.isNaN(w)?this.adjustedDecimalPoint=w:typeof this.getAutoDecimalPointFromInterval=="function"?this.adjustedDecimalPoint=this.getAutoDecimalPointFromInterval(b):this.adjustedDecimalPoint=0}else this.adjustedDecimalPoint=this.decimalPoint},p=(b,w)=>Math.max(1,Math.round(b/w+u)),g=({min:b,max:w,interval:T})=>{let k=0,M=0;return b>=0?(k=+b,M=Math.ceil(w/T)*T):w>=0?(k=Math.floor(b/T)*T,M=Math.ceil(w/T)*T):(M=+w,k=Math.floor(b/T)*T),{graphMin:k,graphMax:M}};if(l&&c){const b=d,w=h,T=r,M=(w-b)/T;if(Math.abs(M-Math.round(M))<u&&M<=s||this.fixedSteps){const S=Math.round(M);return f(T),{steps:S,interval:T,graphMin:b,graphMax:w}}}if(l){const b=d,w=h,T=w-b,{interval:k,steps:M}=this.getExactInterval(T,s);return f(k),{steps:M,interval:k,graphMin:b,graphMax:w}}if(c){let b=r,w=0,T=0,k=0,M=0;for({graphMin:w,graphMax:T}=g({min:n,max:i,interval:b}),k=T-w,M=p(k,b);M>s;)b+=r,{graphMin:w,graphMax:T}=g({min:n,max:i,interval:b}),k=T-w,M=p(k,b);return f(b),{steps:M,interval:b,graphMin:w,graphMax:T}}const m=this.startToZero&&n>=0?0:n,y=this.startToZero&&i<=0?0:i;if(m===0&&y===1){const b=this.getLegacyOneMaxScale(s);return f(b.interval),{steps:b.steps,interval:b.interval,graphMin:m,graphMax:y}}const C=this.getStepsWithNiceScale({min:m,max:y,maxSteps:s});return f(C.interval),{steps:C.steps,interval:C.interval,graphMin:C.min,graphMax:C.max}}calculateScaleRange(t,n){var u;let i,s,l=!1;const a=n!=null&&n.use?n==null?void 0:n.range:this.range;if(!(Array.isArray(a)||typeof a=="function")&&((t==null?void 0:t.min)==null||(t==null?void 0:t.max)==null)){const f=this.getLabelFormat(0),p=this.getLabelFormat(1,{isMaxValueSameAsMin:!0});return{min:0,max:1,minLabel:f,maxLabel:p,size:A.calcTextSizeCanvas(p,A.getLabelStyle(this.labelStyle))}}Array.isArray(a)&&(a==null?void 0:a.length)===2?this.options.type==="heatMap"?(i=a[1]>+t.max?+t.max:a[1],s=a[0]<+t.min?+t.min:a[0]):(i=a[1],s=a[0]):typeof a=="function"?[s,i]=a(t.min,t.max):(i=t.max,s=t.min);const c=Array.isArray(this.range)&&this.range.length===2;if(this.autoScaleRatio&&!c){const f=i,p=i*(this.autoScaleRatio+1);if(i=this.decimalPoint?p:Math.ceil(p),i>0&&s<0){const g=f-i;s+=g}else if(i<0&&s<0){const g=s*(this.autoScaleRatio+1);s=this.decimalPoint?g:Math.ceil(g)}}this.startToZero&&!c&&(s>0&&(s=0),i<0&&(i=0)),i===s&&(i+=1,l=!0);const d=this.getLabelFormat(s),h=this.getLabelFormat(i,{isMaxValueSameAsMin:l});return{min:s,max:i,minLabel:d,maxLabel:h,size:A.calcTextSizeCanvas(h,A.getLabelStyle(this.labelStyle),(u=this.labelStyle)==null?void 0:u.padding)}}}class lC extends pi{calculateScaleRange(t){let n,i,s=!1;Array.isArray(this.range)&&this.range.length===2?(n=this.range[1],i=this.range[0]):typeof range=="function"?[i,n]=this.range(t.min,t.max):(n=t.max,i=t.min);const l=A.calculateMagnitude(n-i);n=Math.ceil(n/10**l)*10**l,this.startToZero&&(i=0),n===i&&(n+=1,s=!0);const a=this.getLabelFormat(i),r=this.getLabelFormat(n,{isMaxValueSameAsMin:s});return{min:i,max:n,minLabel:a,maxLabel:r,size:A.calcTextSizeCanvas(r,A.getLabelStyle(this.labelStyle))}}calculateSteps(t,n){const i=t.maxValue,s=t.minValue,l=t.maxSteps,a=A.calculateMagnitude(i-s);let r=this.getInterval(t),c;const d=i,h=s,u=d-h;for(c=Math.round(u/r),i===1&&(r=.2,c=5);(c>l||c*2<l)&&!n;)if(c>l)r*=2,c=Math.ceil(u/r);else if(a>=0)if(r/2%1===0)r/=2,c=Math.ceil(u/r);else break;else r/=2,c=Math.ceil(u/r);return{steps:c,interval:r,graphMin:h,graphMax:Math.ceil(h+c*r)}}getLabelFormat(t,n={}){if(this.formatter){const i=this.formatter(t,n);if(typeof i=="string")return i}return A.labelSignFormat(t,this.decimalPoint)}getInterval(t){const n=t.maxValue,i=t.minValue;return 10**A.calculateMagnitude(n-i)}}const _o=new WeakMap;class aC extends pi{constructor(t,n,i,s,l){super(t,n,i,l),this.labels=s}getMaxWidth(t,n){var s;const i=(s=this.labelStyle)==null?void 0:s.maxWidth;if(i==null)return n;if(typeof i=="string"){const l=i.trim();if(l.includes("%")){const r=Number.parseFloat(l.replace("%",""));return Number.isNaN(r)?n:t.chartWidth*(r/100)}const a=Number.parseFloat(l);return Number.isNaN(a)?n:a}return i}getStepMinMax(t,n){return this.labelStyle.alignToGridLine?t:n!=null&&n.use?(_o.has(this.labels)||_o.set(this.labels,A.getStringMinMax(this.labels)),_o.get(this.labels)):A.getStringMinMax(this.labels)}calculateScaleRange(t,n,i){const s=this.getStepMinMax(t,n);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[f,p]=h;Re(f)&&Re(p)&&(r=f<r?r:f,c=p>c?c:p,l=this.labels[c],a=this.labels[r],d=c-r+1)}else if(typeof h=="function"){const[f,p]=h(a,l);r=f<r?r:f,c=p>c?c:p,l=this.labels[c],a=this.labels[r],d=c-r+1}const u=this.getMaxWidth(i,i.chartWidth/(d+2));return{min:a,max:l,minIndex:r,maxIndex:c,minLabel:this.getLabelFormat(a,u),maxLabel:this.getLabelFormat(l,u),size:A.calcTextSizeCanvas(this.getLabelFormat(l,u),A.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:i,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:i,minIndex:s,maxIndex:l}}draw(t,n,i,s,l){var b,w,T,k,M,Z,S,x,I,L,V;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=i.steps,h=i.indexInterval,u=i.minIndex,f=c[this.units.rectStart],p=c[this.units.rectEnd],g=c[this.units.rectOffset(this.position)],m=c[this.units.rectOffsetCounter(this.position)],y=this.getMaxWidth(t,t.chartWidth/(d+2)),C=5;if(this.drawAxisTitle(t,n),(b=this.labelStyle)!=null&&b.show){a.font=A.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 R=A.aliasPixel(a.lineWidth);if(a.beginPath(),a.strokeStyle=this.axisLineColor,this.type==="x"?(a.moveTo(f,g+R),a.lineTo(p,g+R)):(a.moveTo(g+R,f),a.lineTo(g+R,p)),a.stroke(),d===0)return;const E=(p-f)/d,G=this.labelStyle.alignToGridLine;let v=null,X=null;a.beginPath(),a.strokeStyle=this.gridLineColor;let W,N,P;for(P=0;P<d;P+=h){const D=u+P,O=this.labels[D];v=Math.round(f+E*P),X=v+R,W=this.getLabelFormat(O,y);const{selectLabel:Y,selectItem:H,horizontal:B}=this.options;let z;l!=null&&l.targetAxis?z=(l==null?void 0:l.targetAxis)==="yAxis"?"y":"x":z=B?"y":"x";const F=(Y==null?void 0:Y.use)&&(Y==null?void 0:Y.useLabelOpacity)&&z===this.type&&((w=l==null?void 0:l.dataIndex)==null?void 0:w.length)&&!((T=l==null?void 0:l.dataIndex)!=null&&T.includes(D));let Q;P===d-1&&this.lastLabelFontStyle?(a.font=A.getLabelStyle(this.lastLabelFontStyle),Q=this.lastLabelFontStyle.color):P===0&&this.firstLabelFontStyle?(a.font=A.getLabelStyle(this.firstLabelFontStyle),Q=this.firstLabelFontStyle.color):(a.font=A.getLabelStyle(this.labelStyle),Q=this.labelStyle.color);let U=1;if(A.getColorStringType(Q)==="RGBA"&&(U=A.getOpacity(Q)),a.fillStyle=A.colorStringToRgba(Q,F?(k=this.options)==null?void 0:k.unSelectedOpacity:U),this.type==="x"){N=this.position==="top"?g-10:g+10;const ee=G?v:v+E/2;if(a.fillText(this.checkFixWidth(W),ee,N),!F&&(H!=null&&H.showLabelTip)&&(s!=null&&s.label)&&!B){const j=s.label;if(j===W){const te=Math.round(a.measureText((M=this.labelStyle)==null?void 0:M.fontSize).width);A.showLabelTip({ctx:this.ctx,width:Math.round(a.measureText(j).width)+10,height:te,x:v+E/2,y:N+(te-2),borderRadius:2,arrowSize:3,text:W,backgroundColor:(Z=H==null?void 0:H.labelTipStyle)==null?void 0:Z.backgroundColor,textColor:(S=H==null?void 0:H.labelTipStyle)==null?void 0:S.textColor})}}this.showAxisTick&&(a.beginPath(),a.strokeStyle=this.axisLineColor,a.moveTo(v+E/2,g),a.lineTo(v+E/2,g+C),a.stroke(),a.closePath()),P>0&&this.showGrid&&(a.beginPath(),a.strokeStyle=this.gridLineColor,a.moveTo(X,g),a.lineTo(X,m),a.stroke(),a.closePath())}else{N=this.position==="left"?g-10:g+10;const ee=G?v:v+E/2;a.fillText(this.checkFixWidth(W),N,ee),this.showAxisTick&&(a.beginPath(),a.strokeStyle=this.axisLineColor,a.moveTo(g+(this.axisLineWidth??1),ee),a.lineTo(g-C,ee),a.stroke(),a.closePath()),P>0&&this.showGrid&&(a.beginPath(),a.strokeStyle=this.gridLineColor,a.moveTo(g,X),a.lineTo(m,X),a.stroke(),a.closePath())}a.stroke()}if(this.showLastLabel){const D=u+d-1;if(u+Math.floor((d-1)/h)*h!==D){const Y=Math.round(f+E*(d-1)),H=G?Y:Y+E/2,B=this.getLabelFormat(r[D],y);a.font=this.lastLabelFontStyle?A.getLabelStyle(this.lastLabelFontStyle):A.getLabelStyle(this.labelStyle),a.fillStyle=this.lastLabelFontStyle?this.lastLabelFontStyle.color:this.labelStyle.color,this.type==="x"?a.fillText(this.checkFixWidth(B),H,N):a.fillText(this.checkFixWidth(B),N,H),this.showAxisTick&&(a.beginPath(),a.strokeStyle=this.axisLineColor,this.type==="x"?(a.moveTo(H,g),a.lineTo(H,g+C)):(a.moveTo(g+(this.axisLineWidth??1),H),a.lineTo(g-C,H)),a.stroke(),a.closePath())}}if(G&&!this.showLastLabel){const D=y0(+r[1],+r[0]),O=Ho(+r[r.length-1],D);if(isNaN(O))return;v=Math.round(f+E*this.labels.length),X=v+R;const Y=this.getLabelFormat(`${O}`,y),H=v+E/2;a.font=A.getLabelStyle(this.labelStyle),a.fillStyle=this.labelStyle.color,this.type==="x"?a.fillText(this.checkFixWidth(Y),v,N):a.fillText(this.checkFixWidth(Y),N,v),this.showAxisTick&&(a.beginPath(),a.strokeStyle=this.axisLineColor,this.type==="x"?(a.moveTo(H,g),a.lineTo(H,g+C)):(a.moveTo(g+(this.axisLineWidth??1),X),a.lineTo(g-C,X)),a.stroke(),a.closePath())}a.closePath()}if((x=this.plotBands)!=null&&x.length||(I=this.plotLines)!=null&&I.length){const R=A.aliasPixel(a.lineWidth)+1,E=c.x1+R,G=c.x2,v=c.y1+R,X=c.y2,W=(p-f)/(this.labelStyle.show?r.length:1);(L=this.plotBands)==null||L.forEach(N=>{if(!N.from&&!N.to)return;const P=He({},N,Ko),{from:D=0,to:O=r.length,label:Y}=P,H=Math.round(f+W*D),B=Math.round(f+W*O);if(this.setPlotBandStyle(P),this.type==="x"?this.drawXPlotBand(H,B,E,G,v,X):this.drawYPlotBand(H,B,E,G,v,X),Y.show){const z=this.getNormalizedLabelOptions(t,Y),F=this.getPlotBandLabelPosition(H,B,z,G,v);this.drawPlotLabel(z,F)}a.restore()}),(V=this.plotLines)==null||V.forEach(N=>{if(!N.value)return;const P=He({},N,Ao),{value:D,label:O}=P,Y=Math.round(f+W*D)+W/2;if(this.setPlotLineStyle(P),this.type==="x"?this.drawXPlotLine(Y,E,G,v,X):this.drawYPlotLine(Y,E,G,v,X),O.show){const H=this.getNormalizedLabelOptions(t,O),B=this.getPlotLineLabelPosition(Y,H,G,v);this.drawPlotLabel(H,B)}a.restore()})}}getLabelFormat(t,n,i={}){if(this.formatter){const s=this.formatter(t,i);if(typeof s=="string")return s}return this.labelStyle.fitWidth?this.fittingString(t,n):t}fittingString(t,n){const i=this.ctx;i.save(),i.font=A.getLabelStyle(this.labelStyle);const s=this.labelStyle.fitDir;return A.truncateLabelWithEllipsis(t,n,i,s)}getLabelWidthHasMaxLength(t,n,i=[]){const s=A.getLabelStyle(this.labelStyle),l=(t==null?void 0:t.length)??0,a=this.getMaxWidth(n,(n==null?void 0:n.chartWidth)/(l+2));return[...(t??[]).map(d=>this.getLabelFormat(d,a)),...i].reduce((d,h)=>{var f;const u=((f=A.calcTextSizeCanvas(h,s))==null?void 0:f.width)??0;return Math.max(d,u)},0)}}class rC extends pi{constructor(t,n,i,s,l){super(t,n,i),this.labels=s,this.options=l}getLabelFormat(t,n={}){if(this.formatter){const i=this.formatter(t,n);if(typeof i=="string")return i}return Ne(t).format(this.timeFormat)}calculateScaleRange(t,n,i){const s=super.calculateScaleRange(t,n,i),l=this.labels;if(!(l!=null&&l.length))return{...s,minIndex:0,maxIndex:-1};let a=0,r=l.length-1;const{min:c,max:d}=s;if(Number.isFinite(c)&&Number.isFinite(d)){const h=l.findIndex(f=>f>=c);let u=-1;for(let f=l.length-1;f>=0;f-=1)if(l[f]<=d){u=f;break}h===-1||u===-1||u<h?(a=0,r=-1):(a=h,r=u)}else{const h=n!=null&&n.use?n==null?void 0:n.range:this.range;h!=null&&console.warn("[EVUI][TimeCategoryScale] axis range가 유효한 min/max 숫자로 해석되지 않아 전체 라벨 범위로 폴백합니다. range 설정을 확인하세요:",h)}return{...s,minIndex:a,maxIndex:r}}getInterval(t){const n=t.maxValue,i=t.minValue,s=t.maxSteps;if(this.interval){if(typeof this.interval=="string")return Ct[this.interval].size;if(typeof this.interval=="object")return this.interval.time*Ct[this.interval.unit].size;if(typeof this.interval=="number")return this.interval}return Math.ceil((n-i)/s)}calculateSteps(t){const{maxValue:n,minValue:i,maxSteps:s,minIndex:l,maxIndex:a}=t,r=this.getInterval(t);let c=r,d=i,h;for(;d<n;)d+=c;const u=d>n?n:d,f=i,p=u-f;h=Math.round(p/c)+1;const g=h;for(n===1&&(c=.2,h=5);h>s;)c*=2,h=Math.round(p/c),c=Math.ceil(p/h);return u-f>h*c&&(c=Math.ceil((u-f)/h)),{steps:h,oriSteps:g,interval:c,rawInterval:r,graphMin:f,graphMax:u,minIndex:l,maxIndex:a}}draw(t,n,i,s,l){var E,G,v,X,W,N,P,D,O,Y,H,B,z,F,Q,U;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=i.steps,h=i.graphMin,u=i.graphMax,f=i.rawInterval,p=i.oriSteps;let g=c[this.units.rectStart];const m=c[this.units.rectEnd],y=c[this.units.rectOffset(this.position)],C=c[this.units.rectOffsetCounter(this.position)],b=5;this.drawAxisTitle(t,n),a.font=A.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=A.aliasPixel(a.lineWidth);if(a.beginPath(),a.strokeStyle=this.axisLineColor,this.type==="x"?(a.moveTo(g,y+w),a.lineTo(m,y+w)):(a.moveTo(y+w,g),a.lineTo(y+w,m)),a.stroke(),a.closePath(),d===0||h===null)return;const T=this.labelStyle.alignToGridLine,k=(m-g)/(p||1);this.categoryMode&&!T&&(g+=Math.ceil(k/2)-2);const M=[];let Z=null,S=null;a.beginPath(),a.strokeStyle=this.gridLineColor;let x,I,L;const V=d<=2?Math.max(1,p-1):Math.round(p/d),R=V===p?p:p-1;for(L=0;L<=R;L+=V){M[L]=Ne(h).valueOf()+L*f,Z=Math.round(g+k*L),S=Z+w;let ee;for(let q=0;q<M.length;q++)M[q]!==void 0&&q!==L&&(ee=M[q]);x=this.getLabelFormat(Math.min(u,M[L]),{prev:ee});const j=((G=(E=this.options)==null?void 0:E.selectLabel)==null?void 0:G.use)&&((X=(v=this.options)==null?void 0:v.selectLabel)==null?void 0:X.useLabelOpacity)&&this.options.horizontal===(this.type==="y")&&((W=l==null?void 0:l.dataIndex)==null?void 0:W.length)&&!(l!=null&&l.label.map(q=>this.getLabelFormat(Math.min(u,q),{prev:ee})).includes(x)),te=this.labelStyle.color;let J=1;if(A.getColorStringType(te)==="RGBA"&&(J=A.getOpacity(te)),a.fillStyle=A.colorStringToRgba(te,j?(N=this.options)==null?void 0:N.unSelectedOpacity:J),this.type==="x"){if(I=this.position==="top"?y-10:y+10,a.fillText(this.checkFixWidth(x),Z,I),!j&&((D=(P=this.options)==null?void 0:P.selectItem)!=null&&D.showLabelTip)&&(s!=null&&s.label)&&!((O=this.options)!=null&&O.horizontal)){const q=this.getLabelFormat(Math.min(u,s.label+0*f));if(q===x){const $=Math.round(a.measureText((Y=this.labelStyle)==null?void 0:Y.fontSize).width);A.showLabelTip({ctx:this.ctx,width:Math.round(a.measureText(q).width)+10,height:$,x:Z,y:I+($-2),borderRadius:2,arrowSize:3,text:x,backgroundColor:(z=(B=(H=this.options)==null?void 0:H.selectItem)==null?void 0:B.labelTipStyle)==null?void 0:z.backgroundColor,textColor:(U=(Q=(F=this.options)==null?void 0:F.selectItem)==null?void 0:Q.labelTipStyle)==null?void 0:U.textColor})}}this.showAxisTick&&(a.beginPath(),a.strokeStyle=this.axisLineColor,a.moveTo(S,y),a.lineTo(S,y+b),a.stroke(),a.closePath()),L<p&&this.showGrid&&(a.beginPath(),a.strokeStyle=this.gridLineColor,a.moveTo(S,y),a.lineTo(S,C),a.stroke(),a.closePath())}else I=this.position==="left"?y-10:y+10,a.fillText(this.checkFixWidth(x),I,Z),this.showAxisTick&&(a.beginPath(),a.strokeStyle=this.axisLineColor,a.moveTo(y+(this.axisLineWidth??1),S),a.lineTo(y-b,S),a.stroke(),a.closePath()),L<p&&this.showGrid&&(a.beginPath(),a.strokeStyle=this.gridLineColor,a.moveTo(y,S),a.lineTo(C,S),a.stroke(),a.closePath());a.stroke()}if(this.categoryMode&&T&&L*V===p){const ee=Ne(r[1]).diff(Ne(r[0])),j=this.getLabelFormat(Ne(M[p-1]+ee));Z=Math.round(g+k*p),S=Z+w,this.type==="x"?(a.fillText(this.checkFixWidth(j),Z,I),this.showGrid&&(a.moveTo(S,y),a.lineTo(S,C))):(a.fillText(this.checkFixWidth(j),I,Z),this.showGrid&&(a.moveTo(y,S),a.lineTo(C,S))),a.stroke()}a.closePath()}}const cC={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`}},dC={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 i;const e=(i=this.options.legend)==null?void 0:i.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,A.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,i=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/i),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,i=Math.max(t-this.visibleRowCount*this.legendItemHeight-n,0);this.legendTopSpacer.style.height=`${n}px`,this.legendBottomSpacer.style.height=`${i}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(i=>{i==null||i.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:i}=t,{min:s,max:l,interval:a,existError:r,decimalPoint:c}=i,d=n.length,h=r?d-2:d-1;for(let u=0;u<d;u++){const{id:f,color:p,label:g=""}=n[u],m=s+a*u;let y=m+a;u<h?y-=.1**c:y=l+.1**c;let C=g;if(!C)if(C=`${m.toFixed(c)} - ${y.toFixed(c)}`,s===void 0||l===void 0)if(u===0)C="0";else break;else{if(m>l)break;a<=1&&c===0&&(C=m)}this.addLegend({cId:f,color:p,name:C,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 u of d)u.style.color=a;h.show=!1,l.dataset.inactive=!0},n=(l,a)=>{var f,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),u=l==null?void 0:l.series;if(typeof u.color!="string"?r=u.color[u.color.length-1][1]:r=u.color,u.type==="line"&&u.fill?(c.style.height="8px",c.style.backgroundColor=A.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 m=(p=(f=this.options.legend.table)==null?void 0:f.columns[g.dataset.type])==null?void 0:p.style;g.style.color=m!=null&&m.color?m.color:a}u.show=!0,l.dataset.inactive=!1},i=()=>{(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 y;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],u=(c==null?void 0:c.dataset.inactive)==="false";if(!d||!h)return;if(a.clickMode==="active"){const C=Array.from(this.legendBoxDOM.getElementsByClassName(e.container));C.every(T=>T.dataset.inactive==="false")?(C.forEach(T=>{t(T,a.inactive)}),i(),n(c,a.color),this.seriesInfo.count=1):u?(t(c,a.inactive),this.seriesInfo.count--):u||(n(c,a.color),this.seriesInfo.count++),C.every(T=>T.dataset.inactive==="true")&&(C.forEach(T=>{n(T,a.color)}),s(),this.seriesInfo.count=C.length)}if(a.clickMode!=="active"){if(u&&this.seriesInfo.count===1)return;u?(t(c,a.inactive),this.seriesInfo.count--):(n(c,a.color),this.seriesInfo.count++)}if(this.brushSeries){const C=[...this.brushSeries.list];C[r]=this.seriesList,this.brushSeries.list=C,this.brushSeries.chartIdx=r}((y=this.options.eventBehavior)==null?void 0:y.legendClick)!=="emitOnly"&&this.update({updateSeries:!1,updateSelTip:{update:!0,keepDomain:!0}});const p=Object.values(this.seriesList).filter(C=>C.show).map(C=>C.sId),g=p.length===Object.values(this.seriesList).length,m={e:l,data:{seriesIds:g?[]:p,isActiveAll:g}};typeof this.listeners["click-legend"]=="function"&&this.listeners["click-legend"](m)},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 f;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=(f=l==null?void 0:l.series)==null?void 0:f.cId;r.style.backgroundColor=a,r.style.borderColor=a,c.style.color=a;const u=d.colorState.findIndex(p=>p.id===h);u>-1&&(d.colorState[u].show=!1),l.dataset.inactive=!0},n=(l,a)=>{var f,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=(f=l==null?void 0:l.series)==null?void 0:f.cId;r.style.backgroundColor=(p=l==null?void 0:l.series)==null?void 0:p.color,c.style.color=a;const u=d.colorState.findIndex(g=>g.id===h);u>-1&&(d.colorState[u].show=!0),l.dataset.inactive=!1},i=()=>{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=>{var C;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],u=(c==null?void 0:c.dataset.inactive)==="false",f=r.colorState.filter(b=>b.show).length;if(!d||!h)return;if(a.clickMode==="active"){const b=Array.from(this.legendBoxDOM.getElementsByClassName(e.container));b.every(k=>k.dataset.inactive==="false")?(b.forEach(k=>{t(k,a.inactive)}),i(),n(c,a.color)):u?t(c,a.inactive):u||n(c,a.color),b.every(k=>k.dataset.inactive==="true")&&(b.forEach(k=>{n(k,a.color)}),s())}if(a.clickMode!=="active"){if(u&&f===1)return;u?t(c,a.inactive):n(c,a.color)}((C=this.options.eventBehavior)==null?void 0:C.legendClick)!=="emitOnly"&&this.update({updateSeries:!1,updateSelTip:{update:!0,keepDomain:!0}});const p=r.colorState.filter(b=>b.show),g=p.map(b=>+b.id.split("#")[1]),m=r.colorState.length===p.length,y={e:l,data:{seriesIndices:m?[]:g,isActiveAll:m}};typeof this.listeners["click-legend"]=="function"&&this.listeners["click-legend"](y)},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,u;const a=(h=Object.values(this.seriesList))==null?void 0:h[0],r=this.getContainerDOM(l);if(!r){this.onLegendBoxLeave();return}const c=(u=r==null?void 0:r.series)==null?void 0:u.cId,d={sId:c,type:this.options.type};this.legendHover=d,a.colorState.forEach(f=>{f.state=f.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,i=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=`${i}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 i,s,l,a,r;const e=(l=(s=(i=this.options)==null?void 0:i.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 u=h.dataset.type;if(u!=="name"){const f=c.series.sId,p=(r=t==null?void 0:t[f])==null?void 0:r[u];h.textContent=this.getFormattedValue(e[u],p)}}}},forceUpdateLegend(){this.destroyLegend(),this.initLegend()},resetLegend(){var t,n;const e=this.legendBoxDOM;if(e){if(this.useTable){const i=this.legendTableDOM;for(;i.hasChildNodes();)i.removeChild(i.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"),i=document.createElement("span"),s=document.createElement("div");n.className="ev-chart-legend-container",n.dataset.inactive=!e.show,n.series=e,i.className="ev-chart-legend-color",e.type==="line"&&e.point&&!e.fill&&(i.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?(i.style.height="8px",i.style.backgroundColor=e.show?A.rgbaAdjustHalfOpacity(l):t.inactive,i.style.border=`1px solid ${l}`):i.style.backgroundColor=l,i.dataset.type="color",s.style.color=t.color,s.textContent=e.name,s.setAttribute("title",e.name),s.dataset.type="name",n.appendChild(i),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,u,f,p,g;const t=this.options.legend,n=(h=t==null?void 0:t.table)==null?void 0:h.columns,i=(u=this.getAggregations())==null?void 0:u[e==null?void 0:e.sId];if(!i||!n)return;const s=document.createElement("tr");s.className="ev-chart-legend--table__row",s.dataset.inactive=!e.show,A.setDOMStyle(s,(p=(f=t.table)==null?void 0:f.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=A.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?A.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",A.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(m=>{var y;if(m!=="name"&&n[m].use){const C=this.getFormattedValue(n[m],i[m]),b=document.createElement("td");b.className="ev-chart-legend--table__value",b.style.color=e.show?t.color:t.inactive,b.textContent=C,b.dataset.type=m.toString(),A.setDOMStyle(b,(y=n[m])==null?void 0:y.style),e.show||(b.style.color=t.inactive),s.appendChild(b)}}),this.legendTableDOM.appendChild(s),e.show&&this.seriesInfo.count++},setLegendPosition(){var g,m,y,C,b,w,T,k,M;const e=this.options,t=(g=e==null?void 0:e.legend)==null?void 0:g.position,n=(m=this.wrapperDOM)==null?void 0:m.style,i=(y=this.legendDOM)==null?void 0:y.style,s=(C=this.legendBoxDOM)==null?void 0:C.style,l=(b=this.resizeDOM)==null?void 0:b.style;let a,r;const c=(w=e==null?void 0:e.title)!=null&&w.show?(T=e==null?void 0:e.title)==null?void 0:T.height:0,d=c+((k=e==null?void 0:e.legend)==null?void 0:k.height),{top:h=0,bottom:u=0,left:f=0,right:p=0}=((M=e==null?void 0:e.legend)==null?void 0:M.padding)??{};if(!(!n||!i))switch(s.padding=`${h}px ${p}px ${u}px ${f}px`,t){case"top":n.padding=`${d}px 0 0 0`,a=this.chartDOM.getBoundingClientRect(),r=parseInt(i.paddingTop)+parseInt(i.paddingBottom),s.width="100%",s.height=`${e.legend.height-r}px`,i.top=`${c}px`,i.right="",i.bottom="",i.left="",i.width=`${a.width}px`,i.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`,i.paddingLeft="10px",i.top=`${c}px`,i.right="0px",i.bottom="",i.left="",i.width=`${e.legend.width}px`,i.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(i.paddingTop)+parseInt(i.paddingBottom),s.width="100%",s.height=`${e.legend.height-r}px`,i.top="",i.right="",i.bottom="0px",i.left="0px",i.width=`${a.width}px`,i.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",i.top=`${c}px`,i.right="",i.bottom="",i.left="0px",i.width=`${e.legend.width}px`,i.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 i=0;i<t.length;i++)e.position==="top"||e.position==="bottom"?(t[i].style.width=`${e.width-8}px`,t[i].style.margin="0 4px"):t[i].style.width="100%"},onMouseMove(e){e.stopPropagation(),e.preventDefault();const t=this.wrapperDOM.getBoundingClientRect(),n=this.wrapperDOM.offsetWidth,i=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>i-r&&(h=i-r),this.ghostDOM.style.top=`${h}px`;break;case"bottom":h=e.clientY-t.top,h<r+s?h=r+s:h>i-d&&(h=i-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,i=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":i.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":i.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":i.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":i.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}i.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,i=(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;!i||!t||(n&&(n.display="none"),i.display="none",i.width="0",i.height="0",t.padding=`${s}px 0 0 0`)},getFormattedValue({formatter:e,decimalPoint:t},n){if(n==null)return"Null";let i;return e&&(i=e(+n)),(!e||typeof i!="string")&&(i=A.labelSignFormat(+n,t)),i}},Ar=28,hC={width:70,height:60},uC={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 i=Object.values(this.seriesList);if(!i.length)return;const{colorState:s}=i[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 i=this.getSelectedValue(e);i=this.isSide?100-i:i;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&&i>c||!n&&i<r)return;a[0][s]=i,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:i,valueOpt:s}=n[0],l=i[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:i,height:s}=this.containerDOM.getBoundingClientRect(),l=!this.isSide,a=l?t:n,r=l?i:s;let c=l?e.clientX:e.clientY;c<a?c=a:c>a+r&&(c=a+r);const d=c-a;return+Je(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 i=e.getElementsByClassName("ev-chart-legend-thumb")[0].children;if(i&&i.length)for(const s of i)s.style.opacity=1}},createLegendOverlay(e,t){this.clearOverlay();const n=this.legendHandleSize,{min:i,max:s}=t;if(i===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(i+(s-i)*(e/100));const c=document.createElement("span");c.className="ev-chart-legend-overlay-item",c.dataset.type="overlay-item";let d,h;const u=Math.floor(n/2)+14;this.isSide?(h=`top:${100-e}%;left:${u}px;transform:translateY(-50%);`,d=`top:${100-e}%;transform:translateY(-50%);`):(h=`top:-${u}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 f=l==null?void 0:l.getElementsByClassName("ev-chart-legend-thumb")[0];if(f){const p=f.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 i=document.createElement("div");return i.className=`ev-chart-legend-handle ${e}`,i.dataset.type="handle",i.appendChild(n),i},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>Ar?Ar:t;const n=this.legendHandleSize,i=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(i),this.containerDOM.appendChild(s)},setLegendStyle(e){const t=this.isSide?"top":"right",n=this.legendHandleSize,{valueOpt:i,colorState:s}=e,{min:l,max:a,decimalPoint:r}=i,{start:c,end:d}=s[0],h=e.getColorForGradient(c),u=e.getColorForGradient(d);let f=`linear-gradient(to ${t}, `;f+=`${h}, ${u})`;const p=Math.floor(n/2)+14;let g=`width:${n}px;height:${n}px;`,m,y,C,b=`background:${f};`;this.isSide?(g+=`margin-top:-${n/2}px;`,m=`left:${p}px;transform:translateY(-50%);top:`,y=`top:${100-d}%;`,C=`top:${100-c}%;`,b+=`top:${100-d}%;height:${d-c}%;`):(g+=`margin-left:-${n/2}px;`,m=`top:-${p}px;transform:translateX(-50%);left:`,y=`left:${c}%;`,C=`left:${d}%;`,b+=`left:${c}%;width:${d-c}%;`);const w=(l+(a-l)*(c/100)).toFixed(r),T=(l+(a-l)*(d/100)).toFixed(r),k=this.containerDOM.getElementsByClassName("ev-chart-legend-thumb")[0];k.style.cssText=b;const M=k.getElementsByClassName("ev-chart-legend-label");M[0].style.cssText=`${m}0%;`,M[1].style.cssText=`${m}100%;`,l!==void 0&&a!==void 0&&(M[0].innerText=this.isSide?T:w,M[1].innerText=this.isSide?w:T);const Z=this.containerDOM.getElementsByClassName("ev-chart-legend-handle");Z[0].style.cssText=g+y,Z[1].style.cssText=g+C;const S=this.containerDOM.getElementsByClassName("ev-chart-legend-handle-btn-color");S[0].style.backgroundColor=this.isSide?u:h,S[1].style.backgroundColor=this.isSide?h:u},setLegendPosition(){var y,C,b,w;const e=this.options,t=(y=e==null?void 0:e.legend)==null?void 0:y.position,{width:n,height:i}=hC,s=this.legendHandleSize,l=(C=e==null?void 0:e.title)!=null&&C.show?(b=e==null?void 0:e.title)==null?void 0:b.height:0,a=l+i,{top:r=0,bottom:c=0,left:d=0,right:h=0}=((w=e==null?void 0:e.legend)==null?void 0:w.padding)??{},u=this.wrapperDOM.style;if(!u)return;let f,p,g,m;switch(t){case"top":u.padding=`${a}px 0 0 0`,m=this.chartDOM.getBoundingClientRect(),p=`padding:${s+7}px ${h}px ${c}px ${d}px;`,p+="width:100%",p+=`height${i}px;`,f=`width:${m.width}px;`,f+=`height:${i}px;`,f+=`top:${l}px;`;break;case"right":u.padding=`${l}px ${n}px 0 0`,m=this.chartDOM.getBoundingClientRect(),p=`padding:${r}px ${h}px ${c}px ${d}px;`,p+=`width:${n}px;`,p+="height:100%;",p+=`max-height:${m.height}px;`,f=`width:${n}px;`,f+=`height:${m.height}px;`,f+=`top:${l}px;right:0px;`;break;case"bottom":u.padding=`${l}px 0 ${i}px 0`,m=this.chartDOM.getBoundingClientRect(),p=`padding:${s+7}px ${h}px ${c}px ${d}px;`,p+="width:100%;",p+=`height:${i}px;`,f=`width:${m.width}px;`,f+=`height:${i}px;`,f+="bottom:0px;left:0px;";break;case"left":u.padding=`${l}px 0 0 ${n}px`,m=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:${m.height}px;`,f=`width:${n}px;`,f+=`height:${m.height}px;`,f+=`top:${l}px;left:0px`;break}if(["top","bottom"].includes(t)){const T=m.width/2;g=`left:${m.width/2-T/2}px;`,g+=`width:${T}px;`,g+=`height:${s}px;`,g+="padding:4px 0;",g+="margin:0 4px;"}else{const T=m.height/2;g=`top:${m.height/2-T/2}px;`,g+="left:5px;",g+=`width:${s}px;`,g+=`height:${T}px;`,g+="padding:0 4px;",g+="margin:4px 0;"}this.containerDOM.style.cssText=g,this.legendBoxDOM.style.cssText=p,this.legendDOM.style.cssText=f},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,i=(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=`${i}px 0 0 0`)}},fC={initScrollbar(){var e,t,n,i,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=(i=this.options.axesY)==null?void 0:i[0])==null?void 0:s.scrollbar)!=null&&l.use&&this.initScrollbarInfo(this.options.axesY,"y")},initScrollbarInfo(e,t){var s,l,a,r,c,d;const n=this.scrollbar[t],i=He({},(s=e==null?void 0:e[0])==null?void 0:s.scrollbar,Br.scrollbar);Object.keys(i).forEach(h=>{n[h]=i[h]}),n.resetPosition&&(n.range=(a=(l=e==null?void 0:e[0])==null?void 0:l.range)!=null&&a.length?[...e[0].range]:null,this.updateScrollbarAnchorEdge(t)),n.isInit||(n.type=(r=e==null?void 0:e[0])==null?void 0:r.type,n.range=(d=(c=e==null?void 0:e[0])==null?void 0:c.range)!=null&&d.length?[...e[0].range]:null,this.initScrollbarRange(t),this.updateScrollbarAnchorEdge(t),this.createScrollbarLayout(t),this.createScrollbar(t),this.createScrollEvent(t),n.isInit=!0)},initScrollbarRange(e){var i;const t=this.scrollbar[e],n=this.options.type==="heatMap"?this.data.labels[e]:this.data.labels;if((i=t.range)!=null&&i.length&&n.length){const[s,l]=t.range;if(Re(s)&&Re(l)){const a=this.getScrollbarLimits(e);if(!a)return;const{limitMin:r,limitMax:c}=a,d=l-s,h=c-r;if(d>=h)t.range[0]=r,t.range[1]=c;else{let u=+s<r?r:+s,f=u+d;f>c&&(f=c,u=f-d,u<r&&(u=r)),t.range[0]=u,t.range[1]=f}}}},updateScrollbarInfo(e,t){var r,c,d,h,u,f,p,g,m,y,C,b,w,T,k;const{axesX:n,axesY:i}=this.options,s=e==="x"?n:i;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)||no((u=s==null?void 0:s[0])==null?void 0:u.range)){this.destroyScrollbar(e);return}const l=e==="x"?this.axesX:this.axesY,a=!_e((f=s==null?void 0:s[0])==null?void 0:f.range,(p=l==null?void 0:l[0])==null?void 0:p.range);if(a||t){const M=e==="x"?(y=(m=(g=this.options.axesX)==null?void 0:g[0])==null?void 0:m.scrollbar)==null?void 0:y.resetPosition:(w=(b=(C=this.options.axesY)==null?void 0:C[0])==null?void 0:b.scrollbar)==null?void 0:w.resetPosition;if(a){const Z=(T=s==null?void 0:s[0])==null?void 0:T.range,S=this.scrollbar[e].range;if(!M&&(Z!=null&&Z.length)&&(S!=null&&S.length)){const x=Z[1]-Z[0],I=this.scrollbar[e].anchorEdge,L=I?this.getScrollbarLimits(e):null;I==="start"&&L?this.scrollbar[e].range=[L.limitMin,L.limitMin+x]:I==="end"&&L?this.scrollbar[e].range=[L.limitMax-x,L.limitMax]:this.scrollbar[e].range=[S[0],S[0]+x]}else this.scrollbar[e].range=Z!=null&&Z.length?[...Z]:null}this.initScrollbarRange(e),a&&this.updateScrollbarAnchorEdge(e)}this.scrollbar[e].use=!!((k=s==null?void 0:s[0].scrollbar)!=null&&k.use)},updateScrollbarPosition(e){var t,n,i,s;(t=this.scrollbar.x)!=null&&t.use&&((n=this.scrollbar.x)!=null&&n.isInit)&&this.setScrollbarPosition("x",e),(i=this.scrollbar.y)!=null&&i.use&&((s=this.scrollbar.y)!=null&&s.isInit)&&this.setScrollbarPosition("y",e)},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 i=document.createElement("div");i.className="ev-chart-scrollbar-button ev-chart-scrollbar-button-down",i.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",i.appendChild(s),e.appendChild(t),e.appendChild(i)},setScrollbarPosition(e,t){var Z,S;const n=this.scrollbar[e];if(!n.use||!n.range)return;const i=n.dom,s=this.chartRect,l=t??this.labelOffset,a={x1:s.x1+l.left,x2:s.x2-l.right,y1:s.y1+l.top,y2:s.y2-l.bottom},r=(Z=this.options.title)!=null&&Z.show?(S=this.options.title)==null?void 0:S.height:0,c=e==="x",d=c?n.height:n.width,h=c?a.x2-a.x1:a.y2-a.y1,u=n.showButton?d:0,f=h-u*2,p=this.getScrollbarThumbSize(e,f),g=Math.max(0,f-p.size);p.position=Math.min(Math.max(p.position,0),g);let m="display: block;",y,C,b,w,T=`width:${u}px;height:${u}px;`;c?(m=`top: ${s.y2+r+l.top}px;`,m+=`left: ${a.x1}px;`,m+=`width: ${h}px;`,m+=` height: ${d}px;`,y="top: 0;",y+=`left: ${u}px;`,y+=`width: ${f}px;`,y+="height: 100%;",C=`width: ${p.size}px;`,C+="height: 100%;",C+=`left: ${p.position+u}px`,T+="transform:rotate(90deg);top: 0;",b=`${T}right:0;`,w=`${T}left:0;`):(m=`top: ${a.y1+r}px;`,m+=`left: ${a.x2+10}px;`,m+=`width: ${d}px;`,m+=`height: ${h}px;`,y=`top: ${u}px;`,y+="left: 0;",y+="width: 100%;",y+=`height: ${f}px;`,C="width: 100%;",C+=`height: ${p.size}px;`,C+=`bottom: ${p.position+u}px`,T+="left:0;",b=`${T}top: 0;`,w=`${T}bottom: 0;`),i.style.cssText=m;const k=i.getElementsByClassName("ev-chart-scrollbar-track");k[0].style.cssText=y,k[0].style.backgroundColor=n.background;const M=i.getElementsByClassName("ev-chart-scrollbar-thumb");if(M[0].style.cssText=C,M[0].style.backgroundColor=n.thumbStyle.background,M[0].style.borderRadius=`${n.thumbStyle.radius}px`,n.showButton){const x=i.getElementsByClassName("ev-chart-scrollbar-button-up"),I=Math.floor(f-p.size),L=Math.floor(p.position)>I?.5:1;x[0].style.cssText=`background-color: ${n.background};${b}`,x[0].style.opacity=L,x[0].children[0].style.display="block";const V=i.getElementsByClassName("ev-chart-scrollbar-button-down");V[0].style.cssText=`background-color: ${n.background};${w}`,V[0].style.opacity=Math.floor(p.position)<0?.5:1,V[0].children[0].style.display="block"}},getScrollbarThumbSize(e,t){var u,f,p,g;const n=this.scrollbar[e],[i,s]=n.range,l=n.type;let a,r,c=1,d=0,h=0;if(l==="step"){const m=this.options.type==="heatMap"?this.data.labels[e]:this.data.labels,y=s-i+1;r=m.length;const C=t/r;a=C*y,h=C*i}else{const m=e==="x"?this.axesX:this.axesY,y=(u=this.minMax[e])==null?void 0:u[0],C=+y.max-+y.min,b=+s-+i;l==="time"&&(c=(g=m==null?void 0:m[0])==null?void 0:g.getInterval({minValue:y.min,maxValue:y.max,maxSteps:(p=(f=this.labelRange[e])==null?void 0:f[0])==null?void 0:p.max})),r=Math.ceil(C/c)+1,d=+y.min;const w=t/r,T=b/c+1,k=+i-d;a=w*T,h=w*(k/c)}return n.startValue=d,n.steps=r,n.interval=c,{size:a,position:h}},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:i,range:s,interval:l,steps:a}=n,r=i+l*a,c=e==="x"?this.axesX[0]:this.axesY[0],[d,h]=s??[];(!Re(d)||!Re(h))&&(n.range=(c==null?void 0:c.range)||null);let u,f,p=!1;t?(u=d+l,f=h+l,p=f>=r):(u=d-l,f=h-l,p=u<i),p||(n.range=[u,f],this.updateScrollbarAnchorEdge(e),this.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1},lightUpdate:u>1,updateByScrollbar:!0}))},getScrollbarLimits(e){var l,a;const t=this.scrollbar[e];if((t==null?void 0:t.type)==="step"){const r=this.options.type==="heatMap"?this.data.labels[e]:this.data.labels;return r!=null&&r.length?{limitMin:0,limitMax:r.length-1}:null}const n=(a=(l=this.minMax)==null?void 0:l[e])==null?void 0:a[0];if((n==null?void 0:n.min)==null||(n==null?void 0:n.max)==null)return null;const i=+n.min,s=+n.max;return!Number.isFinite(i)||!Number.isFinite(s)?null:{limitMin:i,limitMax:s}},updateScrollbarAnchorEdge(e){const t=this.scrollbar[e];if(!t)return;const n=t.range,i=this.getScrollbarLimits(e);if(!Array.isArray(n)||n.length!==2||!i){t.anchorEdge=null;return}n[0]<=i.limitMin?t.anchorEdge="start":n[1]>=i.limitMax?t.anchorEdge="end":t.anchorEdge=null},createScrollEvent(){var t,n,i;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:u,y:f}=h[0].getBoundingClientRect(),p=c==="x",g=p?s.clientX:-s.clientY,m=p?u:-f;d=g>m}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(),u=this.scrollbar[a];u.scrolling=!0,a==="x"?u.pointInThumb=s.clientX-c:u.pointInThumb=d+h-s.clientY;const f=u.dom;f.addEventListener("mousemove",this.onScrollbarMove),f.addEventListener("mouseup",this.onScrollbarUp)};const e=s=>{this.scrolling(s)};if(this.onScrollbarMove=ns(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,u,f,p,g,m,y,C;const l=((u=(h=this.tooltipDOM)==null?void 0:h.style)==null?void 0:u.display)==="block",a=this.tooltipBodyDOM||((f=this.tooltipDOM)==null?void 0:f.querySelector(this.options.tooltip.htmlScrollTarget));if(l&&a){const{scrollTop:b,scrollHeight:w,clientHeight:T}=a,k=b<=0,M=Math.ceil(b)+T>=w,Z=s.deltaY<0,S=s.deltaY>0;if(!(k&&Z||M&&S))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&&((m=this.scrollbar.y)!=null&&m.use)&&this.updateScrollbarRange("y",s.deltaY<0);return}if((y=this.scrollbar.x)!=null&&y.use&&c>r){this.updateScrollbarRange("x",s.deltaX>0);return}(C=this.scrollbar.y)!=null&&C.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)&&((i=this.overlayCanvas)==null||i.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:i,range:s,pointInThumb:l,startValue:a,interval:r}=this.scrollbar[n],c=t.getElementsByClassName("ev-chart-scrollbar-track"),{x:d,y:h,width:u,height:f}=c[0].getBoundingClientRect(),p=n==="x",g=p?d:h,m=p?u:f,y=m/i,C=a+(i-1)*r;let b=p?e.clientX:e.clientY;b<g?b=g:b>g+m&&(b=g+m);let w;if(p?w=b-g-l:w=g+m-b-l,w<=0)return;let T,k;const M=Math.round(Math.abs(w)/y)*r,[Z,S]=s;if(w>0){const x=a+(M-+Z);T=+Z+x,k=T+(+S-+Z)}T<a||k>C||(this.scrollbar[n].range=[T,k],this.updateScrollbarAnchorEdge(n),this.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1},lightUpdate:T>1,updateByScrollbar:!0}))},stopScrolling(e){const n=this.getScrollbarContainerDOM(e.target).dataset.type,i=this.scrollbar[n];if(i.scrolling){i.scrolling=!1;const s=i.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,i,s;const t=this.scrollbar[e].dom;t&&(t.remove(),this.scrollbar[e]={isInit:!1},!((n=this.scrollbar.x)!=null&&n.use)&&!((i=this.scrollbar.y)!=null&&i.use)&&((s=this.overlayCanvas)==null||s.removeEventListener("wheel",this.onScrollbarWheel,{passive:!1})))}};function mC(e){const t=typeof e;return e!=null&&(t==="object"||t==="function")}function Kr(e,t,n){let i,s,l,a,r,c,d=0,h=!1,u=!1,f=!0;const p=!t&&t!==0&&typeof root.requestAnimationFrame=="function";if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0,mC(n)&&(h=!!n.leading,u="maxWait"in n,l=u?Math.max(+n.maxWait||0,t):l,f="trailing"in n?!!n.trailing:f);function g(I){const L=i,V=s;return i=s=void 0,d=I,a=e.apply(V,L),a}function m(I,L){return p?(window.cancelAnimationFrame(r),window.requestAnimationFrame(I)):setTimeout(I,L)}function y(I){if(p)return window.cancelAnimationFrame(I);clearTimeout(I)}function C(I){return d=I,r=m(T,t),h?g(I):a}function b(I){const L=I-c,V=I-d,R=t-L;return u?Math.min(R,l-V):R}function w(I){const L=I-c,V=I-d;return c===void 0||L>=t||L<0||u&&V>=l}function T(){const I=Date.now();if(w(I))return k(I);r=m(T,b(I))}function k(I){return r=void 0,f&&i?g(I):(i=s=void 0,a)}function M(){r!==void 0&&y(r),d=0,i=c=s=r=void 0}function Z(){return r===void 0?a:k(Date.now())}function S(){return r!==void 0}function x(...I){const L=Date.now(),V=w(L);if(i=I,s=this,c=L,V){if(r===void 0)return C(c);if(u)return r=m(T,t),g(c)}return r===void 0&&(r=m(T,t)),a}return x.cancel=M,x.flush=Z,x.pending=S,x}const pC="Expected a function";function gC(e,t,n){let i=!0,s=!0;if(typeof e!="function")throw new TypeError(pC);return Kr(e,t,{leading:i,maxWait:t,trailing:s})}const bC={createEventFunctions(){var n,i,s,l;this.onMouseMove=a=>{var b,w;if((b=this.dragInfo)!=null&&b.isMove||this.isMobile)return;const r={e:a},{indicator:c,tooltip:d,type:h}=this.options,u=this.getMousePosition(a),f=this.findHitItem(u);d!=null&&d.showAllValueInRange&&(f!=null&&f.items)&&this.addNotHitInfo(f);const p=this.overlayCtx,g=Object.keys(f.items),m=g.length>0;let y="";if(m){y=`h=${f.hitId}`;const T=g.slice().sort();for(let k=0;k<T.length;k++){const M=T[k];y+=`|${M}:${f.items[M].index}`}}const C=y!==""&&y===this._lastHoverSig&&this.tooltipDOM&&this.tooltipDOM.style.display!=="none";if(this.overlayClear(),m){if(d.use&&this.isInitTooltip)if(this.drawItemsHighlight(f,p),typeof(d==null?void 0:d.returnValue)=="function"){const k=[];for(let M=0;M<g.length;M++){const Z=g[M],S=f.items[Z];k.push({sId:Z,data:S.data,color:S.color,name:S.name,dataId:S.id,index:S.index})}this.hideTooltipDOM(),d.returnValue(k,a)}else(w=d==null?void 0:d.formatter)!=null&&w.html?(C||this.drawCustomTooltip(f==null?void 0:f.items),this.setCustomTooltipLayoutPosition(f,a)):(this.setTooltipLayoutPosition(f,a),h==="scatter"?this.drawTooltipForScatter(f,this.tooltipCtx):h==="heatMap"?this.drawToolTipForHeatMap(f,this.tooltipCtx):this.drawTooltip(f,this.tooltipCtx));const T=Object.values(this.seriesList||{}).some(k=>k.type==="line");if(d.use&&(h==="line"||T)){const k=this.drawIndicatorForTooltip(f,c.color),M=k==null?void 0:k.labelValue,Z=this.getTimeLabel(u);r.hoveredLabel={horizontal:this.options.horizontal,label:Z,mousePosition:[a.clientX,a.clientY],dataLabel:M}}}else d.use&&this.isInitTooltip&&(typeof(d==null?void 0:d.returnValue)=="function"&&d.returnValue([],a),this.hideTooltipDOM());if(this._lastHoverSig=y,this.dragInfoBackup&&this.drawSelectionArea(this.dragInfoBackup),!r.hoveredLabel&&!this.isNotUseIndicator()){const T=Object.values(this.seriesList||{}).some(M=>M.type==="line");(h!=="line"&&!T||!d.use||!Object.keys(f.items).length)&&this.drawIndicator(u,c.color);const k=this.getTimeLabel(u);r.hoveredLabel={horizontal:this.options.horizontal,label:k,mousePosition:[a.clientX,a.clientY]}}else r.hoveredLabel||(r.hoveredLabel={label:""});typeof this.listeners["mouse-move"]=="function"&&(h!=="pie"&&(r.curMouseTargetVal=this.getCurMouseTargetVal(u,f)),this.listeners["mouse-move"](r))},this.onMouseLeave=a=>{const{tooltip:r,dragSelection:c}=this.options;r.throttledMove&&this.onMouseMove.cancel(),(!c.use||!c.keepDisplay)&&this.overlayClear(),r.use&&this.isInitTooltip&&(typeof(r==null?void 0:r.returnValue)=="function"&&r.returnValue([],a),this.tooltipClear()),this._lastHoverSig="",this.invalidateClientRectCache(),this.listeners["mouse-leave"]()},this.onDblClick=a=>{const r={e:a},c=this.getMousePosition(a),{type:d,selectItem:h,selectLabel:u,selectSeries:f}=this.options,p=(h==null?void 0:h.use)&&(h==null?void 0:h.useClick),g=(u==null?void 0:u.use)&&(u==null?void 0:u.useClick),m=(f==null?void 0:f.use)&&(f==null?void 0:f.useClick);p?r.eventTarget="item":g?r.eventTarget="label":m&&(r.eventTarget="series");const y=()=>{var M,Z;const w=this.findHitItem(c,!0),T=w.hitId??Object.keys(w.items)[0],k=w.items[T];k&&(r.label=k.label,r.value=(M=k.data)==null?void 0:M.o,r.seriesId=T,r.dataIndex=k.index,r.acc=(Z=k.data)==null?void 0:Z.acc)},C=w=>{var x,I;const T=this.findHitItem(c,!0),k=T.hitId??Object.keys(T.items)[0],M=T.items[k],{labelIndex:Z}=this.getLabelInfoByPosition(c,w),{dataIndex:S}=this.regulateSelectedLabelInfo(Z,w);this.defaultSelectInfo=this.getSelectedLabelInfoWithLabelData(S,w),M&&(r.label=M.label,r.seriesId=k,r.value=(x=M.data)==null?void 0:x.o,r.acc=(I=M.data)==null?void 0:I.acc,r.dataIndex=M.index)},b=()=>{var M,Z,S;const w=this.findHitItem(c,!0),T=w.hitId??Object.keys(w.items)[0],k=w.items[T];if(T!==null){const x=this.updateSelectedSeriesInfo(T,!0);k&&(r.label=k.label,r.value=(M=k.data)==null?void 0:M.o,r.seriesId=(Z=x.seriesId)==null?void 0:Z.at(0),r.acc=(S=k.data)==null?void 0:S.acc,r.dataIndex=k.index)}};switch(d){case"bar":{g?C(this.options.horizontal?"yAxis":"xAxis"):y();break}case"line":{p?y():g?C():m&&b();break}default:{y();break}}typeof this.listeners["dbl-click"]=="function"&&this.listeners["dbl-click"](r)},this.onClick=a=>{var w;if(this.isMouseMove){this.isMouseMove=!1;return}const r={e:a},c=this.getMousePosition(a),{type:d,selectItem:h,selectLabel:u,selectSeries:f}=this.options,p=(h==null?void 0:h.use)&&(h==null?void 0:h.useClick),g=(u==null?void 0:u.use)&&(u==null?void 0:u.useClick),m=(f==null?void 0:f.use)&&(f==null?void 0:f.useClick),y=()=>{const T=this.getHitItemByPosition(c,!1,void 0,!1,!0);({label:r.label,value:r.value,sId:r.seriesId,dataIndex:r.dataIndex,acc:r.acc}=T),T!=null&&T.sId&&(r.selected={eventTarget:"item",seriesId:this.isDeselectItem(T)?null:T.sId,dataIndex:this.isDeselectItem(T)?null:T.dataIndex})},C=T=>{var Z,S,x,I;const{labelIndex:k}=this.getLabelInfoByPosition(c,T),{dataIndex:M}=this.regulateSelectedLabelInfo(k,T);this.defaultSelectInfo=this.getSelectedLabelInfoWithLabelData(M,T),T&&(this.defaultSelectInfo.targetAxis=M!=null&&M.length?T:null),r.selected={eventTarget:"label",...Ze(this.defaultSelectInfo)},r.label=(S=(Z=this.defaultSelectInfo)==null?void 0:Z.label)==null?void 0:S.at(0),r.dataIndex=(I=(x=this.defaultSelectInfo)==null?void 0:x.dataIndex)==null?void 0:I.at(0)},b=()=>{const T=this.findHitItem(c,!0),k=T.hitId??Object.keys(T.items)[0],M=T.items[k];if(!Yt(k)){const Z=this.updateSelectedSeriesInfo(k,!1);this.defaultSelectInfo.seriesId=Z.seriesId,r.selected={eventTarget:"series",...Ze(this.defaultSelectInfo)},r.label=M.label,r.dataIndex=M.index}};switch(d){default:case"bar":{p?y():g&&C(this.options.horizontal?"yAxis":"xAxis");break}case"line":{p?y():g?C():m&&b();break}case"heatMap":{const T=!!this.options.horizontal;if(p&&g){const{useBothAxis:k}=u,M=this.getCurMouseLocation(c);if(M==="chartBackground")this.clearSelectedLabelInfo(),r.deselected={eventTarget:"label"},y();else if(M==="yAxis"||M==="xAxis"){if(this.clearSelectedItemInfo(),r.deselected={eventTarget:"item"},!k&&M!==(T?"yAxis":"xAxis"))return;C(M)}}else if(p)y();else if(g){const{useBothAxis:k}=u,M=this.getCurMouseLocation(c);if((M==="yAxis"||M==="xAxis")&&!k&&M!==(T?"yAxis":"xAxis"))return;M!=="canvas"&&C(k?M:null)}break}case"pie":{p&&y();break}case"scatter":{if(p&&y(),(w=this.options.dragSelection)!=null&&w.use&&this.isMobile){let T=this.setTouchInfo(a);this.overlayClear(),this.options.dragSelection.keepDisplay&&(a.layerX<T.range.x1||a.layerY<T.range.y1||a.layerX>T.range.x2||a.layerY>T.range.y2)?this.isTouchOverlay=!1:(T=this.setTouchBoxDimensions(T),this.isTouchOverlay=!0,this.drawSelectionArea(T)),this.options.dragSelection.keepDisplay||setTimeout(()=>{this.isTouchOverlay=!1,this.overlayClear()},100),r.e=a,r.touchInfo=T,r.data=this.findSelectedItems(T),r.range=this.getSelectionRange(T),typeof this.listeners["drag-select"]=="function"&&this.listeners["drag-select"](r)}break}}typeof this.listeners.click=="function"&&(this.dragInfoBackup||this.listeners.click(r))},this.onMouseDown=a=>{const{dragSelection:r,type:c}=this.options;r.use&&(c==="scatter"||c==="line"||c==="heatMap")&&(this.removeSelectionArea(),this.dragStart(a,c))},this.onWheel=a=>{var y,C,b,w;if(!(((C=(y=this.tooltipDOM)==null?void 0:y.style)==null?void 0:C.display)==="block"))return;const c=((b=this.vsState)==null?void 0:b.scrollEl)||(this.options.tooltip.htmlScrollTarget?(w=this.tooltipDOM)==null?void 0:w.querySelector(this.options.tooltip.htmlScrollTarget):null)||this.tooltipBodyDOM;if(!c||c.scrollHeight<=c.clientHeight){this.hideTooltipDOM();return}const{scrollTop:d,scrollHeight:h,clientHeight:u}=c,f=d<=0,p=Math.ceil(d)+u>=h,g=a.deltaY<0,m=a.deltaY>0;a.preventDefault(),!(f&&g)&&!(p&&m)&&(c.scrollTop+=a.deltaY)};const e=(n=this.options)==null?void 0:n.tooltip,t=!!((i=e==null?void 0:e.formatter)!=null&&i.html)&&!!(e!=null&&e.virtualScroll)&&e.virtualScroll.use!==!1;(e!=null&&e.useScrollbar||t)&&this.overlayCanvas.addEventListener("wheel",this.onWheel,{passive:!1}),(l=(s=this.options)==null?void 0:s.tooltip)!=null&&l.throttledMove&&(this.onMouseMove=gC(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=a=>this.dragTouchSelectionDestroy(a),window.addEventListener("click",this.dragTouchSelectionEvent),this.invalidateRectOnScroll=()=>this.invalidateClientRectCache(),window.addEventListener("scroll",this.invalidateRectOnScroll,{capture:!0,passive:!0})},dragStart(e,t){let[n,i]=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),i<a.y1&&(i=a.y1),i>a.y2&&(i=a.y2),this.dragInfo={xcp:n,ycp:i,range:a};const r=d=>{d.preventDefault();const[h,u]=this.getMousePosition(d),f=this.dragInfo,{xcp:p,ycp:g,range:m}=f;let y,C;if(f.isMove=!0,this.isMouseMove=!0,h<m.x1?y=m.x1:h>m.x2?y=m.x2:y=h,u<m.y1?C=a.y1:u>m.y2?C=m.y2:C=u,t==="heatMap"){const b={xcp:p,xep:y,ycp:g,yep:C,range:m},{xsp:w,ysp:T,width:k,height:M}=this.getDragInfoForHeatMap(b);f.xsp=w,f.ysp=T,f.width=k,f.height=M}else f.xsp=Math.min(p,y),f.ysp=t==="scatter"?Math.min(g,C):m.y1,f.width=Math.ceil(Math.abs(y-p)),f.height=t==="scatter"?Math.ceil(Math.abs(C-g)):m.y2-m.y1;this.overlayClear(),this.drawSelectionArea(f)},c=d=>{var u,f;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=He({},h),typeof this.listeners["drag-select"]=="function"&&!((f=(u=this.options)==null?void 0:u.zoom)!=null&&f.use))this.listeners["drag-select"](p);else{const{xsp:g,range:m,width:y}=h,C=g-m.x1;p.range.dragSelectionInfo={dragXsp:C,dragXep:C+y,exceptAxesYChartWidth:m.x2-m.x1,exceptAxesXChartHeight:m.y2-m.y1,chartRange:m,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:i,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,_e(h,s))l.fillRect(e,t,n,i);else{const u=s.x2-s.x1,f=s.y2-s.y1,p=h.x2-h.x1,g=h.y2-h.y1,m=(e-s.x1)/u,y=(t-s.y1)/f,C=h.x1+p*m,b=h.y1+g*y,w=n/u,T=i/f,k=p*w,M=g*T;l.fillRect(C,b,k,M)}l.globalAlpha=1},removeSelectionArea(){this.dragInfoBackup=null,this.overlayClear()},getMousePosition(e){const t=e.originalEvent||e,n=this.getOverlayClientRect();return[t.clientX-n.left,t.clientY-n.top,n.width,n.height]},getCurMouseTargetVal(e,t){const n=this.getCurMouseLocation(e),i={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]&&(i.dataIdx=l[a].index,i.maxDataVal=r,i.originVal=t)}}else if(n==="xAxis"||n==="yAxis"){const{axesX:s,axesY:l}=this.options,a=(c,d,h)=>{i.labelIdx=d,i.labelVal=c[0].type==="time"?Ne(h).format(c[0].timeFormat):h,i.originVal=c[0].type==="time"?Ne(h):h};(c=>{const{labelIndex:d}=this.getLabelInfoByPosition(e,n),{labelVal:h,labelIdx:u}=this.getCurMouseLabelVal(c,e,d);a(c==="xAxis"?s:l,u,h)})(n)}return i},setTouchInfo(e){let[t,n]=this.getMousePosition(e);const i=this.chartRect,s=this.labelOffset,l={x1:i.x1+s.left,x2:i.x2-s.right,y1:i.y1+s.top,y2:i.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:i,ycp:s,range:l}=e;let a=i-n,r=s-n,c=t,d=t;return this.boxOverflow={x1:!1,x2:!1,y1:!1,y2:!1},i<l.x1+n&&(a=l.x1,c=n-(l.x1-i),this.boxOverflow.x1=!0),i>l.x2-n&&(c=n-(i-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,t=!1){var k,M,Z,S;(k=this.ensureHitCoordsFresh)==null||k.call(this);const n=Object.keys(this.seriesList),i={},s=!!this.options.horizontal,l=this.tooltipCtx,[a,r]=e;let c=null,d="",h=0,u="",f=null,p=null,g=1/0,m=!1,y=null,C=1/0;const b=this.findClosestDataIndex(e,n,t);if(b===-1&&!this.isNotUseIndicator())return{items:i,hitId:c,maxTip:[d,u],maxHighlight:null};const w=n.every(x=>this.seriesList[x].type==="bar");for(let x=0;x<n.length;x++){const I=n[x],L=this.seriesList[I];if(L.findGraphData&&L.show){const V=L.findGraphData(e,s,b,!w);if(V!=null&&V.data){let R;if(V.data.o===null&&L.interpolation!=="zero"?L.isExistGrp||(R=s?V.data.x:V.data.y):isNaN(V.data.o)||(R=V.data.o),R!=null){const E=this.getFormattedTooltipLabel({dataId:L.id,seriesId:I,seriesName:L.name,itemData:V.data}),G=l?l.measureText(E).width:1;V.id=L.id,V.name=E,V.axis={x:L.xAxisIndex,y:L.yAxisIndex},V.label=s?(M=V.data)==null?void 0:M.y:(Z=V.data)==null?void 0:Z.x,i[I]=V;const v=this.getFormattedTooltipValue({dataId:L.id,seriesId:I,seriesName:E,value:R,itemData:V.data});if(V.data.formatted=v,h<G&&(d=E,h=G),u.length<=`${v}`.length&&(u=`${v}`),(f===null||f<=R)&&(f=R,p=I),V.hit&&V.data.xp!==void 0&&V.data.yp!==void 0){const X=(V.data.xp-e[0])**2+(V.data.yp-e[1])**2;V.directHit?((!m||X<g)&&(g=X,c=I),m=!0):!m&&X<g&&(g=X,c=I)}if(c===null&&V.data.xp!==void 0&&V.data.yp!==void 0&&V.data.xp!==null&&V.data.yp!==null){const X=A.calcBoxDistance(V.data,a,r);X<C&&(C=X,y=I)}}}}}c===null&&(c=y!==null?y:Object.keys(i)[0]);const T=f!==null?[p,f]:null;if(t&&Object.keys(i).length===0&&b!==-1){const x=n.find(L=>{var R;const V=this.seriesList[L];return(V==null?void 0:V.show)&&((R=V==null?void 0:V.data)==null?void 0:R.length)>0}),I=x?(S=this.seriesList[x].data)==null?void 0:S[b]:null;I&&(i[""]={id:"",name:"",label:s?I.y:I.x,index:b,axis:{x:0,y:0},data:{o:void 0,x:I.x,y:I.y}},c="")}return{items:i,hitId:c,maxTip:[d,u],maxHighlight:T}},buildLabelValidMask(e){var s,l;const t=e??Object.keys(this.seriesList);let n=0;for(let a=0;a<t.length;a++){const r=this.seriesList[t[a]];r!=null&&r.show&&((s=r.data)==null?void 0:s.length)>n&&(n=r.data.length)}const i=new Uint8Array(n);for(let a=0;a<t.length;a++){const r=this.seriesList[t[a]];if(r!=null&&r.show&&r.data){const{data:c}=r;for(let d=0;d<c.length;d++){const h=(l=c[d])==null?void 0:l.o;h!=null&&(i[d]=1)}}}return this.labelValidMask=i,i},findClosestDataIndex(e,t,n=!1){var m;const[i,s]=e,l=!!this.options.horizontal,a=l?s:i,r=t.find(y=>{var b;const C=this.seriesList[y];return(C==null?void 0:C.show)&&((b=C==null?void 0:C.data)==null?void 0:b.length)>0});if(!r||!((m=this.seriesList[r])!=null&&m.data))return-1;const c=this.seriesList[r].data;let d=50;if(c.length>1){const y=[];for(let C=1;C<c.length;C++){const b=c[C-1],w=c[C];if(b&&w){let T,k;l?(T=b.h?b.yp+b.h/2:b.yp,k=w.h?w.yp+w.h/2:w.yp):(T=b.w?b.xp+b.w/2:b.xp,k=w.w?w.xp+w.w/2:w.xp),T!==null&&k!==null&&y.push(Math.abs(k-T))}}y.length>0&&(d=y.reduce((C,b)=>C+b,0)/y.length)}let h=1/0,u=-1,f=this.labelValidMask;!n&&(!f||f.length<c.length)&&(f=this.buildLabelValidMask(t));for(let y=0;y<c.length;y++)if(n||f[y]===1){const b=c[y];if(b){let w;if(l?w=b.h?b.yp+b.h/2:b.yp:w=b.w?b.xp+b.w/2:b.xp,w!==null){const T=Math.abs(a-w);T<h&&(h=T,u=y)}}}if(u===-1)return-1;const g=Math.max(d,6);return h>=g?t.some(C=>{const b=this.seriesList[C];if(b!=null&&b.show){const w=b.passingValue,T=b.interpolation,k=b.hasPassingValueInData;return T==="linear"||T==="none"&&!!w&&k}return!1})?u:-1:u},getFormattedTooltipLabel({dataId:e,seriesId:t,seriesName:n,itemData:i}){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:i})),r},getFormattedTooltipValue({dataId:e,seriesId:t,seriesName:n,value:i,itemData:s}){var u;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:(u=r==null?void 0:r.formatter)==null?void 0:u.value,d=s!==null&&typeof s=="object"&&c;if(d){this._tooltipValueCache||(this._tooltipValueCache=new WeakMap);const f=this._tooltipValueCache.get(s);if(f!==void 0){const p=f[t];if(p!==void 0)return p}}let h=i;if(c&&(l.type==="pie"?h=c({value:i,name:n,percentage:s==null?void 0:s.percentage,seriesId:t,dataId:e}):l.type==="heatMap"?h=c({x:s==null?void 0:s.x,y:s==null?void 0:s.y,value:i>-1?i:"error",seriesId:t,dataId:e}):h=c({x:a?i:s==null?void 0:s.x,y:a?s==null?void 0:s.y:i,o:s==null?void 0:s.o,name:n,seriesId:t,dataId:e})),i&&(!c||typeof h!="string")&&(l.type==="heatMap"?h=i<0?"error":Qt(i):h=Qt(i)),d){let f=this._tooltipValueCache.get(s);f||(f=Object.create(null),this._tooltipValueCache.set(s,f)),f[t]=h}return h},addNotHitInfo(e){var c,d,h,u,f,p;const t=this.tooltipCtx,n=!!this.options.horizontal,i=Object.keys(e.items)[0],s=n?(h=(d=(c=e.items)==null?void 0:c[i])==null?void 0:d.data)==null?void 0:h.y:(p=(f=(u=e.items)==null?void 0:u[i])==null?void 0:f.data)==null?void 0:p.x;let l="",a="";const r=Object.keys(this.seriesList);for(let g=0;g<r.length;g++){const m=r[g],y=this.seriesList[m];if(y!=null&&y.show){const C=y.data.find(S=>n?(S==null?void 0:S.y)===s:(S==null?void 0:S.x)===s),b=this.getFormattedTooltipLabel({dataId:y.id,seriesId:m,seriesName:y.name,itemData:C}),w=this.getFormattedTooltipValue({dataId:y.id,seriesId:m,seriesName:b,value:C==null?void 0:C.o,itemData:C});if(C&&C.o!==null&&C.o!==void 0&&!e.items[m]){const S={};S.color=y.color,S.hit=!1,S.name=b,S.axis={x:y.xAxisIndex,y:y.yAxisIndex},S.index=n?y.yAxisIndex:y.xAxisIndex,S.data=C,S.data.formatted=w,e.items[m]=S}const T=t?t.measureText(l).width:1,k=t?t.measureText(b).width:1;T<k&&(l=b);const M=t?t.measureText(a).width:1,Z=t?t.measureText(`${w}`).width:1;M<Z&&(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){const t=e??[],n=this._renderedSelectSeriesIds;n&&n.length===t.length&&n.every((i,s)=>i===t[s])||(this.defaultSelectInfo.seriesId=e,this._renderedSelectSeriesIds=[...t],this.render())},getSelectedLabelInfoWithLabelData(e,t){const{selectLabel:n,type:i,horizontal:s}=this.options,l=Ze(this.defaultSelectInfo);switch(l.dataIndex=e,i){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:u})=>l.label.includes(c==="y"?u:h));break}}return l},regulateSelectedLabelInfo(e,t){var l,a;const n=((l=this.options)==null?void 0:l.selectLabel)??{},i=t===null||((a=this.defaultSelectInfo)==null?void 0:a.targetAxis)===t?{...this.defaultSelectInfo,targetAxis:t}:{dataIndex:[],targetAxis:t},s=Ze(i);if(i.dataIndex.includes(e)){const r=i.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)??{},i=this.defaultSelectInfo??{seriesId:[]};typeof i.seriesId=="string"&&(i.seriesId=[i.seriesId]);const s=Ze(i);if(i.seriesId.includes(e)){if(!t){const a=i.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:i}=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=i?a.data.y:a.data.x;let c;if(i){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),i?(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){var i;(i=this.ensureHitCoordsFresh)==null||i.call(this);const t=[],n=Object.keys(this.seriesList);for(let s=0;s<n.length;s++){const l=n[s],a=this.seriesList[l],r=a.findItems;if(r){const c=r.call(a,e);c&&c.length&&t.push({seriesName:a.name,seriesId:l,items:c})}}return t},getSelectionRange({xsp:e,ysp:t,width:n,height:i,range:s}){var w,T,k,M;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+i,d=l.graphMax-l.graphMin,h=a.graphMax-a.graphMin,u=this.getRatioInRange(s.x1,s.x2,e),f=this.getRatioInRange(s.x1,s.x2,r),p=this.getRatioInRange(s.y1,s.y2,c),g=this.getRatioInRange(s.y1,s.y2,t),m=this.isMobile&&((w=this.boxOverflow)!=null&&w.x1)?Math.min(this.minMax.x[0].min,l.graphMin):Math.max(l.graphMin+d*u,l.graphMin),y=this.isMobile&&((T=this.boxOverflow)!=null&&T.x2)?Math.max(this.minMax.x[0].max,l.graphMax):Math.min(l.graphMin+d*f,l.graphMax),C=this.isMobile&&((k=this.boxOverflow)!=null&&k.y2)?Math.min(this.minMax.y[0].min,a.graphMin):Math.max(a.graphMin+h*(1-p),a.graphMin),b=this.isMobile&&((M=this.boxOverflow)!=null&&M.y1)?Math.max(this.minMax.y[0].max,a.graphMax):Math.min(a.graphMin+h*(1-g),a.graphMax);return{xMin:+m.toFixed(3),xMax:+y.toFixed(3),yMin:+C.toFixed(3),yMax:+b.toFixed(3)}},getRatioInRange(e,t,n){const i=t-e;return(n-e)/i},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 i=Object.keys(this.seriesList)[0],{xMin:s,xMax:l,yMin:a,yMax:r}=this.seriesList[i].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.dataIndex)===((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.dataIndex)},getCurMouseLocation(e){const[t,n]=e,i={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=i[this.axesX[0].units.rectStart],l=i[this.axesX[0].units.rectEnd],a=i[this.axesY[0].units.rectStart],r=i[this.axesY[0].units.rectEnd];return St(t,this.chartRect.x1,i.x1)&&St(n,a,r)?"yAxis":St(t,s,l)&&St(n,i.y2,this.chartRect.y2)?"xAxis":St(t,i.x1,i.x2)&&St(n,i.y1,i.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}},Uo=8,fs=50,gi=17,yC=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=Kr(()=>{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,i=(t==null?void 0:t.fontFamily)??"Roboto";return`normal normal lighter ${Math.max(n,0)}px ${i}`},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:i=16}=((l=(s=this.options)==null?void 0:s.tooltip)==null?void 0:l.rowPadding)??{};return{t:e,l:i,b:n,r:t}},setTooltipLayoutPosition(e,t){var Y,H,B,z,F,Q,U;const n=this.tooltipCtx,i=t.pageX,s=t.pageY,l=e.items,[a,r]=e.maxTip,d=Object.keys(l).length,h=this.getBoxPadding(),u=this.options.tooltip,f=this.getColorMargin(),p=e.hitId,g=l[p].data,m=l[p].axis,y=(Y=u.formatter)==null?void 0:Y.title;this.axesX.length&&this.axesY.length&&u.showHeader&&(y?this.tooltipHeaderDOM.textContent=y({x:g.x,y:g.y}):this.tooltipHeaderDOM.textContent=this.options.horizontal?this.axesY[m.y].getLabelFormat(g.y):this.axesX[m.x].getLabelFormat(g.x)),u.textOverflow&&this.tooltipHeaderDOM.classList.add(`ev-chart-tooltip-header--${u.textOverflow}`),this.tooltipHeaderDOM.style.visibility="hidden",n.save(),n.font=this.getFontStyle("contents");const b=!!this.options.horizontal?(B=(H=l[e.hitId])==null?void 0:H.data)==null?void 0:B.y:(F=(z=l[e.hitId])==null?void 0:z.data)==null?void 0:F.x,w=(b==null?void 0:b.length)>a.length?b:a,T=Math.round(n.measureText(w).width),k=Math.round(n.measureText(r).width),M=T+k+h.l+h.r+f+fs+gi,Z=M>u.maxWidth?u.maxWidth:M;let S=u.textOverflow==="wrap"?0:d;if(u.textOverflow==="wrap"){const ee=u.maxWidth-(Math.round(n.measureText(r).width)+h.l+h.r+f+fs+gi);Object.values(l).map(te=>te.name).forEach(te=>{if(n.measureText(te).width>ee){let J="";for(let q=0;q<te.length;q++){const $=te[q],ae=`${J}${$}`;n.measureText(ae).width>ee?(J=$,S+=1):J=ae}}S+=1}),n.restore()}const x=h.t+S*this.getTextHeight()+d*Uo+h.b;let I;u.useScrollbar&&x>u.maxHeight?(this.tooltipBodyDOM.style.overflowY="auto",I=u.maxHeight):(this.tooltipBodyDOM.style.overflowY="hidden",I=x),this.tooltipCanvas.width=Z*this.pixelRatio,this.tooltipCanvas.height=x*this.pixelRatio,this.tooltipCanvas.style.width=`${Z}px`,this.tooltipCanvas.style.height=`${x}px`,this.tooltipHeaderDOM.style.width=`${Z}px`,this.tooltipHeaderDOM.style.height="auto",this.tooltipDOM.style.height="auto",this.tooltipBodyDOM.style.height=`${I+6}px`,this.tooltipDOM.style.display="block";const L=document.body.clientWidth,V=document.body.clientHeight,R=20,E=((Q=this.tooltipDOM)==null?void 0:Q.offsetHeight)||((U=this.tooltipHeaderDOM)==null?void 0:U.offsetHeight)+I+yC,G=L-Z-R,v=V-E-R,X=i+R,W=s+R,N=i-Z-R,P=s-E-R,D=X>G?N:X,O=W>v?P:W;this.tooltipDOM.style.transform=`translate3d(${D}px, ${O}px, 0)`},drawSeriesColorShape(e,t,n){var a,r;const i=(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=i/2;e.arc(s,l-c/2,c,0,2*Math.PI),e.fill()}else{const c=i;e.fillRect(s-c/3,l-c/1.2,c,c)}},drawTooltip(e,t){const n=t,i=e.items,[,s]=e.maxTip,l=this.alignSeriesList(Object.keys(i)),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 u=2,f=2;u+=A.aliasPixel(u),f+=A.aliasPixel(f),n.save(),n.scale(this.pixelRatio,this.pixelRatio),this.tooltipBodyDOM.style.overflowY==="auto"&&(a.r+=gi),u+=a.l,f+=a.t,n.font=this.getFontStyle("contents");const p=[];l.forEach(y=>{p.push({id:y,data:i[y].data,color:i[y].color,name:i[y].name,dataId:i[y].id})}),c.sortByValue&&p.sort((y,C)=>{let b=y.data.o,w=C.data.o;return b==null&&(b=r?y.data.x:y.data.y),w==null&&(w=r?C.data.x:C.data.y),w-b}),this.setTooltipDOMStyle(c);const g=this.tooltipDOM.offsetWidth;let m=1;for(let y=0;y<p.length;y++){const C=p[y].data,b=p[y].color,w=p[y].name,T=C.formatted;let k=u+4,M=f+m*d;k+=A.aliasPixel(k),M+=A.aliasPixel(M),n.beginPath(),typeof b!="string"?n.fillStyle=ne.createGradient(n,r,{x:k-4,y:M,w:12,h:-12},b):n.fillStyle=b;const Z={id:p[y].id,name:p[y].name,value:T,dataId:p[y].dataId};this.drawSeriesColorShape(n,c.colorShape,{x:k,y:M}),n.fillStyle=typeof c.fontColor.label=="function"?c.fontColor.label(Z):c.fontColor.label??c.fontColor;const S=c.maxWidth-Math.round(n.measureText(s).width)-a.l-a.r-h-fs,x=k+h,I=M;if(S>n.measureText(w).width)n.fillText(w,x,I);else if(c.textOverflow==="wrap"){let L="",V=I;for(let R=0;R<w.length;R++){const E=w[R],G=`${L}${E}`;n.measureText(G).width>S?(n.fillText(L,x,V),L=E,m+=1,V+=d):L=G}n.fillText(L,x,V)}else{const L=A.truncateLabelWithEllipsis(w,S,n);n.fillText(L,x,I)}n.save(),n.fillStyle=typeof c.fontColor.value=="function"?c.fontColor.value(Z):c.fontColor.value??c.fontColor,n.textAlign="right",n.fillText(T,g-a.r,M),n.restore(),n.closePath(),f+=Uo,m+=1}n.restore()},drawToolTipForHeatMap(e,t){const n=t,i=e.items,s=e.hitId,l=i[s].data,a=i[s].axis,r=i[s].color,c=this.getBoxPadding(),d=this.options.horizontal,h=this.options.tooltip,u=Object.values(this.seriesList)[0],f=this.getTextHeight(),p=this.getColorMargin();let g=!1,m=l.formatted;const{colorState:y,isGradient:C}=u;if(C){const{min:M,max:Z}=u.valueOpt,S=Je(l.o-M,Z-M),{start:x,end:I}=y[0];g=x<=S&&S<=I||l.o===-1}else{const M=y.find(({id:Z})=>Z===l.cId);g=M==null?void 0:M.show,m=(M==null?void 0:M.label)??m}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);const b=this.tooltipDOM.offsetWidth;n.save(),n.scale(this.pixelRatio,this.pixelRatio),this.tooltipBodyDOM.style.overflowY==="auto"&&(c.r+=gi);const w=c.l+2,T=c.t+f+2;n.font=this.getFontStyle("contents"),n.beginPath(),typeof r!="string"?n.fillStyle=ne.createGradient(n,d,{x:w,y:T,w:12,h:-12},r):n.fillStyle=r;const k={id:e.hitId,name:l.y,value:m,dataId:i[s].id};this.drawSeriesColorShape(n,h.colorShape,{x:w,y:T}),n.fillStyle=typeof h.fontColor.label=="function"?h.fontColor.label(k):h.fontColor.label??h.fontColor,this.axesY.length&&n.fillText(this.axesY[a.y].getLabelFormat(l.y),w+p,T),n.textAlign="right",n.fillStyle=typeof h.fontColor.value=="function"?h.fontColor.value(k):h.fontColor.value??h.fontColor,n.fillText(m,b-c.r,T),n.closePath()},drawTooltipForScatter(e,t){const n=t,i=e.items,[,s]=e.maxTip,l=this.alignSeriesList(Object.keys(i)),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,u=2;h+=A.aliasPixel(h),u+=A.aliasPixel(u),n.save(),n.scale(this.pixelRatio,this.pixelRatio),this.tooltipBodyDOM.style.overflowY==="auto"&&(a.r+=gi),h+=a.l,u+=a.t,n.font=this.getFontStyle("contents");const f=[];l.forEach(m=>{f.push({data:i[m].data,color:i[m].color,name:i[m].name})}),r.sortByValue&&f.sort((m,y)=>{let C=m.data.o,b=y.data.o;return C==null&&(C=m.data.y),b==null&&(b=y.data.y),b-C}),this.setTooltipDOMStyle(r);const p=this.tooltipDOM.offsetWidth;let g=1;for(let m=0;m<f.length;m++){const y=f[m].data,C=f[m].color,b=f[m].name,w=y.formatted;let T=h+4,k=u+g*c;T+=A.aliasPixel(T),k+=A.aliasPixel(k),n.beginPath(),typeof C!="string"?n.fillStyle=ne.createGradient(n,!1,{x:T-4,y:k,w:12,h:-12},C):n.fillStyle=C;const M={id:e.hitId,name:f[m].name,value:w,dataId:f[m].dataId};this.drawSeriesColorShape(n,r.colorShape,{x:T,y:k}),n.fillStyle=typeof r.fontColor.label=="function"?r.fontColor.label(M):r.fontColor.label??r.fontColor;const Z=r.maxWidth-Math.round(n.measureText(s).width)-a.l-a.r-d-fs,S=T+d,x=k;if(Z>n.measureText(b).width)n.fillText(b,S,x);else if(r.textOverflow==="wrap"){let I="",L=x;for(let V=0;V<b.length;V++){const R=b[V],E=`${I}${R}`;n.measureText(E).width>Z?(n.fillText(I,S,L),I=R,g+=1,L+=c):I=E}n.fillText(I,S,L)}else{const I=A.truncateLabelWithEllipsis(b,Z,n);n.fillText(I,S,x)}n.save(),n.textAlign="right",n.fillStyle=typeof r.fontColor.value=="function"?r.fontColor.value(M):r.fontColor.value??r.fontColor,n.fillText(w,p-a.r,k),n.restore(),n.closePath(),u+=Uo,g+=1}n.restore()},setCustomTooltipLayoutPosition(e,t){var w;const n=t.pageX,i=t.pageY;if(!this.tooltipDOM)return;let s=this.tooltipDOM.firstElementChild;if(!s&&(e!=null&&e.items)&&Object.keys(e.items).length&&(this.drawCustomTooltip(e.items),s=this.tooltipDOM.firstElementChild),!s)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=(w=this.tooltipDOM)==null?void 0:w.getBoundingClientRect(),h=20,u=r-l-h,f=c-(d==null?void 0:d.height)-h,p=n+h,g=i+h,m=n-l-h,y=i-(d==null?void 0:d.height)-h,C=p>u?m:p,b=g>f?y:g;this.tooltipDOM.style.transform=`translate3d(${C}px, ${b}px, 0)`},drawCustomTooltip(e){var l,a,r,c,d;const t=(l=this.options)==null?void 0:l.tooltip;if(!((a=t==null?void 0:t.formatter)!=null&&a.html))return;const n=Object.keys(e).length;if((r=this._shouldVirtualizeCustomTooltip)!=null&&r.call(this,n)&&this.drawCustomTooltipVirtual(e))return;(c=this._teardownCustomTooltipVirtualScroll)==null||c.call(this),this.tooltipDOM.innerHTML="";const i=[];Object.keys(e).forEach(h=>{i.push({sId:h,data:e[h].data,color:e[h].color,name:e[h].name,dataId:e[h].id,index:e[h].index})});const s=A.htmlToElement(t.formatter.html(i));s&&this.tooltipDOM.appendChild(s),this.tooltipDOM.style.overflowY="hidden",this.tooltipDOM.style.backgroundColor=t.backgroundColor,this.tooltipDOM.style.border=`1px solid ${t.borderColor}`,this.tooltipDOM.style.color=((d=t.fontColor)==null?void 0:d.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 i=this.seriesList[n];i.itemHighlight(e.items[n],t,e.items[n].index,(s=this.options)==null?void 0:s.unSelectedOpacity),A.isDoughnutHole(i.type)&&this.drawDoughnutHole(t)})},drawIndicator(e,t){var d;const n=this.overlayCtx,[i,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;i>=l.x1-a&&i<=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(i+.5,l.y1),n.lineTo(i+.5,l.y2)),n.stroke(),n.restore(),n.closePath())},getTimeLabel(e){var u,f,p,g;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=+((u=this.data.labels)==null?void 0:u[0]),i=+((f=this.data.labels)==null?void 0:f[this.data.labels.length-1]);if(n==null||i==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?(p=t.axesY)==null?void 0:p.every(m=>m.categoryMode):(g=t.axesX)==null?void 0:g.every(m=>m.categoryMode)){const m=this.data.labels.length;if(!m)return null;let y;if(t.horizontal){const b=a.y2-a.y1;y=(l-a.y1)/b}else{const b=a.x2-a.x1;y=(s-a.x1)/b}const C=Math.min(Math.max(Math.floor(y*m),0),m-1);return+this.data.labels[C]}if(t.horizontal){const m=a.y2-a.y1,C=(l-a.y1)*(i-n)/m+n;return Math.round(C)}const c=a.x2-a.x1,h=(s-a.x1)*(i-n)/c+n;return Math.round(h)},drawSyncedIndicator({horizontal:e,label:t,mousePosition:n,dataLabel:i}){var g,m;if(!this._canDrawSyncedIndicator(e,n))return;if(i){this.drawSyncedIndicatorForTooltip({dataLabel:i,mousePosition:n});return}const s=+((g=this.data.labels)==null?void 0:g[0]),l=+((m=this.data.labels)==null?void 0:m[this.data.labels.length-1]),[a,r]=n,{top:c,bottom:d,left:h,right:u}=this.getChartDOMClientRect();if(St(a,h,u)&&St(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 C=(p.y2-p.y1)*(t-s)/(l-s)+p.y1;this.drawIndicator([p.x2,C],this.options.indicator.color)}else{const C=(p.x2-p.x1)*(t-s)/(l-s)+p.x1;this.drawIndicator([C,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,i;return this.options.syncHover===!1||!((i=(n=this.data)==null?void 0:n.labels)!=null&&i.length)?!1:e?this.options.axesY.every(({type:s})=>s==="time"):this.options.axesX.every(({type:s})=>s==="time")},_hasValidTimeRange(){var n,i;const e=+((n=this.data.labels)==null?void 0:n[0]),t=+((i=this.data.labels)==null?void 0:i[this.data.labels.length-1]);return e!=null&&t!=null},drawSyncedIndicatorForTooltip({dataLabel:e,mousePosition:t}){var u,f,p,g,m,y,C,b,w,T,k,M,Z;if(!((u=this.data)!=null&&u.labels)||!e)return;const n=this.data.labels.findIndex(S=>(S==null?void 0:S.valueOf())===(e==null?void 0:e.valueOf()));if(n===-1){this.overlayClear();return}const{horizontal:i}=this.options,s=this.getChartDOMClientRect(),[l,a]=t;if(St(l,s.left,s.right)&&St(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(i){const S=c.y2-c.y1,x=(f=this.options.axesY)==null?void 0:f.some(V=>V.categoryMode),I=(p=this.options.axesY)==null?void 0:p.some(V=>V.type==="time");let L;if(x)L=c.y1+S*(n+.5)/d;else if(I){const V=(m=(g=this.axesSteps)==null?void 0:g.y)==null?void 0:m[0],R=(V==null?void 0:V.graphMin)??+((y=this.data.labels)==null?void 0:y[0]),E=(V==null?void 0:V.graphMax)??+((C=this.data.labels)==null?void 0:C[this.data.labels.length-1]);L=c.y1+S*(+e-R)/(E-R)}else L=c.y1+S*n/(d-1);h=[c.x2,L]}else{const S=c.x2-c.x1,x=(b=this.options.axesX)==null?void 0:b.some(V=>V.categoryMode),I=(w=this.options.axesX)==null?void 0:w.some(V=>V.type==="time");let L;if(x)L=c.x1+S*(n+.5)/d;else if(I){const V=(k=(T=this.axesSteps)==null?void 0:T.x)==null?void 0:k[0],R=(V==null?void 0:V.graphMin)??+((M=this.data.labels)==null?void 0:M[0]),E=(V==null?void 0:V.graphMax)??+((Z=this.data.labels)==null?void 0:Z[this.data.labels.length-1]);L=c.x1+S*(+e-R)/(E-R)}else L=c.x1+S*n/(d-1);h=[L,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,i=[];return t.forEach(s=>{s.slice().reverse().forEach(l=>{const a=n[l];a&&a.showLegend&&e.includes(l)&&i.push(l)})}),Object.keys(n).forEach(s=>{const l=n[s];!l.isExistGrp&&l.showLegend&&e.includes(s)&&i.push(s)}),i},tooltipDestroy(){var e;(e=this._teardownCustomTooltipVirtualScroll)==null||e.call(this),this.tooltipDOM&&(this.tooltipDOM.remove(),this.tooltipDOM=null),this.isInitTooltip=!1}},SC=480,CC=28,kC=5,wC=50,IC={_shouldVirtualizeCustomTooltip(e){var i,s;if(this._vsDetectFailed)return!1;const t=(i=this.options)==null?void 0:i.tooltip;if(!((s=t==null?void 0:t.formatter)!=null&&s.html))return!1;const n=t.virtualScroll;return!n||n.use===!1?!1:n.use===!0?e>0:e>=(n.threshold??wC)},_findCustomTooltipContainer(e,t){if(!e||!e.querySelectorAll)return null;const n=e.querySelectorAll("[data-evui-tooltip-row]");if(n.length===t&&n.length>0){const s=n[0].parentElement;let l=!!s;for(let a=1;a<n.length;a++)if(n[a].parentElement!==s){l=!1;break}if(l)return s}const i=[e];for(;i.length;){const s=i.shift();if(s.children&&s.children.length===t)return s;if(s.children)for(let l=0;l<s.children.length;l++)i.push(s.children[l])}return null},_createVirtualScrollAnatomy(){const e=document.createElement("div");e.className="ev-chart-tooltip-virtual__spacer",e.setAttribute("aria-hidden","true");const t=document.createElement("div");t.className="ev-chart-tooltip-virtual__viewport";const n=document.createElement("div");return n.className="ev-chart-tooltip-virtual__spacer",n.setAttribute("aria-hidden","true"),{topSpacer:e,viewport:t,bottomSpacer:n}},_recomputeCustomTooltipPrefixSums(){const e=this.vsState,t=e.heights.length;e.prefixSums.length!==t+1&&(e.prefixSums=new Array(t+1));let n=0;e.prefixSums[0]=0;for(let i=0;i<t;i++)n+=e.heights[i],e.prefixSums[i+1]=n;e.totalHeight=n},_computeCustomTooltipVisibleRange(){const e=this.vsState,t=e.heights.length;if(!t)return{start:0,end:-1};const n=e.scrollEl.clientHeight||e.maxHeight,i=e.scrollEl.scrollTop;let s=0,l=t;for(;s<l;){const d=s+l>>>1;e.prefixSums[d+1]>i?l=d:s=d+1}const a=Math.max(0,s-e.overscan),r=i+n;for(s=a,l=t;s<l;){const d=s+l>>>1;e.prefixSums[d]>=r?l=d:s=d+1}const c=Math.min(t-1,s+e.overscan);return{start:a,end:c}},_syncCustomTooltipSpacers(){const e=this.vsState,t=e.prefixSums[e.range.start]||0,n=Math.max(0,e.totalHeight-(e.prefixSums[e.range.end+1]||e.totalHeight)),i=`${t}px`,s=`${n}px`;e.topSpacer.style.height!==i&&(e.topSpacer.style.height=i),e.bottomSpacer.style.height!==s&&(e.bottomSpacer.style.height=s)},_renderVisibleCustomTooltipRows(){const e=this.vsState;if(!e||!e.items.length)return;const t=this._computeCustomTooltipVisibleRange();if(e.range.start===t.start&&e.range.end===t.end)e.range=t;else{for(;e.viewport.firstChild;)e.viewport.removeChild(e.viewport.firstChild);const s=document.createDocumentFragment();for(let l=t.start;l<=t.end;l++){const a=e.items[l];a&&s.appendChild(a)}e.viewport.appendChild(s),e.range=t}this._syncCustomTooltipSpacers();let i=!1;for(let s=t.start;s<=t.end;s++)if(!e.measured[s]){i=!0;break}if(i){const s=e.measureDepth||0;if(s<2){e.measureDepth=s+1;try{this._measureVisibleCustomTooltipRows()}finally{e.measureDepth=s}}}},_measureVisibleCustomTooltipRows(){const e=this.vsState;if(!e||!e.viewport)return;const t=e.viewport.children,n=t.length;if(!n)return;const i=e.range.start,s=e.prefixSums[i]||0;let l=!1,a=0,r=0;for(let c=0;c<n;c++){const d=e.range.start+c,h=t[c].offsetHeight;h>0&&(h!==e.heights[d]&&(e.heights[d]=h,l=!0),e.measured[d]=!0),e.isRow[d]&&h>0&&(a+=h,r+=1)}if(r>0){const c=a/r;if(e.learnedAverageHeight=c,c>0&&Math.abs(c-e.estimatedRowHeight)>.5){e.estimatedRowHeight=c;for(let d=0;d<e.heights.length;d++)e.isRow[d]&&!e.measured[d]&&e.heights[d]!==c&&(e.heights[d]=c,l=!0)}}if(l){this._recomputeCustomTooltipPrefixSums();const d=(e.prefixSums[i]||0)-s;d!==0&&(e.suppressScroll=!0,e.scrollEl.scrollTop+=d,requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.vsState&&(this.vsState.suppressScroll=!1)})})),this._renderVisibleCustomTooltipRows()}else this._syncCustomTooltipSpacers()},drawCustomTooltipVirtual(e){var b,w,T;const t=(b=this.options)==null?void 0:b.tooltip;if(!((w=t==null?void 0:t.formatter)!=null&&w.html))return!1;const n=[];Object.keys(e).forEach(k=>{n.push({sId:k,data:e[k].data,color:e[k].color,name:e[k].name,dataId:e[k].id,index:e[k].index})});let i;try{i=t.formatter.html(n)}catch(k){return console.warn("[evui] tooltip.formatter.html threw, falling back:",k),!1}const s=A.htmlToElement(i);if(!s||!s.children)return!1;const l=this._findCustomTooltipContainer(s,n.length);if(!l)return this._vsDetectFailed=!0,this._vsWarnedFallback||(this._vsWarnedFallback=!0,console.warn("[evui] tooltip.virtualScroll: formatter.html 반환 구조에서 row를 식별하지 못해 가상 스크롤을 건너뜁니다. 시리즈당 wrapper element에 `data-evui-tooltip-row` 속성을 추가하거나, row 컨테이너 직속 자식이 시리즈 수와 일치하도록 마크업을 정리하세요.")),!1;const a=Array.from(l.children);if(!a.length)return!1;const r=k=>!!(k.hasAttribute&&k.hasAttribute("data-evui-tooltip-row")),c=a.some(r),d=a.map(k=>c?r(k):!0);for(let k=0;k<a.length;k++){const M=a[k];M.parentNode&&M.parentNode.removeChild(M)}for(;l.firstChild;)l.removeChild(l.firstChild);const{topSpacer:h,viewport:u,bottomSpacer:f}=this._createVirtualScrollAnatomy();l.appendChild(h),l.appendChild(u),l.appendChild(f);const p=t.maxHeight||SC;l.style.maxHeight=`${p}px`,l.style.overflowY="auto",l.style.overflowX="hidden",l.style.overflowAnchor="none",this._teardownCustomTooltipVirtualScroll();const g=t.virtualScroll||{},m=this._vsLearnedAverageHeight,y=m??g.estimatedRowHeight??CC;this.vsState={scrollEl:l,topSpacer:h,viewport:u,bottomSpacer:f,items:a,isRow:d,heights:new Array(a.length).fill(y),measured:new Array(a.length).fill(!1),prefixSums:[],totalHeight:0,range:{start:0,end:-1},estimatedRowHeight:y,overscan:g.overscan??kC,maxHeight:p,rafPending:!1,suppressScroll:!1,learnedAverageHeight:m,resizeObserver:null,onScroll:null},this._recomputeCustomTooltipPrefixSums();const C=()=>{this.vsState&&(this.vsState.suppressScroll||this.vsState.rafPending||(this.vsState.rafPending=!0,requestAnimationFrame(()=>{this.vsState&&(this.vsState.rafPending=!1,this._renderVisibleCustomTooltipRows())})))};if(l.addEventListener("scroll",C,{passive:!0}),this.vsState.onScroll=C,typeof ResizeObserver<"u"){let k=l.clientWidth;const M=new ResizeObserver(()=>{if(!this.vsState)return;const Z=l.clientWidth;Z!==k&&(k=Z,this.vsState.measured.fill(!1),this.vsState.heights.fill(this.vsState.estimatedRowHeight),this._recomputeCustomTooltipPrefixSums(),this._renderVisibleCustomTooltipRows())});M.observe(l),this.vsState.resizeObserver=M}for(;this.tooltipDOM.firstChild;)this.tooltipDOM.removeChild(this.tooltipDOM.firstChild);return this.tooltipDOM.appendChild(s),this.tooltipDOM.style.overflowY="hidden",this.tooltipDOM.style.backgroundColor=t.backgroundColor,this.tooltipDOM.style.border=`1px solid ${t.borderColor}`,this.tooltipDOM.style.color=((T=t.fontColor)==null?void 0:T.title)??t.fontColor,this._renderVisibleCustomTooltipRows(),!0},_teardownCustomTooltipVirtualScroll(){const e=this.vsState;e&&(e.scrollEl&&e.onScroll&&e.scrollEl.removeEventListener("scroll",e.onScroll),e.resizeObserver&&e.resizeObserver.disconnect(),e.learnedAverageHeight&&(this._vsLearnedAverageHeight=e.learnedAverageHeight),this.vsState=null)}},LC={pieDataSet:[],drawPie(e,t=this.bufferCtx){var T;const n=this.chartRect,i=this.pieDataSet,s=this.options,l=this.options.padding,a=!!s.doughnutHoleSize;let r,c,d,h=1.5*Math.PI,u,f,p;const g=n.width/2,m=n.height/2,y=g-(l.left+l.right),C=m-(l.bottom+l.top);if(typeof y=="number"&&y<0||typeof C=="number"&&C<0)return;const b=Math.min(y,C)*s.doughnutHoleSize,w=Math.min(y,C);for(let k=0;k<i.length;k++){const M=i[k];if(!M)return;let Z=w-(w-b)/i.length*k;if((T=s==null?void 0:s.pieStroke)!=null&&T.use&&(Z-=s.pieStroke.lineWidth),Z<0)return;if(M.or=Z,k<i.length-1?M.ir=w-(w-b)/i.length*(k+1):M.ir=1,M.total){for(let S=0;S<M.data.length;S++)if(r=M.data[S],c=r.value,p=c/M.total*100,d=2*Math.PI*(c/M.total),u=h+d,r.sa=h,r.ea=u,f=this.seriesList[r.id],c){const x={...s.pieStroke};M.data.length===1&&s.pieStroke.use&&(x.use=!1,t.lineWidth=s.pieStroke.lineWidth,t.strokeStyle=s.pieStroke.color,t.arc(g,m,Z,0,2*Math.PI),t.stroke());const{selectInfo:I,legendHitInfo:L,unSelectedOpacity:V}=e;f.isSelect=(I==null?void 0:I.sId)===r.id,f.isDownplay=L&&L.sId!==r.id,f.type=a?"doughnut":"pie",f.centerX=g,f.centerY=m,f.radius=Z,f.doughnutHoleSize=Z*(s.doughnutHoleSize??0),f.startAngle=h,f.endAngle=u,f.data={o:c,percentage:p},f.draw(t,x,V),h+=d}}}},drawSunburst(e,t=this.bufferCtx){var m;const{width:n,height:i}=this.chartRect,s=this.pieDataSet,l=this.options,a=this.options.padding;this.calculateAngle();let r,c;const d=n/2,h=i/2,u=d-(a.left+a.right),f=h-(a.bottom+a.top);if(typeof u=="number"&&u<0||typeof f=="number"&&f<0)return;const p=Math.min(u,f)*l.doughnutHoleSize,g=Math.min(u,f);for(let y=0;y<s.length;y++){const C=s[y];if(!C)return;let b=g-(g-p)/s.length*y;if((m=l==null?void 0:l.pieStroke)!=null&&m.use&&(b-=l.pieStroke.lineWidth),b<0)return;C.or=b,y<s.length-1?C.ir=g-(g-p)/s.length*(y+1):C.ir=1;for(let w=0;w<C.data.length;w++)if(r=C.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,b,r.sa,r.ea),t.stroke(),t.fill(),t.closePath(),t.restore();else if(c=this.seriesList[r.id],r.value){const T={...l.pieStroke};C.data.length===1&&l.pieStroke.use&&(T.use=!1,t.lineWidth=l.pieStroke.lineWidth,t.strokeStyle=l.pieStroke.color,t.arc(d,h,b,0,2*Math.PI),t.stroke());const{selectInfo:k,legendHitInfo:M,unSelectedOpacity:Z}=e;c.isSelect=(k==null?void 0:k.sId)===r.id,c.isDownplay=M&&M.sId!==r.id,c.type="sunburst",c.centerX=d,c.centerY=h,c.radius=b,c.doughnutHoleSize=b*(l.doughnutHoleSize??0),c.startAngle=r.sa,c.endAngle=r.ea,c.data={o:r.value},c.draw(t,T,Z)}}},drawDoughnutHole(e=this.bufferCtx){var h;const t=this.options,{width:n,height:i}=this.chartRect,s=this.options.padding,l=n/2,a=i/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}},TC={drawTips(e,t=this.bufferCtx){var u,f,p,g,m,y,C,b;const n=this.options;let i=null;const s=!!n.horizontal,l=n.maxTip,a=n.selectItem,r=n.selectLabel;let c,d;typeof((u=n.tooltip)==null?void 0:u.formatter)=="function"?i=(f=n.tooltip)==null?void 0:f.formatter:typeof((g=(p=n.tooltip)==null?void 0:p.formatter)==null?void 0:g.value)=="function"&&(i=(y=(m=n.tooltip)==null?void 0:m.formatter)==null?void 0:y.value),r.use&&r.showTip&&(d=n.type==="heatMap"?this.drawLabelTipForHeatMap(t):this.drawTipForSelectedLabel(t));const h=w=>{e.forEach(T=>{if(T){const k=this.seriesList[T==null?void 0:T.sId];if(!(k!=null&&k.show))return;const M=this.calculateTipInfo(k,"sel",T);if(M&&M.dp!==null){let Z=!1;if(l.use&&(c==null?void 0:c.dp)===M.dp&&(Z=!0),w.showTextTip||w.showTip){if(w.tipText==="label"){const S=s?n.axesY[0]:n.axesX[0],x=M.label;M.text=S.type==="time"?Ne(x).format(S.timeFormat):x}else M.text=Qt(M.value);this.drawTextTip({opt:w,tipType:"sel",seriesOpt:k,isSamePos:Z,ctx:t,...M})}w.showIndicator&&this.drawFixedIndicator({opt:w,seriesOpt:k,ctx:t,...M})}T&&(T!=null&&T.label)&&(T==null?void 0:T.label)===0&&(this.lastHitInfo=T)}})};if(e&&!d&&(a.use?h(a):r.use&&n.type==="line"&&h(r)),l.use&&!d){const w=s?this.axesSteps.y[0]:this.axesSteps.x[0],T=w==null?void 0:w.minIndex,k=w==null?void 0:w.maxIndex,M=(b=(C=s?this.axesY[0]:this.axesX[0])==null?void 0:C.labels)==null?void 0:b.length,Z=Number.isFinite(M)?M-1:k,S=Number.isFinite(T)&&Number.isFinite(k),x=S&&k<T,I=S&&(T>0||k<Z);let L,V=null;x?L=void 0:I?(V=this.getVisibleWindowMaxSeries(T,k),L=V==null?void 0:V.sId):L=this.minMax[s?"x":"y"][0].maxSID;const R=L?this.seriesList[L]:null;R&&(c=this.calculateTipInfo(R,"max",V),l.use&&c&&c.dp!==null&&(i?c.text=i({seriesId:R.sId,x:s?c.value:void 0,y:s?void 0:c.value}):c.text=Qt(c.value),this.drawTextTip({opt:l,tipType:"max",seriesOpt:R,ctx:t,...c}),l.showIndicator&&this.drawFixedIndicator({opt:l,seriesOpt:R,ctx:t,...c})))}},calculateTipInfo(e,t,n){if(!e)return!1;const i=!!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],u=this.axesSteps.y[e.yAxisIndex],f=r.x1,p=r.x2,g=r.y2,{type:m,size:y}=e,{maxDomain:C,maxDomainIndex:b}=e.minMax;if(C===null||b<0)return!1;const w=m==="bar"?n==null?void 0:n.index:n==null?void 0:n.domain,T=t==="max"&&n&&Number.isFinite(w)&&Number.isFinite(n.value);let k;T?k=w:k=m==="bar"?b:C,t==="sel"&&(n&&n.label!==null?(s.pos=m==="bar"?n.dataIndex:n.label,k=s.pos):s.pos!==null&&(k=s.pos));let M;T?M=n.value:M=i?e.minMax.maxX:e.minMax.maxY;let Z;if(t==="sel"){if(n&&n.label!==null)Z=n.label,n.value!==null?(M=n.useStack?n.acc:n.value,s.value=M):s.value!==null&&(M=s.value),s.label=Z;else if(s.value!==null)M=s.value,Z=s.label;else if(s.pos!==null){const E=m==="bar"?"getItemByLabelIndex":"getItemByLabel";if(typeof this[E]=="function"){const G=this[E](s.pos);M=G.useStack?G.acc:G.value,Z=G.label,s.value=M,s.label=Z}}}const S=i?h.graphMax:u.graphMax;if((t==="max"||t==="sel")&&M>S&&!this.options.displayOverflow)return!1;let x,I,L;if(m==="bar"){const E=i?this.scrollbar.y:this.scrollbar.x;if(E!=null&&E.use){const[G,v]=(E==null?void 0:E.range)??[];if(k>=G&&k<=v)k-=G??0;else return!1}else{const G=i?u:h,{minIndex:v,maxIndex:X}=G??{};if(Number.isFinite(v)&&Number.isFinite(X))if(k>=v&&k<=X)k-=v;else return!1}i?(I=Math.round(y.h/2),x=g-y.cat*k-y.cPad,L=x-(y.bar*y.ix-(y.h+y.bPad))-I):(I=Math.round(y.w/2),x=f+y.cat*k+y.cPad,L=x+(y.bar*y.ix-(y.w+y.bPad))+I)}else m==="line"?L=ne.calculateX(k,h.graphMin,h.graphMax,d-y.comboOffset,f+y.comboOffset/2):m==="scatter"&&(L=ne.calculateX(k,h.graphMin,h.graphMax,d,f));return{...{xArea:d,yArea:c,graphX:h,graphY:u,xsp:f,xep:p,ysp:g},...{dp:L,value:M,label:Z,type:m}}},drawFixedIndicator(e){const t=!!this.options.horizontal,n=e.ctx??this.bufferCtx,{graphX:i,graphY:s,xArea:l,yArea:a,xsp:r,ysp:c,dp:d,type:h,value:u,opt:f,seriesOpt:p}=e;let g=0;h==="line"?g+=3:h==="scatter"&&(g+=(p==null?void 0:p.pointSize)??0);let m;if(f.fixedPosTop)t?m=ne.calculateX(i.graphMax,i.graphMin,i.graphMax,l,r):(m=ne.calculateY(s.graphMax,s.graphMin,s.graphMax,a,c),m-=g);else if(t){const y=Math.min(Math.max(u,i.graphMin),i.graphMax);m=ne.calculateX(y,i.graphMin,i.graphMax,l,r)}else{const y=Math.min(Math.max(u,s.graphMin),s.graphMax);m=ne.calculateY(y,s.graphMin,s.graphMax,a,c),m-=g}d!==null&&(n.beginPath(),n.save(),n.strokeStyle=f.indicatorColor,n.lineWidth=2,t?(n.moveTo(r,d),n.lineTo(m,d)):(n.moveTo(d,c),n.lineTo(d,m)),n.stroke(),n.restore(),n.closePath())},drawTipForSelectedLabel(e=this.bufferCtx){var c,d;const t=this.options,n=!!t.horizontal,i=t.selectLabel,{dataIndex:s,data:l,label:a}=this.defaultSelectInfo;let r=!1;if(s.length){r=!0;const h=this.chartRect,u=this.labelOffset,f={x1:h.x1+u.left,x2:h.x2-u.right,y1:h.y1+u.top,y2:h.y2-u.bottom},p=n?this.axesY[0]:this.axesX[0],g=n?this.axesX[0]:this.axesY[0],m=n?this.axesSteps.x[0]:this.axesSteps.y[0],y=n?ne.calculateX:ne.calculateY,C=n?ne.calculateY:ne.calculateX,b=n?this.scrollbar.y:this.scrollbar.x,w=h.chartWidth-(u.left+u.right),T=h.chartHeight-(u.top+u.bottom),k=n?w:T,M=f[g.units.rectStart];let Z=this.options.type==="bar"?4:6;Z*=n?1:-1;const S=Object.keys(this.seriesList??{}),x=S.filter(Y=>this.seriesList[Y].show),I=S.some(Y=>this.seriesList[Y].isExistGrp&&!this.seriesList[Y].isOverlapping),L=((c=this.data.groups)==null?void 0:c[0])??[];let V,R,E,G,v,X,W,N,P,D=0,O=(d=p.labels)==null?void 0:d.length;if(p.labels){let Y=p.labels.length;if(b!=null&&b.use){const{range:H,interval:B,type:z}=b,[F,Q]=H??[];if(Re(F)&&Re(Q))Y=Math.floor((+Q-+F)/B)+1,D=z==="step"?F:p.labels.findIndex(U=>U===+F),O=z==="step"?Q:p.labels.findIndex(U=>U===+Q);else{const U=n?this.axesSteps.y[0]:this.axesSteps.x[0];Number.isFinite(U==null?void 0:U.minIndex)&&Number.isFinite(U==null?void 0:U.maxIndex)&&U.minIndex<U.maxIndex&&(D=U.minIndex,O=U.maxIndex,Y=O-D+1)}}G=f[p.units.rectStart],v=f[p.units.rectEnd],X=(v-G)/Y}else W=this.axesSteps.x[0],N=S.find(Y=>{var H;return((H=this.seriesList[Y])==null?void 0:H.type)==="line"}),P=this.seriesList[N].size;l.forEach((Y,H)=>{var B;if(E=m.graphMax,!i.fixedPosTop){if(I){const z=x==null?void 0:x.reduce((U,ee)=>{var j,te;return L.includes(ee)&&(((j=Y[ee])==null?void 0:j.value)??Y[ee])>0?U+(((te=Y[ee])==null?void 0:te.value)??Y[ee]):U},0),F=((B=x==null?void 0:x.filter(U=>!L.includes(U)))==null?void 0:B.map(U=>{var ee;return((ee=Y[U])==null?void 0:ee.value)??Y[U]}))??[],Q=(F==null?void 0:F.length)>0?F.reduce((U,ee)=>Math.max(U,ee??-1/0),-1/0):-1/0;E=z>0?Math.max(Q,z):Math.max(Q,0)}else if(x.length){const z=x.map(Q=>{var U;return((U=Y[Q])==null?void 0:U.value)??Y[Q]}),F=z.length>0?z.reduce((Q,U)=>Math.max(Q,U??-1/0),-1/0):-1/0;E=F>0||this.options.type!=="bar"?F:0}}if(p.labels){if(s[H]<D||s[H]>O)return;const z=s[H]-D;V=Math.round(G+X*z)+X/2}else V=C(a[H],W.graphMin,W.graphMax,w-P.comboOffset,f.x1+P.comboOffset/2);R=y(E,m.graphMin,m.graphMax,k,M)+Z,this.showTip({context:e,x:n?R:V,y:n?V:R,opt:i,isSamePos:!1})})}return r},drawLabelTipForHeatMap(e=this.bufferCtx){const t=this.options,n=!!t.horizontal,i=t.selectLabel,{dataIndex:s}=this.defaultSelectInfo;let l=!1;if(s){l=!0;const a=this.chartRect,r=this.labelOffset,c={x1:a.x1+r.left,x2:a.x2-r.right,y1:a.y1+r.top,y2:a.y2-r.bottom},d=n?this.axesY[0]:this.axesX[0],h=c[d.units.rectStart],f=(c[d.units.rectEnd]-h)/d.labels.length,p=n?this.axesX[0]:this.axesY[0],g=6*(n?1:-1),m=c[p.units.rectEnd]+g;s==null||s.forEach(y=>{const b=Math.round(h+f*y)+f/2;this.showTip({context:e,x:n?m:b,y:n?b:m,opt:i,isSamePos:!1})})}return l},drawTextTip(e){const t=!!this.options.horizontal,n=e.ctx??this.bufferCtx,{graphX:i,graphY:s,xArea:l,yArea:a,xsp:r,xep:c,ysp:d}=e,{dp:h,value:u,text:f,opt:p,type:g,tipType:m,isSamePos:y,seriesOpt:C}=e,b=4,w=4,{fontSize:T,fontFamily:k,fontWeight:M,height:Z}=p.tipStyle,S=`normal normal ${M} ${T}px ${k}`;let x=1;g==="line"?x+=6:g==="scatter"?x+=C==null?void 0:C.pointSize:g==="bar"&&(x+=4);let I,L=h;if(p.fixedPosTop)t?(I=ne.calculateX(i.graphMax,i.graphMin,i.graphMax,l,r),I+=x):(I=ne.calculateY(s.graphMax,s.graphMin,s.graphMax,a,d),I-=x);else if(t){const E=Math.min(Math.max(u,i.graphMin),i.graphMax);I=ne.calculateX(E,i.graphMin,i.graphMax,l,r),I=u<0?I-x:I+x}else{const E=g==="bar"&&u<0?0:u,G=Math.min(Math.max(E,s.graphMin),s.graphMax);I=ne.calculateY(G,s.graphMin,s.graphMax,a,d),I=E<0?I+x:I-x}let V="center";n.save(),n.font=S;const R=Math.round(Math.max(n.measureText(f).width+12,40));t||(h+R/2>c-10?(V="right",L-=R/2-b*2):h-R/2<r+10&&(V="left",L+=R/2-b*2)),n.restore(),(p.showTextTip||m==="max")&&this.showTextTip({context:n,type:V,width:R,height:Z,x:t?I+R/2:L,y:t?L+Z/2:I,opt:p,arrowSize:b,borderRadius:w,text:f,textStyle:S,isNegative:u<0}),p.showTip&&m==="sel"&&this.showTip({context:n,x:t?I:h,y:t?h:I,opt:p,isSamePos:y})},showTextTip(e){const t=!!this.options.horizontal,{type:n,width:i,height:s,x:l,y:a,arrowSize:r,borderRadius:c,text:d,opt:h,textStyle:u,isNegative:f}=e,p=e.context;let g=l-i/2,m=l+i/2;const y=a-s,C=a;f&&t&&(g=l-i/2-i,m=l-i/2),p.save(),p.font=u,p.fillStyle=h.tipBackground??h.tipStyle.background,p.shadowBlur=0,p.beginPath(),p.moveTo(g+c,y),p.quadraticCurveTo(g,y,g,y+c),p.lineTo(g,C-c),p.quadraticCurveTo(g,C,g+c,C),p.lineTo(m-c,C),p.quadraticCurveTo(m,C,m,C-c),p.lineTo(m,y+c),p.quadraticCurveTo(m,y,m-c,y),p.lineTo(g+c,y),p.closePath(),p.fill(),p.beginPath(),t?(f?(p.moveTo(m,C),p.lineTo(m,y+c+r/2),p.lineTo(m+r,C-s/2),p.lineTo(m,C-c-r/2)):(p.moveTo(g,y),p.lineTo(g,y+c+r/2),p.lineTo(g-r,C-s/2),p.lineTo(g,C-c-r/2)),p.closePath(),p.fill()):(f?n==="left"?(p.lineTo(g+c+r,C+r),p.lineTo(g+c+r*2,C)):n==="right"?(p.lineTo(m-r*2-c,C),p.lineTo(m-r-c,C+r)):(p.lineTo(l-r,C),p.lineTo(l,C+r),p.lineTo(l+r,C)):f||(n==="left"?(p.moveTo(g,y),p.lineTo(g+c+r,C+r),p.lineTo(g+c+r*2,C)):n==="right"?(p.moveTo(m,y),p.lineTo(m-r*2-c,C),p.lineTo(m-r-c,C+r)):(p.lineTo(l-r,C),p.lineTo(l,C+r),p.lineTo(l+r,C))),p.closePath(),p.fill()),p.restore(),p.save(),p.font=u,p.fillStyle=h.tipTextColor??h.tipStyle.textColor,p.textBaseline="middle",p.textAlign="center",p.fillText(`${d}`,g+i/2,y+s/2),p.restore()},showTip(e){const t=!!this.options.horizontal,{x:n,y:i,opt:s,isSamePos:l}=e,a=e.context,c=i-(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()}},MC={initBlitState(){var e;this._blitPrev=null,this._blitDiag=null,this.pointsLayerA=null,this.pointsLayerB=null,this.pointsLayerACtx=null,this.pointsLayerBCtx=null,this.curPointsLayer="A",this.pointsLayerValid=!1,this._blitCarry=0,this._framesSinceFullRedraw=0,this._pointsLayerStamp=null,this._pointsLayerOptionsRef=null,this._hitCoordsDirty=!1,(e=this.options.realTimeScatter)!=null&&e.use&&this.createPointsLayers()},createPointsLayers(){this.pointsLayerA||(this.pointsLayerA=document.createElement("canvas"),this.pointsLayerB=document.createElement("canvas"),this.pointsLayerACtx=this.pointsLayerA.getContext("2d"),this.pointsLayerBCtx=this.pointsLayerB.getContext("2d"),this.curPointsLayer="A",this.pointsLayerValid=!1)},getPointsLayers(){const e=this.curPointsLayer==="A";return{src:e?this.pointsLayerA:this.pointsLayerB,srcCtx:e?this.pointsLayerACtx:this.pointsLayerBCtx,dst:e?this.pointsLayerB:this.pointsLayerA,dstCtx:e?this.pointsLayerBCtx:this.pointsLayerACtx,dstName:e?"B":"A"}},pointsLayersSized(){return!this.pointsLayerA||!this.bufferCanvas?!1:this.pointsLayerA.width===this.bufferCanvas.width&&this.pointsLayerA.height===this.bufferCanvas.height&&this.pointsLayerA.width>1&&this.pointsLayerA.height>1},collectStripDuplicatePoints(e,t){var s,l,a;const n=((l=(s=this.seriesInfo)==null?void 0:s.charts)==null?void 0:l.scatter)??[],i=!!this.options.seriesReverse;for(let r=i?n.length-1:0;i?r>=0:r<n.length;i?r--:r++){const c=this.seriesList[n[r]];if(!(c!=null&&c.show))continue;const d=(a=c.data[c.sId])==null?void 0:a.dataGroup;if(d)for(let h=0;h<t.length;h++){const u=d[t[h]];if(u!=null&&u.data)for(let f=0;f<u.data.length;f++){const p=u.data[f];e.set(p.k??A.coordinateKey(p.x,p.y),c.sId)}}}},getBlitScatterSeriesList(){var n,i;const e=((i=(n=this.seriesInfo)==null?void 0:n.charts)==null?void 0:i.scatter)??[],t=[];for(let s=0;s<e.length;s++){const l=this.seriesList[e[s]];l!=null&&l.show&&t.push({sId:e[s],series:l,xi:l.xAxisIndex??0,yi:l.yAxisIndex??0})}return t},getBlitScatterSeries(){return this.getBlitScatterSeriesList()[0]??null},areBlitSeriesAligned(e){var n,i,s,l;if(!e||e.length<1)return!1;const t=(i=(n=this.dataSet)==null?void 0:n[e[0].sId])==null?void 0:i.lastTick;if(!t)return!1;for(let a=1;a<e.length;a++){const r=(l=(s=this.dataSet)==null?void 0:s[e[a].sId])==null?void 0:l.lastTick;if(!r||r.gapCount!==t.gapCount||r.toTime!==t.toTime||r.endIndex!==t.endIndex||r.length!==t.length)return!1}return!0},evaluateBlitGate(e){var m,y,C,b,w,T,k,M,Z,S,x,I,L,V,R;const t=this.options,n=this._blitPrev,i=this.isInit===!0&&((m=t.realTimeScatter)==null?void 0:m.use)===!0&&!t.brush&&this.updateSeries!==!0&&!e&&!((C=(y=this.scrollbar)==null?void 0:y.x)!=null&&C.use||(w=(b=this.scrollbar)==null?void 0:b.y)!=null&&w.use),s=this.getBlitScatterSeriesList(),l=this.areBlitSeriesAligned(s),a=!((T=t.selectItem)!=null&&T.use&&(((k=this.defaultSelectItemInfo)==null?void 0:k.dataIndex)!=null||((M=this.lastHitInfo)==null?void 0:M.dataIndex)!=null))&&!((Z=t.selectSeries)!=null&&Z.use&&this.defaultSelectInfo)&&!this.legendHover,r={modeOk:i,seriesAligned:l,selectionOk:a,scatterOnly:this.hasOnlyVisibleScatter(),hasPrev:!!n,optionsStable:!!n&&n.optionsRef===this.options,yFixed:!1,xWidthStable:!1,xAreaStable:!1,labelOffsetStable:!1,xMonotonic:!1,deviceStable:!1,gapOk:!1};let c=0,d=0,h=0;const u=s[0]??null,f=u?(x=(S=this.axesSteps)==null?void 0:S.x)==null?void 0:x[u.xi]:null,p=u?(L=(I=this.axesSteps)==null?void 0:I.y)==null?void 0:L[u.yi]:null;if(u&&f&&p&&this.chartRect&&this.labelOffset){const E=this.chartRect,G=E.chartWidth-(this.labelOffset.left+this.labelOffset.right);n&&(r.yFixed=p.graphMin===n.graphMinY&&p.graphMax===n.graphMaxY,r.xWidthStable=f.graphMax-f.graphMin===n.graphMaxX-n.graphMinX,r.xAreaStable=G===n.xArea,r.labelOffsetStable=this.labelOffset.left===n.labelOffsetLeft&&this.labelOffset.right===n.labelOffsetRight,c=f.graphMin-n.graphMinX,r.xMonotonic=Number.isFinite(c)&&c>0,r.deviceStable=this.pixelRatio===n.pixelRatio&&E.chartWidth===n.chartWidth&&E.chartHeight===n.chartHeight&&E.x1===n.x1&&E.y2===n.y2);const v=(R=(V=this.dataSet)==null?void 0:V[u.sId])==null?void 0:R.lastTick;v&&(d=v.gapCount??0,h=v.length??0,r.gapOk=d>0&&d<h)}return{ok:r.modeOk&&r.seriesAligned&&r.selectionOk&&r.scatterOnly&&r.hasPrev&&r.optionsStable&&r.yFixed&&r.xWidthStable&&r.xAreaStable&&r.labelOffsetStable&&r.xMonotonic&&r.deviceStable&&r.gapOk,parts:r,shiftMs:c,gapCount:d,length:h,scatterList:s}},hasOnlyVisibleScatter(){var n,i;const e=((n=this.seriesInfo)==null?void 0:n.charts)??{},t=Object.keys(e);for(let s=0;s<t.length;s++){if(t[s]==="scatter")continue;const l=e[t[s]];for(let a=0;a<l.length;a++)if((i=this.seriesList[l[a]])!=null&&i.show)return!1}return!0},snapshotBlitState(){var s,l,a,r,c;if(!((s=this.options.realTimeScatter)!=null&&s.use))return null;const e=this.getBlitScatterSeries();if(!e)return null;const t=(a=(l=this.axesSteps)==null?void 0:l.x)==null?void 0:a[e.xi],n=(c=(r=this.axesSteps)==null?void 0:r.y)==null?void 0:c[e.yi];if(!t||!n||!this.chartRect||!this.labelOffset)return null;const i=this.chartRect;return{sId:e.sId,graphMinX:t.graphMin,graphMaxX:t.graphMax,graphMinY:n.graphMin,graphMaxY:n.graphMax,xArea:i.chartWidth-(this.labelOffset.left+this.labelOffset.right),labelOffsetLeft:this.labelOffset.left,labelOffsetRight:this.labelOffset.right,pixelRatio:this.pixelRatio,chartWidth:i.chartWidth,chartHeight:i.chartHeight,x1:i.x1,y2:i.y2,optionsRef:this.options}},recordBlitDiag(e,t,n){var s;if(typeof window>"u"||!window.__EVUI_BLIT_DEBUG__)return;(s=this.options.realTimeScatter)!=null&&s.use&&(window.__EVUI_BLIT_CHART__=this),this._blitDiag||(this._blitDiag={ticks:0,eligible:0,blitted:0,fail:{},rate:0,lastShiftMs:0,lastGap:0});const i=this._blitDiag;if(i.ticks++,i.lastShiftMs=e.shiftMs,i.lastGap=e.gapCount,e.ok)i.eligible++;else{const l=Object.keys(e.parts);for(let a=0;a<l.length;a++)e.parts[l[a]]||(i.fail[l[a]]=(i.fail[l[a]]||0)+1)}if(e.ok&&!t&&n){const l=Object.keys(n);for(let a=0;a<l.length;a++)n[l[a]]&&(i.fail[l[a]]=(i.fail[l[a]]||0)+1)}t&&i.blitted++,i.rate=i.blitted/i.ticks,window.__EVUI_BLIT_DIAG__=i},drawChartBlitFastPath(e,t){var Y,H,B,z;const n=t.scatterList??this.getBlitScatterSeriesList(),i=n[0]??null,s=(H=(Y=this.dataSet)==null?void 0:Y[i==null?void 0:i.sId])==null?void 0:H.lastTick;if(!i||!s)return!1;const l=this.pixelRatio,a=this.chartRect,r=this.labelOffset,c=this.axesSteps.x[i.xi],d=a.chartWidth-(r.left+r.right),h=c.graphMax-c.graphMin;if(!(h>0)||!(d>0))return!1;const p=d/h*t.shiftMs*l+this._blitCarry,g=Math.floor(p);if(g<1)return!1;let m=s.maxDirtyAge,y=typeof i.series.pointSize=="number"?i.series.pointSize:i.series.pointSize.value;for(let F=1;F<n.length;F++){const Q=(z=(B=this.dataSet)==null?void 0:B[n[F].sId])==null?void 0:z.lastTick;Q&&Q.maxDirtyAge>m&&(m=Q.maxDirtyAge);const U=n[F].series.pointSize,ee=typeof U=="number"?U:U.value;ee>y&&(y=ee)}if(m>s.gapCount+1)return!1;const C=this.bufferCanvas.width,b=this.bufferCanvas.height;if(g>=C)return!1;this._blitCarry=p-g;const{src:w,dst:T,dstCtx:k,dstName:M}=this.getPointsLayers();k.setTransform(1,0,0,1,0,0),k.clearRect(0,0,C,b),k.drawImage(w,g,0,C-g,b,0,0,C-g,b);const Z=Math.ceil(y*l)+1,S=(a.x1+r.left+d)*l,x=d/h*1e3*l,{gapCount:I,endIndex:L,length:V}=s,R=Z+Math.ceil(4*l),E=Math.max(2,Math.ceil((R+Z+2)/Math.max(1e-6,x))),G=Math.min(V,I+E),v=S-G*x,X=Math.max(0,Math.floor(v+R));k.clearRect(X,0,C-X,b);const W=new Array(G);for(let F=0;F<G;F++){let Q=(L-F)%V;Q<0&&(Q+=V),W[F]=Q}const N=this.options.coordinateDedupe!==!1&&n.length>1,P=N?new Map:null;N&&this.collectStripDuplicatePoints(P,W);const D={chartRect:a,labelOffset:r,axesSteps:this.axesSteps,displayOverflow:this.options.displayOverflow,selectInfo:null,legendHitInfo:null,unSelectedOpacity:this.options.unSelectedOpacity,duple:P,coordinateDedupe:N};k.save(),k.beginPath(),k.rect(X,0,C-X,b),k.clip(),k.setTransform(l,0,0,l,0,0);const O=!!this.options.seriesReverse;for(let F=0;F<n.length;F++)(O?n[n.length-1-F]:n[F]).series.realTimeScatterDrawStrip(k,W,D);k.restore(),k.setTransform(1,0,0,1,0,0),this.curPointsLayer=M;for(let F=0;F<n.length;F++)n[F].series.refreshRtTotalCount();return this.drawStaticLayer(this.bufferCtx,e),this.compositePointsLayer(T,y),!0},compositePointsLayer(e,t){const n=this.pixelRatio,i=this.chartRect,s=this.labelOffset,l=i.chartWidth-(s.left+s.right),a=i.chartHeight-(s.top+s.bottom),r=i.x1+s.left,c=i.y2-s.bottom,d=c-a,h=r+l,u=(r-t)*n,f=(d-t)*n,p=(h+t)*n,g=(c+t)*n;this.bufferCtx.save(),this.bufferCtx.setTransform(1,0,0,1,0,0),this.bufferCtx.beginPath(),this.bufferCtx.rect(u,f,p-u,g-f),this.bufferCtx.clip(),this.bufferCtx.drawImage(e,0,0),this.bufferCtx.restore()},computePointsLayerStamp(){var s,l,a,r,c,d,h;if(!((s=this.options.realTimeScatter)!=null&&s.use))return null;const e=this.getBlitScatterSeriesList();if(!e.length||!this.chartRect||!this.labelOffset||!this.axesSteps)return null;const t=this.chartRect,n=this.labelOffset,i=[this.pixelRatio,(l=this.bufferCanvas)==null?void 0:l.width,(a=this.bufferCanvas)==null?void 0:a.height,t.chartWidth,t.chartHeight,t.x1,t.y2,n.left,n.right,n.top,n.bottom];for(let u=0;u<e.length;u++){const{sId:f,xi:p,yi:g}=e[u],m=(c=(r=this.dataSet)==null?void 0:r[f])==null?void 0:c.lastTick,y=(d=this.axesSteps.x)==null?void 0:d[p],C=(h=this.axesSteps.y)==null?void 0:h[g];if(!y||!C)return null;i.push(f,m?`${m.seq}/${m.toTime}/${m.endIndex}/${m.length}`:"nt",y.graphMin,y.graphMax,C.graphMin,C.graphMax)}return i.join("|")},maybeRebuildPointsLayer(e=!1){var n;if(!((n=this.options.realTimeScatter)!=null&&n.use))return!1;const t=this.computePointsLayerStamp();return!e&&t&&this.pointsLayerValid&&this._pointsLayerStamp===t&&this._pointsLayerOptionsRef===this.options?!1:(this.rebuildPointsLayer(),this._pointsLayerStamp=this.pointsLayerValid?t:null,this._pointsLayerOptionsRef=this.pointsLayerValid?this.options:null,this.pointsLayerValid)},canRouteFallbackViaLayer(e){var n,i,s,l,a;const t=this.options;return!((n=t.realTimeScatter)!=null&&n.use)||e||(i=t.selectItem)!=null&&i.use&&(((s=this.defaultSelectItemInfo)==null?void 0:s.dataIndex)!=null||((l=this.lastHitInfo)==null?void 0:l.dataIndex)!=null)||(a=t.selectSeries)!=null&&a.use&&this.defaultSelectInfo||!this.pointsLayersSized()||!this.hasOnlyVisibleScatter()?!1:this.getBlitScatterSeriesList().length>0},ensureHitCoordsFresh(){var n,i,s;if(!this._hitCoordsDirty||!((n=this.options.realTimeScatter)!=null&&n.use)||!this.chartRect||!this.labelOffset||!this.axesSteps)return;const e=this.getBlitScatterSeriesList(),t={chartRect:this.chartRect,labelOffset:this.labelOffset,axesSteps:this.axesSteps,displayOverflow:this.options.displayOverflow};for(let l=0;l<e.length;l++)(s=(i=e[l].series).refreshRtHitCoords)==null||s.call(i,t);this._hitCoordsDirty=!1},getMaxVisibleScatterPointSize(){const e=this.getBlitScatterSeriesList();let t=0;for(let n=0;n<e.length;n++){const i=e[n].series.pointSize,s=typeof i=="number"?i:(i==null?void 0:i.value)??0;s>t&&(t=s)}return t},rebuildPointsLayer(){var h,u,f;if(!((h=this.options.realTimeScatter)!=null&&h.use)||!this.pointsLayersSized()){this.pointsLayerValid=!1;return}const e=this.getBlitScatterSeriesList();if(!e.length){this.pointsLayerValid=!1;return}const t=this.pixelRatio,n=this.curPointsLayer==="A",i=n?this.pointsLayerA:this.pointsLayerB,s=n?this.pointsLayerACtx:this.pointsLayerBCtx;s.setTransform(1,0,0,1,0,0),s.clearRect(0,0,i.width,i.height),s.setTransform(t,0,0,t,0,0);const l=((f=(u=this.seriesInfo)==null?void 0:u.charts)==null?void 0:f.scatter)??[],a=this.options.coordinateDedupe!==!1&&!this.canSkipRealtimeScatterDedupe(l),r=new Map;a&&this.collectDuplicatePoints(r,l);const c={ctx:s,chartRect:this.chartRect,labelOffset:this.labelOffset,axesSteps:this.axesSteps,displayOverflow:this.options.displayOverflow,duple:r,coordinateDedupe:a,selectInfo:null,legendHitInfo:null,unSelectedOpacity:this.options.unSelectedOpacity},d=!!this.options.seriesReverse;for(let p=0;p<e.length;p++){const g=d?e[e.length-1-p]:e[p];g.series.computeGeometry(c),g.series.realTimeScatterDraw(c)}s.setTransform(1,0,0,1,0,0),this.pointsLayerValid=!0}},RC={selectedSeriesAllLineSafe(){var t;const e=((t=this.defaultSelectInfo)==null?void 0:t.seriesId)??[];for(let n=0;n<e.length;n++){const i=this.seriesList[e[n]];if(!i||i.type!=="line"||i.fill||i.isExistGrp)return!1}return!0},shouldDrawSelectedOnTop(e){var n,i,s,l;const t=this.options;return!((n=t.selectSeries)!=null&&n.use)||t.brush||(i=t.realTimeScatter)!=null&&i.use||t.workerRender||e!=null&&e.legend||this.legendHover||!((l=(s=this.defaultSelectInfo)==null?void 0:s.seriesId)!=null&&l.length)?!1:this.selectedSeriesAllLineSafe()},drawSelectedSeriesOnly(){var d;const{maxTip:e,selectLabel:t,selectItem:n,selectSeries:i,brush:s,displayOverflow:l,unSelectedOpacity:a}=this.options,r={ctx:this.bufferCtx,chartRect:this.chartRect,labelOffset:this.labelOffset,axesSteps:this.axesSteps,maxTipOpt:{background:e.background,color:e.color},selectLabel:{option:t,selected:this.defaultSelectInfo},selectSeries:{option:i,selected:this.defaultSelectInfo},selectItem:{option:n,selected:this.defaultSelectItemInfo},isBrush:!!s,displayOverflow:l,unSelectedOpacity:a,isHorizontal:this.options.horizontal,dataEpoch:this._dataEpoch,scaleVersion:this._scaleVersion},c=((d=this.defaultSelectInfo)==null?void 0:d.seriesId)??[];for(let h=0;h<c.length;h++){const u=this.seriesList[c[h]];u&&u.show&&u.draw({...r})}}},_r=2,vC=["type","horizontal","sunburst","coordinateDedupe","unSelectedOpacity","displayOverflow","thickness","cPadRatio","borderRadius","seriesReverse","maxTip","padding","heatMapColor"],VC=["sId","type","name","show","color","fill","fillColor","fillOpacity","pointFill","point","lineWidth","thickness","pointSize","pointStyle","interpolation","passingValue","hasPassingValueInData","segments","combo","xAxisIndex","yAxisIndex","stackIndex","groupIndex","isExistGrp","showValue"];function st(e){if(e===null)return null;const t=typeof e;if(t==="number"||t==="string"||t==="boolean")return e;if(t==="function"||t==="undefined"||t==="symbol"||t==="bigint")return;if(Array.isArray(e))return e.map(i=>st(i)??null);const n=Object.getPrototypeOf(e);if(n===Object.prototype||n===null){const i={};return Object.keys(e).forEach(s=>{const l=st(e[s]);l!==void 0&&(i[s]=l)}),i}}function Ur(e,t){const n={};return e&&t.forEach(i=>{const s=st(e[i]);s!==void 0&&(n[i]=s)}),n}function Jr(e,t){if(t==="time")return Fr(e);if(typeof e=="number")return e;if(t==="step"){const n=Number(e);return Number.isFinite(n)?n:null}return null}function EC(e,t={}){const n=e.data??[];if(e.type==="pie")return{value:n.map(d=>typeof(d==null?void 0:d.value)=="number"?d.value:null)};const i=t.x??"linear",s=t.y??"linear",l=new Array(n.length),a=new Array(n.length),r=new Array(n.length),c=new Array(n.length);for(let d=0;d<n.length;d++){const h=n[d]??{};l[d]=Jr(h.x,i),a[d]=Jr(h.y,s),r[d]=typeof h.o=="number"?h.o:null,c[d]=typeof h.b=="number"?h.b:null}return{x:l,y:a,o:r,b:c}}function GC(e){var s,l,a,r,c,d,h,u;const t=e.options??{},n=e.defaultSelectInfo,i=e.defaultSelectItemInfo;return{selectSeries:{use:!!((s=t.selectSeries)!=null&&s.use),selected:{seriesId:st(n==null?void 0:n.seriesId)??[]}},selectItem:{use:!!((l=t.selectItem)!=null&&l.use),useSeriesOpacity:!!((a=t.selectItem)!=null&&a.useSeriesOpacity),showBorder:!!((r=t.selectItem)!=null&&r.showBorder),borderStyle:st((c=t.selectItem)==null?void 0:c.borderStyle)??null,selected:i?{dataIndex:i.dataIndex??null,seriesID:i.seriesID??null}:null},selectLabel:{use:!!((d=t.selectLabel)!=null&&d.use),useSeriesOpacity:!!((h=t.selectLabel)!=null&&h.useSeriesOpacity),useBothAxis:!!((u=t.selectLabel)!=null&&u.useBothAxis),selected:{dataIndex:st(n==null?void 0:n.dataIndex)??[],label:st(n==null?void 0:n.label)??[],targetAxis:(n==null?void 0:n.targetAxis)??null}}}}function WC(e,t=0){var a,r,c,d,h;const n={},i=e.seriesList??{};Object.keys(i).forEach(u=>{var m,y,C,b,w,T;const f=i[u];if(!f||typeof f.hasRenderableValue=="function"&&!f.isExistGrp&&!f.hasRenderableValue())return;const p=((C=(y=(m=e.options)==null?void 0:m.axesX)==null?void 0:y[f.xAxisIndex??0])==null?void 0:C.type)??"linear",g=((T=(w=(b=e.options)==null?void 0:b.axesY)==null?void 0:w[f.yAxisIndex??0])==null?void 0:T.type)??"linear";n[u]={...Ur(f,VC),data:EC(f,{x:p,y:g})},f.type==="heatMap"&&f.labels&&(n[u].labels=st(f.labels)??{})});const s={},l=((a=e.seriesInfo)==null?void 0:a.charts)??{};return Object.keys(l).forEach(u=>{s[u]=(l[u]??[]).filter(f=>n[f])}),{version:_r,epoch:t,pixelRatio:e.pixelRatio??1,chartRect:st(e.chartRect)??{},labelOffset:st(e.labelOffset)??{},axesSteps:{x:st((r=e.axesSteps)==null?void 0:r.x)??[],y:st((c=e.axesSteps)==null?void 0:c.y)??[]},options:{...Ur(e.options,vC),isGradient:((h=(d=e.options)==null?void 0:d.legend)==null?void 0:h.type)==="gradient"},selection:GC(e),seriesOrder:s,series:n}}function ZC(e){const t={},n=[],i=e.series??{};return Object.keys(i).forEach(s=>{const l=i[s].data??{},a={};let r=0;Object.keys(l).forEach(c=>{const d=l[c]??[];r=d.length;const h=new Float64Array(d.length);for(let u=0;u<d.length;u++)h[u]=typeof d[u]=="number"?d[u]:NaN;a[c]=h,n.push(h.buffer)}),a.length=r,t[s]=a}),{columns:t,transferList:n}}const jr="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3ZhciBxdD10eXBlb2YgZ2xvYmFsPT0ib2JqZWN0IiYmZ2xvYmFsJiZnbG9iYWwuT2JqZWN0PT09T2JqZWN0JiZnbG9iYWwsQWU9dHlwZW9mIHNlbGY9PSJvYmplY3QiJiZzZWxmJiZzZWxmLk9iamVjdD09PU9iamVjdCYmc2VsZix5dD1xdHx8QWV8fEZ1bmN0aW9uKCJyZXR1cm4gdGhpcyIpKCksT3Q9eXQuU3ltYm9sLFp0PU9iamVjdC5wcm90b3R5cGUsRGU9WnQuaGFzT3duUHJvcGVydHksemU9WnQudG9TdHJpbmcsTX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DYW52YXM8InUiO2lmKG4pdHJ5e249ISFuZXcgT2Zmc2NyZWVuQ2FudmFzKDEsMSkuZ2V0Q29udGV4dCgiMmQiKX1jYXRjaHtuPSExfXNlbGYucG9zdE1lc3NhZ2Uoe3R5cGU6bj8icmVhZHkiOiJ1bnN1cHBvcnRlZCIsdmVyc2lvbjpnc30pO3JldHVybn1pZih0LnR5cGU9PT0icmVuZGVyIil0cnl7SXModCl9Y2F0Y2gobil7c2VsZi5wb3N0TWVzc2FnZSh7dHlwZToicmVuZGVyLWVycm9yIixlcG9jaDp0LmVwb2NoLG1lc3NhZ2U6U3RyaW5nKG4mJm4ubWVzc2FnZXx8biksbmFtZTpuJiZuLm5hbWUsc3RhY2s6biYmbi5zdGFja30pfX19fSkoKTsK",XC=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),Qr=typeof self<"u"&&self.Blob&&new Blob([XC(jr)],{type:"text/javascript;charset=utf-8"});function NC(e){let t;try{if(t=Qr&&(self.URL||self.webkitURL).createObjectURL(Qr),!t)throw"";const n=new Worker(t,{name:e==null?void 0:e.name});return n.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker("data:text/javascript;base64,"+jr,{name:e==null?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}const mt={IDLE:"idle",INITIALIZING:"initializing",READY:"ready",FAILED:"failed"},PC=3e3,BC=2,DC=3,zt=()=>{},YC={onInitFailure:zt,onTimeout:zt,onRenderException:zt,onFallback:zt};function OC(){return typeof Worker<"u"&&typeof OffscreenCanvas<"u"&&typeof OffscreenCanvas.prototype.transferToImageBitmap=="function"}function HC(e){if(typeof structuredClone!="function")return!1;try{return structuredClone(e),!0}catch{return!1}}function zC(){return new NC}class FC{constructor(t={}){this.state=mt.IDLE,this.worker=null,this.version=t.version??_r,this.initTimeoutMs=t.initTimeoutMs??PC,this.maxInFlight=t.maxInFlight??BC,this.maxRenderErrors=t.maxRenderErrors??DC,this.hooks={...YC,...t.hooks||{}},this._timer=null,this._frameHandler=zt,this._errorHandler=zt,this._inFlight=0,this._renderErrorStreak=0,this._isEnabled=t.isEnabled||(()=>!1),this._isSupported=t.isSupported||OC,this._createWorker=t.createWorker||zC}start(){if(this.state!==mt.IDLE)return this.state;if(!this._isEnabled())return this.hooks.onFallback("opt-in-off"),this.state;if(!this._isSupported())return this.hooks.onFallback("unsupported"),this.state;let t;try{t=this._createWorker()}catch(n){return this.state=mt.FAILED,this.hooks.onInitFailure(n),this.hooks.onFallback("worker-create-failed"),this.state}return t?(this.worker=t,this.state=mt.INITIALIZING,t.onmessage=n=>this._handleMessage(n),t.onerror=()=>this._fail("worker-error"),this._timer=setTimeout(()=>this._handleTimeout(),this.initTimeoutMs),t.postMessage({type:"init",version:this.version}),this.state):(this.state=mt.FAILED,this.hooks.onInitFailure("worker-create-failed"),this.hooks.onFallback("worker-create-failed"),this.state)}isReady(){return this.state===mt.READY}shouldRenderOnWorker(t){return this.isReady()&&HC(t)}setFrameHandler(t){this._frameHandler=t||zt}setErrorHandler(t){this._errorHandler=t||zt}canAcceptRender(){return this.isReady()&&this._inFlight<this.maxInFlight}render(t,n,i){if(!this.canAcceptRender()||!this.worker)return!1;this._inFlight+=1;try{this.worker.postMessage({type:"render",epoch:t.epoch,snapshot:t,columns:n},i||[])}catch(s){return this._inFlight=0,this.hooks.onRenderException(s),this._fail("post-message-failed"),!1}return!0}destroy(){this._clearTimer(),this.worker&&(this.worker.terminate(),this.worker=null),this.state=mt.IDLE}_handleMessage(t){const n=t&&t.data;if(n)if(n.type==="ready"&&this.state===mt.INITIALIZING){if(n.version!==this.version){this._fail("version-mismatch");return}this._clearTimer(),this.state=mt.READY}else n.type==="unsupported"?this._fail("worker-unsupported"):n.type==="rendered"?(this._inFlight=Math.max(0,this._inFlight-1),this._renderErrorStreak=0,this._frameHandler(n)):n.type==="render-error"&&(this._inFlight=Math.max(0,this._inFlight-1),this.hooks.onRenderException(n),this._errorHandler(n),this._renderErrorStreak+=1,this._renderErrorStreak>=this.maxRenderErrors&&(this._inFlight=0,this._fail("render-error-threshold")))}_handleTimeout(){this.state===mt.INITIALIZING&&(this.hooks.onTimeout("init-timeout"),this._fail("init-timeout"))}_fail(t){this._clearTimer(),this.state=mt.FAILED,this.worker&&(this.worker.terminate(),this.worker=null);const n=this._inFlight>0;this._inFlight=0,this.hooks.onInitFailure(t),this.hooks.onFallback(t),n&&this._errorHandler()}_clearTimer(){this._timer&&(clearTimeout(this._timer),this._timer=null)}}const AC=300;let ms=class{constructor(t,n,i,s,l,a,r){Object.keys(zr).forEach(d=>Object.assign(this,zr[d])),i.brush||(Object.assign(this,xC),Object.assign(this,IC),Object.assign(this,bC),Object.assign(this,TC),Object.assign(this,dC),Object.assign(this,LC),Object.assign(this,cC),Object.assign(this,fC)),i.type==="heatMap"&&i.legend.type==="gradient"&&Object.assign(this,uC),this.isMobile=Zh(),this.brushSeries=r,this.target=t,this.data=n,this.options=i,this.listeners=s,this.wrapperDOM=document.createElement("div"),this.wrapperDOM.className=i.brush?"ev-chart-brush-wrapper":"ev-chart-wrapper",this.chartDOM=document.createElement("div"),this.chartDOM.className=i.brush?"ev-chart-brush-container":"ev-chart-container",this.wrapperDOM.appendChild(this.chartDOM),this.target.appendChild(this.wrapperDOM);const c=i.type==="pie";this.displayCanvas=document.createElement("canvas"),this.displayCanvas.setAttribute("style","display: block;"),this.displayCtx=this.displayCanvas.getContext("2d",{willReadFrequently:c}),this.bufferCanvas=document.createElement("canvas"),this.bufferCanvas.setAttribute("style","display: block;"),this.bufferCtx=this.bufferCanvas.getContext("2d",{willReadFrequently:c}),this.pixelRatio=window.devicePixelRatio||1,this.oldPixelRatio=this.pixelRatio,this.chartDOM.appendChild(this.displayCanvas),i.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",{willReadFrequently:c}),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,this.initBlitState(),this.renderWorkerGate=new FC({isEnabled:()=>!!this.options.workerRender,hooks:{onInitFailure:d=>to.warn("[EvChart] workerRender 비활성화 — main 렌더로 fallback:",d),onRenderException:d=>to.warn("[EvChart] workerRender 렌더 예외 — main 렌더로 fallback:",d),onFallback:d=>{d==="unsupported"&&to.warn("[EvChart] workerRender 미지원 환경 — main 렌더 사용")}}}),this.renderEpoch=0,this.renderWorkerGate.setFrameHandler(d=>this.commitWorkerFrame(d)),this.renderWorkerGate.setErrorHandler(d=>this.drawSeriesLayerFallback(d)),this.renderWorkerGate.start()}init(){var u,f,p,g,m;const{series:t,data:n,labels:i,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,i),this.minMax=this.getStoreMinMax(),this.initRect(),this.axesX=this.createAxes("x",a),this.axesY=this.createAxes("y",r),((f=(u=a==null?void 0:a[0])==null?void 0:u.scrollbar)!=null&&f.use||(g=(p=r==null?void 0:r[0])==null?void 0:p.scrollbar)!=null&&g.use)&&this.initScrollbar(),this.initDefaultSelectInfo(),this.drawChart(),c.use&&!this.isInitTooltip&&this.createTooltipDOM(),(m=this.createEventFunctions)==null||m.call(this),this.isInit=!0}_updateSeriesCount(){this.seriesInfo.count=Object.values(this.seriesList).filter(t=>t.show).length}initRect(){const t=this.options;t.title.show&&(this.isInitTitle||this.initTitle(),this.showTitle()),t.legend.show&&!t.legend.external?(this.isInitLegend||this.initLegend(),this.setLegendPosition()):t.legend.show&&t.legend.external&&this._updateSeriesCount(),this.chartRect=this.getChartRect()}drawSyncedIndicator({horizontal:t,label:n,mousePosition:i}){this.drawSyncedIndicator({horizontal:t,label:n,mousePosition:i})}adjustXAndYAxisWidth(){var i,s,l,a;const t=(r,c,d)=>{const{interval:h,graphMin:u,graphMax:f,steps:p=0,minIndex:g,maxIndex:m,indexInterval:y}=r??{};let C=[];if((d==null?void 0:d.type)==="step"&&g!==void 0&&m!==void 0&&y!==void 0){const{labels:b}=this.data,w=c==="x"?(b==null?void 0:b.x)??b??[]:(b==null?void 0:b.y)??b??[];C=[];for(let T=g;T<=m;T+=y)w[T]!==void 0&&C.push(w[T])}else if(h)C=Array.from({length:p},(b,w)=>u+w*h),C.push(f);else{const{labels:b}=this.data;C=c==="x"?(b==null?void 0:b.x)??b??[]:(b==null?void 0:b.y)??b??[]}return C},n={x:(s=(i=this.axesRange)==null?void 0:i.x)==null?void 0:s.map((r,c)=>{var y,C,b,w;const d=this.axesX[c],h=(y=this.axesSteps)==null?void 0:y.x[c],u=t(h,"x",d),f=Re((C=d==null?void 0:d.labelStyle)==null?void 0:C.fixWidth)?d.labelStyle.fixWidth:0;let p=[];const g=(b=this.axesSteps)==null?void 0:b.x[c];if((d==null?void 0:d.type)==="linear"&&g!=null){const{graphMin:T,graphMax:k}=g;if(typeof T=="number"&&typeof k=="number"){const M=Math.abs(T)>=Math.abs(k)?T:k;p=[PS(M)]}}const m=((w=d==null?void 0:d.getLabelWidthHasMaxLength)==null?void 0:w.call(d,u,this.chartRect,p))??0;return{...r,size:{width:f||Math.max(m,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,m,y;const d=this.axesY[c],h=(g=this.axesSteps)==null?void 0:g.y[c],u=t(h,"y",d),f=Re((m=d==null?void 0:d.labelStyle)==null?void 0:m.fixWidth)?d.labelStyle.fixWidth:0,p=((y=d==null?void 0:d.getLabelWidthHasMaxLength)==null?void 0:y.call(d,u,this.chartRect))??0;return{...r,size:{width:f||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()}computeAxesScaleChange(){var r;if(typeof((r=this.listeners)==null?void 0:r["axes-scale-change"])!="function")return null;const t=this._lastEmittedAxesRange,n=this.labelRange,i=(c,d)=>(c==null?void 0:c.min)===(d==null?void 0:d.min)&&(c==null?void 0:c.max)===(d==null?void 0:d.max),s=({min:c,max:d})=>({minSteps:c,maxSteps:d}),l=n.x.every((c,d)=>{var u;return!!!((u=this.options.axesX[d])!=null&&u.scaleChange)||!!t&&i(c,t.x[d])}),a=n.y.every((c,d)=>{var u;return!!!((u=this.options.axesY[d])!=null&&u.scaleChange)||!!t&&i(c,t.y[d])});return l&&a?null:(this._lastEmittedAxesRange=n,{x:n.x.map(s),y:n.y.map(s)})}emitDataMaxChange(){var i;const t=(i=this.listeners)==null?void 0:i["axes-data-max-change"];if(typeof t!="function")return;let n=-1/0;Object.values(this.seriesList).forEach(s=>{if(!(s!=null&&s.show)||!s.minMax)return;const l=s.minMax.maxY;Number.isFinite(l)&&l>n&&(n=l)}),t(Number.isFinite(n)?n:null)}prepareScale(){this.axesRange=this.getAxesRange(),this.labelOffset=this.getLabelOffset(),this.labelRange=this.getAxesLabelRange();const t=this.labelOffset;return this.axesSteps=this.calculateSteps(),this.adjustXAndYAxisWidth(),{scaleChange:this.computeAxesScaleChange(),scrollbarLabelOffset:t}}drawChart(t,n){var l,a,r,c,d,h;this.renderEpoch+=1,this.initScale();const{scaleChange:i,scrollbarLabelOffset:s}=this.prepareScale();this.computeScaleVersion(),((a=(l=this.scrollbar)==null?void 0:l.x)!=null&&a.use||(c=(r=this.scrollbar)==null?void 0:r.y)!=null&&c.use)&&this.updateScrollbarPosition(s),i&&typeof((d=this.listeners)==null?void 0:d["axes-scale-change"])=="function"&&this.listeners["axes-scale-change"](i),this.emitDataMaxChange(),!(!n&&this.tryDrawSeriesOnWorker(t))&&((h=this.options.realTimeScatter)!=null&&h.use?this.drawAxisAndSeries(t):(this.drawStaticLayer(this.bufferCtx,t),this.drawSeriesLayer(this.bufferCtx,t),this.shouldDrawSelectedOnTop(t)&&this.drawSelectedSeriesOnly()),this.drawSeriesOverlay(),this.drawTip(),this.commitToDisplay(this.displayCtx,this.bufferCanvas))}tryDrawSeriesOnWorker(t){var r;if(!((r=this.renderWorkerGate)!=null&&r.canAcceptRender())||!this.canRenderSeriesOnWorker(t).ok)return!1;const n=this.renderEpoch,i=WC(this,n),{columns:s,transferList:l}=ZC(i);return this.drawStaticLayer(this.bufferCtx,t),this.computeSeriesGeometry(),this.renderWorkerGate.render(i,s,l)?this.drawSeriesOverlay():(this.drawSeriesLayer(this.bufferCtx,t),this.drawSeriesOverlay(),this.drawTip(),this.commitToDisplay(this.displayCtx,this.bufferCanvas)),!0}canRenderSeriesOnWorker(t){var a;if(t||this.lastHitInfo)return{ok:!1,reason:"hit-info"};const n=((a=this.seriesInfo)==null?void 0:a.charts)??{},i={line:!0,bar:!0,heatMap:!0},s=Object.keys(n).find(r=>!i[r]&&(n[r]??[]).some(c=>{var d;return((d=this.seriesList[c])==null?void 0:d.show)!==!1}));return s?{ok:!1,reason:`unsupported-type:${s}`}:(n.bar??[]).some(r=>{const c=this.seriesList[r];return(c==null?void 0:c.show)!==!1&&(c==null?void 0:c.timeMode)})?{ok:!1,reason:"time-bar"}:{ok:!0}}commitWorkerFrame(t){const n=t==null?void 0:t.bitmap;if(!n)return;if(t.epoch!==this.renderEpoch){n.close();return}const i=this.displayCtx;this.commitToDisplay(i,this.bufferCanvas),i.drawImage(n,0,0),n.close(),i.save(),i.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0),this.drawTip(i),i.restore()}drawSeriesLayerFallback(t){t&&t.epoch!==this.renderEpoch||(this.drawSeriesLayer(this.bufferCtx,void 0),this.commitToDisplay(this.displayCtx,this.bufferCanvas))}commitToDisplay(t,n){if(this.displayCanvas){const i=this.pixelRatio<1?this.pixelRatio:1;t.clearRect(0,0,this.displayCanvas.width/i,this.displayCanvas.height/i)}n&&(n==null?void 0:n.width)>1&&(n==null?void 0:n.height)>1&&t.drawImage(n,0,0),this._blitPrev=this.snapshotBlitState()}drawAxisAndSeries(t){const n=this.evaluateBlitGate(t),i=typeof window<"u"&&window.__EVUI_BLIT_FORCE_OFF__===!0,s=typeof window<"u"?window.__EVUI_BLIT_REFRESH_INTERVAL__:void 0,l=Number.isFinite(s)?s:this._blitRefreshInterval||AC,a=n.ok&&!i&&this.pointsLayerValid&&this.pointsLayersSized()&&this._framesSinceFullRedraw<l,r={blockedByForceOff:i,blockedByLayerInvalid:!this.pointsLayerValid,blockedByLayerUnsized:!this.pointsLayersSized(),blockedByRefreshDue:this._framesSinceFullRedraw>=l};let c=!1;if(a&&(c=this.drawChartBlitFastPath(t,n)),this.recordBlitDiag(n,c,r),c)this._framesSinceFullRedraw++,this._pointsLayerStamp=this.computePointsLayerStamp(),this._pointsLayerOptionsRef=this.options,this._hitCoordsDirty=!0;else{this.drawStaticLayer(this.bufferCtx,t);let d=!1,h=!1;!i&&this.canRouteFallbackViaLayer(t)?(d=this.maybeRebuildPointsLayer(r.blockedByRefreshDue),this.pointsLayerValid?this.compositePointsLayer(this.getPointsLayers().src,this.getMaxVisibleScatterPointSize()):(this.drawSeriesLayer(this.bufferCtx,t),h=!0)):(this.drawSeriesLayer(this.bufferCtx,t),d=this.maybeRebuildPointsLayer(!1),h=!(t!=null&&t.legend)),(d||h)&&(this._hitCoordsDirty=!1),d&&(this._framesSinceFullRedraw=0,this._blitCarry=0)}}collectDuplicatePoints(t,n){var s,l,a;const i=!!this.options.seriesReverse;for(let r=i?n.length-1:0;i?r>=0:r<n.length;i?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 u=0;u<h.length;u++){const f=((a=h[u])==null?void 0:a.data)||[];for(let p=0;p<f.length;p++){const g=f[p];t.set(g.k??A.coordinateKey(g.x,g.y),c.sId)}}}else{const h=this.data.data[n[r]]??[];for(let u=0;u<h.length;u++){const f=h[u];t.set(A.coordinateKey(f.x,f.y),c.sId)}}}}canSkipRealtimeScatterDedupe(t){var i,s;if(!((i=this.options.realTimeScatter)!=null&&i.use))return!1;let n=0;for(let l=0;l<t.length;l++)if((s=this.seriesList[t[l]])!=null&&s.show&&(n++,n>1))return!1;return n===1}computeScaleVersion(){var r,c;const t=this.chartRect??{},n=this.labelOffset??{},i=this.options??{},s=((r=this.axesSteps)==null?void 0:r.x)??[],l=((c=this.axesSteps)==null?void 0:c.y)??[];let a=`${t.x1},${t.x2},${t.y1},${t.y2},${t.chartWidth},${t.chartHeight}|${n.left},${n.right},${n.top},${n.bottom}|${this.pixelRatio}|${i.horizontal?1:0}|${i.thickness},${i.cPadRatio},${i.borderRadius}|`;for(let d=0;d<s.length;d++){const h=s[d];a+=`${h==null?void 0:h.graphMin}:${h==null?void 0:h.graphMax}:${h==null?void 0:h.minIndex}:${h==null?void 0:h.maxIndex}:${h==null?void 0:h.oriSteps};`}a+="|";for(let d=0;d<l.length;d++){const h=l[d];a+=`${h==null?void 0:h.graphMin}:${h==null?void 0:h.graphMax}:${h==null?void 0:h.minIndex}:${h==null?void 0:h.maxIndex}:${h==null?void 0:h.oriSteps};`}a!==this._scaleKey&&(this._scaleKey=a,this._scaleVersion=(this._scaleVersion??0)+1)}computeSeriesGeometry(){const t={chartRect:this.chartRect,labelOffset:this.labelOffset,axesSteps:this.axesSteps,isHorizontal:this.options.horizontal,dataEpoch:this._dataEpoch,scaleVersion:this._scaleVersion};let n=0;this.seriesInfo.charts.bar.forEach(r=>{var c;(c=this.seriesList[r])!=null&&c.show&&n++}),["line","heatMap"].forEach(r=>{this.seriesInfo.charts[r].forEach(c=>{var d,h;(h=(d=this.seriesList[c])==null?void 0:d.computeGeometry)==null||h.call(d,t)})});const{thickness:i,cPadRatio:s,borderRadius:l}=this.options;let a=0;this.seriesInfo.charts.bar.forEach(r=>{var d;const c=this.seriesList[r];c&&((d=c.computeGeometry)==null||d.call(c,{...t,thickness:i,cPadRatio:s,borderRadius:l,showSeriesCount:n,showIndex:a}),c.show&&a++)})}drawSeriesLayer(t,n){var m;const{maxTip:i,selectLabel:s,selectItem:l,selectSeries:a,brush:r,displayOverflow:c,unSelectedOpacity:d}=this.options,h={ctx:t,chartRect:this.chartRect,labelOffset:this.labelOffset,axesSteps:this.axesSteps,maxTipOpt:{background:i.background,color:i.color},selectLabel:{option:s,selected:this.defaultSelectInfo},selectSeries:{option:a,selected:this.defaultSelectInfo},selectItem:{option:l,selected:this.defaultSelectItemInfo},isBrush:!!r,displayOverflow:c,unSelectedOpacity:d,isHorizontal:this.options.horizontal,dataEpoch:this._dataEpoch,scaleVersion:this._scaleVersion};let u=0,f=0;this.seriesInfo.charts.bar.forEach(y=>{this.seriesList[y].show&&f++});const p=new Map,g=Object.keys(this.seriesInfo.charts);for(let y=0;y<g.length;y++){const C=g[y],b=this.seriesInfo.charts[C];let w=!1;C==="scatter"&&(w=this.options.coordinateDedupe!==!1&&!this.canSkipRealtimeScatterDedupe(b),w&&this.collectDuplicatePoints(p,b));for(let T=0;T<b.length;T++){let k=this.seriesList[b[T]];switch(C){case"line":{const M=n==null?void 0:n.legend;k.draw({legendHitInfo:M,...h});break}case"heatMap":{const M=n==null?void 0:n.legend;k.draw({legendHitInfo:M,...h});break}case"bar":{const M=n==null?void 0:n.legend,{thickness:Z,cPadRatio:S,borderRadius:x}=this.options;k.draw({thickness:Z,cPadRatio:S,borderRadius:x,showSeriesCount:f,showIndex:u,legendHitInfo:M,...h}),k.show&&u++;break}case"pie":{const M=this.lastHitInfo??{sId:(m=this.defaultSelectItemInfo)==null?void 0:m.seriesID},Z=n==null?void 0:n.legend;this.options.sunburst?this.drawSunburst({selectInfo:M,legendHitInfo:Z,unSelectedOpacity:h.unSelectedOpacity},t):this.drawPie({selectInfo:M,legendHitInfo:Z,unSelectedOpacity:h.unSelectedOpacity},t),this.options.doughnutHoleSize>0&&this.drawDoughnutHole(t);break}case"scatter":{const M=n==null?void 0:n.legend;let Z;if(l.use&&l.useSeriesOpacity){const S=this.lastHitInfo,x=this.defaultSelectItemInfo;S!=null&&S.dataIndex||(S==null?void 0:S.dataIndex)===0?Z={seriesID:S.sId,dataIndex:S.dataIndex}:x!=null&&x.dataIndex||(x==null?void 0:x.dataIndex)===0?Z={...x}:Z=null}this.options.seriesReverse&&(k=this.seriesList[b.at(-1-T)]),k.draw({legendHitInfo:M,selectInfo:Z,duple:p,coordinateDedupe:w,...h});break}}}}}drawSeriesOverlay(){var s,l;const t=this.overlayCtx;if(!t)return;const n={overlayCtx:t,chartRect:this.chartRect,labelOffset:this.labelOffset,axesSteps:this.axesSteps},i=this.seriesInfo.charts.heatMap;for(let a=0;a<i.length;a++)(l=(s=this.seriesList[i[a]])==null?void 0:s.drawOverlay)==null||l.call(s,n)}drawTip(t){var i;let n;this.lastHitInfo?n=this.lastHitInfo:this.defaultSelectItemInfo?n=this.getItem(this.defaultSelectItemInfo,!1):this.defaultSelectInfo&&this.options.selectLabel.use?n=this.getItem(this.defaultSelectInfo,!1):n=null,(i=this.drawTips)==null||i.call(this,n,t)}createAxes(t,n=[]){const i=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 oC(t,r,i,a);case"time":return r.categoryMode?new rC(t,r,i,l,a):new sC(t,r,i,a);case"log":return new lC(t,r,i);case"step":return new aC(t,r,i,l,a);default:return!1}})}getAxesRange(){const t=this.axesX.map((i,s)=>i.calculateScaleRange(this.minMax.x[s],this.scrollbar.x,this.chartRect)),n=this.axesY.map((i,s)=>i.calculateScaleRange(this.minMax.y[s],this.scrollbar.y,this.chartRect));return{x:t,y:n}}drawStaticLayer(t,n){this.axesX.forEach((i,s)=>{i.ctx=t,i.draw(this.chartRect,this.labelOffset,this.axesSteps.x[s],n,this.defaultSelectInfo,this.data.labels)}),this.axesY.forEach((i,s)=>{i.ctx=t,i.draw(this.chartRect,this.labelOffset,this.axesSteps.y[s],n,this.defaultSelectInfo)})}calculateSteps(){const t=this.axesX.map((i,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 i.calculateSteps(l)}),n=this.axesY.map((i,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 i.calculateSteps(l)});return{x:t,y:n}}getAxesLabelRange(){const t=this.axesX.map((i,s)=>{const l=this.axesRange.x[s].size;return i.calculateLabelRange("x",this.chartRect,this.labelOffset,l.width)}),n=this.axesY.map((i,s)=>{const l=this.axesRange.y[s].size;return i.calculateLabelRange("y",this.chartRect,this.labelOffset,l.height)});return{x:t,y:n}}computePixelRatio(){const t=window.devicePixelRatio||1,n=this.displayCtx.webkitBackingStorePixelRatio||this.displayCtx.mozBackingStorePixelRatio||this.displayCtx.msBackingStorePixelRatio||this.displayCtx.oBackingStorePixelRatio||this.displayCtx.backingStorePixelRatio||1;return t/n}prepareLayout(t){this.pixelRatio=t,this.oldPixelRatio!==this.pixelRatio&&(this.oldPixelRatio=this.pixelRatio),this.bufferCtx.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}initScale(){const t=this.computePixelRatio();this.prepareLayout(t),this.overlayCtx&&this.overlayCtx.setTransform(t,0,0,t,0,0)}getChartDOMRect(){var s;const t=(s=this.chartDOM)==null?void 0:s.getBoundingClientRect(),n=(t==null?void 0:t.width)||10,i=(t==null?void 0:t.height)||10;return this.setWidth(n),this.setHeight(i),{width:n,height:i}}getOverlayClientRect(){return!this.cachedOverlayRect&&this.overlayCanvas&&(this.cachedOverlayRect=this.overlayCanvas.getBoundingClientRect()),this.cachedOverlayRect}getChartDOMClientRect(){return!this.cachedChartDOMRect&&this.chartDOM&&(this.cachedChartDOMRect=this.chartDOM.getBoundingClientRect()),this.cachedChartDOMRect}invalidateClientRectCache(){this.cachedOverlayRect=null,this.cachedChartDOMRect=null}getChartRect(){var k,M,Z,S;const{width:t,height:n}=this.getChartDOMRect(),i=this.options.padding,s=(M=(k=this.options.axesX)==null?void 0:k[0])==null?void 0:M.title,l=(S=(Z=this.options.axesY)==null?void 0:Z[0])==null?void 0:S.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 u=0;d!=null&&d.use&&(u=d==null?void 0:d.height);let f=0;h!=null&&h.use&&(f=h==null?void 0:h.width);const p=i.left+i.right+f,g=i.top+i.bottom+r+c+u,m=t>p?t-p:t,y=n>g?n-g:n,C=i.left,b=Math.max(t-i.right-f,C+2),w=i.top+c,T=Math.max(n-i.bottom-r-u,w+2);return{x1:C,x2:b,y1:w,y2:T,chartWidth:m,chartHeight:y,width:t,height:n}}setWidth(t){if(!this.displayCanvas)return;const n=t*this.pixelRatio;if(this._deviceWidth!==n&&(this._deviceWidth=n,this.displayCanvas.width=n,this.displayCanvas.style.width=`${t}px`,this.bufferCanvas.width=n,this.bufferCanvas.style.width=`${t}px`,this.overlayCanvas&&(this.overlayCanvas.width=n,this.overlayCanvas.style.width=`${t}px`),this.pointsLayerA)){const i=Math.floor(t*this.pixelRatio);this.pointsLayerA.width!==i&&(this.pointsLayerA.width=i,this.pointsLayerB.width=i,this.pointsLayerValid=!1)}}setHeight(t){if(!this.displayCanvas)return;const n=t*this.pixelRatio;if(this._deviceHeight!==n&&(this._deviceHeight=n,this.displayCanvas.height=n,this.displayCanvas.style.height=`${t}px`,this.bufferCanvas.height=n,this.bufferCanvas.style.height=`${t}px`,this.overlayCanvas&&(this.overlayCanvas.height=n,this.overlayCanvas.style.height=`${t}px`),this.pointsLayerA)){const i=Math.floor(t*this.pixelRatio);this.pointsLayerA.height!==i&&(this.pointsLayerA.height=i,this.pointsLayerB.height=i,this.pointsLayerValid=!1)}}getLabelOffset(t=null){const n=this.axesX,i=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 u;(u=d.labelStyle)!=null&&u.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)}),i.forEach((d,h)=>{var u;(u=d.labelStyle)!=null&&u.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}updateScrollbar(t,n){var c,d,h,u,f,p,g,m,y,C;const i=n||t,s=((h=(d=(c=this.options.axesX)==null?void 0:c[0])==null?void 0:d.scrollbar)==null?void 0:h.use)??!1,l=((p=(f=(u=this.options.axesY)==null?void 0:u[0])==null?void 0:f.scrollbar)==null?void 0:p.use)??!1,a=((m=(g=this.scrollbar)==null?void 0:g.x)==null?void 0:m.use)??!1,r=((C=(y=this.scrollbar)==null?void 0:y.y)==null?void 0:C.use)??!1;(s!==a||s||i&&s)&&this.updateScrollbarInfo("x",t),(l!==r||l||i&&l)&&this.updateScrollbarInfo("y",t)}update(t){var y,C,b,w,T,k,M;const n=this.options,i=this.data.data,s=this.data.labels,l=this.data.groups,a=this.data.series,{updateSeries:r,updateSelTip:c,updateLegend:d,updateData:h,updateTooltip:u,lightUpdate:f,updateByScrollbar:p}=t;if(!this.isInit)return;if((h||r)&&(this._lastHoverSig=""),this.updateScrollbar(h,p),this.resetProps(),this.updateSeries=r,r&&(this.pointsLayerValid=!1),(y=this.options.realTimeScatter)!=null&&y.use&&!this.pointsLayerA&&this.createPointsLayers(),r){const Z=this.seriesList;this.seriesInfo={charts:{pie:[],bar:[],line:[],scatter:[],heatMap:[]},count:0},this.lastTip={pos:null,value:null},this.reconcileSeriesSet(a,n.type,n.horizontal,l,Z),this.legendDOM&&!n.legend.external&&this.updateLegend()}if(c.update&&(this.lastTip.value=null,c.keepDomain||(this.lastTip.pos=null,this.lastHitInfo=null)),!f)if(l.length&&this.addGroupInfo(l),(C=this.options.realTimeScatter)!=null&&C.use?(this.dataSet||(this.dataSet={}),this.createRealTimeScatterDataSet(i)):this.createDataSet(i,s),n.title.show?(this.isInitTitle?this.updateTitle():this.initTitle(),this.showTitle()):this.isInitTitle&&this.hideTitle(),n.legend.show&&!n.legend.external){const Z=!!((w=(b=n.legend)==null?void 0:b.table)!=null&&w.use)&&n.type!=="heatMap"&&n.type!=="scatter";this.isInitLegend?r?this.updateLegend():d?this.forceUpdateLegend():Z&&h&&this.updateLegendTableValues():this.initLegend(),this.setLegendPosition(),this.updateLegendContainerSize(),this.showLegend()}else n.legend.show&&n.legend.external?(r||h)&&(this._updateSeriesCount(),this.emitLegendData()):this.isInitLegend&&this.hideLegend();u&&(this.isInitTooltip||this.createTooltipDOM(),this.tooltipDOM.innerHTML="",(k=(T=n.tooltip)==null?void 0:T.formatter)!=null&&k.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)&&((M=this.legendHover)!=null&&M.sId)&&(g={...g||{},legend:this.legendHover}),this.render(g),this.dragInfo&&this.drawSelectionArea?this.drawSelectionArea(this.dragInfo):this.dragInfoBackup&&(f?this.drawSelectionArea(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.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,i,s,l,a,r,c;this.invalidateClientRectCache(),this.clear(),this.bufferCtx.restore(),this.bufferCtx.save(),this.pointsLayerValid=!1,((s=(i=(n=this.options.axesX)==null?void 0:n[0])==null?void 0:i.scrollbar)!=null&&s.use||(r=(a=(l=this.options.axesY)==null?void 0:l[0])==null?void 0:a.scrollbar)!=null&&r.use)&&this.initScrollbar(),this.initRect(),this.initScale(),this.chartRect=this.getChartRect(),this.drawChart(void 0,!0),this.dragInfoBackup&&((c=this.drawSelectionArea)==null||c.call(this,this.dragInfoBackup)),t&&t(!0)}render(t){this.isInit&&(this.invalidateClientRectCache(),this._vsDetectFailed=!1,this.clear(),this.chartRect=this.getChartRect(),this.drawChart(t))}_getLegendSeries(){var n;const t=(n=this.data.groups)==null?void 0:n.at(0);return t?t.filter(i=>{var s;return(s=this.seriesList[i])==null?void 0:s.showLegend}).map(i=>[i,this.seriesList[i]]):Object.entries(this.seriesList).filter(([,i])=>i.showLegend)}_seriesToLegendItem(t){const n=typeof t.color!="string"?t.color[t.color.length-1][1]:t.color;return{sId:t.sId,name:t.name,color:n,type:t.type,show:t.show,fill:t.fill,fillColor:t.fillColor}}buildLegendData(){return this._getLegendSeries().map(([,t])=>this._seriesToLegendItem(t))}emitLegendData(){typeof this.listeners["update:legendData"]=="function"&&this.listeners["update:legendData"](this.buildLegendData())}toggleSeries(t){var d;const n=this.seriesList[t];if(!n)return;const i=this.options.legend,s=this._getLegendSeries();if(i.clickMode==="active")s.every(([,f])=>f.show)?(s.forEach(([,f])=>{f.show=!1}),n.show=!0,this.seriesInfo.count=1):n.show?(n.show=!1,this.seriesInfo.count--):(n.show=!0,this.seriesInfo.count++),s.every(([,f])=>!f.show)&&(s.forEach(([,f])=>{f.show=!0}),this.seriesInfo.count=s.length);else{if(n.show&&this.seriesInfo.count===1)return;n.show?(n.show=!1,this.seriesInfo.count--):(n.show=!0,this.seriesInfo.count++)}if(this.brushSeries){const{chartIdx:h}=this.data,u=[...this.brushSeries.list];u[h]=this.seriesList,this.brushSeries.list=u,this.brushSeries.chartIdx=h}((d=this.options.eventBehavior)==null?void 0:d.legendClick)!=="emitOnly"&&this.update({updateSeries:!1,updateSelTip:{update:!0,keepDomain:!0}});const a=Object.values(this.seriesList).filter(h=>h.show).map(h=>h.sId),r=a.length===Object.values(this.seriesList).length,c={data:{seriesIds:r?[]:a,isActiveAll:r}};typeof this.listeners["click-legend"]=="function"&&this.listeners["click-legend"](c),this.options.legend.show&&this.options.legend.external&&this.emitLegendData()}highlightSeries(t){const n={sId:t,type:this.options.type};this.legendHover=n,this.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1},hitInfo:{legend:n},lightUpdate:!0})}unhighlightSeries(){this.legendHover=null,this.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1},hitInfo:{legend:null},lightUpdate:!0})}destroy(){if(!this.isInit)return;const t=this.target;for(this.options.legend.show&&!this.options.legend.external&&(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.invalidateRectOnScroll&&window.removeEventListener("scroll",this.invalidateRectOnScroll,{capture:!0})),this.isInitTooltip&&this.tooltipDestroy(),this.renderWorkerGate&&this.renderWorkerGate.destroy(),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:i}=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:[]}}i.use&&!this.defaultSelectInfo&&(this.defaultSelectInfo={seriesId:[]})}};Object.assign(ms.prototype,MC),Object.assign(ms.prototype,RC);const KC={name:"EvChartToolbar",props:{toolbar:{type:Object,default:()=>({})}},emits:["onClickToolbar"]},_C={class:"ev-chart-toolbar"},UC={class:"ev-chart-toolbar__icon"};function JC(e,t,n,i,s,l){const a=o.resolveComponent("ev-icon");return o.openBlock(),o.createElementBlock("div",_C,[o.createElementVNode("div",UC,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.$props.toolbar.items,(r,c)=>(o.openBlock(),o.createBlock(a,{key:`${c}-${r.icon}`,class:o.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 $r=de(KC,[["render",JC],["__scopeId","data-v-dfbffbab"]]);class jC{constructor(t,n,i,s,l,a,r){this.isExecuteZoom=l,this.evChartProps=t.props,this.evChartCloneData=n.data,this.brushIdx=a;const c=i.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 i=document.createElement("canvas");i.setAttribute("style","display: block;"),i.setAttribute("class","animation-canvas"),i.style.position="absolute",n.appendChild(i)}),t}setEventListener(t){const n=t?"addEventListener":"removeEventListener";this.isUseZoomMode=t,this.evChartDomContainers.forEach(i=>{i[n]("wheel",this.wrapWheelMoveZoomArea)})}wheelMoveZoomArea(t){t.preventDefault();const[n,i]=this.zoomAreaMemory.current[0];if(n===i)return;let s,l;if(t.deltaY>0){if(!n)return;s=n-1,l=i-1}else{if(i===this.cloneLabelsLastIdx)return;s=n+1,l=i+1}this.isUseToolbar=!0,this.executeZoom(s,l),this.zoomAreaMemory.current[0]=[s,l]}clickMoveZoomArea(t){if(!this.zoomAreaMemory[t].length)return;const[n,i]=this.zoomAreaMemory[t].pop();this.isUseToolbar=!0,this.executeZoom(n,i),this.setZoomAreaMemory(n,i,t==="previous"?"latest":"previous")}dragZoom({data:t,range:{dragSelectionInfo:n}}){const{dragXsp:i,dragXep:s,exceptAxesYChartWidth:l,chartTitle:a}=n,{options:r,data:c}=this.evChartProps,d=r.length>1?r.findIndex(h=>{var u;return(((u=h==null?void 0:h.title)==null?void 0:u.text)??"")===a}):0;if(r[d].axesX[0].type==="time"){const h=t[0].items,u=h[0].x,f=h[h.length-1].x,p=c[d].labels,g=this.evChartCloneData[d].labels,[m,y]=this.zoomAreaMemory.current[0];let C=g.findIndex(M=>+M.$d==+u.$d),b=g.findLastIndex(M=>+M.$d==+f.$d);const w=M=>l/(p.length-1)*(M-m);let T=w(C);if(C===b&&(T-i>=s-T?C-=1:b+=1),C===m&&b===y)return;C-b===-1&&(T=w(C));const k=w(b);this.evChartZoomOptions.useAnimation?this.dragZoomAnimation(n,C,b,T,k):(this.executeZoom(C,b),this.setZoomAreaMemory(C,b))}}dragZoomAnimation(t,n,i,s,l){const{chartRange:a,exceptAxesYChartWidth:r,exceptAxesXChartHeight:c}=t,d=window.devicePixelRatio||1,h=Array.from(this.evChartDomContainers).map(u=>{const f=u.querySelector(".animation-canvas");return[u.children[0],f]});for(let u=0;u<h.length;u++){const[f,p]=h[u],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(f,g,t,s,l).then(m=>{p.style.display="none",m&&u===h.length-1&&(this.isAnimationFinish=m,this.executeZoom(n,i),this.setZoomAreaMemory(n,i))})}}executeZoom(t,n){this.isExecuteZoom&&(this.isExecuteZoom.value=!0);for(let i=0;i<this.evChartCloneData.length;i++){const{data:s,labels:l,series:a}=this.evChartCloneData[i],r=this.evChartProps.data[i],c=Object.keys(a);for(let d=0;d<c.length;d++){const h=c[d];r.data[h]=s[h].filter((u,f)=>t<=f&&n>=f)}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 i=0;i<n.value.length;i++){const s=t.data[n.value[i]];s.labels.length&&(this.brushIdx.start=0,this.brushIdx.end=s.labels.length-1)}}updateEvChartCloneData(t,n,i,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(i),this.setBrushIdx(t,n)}setZoomAreaMemory(t,n,i){if(t<0||n<=0)return;const{previous:s,current:l,latest:a}=this.zoomAreaMemory,r=l.pop(),{bufferMemoryCnt:c}=this.evChartZoomOptions;i?(s.length>=c&&s.splice(0,s.length-c+1),this.zoomAreaMemory[i].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,i,s,l){const{chartRange:a,exceptAxesYChartWidth:r,exceptAxesXChartHeight:c}=i;let d=0,h=s,u=l-s,f=l,p=1;const g=.0015;let m=.5;const y=.1,C=.05,b=50,w=Math.ceil(b*(s/r)),T=Math.ceil(b*((r-l)/r)),k=M=>(n.clearRect(0,0,r,c),h<=0&&u>=r?(t.style.opacity="initial",M(!0)):(m>=y&&(t.style.opacity=m,m-=C),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,u,c),n.drawImage(t,a.x1+l,a.y1,r,c,f,0,r,c),p-=g,d-=w,h-=w,u+=w+T,f+=T,requestAnimationFrame(()=>k(M))));return new Promise(M=>k(M))}setIconStyle(t){const n=(i,s)=>{s?this.iconStyle(i,"enable"):this.iconStyle(i,"disable")};if(t&&this.dragZoomIcon.classList.contains("active")){const{previous:i,latest:s}=this.zoomAreaMemory;n(this.previousIcon,i.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[i,s]=n==="enable"?[1,"initial"]:[.5,"none"];t.style.opacity=i,t.style.pointerEvents=s}initZoom(){if(!this.isAnimationFinish)return;const[t,n]=this.zoomAreaMemory.current[0],i=this.cloneLabelsLastIdx;(t!==0||n!==i)&&(this.isUseToolbar=!0,this.executeZoom(0,i),this.setZoomAreaMemory(0,i))}}const QC={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",external:!1,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,displayOverflow:!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:!0,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,virtualScroll:{use:"auto",threshold:50,estimatedRowHeight:28,overscan:5}},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"},workerRender:!1,shallowDataWatch:!1,shallowOptionsWatch:!1},$C={series:{},groups:[],labels:[],data:{}},qC=e=>_g({...e},$C),e1=e=>e instanceof Date||e!==null&&typeof e=="object"&&typeof e.toDate=="function"&&typeof e.format=="function",Jo=e=>or(e,function t(n){if(e1(n))return n;if(o.isReactive(n))return or(o.toRaw(n),t)}),t1=()=>{let e=null;const t=200;return{clickEventCallback:s=>{e&&(clearTimeout(e),e=null),e=setTimeout(()=>{s(),e=null},t)},dblClickEventCallback:s=>{e&&(clearTimeout(e),e=null),s()}}},qr=(e,t)=>{var p;const n=o.getCurrentInstance(),{props:i,emit:s}=n,l=g=>{const m=He({},g,QC);return(g.type==="scatter"||g.type==="heatMap")&&!(g!=null&&g.tooltip)&&(m.tooltip.use=!1),g.type==="pie"&&!(g!=null&&g.padding)&&(m.padding={top:2,right:2,left:2,bottom:4}),m},a=qC,r=Ze(i.selectedItem),c=Ze(i.selectedLabel??(e==null?void 0:e.value)),d=Ze(i.selectedSeries),{clickEventCallback:h,dblClickEventCallback:u}=t1(),f={click:async g=>{await o.nextTick(),h(()=>{const{seriesId:m,dataIndex:y,eventTarget:C,targetAxis:b}=(g==null?void 0:g.selected)??{},{eventTarget:w}=(g==null?void 0:g.deselected)??{};switch(C){case"item":{m!==null?(s("update:selectedItem",{seriesID:m,dataIndex:y}),w==="label"&&s("update:selectedLabel",{dataIndex:[]})):s("update:selectedItem",null);break}case"label":{e!=null&&e.value?e.value.dataIndex=y:(s("update:selectedLabel",{dataIndex:y,targetAxis:b}),w==="item"&&s("update:selectedItem",null));break}case"series":{s("update:selectedSeries",{seriesId:m});break}}s("click",g)})},"dbl-click":async g=>{await o.nextTick(),u(()=>{const{eventTarget:m}=g;switch(m){case"series":{s("update:selectedSeries",{seriesId:g.seriesId?[g.seriesId]:[]});break}}s("dbl-click",g)})},"drag-select":async g=>{await o.nextTick(),s("drag-select",g)},"mouse-move":async g=>{t!=null&&t.value&&(t.value=g.hoveredLabel),await o.nextTick(),s("mouse-move",g)},"mouse-leave":()=>{t!=null&&t.value&&(t.value.label=null)},"click-legend":async g=>{await o.nextTick(),s("click-legend",g)},"update:legendData":async g=>{await o.nextTick(),s("update:legendData",g)},"axes-scale-change":g=>{s("axes-scale-change",g)}};return(p=n.vnode.props)!=null&&p.onAxesDataMaxChange&&(f["axes-data-max-change"]=g=>{s("axes-data-max-change",g)}),{eventListeners:f,selectItemInfo:r,selectLabelInfo:c,selectSeriesInfo:d,getNormalizedData:a,getNormalizedOptions:l}},ec=e=>{const t=o.ref(),n=o.computed(()=>{const i=s=>{let l;return s?l=s.unit?s.value+s.unit:`${s.value}px`:l=void 0,l};return{width:i(ra(e.width)),height:i(ra(e.height))}});return{wrapper:t,wrapperStyle:n}},tc=(e,{wrapper:t,evChartGroupRef:n},i,s)=>{const{props:l,emit:a}=o.getCurrentInstance(),r=o.ref(!1),c=o.ref(!1),d=o.ref(!0),h=o.ref(),u=o.reactive({zoom:e.zoom}),f=o.reactive({start:0,end:-1,isUseButton:!1,isUseScroll:!1});let p=null;const g=o.reactive({dom:[],props:{data:[],options:[]}}),m=o.reactive({data:null,options:null}),y=o.ref([]),C=x=>{x.data.length&&x.range&&c.value&&p.dragZoom(x)},b=()=>{g.props.options.forEach((x,I)=>{if(x.zoom={...x.zoom,use:c.value,getRangeInfo:C},c.value)x.dragSelection={...x.dragSelection,use:!0,keepDisplay:!1};else{const{use:L,keepDisplay:V}=m.options[I].dragSelection??{};x.dragSelection={use:!!L,keepDisplay:!!V}}})},w=()=>{if(n!=null&&n.value?(g.dom=n.value.querySelectorAll(".ev-chart-container"),g.dom.length&&s.value.forEach(({data:x,options:I},L)=>{x.chartIdx=L,g.props.data.push(x),g.props.options.push(I),y.value.push(L)})):(g.dom=[t.value.querySelector(".ev-chart-container")],g.props.data.push(l.data),g.props.options.push(l.options)),g.props.data.length){m.data=Ze(g.props.data),m.options=Ze(g.props.options);const x={updateZoomStartIdx:I=>a("update:zoomStartIdx",I),updateZoomEndIdx:I=>a("update:zoomEndIdx",I)};p=new jC(g,m,u,h.value,r,f,x)}},T=x=>{m.data[0].labels.length<=1||(c.value=!c.value,x?x.classList.toggle("active"):h.value.querySelector(".dragZoom").classList.toggle("active"),b(),p.setIconStyle(c.value),p.setEventListener(c.value))},k=(x,I)=>{if(p.isAnimationFinish)switch(I){case"dragZoom":T(x.target);break;case"reset":p.initZoom();break;case"previous":case"latest":p.clickMoveZoomArea(I);break}};o.onUpdated(()=>{p&&h.value&&p.setIcon(h.value)});const M=x=>{!_e(x.zoom,u.zoom)&&(u.zoom=x.zoom,p?(!u.zoom.toolbar.show&&c.value&&T(),p.setEvChartZoomOptions(u.zoom)):u.zoom.toolbar.show&&!n&&w())},Z=x=>{d.value?(r.value||(m.data=n?Jo(x):[Jo(x)],u.zoom.keepZoomStatus?d.value=!1:(c.value=!1,b()),p&&p.updateEvChartCloneData(m,y,c.value,u.zoom.keepZoomStatus)),r.value=!1):d.value=!0},S=(x,I)=>{if(p.isUseToolbar){p.isUseToolbar=!1;return}c.value&&(p.executeZoom(x,I),p.setZoomAreaMemory(x,I))};return o.watch(()=>[f.start,f.end],([x,I],[L])=>{if(i!=null&&i.value)if(typeof i.value.dataIndex=="number")x>=(L??0)?i.value.dataIndex-=x-(L??0):i.value.dataIndex+=L-x;else for(let V=0;V<i.value.dataIndex.length;V++)x>=(L??0)?i.value.dataIndex[V]-=x-(L??0):i.value.dataIndex[V]+=L-x;(f.isUseButton||f.isUseScroll)&&p.executeZoom(x,I)}),o.watch(()=>[f.isUseButton,f.isUseScroll],([x,I],[L,V])=>{L&&!x?p.setZoomAreaMemory(f.start,f.end):V&&!I&&(p.zoomAreaMemory.current[0]=[f.start,f.end])}),{evChartZoomOptions:u,evChartInfo:g,evChartToolbarRef:h,evChartClone:m,brushIdx:f,createEvChartZoom:w,setOptionsForUseZoom:M,setDataForUseZoom:Z,controlZoomIdx:S,onClickToolbar:k}},n1={name:"EvChart",components:{EvChartToolbar:$r},directives:{resize:En},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},legendData:{type:Array,default:()=>[]}},emits:["click","dbl-click","drag-select","mouse-move","update:selectedItem","update:selectedLabel","update:selectedSeries","update:zoomStartIdx","update:zoomEndIdx","update:realTimeScatterReset","click-legend","update:legendData","axes-scale-change","axes-data-max-change"],setup(e,{emit:t}){let n=null;const i=o.ref(!1),s=o.inject("isChartGroup",!1),l=o.inject("brushSeries",{list:[],chartIdx:null}),a=o.inject("groupSelectedLabel",null),r=o.inject("groupHoveredLabel",null),c=o.inject("brushIdx",{start:0,end:-1}),d=o.inject("evChartPropsInGroup",[]),h=o.inject("groupInteraction",null),{eventListeners:u,selectItemInfo:f,selectLabelInfo:p,selectSeriesInfo:g,getNormalizedData:m,getNormalizedOptions:y}=qr(a,r),C=m(e.data),b=y(e.options),w=o.computed(()=>e.selectedLabel),T=o.computed(()=>e.selectedItem),{wrapper:k,wrapperStyle:M}=ec(b),{evChartZoomOptions:Z,evChartToolbarRef:S,createEvChartZoom:x,setOptionsForUseZoom:I,setDataForUseZoom:L,controlZoomIdx:V,onClickToolbar:R}=s?{}:tc(b,{wrapper:k,evChartGroupRef:null},e.selectedLabel?w:T,d),E=()=>typeof performance<"u"?performance.now():Date.now();let G=null,v=null;const X=B=>{var ee;G?(B.updateSeries&&(G.updateSeries=!0),B.updateData&&(G.updateData=!0),B.updateLegend&&(G.updateLegend=!0),B.updateTooltip&&(G.updateTooltip=!0),(ee=B.updateSelTip)!=null&&ee.update&&(G.updateSelTip??(G.updateSelTip={}),G.updateSelTip.update=!0)):G={...B};const z=()=>{const te=((h==null?void 0:h.deferUntil)??0)-E();if(te>0){v=setTimeout(z,te);return}G&&n&&n.update(G),G=null,v=null};clearTimeout(v);const F=E(),Q=(h==null?void 0:h.deferUntil)??0,U=Q>F?Q-F:0;v=setTimeout(z,U)},W=()=>{var F;let B;b.selectLabel.use?B=p:b.selectSeries.use&&(B=g);const z=(F=e.options.realTimeScatter)!=null&&F.use?{...e.data,groups:[],labels:[]}:C;n=new ms(k.value,z,b,u,f,B,l)},N=()=>{n&&(n.init(),!s&&b.zoom.toolbar.show&&x(),b.legend.show&&b.legend.external&&n.emitLegendData())};o.watch(()=>e.options,B=>{var ee,j;const z=y(B),F=((j=(ee=n.options)==null?void 0:ee.legend)==null?void 0:j.show)??!1,Q=!_e(z.legend.table,n.options.legend.table),U=z.tooltip.use&&!_e(z.tooltip,n.options.tooltip);n.options=z,X({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1},updateLegend:Q,updateTooltip:U}),z.legend.show&&z.legend.external&&!F&&n.emitLegendData(),s||I(z)},{deep:!b.shallowOptionsWatch,flush:"post"}),o.watch(()=>e.data,B=>{var j,te;const z=(j=e.options.realTimeScatter)!=null&&j.use?{...B,groups:[],labels:[]}:m(B),F=!_e(z.series,n.data.series),Q=!_e(z.groups,n.data.groups),U=F||Q||e.options.type==="heatMap",ee=F||Q||!_e(z.labels,n.data.labels)||!_e(z.data,n.data.data);n.data=(te=e.options.realTimeScatter)!=null&&te.use?z:Jo(z),X({updateSeries:U,updateSelTip:{update:!0,keepDomain:!1},updateData:ee}),!s&&ee&&L(z)},{deep:!b.shallowDataWatch,flush:"post"}),s&&!(a!=null&&a.value)&&o.watch(()=>c.start,(B,z)=>{if(w!=null&&w.value)for(let F=0;F<w.value.dataIndex.length;F++)B>=(z??0)?w.value.dataIndex[F]-=B-(z??0):w.value.dataIndex[F]+=z-B;else T!=null&&T.value&&(B>=(z??0)?T.value.dataIndex-=B-(z??0):T.value.dataIndex+=z-B)}),o.watch(()=>T.value,B=>{const z=e.options.type;n.selectItemByData(B,z)},{deep:!0,flush:"post"}),o.watch(()=>(a==null?void 0:a.value)??w.value,B=>{B!=null&&B.dataIndex&&n.selectLabelByData(B.dataIndex,B==null?void 0:B.targetAxis)},{deep:!0,flush:"post"}),o.watch(()=>e.selectedSeries,B=>{var z;(z=b.selectSeries)!=null&&z.use?B.seriesId&&n.selectSeriesByData(B.seriesId):console.warn("[EVUI][Chart] selectSeries.use is false, so selectedSeries is not working")},{deep:!0,flush:"post"}),s||o.watch(()=>[e.zoomStartIdx,e.zoomEndIdx],([B,z])=>{V(B,z)}),o.watch(()=>e.realTimeScatterReset,B=>{B&&(Object.keys(n.dataSet??{}).forEach(z=>{n.dataSet[z]&&(n.dataSet[z].dataGroup=[])}),t("update:realTimeScatterReset",!1))}),o.watch(()=>{var B;return(B=e.options.realTimeScatter)==null?void 0:B.use},B=>{n.options.realTimeScatter.use=B??!1,n.update({updateSeries:!0,updateSelTip:{update:!1,keepDomain:!1},updateData:!1})}),o.watch(()=>r==null?void 0:r.value,B=>{B&&e.options.syncHover!==!1&&(B.label==null?n.overlayClear():n.drawSyncedIndicator(B))},{deep:!0,flush:"post"}),o.onMounted(async()=>{d!=null&&d.value&&d.value.push(e),await W(),await N(),i.value=!0}),o.onBeforeUnmount(()=>{var B;clearTimeout(v),G=null,v=null,n&&"destroy"in n&&n.destroy(),(B=d==null?void 0:d.value)!=null&&B.length&&(d.value.length=0),i.value=!1}),o.onDeactivated(()=>{n&&"hideTooltip"in n&&n.hideTooltip()});const P=B=>{n==null||n.toggleSeries(B)},D=B=>{n==null||n.highlightSeries(B)},O=()=>{n==null||n.unhighlightSeries()},Y=()=>{n&&"update"in n&&n.update({updateSeries:!0,updateSelTip:{update:!0,keepDomain:!1}})},H=es(()=>{n&&"resize"in n&&n.resize()},e.resizeTimeout);return o.onActivated(()=>{i.value&&H()}),{wrapper:k,wrapperStyle:M,onResize:H,redraw:Y,toggleSeries:P,highlightSeries:D,unhighlightSeries:O,evChartToolbarRef:S,injectIsChartGroup:s,onClickToolbar:R,normalizedOptions:b,zoomOptions:o.toRef(Z??{zoom:{}},"zoom")}}},i1={key:0,ref:"evChartToolbarRef"};function s1(e,t,n,i,s,l){var c;const a=o.resolveComponent("ev-chart-toolbar"),r=o.resolveDirective("resize");return o.openBlock(),o.createElementBlock(o.Fragment,null,[(c=i.zoomOptions.toolbar)!=null&&c.show&&!i.injectIsChartGroup?(o.openBlock(),o.createElementBlock("div",i1,[o.createVNode(a,{toolbar:i.zoomOptions.toolbar,onOnClickToolbar:i.onClickToolbar},null,8,["toolbar","onOnClickToolbar"])],512)):o.createCommentVNode("",!0),o.withDirectives(o.createElementVNode("div",{ref:"wrapper",style:o.normalizeStyle(i.wrapperStyle),class:"ev-chart"},null,4),[[r,i.onResize]])],64)}const bi=de(n1,[["render",s1]]);bi.install=e=>{e.component(bi.name,bi)};const o1={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"}}}}},l1=()=>{const e=o.ref(!1),t=o.ref(),n=o.ref([]),i=o.reactive({list:[],chartIdx:null});return{getNormalizedOptions:a=>He({},a,o1),isExecuteZoom:e,brushSeries:i,evChartGroupRef:t,evChartPropsInGroup:n,groupInteraction:{deferUntil:0}}},a1={name:"EvChartGroup",components:{evChartToolbar:$r},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:i,brushSeries:s,evChartGroupRef:l,evChartPropsInGroup:a,groupInteraction:r}=l1(),c=n(e.options);o.provide("isExecuteZoom",i),o.provide("isChartGroup",!0),o.provide("brushSeries",s),o.provide("evChartPropsInGroup",a),o.provide("groupInteraction",r);const d=2e3,h=800,u=()=>typeof performance<"u"?performance.now():Date.now(),f=(x=h)=>{const I=Number.isFinite(x)?Math.min(Math.max(x,0),d):h,L=u();r.deferUntil=Math.min(Math.max(r.deferUntil,L+I),L+d)};o.provide("deferPollingRedraw",f);const p=o.computed({get:()=>e.groupSelectedLabel,set:x=>t("update:groupSelectedLabel",x)});o.provide("groupSelectedLabel",p);const g=o.ref(null);o.provide("groupHoveredLabel",g),o.watch(()=>e.options.syncHover,x=>{x?g.value={label:"",horizontal:!1}:g.value=null},{immediate:!0});const{evChartZoomOptions:m,evChartInfo:y,evChartToolbarRef:C,evChartClone:b,brushIdx:w,createEvChartZoom:T,setOptionsForUseZoom:k,setDataForUseZoom:M,controlZoomIdx:Z,onClickToolbar:S}=tc(c,{wrapper:null,evChartGroupRef:l},p,a);return o.provide("evChartClone",b),o.provide("evChartInfo",y),o.provide("brushIdx",w),o.onMounted(()=>{T()}),o.watch(()=>y.props.data,x=>{M(x)},{deep:!0}),o.watch(()=>e.options,x=>{const I=n(x);k(I)},{deep:!0}),o.watch(()=>[e.zoomStartIdx,e.zoomEndIdx],([x,I])=>{w.isUseButton||w.isUseScroll||Z(x,I)}),{evChartGroupRef:l,evChartToolbarRef:C,zoomOptions:o.toRef(m,"zoom"),onClickToolbar:S,deferPollingRedraw:f}}},r1={key:0,ref:"evChartToolbarRef"},c1={ref:"evChartGroupRef",class:"ev-chart-group__wrapper"};function d1(e,t,n,i,s,l){const a=o.resolveComponent("ev-chart-toolbar");return o.openBlock(),o.createElementBlock(o.Fragment,null,[i.zoomOptions.toolbar.show?(o.openBlock(),o.createElementBlock("div",r1,[o.createVNode(a,{toolbar:i.zoomOptions.toolbar,onOnClickToolbar:i.onClickToolbar},null,8,["toolbar","onOnClickToolbar"])],512)):o.createCommentVNode("",!0),o.createElementVNode("div",c1,[o.renderSlot(e.$slots,"default",{},void 0,!0)],512)],64)}const yi=de(a1,[["render",d1],["__scopeId","data-v-dda98b9e"]]);yi.install=e=>{e.component(yi.name,yi)};const Me={WHEEL:{UP:"MOVEUP_WHEEL",DOWN:"MOVEDOWN_WHEEL"},GRAB:{UP:"MOVEUP_GRAB",DOWN:"MOVEDOWN_GRAB"},BUTTON:{INCREASE:"INCREASE",DECREASE:"DECREASE"}},Be={LEFT:"leftX",RIGHT:"rightX"};let h1=class{constructor(t,n,i,s,l){this.evChart=t,this.evChartBrushOptions=i,this.evChartBrushRef=l,this.evChartData=n,this.brushIdx=s,i.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 i=this.evChartBrushRef.value.querySelector(".brush-canvas");if(i)this.drawBrushRect({brushCanvas:i,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:i,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 u=this.setBrushXAndWidth(h,l,i,s);h&&u&&this.drawBrush(h,u,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,i,s){const{brushButtonWidth:l,brushCanvasWidth:a,axesXInterval:r,pixelRatio:c}=t;!i&&this.debounceBrushIdx&&(this.debounceBrushIdx.start=this.brushIdx.start,this.debounceBrushIdx.end=this.brushIdx.end);const d=this.debounceBrushIdx??this.brushIdx;switch(s){case Me.BUTTON.INCREASE:case Me.BUTTON.DECREASE:this.brushRectWidth=a*c,this.curBrushButtonType===Be.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===Be.RIGHT&&(this.brushRectWidth=n-this.beforeBrushRectX,this.brushRectWidth<=l?this.brushRectWidth=l:(this.brushRectX=this.beforeBrushRectX,this.beforeBrushRectWidth=this.brushRectWidth+this.brushRectX));break;case Me.GRAB.UP:case Me.GRAB.DOWN:this.brushRectX<=0&&s===Me.GRAB.DOWN||this.brushRectX+this.brushRectWidth>=a&&s===Me.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}const h=a*c;return s===Me.BUTTON.INCREASE||s===Me.BUTTON.DECREASE?(this.brushRectX<0&&(this.brushRectWidth+=this.brushRectX,this.brushRectX=0),this.brushRectX+this.brushRectWidth>h&&(this.brushRectWidth=h-this.brushRectX)):this.brushRectX<0?this.brushRectX=0:this.brushRectX+this.brushRectWidth>h&&(this.brushRectX=h-this.brushRectWidth),this.brushRectWidth>h&&(this.brushRectWidth=h),{brushRectX:this.brushRectX,brushRectWidth:this.brushRectWidth}}drawBrush(t,n,i,s){const{brushButtonWidth:l,brushCanvasHeight:a,brushCanvasWidth:r,axesXInterval:c,pixelRatio:d}=t,{brushRectX:h,brushRectWidth:u}=n,{height:f,selection:{fillColor:p,opacity:g}}=this.evChartBrushOptions.value,m=f-i.y1,y=h,C=h+u;s.style.position||(s.style.position="absolute",s.style.top=`${i.y1}px`,s.style.left=`${i.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 b=s.getContext("2d");b.clearRect(0,0,r*d,a*d),b.fillStyle=p,b.globalAlpha=g,b.fillRect(h,0,u,m),b.fillRect(y,0,l,m),b.fillRect(C-l,0,l,m),this.brushPosInfo={leftX:y/d,rightX:C/d,buttonWidth:l,axesXInterval:c,...t,...n}}getCanvasOffsetX(t){const n=this.brushCanvas.getBoundingClientRect();return t.clientX-n.left}addEvent(){let t;const n=l=>{if(this.isDragMode){const a=this.getCanvasOffsetX(l);this.mouseDownAndMove({offsetX:a})}};this.onDocumentMouseMove=ns(n,5),this.onDocumentMouseUp=()=>{document.removeEventListener("mousemove",this.onDocumentMouseMove),document.removeEventListener("mouseup",this.onDocumentMouseUp),this.initEventState()},this.onMouseDown=l=>{l.preventDefault(),t.isInsideButton?this.isDragMode="button":t.isInsideBrush?(this.clickBrushInsideX=l.offsetX,this.isDragMode="grab"):t.isOutsideBrush&&this.teleportBrush(l),this.isDragMode&&(document.addEventListener("mousemove",this.onDocumentMouseMove),document.addEventListener("mouseup",this.onDocumentMouseUp))};const i=l=>{this.isDragMode||(t=this.getMousePosition(l),this.changeCursor(t))};this.onMouseMove=ns(i,5),this.onWheel=l=>{l.preventDefault();const a=l.deltaY>0?Me.WHEEL.DOWN:Me.WHEEL.UP;this.updateBrushIdx(a),this.debounceBrushIdx&&this.drawBrushRect({brushCanvas:this.brushCanvas,isDebounce:!0,mode:a}),this.brushIdx.isUseScroll=!0},this.onMouseUp=()=>{this.initEventState()};const s=()=>{this.initEventState()};this.onWheelDebounce=es(s,100),this.setEventListener("addEventListener")}getMousePosition(t){const n=d=>Math.abs(this.brushPosInfo[d]-t.offsetX),i=n(Be.RIGHT)>n(Be.LEFT)?Be.LEFT:Be.RIGHT,s=d=>t.offsetX>this.brushPosInfo[d],l=d=>t.offsetX<this.brushPosInfo[d],a=l(Be.LEFT)||s(Be.RIGHT),r=s(Be.LEFT)&&l(Be.RIGHT),c=t.offsetX+this.brushPosInfo.buttonWidth>=this.brushPosInfo[i]&&t.offsetX-this.brushPosInfo.buttonWidth<=this.brushPosInfo[i];return this.curBrushButtonType=c&&i,{isInsideButton:c,isInsideBrush:r,isOutsideBrush:a}}destroy(){if(this.brushCanvas&&(this.setEventListener("removeEventListener"),document.removeEventListener("mousemove",this.onDocumentMouseMove),document.removeEventListener("mouseup",this.onDocumentMouseUp),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.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,i=(n.end-n.start)/2;let s,l,a;i>.5?(n.end-n.start)%2===0?(a=Math.round(t.offsetX/this.brushPosInfo.axesXInterval),s=Math.ceil(i),l=Math.floor(i)):(a=Math.ceil(t.offsetX/this.brushPosInfo.axesXInterval),s=Math.ceil(i),l=Math.floor(i)):(a=Math.floor(t.offsetX/this.brushPosInfo.axesXInterval),t.offsetX-a*this.brushPosInfo.axesXInterval>this.brushPosInfo.axesXInterval/2?(s=Math.floor(i),l=Math.ceil(i)):(s=Math.ceil(i),l=Math.floor(i),i<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 i;t.offsetX>this.beforeMouseXPos?this.isDragMode==="grab"?this.clickBrushInsideX<t.offsetX-n&&(i=Me.GRAB.UP,this.isUseBrushGrab=!0,this.brushIdx.isUseScroll=!0,this.clickBrushInsideX=t.offsetX+n):t.offsetX-this.brushPosInfo[this.curBrushButtonType]>n&&(i=this.curBrushButtonType===Be.LEFT?Me.BUTTON.DECREASE:Me.BUTTON.INCREASE,this.brushIdx.isUseButton=!0):t.offsetX<this.beforeMouseXPos&&(this.isDragMode==="grab"?this.clickBrushInsideX>t.offsetX+n&&(i=Me.GRAB.DOWN,this.isUseBrushGrab=!0,this.brushIdx.isUseScroll=!0,this.clickBrushInsideX=t.offsetX-n):this.brushPosInfo[this.curBrushButtonType]-t.offsetX>n&&(i=this.curBrushButtonType===Be.LEFT?Me.BUTTON.INCREASE:Me.BUTTON.DECREASE,this.brushIdx.isUseButton=!0)),this.debounceBrushIdx?this.drawBrushRect({brushCanvas:this.brushCanvas,isDebounce:!0,mode:i,offsetX:t.offsetX}):this.updateBrushIdx(i),this.beforeMouseXPos=t.offsetX}updateBrushIdx(t){const n=this.debounceBrushIdx??this.brushIdx;switch(t){case Me.WHEEL.UP:case Me.GRAB.UP:if(n.end>=this.labelEndIdx)return;n.start+=1,n.end+=1;break;case Me.WHEEL.DOWN:case Me.GRAB.DOWN:if(n.start<=0)return;n.start-=1,n.end-=1;break;case Me.BUTTON.INCREASE:if(this.curBrushButtonType===Be.LEFT){if(!n.start)return;n.start-=1}else{if(n.end===this.labelEndIdx)return;n.end+=1}break;case Me.BUTTON.DECREASE:if(n.start===n.end-1)return;this.curBrushButtonType===Be.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===Be.LEFT?(s=Math.round(s),l=this.brushIdx.end,s===l&&(s-=1)):this.curBrushButtonType===Be.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:i}=t();this.brushIdx.start===n&&this.brushIdx.end===i&&this.drawBrushRect({brushCanvas:this.brushCanvas}),this.brushIdx.start=n??this.debounceBrushIdx.start,this.brushIdx.end=i??this.debounceBrushIdx.end}initEventState(){if(this.isCleaningUp)return;this.isCleaningUp=!0,new Promise(n=>{this.updateBrushIdxUseXPos(),n(!0)}).then(n=>{n&&(this.clickBrushInsideX=null,this.isDragMode=null,this.beforeMouseXPos=null,this.curBrushButtonType=null,this.isUseBrushGrab=!1,this.offsetXAndRectXInterval=null,this.brushIdx.isUseButton=!1,this.brushIdx.isUseScroll=!1),this.isCleaningUp=!1})}};const u1={show:!0,useDebounce:!0,chartIdx:0,height:100,showLabel:!1,selection:{fillColor:"#38ACEC",opacity:.65},useWheelMove:!0},f1=()=>({getNormalizedBrushOptions:t=>He({},t,u1)}),m1={name:"EvChartBrush",directives:{resize:En},props:{options:{type:Object,default:()=>({})}},setup(e){let t=null,n=null;const i=o.ref(!1),s=o.inject("evChartClone",{data:[]}),l=o.inject("evChartInfo",{props:{options:[]}}),a=o.inject("brushIdx",{start:0,end:-1,isUseButton:!1,isUseScroll:!1}),r=o.inject("brushSeries",{list:[],chartIdx:null}),{getNormalizedBrushOptions:c}=f1(),d=o.computed(()=>c(e.options)),{eventListeners:h,selectItemInfo:u,selectLabelInfo:f,selectSeriesInfo:p,getNormalizedData:g,getNormalizedOptions:m}=qr(),y=o.computed(()=>g((s.data??[])[d.value.chartIdx])),C=o.computed(()=>{var L,V;const x=l.props.options[d.value.chartIdx],I={...x,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:[{...(L=x==null?void 0:x.axesX)==null?void 0:L[0],title:{use:!1}}],axesY:[{...(V=x==null?void 0:x.axesY)==null?void 0:V[0],title:{use:!1}}]};return m(I)}),{wrapper:b,wrapperStyle:w}=ec(C.value);o.watch(()=>r.list,()=>{b.value&&r.chartIdx===d.value.chartIdx&&(t.seriesList=r.list[d.value.chartIdx],t.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1}}))}),o.watch(C,(x,I)=>{var L;x.brush.chartIdx<=((L=s.data)==null?void 0:L.length)-1?n&&!_e(I.brush,x.brush)?n.removeBrushWrapper():t&&!_e(x,I)&&(t.options=Ze(x),t.update({updateSeries:!1,updateSelTip:{update:!1,keepDomain:!1}})):(t.data=Ze(y.value),t.update({updateSeries:!0,updateSelTip:{update:!1,keepDomain:!1},updateData:!1}),n.removeBrushCanvas())}),o.watch(()=>s.data,x=>{if(t){const I=x[d.value.chartIdx];if(I){const L=!_e(I.series,t.data.series),V=r.list[d.value.chartIdx];typeof V=="object"&&Object.keys(V).length&&Object.keys(I.series).forEach(R=>{var E;"show"in I.series[R]||(I.series[R].show=((E=V[R])==null?void 0:E.show)??!0)}),t.data=Ze(g(I)),t.update({updateSeries:L,updateSelTip:{update:!1,keepDomain:!1},updateData:!1})}}});const T=()=>{let x;C.value.selectLabel.use?x=f:C.value.selectSeries.use&&(x=p),t=new ms(b.value,y.value,C.value,h,u,x)},k=()=>{n=new h1(t,y,d,a,b)},M=()=>{t&&t.init()},Z=x=>{n&&n.init(x)};o.watch(()=>[a.start,a.end],()=>{var x;b.value&&d.value.chartIdx<=((x=s.data)==null?void 0:x.length)-1&&Z()}),o.onMounted(async()=>{d.value.show&&(await T(),await M(),k(),Z()),i.value=!0}),o.onUpdated(async()=>{var x;if(d.value.show&&d.value.chartIdx<=((x=s.data)==null?void 0:x.length)-1){const I=r.list[d.value.chartIdx];typeof I=="object"&&Object.keys(I).length&&Object.keys(y.value.series).forEach(L=>{var V;"show"in y.value.series[L]||(y.value.series[L].show=((V=I[L])==null?void 0:V.show)??!0)}),await T(),await M(),k(),Z()}}),o.onBeforeUnmount(()=>{t&&"destroy"in t&&t.destroy(),n&&n.destroy(),i.value=!1}),o.onDeactivated(()=>{t&&"hideTooltip"in t&&t.hideTooltip()});const S=es(()=>{t&&"resize"in t&&new Promise(I=>t.resize(I)).then(I=>{I&&Z(I)})},0);return o.onActivated(()=>{i.value&&S()}),{evChartBrushOptions:d,evChartBrushRef:b,evChartBrushStyle:w,onResize:S}}};function p1(e,t,n,i,s,l){const a=o.resolveDirective("resize");return i.evChartBrushOptions.show?o.withDirectives((o.openBlock(),o.createElementBlock("div",{key:0,ref:"evChartBrushRef",style:o.normalizeStyle(i.evChartBrushStyle),class:"ev-chart-brush"},null,4)),[[a,i.onResize]]):o.createCommentVNode("",!0)}const xi=de(m1,[["render",p1]]);xi.install=e=>{e.component(xi.name,xi)};const g1={name:"TreeGridNode",components:{GridOptionButton:zo},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=(b,w)=>{t("check-tree-data",b,w)},i=b=>{t("expand-tree-data",b)},s=(b,w)=>{t("click-tree-data",b,w)},l=(b,w)=>{t("dbl-click-tree-data",b,w)},a=b=>{t("context-menu",b)},r=b=>{const w=e.expandIcon?e.expandIcon:"",T=e.expandIcon?e.collapseIcon:"";return b.expand?T:w},c=o.computed(()=>e.nodeData||{}),d=o.computed(()=>e.parentIcon||"tree-parent-icon"),h=o.computed(()=>e.childIcon||"tree-child-icon"),u=o.computed(()=>d.value!=="none"||h.value!=="none"),f=o.computed(()=>{const b=e.orderedColumns||[],w=b.findIndex(k=>k.expandColumn&&!k.hide&&!k.hiddenDisplay);if(w!==-1)return w;const T=b.findIndex(k=>!k.hide&&!k.hiddenDisplay);return T!==-1?T:0}),p=b=>({row:!0,"tree-row":!0,[`tree-row--level-${b==null?void 0:b.level}`]:!0,highlight:(b==null?void 0:b.index)===e.highlightIndex,selected:b.selected,"non-border":!!e.borderStyle&&e.borderStyle!=="rows"}),g=o.computed(()=>({cell:!0,"row-checkbox":!0,"non-border":!!e.borderStyle}));return{parentIconMV:d,childIconMV:h,node:c,isDataIcon:u,checkboxClass:g,expandColumnIdx:f,onCheck:n,onExpand:i,onClick:s,onDblClick:l,onContextMenu:a,expandIconClasses:r,getRowClass:p,getColumnClass:(b,w)=>({cell:!0,"tree-td":w===0,[b.type]:b.type,[b.align]:b.align,[b.field]:b.field,"non-border":!!e.borderStyle}),getColumnStyle:(b,w)=>({width:`${b.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:b=>({"margin-left":`${b*13}px`})}}},b1=["data-index"],y1=["data-name","data-index"],x1={class:"td-content__wrapper"},S1=["title"],C1={class:"td-content"};function k1(e,t,n,i,s,l){var d;const a=o.resolveComponent("ev-checkbox"),r=o.resolveComponent("ev-icon"),c=o.resolveComponent("grid-option-button");return o.openBlock(),o.createElementBlock("tr",{"data-index":i.node.index,class:o.normalizeClass(i.getRowClass(i.node)),onClick:t[7]||(t[7]=h=>i.onClick(h,i.node)),onDblclick:t[8]||(t[8]=h=>i.onDblClick(h,i.node))},[n.useCheckbox.use?(o.openBlock(),o.createElementBlock("td",{key:0,class:o.normalizeClass(i.checkboxClass),style:o.normalizeStyle({width:`${n.minWidth}px`,height:`${n.rowHeight}px`,"border-right":"1px solid #CFCFCF"})},[o.createVNode(a,{modelValue:i.node.checked,"onUpdate:modelValue":t[0]||(t[0]=h=>i.node.checked=h),disabled:i.node.uncheckable,indeterminate:i.node.indeterminate,class:"row-checkbox-input",onChange:t[1]||(t[1]=h=>i.onCheck(h,i.node))},null,8,["modelValue","disabled","indeterminate"])],6)):o.createCommentVNode("",!0),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(n.orderedColumns,(h,u)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:u},[!h.hide&&!h.hiddenDisplay?(o.openBlock(),o.createElementBlock("td",{key:0,"data-name":h.field,"data-index":i.node.index,class:o.normalizeClass(i.getColumnClass(h,u)),style:o.normalizeStyle(i.getColumnStyle(h,u))},[o.createElementVNode("div",x1,[u===i.expandColumnIdx?(o.openBlock(),o.createElementBlock("span",{key:0,style:o.normalizeStyle(i.getDepthStyle(i.node.level))},null,4)):o.createCommentVNode("",!0),u===i.expandColumnIdx?(o.openBlock(),o.createElementBlock("span",{key:1,class:o.normalizeClass({expand:i.node.expand,"ev-tree-toggle":!0})},[i.node.hasChild?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[i.expandIconClasses(i.node)?(o.openBlock(),o.createBlock(r,{key:0,icon:i.expandIconClasses(i.node),style:{display:"block"},onClick:t[2]||(t[2]=f=>i.onExpand(i.node))},null,8,["icon"])):(o.openBlock(),o.createElementBlock("button",{key:1,class:"tree-expand-icon",onClick:t[3]||(t[3]=o.withModifiers(f=>i.onExpand(i.node),["stop"]))},[...t[9]||(t[9]=[o.createElementVNode("i",null,null,-1)])]))],64)):o.createCommentVNode("",!0)],2)):o.createCommentVNode("",!0),u===i.expandColumnIdx&&i.isDataIcon?(o.openBlock(),o.createElementBlock("span",{key:2,title:i.node[h.field],class:o.normalizeClass({expand:i.node.expand,"ev-tree-toggle":!0})},[o.createElementVNode("span",{class:o.normalizeClass(i.node.hasChild?i.parentIconMV:i.childIconMV)},[...t[10]||(t[10]=[o.createElementVNode("i",null,null,-1)])],2)],10,S1)):o.createCommentVNode("",!0),o.createElementVNode("div",C1,[e.$slots[h.field+"Node"]?o.renderSlot(e.$slots,h.field+"Node",{key:0,item:{data:i.node.data}},void 0,!0):o.createCommentVNode("",!0)])])],14,y1)):o.createCommentVNode("",!0)],64))),128)),(d=n.customContextMenu)!=null&&d.length?(o.openBlock(),o.createElementBlock("td",{key:1,class:o.normalizeClass({"row-contextmenu":!0,"non-border":!!n.borderStyle}),style:o.normalizeStyle({position:"sticky",right:0,width:"30px",height:`${n.rowHeight}px`,"min-width":"30px","line-height":`${n.rowHeight}px`})},[e.$slots.contextmenuIconNode?(o.openBlock(),o.createElementBlock("span",{key:0,class:"row-contextmenu__btn",onClick:[t[4]||(t[4]=h=>i.onContextMenu(h)),t[5]||(t[5]=o.withModifiers((...h)=>n.menuRef.show&&n.menuRef.show(...h),["prevent"]))]},[o.renderSlot(e.$slots,"contextmenuIconNode",{},void 0,!0)])):(o.openBlock(),o.createBlock(c,{key:1,icon:"ev-icon-warning2",class:"row-contextmenu__btn",onClick:[t[6]||(t[6]=h=>i.onContextMenu(h)),o.withModifiers(n.menuRef.show,["prevent"])]},null,8,["onClick"]))],6)):o.createCommentVNode("",!0)],42,b1)}const w1=de(g1,[["render",k1],["__scopeId","data-v-faab3696"]]),I1={name:"EvTreeGridToolbar"},L1={class:"tree-grid-toolbar"};function T1(e,t,n,i,s,l){return o.openBlock(),o.createElementBlock("div",L1,[o.renderSlot(e.$slots,"toolbarWrapper")])}const M1=de(I1,[["render",T1]]),R1=e=>{const{props:t}=o.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),u="Renderer";let f="";if(d.indexOf("_")!==-1){const p=d.split("_");for(let g=0;g<p.length;g++)f+=h(p[g])}else f=h(d);return f+u},getConvertValue:(d,h)=>{let u=d.type==="number"||d.type==="float"?Number(h):h;return d.type==="number"?(u=Qt(h),u=u===!1?h:u):d.type==="float"&&(u=u.toFixed(d.decimal??3).replace(/\B(?=(\d{3})+(?!\d))/g,",")),u},getColumnIndex:d=>t.columns.findIndex(h=>h.field===d),setPixelUnit:d=>{let h=d;const u=h.toString().indexOf("px")>=0,f=h.toString().indexOf("%")>=0;return!u&&!f&&(h=`${h}px`),h},checkHeader:d=>{n.isHeaderChecked=!!d.length&&d.every(u=>u.checked);const h=d.filter(u=>u.uncheckable);if(h.length){const u=d.filter(p=>p.checked),f=d.every(p=>h.includes(p));n.isHeaderChecked=!f&&h.length+u.length===d.length,n.isHeaderUncheckable=f}n.isHeaderIndeterminate=!!d.length&&d.some(u=>u.checked||u.indeterminate)&&!n.isHeaderChecked}}},ps=e=>{const{originColumns:t,filteredColumns:n}=e;return t.map(i=>{const s=n.find(l=>l.index===i.index)??{};return{...i,...s}})},v1=e=>{const{scrollInfo:t,stores:n,elementInfo:i,resizeInfo:s,pageInfo:l,summaryScroll:a,getPagingData:r,updatePagingInfo:c}=e,d=f=>{let p=n.showTreeStore;l.isClientPaging&&(p=r());const g=i.body;if(g){const m=s.rowHeight,y=g.clientHeight>m?Math.ceil(g.clientHeight/m):p.length,C=p.length*m;let b=Math.floor(g.scrollTop/m);b>p.length-1&&(b=0);const w=b+y+1,T=Math.max(b,0),k=w,M=i.table;n.viewStore=p.slice(T,k),t.hasVerticalScrollBar=y<p.length||g.clientHeight<M.clientHeight,t.vScrollTopHeight=T*m,t.vScrollBottomHeight=C-n.viewStore.length*m-t.vScrollTopHeight,f&&l.isInfinite&&t.vScrollBottomHeight===0&&(l.prevPage=l.currentPage,l.currentPage=Math.ceil(k/l.perPage)+1,l.startIndex=k,c({onScrollEnd:!0}))}},h=()=>{const f=i.header,p=i.body,g=i.table;f.scrollLeft=p.scrollLeft,a.value=p.scrollLeft,t.hasHorizontalScrollBar=p.clientWidth<g.clientWidth};return{updateVScroll:d,updateHScroll:h,onScroll:()=>{const f=i.body,p=f.scrollTop,g=f.scrollLeft,m=t.lastScroll.top,y=t.lastScroll.left,C=g!==y;p!==m&&f.clientHeight&&d(!0),C&&h(),t.lastScroll.top=p,t.lastScroll.left=g}}},V1=e=>{const{props:t,emit:n}=o.getCurrentInstance(),{resizeInfo:i,elementInfo:s,checkInfo:l,stores:a,isRenderer:r,updateVScroll:c,updateHScroll:d,contextInfo:h}=e,u=()=>{a.viewStore=a.showTreeStore;const m=a.viewStore;let y=i.columnWidth;i.columnWidth>0&&(y=i.columnWidth),y=i.columnWidth;let C=0;if(i.adjust&&s.body){const b=s.body;let w=b.offsetWidth;const T=b.offsetHeight,k=a.orderedColumns.reduce((M,Z)=>(Z.hide||Z.hiddenDisplay||(Z.width?M.totalWidth+=Z.width:M.emptyCount++),M),{totalWidth:h.customContextMenu.length?30:0,emptyCount:0});if(i.rowHeight*m.length>T-i.scrollWidth&&(w-=i.scrollWidth),l.useCheckbox.use&&(w-=i.minWidth),y=w-k.totalWidth,y>0){const M=k.emptyCount===0?0:Math.floor(y/k.emptyCount);C=y-M*k.emptyCount,y=k.emptyCount!==0?M:y}else y=i.columnWidth;y=y<i.minWidth?i.minWidth:y,i.columnWidth=y}if(a.orderedColumns.forEach(b=>{const w=r(b)?i.rendererMinWidth:i.minWidth;b.width&&b.width<w&&(b.width=w),!b.width&&!b.hide&&(b.width=y)}),C&&a.orderedColumns.length){let b=a.orderedColumns.length-1,w=a.orderedColumns[b];for(;b>0&&w&&(w.hide||w.hiddenDisplay);)b-=1,w=a.orderedColumns[b];w&&(w.width+=C)}i.isResize=!i.isResize},f=()=>{o.nextTick(()=>{var m,y;i.adjust&&a.orderedColumns.forEach(C=>{var w;const b=C;return!((w=t.columns[C.index])!=null&&w.width)&&!b.resized&&(b.width=0),b},void 0),u(),(m=s.body)!=null&&m.clientHeight&&c(),(y=s.body)!=null&&y.clientWidth&&d()})};return{calculatedColumn:u,onResize:f,onShow:m=>{m&&f()},onColumnResize:(m,y)=>{const C=s.header,b=s.body,w=C.getBoundingClientRect().left,T=C.querySelector(`li[data-index="${m}"]`),k=r(a.orderedColumns[m])?i.rendererMinWidth:i.minWidth,M=T.getBoundingClientRect(),Z=b.getBoundingClientRect().right-w,S=s.resizeLine,x=M.left-w+k,I=M.right-w,L=y.clientX,V=M.left-w;b.style.overflow="auto",S.style.left=`${I}px`,i.showResizeLine=!0;const R=G=>{const v=G.clientX-L,X=I+v;let W=Math.max(x,X);W=Math.min(Z,W),S.style.left=`${W}px`},E=()=>{const v=parseInt(S.style.left,10)-V;a.orderedColumns[m]&&(a.orderedColumns[m].width=v,a.orderedColumns[m].resized=!0),i.showResizeLine=!1,document.removeEventListener("mousemove",R),f();const X=ps(a);n("resize-column",{column:a.orderedColumns[m],columns:X}),n("change-column-info",{type:"resize",columns:X})};document.addEventListener("mousemove",R),document.addEventListener("mouseup",E,{once:!0})}}},E1=e=>{const{emit:t}=o.getCurrentInstance(),n=e,i=(r,c)=>{var u;const d=r.target.tagName.toLowerCase();let h={};return r.target.offsetParent&&(d==="td"?h=r.target.dataset:h=((u=r.target.closest("td"))==null?void 0:u.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(u=>u.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",i(r,c)))},100),!0)},onRowDblClick:(r,c)=>{clearTimeout(s),t("dblclick-row",i(r,c))}}},G1=e=>{const{checkInfo:t,stores:n,checkHeader:i,pageInfo:s,getPagingData:l}=e,{emit:a}=o.getCurrentInstance(),r=()=>t.useCheckbox.mode==="each",c=p=>{const g=n.treeStore.findIndex(m=>m.index===p.index);g!==-1&&(n.treeStore[g].checked=p.checked)},d=p=>{r()||p.hasChild&&p.children.forEach(g=>{const m=g;p.checked&&!m.checked&&!m.uncheckable&&t.checkedRows.push(m),p.checked||(t.checkedRows=t.checkedRows.filter(y=>y.index!==m.index)),m.checked=p.checked&&!m.uncheckable,m.hasChild&&d(m)})},h=p=>{if(r())return;const g=p.parent;if(g){const m=g.children.every(C=>C.checked);g.checked=m&&!g.uncheckable;const y=g.children.filter(C=>C.uncheckable);if(y.length){const C=g.children.filter(b=>b.checked);y.length+C.length===g.children.length&&(g.checked=!0)}g.indeterminate=!m&&g.children.some(C=>C.checked||C.indeterminate),g.checked?t.checkedRows.push(g):t.checkedRows=t.checkedRows.filter(C=>C.index!==g.index),g.parent&&h(g)}};return{onCheck:(p,g)=>{let m=n.store;s.isClientPaging&&(m=l());const y=()=>t.useCheckbox.mode==="single",C=()=>{t.isHeaderChecked&&(t.isHeaderChecked=!1)},b=()=>{y()&&t.checkedRows.length>0&&(t.prevCheckedRow.checked=!1,c(t.prevCheckedRow))},w=k=>{if(y()){t.checkedRows=[k];return}d(k),h(k),t.checkedRows.push(k),k.indeterminate=!1},T=k=>{if(y()){t.checkedRows=[];return}t.checkedRows=t.checkedRows.filter(M=>M.index!==k.index)};b(),g.checked?(w(g),i(m)):(C(),T(g),d(g),h(g)),t.prevCheckedRow=g,a("update:checked",t.checkedRows),a("check-row",p,g.index,g)},onCheckAll:p=>{var y;const g=t.isHeaderChecked;let m=(y=n.store)==null?void 0:y.filter(C=>C.isFilter);s.isClientPaging&&(m=l()),m.forEach(C=>{C.checked=g&&!C.uncheckable,C.checked?t.checkedRows.find(b=>b.index===C.index)||t.checkedRows.push(C):t.checkedRows=t.checkedRows.filter(b=>b.index!==C.index),C.indeterminate=!1}),t.isHeaderIndeterminate=!1,a("update:checked",t.checkedRows),a("check-all",p,t.checkedRows)}}},W1=e=>{const{emit:t}=o.getCurrentInstance(),{contextInfo:n,stores:i,selectInfo:s,useGridSetting:l,columnSettingInfo:a,setColumnHidden:r,onSort:c}=e,d=(p=!0)=>{const g=[];if(p&&n.customContextMenu.length){const m=s.selectedRow,y=n.customContextMenu.map(C=>{const b=C;return b.validate&&(b.disabled=!b.validate(b.itemId,m)),b.selectedRow=m??[],b});g.push(...y)}n.contextMenuItems=g};return{setContextMenu:d,onContextMenu:p=>{var y,C;const m=(C=(y=p.target.closest(".row"))==null?void 0:y.dataset)==null?void 0:C.index;if(m){const b=i.viewStore.findIndex(T=>T.index===Number(m)),w=i.viewStore[b];s.selectedRow=[w],d(),t("update:selected",s.selectedRow)}else s.selectedRow=[],d(!1),t("update:selected",[])},onColumnContextMenu:(p,g)=>{var m,y,C,b,w,T;if(p.target.className.includes("column-name")){const k=!!g.sortable;n.columnMenuItems=[{text:((m=n.columnMenuTextInfo)==null?void 0:m.hide)??"Hide",iconClass:"ev-icon-visibility-off",disabled:!l.value||i.orderedColumns.length===1||!!g.fixed,hidden:((y=n.hiddenColumnMenuItem)==null?void 0:y.hide)||!l.value,click:()=>{r(g.field),t("change-column-status",{columns:i.updatedColumns}),t("change-column-info",{type:"display",columns:i.updatedColumns})}},{text:((C=n.columnMenuTextInfo)==null?void 0:C.ascending)??"Ascending",iconClass:"ev-icon-allow2-up",disabled:!k,hidden:(b=n.hiddenColumnMenuItem)==null?void 0:b.ascending,click:()=>c(g,"asc")},{text:((w=n.columnMenuTextInfo)==null?void 0:w.descending)??"Descending",iconClass:"ev-icon-allow2-down",disabled:!k,hidden:(T=n.hiddenColumnMenuItem)==null?void 0:T.descending,click:()=>c(g,"desc")}]}else n.columnMenuItems.length=0},onGridSettingContextMenu:p=>{const{useDefaultColumnSetting:g,columnSettingTextInfo:m}=a,y={text:(m==null?void 0:m.title)??"Column List",isShowMenu:!0,click:()=>{a.isShowColumnSetting=!0,n.isShowMenuOnClick=!0}};n.customGridSettingContextMenu.length&&(n.gridSettingContextMenuItems=[...n.customGridSettingContextMenu]),g&&n.gridSettingContextMenuItems.push(y),n.gridSettingMenu.show(p)}}},Z1=e=>{const{emit:t}=o.getCurrentInstance(),{stores:n,onResize:i}=e,s=()=>{let r=0;const c=[];function d(u){const f={};return Object.keys(u).forEach(p=>{p!=="children"&&(f[p]=u[p])}),f}function h(u){const{node:f,level:p,isShow:g,parent:m,uncheckable:y}=u;f!==null&&typeof f=="object"&&(f.index=r++,f.level=p,Object.hasOwnProperty.call(f,"checked")||(f.checked=!1),Object.hasOwnProperty.call(f,"selected")||(f.selected=!1),Object.hasOwnProperty.call(f,"show")||(f.show=g),Object.hasOwnProperty.call(f,"expand")||(f.expand=!0),Object.hasOwnProperty.call(f,"isFilter")||(f.isFilter=!1),Object.hasOwnProperty.call(f,"uncheckable")||(f.uncheckable=y),Object.hasOwnProperty.call(f,"indeterminate")||(f.indeterminate=!1),Object.hasOwnProperty.call(f,"data")||(f.data=d(f)),c.push(f),Object.hasOwnProperty.call(f,"parent")||(f.parent=m),f.children&&(f.hasChild=!0,f.children.forEach(C=>h({node:C,level:p+1,isShow:f.show&&f.expand,parent:f,uncheckable:f.uncheckable}))))}return n.treeRows.forEach(u=>{h({node:u,level:0,isShow:!0,parent:void 0,uncheckable:!1})}),c},l=(r,c,d)=>{r.forEach(h=>{const u=h;u.show=d&&c?u.isFilter:c,u.hasChild&&l(u.children,u.show&&u.expand,u.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}),i()}}},X1=e=>{const{stores:t,filterInfo:n,pageInfo:i,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(m=>{const y=m;y.parent.show&&y.parent.expand?y.show=!0:y.show=!1,y.isFilter=!0,y.hasChild&&h(y)})};let u=null;return{onSearch:p=>{u&&clearTimeout(u),u=setTimeout(()=>{n.isSearch=!1,n.searchWord=p;const g=t.treeStore;g.forEach(m=>{m.show=!1,m.isFilter=!1}),p?(g.filter(y=>{let C=!1;for(let b=0;b<t.orderedColumns.length;b++){const w=t.orderedColumns[b]||{};let T=y[w.field]??null;if(w.type=w.type||"string",T!==null&&!w.hide&&((w==null?void 0:w.searchable)===void 0||w!=null&&w.searchable)&&(T=s(w,T).toString(),C=T.toLowerCase().includes(p.toString().toLowerCase()),C))break}return C}).forEach(y=>{y.show=!0,y.parent&&!y.parent.expand&&(y.show=!1),y.isFilter=!0,d(y),h(y)}),n.isSearch=!0):(g.forEach(m=>{m.show=!0,m.isFilter=!1}),g.forEach(m=>{d(m),h(m)})),!p&&i.isClientPaging&&i.prevPage&&(i.currentPage=1,t.pagingStore=r()),c({onSearch:!0}),a(t.store),l()},500)}}},N1=e=>{const{emit:t}=o.getCurrentInstance(),{stores:n,pageInfo:i,sortInfo:s,filterInfo:l,elementInfo:a,clearCheckInfo:r}=e,c=()=>{const u=(i.currentPage-1)*i.perPage,f=parseInt(u,10)+parseInt(i.perPage,10);return n.showTreeStore.slice(u,f)},d=u=>{t("page-change",{eventName:u,pageInfo:{currentPage:i.currentPage,prevPage:i.prevPage,startIndex:i.startIndex,total:i.pageTotal,perPage:i.perPage},sortInfo:{field:s.sortField,order:s.sortOrder},searchInfo:{searchWord:l.searchWord,searchColumns:n.orderedColumns.filter(f=>!f.hide&&((f==null?void 0:f.searchable)===void 0||(f==null?void 0:f.searchable))).map(f=>f.field)}}),i.isInfinite&&(u!=null&&u.onSearch||u!=null&&u.onSort)&&(i.currentPage=1,a.body.scrollTop=0,r())};return{getPagingData:c,updatePagingInfo:d,changePage:u=>{if(i.isClientPaging)if(i.prevPage=u,n.showTreeStore.length<=i.perPage)n.pagingStore=n.showTreeStore;else{const f=(i.currentPage-1)*i.perPage,p=parseInt(f,10)+parseInt(i.perPage,10);n.pagingStore=n.showTreeStore.slice(f,p),a.body.scrollTop=0,i.startIndex=f}d({onChangePage:!0})}}},P1=({sortInfo:e,stores:t})=>{const{emit:n}=o.getCurrentInstance(),i=(u=!0)=>u?["asc","desc","init"]:["asc","desc"];function s(){this.orders=i(),this.dequeue=()=>this.orders.shift(),this.enqueue=u=>this.orders.push(u)}const l=(u,f="init")=>{t.orderedColumns.forEach(p=>{p.index===(u==null?void 0:u.index)&&f?p.sortOption={sortType:f}:p.sortOption={sortType:"init"}})},a=()=>{const u=t.originColumns.filter(f=>f.hiddenDisplay||f.hide);u.length&&u.forEach(f=>{f.sortOption={sortType:"init"}})},r=new s;return{onSort:(u,f)=>{if(u.sortable===void 0?!0:u.sortable){e.sortColumn=u,e.sortField!==(u==null?void 0:u.field)&&(r.orders=i(),e.sortField=u==null?void 0:u.field),f&&(r.orders=i(),f==="desc"&&(e.sortOrder=r.dequeue(),r.enqueue(e.sortOrder))),e.sortOrder=r.dequeue(),r.enqueue(e.sortOrder),a(),l(u,e.sortOrder);const g=ps(t);n("sort-column",{field:e.sortField,order:e.sortOrder,column:e.sortColumn,columns:g}),n("change-column-info",{type:"sort",columns:g})}},setSortInfo:(u,f=!0)=>{const p=u==null?void 0:u.findIndex(y=>{var C;return(y==null?void 0:y.sortable)&&((C=y==null?void 0:y.sortOption)==null?void 0:C.sortType)&&y.sortOption.sortType!=="init"}),g=u[p];p>-1&&(g.index=p);const{sortType:m}=(g==null?void 0:g.sortOption)||{};e.sortColumn=g,e.sortField=g==null?void 0:g.field,e.isSorting=!!m,e.sortOrder=m,l(g,m),f&&n("change-column-info",{type:"sort",columns:ps(t)})},initSortInfo:u=>{e.isSorting=!1,e.sortOrder="init",u.forEach(f=>{var p;(p=f==null?void 0:f.sortOption)!=null&&p.sortType&&f.sortOption.sortType!=="init"&&(f.sortOption.sortType="init")})}}},B1={name:"EvTreeGrid",components:{TreeGridNode:w1,Toolbar:M1,GridPagination:Rr,GridSummary:Wr,ColumnSetting:Zr,GridSortButton:Xr,GridOptionButton:zo},directives:{observeVisibility:Qs,resize:En},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 gs,bs,ys,xs,Ss,Cs,ks,sn,In;const t=o.ref(null),n=o.computed(()=>{var _,oe;return((oe=(_=e.option)==null?void 0:_.useGridSetting)==null?void 0:oe.use)||!1}),i=o.computed(()=>{var _;return((_=e.option)==null?void 0:_.useSummary)||!1}),s=o.computed(()=>e.option.emptyText??"No records"),l=o.reactive({body:null,header:null,table:null,resizeLine:null,"grid-wrapper":null}),a=o.reactive({isSearch:!1,searchWord:""}),r=o.reactive({isShowColumnSetting:!1,isFilteringColumn:!1,visibleColumnIdx:[],hiddenColumn:"",columnSettingPosition:{top:0,left:0,columnListMenuWidth:0},useDefaultColumnSetting:o.computed(()=>{var _,oe;return((oe=(_=e.option)==null?void 0:_.useGridSetting)==null?void 0:oe.useDefaultColumnSetting)??!0}),columnSettingTextInfo:{title:((bs=(gs=e.option)==null?void 0:gs.useGridSetting)==null?void 0:bs.columnMenuText)??"Column List",search:((xs=(ys=e.option)==null?void 0:ys.useGridSetting)==null?void 0:xs.searchText)??"Search",empty:((Cs=(Ss=e.option)==null?void 0:Ss.useGridSetting)==null?void 0:Cs.emptyText)??"No records",ok:((sn=(ks=e.option)==null?void 0:ks.useGridSetting)==null?void 0:sn.okBtnText)??"OK"}}),c=o.reactive({treeStore:[],viewStore:[],filterStore:[],pagingStore:[],originStore:[],showTreeStore:o.computed(()=>c.treeStore.filter(_=>_.show)),searchStore:o.computed(()=>c.treeStore.filter(_=>_.isFilter)),store:o.computed(()=>a.isSearch?c.searchStore:c.treeStore),treeRows:e.rows,filteredColumns:[],originColumns:o.computed(()=>e.columns.map((_,oe)=>{var pe;return{index:oe,hiddenDisplay:!1,..._,width:isFinite(_.width)?_.width:void 0,sortOption:{sortType:((pe=_==null?void 0:_.sortOption)==null?void 0:pe.sortType)||"init"}}})),orderedColumns:o.computed(()=>c.filteredColumns.length?c.filteredColumns:c.originColumns),updatedColumns:o.computed(()=>ps(c))}),d=o.reactive({usePage:o.computed(()=>{var _;return((_=e.option.page)==null?void 0:_.use)||!1}),useClient:((In=e.option.page)==null?void 0:In.useClient)||!1,isInfinite:o.computed(()=>{var _;return((_=e.option.page)==null?void 0:_.isInfinite)||!1}),startIndex:0,prevPage:0,currentPage:0,pageTotal:o.computed(()=>{var _;return((_=e.option.page)==null?void 0:_.total)||0}),perPage:o.computed(()=>{var _;return((_=e.option.page)==null?void 0:_.perPage)||20}),visiblePage:o.computed(()=>{var _;return((_=e.option.page)==null?void 0:_.visiblePage)||8}),order:o.computed(()=>{var _;return((_=e.option.page)==null?void 0:_.order)||"center"}),showPageInfo:o.computed(()=>{var _;return((_=e.option.page)==null?void 0:_.showPageInfo)||!1}),isClientPaging:o.computed(()=>d.useClient&&d.usePage&&!d.isInfinite),isHighlight:!1,highlightPage:0}),h=o.reactive({prevCheckedRow:[],isHeaderChecked:!1,isHeaderUncheckable:!1,isHeaderIndeterminate:!1,checkedRows:e.checked,useCheckbox:o.computed(()=>e.option.useCheckbox||{})}),{isRenderer:u,getComponentName:f,getConvertValue:p,getColumnIndex:g,setPixelUnit:m,checkHeader:y}=R1({checkInfo:h}),C=o.reactive({lastScroll:{top:0,left:0},vScrollTopHeight:0,vScrollBottomHeight:0,hasVerticalScrollBar:!1,hasHorizontalScrollBar:!1}),b=o.reactive({selectedRow:e.selected,useSelect:o.computed(()=>{var _,oe;return((oe=(_=e.option)==null?void 0:_.useSelection)==null?void 0:oe.use)??!0}),limitCount:o.computed(()=>{var oe,pe;let _=(pe=(oe=e.option)==null?void 0:oe.useSelection)==null?void 0:pe.limitCount;return _=_&&_>=2?_:0,_}),multiple:o.computed(()=>{var _,oe;return((oe=(_=e.option)==null?void 0:_.useSelection)==null?void 0:oe.multiple)??!1})}),w=o.reactive({isSorting:!1,sortField:"",sortOrder:"",sortColumn:{},sortFunction:e.option.customAscFunction??{}}),T=o.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:o.computed(()=>{var _,oe;return((oe=(_=e.option)==null?void 0:_.useGridSetting)==null?void 0:oe.customContextMenu)||[]}),isShowMenuOnClick:!1}),k=o.reactive({minWidth:40,rendererMinWidth:80,showResizeLine:!1,adjust:e.option.adjust||!1,columnWidth:e.option.columnWidth||80,scrollWidth:e.option.scrollWidth||17,rowHeight:o.computed(()=>e.option.rowHeight||35),gridWidth:o.computed(()=>e.width?m(e.width):"100%"),gridHeight:o.computed(()=>e.height?m(e.height):"100%"),isResize:!1}),M=o.reactive({showHeader:o.computed(()=>e.option.showHeader===void 0?!0:e.option.showHeader),stripeStyle:o.computed(()=>{var _;return((_=e.option.style)==null?void 0:_.stripe)||!1}),borderStyle:o.computed(()=>{var _;return((_=e.option.style)==null?void 0:_.border)||""}),highlightIdx:o.computed(()=>{var _;return((_=e.option.style)==null?void 0:_.highlight)??-1})}),Z=()=>{b.selectedRow.length=0,c.store.forEach(_=>{_.selected=!1})},S=()=>{h.isHeaderChecked=!1,h.isHeaderIndeterminate=!1,h.checkedRows.length=0,c.store.forEach(_=>{_.checked=!1,_.indeterminate=!1})},{getPagingData:x,updatePagingInfo:I,changePage:L}=N1({stores:c,pageInfo:d,sortInfo:w,filterInfo:a,elementInfo:l,clearCheckInfo:S}),V=o.ref(0),{updateVScroll:R,updateHScroll:E,onScroll:G}=v1({scrollInfo:C,stores:c,elementInfo:l,resizeInfo:k,pageInfo:d,summaryScroll:V,getPagingData:x,updatePagingInfo:I}),{onRowClick:v,onRowDblClick:X}=E1(b),{onCheck:W,onCheckAll:N}=G1({checkInfo:h,stores:c,checkHeader:y,pageInfo:d,getPagingData:x}),{calculatedColumn:P,onResize:D,onShow:O,onColumnResize:Y}=V1({resizeInfo:k,elementInfo:l,checkInfo:h,stores:c,isRenderer:u,updateVScroll:R,updateHScroll:E,contextInfo:T}),{setTreeNodeStore:H,handleExpand:B}=Z1({stores:c,onResize:D}),{onSort:z,initSortInfo:F,setSortInfo:Q}=P1({sortInfo:w,stores:c}),{onSearch:U}=X1({stores:c,filterInfo:a,pageInfo:d,getConvertValue:p,onResize:D,checkHeader:y,getPagingData:x,updatePagingInfo:I}),{setPositionColumnSetting:ee,initColumnSettingInfo:j,onApplyColumn:te,setColumnHidden:J}=Nr({stores:c,columnSettingInfo:r,contextInfo:T,onSearch:U,onResize:D}),{setContextMenu:q,onContextMenu:$,onColumnContextMenu:ae,onGridSettingContextMenu:he}=W1({contextInfo:T,stores:c,selectInfo:b,useGridSetting:n,columnSettingInfo:r,setColumnHidden:J,onSort:z}),se=_=>{T.gridSettingContextMenuItems.length=0,T.customGridSettingContextMenu.length?he(_):r.isShowColumnSetting=!0},fe=_=>{var oe,pe,ke,ve,ze,Qe;_.type==="wheel"&&((oe=T.menu)==null||oe.hide(_)),_.type==="scroll"&&!((pe=_.target.classList)!=null&&pe.contains("table-body"))&&!((ve=(ke=_.target.offsetParent)==null?void 0:ke.classList)!=null&&ve.contains("ev-grid-column-setting"))&&(r.isShowColumnSetting=!1,T.isShowMenuOnClick=!1,(ze=T.columnMenu)==null||ze.hide(_),(Qe=T.gridSettingMenu)==null||Qe.hide())};o.onMounted(()=>{var _;if(c.treeStore=H(),c.originStore=Ze(c.treeStore),(_=e.option)!=null&&_.useSort)Q(e.columns,!1);else{const oe=T.hiddenColumnMenuItem;oe.ascending=!0,oe.descending=!0}document.addEventListener("wheel",fe,{capture:!1}),document.addEventListener("scroll",fe,{capture:!0})}),o.onUnmounted(()=>{document.removeEventListener("wheel",fe,{capture:!1}),document.removeEventListener("scroll",fe,{capture:!0})}),o.onActivated(()=>{D()}),o.watch(()=>{var _;return(_=e.option)==null?void 0:_.useSort},_=>{const oe=e.option.hiddenColumnMenuItem,pe=T.hiddenColumnMenuItem;_?(pe.ascending=(oe==null?void 0:oe.ascending)??!1,pe.descending=(oe==null?void 0:oe.descending)??!1,Q(e.columns,!1)):(pe.ascending=!0,pe.descending=!0,F(e.columns))}),o.watch(()=>r.isShowColumnSetting,_=>{var oe;if(!_){(oe=T.gridSettingMenu)==null||oe.hide();return}ee(t.value)}),o.watch(()=>e.columns,()=>{j()},{deep:!0,immediate:!0}),o.watch(()=>e.checked,_=>{h.checkedRows=_}),o.watch(()=>h.checkedRows,_=>{h.isHeaderChecked=!1;let oe=c.store;d.isClientPaging&&(oe=x()),oe.length&&(oe.forEach(pe=>{pe.checked=!!_.find(ke=>ke.index===pe.index)}),y(oe)),R()}),o.watch(()=>e.selected,_=>{b.useSelect&&(b.selectedRow=_)}),o.watch(()=>b.selectedRow,_=>{b.useSelect&&(c.store.forEach(oe=>{oe.selected=!!_.find(pe=>pe.index===oe.index)}),R())},{deep:!0}),o.watch(()=>M.highlightIdx,async _=>{await o.nextTick();const oe=ke=>{if(!(ke!=null&&ke.children))return;const{children:ve}=ke;ve.forEach(ze=>{const Qe=ze;Qe.parent.show&&Qe.parent.expand?Qe.show=!0:Qe.show=!1,Qe.isFilter=!0,Qe.hasChild&&oe(Qe)})},pe=ke=>{if(!(ke!=null&&ke.parent)){oe(ke);return}const{parent:ve}=ke;ve.show=!0,ve.isFilter=!0,ve.expand=!0,oe(ve),pe(ve)};if(_>=0){const ke=c.store.find(ze=>ze.index===_);if(!ke)return;ke.show=!0,ke.isFilter=!0,pe(ke);const ve=c.showTreeStore.map(ze=>ze.index).indexOf(ke.index);if(d.usePage&&!d.isInfinite){const ze=Math.ceil(ve/d.perPage);if(d.highlightPage=ve===d.perPage?ze+1:ze||1,d.highlightPage!==d.currentPage){d.currentPage=d.highlightPage,d.isHighlight=!0;return}}l.body.scrollTop=k.rowHeight*ve}}),o.watch(()=>h.useCheckbox.mode,()=>{h.checkedRows=[],h.isHeaderChecked=!1}),o.watch(()=>b.useSelect,()=>{Z()}),o.watch(()=>b.multiple,()=>{Z()}),o.watch(()=>e.rows,_=>{c.treeRows=_,c.treeStore=H(),D()},{deep:!0}),o.watch(()=>c.treeStore.length,()=>{y(c.store)}),o.watch(()=>[e.width,e.height,e.option.columnWidth],()=>{e.option.columnWidth!=null&&(k.columnWidth=e.option.columnWidth),c.orderedColumns.map(_=>{var pe;const oe=_;return!((pe=e.columns[_.index])!=null&&pe.width)&&!oe.resized&&(oe.width=0),oe}),D()}),o.watch(()=>e.option.searchValue,_=>{o.nextTick(()=>{_!==void 0&&(U((_==null?void 0:_.value)??_),d.isClientPaging&&(S(),Z()))})},{immediate:!0}),o.watch(()=>{var _;return(_=e.option.page)==null?void 0:_.currentPage},_=>{var pe;const oe=_||1;d.currentPage=(pe=e.option.page)!=null&&pe.isInfinite?1:oe},{immediate:!0}),o.watch(()=>d.currentPage,(_,oe)=>{o.nextTick(()=>{if(L(oe),d.isClientPaging&&_!==oe&&(S(),Z()),R(),_===d.highlightPage&&d.isHighlight){const pe=c.pagingStore.map(ke=>ke.index).indexOf(M.highlightIdx);l.body.scrollTop=k.rowHeight*pe,d.isHighlight=!d.isHighlight}})});const ge=()=>({"column-sort__icon":!0,"column-sort__icon--asc":w.sortOrder==="asc","column-sort__icon--desc":w.sortOrder==="desc"}),le=o.computed(()=>({width:k.gridWidth,height:k.gridHeight})),ce=o.computed(()=>({"table-body":!0,stripe:M.stripeStyle,"bottom-border":!!c.viewStore.length,"non-border":!!M.borderStyle})),be=o.computed(()=>({table:!0,"ev-grid":!0,"ev-tree-grid":!0,adjust:k.adjust,"non-header":!M.showHeader,"ev-tree-grid--empty":!c.viewStore.length})),Ie=o.computed(()=>({"table-header":!0,"non-border":!!M.borderStyle})),Ve=o.computed(()=>({column:!0,"checkbox-all":!0,"non-border":!!M.borderStyle})),kt=o.computed(()=>h.useCheckbox.use&&h.useCheckbox.headerCheck&&h.useCheckbox.mode!=="single"),Vt=_=>({column:!0,render:u(_),"non-border":!!M.borderStyle,[_.field]:_.field}),jo=(_,oe)=>{const pe=u(_);return{width:`${_.width}px`,"min-width":pe?`${k.rendererMinWidth}px;`:`${k.minWidth}px`,"margin-right":c.orderedColumns.length-1===oe&&C.hasVerticalScrollBar&&C.hasHorizontalScrollBar?`${k.scrollWidth}px`:"0px","border-right":c.orderedColumns.length-1===oe?"none":"1px solid #CFCFCF"}},Qo=_=>`${_}Node`;return{summaryScroll:V,gridStyle:le,gridClass:be,headerClass:Ie,headerCheckboxClass:Ve,isHeaderCheckbox:kt,bodyStyle:ce,useSummary:i,useGridSetting:n,toolbarRef:t,stores:c,emptyText:s,...o.toRefs(M),...o.toRefs(l),...o.toRefs(c),...o.toRefs(a),...o.toRefs(C),...o.toRefs(k),...o.toRefs(b),...o.toRefs(h),...o.toRefs(w),...o.toRefs(T),...o.toRefs(d),...o.toRefs(r),isRenderer:u,getComponentName:f,getConvertValue:p,getColumnIndex:g,setPixelUnit:m,updateVScroll:R,updateHScroll:E,onScroll:G,calculatedColumn:P,onResize:D,onShow:O,onColumnResize:Y,onRowClick:v,onRowDblClick:X,onCheck:W,onCheckAll:N,setContextMenu:q,onContextMenu:$,onSearch:U,handleExpand:B,getColumnClass:Vt,getColumnStyle:jo,getSlotName:Qo,setGridSetting:se,onApplyColumn:te,onColumnContextMenu:ae,onSort:z,sortIconClass:ge}}},D1={class:"column-list"},Y1=["data-index"],O1=["title","onClick"],H1=["onClick"],z1=["onMousedown"],F1={ref:"table"},A1=["title"],K1={key:0},_1={class:"is-empty"},U1={ref:"resizeLine",class:"table-resize-line"};function J1(e,t,n,i,s,l){var C;const a=o.resolveComponent("grid-option-button"),r=o.resolveComponent("toolbar"),c=o.resolveComponent("ev-checkbox"),d=o.resolveComponent("grid-sort-button"),h=o.resolveComponent("tree-grid-node"),u=o.resolveComponent("ev-context-menu"),f=o.resolveComponent("grid-summary"),p=o.resolveComponent("grid-pagination"),g=o.resolveComponent("column-setting"),m=o.resolveDirective("resize"),y=o.resolveDirective("observe-visibility");return o.openBlock(),o.createElementBlock(o.Fragment,null,[e.$slots.toolbar||i.useGridSetting?(o.openBlock(),o.createElementBlock("div",{key:0,ref:"toolbarRef",class:"toolbar-wrapper",style:o.normalizeStyle(`width: ${e.gridWidth};`)},[o.createVNode(r,null,{toolbarWrapper:o.withCtx(()=>[i.useGridSetting?(o.openBlock(),o.createBlock(a,{key:0,class:"grid-setting__icon",onClick:i.setGridSetting},null,8,["onClick"])):o.createCommentVNode("",!0),o.renderSlot(e.$slots,"toolbar",{item:{onSearch:i.onSearch}},void 0,!0)]),_:3})],4)):o.createCommentVNode("",!0),o.withDirectives((o.openBlock(),o.createElementBlock("div",{ref:"grid-wrapper",style:o.normalizeStyle(i.gridStyle)},[o.createElementVNode("div",{ref:"grid",class:o.normalizeClass(i.gridClass)},[o.withDirectives(o.createElementVNode("div",{ref:"header",class:o.normalizeClass(i.headerClass)},[o.createElementVNode("ul",D1,[e.useCheckbox.use?(o.openBlock(),o.createElementBlock("li",{key:0,class:o.normalizeClass(i.headerCheckboxClass),style:o.normalizeStyle({width:`${e.minWidth}px`,"border-right":"1px solid #CFCFCF"})},[i.isHeaderCheckbox?(o.openBlock(),o.createBlock(c,{key:0,modelValue:e.isHeaderChecked,"onUpdate:modelValue":t[0]||(t[0]=b=>e.isHeaderChecked=b),disabled:e.isHeaderUncheckable,indeterminate:e.isHeaderIndeterminate,onChange:i.onCheckAll},null,8,["modelValue","disabled","indeterminate","onChange"])):o.createCommentVNode("",!0)],6)):o.createCommentVNode("",!0),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.orderedColumns,(b,w)=>{var T,k;return o.openBlock(),o.createElementBlock(o.Fragment,{key:w},[!b.hide&&!b.hiddenDisplay?(o.openBlock(),o.createElementBlock("li",{key:0,"data-index":w,class:o.normalizeClass(i.getColumnClass(b)),style:o.normalizeStyle(i.getColumnStyle(b,w))},[b.customHeader&&e.$slots.customHeader?o.renderSlot(e.$slots,"customHeader",{key:0},void 0,!0):(o.openBlock(),o.createElementBlock("span",{key:1,title:b.caption,class:o.normalizeClass(["column-name",{"column-name--click":i.useGridSetting}]),onClick:[M=>i.onColumnContextMenu(M,b),t[1]||(t[1]=o.withModifiers((...M)=>e.columnMenu.show&&e.columnMenu.show(...M),["prevent"]))]},[o.createTextVNode(o.toDisplayString(b.caption)+" ",1),o.createElementVNode("span",{onClick:o.withModifiers(M=>i.onSort(b),["stop"])},[e.$slots.sortIcon?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[(T=e.$props.option)!=null&&T.useSort&&(b!=null&&b.sortable)?(o.openBlock(),o.createElementBlock("span",{key:0,class:"column-sort__icon column-sort__icon--basic",style:o.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`})},[o.renderSlot(e.$slots,"sortIcon",{},void 0,!0)],4)):o.createCommentVNode("",!0),e.sortField===b.field?(o.openBlock(),o.createElementBlock("span",{key:1,class:o.normalizeClass(i.sortIconClass(b)),style:o.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`})},[o.renderSlot(e.$slots,`sortIcon_${e.sortOrder}`,{},void 0,!0)],6)):o.createCommentVNode("",!0)],64)):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[(k=e.$props.option)!=null&&k.useSort&&(b!=null&&b.sortable)?(o.openBlock(),o.createBlock(d,{key:0,class:"column-sort__icon column-sort__icon--basic",icon:"basic",style:o.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`})},null,8,["style"])):o.createCommentVNode("",!0),e.sortField===b.field?(o.openBlock(),o.createBlock(d,{key:1,class:o.normalizeClass(i.sortIconClass(b)),icon:e.sortOrder,style:o.normalizeStyle({height:`${e.rowHeight}px`,"line-height":`${e.rowHeight}px`,visibility:e.sortOrder?b.hidden:!0})},null,8,["class","icon","style"])):o.createCommentVNode("",!0)],64))],8,H1)],10,O1)),o.createElementVNode("span",{class:"column-resize",onMousedown:o.withModifiers(M=>i.onColumnResize(w,M),["stop","left"])},null,40,z1)],14,Y1)):o.createCommentVNode("",!0)],64)}),128)),(C=e.$props.option.customContextMenu)!=null&&C.length?(o.openBlock(),o.createElementBlock("li",{key:1,class:o.normalizeClass({column:!0,"non-border":!!e.borderStyle}),style:o.normalizeStyle({width:"30px","min-width":"30px","margin-right":e.hasVerticalScrollBar||e.hasHorizontalScrollBar?`${e.scrollWidth}px`:"0px"})},null,6)):o.createCommentVNode("",!0)])],2),[[o.vShow,e.showHeader]]),o.createElementVNode("div",{ref:"body",class:o.normalizeClass(i.bodyStyle),onScroll:t[2]||(t[2]=(...b)=>i.onScroll&&i.onScroll(...b)),onContextmenu:[t[3]||(t[3]=b=>i.onContextMenu(b)),t[4]||(t[4]=o.withModifiers((...b)=>e.menu.show&&e.menu.show(...b),["prevent"]))]},[o.createElementVNode("div",{style:o.normalizeStyle(`height: ${e.vScrollTopHeight}px;`),class:"vscroll-spacer"},null,4),o.createElementVNode("table",F1,[o.createElementVNode("tbody",null,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.viewStore,(b,w)=>(o.openBlock(),o.createBlock(h,{key:w,"selected-data":e.selectedRow,"node-data":b,"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:i.onCheck,onExpandTreeData:i.handleExpand,onClickTreeData:i.onRowClick,onDblClickTreeData:i.onRowDblClick,onContextMenu:i.onContextMenu},o.createSlots({_:2},[o.renderList(e.orderedColumns,(T,k)=>({name:i.getSlotName(T.field),fn:o.withCtx(({item:M})=>[e.$slots[T.field]?o.renderSlot(e.$slots,T.field,{key:0,item:{data:M.data,fieldName:T.field}},void 0,!0):(o.openBlock(),o.createElementBlock("span",{key:1,title:i.getConvertValue(T,b[T.field])},o.toDisplayString(i.getConvertValue(T,b[T.field])),9,A1))])})),e.$slots.contextmenuIcon?{name:"contextmenuIconNode",fn:o.withCtx(()=>[o.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?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("tr",K1,[o.createElementVNode("td",_1,o.toDisplayString(i.emptyText),1)]))])],512),o.createElementVNode("div",{style:o.normalizeStyle(`height: ${e.vScrollBottomHeight}px;`),class:"vscroll-spacer"},null,4),o.createVNode(u,{ref:"menu","custom-class":e.contextMenuClass,items:e.contextMenuItems},null,8,["custom-class","items"]),o.createVNode(u,{ref:"columnMenu",items:e.columnMenuItems},null,8,["items"]),o.createVNode(u,{ref:"gridSettingMenu",items:e.gridSettingContextMenuItems,"is-show-menu-on-click":e.isShowMenuOnClick},null,8,["items","is-show-menu-on-click"])],34),o.withDirectives(o.createElementVNode("div",U1,null,512),[[o.vShow,e.showResizeLine]])],2)],4)),[[m,i.onResize],[y,{callback:i.onShow,once:!0}]]),i.useSummary?(o.openBlock(),o.createBlock(f,{key:1,"is-tree":!0,"ordered-columns":e.orderedColumns,stores:i.stores,"use-checkbox":e.useCheckbox.use,"style-option":{borderStyle:e.borderStyle,minWidth:e.minWidth,rowHeight:e.rowHeight},"scroll-left":i.summaryScroll},null,8,["ordered-columns","stores","use-checkbox","style-option","scroll-left"])):o.createCommentVNode("",!0),e.usePage&&!e.isInfinite?(o.openBlock(),o.createBlock(p,{key:2,modelValue:e.currentPage,"onUpdate:modelValue":t[5]||(t[5]=b=>e.currentPage=b),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"])):o.createCommentVNode("",!0),o.createVNode(g,{"is-show":e.isShowColumnSetting,"onUpdate:isShow":t[6]||(t[6]=b=>e.isShowColumnSetting=b),"is-show-menu-on-click":e.isShowMenuOnClick,"onUpdate:isShowMenuOnClick":t[7]||(t[7]=b=>e.isShowMenuOnClick=b),columns:e.updatedColumns,"hidden-column":e.hiddenColumn,position:e.columnSettingPosition,"text-info":e.columnSettingTextInfo,onApplyColumn:i.onApplyColumn},null,8,["is-show","is-show-menu-on-click","columns","hidden-column","position","text-info","onApplyColumn"])],64)}const Si=de(B1,[["render",J1],["__scopeId","data-v-9ed705b7"]]);Si.install=e=>{e.component(Si.name,Si)};const j1={name:"PageButton",props:{page:{type:Object,required:!0},disabled:{type:Boolean,default:!1}}},Q1=["aria-current"];function $1(e,t,n,i,s,l){return o.openBlock(),o.createElementBlock("span",o.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]=o.withModifiers((...a)=>n.page.click&&n.page.click(...a),["stop"]))}),[o.renderSlot(e.$slots,"default",{},()=>[o.createTextVNode(o.toDisplayString(n.page.number),1)])],16,Q1)}const q1={name:"EvPagination",components:{EvIcon:Sn,pageButton:de(j1,[["render",$1]])},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=o.computed(()=>e.visiblePage>7?e.visiblePage:7),i=o.computed(()=>e.modelValue),s=o.computed(()=>e.total===0?1:Math.ceil(e.total/e.perPage)),l=o.computed(()=>i.value>1),a=o.computed(()=>i.value<s.value),r=o.computed(()=>Math.max(i.value-e.pagePerJump,1)),c=o.computed(()=>Math.min(i.value+e.pagePerJump,s.value)),d=o.computed(()=>{const m=i.value*e.perPage-e.perPage+1;return m>=0?m:0}),h=(m,y)=>{i.value===m||m<1||m>s.value||(t("update:modelValue",m),t("change",m),y&&y.target&&o.nextTick(()=>y.target.focus()))},u=(m,y={})=>({number:m,isCurrent:y.isCurrent??i.value===m,click:C=>h(m,C),input:(C,b)=>h(+b,C),disabled:y.disabled||!1,class:y.class||""}),f=(m,y)=>{const C=[],b=m>0?m:1;for(let w=b;w<=y;w++)C.push(u(w));return C},p=o.computed(()=>{const m=parseInt(n.value,10);if(m===0)return[];const y=Math.min(Math.max(0,m)||s.value,s.value);if(s.value<=y)return f(1,s.value);const C=y%2===0?1:0,b=Math.floor(y/2),w=s.value-b+1+C;if(i.value>b&&i.value<w){const k=s.value,M=i.value-b+2,Z=i.value+b-2-C,S=M-1===2?2:-1,x=Z+1===k-1?Z+1:-1;return[u(1),u(S),...f(M,Z),u(x),u(s.value)]}else if(i.value===b){const T=i.value+b-1-C;return[...f(1,T),u(-1),u(s.value)]}else if(i.value===w){const T=i.value-b+1;return[u(1),u(-1),...f(T,s.value)]}return[...f(1,b),u(-1),...f(w,s.value)]}),g=o.computed(()=>({"justify-content":e.order,flex:"3 1 0%"}));return o.watch(()=>s.value,m=>{i.value>m&&h(m)}),o.watch(()=>i.value,(m,y)=>{s.value<m&&h(y)}),{pageCount:s,pagesInRange:p,hasPrev:l,hasNext:a,listClasses:g,firstData:d,current:i,changePage:h,getPage:u,prevJumpPage:r,nextJumpPage:c}}},ek={class:"pagination"},tk={key:0,class:"pagination-info"},nk={key:0,class:"pagination-ellipsis"},ik=["onClick"];function sk(e,t,n,i,s,l){const a=o.resolveComponent("ev-icon"),r=o.resolveComponent("page-button");return o.openBlock(),o.createElementBlock("nav",ek,[n.showPageInfo?(o.openBlock(),o.createElementBlock("small",tk,[n.perPage===1?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[o.createTextVNode(o.toDisplayString(i.firstData)+" / "+o.toDisplayString(n.total),1)],64)):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createTextVNode(o.toDisplayString(i.firstData)+" - "+o.toDisplayString(Math.min(i.current*n.perPage,n.total))+" / "+o.toDisplayString(n.total),1)],64))])):o.createCommentVNode("",!0),o.createElementVNode("ul",{class:"pagination-list",style:o.normalizeStyle(i.listClasses)},[e.$props.pagePerJump?(o.openBlock(),o.createElementBlock("li",{key:0,class:o.normalizeClass(["step-button",{"is-disabled":!i.hasPrev}])},[o.createVNode(r,{class:"pagination-previous",disabled:!i.hasPrev,page:i.getPage(i.prevJumpPage,{isCurrent:!1})},{default:o.withCtx(()=>[o.createVNode(a,{icon:"ev-icon-s-double-left"})]),_:1},8,["disabled","page"])],2)):o.createCommentVNode("",!0),o.createElementVNode("li",{class:o.normalizeClass(["step-button",{"is-disabled":!i.hasPrev}])},[o.createVNode(r,{class:"pagination-previous",disabled:!i.hasPrev,page:i.getPage(i.current-1)},{default:o.withCtx(()=>[o.createVNode(a,{icon:"ev-icon-s-arrow-left"})]),_:1},8,["disabled","page"])],2),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.pagesInRange,(c,d)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:d},[c.number===-1?(o.openBlock(),o.createElementBlock("li",nk,[...t[0]||(t[0]=[o.createElementVNode("span",null,"…",-1)])])):(o.openBlock(),o.createElementBlock("li",{key:1,class:o.normalizeClass({"is-current":c.isCurrent,"is-page":!0}),onClick:c.click},[o.createVNode(r,{page:c},null,8,["page"])],10,ik))],64))),128)),o.createElementVNode("li",{class:o.normalizeClass(["step-button",{"is-disabled":!i.hasNext}])},[o.createVNode(r,{class:"pagination-next",disabled:!i.hasNext,page:i.getPage(i.current+1)},{default:o.withCtx(()=>[o.createVNode(a,{icon:"ev-icon-s-arrow-right"})]),_:1},8,["disabled","page"])],2),e.$props.pagePerJump?(o.openBlock(),o.createElementBlock("li",{key:1,class:o.normalizeClass(["step-button",{"is-disabled":!i.hasNext}])},[o.createVNode(r,{class:"pagination-previous",disabled:!i.hasNext,page:i.getPage(i.nextJumpPage,{isCurrent:!1})},{default:o.withCtx(()=>[o.createVNode(a,{icon:"ev-icon-s-double-right"})]),_:1},8,["disabled","page"])],2)):o.createCommentVNode("",!0)],4)])}const Ci=de(q1,[["render",sk]]);Ci.install=e=>{e.component(Ci.name,Ci)};const ok="3.12.0",lk=[Gn,Wn,un,Zn,fn,mn,Xn,Nn,Bn,Dn,Yn,zn,Qn,Sn,ei,ti,ni,ii,si,oi,li,ai,ri,ci,hi,bi,yi,xi,ls,rs,cs,Si,Ci],ak={version:ok,install:e=>{e&&lk.forEach(t=>{e.use(t)})}};re.EvButton=un,re.EvButtonGroup=Zn,re.EvCalendar=ei,re.EvChart=bi,re.EvChartBrush=xi,re.EvChartGroup=yi,re.EvCheckbox=fn,re.EvCheckboxGroup=mn,re.EvContextMenu=ii,re.EvDatePicker=ti,re.EvGrid=hi,re.EvIcon=Sn,re.EvInputNumber=zn,re.EvLoading=oi,re.EvMenu=ai,re.EvMessage=ls,re.EvMessageBox=cs,re.EvNotification=rs,re.EvPagination=Ci,re.EvProgress=li,re.EvRadio=Xn,re.EvRadioGroup=Nn,re.EvScheduler=ni,re.EvSelect=Bn,re.EvSlider=Qn,re.EvTabPanel=Wn,re.EvTabs=Gn,re.EvTextField=Yn,re.EvTimePicker=ci,re.EvToggle=Dn,re.EvTree=ri,re.EvTreeGrid=Si,re.EvWindow=si,re.default=ak,Object.defineProperties(re,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});