@deephaven/embed-grid 0.30.2-beta.1 → 0.30.2-beta.5

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.
@@ -1,6 +1,6 @@
1
- import{A as F,R as Fe,C as m,E as ee,T as fa,F as y,J as te,D as $t,K as Oe,L as Ln,U as Be,H as be,V as yi,B,W as Re,S as Ca,I as vt,X as rt,Y as $o,O as sl,Q as Oi,Z as mr,_ as wa,$ as Wt,a0 as Sa,a1 as ba,a2 as Ta,a3 as Ea,a4 as Fi,a5 as va,a6 as Ra,a7 as ya,a8 as gr,a9 as Fa,aa as Da,ab as pr,ac as Ia,ad as Na,ae as Aa,af as Ma,ag as Oa,ah as Pn,ai as xa,aj as Di,ak as ol}from"./vendor.cad6ca1e.js";import{P as Ge,C as _n,a as ka,u as La,B as z,v as Pa,b as _a,c as Ha,d as Va,e as qs,T as Ue,E as ve,f as il,L as ie,g as Kn,h as dn,i as rl,j as on,k as zo,l as xi,m as ki,n as Oo,r as Ve,M as le,K as he,o as Rt,p as se,q as Qt,G as Li,s as Qn,t as Ua,w as Ba,x as Yn,y as ll,z as Ga,A as Wa,D as $a,F as za,H as un,S as qa,I as vs,J as fr,N as al,O as Ft,Q as Pi,R as jn,U as ln,V as _i,W as Hi,X as xo,Y as Vi,Z as qo,_ as Ya,$ as Xa,a0 as Ys,a1 as Ui,a2 as Xs,a3 as Bi,a4 as Ka,a5 as ko,a6 as Qa,a7 as Gi,a8 as cl,a9 as ja,aa as Za,ab as Ja,ac as ec,ad as tc,ae as nc,af as sc,ag as dl,ah as Cr,ai as di,aj as oc,ak as ic,al as Ss,am as rc,an as ul,ao as lc,ap as ac,aq as hl,ar as wr,as as cc,at as dc,au as uc,av as hc,aw as mc,ax as ml,ay as gc,az as pc,aA as Sr,aB as fc,aC as br,aD as Cc,aE as wc,aF as Sc,aG as bc,aH as Tc,aI as Ec,aJ as vc,aK as Rc,aL as yc,aM as Fc,aN as Dc,aO as Ic,aP as Nc,aQ as Ac,aR as Mc,aS as Oc,aT as xc,aU as kc,aV as Lc,aW as Pc,aX as _c,aY as Hc,aZ as Vc,a_ as Me}from"./index.b4206c9b.js";import{e as an,l as ps,K as Et,a as Tr,b as Mn}from"./monaco.e84eddf6.js";import{P as Lo,b as Uc,h as Bc,p as Gc,o as Wc,s as $c,t as zc,c as ui}from"./plotly.d8b7bba2.js";import"./helpers.162e09a8.js";class Yo{static isDark(t){const n=document.createElement("div");n.style.display="none",n.style.color=t;const s=getComputedStyle(document.body.appendChild(n)).color,o=s.match(/\d+/g);let i=[];if(o)i=o.map(l=>parseInt(l,10));else throw new Error(`Invalid color received. Got ${s}`);return document.body.removeChild(n),Yo.getBrightness(i)<125}static getBrightness(t){return Math.round((t[0]*299+t[1]*587+t[2]*114)/1e3)}}function qc(e,t){return e?e.closest(`.${t}`):null}const Yc={getClosestByClassName:qc};class Xo{constructor(){this.pending=[],this.resolved=[]}add(t,n){const s=Ge.makeCancelable(t,n);return this.pending.push(s),s.then(()=>{this.resolve(s)},()=>{this.resolve(s)}),s}remove(t){for(let n=0;n<this.pending.length;n+=1)if(this.pending[n]===t){this.pending.splice(n,1);return}}resolve(t){this.remove(t),this.resolved.push(t)}cancel(){const t=[...this.pending,...this.resolved];for(let n=0;n<t.length;n+=1)t[n].cancel();this.pending=[],this.resolved=[]}}function M(e){if(e==null)throw new Error("Value is null or undefined")}class Wi{static join(t,n="and"){if(t==null||t.length===0)return"";if(t.length===1)return t[0];if(t.length===2)return`${t[0]} ${n} ${t[1]}`;const s=t.slice(0,t.length-1).join(", "),o=t[t.length-1];return`${s}, ${n} ${o}`}static toLower(t,n=!0){if(t==null){if(n)return"";throw new Error("Null string passed in to TextUtils.toLower")}return t.toLowerCase()}static sort(t,n,s=!0){return t<n?s?-1:1:t>n?s?1:-1:0}}class Xc extends Error{constructor(){super(...arguments),this.isInvalid=!0}}class Kc extends F.exports.Component{constructor(t){super(t),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=Fe.createRef(),this.openMenu=Fe.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){var t;(t=this.container.current)!=null&&t.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){var t;(t=this.container.current)!=null&&t.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}handleContextMenu(t){if(!_n.isContextActionEvent(t)||!this.container.current||t.metaKey||t.ctrlKey)return;const n=_n.getMenuItems(t.contextActions),s=this.container.current.getBoundingClientRect(),o=t.clientY-s.top,i=t.clientX-s.left;if(n.length===0){if(t.target===this.container.current){t.preventDefault(),this.setState({actions:null},()=>{const r=document.elementFromPoint(i,o),l=new MouseEvent("contextmenu",{clientX:t.clientX,clientY:t.clientY,bubbles:!0,cancelable:!0});r==null||r.dispatchEvent(l)});return}return}t.preventDefault(),this.setState({actions:n,top:o,left:i})}handleMenuClose(t){t===this.openMenu.current&&this.setState({actions:null})}render(){let t=null;const{"data-testid":n}=this.props,{actions:s,top:o,left:i}=this.state;return s&&(t=m(ka,{ref:this.openMenu,actions:s,onMenuClosed:this.handleMenuClose,top:o,left:i,updatePosition:(r,l)=>{this.setState({top:r,left:l})},"data-testid":n})),m("div",{className:ee("context-menu-root",{active:s}),ref:this.container,children:t})}}function $i(e){const t=F.exports.useRef();return F.exports.useEffect(function(){t.current=e}),t.current}function gl({copy:e,kind:t="ghost",tooltip:n="Copy",className:s,"data-testid":o,children:i}){const[r,l]=La();return m(z,{kind:t,className:s,"data-testid":o,icon:r?Pa:_a,tooltip:r?"Copied":n,onClick:()=>{l(typeof e=="function"?e():e)},children:i})}class dt{static reorder(t,n,s,o){const i=t===s?dt.adjustDestinationIndex(o,n):o,r=dt.removeItems(t,n);return s.splice(i,0,...r),r}static removeItems(t,n){const s=[],o=n.map((i,r)=>({range:i,index:r})).sort((i,r)=>r.range[0]-i.range[0]);for(let i=0;i<o.length;i+=1){const{range:r,index:l}=o[i],[a,c]=r;s[l]=t.splice(a,c-a+1)}return fa(s)}static adjustDestinationIndex(t,n){let s=t;for(let o=0;o<n.length;o+=1){const[i,r]=n[o];if(i>t)break;s-=Math.min(r,t-1)-i+1}return s}static startDragging(){document.documentElement.classList.add("drag-pointer-events-none")}static stopDragging(){document.documentElement.classList.remove("drag-pointer-events-none")}}function pl({on:e,id:t,className:n,isInvalid:s,disabled:o=!1,onClick:i,"data-testid":r}){return m("button",{type:"button",className:ee("btn","btn-switch",n,{active:e},{"is-invalid":s}),id:t,onClick:i,disabled:o,"data-testid":r,children:m("div",{className:"handle"})})}function Er(e){return e.isOn!==void 0}function Qc({item:e,onSelect:t=()=>{},"data-testid":n}){const{icon:s,subtitle:o,title:i}=e,r=F.exports.useMemo(()=>Er(e)?()=>{e.onChange(!e.isOn)}:t,[e,t]);return y("div",{className:"btn btn-navigation-menu-item","data-testid":`menu-item-${i}`,onClick:r,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&r()},tabIndex:0,role:"menuitem",children:[s!==void 0&&m("div",{className:"icon",children:m(te,{icon:s})}),m("div",{className:"title",children:i}),o!==void 0&&m("div",{className:"shortcut",children:o}),m("div",{className:"accessory","data-testid":n,children:Er(e)?m(pl,{on:e.isOn,onClick:l=>{l.stopPropagation(),r()}}):m(te,{icon:Ha})})]})}function fl({items:e,onSelect:t=()=>{},"data-testid":n}){return m("div",{className:"navigation-menu-view","data-testid":n,children:m("ul",{className:"navigation-menu-list",children:e.map((s,o)=>m("li",{children:m(Qc,{item:s,onSelect:()=>{t(o)}})},s.title))})})}function vr({children:e,onBack:t,onClose:n,title:s,"data-testid":o}){return y("div",{className:"navigation-page","data-testid":o,children:[y("div",{className:"navigation-title-bar",children:[m("div",{className:"navigation-left-buttons",children:t!==void 0&&m(z,{kind:"ghost",className:"btn-back","data-testid":"btn-page-back",onClick:t,icon:Va,children:"Back"})}),m("div",{className:"navigation-title",children:s}),m("div",{className:"navigation-right-buttons",children:n!==void 0&&m(z,{kind:"ghost",className:"btn-close px-2 m-1","data-testid":"btn-page-close",onClick:n,icon:qs,tooltip:"Close"})})]}),m("div",{className:"navigation-content",children:e})]})}function jc({children:e,"data-testid":t}){const n=F.exports.useMemo(()=>Fe.Children.toArray(e),[e]),s=$i(n),[o,i]=F.exports.useState(n[n.length-1]),[r,l]=F.exports.useState(null),[a,c]=F.exports.useState(null);F.exports.useEffect(function(){if(s===void 0||n===s)return;const g=n[n.length-1];n.length===s.length||s.length===0||r!==null||a!==null?r!==null&&g!==r?l(g):g!==a&&g!==o&&i(g):n.length>s.length?l(g):n.length<s.length&&(i(g),c(s[s.length-1]))},[n,s,r,a,o]);const d=F.exports.useCallback(()=>{i(r),l(null)},[r]),u=F.exports.useCallback(()=>{c(null)},[]);return y("div",{className:"navigation-stack",children:[m("div",{className:"main-view","data-testid":t,children:o}),m($t,{in:a!=null,timeout:Ue.transitionMidMs,classNames:"slide-right",onEntered:u,children:m(Oe,{children:a!=null&&m("div",{className:"popping-view",children:a})})}),m($t,{in:r!=null,timeout:Ue.transitionMidMs,classNames:"slide-left",onEntered:d,children:m(Oe,{children:r!=null&&m("div",{className:"pushing-view",children:r})})})]})}function Zc({children:e,disabled:t,value:n,"data-testid":s}){return m("option",{value:n,disabled:t,"data-testid":s,children:e})}function zi(e){const{children:t,disabled:n=!1,name:s,onChange:o,value:i="","data-testid":r}=e,[l]=F.exports.useState(s!=null?s:Ln());return m(Oe,{children:Fe.Children.map(t,a=>{var c,d;return a?Fe.cloneElement(a,{name:l,onChange:(c=a.props.onChange)!=null?c:o,checked:i===a.props.value,disabled:(d=a.props.disabled)!=null?d:n,"data-testid":r}):null})})}function Jc({children:e,onBlur:t,onChange:n,className:s,defaultValue:o,name:i,value:r,disabled:l,"data-testid":a}){const c=F.exports.useCallback(d=>{n(d.target.value)},[n]);return m("select",{className:ee("custom-select",s),onBlur:t,onChange:c,defaultValue:o,value:r,name:i,disabled:l,"data-testid":a,children:e})}class Cl extends Error{constructor(){super(...arguments),this.isAssertionFailed=!0}}function Rr(e){if(e==null)throw new Cl(`Expected 'val' to be defined, but received ${e}`)}class hi extends Error{constructor(){super(...arguments),this.isPasteError=!0}}function ke(e){return(e==null?void 0:e.isEditable)!==void 0}function yr(e){if(!ke(e))throw new Cl(`Expected 'model' to be editable, but received ${e}`)}function Ae(e){return(e==null?void 0:e.hasExpandableRows)!==void 0}var Nt=(e=>(e.DOWN="DOWN",e.UP="UP",e.LEFT="LEFT",e.RIGHT="RIGHT",e))(Nt||{});const ae=class{static normalize(e,t,n,s){let o=e,i=t,r=n,l=s;return o!=null&&r!=null&&r<o&&(o=r,r=e),i!=null&&l!=null&&l<i&&(i=l,l=t),[o,i,r,l]}static makeNormalized(e,t,n,s){return new ae(...ae.normalize(e,t,n,s))}static makeCell(e,t){return new ae(e,t,e,t)}static makeColumn(e){return new ae(e,null,e,null)}static makeRow(e){return new ae(null,e,null,e)}static minOrNull(e,t){return e==null||t==null?null:Math.min(e,t)}static maxOrNull(e,t){return e==null||t==null?null:Math.max(e,t)}static consolidate(e){const t=e.slice();let n=!0;for(;n;){n=!1;for(let s=0;s<t.length&&!n;s+=1){const o=t[s];for(let i=t.length-1;i>s;i-=1){const r=t[i];if(o.contains(r))t.splice(i,1);else if(r.contains(o)){n=!0,t[s]=r,t.splice(i,1);break}else if(o.startRow===r.startRow&&o.endRow===r.endRow){if(o.touches(r)){const{startRow:l,endRow:a}=o,c=ae.minOrNull(o.startColumn,r.startColumn),d=ae.maxOrNull(o.endColumn,r.endColumn);n=!0,t[s]=new ae(c,l,d,a),t.splice(i,1);break}}else if(o.startColumn===r.startColumn&&o.endColumn===r.endColumn&&o.touches(r)){const{startColumn:l,endColumn:a}=o,c=ae.minOrNull(o.startRow,r.startRow),d=ae.maxOrNull(o.endRow,r.endRow);n=!0,t[s]=new ae(l,c,a,d),t.splice(i,1);break}}}}return t}static isAxisRangeTouching(e,t,n,s){return e==null?t==null||n==null?!0:n<=t+1:t==null?s==null?!0:s>=e-1:n==null?s==null?!0:e<=s+1:s==null?t>=n-1:n>=e-1?n<=t+1:s>=e-1}static rangeArraysEqual(e,t){if(e===t)return!0;if(e==null||t==null||e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(!e[n].equals(t[n]))return!1;return!0}static intersection(e,t){if(e.equals(t))return e;let{startColumn:n,startRow:s,endColumn:o,endRow:i}=e;return n=n!=null&&t.startColumn!=null?Math.max(n,t.startColumn):n!=null?n:t.startColumn,o=o!=null&&t.endColumn!=null?Math.min(o,t.endColumn):o!=null?o:t.endColumn,s=s!=null&&t.startRow!=null?Math.max(s,t.startRow):s!=null?s:t.startRow,i=i!=null&&t.endRow!=null?Math.min(i,t.endRow):i!=null?i:t.endRow,n!=null&&n>(o!=null?o:-1)||s!=null&&s>(i!=null?i:-1)?null:new ae(n,s,o,i)}static subtractFromRange(e,t){const n=[],s=ae.intersection(e,t);return s==null?[e]:(s.startRow!=null&&(e.startRow==null||e.startRow<s.startRow)&&n.push(new ae(e.startColumn,e.startRow,e.endColumn,s.startRow-1)),s.startColumn!=null&&(e.startColumn==null||e.startColumn<s.startColumn)&&n.push(new ae(e.startColumn,s.startRow,s.startColumn-1,s.endRow)),s.endColumn!=null&&(e.endColumn==null||e.endColumn>s.endColumn)&&n.push(new ae(s.endColumn+1,s.startRow,e.endColumn,s.endRow)),s.endRow!=null&&(e.endRow==null||e.endRow>s.endRow)&&n.push(new ae(e.startColumn,s.endRow+1,e.endColumn,e.endRow)),n)}static subtractFromRanges(e,t){const n=[];for(let s=0;s<e.length;s+=1)n.push(...ae.subtractFromRange(e[s],t));return n}static subtractRangesFromRanges(e,t){let n=[...e];for(let s=0;s<t.length;s+=1)n=ae.subtractFromRanges(n,t[s]);return n}static isBounded(e){return e.startRow!=null&&e.startColumn!=null&&e.endRow!=null&&e.endColumn!=null}static boundedRange(e,t,n){var s,o,i,r;return ae.isBounded(e)?e:new ae((s=e.startColumn)!=null?s:0,(o=e.startRow)!=null?o:0,(i=e.endColumn)!=null?i:t-1,(r=e.endRow)!=null?r:n-1)}static boundedRanges(e,t,n){return e.map(s=>ae.boundedRange(s,t,n))}static offset(e,t,n){return new ae(e.startColumn!=null?e.startColumn+t:null,e.startRow!=null?e.startRow+n:null,e.endColumn!=null?e.endColumn+t:null,e.endRow!=null?e.endRow+n:null)}static nextCell(e,t=null,n=null,s=ae.SELECTION_DIRECTION.DOWN){if(e.length===0)return null;let o=-1;if(t!=null&&n!=null&&(o=e.findIndex(i=>i.containsCell(t,n)),o>=0)){const r=e[o].nextCell(t,n,s);if(r!=null)return r}switch(s){case ae.SELECTION_DIRECTION.DOWN:case ae.SELECTION_DIRECTION.RIGHT:{const i=o<e.length-1?o+1:0;return e[i].startCell(s)}case ae.SELECTION_DIRECTION.LEFT:case ae.SELECTION_DIRECTION.UP:{const i=o>0?o-1:e.length-1;return e[i].startCell(s)}default:throw new Error(`Invalid direction: ${s}`)}}static cellCount(e){return e.reduce((t,n)=>{var s,o,i,r;return t+(((s=n.endRow)!=null?s:NaN)-((o=n.startRow)!=null?o:NaN)+1)*(((i=n.endColumn)!=null?i:NaN)-((r=n.startColumn)!=null?r:NaN)+1)},0)}static rowCount(e){return e.reduce((t,n)=>{var s,o;return t+((s=n.endRow)!=null?s:NaN)-((o=n.startRow)!=null?o:NaN)+1},0)}static columnCount(e){return e.reduce((t,n)=>{var s,o;return t+((s=n.endColumn)!=null?s:NaN)-((o=n.startColumn)!=null?o:NaN)+1},0)}static containsCell(e,t,n){for(let s=0;s<e.length;s+=1)if(e[s].containsCell(t,n))return!0;return!1}static forEachCell(e,t,n=ae.SELECTION_DIRECTION.RIGHT){for(let s=0;s<e.length;s+=1)e[s].forEach(t,n)}constructor(e,t,n,s){this.startColumn=e,this.startRow=t,this.endColumn=n,this.endRow=s}equals(e){return this.startColumn===e.startColumn&&this.startRow===e.startRow&&this.endColumn===e.endColumn&&this.endRow===e.endRow}contains(e){return(this.startColumn==null||e.startColumn!=null&&this.startColumn<=e.startColumn)&&(this.startRow==null||e.startRow!=null&&this.startRow<=e.startRow)&&(this.endColumn==null||e.endColumn!=null&&this.endColumn>=e.endColumn)&&(this.endRow==null||e.endRow!=null&&this.endRow>=e.endRow)}containsCell(e,t){return e==null||t==null?!1:(this.startColumn==null||this.startColumn<=e)&&(this.endColumn==null||this.endColumn>=e)&&(this.startRow==null||this.startRow<=t)&&(this.endRow==null||this.endRow>=t)}touches(e){return ae.isAxisRangeTouching(this.startRow,this.endRow,e.startRow,e.endRow)&&ae.isAxisRangeTouching(this.startColumn,this.endColumn,e.startColumn,e.endColumn)}subtract(e){return ae.subtractFromRange(this,e)}startCell(e=ae.SELECTION_DIRECTION.DOWN){if(!ae.isBounded(this))throw new Error("Cannot get the startCell of an unbounded range");switch(e){case ae.SELECTION_DIRECTION.DOWN:case ae.SELECTION_DIRECTION.RIGHT:return{column:this.startColumn,row:this.startRow};case ae.SELECTION_DIRECTION.LEFT:case ae.SELECTION_DIRECTION.UP:return{column:this.endColumn,row:this.endRow};default:throw new Error(`Invalid direction: ${e}`)}}nextCell(e,t,n){if(!ae.isBounded(this))throw new Error("Bounded range required");if(e==null||t==null)throw new Error("Require a non-null cursor");const{startColumn:s,endColumn:o,startRow:i,endRow:r}=this;switch(n){case ae.SELECTION_DIRECTION.DOWN:if(t<r)return{column:e,row:Math.max(t+1,i)};if(e<o)return{column:Math.max(e+1,s),row:i};break;case ae.SELECTION_DIRECTION.UP:if(t>i)return{column:e,row:Math.min(t-1,r)};if(e>s)return{column:Math.min(e-1,o),row:r};break;case ae.SELECTION_DIRECTION.RIGHT:if(e<o)return{column:Math.max(e+1,s),row:t};if(t<r)return{column:s,row:Math.max(t+1,i)};break;case ae.SELECTION_DIRECTION.LEFT:if(e>s)return{column:Math.min(e-1,o),row:t};if(t>i)return{column:o,row:Math.min(t-1,r)};break;default:throw new Error(`Invalid direction: ${n}`)}return null}forEach(e,t=ae.SELECTION_DIRECTION.RIGHT){var i;let n=0,{column:s,row:o}=this.startCell(t);for(;s!=null&&o!=null;)e(s,o,n),n+=1,{column:s,row:o}=(i=this.nextCell(s,o,t))!=null?i:{}}};let Q=ae;Q.SELECTION_DIRECTION=Nt;function ed(e){return Array.isArray(e)&&e.length===2&&(e[0]===null||typeof e[0]=="number")&&(e[1]===null||typeof e[1]=="number")}function Eo(e){return ed(e)&&e[0]!=null&&e[1]!=null}const ue=class{static getGridPointFromXY(e,t,n){const s=ue.getColumnAtX(e,n),o=ue.getRowAtY(t,n),i=ue.getColumnHeaderDepthAtY(t,n);return{x:e,y:t,row:o,column:s,columnHeaderDepth:i}}static getCellInfoFromXY(e,t,n){const{row:s,column:o}=ue.getGridPointFromXY(e,t,n),{allColumnWidths:i,allRowHeights:r,allColumnXs:l,allRowYs:a,modelColumns:c,modelRows:d}=n,u=s!==null?d.get(s):null,h=o!==null?c.get(o):null,g=o!==null?l.get(o):null,p=s!==null?a.get(s):null,f=o!==null?i.get(o):null,C=s!==null?r.get(s):null;return{row:s,column:o,modelRow:u!=null?u:null,modelColumn:h!=null?h:null,left:g!=null?g:null,top:p!=null?p:null,columnWidth:f!=null?f:null,rowHeight:C!=null?C:null}}static getColumnHeaderDepthAtY(e,t){const n=ue.getRowAtY(e,t),{columnHeaderHeight:s,columnHeaderMaxDepth:o}=t;if(n===null&&e<=s*o)return Be(o-Math.ceil(e/s),0,o-1)}static iterateFloatingStart(e,t,n){for(let s=0;s<e&&s<t;s+=1){const o=n(s);if(o!==void 0)return o}}static iterateFloatingEnd(e,t,n){for(let s=0;s<e&&t-(e-s)>=0;s+=1){const o=n(t-(e-s));if(o!==void 0)return o}}static iterateFloating(e,t,n,s){const o=ue.iterateFloatingStart(e,n,s);return o!==void 0?o:ue.iterateFloatingEnd(t,n,s)}static iterateAllItems(e,t,n,s,o,i){const r=Math.max(e,n),l=Math.min(t,o-s-1);let a=ue.iterateFloating(n,s,o,i);if(a!==void 0)return a;for(let c=r;c<=l;c+=1)if(a=i(c),a!==void 0)return a}static isInItem(e,t,n,s){var r,l;const o=(r=t.get(e))!=null?r:0,i=(l=n.get(e))!=null?l:0;return o<=s&&s<=o+i}static getItemAtOffset(e,t,n,s,o,i,r,l=!1){const a=l?void 0:ue.iterateFloating(n,s,t,c=>{if(ue.isInItem(c,i,r,e))return c});if(!l&&a!==void 0)return a;for(let c=0;c<o.length;c+=1){const d=o[c];if(ue.isInItem(d,i,r,e))return d}return null}static getColumnAtX(e,t,n=!1){const{columnCount:s,floatingLeftColumnCount:o,floatingRightColumnCount:i,visibleColumns:r,allColumnXs:l,allColumnWidths:a,gridX:c}=t;return e<c?null:this.getItemAtOffset(e-c,s,o,i,r,l,a,n)}static getRowAtY(e,t){const{floatingTopRowCount:n,floatingBottomRowCount:s,rowCount:o,visibleRows:i,allRowYs:r,allRowHeights:l,gridY:a}=t;return e<a?null:this.getItemAtOffset(e-a,o,n,s,i,r,l)}static getNextShownItem(e,t,n,s){let o=n.findIndex(i=>i===e)||0;for(o-=1;o!=null&&o>=0;){const i=n[o],r=t.get(i);if(r!=null&&s.get(r)!==0)return i;o-=1}return null}static getNextShownColumn(e,t){const{modelColumns:n,visibleColumns:s,userColumnWidths:o}=t;return ue.getNextShownItem(e,n,s,o)}static getNextShownRow(e,t){const{modelRows:n,visibleRows:s,userRowHeights:o}=t;return ue.getNextShownItem(e,n,s,o)}static getColumnSeparatorIndex(e,t,n,s){var w,S,T,R;const{rowHeaderWidth:o,columnHeaderHeight:i,floatingColumns:r,floatingLeftWidth:l,visibleColumns:a,allColumnXs:c,allColumnWidths:d,columnHeaderMaxDepth:u}=n,{allowColumnResize:h,headerSeparatorHandleSize:g}=s;if(u*i<t||!h||g<=0)return null;const p=e-o,f=g*.5;let C=!1;for(let b=r.length-1;b>=0;b-=1){const v=r[b],D=(w=c.get(v))!=null?w:0,A=(S=d.get(v))!=null?S:0,N=A===0;if(!C||!N){let L=D+A;N?L+=f:C&&(L-=f);const k=L-f,x=L+f;if(k<=p&&p<=x)return v;C=N}}C=!1;for(let b=a.length-1;b>=0;b-=1){const v=a[b],D=(T=c.get(v))!=null?T:0,A=(R=d.get(v))!=null?R:0,N=A===0;if(D<l-A)return null;if(!C||!N){let L=D+A;N?L+=f:C&&(L-=f);const k=L-f,x=L+f;if(k<=p&&p<=x)return v;C=N}}return null}static isItemHidden(e,t){return t.get(e)===0}static isColumnHidden(e,t){const{allColumnWidths:n}=t;return ue.isItemHidden(e,n)}static isFloatingRow(e,t){if(e==null)return!1;const{floatingTopRowCount:n,floatingBottomRowCount:s,rowCount:o}=t;return e<n||e>=o-s}static isFloatingColumn(e,t){if(e==null)return!1;const{floatingLeftColumnCount:n,floatingRightColumnCount:s,columnCount:o}=t;return e<n||e>=o-s}static getHiddenItems(e,t,n){if(!ue.isItemHidden(e,t))return[];const s=[e],o=n.findIndex(i=>i===e);for(let i=o-1;i>=0;i-=1){const r=n[i];if(!ue.isItemHidden(r,t))break;s.push(r)}return s}static getHiddenColumns(e,t){const{visibleColumns:n,allColumnWidths:s}=t;return ue.getHiddenItems(e,s,n)}static getRowSeparatorIndex(e,t,n,s){var p,f;const{rowHeaderWidth:o,columnHeaderHeight:i,visibleRows:r,allRowYs:l,allRowHeights:a}=n,{allowRowResize:c,headerSeparatorHandleSize:d}=s;if(o<e||!c||d<=0)return null;const u=t-i,h=d*.5;let g=!1;for(let C=r.length-1;C>=0;C-=1){const w=r[C],S=(p=l.get(w))!=null?p:0,T=(f=a.get(w))!=null?f:0,R=T===0;if(!g||!R){let b=S+T;R?b+=h:g&&(b-=h);const v=b-h,D=b+h;if(v<=u&&u<=D)return w;g=R}}return null}static isRowHidden(e,t){const{allRowHeights:n}=t;return ue.isItemHidden(e,n)}static getHiddenRows(e,t){const{visibleRows:n,allRowHeights:s}=t;return ue.getHiddenItems(e,s,n)}static moveItem(e,t,n){if(e===t)return[...n];const s=[...n],o=s[s.length-1];return o!=null&&!Eo(o.from)&&o.to===e?o.from===t?s.pop():s[s.length-1]={...o,to:t}:s.push({from:e,to:t}),s}static moveRange(e,t,n,s=!1){if(e[0]===e[1])return ue.moveItem(e[0],t,n);let o=t;if(s&&e[0]<t&&(o-=e[1]-e[0]),e[0]===o)return[...n];const i=[...n],r=i[i.length-1];r!=null&&Eo(r.from)&&r.from[1]-r.from[0]===e[1]-e[0]&&r.to===e[0]?i[i.length-1]={...r,to:o}:i.push({from:e,to:o});const l=i[i.length-1];return Eo(l.from)&&l.from[0]===l.to&&i.pop(),i}static moveItemOrRange(e,t,n,s=!1){return Array.isArray(e)?ue.moveRange(e,t,n,s):ue.moveItem(e,t,n)}static applyItemMoves(e,t,n,s=!1){var i,r;let o=[[e,t]];for(let l=s?n.length-1:0;s?l>=0:l<n.length;s?l-=1:l+=1){const{from:a,to:c}=n[l];let d=1,u;Eo(a)?(d=a[1]-a[0]+1,[u]=a):u=a;const h=s?c:u,g=h+d-1,p=s?u:c,f=p-h,C=[];for(let w=0;w<o.length;w+=1){const S=(i=o[w][0])!=null?i:Number.NEGATIVE_INFINITY,T=(r=o[w][1])!=null?r:Number.POSITIVE_INFINITY;let R;const b=[[S,h-1],[h,g],[g+1,T]].map(([v,D])=>[Math.max(v,S),Math.min(D,T)]).filter(([v,D])=>v<=D).map(v=>{const[D,A]=v;return h<=D&&g>=A?(R=[D+f,A+f],R):g<D?[D-d,A-d]:v}).map(v=>{const[D,A]=v;return p>D&&p<=A?[[D,p-1],[p+d,A+d]]:v===R?[v]:p<=D?[[D+d,A+d]]:[v]}).flat();C.push(...b)}o=C.map(([w,S])=>[Number.isFinite(w)?w:null,Number.isFinite(S)?S:null])}return o}static translateRange(e,t,n,s){const o=ue.applyItemMoves(e.startColumn,e.endColumn,t,s),i=ue.applyItemMoves(e.startRow,e.endRow,n,s),r=[];for(let l=0;l<o.length;l+=1){const a=o[l];for(let c=0;c<i.length;c+=1){const d=i[c];r.push(new Q(a[0],d[0],a[1],d[1]))}}return r}static getModelIndex(e,t){return ue.applyItemMoves(e,e,t,!0)[0][0]}static getModelIndexes(e,t){return e.map(n=>ue.getModelIndex(n,t))}static getModelRangeIndexes(e,t,n){return ue.applyItemMoves(e,t,n,!0)}static getModelRange(e,t=ve,n=ve){return ue.translateRange(e,t,n,!0)}static getModelRanges(e,t=ve,n=ve){const s=[];for(let o=0;o<e.length;o+=1)s.push(...ue.getModelRange(e[o],t,n));return s}static getVisibleRangeIndexes(e,t,n){return ue.applyItemMoves(e,t,n,!1)}static getVisibleRange(e,t=ve,n=ve){return this.translateRange(e,t,n,!1)}static getVisibleRanges(e,t=ve,n=ve){const s=[];for(let o=0;o<e.length;o+=1)s.push(...ue.getVisibleRange(e[o],t,n));return s}static getVisibleIndex(e,t){return ue.applyItemMoves(e,e,t)[0][0]}static getVisibleIndexes(e,t){return e.map(n=>ue.getVisibleIndex(n,t))}static isMacPlatform(){const{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return ue.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){const t=ue.getModifierKey();return e[t]}static checkColumnHidden(e,t){return t.get(e)===0}static checkAllColumnsHidden(e,t){return t.size===0?!1:e.every(n=>t.get(n)===0)}static getScrollDragBounds(e,t,n){const{gridX:s,gridY:o,width:i,height:r,floatingTopRowCount:l,floatingBottomRowCount:a,floatingLeftColumnCount:c,floatingRightColumnCount:d,floatingLeftWidth:u,floatingRightWidth:h,floatingTopHeight:g,floatingBottomHeight:p,columnCount:f,rowCount:C}=e;let w=s,S=o,T=i,R=r;return n!=null&&(n>c&&(w+=u),n<f-d&&(T-=h)),t!=null&&(t>l&&(S+=g),t<C-a&&(R-=p)),{x1:w,y1:S,x2:T,y2:R}}static getScrollDelta(e,t=1024,n=768,s=20,o=20){let{deltaX:i,deltaY:r}=e;return!ue.isMacPlatform()&&e.shiftKey&&e.deltaX===0&&e.deltaY!==0&&(i=e.deltaY,r=e.deltaX),(e==null?void 0:e.deltaMode)===WheelEvent.DOM_DELTA_PAGE?(i*=t,r*=n):(e==null?void 0:e.deltaMode)===WheelEvent.DOM_DELTA_LINE&&(ue.isMacPlatform()?(i=Math.round(i*s),r=Math.round(r*o)):(i=Math.round(i*this.PIXELS_PER_LINE),r=Math.round(r*this.PIXELS_PER_LINE))),{deltaX:i,deltaY:r}}static compareRanges(e,t){return e[0]==null||e[1]==null||t[0]==null||t[1]==null?0:e[0]!==t[0]?e[0]-t[0]:e[1]-t[1]}static mergeSortedRanges(e){const t=[];for(let n=0;n<e.length;n+=1){const s=e[n],o=s[0],i=s[1];n===0?t.push([o,i]):o-1<=t[t.length-1][1]?t[t.length-1][1]=Math.max(t[t.length-1][1],i):t.push([o,i])}return t}};let H=ue;H.PIXELS_PER_LINE=100/3;function O(e,t,n=void 0){var o;const s=(o=e.get(t))!=null?o:n;if(s!==void 0)return s;throw new Error(`Missing value for key ${t}`)}function vo(e,t=Ks.CACHE_SIZE,n=Math.floor(t/2)){if(e.size>t){const s=e.keys();for(;e.size>n;)e.delete(s.next().value)}}function Fr(e,t,n,s,o){const i=new Map;let r=0;for(let l=0;l<e&&l<n;l+=1)i.set(l,r),r+=O(o,l);r=s;for(let l=0;l<t&&n-l-1>=0;l+=1)r-=O(o,n-l-1),i.set(n-l-1,r);return i}const wl=class{constructor({userColumnWidths:e=new Map,userRowHeights:t=new Map,calculatedColumnWidths:n=new Map,calculatedRowHeights:s=new Map,fontWidths:o=new Map,modelRows:i=new Map,modelColumns:r=new Map,movedRows:l=[],movedColumns:a=[],initialRowHeights:c=new Map,initialColumnWidths:d=new Map}={}){this.userColumnWidths=e,this.userRowHeights=t,this.calculatedRowHeights=s,this.calculatedColumnWidths=n,this.fontWidths=o,this.modelRows=i,this.modelColumns=r,this.movedRows=l,this.movedColumns=a,this.initialRowHeights=c,this.initialColumnWidths=d}getMetrics(e){const{left:t,top:n,leftOffset:s,topOffset:o,width:i,height:r,theme:l,model:a,movedRows:c,movedColumns:d,draggingColumn:u}=e,{rowHeight:h,rowHeaderWidth:g,rowFooterWidth:p,columnWidth:f,columnHeaderHeight:C,minScrollHandleSize:w,scrollBarSize:S}=l;c!==this.movedRows&&(this.movedRows=c,this.modelRows.clear()),d!==this.movedColumns&&(this.movedColumns=d,this.modelColumns.clear());const{columnCount:T,rowCount:R,floatingTopRowCount:b,floatingBottomRowCount:v,floatingLeftColumnCount:D,floatingRightColumnCount:A,columnHeaderMaxDepth:N}=a,L=this.getFirstRow(e),k=this.getFirstColumn(e),x=this.getGridX(e),W=this.getGridY(e),V=Ae(a)&&a.hasExpandableRows?this.calculateTreePaddingX(e):0,K=0,Z=this.getVisibleRowHeights(e),$=this.getVisibleColumnWidths(e,k,V),P=Array.from(Z.keys()),G=Array.from($.keys()),X=new Map([...Z,...this.getFloatingRowHeights(e)]),j=new Map([...$,...this.getFloatingColumnWidths(e)]),de=this.getVisibleColumnXs(j,G,s),me=this.getVisibleRowYs(X,P,o),Ce=P.length>0?P[P.length-1]:n,ye=G.length>0?G[G.length-1]:t,fe=this.getBottomViewport(e,P,me,X),Je=this.getRightViewport(e,G,de,j),Xe=this.getFloatingTopHeight(e,X),$e=this.getFloatingBottomHeight(e,X),Mt=this.getFloatingLeftWidth(e,j),Ct=this.getFloatingRightWidth(e,j),hn=Array.from(j.values()),Ot=Array.from(X.values()),De=hn.reduce((We,rs)=>We+rs,0)-s,ge=Ot.reduce((We,rs)=>We+rs,0)-o,Ke=s+De+p,ze=o+ge,lt=i-x,wt=r-W,mn=this.getLastLeft(e,null,lt-p),xt=this.getLastLeft(e,null,lt-p-S),eo=this.getLastTop(e,null,wt-$e),Xt=this.getLastTop(e,null,wt-$e-S);let St=xt,gn=Xt;mn===0&&eo===0&&(St=0,gn=0);const ss=St>0,Ds=ss?S:0,os=gn>0,is=os?S:0,to=x,no=N*C,pn=i-to-is,Hn=r-no-Ds,ni=T===1?pn/Ke:(T-St)/T,so=R===1?Hn/ze:(R-gn)/R,Is=ss?Be(pn*ni,w,pn-1):0,Ns=os?Be(Hn*so,w,Hn-1):0,oo=O(j,t,0),io=O(X,n,0),si=oo>0?s/oo:0,oi=io>0?o/io:0,ii=T===1?s/(Ke-lt):(t+si)/St,Vn=R===1?o/(ze-wt):(n+oi)/gn,ri=ss?ii*(pn-Is):0,ro=os?Vn*(Hn-Ns):0,lo=[...Array(b).keys(),...[...Array(v).keys()].map(We=>R-We-1)],As=new Map([...me,...this.getFloatingRowYs(e,X,Math.floor(r-W-Ds))]),ao=[...Array(D).keys(),...[...Array(A).keys()].map(We=>T-We-1)],fn=new Map([...de,...this.getFloatingColumnXs(e,j,Math.floor(i-x-is))]),Ms=[];if(u)for(let We=u.range[0];We<=u.range[1];We+=1)Ms.push(We),j.has(We)||j.set(We,this.getVisibleColumnWidth(We,e)),fn.has(We)||fn.set(We,0);const co=P.concat(lo),uo=G.concat(ao).concat(Ms),Os=this.getModelRows(co,e),li=this.getModelColumns(uo,e),ho=this.getVisibleRowTreeBoxes(X,Os,e),mo=this.getTopVisible(e,As,X,P),go=this.getLeftVisible(e,fn,j,G),po=gn>0?this.getBottomVisible(e,As,X,P,W):Ce,fo=St>0?this.getRightVisible(e,fn,j,G,x):ye,{fontWidths:Co,userColumnWidths:ai,userRowHeights:wo,calculatedRowHeights:So,calculatedColumnWidths:bo}=this;return{rowHeight:h,rowHeaderWidth:g,rowFooterWidth:p,rowCount:R,columnWidth:f,columnCount:T,columnHeaderHeight:C,floatingTopRowCount:b,floatingBottomRowCount:v,floatingLeftColumnCount:D,floatingRightColumnCount:A,gridX:x,gridY:W,firstRow:L,firstColumn:k,treePaddingX:V,treePaddingY:K,left:t,top:n,bottom:Ce,right:ye,topOffset:o,leftOffset:s,topVisible:mo,leftVisible:go,bottomVisible:po,rightVisible:fo,bottomViewport:fe,rightViewport:Je,width:i,height:r,maxX:De,maxY:ge,lastLeft:St,lastTop:gn,barHeight:Hn,barTop:no,barWidth:pn,barLeft:to,handleHeight:Ns,handleWidth:Is,hasHorizontalBar:ss,hasVerticalBar:os,verticalBarWidth:is,horizontalBarHeight:Ds,scrollX:ri,scrollY:ro,scrollableContentWidth:Ke,scrollableContentHeight:ze,scrollableViewportWidth:lt,scrollableViewportHeight:wt,visibleRows:P,visibleColumns:G,visibleRowHeights:Z,visibleColumnWidths:$,floatingRows:lo,floatingColumns:ao,allRows:co,allColumns:uo,allRowHeights:X,allColumnWidths:j,floatingTopHeight:Xe,floatingBottomHeight:$e,floatingLeftWidth:Mt,floatingRightWidth:Ct,visibleRowYs:me,visibleColumnXs:de,allRowYs:As,allColumnXs:fn,visibleRowTreeBoxes:ho,modelRows:Os,modelColumns:li,movedRows:c,movedColumns:d,fontWidths:Co,userColumnWidths:ai,userRowHeights:wo,calculatedRowHeights:So,calculatedColumnWidths:bo,columnHeaderMaxDepth:N}}getGridX(e){const{theme:t}=e,{rowHeaderWidth:n}=t;return n}getGridY(e){const{theme:t,model:n}=e,{columnHeaderHeight:s}=t,{columnHeaderMaxDepth:o}=n;return o*s}getVisibleHeight(e,t=this.getFloatingRowHeights(e)){const{height:n,theme:s}=e,{scrollBarSize:o}=s,i=this.getGridY(e),r=this.getFloatingBottomHeight(e,t),l=this.getFloatingTopHeight(e,t);return n-r-l-i-o}getVisibleWidth(e,t=this.getFloatingColumnWidths(e)){const{width:n,theme:s}=e,{scrollBarSize:o,rowFooterWidth:i}=s,r=this.getGridX(e),l=this.getFloatingRightWidth(e,t),a=this.getFloatingLeftWidth(e,t);return n-a-l-r-o-i}getFirstIndex(e,t,n){const s=e.size+1;for(let o=0;o<s;o+=1){const i=t(o,n);if(e.get(i)!==0)return o}return 0}getFirstColumn(e){return this.getFirstIndex(this.userColumnWidths,this.getModelColumn.bind(this),e)}getFirstRow(e){return this.getFirstIndex(this.userRowHeights,this.getModelRow.bind(this),e)}getLastLeft(e,t,n){const{model:s}=e,{columnCount:o,floatingRightColumnCount:i}=s;let r=Math.max(0,o-i-1);t!=null&&(r=t);let l=0;for(;r>=0;){if(l+=this.getVisibleColumnWidth(r,e),l>=n)return Be(r+1,0,t!=null?t:o-1);r-=1}return 0}getLastTop(e,t,n){const{model:s}=e,{rowCount:o,floatingBottomRowCount:i}=s;let r=Math.max(0,o-i-1);t!=null&&(r=t);let l=0;for(;r>=0;){if(l+=this.getVisibleRowHeight(r,e),l>=n)return Be(r+1,0,o-1);r-=1}return 0}getTopForTopVisible(e,t){const n=this.getFloatingTopHeight(e);let s=t,o=0;for(;s>0&&o<n;)s-=1,o+=this.getVisibleRowHeight(s,e);return s}getTopForBottomVisible(e,t){const{height:n}=e,s=this.getGridY(e),o=this.getFloatingBottomHeight(e),i=n-s-o;return this.getLastTop(e,t,i)}getLeftForLeftVisible(e,t){const n=this.getFloatingLeftWidth(e);let s=t,o=0;for(;s>0&&o<n;)s-=1,o+=this.getVisibleColumnWidth(s,e);return s}getLeftForRightVisible(e,t){const{width:n}=e,s=this.getGridX(e),o=this.getFloatingRightWidth(e),i=n-s-o;return this.getLastLeft(e,t,i)}getFloatingRowHeights(e){const{model:t}=e,{floatingTopRowCount:n,floatingBottomRowCount:s,rowCount:o}=t,i=new Map;for(let r=0;r<n&&r<o;r+=1)i.set(r,this.getVisibleRowHeight(r,e));for(let r=0;r<s&&o-r-1>=0;r+=1){const l=o-r-1;i.set(l,this.getVisibleRowHeight(l,e))}return i}getVisibleRowHeights(e){const{top:t,topOffset:n,height:s,model:o}=e;let i=0,r=t;const l=new Map,{rowCount:a}=o;for(;i<s+n&&r<a;){const c=this.getVisibleRowHeight(r,e);l.set(r,c),i+=c,r+=1}return l}getFloatingColumnWidths(e,t=this.getFirstColumn(e),n=this.calculateTreePaddingX(e)){const{model:s}=e,{columnCount:o,floatingLeftColumnCount:i,floatingRightColumnCount:r}=s,l=new Map;for(let a=0;a<i&&a<o;a+=1)l.set(a,this.getVisibleColumnWidth(a,e,t,n));for(let a=0;a<r&&o-a-1>=0;a+=1){const c=o-a-1;l.set(c,this.getVisibleColumnWidth(c,e,t,n))}return l}getVisibleColumnWidths(e,t=this.getFirstColumn(e),n=this.calculateTreePaddingX(e)){const{left:s,leftOffset:o,width:i,model:r}=e;let l=0,a=s;const c=new Map,{columnCount:d}=r;for(;l<i+o&&a<d;){const u=this.getVisibleColumnWidth(a,e,t,n);c.set(a,u),l+=u,a+=1}return c}getFloatingColumnXs(e,t,n){const{model:s}=e,{columnCount:o,floatingLeftColumnCount:i,floatingRightColumnCount:r}=s;return Fr(i,r,o,n,t)}getVisibleColumnXs(e,t,n){const s=new Map;let o=-n;for(let i=0;i<t.length;i+=1){const r=t[i],l=O(e,r);s.set(r,o),o+=l}return s}getFloatingRowYs(e,t,n){const{model:s}=e,{floatingTopRowCount:o,floatingBottomRowCount:i,rowCount:r}=s;return Fr(o,i,r,n,t)}getVisibleRowYs(e,t,n){const s=new Map;let o=-n;for(let i=0;i<t.length;i+=1){const r=t[i],l=O(e,r);s.set(r,o),o+=l}return s}getVisibleRowTreeBoxes(e,t,n){const s=new Map,{model:o,theme:i}=n,{treeDepthIndent:r,treeHorizontalPadding:l}=i;return Ae(o)&&o.hasExpandableRows&&e.forEach((a,c)=>{const d=O(t,c);if(o.isRowExpandable(d)){const u=o.depthForRow(d),h=u*r+l,g=(u+1)*r+l,p=0,f=a;s.set(c,{x1:h,y1:p,x2:g,y2:f})}}),s}getFloatingLeftWidth(e,t=this.getFloatingColumnWidths(e)){const{model:n}=e,{floatingLeftColumnCount:s}=n;let o=0;for(let i=0;i<s;i+=1)o+=O(t,i);return o}getFloatingRightWidth(e,t=this.getFloatingColumnWidths(e)){const{model:n}=e,{floatingRightColumnCount:s,columnCount:o}=n;let i=0;for(let r=0;r<s;r+=1)i+=O(t,o-r-1);return i}getFloatingTopHeight(e,t=this.getFloatingRowHeights(e)){const{model:n}=e,{floatingTopRowCount:s}=n;let o=0;for(let i=0;i<s;i+=1)o+=O(t,i);return o}getFloatingBottomHeight(e,t=this.getFloatingRowHeights(e)){const{model:n}=e,{floatingBottomRowCount:s,rowCount:o}=n;let i=0;for(let r=0;r<s;r+=1)i+=O(t,o-r-1);return i}getTopVisible(e,t,n,s){const o=this.getFloatingTopHeight(e,n);for(let i=0;i<s.length;i+=1){const r=s[i];if(O(t,r)>=o)return r}return 0}getLeftVisible(e,t,n,s){const o=this.getFloatingLeftWidth(e,n);for(let i=0;i<s.length;i+=1){const r=s[i];if(O(t,r)>=o)return r}return 0}getBottomVisible(e,t,n,s,o){const{height:i,theme:r}=e,{scrollBarSize:l}=r,a=this.getFloatingBottomHeight(e,n),c=i-o-l-a;for(let d=s.length-1;d>=0;d-=1){const u=s[d],h=O(t,u),g=O(n,u);if(h+g<=c)return u}return 0}getRightVisible(e,t,n,s,o){const{width:i,theme:r}=e,{scrollBarSize:l}=r,a=this.getFloatingRightWidth(e,n),c=i-o-l-a;for(let d=s.length-1;d>=0;d-=1){const u=s[d],h=O(t,u),g=O(n,u);if(h+g<=c)return u}return 0}getBottomViewport(e,t,n,s){const{height:o,theme:i}=e,{rowHeight:r}=i;return this.getLastIndexViewport(t,n,s,o,r)}getRightViewport(e,t,n,s){const{width:o,theme:i}=e,{columnWidth:r}=i;return this.getLastIndexViewport(t,n,s,o,r)}getLastIndexViewport(e,t,n,s,o){let i=0,r=0;return e.length>0&&(i=e[e.length-1],r=O(t,i)+O(n,i)),r<s&&(i+=Math.ceil((s-r)/o)),i}getVisibleItemSize(e,t,n){var s;return(s=t.get(e))!=null?s:n()}getVisibleRowHeight(e,t){const n=this.getModelRow(e,t),s=this.calculateRowHeight(e,n,t);return this.getVisibleItemSize(n,this.userRowHeights,()=>{const o=this.initialRowHeights.get(n);return o!==void 0?o:s})}getVisibleColumnWidth(e,t,n=this.getFirstColumn(t),s=this.calculateTreePaddingX(t)){const o=this.getModelColumn(e,t),i=this.calculateColumnWidth(e,o,t,n,s);return this.getVisibleItemSize(o,this.userColumnWidths,()=>{const r=this.initialColumnWidths.get(o);return r!==void 0?r:i})}getModelRows(e,t){const n=new Map;for(let s=0;s<e.length;s+=1){const o=e[s],i=this.getModelRow(o,t);n.set(o,i)}return n}getModelRow(e,t){if(this.modelRows.has(e))return O(this.modelRows,e);const{movedRows:n}=t,s=H.getModelIndex(e,n);return this.modelRows.set(e,s),s}getModelColumns(e,t){const n=new Map;for(let s=0;s<e.length;s+=1){const o=e[s],i=this.getModelColumn(o,t);n.set(o,i)}return n}getModelColumn(e,t){if(this.modelColumns.has(e))return O(this.modelColumns,e);const{movedColumns:s}=t,o=H.getModelIndex(e,s);return this.modelColumns.set(e,o),o}calculateRowHeight(e,t,n){const{theme:s}=n,{autoSizeRows:o,rowHeight:i}=s;if(!o)return i;const r=this.calculatedRowHeights.get(t);return r!=null?r:(this.calculatedRowHeights.set(t,Math.ceil(i)),vo(this.calculatedRowHeights),i)}calculateColumnWidth(e,t,n,s=this.getFirstColumn(n),o=this.calculateTreePaddingX(n)){const{theme:i}=n,{autoSizeColumns:r,minColumnWidth:l}=i;if(!r){const{columnWidth:h}=i;return h}const a=this.calculateColumnHeaderWidth(t,n),c=this.calculateColumnDataWidth(t,n),d=this.calculatedColumnWidths.get(t);let u=Math.ceil(Math.max(a,c));return u=Math.max(l,u),d!=null&&d>u?u=d:(this.calculatedColumnWidths.set(t,u),vo(this.calculatedColumnWidths)),e===s&&(u+=o),u}calculateColumnHeaderWidth(e,t){const{model:n,theme:s}=t,{headerFont:o,headerHorizontalPadding:i}=s,r=n.textForColumnHeader(e,0);if(r!==void 0&&r!==""){const l=this.getWidthForFont(o,t);return r.length*l+i*2}return i*2}calculateColumnDataWidth(e,t){const{top:n,height:s,width:o,model:i,theme:r}=t,{floatingTopRowCount:l,floatingBottomRowCount:a,rowCount:c}=i,{font:d,cellHorizontalPadding:u,rowHeight:h,rowHeaderWidth:g,rowFooterWidth:p,scrollBarSize:f}=r;let C=0;const w=this.getWidthForFont(d,t),S=s/h,T=Math.ceil(n+S);return H.iterateAllItems(n,T,l,a,c,R=>{const b=this.getModelRow(R,t),v=i.textForCell(e,b);if(v){const D=u*2;C=Math.max(C,v.length*w+D)}}),C=Math.max(Math.min(C,(o-g-f-p)*wl.MAX_COLUMN_WIDTH),u*2),C}calculateTreePaddingX(e){const{top:t,height:n,model:s,theme:o}=e,{rowHeight:i,treeDepthIndent:r}=o;if(!Ae(s)||!s.hasExpandableRows)return 0;let l=0;const a=n/i,c=Math.ceil(t+a);for(let d=t;d<=c;d+=1){const u=this.getModelRow(d,e),h=s.depthForRow(u);l=Math.max(l,r*(h+1))}return l}getWidthForFont(e,t){if(this.fontWidths.has(e))return O(this.fontWidths,e);const{context:n}=t;n.font=e;const s=n.measureText("8"),{width:o}=s;return this.fontWidths.set(e,o),this.fontWidths.set(n.font,o),o}setColumnWidth(e,t){const n=new Map(this.userColumnWidths);n.set(e,Math.ceil(t)),vo(n),this.userColumnWidths=n}resetColumnWidth(e){const t=new Map(this.userColumnWidths);t.delete(e),this.userColumnWidths=t}setRowHeight(e,t){const n=new Map(this.userRowHeights);n.set(e,Math.ceil(t)),vo(n),this.userRowHeights=n}resetRowHeight(e){const t=new Map(this.userRowHeights);t.delete(e),this.userRowHeights=t,this.calculatedRowHeights.delete(e)}};let Ks=wl;Ks.CACHE_SIZE=1e4;Ks.MAX_COLUMN_WIDTH=.8;const td=Object.freeze({allowColumnResize:!0,allowRowResize:!0,autoSelectRow:!1,autoSelectColumn:!1,autoSizeColumns:!0,autoSizeRows:!0,backgroundColor:"#000000",black:"#000000",white:"#ffffff",cellHorizontalPadding:5,headerHorizontalPadding:5,font:"12px Arial, sans serif",gridColumnColor:"#8f8f8f66",gridRowColor:"#8f8f8f66",headerBackgroundColor:"#222222",headerSeparatorColor:"#000000",headerSeparatorHoverColor:"#888888",headerSeparatorHandleSize:5,headerHiddenSeparatorSize:5,headerHiddenSeparatorHoverColor:"#8888FF",headerColor:"#d5d5d5",headerFont:"10px Arial, sans serif",columnHoverBackgroundColor:"#444444",selectedColumnHoverBackgroundColor:"#494949",rowBackgroundColors:"#333333 #222222",rowHoverBackgroundColor:"#444444",selectedRowHoverBackgroundColor:"#494949",minScrollHandleSize:50,scrollBarBackgroundColor:"#111111",scrollBarHoverBackgroundColor:"#333333",scrollBarCasingColor:"#000000",scrollBarCornerColor:"#000000",scrollBarColor:"#555555",scrollBarHoverColor:"#888888",scrollBarActiveColor:"#AAAAAA",scrollBarSize:12,scrollBarHoverSize:16,scrollBarCasingWidth:1,scrollSnapToColumn:!1,scrollSnapToRow:!1,selectionColor:"#4286f433",selectionOutlineColor:"#4286f4",selectionOutlineCasingColor:"#222222",scrollBarSelectionTick:!0,scrollBarSelectionTickColor:"#4286f433",scrollBarActiveSelectionTickColor:"#4286f480",shadowBlur:8,shadowColor:"#000000",textColor:"#ffffff",maxDepth:6,treeDepthIndent:10,treeHorizontalPadding:5,treeLineColor:"#888888",treeMarkerColor:"#cccccc",treeMarkerHoverColor:"#ffffff",rowHeight:20,columnWidth:100,minRowHeight:20,minColumnWidth:55,columnHeaderHeight:20,rowHeaderWidth:30,rowFooterWidth:0,headerResizeSnapThreshold:10,headerResizeHiddenSnapThreshold:8,allowColumnReorder:!0,allowRowReorder:!0,reorderOffset:2,floatingGridColumnColor:"#8f8f8f66",floatingGridRowColor:"#8f8f8f66",floatingRowBackgroundColors:"#393939 #292929",floatingDividerOuterColor:"#000000",floatingDividerInnerColor:"#cccccc"}),pt=(e,t)=>{let n=!1;const s=be(e,{...t,dispose:()=>{n||(n=!0,s.clear(),n=!1)}});return s};function nd(e,t,n=6){const s=yi.hex.lab.raw(e);return s[0]=Math.max(s[0]-s[0]/n*t,0),`#${yi.lab.hex(s)}`}function sd(e,t){const[n,s,o]=yi.hex.rgb(e);return`rgba(${n}, ${s}, ${o}, ${t})`}const Dr={colorWithAlpha:sd,darkenForDepth:nd};class Ye{constructor(t=5e3){this.cursor=null,this.order=t}onDown(t,n,s){return!1}onMove(t,n,s){return!1}onDrag(t,n,s){return!1}onLeave(t,n,s){return!1}onClick(t,n,s){return!1}onContextMenu(t,n,s){return!1}onDoubleClick(t,n,s){return!1}onUp(t,n,s){return!1}onWheel(t,n,s){return!1}}class Sl extends Ye{constructor(){super(...arguments),this.resizingItems=[],this.hiddenItems=[],this.targetSizes=new Map,this.dragOffset=0}onDown(t,n){const{metrics:s}=n,{model:o}=n.props,i=n.getTheme();if(!s)throw new Error("metrics not set");const r=this.getSeparator(t,s,o,i);if(r!=null){const l=r.index;return this.dragOffset=0,this.draggingIndex=l,this.resizingItems=[l],this.hiddenItems=this.getHiddenItems(l,s).reverse(),this.targetSizes.clear(),this.addTargetSize(s,l),this.updateCursor(s,l),this.updateSeparator(n,r),!0}return!1}onMove(t,n){const{metrics:s}=n,{model:o}=n.props,i=n.getTheme();if(!s)throw new Error("metrics not set");const r=this.getSeparator(t,s,o,i);return r!=null?(this.updateCursor(s,r.index),!0):!1}onDrag(t,n){var f;if(this.draggingIndex==null)return!1;const s=t[this.pointProperty],{metricCalculator:o,metrics:i}=n;if(!i)throw new Error("metrics not set");const r=n.getTheme(),l=i[this.visibleOffsetProperty],a=i[this.marginProperty],c=i[this.calculatedSizesProperty],d=i[this.modelIndexesProperty],u=i[this.firstIndexProperty],h=i[this.treePaddingProperty],g=new Map;let p=this.resizingItems[this.resizingItems.length-1];for(;p!=null;){const C=O(l,p),w=s-a-C-this.dragOffset,S=O(d,p),T=this.targetSizes.get(S),R=this.resizingItems.length>1,b=this.hiddenItems.indexOf(p);let v=O(c,S);p===u&&(v+=h);let D=w;Math.abs(w-v)<=r.headerResizeSnapThreshold?D=v:T!==void 0&&w>T&&(R&&b!==0||b>0)?D=T:w<=r.headerResizeHiddenSnapThreshold&&(D=0),g.set(S,D),w<-r.headerResizeSnapThreshold&&D===0?b>=0&&R?(this.resizingItems.pop(),this.removeTargetSize(i,p),p=this.resizingItems[this.resizingItems.length-1],this.dragOffset-=(f=this.targetSizes.get(O(d,p)))!=null?f:0):(p=this.getNextShownItem(p,i),p!==null&&(this.resizingItems.push(p),this.addTargetSize(i,p))):T!==void 0&&w>T+r.headerResizeSnapThreshold&&D===T?b>0?(this.dragOffset+=D,p=this.hiddenItems[b-1],this.resizingItems.push(p),this.addTargetSize(i,p)):R?(this.resizingItems.pop(),this.removeTargetSize(i,p),p=this.resizingItems[this.resizingItems.length-1]):p=null:p=null}return g.forEach((C,w)=>{var T;const S=(T=o[this.initialSizesProperty].get(w))!=null?T:c.get(w);C===S?this.resetSize(o,w):this.setSize(o,w,C)}),this.updateCursor(i,this.draggingIndex),!0}onUp(t,n){return this.draggingIndex!=null&&(this.draggingIndex=void 0,this.resizingItems=[],this.hiddenItems=[],this.targetSizes.clear(),this.updateSeparator(n,null)),!1}onDoubleClick(t,n){const{metrics:s,metricCalculator:o}=n,{model:i}=n.props,r=n.getTheme();if(!s)throw new Error("metrics not set");const l=this.getSeparator(t,s,i,r);if(l!=null){const a=s[this.modelIndexesProperty],c=O(a,l.index),d=O(s[this.calculatedSizesProperty],c),u=o[this.initialSizesProperty].get(c);return d===u?this.resetSize(o,c):this.setSize(o,c,d),n.forceUpdate(),!0}return!1}updateCursor(t,n){const s=t[this.visibleSizesProperty];O(s,n)===0?this.cursor=this.hiddenCursor:this.cursor=this.defaultCursor}addTargetSize(t,n){const s=t[this.modelIndexesProperty],o=t[this.userSizesProperty],i=t[this.calculatedSizesProperty],r=n===0?t[this.treePaddingProperty]:0,l=O(s,n);let a=o.get(l);(a==null||a===0)&&(a=O(i,l)+r),this.targetSizes.set(l,a)}removeTargetSize(t,n){const s=t[this.modelIndexesProperty],o=O(s,n);this.targetSizes.delete(o)}}class Ko extends Sl{constructor(){super(...arguments),this.hiddenCursor="e-resize",this.defaultCursor="col-resize",this.pointProperty="x",this.userSizesProperty="userColumnWidths",this.visibleOffsetProperty="visibleColumnXs",this.visibleSizesProperty="visibleColumnWidths",this.marginProperty="rowHeaderWidth",this.calculatedSizesProperty="calculatedColumnWidths",this.initialSizesProperty="initialColumnWidths",this.modelIndexesProperty="modelColumns",this.firstIndexProperty="firstColumn",this.treePaddingProperty="treePaddingX",this.getHiddenItems=H.getHiddenColumns,this.getNextShownItem=H.getNextShownColumn,this.getSeparator=Ko.getColumnSeparator}static getColumnSeparator(t,n,s,o){if(!o.allowColumnResize)return null;const{x:i,y:r,columnHeaderDepth:l}=t,{modelColumns:a}=n,c=H.getColumnSeparatorIndex(i,r,n,o);return c==null||l==null||l>0?null:a.get(c)!=null?{index:c,depth:0}:null}setSize(t,n,s){t.setColumnWidth(n,s)}resetSize(t,n){t.resetColumnWidth(n)}updateSeparator(t,n){t.setState({draggingColumnSeparator:n,isDragging:n!==null})}}const tn=class{constructor(){this.getCachedTruncatedString=pt((e,t,n,s,o)=>tn.truncateToWidth(e,t,n,s,o),{max:1e4}),this.getCachedBackgroundColors=pt((e,t)=>e.split(" ").map(n=>{const s=[];for(let o=0;o<t;o+=1)s.push(Dr.darkenForDepth(n,o,t));return s}),{max:1e3}),this.getCachedColorWithAlpha=pt((e,t)=>Dr.colorWithAlpha(e,t),{max:1e3}),this.getCachedColorIsDark=pt(e=>Yo.isDark(e),{max:1e3})}static truncate(e,t){return t<e.length?e.substr(0,t)+"\u2026":e}static binaryTruncateToWidth(e,t,n,s=0,o=t.length,i){if(o>=t.length&&e.measureText(t).width<=n)return t;if(i!==void 0){const c=e.measureText(i).width;return i.repeat(Math.max(1,Math.floor(n/c)))}let r=s,l=Math.min(t.length-1,o),a=t;for(;l>=r;){const c=Math.ceil((l+r)/2),d=tn.truncate(t,c);if(e.measureText(d).width<=n){if(a=d,r===c)break;r=c}else if(c===0){a=d;break}else l=c-1}return a}static truncateToWidth(e,t,n,s=tn.DEFAULT_FONT_WIDTH,o){if(n<=0||t.length<=0)return"";const i=Math.min(Math.max(0,Math.floor(n/s/2)-5),t.length),r=Math.min(Math.ceil(n/s*2),t.length);return tn.binaryTruncateToWidth(e,t,n,i,r,o)}drawCanvas(e){const{context:t}=e;t.save(),this.configureContext(t,e),this.drawBackground(t,e),this.drawGrid(t,e),this.drawHeaders(t,e),this.drawFooters(t,e),this.drawDraggingColumn(t,e),this.drawDraggingRow(t,e),this.drawScrollBars(t,e),t.restore()}configureContext(e,t){const{theme:n}=t;e.font=n.font,e.textBaseline="middle",e.lineCap="butt"}drawBackground(e,t){const{theme:n,metrics:s}=t,{width:o,height:i}=s;e.fillStyle=n.backgroundColor,e.fillRect(0,0,o,i)}drawGrid(e,t){const{metrics:n,draggingRow:s,draggingColumn:o}=t,{gridX:i,gridY:r}=n;e.translate(i,r),this.drawGridBackground(e,t,s==null&&o==null),this.drawCellContents(e,t),this.drawFloatingRows(e,t),this.drawFloatingColumns(e,t),e.translate(-i,-r)}drawFloatingRows(e,t){const{draggingRow:n,draggingColumn:s,metrics:o,theme:i}=t,{floatingTopRowCount:r,floatingBottomRowCount:l,floatingRows:a,rowCount:c,visibleColumns:d,allRowYs:u,allRowHeights:h}=o;if(a.length!==0){i.floatingRowBackgroundColors&&this.drawRowStripesForRows(e,t,a,i.floatingRowBackgroundColors),n==null&&s==null&&this.drawFloatingMouseRowHover(e,t),this.drawGridLinesForItems(e,t,d,a,i.floatingGridColumnColor,i.floatingGridRowColor),this.drawCellBackgroundsForItems(e,t,d,a),this.drawFloatingBorders(e,t),r>0&&this.drawSelectedRanges(e,t,{top:0,bottom:r-1,maxY:O(u,r-1)+O(h,r-1)-.5}),l>0&&this.drawSelectedRanges(e,t,{top:c-l-1,bottom:c-1,minY:O(u,c-l)+.5,maxY:O(u,c-1)+O(h,c-1)-.5});for(let g=0;g<d.length;g+=1){const p=d[g];for(let f=0;f<a.length;f+=1){const C=a[f];this.drawCellContent(e,t,p,C)}}}}drawFloatingColumns(e,t){const{draggingRow:n,draggingColumn:s,metrics:o,theme:i}=t,{floatingLeftColumnCount:r,floatingRightColumnCount:l,floatingLeftWidth:a,floatingRightWidth:c,floatingColumns:d,gridX:u,maxX:h,columnCount:g,visibleRows:p,allColumnXs:f,allColumnWidths:C,width:w,height:S}=o;if(d.length!==0){i.floatingRowBackgroundColors&&(this.drawRowStripesForRows(e,t,p,i.floatingRowBackgroundColors,0,a),this.drawRowStripesForRows(e,t,p,i.floatingRowBackgroundColors,w-u-c,h)),n==null&&s==null&&this.drawFloatingMouseRowHover(e,t),e.save(),e.beginPath(),e.rect(0,0,a,S),e.clip(),this.drawGridLinesForItems(e,t,d,p,i.floatingGridColumnColor,i.floatingGridRowColor),e.restore(),this.drawCellBackgroundsForItems(e,t,d,p),this.drawFloatingBorders(e,t),r>0&&this.drawSelectedRanges(e,t,{left:0,maxX:O(f,r-1)+O(C,r-1)}),l>0&&this.drawSelectedRanges(e,t,{left:g-l,right:g-1,minX:O(f,g-l)+.5,maxX:O(f,g-1)+O(C,g-1)});for(let T=0;T<d.length;T+=1){const R=d[T];for(let b=0;b<p.length;b+=1){const v=p[b];this.drawCellContent(e,t,R,v)}}}}drawFloatingBorders(e,t){const{metrics:n,theme:s}=t,{floatingTopRowCount:o,floatingBottomRowCount:i,floatingLeftColumnCount:r,floatingRightColumnCount:l,rowCount:a,columnCount:c,allRowYs:d,allColumnXs:u,allRowHeights:h,allColumnWidths:g,maxX:p,maxY:f}=n,{floatingDividerOuterColor:C,floatingDividerInnerColor:w}=s;if(e.lineWidth=3,e.beginPath(),e.strokeStyle=C,o>0){const S=O(d,o-1)+O(h,o-1)+.5;e.moveTo(0,S),e.lineTo(p,S)}if(i>0){const S=O(d,a-i)-.5;e.moveTo(0,S),e.lineTo(p,S)}if(r>0){const S=O(u,r-1)+O(g,r-1)+.5;e.moveTo(S,0),e.lineTo(S,f)}if(l>0){const S=O(u,c-l)-.5;e.moveTo(S,0),e.lineTo(S,f)}if(e.stroke(),e.beginPath(),e.lineWidth=1,e.strokeStyle=w,o>0){const S=O(d,o-1)+O(h,o-1)+.5;e.moveTo(0,S),e.lineTo(p,S)}if(i>0){const S=O(d,a-i)-.5;e.moveTo(0,S),e.lineTo(p,S)}if(r>0){const S=O(u,r-1)+O(g,r-1)+.5;e.moveTo(S,0),e.lineTo(S,f)}if(l>0){const S=O(u,c-l)-.5;e.moveTo(S,0),e.lineTo(S,f)}e.stroke()}drawGridBackground(e,t,n=!1){this.drawRowStripes(e,t),n&&(this.drawMouseColumnHover(e,t),this.drawMouseRowHover(e,t)),this.drawGridLines(e,t),this.drawCellBackgrounds(e,t);const{metrics:s}=t,{bottom:o,right:i,floatingBottomRowCount:r,floatingLeftColumnCount:l,floatingRightColumnCount:a,floatingTopRowCount:c,columnCount:d,rowCount:u,allRowHeights:h,allRowYs:g,allColumnXs:p,allColumnWidths:f,width:C,height:w}=s;this.drawSelectedRanges(e,t,{bottom:Math.min(o,u-r-1),right:Math.min(i,d-a-1),minX:l>0&&p.has(l+1)?O(p,l+1):-10,minY:c>0&&g.has(c+1)?O(g,c+1):-10,maxX:a>0&&p.has(d-a-1)?O(p,d-a-1)+O(f,d-a-1)-.5:C+10,maxY:r>0&&g.has(u-r-1)?O(g,u-r-1)+O(h,u-r-1)-.5:w+10})}drawRowStripes(e,t){const{metrics:n,theme:s}=t,{visibleRows:o}=n,{rowBackgroundColors:i}=s;!i||this.drawRowStripesForRows(e,t,o,i)}drawRowStripesForRows(e,t,n,s,o=0,i=t.metrics.maxX){const{theme:r,metrics:l,model:a}=t,{maxDepth:c,shadowBlur:d,shadowColor:u}=r,h=this.getCachedBackgroundColors(s,c),{allRowYs:g,allRowHeights:p}=l,f=new Map,C=[],w=[],S=(T,R)=>{const b=Ae(a)?a.depthForRow(T):0,v=h[T%h.length],D=v[Math.min(b,v.length-1)];if(f.has(D)||f.set(D,[]),f.get(D).push(T),R!=null){const A=Ae(a)?a.depthForRow(R):0;A<b?C.push(T):A>b&&w.push(R)}};for(let T=0;T<n.length;T+=1){const R=n[T],b=T>0?n[T-1]:void 0;S(R,b)}if(f.forEach((T,R)=>{e.fillStyle=R,e.beginPath();for(let b=0;b<T.length;b+=1){const v=T[b],D=O(g,v),A=O(p,v);e.rect(o,D,i,A)}e.fill()}),C.length>0){e.save();const T=this.getCachedColorWithAlpha(u,.15),R=this.getCachedColorWithAlpha(u,0),b=e.createLinearGradient(0,0,0,d);b.addColorStop(0,T),b.addColorStop(1,R),e.fillStyle=b;for(let v=0;v<C.length;v+=1){const D=C[v],A=O(g,D);e.translate(0,A),e.fillRect(o,0,i,d),e.translate(0,-A)}e.restore()}if(w.length>0){e.save();const T=this.getCachedColorWithAlpha(u,0),R=this.getCachedColorWithAlpha(u,.15),b=e.createLinearGradient(0,0,0,d);b.addColorStop(0,T),b.addColorStop(1,R),e.fillStyle=b;for(let v=0;v<w.length;v+=1){const D=w[v],A=O(g,D),N=O(p,D),L=A+N-d;e.translate(0,L),e.fillRect(o,0,i,d),e.translate(0,-L)}e.restore()}}drawMouseColumnHover(e,t){const{mouseX:n,mouseY:s,theme:o,metrics:i}=t;if(n==null||s==null)return;const r=H.getColumnAtX(n,i);if(r==null||o.columnHoverBackgroundColor==null)return;const{allColumnWidths:l,allColumnXs:a,maxY:c}=i;if(s>c)return;const d=O(a,r),u=O(l,r);e.fillStyle=o.columnHoverBackgroundColor,e.fillRect(d,0,u,c)}drawMouseRowHover(e,t){const{mouseX:n,mouseY:s,theme:o,metrics:i}=t;if(n==null||s==null)return;const{maxX:r}=i;if(n>r||o.rowHoverBackgroundColor==null)return;const l=H.getRowAtY(s,i);l!=null&&this.drawMouseRowHoverForRow(e,t,l)}drawFloatingMouseRowHover(e,t){const{mouseX:n,mouseY:s,theme:o,metrics:i}=t,{maxX:r,floatingTopRowCount:l,floatingBottomRowCount:a,rowCount:c,rowFooterWidth:d}=i;if(n==null||s==null||n>r+d||o.rowHoverBackgroundColor==null)return;const u=H.getRowAtY(s,i);u!=null&&(u<l||c-a<=u)&&this.drawMouseRowHoverForRow(e,t,u)}drawMouseRowHoverForRow(e,t,n){const{metrics:s,selectedRanges:o,theme:i}=t,{allRowHeights:r,allRowYs:l,maxX:a}=s,c=O(l,n),d=O(r,n);i.rowHoverBackgroundColor!=null&&(e.fillStyle=i.rowHoverBackgroundColor);for(let u=0;u<o.length;u+=1){const{startRow:h,endRow:g}=o[u];if(h!=null&&g!=null&&h<=n&&g>=n){i.selectedRowHoverBackgroundColor!=null&&(e.fillStyle=i.selectedRowHoverBackgroundColor);break}}e.fillRect(0,c,a,d)}drawGridLines(e,t){const{metrics:n,theme:s}=t,{visibleColumns:o,visibleRows:i}=n;this.drawGridLinesForItems(e,t,o,i,s.gridColumnColor,s.gridRowColor)}drawGridLinesForItems(e,t,n,s,o,i){o==null&&i==null||(e.lineWidth=1,e.beginPath(),o!=null&&(e.strokeStyle=o,this.drawGridLinesForColumns(e,t,n)),i!=null&&(e.strokeStyle=i,this.drawGridLinesForRows(e,t,s)),e.stroke())}drawGridLinesForColumns(e,t,n){const{metrics:s}=t,{allColumnXs:o,maxY:i}=s;for(let r=0;r<n.length;r+=1){const l=n[r],a=O(o,l)+.5;e.moveTo(a,0),e.lineTo(a,i)}}drawGridLinesForRows(e,t,n){const{metrics:s}=t,{allRowYs:o,maxX:i}=s,r=i;for(let l=0;l<n.length;l+=1){const a=n[l],c=O(o,a)+.5;e.moveTo(.5,c),e.lineTo(r-.5,c)}}drawCellBackgrounds(e,t){const{metrics:n}=t,{visibleColumns:s,visibleRows:o}=n;this.drawCellBackgroundsForItems(e,t,s,o)}drawCellBackgroundsForItems(e,t,n,s){e.save();for(let o=0;o<n.length;o+=1){const i=n[o];for(let r=0;r<s.length;r+=1){const l=s[r],a=r+1<s.length?s[r+1]:void 0;this.drawCellBackground(e,t,i,l,a)}}e.restore()}drawCellBackground(e,t,n,s,o){const{metrics:i,model:r,theme:l}=t,{firstColumn:a,modelColumns:c,modelRows:d,allColumnXs:u,allColumnWidths:h,allRowYs:g,allRowHeights:p}=i,f=O(d,s),C=O(c,n),w=r.backgroundColorForCell(C,f,l),S=n===a,T=Ae(r)&&r.hasExpandableRows;if(w!=null){const R=O(u,n)+1,b=O(g,s)+1,v=O(h,n)-1,D=O(p,s)-1;e.fillStyle=w,e.fillRect(R,b,v,D)}S&&T&&this.drawCellRowTreeDepthLines(e,t,s,o)}drawCellContents(e,t){const{metrics:n}=t,{visibleColumns:s}=n;for(let o=0;o<s.length;o+=1){const i=s[o];this.drawColumnCellContents(e,t,i)}}drawColumnCellContents(e,t,n){const{metrics:s}=t,{allColumnXs:o,allColumnWidths:i,visibleRows:r,height:l}=s,a=O(o,n),c=O(i,n);e.save(),e.beginPath(),e.rect(a,0,c,l),e.clip();for(let d=0;d<r.length;d+=1){const u=r[d];this.drawCellContent(e,t,n,u)}e.restore()}getTextRenderMetrics(e,t,n,s){const{textAlign:o}=e,{metrics:i,model:r,theme:l}=t,{firstColumn:a,allColumnXs:c,allColumnWidths:d,allRowYs:u,allRowHeights:h}=i,{cellHorizontalPadding:g,treeDepthIndent:p,treeHorizontalPadding:f}=l,C=O(c,n),w=O(u,s),S=O(d,n),T=O(h,s),R=n===a;let b=0;Ae(r)&&r.hasExpandableRows&&R&&(b=p*(r.depthForRow(s)+1)+f);const v=S-b;let D=C+g;const A=w+T*.5;return o==="right"?D=C+v-g:o==="center"&&(D=C+v*.5),D+=b,{width:v-g*2,x:D,y:A}}drawCellContent(e,t,n,s,o){var R;const{metrics:i,model:r,theme:l}=t,{firstColumn:a,fontWidths:c,modelColumns:d,modelRows:u,allRowHeights:h}=i,{textColor:g}=l,p=O(h,s),f=O(u,s),C=O(d,n),w=o!=null?o:r.textForCell(C,f),S=r.truncationCharForCell(C,f),T=n===a;if(w&&p>0){const b=r.textAlignForCell(C,f)||"left";e.textAlign=b;const v=r.colorForCell(C,f,l)||g;e.fillStyle=v;const{width:D,x:A,y:N}=this.getTextRenderMetrics(e,t,n,s),L=(R=c.get(e.font))!=null?R:tn.DEFAULT_FONT_WIDTH,k=this.getCachedTruncatedString(e,w,D,L,S);k&&e.fillText(k,A,N)}T&&Ae(r)&&r.hasExpandableRows&&this.drawCellRowTreeMarker(e,t,s)}drawCellRowTreeMarker(e,t,n){const{metrics:s,model:o,mouseX:i,mouseY:r,theme:l}=t,{firstColumn:a,gridX:c,gridY:d,allColumnXs:u,allColumnWidths:h,allRowYs:g,allRowHeights:p,visibleRowTreeBoxes:f}=s,{treeMarkerColor:C,treeMarkerHoverColor:w}=l,S=O(u,a),T=O(h,a),R=O(g,n),b=O(p,n);if(!Ae(o)||!o.isRowExpandable(n))return;const v=O(f,n),D=i!=null&&r!=null&&i>=c+S&&i<=c+S+T&&r>=d+R&&r<=d+R+b?w:C;this.drawTreeMarker(e,t,S,R,v,D,o.isRowExpanded(n))}drawTreeMarker(e,t,n,s,o,i,r){const{x1:l,y1:a,x2:c,y2:d}=o,u=r?"\u229F":"\u229E",h=n+(l+c)*.5+.5,g=s+(a+d)*.5+.5;e.fillStyle=i,e.textAlign="center",e.fillText(u,h,g)}drawCellRowTreeDepthLines(e,t,n,s){const{metrics:o,model:i,theme:r}=t;if(!Ae(i))return;const l=i.depthForRow(n);if(l===0)return;const{firstColumn:a,allColumnXs:c,allRowYs:d,allRowHeights:u}=o,{treeDepthIndent:h,treeHorizontalPadding:g,treeLineColor:p}=r,f=O(c,a),C=O(d,n),w=O(u,n),S=s!==void 0?i.depthForRow(s):0,T=l>S?l-S:0;if(e.strokeStyle=p,e.lineWidth=1,l-T>0){e.beginPath();for(let R=0;R<l-T;R+=1){const b=f+R*h+h*.5+g+.5;e.moveTo(b,C),e.lineTo(b,C+w)}e.stroke()}if(T>0){e.beginPath();for(let R=l-T;R<l;R+=1){const b=f+R*h+h*.5+g+.5;e.moveTo(b,C),e.lineTo(b,C+Math.ceil(w/2)),e.moveTo(b-.5,C+Math.ceil(w/2)+.5),e.lineTo(b+h-.5,C+Math.ceil(w/2)+.5)}e.stroke()}}drawHeaders(e,t){const{theme:n}=t;e.font=n.headerFont,this.drawColumnHeaders(e,t),this.drawRowHeaders(e,t)}drawFooters(e,t){const{theme:n}=t;e.font=n.headerFont,this.drawRowFooters(e,t)}drawColumnHeaders(e,t){const{mouseX:n,mouseY:s,theme:o,metrics:i,draggingColumnSeparator:r,isDragging:l,model:a}=t,{columnHeaderHeight:c,floatingColumns:d,gridX:u,width:h,visibleColumns:g,allColumnWidths:p,allColumnXs:f,floatingLeftColumnCount:C,floatingLeftWidth:w,floatingRightWidth:S,modelColumns:T,columnHeaderMaxDepth:R}=i;if(c<=0)return;const{headerHiddenSeparatorSize:b,headerHiddenSeparatorHoverColor:v,headerSeparatorColor:D,headerSeparatorHoverColor:A}=o,N=c*.5,L=c*(R-1)+c*.5-N*.5,k=C>0;if(e.save(),this.drawColumnHeadersForRange(e,t,[g[0],g[g.length-1]],{minX:u+w,maxX:h-S}),k&&this.drawColumnHeadersForRange(e,t,[d[0],d[d.length-1]],{minX:u,maxX:u+w}),D){e.strokeStyle=D;const x=[...p.entries()].filter(([W,V])=>V===0).map(([W])=>W);e.beginPath(),e.fillStyle=D;for(let W=0;W<x.length;W+=1){const V=x[W],K=O(f,V),Z=O(p,V),$=u+K+Z+.5-b*.5;e.rect($,L,b,N)}e.fill()}if(A){let{index:x,depth:W}=r!=null?r:{};if(x==null&&n!=null&&s!=null){const K=Ko.getColumnSeparator(H.getGridPointFromXY(n,s,i),i,a,o);x=K==null?void 0:K.index,W=K==null?void 0:K.depth}let V;if(x==null)V=!1;else{const K=T.get(x),Z=T.get(x+1);K==null||Z==null?V=!1:V=a.textForColumnHeader(K,W)!==a.textForColumnHeader(Z,W)}if(V&&x!=null&&W!=null&&(!l||r!=null)){e.strokeStyle=A;const K=O(f,x),Z=O(p,x),$=u+K+Z+.5,P=g.indexOf(x),G=P<g.length-1?g[P+1]:null,X=G!=null?p.get(G):null,j=Z===0,de=X!=null&&X===0;j?(e.strokeStyle=v,e.fillStyle=v,e.fillRect($,L,b*.5,N)):de&&(e.fillStyle=A,e.fillRect($-b*.5,L,b*.5,N)),e.beginPath(),e.moveTo($,(R-W-1)*c),e.lineTo($,(R-W)*c-1),e.stroke()}}e.restore()}drawColumnHeadersForRange(e,t,n,s){const{model:o}=t,{columnHeaderMaxDepth:i}=o;if(i!==0)for(let r=0;r<=i;r+=1)this.drawColumnHeadersAtDepth(e,t,n,s,r)}drawColumnHeadersAtDepth(e,t,n,s,o){var D,A,N,L,k,x;const{metrics:i,model:r,theme:l}=t,{modelColumns:a,allColumnXs:c,gridX:d,calculatedColumnWidths:u,userColumnWidths:h,allColumnWidths:g,movedColumns:p}=i,{columnHeaderHeight:f,columnWidth:C}=l,{columnHeaderMaxDepth:w}=r,{minX:S,maxX:T}=s,R=T-S;if(w===0)return;const b=n[0],v=n[1];if(e.save(),e.translate(0,(w-o-1)*f),o===0){this.drawColumnHeader(e,t,"",S,T);for(let W=b;W<=v;W+=1)this.drawColumnHeaderAtIndex(e,t,W,s)}if(o>0){let W=b;for(;W<=v;){const{columnCount:V}=i,K=O(a,W),Z=r.textForColumnHeader(K,o),$=r.colorForColumnHeader(K,o);let P=O(c,W)+d,G=P+O(g,W);if(Z!=null){let X=W-1;for(;X>=0&&(G-P<R||P>S);){const Ce=(D=a.get(X))!=null?D:H.getModelIndex(X,p);if(Ce==null||r.textForColumnHeader(Ce,o)!==Z)break;P-=(N=(A=h.get(Ce))!=null?A:u.get(Ce))!=null?N:C,X-=1}let j=W+1;for(;j<V&&(G-P<R||G<T);){const Ce=(L=a.get(j))!=null?L:H.getModelIndex(j,p);if(r.textForColumnHeader(Ce,o)!==Z)break;G+=(x=(k=h.get(Ce))!=null?k:u.get(Ce))!=null?x:C,j+=1}W=j-1;const de=G-P>=R;let me=P;de&&(G<T?me=G-R:P<S&&(me=S)),this.drawColumnHeader(e,t,Z,me,Math.min(G-P,R),{backgroundColor:$!=null?$:void 0},s)}W+=1}}e.restore()}drawColumnHeaderAtIndex(e,t,n,s){var p;const{metrics:o,model:i}=t,{modelColumns:r,allColumnWidths:l,allColumnXs:a,gridX:c}=o,d=O(l,n),u=O(a,n)+c,h=O(r,n),g=i.textForColumnHeader(h);g!=null&&this.drawColumnHeader(e,t,g,u,d,{backgroundColor:(p=i.colorForColumnHeader(h))!=null?p:void 0},s)}drawColumnHeader(e,t,n,s,o,i,r){var j;if(o<=0)return;const{metrics:l,theme:a}=t,{headerHorizontalPadding:c,columnHeaderHeight:d,headerBackgroundColor:u,headerColor:h,headerSeparatorColor:g,black:p,white:f}=a,{fontWidths:C,width:w}=l,S=(j=C.get(e.font))!=null?j:tn.DEFAULT_FONT_WIDTH,R=(o-c*2)/S,{backgroundColor:b=u,separatorColor:v=g}=i!=null?i:{};let{textColor:D=h}=i!=null?i:{};try{const de=this.getCachedColorIsDark(b),me=this.getCachedColorIsDark(D);de&&me?D=f:!de&&!me&&(D=p)}catch{}let{minX:A=0,maxX:N=w}=r!=null?r:{};e.save(),e.rect(A,0,N-A,d),e.clip(),b!=null&&(e.fillStyle=b,e.fillRect(s,0,o,d)),v!=null&&(e.strokeStyle=v,e.beginPath(),s>0&&(e.moveTo(s+.5,0),e.lineTo(s+.5,d)),e.moveTo(s+o+.5,0),e.lineTo(s+o+.5,d),e.moveTo(s,d-.5),e.lineTo(s+o,d-.5),e.stroke()),e.beginPath(),e.rect(s,0,o,d),e.clip(),e.fillStyle=D;let L=n;R<=0?L="":L.length>R&&(L=`${L.substring(0,R-1)}\u2026`);const k=L.length*S;let x=s+o*.5;const W=d*.5;A+=c,N-=c;const V=s+c,K=Be(V,A,N),Z=s+o-c,P=Be(Z,A,N)-K,G=x-k*.5<A,X=x+k*.5>N;G?k<P?x=A+k*.5:x=Z-k*.5:X&&(k<P?x=N-k*.5:x=V+k*.5),e.textAlign="center",e.fillText(L,x,W),e.restore()}drawRowHeaders(e,t){const{mouseX:n,mouseY:s,metrics:o,theme:i,draggingRowSeparator:r}=t,{gridY:l,rowHeaderWidth:a,height:c,visibleRows:d,allRowHeights:u,allRowYs:h}=o;if(a<=0)return;const{headerBackgroundColor:g,headerColor:p,headerHiddenSeparatorSize:f,headerHiddenSeparatorHoverColor:C,headerSeparatorColor:w,headerSeparatorHoverColor:S}=i,T=a*.5,R=a*.5-T*.5;if(e.save(),e.beginPath(),e.fillStyle=g,e.fillRect(0,0,a,c),w){e.strokeStyle=w,e.beginPath(),e.moveTo(0,l+.5),e.lineTo(a,l+.5);const b=[];let v=!1;for(let D=0;D<d.length;D+=1){const A=d[D],N=O(h,A),L=O(u,A);if(L>0){const k=l+N+L+.5;e.moveTo(0,k),e.lineTo(a,k),v=!1}else v||(v=!0,b.push(A))}e.moveTo(a-.5,0),e.lineTo(a-.5,c),e.stroke(),e.beginPath(),e.fillStyle=w;for(let D=0;D<b.length;D+=1){const A=b[D],N=O(h,A),L=O(u,A),k=l+N+L+.5-f*.5;e.rect(R,k,T,f)}e.fill()}if(S){let{index:b=null}=r!=null?r:{};if(b==null&&n!=null&&s!=null&&(b=H.getRowSeparatorIndex(n,s,o,i)),b!=null){e.strokeStyle=S;const v=O(h,b),D=O(u,b),A=l+v+D+.5,N=d.indexOf(b),L=N<d.length-1?d[N+1]:null,k=L!=null?u.get(L):null,x=D===0,W=k!=null&&k===0;x?(e.strokeStyle=C,e.fillStyle=C,e.fillRect(R,A,T,f*.5)):W&&(e.fillStyle=S,e.fillRect(R,A-f*.5,T,f*.5)),e.beginPath(),e.moveTo(.5,A),e.lineTo(a+.5,A),e.stroke()}}e.beginPath(),e.rect(0,l,a,c),e.clip(),e.fillStyle=p,e.textAlign="right";for(let b=0;b<d.length;b+=1){const v=d[b],D=O(u,v),A=O(h,v)+l;this.drawRowHeader(e,t,v,A,D)}e.restore()}drawRowHeader(e,t,n,s,o){if(o<=0)return;const{metrics:i,model:r,theme:l}=t,{modelRows:a,rowHeaderWidth:c}=i,d=O(a,n),u=c-l.cellHorizontalPadding,h=s+o*.5;e.fillText(r.textForRowHeader(d),u,h)}drawRowFooters(e,t){const{mouseX:n,mouseY:s,metrics:o,model:i,theme:r,draggingRowSeparator:l}=t,{gridY:a,gridX:c,maxX:d,modelRows:u,rowFooterWidth:h,height:g,verticalBarWidth:p,visibleRows:f,allRowHeights:C,allRowYs:w,width:S}=o;if(h<=0)return;const{cellHorizontalPadding:T,headerBackgroundColor:R,headerColor:b,headerHiddenSeparatorSize:v,headerHiddenSeparatorHoverColor:D,headerSeparatorColor:A,headerSeparatorHoverColor:N}=r,L=h*.5,k=h*.5-L*.5,x=Math.min(c+d,S-h-p);if(e.save(),e.beginPath(),e.fillStyle=R,e.fillRect(x,a,h,g),A){e.strokeStyle=A,e.beginPath(),e.moveTo(x,a+.5),e.lineTo(h,a+.5);const V=[];let K=!1;for(let Z=0;Z<f.length;Z+=1){const $=f[Z],P=O(w,$),G=O(C,$);if(G>0){const X=a+P+G+.5;e.moveTo(x+.5,X),e.lineTo(x+h-.5,X),K=!1}else K||(K=!0,V.push($))}e.moveTo(x+.5,a),e.lineTo(x+.5,g),e.stroke(),e.beginPath(),e.fillStyle=A;for(let Z=0;Z<V.length;Z+=1){const $=V[Z],P=O(w,$),G=O(C,$),X=a+P+G+.5-v*.5;e.rect(x+k,X,L,v)}e.fill()}if(N){let{index:V=null}=l!=null?l:{};if(V==null&&n!=null&&s!=null&&(V=H.getRowSeparatorIndex(n,s,o,r)),V!=null){e.strokeStyle=N;const K=O(w,V),Z=O(C,V),$=a+K+Z+.5,P=f.indexOf(V),G=P<f.length-1?f[P+1]:null,X=G!=null?C.get(G):null,j=Z===0,de=X!=null&&X===0;j?(e.strokeStyle=D,e.fillStyle=D,e.fillRect(k,$,L,v*.5)):de&&(e.fillStyle=N,e.fillRect(k,$-v*.5,L,v*.5)),e.beginPath(),e.moveTo(x+.5,$),e.lineTo(x+h+.5,$),e.stroke()}}e.beginPath(),e.rect(x,a,h,g),e.clip(),e.fillStyle=b,e.textAlign="left";const W=x+T;for(let V=0;V<f.length;V+=1){const K=f[V],Z=O(C,K);if(Z>0){const $=O(w,K)+a,P=O(u,K),G=$+Z*.5;e.fillText(i.textForRowFooter(P),W,G)}}e.restore()}drawSelectedRanges(e,t,n={}){const{cursorColumn:s,cursorRow:o,draggingRow:i,draggingColumn:r,editingCell:l,metrics:a,model:c,selectedRanges:d,theme:u}=t,{allColumnWidths:h,allColumnXs:g,allRowHeights:p,allRowYs:f,width:C,height:w}=a,{left:S=a.left,top:T=a.top,right:R=a.right,bottom:b=a.bottom,minY:v=-10,maxY:D=w+10,minX:A=-10,maxX:N=C+10}=n;if(d.length===0)return;const L=ke(c)&&c.isEditable&&l==null&&i==null&&r==null&&s!=null&&o!=null&&g.has(s)&&f.has(o);if(L){const k=O(g,s),x=O(f,o),W=O(h,s),V=O(p,o);e.save(),e.beginPath(),e.rect(0,0,C,w),e.rect(k,x,W,V),e.clip("evenodd")}e.beginPath();for(let k=0;k<d.length;k+=1){const x=d[k],W=x.startColumn!==null?x.startColumn:S,V=x.startRow!==null?x.startRow:T,K=x.endColumn!==null?x.endColumn:R,Z=x.endRow!==null?x.endRow:b;if(Z>=T&&b>=V&&K>=S&&R>=W){const $=W>=S&&g.has(W)?Math.round(O(g,W))+.5:A,P=V>=T&&f.has(V)?Math.max(Math.round(O(f,V))+.5,.5):v,G=K<=R&&g.has(K)?Math.round(O(g,K)+O(h,K))-.5:N,X=Z<=b&&f.has(Z)?Math.round(O(f,Z)+O(p,Z))-.5:D;e.rect($,P,G-$,X-P)}e.fillStyle=u.selectionColor,e.fill(),e.save(),e.clip(),e.strokeStyle=u.selectionOutlineCasingColor,e.lineWidth=3,e.stroke(),e.restore(),e.strokeStyle=u.selectionOutlineColor,e.lineWidth=1,e.stroke()}L&&s!=null&&o!=null&&(e.restore(),this.drawActiveCell(e,t,s,o))}drawActiveCell(e,t,n,s,o=tn.ACTIVE_CELL_BORDER_WIDTH){const{metrics:i,theme:r}=t,{allColumnWidths:l,allColumnXs:a,allRowHeights:c,allRowYs:d}=i,u=O(a,n),h=O(d,s),g=O(l,n),p=O(c,s);let f=u-o*.5,C=h-o*.5,w=g+o,S=p+o;f<=0&&(w+=f-1,f=1),C<=0&&(S+=C-1,C=1);const{lineWidth:T}=e;e.beginPath(),e.lineWidth=o,e.strokeStyle=r.selectionOutlineColor,this.drawRoundedRect(e,f,C,w,S),e.stroke(),e.lineWidth=T}drawRoundedRect(e,t,n,s,o,i=tn.DEFAULT_EDGE_RADIUS){e.beginPath(),e.moveTo(t+i,n),e.lineTo(t+s-i,n),e.quadraticCurveTo(t+s,n,t+s,n+i),e.lineTo(t+s,n+o-i),e.quadraticCurveTo(t+s,n+o,t+s-i,n+o),e.lineTo(t+i,n+o),e.quadraticCurveTo(t,n+o,t,n+o-i),e.lineTo(t,n+i),e.quadraticCurveTo(t,n,t+i,n),e.closePath()}drawDraggingColumn(e,t){var X;const{draggingColumn:n,metrics:s,mouseX:o,theme:i,model:r}=t;if(n==null||o==null)return;const{range:l,depth:a}=n,{gridX:c,gridY:d,allColumnXs:u,allColumnWidths:h,height:g,width:p,columnHeaderMaxDepth:f,columnHeaderHeight:C,movedColumns:w,modelColumns:S,floatingLeftWidth:T}=s,R=(X=S.get(l[0]))!=null?X:H.getModelIndex(l[0],w),b=r.getColumnHeaderGroup(R,a);if(a>0&&!b)return;const[v,D]=l,A=O(u,v),L=O(u,D)+O(h,D)-A,k=n.left,{backgroundColor:x,font:W,headerFont:V,reorderOffset:K,shadowBlur:Z,shadowColor:$}=i,P=(f-a-1)*C;e.save(),e.translate(c,0),e.save(),e.beginPath(),e.rect(T,0,p,g),e.clip(),e.fillStyle=x,e.fillRect(A,P,L,g),e.restore(),e.translate(0,K),e.save(),e.shadowColor=$,e.shadowBlur=Z,e.fillStyle=x,e.fillRect(n.left,P+K,n.width,g),e.restore(),e.beginPath(),e.rect(n.left,P,n.width+1,g),e.clip(),e.translate(k-A,0),e.font=V;const G=[];for(let j=n.range[0];j<=n.range[1];j+=1)G.push(j);this.drawColumnHeaders(e,t),this.drawColumnHeadersForRange(e,t,[G[0],G[G.length-1]],{minX:A,maxX:p}),e.translate(0,d),e.font=W,this.drawGridBackground(e,t);for(let j=v;j<=D;j+=1)this.drawColumnCellContents(e,t,j);e.restore()}drawDraggingRow(e,t){const{draggingRow:n,draggingRowOffset:s,metrics:o,mouseY:i,theme:r}=t;if(n==null||i==null)return;const{gridX:l,gridY:a,allRowYs:c,allRowHeights:d,width:u}=o,h=O(c,n),g=O(d,n)+1,{backgroundColor:p,font:f,headerFont:C,reorderOffset:w,shadowBlur:S,shadowColor:T}=r;e.save(),e.translate(0,a),e.fillStyle=p,e.fillRect(0,h,u,g),e.translate(l+w,i-h-a-(s!=null?s:0)),e.save(),e.shadowColor=T,e.shadowBlur=S,e.fillStyle=p,e.fillRect(-l,h,u,g),e.restore(),e.beginPath(),e.rect(-l,h,u,g),e.clip(),e.font=f,this.drawGridBackground(e,t),this.drawCellContents(e,t),e.translate(-l,-a),e.font=C,this.drawRowHeaders(e,t),e.restore()}drawScrollBars(e,t){const{isDraggingHorizontalScrollBar:n,isDraggingVerticalScrollBar:s,isDragging:o,metrics:i,mouseX:r,mouseY:l,theme:a}=t;if(a.scrollBarSize<=0)return;const{width:c,height:d,handleHeight:u,handleWidth:h,scrollX:g,scrollY:p,hasHorizontalBar:f,hasVerticalBar:C,barWidth:w,barHeight:S,barLeft:T,barTop:R}=i,{scrollBarBackgroundColor:b,scrollBarHoverBackgroundColor:v,scrollBarCasingColor:D,scrollBarCornerColor:A,scrollBarColor:N,scrollBarHoverColor:L,scrollBarActiveColor:k,scrollBarSize:x,scrollBarHoverSize:W,scrollBarCasingWidth:V,scrollBarSelectionTick:K,scrollBarSelectionTickColor:Z,scrollBarActiveSelectionTickColor:$,autoSelectRow:P,autoSelectColumn:G}=a,X=r!=null&&l!=null&&r<=c&&l<=d,j=s||C&&!n&&!o&&r!=null&&l!=null&&r>=c-W&&l>=R&&X,de=n||f&&!s&&!o&&!j&&r!=null&&l!=null&&l>=d-W&&r>=T&&X,me=de?W:x,Ce=j?W:x;if(e.translate(T,R),f&&C&&(e.fillStyle=D,e.fillRect(c-T-x,d-R-x,x,x),e.fillStyle=A,e.fillRect(c-T-x+V,d-R-x+V,x-V,x-V)),f){const ye=g,fe=d-R-me;if(e.fillStyle=D,e.fillRect(0,fe,w,me-V),e.fillStyle=de?v:b,e.fillRect(0,fe+V,w,me-V),n?e.fillStyle=k:de?e.fillStyle=L:e.fillStyle=N,e.fillRect(ye,fe+V,h,me-V),!P&&K&&Z!=null&&$!=null){e.fillStyle=Z;const{selectedRanges:Je,cursorColumn:Xe}=t,{lastLeft:$e,columnCount:Mt}=i,hn=[...Je].filter(ge=>ge.startColumn!=null&&ge.endColumn!=null).map(ge=>[ge.startColumn,ge.endColumn]).sort(H.compareRanges),Ot=H.mergeSortedRanges(hn),De=ge=>ge<=$e?ge/$e*(w-h):w-h+(ge-$e)/(Mt-$e)*h;for(let ge=0;ge<Ot.length;ge+=1){const Ke=Ot[ge],ze=Ke[0],lt=Ke[1];if(ze!=null&&lt!=null&&(ze!==Xe||lt!==Xe)){const wt=De(ze),mn=Math.max(1,Math.round(De(lt+1)-wt)),xt=me-V;e.fillRect(wt,fe+V+Math.round(xt/3),mn,Math.round(xt/3))}}if(Xe!=null){const ge=De(Xe),Ke=2,ze=me-V;e.fillStyle=$,e.fillRect(ge,fe+V,Ke,ze)}}}if(C){const ye=c-T-Ce,fe=p;if(e.fillStyle=D,e.fillRect(ye,0,Ce-V,S),e.fillStyle=j?v:b,e.fillRect(ye+V,0,Ce-V,S),s?e.fillStyle=k:j?e.fillStyle=L:e.fillStyle=N,e.fillRect(ye+V,fe,Ce-V,u),!G&&K&&Z!=null&&$!=null){const{selectedRanges:Je,cursorRow:Xe}=t,{lastTop:$e,rowCount:Mt}=i,Ct=ge=>ge<=$e?ge/$e*(S-u):S-u+(ge-$e)/(Mt-$e)*u;e.fillStyle=Z;const Ot=[...Je].filter(ge=>ge.startRow!=null&&ge.endRow!=null).map(ge=>[ge.startRow,ge.endRow]).sort(H.compareRanges),De=H.mergeSortedRanges(Ot);for(let ge=0;ge<De.length;ge+=1){const Ke=De[ge],ze=Ke[0],lt=Ke[1];if(ze!=null&&lt!=null&&(ze!==Xe||lt!==Xe)){const wt=Ct(ze),mn=Ce-V,xt=Math.max(1,Math.round(Ct(lt+1)-wt));e.fillRect(ye+V+Math.round(mn/3),wt,Math.round(mn/3),xt)}}if(Xe!=null){const ge=Math.round(Ct(Xe)),Ke=Ce-V,ze=2;e.fillStyle=$,e.fillRect(ye+V,ge,Ke,ze)}}}e.translate(-T,-R)}};let es=tn;es.DEFAULT_FONT_WIDTH=10;es.DEFAULT_EDGE_RADIUS=2;es.ACTIVE_CELL_BORDER_WIDTH=2;const Ir=100;class od extends Ye{constructor(){super(...arguments),this.hasExtendedFloating=!1}onDown(t,n,s){const{x:o,y:i,column:r,row:l}=t,{metrics:a}=n;if(!a)throw new Error("metrics not set");const{gridX:c,gridY:d,maxX:u,maxY:h}=a,g=o-c,p=i-d;if(g<0||p<0||r==null&&g>u||l==null&&p>h)return!1;const f=H.isModifierKeyDown(s),C=s.shiftKey;f||(C?n.trimSelectedRanges():n.clearSelectedRanges());const w=n.getTheme(),{autoSelectRow:S,autoSelectColumn:T}=w;return(r!==null||!T)&&(l!==null||!S)&&(n.focus(),n.moveCursorToPosition(r,l,C,!1,C&&f)),this.startPoint=t,this.hasExtendedFloating=!1,this.dragBounds=H.getScrollDragBounds(a,l,r),!0}onDrag(t,n){if(this.startPoint===void 0)return!1;this.stopTimer();const{row:s,column:o}=this.startPoint,{x:i,y:r}=t;let{row:l,column:a}=t;const{metrics:c}=n;if(!c)throw new Error("metrics not set");const{left:d,lastLeft:u,top:h,lastTop:g,columnWidth:p,rowHeight:f}=c,C=H.getScrollDragBounds(c,s,o);let w=0,S=0;if(d<u&&(i<C.x1?w=i-C.x1:i>C.x2&&(w=i-C.x2)),h<g&&(r<C.y1?S=r-C.y1:r>C.y2&&(S=r-C.y2)),w!==0||S!==0)this.startTimer(n,t,w>0?Math.ceil(w/p):Math.floor(w/p),S>0?Math.ceil(S/f):Math.floor(S/f));else if(l!=null&&a!=null){const{floatingTopRowCount:T,floatingBottomRowCount:R,floatingLeftColumnCount:b,floatingRightColumnCount:v,columnCount:D,rowCount:A,bottom:N,right:L,topVisible:k,bottomVisible:x,leftVisible:W,rightVisible:V}=c;this.hasExtendedFloating||(s!==null&&s<T&&l>=T?(l=T,this.hasExtendedFloating=!0):s!==null&&s>=A-R&&l<A-R&&(l=A-R-1,this.hasExtendedFloating=!0),o!==null&&o<b&&a>=b?(a=b,this.hasExtendedFloating=!0):o!==null&&o>=D-v&&a<D-v&&(a=D-v-1,this.hasExtendedFloating=!0)),s!==null&&!H.isFloatingRow(s,c)&&H.isFloatingRow(l,c)&&(s>l&&l<h?l=k-1:s<l&&l>N&&(l=x+1)),o!==null&&!H.isFloatingColumn(o,c)&&H.isFloatingColumn(a,c)&&(o>a&&a<d?a=W-1:o<a&&a>L&&(a=V+1)),n.moveCursorToPosition(a,l,!0,!0)}return!0}onUp(t,n){return this.startPoint!==void 0&&(this.startPoint=void 0,this.dragBounds=void 0,this.stopTimer(),n.commitSelection()),!1}moveSelection(t,n,s,o){const{row:i,column:r}=n,{metrics:l}=t;if(!l)throw new Error("metrics not set");const{selectionEndRow:a,selectionEndColumn:c}=t.state;if(a==null||c==null)throw new Error("selection not set");const{rowCount:d,columnCount:u}=l,h=s<0&&r!=null?r:0,g=s>0&&r!=null?r:u-1,p=o<0&&i!=null?i:0,f=o>0&&i!=null?i:d-1;t.moveCursorToPosition(Math.min(Math.max(h,c+s),g),Math.min(Math.max(p,a+o),f),!0),this.lastTriggerTime=Date.now()}startTimer(t,n,s,o){this.stopTimer();const i=this.lastTriggerTime!=null?Ir-Math.min(Ir,Date.now()-this.lastTriggerTime):0;this.timer=setTimeout(()=>{this.moveSelection(t,n,s,o),this.startTimer(t,n,s,o)},i)}stopTimer(){this.timer!==void 0&&(clearTimeout(this.timer),this.timer=void 0)}}const Nr=5,id=1e3/60,Ro=10;function Sn(e,t,n,s){var T,R,b,v,D,A,N;const{modelColumns:o,movedColumns:i,allColumnXs:r,columnCount:l,allColumnWidths:a,userColumnWidths:c,calculatedColumnWidths:d,floatingLeftWidth:u,maxX:h}=n;if(t==null||e==null||e>l||e<0)return null;const g=(T=o.get(e))!=null?T:H.getModelIndex(e,i),p=s.getColumnHeaderGroup(g,t),f=p!=null;let C,w,S;if(p!=null){const[L,k]=p.getVisibleRange(i);C=(R=r.get(L))!=null?R:u,w=((b=r.get(k))!=null?b:h)+((v=a.get(k))!=null?v:0),S=[L,k]}else{const L=r.get(e);if(L==null)return null;C=L,w=C+((N=(A=(D=a.get(e))!=null?D:c.get(g))!=null?A:d.get(g))!=null?N:0),S=[e,e]}return{visibleIndex:e,modelIndex:g,left:C,right:w,width:w-C,isColumnGroup:f,range:S,depth:t}}class rd extends Ye{constructor(){super(...arguments),this.cursor=null,this.draggingColumn=null}setScrollInterval(t,n){this.scrollingInterval!=null&&n===this.scrollingDirection||(this.scrollingDirection=n,this.scrollingInterval=window.setInterval(()=>{var f,C;const{metrics:s}=t;if(!s)return;const{left:o,lastLeft:i,leftOffset:r,userColumnWidths:l,calculatedColumnWidths:a,movedColumns:c,allColumnWidths:d}=s;let u=o,h=r;if(n==="left")for(h-=Ro;h<0;){u-=1;const w=H.getModelIndex(o-1,c),S=(f=l.get(w))!=null?f:a.get(w);S===void 0?h=0:h+=S,u<0&&(h=0,u=0)}else{h+=Ro;let w=d.get(o);for(;w!==void 0&&h>w;){u+=1,h-=w;const S=H.getModelIndex(o+1,c);w=(C=l.get(S))!=null?C:a.get(S),u>i&&(h=0,u=i)}}const{mouseX:g,mouseY:p}=t.state;s==null||g==null||p==null||(this.moveDraggingColumn(g,t,n==="left"?-Ro:Ro),t.setState({left:u,leftOffset:h}),(n==="left"&&u===0&&r===0||n==="right"&&u===i)&&this.clearScrollInterval())},id))}clearScrollInterval(){this.scrollingDirection=void 0,window.clearInterval(this.scrollingInterval),this.scrollingInterval=void 0}onLeave(){return this.clearScrollInterval(),!1}onDown(t,n){const{model:s}=n.props,{x:o,column:i,columnHeaderDepth:r}=t,{metrics:l}=n;if(!l)throw new Error("Metrics not set");const a=Sn(i,r,l,s);if(i==null||a==null||r==null||r>0&&!a.isColumnGroup)return!1;const{rowHeaderWidth:c}=l;return this.initialGridPoint=t,this.draggingColumn=null,this.cursor=null,a.modelIndex!=null&&r!=null&&s.isColumnMovable(a.modelIndex,r)&&(this.draggingOffset=o-a.left-c,this.initialOffset=this.draggingOffset),!1}onDrag(t,n,s){if(this.draggingOffset===void 0||this.initialGridPoint===void 0||this.initialOffset===void 0)return!1;const{x:o,y:i}=t,{columnHeaderDepth:r}=this.initialGridPoint,{model:l}=n.props;let{draggingColumn:a}=this;const{metrics:c}=n;if(!c)throw new Error("Metrics not set");if(!a&&Math.abs(this.initialGridPoint.x-o)<Nr&&Math.abs(this.initialGridPoint.y-i)<Nr)return!1;if(a==null){const d=Sn(this.initialGridPoint.column,r,c,l);if(!d||r==null||!l.isColumnMovable(d.modelIndex)||r>0&&!d.isColumnGroup||d.range[0]==null)return!1;a={range:d.range,depth:r,left:d.left,width:d.width};const u=Sn(a.range[0],0,c,l),h=Sn(a.range[1],0,c,l);if(!u||!h)return!1;this.draggingColumn=a,n.setState({draggingColumn:a,isDragging:!0})}return this.cursor="move",this.moveDraggingColumn(t.x,n,s.movementX),!0}moveDraggingColumn(t,n,s){var D,A,N,L,k;if(this.draggingOffset===void 0||this.initialGridPoint===void 0||this.initialOffset===void 0||this.draggingColumn==null||s===0)return;if(this.initialOffset!==this.draggingOffset){this.draggingOffset<this.initialOffset&&this.initialOffset<this.draggingOffset+s||this.draggingOffset>this.initialOffset&&this.initialOffset>this.draggingOffset+s?this.draggingOffset=this.initialOffset:this.draggingOffset+=s,this.draggingColumn={...this.draggingColumn,left:t-this.draggingOffset},n.setState({draggingColumn:this.draggingColumn});return}const{depth:o}=this.draggingColumn,{model:i}=n.props,{movedColumns:r}=n.state,{metrics:l}=n;if(!l)throw new Error("Metrics not set");const{floatingLeftWidth:a,width:c,columnHeaderMaxDepth:d,allColumnXs:u}=l,h=s<0,g=Sn(this.draggingColumn.range[0],o,l,i);if(!g)return;const p=t-this.draggingOffset,f=p+g.width;this.draggingColumn={...this.draggingColumn,left:p},n.setState({draggingColumn:this.draggingColumn});const C=Sn(H.getColumnAtX(Be(h?p:f,a,c),l,!0),o,l,i),w=i.getColumnHeaderParentGroup(g.modelIndex,g.depth);if(!C)return;if(w!==void 0){const x=w.getVisibleRange(r);if(C.visibleIndex<x[0]){const W=this.moveColumn(g,x[0],r);this.draggingOffset=t-((D=u.get(x[0]))!=null?D:0),this.draggingColumn={...this.draggingColumn,left:t-this.draggingOffset},this.clearScrollInterval(),n.setState({draggingColumn:this.draggingColumn,movedColumns:W});return}if(C.visibleIndex>x[1]){const W=this.moveColumn(g,x[1]-(g.range[1]-g.range[0]),r),{right:V=0}=(A=Sn(x[1],0,l,i))!=null?A:{};this.draggingOffset=t-(V-g.width),this.draggingColumn={...this.draggingColumn,left:t-this.draggingOffset},this.clearScrollInterval(),n.setState({draggingColumn:this.draggingColumn,movedColumns:W});return}}if(!i.isColumnMovable(C.modelIndex)){let x=C.visibleIndex;if(h)for(x+=1;x<g.visibleIndex&&!i.isColumnMovable(H.getModelIndex(x,r));)x+=1;else for(x-=1;x>g.visibleIndex&&!i.isColumnMovable(H.getModelIndex(x,r));)x-=1;if(x!==g.visibleIndex){h||(x-=g.range[1]-g.range[0]);const V=this.moveColumn(g,x,r);n.setState({movedColumns:V,draggingColumn:this.draggingColumn})}const W=Sn(x,0,l,i);h?this.draggingOffset=t-((N=W==null?void 0:W.left)!=null?N:0):this.draggingOffset=t-(((L=W==null?void 0:W.right)!=null?L:0)-g.width),this.draggingColumn={...this.draggingColumn,left:t-this.draggingOffset},n.setState({draggingColumn:this.draggingColumn});return}if(p<=a?this.setScrollInterval(n,"left"):f>c?this.setScrollInterval(n,"right"):this.clearScrollInterval(),C.visibleIndex===g.visibleIndex||h&&g.visibleIndex<C.visibleIndex||!h&&g.visibleIndex>C.visibleIndex)return;const S=C.left+C.width*.5,T=i.getColumnHeaderParentGroup(g.modelIndex,g.depth);let R,b=((k=T==null?void 0:T.depth)!=null?k:d)-1;for(;b>=0&&R===void 0;)R=i.getColumnHeaderGroup(C.modelIndex,b),b-=1;let v;h&&p<S&&(!R||C.visibleIndex===R.getVisibleRange(r)[0])&&(v=this.moveColumn(g,C.range[0],r)),!h&&f>S&&(!R||C.visibleIndex===R.getVisibleRange(r)[1])&&(v=this.moveColumn(g,C.range[1]-(g.range[1]-g.range[0]),r)),v&&(this.draggingColumn={...this.draggingColumn,left:p},n.setState({movedColumns:v,draggingColumn:this.draggingColumn}))}moveColumn(t,n,s){const o=t.isColumnGroup?H.moveRange(t.range,n,s):H.moveItem(t.visibleIndex,n,s),i=n-t.range[0],r=[t.range[0]+i,t.range[1]+i];return this.draggingColumn&&(this.draggingColumn={...this.draggingColumn,range:r}),o}onUp(t,n){return this.cursor=null,this.clearScrollInterval(),this.draggingOffset!=null?(this.draggingOffset=void 0,n.setState({draggingColumn:null,isDragging:!1}),!0):!1}}class qi extends Ye{constructor(){super(...arguments),this.cursor="default"}static getLeftWithOffsetFromRawLeft(t,n){const s=t.getTheme(),{metrics:o,metricCalculator:i}=t;if(!o)throw new Error("metrics not set");if(s.scrollSnapToColumn)return{left:Math.round(n),leftOffset:0};const r=Math.floor(n),l=n-r;let a=o.allColumnWidths.get(r);if(a==null){const d=t.getMetricState();a=i.getVisibleColumnWidth(r,d)}const c=a*l;return{left:r,leftOffset:c}}isInScrollBar(t,n){const s=n.getTheme(),{scrollBarSize:o,scrollBarHoverSize:i}=s,{metrics:r}=n;if(!r)throw new Error("metrics not set");const{x:l,y:a}=t,{barLeft:c,barWidth:d,height:u,hasHorizontalBar:h}=r;return h&&o>0&&a>=u-i&&a<u&&l>c&&l<c+d}getLeftWithOffset(t,n){var f;const{metrics:s}=n;if(!s)throw new Error("metrics not set");const{x:o}=t,{barWidth:i,handleWidth:r,lastLeft:l,barLeft:a,columnCount:c,scrollableContentWidth:d,scrollableViewportWidth:u}=s,h=o-a,g=Be((h-((f=this.dragOffset)!=null?f:0))/(i-r),0,1);if(c===1)return{left:0,leftOffset:g*(d-u)};const p=g*l;return qi.getLeftWithOffsetFromRawLeft(n,p)}onDown(t,n){const{metrics:s}=n;if(!s)throw new Error("metrics not set");const{x:o}=t,{handleWidth:i,barLeft:r,scrollX:l}=s;if(!this.isInScrollBar(t,n))return!1;const a=o-r;if(a>=l&&a<=l+i)this.dragOffset=a-l,n.setState({isDraggingHorizontalScrollBar:!0});else{this.dragOffset=0;const{left:c,leftOffset:d}=this.getLeftWithOffset(t,n);n.setViewState({left:c,leftOffset:d,isDraggingHorizontalScrollBar:!0,isDragging:!0})}return!0}onDrag(t,n){if(this.dragOffset!=null){const{left:s,leftOffset:o}=this.getLeftWithOffset(t,n);return n.setViewState({left:s,leftOffset:o,isDraggingHorizontalScrollBar:!0,isDragging:!0}),!0}return!1}onMove(t,n){return this.isInScrollBar(t,n)}onUp(t,n){return this.dragOffset!==void 0&&(this.dragOffset=void 0,n.setState({isDraggingHorizontalScrollBar:!1,isDragging:!1})),this.isInScrollBar(t,n)}onClick(t,n){return this.isInScrollBar(t,n)}}class ld extends Ye{constructor(){super(...arguments),this.cursor="move"}onDown(t,n){const{model:s}=n.props,{x:o,y:i,row:r}=t,{metrics:l}=n;if(!l)throw new Error("metrics not set");const{columnHeaderHeight:a,rowHeaderWidth:c,allRowYs:d}=l;if(o<=c&&r!==null&&s.isRowMovable(r)){const u=O(d,r);this.draggingOffset=i-u-a,n.setState({draggingRowOffset:this.draggingOffset})}return!1}onDrag(t,n){if(this.draggingOffset==null)return!1;const{model:s}=n.props;let{draggingRow:o}=n.state;const{mouseX:i,mouseY:r}=n.state;if(i==null||r==null)return!1;if(o==null){const{row:v}=n.getGridPointFromXY(i,r);if(v!=null&&!s.isRowMovable(v)||(o=v,n.setState({draggingRow:o,isDragging:!0}),o==null))return!1}const{metrics:l}=n;if(!l)throw new Error("metrics not set");const{top:a,lastTop:c,bottom:d,bottomVisible:u,rowCount:h,columnHeaderHeight:g,allRowHeights:p,allRowYs:f,height:C}=l;let w=g;if(a<o){const v=o-1;w=O(f,v)+O(p,v)*.5+g}let S=C;if(o<d){const v=o+1;S=O(f,v)+O(p,v)*.5+g}let{movedRows:T}=n.state;r<w&&o>0&&s.isRowMovable(o-1)?(T=H.moveItem(o,o-1,T),o-=1):S<r&&o<h-1&&s.isRowMovable(o+1)&&(T=H.moveItem(o,o+1,T),o+=1),n.setState({movedRows:T,draggingRow:o});const R=g+O(p,a)*.5,b=g+O(f,u)+O(p,u)*.5;return r<R&&a>0?n.setState({top:a-1}):r>b&&a<c&&n.setState({top:a+1}),!0}onUp(t,n){return this.draggingOffset!==void 0?(this.draggingOffset=void 0,n.setState({draggingRowOffset:null,draggingRow:null,isDragging:!1}),!0):!1}}class Yi extends Sl{constructor(){super(...arguments),this.hiddenCursor="s-resize",this.defaultCursor="row-resize",this.pointProperty="y",this.userSizesProperty="userRowHeights",this.visibleOffsetProperty="visibleRowYs",this.visibleSizesProperty="visibleRowHeights",this.marginProperty="columnHeaderHeight",this.calculatedSizesProperty="calculatedRowHeights",this.initialSizesProperty="initialRowHeights",this.modelIndexesProperty="modelRows",this.firstIndexProperty="firstRow",this.treePaddingProperty="treePaddingY",this.getHiddenItems=H.getHiddenRows,this.getNextShownItem=H.getNextShownRow,this.getSeparator=Yi.getRowSeparator}static getRowSeparator(t,n,s,o){if(!o.allowRowResize)return null;const{x:i,y:r}=t,l=H.getRowSeparatorIndex(i,r,n,o);return l!=null?{index:l,depth:0}:null}setSize(t,n,s){t.setRowHeight(n,s)}resetSize(t,n){t.resetRowHeight(n)}updateSeparator(t,n){t.setState({draggingRowSeparator:n,isDragging:n!==null})}}class Ts extends Ye{static isInTreeBox(t,n){const{column:s,row:o,x:i,y:r}=t,{metrics:l}=n;if(!l)throw new Error("metrics not set");const{gridX:a,gridY:c,firstColumn:d,allColumnXs:u,allColumnWidths:h,allRowHeights:g,allRowYs:p,visibleRowTreeBoxes:f}=l;if(s===d&&o!=null&&f.get(o)!=null&&i>a&&r>c){const C=O(u,s),w=O(h,s),S=O(p,o),T=O(g,o);if(i>=a+C&&i<=a+C+w&&r>=c+S&&r<=c+S+T)return!0}return!1}onDown(t,n){return Ts.isInTreeBox(t,n)}onClick(t,n,s){if(Ts.isInTreeBox(t,n)){const{row:o}=t;if(o!==null)return n.toggleRowExpanded(o,H.isModifierKeyDown(s)),!0}return!1}}class ad extends Ye{isInCorner(t,n){const s=n.getTheme(),{scrollBarSize:o}=s,{metrics:i}=n;if(!i)throw new Error("metrics not set");const{x:r,y:l}=t,{width:a,height:c,hasVerticalBar:d,hasHorizontalBar:u}=i;return o>0&&d&&u&&r>=a-o&&l>=c-o&&r<=a&&l<=c}onDown(t,n){return this.isInCorner(t,n)}onUp(t,n){return this.isInCorner(t,n)}onClick(t,n){return this.isInCorner(t,n)}}class Xi extends Ye{constructor(){super(...arguments),this.cursor="default"}static getTopWithOffsetFromRawTop(t,n){const s=t.getTheme(),{metrics:o,metricCalculator:i}=t;if(!o)throw new Error("metrics not set");if(s.scrollSnapToRow)return{top:Math.round(n),topOffset:0};const r=Math.floor(n),l=n-r;let a=o.allRowHeights.get(r);if(a==null){const d=t.getMetricState();a=i.getVisibleRowHeight(r,d)}const c=a*l;return{top:r,topOffset:c}}isInScrollBar(t,n){const s=n.getTheme(),{scrollBarSize:o,scrollBarHoverSize:i}=s,{metrics:r}=n;if(!r)throw new Error("metrics not set");const{x:l,y:a}=t,{barTop:c,barHeight:d,width:u,hasVerticalBar:h}=r;return h&&o>0&&l>=u-i&&l<u&&a>c&&a<c+d}getTopWithOffset(t,n){var f;const{metrics:s}=n;if(!s)throw new Error("metrics not set");const{y:o}=t,{barHeight:i,handleHeight:r,lastTop:l,barTop:a,rowCount:c,scrollableContentHeight:d,scrollableViewportHeight:u}=s,h=o-a,g=Be((h-((f=this.dragOffset)!=null?f:0))/(i-r),0,1);if(c===1)return{top:0,topOffset:g*(d-u)};const p=g*l;return Xi.getTopWithOffsetFromRawTop(n,p)}onDown(t,n){const{metrics:s}=n;if(!s)throw new Error("metrics not set");const{y:o}=t,{handleHeight:i,barTop:r,scrollY:l}=s;if(!this.isInScrollBar(t,n))return!1;const a=o-r;if(a>=l&&a<=l+i)this.dragOffset=a-l,n.setState({isDraggingVerticalScrollBar:!0});else{this.dragOffset=0;const{top:c,topOffset:d}=this.getTopWithOffset(t,n);n.setViewState({top:c,topOffset:d,isDraggingVerticalScrollBar:!0,isDragging:!0})}return!0}onMove(t,n){return this.isInScrollBar(t,n)}onDrag(t,n){if(this.dragOffset!=null){const{top:s,topOffset:o}=this.getTopWithOffset(t,n);return n.setViewState({top:s,topOffset:o,isDraggingVerticalScrollBar:!0,isDragging:!0}),!0}return!1}onUp(t,n){return this.dragOffset!==void 0&&(this.dragOffset=void 0,n.setState({isDraggingVerticalScrollBar:!1,isDragging:!1})),this.isInScrollBar(t,n)}onClick(t,n){return this.isInScrollBar(t,n)}}class cd extends Ye{onDoubleClick({column:t,row:n},s){const{model:o}=s.props;return ke(o)&&t!=null&&n!=null&&o.isEditableRange(Q.makeCell(t,n))?(s.startEditing(t,n),!0):!1}}class ns{constructor(t=5e3){this.order=t}onDown(t,n){return!1}}class dd extends ns{onDown(t,n){switch(t.key){case"a":if(H.isModifierKeyDown(t))return n.selectAll(),!0;break;case"ArrowUp":return this.handleArrowMove(0,-1,t,n);case"ArrowDown":return this.handleArrowMove(0,1,t,n);case"ArrowRight":return this.handleArrowMove(1,0,t,n);case"ArrowLeft":return this.handleArrowMove(-1,0,t,n);case"k":case"K":return H.isModifierKeyDown(t)?!1:this.handlePageUp(t,n);case"j":case"J":return H.isModifierKeyDown(t)?!1:this.handlePageDown(t,n);case"h":case"H":return H.isModifierKeyDown(t)?!1:(t.shiftKey||n.clearSelectedRanges(),n.moveCursorToPosition(0,n.state.cursorRow,t.shiftKey),!0);case"l":case"L":{if(H.isModifierKeyDown(t))return!1;const{model:s}=n.props,{columnCount:o}=s;return t.shiftKey||n.clearSelectedRanges(),n.moveCursorToPosition(o-1,n.state.cursorRow,t.shiftKey),!0}case"PageDown":return this.handlePageDown(t,n);case"PageUp":return this.handlePageUp(t,n);case"Home":return t.shiftKey||n.clearSelectedRanges(),n.moveCursorToPosition(H.isModifierKeyDown(t)?n.state.cursorColumn:0,H.isModifierKeyDown(t)?0:n.state.cursorRow,t.shiftKey,!0,!0),!0;case"End":{const{model:s}=n.props,{columnCount:o,rowCount:i}=s;return t.shiftKey||n.clearSelectedRanges(),n.moveCursorToPosition(H.isModifierKeyDown(t)?n.state.cursorColumn:o-1,H.isModifierKeyDown(t)?i-1:n.state.cursorRow,t.shiftKey,!0,!0),!0}case"Escape":return n.clearSelectedRanges(),{preventDefault:!1,stopPropagation:!1};case"Enter":if(n.state.selectedRanges.length>0)return n.moveCursorInDirection(t.shiftKey?Q.SELECTION_DIRECTION.UP:Q.SELECTION_DIRECTION.DOWN),!0;break;case"Tab":if(n.state.selectedRanges.length>0)return n.moveCursorInDirection(t.shiftKey?Q.SELECTION_DIRECTION.LEFT:Q.SELECTION_DIRECTION.RIGHT),!0;break}return!1}handleArrowMove(t,n,s,o){const i=s.shiftKey,r=H.isModifierKeyDown(s);i?o.trimSelectedRanges():o.clearSelectedRanges();const{cursorRow:l,cursorColumn:a,selectionEndColumn:c,selectionEndRow:d}=o.state,u=i?c:a,h=i?d:l;if(r){const{model:g}=o.props,{columnCount:p,rowCount:f}=g,C=r&&i;let w=null,S=null;t<0?(w=0,S=h):t>0?(w=p-1,S=h):n<0?(w=u,S=0):n>0&&(w=u,S=f-1),w!=null&&S!=null&&o.moveCursorToPosition(w,S,i,!0,C)}else{if(!o.metrics)throw new Error("grid.metrics are not set");const{theme:g}=o.props,{autoSelectRow:p=!1,autoSelectColumn:f=!1}=g;if(p&&t!==0){const{lastLeft:C}=o.metrics;let{left:w}=o.state;w=Be(w+t,0,C),o.moveCursorToPosition(w,l,i,!1),o.setViewState({left:w})}else if(f&&n!==0){const{lastTop:C}=o.metrics;let{top:w}=o.state;w=Be(w+n,0,C),o.moveCursorToPosition(w,a,i,!1),o.setViewState({top:w})}else o.moveCursor(t,n,i)}return!0}handlePageUp(t,n){const s=t.shiftKey;s?n.trimSelectedRanges():n.clearSelectedRanges();const{cursorColumn:o,selectionEndRow:i}=n.state,r=i,l=o;if(r==null)return!1;const a=n.getMetricState(),{metricCalculator:c}=n,{bottomVisible:d,topVisible:u,hasHorizontalBar:h}=c.getMetrics(a);let g=r-(d-u);g-=h?0:1,g=Math.max(g,0);const p=Math.max(g-(r-u),0);return n.moveCursorToPosition(l,g,s,!1),n.setViewState({top:p}),!0}handlePageDown(t,n){const s=t.shiftKey;s?n.trimSelectedRanges():n.clearSelectedRanges();const{selectionEndRow:o,cursorColumn:i}=n.state,r=o,l=i;if(r===null)return!1;const a=n.getMetricState(),{metricCalculator:c}=n,{bottomVisible:d,topVisible:u,hasHorizontalBar:h,rowCount:g,lastTop:p}=c.getMetrics(a),f=g-1;let C=d-u+r;C+=h?0:1,C=Math.min(C,f);const w=Math.min(p,C-(r-u));return n.moveCursorToPosition(l,C,s,!1),n.setViewState({top:w}),!0}}class ud extends ns{onDown(t,n){switch(t.key){case"Enter":case" ":return this.handleExpandKey(t,n)}return!1}handleExpandKey(t,n){const{selectedRanges:s}=n.state;if(s.length===1){const o=s[0];if(o.startRow===o.endRow&&o.startColumn===o.endColumn){if(!n.metrics)throw new Error("grid.metrics not set");const{model:i}=n.props,{startRow:r,startColumn:l}=o;if(r!=null){const a=n.getModelRow(r);if((l===0||l==null)&&Ae(i)&&i.isRowExpandable(a))return n.toggleRowExpanded(r),!0}}}return!1}}class hd extends ns{onDown(t,n){if(H.isModifierKeyDown(t))return!1;const{model:s}=n.props,{cursorColumn:o,cursorRow:i}=n.state;if(o==null||i==null||!ke(s)||!s.isEditableRange(Q.makeCell(o,i)))return!1;const r=o,l=i;return r==null||l==null?!1:t.key.length===1?(n.startEditing(r,l,!0,[1,1],t.key),!0):t.key==="F2"?(n.startEditing(r,l),!0):t.key==="Backspace"?(n.startEditing(r,l,!0,void 0,""),!0):t.key==="Delete"?(n.setValueForCell(r,l,""),!0):!1}}function md(e){var s,o;const t=[],n=e.querySelectorAll("tr");for(let i=0;i<n.length;i+=1){const l=n[i].querySelectorAll("td"),a=[];for(let c=0;c<l.length;c+=1){const d=l[c];a.push((o=(s=d.textContent)==null?void 0:s.trim())!=null?o:"")}t.push(a)}return t}function gd(e){const t=[];return e.forEach(n=>{var o;const s=(o=n.textContent)!=null?o:"";s.length>0&&t.push(s.split(/\t|\u00a0\u00a0 \u00a0/))}),t}function pd(e){var s,o;const t=e.querySelector("table");if(t!=null)return md(t);const n=(o=(s=e.textContent)==null?void 0:s.trim())!=null?o:"";if(n.length>0){const{childNodes:i}=e,r=n.includes(" "),l=n.includes("\xA0\xA0 \xA0");return r&&i.length!==0&&(i.length===1||i.length>1&&(i[0].textContent==null||!i[0].textContent.includes(" ")))?n.split(`
2
- `).map(a=>a.split(" ")):i.length>1||l?gd(e.childNodes):n}return null}class fd extends ns{onDown(t,n){switch(t.key){case"v":if(H.isModifierKeyDown(t)){const s=document.createElement("div");document.body.appendChild(s),s.setAttribute("contenteditable","true"),s.setAttribute("style",'clip-path: "inset(50%)"; height: 1px; width: 1px; margin: -1px; overflow: hidden; padding 0; position: absolute;');const o=()=>{s.removeEventListener("input",o),s.remove(),n.focus();const i=pd(s);i!=null&&n.pasteValue(i)};return s.addEventListener("input",o),s.focus(),{preventDefault:!1,stopPropagation:!0}}break}return!1}}const Cd=e=>{switch(e){case"ArrowDown":return Nt.DOWN;case"ArrowUp":return Nt.UP;case"ArrowLeft":return Nt.LEFT;case"ArrowRight":return Nt.RIGHT;default:return}};function Ki({selectionRange:e=void 0,className:t="",disabled:n=!1,value:s="",isQuickEdit:o=!0,onChange:i=()=>{},onCancel:r=()=>{},onDone:l=()=>{},onContextMenu:a=()=>{},style:c={}}){const d=F.exports.useRef(null),u=F.exports.useRef(!1),[h]=F.exports.useState(s),[g,p]=F.exports.useState(!1),[f,C]=F.exports.useState(o),[w,S]=F.exports.useState(s);F.exports.useEffect(function(){const{current:x}=d;x!=null&&(x.focus(),e?x.setSelectionRange(e[0],e[1]):x.setSelectionRange(x.value.length,x.value.length))},[e]);const T=F.exports.useCallback(k=>{i(k)},[i]),R=F.exports.useCallback(k=>{const{value:x}=k.target;S(x),p(!0),T(x)},[T,S,p]),b=F.exports.useCallback(()=>{u.current=!0,g&&T(h),p(!1),r()},[h,g,r,T]),v=F.exports.useCallback(()=>{C(!1)},[C]),D=F.exports.useCallback((k,x=!1)=>{l(w,{direction:k,fillRange:x})},[l,w]),A=F.exports.useCallback(()=>{u.current||D(null)},[u,D]),N=F.exports.useCallback(k=>{switch(k.stopPropagation(),k.key){case"Escape":k.preventDefault(),b();break;case"Enter":if(k.preventDefault(),H.isModifierKeyDown(k))D(void 0,!0);else if(k.altKey){const x=`${w}
3
- `;S(x),p(!0),T(x)}else D(k.shiftKey?Nt.UP:Nt.DOWN);break;case"Tab":k.preventDefault(),D(k.shiftKey?Nt.LEFT:Nt.RIGHT);break;case"ArrowDown":case"ArrowUp":case"ArrowLeft":case"ArrowRight":f&&(k.preventDefault(),D(Cd(k.key)));break}},[b,D,f,S,p,T,w]),L=F.exports.useCallback(k=>{a(k)},[a]);return m("textarea",{ref:d,className:ee("grid-cell-input-field",t),value:w,onBlur:A,onChange:R,onKeyDown:N,onContextMenu:L,onClick:v,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false",disabled:n,style:c})}Ki.propTypes={selectionRange:B.exports.arrayOf(B.exports.number),className:B.exports.string,disabled:B.exports.bool,isQuickEdit:B.exports.bool,value:B.exports.string,onChange:B.exports.func,onCancel:B.exports.func,onDone:B.exports.func,onContextMenu:B.exports.func,style:B.exports.shape({})};Ki.defaultProps={selectionRange:null,className:"",disabled:!1,value:"",isQuickEdit:!0,onChange:()=>{},onCancel:()=>{},onDone:()=>{},onContextMenu:()=>{},style:{}};const wd=Fe.createContext({}),Wn=class extends F.exports.PureComponent{constructor(e){super(e),this.getCachedKeyHandlers=Re(l=>[...l,...this.keyHandlers].sort((a,c)=>a.order-c.order)),this.getCachedMouseHandlers=Re(l=>[...l,...this.mouseHandlers].sort((a,c)=>a.order-c.order)),this.handleClick=this.handleClick.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleEditCellCancel=this.handleEditCellCancel.bind(this),this.handleEditCellChange=this.handleEditCellChange.bind(this),this.handleEditCellCommit=this.handleEditCellCommit.bind(this),this.handleDoubleClick=this.handleDoubleClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseDrag=this.handleMouseDrag.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleResize=this.handleResize.bind(this),this.handleWheel=this.handleWheel.bind(this);const{isStuckToBottom:t,isStuckToRight:n,metricCalculator:s,movedColumns:o,movedRows:i,renderer:r}=e;this.renderer=r||new es,this.metricCalculator=s||new Ks,this.canvas=null,this.canvasContext=null,this.animationFrame=null,this.prevMetrics=null,this.metrics=null,this.documentCursor=null,this.dragTimer=null,this.keyHandlers=[new hd(400),new fd(450),new dd(500),new ud(900)],this.mouseHandlers=[new Yi(100),new Ko(200),new ld(300),new rd(400),new cd(450),new Xi(500),new qi(600),new ad(700),new Ts(800),new od(900)],this.state={top:0,left:0,topOffset:0,leftOffset:0,draggingColumn:null,draggingRow:null,draggingRowOffset:null,draggingColumnSeparator:null,draggingRowSeparator:null,isDraggingHorizontalScrollBar:!1,isDraggingVerticalScrollBar:!1,isDragging:!1,mouseX:null,mouseY:null,movedColumns:o,movedRows:i,cursorRow:null,cursorColumn:null,selectionStartRow:null,selectionStartColumn:null,selectionEndRow:null,selectionEndColumn:null,selectedRanges:ve,lastSelectedRanges:ve,cursor:null,editingCell:null,isStuckToBottom:t,isStuckToRight:n}}static getScale(e){var o,i,r,l,a;const t=window.devicePixelRatio||1,n=e,s=(a=(l=(r=(i=(o=n.webkitBackingStorePixelRatio)!=null?o:n.mozBackingStorePixelRatio)!=null?i:n.msBackingStorePixelRatio)!=null?r:n.oBackingStorePixelRatio)!=null?l:n.backingStorePixelRatio)!=null?a:1;return t/s}static getCursorClassName(e){return e!=null&&e!==""?`grid-cursor-${e}`:null}componentDidMount(){var n;this.initContext(),(n=this.canvas)==null||n.addEventListener("wheel",this.handleWheel,{passive:!1}),window.addEventListener("resize",this.handleResize),this.updateCanvasScale(),this.updateCanvas();const{isStuckToBottom:e,isStuckToRight:t}=this.props;e&&this.scrollToBottom(),t&&this.scrollToRight()}componentDidUpdate(e,t){const{isStickyBottom:n,isStickyRight:s,movedColumns:o,movedRows:i,onMovedColumnsChanged:r,onMoveColumnComplete:l,onMovedRowsChanged:a,onMoveRowComplete:c}=this.props,{isStickyBottom:d,isStickyRight:u,movedColumns:h,movedRows:g}=e,{movedColumns:p,movedRows:f}=t,{draggingColumn:C,draggingRow:w,movedColumns:S,movedRows:T}=this.state;if(h!==o&&this.setState({movedColumns:o}),g!==i&&this.setState({movedRows:i}),p!==S&&r(S),t.draggingColumn!=null&&C==null&&l(S),f!==T&&a(T),t.draggingRow!=null&&w==null&&c(T),n!==d&&this.setState({isStuckToBottom:!1}),s!==u&&this.setState({isStuckToRight:!1}),this.updateMetrics(),this.requestUpdateCanvas(),!this.metrics||!this.prevMetrics)return;const{rowCount:R,columnCount:b,height:v,width:D}=this.metrics,{rowCount:A,columnCount:N,height:L,width:k}=this.prevMetrics;if(A!==R||v!==L){const{isStuckToBottom:x}=this.state;x&&this.scrollToBottom()}if(N!==b||D!==k){const{isStuckToRight:x}=this.state;x&&this.scrollToRight()}this.validateSelection()&&this.checkSelectionChange(t)}componentWillUnmount(){var e;this.animationFrame!=null&&cancelAnimationFrame(this.animationFrame),(e=this.canvas)==null||e.removeEventListener("wheel",this.handleWheel),window.removeEventListener("mousemove",this.handleMouseDrag,!0),window.removeEventListener("mouseup",this.handleMouseUp,!0),window.removeEventListener("resize",this.handleResize),this.stopDragTimer()}getTheme(){const{theme:e}=this.props;return Wn.getTheme(this.context,e)}getGridPointFromEvent(e){Rr(this.canvas);const t=this.canvas.getBoundingClientRect(),n=e.clientX-t.left,s=e.clientY-t.top;return this.getGridPointFromXY(n,s)}getGridPointFromXY(e,t){if(!this.metrics)throw new Error("metrics must be set");return H.getGridPointFromXY(e,t,this.metrics)}getMetricState(e=this.state){const t=this.getTheme(),{model:n,stateOverride:s}=this.props;if(!this.canvasContext||!this.canvas)throw new Error("Canvas and context must be defined to get metrics");const o=this.canvasContext,i=this.canvas.clientWidth,r=this.canvas.clientHeight,{left:l,top:a,leftOffset:c,topOffset:d,movedColumns:u,movedRows:h,isDraggingHorizontalScrollBar:g,isDraggingVerticalScrollBar:p,draggingColumn:f}=e;return{left:l,top:a,leftOffset:c,topOffset:d,width:i,height:r,context:o,theme:t,model:n,movedColumns:u,movedRows:h,isDraggingHorizontalScrollBar:g,isDraggingVerticalScrollBar:p,draggingColumn:f,...s}}getKeyHandlers(){const{keyHandlers:e}=this.props;return this.getCachedKeyHandlers(e)}getMouseHandlers(){const{mouseHandlers:e}=this.props;return this.getCachedMouseHandlers(e)}getModelColumn(e){var n,s;const t=(s=(n=this.metrics)==null?void 0:n.modelColumns)==null?void 0:s.get(e);if(t===void 0)throw new Error(`Unable to get ModelIndex for column ${e}`);return t}getModelRow(e){var n,s;const t=(s=(n=this.metrics)==null?void 0:n.modelRows)==null?void 0:s.get(e);if(t===void 0)throw new Error(`Unable to get ModelIndex for row ${e}`);return t}toggleRowExpanded(e,t=!1){const n=this.getModelRow(e),{model:s}=this.props;Ae(s)&&s.isRowExpandable(n)&&s.setRowExpanded(n,!s.isRowExpanded(n),t),this.clearSelectedRanges(),this.commitSelection(),this.moveCursorToPosition(0,e),this.commitSelection(),this.setState({isStuckToBottom:!1})}scrollToBottom(){if(!this.metrics)return;const{bottomVisible:e,rowCount:t,top:n,lastTop:s}=this.metrics;(e<t-1&&e>0||n>s)&&this.setState({top:s})}scrollToRight(){if(!this.metrics)return;const{rightVisible:e,columnCount:t,left:n,lastLeft:s}=this.metrics;(e<t-1&&e>0||n>s)&&this.setState({left:s})}setSelectedRanges(e){const{model:t}=this.props,{columnCount:n,rowCount:s}=t,{cursorRow:o,cursorColumn:i,selectedRanges:r}=this.state;if(this.setState({selectedRanges:e,lastSelectedRanges:r}),e.length>0){const l=Q.boundedRange(e[0],n,s);let a=o,c=i;l.containsCell(i,o)||({row:a,column:c}=l.startCell()),this.setState({selectionStartColumn:l.startColumn,selectionStartRow:l.startRow,selectionEndColumn:l.endColumn,selectionEndRow:l.endRow,cursorColumn:c,cursorRow:a})}}initContext(){const{canvas:e}=this,{canvasOptions:t}=this.props;if(!e)throw new Error("Canvas not set");this.canvasContext=e.getContext("2d",t)}requestUpdateCanvas(){this.animationFrame==null&&(this.animationFrame=requestAnimationFrame(()=>{if(this.animationFrame=null,!this.metrics)throw new Error("Metrics not set");this.updateCanvas(this.metrics)}))}updateCanvas(e=this.updateMetrics()){this.updateCanvasScale();const{onViewChanged:t}=this.props;t(e),this.drawCanvas(e)}updateCanvasScale(){const{canvas:e,canvasContext:t}=this;if(!e)throw new Error("canvas not set");if(!t)throw new Error("canvasContext not set");if(!e.parentElement)throw new Error("Canvas has no parent element");const n=Wn.getScale(t),s=e.parentElement.getBoundingClientRect(),o=Math.floor(s.width),i=Math.floor(s.height);e.style.width=`${o}px`,e.style.height=`${i}px`,e.width=o*n,e.height=i*n,t.scale(n,n)}updateScrollBounds(){if(!this.metrics)throw new Error("metrics not set");const{left:e,top:t}=this.state,{lastLeft:n,lastTop:s}=this.metrics;e>n&&this.setState({left:n,leftOffset:0}),t>s&&this.setState({top:s,topOffset:0})}updateMetrics(e=this.state){this.prevMetrics=this.metrics;const{metricCalculator:t}=this,n=this.getMetricState(e);return this.metrics=t.getMetrics(n),this.updateScrollBounds(),this.metrics}checkSelectionChange(e){const{selectedRanges:t}=e,{selectedRanges:n}=this.state;if(n!==t){const{onSelectionChanged:s}=this.props;s(n)}}validateSelection(){const{model:e}=this.props,{selectedRanges:t}=this.state,{columnCount:n,rowCount:s}=e;for(let o=0;o<t.length;o+=1){const i=t[o];if(i.endColumn!=null&&i.endColumn>=n||i.endRow!=null&&i.endRow>=s)return this.setState({selectedRanges:[],lastSelectedRanges:[]}),!1}return!0}clearSelectedRanges(){const{selectedRanges:e}=this.state;this.setState({selectedRanges:[],lastSelectedRanges:e})}trimSelectedRanges(){const{selectedRanges:e}=this.state;e.length>0&&this.setState({selectedRanges:e.slice(e.length-1)})}beginSelection(e,t){this.setState({selectionStartColumn:e,selectionStartRow:t,selectionEndColumn:e,selectionEndRow:t,cursorColumn:e,cursorRow:t})}moveSelection(e,t,n=!1,s=!1){this.setState(o=>{var p,f,C,w;const{selectedRanges:i,selectionStartRow:r,selectionStartColumn:l}=o,{theme:a}=this.props,{autoSelectRow:c,autoSelectColumn:d}=a;if(n&&i.length>0){const S=i[i.length-1];let T=null,R=null,b=null,v=null;s?(T=c!==void 0&&c?null:Math.min(e!=null?e:0,(p=S.startColumn)!=null?p:0),R=d!==void 0&&d?null:Math.min(t!=null?t:0,(f=S.startRow)!=null?f:0),b=c!==void 0&&c?null:Math.max(e!=null?e:0,(C=S.endColumn)!=null?C:0),v=d!==void 0&&d?null:Math.max(t!=null?t:0,(w=S.endRow)!=null?w:0)):(T=S.startColumn,R=S.startRow,(l!=null||r!=null)&&((c===void 0||!c)&&(T=l),(d===void 0||!d)&&(R=r)),b=c!==void 0&&c?null:e,v=d!==void 0&&d?null:t);const D=Q.makeNormalized(T,R,b,v);if(S.equals(D))return null;const A=[...i];return A[A.length-1]=D,{selectedRanges:A,selectionEndColumn:e,selectionEndRow:t}}const u=[...i],h=c!==void 0&&c?null:e,g=d!==void 0&&d?null:t;return u.push(Q.makeNormalized(h,g,h,g)),{selectedRanges:u,selectionEndColumn:e,selectionEndRow:t}})}commitSelection(){this.setState(e=>{const{theme:t}=this.props,{autoSelectRow:n}=t,{selectedRanges:s,lastSelectedRanges:o,cursorRow:i,cursorColumn:r}=e;if(s.length===1&&(n!==void 0&&n?Q.rowCount(s)===1:Q.cellCount(s)===1)&&Q.rangeArraysEqual(s,o))return{selectedRanges:[],lastSelectedRanges:[],cursorColumn:null,cursorRow:null};let l=s.slice();if(l.length>1){const d=l[l.length-1];for(let u=0;u<l.length-1;u+=1){const h=l[u];if(h.contains(d)){const g=h.subtract(d);l.pop(),l.splice(u,1),l=l.concat(g);break}}l=Q.consolidate(l)}let a=r,c=i;if(!Q.containsCell(l,r,i)){const{model:d}=this.props,{columnCount:u,rowCount:h}=d,g=Q.nextCell(Q.boundedRanges(s,u,h));g!=null?{column:a,row:c}=g:(a=null,c=null)}return l.length===0&&(a=null,c=null),{cursorRow:c,cursorColumn:a,selectedRanges:l,lastSelectedRanges:s}})}setFocusRow(e){var u;if(!this.metrics||!this.prevMetrics)return;const{gridY:t,height:n,lastTop:s,userRowHeights:o,rowHeight:i}=this.metrics,r=n-t,l=Math.round(r/2)+((u=o.get(e))!=null?u:i),a=this.getMetricState(),c=this.metricCalculator.getLastTop(a,e+1,l);this.setState({top:Math.min(s,c),selectedRanges:[new Q(null,e,null,e)],isStuckToBottom:!1});const{cursorColumn:d}=this.state;this.moveCursorToPosition(d,e,!1,!1)}selectAll(){const{model:e,theme:t}=this.props,{autoSelectRow:n,autoSelectColumn:s}=t,o=s!==void 0&&s?null:0,i=s!==void 0&&s?null:e.rowCount-1,r=n!==void 0&&n?null:0,l=n!==void 0&&n?null:e.columnCount-1;this.setSelectedRanges([new Q(r,o,l,i)])}moveCursor(e,t,n){const{cursorRow:s,cursorColumn:o,selectionEndColumn:i,selectionEndRow:r}=this.state,l=n?i:o,a=n?r:s;if(a===null||l===null){const{left:c,top:d}=this.state;this.moveCursorToPosition(c,d,n)}else{const{model:c}=this.props,{columnCount:d,rowCount:u}=c,h=Be(l+e,0,d-1),g=Be(a+t,0,u-1);this.moveCursorToPosition(h,g,n)}}moveCursorInDirection(e=Q.SELECTION_DIRECTION.DOWN){var c;const{model:t}=this.props,{columnCount:n,rowCount:s}=t,{cursorRow:o,cursorColumn:i,selectedRanges:r}=this.state,l=r.length>0?r:[Q.makeCell(i,o)];let a=null;if(l.length===1&&Q.cellCount(l)===1){const d=new Q(0,0,n-1,s-1);a=(c=d.nextCell(i,o,e))!=null?c:d.startCell(e)}else a=Q.nextCell(Q.boundedRanges(l,n,s),i,o,e);if(a!=null){const{column:d,row:u}=a;this.setState({cursorColumn:d,cursorRow:u}),Q.containsCell(r,d,u)||this.setState({selectedRanges:[Q.makeCell(d,u)],selectionStartColumn:d,selectionStartRow:u,selectionEndColumn:d,selectionEndRow:u}),this.moveViewToCell(a.column,a.row)}}moveCursorToPosition(e,t,n=!1,s=!0,o=!1){n||this.beginSelection(e,t),this.moveSelection(e,t,n,o),s&&this.moveViewToCell(e,t)}moveViewToCell(e,t){if(!this.metrics)throw new Error("metrics not set");const{metricCalculator:n}=this,{bottomVisible:s,rightVisible:o,topVisible:i,leftVisible:r}=this.metrics,l=this.getMetricState(this.state);let{top:a,left:c,topOffset:d,leftOffset:u}=this.state;t!=null&&!H.isFloatingRow(t,this.metrics)&&(t<i?(a=n.getTopForTopVisible(l,t),d=0):t>s&&(a=n.getTopForBottomVisible(l,t),d=0)),e!=null&&!H.isFloatingColumn(e,this.metrics)&&(e<r?(c=n.getLeftForLeftVisible(l,e),u=0):e>o&&(c=n.getLeftForRightVisible(l,e),u=0)),this.setViewState({top:a,left:c,topOffset:d,leftOffset:u})}setViewState(e,t=!1){if(!this.metrics)throw new Error("metrics not set");const{isStickyBottom:n,isStickyRight:s}=this.props,{top:o,left:i}=e,{lastTop:r,lastLeft:l}=this.metrics;o!=null&&this.setState({isStuckToBottom:n&&o>=r}),i!=null&&this.setState({isStuckToRight:s&&i>=l}),this.setState(e),t&&this.forceUpdate()}startEditing(e,t,n=!1,s,o){const{model:i}=this.props;if(!ke(i))throw new Error("model is not editable");const r=this.getModelColumn(e),l=this.getModelRow(t),a={column:e,row:t,selectionRange:s,value:o!==void 0?o:i.editValueForCell(r,l),isQuickEdit:n};this.setState({editingCell:a,cursorColumn:e,cursorRow:t}),this.moveViewToCell(e,t)}isValidForCell(e,t,n){const{model:s}=this.props,o=this.getModelColumn(e),i=this.getModelRow(t);return ke(s)&&s.isValidForCell(o,i,n)}async pasteValue(e){const{model:t}=this.props,{movedColumns:n,movedRows:s,selectedRanges:o}=this.state;try{if(yr(t),!t.isEditable||!o.every(u=>t.isEditableRange(u)))throw new hi("Can't paste in to read-only area.");if(o.length<=0)throw new hi("Select an area to paste to.");if(typeof e=="string"){const u=[],h=H.getModelRanges(o,n,s);Q.forEachCell(h,(g,p)=>{u.push({column:g,row:p,text:e})}),await t.setValues(u);return}const i=e.length,r=e[0].length,{columnCount:l,rowCount:a}=t;let c=o;if(c.every(u=>{var h,g;return Q.cellCount([u])===1&&((h=u.startColumn)!=null?h:0)+r<=l&&((g=u.startRow)!=null?g:0)+i<=a})&&(c=c.map(u=>{var h,g;return new Q(u.startColumn,u.startRow,((h=u.startColumn)!=null?h:0)+r-1,((g=u.startRow)!=null?g:0)+i-1)}),this.setSelectedRanges(c)),!c.every(u=>Q.rowCount([u])===i&&Q.columnCount([u])===r))throw new hi("Copy and paste area are not same size.");const d=[];c.forEach(u=>{var h,g;for(let p=0;p<r;p+=1)for(let f=0;f<i;f+=1)d.push({column:((h=u.startColumn)!=null?h:0)+p,row:((g=u.startRow)!=null?g:0)+f,text:e[f][p]})}),await t.setValues(d)}catch(i){const{onError:r}=this.props;r(i instanceof Error?i:new Error(`${i}`))}}setValueForCell(e,t,n){const{model:s}=this.props;yr(s);const o=this.getModelColumn(e),i=this.getModelRow(t);return s.isValidForCell(o,i,n)?(s.setValueForCell(o,i,n),!0):!1}setValueForRanges(e,t){const{model:n}=this.props,{movedColumns:s,movedRows:o}=this.state,i=H.getModelRanges(e,s,o);ke(n)&&n.setValueForRanges(i,t)}isSelected(e,t){var s,o;const{selectedRanges:n}=this.state;for(let i=0;i<n.length;i+=1){const r=n[i],l=r.startRow===null||r.startRow<=e&&e<=((s=r.endRow)!=null?s:0),a=r.startColumn===null||r.startColumn<=t&&t<=((o=r.endColumn)!=null?o:0);if(l&&a)return!0}return!1}addDocumentCursor(e=null){this.documentCursor!==Wn.getCursorClassName(e)&&(this.documentCursor!=null&&document.documentElement.classList.remove(this.documentCursor),this.documentCursor=Wn.getCursorClassName(e),this.documentCursor!=null&&document.documentElement.classList.add(this.documentCursor),document.documentElement.classList.add("grid-block-events"))}removeDocumentCursor(){this.documentCursor!=null&&(document.documentElement.classList.remove(this.documentCursor),document.documentElement.classList.remove("grid-block-events"),this.documentCursor=null)}startDragTimer(e){this.stopDragTimer();const t=new MouseEvent("custom",e.nativeEvent);this.dragTimer=setTimeout(()=>{this.handleMouseDrag(t)},Wn.dragTimeout)}stopDragTimer(){this.dragTimer&&(clearTimeout(this.dragTimer),this.dragTimer=null)}drawCanvas(e=this.updateMetrics()){if(!this.canvas)throw new Error("canvas is not set");if(!this.canvasContext)throw new Error("context not set");const{cursorColumn:t,cursorRow:n,draggingColumn:s,draggingColumnSeparator:o,draggingRow:i,draggingRowOffset:r,draggingRowSeparator:l,editingCell:a,isDraggingHorizontalScrollBar:c,isDraggingVerticalScrollBar:d,isDragging:u,mouseX:h,mouseY:g,selectedRanges:p}=this.state,{model:f,stateOverride:C}=this.props,{renderer:w}=this,S=this.canvasContext,T=this.getTheme(),R=this.canvas.clientWidth,b=this.canvas.clientHeight,v={width:R,height:b,context:S,theme:T,model:f,metrics:e,mouseX:h,mouseY:g,selectedRanges:p,draggingColumn:s,draggingColumnSeparator:o,draggingRow:i,draggingRowOffset:r,draggingRowSeparator:l,editingCell:a,isDraggingHorizontalScrollBar:c,isDraggingVerticalScrollBar:d,isDragging:u,cursorColumn:t,cursorRow:n,...C};S.save(),w.drawCanvas(v),S.restore()}focus(){var e;(e=this.canvas)==null||e.focus()}isFocused(){return document.activeElement===this.canvas}handleClick(e){var s;const t=this.getGridPointFromEvent(e),n=this.getMouseHandlers();for(let o=0;o<n.length;o+=1)if(n[o].onClick(t,this,e)!==!1){e.stopPropagation(),e.preventDefault();break}(s=this.canvas)==null||s.focus()}handleContextMenu(e){const t=this.getGridPointFromEvent(e),n=this.getMouseHandlers();for(let s=0;s<n.length;s+=1)if(n[s].onContextMenu(t,this,e)!==!1){e.stopPropagation(),e.preventDefault();break}}handleKeyDown(e){var n,s;const t=this.getKeyHandlers();for(let o=0;o<t.length;o+=1){const r=t[o].onDown(e,this);if(r!==!1){const l=r;((n=l==null?void 0:l.stopPropagation)==null||n)&&e.stopPropagation(),((s=l==null?void 0:l.preventDefault)==null||s)&&e.preventDefault();break}}}notifyMouseHandlers(e,t,n=!0,s=!1){var l,a;const o=this.getGridPointFromEvent(t),i=this.getMouseHandlers();let r=null;for(let c=0;c<i.length;c+=1){const d=i[c],u=d[e]!=null&&d[e](o,this,t);if(u!==!1){d.cursor!=null&&({cursor:r}=d,s&&this.addDocumentCursor(r));const h=u;((l=h==null?void 0:h.stopPropagation)==null||l)&&t.stopPropagation(),((a=h==null?void 0:h.preventDefault)==null||a)&&t.preventDefault();break}}if(this.setState({cursor:r}),n){const{x:c,y:d}=o;this.setState({mouseX:c,mouseY:d})}}handleMouseDown(e){window.addEventListener("mousemove",this.handleMouseDrag,!0),window.addEventListener("mouseup",this.handleMouseUp,!0),!(e.button!=null&&e.button!==0)&&(this.notifyMouseHandlers("onDown",e),this.startDragTimer(e))}handleDoubleClick(e){this.notifyMouseHandlers("onDoubleClick",e)}handleMouseMove(e){this.notifyMouseHandlers("onMove",e)}handleMouseLeave(e){this.notifyMouseHandlers("onLeave",e,!1),this.setState({mouseX:null,mouseY:null})}handleMouseDrag(e){this.setState({isDragging:!0}),this.notifyMouseHandlers("onDrag",e,!0,!0),this.stopDragTimer()}handleMouseUp(e){window.removeEventListener("mousemove",this.handleMouseDrag,!0),window.removeEventListener("mouseup",this.handleMouseUp,!0),!(e.button!=null&&e.button!==0)&&(this.notifyMouseHandlers("onUp",e,!1),this.stopDragTimer(),this.removeDocumentCursor())}handleResize(){if(this.updateCanvasScale(),this.updateCanvas(),!this.metrics)throw new Error("metrics not set");this.forceUpdate()}handleWheel(e){var b,v,D,A;if(this.notifyMouseHandlers("onWheel",e),e.defaultPrevented)return;const{metricCalculator:t,metrics:n}=this,s=this.getMetricState();if(!n)throw new Error("metrics not set");const{lastTop:o,lastLeft:i,columnCount:r,rowCount:l,scrollableContentWidth:a,scrollableViewportWidth:c,scrollableContentHeight:d,scrollableViewportHeight:u,hasHorizontalBar:h,hasVerticalBar:g}=n;let{top:p,left:f,topOffset:C,leftOffset:w}=n;const S=this.getTheme();let{deltaX:T,deltaY:R}=H.getScrollDelta(e,n.barWidth,n.barHeight,n.rowHeight,n.rowHeight);for(;h&&T!==0;){if(w+=T,T=0,r>1){if(w>0&&f>=i||w<0&&f<=0){w=0;break}}else{if(w<=0){w=0;break}const N=a-c;if(w>=N){w=N;break}}if(w>0){const N=(b=n.allColumnWidths.get(f))!=null?b:t.getVisibleColumnWidth(f,s);w>=N?(T=w-N,w=0,f+=1):S.scrollSnapToColumn&&r>1&&(w=0,f+=1)}else if(w<0){const N=(v=n.allColumnWidths.get(f-1))!=null?v:t.getVisibleColumnWidth(f-1,s);Math.abs(w)<=N&&S.scrollSnapToColumn&&r>1?(w=0,f-=1):(T=w+N,w=0,f-=1)}}for(;g&&R!==0;){if(C+=R,R=0,l>1){if(C>0&&p>=o||C<0&&p<=0){C=0;break}}else{if(C<=0){C=0;break}const N=d-u;if(C>=N){C=N;break}}if(C>0){const N=(D=n.allRowHeights.get(p))!=null?D:t.getVisibleRowHeight(p,s);C>=N?(R=C-N,C=0,p+=1):S.scrollSnapToRow&&l>1&&(C=0,p+=1)}else if(C<0){const N=(A=n.allRowHeights.get(p-1))!=null?A:t.getVisibleRowHeight(p-1,s);Math.abs(C)<=N&&S.scrollSnapToRow&&l>1?(C=0,p-=1):(R=C+N,C=0,p-=1)}}this.setViewState({top:p,left:f,leftOffset:w,topOffset:C}),e.stopPropagation(),e.preventDefault()}handleEditCellCancel(){this.setState({editingCell:null}),this.focus()}handleEditCellChange(e){this.setState(({editingCell:t})=>{try{return Rr(t),{editingCell:{...t,value:e}}}catch(n){const{onError:s}=this.props;return s(n instanceof Error?n:new Error(`${n}`)),null}})}handleEditCellCommit(e,{direction:t=Nt.DOWN,fillRange:n=!1}={}){const{editingCell:s,selectedRanges:o}=this.state;if(!s)throw new Error("editingCell not set");const{column:i,row:r}=s;if(!this.isValidForCell(i,r,e)){t===null&&this.setState({editingCell:null});return}n?this.setValueForRanges(o,e):this.setValueForCell(i,r,e),t!==null&&this.moveCursorInDirection(t),this.setState({editingCell:null}),this.focus()}renderInputField(){const{model:e}=this.props,{editingCell:t}=this.state,{metrics:n}=this;if(t==null||n==null||!ke(e))return null;const{selectionRange:s,value:o,isQuickEdit:i}=t,{column:r,row:l}=t,{gridX:a,gridY:c,allColumnXs:d,allRowYs:u,allColumnWidths:h,allRowHeights:g}=n,p=d.get(r),f=u.get(l),C=h.get(r),w=g.get(l),S=p!=null&&f!=null&&C!=null&&w!=null?{position:"absolute",left:a+p,top:c+f,width:C,height:w}:{opacity:0},T=this.getModelColumn(r),R=this.getModelRow(l),b=T!=null&&R!=null?{textAlign:e.textAlignForCell(T,R)}:void 0,v=e.isValidForCell(T,R,o);return m("div",{style:S,children:m(Ki,{selectionRange:s,className:ee({error:!v}),onCancel:this.handleEditCellCancel,onChange:this.handleEditCellChange,onDone:this.handleEditCellCommit,isQuickEdit:i,style:b,value:o},`${r},${l}`)})}render(){const{cursor:e}=this.state;return y(Oe,{children:[m("canvas",{className:ee("grid-canvas",Wn.getCursorClassName(e)),ref:t=>{this.canvas=t},onClick:this.handleClick,onContextMenu:this.handleContextMenu,onDoubleClick:this.handleDoubleClick,onKeyDown:this.handleKeyDown,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,tabIndex:0,children:"Your browser does not support HTML canvas. Update your browser?"}),this.renderInputField()]})}};let Rs=Wn;Rs.contextType=wd;Rs.defaultProps={canvasOptions:{alpha:!1},isStickyBottom:!1,isStickyRight:!1,isStuckToBottom:!1,isStuckToRight:!1,keyHandlers:ve,mouseHandlers:ve,movedColumns:ve,movedRows:ve,onError:()=>{},onSelectionChanged:()=>{},onMovedColumnsChanged:e=>{},onMoveColumnComplete:()=>{},onMovedRowsChanged:()=>{},onMoveRowComplete:()=>{},onViewChanged:()=>{},stateOverride:{},theme:{autoSelectColumn:!1,autoSelectRow:!1}};Rs.pixelsPerLine=100/3;Rs.dragTimeout=1e3;Rs.getTheme=Re((e,t)=>({...td,...e,...t}));class bl extends Ca{get floatingTopRowCount(){return 0}get floatingBottomRowCount(){return 0}get floatingLeftColumnCount(){return 0}get floatingRightColumnCount(){return 0}get columnHeaderMaxDepth(){return 1}truncationCharForCell(t,n){}textAlignForCell(t,n){return"left"}colorForCell(t,n,s){return s.textColor}backgroundColorForCell(t,n,s){return null}colorForColumnHeader(t,n=0){return null}textForRowHeader(t){return""}textForRowFooter(t){return""}isColumnMovable(t,n=0){return!0}isRowMovable(t){return!0}getColumnHeaderGroup(t,n){}getColumnHeaderParentGroup(t,n){}}class Sd extends bl{constructor({rowCount:t=1e9,columnCount:n=100,floatingTopRowCount:s=0,floatingBottomRowCount:o=0,floatingLeftColumnCount:i=0,floatingRightColumnCount:r=0,isEditable:l=!1,editedData:a=[]}={}){super(),this.numRows=t,this.numColumns=n,this.floatingTop=s,this.floatingBottom=o,this.floatingLeft=i,this.floatingRight=r,this.editable=l,this.editedData=a}get rowCount(){return this.numRows}get columnCount(){return this.numColumns}get floatingTopRowCount(){return this.floatingTop}get floatingBottomRowCount(){return this.floatingBottom}get floatingLeftColumnCount(){return this.floatingLeft}get floatingRightColumnCount(){return this.floatingRight}get isEditable(){return this.editable}textForCell(t,n){var s,o;return(o=(s=this.editedData[t])==null?void 0:s[n])!=null?o:`${t},${n}`}colorForCell(t,n,s){return s.textColor}textForColumnHeader(t,n=0){return`${t}`}textForRowHeader(t){return`${t}`}textForRowFooter(t){return`${t}`}async setValueForCell(t,n,s){this.editedData[t]==null&&(this.editedData[t]=[]),this.editedData[t][n]=`${s}`}async setValueForRanges(t,n){Q.forEachCell(t,(s,o)=>{this.setValueForCell(s,o,n)})}async setValues(t){var n,s;for(let o=0;o<t.length;o+=1){const i=t[o];this.setValueForCell((n=i.column)!=null?n:i.x,(s=i.row)!=null?s:i.y,i.text)}}editValueForCell(t,n){return this.textForCell(t,n)}isValidForCell(t,n,s){return!0}isEditableRange(t){return this.isEditable}delete(t){throw new Error("Method not implemented.")}}const $n=class extends Sd{constructor({rowCount:e=$n.DEFAULT_ROW_COUNT,columnCount:t=$n.DEFAULT_COLUMN_COUNT,children:n=new Map,childRowCount:s=Math.ceil(Math.max($n.MIN_CHILD_ROW_COUNT,e*$n.DEFAULT_CHILD_ROW_COUNT_FACTOR)),maxDepth:o=$n.MAX_DEPTH}={}){super({rowCount:e,columnCount:t}),this.getCachedModelRowOffset=pt((i,r)=>{let l=null,a=r;const c=[...i].sort((d,u)=>d[0]-u[0]);for(let d=0;d<c.length;d+=1){const[u,h]=c[d];if(a<=u)break;const g=h.rowCount;if(a<=u+g){l=u,a=a-u-1;break}a-=g}return{key:l,offsetRow:a}}),this.getCachedTextForRowHeader=pt((i,r)=>{const{key:l,offsetRow:a}=this.getCachedModelRowOffset(i,r);if(l!=null){const c=i.get(l);if(c!==void 0)return`${l}.${c.textForRowHeader(a)}`}return`${a}`}),this.getCachedTextForCell=pt((i,r,l)=>{const{key:a,offsetRow:c}=this.getCachedModelRowOffset(i,l);if(a!=null){const d=i.get(a);if(d!==void 0)return`${a}.${d.textForCell(r,c)}`}return`${r},${c}`}),this.getCachedIsRowExpandable=pt((i,r,l)=>this.getCachedDepthForRow(i,r)<l),this.getCachedIsRowExpanded=pt((i,r)=>{const{key:l,offsetRow:a}=this.getCachedModelRowOffset(i,r);if(l!=null){const c=i.get(l);if(c!==void 0)return c.isRowExpanded(a)}return i.has(a)}),this.getCachedDepthForRow=pt((i,r)=>{const{key:l,offsetRow:a}=this.getCachedModelRowOffset(i,r);if(l!=null){const c=i.get(l);if(c!==void 0)return c.depthForRow(a)+1}return 0}),this.children=n,this.childRowCount=s,this.maxDepth=o}textForCell(e,t){return this.getCachedTextForCell(this.children,e,t)}textForRowHeader(e){return this.getCachedTextForRowHeader(this.children,e)}isRowMovable(e){return!1}get hasExpandableRows(){return!0}get isExpandAllAvailable(){return!1}get floatingBottomRowCount(){return 0}isRowExpandable(e){return this.getCachedIsRowExpandable(this.children,e,this.maxDepth)}isRowExpanded(e){return this.getCachedIsRowExpanded(this.children,e)}setRowExpanded(e,t,n=!1){const{key:s,offsetRow:o}=this.getCachedModelRowOffset(this.children,e),i=new Map(this.children);if(s!=null){const r=this.children.get(s);if(r!==void 0){const{rowCount:l}=r;r.setRowExpanded(o,t,n),this.numRows+=r.rowCount-l}}else if(t){const r=new $n({rowCount:this.childRowCount,columnCount:this.numColumns});i.set(o,r),this.numRows+=r.rowCount}else{const r=i.get(o);r!==void 0&&(this.numRows-=r.rowCount,i.delete(o))}this.children=i}expandAll(){throw new Error("Expand all not implemented.")}collapseAll(){throw new Error("Collapse all not implemented.")}depthForRow(e){return this.getCachedDepthForRow(this.children,e)}};let Qs=$n;Qs.DEFAULT_ROW_COUNT=1e9;Qs.DEFAULT_COLUMN_COUNT=100;Qs.DEFAULT_CHILD_ROW_COUNT_FACTOR=.01;Qs.MIN_CHILD_ROW_COUNT=10;Qs.MAX_DEPTH=10;const{dh:E}=globalThis,Qo=B.exports.shape({name:B.exports.string.isRequired,type:B.exports.string.isRequired,description:B.exports.string,constituentType:B.exports.string}),Tl=B.exports.shape({not:B.exports.func.isRequired,and:B.exports.func.isRequired,or:B.exports.func.isRequired}),bd=B.exports.shape({asc:B.exports.func.isRequired,desc:B.exports.func.isRequired,abs:B.exports.func.isRequired,column:Qo.isRequired,direction:B.exports.string.isRequired,isAbs:B.exports.bool.isRequired}),Td=B.exports.shape({columns:B.exports.arrayOf(Qo).isRequired,customColumns:B.exports.arrayOf(B.exports.string).isRequired,filter:B.exports.arrayOf(Tl),addEventListener:B.exports.func.isRequired,removeEventListener:B.exports.func.isRequired,size:B.exports.number.isRequired,sort:B.exports.arrayOf(B.exports.any),copy:B.exports.func.isRequired,applyFilter:B.exports.func.isRequired,applySort:B.exports.func.isRequired,applyCustomColumns:B.exports.func.isRequired,description:B.exports.string}),Ed=B.exports.shape({columns:B.exports.arrayOf(Qo),filter:B.exports.arrayOf(B.exports.any),isExpanded:B.exports.func.isRequired,saveExpandedState:B.exports.func.isRequired,addEventListener:B.exports.func.isRequired,removeEventListener:B.exports.func.isRequired,size:B.exports.number.isRequired,sort:B.exports.arrayOf(B.exports.any),applyFilter:B.exports.func.isRequired,applySort:B.exports.func.isRequired}),Mo=B.exports.shape({name:B.exports.string.isRequired,type:B.exports.string.isRequired}),vd=B.exports.shape({created:B.exports.arrayOf(Mo).isRequired,updated:B.exports.arrayOf(Mo).isRequired,removed:B.exports.arrayOf(Mo).isRequired}),Rd=B.exports.shape({groupingColumns:B.exports.arrayOf(B.exports.string),aggregations:B.exports.shape({}),includeConstituents:B.exports.bool,includeOriginalColumns:B.exports.bool,includeDescriptions:B.exports.bool}),yd=B.exports.shape({addEventListener:B.exports.func.isRequired,removeEventListener:B.exports.func.isRequired,onLogMessage:B.exports.func,getTable:B.exports.func.isRequired,runCode:B.exports.func.isRequired});Object.freeze({Column:Qo,FilterCondition:Tl,IdeSession:yd,RollupConfig:Rd,Sort:bd,Table:Td,TreeTable:Ed,VariableChanges:vd,VariableDefinition:Mo});const Fd=1e4;function Dd(e,t,n=Fd){return new Promise((s,o)=>{let i;const r=setTimeout(()=>{i==null||i(),o(new il(`Variable ${t} not found`))},n);function l(a){const c=a.created.find(d=>d.title===t);c!=null&&(clearTimeout(r),i==null||i(),s(c))}i=e.subscribeToFieldUpdates(l)})}class Le{static isValid(t){return!0}static isSameFormat(t,n){throw new Error("isSameFormat not implemented")}static makeFormat(t,n,s){return{label:t,formatString:n,type:s}}format(t,n){return""}}Le.TYPE_GLOBAL="type-global";Le.TYPE_CONTEXT_PRESET="type-context-preset";Le.TYPE_CONTEXT_CUSTOM="type-context-custom";class Id extends Le{format(t){switch(t){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}class Nd extends Le{format(t){return String.fromCharCode(t)}}const Ar=ie.module("DateTimeColumnFormatter"),zn=class extends Le{constructor({timeZone:e="",showTimeZone:t=!0,showTSeparator:n=!1,defaultDateTimeFormatString:s=zn.DEFAULT_DATETIME_FORMAT_STRING}={}){super();const o=e||zn.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=E.i18n.TimeZone.getTimeZone(o)}catch{Ar.error("Unsupported time zone id",o),this.dhTimeZone=E.i18n.TimeZone.getTimeZone(zn.DEFAULT_TIME_ZONE_ID)}this.defaultDateTimeFormatString=s,this.showTimeZone=t,this.showTSeparator=n,this.formatStringMap=zn.makeFormatStringMap(t,n)}static isValid(e){try{return E.i18n.DateTimeFormat.format(e.formatString,new Date),!0}catch{return!1}}static makeFormat(e,t,n=Le.TYPE_CONTEXT_PRESET){return{label:e,formatString:t,type:n}}static isSameFormat(e,t){return e===t||e!==null&&t!==null&&e.type===t.type&&e.formatString===t.formatString}static makeGlobalFormatStringMap(e,t){const n=t?"'T'":" ",s=e?" z":"";return new Map([["yyyy-MM-dd HH:mm:ss",`yyyy-MM-dd${n}HH:mm:ss${s}`],["yyyy-MM-dd HH:mm:ss.SSS",`yyyy-MM-dd${n}HH:mm:ss.SSS${s}`],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS",`yyyy-MM-dd${n}HH:mm:ss.SSSSSSSSS${s}`]])}static getGlobalFormats(e,t){return[...zn.makeGlobalFormatStringMap(e,t).keys()]}static makeFormatStringMap(e,t){const n=t!==void 0&&t?"'T'":" ",s=e!==void 0&&e?" z":"";return new Map([["yyyy-MM-dd",`yyyy-MM-dd${s}`],["MM-dd-yyyy",`MM-dd-yyyy${s}`],["HH:mm:ss",`HH:mm:ss${s}`],["HH:mm:ss.SSS",`HH:mm:ss.SSS${s}`],["HH:mm:ss.SSSSSSSSS",`HH:mm:ss.SSSSSSSSS${s}`],["yyyy-MM-dd HH:mm:ss",`yyyy-MM-dd${n}HH:mm:ss${s}`],["yyyy-MM-dd HH:mm:ss.SSS",`yyyy-MM-dd${n}HH:mm:ss.SSS${s}`],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS",`yyyy-MM-dd${n}HH:mm:ss.SSSSSSSSS${s}`]])}static getFormats(e,t){return[...zn.makeFormatStringMap(e,t).keys()]}getEffectiveFormatString(e){var t;return(t=this.formatStringMap.get(e))!=null?t:e}format(e,t={}){const n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultDateTimeFormatString,s=this.getEffectiveFormatString(n);try{return E.i18n.DateTimeFormat.format(s,e,this.dhTimeZone)}catch{Ar.error("Invalid format arguments")}return""}};let kn=zn;kn.DEFAULT_DATETIME_FORMAT_STRING="yyyy-MM-dd HH:mm:ss.SSS";kn.DEFAULT_TIME_ZONE_ID="America/New_York";const Ad=ie.module("DecimalColumnFormatter"),At=class extends Le{constructor({defaultFormatString:e=At.DEFAULT_FORMAT_STRING}={}){super(),this.defaultFormatString=e}static isValid(e){try{return E.i18n.NumberFormat.format(e.formatString,0),!0}catch{return!1}}static makeFormat(e,t,n=Le.TYPE_CONTEXT_PRESET,s){return{label:e,type:n,formatString:t,multiplier:s}}static makePresetFormat(e,t="",n){return At.makeFormat(e,t,Le.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(e="",t){return At.makeFormat("Custom Format",e,Le.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}format(e,t={}){const n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,s=t.multiplier!==void 0&&t.multiplier!==0?e*t.multiplier:e;try{return E.i18n.NumberFormat.format(n,s)}catch{Ad.error("Invalid format arguments")}return""}};let _e=At;_e.DEFAULT_FORMAT_STRING="###,##0.0000";_e.FORMAT_PERCENT=At.makePresetFormat("Percent","##0.00%");_e.FORMAT_BASIS_POINTS=At.makePresetFormat("Basis Points","###,##0 bp",1e4);_e.FORMAT_MILLIONS=At.makePresetFormat("Millions","###,##0.000 mm",1e-6);_e.FORMAT_SCIENTIFIC_NOTATION=At.makePresetFormat("Scientific Notation","0.0000E0");_e.FORMAT_ROUND=At.makePresetFormat("Round","###,##0");_e.FORMAT_ROUND_TWO_DECIMALS=At.makePresetFormat("0.00","###,##0.00");_e.FORMAT_ROUND_FOUR_DECIMALS=At.makePresetFormat("0.0000","###,##0.0000");class Md extends Le{format(t){return`${t}`}}const Od=ie.module("IntegerColumnFormatter"),bs=class extends Le{constructor({defaultFormatString:e=bs.DEFAULT_FORMAT_STRING}={}){super(),this.defaultFormatString=e}static isValid(e){try{return E.i18n.NumberFormat.format(e.formatString,0),!0}catch{return!1}}static makeFormat(e,t,n=Le.TYPE_CONTEXT_PRESET,s){return{label:e,type:n,formatString:t,multiplier:s}}static makePresetFormat(e,t="",n){return bs.makeFormat(e,t,Le.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(e="",t){return bs.makeFormat("Custom Format",e,Le.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}format(e,t={}){const n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,s=t.multiplier!==void 0&&t.multiplier!==0?e*t.multiplier:e;try{return E.i18n.NumberFormat.format(n,s)}catch{Od.error("Invalid format arguments")}return""}};let Dt=bs;Dt.DEFAULT_FORMAT_STRING="###,##0";Dt.FORMAT_MILLIONS=bs.makePresetFormat("Millions","###,##0.000 mm",1e-6);Dt.FORMAT_SCIENTIFIC_NOTATION=bs.makePresetFormat("Scientific Notation","0.0000E0");class xd extends Le{format(t){return t}}const ct=class{static makeDateWrapper(e,t,n=0,s=1,o=0,i=0,r=0,l=0){if(!e)throw new Error("No timezone provided");const a=`${t}`.padStart(4,"0"),c=`${n+1}`.padStart(2,"0"),d=`${s}`.padStart(2,"0"),u=`${o}`.padStart(2,"0"),h=`${i}`.padStart(2,"0"),g=`${r}`.padStart(2,"0"),p=`${l}`.padStart(9,"0"),f=`${a}-${c}-${d} ${u}:${h}:${g}.${p}`;return E.i18n.DateTimeFormat.parse(ct.FULL_DATE_FORMAT,f,E.i18n.TimeZone.getTimeZone(e))}static getNextNanos(e){const t=parseInt(e,10),n="0".repeat(9-e.length),s=`${t+1}${n}`;return parseInt(s,10)}static getNextDate(e,t,n){let{year:s,month:o,date:i,hours:r,minutes:l,seconds:a,nanos:c}=t;if(e.nanos!=null){if(e.nanos.length===9)return null;c=ct.getNextNanos(e.nanos),c>999999999&&(a+=1,c=0)}else e.seconds!=null?a+=1:e.minutes!=null?l+=1:e.hours!=null?r+=1:e.date!=null?i+=1:e.month!=null?o+=1:s+=1;const d=new Date(s,o,i,r,l,a);return ct.makeDateWrapper(n,d.getFullYear(),d.getMonth(),d.getDate(),d.getHours(),d.getMinutes(),d.getSeconds(),c)}static parseMonth(e){const t=parseInt(e,10);if(!Number.isNaN(t))return t>=1&&t<=12?t-1:NaN;const n=e.trim().toLowerCase();if(n.length>=3){for(let s=0;s<ct.months.length;s+=1)if(ct.months[s].startsWith(n))return s}return NaN}static parseDateValues(e,t,n,s,o,i,r){const l=parseInt(e,10),a=t!=null?this.parseMonth(t):0,c=n!=null?parseInt(n,10):1,d=s!=null?parseInt(s,10):0,u=o!=null?parseInt(o,10):0,h=i!=null?parseInt(i,10):0,g=r!=null?parseInt(r.padEnd(9,"0"),10):0;return Number.isNaN(l)||Number.isNaN(a)||Number.isNaN(c)||Number.isNaN(d)||Number.isNaN(u)||Number.isNaN(h)||Number.isNaN(g)?null:{year:l,month:a,date:c,hours:d,minutes:u,seconds:h,nanos:g}}static parseDateTimeString(e){const n=/\s*(\d{4})([-./]([\da-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/.exec(e);if(n==null)throw new Error(`Unexpected date string: ${e}`);const[,s,,o,,i,,r,,l,,a,,c,d]=n;if(d!=null&&d.length>0)throw new Error(`Unexpected characters after date string '${e}': ${d}`);return{year:s,month:o,date:i,hours:r,minutes:l,seconds:a,nanos:c}}static parseDateRange(e,t){const n=e.trim().toLowerCase();if(n.length===0)throw new Error("Cannot parse date range from empty string");if(n==="null")return[null,null];if(n==="today"){const l=new Date(Date.now()),a=ct.makeDateWrapper(t,l.getFullYear(),l.getMonth(),l.getDate()),c=ct.makeDateWrapper(t,l.getFullYear(),l.getMonth(),l.getDate()+1);return[a,c]}if(n==="yesterday"){const l=new Date(Date.now()),a=ct.makeDateWrapper(t,l.getFullYear(),l.getMonth(),l.getDate()-1),c=ct.makeDateWrapper(t,l.getFullYear(),l.getMonth(),l.getDate());return[a,c]}if(n==="now"){const l=new Date(Date.now());return[E.DateWrapper.ofJsDate(l),null]}const s=ct.parseDateTimeString(n);if(s.year==null&&s.month==null&&s.date==null)throw new Error(`Unable to extract year, month, or day ${n}`);const o=ct.parseDateValues(s.year,s.month,s.date,s.hours,s.minutes,s.seconds,s.nanos);if(o==null)throw new Error(`Unable to extract date values from ${s}`);const i=ct.makeDateWrapper(t,o.year,o.month,o.date,o.hours,o.minutes,o.seconds,o.nanos),r=ct.getNextDate(s,o,t);return[i,r]}static getJsDate(e){return typeof e=="number"?new Date(e):e.asDate()}};let cn=ct;cn.FULL_DATE_FORMAT="yyyy-MM-dd HH:mm:ss.SSSSSSSSS";cn.months=["january","february","march","april","may","june","july","august","september","october","november","december"];class Gt{}Gt.not="not";Gt.and="and";Gt.or="or";function kd(e){if(!(e==="not"||e==="and"||e==="or"))throw new Error("operator is not a valid FilterOperatorValue")}class _{}_.eq="eq";_.eqIgnoreCase="eqIgnoreCase";_.notEq="notEq";_.notEqIgnoreCase="notEqIgnoreCase";_.greaterThan="greaterThan";_.greaterThanOrEqualTo="greaterThanOrEqualTo";_.lessThan="lessThan";_.lessThanOrEqualTo="lessThanOrEqualTo";_.in="in";_.inIgnoreCase="inIgnoreCase";_.notIn="notIn";_.notInIgnoreCase="notInIgnoreCase";_.isTrue="isTrue";_.isFalse="isFalse";_.isNull="isNull";_.invoke="invoke";_.contains="contains";_.notContains="notContains";_.startsWith="startsWith";_.endsWith="endsWith";_.containsAny="containsAny";function Ld(e){switch(e){case _.eq:return"is exactly";case _.eqIgnoreCase:return"is exactly (ignore case)";case _.notEq:return"is not exactly";case _.notEqIgnoreCase:return"is not exactly (ignore case)";case _.contains:return"contains";case _.notContains:return"does not contain";case _.startsWith:return"starts with";case _.endsWith:return"ends with";default:throw new Error(`Unrecognized text filter type ${e}`)}}function Pd(e){switch(e){case _.eq:return"is equal to";case _.notEq:return"is not equal to";case _.greaterThan:return"greater than";case _.greaterThanOrEqualTo:return"greater than or equal to";case _.lessThan:return"less than";case _.lessThanOrEqualTo:return"less than or equal to";default:throw new Error(`Unrecognized number filter type ${e}`)}}function _d(e){switch(e){case _.eq:return"date is";case _.notEq:return"date is not";case _.notEqIgnoreCase:case _.greaterThan:return"date is after";case _.greaterThanOrEqualTo:return"date is after or equal";case _.lessThan:return"date is before";case _.lessThanOrEqualTo:return"date is before or equal";default:throw new Error(`Unrecognized date filter type ${e}`)}}function Hd(e){switch(e){case _.isTrue:return"Is True";case _.isFalse:return"Is False";case _.isNull:return"Is Null";default:throw new Error(`Unrecognized boolean filter type ${e}`)}}const jt=ie.module("TableUtils"),Y=class{static getSortIndex(e,t){var n;for(let s=0;s<e.length;s+=1)if(((n=e[s].column)==null?void 0:n.index)===t)return s;return null}static getSortForColumn(e,t){const n=Y.getSortIndex(e,t);return n!=null?e[n]:null}static getFilterText(e){return e?e.toString():null}static getFilterTypes(e){return Y.isBooleanType(e)?[_.isTrue,_.isFalse,_.isNull]:Y.isCharType(e)||Y.isNumberType(e)||Y.isDateType(e)?[_.eq,_.notEq,_.greaterThan,_.greaterThanOrEqualTo,_.lessThan,_.lessThanOrEqualTo]:Y.isTextType(e)?[_.eq,_.eqIgnoreCase,_.notEq,_.notEqIgnoreCase,_.contains,_.notContains,_.startsWith,_.endsWith]:[]}static getNextSort(e,t,n){if(e==null||n<0||n>=e.length)return null;const s=Y.getSortForColumn(t,n);return s===null?e[n].sort().asc():s.direction===Y.sortDirection.ascending?s.desc():null}static makeColumnSort(e,t,n,s){if(e==null||t<0||t>=e.length||n===Y.sortDirection.none)return null;let o=e[t].sort();switch(n){case Y.sortDirection.ascending:o=o.asc();break;case Y.sortDirection.descending:o=o.desc();break}return s&&(o=o.abs()),o}static toggleSortForColumn(e,t,n,s=!1){if(n<0||n>=t.length)return[];const o=Y.getNextSort(t,e,n);return Y.setSortForColumn(e,n,o,s)}static sortColumn(e,t,n,s,o,i){if(e==null||n<0||n>=t.length)return[];const r=Y.makeColumnSort(t,n,s,o);return Y.setSortForColumn(e,n,r,i)}static setSortForColumn(e,t,n,s=!1){const o=Y.getSortIndex(e,t);let i=[];return s&&(i=i.concat(e.filter(({direction:r})=>r!==Y.sortDirection.reverse)),o!==null&&i.splice(o,1)),n!==null&&i.push(n),i}static getNormalizedType(e){switch(e){case"boolean":case"java.lang.Boolean":case Y.dataType.BOOLEAN:return Y.dataType.BOOLEAN;case"char":case"java.lang.Character":case Y.dataType.CHAR:return Y.dataType.CHAR;case"java.lang.String":case Y.dataType.STRING:return Y.dataType.STRING;case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":case Y.dataType.DATETIME:return Y.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case Y.dataType.DECIMAL:return Y.dataType.DECIMAL;case"int":case"java.lang.Integer":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":case"java.math.BigInteger":case Y.dataType.INT:return Y.dataType.INT;default:return Y.dataType.UNKNOWN}}static isLongType(e){switch(e){case"long":case"java.lang.Long":return!0;default:return!1}}static isDateType(e){switch(e){case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":return!0;default:return!1}}static isNumberType(e){return Y.isIntegerType(e)||Y.isDecimalType(e)}static isIntegerType(e){switch(e){case"int":case"java.lang.Integer":case"java.math.BigInteger":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":return!0;default:return!1}}static isDecimalType(e){switch(e){case"double":case"java.lang.Double":case"java.math.BigDecimal":case"float":case"java.lang.Float":return!0;default:return!1}}static isBigDecimalType(e){switch(e){case"java.math.BigDecimal":return!0;default:return!1}}static isBigIntegerType(e){switch(e){case"java.math.BigInteger":return!0;default:return!1}}static isBooleanType(e){switch(e){case"boolean":case"java.lang.Boolean":return!0;default:return!1}}static isCharType(e){switch(e){case"char":case"java.lang.Character":return!0;default:return!1}}static isStringType(e){switch(e){case"java.lang.String":return!0;default:return!1}}static isTextType(e){return this.isStringType(e)||this.isCharType(e)}static getBaseType(e){return e.split("[]")[0]}static isCompatibleType(e,t){return Y.getNormalizedType(e)===Y.getNormalizedType(t)}static makeQuickFilter(e,t,n){const s=t.split("||");let o=null;for(let i=0;i<s.length;i+=1){const l=s[i].split("&&");let a=null;for(let c=0;c<l.length;c+=1){const d=l[c].trim();if(d.length>0){const u=Y.makeQuickFilterFromComponent(e,d,n);if(u)a?a=a.and(u):a=u;else throw new Error(`Unable to parse quick filter from text ${t}`)}}o&&a?o=o.or(a):o=a}return o}static makeQuickFilterFromComponent(e,t,n){const{type:s}=e;return Y.isNumberType(s)?this.makeQuickNumberFilter(e,t):Y.isBooleanType(s)?this.makeQuickBooleanFilter(e,t):n!=null&&Y.isDateType(s)?this.makeQuickDateFilter(e,t,n):Y.isCharType(s)?this.makeQuickCharFilter(e,t):this.makeQuickTextFilter(e,t)}static makeQuickNumberFilter(e,t){if(t==null)return null;const n=e.filter();let s=null;const i=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i.exec(t);let r=null,l=null,a=null,c=null,d=null;if(i!==null&&i.length>3&&([,r,l,a,c,d]=i),d!=null&&d.trim().length>0)return null;if(r==null&&(r="="),c!=null){if(!(r==="="||r==="!"||r==="!="))return null;switch(c=c.trim().toLowerCase(),c){case"null":s=n.isNull();break;case"nan":s=E.FilterCondition.invoke("isNaN",n);break;case"infinity":case"inf":case"\u221E":l!=null?s=E.FilterCondition.invoke("isInf",n).and(n.lessThan(E.FilterValue.ofNumber(0))):s=E.FilterCondition.invoke("isInf",n).and(n.greaterThan(E.FilterValue.ofNumber(0)));break}return s!==null&&(r==="!"||r==="!=")&&(s=s.not()),s}if(a==null)return null;if(a=Y.removeCommas(a),Y.isLongType(e.type))try{a=E.FilterValue.ofNumber(E.LongWrapper.ofString(`${l!=null?"-":""}${a}`))}catch(u){return jt.warn("Unable to create long filter",u),null}else{if(a=parseFloat(a),a==null||Number.isNaN(a))return null;a=E.FilterValue.ofNumber(l!=null?0-a:a)}return s=e.filter(),Y.makeRangeFilterWithOperation(s,r,a)}static makeQuickTextFilter(e,t){if(t==null)return null;const n=`${t}`.trim(),o=/^(!~|!=|~|=|!)?(.*)/.exec(n);let i=null,r=null;if(o!==null&&o.length>2&&([,i,r]=o,r!=null&&(r=r.trim())),r==null||r.length===0)return null;i==null&&(i="=");const l=e.filter();if(r.toLowerCase()==="null")switch(i){case"=":return l.isNull();case"!=":case"!":return l.isNull().not();default:return null}let a=null,c=null;switch(r.startsWith("*")?(a="*",r=r.substring(1)):r.endsWith("*")&&!r.endsWith("\\*")&&(c="*",r=r.substring(0,r.length-1)),r=r.replace("\\",""),i){case"~":return l.isNull().not().and(l.invoke("matches",E.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E.*`)));case"!~":return l.isNull().or(l.invoke("matches",E.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E.*`)).not());case"!=":return a==="*"?l.isNull().or(l.invoke("matches",E.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E$`)).not()):c==="*"?l.isNull().or(l.invoke("matches",E.FilterValue.ofString(`(?s)(?i)^\\Q${r}\\E.*`)).not()):l.notEqIgnoreCase(E.FilterValue.ofString(r.toLowerCase()));case"=":return a==="*"?l.isNull().not().and(l.invoke("matches",E.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E$`))):c==="*"?l.isNull().not().and(l.invoke("matches",E.FilterValue.ofString(`(?s)(?i)^\\Q${r}\\E.*`))):l.eqIgnoreCase(E.FilterValue.ofString(r.toLowerCase()))}return null}static makeQuickBooleanFilter(e,t){if(t==null)return null;const s=/^(!=|=|!)?(.*)/.exec(`${t}`.trim());if(s===null)return null;const[,o,i]=s,r=o==="!"||o==="!=",l=i.trim().toLowerCase();let a=e.filter();try{const c=Y.makeBooleanValue(l);return c!=null&&c?a=a.isTrue():c===null?a=a.isNull():a=a.isFalse(),r?a.not():a}catch{return null}}static makeQuickDateFilter(e,t,n){const s=t.trim(),i=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/.exec(s);if(i==null||i.length<=2)throw new Error(`Unable to parse date filter: ${t}`);let r=null,l=null;[,r,l]=i;let a=_.eq;switch(r){case"<":a=_.lessThan;break;case"<=":case"=<":a=_.lessThanOrEqualTo;break;case">":a=_.greaterThan;break;case">=":case"=>":a=_.greaterThanOrEqualTo;break;case"!=":case"!":a=_.notEq;break;case"=":case"==":default:a=_.eq;break}return Y.makeQuickDateFilterWithOperation(e,l,a,n)}static makeQuickDateFilterWithOperation(e,t,n,s){if(e==null)throw new Error("Column is null");const[o,i]=cn.parseDateRange(t,s),r=o!=null?E.FilterValue.ofNumber(o):null,l=i!=null?E.FilterValue.ofNumber(i):null,a=e.filter();if(r==null)return n===_.notEq?a.isNull().not():a.isNull();switch(n){case _.eq:{if(l!=null){const c=a.greaterThanOrEqualTo(r),d=a.lessThan(l);return c.and(d)}return a.eq(r)}case _.lessThan:return a.lessThan(r);case _.lessThanOrEqualTo:return l!=null?a.lessThan(l):a.lessThanOrEqualTo(r);case _.greaterThan:return l!=null?a.greaterThanOrEqualTo(l):a.greaterThan(r);case _.greaterThanOrEqualTo:return a.greaterThanOrEqualTo(r);case _.notEq:{if(l!=null){const c=a.lessThan(r),d=a.greaterThanOrEqualTo(l);return c.or(d)}return a.notEq(r)}default:throw new Error(`Invalid operator: ${n}`)}}static quoteValue(e){return e.length>=2&&(e.charAt(0)==='"'&&e.charAt(e.length-1)==='"'||e.charAt(0)==="'"&&e.charAt(e.length-1)==="'")?e:`"${e}"`}static isRangeOperation(e){switch(e){case"<":case"<=":case"=<":case">":case">=":case"=>":return!0;default:return!1}}static makeQuickCharFilter(e,t){if(t==null)return null;const n=`${t}`.trim(),o=/^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/.exec(n);let i=null,r=null,l=null;if(o!==null&&o.length>3&&([,i,r,l]=o),l!=null&&l.trim().length>0||r==null||r.length===0)return null;i==null&&(i="=");const a=e.filter();if(r.toLowerCase()==="null")switch(i){case"=":return a.isNull();case"!=":case"!":return a.isNull().not();default:return null}const c=E.FilterValue.ofString(Y.isRangeOperation(i)?Y.quoteValue(r):r);return Y.makeRangeFilterWithOperation(a,i,c)}static makeRangeFilterWithOperation(e,t,n){switch(t){case"=":return e.eq(n);case"<":return e.lessThan(n);case"<=":case"=<":return e.lessThanOrEqualTo(n);case">":return e.greaterThan(n);case">=":case"=>":return e.greaterThanOrEqualTo(n);case"!=":case"!":return e.notEq(n);default:return null}}static makeCancelableTablePromise(e){return Ge.makeCancelable(e,t=>{t.close()})}static makeCancelableTableEventPromise(e,t,n=0,s=null){let o,i,r=!0;const l=new Promise((a,c)=>{i=setTimeout(()=>{o(),r=!1,c(new il(`Event "${t}" timed out.`))},n),o=e.addEventListener(t,d=>{if(s!=null&&!s(d)){jt.debug2("Event triggered, but matcher returned false.");return}jt.debug2("Event triggered, resolving."),o(),clearTimeout(i),r=!1,a(d)})});return l.cancel=()=>{if(r){jt.debug2("Pending promise cleanup."),o(),clearTimeout(i),r=!1;return}jt.debug2("Ignoring non-pending promise cancel.")},l}static makeAdvancedFilter(e,t,n){const{filterItems:s,filterOperators:o,invertSelection:i,selectedValues:r}=t;let l=null;for(let c=0;c<s.length;c+=1){const d=s[c],{selectedType:u,value:h}=d;if(u!=null&&u.length>0&&h!=null&&h.length>0)try{const g=Y.makeAdvancedValueFilter(e,u,h,n);if(g!=null){if(c===0)l=g;else if(l!==null&&c-1<o.length){const p=o[c-1];if(p===Gt.and)l=l.and(g);else if(p===Gt.or)l=l.or(g);else{jt.error("Unexpected filter operator",p,g),l=null;break}}}else jt.debug2("Empty filter ignored for",u,h)}catch(g){jt.error("Unable to create filter",g),l=null;break}}const a=Y.makeSelectValueFilter(e,r,i);return a!=null&&(l!=null?l=l.and(a):l=a),l}static removeCommas(e){return e.replace(/[\s|,]/g,"")}static makeFilterValue(e,t){const n=Y.getBaseType(e);return Y.isTextType(n)?E.FilterValue.ofString(t):Y.isLongType(n)?E.FilterValue.ofNumber(E.LongWrapper.ofString(Y.removeCommas(t))):E.FilterValue.ofNumber(Y.removeCommas(t))}static makeFilterRawValue(e,t){return Y.isTextType(e)?E.FilterValue.ofString(t):Y.isBooleanType(e)?E.FilterValue.ofBoolean(t):E.FilterValue.ofNumber(t)}static makeValue(e,t,n){if(t==null||t==="null")return null;if(Y.isTextType(e))return t;if(Y.isLongType(e))return E.LongWrapper.ofString(Y.removeCommas(t));if(Y.isBooleanType(e))return Y.makeBooleanValue(t,!0);if(Y.isDateType(e)){const[s]=cn.parseDateRange(t,n);return s}return Y.isNumberType(e)?Y.makeNumberValue(t):(jt.error("Unexpected column type",e),null)}static makeBooleanValue(e,t=!1){if(e===""&&t)return null;switch(e==null?void 0:e.toLowerCase()){case"null":return null;case"0":case"f":case"fa":case"fal":case"fals":case"false":case"n":case"no":return!1;case"1":case"t":case"tr":case"tru":case"true":case"y":case"ye":case"yes":return!0;default:throw new Error(`Invalid boolean '${e}'`)}}static makeNumberValue(e){if(e==null||e==="null"||e==="")return null;const t=e.toLowerCase().trim();if(t==="\u221E"||t==="infinity"||t==="inf")return Number.POSITIVE_INFINITY;if(t==="-\u221E"||t==="-infinity"||t==="-inf")return Number.NEGATIVE_INFINITY;const n=Y.removeCommas(t);if(Y.NUMBER_REGEX.test(n))return parseFloat(n);throw new Error(`Invalid number '${e}'`)}static getFilterOperatorString(e){switch(e){case _.eq:return"=";case _.notEq:return"!=";case _.greaterThan:return">";case _.greaterThanOrEqualTo:return">=";case _.lessThan:return"<";case _.lessThanOrEqualTo:return"<=";case _.contains:return"~";case _.notContains:return"!~";default:throw new Error(`Unexpected filter type ${e}`)}}static makeAdvancedValueFilter(e,t,n,s){if(Y.isDateType(e.type))return Y.makeQuickDateFilterWithOperation(e,n,t,s);if(Y.isNumberType(e.type)||Y.isCharType(e.type))return Y.makeQuickFilter(e,`${Y.getFilterOperatorString(t)}${n}`);const o=Y.makeFilterValue(e.type,n),i=e.filter();switch(t){case _.eq:return i.eq(o);case _.eqIgnoreCase:return i.eqIgnoreCase(o);case _.notEq:return i.notEq(o);case _.notEqIgnoreCase:return i.notEqIgnoreCase(o);case _.greaterThan:return i.greaterThan(o);case _.greaterThanOrEqualTo:return i.greaterThanOrEqualTo(o);case _.lessThan:return i.lessThan(o);case _.lessThanOrEqualTo:return i.lessThanOrEqualTo(o);case _.isTrue:return i.isTrue();case _.isFalse:return i.isFalse();case _.isNull:return i.isNull();case _.contains:return i.isNull().not().and(i.invoke("matches",E.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E.*`)));case _.notContains:return i.isNull().or(i.invoke("matches",E.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E.*`)).not());case _.startsWith:return i.isNull().not().and(i.invoke("matches",E.FilterValue.ofString(`(?s)(?i)^\\Q${n}\\E.*`)));case _.endsWith:return i.isNull().not().and(i.invoke("matches",E.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E$`)));case _.in:case _.inIgnoreCase:case _.notIn:case _.notInIgnoreCase:case _.invoke:default:throw new Error(`Unexpected filter operation: ${t}`)}}static makeSelectValueFilter(e,t,n){if(t.length===0){if(n)return null;let i=null;Y.isTextType(e.type)?i=E.FilterValue.ofString("a"):Y.isBooleanType(e.type)?i=E.FilterValue.ofBoolean(!0):Y.isDateType(e.type)?i=E.FilterValue.ofNumber(E.DateWrapper.ofJsDate(new Date)):i=E.FilterValue.ofNumber(0);const r=e.filter().eq(i),l=e.filter().notEq(i);return r.and(l)}const s=[];let o=!1;for(let i=0;i<t.length;i+=1){const r=t[i];r==null?o=!0:Y.isTextType(e.type)?s.push(E.FilterValue.ofString(typeof r=="number"?String.fromCharCode(r):r)):Y.isBooleanType(e.type)?s.push(E.FilterValue.ofBoolean(Boolean(r))):s.push(E.FilterValue.ofNumber(r))}return o?s.length>0?n?e.filter().isNull().not().and(e.filter().notIn(s)):e.filter().isNull().or(e.filter().in(s)):n?e.filter().isNull().not():e.filter().isNull():n?e.filter().notIn(s):e.filter().in(s)}static isTreeTable(e){return e!=null&&e.expand!==void 0&&e.collapse!==void 0}static sortColumns(e,t=!0){return[...e].sort((n,s)=>{const o=n.name.toUpperCase(),i=s.name.toUpperCase();return Wi.sort(o,i,t)})}};let I=Y;I.dataType={BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"};I.sortDirection={ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null};I.REVERSE_TYPE=Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"});I.NUMBER_REGEX=/^-?\d+(\.\d+)?$/;class zt{static makeColumnFormatMap(t){return t==null?new Map:t.reduce((n,s)=>{const o=I.getNormalizedType(s.columnType);if(o===null)return n;n.has(o)||n.set(o,new Map);const i=n.get(o);return i==null||i.set(s.columnName,s.format),n},new Map)}static makeColumnFormattingRule(t,n,s){return{columnType:t,columnName:n,format:s}}constructor(t=[],n,s,o,i=!1){this.defaultColumnFormatter=new Md,this.typeFormatterMap=new Map([[I.dataType.BOOLEAN,new Id],[I.dataType.CHAR,new Nd],[I.dataType.DATETIME,new kn(n)],[I.dataType.DECIMAL,new _e(s)],[I.dataType.INT,new Dt(o)],[I.dataType.STRING,new xd]]),this.columnFormatMap=zt.makeColumnFormatMap(t),this.truncateNumbersWithPound=i}getColumnFormatMapForType(t,n=!1){const s=I.getNormalizedType(t);if(s!==null)return n&&!this.columnFormatMap.has(s)&&this.columnFormatMap.set(s,new Map),this.columnFormatMap.get(s)}getColumnFormat(t,n){var o;const s=this.getColumnFormatMapForType(t);return(o=s==null?void 0:s.get(n))!=null?o:null}getColumnTypeFormatter(t){var o;const n=I.getNormalizedType(t);let s=this.defaultColumnFormatter;return n&&(s=(o=this.typeFormatterMap.get(n))!=null?o:s),s}getFormattedString(t,n,s="",o){if(t==null)return"";const i=this.getColumnTypeFormatter(n),r=o||this.getColumnFormat(n,s);return i.format(t,r!=null?r:void 0)}get timeZone(){var n;const t=this.typeFormatterMap.get(I.dataType.DATETIME);return(n=t==null?void 0:t.dhTimeZone)==null?void 0:n.id}}function Vd(e){if(e&&e.formatter){const{formatter:t}=e;return t}}function Ud(e){return{timeZone:e==null?void 0:e.timeZone,defaultDateTimeFormatString:e==null?void 0:e.defaultDateTimeFormat,showTimeZone:e==null?void 0:e.showTimeZone,showTSeparator:e==null?void 0:e.showTSeparator}}function Bd(e,t,n){const s=e.getColumnFormat(n,t);return s!=null&&(s.type===Le.TYPE_CONTEXT_PRESET||s.type===Le.TYPE_CONTEXT_CUSTOM)}const Zn={getColumnFormats:Vd,getDateTimeFormatterOptions:Ud,isCustomColumnFormatDefined:Bd};function Gd(e,t){const n=zd(e);return n===void 0?void 0:`${jd(e)} ? ${n} : ${t}`}function Wd(e){return dh.Column.formatRowColor(e)}function $d(e,t){return e.formatColor(t)}const mi=ie.module("ConditionalFormattingUtils");var qt=(e=>(e.CONDITIONAL="conditional",e.ROWS="rows",e))(qt||{}),Ne=(e=>(e.IS_EQUAL="is-equal",e.IS_NOT_EQUAL="is-not-equal",e.IS_BETWEEN="is-between",e.GREATER_THAN="greater-than",e.GREATER_THAN_OR_EQUAL="greater-than-or-equal",e.LESS_THAN="less-than",e.LESS_THAN_OR_EQUAL="less-than-or-equal",e.IS_NULL="is-null",e.IS_NOT_NULL="is-not-null",e))(Ne||{}),mt=(e=>(e.IS_EXACTLY="is-exactly",e.IS_NOT_EXACTLY="is-not-exactly",e.CONTAINS="contains",e.DOES_NOT_CONTAIN="does-not-contain",e.STARTS_WITH="starts-with",e.ENDS_WITH="ends-with",e.IS_NULL="is-null",e.IS_NOT_NULL="is-not-null",e))(mt||{}),it=(e=>(e.IS_EXACTLY="is-exactly",e.IS_NOT_EXACTLY="is-not-exactly",e.IS_BEFORE="is-before",e.IS_BEFORE_OR_EQUAL="is-before-or-equal",e.IS_AFTER="is-after",e.IS_AFTER_OR_EQUAL="is-after-or-equal",e.IS_NULL="is-null",e.IS_NOT_NULL="is-not-null",e))(it||{}),Us=(e=>(e.IS_TRUE="is-true",e.IS_FALSE="is-false",e.IS_NULL="is-null",e.IS_NOT_NULL="is-not-null",e))(Us||{}),Xn=(e=>(e.IS_EQUAL="is-equal",e.IS_NOT_EQUAL="is-not-equal",e.IS_NULL="is-null",e.IS_NOT_NULL="is-not-null",e))(Xn||{}),Ht=(e=>(e.NO_FORMATTING="no-formatting",e.POSITIVE="positive",e.NEGATIVE="negative",e.WARN="warn",e.NEUTRAL="neutral",e.ACCENT_1="accent-1",e.ACCENT_2="accent-2",e.CUSTOM="custom",e))(Ht||{});function Mr(e){switch(e){case"no-formatting":return"No formatting";case"positive":return"Positive";case"negative":return"Negative";case"warn":return"Warn";case"neutral":return"Neutral";case"accent-1":return"Accent 1";case"accent-2":return"Accent 2";case"custom":return"Custom..."}}function Po(e){const{type:t,customConfig:n}=e;switch(t){case"no-formatting":return;case"positive":return"#9fde6f";case"negative":return"#ff6087";case"warn":return"#f67f40";case"neutral":return"#ffd95c";case"accent-1":return"#78dce8";case"accent-2":return"#ab9bf5";case"custom":return n==null?void 0:n.background;default:return}}function _o(e){const{type:t,customConfig:n}=e;switch(t){case"no-formatting":return;case"positive":return"#526a3f";case"negative":return"#802f44";case"warn":return"#663318";case"neutral":return"#63562b";case"accent-1":return"#3f6469";case"accent-2":return"#554d72";case"custom":return n==null?void 0:n.color;default:return}}function zd(e){const t=_o(e.style),n=Po(e.style);if(!(t===void 0||n===void 0))return`bgfg(\`${n}\`, \`${t}\`)`}function qd(e){const{column:t,value:n,start:s,end:o}=e;return cu(t.name,e.condition,n,s,o)}function Yd(e){const{column:t,value:n}=e;return du(t.name,e.condition,n)}function Xd(e){const{column:t,value:n}=e;return uu(t.name,e.condition,n)}function Kd(e){const{column:t}=e;return hu(t.name,e.condition)}function Qd(e){const{column:t,value:n}=e;return mu(t.name,e.condition,n)}function jd(e){const{column:t}=e;if(I.isNumberType(t.type))return qd(e);if(I.isCharType(t.type))return Qd(e);if(I.isStringType(t.type))return Yd(e);if(I.isDateType(t.type))return Xd(e);if(I.isBooleanType(t.type))return Kd(e);throw new Error("Invalid column type")}function Zd(e){switch(e){case"is-equal":return"is equal to";case"is-not-equal":return"is not equal to";case"is-between":return"is between";case"greater-than":return"greater than";case"greater-than-or-equal":return"greater than or equal to";case"less-than":return"less than";case"less-than-or-equal":return"less than or equal to";case"is-null":return"is null";case"is-not-null":return"is not null"}}function Jd(e){switch(e){case"is-exactly":return"is exactly";case"is-not-exactly":return"is not exactly";case"contains":return"contains";case"does-not-contain":return"does not contain";case"starts-with":return"starts with";case"ends-with":return"ends with";case"is-null":return"is null";case"is-not-null":return"is not null"}}function eu(e){switch(e){case"is-exactly":return"is";case"is-not-exactly":return"is not";case"is-before":return"is before";case"is-before-or-equal":return"is before or equal";case"is-after":return"is after";case"is-after-or-equal":return"is after or equal";case"is-null":return"is null";case"is-not-null":return"is not null"}}function tu(e){switch(e){case"is-true":return"is true";case"is-false":return"is false";case"is-null":return"is null";case"is-not-null":return"is not null"}}function nu(e){switch(e){case"is-equal":return"is";case"is-not-equal":return"is not";case"is-null":return"is null";case"is-not-null":return"is not null"}}function El(e){if(I.isNumberType(e)||I.isCharType(e))return"is-equal";if(I.isStringType(e)||I.isDateType(e))return"is-exactly";if(I.isBooleanType(e))return"is-true";throw new Error("Invalid column type")}function su(e){if(I.isCharType(e)||I.isStringType(e))return""}function vl(e){const{condition:t,value:n,start:s,end:o}=e;return{condition:t,value:n,start:s,end:o}}function jo(e){return{condition:El(e),value:su(e),start:void 0,end:void 0}}function Rl(){return{type:"no-formatting"}}function ou(e){switch(e){case"is-exactly":return"==";case"is-not-exactly":return"!=";case"contains":return"contains";case"does-not-contain":return"does not contain";case"starts-with":return"starts with";case"ends-with":return"ends with";case"is-null":return"is null";case"is-not-null":return"is not null"}}function iu(e){switch(e){case"is-exactly":return"==";case"is-not-exactly":return"!=";case"is-before":return"<";case"is-before-or-equal":return"<=";case"is-after":return">";case"is-after-or-equal":return">=";case"is-null":return"is null";case"is-not-null":return"is not null"}}function ru(e){switch(e){case"is-true":return"is true";case"is-false":return"is false";case"is-null":return"is null";case"is-not-null":return"is not null"}}function lu(e){switch(e){case"is-equal":return"==";case"is-not-equal":return"!=";case"is-null":return"is null";case"is-not-null":return"is not null"}}function au(e){switch(e){case"is-equal":return"==";case"is-not-equal":return"!=";case"is-between":return"==";case"greater-than":return">";case"greater-than-or-equal":return">=";case"less-than":return"<";case"less-than-or-equal":return"<=";case"is-null":return"is null";case"is-not-null":return"is not null"}}function cu(e,t,n,s,o){switch(t){case"is-equal":return`${e} == ${n}`;case"is-not-equal":return`${e} != ${n}`;case"is-between":return`${e} > ${s} && ${e} < ${o}`;case"greater-than":return`${e} > ${n}`;case"greater-than-or-equal":return`${e} >= ${n}`;case"less-than":return`${e} < ${n}`;case"less-than-or-equal":return`${e} <= ${n}`;case"is-null":return`${e} == null`;case"is-not-null":return`${e} != null`}}function du(e,t,n){switch(t){case"is-exactly":return`${e} == "${n}"`;case"is-not-exactly":return`${e} != "${n}"`;case"contains":return`${e} != null && ${e}.contains("${n}")`;case"does-not-contain":return`${e} != null && !${e}.contains("${n}")`;case"starts-with":return`${e} != null && ${e}.startsWith("${n}")`;case"ends-with":return`${e} != null && ${e}.endsWith("${n}")`;case"is-null":return`${e} == null`;case"is-not-null":return`${e} != null`}}function uu(e,t,n){switch(t){case"is-exactly":return`${e} == convertDateTime("${n}")`;case"is-not-exactly":return`${e} != convertDateTime(\`${n}\`)`;case"is-before":return`${e} < convertDateTime(\`${n}\`)`;case"is-before-or-equal":return`${e} <= convertDateTime("${n}")`;case"is-after":return`${e} > convertDateTime(\`${n}\`)`;case"is-after-or-equal":return`${e} >= convertDateTime(\`${n}\`)`;case"is-null":return`${e} == null`;case"is-not-null":return`${e} != null`}}function hu(e,t){switch(t){case"is-true":return`${e} == true`;case"is-false":return`${e} == false`;case"is-null":return`${e} == null`;case"is-not-null":return`${e} != null`}}function mu(e,t,n){switch(t){case"is-equal":return`${e} == '${n}'`;case"is-not-equal":return`${e} != '${n}'`;case"is-null":return`isNull(${e})`;case"is-not-null":return`!isNull(${e})`}}function gu(e,t){if(I.isNumberType(e))return au(t);if(I.isCharType(e))return lu(t);if(I.isStringType(e))return ou(t);if(I.isDateType(e))return iu(t);if(I.isBooleanType(e))return ru(t);throw new Error("Invalid column type")}function pu(e,t){if(t===void 0)return mi.debug("no rules passed."),[];const n=[];let s;const o=new Map;return t.forEach(({config:i,type:r})=>{var p;const{column:l}=i,a=e.find(({name:f,type:C})=>f===l.name&&C===l.type);if(a===void 0){mi.debug(`Column ${l.name}:${l.type} not found. Ignoring format rule.`,i);return}const[c,d]=(p=r==="conditional"?o.get(a.name):s)!=null?p:["null",void 0],u=Gd(i,c);if(u===void 0){mi.debug("Ignoring format rule.",i);return}const h=d===void 0?-1:n.indexOf(d);h>-1&&n.splice(h,1);const g=r==="conditional"?$d(a,u):Wd(u);n.push(g),r==="conditional"?o.set(a.name,[u,g]):s=[u,g]}),n}function fu({type:e}){return I.isNumberType(e)||I.isCharType(e)||I.isStringType(e)||I.isDateType(e)||I.isBooleanType(e)}function Zo({animation:e="iris-grid-bottom-bar-slide-up",children:t,className:n,isShown:s,onClick:o,onEntering:i,onEntered:r,onExiting:l,onExited:a}){return m($t,{in:s,timeout:Ue.transitionMs,classNames:e,onEntering:i,onEntered:r,onExiting:l,onExited:a,mountOnEnter:!0,unmountOnExit:!0,children:m("div",{className:ee("iris-grid-bottom-bar",n),role:"presentation",onClick:o,onKeyPress:o,children:t})})}const Cu=3e3,wu=5;function Su({isSaving:e=!1,onSave:t,onDiscard:n,discardTooltip:s,saveTooltip:o,error:i,pendingDataErrors:r,pendingDataMap:l,onEntering:a,onEntered:c,onExiting:d,onExited:u}){const[h,g]=F.exports.useState(!1),[p,f]=F.exports.useState(!1),C=F.exports.useRef(),w=$i(e),S=F.exports.useMemo(()=>r.size===0?i:r.size<=wu?`Key can't be empty (on pending row${r.size>1?"s":""} ${Array.from(r.keys()).join(", ").trim()})`:`Key can't be empty (on ${r.size} rows)`,[i,r]);F.exports.useEffect(function(){w!=null&&w&&!e&&S==null&&(g(!0),f(!0),C.current=setTimeout(()=>{g(!1)},Cu))},[S,e,w]),F.exports.useEffect(function(){C.current&&l.size>0&&(clearTimeout(C.current),g(!1),f(!1))},[l]),F.exports.useEffect(function(){return()=>C.current?clearTimeout(C.current):void 0},[]);const T=l.size;let R;return e?R=m(dn,{}):p&&(R=rl),y(Zo,{className:"pending-data-bottom-bar",isShown:T>0||h||S!=null,onEntering:a,onEntered:c,onExiting:d,onExited:()=>{f(!1),u&&u()},children:[S!=null&&S!==""&&y("div",{className:"error-message",children:[m(te,{icon:Kn}),m("span",{children:`${S}`})]}),(S==null||S==="")&&m("div",{className:"status-message",children:T>0&&m("span",{children:`${T} row${T>1?"s":""} pending`})}),y("div",{className:"buttons-container",children:[!e&&!p&&m(z,{kind:"secondary",onClick:n,tooltip:s,children:"Discard"}),y(z,{kind:p?"success":"primary",onClick:t,icon:R,disabled:e||p||S!=null,tooltip:o,children:[e&&"Committing...",!e&&p&&"Success",!e&&!p&&"Commit"]})]})]})}var Te=(e=>(e.COUNT="Count",e.MIN="Min",e.MAX="Max",e.SUM="Sum",e.ABS_SUM="AbsSum",e.VAR="Var",e.AVG="Avg",e.STD="Std",e.FIRST="First",e.LAST="Last",e.SKIP="Skip",e.COUNT_DISTINCT="CountDistinct",e.DISTINCT="Distinct",e.UNIQUE="Unique",e))(Te||{});const bu=e=>{switch(e){default:return!1}},Tu=(e,t)=>{switch(e){case Te.COUNT:case Te.FIRST:case Te.LAST:case Te.COUNT_DISTINCT:case Te.DISTINCT:case Te.UNIQUE:return!0;case Te.MIN:case Te.MAX:return I.isNumberType(t)||I.isDateType(t)||I.isTextType(t);case Te.SUM:case Te.ABS_SUM:case Te.VAR:case Te.AVG:case Te.STD:return I.isNumberType(t);case Te.SKIP:return!1}},Qi=(e,t)=>e.filter(n=>Tu(t,n.type)),Eu=(e,t,n,s)=>Qi(e,t).map(({name:o})=>o).filter(o=>n.includes(o)?!s:s),On={isRollupOperation:bu,filterValidColumns:Qi,getOperationColumnNames:Eu};var ts=(e=>(e.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS="filter-control-change-clears-all-filters",e.LINK_CHANGE_CLEARS_ALL_FILTERS="link-change-clears-all-filters",e))(ts||{});const vu=Object.freeze([[ts.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS,!1],[ts.LINK_CHANGE_CLEARS_ALL_FILTERS,!1]]),Ru={DEFAULTS:vu},yu=ie.module("ColumnHeaderGroup");function gi(e){return e instanceof Bt}const yl=class{constructor({name:e,children:t,color:n,depth:s,childIndexes:o,parent:i}){this.getVisibleRange=Re(r=>{const l=this.childIndexes.flat(),a=H.getVisibleIndexes(l,r),c=Math.min(...a),d=Math.max(...a);return d-c!==l.length-1&&yu.warn(`Column header group ${this.name} is not contiguous`),[c,d]}),this.name=e,this.children=t,this.color=n,this.depth=s,this.childIndexes=o,this.parent=i}setParent(e){this.parent=e}addChildren(e){const t=new Set(this.children.concat(e));this.children=[...t]}removeChildren(e){const t=new Set(this.children);e.forEach(n=>t.delete(n)),this.children=[...t]}get isNew(){return this.name.startsWith(yl.NEW_GROUP_PREFIX)}};let Bt=yl;Bt.NEW_GROUP_PREFIX=":newGroup";const ks=ie.module("IrisGridUtils");function bn(e,t){return e>=0&&e<t.length}class J{static dehydrateGridState(t,n){const{isStuckToBottom:s,isStuckToRight:o,movedColumns:i,movedRows:r}=n,{columns:l}=t;return{isStuckToBottom:s,isStuckToRight:o,movedColumns:[...i].filter(({to:a,from:c})=>bn(a,l)&&(typeof c=="number"&&bn(c,l)||Array.isArray(c)&&bn(c[0],l)&&bn(c[1],l))).map(({to:a,from:c})=>({to:l[a].name,from:Array.isArray(c)?[l[c[0]].name,l[c[1]].name]:l[c].name})),movedRows:[...r]}}static hydrateGridState(t,n,s=[]){const{isStuckToBottom:o,isStuckToRight:i,movedColumns:r,movedRows:l}=n,{columns:a}=t,c=J.parseCustomColumnNames(s),d=a.map(({name:u})=>u).concat(c);return{isStuckToBottom:o,isStuckToRight:i,movedColumns:[...r].map(({to:u,from:h})=>{const g=p=>typeof p=="string"?d.findIndex(f=>f===p):p;return{to:g(u),from:Array.isArray(h)?[g(h[0]),g(h[1])]:g(h)}}).filter(({to:u,from:h})=>bn(u,d)&&(typeof h=="number"&&bn(h,d)||Array.isArray(h)&&bn(h[0],d)&&bn(h[1],d))),movedRows:[...l]}}static dehydrateIrisGridState(t,n){const{aggregationSettings:s={aggregations:ve,showOnTop:!1},advancedFilters:o,customColumnFormatMap:i,isFilterBarShown:r,metrics:l,quickFilters:a,customColumns:c,conditionalFormats:d=ve,reverseType:u,rollupConfig:h=void 0,showSearchBar:g,searchValue:p,selectDistinctColumns:f=ve,selectedSearchColumns:C,sorts:w,invertSearchColumns:S,pendingDataMap:T=on,frozenColumns:R,columnHeaderGroups:b}=n;M(l);const{userColumnWidths:v,userRowHeights:D}=l,{columns:A}=t;return{advancedFilters:J.dehydrateAdvancedFilters(A,o),aggregationSettings:s,customColumnFormatMap:[...i],isFilterBarShown:r,quickFilters:J.dehydrateQuickFilters(a),sorts:J.dehydrateSort(w),userColumnWidths:[...v].filter(([N])=>N!=null&&N>=0&&N<A.length).map(([N,L])=>[A[N].name,L]),userRowHeights:[...D],customColumns:[...c],conditionalFormats:[...d],reverseType:u,rollupConfig:h,showSearchBar:g,searchValue:p,selectDistinctColumns:[...f],selectedSearchColumns:C,invertSearchColumns:S,pendingDataMap:J.dehydratePendingDataMap(A,T),frozenColumns:R,columnHeaderGroups:b==null?void 0:b.map(N=>({name:N.name,children:N.children,color:N.color}))}}static hydrateIrisGridState(t,n){var N,L;const{advancedFilters:s,aggregationSettings:o={aggregations:[],showOnTop:!1},customColumnFormatMap:i,isFilterBarShown:r,quickFilters:l,sorts:a,customColumns:c,conditionalFormats:d,userColumnWidths:u,userRowHeights:h,reverseType:g,rollupConfig:p=void 0,showSearchBar:f,searchValue:C,selectDistinctColumns:w,selectedSearchColumns:S,invertSearchColumns:T=!0,pendingDataMap:R=[],frozenColumns:b,columnHeaderGroups:v}=n,{columns:D,formatter:A}=t;return{advancedFilters:J.hydrateAdvancedFilters(D,s,A.timeZone),aggregationSettings:o,customColumnFormatMap:new Map(i),isFilterBarShown:r,quickFilters:J.hydrateQuickFilters(D,l,A.timeZone),sorts:J.hydrateSort(D,a),userColumnWidths:new Map(u.map(([k,x])=>typeof k=="string"||k instanceof String?[D.findIndex(({name:W})=>W===k),x]:[k,x]).filter(([k])=>k!=null&&k>=0&&k<D.length)),customColumns:c,conditionalFormats:d,userRowHeights:new Map(h),reverseType:g,rollupConfig:p,showSearchBar:f,searchValue:C,selectDistinctColumns:w,selectedSearchColumns:S,invertSearchColumns:T,pendingDataMap:J.hydratePendingDataMap(D,R),frozenColumns:b,columnHeaderGroups:J.parseColumnHeaderGroups(t,(L=v!=null?v:(N=t.layoutHints)==null?void 0:N.columnGroups)!=null?L:[]).groups}}static dehydrateIrisGridPanelState(t,n){const{isSelectingPartition:s,partition:o,partitionColumn:i,advancedSettings:r}=n;return{isSelectingPartition:s,partition:o,partitionColumn:i!=null?i.name:void 0,advancedSettings:[...r]}}static hydrateIrisGridPanelState(t,n){const{isSelectingPartition:s,partition:o,partitionColumn:i,advancedSettings:r}=n,{columns:l}=t;return{isSelectingPartition:s,partition:o,partitionColumn:i!=null?J.getColumnByName(l,i):void 0,advancedSettings:new Map([...Ru.DEFAULTS,...r])}}static dehydrateQuickFilters(t){return[...t].map(([n,s])=>{const{text:o}=s;return[n,{text:o}]})}static hydrateQuickFilters(t,n,s){const o=n.map(([i,r])=>{const{text:l}=r;let a=null;try{const c=J.getColumn(t,i);c!=null&&(a=I.makeQuickFilter(c,l,s))}catch(c){ks.error("hydrateQuickFilters error with",l,c)}return[i,{text:l,filter:a}]});return new Map(o)}static dehydrateAdvancedFilters(t,n){return[...n].map(([s,o])=>{const i=J.getColumn(t,s);M(i);const r=J.dehydrateAdvancedFilterOptions(i,o.options);return[s,{options:r}]})}static hydrateAdvancedFilters(t,n,s){const o=n.map(([i,r])=>{const l=J.getColumn(t,i);M(l);const a=J.hydrateAdvancedFilterOptions(l,r.options);let c=null;try{J.getColumn(t,i)!=null&&(c=I.makeAdvancedFilter(l,a,s))}catch(d){ks.error("hydrateAdvancedFilters error with",a,d)}return[i,{options:a,filter:c}]});return new Map(o)}static dehydrateAdvancedFilterOptions(t,n){const{selectedValues:s,...o}=n;return{selectedValues:s==null?void 0:s.map(i=>J.dehydrateValue(i,t==null?void 0:t.type)),...o}}static hydrateAdvancedFilterOptions(t,n){const{selectedValues:s,...o}=n;return{selectedValues:s==null?void 0:s.map(i=>J.hydrateValue(i,t==null?void 0:t.type)),...o}}static dehydratePendingDataMap(t,n){return[...n].map(([s,{data:o}])=>[s,{data:[...o].map(([i,r])=>[t[i].name,J.dehydrateValue(r,t[i].type)])}])}static hydratePendingDataMap(t,n){const s=new Map,o=i=>(s.has(i)||s.set(i,t.findIndex(({name:r})=>r===i)),s.get(i));return new Map(n.map(([i,{data:r}])=>[i,{data:new Map(r.map(([l,a])=>{var d;const c=o(l);return M(c),[(d=o(l))!=null?d:null,J.hydrateValue(a,t[c].type)]}))}]))}static dehydrateValue(t,n){return I.isDateType(n)?J.dehydrateDateTime(t):I.isLongType(n)?J.dehydrateLong(t):t}static hydrateValue(t,n){return I.isDateType(n)?J.hydrateDateTime(t):I.isLongType(n)?J.hydrateLong(t):t}static dehydrateDateTime(t){return t!=null?E.i18n.DateTimeFormat.format(cn.FULL_DATE_FORMAT,t):null}static hydrateDateTime(t){return t!=null?E.i18n.DateTimeFormat.parse(cn.FULL_DATE_FORMAT,t):null}static dehydrateLong(t){return t!=null?`${t}`:null}static hydrateLong(t){return t!=null?E.LongWrapper.ofString(t):null}static dehydrateSort(t){return t.map(n=>{const{column:s,isAbs:o,direction:i}=n;return{column:s.index,isAbs:o,direction:i}})}static hydrateSort(t,n){return n.map(s=>{const{column:o,isAbs:i,direction:r}=s;if(r===I.sortDirection.reverse)return E.Table.reverse();const l=J.getColumn(t,o);if(l!=null){let a=l.sort();return i&&(a=a.abs()),r===I.sortDirection.descending?a=a.desc():a=a.asc(),a}return null}).filter(s=>s!=null&&s.direction!==I.sortDirection.reverse)}static extractTableSettings(t,n=[]){const{irisGridPanelState:s,irisGridState:o}=t,{partitionColumn:i,partition:r}=s,{advancedFilters:l,quickFilters:a,sorts:c}=o;return{advancedFilters:l,inputFilters:n,partition:r,partitionColumn:i,quickFilters:a,sorts:c}}static applyTableSettings(t,n,s){const{columns:o}=t;let i=[];n.quickFilters&&(i=J.getFiltersFromFilterMap(J.hydrateQuickFilters(o,n.quickFilters,s)));let r=[];n.advancedFilters&&(r=J.getFiltersFromFilterMap(J.hydrateAdvancedFilters(o,n.advancedFilters,s)));const l=J.getFiltersFromInputFilters(o,n.inputFilters,s);let a=[];n.sorts&&(a=J.hydrateSort(o,n.sorts));let c=[...i,...r];const{partition:d,partitionColumn:u}=n;if(d!=null&&u!=null){const h=J.getColumnByName(o,u);h&&(c=[h.filter().eq(E.FilterValue.ofString(d)),...c])}c=[...l,...c],t.applyFilter(c),t.applySort(a)}static getInputFiltersForColumns(t,n=[]){return n.filter(({name:s,type:o})=>t.find(({name:i,type:r})=>i===s&&r===o))}static getFiltersFromInputFilters(t,n=[],s){return n.map(({name:o,type:i,value:r})=>{const l=t.find(({name:a,type:c})=>a===o&&c===i);if(l)try{return I.makeQuickFilter(l,r,s)}catch(a){ks.debug("Unable to create input filter",a)}return null}).filter(o=>o!=null)}static getFiltersFromFilterMap(t){const n=[],s=Array.from(t.keys());for(let o=0;o<s.length;o+=1){const i=s[o],r=t.get(i);(r==null?void 0:r.filter)!=null&&n.push(r.filter)}return n}static getHiddenColumns(t){return[...t.entries()].filter(([,n])=>n===0).map(([n])=>n)}static parseCustomColumnNames(t){return t.map(n=>n.split("=")[0])}static getRemovedCustomColumnNames(t,n){const s=J.parseCustomColumnNames(t),o=J.parseCustomColumnNames(n);return s.filter(i=>!o.includes(i))}static removeSortsInColumns(t,n){return t.filter(s=>!n.includes(s.column.name))}static removeFiltersInColumns(t,n,s){const o=t.map(({name:r})=>r),i=new Map(n);return s.forEach(r=>i.delete(o.indexOf(r))),i}static removeColumnFromMovedColumns(t,n,s){const o=t.map(({name:r})=>r);let i=[...n];for(let r=0;r<s.length;r+=1){const l=s[r];let a=o.findIndex(d=>d===l);const c=[];for(let d=0;d<i.length;d+=1){const u=i[d],h={...u};let[g,p]=Array.isArray(u.from)?u.from:[u.from,u.from];a<=u.to&&(h.to-=1),a<g&&(g-=1),a<=p&&(p-=1),g<=p&&g!==h.to&&(g===p?c.push({...h,from:g}):c.push({...h,from:[g,p]})),a=H.applyItemMoves(a,a,[u])[0][0]}i=c,o.splice(o.findIndex(d=>d===l),1)}return i}static removeColumnsFromSelectDistinctColumns(t,n){return t.filter(s=>!n.includes(s))}static getVisibleColumnsInRange(t,n,s,o,i){const r=[];for(let l=n;l<=s;l+=1){const a=H.getModelIndex(l,o);a>=0&&a<t.length&&!i.includes(a)&&r.push(t[a])}return r}static getPrevVisibleColumns(t,n,s,o,i){const r=[];let l=n;for(;l>=0&&r.length<s;){const a=H.getModelIndex(l,o);a>=0&&a<t.length&&!i.includes(a)&&r.unshift(t[a]),l-=1}return r}static getNextVisibleColumns(t,n,s,o,i){const r=[];let l=n;for(;l<t.length&&r.length<s;){const a=H.getModelIndex(l,o);a>=0&&a<t.length&&!i.includes(a)&&r.push(t[a]),l+=1}return r}static getColumnsToFetch(t,n,s){const o=[...n];return s.forEach(i=>{const r=t.find(({name:l})=>l===i);r!=null&&!n.includes(r)&&o.push(r)}),o}static getModelViewportColumns(t,n,s,o,i=[],r=[],l=0){if(n==null||s==null)return null;const a=J.getVisibleColumnsInRange(t,n,s,o,i),c=a.length*l,d=J.getPrevVisibleColumns(t,n-1,c,o,i),u=J.getNextVisibleColumns(t,s+1,c,o,i),h=[...d,...a,...u];return J.getColumnsToFetch(t,h,r)}static rangeSetFromRanges(t){const n=t.slice().sort((s,o)=>(M(s.startRow),M(o.startRow),s.startRow-o.startRow)).map(s=>{const{startRow:o,endRow:i}=s;return M(o),M(i),E.RangeSet.ofRange(o,i)});return E.RangeSet.ofRanges(n)}static isValidSnapshotRanges(t){if(t==null||t.length===0)return!1;const n=new Map;for(let i=0;i<t.length;i+=1){const r=t[i],l=`${r.startRow}:${r.endRow}`,a=`${r.startColumn}:${r.endColumn}`;n.has(l)||n.set(l,[]),n.get(l).push(a)}const s=[...n.keys()],o=n.get(s[0]).sort().join(",");for(let i=1;i<s.length;i+=1)if(n.get(s[i]).sort().join(",")!==o)return!1;return!0}static isValidIndex(t){return!Number.isInteger(t)||typeof t!="number"?!1:t>=0}static columnsFromRanges(t,n){var o,i;if(t==null||t.length===0)return[];if(t[0].startColumn===null&&t[0].endColumn===null)return[...n];const s=new Set;for(let r=0;r<t.length;r+=1){const l=t[r];M(l.startColumn),M(l.endColumn);for(let a=(o=l.startColumn)!=null?o:0;a<=((i=l.endColumn)!=null?i:n.length-1);a+=1)s.add(a)}return[...s].map(r=>n[r])}static snapshotDataToMatrix(t){const{columns:n,rows:s}=t,o=[];for(let i=0;i<s.length;i+=1){const r=s[i],l=[];for(let a=0;a<n.length;a+=1){const c=n[a],d=r.get(c);l.push(d)}o.push(l)}return o}static getModelRollupConfig(t,n,s){var u,h,g;if(((h=(u=n==null?void 0:n.columns)==null?void 0:u.length)!=null?h:0)===0)return null;const{columns:o=[],showConstituents:i=!0,showNonAggregatedColumns:r=!0,includeDescriptions:l=!0}=n!=null?n:{},{aggregations:a=[]}=s!=null?s:{},c=a.map(({operation:p,selected:f,invert:C})=>On.isRollupOperation(p)?[]:On.getOperationColumnNames(t,p,f,C)),d={};for(let p=0;p<a.length;p+=1)d[a[p].operation]=c[p];if(r){const p=new Set(t.map(f=>f.name).filter(f=>!o.includes(f)));if(c.forEach(f=>{f.forEach(C=>p.delete(C))}),p.size>0){const f=(g=d[Te.FIRST])!=null?g:[];d[Te.FIRST]=[...f,...p]}}return{groupingColumns:o,includeConstituents:i,includeDescriptions:l,aggregations:d}}static getPendingErrors(t){t.forEach((n,s)=>{if(!J.isValidIndex(s))throw new Error(`Invalid rowIndex ${s}`);const{data:o}=n;o.forEach((i,r)=>{if(!J.isValidIndex(r))throw new Error(`Invalid columnIndex ${r}`)})})}static getColumn(t,n){return n<t.length?t[n]:(ks.error("Unable to retrieve column",n,">=",t.length),null)}static getColumnByName(t,n){const s=t.find(({name:o})=>o===n);return s==null&&ks.error("Unable to retrieve column by name",n,t.map(({name:o})=>o)),s}static changeFilterColumnNamesToIndexes(t,n){return n.map(({name:s,filter:o})=>{const i=t.findIndex(r=>r.name===s);return i<0?null:[i,o]}).filter(s=>s!=null)}static combineFiltersFromList(t,n){n.sort((o,i)=>o.operator==="eq"&&i.operator!=="eq"?1:o.operator!=="eq"&&i.operator==="eq"?-1:o.startColumnIndex-i.startColumnIndex);let s="";for(let o=0;o<n.length;o+=1){const{text:i,value:r,operator:l}=n[o];if(r!==void 0){let a="";l!==void 0&&(r==null&&l==="eq"?a="=":l!=="eq"&&(l==="startsWith"||l==="endsWith"?a="*":a=I.getFilterOperatorString(l)));let c=`${a}${i}`;l==="startsWith"&&(c=`${i}${a}`),t!=null&&r!==null&&I.isCharType(t)&&(c=`${a}${String.fromCharCode(parseInt(i,10))}`),o!==0&&(s+=l==="eq"?" || ":" && "),s+=c}}return s}static parseColumnHeaderGroups(t,n){let s=1;const o=new Map,i=new Map,r=n==null?void 0:n.filter(({children:u})=>u.length>0);if(r.length===0)return{groups:[],maxDepth:s,parentMap:o,groupMap:i};const l=new Map(r.map(u=>[u.name,u])),a=new Set,c=u=>{const{name:h}=u;if(t.getColumnIndexByName(h)!=null)throw new Error(`Column header group has same name as column: ${h}`);const g=i.get(h);if(g)return g;const p=[];let f=1;u.children.forEach(w=>{if(a.has(w))throw new Error(`Column group child ${w} specified in multiple groups`);a.add(w);const S=l.get(w),T=t.getColumnIndexByName(w);if(S){const R=c(S);p.push(...R.childIndexes),f=Math.max(f,R.depth+1)}else if(T!=null)p.push(T),f=Math.max(f,1);else throw new Error(`Unknown child ${w} in group ${h}`)});const C=new Bt({...u,depth:f,childIndexes:p.flat()});return i.set(h,C),u.children.forEach(w=>o.set(w,C)),s=Math.max(s,C.depth+1),C},d=new Set;return r.forEach(u=>{const{name:h}=u;if(d.has(h))throw new Error(`Duplicate column group name: ${h}`);d.add(h),c(u)}),i.forEach(u=>{var h;u.setParent((h=o.get(u.name))==null?void 0:h.name)}),{groups:[...i.values()],maxDepth:s,groupMap:i,parentMap:o}}}const ht=ie.module("IrisGridCopyHandler"),Ee=class extends F.exports.Component{constructor(e){super(e),this.handleBackgroundClick=this.handleBackgroundClick.bind(this),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleCopyClick=this.handleCopyClick.bind(this),this.handleHideTimeout=this.handleHideTimeout.bind(this),this.state={error:void 0,copyState:Ee.COPY_STATES.IDLE,buttonState:Ee.BUTTON_STATES.COPY,isShown:!1,rowCount:0}}static getStatusMessageText(e,t){switch(e){case Ee.COPY_STATES.CONFIRMATION_REQUIRED:return`Are you sure you want to copy ${t.toLocaleString()} rows to your clipboard?`;case Ee.COPY_STATES.CLICK_REQUIRED:return`Fetched ${t.toLocaleString()} rows!`;case Ee.COPY_STATES.FETCH_ERROR:return"Unable to copy data.";case Ee.COPY_STATES.FETCH_IN_PROGRESS:return`Fetching ${t.toLocaleString()} rows for clipboard...`;case Ee.COPY_STATES.DONE:return"Copied to Clipboard!";default:return""}}static getCopyButtonText(e){switch(e){case Ee.BUTTON_STATES.FETCH_IN_PROGRESS:return"Fetching";case Ee.BUTTON_STATES.CLICK_TO_COPY:return"Click to Copy";case Ee.BUTTON_STATES.RETRY:return"Retry";default:return"Copy"}}componentDidMount(){const{copyOperation:e}=this.props;e!=null&&this.startCopy()}componentDidUpdate(e){const{copyOperation:t}=this.props;e.copyOperation!==t&&this.startCopy()}componentWillUnmount(){this.stopCopy()}startCopy(){ht.debug2("startCopy"),this.stopCopy();const{copyOperation:e}=this.props;if(e==null){ht.debug2("No copy operation set, cancelling out"),this.setState({isShown:!1});return}const{ranges:t,error:n}=e;if(n!=null){ht.debug("Showing copy error",n),this.setState({isShown:!0,copyState:Ee.COPY_STATES.DONE,error:n}),this.startHideTimer();return}const s=Q.rowCount(t);this.setState({rowCount:s,isShown:!0,error:void 0}),s>Ee.NO_PROMPT_THRESHOLD?this.setState({buttonState:Ee.BUTTON_STATES.COPY,copyState:Ee.COPY_STATES.CONFIRMATION_REQUIRED}):this.startFetch()}stopCopy(){this.textData=void 0,this.stopFetch(),this.stopHideTimer()}handleBackgroundClick(){ht.debug2("handleBackgroundClick");const{copyState:e}=this.state;e===Ee.COPY_STATES.DONE&&this.setState({isShown:!1})}handleCancelClick(){ht.debug2("handleCancelClick"),this.stopFetch(),this.setState({isShown:!1})}handleCopyClick(){ht.debug2("handleCopyClick"),this.textData!=null?this.copyText(this.textData):this.startFetch()}handleHideTimeout(){ht.debug2("handleHideTimeout"),this.stopHideTimer(),this.setState({isShown:!1})}copyText(e){ht.debug2("copyText",e),this.textData=e,zo(e).then(()=>{this.setState({copyState:Ee.COPY_STATES.DONE}),this.startHideTimer()},t=>{ht.error("copyText error",t),this.setState({buttonState:Ee.BUTTON_STATES.CLICK_TO_COPY,copyState:Ee.COPY_STATES.CLICK_REQUIRED})})}startFetch(){this.stopFetch(),this.setState({buttonState:Ee.BUTTON_STATES.FETCH_IN_PROGRESS,copyState:Ee.COPY_STATES.FETCH_IN_PROGRESS});const{model:e,copyOperation:t}=this.props,{ranges:n,includeHeaders:s,userColumnWidths:o,movedColumns:i,formatValues:r}=t;ht.debug("startFetch",n);const l=J.getHiddenColumns(o);let a=H.getModelRanges(n,i);if(l.length>0){const d=l.map(Q.makeColumn);a=Q.subtractRangesFromRanges(a,d)}const c=r!=null&&r?(d,u)=>e.displayString(d,u.type,u.name):d=>`${d}`;this.fetchPromise=Ge.makeCancelable(e.textSnapshot(a,s,c)),this.fetchPromise.then(d=>{this.fetchPromise=void 0,this.copyText(d)}).catch(d=>{d instanceof xi?ht.debug("User cancelled copy."):(ht.error("Error fetching contents",d),this.fetchPromise=void 0,this.setState({buttonState:Ee.BUTTON_STATES.RETRY,copyState:Ee.COPY_STATES.FETCH_ERROR}))})}stopFetch(){this.fetchPromise&&(ht.debug2("stopFetch"),this.fetchPromise.cancel(),this.fetchPromise=void 0)}startHideTimer(){this.stopHideTimer(),this.hideTimer=setTimeout(this.handleHideTimeout,Ee.HIDE_TIMEOUT)}stopHideTimer(){this.hideTimer!=null&&(clearTimeout(this.hideTimer),this.hideTimer=void 0)}render(){const{onEntering:e,onEntered:t,onExiting:n,onExited:s}=this.props,{buttonState:o,copyState:i,isShown:r,rowCount:l,error:a}=this.state,c=i===Ee.COPY_STATES.DONE?"fade":"copy-slide-up",d=Ee.getCopyButtonText(o),u=a!=null?a:Ee.getStatusMessageText(i,l),h=i!==Ee.COPY_STATES.DONE,g=o===Ee.BUTTON_STATES.FETCH_IN_PROGRESS,p=i===Ee.COPY_STATES.DONE;return y(Zo,{animation:c,isShown:r,className:ee("iris-grid-copy-handler",{"copy-done":p}),onClick:this.handleBackgroundClick,onEntering:e,onEntered:t,onExiting:n,onExited:s,children:[m("div",{className:"status-message",children:m("span",{children:u})}),m($t,{in:h,timeout:Ue.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:y("div",{className:"buttons-container",children:[m("button",{type:"button",className:"btn btn-outline-secondary btn-cancel",onClick:this.handleCancelClick,children:"Cancel"}),y(z,{kind:g?"tertiary":"primary",className:ee("btn-copy",{"btn-spinner":g}),onClick:this.handleCopyClick,disabled:g,children:[g&&m(dn,{}),d]})]})})]})}};let ys=Ee;ys.NO_PROMPT_THRESHOLD=1e4;ys.HIDE_TIMEOUT=3e3;ys.COPY_STATES={IDLE:"IDLE",CONFIRMATION_REQUIRED:"CONFIRMATION_REQUIRED",FETCH_IN_PROGRESS:"FETCH_IN_PROGRESS",FETCH_ERROR:"FETCH_ERROR",CLICK_REQUIRED:"CLICK_REQUIRED",DONE:"DONE"};ys.BUTTON_STATES={COPY:"COPY",FETCH_IN_PROGRESS:"FETCH_IN_PROGRESS",CLICK_TO_COPY:"CLICK_TO_COPY",RETRY:"RETRY"};ys.defaultProps={copyOperation:null,onEntering:()=>{},onEntered:()=>{},onExiting:()=>{},onExited:()=>{}};class Fl extends F.exports.PureComponent{constructor(t){super(t);const{debounceMs:n}=t;this.debouncedSendUpdate=vt(this.sendUpdate.bind(this),n),this.handleCancel=this.handleCancel.bind(this),this.handleChange=this.handleChange.bind(this),this.handleCommit=this.handleCommit.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.inputField=null;const{value:s}=t;this.initialValue=s,this.state={isChanged:!1,value:s}}componentDidMount(){var t;(t=this.inputField)==null||t.focus()}componentDidUpdate(t){const{debounceMs:n}=this.props;t.debounceMs!==n&&(this.debouncedSendUpdate.flush(),this.debouncedSendUpdate=vt(this.sendUpdate.bind(this),n))}componentWillUnmount(){this.debouncedSendUpdate.cancel()}setValue(t){this.initialValue=t,this.setState({value:t})}focus(){var t;(t=this.inputField)==null||t.focus()}handleChange(t){const{value:n}=t.target;this.setState({value:n,isChanged:!0}),this.debouncedSendUpdate(n)}handleCancel(){this.debouncedSendUpdate.cancel();const{initialValue:t}=this,{isChanged:n}=this.state;n&&this.sendUpdate(t);const{onDone:s}=this.props;s()}handleCommit(t=!0,n=!0){this.debouncedSendUpdate.flush();const{onDone:s}=this.props;s(t,n)}handleFocus(){var t;(t=this.inputField)==null||t.select()}handleBlur(t){const{relatedTarget:n}=t;n!=null&&n.classList.contains("context-menu-container")?this.handleCommit(!1,!0):n!=null&&n.classList.contains("advanced-filter-button")?this.handleCommit(!1,!1):this.handleCommit(!0,!0)}handleTab(t=!1){this.debouncedSendUpdate.flush();const{onTab:n}=this.props;n(t)}handleKeyDown(t){switch(t.key){case"Escape":t.stopPropagation(),t.preventDefault(),this.handleCancel();break;case"Enter":t.stopPropagation(),t.preventDefault(),this.handleCommit();break;case"Tab":t.stopPropagation(),t.preventDefault(),this.handleTab(t.shiftKey);break}}handleContextMenu(t){const{onContextMenu:n}=this.props;n(t)}sendUpdate(t){const{onChange:n}=this.props;n(t)}render(){const{className:t,style:n,isAdvancedFilterSet:s,onAdvancedFiltersTriggered:o}=this.props,{value:i}=this.state;return y("div",{style:n,className:"iris-grid-input-autosized-wrapper","data-value":i,children:[m("input",{ref:r=>{this.inputField=r},className:ee("iris-grid-input-field",t),type:"text",value:i,onBlur:this.handleBlur,onFocus:this.handleFocus,onChange:this.handleChange,onKeyDown:this.handleKeyDown,onContextMenu:this.handleContextMenu,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false"}),m("div",{className:"advanced-filter-button-container",children:m(z,{kind:"ghost",className:ee("btn-link-icon advanced-filter-button",{"filter-set":s}),onClick:o,onContextMenu:this.handleContextMenu,children:y("div",{className:"fa-layers ",children:[m(te,{icon:ki,className:"filter-solid"}),m(te,{icon:Oo,className:"filter-light"})]})})})]})}}Fl.defaultProps={style:{},className:"",value:"",isAdvancedFilterSet:!1,onAdvancedFiltersTriggered:()=>{},onChange:()=>{},onDone:()=>{},onTab:()=>{},onContextMenu:()=>{},debounceMs:150};class Fu extends ns{constructor(t){super(),this.irisGrid=t}onDown(t){const{selectedRanges:n}=this.irisGrid.state;return t.key==="c"&&_n.isModifierKeyDown(t)?(J.isValidSnapshotRanges(n)?this.irisGrid.copyRanges(n):this.irisGrid.copyRanges(n,!1,!1,"Invalid copy ranges"),!0):!1}}const Du={TOGGLE_QUICK_FILTER:Ve.createAndAdd({id:"TABLE.TOGGLE_QUICK_FILTER",name:"Toggle Quick Filter",shortcut:[le.CTRL,he.F],macShortcut:[le.CMD,he.F]}),CLEAR_ALL_FILTERS:Ve.createAndAdd({id:"TABLE.CLEAR_ALL_FILTERS",name:"Clear All Table Filters",shortcut:[le.CTRL,he.E],macShortcut:[le.CMD,he.E]}),CLEAR_FILTERS:Ve.createAndAdd({id:"TABLE.CLEAR_FILTERS",name:"Clear Active Table Filters",shortcut:[le.CTRL,le.SHIFT,he.E],macShortcut:[le.CMD,le.SHIFT,he.E]}),REVERSE:Ve.createAndAdd({id:"TABLE.REVERSE",name:"Reverse",shortcut:[le.CTRL,he.I],macShortcut:[le.CMD,he.I]}),TOGGLE_SEARCH:Ve.createAndAdd({id:"TABLE.TOGGLE_SEARCH",name:"Toggle Search",shortcut:[le.CTRL,le.SHIFT,he.F],macShortcut:[le.CMD,le.SHIFT,he.F]}),GOTO_ROW:Ve.createAndAdd({id:"TABLE.GOTO_ROW",name:"Go to Row",shortcut:[le.CTRL,he.G],macShortcut:[le.CMD,he.G]})},Iu={COMMIT:Ve.createAndAdd({id:"INPUT_TABLE.COMMIT",name:"Commit",shortcut:[le.CTRL,he.S],macShortcut:[le.CMD,he.S]}),DISCARD:Ve.createAndAdd({id:"INPUT_TABLE.DISCARD",name:"Discard",shortcut:[le.CTRL,le.ALT,he.S],macShortcut:[le.CMD,le.OPTION,he.S]})},It={TABLE:Du,INPUT_TABLE:Iu};class Nu extends ns{constructor(t){super(),this.irisGrid=t}onDown(t){if(It.TABLE.REVERSE.matchesEvent(t)){if(!this.irisGrid.isReversible())return!1;const{reverseType:n}=this.irisGrid.state;return n===I.REVERSE_TYPE.NONE?this.irisGrid.reverse(I.REVERSE_TYPE.POST_SORT):this.irisGrid.reverse(I.REVERSE_TYPE.NONE),!0}return!1}}class Au extends ns{constructor(t){super(),this.irisGrid=t}onDown(t){return It.TABLE.CLEAR_FILTERS.matchesEvent(t)?(this.irisGrid.clearAllFilters(),!0):!1}}class Mu extends Ye{constructor(t){super(850),this.irisGrid=t}destroyColumnTooltip(){this.irisGrid.setState({overflowButtonTooltipProps:null})}setCursor(t){return this.isHoveringOverflowButton(t)?(this.cursor="pointer",{stopPropagation:!1,preventDefault:!1}):(this.cursor=null,!1)}getButtonPosition({x:t,y:n,column:s,row:o}){if(s==null||o==null)return null;const{renderer:i,grid:r,state:l,props:a}=this.irisGrid;if(!r)return null;const{metrics:c}=l,{model:d}=a,{canvasContext:u}=r,h=r.getTheme(),g={context:u,mouseX:t,mouseY:n,metrics:c,model:d,theme:h},{left:p,top:f,width:C,height:w}=i.getCellOverflowButtonPosition(g);return p==null||C==null||f==null||w==null?null:{left:p,top:f,width:C,height:w}}isHoveringOverflowButton(t){var w;const{x:n,y:s}=t,{left:o,top:i,width:r,height:l}=(w=this.getButtonPosition(t))!=null?w:{};if(o==null||r==null||i==null||l==null)return!1;const{renderer:a,grid:c,state:d,props:u}=this.irisGrid;if(!c)return!1;const{metrics:h}=d,{model:g}=u,{canvasContext:p}=c,f=c.getTheme(),C={context:p,mouseX:n,mouseY:s,metrics:h,model:g,theme:f};return a.shouldRenderOverflowButton(C)&&n>=o&&n<=o+r&&s>=i&&s<=i+l}onMove(t){if(this.isHoveringOverflowButton(t)){const{overflowButtonTooltipProps:n}=this.irisGrid.state,s=this.getButtonPosition(t);rt(n,s)||this.irisGrid.setState({overflowButtonTooltipProps:s})}else this.destroyColumnTooltip();return this.setCursor(t)}onWheel(t){return this.destroyColumnTooltip(),this.onMove(t)}onDown(t){this.destroyColumnTooltip();const{column:n,row:s}=t;return this.isHoveringOverflowButton(t)&&this.irisGrid.setState({showOverflowModal:!0,overflowText:this.irisGrid.getValueForCell(n,s)}),!1}onContextMenu(){return this.destroyColumnTooltip(),!1}onLeave(){return this.destroyColumnTooltip(),!1}}class Ou extends Ye{constructor(t){super(),this.irisGrid=t,this.cursor=null}isActive(){const{isSelectingColumn:t}=this.irisGrid.props;return t}isValidColumn(t){if(t==null)return!1;const{columnSelectionValidator:n}=this.irisGrid.props;return n!=null?n(t):!0}updateColumnSelectionStatus(){const{columnSelectionValidator:t}=this.irisGrid.props;t!=null&&t(null)}getTableColumn(t){if(t==null)return null;const{model:n}=this.irisGrid.props,s=this.irisGrid.getModelColumn(t);return s==null?null:n.columns[s]}onMove(t){if(!this.isActive())return!1;const{columnAllowedCursor:n,columnNotAllowedCursor:s}=this.irisGrid.props,{column:o}=t,i=this.getTableColumn(o);return this.isValidColumn(i)?(this.cursor=n,this.irisGrid.setState({hoverSelectColumn:o})):(this.cursor=s,this.irisGrid.setState({hoverSelectColumn:null})),!0}onWheel(t){if(!this.isActive())return!1;const{columnAllowedCursor:n,columnNotAllowedCursor:s}=this.irisGrid.props,{column:o}=t,i=this.getTableColumn(o);return this.isValidColumn(i)?this.cursor=n:this.cursor=s,{preventDefault:!1,stopPropagation:!1}}onLeave(){return this.isActive()&&this.irisGrid.setState({hoverSelectColumn:null}),this.updateColumnSelectionStatus(),!1}onDown(){return this.isActive()}onClick(t){if(!this.isActive())return!1;const{column:n}=t,s=this.getTableColumn(n);return s!=null&&this.isValidColumn(s)&&this.irisGrid.selectColumn(s),!0}}class xu extends Ye{constructor(t){super(),this.irisGrid=t}hideColumnTooltip(){const{tooltip:t}=this.irisGrid;t&&(t.stopTimer(),t.hide())}onDown(){return this.hideColumnTooltip(),!1}onContextMenu(){return this.hideColumnTooltip(),!1}onWheel(){return this.hideColumnTooltip(),!1}onLeave(t,n,s){const{relatedTarget:o}=s instanceof MouseEvent?s:s.nativeEvent,{tooltip:i}=this.irisGrid;if(!i)return!1;const r=i.popper.current;return r&&o instanceof Element&&r.element.contains(o)||this.hideColumnTooltip(),!1}onMove(t){const{column:n,row:s,columnHeaderDepth:o}=t,{shownColumnTooltip:i}=this.irisGrid.state;let r=null;return n!==null&&s===null&&o===0&&(r=n),r!==i&&this.irisGrid.setState({shownColumnTooltip:r}),!1}}const Dl=class extends F.exports.Component{constructor(e=Dl.defaultProps){super(e),this.handleInputChange=this.handleInputChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.inputRef=Fe.createRef()}handleInputChange(){const{onChange:e}=this.props;this.inputRef.current&&e(this.inputRef.current.value)}closeContextMenu(){const{forwardedProps:e}=this.props,{closeMenu:t}=e;t(!0)}revertToDefault(){const{onChange:e}=this.props;e(null)}returnFocusToContextMenu(){const e=Yc.getClosestByClassName(this.inputRef.current,"context-menu-container");e instanceof HTMLElement&&e.focus()}handleKeyDown(e){switch(e.key){case"Enter":e.stopPropagation(),this.closeContextMenu();break;case"Escape":e.stopPropagation(),this.revertToDefault(),this.closeContextMenu();break;case"ArrowRight":case"ArrowLeft":e.stopPropagation();break;case"ArrowUp":case"ArrowDown":this.returnFocusToContextMenu();break;default:e.stopPropagation()}}render(){const{formatString:e,forwardedProps:t,placeholder:n,title:s}=this.props,{menuItem:{description:o},iconElement:i}=t;return y("div",{className:"form-group flex-grow mb-0",children:[y("div",{className:"custom-format-title",children:[m("span",{className:"icon",children:i}),y("label",{className:"title mb-0",htmlFor:"custom-format-input",children:[s,o!=null&&m(Rt,{children:o})]})]}),m("div",{className:"pl-2 pr-2 pb-2",children:m("input",{id:"custom-format-input",className:"form-control text-right mb-0",type:"text",defaultValue:e,ref:this.inputRef,placeholder:n,onKeyDown:this.handleKeyDown,onChange:this.handleInputChange,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false"})})]})}};let Il=Dl;Il.defaultProps={formatString:"",forwardedProps:{menuItem:{},closeMenu(e){},iconElement:null},placeholder:"",title:"",onChange(e){}};class ft{static isDefaultSelected(t){return!t||![Le.TYPE_CONTEXT_CUSTOM,Le.TYPE_CONTEXT_PRESET].includes(t.type)}static isCustomSelected(t){return t!=null&&t.type===Le.TYPE_CONTEXT_CUSTOM}static makeOption(t,n,s,o){return{title:t,description:t,group:s,format:n,isSelected:o}}static makeCustomFormatOption(t,n,s,o,i){return{title:t.label,description:t.label,format:t,group:n,isSelected:o,menuElement:m(Il,{formatString:t.formatString,title:t.label,placeholder:s,onChange:i})}}}const Vt=class{static getOptions(e,t){const n=new Date,o=[{group:Vt.dateGroup,formatString:"yyyy-MM-dd"},{group:Vt.dateGroup,formatString:"MM-dd-yyyy"},{group:Vt.timeGroup,formatString:"HH:mm:ss"},{group:Vt.timeGroup,formatString:"HH:mm:ss.SSS"},{group:Vt.timeGroup,formatString:"HH:mm:ss.SSSSSSSSS"},{group:Vt.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss"},{group:Vt.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss.SSS"},{group:Vt.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss.SSSSSSSSS"}].map(r=>{const l=kn.makeFormat("",r.formatString,kn.TYPE_CONTEXT_PRESET),a=e.getFormattedString(n,I.dataType.DATETIME,"",l);return ft.makeOption(a,l,r.group,kn.isSameFormat(l,t))});return[ft.makeOption("Default",null,Vt.dateGroup,ft.isDefaultSelected(t)),...o]}};let Jo=Vt;Jo.dateGroup=10;Jo.timeGroup=20;Jo.dateTimeGroup=30;const Ut=class{static getOptions(e,t){const n=[{format:_e.FORMAT_PERCENT,group:Ut.presetGroup},{format:_e.FORMAT_BASIS_POINTS,group:Ut.presetGroup},{format:_e.FORMAT_MILLIONS,group:Ut.presetGroup},{format:_e.FORMAT_SCIENTIFIC_NOTATION,group:Ut.presetGroup},{format:_e.FORMAT_ROUND,group:Ut.presetRoundGroup},{format:_e.FORMAT_ROUND_TWO_DECIMALS,group:Ut.presetRoundGroup},{format:_e.FORMAT_ROUND_FOUR_DECIMALS,group:Ut.presetRoundGroup}],s=ft.makeOption("Default",null,Ut.defaultGroup,ft.isDefaultSelected(e)),o=n.map(a=>ft.makeOption(a.format.label,a.format,a.group,_e.isSameFormat(a.format,e))),i=ft.isCustomSelected(e),r=i?e:_e.makeCustomFormat(),l=ft.makeCustomFormatOption(r,Ut.customGroup,_e.DEFAULT_FORMAT_STRING,i,a=>{if(a!=null){const c=_e.makeCustomFormat(a);_e.isValid(c)&&t(c)}else t(null)});return[s,...o,l]}};let js=Ut;js.defaultGroup=10;js.presetGroup=20;js.presetRoundGroup=30;js.customGroup=40;const Bs=class{static getOptions(e,t){const n=[{format:Dt.FORMAT_MILLIONS,group:Bs.presetGroup},{format:Dt.FORMAT_SCIENTIFIC_NOTATION,group:Bs.presetGroup}],s=ft.makeOption("Default",null,Bs.defaultGroup,ft.isDefaultSelected(e)),o=n.map(a=>ft.makeOption(a.format.label,a.format,a.group,Dt.isSameFormat(a.format,e))),i=ft.isCustomSelected(e),r=i?e:Dt.makeCustomFormat(),l=ft.makeCustomFormatOption(r,Bs.customGroup,Dt.DEFAULT_FORMAT_STRING,i,a=>{if(a!=null){const c=Dt.makeCustomFormat(a);Dt.isValid(c)&&t(c)}else t(null)});return[s,...o,l]}};let ei=Bs;ei.defaultGroup=10;ei.presetGroup=20;ei.customGroup=30;const Or=ie.module("IrisGridContextMenuHandler"),ku=150,xr="yyyy-MM-dd HH:mm:ss.SSSSSSSSS",U=class extends Ye{constructor(e){super(),this.debouncedUpdateCustomFormat=vt(e.handleFormatSelection,ku),this.irisGrid=e}static getQuickFilterCondition(e,t,n){return e&&n==="&&"?e.and(t):e&&n==="||"?e.or(t):t}static getQuickFilterText(e,t,n){return n&&e!=null?`${e} ${n} ${t}`:t}static getOperatorAsText(e){return e==="&&"?"And":"Or"}static getNumberValueEqualsFilter(e,t){const n=e.filter();if(t===Number.POSITIVE_INFINITY)return E.FilterCondition.invoke("isInf",n).and(n.greaterThan(E.FilterValue.ofNumber(0)));if(t===Number.NEGATIVE_INFINITY)return E.FilterCondition.invoke("isInf",n).and(n.lessThan(E.FilterValue.ofNumber(0)));if(Number.isNaN(t))return E.FilterCondition.invoke("isNaN",n);const s=U.getFilterValueForNumberOrChar(e.type,t);return n.eq(s)}static getFilterValueForNumberOrChar(e,t){return I.isCharType(e)?E.FilterValue.ofString(String.fromCharCode(t)):E.FilterValue.ofNumber(t)}static getRowOptionFormatted(e,t,n=30){return`${e} "${es.truncate(t,n-e.length-3)}"`}componentWillUnmount(){this.debouncedUpdateCustomFormat.flush()}getHeaderActions(e,t){var N;const{irisGrid:n}=this,{column:s}=t;M(s);const{model:o}=n.props,{columns:i}=o,r=i[e],l=[],{metrics:a,reverseType:c,quickFilters:d,advancedFilters:u,searchFilter:h}=n.state,g=n.getTheme();M(a);const{filterIconColor:p,filterBarActiveColor:f,contextMenuSortIconColor:C,contextMenuReverseIconColor:w}=g,S=o.sort,T=I.getSortForColumn(S,e),R=c!==I.REVERSE_TYPE.NONE,{userColumnWidths:b}=a,v=[...b.values()].some(L=>L===0),D=o.getColumnHeaderParentGroup(e,0)===void 0,A=o.isColumnFrozen(e);return l.push({title:"Hide Column",group:U.GROUP_HIDE_COLUMNS,action:()=>{this.irisGrid.hideColumnByVisibleIndex(s)}}),l.push({title:A?"Unfreeze Column":"Freeze Column",group:U.GROUP_HIDE_COLUMNS,disabled:!D,action:()=>{A?this.irisGrid.unFreezeColumnByColumnName(r.name):this.irisGrid.freezeColumnByColumnName(r.name)},order:10}),l.push({title:"Show All Columns",group:U.GROUP_HIDE_COLUMNS,action:()=>{this.irisGrid.showAllColumns()},disabled:!v}),l.push({title:"Quick Filters",icon:Qt,iconColor:f,shortcut:It.TABLE.TOGGLE_QUICK_FILTER,group:U.GROUP_FILTER,order:10,action:()=>{this.irisGrid.toggleFilterBar(s)}}),l.push({title:"Advanced Filters",icon:u.get(e)?ki:Oo,iconColor:p,group:U.GROUP_FILTER,order:20,action:()=>{this.irisGrid.handleAdvancedMenuOpened(s)}}),l.push({title:"Clear Table Filters",group:U.GROUP_FILTER,order:40,shortcut:It.TABLE.CLEAR_FILTERS,action:()=>{this.irisGrid.clearAllFilters()},disabled:!(d.size>0||u.size>0||h!=null)}),l.push({title:"Sort by",icon:Qt,iconColor:C,group:U.GROUP_SORT,order:10,actions:this.sortByActions(r,e,T)}),l.push({title:"Add Additional Sort",disabled:T&&S.length===1||R&&S.length===1||T&&R&&S.length===2||S.length===0,group:U.GROUP_SORT,order:20,actions:this.additionalSortActions(r,e)}),l.push({title:"Clear Table Sorting",disabled:S.length===0||R&&S.length===1,group:U.GROUP_SORT,action:()=>{this.irisGrid.sortColumn(s,U.COLUMN_SORT_DIRECTION.none)},order:30}),l.push({title:c===I.REVERSE_TYPE.NONE?"Reverse Table":"Clear Reverse Table",icon:Qt,iconColor:w,group:U.GROUP_SORT,order:40,disabled:!o.isReversible,shortcut:It.TABLE.REVERSE,action:()=>{c===I.REVERSE_TYPE.NONE?this.irisGrid.reverse(I.REVERSE_TYPE.POST_SORT):this.irisGrid.reverse(I.REVERSE_TYPE.NONE)}}),l.push({title:"Copy Column Name",group:U.GROUP_COPY,action:()=>{var L;zo((L=o.textForColumnHeader(e))!=null?L:"").catch(k=>Or.error("Unable to copy header",k))}}),I.isDateType(r.type)?l.push({title:"Date/Time Format",group:U.GROUP_FORMAT,actions:this.dateFormatActions(r)}):I.isNumberType(r.type)&&l.push({title:"Number Format",group:U.GROUP_FORMAT,actions:(N=this.numberFormatActions(r))!=null?N:void 0}),l}getCellActions(e,t,n){M(e);const{irisGrid:s}=this,{column:o,row:i}=n,{model:r,canCopy:l}=s.props,{columns:a}=r,c=s.getModelRow(i);M(c);const d=r.valueForCell(e,c),u=r.textForCell(e,c),h=a[e],g=[],{quickFilters:p}=s.state,f=s.getTheme(),{filterIconColor:C}=f,{settings:w}=s.props,S=new kn({timeZone:w==null?void 0:w.timeZone,showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:xr}),T=new kn({timeZone:w==null?void 0:w.timeZone,showTimeZone:w==null?void 0:w.showTimeZone,showTSeparator:w==null?void 0:w.showTSeparator,defaultDateTimeFormatString:xr});if(h==null||i==null)return g;if(r.isFilterable(e)){const b={title:"Filter by Value",icon:Qt,iconColor:C,group:U.GROUP_FILTER,order:10,actions:[]};if(d==null)p.get(e)&&b.actions.push({title:"And",actions:this.nullFilterActions(h,p.get(e),"&&"),order:2,group:se.groups.high}),b.actions.push(...this.nullFilterActions(h));else if(I.isBooleanType(h.type))p.get(e)&&b.actions.push({title:"Or",actions:this.booleanFilterActions(h,u,p.get(e),"||"),order:2,group:se.groups.high}),b.actions.push(...this.booleanFilterActions(h,u));else if(I.isNumberType(h.type)||I.isCharType(h.type)){M(e);const v=I.isCharType(h.type)?String.fromCharCode(d):`${d}`;p.get(e)&&b.actions.push({title:"And",actions:this.numberFilterActions(h,v,d,p.get(e),"&&"),order:2,group:se.groups.high}),b.actions.push(...this.numberFilterActions(h,v,d,p.get(e)))}else if(I.isDateType(h.type)){const v=S.format(d),D=T.format(d);p.get(e)&&b.actions.push({title:"And",actions:this.dateFilterActions(h,v,D,d,p.get(e),"&&"),order:2,group:se.groups.high}),b.actions.push(...this.dateFilterActions(h,v,D,d,p.get(e)))}else p.get(e)&&b.actions.push({title:"And",actions:this.stringFilterActions(h,u,d,p.get(e),"&&"),order:2,group:se.groups.high}),b.actions.push(...this.stringFilterActions(h,u,d));b.actions!=null&&b.actions.length>0&&g.push(b)}if(Ae(r)&&r.isRowExpandable(c)){const b=r.groupedColumns.length>0?r.depthForRow(c)-1:0,D=r.valueForCell(b,c)==null?"null":r.textForCell(b,c);g.push({title:U.getRowOptionFormatted(r.isRowExpanded(c)?"Collapse":"Expand",D),group:U.GROUP_EXPAND_COLLAPSE,order:10,action:()=>{r.setRowExpanded(c,!r.isRowExpanded(c))}}),r.isExpandAllAvailable===!0&&g.push({title:U.getRowOptionFormatted("Expand All in",D),group:U.GROUP_EXPAND_COLLAPSE,order:20,action:()=>{r.setRowExpanded(c,!0,!0)}})}Ae(r)&&r.hasExpandableRows&&r.isExpandAllAvailable===!0&&(g.push({title:"Expand Entire Table",group:U.GROUP_EXPAND_COLLAPSE,order:30,action:()=>{r.expandAll()}}),g.push({title:"Collapse Entire Table",group:U.GROUP_EXPAND_COLLAPSE,order:40,action:()=>{r.collapseAll()}}));const R={title:"Go to",iconColor:C,shortcut:It.TABLE.GOTO_ROW,group:U.GROUP_GOTO,order:10,action:()=>this.irisGrid.toggleGotoRow(`${i+1}`,`${d}`,h.name)};return g.push(R),l&&(g.push({title:"Copy Cell",group:U.GROUP_COPY,order:10,action:()=>{s.copyCell(o,i)}}),g.push({title:"Copy Cell Unformatted",group:U.GROUP_COPY,order:20,action:()=>{s.copyCell(o,i,!0)}})),g}onContextMenu(e,t,n){const{irisGrid:s}=this,{y:o,column:i,row:r,columnHeaderDepth:l}=e,a=s.getModelColumn(i),c=s.getModelRow(r),{model:d,canCopy:u}=s.props,{columns:h}=d,{metrics:g,isFilterBarShown:p,quickFilters:f,advancedFilters:C,selectedRanges:w}=s.state;M(g);const{columnHeaderHeight:S,gridY:T,columnHeaderMaxDepth:R}=g,b=[];if(a!=null&&c!=null){const v=d.valueForCell(a,c),D=d.textForCell(a,c),A=h[a],{onContextMenu:N}=s.props;A!=null&&b.push(N({model:d,value:v,valueText:D,column:A,rowIndex:r,columnIndex:i,modelRow:c,modelColumn:a}))}return a!=null&&d.isFilterable(a)&&b.push({title:"Clear Column Filter",group:U.GROUP_FILTER,order:30,action:()=>{this.irisGrid.removeColumnFilter(a)},disabled:!(f.has(a)||C.has(a))}),(p?o<=T:o<=S*R&&l===0)?a!=null&&b.push(...this.getHeaderActions(a,e)):(a!=null&&c!=null&&b.push(...this.getCellActions(a,t,e)),u&&w.length>0&&(b.push({title:"Copy Selection",shortcut:Li.COPY,group:U.GROUP_COPY,order:30,action:()=>{s.copyRanges(w)}}),b.push({title:"Copy Selection w/ Headers",group:U.GROUP_COPY,order:40,action:()=>{s.copyRanges(w,!0)}})),ke(d)&&d.isEditable&&w.length>0&&b.push({title:"Delete Selected Rows",group:U.GROUP_EDIT,order:50,action:()=>{this.irisGrid.deleteRanges(w)}})),b.length===0?!1:(M(s.gridWrapper),se.triggerMenu(s.gridWrapper,n.pageX,n.pageY,b),!0)}dateFormatActions(e){const{model:t}=this.irisGrid.props,{formatter:n}=t,s=n.getColumnFormat(e.type,e.name),o=Jo.getOptions(n,s),i=[];for(let r=0;r<o.length;r+=1){const{description:l,format:a,group:c,isSelected:d,title:u}=o[r];i.push({title:u,description:l,icon:d?Qn:void 0,group:c,order:r,action:()=>{const h=t.getColumnIndexByName(e.name);M(h),this.irisGrid.handleFormatSelection(h,a)}})}return i}numberFormatActions(e){const{model:t}=this.irisGrid.props,{formatter:n}=t,s=n.getColumnFormat(e.type,e.name);let o;const i=t.getColumnIndexByName(e.name);if(I.isDecimalType(e.type))o=js.getOptions(s,l=>{M(i),this.debouncedUpdateCustomFormat(i,l)});else if(I.isIntegerType(e.type))o=ei.getOptions(s,l=>{M(i),this.debouncedUpdateCustomFormat(i,l)});else return Or.error("Invalid column type in numberFormatActions"),null;const r=[];for(let l=0;l<o.length;l+=1){const{format:a,isSelected:c}=o[l];r.push({...o[l],icon:c?Qn:void 0,order:l,action:()=>{i===void 0&&a&&a.type===Le.TYPE_CONTEXT_CUSTOM||(M(i),this.irisGrid.handleFormatSelection(i,a))}})}return r}stringFilterActions(e,t,n,s,o){const i=E.FilterValue.ofString(n);let r=s;r||(r={filter:null,text:null});const{filter:l,text:a}=r,c=[],{model:d}=this.irisGrid.props,u=d.getColumnIndexByName(e.name);return M(u),c.push({menuElement:y("div",{className:"iris-grid-filter-menu-item-value",children:[o?U.getOperatorAsText(o):""," ",'"',t,'"']}),order:1,group:se.groups.high}),c.push({title:"text is exactly",description:`Show only rows where ${e.name} is ${n} (case sensitive)`,action:()=>{this.irisGrid.setQuickFilter(u,U.getQuickFilterCondition(l,e.filter().eq(i),o),U.getQuickFilterText(a,`=${t}`,o))},order:10,group:se.groups.low}),c.push({title:"text is not exactly",description:`Show only rows where ${e.name} is not ${t} (case sensitive)`,action:()=>{this.irisGrid.setQuickFilter(u,U.getQuickFilterCondition(l,e.filter().notEq(i),o),U.getQuickFilterText(a,`!=${t}`,o))},order:20,group:se.groups.low}),c.push({title:"text contains",description:`Show only rows where ${e.name} contains ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,U.getQuickFilterCondition(l,e.filter().contains(i),o),U.getQuickFilterText(a,`~${t}`,o))},order:30,group:se.groups.low}),c.push({title:"text does not contain",description:`Show only rows where ${e.name} does not contain ${n}`,action:()=>{this.irisGrid.setQuickFilter(u,U.getQuickFilterCondition(l,e.filter().contains(i).not(),o),U.getQuickFilterText(a,`!~${t}`,o))},order:40,group:se.groups.low}),c.push({title:"text starts with",description:`Show only rows where ${e.name} starts with ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,U.getQuickFilterCondition(l,e.filter().invoke("startsWith",i),o),U.getQuickFilterText(a,`${t}*`,o))},order:50,group:se.groups.low}),c.push({title:"text ends with",description:`Show only rows where ${e.name} ends with ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,U.getQuickFilterCondition(l,e.filter().invoke("endsWith",i),o),U.getQuickFilterText(a,`*${t}`,o))},order:60,group:se.groups.low}),c}numberFilterActions(e,t,n,s,o){const i=U.getFilterValueForNumberOrChar(e.type,n);let r=null,l=null;s&&(r=s.filter,l=s.text);const a=[],c=n!==Number.POSITIVE_INFINITY&&n!==Number.NEGATIVE_INFINITY&&!Number.isNaN(n),{model:d}=this.irisGrid.props,u=d.getColumnIndexByName(e.name);return M(u),a.push({menuElement:y("div",{className:"iris-grid-filter-menu-item-value",children:[o?U.getOperatorAsText(o):""," ",'"',t,'"']}),order:1,group:se.groups.high}),a.push({title:"is equal to",description:`Show only rows where ${e.name} is ${t}`,action:()=>{const h=U.getNumberValueEqualsFilter(e,n);this.irisGrid.setQuickFilter(u,U.getQuickFilterCondition(r,h,o),U.getQuickFilterText(l,`=${t}`,o))},order:10,group:se.groups.low}),a.push({title:"is not equal to",description:`Show only rows where ${e.name} is not ${t}`,action:()=>{const h=U.getNumberValueEqualsFilter(e,n).not();this.irisGrid.setQuickFilter(u,U.getQuickFilterCondition(r,h,o),U.getQuickFilterText(l,`!=${t}`,o))},order:20,group:se.groups.low}),c&&!I.isCharType(e.type)&&(a.push({title:"greater than",description:`Show only rows where ${e.name} is greater than ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,U.getQuickFilterCondition(r,e.filter().greaterThan(i),o),U.getQuickFilterText(l,`>${t}`,o))},order:30,group:se.groups.low}),a.push({title:"greater than or equal to",description:`Show only rows where ${e.name} is greater than or equal to ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,U.getQuickFilterCondition(r,e.filter().greaterThanOrEqualTo(i),o),U.getQuickFilterText(l,`>=${t}`,o))},order:40,group:se.groups.low}),a.push({title:"less than",description:`Show only rows where ${e.name} is less than ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,U.getQuickFilterCondition(r,e.filter().lessThan(i),o),U.getQuickFilterText(l,`<${t}`,o))},order:50,group:se.groups.low}),a.push({title:"less than or equal to",description:`Show only rows where ${e.name} is less than or equal to ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,U.getQuickFilterCondition(r,e.filter().lessThanOrEqualTo(i),o),U.getQuickFilterText(l,`<=${t}`,o))},order:60,group:se.groups.low})),a}booleanFilterActions(e,t,n,s){const o=[],{model:i}=this.irisGrid.props,{filter:r,text:l}=n||{},a=i.getColumnIndexByName(e.name);return M(a),o.push({menuElement:y("div",{className:"iris-grid-filter-menu-item-value",children:[s?U.getOperatorAsText(s):""," ",'"',t!=null?t:"null",'"']}),order:1,group:se.groups.high}),o.push({title:"true",description:`Show only rows where ${e.name} is true`,action:()=>{this.irisGrid.setQuickFilter(a,U.getQuickFilterCondition(r,e.filter().isTrue(),s),U.getQuickFilterText(l,"true",s))},order:10,group:se.groups.low}),o.push({title:"false",description:`Show only rows where ${e.name} is false`,action:()=>{this.irisGrid.setQuickFilter(a,U.getQuickFilterCondition(r,e.filter().isFalse(),s),U.getQuickFilterText(l,"false",s))},order:20,group:se.groups.low}),o.push({title:"is null",description:`Show only rows where ${e.name} is null`,action:()=>{this.irisGrid.setQuickFilter(a,U.getQuickFilterCondition(r,e.filter().isNull(),s),U.getQuickFilterText(l,"null",s))},order:30,group:se.groups.low}),o.push({title:"is not null",description:`Show only rows where ${e.name} is not null`,action:()=>{this.irisGrid.setQuickFilter(a,U.getQuickFilterCondition(r,e.filter().isNull().not(),s),U.getQuickFilterText(l,"!null",s))},order:40,group:se.groups.low}),o}dateFilterActions(e,t,n,s,o,i){const r=E.FilterValue.ofNumber(s);let l=null,a=null;o&&(l=o.filter,a=o.text);const{model:c}=this.irisGrid.props,d=c.getColumnIndexByName(e.name);M(d);const u=[];return u.push({menuElement:y("div",{className:"iris-grid-filter-menu-item-value",children:[i?U.getOperatorAsText(i):""," ",'"',n,'"']}),order:1,group:se.groups.high}),u.push({title:"date is",description:`Show only rows where ${e.name} is ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,U.getQuickFilterCondition(l,e.filter().eq(r),i),U.getQuickFilterText(a,`=${t}`,i))},order:10,group:se.groups.low}),u.push({title:"date is not",description:`Show only rows where ${e.name} is not ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,U.getQuickFilterCondition(l,e.filter().notEq(r),i),U.getQuickFilterText(a,`!=${t}`,i))},order:20,group:se.groups.low}),u.push({title:"date is before",description:`Show only rows where ${e.name} is before ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,U.getQuickFilterCondition(l,e.filter().lessThan(r),i),U.getQuickFilterText(a,`<${t}`,i))},order:30,group:se.groups.low}),u.push({title:"date is before or equal",description:`Show only rows where ${e.name} is before or equal to ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,U.getQuickFilterCondition(l,e.filter().lessThanOrEqualTo(r),i),U.getQuickFilterText(a,`<=${t}`,i))},order:40,group:se.groups.low}),u.push({title:"date is after",description:`Show only rows where ${e.name} is greater than ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,U.getQuickFilterCondition(l,e.filter().greaterThan(r),i),U.getQuickFilterText(a,`>${t}`,i))},order:50,group:se.groups.low}),u.push({title:"date is after or equal",description:`Show only rows where ${e.name} is after or equal to ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,U.getQuickFilterCondition(l,e.filter().greaterThanOrEqualTo(r),i),U.getQuickFilterText(a,`>=${t}`,i))},order:60,group:se.groups.low}),u}nullFilterActions(e,t,n){let s=null,o=null;t&&(s=t.filter,o=t.text);const i=[],{model:r}=this.irisGrid.props,l=r.getColumnIndexByName(e.name);return M(l),i.push({menuElement:y("div",{className:"iris-grid-filter-menu-item-value",children:[n?U.getOperatorAsText(n):""," ",'"null"']}),order:1,group:se.groups.high}),i.push({title:"is null",description:`Show only rows where ${e.name} is null`,action:()=>{this.irisGrid.setQuickFilter(l,U.getQuickFilterCondition(s,e.filter().isNull(),n),U.getQuickFilterText(o,"null",n))},order:10,group:se.groups.low}),i.push({title:"is not null",description:`Show only rows where ${e.name} is not null`,action:()=>{this.irisGrid.setQuickFilter(l,U.getQuickFilterCondition(s,e.filter().isNull().not(),n),U.getQuickFilterText(o,"!null",n))},order:20,group:se.groups.low}),i}sortByActions(e,t,n){const s=this.irisGrid.getTheme(),{contextMenuSortIconColor:o}=s,i=[{title:`${e.name} Ascending`,order:10,action:()=>{this.irisGrid.sortColumn(t,U.COLUMN_SORT_DIRECTION.ascending)},icon:this.checkColumnSort(n,U.COLUMN_SORT_DIRECTION.ascending)?Qt:void 0,iconColor:o},{title:`${e.name} Descending`,order:20,action:()=>{this.irisGrid.sortColumn(t,U.COLUMN_SORT_DIRECTION.descending)},icon:this.checkColumnSort(n,U.COLUMN_SORT_DIRECTION.descending)?Qt:void 0,iconColor:o},{title:"Remove Sort",order:50,action:()=>{this.irisGrid.sortColumn(t,U.COLUMN_SORT_DIRECTION.none,!1,!0)},disabled:!n}];return I.isNumberType(e.type)&&(i.push({title:`ABS(${e.name}) Ascending`,order:30,action:()=>{this.irisGrid.sortColumn(t,U.COLUMN_SORT_DIRECTION.ascending,!0)},icon:this.checkColumnSort(n,U.COLUMN_SORT_DIRECTION.ascending,!0)?Qt:void 0,iconColor:o}),i.push({title:`ABS(${e.name}) Descending`,order:40,action:()=>{this.irisGrid.sortColumn(t,U.COLUMN_SORT_DIRECTION.descending,!0)},icon:this.checkColumnSort(n,U.COLUMN_SORT_DIRECTION.descending,!0)?Qt:void 0,iconColor:o})),i}additionalSortActions(e,t){const n=this.irisGrid.getTheme(),{contextMenuSortIconColor:s}=n,o=[{title:"Add Sort By",menuElement:y("div",{className:"btn-context-menu menu-title",children:[m("span",{className:"icon",children:m(te,{icon:Qt,style:{color:s!=null?s:void 0}})}),m("span",{className:"title",children:"Add Additional Sort"}),m("span",{className:"shortcut",children:_n.isMacPlatform()?"\u2318Click":"Ctrl+Click"})]}),order:1},{title:`${e.name} Ascending`,order:10,action:()=>{this.irisGrid.sortColumn(t,U.COLUMN_SORT_DIRECTION.ascending,!1,!0)}},{title:`${e.name} Descending`,order:20,action:()=>{this.irisGrid.sortColumn(t,U.COLUMN_SORT_DIRECTION.descending,!1,!0)}}];return I.isNumberType(e.type)&&(o.push({title:`ABS(${e.name}) Ascending`,order:30,action:()=>{this.irisGrid.sortColumn(t,U.COLUMN_SORT_DIRECTION.ascending,!0,!0)}}),o.push({title:`ABS(${e.name}) Descending`,order:40,action:()=>{this.irisGrid.sortColumn(t,U.COLUMN_SORT_DIRECTION.descending,!0,!0)}})),o}checkColumnSort(e,t=null,n=!1){return e?e.direction===t&&e.isAbs===n:!1}};let Yt=U;Yt.GROUP_EDIT=se.groups.high+10;Yt.GROUP_HIDE_COLUMNS=se.groups.high+25;Yt.GROUP_FILTER=se.groups.high+50;Yt.GROUP_EXPAND_COLLAPSE=se.groups.high+55;Yt.GROUP_GOTO=se.groups.high+60;Yt.GROUP_SORT=se.groups.high+75;Yt.GROUP_COPY=se.groups.high+100;Yt.GROUP_FORMAT=se.groups.high+150;Yt.COLUMN_SORT_DIRECTION={ascending:"ASC",descending:"DESC",none:null};class Lu extends Ye{constructor(t){super(),this.irisGrid=t}onDoubleClick(t){const{column:n,row:s}=t;return s==null||n==null?!1:(this.irisGrid.selectData(n,s),!0)}}class Pu extends Ye{constructor(t){super(),this.irisGrid=t}onDown(t){const{y:n,column:s,row:o}=t;if(s!==null&&o===null){const{isFilterBarShown:i,metrics:r}=this.irisGrid.state;if(!r)throw new Error("Metrics not set");const{columnHeaderMaxDepth:l}=r,a=this.irisGrid.getTheme();if(i&&a.columnHeaderHeight!=null&&a.filterBarHeight!=null&&n>a.columnHeaderHeight*l&&n<=a.columnHeaderHeight*l+a.filterBarHeight)return this.irisGrid.focusFilterBar(s),!0}return!1}onMove(t){const{y:n,column:s}=t,{isFilterBarShown:o,hoverAdvancedFilter:i,metrics:r}=this.irisGrid.state;if(!r)throw new Error("Metrics not set");const{columnHeaderMaxDepth:l}=r,a=this.irisGrid.getTheme();let c=null;return o&&a.columnHeaderHeight!=null&&a.filterBarHeight!=null&&s!==null&&n>=a.columnHeaderHeight*l&&n<=a.columnHeaderHeight*l+a.filterBarHeight&&(c=s),c!==i&&this.irisGrid.setState({hoverAdvancedFilter:c}),!1}onLeave(t){const{column:n}=t,{hoverAdvancedFilter:s}=this.irisGrid.state;return s!==null&&n!==s&&this.irisGrid.setState({hoverAdvancedFilter:null}),!1}}class _u extends Ye{constructor(t){super(750),this.irisGrid=t}destroyTooltip(){this.irisGrid.setState({expandCellTooltipProps:null})}setCursor(t,n){return Ts.isInTreeBox(t,n)?(this.cursor="pointer",{stopPropagation:!1,preventDefault:!1}):(this.cursor=null,!1)}getButtonPosition({x:t,y:n,column:s,row:o}){if(s==null||o==null)return null;const{renderer:i,grid:r,state:l,props:a}=this.irisGrid;if(!r)return null;const{metrics:c}=l,{model:d}=a,{canvasContext:u}=r,h=r.getTheme(),g={context:u,mouseX:t,mouseY:n,metrics:c,model:d,theme:h},p=Ae(d)?d.depthForRow(o):null,{left:f,top:C,width:w,height:S}=i.getExpandButtonPosition(g,p);return f==null||w==null||C==null||S==null?null:{left:f,top:C,width:w,height:S}}onMove(t,n){if(Ts.isInTreeBox(t,n)){const{expandCellTooltipProps:s}=this.irisGrid.state,{model:o}=this.irisGrid.props,i=this.getButtonPosition(t),{row:r}=t;M(r);const l=Ae(o)&&o.isRowExpanded(r);rt(s,i)||this.irisGrid.setState({expandCellTooltipProps:i,expandTooltipDisplayValue:l?"collapse":"expand"})}else this.destroyTooltip();return this.setCursor(t,n)}onDown(){return this.destroyTooltip(),!1}onContextMenu(){return this.destroyTooltip(),!1}onWheel(){return this.destroyTooltip(),!1}onLeave(){return this.destroyTooltip(),!1}}class Hu extends Ye{constructor(t){super(),this.column=null,this.irisGrid=t}getColumnFromGridPoint(t){const{column:n,row:s,columnHeaderDepth:o}=t;return n!==null&&s===null&&o===0?n:null}onDown(t){return this.column=this.getColumnFromGridPoint(t),!1}onClick(t,n,s){const o=this.getColumnFromGridPoint(t);if(o!=null&&o===this.column){const i=_n.isModifierKeyDown(s);return this.irisGrid.toggleSort(o,i),!0}return!1}}class Vu extends Ye{constructor(t){super(),this.irisGrid=t}onWheel(t,n,s){const{irisGrid:o}=this,{model:i}=o.props,{metrics:r,pendingRowCount:l}=o.state;M(r);const{bottom:a,rowCount:c,rowHeight:d}=r,{deltaY:u}=H.getScrollDelta(s);return ke(i)&&i.isEditable&&a>=c-1&&u>0&&o.setState({pendingRowCount:l+Math.ceil(u/d)}),!1}}const Uu=3e3;function Bu({children:e=null,onEntering:t,onEntered:n,onExiting:s,onExited:o}){const[i,r]=F.exports.useState(!1),l=F.exports.useRef(),a=$i(e),c=F.exports.useCallback(()=>{r(!0),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{r(!1)},Uu)},[r,l]);return F.exports.useEffect(()=>{a!==e&&e!=null&&c()},[e,a,r,c]),F.exports.useEffect(()=>()=>l.current?clearTimeout(l.current):void 0,[]),m(Zo,{className:"toast-bottom-bar",isShown:i,onEntering:t,onEntered:n,onExiting:s,onExited:o,children:e})}class Gu extends Ks{getGridY(t){let n=super.getGridY(t);const{isFilterBarShown:s,theme:o,advancedFilters:i,quickFilters:r,sorts:l,reverseType:a}=t;return s?n+=o.filterBarHeight:(r!=null&&r.size>0||i!=null&&i.size>0)&&(n+=o.filterBarCollapsedHeight),a!==I.REVERSE_TYPE.NONE&&l!=null&&l.length>0&&(n+=o.reverseHeaderBarHeight),n}getUserColumnWidths(){return this.userColumnWidths}}const Wu=1,Nl=Fe.memo(({model:e,modelColumns:t,top:n,bottom:s,left:o,right:i,filter:r,formatter:l,reverseType:a=I.REVERSE_TYPE.NONE,sorts:c,customColumns:d,movedColumns:u,hiddenColumns:h,alwaysFetchColumns:g,rollupConfig:p=null,totalsConfig:f=null,selectDistinctColumns:C=ve,pendingRowCount:w=0,pendingDataMap:S=on,frozenColumns:T,formatColumns:R,columnHeaderGroups:b})=>{const v=F.exports.useMemo(()=>J.getModelViewportColumns(t,o,i,u,h,g,Wu),[t,o,i,u,h,g]);return F.exports.useEffect(function(){e.filter=r},[e,r]),F.exports.useEffect(function(){const A=[...c];a!==I.REVERSE_TYPE.NONE&&A.push(E.Table.reverse()),e.sort=A},[e,c,a]),F.exports.useEffect(function(){e.formatter=l},[e,l]),F.exports.useEffect(function(){e.isCustomColumnsAvailable&&(e.customColumns=d)},[e,d]),F.exports.useEffect(function(){e.isFormatColumnsAvailable&&(e.formatColumns=R)},[e,R]),F.exports.useEffect(function(){e.setViewport(n,s,v)},[e,n,s,v]),F.exports.useEffect(function(){e.isRollupAvailable&&(e.rollupConfig=p)},[e,e.isRollupAvailable,p]),F.exports.useEffect(function(){e.isSelectDistinctAvailable&&(e.selectDistinctColumns=C)},[e,C]),F.exports.useEffect(function(){e.isTotalsAvailable&&(e.totalsConfig=f)},[e,e.isTotalsAvailable,f]),F.exports.useEffect(function(){e.pendingRowCount=w},[e,w]),F.exports.useEffect(function(){e.pendingDataMap=S},[e,S]),F.exports.useEffect(function(){T&&e.updateFrozenColumns(T)},[e,T]),F.exports.useEffect(function(){e.columnHeaderGroups=b},[e,b]),null});Nl.displayName="IrisGridModelUpdater";const Pt=Object.freeze({SORT_UP:"sortUp",SORT_DOWN:"sortDown",CARET_DOWN:"caretDown",CARET_RIGHT:"caretRight",CELL_OVERFLOW:"cellOverflow"}),kr=10,pi=16;class zs extends es{constructor(){super(),this.icons={},this.initIcons()}static isFilterValid(t,n){const s=t==null||t.filter!=null,o=n==null||n.filter!=null;return s&&o}initIcons(){this.setIcon(Pt.SORT_UP,Ua),this.setIcon(Pt.SORT_DOWN,Ba),this.setIcon(Pt.CARET_DOWN,Yn),this.setIcon(Pt.CARET_RIGHT,ll),this.setIcon(Pt.CELL_OVERFLOW,Ga)}setIcon(t,n){const s=Array.isArray(n.icon[4])?n.icon[4][0]:n.icon[4],o=new Path2D(s),i=new Path2D,r={a:pi/n.icon[0],d:pi/n.icon[1]};i.addPath(o,r),this.icons[t]=i}getIcon(t){return this.icons[t]}getSortIcon(t){return t?t.direction===I.sortDirection.ascending?this.getIcon(Pt.SORT_UP):t.direction===I.sortDirection.descending?this.getIcon(Pt.SORT_DOWN):null:null}drawCanvas(t){super.drawCanvas(t),this.drawScrim(t)}drawGrid(t,n){super.drawGrid(t,n),this.drawCellOverflowButton(n)}drawGridLines(t,n){super.drawGridLines(t,n),this.drawGroupedColumnLine(t,n),this.drawPendingRowLine(t,n)}drawCellContent(t,n,s,o){var h;const{metrics:i,model:r}=n,{modelColumns:l,modelRows:a}=i,c=O(a,o),d=l.get(s);if(d===void 0)return;const u=r.valueForCell(d,c);if(I.isTextType((h=r.columns[d])==null?void 0:h.type)&&(u===null||u==="")){const g=t.font;t.font=`italic ${g}`;const p=u===null?"null":"empty";super.drawCellContent(t,n,s,o,p),t.font=g;return}super.drawCellContent(t,n,s,o)}drawGroupedColumnLine(t,n){const{metrics:s,model:o,theme:i}=n,{groupedColumns:r,columns:l}=o,{maxY:a,allColumnWidths:c,allColumnXs:d}=s;if(r.length===0||i.groupedColumnDividerColor==null)return;const u=r[r.length-1],h=l.findIndex(C=>C.name===u.name),g=d.get(h),p=c.get(h);if(g==null||p==null)return;const f=g+p+.5;t.strokeStyle=i.groupedColumnDividerColor,t.lineWidth=1,t.beginPath(),t.moveTo(f,0),t.lineTo(f,a),t.stroke()}drawPendingRowLine(t,n){const{metrics:s,model:o,theme:i}=n,{allRowYs:r,maxX:l}=s,{pendingRowCount:a}=o;if(a<=0)return;const c=o.rowCount-o.pendingRowCount-o.floatingBottomRowCount;let d=r.get(c);d!=null&&(d-=.5,t.save(),t.setLineDash([4,2]),t.strokeStyle=i.pendingTextColor,t.lineWidth=1,t.beginPath(),t.moveTo(0,d),t.lineTo(l,d),t.stroke(),t.restore())}drawMouseColumnHover(t,n){const{theme:s,metrics:o,hoverSelectColumn:i}=n;if(i==null||s.linkerColumnHoverBackgroundColor==null)return;const{allColumnWidths:r,allColumnXs:l,maxY:a}=o,c=l.get(i),d=r.get(i);M(c),M(d),t.fillStyle=s.linkerColumnHoverBackgroundColor,t.fillRect(c,0,d,a)}drawMouseRowHover(t,n){const{isSelectingColumn:s}=n;s||super.drawMouseRowHover(t,n)}drawScrim(t){const{context:n,loadingScrimProgress:s,metrics:o,theme:i}=t;if(s==null)return;const{width:r,height:l,gridY:a}=o,{scrimBlurSize:c,scrimColor:d}=i;n.save(),n.globalCompositeOperation="color",n.filter=`blur(${c}px)`,d!=null&&(n.fillStyle=d),n.beginPath(),n.rect(0,a,r,l-a),n.clip(),n.fillRect(-c,-c+a,c*2+r,(c*2+(l-a))*s),n.globalCompositeOperation="overlay",n.filter=`blur(${c}px) opacity(15%)`,n.fillRect(-c,-c+a,c*2+r,(c*2+(l-a))*s),n.restore()}drawColumnHeaders(t,n){super.drawColumnHeaders(t,n);const{theme:s,metrics:o,model:i,reverseType:r}=n,{columnHeaderHeight:l}=o;if(this.drawFilterHeaders(t,n),l<=0)return;const{sort:a}=i;if(a.length===1){const c=r!==I.REVERSE_TYPE.NONE;let d;c?d=s.headerReverseBarColor:d=s.headerSortBarColor,this.drawHeaderBar(t,n,d,c?s.reverseHeaderBarHeight:s.sortHeaderBarHeight)}else a.length>1&&(r!==I.REVERSE_TYPE.NONE&&this.drawHeaderBar(t,n,s.headerReverseBarColor,s.reverseHeaderBarHeight,!1),this.drawHeaderBar(t,n,s.headerSortBarColor,s.sortHeaderBarHeight))}drawHeaderBar(t,n,s,o,i=!0){const{theme:r,metrics:l,model:a}=n,{columnHeaderHeight:c,width:d}=l;let u=0;i||(u=o),t.fillStyle=r.headerBarCasingColor,t.fillRect(0,a.columnHeaderMaxDepth*c-o-2+u,d,o+2),t.fillStyle=s,t.fillRect(0,a.columnHeaderMaxDepth*c-o-1+u,d,o)}drawColumnHeadersAtDepth(t,n,s,o,i){const{metrics:r,model:l,isMenuShown:a}=n,{columnHeaderMaxDepth:c}=l,{width:d}=r,u={...o,maxX:i===c-1&&o.maxX===d?d-(a?0:30):o.maxX};super.drawColumnHeadersAtDepth(t,n,s,u,i)}drawColumnHeaderAtIndex(t,n,s,o){var W;super.drawColumnHeaderAtIndex(t,n,s,o);const{metrics:i,model:r,theme:l}=n,{modelColumns:a,allColumnWidths:c,allColumnXs:d,gridX:u,columnHeaderHeight:h,fontWidths:g}=i,{headerHorizontalPadding:p}=l,f=O(c,s,0),C=O(d,s)+u,w=a.get(s);if(w==null)return;const S=I.getSortForColumn(r.sort,w);if(!S)return;const T=this.getSortIcon(S);if(!T)return;const R=r.textForColumnHeader(w);if(R===void 0)return;const b=(W=g.get(t.font))!=null?W:es.DEFAULT_FONT_WIDTH;M(b);const v=R.length*b,D=u+C+v+p;let{maxX:A}=o;A-=p;const N=u+C+f-p-1,L=D>A?D+1:Math.min(A,N),k=S.direction===I.sortDirection.ascending?-6:-12,x=h*.5+k;t.save(),t.beginPath(),t.rect(C,0,f,h),t.clip(),t.fillStyle=l.headerSortBarColor,t.translate(L,x),t.fill(T),t.restore()}drawFilterHeaders(t,n){const{isFilterBarShown:s,quickFilters:o,advancedFilters:i}=n;s?this.drawExpandedFilterHeaders(t,n):(o!=null&&o.size>0||i!=null&&i.size>0)&&this.drawCollapsedFilterHeaders(t,n)}drawExpandedFilterHeaders(t,n){const{metrics:s,model:o,theme:i,quickFilters:r,advancedFilters:l}=n,{filterBarHeight:a}=i;if(a<=0)return;const{gridX:c,gridY:d,maxX:u,modelColumns:h,visibleColumns:g,allColumnWidths:p,allColumnXs:f}=s,C=d-a;t.save(),t.font=i.font,t.textAlign="left",r!=null&&r.size>0||l!=null&&l.size>0?t.fillStyle=i.filterBarExpandedActiveBackgroundColor:t.fillStyle=i.filterBarExpandedBackgroundColor,t.fillRect(c,C,u,a-1),t.fillStyle=i.headerBarCasingColor,t.fillRect(c,C+a-1,u,1);const w=C;t.strokeStyle=i.filterBarSeparatorColor,t.beginPath();for(let S=0;S<g.length;S+=1){const T=g[S],R=O(h,T),b=O(f,T),v=O(p,T);if(o.isFilterable(R)&&v>0){const D=c+(b!=null?b:0);t.rect(D+.5,w+.5,v,a-2)}}t.stroke();for(let S=0;S<g.length;S+=1){const T=g[S],R=O(p,T),v=O(f,T)+c;this.drawExpandedFilterHeader(t,n,T,v,R)}t.restore()}drawExpandedFilterHeader(t,n,s,o,i){if(i<=0)return;const{metrics:r,theme:l,quickFilters:a,advancedFilters:c}=n,{modelColumns:d,gridY:u}=r,{filterBarHeight:h,filterBarExpandedActiveCellBackgroundColor:g,filterBarErrorColor:p,filterBarHorizontalPadding:f,headerColor:C}=l,w=u-h,S=d.get(s);if(S===void 0)return;const T=a.get(S),R=c.get(S);if(T==null&&R==null)return;let b=null;if(T!=null){const{text:D}=T;if(b=D,b||(b=I.getFilterText(T.filter)),b!=null){const{fontWidths:A}=r;let N=A.get(t.font);(N==null||N===0)&&(N=t.measureText("8").width,N||(N=10));const L=(i-f*2)/N;L<=0?b="":b.length>L&&(b=`${b.substring(0,L-1)}\u2026`)}}if(t.save(),zs.isFilterValid(R,T)&&g!=null)t.fillStyle=g,t.fillRect(o+1,w+1,i-1,h-3);else if(p!=null){t.fillStyle=p,t.lineWidth=2,t.strokeStyle=p;const D=o+2,A=w+2,N=i-3,L=h-5;t.strokeRect(D,A,N,L)}if(b!=null&&b!==""){const D=o+f,A=w+h*.5+1;t.fillStyle=C,t.fillText(b,D,A)}t.restore()}drawCollapsedFilterHeaders(t,n){const{metrics:s,theme:o}=n,{headerSeparatorColor:i,filterBarCollapsedHeight:r}=o;if(r<=0)return;const{gridX:l,gridY:a,maxX:c,visibleColumns:d,allColumnWidths:u,allColumnXs:h}=s,g=a-r;t.save(),t.fillStyle=i,t.fillRect(l,g,c,r);for(let p=0;p<d.length;p+=1){const f=d[p],C=u.get(f),w=h.get(f);if(w!=null&&C!=null){const S=w+l;this.drawCollapsedFilterHeader(t,n,f,S,C)}}t.restore()}drawCollapsedFilterHeader(t,n,s,o,i){if(i<=0)return;const{metrics:r,theme:l,quickFilters:a,advancedFilters:c}=n,{modelColumns:d,gridY:u}=r,h=d.get(s);if(h===void 0)return;const g=a.get(h),p=c.get(h),{filterBarCollapsedHeight:f,filterBarActiveColor:C,filterBarActiveBackgroundColor:w,filterBarErrorColor:S}=l;t.save();const T=zs.isFilterValid(p,g);w!=null&&g==null&&p==null?t.fillStyle=w:C!=null&&T?t.fillStyle=C:S!=null&&(t.fillStyle=S);const R=o+1,b=u-f,v=i-1,D=f-1;t.fillRect(R,b,v,D),t.restore()}drawTreeMarker(t,n,s,o,i,r,l){t.save();const{x1:a,y1:c}=i,d=l?this.getIcon(Pt.CARET_DOWN):this.getIcon(Pt.CARET_RIGHT),u=s+a-2,h=o+c+2.5;t.fillStyle=r,t.textAlign="center",t.translate(u,h),t.fill(d),t.restore()}drawRowFooters(t,n){const{metrics:s,model:o,mouseX:i,mouseY:r,theme:l}=n,{gridY:a,gridX:c,maxX:d,modelRows:u,floatingTopHeight:h,floatingBottomHeight:g,floatingRows:p,rowFooterWidth:f,height:C,horizontalBarHeight:w,verticalBarWidth:S,allRowHeights:T,allRowYs:R,width:b}=s;if(f<=0||p.length===0)return;const{cellHorizontalPadding:v,floatingGridRowColor:D,floatingRowBackgroundColors:A,headerColor:N,rowHoverBackgroundColor:L}=l;t.translate(c,a),t.beginPath();const k=Math.min(d,b-f-S-c);t.fillStyle=A,h>0&&t.rect(k,0,f,h),g>0&&t.rect(k,C-a-w-g,f,g),t.fill();const x=i!=null&&r!=null&&i>=c&&i<=d+f?H.getRowAtY(r,s):null;if(L!=null&&x!==null&&p.includes(x)){t.fillStyle=L;const V=R.get(x),K=T.get(x);M(V),M(K),t.fillRect(k,V,f,K)}if(t.beginPath(),D!=null&&(t.strokeStyle=D),h>0&&(t.moveTo(k+.5,.5),t.lineTo(k+.5,h-.5)),g>0){const V=C-a-w-g;t.moveTo(k-.5,V+.5),t.lineTo(k-.5,V+g-.5)}t.stroke(),t.fillStyle=N,t.textAlign="left";const W=k+v;for(let V=0;V<p.length;V+=1){const K=p[V],Z=T.get(K),$=R.get(K),P=u.get(K);if($!=null&&Z!=null&&P!=null){const G=$+Z*.5;t.fillText(o.textForRowFooter(P),W,G)}}t.translate(-c,-a)}getTextRenderMetrics(t,n,s,o){const i=super.getTextRenderMetrics(t,n,s,o),{mouseX:r,mouseY:l,metrics:a}=n;if(r==null||l==null)return i;const{column:c,row:d}=H.getGridPointFromXY(r,l,a);if(s===c&&o===d){const{left:u}=this.getCellOverflowButtonPosition(n);this.shouldRenderOverflowButton(n)&&u!=null&&(i.width=u-a.gridX-i.x)}return i}shouldRenderOverflowButton(t){var C,w;const{context:n,mouseX:s,mouseY:o,metrics:i,model:r,theme:l}=t;if(s==null||o==null)return!1;const{row:a,column:c,modelRow:d,modelColumn:u}=H.getCellInfoFromXY(s,o,i);if(a==null||c==null||d==null||u==null||!I.isStringType(r.columns[u].type))return!1;const h=(C=r.textForCell(u,d))!=null?C:"",{width:g}=super.getTextRenderMetrics(n,t,c,a),p=(w=i.fontWidths.get(l.font))!=null?w:zs.DEFAULT_FONT_WIDTH;n.save(),n.font=l.font;const f=this.getCachedTruncatedString(n,h,g,p,r.truncationCharForCell(u,d));return n.restore(),h!==""&&f!==h}getCellOverflowButtonPosition({mouseX:t,mouseY:n,metrics:s,theme:o}){const i={left:null,top:null,width:null,height:null};if(t==null||n==null||!s)return i;const{rowHeight:r,columnWidth:l,left:a,top:c}=H.getCellInfoFromXY(t,n,s);M(a),M(l),M(c);const{width:d,verticalBarWidth:u}=s,{cellHorizontalPadding:h}=o,g=pi+2*h,p=r,C=Math.min(s.gridX+a+l,d-u)-g,w=s.gridY+c;return{left:C,top:w,width:g,height:p}}drawCellOverflowButton(t){const{context:n,mouseX:s,mouseY:o,theme:i}=t;if(s==null||o==null||!this.shouldRenderOverflowButton(t))return;const{left:r,top:l,width:a,height:c}=this.getCellOverflowButtonPosition(t),{cellHorizontalPadding:d,overflowButtonColor:u,overflowButtonHoverColor:h}=i;n.save(),h!=null&&r!=null&&a!=null&&l!=null&&c!=null&&s>=r&&s<=r+a&&o>=l&&o<=l+c?n.fillStyle=h:u!=null&&(n.fillStyle=u);const g=this.getIcon(Pt.CELL_OVERFLOW);r!=null&&l!=null&&n.translate(r+d,l+2),n.fill(g),n.restore()}getExpandButtonPosition({mouseX:t,mouseY:n,metrics:s,theme:o},i){const r={left:null,top:null,width:null,height:null};if(t==null||n==null||i==null||!s)return r;const{rowHeight:l,left:a,top:c}=H.getCellInfoFromXY(t,n,s);M(a),M(l),M(c);const{cellHorizontalPadding:d}=o,u=kr+2*d,h=Math.max(a+kr*i,s.gridX),g=s.gridY+c;return{left:h,top:g,width:u,height:l}}}const $u="12px Fira Sans, sans-serif",zu="#f0f0ee",qu="#1a171a",ne={"grid-bg":"#211f22",font:$u,white:zu,black:qu,"header-bg":"#2d2a2e","header-color":"#f0f0ee","header-height":"30px","header-separator-color":"#211f22","header-separator-hover-color":"#929192","header-hidden-separator-hover-color":"#4878ea","header-sort-bar-color":"#aa9af4","header-reverse-bar-color":"#548d29","header-bar-casing-color":"#211f22","header-font":"600 12px Fira Sans, sans-serif","row-height":"19px","row-background-colors":"#373438 #2d2a2e","selection-color":"rgba(118, 217, 228, 0.09)","selection-outline-color":"#76d9e4","selection-outline-casing-color":"#211f22","row-hover-bg":"#4b494c","selected-row-hover-bg":"rgba(118, 217, 228, 0.25)","scroll-bar-active-selection-tick-color":"rgba(118, 217, 228, 0.5)","scroll-bar-bg":"#322f33","scroll-bar-hover-bg":"#373438","scroll-bar-casing-color":"#555356","scroll-bar-corner-color":"#322f33","scroll-bar-color":"#5b5a5c","scroll-bar-hover-color":"#929192","scroll-bar-active-color":"#c0bfbf","text-color":"#f0f0ee","positive-number-color":"#9edc6f","negative-number-color":"#f95d84","zero-number-color":"#fcd65b","date-color":"#fcd65b","pending-text-color":"#fde38d","error-text-color":"#f95d84","null-string-color":"#929192","filter-bar-active-bg":"#425175","filter-bar-active-color":"#4878ea","filter-bar-expanded-bg":"#373438","filter-bar-expanded-active-bg":"#313849","filter-bar-expanded-active-cell-bg":"#374d80","filter-bar-separator-color":"#929192","filter-bar-error-color":"#f95d84","filter-icon-color":"#4878ea","scrim-color":"#211f22","context-menu-sort-icon-color":"#aa9af4","context-menu-reverse-icon-color":"#548d29","linker-column-hover-bg":"rgba(118, 217, 228, 0.09)","tree-line-color":"#5b5a5c","tree-marker-color":"#c0bfbf","tree-marker-hover-color":"#fcfcfa","grouped-column-divider-color":"#1a171a","floating-grid-row-color":"#555356","floating-row-background-colors":"#403e41","floating-divider-inner-color":"#403e41","floating-divider-outer-color":"#211f22","overflow-button-color":"#c0bfbf","overflow-button-hover-color":"#fcfcfa"},Al=Object.freeze({backgroundColor:ne["grid-bg"],white:ne.white,black:ne.black,font:ne.font,headerBackgroundColor:ne["header-bg"],headerColor:ne["header-color"],headerSeparatorColor:ne["header-separator-color"],headerSeparatorHoverColor:ne["header-separator-hover-color"],headerHiddenSeparatorHoverColor:ne["header-hidden-separator-hover-color"],headerSortBarColor:ne["header-sort-bar-color"],headerReverseBarColor:ne["header-reverse-bar-color"],headerBarCasingColor:ne["header-bar-casing-color"],headerFont:ne["header-font"],rowBackgroundColors:ne["row-background-colors"],rowHoverBackgroundColor:ne["row-hover-bg"],selectionColor:ne["selection-color"],selectionOutlineColor:ne["selection-outline-color"],selectionOutlineCasingColor:ne["selection-outline-casing-color"],selectedRowHoverBackgroundColor:ne["selected-row-hover-bg"],scrollBarBackgroundColor:ne["scroll-bar-bg"],scrollBarHoverBackgroundColor:ne["scroll-bar-hover-bg"],scrollBarCasingColor:ne["scroll-bar-casing-color"],scrollBarCornerColor:ne["scroll-bar-corner-color"],scrollBarColor:ne["scroll-bar-color"],scrollBarHoverColor:ne["scroll-bar-hover-color"],scrollBarActiveColor:ne["scroll-bar-active-color"],scrollBarSelectionTickColor:ne["selected-row-hover-bg"],scrollBarActiveSelectionTickColor:ne["scroll-bar-active-selection-tick-color"],textColor:ne["text-color"],positiveNumberColor:ne["positive-number-color"],negativeNumberColor:ne["negative-number-color"],zeroNumberColor:ne["zero-number-color"],dateColor:ne["date-color"],pendingTextColor:ne["pending-text-color"],errorTextColor:ne["error-text-color"],nullStringColor:ne["null-string-color"],filterBarActiveBackgroundColor:ne["filter-bar-active-bg"],filterBarExpandedBackgroundColor:ne["filter-bar-expanded-bg"],filterBarExpandedActiveBackgroundColor:ne["filter-bar-expanded-active-bg"],filterBarExpandedActiveCellBackgroundColor:ne["filter-bar-expanded-active-cell-bg"],filterBarSeparatorColor:ne["filter-bar-separator-color"],filterBarActiveColor:ne["filter-bar-active-color"],filterBarErrorColor:ne["filter-bar-error-color"],filterIconColor:ne["filter-icon-color"],scrimColor:ne["scrim-color"],contextMenuSortIconColor:ne["context-menu-sort-icon-color"],contextMenuReverseIconColor:ne["context-menu-reverse-icon-color"],allowRowResize:!1,autoSelectRow:!0,gridColumnColor:null,gridRowColor:null,groupedColumnDividerColor:ne["grouped-column-divider-color"],columnHoverBackgroundColor:null,headerHorizontalPadding:12,scrollBarSize:13,scrollBarHoverSize:16,minScrollHandleSize:24,rowHeight:parseInt(ne["row-height"],10)||19,columnWidth:100,rowHeaderWidth:0,rowFooterWidth:60,columnHeaderHeight:parseInt(ne["header-height"],10)||30,filterBarHeight:30,filterBarCollapsedHeight:5,sortHeaderBarHeight:2,reverseHeaderBarHeight:4,filterBarHorizontalPadding:4,scrimBlurSize:25,minScrimTransitionTime:150,maxScrimTransitionTime:350,scrollSnapToRow:!0,linkerColumnHoverBackgroundColor:ne["linker-column-hover-bg"],treeLineColor:ne["tree-line-color"],treeMarkerColor:ne["tree-marker-color"],treeMarkerHoverColor:ne["tree-marker-hover-color"],floatingGridColumnColor:null,floatingGridRowColor:ne["floating-grid-row-color"],floatingRowBackgroundColors:ne["floating-row-background-colors"],floatingDividerInnerColor:ne["floating-divider-inner-color"],floatingDividerOuterColor:ne["floating-divider-outer-color"],overflowButtonColor:ne["overflow-button-color"],overflowButtonHoverColor:ne["overflow-button-hover-color"]});const fi=ie.module("ColumnStatistics"),Yu={SIZE:"Number of Rows"},Ii=class extends F.exports.Component{constructor(e){super(e),this.handleError=this.handleError.bind(this),this.handleGenerateStatistics=this.handleGenerateStatistics.bind(this),this.handleStatistics=this.handleStatistics.bind(this),this.cancelablePromise=null,this.state={error:null,loading:!1,statistics:null,numRows:0}}static getStatsLabel(e){var t;return(t=Yu[e])!=null?t:e.split(" ").map(n=>n[0].toUpperCase()+n.substr(1).toLowerCase()).join(" ")}componentDidMount(){this.maybeGenerateStatistics()}componentWillUnmount(){this.cancelablePromise&&this.cancelablePromise.cancel()}maybeGenerateStatistics(){const{model:e}=this.props,t=e.rowCount-e.pendingRowCount;this.setState({numRows:t}),e.isColumnStatisticsAvailable?t<Ii.AUTO_GENERATE_LIMIT&&this.handleGenerateStatistics():this.setState({loading:!1})}handleGenerateStatistics(){this.setState({loading:!0});const{column:e,model:t}=this.props;this.cancelablePromise=Ge.makeCancelable(t.columnStatistics(e)),this.cancelablePromise.then(this.handleStatistics).catch(this.handleError)}handleStatistics(e){fi.debug("Received statistics",e);const{model:t,onStatistics:n}=this.props,s=[];e.statisticsMap.forEach((o,i)=>{s.push({operation:Ii.getStatsLabel(i),value:o,type:e.getType(i)})}),e.uniqueValues.forEach((o,i)=>{s.push({operation:i,className:"column-statistics-unique-value",value:o,type:"long"})}),this.setState({loading:!1,statistics:s,numRows:t.rowCount-t.pendingRowCount}),n()}handleError(e){if(e!=null&&Ge.isCanceled(e)){fi.debug("Called handleError on a cancelled promise result");return}fi.error("Error generating statistics",e),this.setState({error:e,loading:!1,statistics:null})}render(){const{column:e,model:t}=this.props,{error:n,loading:s,statistics:o,numRows:i}=this.state,r=!s&&n==null&&o==null&&t.isColumnStatisticsAvailable,l=[],a=e.type.substring(e.type.lastIndexOf(".")+1),c=e.description===null?null:e.description;if(o!=null)for(let g=0;g<o.length;g+=1){const{operation:p,className:f,value:C,type:w}=o[g],S=w?t.displayString(C,w):t.displayString(C,e.type,e.name),T=y(Fe.Fragment,{children:[m("div",{className:ee("column-statistic-operation",f),children:p}),m("div",{className:"column-statistic-value",children:S})]},p);l.push(T)}const d=Ae(t)&&t.hasExpandableRows?"Expanded Rows":"Number of Rows",u=t.displayString(i,"long"),h=t.getColumnIndexByName(e.name);return y("div",{className:"column-statistics",children:[y("div",{className:"column-statistics-title",children:[e.name,y("span",{className:"column-statistics-type",children:["\xA0(",a,")"]}),m(gl,{className:"column-statistics-copy",tooltip:"Copy column name",copy:e.name})]}),c!=null&&m("div",{className:"column-statistics-description",children:c}),h!=null&&!t.isColumnMovable(h)&&y("div",{className:"column-statistics-status",children:[m(te,{icon:t.isColumnFrozen(h)?Wa:$a,className:"mr-1"}),t.isColumnFrozen(h)?"Frozen":"Not movable"]}),y("div",{className:"column-statistics-grid",children:[o==null&&y(Oe,{children:[m("div",{className:"column-statistic-operation",children:d}),m("div",{className:"column-statistic-value",children:u})]}),l]}),r&&m(z,{kind:"ghost",className:"px-0",onClick:this.handleGenerateStatistics,children:"Generate Stats"}),n!=null&&m("div",{className:"error-message",children:`${n}`}),o&&!s&&m(z,{kind:"ghost",className:"px-0",onClick:this.handleGenerateStatistics,icon:m(te,{icon:za,className:"mr-1"}),children:"Refresh"}),s&&y("div",{className:"column-statistics-loading",children:[m(dn,{className:"mr-2"}),"Calculating Stats..."]})]})}};let Ml=Ii;Ml.AUTO_GENERATE_LIMIT=1e5;const yo=ie.module("AdvancedFilterCreatorFilterItem");class ji extends F.exports.PureComponent{constructor(t){super(t),this.getCachedIsValid=Re((i,r,l,a)=>{try{return!l||I.makeAdvancedValueFilter(i,r,l,a)!=null}catch{return!1}}),this.handleDelete=this.handleDelete.bind(this),this.handleTypeChange=this.handleTypeChange.bind(this),this.handleValueChange=this.handleValueChange.bind(this),this.typeDropdown=null;const{value:n="",filterTypes:s,selectedType:o=s[0]}=t;this.state={selectedType:o,value:n}}static getLabelForFilter(t,n){try{if(I.isNumberType(t)||I.isCharType(t))return Pd(n);if(I.isTextType(t))return Ld(n);if(I.isDateType(t))return _d(n);if(I.isBooleanType(t))return Hd(n);throw new Error(`Unrecognized column type: ${t}`)}catch(s){return yo.warn(s),""}}componentDidMount(){var t;(t=this.typeDropdown)==null||t.focus()}componentDidUpdate(t){const{value:n,selectedType:s}=this.props;s!==void 0&&t.selectedType!==s&&this.setState({selectedType:s}),n!==void 0&&t.value!==n&&this.setState({value:n})}handleTypeChange(t){const n=t.target.value;yo.debug2("typeChange",n),this.setState({selectedType:n});const{onChange:s}=this.props,{value:o}=this.state;o!=null&&o.length>0&&s(n,o)}handleValueChange(t){yo.debug2("valueChange");const{value:n}=t.target;this.setState({value:n});const{onChange:s}=this.props,{selectedType:o}=this.state;o!=null&&s(o,n)}handleDelete(){yo.debug("delete");const{onDelete:t}=this.props;t()}render(){const{column:t,filterTypes:n,formatter:s}=this.props,{selectedType:o,value:i}=this.state,r=!I.isBooleanType(t.type),l=[],a=this.getCachedIsValid(t,o,i,s.timeZone);for(let c=0;c<n.length;c+=1){const d=n[c],u=ji.getLabelForFilter(t.type,d),h=m("option",{value:d,children:u},d);l.push(h)}return m("div",{className:"advanced-filter-creator-filter-item",children:y("div",{className:"form-row",children:[m("div",{className:"form-group col",children:m("select",{className:"form-control custom-select",value:o,onChange:this.handleTypeChange,ref:c=>{this.typeDropdown=c},children:l})}),r&&m("div",{className:"form-group col",children:m("div",{className:"input-group",children:m("input",{type:"text",className:ee("form-control",{error:!a}),placeholder:"Enter value",value:i,onChange:this.handleValueChange})})}),m("div",{className:"form-group col-1 px-0",children:m(z,{kind:"ghost",className:"w-100 h-100 p-0 m-0",onClick:this.handleDelete,icon:un,tooltip:"Remove Filter"})})]})})}}const Lr=ie.module("AdvancedFilterCreatorSelectValueList"),Ni=class extends F.exports.PureComponent{constructor(e){super(e),this.handleSelect=this.handleSelect.bind(this),this.handleViewportChange=this.handleViewportChange.bind(this),this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.handleTableUpdate=this.handleTableUpdate.bind(this),this.list=null;const{selectedValues:t}=this.props;this.state={itemCount:0,items:[],offset:0,selectedValues:t,isLoading:!0}}static indexOf(e,t){for(let n=0;n<t.length;n+=1){const s=t[n];if(s===e||s!=null&&s.valueOf!=null&&e!=null&&e.valueOf!=null&&s.valueOf()===e.valueOf())return n}return-1}componentDidMount(){const{table:e}=this.props;e&&this.startListening(e)}componentDidUpdate(e){const{filters:t,invertSelection:n,selectedValues:s,table:o}=this.props;e.table!==o&&(e.table&&this.stopListening(e.table),o&&this.startListening(o),this.resetViewport()),e.invertSelection!==n&&this.setState({selectedValues:[]},this.handleSelectionUpdate),e.selectedValues!==s&&this.setState({selectedValues:s},this.handleSelectionUpdate),e.filters!==t&&(o==null||o.applyFilter(t),this.resetViewport())}componentWillUnmount(){const{table:e}=this.props;e&&this.stopListening(e)}handleSelect(e,t){const{invertSelection:n}=this.props;let{selectedValues:s}=this.state;s=[...s];const o=Ni.indexOf(t,s);o>=0?s.splice(o,1):s.push(t);let i=o<0;n&&(i=!i);const{offset:r}=this.state;let{items:l}=this.state;l=[...l];const a=e-r;a>=0&&a<l.length&&(l[a].isSelected=i),this.setState({items:l,selectedValues:s});const{onChange:c}=this.props;c(s,n)}handleViewportChange(e,t){this.updateViewport(e,t)}handleSelectionUpdate(){this.updateItemSelection()}handleTableUpdate(e){const{table:t,formatter:n}=this.props;if(!t)return;const s=e.detail,{offset:o}=s,i=[],r=t.columns[0];for(let a=0;a<s.rows.length;a+=1){const d=s.rows[a].get(r),u=n.getFormattedString(d,r.type,r.name),h=this.isValueSelected(d);i.push({displayValue:u,value:d,isSelected:h})}Lr.debug2("Received table update:",o,i.length);const l=t.size;this.setState({itemCount:l,items:i,offset:o,isLoading:!1})}isValueSelected(e){const{invertSelection:t}=this.props,{selectedValues:n}=this.state,s=Ni.indexOf(e,n);return t?s<0:s>=0}startListening(e){e.addEventListener(E.Table.EVENT_UPDATED,this.handleTableUpdate)}stopListening(e){e.removeEventListener(E.Table.EVENT_UPDATED,this.handleTableUpdate)}resetViewport(){this.list&&this.list.topRow!=null&&this.list.bottomRow!=null&&this.updateViewport(this.list.topRow,this.list.bottomRow,!0)}updateItemSelection(){let{items:e}=this.state;e=[...e];for(let t=0;t<e.length;t+=1){const n=e[t],{value:s}=n;n.isSelected=this.isValueSelected(s)}this.setState({items:e})}updateViewport(e,t,n=!1){const{table:s}=this.props;if(s==null)return;n&&this.setState({isLoading:!0});const o=t-e+1,i=Math.max(0,e-o*3),r=Math.max(i,t+o*3);Lr.debug2("Setting viewport",i,",",r),s.setViewport(i,r)}render(){const{offset:e,isLoading:t,items:n,itemCount:s}=this.state;return y("div",{className:"select-value-list-wrapper",children:[m(qa,{itemCount:s,items:n,offset:e,onSelect:this.handleSelect,onViewportChange:this.handleViewportChange,ref:o=>{this.list=o}}),m($t,{in:t,timeout:250,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:m("div",{className:"loading-list",children:m(dn,{className:"loading-spinner-large"})})})]})}};let Ol=Ni;Ol.defaultProps={invertSelection:!0,selectedValues:[],onChange:()=>{}};const xl=class extends F.exports.PureComponent{constructor(e){super(e),this.handleSelectAllClick=this.handleSelectAllClick.bind(this),this.handleClearAllClick=this.handleClearAllClick.bind(this),this.handleListChange=this.handleListChange.bind(this),this.handleSearchChange=this.handleSearchChange.bind(this),this.handleUpdateFilterTimeout=this.handleUpdateFilterTimeout.bind(this);const{invertSelection:t,selectedValues:n}=e;this.state={filters:[],invertSelection:t,selectedValues:n,searchText:""}}componentDidMount(){this.initSearchTable()}componentDidUpdate(e,t){const{invertSelection:n,selectedValues:s,table:o}=this.props;e.table!==o&&this.initSearchTable(),e.invertSelection!==n&&this.setState({invertSelection:n}),e.selectedValues!==s&&this.setState({selectedValues:s});const{table:i,searchText:r}=this.state;i!==t.table&&(t.table!=null&&t.table.close(),i!=null&&this.startUpdateFilterTimer()),r!==t.searchText&&this.startUpdateFilterTimer()}componentWillUnmount(){const{table:e}=this.state;e!=null&&e.close(),this.searchTablePromise=void 0,this.stopUpdateFilterTimer()}getColumnName(){const{table:e}=this.props;return e!=null?e.columns[0].name:""}getDisplayedValuesCount(){const{invertSelection:e,selectedValues:t,table:n}=this.state;return n==null?null:e?n.totalSize-t.length:t.length}getDisplayedValueText(){const e=this.getDisplayedValuesCount(),{table:t}=this.state,{formatter:n}=this.props;if(e!=null&&t!=null){const s=n.getFormattedString(e,"long"),o=n.getFormattedString(t.totalSize,"long");let i="";return e<1e6&&(i="Displaying "),`${i}${s} of ${o}`}return null}initSearchTable(){const{table:e}=this.props;if(e==null)return;const t=e.copy();this.searchTablePromise=t,this.searchTablePromise.then(n=>{this.searchTablePromise===t?(this.setState({table:n}),this.searchTablePromise=void 0):n.close()})}handleListChange(e,t){this.setState({selectedValues:e,invertSelection:t});const{onChange:n}=this.props;n(e,t)}handleSearchChange(e){const t=e.target.value;this.setState({searchText:t})}handleSelectAllClick(){this.resetSelection(!0)}handleClearAllClick(){this.resetSelection(!1)}handleUpdateFilterTimeout(){this.updateFilterTimer=void 0,this.updateTableFilter()}resetSelection(e){const t=[];this.setState({invertSelection:e,selectedValues:t});const{onChange:n}=this.props;n(t,e)}startUpdateFilterTimer(){this.stopUpdateFilterTimer(),this.updateFilterTimer=setTimeout(this.handleUpdateFilterTimeout,xl.searchDebounceTime)}stopUpdateFilterTimer(){this.updateFilterTimer!=null&&(clearTimeout(this.updateFilterTimer),this.updateFilterTimer=void 0)}updateTableFilter(){const{table:e,searchText:t}=this.state,{timeZone:n}=this.props,s=e==null?void 0:e.columns[0],o=[];if(s==null)return;let i;if(t.length>0){let r=null;I.isCharType(s.type)?r=I.makeQuickFilter(s,t):I.isTextType(s.type)?r=I.makeQuickFilter(s,`~${t}`,n):r=I.makeQuickFilter(s,`>=${t}`,n),r!=null?o.push(r):i="Invalid search text"}this.setState({filters:o,error:i})}render(){const{error:e,filters:t,invertSelection:n,selectedValues:s,searchText:o,table:i}=this.state,{formatter:r,showSearch:l}=this.props,a=this.getColumnName(),c=this.getDisplayedValueText(),d=a?`Find ${a}...`:"";return y("div",{className:"advanced-filter-creator-select-value",children:[y("div",{className:l?"form-group":"",children:[m("label",{htmlFor:"advanced-filter-creator-select-value-input",children:"Select Values"}),l&&m("input",{type:"text",className:ee("form-control",{"is-invalid":e!=null}),id:"advanced-filter-creator-select-value-input",placeholder:d,value:o,onChange:this.handleSearchChange})]}),m(Ol,{table:i,filters:t,invertSelection:n,selectedValues:s,formatter:r,onChange:this.handleListChange}),y("div",{className:"advanced-filter-creator-select-meta-row",children:[y("div",{children:[m(z,{kind:"ghost",onClick:this.handleSelectAllClick,children:"Select All"}),m(z,{kind:"ghost",onClick:this.handleClearAllClick,children:"Clear"})]}),m($t,{in:c!=null,timeout:250,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:m("div",{className:"row-count-info",children:c})})]})]})}};let Zi=xl;Zi.searchDebounceTime=250;Zi.defaultProps={invertSelection:!0,selectedValues:[],onChange:()=>{},showSearch:!0};const Ls=ie.module("AdvancedFilterCreator"),qn=class extends F.exports.PureComponent{constructor(e){var r,l;super(e),this.getFilterTypes=Re(a=>I.getFilterTypes(a)),this.handleAddAnd=this.handleAddAnd.bind(this),this.handleAddOr=this.handleAddOr.bind(this),this.handleChangeFilterOperator=this.handleChangeFilterOperator.bind(this),this.handleDone=this.handleDone.bind(this),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleFilterDelete=this.handleFilterDelete.bind(this),this.handleSelectValueChange=this.handleSelectValueChange.bind(this),this.handleReset=this.handleReset.bind(this),this.handleSortDown=this.handleSortDown.bind(this),this.handleSortUp=this.handleSortUp.bind(this),this.handleSubmit=this.handleSubmit.bind(this),this.handleFocusTrapStart=this.handleFocusTrapStart.bind(this),this.handleFocusTrapEnd=this.handleFocusTrapEnd.bind(this),this.handleUpdateTimeout=this.handleUpdateTimeout.bind(this),this.focusTrapContainer=Fe.createRef();const{options:t}=e;let{filterOperators:n,invertSelection:s,selectedValues:o}=t;const i=(l=(r=t.filterItems)==null?void 0:r.map(({selectedType:a,value:c})=>({selectedType:a,value:c,key:Ln()})))!=null?l:[];i.length===0&&i.push(qn.makeFilterItem()),n==null&&(n=[]),s==null&&(s=!0),o==null&&(o=[]),this.state={filterItems:i,filterOperators:n,invertSelection:s,selectedValues:o,valuesTableError:null,valuesTable:void 0}}static makeFilterItem(){return{key:Ln()}}componentDidMount(){this.initValuesTable()}componentWillUnmount(){this.debounceTimeout!=null&&(clearTimeout(this.debounceTimeout),this.sendUpdate()),this.valuesTablePromise!=null&&this.valuesTablePromise.cancel()}getFilterChangeHandler(e){return this.handleFilterChange.bind(this,e)}getFilterDeleteHandler(e){return this.handleFilterDelete.bind(this,e)}initValuesTable(){const{model:e,column:t}=this.props;if(!e.isValuesTableAvailable){Ls.debug("No values table for this model, just ignore");return}this.valuesTablePromise=I.makeCancelableTablePromise(e.valuesTable(t)),this.valuesTablePromise.then(n=>{const s=n.columns[0].sort().asc();n.applySort([s]),this.setState({valuesTable:n})}).catch(n=>{Ge.isCanceled(n)||(Ls.error("Unable to open values table",n),this.setState({valuesTableError:n}))})}handleFocusTrapEnd(){var e,t;((t=(e=this.focusTrapContainer)==null?void 0:e.current)==null?void 0:t.querySelector("button,select,input,textarea")).focus()}handleFocusTrapStart(){var t,n;const e=(n=(t=this.focusTrapContainer)==null?void 0:t.current)==null?void 0:n.querySelectorAll("button,select,input,textarea");e&&e.length>0&&e[e.length-1].focus()}handleAddAnd(){let{filterItems:e,filterOperators:t}=this.state;e=e.concat(qn.makeFilterItem()),t=t.concat(Gt.and),this.setState({filterItems:e,filterOperators:t})}handleAddOr(){let{filterItems:e,filterOperators:t}=this.state;e=e.concat(qn.makeFilterItem()),t=t.concat(Gt.or),this.setState({filterItems:e,filterOperators:t})}handleChangeFilterOperator(e,t){let{filterOperators:n}=this.state;n=[...n],kd(t),n[e]=t,this.setState({filterOperators:n}),this.startUpdateTimer()}handleFilterChange(e,t,n){let{filterItems:s}=this.state;s=[...s];const{key:o}=s[e];s[e]={key:o,selectedType:t,value:n},this.setState({filterItems:s}),this.startUpdateTimer()}handleFilterDelete(e){let{filterItems:t,filterOperators:n}=this.state;t=[...t],n=[...n],e<t.length&&t.splice(e,1),e<n.length?n.splice(e,1):e===n.length&&n.splice(n.length-1,1),t.length===0&&t.push(qn.makeFilterItem()),this.setState({filterItems:t,filterOperators:n}),this.startUpdateTimer()}handleSelectValueChange(e,t){this.setState({selectedValues:e,invertSelection:t}),this.startUpdateTimer()}handleReset(){Ls.debug("Resetting Advanced Filter"),this.setState({filterItems:[qn.makeFilterItem()],filterOperators:[],selectedValues:[],invertSelection:!0}),this.startUpdateTimer()}handleSortDown(e){const t=_n.isModifierKeyDown(e);this.sortTable(I.sortDirection.descending,t)}handleSortUp(e){const t=_n.isModifierKeyDown(e);this.sortTable(I.sortDirection.ascending,t)}handleSubmit(e){Ls.debug("Submitting Advanced Filter"),this.stopUpdateTimer(),this.sendUpdate(),e.preventDefault()}handleDone(e){Ls.debug("Submitting and Closing Advanced Filter"),this.stopUpdateTimer(),this.sendUpdate();const{onDone:t}=this.props;t(),e.preventDefault()}handleUpdateTimeout(){this.debounceTimeout=void 0,this.sendUpdate()}shouldShowAddFilter(){const{filterItems:e}=this.state;if(e.length===0)return!1;const t=e[e.length-1],{selectedType:n,value:s}=t;return n!=null&&n.length>0&&s!=null&&s.length>0}sortTable(e,t=!1){const{column:n,onSortChange:s}=this.props;s(n,e,t)}startUpdateTimer(){this.stopUpdateTimer(),this.debounceTimeout=setTimeout(this.handleUpdateTimeout,qn.debounceFilterUpdate)}stopUpdateTimer(){this.debounceTimeout!==void 0&&(clearTimeout(this.debounceTimeout),this.debounceTimeout=void 0)}sendUpdate(){const{filterItems:e,filterOperators:t,invertSelection:n,selectedValues:s}=this.state,{column:o,onFilterChange:i,model:r}=this.props,{formatter:l}=r,a=e.filter(({selectedType:h,value:g})=>h!=null&&g!=null&&g!==""),c=t.filter((h,g)=>h!=null&&e[g].selectedType!=null&&e[g].value!=null&&e[g].value!=="").slice(0,a.length-1),d={filterItems:a,filterOperators:c,invertSelection:n,selectedValues:s},u=I.makeAdvancedFilter(o,d,l.timeZone);i(o,u,d)}render(){const{column:e,model:t,sortDirection:n,formatter:s}=this.props,{filterItems:o,filterOperators:i,invertSelection:r,selectedValues:l,valuesTable:a,valuesTableError:c}=this.state,{isValuesTableAvailable:d}=t,u=I.isBooleanType(e.type),h=I.isDateType(e.type),g=this.getFilterTypes(e.type),p=e.type.substring(e.type.lastIndexOf(".")+1),f=[];if(!u&&g.length)for(let S=0;S<o.length;S+=1){const T=o[S],{key:R,selectedType:b,value:v}=T,D=m(ji,{column:e,filterTypes:g,onChange:this.getFilterChangeHandler(S),onDelete:this.getFilterDeleteHandler(S),selectedType:b,value:v,formatter:s},R);if(f.push(D),S<i.length){const N=i[S]===Gt.and,L=y("div",{className:"form-row justify-content-end advanced-filter-creator-filter-operator",children:[m(z,{kind:"ghost",className:ee("filter-operator",{active:N}),onClick:()=>this.handleChangeFilterOperator(S,Gt.and),children:"AND"}),m(z,{kind:"ghost",className:ee("filter-operator",{active:!N}),onClick:()=>this.handleChangeFilterOperator(S,Gt.or),children:"OR"})]},`filterOperator${R}`);f.push(L)}}const C=this.shouldShowAddFilter(),w=y("div",{className:ee("form-row justify-content-end add-filter-item",{hidden:!C}),children:[m("span",{className:"text-muted",children:m(te,{icon:vs})}),m(z,{kind:"ghost",className:"btn-filter-item",onClick:this.handleAddAnd,disabled:!C,tooltip:"Add filter with AND",children:"AND"}),m(z,{kind:"ghost",className:"btn-filter-item",onClick:this.handleAddOr,disabled:!C,tooltip:"Add filter with OR",children:"OR"})]},"addFilterItem");return f.push(w),y("div",{className:"advanced-filter-creator",role:"presentation",children:[m("div",{tabIndex:0,onFocus:this.handleFocusTrapStart}),y("form",{onSubmit:this.handleSubmit,ref:this.focusTrapContainer,children:[y("div",{className:"title-bar",children:[m("h6",{className:"advanced-filter-title",children:"Advanced Filters"}),y("div",{className:"advanced-filter-menu-buttons",children:[m(z,{kind:"ghost",className:ee("sort-operator",{active:n===I.sortDirection.descending}),onClick:this.handleSortDown,icon:fr,tooltip:`Sort ${e.name} Descending`}),m(z,{kind:"ghost",className:ee("sort-operator",{active:n===I.sortDirection.ascending}),onClick:this.handleSortUp,icon:m(te,{icon:fr,rotation:180}),tooltip:`Sort ${e.name} Ascending`})]})]}),m("hr",{}),y("div",{className:"advanced-filter-column-name",children:[e.name,"\xA0",y("span",{className:"column-type",children:["(",p,")"]})]}),f,d&&c==null&&y(Oe,{children:[!u&&m("hr",{}),m("div",{className:"form-group",children:m(Zi,{table:a,onChange:this.handleSelectValueChange,invertSelection:r,selectedValues:l,formatter:s,showSearch:!h,timeZone:s.timeZone})})]}),y("div",{className:"form-row justify-content-end",children:[m(z,{kind:"secondary",className:"mr-2",onClick:this.handleReset,children:"Reset"}),m(z,{kind:"primary",onClick:this.handleDone,children:"Done"})]})]}),m("div",{tabIndex:0,onFocus:this.handleFocusTrapEnd})]})}};let Ji=qn;Ji.debounceFilterUpdate=250;Ji.defaultProps={options:{filterItems:null,filterOperators:null,invertSelection:!0,selectedValues:[]},sortDirection:null};const Pr=ie.module("Aggregations"),Xu=[Te.SUM,Te.ABS_SUM,Te.MIN,Te.MAX,Te.VAR,Te.AVG,Te.STD,Te.FIRST,Te.LAST,Te.COUNT_DISTINCT,Te.DISTINCT,Te.COUNT,Te.UNIQUE];function Ku({isRollup:e,settings:t,onChange:n,onEdit:s}){const{aggregations:o,showOnTop:i}=t,r=F.exports.useMemo(()=>Xu.filter(N=>!o.some(L=>L.operation===N)),[o]),[l,a]=F.exports.useState(r[0]),[c,d]=F.exports.useState([]),u=F.exports.useCallback(N=>{n({...t,...N})},[n,t]),h=F.exports.useCallback(N=>{u({aggregations:N})},[u]),g=F.exports.useCallback(N=>{u({showOnTop:N})},[u]),p=F.exports.useCallback(()=>{Pr.debug("handleDragStart"),dt.startDragging()},[]),f=F.exports.useCallback(({destination:N,source:L})=>{if(Pr.debug("handleDragEnd",N,L),dt.stopDragging(),N===null)return;let k=N.index;L.index<N.index&&(k+=1);const x=[...o],W=dt.reorder(x,c,x,k),V=dt.adjustDestinationIndex(k,c),K=[[V,V+W.length-1]];h(x),d(K)},[h,o,c,d]),C=F.exports.useCallback(N=>{a(N)},[a]),w=F.exports.useCallback(()=>{h([...o,{operation:l,selected:[],invert:!0}])},[o,l,h]),S=F.exports.useCallback(N=>{h(o.filter((L,k)=>k!==N))},[o,h]),T=F.exports.useCallback(N=>{d(N)},[d]),R=F.exports.useCallback(N=>{const L=o[N];On.isRollupOperation(L.operation)||s(L)},[o,s]),b=F.exports.useCallback(N=>{g(N.target.value==="true")},[g]);F.exports.useEffect(function(){r.length>0&&!r.includes(l)&&a(r[0])},[r,l]);const v=F.exports.useCallback(({item:N,itemIndex:L,isClone:k=!1,selectedCount:x})=>{const W=N.operation,V=k?`${x}`:void 0,K=k?"item-list-item-clone":void 0,Z=On.isRollupOperation(N.operation),$=!k&&!Z;return y(Oe,{children:[y("div",{className:ee("item-list-item-content","draggable-item-list-item-content",K),children:[y("span",{className:"title",children:[W,!e&&Z&&y("span",{className:"small text-warning",children:[m(te,{icon:al})," Requires rollup"]})]}),Ft.renderBadge({text:V}),Ft.renderHandle()]}),!k&&y(Oe,{children:[m(z,{kind:"ghost",className:"btn-edit",icon:Pi,tooltip:"Edit Columns",onClick:()=>s(N),disabled:!$}),m(z,{kind:"ghost",className:"btn-delete",icon:un,tooltip:"Delete Aggregation",onClick:()=>S(L)})]})]})},[S,s,e]),D=r.length>0,A=o.length>0;return y("div",{className:"aggregations",children:[D&&y("div",{className:"form-inline",children:[m(Jc,{onChange:C,value:l,children:r.map(N=>m(Zc,{value:N,children:N},N))}),y("button",{type:"button",className:"btn btn-link btn-add",onClick:w,children:[m(te,{icon:vs}),"Add Aggregation"]})]}),D&&A&&m("hr",{}),A&&y(Oe,{children:[!e&&y("div",{className:"form-inline",children:[m("label",{children:"Placement:\xA0"}),y(zi,{onChange:b,value:`${i}`,children:[m(jn,{value:"true",children:"Top"}),m(jn,{value:"false",children:"Bottom"})]})]}),m($o,{onDragStart:p,onDragEnd:f,children:m(Ft,{className:"selected-aggregations",itemCount:o.length,items:o,renderItem:v,offset:0,onSelectionChange:T,onSelect:R,selectedRanges:c,isMultiSelect:!0})})]})]})}const Qu=30;function ju({aggregation:e,columns:t,onChange:n}){const[s,o]=F.exports.useState(-1),[i,r]=F.exports.useState(-1),[l,a]=F.exports.useState(0),{invert:c,selected:d}=e,u=F.exports.useRef(null),h=F.exports.useCallback(b=>d.includes(b)?!c:c,[c,d]),g=F.exports.useMemo(()=>{let b=Qi(t,e.operation);return l!==0&&(b=I.sortColumns(b,l===1)),b},[t,e.operation,l]),p=F.exports.useMemo(()=>s>=0?g.slice(s,i+1).map(b=>({value:b.name,displayValue:b.name,isSelected:h(b.name)})):[],[g,h,i,s]),f=F.exports.useCallback(b=>{const{name:v}=g[b],D=d.indexOf(v);let A=[...d],N=c;D>=0?A.splice(D,1):(A.push(v),A.length===g.length&&(A=[],N=!c)),n({...e,selected:A,invert:N})},[e,c,g,d,n]),C=F.exports.useCallback(()=>{a(0),n({...e,selected:[],invert:!0})},[e,n]),w=F.exports.useCallback((b,v)=>{o(b),r(v)},[o,r]),S=F.exports.useCallback(()=>{d.length===0?n({...e,invert:!c}):n({...e,selected:[],invert:!0})},[e,c,n,d]),T=d.length===0?c:null,R=d.length!==0||!c||l!==0;return y("div",{role:"menu",className:"aggregation-edit",children:[m("div",{className:"top-menu",children:y("div",{className:"form-inline",children:[m(ln,{checked:T,onChange:S,children:"Toggle All"}),m("div",{className:"spacer"}),m($t,{in:R,timeout:Ue.transitionSlowMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:m(z,{kind:"ghost",className:"btn-reset",onClick:C,children:"Reset"})}),m(z,{kind:"ghost",className:ee({active:l===1}),icon:_i,tooltip:"Sort ascending",onClick:()=>a(1)}),m(z,{kind:"ghost",className:ee({active:l===2}),icon:Hi,tooltip:"Sort descending",onClick:()=>a(2)})]})}),m("div",{className:"aggregation-edit-item-list",children:m(xo,{itemCount:g.length,items:p,offset:s,renderItem:({item:b})=>m(ln,{checked:h(b.value),children:b.displayValue}),onSelect:f,onViewportChange:w,rowHeight:Qu,focusSelector:"input",ref:u})})]})}function Zu(e){return m("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...e,children:y("g",{fill:"none",fillRule:"evenodd",children:[m("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),m("path",{fill:"#7DA4FF",d:"M8 26h4v15H8zM15 17h4v24h-4zM22 21h4v20h-4zM29 17h4v24h-4zM36 11h4v30h-4z"})]})})}function Ju(e){return m("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...e,children:y("g",{fill:"none",fillRule:"evenodd",children:[m("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),m("path",{fill:"#7DA4FF",d:"M7 34h4v8H7zM12 31h4v11h-4zM17 27h4v15h-4zM22 22h4v20h-4zM27 27h4v15h-4zM32 29h4v13h-4zM37 31h4v11h-4z"})]})})}function eh(e){return m("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...e,children:y("g",{fill:"none",fillRule:"evenodd",children:[m("path",{fill:"#C1C0C0",d:"M4 4h1v40H4zM44 43v1H5v-1z"}),m("path",{stroke:"#7DA4FF",d:"M7.984 32.44l7.982-11.378 5.273 3.739 9.952-10.838 2.826 1.894 7.45-5.802"}),m("path",{stroke:"#BECDEF",d:"M8.244 37.926L17 33.496l5 .87 10.637-10.35 10.615-1.381"})]})})}function th(e){return m("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...e,children:y("g",{fill:"none",fillRule:"evenodd",children:[m("path",{d:"M24 10c7.732 0 14 6.268 14 14s-6.268 14-14 14-14-6.268-14-14h14V10z",fill:"#80A6FF"}),m("path",{d:"M10 24c0-7.732 6.268-14 14-14v14H10z",fill:"#C1C0C0"})]})})}function nh(e){return m("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...e,children:y("g",{fill:"none",fillRule:"evenodd",children:[m("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),m("path",{fill:"#939293",d:"M44 34v1H4v-1zM44 25v1H4v-1zM44 16v1H4v-1z"}),m("circle",{fill:"#7DA4FF",cx:9.5,cy:37.5,r:1.5}),m("circle",{fill:"#7DA4FF",cx:16.5,cy:30.5,r:1.5}),m("circle",{fill:"#7DA4FF",cx:22.5,cy:36.5,r:1.5}),m("circle",{fill:"#7DA4FF",cx:28.5,cy:30.5,r:1.5}),m("circle",{fill:"#7DA4FF",cx:15.5,cy:38.5,r:1.5}),m("circle",{fill:"#7DA4FF",cx:23.5,cy:25.5,r:1.5}),m("circle",{fill:"#7DA4FF",cx:19.5,cy:19.5,r:1.5}),m("circle",{fill:"#7DA4FF",cx:29.5,cy:19.5,r:1.5}),m("circle",{fill:"#7DA4FF",cx:32.5,cy:26.5,r:1.5}),m("circle",{fill:"#7DA4FF",cx:36.5,cy:13.5,r:1.5})]})})}function sh(e){return y("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[m("rect",{width:"48",height:"48",fill:"none"}),m("rect",{x:"26",y:"10",width:"15",height:"4",fill:"#9FDE70"}),m("rect",{x:"26",y:"22",width:"15",height:"4",fill:"#9FDE70"}),m("rect",{x:"26",y:"28",width:"15",height:"4",fill:"#FFD95C"}),m("rect",{x:"26",y:"34",width:"15",height:"4",fill:"#9FDE70"})]})}function oh(e){return y("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[m("rect",{width:"48",height:"48",fill:"none"}),m("rect",{x:"4",y:"16",width:"40",height:"4",fill:"#FFD95C"}),m("rect",{x:"4",y:"10",width:"40",height:"4",fill:"#78DCE8"}),m("rect",{x:"4",y:"34",width:"40",height:"4",fill:"#78DCE8"})]})}const _r=ie.module("ChartBuilder"),qe=class extends F.exports.PureComponent{static getTypeName(e){switch(e){case E.plot.SeriesPlotStyle.LINE:return"Line";case E.plot.SeriesPlotStyle.BAR:return"Bar";case E.plot.SeriesPlotStyle.SCATTER:return"Scatter";case E.plot.SeriesPlotStyle.PIE:return"Pie";case E.plot.SeriesPlotStyle.HISTOGRAM:return"Histogram";default:return e}}static getTypeIcon(e){switch(e){case E.plot.SeriesPlotStyle.LINE:return m(eh,{});case E.plot.SeriesPlotStyle.BAR:return m(Zu,{});case E.plot.SeriesPlotStyle.SCATTER:return m(nh,{});case E.plot.SeriesPlotStyle.PIE:return m(th,{});case E.plot.SeriesPlotStyle.HISTOGRAM:return m(Ju,{});default:return null}}static getMaxSeriesCount(e){switch(e){case E.plot.SeriesPlotStyle.PIE:return 1;case E.plot.SeriesPlotStyle.HISTOGRAM:return 0;default:return 100}}static getXAxisLabel(e){switch(e){case E.plot.SeriesPlotStyle.PIE:return"Labels";case E.plot.SeriesPlotStyle.HISTOGRAM:return"Data";default:return"X-Axis"}}static getSeriesLabel(e){switch(e){case E.plot.SeriesPlotStyle.PIE:return"Values";default:return"Series"}}static makeSeriesItem(e){return{id:Ln.generate(),value:e}}static makeDefaultSeriesItems(e,t){if(qe.getMaxSeriesCount(e)===0||t==null||t.length===0)return[];const s=t.length>1?t[1].name:t[0].name;return[qe.makeSeriesItem(s)]}static getDefaultXAxis(e,t){return t!=null&&t.length>0?t[0].name:null}constructor(e){super(e),this.handleAddSeries=this.handleAddSeries.bind(this),this.handleLinkStateChange=this.handleLinkStateChange.bind(this),this.handleReset=this.handleReset.bind(this),this.handleSeriesChange=this.handleSeriesChange.bind(this),this.handleSeriesDeleteClick=this.handleSeriesDeleteClick.bind(this),this.handleSubmit=this.handleSubmit.bind(this),this.handleTypeClick=this.handleTypeClick.bind(this),this.handleXAxisChange=this.handleXAxisChange.bind(this),this.sendChange=this.sendChange.bind(this);const{model:t}=e,{columns:n}=t,s=qe.types[0],o=qe.getDefaultXAxis(s,n),i=qe.makeDefaultSeriesItems(s,n);this.state={type:s,seriesItems:i,xAxis:o,isLinked:!0}}handleAddSeries(){this.setState(e=>{const{seriesItems:t}=e,n=[...t],{model:s}=this.props,{columns:o}=s;return n.push({id:Ln.generate(),value:o[0].name}),{seriesItems:n}},this.sendChange)}handleLinkStateChange(e){this.setState({isLinked:e.target.value==="true"},this.sendChange)}handleReset(){const{model:e}=this.props,{columns:t}=e,n=qe.types[0],s=qe.getDefaultXAxis(n,t),o=qe.makeDefaultSeriesItems(n,t),i=!0;this.setState({type:n,seriesItems:o,xAxis:s,isLinked:i},this.sendChange)}handleSeriesChange(e){const{value:t}=e.target,n=e.target.getAttribute("data-index"),s=parseInt(n,10);this.setState(o=>{let{seriesItems:i}=o;return i=[...i],i[s].value=t,{seriesItems:i}},this.sendChange)}handleSeriesDeleteClick(e){const n=e.target.getAttribute("data-index"),s=parseInt(n,10);this.setState(o=>{const{seriesItems:i}=o,r=[...i];return r.splice(s,1),{seriesItems:r}},this.sendChange)}handleSubmit(e){e.preventDefault();const{onSubmit:t}=this.props,{type:n,seriesItems:s,xAxis:o,isLinked:i}=this.state,r=s.map(l=>l.value);t({type:`${n}`,series:r,xAxis:o,isLinked:i})}handleTypeClick(e){const n=e.target.getAttribute("data-index"),s=parseInt(n,10),o=qe.types[s];_r.debug2("handleTypeSelect",o),this.setState(i=>{const r=qe.getMaxSeriesCount(o);let{seriesItems:l}=i;if(l=l.slice(0,r),l.length===0&&r>0){const{model:a}=this.props,{columns:c}=a;l=qe.makeDefaultSeriesItems(o,c)}return{type:o,seriesItems:l}},this.sendChange)}handleXAxisChange(e){const t=e.target.value;_r.debug2("x-axis change",t),this.setState({xAxis:t},this.sendChange)}sendChange(){const{onChange:e}=this.props,{isLinked:t,type:n,seriesItems:s,xAxis:o}=this.state,i=s.map(r=>r.value);e({type:n,series:i,xAxis:o,isLinked:t})}render(){const{model:e}=this.props,{columns:t}=e,{seriesItems:n,type:s,xAxis:o,isLinked:i}=this.state,r=qe.getMaxSeriesCount(s),l=qe.getXAxisLabel(s),a=qe.getSeriesLabel(s),c=n.length>0,d=n.length<r;return m("div",{className:"chart-builder",children:y("form",{onSubmit:this.handleSubmit,children:[y("div",{className:"form-row",children:[m("label",{children:"Select Chart Type"}),m("div",{className:"form-row",children:qe.types.map((u,h)=>{const g=u;return m("div",{className:"col col-chart-type",children:y("button",{type:"button",className:ee("btn","btn-icon","btn-chart-type",{active:u===s}),"data-index":h,onClick:this.handleTypeClick,children:[qe.getTypeIcon(u),qe.getTypeName(u)]})},g)})})]}),m("hr",{}),y("div",{className:"form-row form-inline",children:[m("label",{className:"col-2 label-left",children:l}),m("select",{className:"form-control custom-select select-x-axis col",value:o,onChange:this.handleXAxisChange,children:t.map(u=>m("option",{value:u.name,children:u.name},u.name))})]}),c&&m("hr",{}),n.map((u,h)=>y("div",{className:"form-row form-inline form-series-item","data-testid":`form-series-item-${h}`,children:[m("label",{className:"col-2 label-left",children:h===0?a:""}),m("select",{className:"form-control custom-select select-series col",value:u.value,onChange:this.handleSeriesChange,"data-testid":`select-series-item-${h}`,"data-index":h,children:t.map(g=>m("option",{value:g.name,"data-index":h,children:g.name},g.name))}),n.length>1&&m(z,{kind:"ghost",className:"btn-delete-series ml-2 px-2","data-index":h,"data-testid":`delete-series-${h}`,onClick:this.handleSeriesDeleteClick,icon:un,tooltip:"Delete"})]},u.id)),d&&y("div",{className:"form-row",children:[m("div",{className:"col-2"}),m(z,{kind:"ghost",className:"btn-add-series mt-1",onClick:this.handleAddSeries,icon:vs,children:"Add Series"})]}),y("div",{className:"form-row chart-builder-link",children:[m("label",{className:"col-2 label-right",children:y("div",{className:"fa-md fa-layers",children:[m(te,{mask:Vi,icon:qo,transform:"right-5 down-5"}),m(te,{icon:i?Ya:Xa,transform:"grow-2 right-8 down-6"})]})}),y(zi,{onChange:this.handleLinkStateChange,value:`${i}`,children:[m(jn,{value:"true",children:"Sync State"}),m(jn,{value:"false",children:"Freeze State"})]})]}),y("div",{className:"form-row",children:[m("div",{className:"col-2 label-right"}),m("div",{className:"col chart-builder-link-info",children:i?"Charts with synced state will update to match any filters or user modifications applied to the parent table.":"Freeze State disconnects the chart state from the parent table. New filters or user modifications on the parent table will not be applied."})]}),y("div",{className:ee("form-row","justify-content-end","my-3"),children:[m(z,{kind:"secondary",className:"btn-reset",onClick:this.handleReset,children:"Reset"}),m(z,{kind:"primary",type:"submit",className:"btn-submit",children:"Create"})]})]})})}};let kl=qe;kl.types=[E.plot.SeriesPlotStyle.LINE,E.plot.SeriesPlotStyle.BAR,E.plot.SeriesPlotStyle.SCATTER,E.plot.SeriesPlotStyle.PIE];class Ll extends F.exports.Component{constructor(t){super(t),this.handleContentChanged=this.handleContentChanged.bind(this),this.handleEditorFocus=this.handleEditorFocus.bind(this),this.handleEditorBlur=this.handleEditorBlur.bind(this),this.handleContainerClick=this.handleContainerClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.state={isEditorFocused:!1,isEditorEmpty:!0},this.editorContainer=null}componentDidMount(){this.initEditor()}componentWillUnmount(){this.destroyEditor()}initEditor(){var o;const{value:t,editorSettings:n}=this.props,s={copyWithSyntaxHighlighting:"false",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"groovyDB",lineDecorationsWidth:8,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},scrollBeyondLastLine:!1,padding:{top:6,bottom:6},tabCompletion:"off",useTabStops:!0,value:t,wordWrap:"on",automaticLayout:!0,...n};if(!this.editorContainer)throw new Error("editorContainer is null");this.editor=an.create(this.editorContainer,s),this.editor.layout(),(o=this.editor.getModel())==null||o.updateOptions({tabSize:0}),this.editor.onKeyDown(this.handleKeyDown),this.editor.onDidChangeModelContent(this.handleContentChanged),this.editor.onDidFocusEditorText(this.handleEditorFocus),this.editor.onDidBlurEditorText(this.handleEditorBlur)}destroyEditor(){var t;(t=this.editor)==null||t.dispose(),this.editor=void 0}handleContentChanged(){var s,o;const{onContentChanged:t}=this.props,n=(o=(s=this.editor)==null?void 0:s.getModel())==null?void 0:o.getValue();n!==void 0&&this.setState({isEditorEmpty:n.length===0}),t(n)}handleEditorFocus(){this.setState({isEditorFocused:!0})}handleEditorBlur(){var n,s,o;const t=(o=(s=(n=this.editor)==null?void 0:n.getModel())==null?void 0:s.getValue())!=null?o:"";this.setState({isEditorEmpty:t.length===0,isEditorFocused:!1})}handleContainerClick(){var n;const{isEditorFocused:t}=this.state;t||(n=this.editor)==null||n.focus()}handleKeyDown(t){const{onTab:n,editorIndex:s}=this.props;t.code==="Tab"&&(t.stopPropagation(),t.preventDefault(),n(s,t.shiftKey))}render(){const{value:t,invalid:n}=this.props,{isEditorFocused:s,isEditorEmpty:o}=this.state;return y("div",{className:ee("input-editor-wrapper",{focused:s,invalid:n}),role:"presentation",onClick:this.handleContainerClick,children:[m("div",{className:"editor-container",ref:i=>{this.editorContainer=i}}),o&&!t&&m("div",{className:"editor-placeholder text-muted",children:"Column Formula"})]})}}Ll.defaultProps={value:"",onContentChanged:()=>{},editorSettings:{},editorIndex:0,onTab:()=>{},invalid:!1};const Hr=Object.freeze({NAME:"name",FORMULA:"formula"}),ih=()=>{};function rh({eventKey:e,name:t,inputIndex:n,formula:s,onChange:o,onDeleteColumn:i,onTabInEditor:r,invalid:l,isDuplicate:a}){const c=t===""||Ys.isValidColumnName(t),d=F.exports.useCallback(u=>{u!==void 0&&(u.replace(/(\r\n|\n|\r)/gm,""),o(e,Hr.FORMULA,u))},[o,e]);return m(sl,{draggableId:e,index:n,disableInteractiveElementBlocking:!0,children:(u,h)=>y("div",{className:ee("draggable-container",{dragging:h.isDragging}),ref:u.innerRef,...u.draggableProps,children:[y("div",{className:"custom-column-input-container",children:[y("div",{className:"pb-3",children:[y("div",{className:"d-flex flex-row custom-column-name",children:[m("input",{className:ee("form-control custom-column-input",{"is-invalid":l||!c||a}),placeholder:"Column Name",value:t,onChange:g=>{o(e,Hr.NAME,g.target.value)}}),m(z,{kind:"ghost",className:"ml-1 px-2",onClick:()=>{i(e)},icon:un,tooltip:"Delete custom column"}),m(z,{kind:"ghost",className:"btn-drag-handle",onClick:ih,...u.dragHandleProps,icon:Ui,tooltip:"Drag column to re-order"})]}),(!c||a)&&m("p",{className:"validate-label-error text-danger mb-0 mt-2 pl-1",children:c?"Duplicate name":"Invalid name"})]}),m(Ll,{editorSettings:{language:"deephavenDb"},editorIndex:n,value:s,onContentChanged:d,onTab:r,invalid:l})]}),m("hr",{})]})})}const Ci=[];class ce extends bl{constructor(){super(),this.listenerCount=0}addEventListener(t,n,s){super.addEventListener(t,n,s),this.listenerCount+=1,this.listenerCount===1&&this.startListening()}removeEventListener(t,n,s){super.removeEventListener(t,n,s),this.listenerCount-=1,this.listenerCount===0&&this.stopListening()}startListening(){}stopListening(){}get originalColumns(){return this.columns}get layoutHints(){return null}get frontColumns(){return Ci}get backColumns(){return Ci}get frozenColumns(){return Ci}isColumnFrozen(t){return!1}get isFilterRequired(){return!1}get isReversible(){return!0}get isColumnStatisticsAvailable(){return!1}get description(){return""}get isCustomColumnsAvailable(){return!1}get isFormatColumnsAvailable(){return!1}get isExportAvailable(){return!1}get isValuesTableAvailable(){return!1}get isChartBuilderAvailable(){return!1}get isRollupAvailable(){return!1}get isSelectDistinctAvailable(){return!1}get isTotalsAvailable(){return!1}isFilterable(t){return!1}close(){}isRowMovable(){return!1}get isSeekRowAvailable(){return!1}}ce.EVENT=Object.freeze({UPDATED:"UPDATED",FORMATTER_UPDATED:"FORMATTER_UPDATED",REQUEST_FAILED:"REQUEST_FAILED",COLUMNS_CHANGED:"COLUMNS_CHANGED",TABLE_CHANGED:"TABLE_CHANGED",FILTERS_CHANGED:"FILTERS_CHANGED",SORTS_CHANGED:"SORTS_CHANGED",DISCONNECT:"DISCONNECT",RECONNECT:"RECONNECT",TOTALS_UPDATED:"TOTALS_UPDATED",PENDING_DATA_UPDATED:"PENDING_DATA_UPDATED"});const fs=class extends F.exports.Component{constructor(e){super(e),this.getInput=Re((t,n)=>t.find(s=>s.eventKey===n)),this.getInputIndex=Re((t,n)=>t.findIndex(s=>s.eventKey===n)),this.handleAddColumnClick=this.handleAddColumnClick.bind(this),this.handleSaveClick=this.handleSaveClick.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleDeleteColumn=this.handleDeleteColumn.bind(this),this.handleCustomColumnUpdated=this.handleCustomColumnUpdated.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.resetRequestFailed=this.resetRequestFailed.bind(this),this.handleEditorTabNavigation=this.handleEditorTabNavigation.bind(this),this.state={inputs:[],isCustomColumnApplying:!1,errorMessage:null,hasRequestFailed:!1,isSuccessShowing:!1},this.container=null,this.successButtonTimer=null}static makeCustomColumnInputEventKey(){return Ln.generate()}static createCustomColumnInput(){return{eventKey:Ln.generate(),name:"",formula:""}}componentDidMount(){const{customColumns:e}=this.props;this.parseCustomColumns(e),this.startListening()}componentWillUnmount(){this.stopListening(),this.successButtonTimer&&clearTimeout(this.successButtonTimer)}resetErrorMessage(){this.setState({errorMessage:null})}startListening(){const{model:e}=this.props;e.addEventListener(ce.EVENT.COLUMNS_CHANGED,this.handleCustomColumnUpdated),e.addEventListener(ce.EVENT.UPDATED,this.handleCustomColumnUpdated),e.addEventListener(ce.EVENT.REQUEST_FAILED,this.handleRequestFailed)}stopListening(){const{model:e}=this.props;e.removeEventListener(ce.EVENT.COLUMNS_CHANGED,this.handleCustomColumnUpdated),e.removeEventListener(ce.EVENT.UPDATED,this.handleCustomColumnUpdated),e.removeEventListener(ce.EVENT.REQUEST_FAILED,this.handleRequestFailed)}parseCustomColumns(e){if(e.length>0){const t=e.map(n=>{const s=n.split(/=(.+)/,2);return{eventKey:fs.makeCustomColumnInputEventKey(),name:s[0],formula:s[1]}});this.setState({inputs:t})}else this.setState({inputs:[fs.createCustomColumnInput()]})}handleAddColumnClick(){const{inputs:e}=this.state,t=[...e];t.push(fs.createCustomColumnInput()),this.setState({inputs:t})}handleDeleteColumn(e){const{inputs:t}=this.state,n=this.getInputIndex(t,e),s=[...t];s.splice(n,1),s.length===0&&s.push(fs.createCustomColumnInput()),this.setState({inputs:s})}handleInputChange(e,t,n){const{inputs:s}=this.state,o=this.getInputIndex(s,e),r={...this.getInput(s,e)};r[t]=n;const l=[...s];l.splice(o,1,r),this.setState({inputs:l})}handleCustomColumnUpdated(){const{isCustomColumnApplying:e}=this.state;!e||this.setState({isCustomColumnApplying:!1,isSuccessShowing:!0},()=>{this.successButtonTimer=setTimeout(()=>this.setState({isSuccessShowing:!1}),fs.SUCCESS_SHOW_DURATION)})}handleRequestFailed(e){const t=e,{isCustomColumnApplying:n}=this.state;!n||this.setState({isCustomColumnApplying:!1,errorMessage:y(Oe,{children:[y("p",{children:[m(te,{icon:Kn})," Failed to apply custom columns."]}),y("div",{className:"error-box",children:[t.detail.errorMessage,m("br",{}),"Table configuration:"," ",JSON.stringify(t.detail.configuration)]})]}),hasRequestFailed:!0})}handleDragEnd(e){if(dt.stopDragging(),!e.destination)return;const{inputs:t}=this.state,n=e.source.index,s=e.destination.index,o=[...t],i=t[n];o.splice(n,1),o.splice(s,0,i),this.setState({inputs:o})}handleEditorTabNavigation(e,t){var s,o,i,r;const{inputs:n}=this.state;if(t){((s=this.container)==null?void 0:s.querySelectorAll(".btn-drag-handle")[e]).focus();return}if(e===n.length-1)(i=(o=this.container)==null?void 0:o.querySelector(".btn-add-column"))==null||i.focus();else{const l=e+1;((r=this.container)==null?void 0:r.querySelectorAll(".custom-column-input")[l]).focus()}}handleSaveClick(){const{onSave:e,customColumns:t}=this.props,{inputs:n,isCustomColumnApplying:s}=this.state;if(s)return;const o=[];n.forEach(i=>{const{name:r,formula:l}=i;r&&l&&o.push(`${r}=${l}`)}),this.resetErrorMessage(),this.setState({isCustomColumnApplying:o.length>0||t.length>0}),e(o)}resetRequestFailed(){this.setState(({hasRequestFailed:e})=>e?{hasRequestFailed:!1}:null)}renderInputs(){const{inputs:e,hasRequestFailed:t}=this.state,n=new Map;return e.forEach(({name:s})=>{var o;return n.set(s,((o=n.get(s))!=null?o:0)+1)}),e.map((s,o)=>{var c;const{eventKey:i,name:r,formula:l}=s,a=((c=n.get(r))!=null?c:0)>1;return m(rh,{inputIndex:o,eventKey:i,name:r,formula:l,onChange:this.handleInputChange,onDeleteColumn:this.handleDeleteColumn,onTabInEditor:this.handleEditorTabNavigation,invalid:t,isDuplicate:a},i)})}renderSaveButton(){const{inputs:e,isCustomColumnApplying:t,isSuccessShowing:n}=this.state,s=e.length>1?"Save Columns":"Save Column",o=e.every(({name:l})=>l===""||Ys.isValidColumnName(l)),i=e.filter(({name:l})=>l!=="").map(({name:l})=>l),r=new Set(i).size===i.length;return y(z,{kind:n?"success":"primary",className:ee("btn-apply",{"btn-spinner":t}),disabled:n||t||!o||!r,onClick:this.handleSaveClick,children:[t&&y("span",{children:[m(dn,{}),m("span",{className:"btn-normal-content",children:"Applying"})]}),!n&&!t&&s,n&&y(Oe,{children:[m(te,{icon:rl})," Success"]})]})}render(){const{onCancel:e}=this.props,{errorMessage:t}=this.state;return y("div",{role:"presentation",className:"custom-column-builder-container",ref:n=>{this.container=n},onClick:this.resetRequestFailed,onFocus:this.resetRequestFailed,children:[m("hr",{}),m($o,{onDragStart:dt.startDragging,onDragEnd:this.handleDragEnd,children:m(Oi,{droppableId:"droppable-custom-columns",children:(n,s)=>y("div",{ref:n.innerRef,...n.droppableProps,className:ee("droppable-container",{dragging:s.draggingFromThisWith}),children:[this.renderInputs(),n.placeholder]})})}),m("div",{className:"pt-1 px-3",children:m(z,{kind:"ghost",className:"btn-add-column",onClick:this.handleAddColumnClick,icon:vs,children:"Add Another Column"})}),y("div",{className:"custom-column-builder-footer",children:[t&&m("div",{className:"error-message",children:t}),y("div",{className:"d-flex justify-content-end",children:[m(z,{kind:"secondary",className:"mr-2",onClick:e,children:"Cancel"}),this.renderSaveButton()]})]})]})}};let Pl=fs;Pl.SUCCESS_SHOW_DURATION=750;var Se=(e=>(e.ADVANCED_SETTINGS="ADVANCED_SETTINGS",e.AGGREGATIONS="AGGREGATIONS",e.AGGREGATION_EDIT="AGGREGATIONS_EDIT",e.CHART_BUILDER="CHART_BUILDER",e.CUSTOM_COLUMN_BUILDER="CUSTOM_COLUMN_BUILDER",e.QUICK_FILTERS="QUICK_FILTERS",e.ROLLUP_ROWS="ROLLUP_ROWS",e.SEARCH_BAR="SEARCH_BAR",e.SELECT_DISTINCT="SELECT_DISTINCT",e.TABLE_EXPORTER="TABLE_EXPORTER",e.VISIBILITY_ORDERING_BUILDER="VISIBILITY_ORDERING_BUILDER",e.CONDITIONAL_FORMATTING="CONDITIONAL_FORMATTING",e.CONDITIONAL_FORMATTING_EDIT="CONDITIONAL_FORMATTING_EDIT",e.GOTO="GOTO",e))(Se||{});const Ps=ie.module("RollupRows"),lh=150,Fo="grouped-rollup-rows",Do="ungrouped-rollup-rows",yt=class extends F.exports.Component{constructor(e){super(e),this.search=vt(i=>{const r=this.getSortedUngroupedColumns(),l=[];let a=null;for(let c=0;c<r.length;c+=1)r[c].name.toLowerCase().includes(i.toLowerCase())&&(a==null&&(a=c),l.push([c,c]));M(a),this.setState({ungroupedSelectedRanges:l}),l.length>0&&this.ungroupedList.current&&this.ungroupedList.current.scrollToItem(a)},lh),this.getCachedUngroupedColumns=be((i,r)=>i.filter(l=>yt.isGroupable(l)&&r.find(a=>a===l.name)==null)),this.getCachedSortedColumns=be((i,r)=>r==null?[...i]:I.sortColumns(i,r===yt.SORT.ASCENDING)),this.handleDeleteClicked=this.handleDeleteClicked.bind(this),this.handleSearchChange=this.handleSearchChange.bind(this),this.handleUngroupedSelect=this.handleUngroupedSelect.bind(this),this.handleUngroupedSelectionChange=this.handleUngroupedSelectionChange.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleGroupedSelectionChange=this.handleGroupedSelectionChange.bind(this),this.handleShowConstituentsChange=this.handleShowConstituentsChange.bind(this),this.handleShowNonAggregatedColumnsChange=this.handleShowNonAggregatedColumnsChange.bind(this),this.handleSortAscending=this.handleSortAscending.bind(this),this.handleSortDescending=this.handleSortDescending.bind(this),this.renderGroupedItem=this.renderGroupedItem.bind(this),this.ungroupedList=Fe.createRef(),this.groupedList=Fe.createRef();const{config:t}=e,{columns:n=[],showConstituents:s=!0,showNonAggregatedColumns:o=!0}=t!=null?t:{};this.state={ungroupedSelectedRanges:[],columns:n,groupedSelectedRanges:[],searchFilter:"",showConstituents:s,showNonAggregatedColumns:o,dragSource:null,sort:null}}static renderColumn({item:e,isClone:t,selectedCount:n}){const s=e==null?void 0:e.name,o=t!==void 0&&t?`${n}`:void 0,i=t!==void 0&&t?"item-list-item-clone":"";return Ft.renderTextItem({text:s,badgeText:o,className:i})}static addGroupings(e,t,n=e.length){if(t==null||t.length===0)return e;let s=n;const o=e.filter((i,r)=>t.includes(i)?(r<s&&(s-=1),!1):!0);return o.splice(s,0,...t),o}static isGroupable(e){return!I.isDecimalType(e.type)}componentDidUpdate(e,t){const{config:n}=this.props,{columns:s,showConstituents:o,showNonAggregatedColumns:i}=this.state;n!==e.config?this.updateFromConfig():(s!==t.columns||o!==t.showConstituents||i!==t.showNonAggregatedColumns)&&(n==null||s!==n.columns||o!==n.showConstituents||i!==n.showNonAggregatedColumns)&&this.sendChange()}componentWillUnmount(){this.search.cancel()}handleSearchChange(e){const t=e.target.value;if(this.setState({searchFilter:t}),!t){this.search.cancel(),this.resetSelection();return}this.search(t)}handleSortAscending(){this.setState(({sort:e})=>({sort:e===yt.SORT.ASCENDING?null:yt.SORT.ASCENDING}))}handleSortDescending(){this.setState(({sort:e})=>({sort:e===yt.SORT.DESCENDING?null:yt.SORT.DESCENDING}))}resetSelection(){this.setState({ungroupedSelectedRanges:[],groupedSelectedRanges:[]})}handleDragStart(e){Ps.debug("handleDragStart",e),document.documentElement.classList.add("drag-pointer-events-none"),this.setState({dragSource:e.source})}handleDragEnd(e){Ps.debug("handleDragEnd",e),document.documentElement.classList.remove("drag-pointer-events-none"),this.setState({dragSource:null});const{destination:t,source:n}=e;if(t==null||n==null)return;if(t.droppableId===Do){this.setState(({groupedSelectedRanges:i,columns:r})=>{const l=[...r];return dt.reorder(l,i,[],0),{columns:l,ungroupedSelectedRanges:[],groupedSelectedRanges:[]}});return}const s=n.droppableId===Fo;let o=t.index;s&&n.index<t.index&&(o+=1),this.setState(({columns:i,ungroupedSelectedRanges:r,groupedSelectedRanges:l})=>{const a=[...i],c=s?a:this.getSortedUngroupedColumns().map(p=>p.name),d=s?l:r,u=dt.reorder(c,d,a,o),h=s?dt.adjustDestinationIndex(o,l):o,g=[[h,h+u.length-1]];return{columns:a,ungroupedSelectedRanges:[],groupedSelectedRanges:g}}),this.resetSelection()}handleUngroupedSelect(e){Ps.debug("handleUngroupedSelect"),this.setState(({columns:t})=>({columns:yt.addGroupings(t,[this.getSortedUngroupedColumns()[e].name]),ungroupedSelectedRanges:[],groupedSelectedRanges:[]}))}handleUngroupedSelectionChange(e){Ps.debug2("handleUngroupedSelectionChange",e),this.setState(({ungroupedSelectedRanges:t})=>e===t?null:{ungroupedSelectedRanges:e,groupedSelectedRanges:[]})}handleGroupedSelectionChange(e){Ps.debug2("handleGroupedSelectedRanges",e),this.setState(({groupedSelectedRanges:t})=>e===t?null:{groupedSelectedRanges:e,ungroupedSelectedRanges:[]})}handleDeleteClicked(e){this.setState(({columns:t})=>{const n=t.slice();return n.splice(e,1),{columns:n}})}handleShowConstituentsChange(){this.setState(({showConstituents:e})=>({showConstituents:!e}))}handleShowNonAggregatedColumnsChange(){this.setState(({showNonAggregatedColumns:e})=>({showNonAggregatedColumns:!e}))}updateFromConfig(){const{config:e}=this.props,{columns:t=[],showConstituents:n=!0,showNonAggregatedColumns:s=!0}=e!=null?e:{};this.setState({columns:t,showConstituents:n,showNonAggregatedColumns:s})}sendChange(){const{onChange:e}=this.props,{columns:t,showConstituents:n,showNonAggregatedColumns:s}=this.state;e({columns:t,showConstituents:n,showNonAggregatedColumns:s})}getUngroupedColumns(){const{model:e}=this.props,{columns:t}=this.state,{originalColumns:n}=e;return this.getCachedUngroupedColumns(n,t)}getSortedUngroupedColumns(){const{sort:e}=this.state,t=this.getUngroupedColumns();return this.getCachedSortedColumns(t,e)}renderGroupedItem({item:e,itemIndex:t,isClone:n,selectedCount:s}){const i=`${n!==void 0&&n?"":"\xA0\xA0".repeat(t)}${e}`,r=n!==void 0&&n?`${s}`:void 0,l=n!==void 0&&n?"item-list-item-clone":"";return y(Oe,{children:[Ft.renderTextItem({text:i,badgeText:r,className:l}),(n===void 0||!n)&&m(z,{kind:"ghost",className:"btn btn-link btn-link-icon btn-delete-grouping float-right",onClick:()=>this.handleDeleteClicked(t),children:m(te,{icon:un})})]})}render(){const{columns:e,dragSource:t,searchFilter:n,groupedSelectedRanges:s,ungroupedSelectedRanges:o,showConstituents:i,showNonAggregatedColumns:r,sort:l}=this.state,a=this.getSortedUngroupedColumns();let c=e.length*Ft.DEFAULT_ROW_HEIGHT;(t==null?void 0:t.droppableId)===Do&&(c+=Ft.DEFAULT_ROW_HEIGHT);const d=a.length*Ft.DEFAULT_ROW_HEIGHT+10,u=Math.min(3*Ft.DEFAULT_ROW_HEIGHT,d);return m("div",{role:"menu",className:ee("rollup-rows",{"is-dragging":t!=null}),tabIndex:0,children:y($o,{onDragEnd:this.handleDragEnd,onDragStart:this.handleDragStart,children:[y("div",{className:"rollup-rows-group-by",children:[m("div",{className:"section-title",children:"Group By"}),e.length===0&&m(Oi,{droppableId:"placeholder",children:(h,g)=>m("div",{className:ee("placeholder","text-muted",{"is-dragging-from-this":g.draggingFromThisWith,"is-dragging-over":g.isDraggingOver,"is-dropping":g.draggingOverWith}),ref:h.innerRef,...h.droppableProps,children:"Create rollup by dragging columns here, from the available columns list below."})}),e.length>0&&m(Ft,{draggingItemClassName:"rollup-rows-dragging-grouped-item",draggablePrefix:Fo,droppableId:Fo,itemCount:e.length,items:e,offset:0,onSelectionChange:this.handleGroupedSelectionChange,ref:this.groupedList,renderItem:this.renderGroupedItem,selectedRanges:s,style:{height:c},isMultiSelect:!0})]}),y("div",{className:"rollup-rows-available-columns",children:[m("div",{className:"section-title",children:"Available Grouping Columns"}),y("div",{className:"top-menu",children:[m(Xs,{className:"w-100",value:n,matchCount:n?o.length:void 0,placeholder:"Find column...",onChange:this.handleSearchChange}),y(z,{kind:"ghost",className:ee("btn-link btn-link-icon",{active:l===yt.SORT.ASCENDING}),onClick:this.handleSortAscending,children:[m(te,{icon:_i}),m(Rt,{children:"Sort ascending"})]}),y(z,{kind:"ghost",className:ee("btn-link btn-link-icon",{active:l===yt.SORT.DESCENDING}),onClick:this.handleSortDescending,children:[m(te,{icon:Hi}),m(Rt,{children:"Sort descending"})]})]}),m(Ft,{className:"rollup-available-grouping-columns",draggablePrefix:Do,droppableId:Do,itemCount:a.length,items:a,renderItem:yt.renderColumn,offset:0,onSelect:this.handleUngroupedSelect,onSelectionChange:this.handleUngroupedSelectionChange,ref:this.ungroupedList,selectedRanges:o,style:{maxHeight:d,minHeight:u},isDropDisabled:(t==null?void 0:t.droppableId)!==Fo,isMultiSelect:!0}),y("div",{className:"bottom-menu",children:[m("div",{className:"label",children:"Show:"}),m(ln,{checked:i,onChange:this.handleShowConstituentsChange,children:"Constituents"}),m(ln,{checked:r,onChange:this.handleShowNonAggregatedColumnsChange,children:"Non-Aggregated Columns"})]})]})]})})}};let er=yt;er.SORT=Object.freeze({ASCENDING:"ASC",DESCENDING:"DESC"});er.defaultProps={config:null,onChange:()=>{}};const ah=ie.module("TableCsvExporter"),Ie=class extends F.exports.Component{static getDateString(){return E.i18n.DateTimeFormat.format(Ie.FILENAME_DATE_FORMAT,new Date)}constructor(e){super(e),this.handleDownloadClick=this.handleDownloadClick.bind(this),this.handleDownloadRowOptionChanged=this.handleDownloadRowOptionChanged.bind(this),this.handleCustomizedDownloadRowOptionChanged=this.handleCustomizedDownloadRowOptionChanged.bind(this),this.handleCustomizedDownloadRowsChanged=this.handleCustomizedDownloadRowsChanged.bind(this),this.handleIncludeColumnHeadersChanged=this.handleIncludeColumnHeadersChanged.bind(this),this.handleIncludeHiddenColumnsChanged=this.handleIncludeHiddenColumnsChanged.bind(this),this.handleUseUnformattedValuesChanged=this.handleUseUnformattedValuesChanged.bind(this);const{name:t}=e;this.state={fileName:`${t}-${Ie.getDateString()}.csv`,downloadRowOption:Ie.DOWNLOAD_ROW_OPTIONS.ALL_ROWS,customizedDownloadRowOption:Ie.CUSTOMIZED_ROWS_OPTIONS.FIRST,customizedDownloadRows:Ie.DEFAULT_DOWNLOAD_ROWS,includeColumnHeaders:!0,includeHiddenColumns:!1,useUnformattedValues:!1,errorMessage:null,id:Ln.generate()}}getSnapshotRanges(){const{model:e,selectedRanges:t}=this.props,{downloadRowOption:n,customizedDownloadRowOption:s,customizedDownloadRows:o}=this.state,{rowCount:i,columnCount:r}=e;let l=[];switch(n){case Ie.DOWNLOAD_ROW_OPTIONS.ALL_ROWS:l.push(new Q(0,0,r-1,i-1));break;case Ie.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS:l=t.map(a=>({...a,startColumn:0,endColumn:r-1})).sort((a,c)=>a.startRow!=null&&c.startRow!=null?a.startRow-c.startRow:0);break;case Ie.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS:switch(s){case Ie.CUSTOMIZED_ROWS_OPTIONS.FIRST:l.push(new Q(0,0,r-1,Math.min(o-1,i-1)));break;case Ie.CUSTOMIZED_ROWS_OPTIONS.LAST:l.push(new Q(0,Math.max(0,i-o),r-1,i-1));break}break}return l}getModelRanges(e){const{userColumnWidths:t,movedColumns:n}=this.props,{includeHiddenColumns:s}=this.state,o=J.getHiddenColumns(t);let i=H.getModelRanges(e,n);if(!s&&o.length>0){const r=o.map(Q.makeColumn);i=Q.subtractRangesFromRanges(i,r)}return i}resetDownloadState(){this.setState({errorMessage:null})}async handleDownloadClick(){const{model:e,isDownloading:t,onDownloadStart:n,onDownload:s,onCancel:o}=this.props,{fileName:i,includeColumnHeaders:r,useUnformattedValues:l}=this.state;if(t){o();return}this.resetDownloadState();const a=this.getSnapshotRanges(),c=this.getModelRanges(a);if(this.validateOptionInput()){n();try{const d=await e.export(),u=d.setViewport(0,0);await u.getViewportData(),s(i,d,u,a,c,r,l)}catch(d){ah.error("CSV download failed",d),this.setState({errorMessage:y("p",{children:[m(te,{icon:Kn})," ",`${d}`]})}),o()}}}handleDownloadRowOptionChanged(e){this.setState({downloadRowOption:e.target.value})}handleCustomizedDownloadRowOptionChanged(e){this.setState({customizedDownloadRowOption:e.target.value})}handleCustomizedDownloadRowsChanged(e){this.setState({customizedDownloadRows:parseInt(e.target.value,10)})}handleIncludeColumnHeadersChanged(){this.setState(({includeColumnHeaders:e})=>({includeColumnHeaders:!e}))}handleIncludeHiddenColumnsChanged(){this.setState(({includeHiddenColumns:e})=>({includeHiddenColumns:!e}))}handleUseUnformattedValuesChanged(){this.setState(({useUnformattedValues:e})=>({useUnformattedValues:!e}))}validateOptionInput(){const{selectedRanges:e}=this.props,{downloadRowOption:t,customizedDownloadRows:n}=this.state;return t===Ie.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS&&e.length===0?(this.setState({errorMessage:y("p",{children:[m(te,{icon:Kn})," No rows selected. Please select some rows in the table."]})}),!1):t===Ie.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS&&n<=0?(this.setState({errorMessage:y("p",{children:[m(te,{icon:Kn})," Number of rows to output must be greater than 0"]})}),!1):!0}render(){const{model:e,isDownloading:t,tableDownloadProgress:n,tableDownloadEstimatedTime:s,selectedRanges:o,tableDownloadStatus:i}=this.props,{fileName:r,downloadRowOption:l,customizedDownloadRowOption:a,customizedDownloadRows:c,includeColumnHeaders:d,includeHiddenColumns:u,useUnformattedValues:h,errorMessage:g,id:p}=this.state,{rowCount:f}=e;return y("div",{className:"table-csv-exporter",children:[m("div",{className:"section-title",children:"Download Rows"}),m("div",{className:"form-group",children:y(zi,{onChange:this.handleDownloadRowOptionChanged,value:l,disabled:t,children:[y(jn,{value:Ie.DOWNLOAD_ROW_OPTIONS.ALL_ROWS,"data-testid":"radio-csv-exporter-download-all",children:["All Rows",m("span",{className:"text-muted ml-2",children:`(${f.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")} rows)`})]}),y(jn,{value:Ie.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS,"data-testid":"radio-csv-exporter-only-selected",children:["Only Selected Rows",m("span",{className:"text-muted ml-2",children:o.length>0?`(${Q.rowCount(o).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")} rows)`:null})]}),m(jn,{value:Ie.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS,"data-testid":"radio-csv-exporter-customized-rows",children:y("div",{className:"radio-input-row",role:"presentation",onClick:()=>{this.setState({downloadRowOption:Ie.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS})},children:[y("select",{value:a,"data-testid":"select-csv-exporter-customized-rows",className:"custom-select",disabled:t,onChange:this.handleCustomizedDownloadRowOptionChanged,children:[m("option",{value:"FIRST",children:"First"}),m("option",{value:"LAST",children:"Last"})]}),m("input",{type:"number",className:"form-control",id:`customizedRows-${p}`,"data-testid":"input-csv-exporter-customized-rows",name:`customizedRows-${p}`,placeholder:"100",value:c,disabled:t,onChange:this.handleCustomizedDownloadRowsChanged}),m("div",{children:"Rows"})]})})]})}),y("div",{className:"form-group",children:[m("label",{htmlFor:`customizedRows-${p}`,children:"File Name"}),m("input",{type:"text",className:"form-control",id:`filename-${p}`,"data-testid":"input-csv-exporter-file-name",name:`filename-${p}`,value:r,onChange:C=>{this.setState({fileName:C.target.value})},disabled:t})]}),y("div",{className:"checkbox-options",children:[m(ln,{checked:d,onChange:this.handleIncludeColumnHeadersChanged,children:"Include column headers"}),m(ln,{checked:u,onChange:this.handleIncludeHiddenColumnsChanged,children:"Include hidden columns"}),m(ln,{checked:h,onChange:this.handleUseUnformattedValuesChanged,children:"Use unformatted values"})]}),y("div",{className:"section-footer flex-column",children:[g!=null&&m("div",{className:"error-message",children:g}),i&&y("div",{className:"download-status",children:[(i===Ie.DOWNLOAD_STATUS.DOWNLOADING||i===Ie.DOWNLOAD_STATUS.INITIATING)&&y(Oe,{children:[i===Ie.DOWNLOAD_STATUS.INITIATING&&m("div",{className:"text-muted",children:"Starting Download..."}),i===Ie.DOWNLOAD_STATUS.DOWNLOADING&&y("div",{className:"text-muted d-flex justify-content-between",children:[m("span",{children:s||s===0?`Estimated time: ${Bi.formatElapsedTime(s)}`:null}),m("span",{children:`${n}%`})]})]}),i===Ie.DOWNLOAD_STATUS.FINISHED&&m("div",{className:"text-muted text-right",children:"Download Completed"}),i===Ie.DOWNLOAD_STATUS.CANCELED&&m("div",{className:"text-muted",children:"Download Canceled"}),(i===Ie.DOWNLOAD_STATUS.DOWNLOADING||i===Ie.DOWNLOAD_STATUS.INITIATING)&&m("div",{className:"progress",children:m("div",{className:"progress-bar progress-bar-striped progress-bar-animated",style:{width:`${n}%`}})}),i===Ie.DOWNLOAD_STATUS.FINISHED&&m("div",{className:"progress",children:m("div",{className:"progress-bar bg-success",style:{width:`${n}%`}})})]}),y(z,{kind:"primary","data-testid":"btn-csv-exporter-download",className:ee("btn-downloading",{"btn-spinner btn-cancelable":t}),onClick:this.handleDownloadClick,children:[t&&y("span",{children:[m(dn,{}),m("span",{className:"btn-normal-content",children:"Downloading"}),m("span",{className:"btn-hover-content",children:"Cancel"})]}),!t&&"Download"]})]})]})}};let gt=Ie;gt.FILENAME_DATE_FORMAT="yyyy-MM-dd-HHmmss";gt.DOWNLOAD_STATUS={INITIATING:"INITIATING",DOWNLOADING:"DOWNLOADING",FINISHED:"FINISHED",CANCELED:"CANCELED"};gt.DOWNLOAD_ROW_OPTIONS={ALL_ROWS:"ALL_ROWS",SELECTED_ROWS:"SELECTED_ROWS",CUSTOMIZED_ROWS:"CUSTOMIZED_ROWS"};gt.CUSTOMIZED_ROWS_OPTIONS={FIRST:"FIRST",LAST:"LAST"};gt.DEFAULT_DOWNLOAD_ROWS=100;gt.defaultProps={onDownloadStart:()=>{},isDownloading:!1,tableDownloadStatus:"",tableDownloadProgress:0,tableDownloadEstimatedTime:null,selectedRanges:[]};const Zt=ie.module("TableSaver"),ch="yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS z";function uh(e){return e.added!==void 0}function hh(e){if(!uh(e))throw new Error("event is not UpdateEventData")}const Dn=class extends F.exports.PureComponent{constructor(e){var t,n;super(e),this.WritableStream=(t=window.WritableStream)!=null?t:mr,this.getCachedCustomColumnFormatFlag=pt(Zn.isCustomColumnFormatDefined,{max:1e4}),this.handlePortMessage=this.handlePortMessage.bind(this),this.handleSnapshotResolved=this.handleSnapshotResolved.bind(this),this.handleDownloadTimeout=this.handleDownloadTimeout.bind(this),this.state={},this.gridRanges=[],this.gridRangeCounter=0,this.rangedSnapshotsTotal=[],this.rangedSnapshotCounter=0,this.includeColumnHeaders=!0,this.useUnformattedValues=!1,this.snapshotsTotal=0,this.snapshotCounter=0,this.snapshotsBuffer=new Map,this.currentSnapshotIndex=0,this.snapshotPending=0,this.cancelableSnapshots=[],this.WritableStream=(n=window.WritableStream)!=null?n:mr,this.iframes=[],this.useBlobFallback=!1}static csvEscapeString(e){return`"${e.replace(/"/g,'""')}"`}componentDidMount(){const{getDownloadWorker:e}=this.props;e().then(t=>{Zt.info("found active service worker"),this.sw=t,this.sw.postMessage("ping")}).catch(t=>{Zt.warn("Download csv is not optimized.",t),this.useBlobFallback=!0})}componentWillUnmount(){this.iframes.length>0&&this.iframes.forEach(e=>{e.remove()}),this.streamTimeout&&clearTimeout(this.streamTimeout),this.snapshotHandlerTimeout&&clearTimeout(this.snapshotHandlerTimeout)}createWriterStream(e){const t=this.useBlobFallback,n=[];let s=null;t&&(s=TextEncoder.prototype.encode.bind(new TextEncoder));const{fileName:o}=this,i={};return t?(i.write=r=>{M(s),r.header!==void 0&&n.push(s(r.header)),r.rows!==void 0&&n.push(s(r.rows))},i.close=()=>{M(o);const r=new Blob(n,{type:"application/octet-stream; charset=utf-8"}),l=document.createElement("a");l.href=URL.createObjectURL(r),l.download=o,l.click()},i.abort=()=>{e.postMessage({cancel:!0}),e.close()}):(i.write=r=>{e.postMessage(r)},i.close=()=>{e.postMessage({end:!0}),e.close()},i.abort=()=>{e.postMessage({cancel:!0}),e.close()}),new this.WritableStream(i)}startDownload(e,t,n,s,o,i,r){const{isDownloading:l}=this.props;if(l)return;this.downloadStartTime=Date.now(),Zt.info(`start downloading ${e}`),this.table=t,this.columns=J.columnsFromRanges(o,t.columns),this.tableSubscription=n,this.gridRanges=s,this.includeColumnHeaders=i,this.useUnformattedValues=r;const a=encodeURIComponent(e.replace(/\//g,":")).replace(/['()]/g,escape).replace(/\*/g,"%2A"),c=new MessageChannel;if(this.port=c.port1,this.fileName=e,this.fileWriter=this.createWriterStream(this.port).getWriter(),this.useBlobFallback){this.writeCsvTable(i);return}this.sw&&this.sw.postMessage({encodedFileName:a},[c.port2]),this.port.onmessage=this.handlePortMessage}finishDownload(){this.table&&this.table.close(),this.tableSubscription&&this.tableSubscription.close(),this.fileWriter&&this.fileWriter.close();const{onDownloadCompleted:e}=this.props;e(),this.resetTableSaver(),this.downloadStartTime!==void 0&&Zt.info(`download finished, total elapsed time ${(Date.now()-this.downloadStartTime)/1e3} seconds`)}cancelDownload(){this.table&&this.table.close(),this.tableSubscription&&this.tableSubscription.close(),this.fileWriter&&this.fileWriter.abort(),this.cancelableSnapshots.forEach(t=>{t&&(t.catch(()=>null),t.cancel())});const{onDownloadCanceled:e}=this.props;e(),this.resetTableSaver()}resetTableSaver(){this.table=void 0,this.tableSubscription=void 0,this.columns=void 0,this.chunkRows=void 0,this.gridRanges=[],this.gridRangeCounter=0,this.rangedSnapshotsTotal=[],this.rangedSnapshotCounter=0,this.includeColumnHeaders=!0,this.useUnformattedValues=!1,this.snapshotsTotal=0,this.snapshotCounter=0,this.snapshotsBuffer=new Map,this.currentSnapshotIndex=0,this.snapshotPending=0,this.cancelableSnapshots=[],this.streamTimeout!=null&&clearTimeout(this.streamTimeout),this.snapshotHandlerTimeout!=null&&clearTimeout(this.snapshotHandlerTimeout),this.streamTimeout=void 0,this.snapshotHandlerTimeout=void 0}handleDownloadTimeout(){Zt.info("download canceled"),this.cancelDownload()}writeTableHeader(){var t;let e="";if(this.columns)for(let n=0;n<this.columns.length;n+=1)e+=this.columns[n].name,e+=n===this.columns.length-1?`
1
+ import{A as F,R as Fe,C as m,E as ee,T as Ca,F as y,J as te,D as $t,K as Oe,L as Ln,U as Be,H as be,V as yi,B,W as Re,S as wa,I as vt,X as rt,Y as $o,O as sl,Q as Oi,Z as mr,_ as Sa,$ as Wt,a0 as ba,a1 as Ta,a2 as Ea,a3 as va,a4 as Fi,a5 as Ra,a6 as ya,a7 as Fa,a8 as gr,a9 as Da,aa as Ia,ab as pr,ac as Na,ad as Aa,ae as Ma,af as Oa,ag as xa,ah as Pn,ai as ka,aj as Di,ak as ol}from"./vendor.cad6ca1e.js";import{P as Ge,C as _n,a as La,u as Pa,B as z,v as _a,b as Ha,c as Va,d as Ua,e as qs,T as Ue,E as ve,f as il,L as ie,g as Qn,h as dn,i as rl,j as on,k as zo,l as xi,m as ki,n as Oo,r as Ve,M as le,K as he,o as Rt,p as se,q as Qt,G as Li,s as jn,t as Ba,w as Ga,x as Xn,y as ll,z as Wa,A as $a,D as za,F as qa,H as un,S as Ya,I as vs,J as fr,N as al,O as Dt,Q as Pi,R as Zn,U as ln,V as _i,W as Hi,X as xo,Y as Vi,Z as qo,_ as Xa,$ as Ka,a0 as Ys,a1 as Ui,a2 as Xs,a3 as Bi,a4 as Qa,a5 as ko,a6 as ja,a7 as Gi,a8 as cl,a9 as Za,aa as Ja,ab as ec,ac as tc,ad as nc,ae as sc,af as oc,ag as dl,ah as Cr,ai as di,aj as ic,ak as rc,al as Ss,am as lc,an as ul,ao as ac,ap as cc,aq as hl,ar as wr,as as dc,at as uc,au as hc,av as mc,aw as gc,ax as ml,ay as pc,az as fc,aA as Sr,aB as Cc,aC as br,aD as wc,aE as Sc,aF as bc,aG as Tc,aH as Ec,aI as vc,aJ as Rc,aK as yc,aL as Fc,aM as Dc,aN as Ic,aO as Nc,aP as Ac,aQ as Mc,aR as Oc,aS as xc,aT as kc,aU as Lc,aV as Pc,aW as _c,aX as Hc,aY as Vc,aZ as Uc,a_ as Me}from"./index.0501e2dc.js";import{e as an,l as ps,K as Et,a as Tr,b as Mn}from"./monaco.e84eddf6.js";import{P as Lo,b as Bc,h as Gc,p as Wc,o as $c,s as zc,t as qc,c as ui}from"./plotly.d8b7bba2.js";import"./helpers.162e09a8.js";class Yo{static isDark(t){const n=document.createElement("div");n.style.display="none",n.style.color=t;const s=getComputedStyle(document.body.appendChild(n)).color,o=s.match(/\d+/g);let i=[];if(o)i=o.map(l=>parseInt(l,10));else throw new Error(`Invalid color received. Got ${s}`);return document.body.removeChild(n),Yo.getBrightness(i)<125}static getBrightness(t){return Math.round((t[0]*299+t[1]*587+t[2]*114)/1e3)}}function Yc(e,t){return e?e.closest(`.${t}`):null}const Xc={getClosestByClassName:Yc};class Xo{constructor(){this.pending=[],this.resolved=[]}add(t,n){const s=Ge.makeCancelable(t,n);return this.pending.push(s),s.then(()=>{this.resolve(s)},()=>{this.resolve(s)}),s}remove(t){for(let n=0;n<this.pending.length;n+=1)if(this.pending[n]===t){this.pending.splice(n,1);return}}resolve(t){this.remove(t),this.resolved.push(t)}cancel(){const t=[...this.pending,...this.resolved];for(let n=0;n<t.length;n+=1)t[n].cancel();this.pending=[],this.resolved=[]}}function M(e){if(e==null)throw new Error("Value is null or undefined")}class Wi{static join(t,n="and"){if(t==null||t.length===0)return"";if(t.length===1)return t[0];if(t.length===2)return`${t[0]} ${n} ${t[1]}`;const s=t.slice(0,t.length-1).join(", "),o=t[t.length-1];return`${s}, ${n} ${o}`}static toLower(t,n=!0){if(t==null){if(n)return"";throw new Error("Null string passed in to TextUtils.toLower")}return t.toLowerCase()}static sort(t,n,s=!0){return t<n?s?-1:1:t>n?s?1:-1:0}}class Kc extends Error{constructor(){super(...arguments),this.isInvalid=!0}}class Qc extends F.exports.Component{constructor(t){super(t),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=Fe.createRef(),this.openMenu=Fe.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){var t;(t=this.container.current)!=null&&t.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){var t;(t=this.container.current)!=null&&t.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}handleContextMenu(t){if(!_n.isContextActionEvent(t)||!this.container.current||t.metaKey||t.ctrlKey)return;const n=_n.getMenuItems(t.contextActions),s=this.container.current.getBoundingClientRect(),o=t.clientY-s.top,i=t.clientX-s.left;if(n.length===0){if(t.target===this.container.current){t.preventDefault(),this.setState({actions:null},()=>{const r=document.elementFromPoint(i,o),l=new MouseEvent("contextmenu",{clientX:t.clientX,clientY:t.clientY,bubbles:!0,cancelable:!0});r==null||r.dispatchEvent(l)});return}return}t.preventDefault(),this.setState({actions:n,top:o,left:i})}handleMenuClose(t){t===this.openMenu.current&&this.setState({actions:null})}render(){let t=null;const{"data-testid":n}=this.props,{actions:s,top:o,left:i}=this.state;return s&&(t=m(La,{ref:this.openMenu,actions:s,onMenuClosed:this.handleMenuClose,top:o,left:i,updatePosition:(r,l)=>{this.setState({top:r,left:l})},"data-testid":n})),m("div",{className:ee("context-menu-root",{active:s}),ref:this.container,children:t})}}function $i(e){const t=F.exports.useRef();return F.exports.useEffect(function(){t.current=e}),t.current}function gl({copy:e,kind:t="ghost",tooltip:n="Copy",className:s,"data-testid":o,children:i}){const[r,l]=Pa();return m(z,{kind:t,className:s,"data-testid":o,icon:r?_a:Ha,tooltip:r?"Copied":n,onClick:()=>{l(typeof e=="function"?e():e)},children:i})}class dt{static reorder(t,n,s,o){const i=t===s?dt.adjustDestinationIndex(o,n):o,r=dt.removeItems(t,n);return s.splice(i,0,...r),r}static removeItems(t,n){const s=[],o=n.map((i,r)=>({range:i,index:r})).sort((i,r)=>r.range[0]-i.range[0]);for(let i=0;i<o.length;i+=1){const{range:r,index:l}=o[i],[a,c]=r;s[l]=t.splice(a,c-a+1)}return Ca(s)}static adjustDestinationIndex(t,n){let s=t;for(let o=0;o<n.length;o+=1){const[i,r]=n[o];if(i>t)break;s-=Math.min(r,t-1)-i+1}return s}static startDragging(){document.documentElement.classList.add("drag-pointer-events-none")}static stopDragging(){document.documentElement.classList.remove("drag-pointer-events-none")}}function pl({on:e,id:t,className:n,isInvalid:s,disabled:o=!1,onClick:i,"data-testid":r}){return m("button",{type:"button",className:ee("btn","btn-switch",n,{active:e},{"is-invalid":s}),id:t,onClick:i,disabled:o,"data-testid":r,children:m("div",{className:"handle"})})}function Er(e){return e.isOn!==void 0}function jc({item:e,onSelect:t=()=>{},"data-testid":n}){const{icon:s,subtitle:o,title:i}=e,r=F.exports.useMemo(()=>Er(e)?()=>{e.onChange(!e.isOn)}:t,[e,t]);return y("div",{className:"btn btn-navigation-menu-item","data-testid":`menu-item-${i}`,onClick:r,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&r()},tabIndex:0,role:"menuitem",children:[s!==void 0&&m("div",{className:"icon",children:m(te,{icon:s})}),m("div",{className:"title",children:i}),o!==void 0&&m("div",{className:"shortcut",children:o}),m("div",{className:"accessory","data-testid":n,children:Er(e)?m(pl,{on:e.isOn,onClick:l=>{l.stopPropagation(),r()}}):m(te,{icon:Va})})]})}function fl({items:e,onSelect:t=()=>{},"data-testid":n}){return m("div",{className:"navigation-menu-view","data-testid":n,children:m("ul",{className:"navigation-menu-list",children:e.map((s,o)=>m("li",{children:m(jc,{item:s,onSelect:()=>{t(o)}})},s.title))})})}function vr({children:e,onBack:t,onClose:n,title:s,"data-testid":o}){return y("div",{className:"navigation-page","data-testid":o,children:[y("div",{className:"navigation-title-bar",children:[m("div",{className:"navigation-left-buttons",children:t!==void 0&&m(z,{kind:"ghost",className:"btn-back","data-testid":"btn-page-back",onClick:t,icon:Ua,children:"Back"})}),m("div",{className:"navigation-title",children:s}),m("div",{className:"navigation-right-buttons",children:n!==void 0&&m(z,{kind:"ghost",className:"btn-close px-2 m-1","data-testid":"btn-page-close",onClick:n,icon:qs,tooltip:"Close"})})]}),m("div",{className:"navigation-content",children:e})]})}function Zc({children:e,"data-testid":t}){const n=F.exports.useMemo(()=>Fe.Children.toArray(e),[e]),s=$i(n),[o,i]=F.exports.useState(n[n.length-1]),[r,l]=F.exports.useState(null),[a,c]=F.exports.useState(null);F.exports.useEffect(function(){if(s===void 0||n===s)return;const g=n[n.length-1];n.length===s.length||s.length===0||r!==null||a!==null?r!==null&&g!==r?l(g):g!==a&&g!==o&&i(g):n.length>s.length?l(g):n.length<s.length&&(i(g),c(s[s.length-1]))},[n,s,r,a,o]);const d=F.exports.useCallback(()=>{i(r),l(null)},[r]),u=F.exports.useCallback(()=>{c(null)},[]);return y("div",{className:"navigation-stack",children:[m("div",{className:"main-view","data-testid":t,children:o}),m($t,{in:a!=null,timeout:Ue.transitionMidMs,classNames:"slide-right",onEntered:u,children:m(Oe,{children:a!=null&&m("div",{className:"popping-view",children:a})})}),m($t,{in:r!=null,timeout:Ue.transitionMidMs,classNames:"slide-left",onEntered:d,children:m(Oe,{children:r!=null&&m("div",{className:"pushing-view",children:r})})})]})}function Jc({children:e,disabled:t,value:n,"data-testid":s}){return m("option",{value:n,disabled:t,"data-testid":s,children:e})}function zi(e){const{children:t,disabled:n=!1,name:s,onChange:o,value:i="","data-testid":r}=e,[l]=F.exports.useState(s!=null?s:Ln());return m(Oe,{children:Fe.Children.map(t,a=>{var c,d;return a?Fe.cloneElement(a,{name:l,onChange:(c=a.props.onChange)!=null?c:o,checked:i===a.props.value,disabled:(d=a.props.disabled)!=null?d:n,"data-testid":r}):null})})}function ed({children:e,onBlur:t,onChange:n,className:s,defaultValue:o,name:i,value:r,disabled:l,"data-testid":a}){const c=F.exports.useCallback(d=>{n(d.target.value)},[n]);return m("select",{className:ee("custom-select",s),onBlur:t,onChange:c,defaultValue:o,value:r,name:i,disabled:l,"data-testid":a,children:e})}class Cl extends Error{constructor(){super(...arguments),this.isAssertionFailed=!0}}function Rr(e){if(e==null)throw new Cl(`Expected 'val' to be defined, but received ${e}`)}class hi extends Error{constructor(){super(...arguments),this.isPasteError=!0}}function ke(e){return(e==null?void 0:e.isEditable)!==void 0}function yr(e){if(!ke(e))throw new Cl(`Expected 'model' to be editable, but received ${e}`)}function Ae(e){return(e==null?void 0:e.hasExpandableRows)!==void 0}var At=(e=>(e.DOWN="DOWN",e.UP="UP",e.LEFT="LEFT",e.RIGHT="RIGHT",e))(At||{});const ae=class{static normalize(e,t,n,s){let o=e,i=t,r=n,l=s;return o!=null&&r!=null&&r<o&&(o=r,r=e),i!=null&&l!=null&&l<i&&(i=l,l=t),[o,i,r,l]}static makeNormalized(e,t,n,s){return new ae(...ae.normalize(e,t,n,s))}static makeCell(e,t){return new ae(e,t,e,t)}static makeColumn(e){return new ae(e,null,e,null)}static makeRow(e){return new ae(null,e,null,e)}static minOrNull(e,t){return e==null||t==null?null:Math.min(e,t)}static maxOrNull(e,t){return e==null||t==null?null:Math.max(e,t)}static consolidate(e){const t=e.slice();let n=!0;for(;n;){n=!1;for(let s=0;s<t.length&&!n;s+=1){const o=t[s];for(let i=t.length-1;i>s;i-=1){const r=t[i];if(o.contains(r))t.splice(i,1);else if(r.contains(o)){n=!0,t[s]=r,t.splice(i,1);break}else if(o.startRow===r.startRow&&o.endRow===r.endRow){if(o.touches(r)){const{startRow:l,endRow:a}=o,c=ae.minOrNull(o.startColumn,r.startColumn),d=ae.maxOrNull(o.endColumn,r.endColumn);n=!0,t[s]=new ae(c,l,d,a),t.splice(i,1);break}}else if(o.startColumn===r.startColumn&&o.endColumn===r.endColumn&&o.touches(r)){const{startColumn:l,endColumn:a}=o,c=ae.minOrNull(o.startRow,r.startRow),d=ae.maxOrNull(o.endRow,r.endRow);n=!0,t[s]=new ae(l,c,a,d),t.splice(i,1);break}}}}return t}static isAxisRangeTouching(e,t,n,s){return e==null?t==null||n==null?!0:n<=t+1:t==null?s==null?!0:s>=e-1:n==null?s==null?!0:e<=s+1:s==null?t>=n-1:n>=e-1?n<=t+1:s>=e-1}static rangeArraysEqual(e,t){if(e===t)return!0;if(e==null||t==null||e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(!e[n].equals(t[n]))return!1;return!0}static intersection(e,t){if(e.equals(t))return e;let{startColumn:n,startRow:s,endColumn:o,endRow:i}=e;return n=n!=null&&t.startColumn!=null?Math.max(n,t.startColumn):n!=null?n:t.startColumn,o=o!=null&&t.endColumn!=null?Math.min(o,t.endColumn):o!=null?o:t.endColumn,s=s!=null&&t.startRow!=null?Math.max(s,t.startRow):s!=null?s:t.startRow,i=i!=null&&t.endRow!=null?Math.min(i,t.endRow):i!=null?i:t.endRow,n!=null&&n>(o!=null?o:-1)||s!=null&&s>(i!=null?i:-1)?null:new ae(n,s,o,i)}static subtractFromRange(e,t){const n=[],s=ae.intersection(e,t);return s==null?[e]:(s.startRow!=null&&(e.startRow==null||e.startRow<s.startRow)&&n.push(new ae(e.startColumn,e.startRow,e.endColumn,s.startRow-1)),s.startColumn!=null&&(e.startColumn==null||e.startColumn<s.startColumn)&&n.push(new ae(e.startColumn,s.startRow,s.startColumn-1,s.endRow)),s.endColumn!=null&&(e.endColumn==null||e.endColumn>s.endColumn)&&n.push(new ae(s.endColumn+1,s.startRow,e.endColumn,s.endRow)),s.endRow!=null&&(e.endRow==null||e.endRow>s.endRow)&&n.push(new ae(e.startColumn,s.endRow+1,e.endColumn,e.endRow)),n)}static subtractFromRanges(e,t){const n=[];for(let s=0;s<e.length;s+=1)n.push(...ae.subtractFromRange(e[s],t));return n}static subtractRangesFromRanges(e,t){let n=[...e];for(let s=0;s<t.length;s+=1)n=ae.subtractFromRanges(n,t[s]);return n}static isBounded(e){return e.startRow!=null&&e.startColumn!=null&&e.endRow!=null&&e.endColumn!=null}static boundedRange(e,t,n){var s,o,i,r;return ae.isBounded(e)?e:new ae((s=e.startColumn)!=null?s:0,(o=e.startRow)!=null?o:0,(i=e.endColumn)!=null?i:t-1,(r=e.endRow)!=null?r:n-1)}static boundedRanges(e,t,n){return e.map(s=>ae.boundedRange(s,t,n))}static offset(e,t,n){return new ae(e.startColumn!=null?e.startColumn+t:null,e.startRow!=null?e.startRow+n:null,e.endColumn!=null?e.endColumn+t:null,e.endRow!=null?e.endRow+n:null)}static nextCell(e,t=null,n=null,s=ae.SELECTION_DIRECTION.DOWN){if(e.length===0)return null;let o=-1;if(t!=null&&n!=null&&(o=e.findIndex(i=>i.containsCell(t,n)),o>=0)){const r=e[o].nextCell(t,n,s);if(r!=null)return r}switch(s){case ae.SELECTION_DIRECTION.DOWN:case ae.SELECTION_DIRECTION.RIGHT:{const i=o<e.length-1?o+1:0;return e[i].startCell(s)}case ae.SELECTION_DIRECTION.LEFT:case ae.SELECTION_DIRECTION.UP:{const i=o>0?o-1:e.length-1;return e[i].startCell(s)}default:throw new Error(`Invalid direction: ${s}`)}}static cellCount(e){return e.reduce((t,n)=>{var s,o,i,r;return t+(((s=n.endRow)!=null?s:NaN)-((o=n.startRow)!=null?o:NaN)+1)*(((i=n.endColumn)!=null?i:NaN)-((r=n.startColumn)!=null?r:NaN)+1)},0)}static rowCount(e){return e.reduce((t,n)=>{var s,o;return t+((s=n.endRow)!=null?s:NaN)-((o=n.startRow)!=null?o:NaN)+1},0)}static columnCount(e){return e.reduce((t,n)=>{var s,o;return t+((s=n.endColumn)!=null?s:NaN)-((o=n.startColumn)!=null?o:NaN)+1},0)}static containsCell(e,t,n){for(let s=0;s<e.length;s+=1)if(e[s].containsCell(t,n))return!0;return!1}static forEachCell(e,t,n=ae.SELECTION_DIRECTION.RIGHT){for(let s=0;s<e.length;s+=1)e[s].forEach(t,n)}constructor(e,t,n,s){this.startColumn=e,this.startRow=t,this.endColumn=n,this.endRow=s}equals(e){return this.startColumn===e.startColumn&&this.startRow===e.startRow&&this.endColumn===e.endColumn&&this.endRow===e.endRow}contains(e){return(this.startColumn==null||e.startColumn!=null&&this.startColumn<=e.startColumn)&&(this.startRow==null||e.startRow!=null&&this.startRow<=e.startRow)&&(this.endColumn==null||e.endColumn!=null&&this.endColumn>=e.endColumn)&&(this.endRow==null||e.endRow!=null&&this.endRow>=e.endRow)}containsCell(e,t){return e==null||t==null?!1:(this.startColumn==null||this.startColumn<=e)&&(this.endColumn==null||this.endColumn>=e)&&(this.startRow==null||this.startRow<=t)&&(this.endRow==null||this.endRow>=t)}touches(e){return ae.isAxisRangeTouching(this.startRow,this.endRow,e.startRow,e.endRow)&&ae.isAxisRangeTouching(this.startColumn,this.endColumn,e.startColumn,e.endColumn)}subtract(e){return ae.subtractFromRange(this,e)}startCell(e=ae.SELECTION_DIRECTION.DOWN){if(!ae.isBounded(this))throw new Error("Cannot get the startCell of an unbounded range");switch(e){case ae.SELECTION_DIRECTION.DOWN:case ae.SELECTION_DIRECTION.RIGHT:return{column:this.startColumn,row:this.startRow};case ae.SELECTION_DIRECTION.LEFT:case ae.SELECTION_DIRECTION.UP:return{column:this.endColumn,row:this.endRow};default:throw new Error(`Invalid direction: ${e}`)}}nextCell(e,t,n){if(!ae.isBounded(this))throw new Error("Bounded range required");if(e==null||t==null)throw new Error("Require a non-null cursor");const{startColumn:s,endColumn:o,startRow:i,endRow:r}=this;switch(n){case ae.SELECTION_DIRECTION.DOWN:if(t<r)return{column:e,row:Math.max(t+1,i)};if(e<o)return{column:Math.max(e+1,s),row:i};break;case ae.SELECTION_DIRECTION.UP:if(t>i)return{column:e,row:Math.min(t-1,r)};if(e>s)return{column:Math.min(e-1,o),row:r};break;case ae.SELECTION_DIRECTION.RIGHT:if(e<o)return{column:Math.max(e+1,s),row:t};if(t<r)return{column:s,row:Math.max(t+1,i)};break;case ae.SELECTION_DIRECTION.LEFT:if(e>s)return{column:Math.min(e-1,o),row:t};if(t>i)return{column:o,row:Math.min(t-1,r)};break;default:throw new Error(`Invalid direction: ${n}`)}return null}forEach(e,t=ae.SELECTION_DIRECTION.RIGHT){var i;let n=0,{column:s,row:o}=this.startCell(t);for(;s!=null&&o!=null;)e(s,o,n),n+=1,{column:s,row:o}=(i=this.nextCell(s,o,t))!=null?i:{}}};let Q=ae;Q.SELECTION_DIRECTION=At;function td(e){return Array.isArray(e)&&e.length===2&&(e[0]===null||typeof e[0]=="number")&&(e[1]===null||typeof e[1]=="number")}function Eo(e){return td(e)&&e[0]!=null&&e[1]!=null}const ue=class{static getGridPointFromXY(e,t,n){const s=ue.getColumnAtX(e,n),o=ue.getRowAtY(t,n),i=ue.getColumnHeaderDepthAtY(t,n);return{x:e,y:t,row:o,column:s,columnHeaderDepth:i}}static getCellInfoFromXY(e,t,n){const{row:s,column:o}=ue.getGridPointFromXY(e,t,n),{allColumnWidths:i,allRowHeights:r,allColumnXs:l,allRowYs:a,modelColumns:c,modelRows:d}=n,u=s!==null?d.get(s):null,h=o!==null?c.get(o):null,g=o!==null?l.get(o):null,p=s!==null?a.get(s):null,f=o!==null?i.get(o):null,C=s!==null?r.get(s):null;return{row:s,column:o,modelRow:u!=null?u:null,modelColumn:h!=null?h:null,left:g!=null?g:null,top:p!=null?p:null,columnWidth:f!=null?f:null,rowHeight:C!=null?C:null}}static getColumnHeaderDepthAtY(e,t){const n=ue.getRowAtY(e,t),{columnHeaderHeight:s,columnHeaderMaxDepth:o}=t;if(n===null&&e<=s*o)return Be(o-Math.ceil(e/s),0,o-1)}static iterateFloatingStart(e,t,n){for(let s=0;s<e&&s<t;s+=1){const o=n(s);if(o!==void 0)return o}}static iterateFloatingEnd(e,t,n){for(let s=0;s<e&&t-(e-s)>=0;s+=1){const o=n(t-(e-s));if(o!==void 0)return o}}static iterateFloating(e,t,n,s){const o=ue.iterateFloatingStart(e,n,s);return o!==void 0?o:ue.iterateFloatingEnd(t,n,s)}static iterateAllItems(e,t,n,s,o,i){const r=Math.max(e,n),l=Math.min(t,o-s-1);let a=ue.iterateFloating(n,s,o,i);if(a!==void 0)return a;for(let c=r;c<=l;c+=1)if(a=i(c),a!==void 0)return a}static isInItem(e,t,n,s){var r,l;const o=(r=t.get(e))!=null?r:0,i=(l=n.get(e))!=null?l:0;return o<=s&&s<=o+i}static getItemAtOffset(e,t,n,s,o,i,r,l=!1){const a=l?void 0:ue.iterateFloating(n,s,t,c=>{if(ue.isInItem(c,i,r,e))return c});if(!l&&a!==void 0)return a;for(let c=0;c<o.length;c+=1){const d=o[c];if(ue.isInItem(d,i,r,e))return d}return null}static getColumnAtX(e,t,n=!1){const{columnCount:s,floatingLeftColumnCount:o,floatingRightColumnCount:i,visibleColumns:r,allColumnXs:l,allColumnWidths:a,gridX:c}=t;return e<c?null:this.getItemAtOffset(e-c,s,o,i,r,l,a,n)}static getRowAtY(e,t){const{floatingTopRowCount:n,floatingBottomRowCount:s,rowCount:o,visibleRows:i,allRowYs:r,allRowHeights:l,gridY:a}=t;return e<a?null:this.getItemAtOffset(e-a,o,n,s,i,r,l)}static getNextShownItem(e,t,n,s){let o=n.findIndex(i=>i===e)||0;for(o-=1;o!=null&&o>=0;){const i=n[o],r=t.get(i);if(r!=null&&s.get(r)!==0)return i;o-=1}return null}static getNextShownColumn(e,t){const{modelColumns:n,visibleColumns:s,userColumnWidths:o}=t;return ue.getNextShownItem(e,n,s,o)}static getNextShownRow(e,t){const{modelRows:n,visibleRows:s,userRowHeights:o}=t;return ue.getNextShownItem(e,n,s,o)}static getColumnSeparatorIndex(e,t,n,s){var w,S,T,R;const{rowHeaderWidth:o,columnHeaderHeight:i,floatingColumns:r,floatingLeftWidth:l,visibleColumns:a,allColumnXs:c,allColumnWidths:d,columnHeaderMaxDepth:u}=n,{allowColumnResize:h,headerSeparatorHandleSize:g}=s;if(u*i<t||!h||g<=0)return null;const p=e-o,f=g*.5;let C=!1;for(let b=r.length-1;b>=0;b-=1){const v=r[b],D=(w=c.get(v))!=null?w:0,A=(S=d.get(v))!=null?S:0,N=A===0;if(!C||!N){let L=D+A;N?L+=f:C&&(L-=f);const k=L-f,x=L+f;if(k<=p&&p<=x)return v;C=N}}C=!1;for(let b=a.length-1;b>=0;b-=1){const v=a[b],D=(T=c.get(v))!=null?T:0,A=(R=d.get(v))!=null?R:0,N=A===0;if(D<l-A)return null;if(!C||!N){let L=D+A;N?L+=f:C&&(L-=f);const k=L-f,x=L+f;if(k<=p&&p<=x)return v;C=N}}return null}static isItemHidden(e,t){return t.get(e)===0}static isColumnHidden(e,t){const{allColumnWidths:n}=t;return ue.isItemHidden(e,n)}static isFloatingRow(e,t){if(e==null)return!1;const{floatingTopRowCount:n,floatingBottomRowCount:s,rowCount:o}=t;return e<n||e>=o-s}static isFloatingColumn(e,t){if(e==null)return!1;const{floatingLeftColumnCount:n,floatingRightColumnCount:s,columnCount:o}=t;return e<n||e>=o-s}static getHiddenItems(e,t,n){if(!ue.isItemHidden(e,t))return[];const s=[e],o=n.findIndex(i=>i===e);for(let i=o-1;i>=0;i-=1){const r=n[i];if(!ue.isItemHidden(r,t))break;s.push(r)}return s}static getHiddenColumns(e,t){const{visibleColumns:n,allColumnWidths:s}=t;return ue.getHiddenItems(e,s,n)}static getRowSeparatorIndex(e,t,n,s){var p,f;const{rowHeaderWidth:o,columnHeaderHeight:i,visibleRows:r,allRowYs:l,allRowHeights:a}=n,{allowRowResize:c,headerSeparatorHandleSize:d}=s;if(o<e||!c||d<=0)return null;const u=t-i,h=d*.5;let g=!1;for(let C=r.length-1;C>=0;C-=1){const w=r[C],S=(p=l.get(w))!=null?p:0,T=(f=a.get(w))!=null?f:0,R=T===0;if(!g||!R){let b=S+T;R?b+=h:g&&(b-=h);const v=b-h,D=b+h;if(v<=u&&u<=D)return w;g=R}}return null}static isRowHidden(e,t){const{allRowHeights:n}=t;return ue.isItemHidden(e,n)}static getHiddenRows(e,t){const{visibleRows:n,allRowHeights:s}=t;return ue.getHiddenItems(e,s,n)}static moveItem(e,t,n){if(e===t)return[...n];const s=[...n],o=s[s.length-1];return o!=null&&!Eo(o.from)&&o.to===e?o.from===t?s.pop():s[s.length-1]={...o,to:t}:s.push({from:e,to:t}),s}static moveRange(e,t,n,s=!1){if(e[0]===e[1])return ue.moveItem(e[0],t,n);let o=t;if(s&&e[0]<t&&(o-=e[1]-e[0]),e[0]===o)return[...n];const i=[...n],r=i[i.length-1];r!=null&&Eo(r.from)&&r.from[1]-r.from[0]===e[1]-e[0]&&r.to===e[0]?i[i.length-1]={...r,to:o}:i.push({from:e,to:o});const l=i[i.length-1];return Eo(l.from)&&l.from[0]===l.to&&i.pop(),i}static moveItemOrRange(e,t,n,s=!1){return Array.isArray(e)?ue.moveRange(e,t,n,s):ue.moveItem(e,t,n)}static applyItemMoves(e,t,n,s=!1){var i,r;let o=[[e,t]];for(let l=s?n.length-1:0;s?l>=0:l<n.length;s?l-=1:l+=1){const{from:a,to:c}=n[l];let d=1,u;Eo(a)?(d=a[1]-a[0]+1,[u]=a):u=a;const h=s?c:u,g=h+d-1,p=s?u:c,f=p-h,C=[];for(let w=0;w<o.length;w+=1){const S=(i=o[w][0])!=null?i:Number.NEGATIVE_INFINITY,T=(r=o[w][1])!=null?r:Number.POSITIVE_INFINITY;let R;const b=[[S,h-1],[h,g],[g+1,T]].map(([v,D])=>[Math.max(v,S),Math.min(D,T)]).filter(([v,D])=>v<=D).map(v=>{const[D,A]=v;return h<=D&&g>=A?(R=[D+f,A+f],R):g<D?[D-d,A-d]:v}).map(v=>{const[D,A]=v;return p>D&&p<=A?[[D,p-1],[p+d,A+d]]:v===R?[v]:p<=D?[[D+d,A+d]]:[v]}).flat();C.push(...b)}o=C.map(([w,S])=>[Number.isFinite(w)?w:null,Number.isFinite(S)?S:null])}return o}static translateRange(e,t,n,s){const o=ue.applyItemMoves(e.startColumn,e.endColumn,t,s),i=ue.applyItemMoves(e.startRow,e.endRow,n,s),r=[];for(let l=0;l<o.length;l+=1){const a=o[l];for(let c=0;c<i.length;c+=1){const d=i[c];r.push(new Q(a[0],d[0],a[1],d[1]))}}return r}static getModelIndex(e,t){return ue.applyItemMoves(e,e,t,!0)[0][0]}static getModelIndexes(e,t){return e.map(n=>ue.getModelIndex(n,t))}static getModelRangeIndexes(e,t,n){return ue.applyItemMoves(e,t,n,!0)}static getModelRange(e,t=ve,n=ve){return ue.translateRange(e,t,n,!0)}static getModelRanges(e,t=ve,n=ve){const s=[];for(let o=0;o<e.length;o+=1)s.push(...ue.getModelRange(e[o],t,n));return s}static getVisibleRangeIndexes(e,t,n){return ue.applyItemMoves(e,t,n,!1)}static getVisibleRange(e,t=ve,n=ve){return this.translateRange(e,t,n,!1)}static getVisibleRanges(e,t=ve,n=ve){const s=[];for(let o=0;o<e.length;o+=1)s.push(...ue.getVisibleRange(e[o],t,n));return s}static getVisibleIndex(e,t){return ue.applyItemMoves(e,e,t)[0][0]}static getVisibleIndexes(e,t){return e.map(n=>ue.getVisibleIndex(n,t))}static isMacPlatform(){const{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return ue.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){const t=ue.getModifierKey();return e[t]}static checkColumnHidden(e,t){return t.get(e)===0}static checkAllColumnsHidden(e,t){return t.size===0?!1:e.every(n=>t.get(n)===0)}static getScrollDragBounds(e,t,n){const{gridX:s,gridY:o,width:i,height:r,floatingTopRowCount:l,floatingBottomRowCount:a,floatingLeftColumnCount:c,floatingRightColumnCount:d,floatingLeftWidth:u,floatingRightWidth:h,floatingTopHeight:g,floatingBottomHeight:p,columnCount:f,rowCount:C}=e;let w=s,S=o,T=i,R=r;return n!=null&&(n>c&&(w+=u),n<f-d&&(T-=h)),t!=null&&(t>l&&(S+=g),t<C-a&&(R-=p)),{x1:w,y1:S,x2:T,y2:R}}static getScrollDelta(e,t=1024,n=768,s=20,o=20){let{deltaX:i,deltaY:r}=e;return!ue.isMacPlatform()&&e.shiftKey&&e.deltaX===0&&e.deltaY!==0&&(i=e.deltaY,r=e.deltaX),(e==null?void 0:e.deltaMode)===WheelEvent.DOM_DELTA_PAGE?(i*=t,r*=n):(e==null?void 0:e.deltaMode)===WheelEvent.DOM_DELTA_LINE&&(ue.isMacPlatform()?(i=Math.round(i*s),r=Math.round(r*o)):(i=Math.round(i*this.PIXELS_PER_LINE),r=Math.round(r*this.PIXELS_PER_LINE))),{deltaX:i,deltaY:r}}static compareRanges(e,t){return e[0]==null||e[1]==null||t[0]==null||t[1]==null?0:e[0]!==t[0]?e[0]-t[0]:e[1]-t[1]}static mergeSortedRanges(e){const t=[];for(let n=0;n<e.length;n+=1){const s=e[n],o=s[0],i=s[1];n===0?t.push([o,i]):o-1<=t[t.length-1][1]?t[t.length-1][1]=Math.max(t[t.length-1][1],i):t.push([o,i])}return t}};let H=ue;H.PIXELS_PER_LINE=100/3;function O(e,t,n=void 0){var o;const s=(o=e.get(t))!=null?o:n;if(s!==void 0)return s;throw new Error(`Missing value for key ${t}`)}function vo(e,t=Ks.CACHE_SIZE,n=Math.floor(t/2)){if(e.size>t){const s=e.keys();for(;e.size>n;)e.delete(s.next().value)}}function Fr(e,t,n,s,o){const i=new Map;let r=0;for(let l=0;l<e&&l<n;l+=1)i.set(l,r),r+=O(o,l);r=s;for(let l=0;l<t&&n-l-1>=0;l+=1)r-=O(o,n-l-1),i.set(n-l-1,r);return i}const wl=class{constructor({userColumnWidths:e=new Map,userRowHeights:t=new Map,calculatedColumnWidths:n=new Map,calculatedRowHeights:s=new Map,fontWidths:o=new Map,modelRows:i=new Map,modelColumns:r=new Map,movedRows:l=[],movedColumns:a=[],initialRowHeights:c=new Map,initialColumnWidths:d=new Map}={}){this.userColumnWidths=e,this.userRowHeights=t,this.calculatedRowHeights=s,this.calculatedColumnWidths=n,this.fontWidths=o,this.modelRows=i,this.modelColumns=r,this.movedRows=l,this.movedColumns=a,this.initialRowHeights=c,this.initialColumnWidths=d}getMetrics(e){const{left:t,top:n,leftOffset:s,topOffset:o,width:i,height:r,theme:l,model:a,movedRows:c,movedColumns:d,draggingColumn:u}=e,{rowHeight:h,rowHeaderWidth:g,rowFooterWidth:p,columnWidth:f,columnHeaderHeight:C,minScrollHandleSize:w,scrollBarSize:S}=l;c!==this.movedRows&&(this.movedRows=c,this.modelRows.clear()),d!==this.movedColumns&&(this.movedColumns=d,this.modelColumns.clear());const{columnCount:T,rowCount:R,floatingTopRowCount:b,floatingBottomRowCount:v,floatingLeftColumnCount:D,floatingRightColumnCount:A,columnHeaderMaxDepth:N}=a,L=this.getFirstRow(e),k=this.getFirstColumn(e),x=this.getGridX(e),W=this.getGridY(e),V=Ae(a)&&a.hasExpandableRows?this.calculateTreePaddingX(e):0,K=0,Z=this.getVisibleRowHeights(e),$=this.getVisibleColumnWidths(e,k,V),P=Array.from(Z.keys()),G=Array.from($.keys()),X=new Map([...Z,...this.getFloatingRowHeights(e)]),j=new Map([...$,...this.getFloatingColumnWidths(e)]),de=this.getVisibleColumnXs(j,G,s),me=this.getVisibleRowYs(X,P,o),Ce=P.length>0?P[P.length-1]:n,ye=G.length>0?G[G.length-1]:t,fe=this.getBottomViewport(e,P,me,X),Je=this.getRightViewport(e,G,de,j),Xe=this.getFloatingTopHeight(e,X),$e=this.getFloatingBottomHeight(e,X),Ot=this.getFloatingLeftWidth(e,j),Ct=this.getFloatingRightWidth(e,j),hn=Array.from(j.values()),xt=Array.from(X.values()),De=hn.reduce((We,ls)=>We+ls,0)-s,ge=xt.reduce((We,ls)=>We+ls,0)-o,Ke=s+De+p,ze=o+ge,lt=i-x,wt=r-W,mn=this.getLastLeft(e,null,lt-p),kt=this.getLastLeft(e,null,lt-p-S),eo=this.getLastTop(e,null,wt-$e),Xt=this.getLastTop(e,null,wt-$e-S);let St=kt,gn=Xt;mn===0&&eo===0&&(St=0,gn=0);const os=St>0,Ds=os?S:0,is=gn>0,rs=is?S:0,to=x,no=N*C,pn=i-to-rs,Hn=r-no-Ds,ni=T===1?pn/Ke:(T-St)/T,so=R===1?Hn/ze:(R-gn)/R,Is=os?Be(pn*ni,w,pn-1):0,Ns=is?Be(Hn*so,w,Hn-1):0,oo=O(j,t,0),io=O(X,n,0),si=oo>0?s/oo:0,oi=io>0?o/io:0,ii=T===1?s/(Ke-lt):(t+si)/St,Vn=R===1?o/(ze-wt):(n+oi)/gn,ri=os?ii*(pn-Is):0,ro=is?Vn*(Hn-Ns):0,lo=[...Array(b).keys(),...[...Array(v).keys()].map(We=>R-We-1)],As=new Map([...me,...this.getFloatingRowYs(e,X,Math.floor(r-W-Ds))]),ao=[...Array(D).keys(),...[...Array(A).keys()].map(We=>T-We-1)],fn=new Map([...de,...this.getFloatingColumnXs(e,j,Math.floor(i-x-rs))]),Ms=[];if(u)for(let We=u.range[0];We<=u.range[1];We+=1)Ms.push(We),j.has(We)||j.set(We,this.getVisibleColumnWidth(We,e)),fn.has(We)||fn.set(We,0);const co=P.concat(lo),uo=G.concat(ao).concat(Ms),Os=this.getModelRows(co,e),li=this.getModelColumns(uo,e),ho=this.getVisibleRowTreeBoxes(X,Os,e),mo=this.getTopVisible(e,As,X,P),go=this.getLeftVisible(e,fn,j,G),po=gn>0?this.getBottomVisible(e,As,X,P,W):Ce,fo=St>0?this.getRightVisible(e,fn,j,G,x):ye,{fontWidths:Co,userColumnWidths:ai,userRowHeights:wo,calculatedRowHeights:So,calculatedColumnWidths:bo}=this;return{rowHeight:h,rowHeaderWidth:g,rowFooterWidth:p,rowCount:R,columnWidth:f,columnCount:T,columnHeaderHeight:C,floatingTopRowCount:b,floatingBottomRowCount:v,floatingLeftColumnCount:D,floatingRightColumnCount:A,gridX:x,gridY:W,firstRow:L,firstColumn:k,treePaddingX:V,treePaddingY:K,left:t,top:n,bottom:Ce,right:ye,topOffset:o,leftOffset:s,topVisible:mo,leftVisible:go,bottomVisible:po,rightVisible:fo,bottomViewport:fe,rightViewport:Je,width:i,height:r,maxX:De,maxY:ge,lastLeft:St,lastTop:gn,barHeight:Hn,barTop:no,barWidth:pn,barLeft:to,handleHeight:Ns,handleWidth:Is,hasHorizontalBar:os,hasVerticalBar:is,verticalBarWidth:rs,horizontalBarHeight:Ds,scrollX:ri,scrollY:ro,scrollableContentWidth:Ke,scrollableContentHeight:ze,scrollableViewportWidth:lt,scrollableViewportHeight:wt,visibleRows:P,visibleColumns:G,visibleRowHeights:Z,visibleColumnWidths:$,floatingRows:lo,floatingColumns:ao,allRows:co,allColumns:uo,allRowHeights:X,allColumnWidths:j,floatingTopHeight:Xe,floatingBottomHeight:$e,floatingLeftWidth:Ot,floatingRightWidth:Ct,visibleRowYs:me,visibleColumnXs:de,allRowYs:As,allColumnXs:fn,visibleRowTreeBoxes:ho,modelRows:Os,modelColumns:li,movedRows:c,movedColumns:d,fontWidths:Co,userColumnWidths:ai,userRowHeights:wo,calculatedRowHeights:So,calculatedColumnWidths:bo,columnHeaderMaxDepth:N}}getGridX(e){const{theme:t}=e,{rowHeaderWidth:n}=t;return n}getGridY(e){const{theme:t,model:n}=e,{columnHeaderHeight:s}=t,{columnHeaderMaxDepth:o}=n;return o*s}getVisibleHeight(e,t=this.getFloatingRowHeights(e)){const{height:n,theme:s}=e,{scrollBarSize:o}=s,i=this.getGridY(e),r=this.getFloatingBottomHeight(e,t),l=this.getFloatingTopHeight(e,t);return n-r-l-i-o}getVisibleWidth(e,t=this.getFloatingColumnWidths(e)){const{width:n,theme:s}=e,{scrollBarSize:o,rowFooterWidth:i}=s,r=this.getGridX(e),l=this.getFloatingRightWidth(e,t),a=this.getFloatingLeftWidth(e,t);return n-a-l-r-o-i}getFirstIndex(e,t,n){const s=e.size+1;for(let o=0;o<s;o+=1){const i=t(o,n);if(e.get(i)!==0)return o}return 0}getFirstColumn(e){return this.getFirstIndex(this.userColumnWidths,this.getModelColumn.bind(this),e)}getFirstRow(e){return this.getFirstIndex(this.userRowHeights,this.getModelRow.bind(this),e)}getLastLeft(e,t,n){const{model:s}=e,{columnCount:o,floatingRightColumnCount:i}=s;let r=Math.max(0,o-i-1);t!=null&&(r=t);let l=0;for(;r>=0;){if(l+=this.getVisibleColumnWidth(r,e),l>=n)return Be(r+1,0,t!=null?t:o-1);r-=1}return 0}getLastTop(e,t,n){const{model:s}=e,{rowCount:o,floatingBottomRowCount:i}=s;let r=Math.max(0,o-i-1);t!=null&&(r=t);let l=0;for(;r>=0;){if(l+=this.getVisibleRowHeight(r,e),l>=n)return Be(r+1,0,o-1);r-=1}return 0}getTopForTopVisible(e,t){const n=this.getFloatingTopHeight(e);let s=t,o=0;for(;s>0&&o<n;)s-=1,o+=this.getVisibleRowHeight(s,e);return s}getTopForBottomVisible(e,t){const{height:n}=e,s=this.getGridY(e),o=this.getFloatingBottomHeight(e),i=n-s-o;return this.getLastTop(e,t,i)}getLeftForLeftVisible(e,t){const n=this.getFloatingLeftWidth(e);let s=t,o=0;for(;s>0&&o<n;)s-=1,o+=this.getVisibleColumnWidth(s,e);return s}getLeftForRightVisible(e,t){const{width:n}=e,s=this.getGridX(e),o=this.getFloatingRightWidth(e),i=n-s-o;return this.getLastLeft(e,t,i)}getFloatingRowHeights(e){const{model:t}=e,{floatingTopRowCount:n,floatingBottomRowCount:s,rowCount:o}=t,i=new Map;for(let r=0;r<n&&r<o;r+=1)i.set(r,this.getVisibleRowHeight(r,e));for(let r=0;r<s&&o-r-1>=0;r+=1){const l=o-r-1;i.set(l,this.getVisibleRowHeight(l,e))}return i}getVisibleRowHeights(e){const{top:t,topOffset:n,height:s,model:o}=e;let i=0,r=t;const l=new Map,{rowCount:a}=o;for(;i<s+n&&r<a;){const c=this.getVisibleRowHeight(r,e);l.set(r,c),i+=c,r+=1}return l}getFloatingColumnWidths(e,t=this.getFirstColumn(e),n=this.calculateTreePaddingX(e)){const{model:s}=e,{columnCount:o,floatingLeftColumnCount:i,floatingRightColumnCount:r}=s,l=new Map;for(let a=0;a<i&&a<o;a+=1)l.set(a,this.getVisibleColumnWidth(a,e,t,n));for(let a=0;a<r&&o-a-1>=0;a+=1){const c=o-a-1;l.set(c,this.getVisibleColumnWidth(c,e,t,n))}return l}getVisibleColumnWidths(e,t=this.getFirstColumn(e),n=this.calculateTreePaddingX(e)){const{left:s,leftOffset:o,width:i,model:r}=e;let l=0,a=s;const c=new Map,{columnCount:d}=r;for(;l<i+o&&a<d;){const u=this.getVisibleColumnWidth(a,e,t,n);c.set(a,u),l+=u,a+=1}return c}getFloatingColumnXs(e,t,n){const{model:s}=e,{columnCount:o,floatingLeftColumnCount:i,floatingRightColumnCount:r}=s;return Fr(i,r,o,n,t)}getVisibleColumnXs(e,t,n){const s=new Map;let o=-n;for(let i=0;i<t.length;i+=1){const r=t[i],l=O(e,r);s.set(r,o),o+=l}return s}getFloatingRowYs(e,t,n){const{model:s}=e,{floatingTopRowCount:o,floatingBottomRowCount:i,rowCount:r}=s;return Fr(o,i,r,n,t)}getVisibleRowYs(e,t,n){const s=new Map;let o=-n;for(let i=0;i<t.length;i+=1){const r=t[i],l=O(e,r);s.set(r,o),o+=l}return s}getVisibleRowTreeBoxes(e,t,n){const s=new Map,{model:o,theme:i}=n,{treeDepthIndent:r,treeHorizontalPadding:l}=i;return Ae(o)&&o.hasExpandableRows&&e.forEach((a,c)=>{const d=O(t,c);if(o.isRowExpandable(d)){const u=o.depthForRow(d),h=u*r+l,g=(u+1)*r+l,p=0,f=a;s.set(c,{x1:h,y1:p,x2:g,y2:f})}}),s}getFloatingLeftWidth(e,t=this.getFloatingColumnWidths(e)){const{model:n}=e,{floatingLeftColumnCount:s}=n;let o=0;for(let i=0;i<s;i+=1)o+=O(t,i);return o}getFloatingRightWidth(e,t=this.getFloatingColumnWidths(e)){const{model:n}=e,{floatingRightColumnCount:s,columnCount:o}=n;let i=0;for(let r=0;r<s;r+=1)i+=O(t,o-r-1);return i}getFloatingTopHeight(e,t=this.getFloatingRowHeights(e)){const{model:n}=e,{floatingTopRowCount:s}=n;let o=0;for(let i=0;i<s;i+=1)o+=O(t,i);return o}getFloatingBottomHeight(e,t=this.getFloatingRowHeights(e)){const{model:n}=e,{floatingBottomRowCount:s,rowCount:o}=n;let i=0;for(let r=0;r<s;r+=1)i+=O(t,o-r-1);return i}getTopVisible(e,t,n,s){const o=this.getFloatingTopHeight(e,n);for(let i=0;i<s.length;i+=1){const r=s[i];if(O(t,r)>=o)return r}return 0}getLeftVisible(e,t,n,s){const o=this.getFloatingLeftWidth(e,n);for(let i=0;i<s.length;i+=1){const r=s[i];if(O(t,r)>=o)return r}return 0}getBottomVisible(e,t,n,s,o){const{height:i,theme:r}=e,{scrollBarSize:l}=r,a=this.getFloatingBottomHeight(e,n),c=i-o-l-a;for(let d=s.length-1;d>=0;d-=1){const u=s[d],h=O(t,u),g=O(n,u);if(h+g<=c)return u}return 0}getRightVisible(e,t,n,s,o){const{width:i,theme:r}=e,{scrollBarSize:l}=r,a=this.getFloatingRightWidth(e,n),c=i-o-l-a;for(let d=s.length-1;d>=0;d-=1){const u=s[d],h=O(t,u),g=O(n,u);if(h+g<=c)return u}return 0}getBottomViewport(e,t,n,s){const{height:o,theme:i}=e,{rowHeight:r}=i;return this.getLastIndexViewport(t,n,s,o,r)}getRightViewport(e,t,n,s){const{width:o,theme:i}=e,{columnWidth:r}=i;return this.getLastIndexViewport(t,n,s,o,r)}getLastIndexViewport(e,t,n,s,o){let i=0,r=0;return e.length>0&&(i=e[e.length-1],r=O(t,i)+O(n,i)),r<s&&(i+=Math.ceil((s-r)/o)),i}getVisibleItemSize(e,t,n){var s;return(s=t.get(e))!=null?s:n()}getVisibleRowHeight(e,t){const n=this.getModelRow(e,t),s=this.calculateRowHeight(e,n,t);return this.getVisibleItemSize(n,this.userRowHeights,()=>{const o=this.initialRowHeights.get(n);return o!==void 0?o:s})}getVisibleColumnWidth(e,t,n=this.getFirstColumn(t),s=this.calculateTreePaddingX(t)){const o=this.getModelColumn(e,t),i=this.calculateColumnWidth(e,o,t,n,s);return this.getVisibleItemSize(o,this.userColumnWidths,()=>{const r=this.initialColumnWidths.get(o);return r!==void 0?r:i})}getModelRows(e,t){const n=new Map;for(let s=0;s<e.length;s+=1){const o=e[s],i=this.getModelRow(o,t);n.set(o,i)}return n}getModelRow(e,t){if(this.modelRows.has(e))return O(this.modelRows,e);const{movedRows:n}=t,s=H.getModelIndex(e,n);return this.modelRows.set(e,s),s}getModelColumns(e,t){const n=new Map;for(let s=0;s<e.length;s+=1){const o=e[s],i=this.getModelColumn(o,t);n.set(o,i)}return n}getModelColumn(e,t){if(this.modelColumns.has(e))return O(this.modelColumns,e);const{movedColumns:s}=t,o=H.getModelIndex(e,s);return this.modelColumns.set(e,o),o}calculateRowHeight(e,t,n){const{theme:s}=n,{autoSizeRows:o,rowHeight:i}=s;if(!o)return i;const r=this.calculatedRowHeights.get(t);return r!=null?r:(this.calculatedRowHeights.set(t,Math.ceil(i)),vo(this.calculatedRowHeights),i)}calculateColumnWidth(e,t,n,s=this.getFirstColumn(n),o=this.calculateTreePaddingX(n)){const{theme:i}=n,{autoSizeColumns:r,minColumnWidth:l}=i;if(!r){const{columnWidth:h}=i;return h}const a=this.calculateColumnHeaderWidth(t,n),c=this.calculateColumnDataWidth(t,n),d=this.calculatedColumnWidths.get(t);let u=Math.ceil(Math.max(a,c));return u=Math.max(l,u),d!=null&&d>u?u=d:(this.calculatedColumnWidths.set(t,u),vo(this.calculatedColumnWidths)),e===s&&(u+=o),u}calculateColumnHeaderWidth(e,t){const{model:n,theme:s}=t,{headerFont:o,headerHorizontalPadding:i}=s,r=n.textForColumnHeader(e,0);if(r!==void 0&&r!==""){const l=this.getWidthForFont(o,t);return r.length*l+i*2}return i*2}calculateColumnDataWidth(e,t){const{top:n,height:s,width:o,model:i,theme:r}=t,{floatingTopRowCount:l,floatingBottomRowCount:a,rowCount:c}=i,{font:d,cellHorizontalPadding:u,rowHeight:h,rowHeaderWidth:g,rowFooterWidth:p,scrollBarSize:f}=r;let C=0;const w=this.getWidthForFont(d,t),S=s/h,T=Math.ceil(n+S);return H.iterateAllItems(n,T,l,a,c,R=>{const b=this.getModelRow(R,t),v=i.textForCell(e,b);if(v){const D=u*2;C=Math.max(C,v.length*w+D)}}),C=Math.max(Math.min(C,(o-g-f-p)*wl.MAX_COLUMN_WIDTH),u*2),C}calculateTreePaddingX(e){const{top:t,height:n,model:s,theme:o}=e,{rowHeight:i,treeDepthIndent:r}=o;if(!Ae(s)||!s.hasExpandableRows)return 0;let l=0;const a=n/i,c=Math.ceil(t+a);for(let d=t;d<=c;d+=1){const u=this.getModelRow(d,e),h=s.depthForRow(u);l=Math.max(l,r*(h+1))}return l}getWidthForFont(e,t){if(this.fontWidths.has(e))return O(this.fontWidths,e);const{context:n}=t;n.font=e;const s=n.measureText("8"),{width:o}=s;return this.fontWidths.set(e,o),this.fontWidths.set(n.font,o),o}setColumnWidth(e,t){const n=new Map(this.userColumnWidths);n.set(e,Math.ceil(t)),vo(n),this.userColumnWidths=n}resetColumnWidth(e){const t=new Map(this.userColumnWidths);t.delete(e),this.userColumnWidths=t}setRowHeight(e,t){const n=new Map(this.userRowHeights);n.set(e,Math.ceil(t)),vo(n),this.userRowHeights=n}resetRowHeight(e){const t=new Map(this.userRowHeights);t.delete(e),this.userRowHeights=t,this.calculatedRowHeights.delete(e)}};let Ks=wl;Ks.CACHE_SIZE=1e4;Ks.MAX_COLUMN_WIDTH=.8;const nd=Object.freeze({allowColumnResize:!0,allowRowResize:!0,autoSelectRow:!1,autoSelectColumn:!1,autoSizeColumns:!0,autoSizeRows:!0,backgroundColor:"#000000",black:"#000000",white:"#ffffff",cellHorizontalPadding:5,headerHorizontalPadding:5,font:"12px Arial, sans serif",gridColumnColor:"#8f8f8f66",gridRowColor:"#8f8f8f66",headerBackgroundColor:"#222222",headerSeparatorColor:"#000000",headerSeparatorHoverColor:"#888888",headerSeparatorHandleSize:5,headerHiddenSeparatorSize:5,headerHiddenSeparatorHoverColor:"#8888FF",headerColor:"#d5d5d5",headerFont:"10px Arial, sans serif",columnHoverBackgroundColor:"#444444",selectedColumnHoverBackgroundColor:"#494949",rowBackgroundColors:"#333333 #222222",rowHoverBackgroundColor:"#444444",selectedRowHoverBackgroundColor:"#494949",minScrollHandleSize:50,scrollBarBackgroundColor:"#111111",scrollBarHoverBackgroundColor:"#333333",scrollBarCasingColor:"#000000",scrollBarCornerColor:"#000000",scrollBarColor:"#555555",scrollBarHoverColor:"#888888",scrollBarActiveColor:"#AAAAAA",scrollBarSize:12,scrollBarHoverSize:16,scrollBarCasingWidth:1,scrollSnapToColumn:!1,scrollSnapToRow:!1,selectionColor:"#4286f433",selectionOutlineColor:"#4286f4",selectionOutlineCasingColor:"#222222",scrollBarSelectionTick:!0,scrollBarSelectionTickColor:"#4286f433",scrollBarActiveSelectionTickColor:"#4286f480",shadowBlur:8,shadowColor:"#000000",textColor:"#ffffff",maxDepth:6,treeDepthIndent:10,treeHorizontalPadding:5,treeLineColor:"#888888",treeMarkerColor:"#cccccc",treeMarkerHoverColor:"#ffffff",rowHeight:20,columnWidth:100,minRowHeight:20,minColumnWidth:55,columnHeaderHeight:20,rowHeaderWidth:30,rowFooterWidth:0,headerResizeSnapThreshold:10,headerResizeHiddenSnapThreshold:8,allowColumnReorder:!0,allowRowReorder:!0,reorderOffset:2,floatingGridColumnColor:"#8f8f8f66",floatingGridRowColor:"#8f8f8f66",floatingRowBackgroundColors:"#393939 #292929",floatingDividerOuterColor:"#000000",floatingDividerInnerColor:"#cccccc"}),pt=(e,t)=>{let n=!1;const s=be(e,{...t,dispose:()=>{n||(n=!0,s.clear(),n=!1)}});return s};function sd(e,t,n=6){const s=yi.hex.lab.raw(e);return s[0]=Math.max(s[0]-s[0]/n*t,0),`#${yi.lab.hex(s)}`}function od(e,t){const[n,s,o]=yi.hex.rgb(e);return`rgba(${n}, ${s}, ${o}, ${t})`}const Dr={colorWithAlpha:od,darkenForDepth:sd};class Ye{constructor(t=5e3){this.cursor=null,this.order=t}onDown(t,n,s){return!1}onMove(t,n,s){return!1}onDrag(t,n,s){return!1}onLeave(t,n,s){return!1}onClick(t,n,s){return!1}onContextMenu(t,n,s){return!1}onDoubleClick(t,n,s){return!1}onUp(t,n,s){return!1}onWheel(t,n,s){return!1}}class Sl extends Ye{constructor(){super(...arguments),this.resizingItems=[],this.hiddenItems=[],this.targetSizes=new Map,this.dragOffset=0}onDown(t,n){const{metrics:s}=n,{model:o}=n.props,i=n.getTheme();if(!s)throw new Error("metrics not set");const r=this.getSeparator(t,s,o,i);if(r!=null){const l=r.index;return this.dragOffset=0,this.draggingIndex=l,this.resizingItems=[l],this.hiddenItems=this.getHiddenItems(l,s).reverse(),this.targetSizes.clear(),this.addTargetSize(s,l),this.updateCursor(s,l),this.updateSeparator(n,r),!0}return!1}onMove(t,n){const{metrics:s}=n,{model:o}=n.props,i=n.getTheme();if(!s)throw new Error("metrics not set");const r=this.getSeparator(t,s,o,i);return r!=null?(this.updateCursor(s,r.index),!0):!1}onDrag(t,n){var f;if(this.draggingIndex==null)return!1;const s=t[this.pointProperty],{metricCalculator:o,metrics:i}=n;if(!i)throw new Error("metrics not set");const r=n.getTheme(),l=i[this.visibleOffsetProperty],a=i[this.marginProperty],c=i[this.calculatedSizesProperty],d=i[this.modelIndexesProperty],u=i[this.firstIndexProperty],h=i[this.treePaddingProperty],g=new Map;let p=this.resizingItems[this.resizingItems.length-1];for(;p!=null;){const C=O(l,p),w=s-a-C-this.dragOffset,S=O(d,p),T=this.targetSizes.get(S),R=this.resizingItems.length>1,b=this.hiddenItems.indexOf(p);let v=O(c,S);p===u&&(v+=h);let D=w;Math.abs(w-v)<=r.headerResizeSnapThreshold?D=v:T!==void 0&&w>T&&(R&&b!==0||b>0)?D=T:w<=r.headerResizeHiddenSnapThreshold&&(D=0),g.set(S,D),w<-r.headerResizeSnapThreshold&&D===0?b>=0&&R?(this.resizingItems.pop(),this.removeTargetSize(i,p),p=this.resizingItems[this.resizingItems.length-1],this.dragOffset-=(f=this.targetSizes.get(O(d,p)))!=null?f:0):(p=this.getNextShownItem(p,i),p!==null&&(this.resizingItems.push(p),this.addTargetSize(i,p))):T!==void 0&&w>T+r.headerResizeSnapThreshold&&D===T?b>0?(this.dragOffset+=D,p=this.hiddenItems[b-1],this.resizingItems.push(p),this.addTargetSize(i,p)):R?(this.resizingItems.pop(),this.removeTargetSize(i,p),p=this.resizingItems[this.resizingItems.length-1]):p=null:p=null}return g.forEach((C,w)=>{var T;const S=(T=o[this.initialSizesProperty].get(w))!=null?T:c.get(w);C===S?this.resetSize(o,w):this.setSize(o,w,C)}),this.updateCursor(i,this.draggingIndex),!0}onUp(t,n){return this.draggingIndex!=null&&(this.draggingIndex=void 0,this.resizingItems=[],this.hiddenItems=[],this.targetSizes.clear(),this.updateSeparator(n,null)),!1}onDoubleClick(t,n){const{metrics:s,metricCalculator:o}=n,{model:i}=n.props,r=n.getTheme();if(!s)throw new Error("metrics not set");const l=this.getSeparator(t,s,i,r);if(l!=null){const a=s[this.modelIndexesProperty],c=O(a,l.index),d=O(s[this.calculatedSizesProperty],c),u=o[this.initialSizesProperty].get(c);return d===u?this.resetSize(o,c):this.setSize(o,c,d),n.forceUpdate(),!0}return!1}updateCursor(t,n){const s=t[this.visibleSizesProperty];O(s,n)===0?this.cursor=this.hiddenCursor:this.cursor=this.defaultCursor}addTargetSize(t,n){const s=t[this.modelIndexesProperty],o=t[this.userSizesProperty],i=t[this.calculatedSizesProperty],r=n===0?t[this.treePaddingProperty]:0,l=O(s,n);let a=o.get(l);(a==null||a===0)&&(a=O(i,l)+r),this.targetSizes.set(l,a)}removeTargetSize(t,n){const s=t[this.modelIndexesProperty],o=O(s,n);this.targetSizes.delete(o)}}class Ko extends Sl{constructor(){super(...arguments),this.hiddenCursor="e-resize",this.defaultCursor="col-resize",this.pointProperty="x",this.userSizesProperty="userColumnWidths",this.visibleOffsetProperty="visibleColumnXs",this.visibleSizesProperty="visibleColumnWidths",this.marginProperty="rowHeaderWidth",this.calculatedSizesProperty="calculatedColumnWidths",this.initialSizesProperty="initialColumnWidths",this.modelIndexesProperty="modelColumns",this.firstIndexProperty="firstColumn",this.treePaddingProperty="treePaddingX",this.getHiddenItems=H.getHiddenColumns,this.getNextShownItem=H.getNextShownColumn,this.getSeparator=Ko.getColumnSeparator}static getColumnSeparator(t,n,s,o){if(!o.allowColumnResize)return null;const{x:i,y:r,columnHeaderDepth:l}=t,{modelColumns:a}=n,c=H.getColumnSeparatorIndex(i,r,n,o);return c==null||l==null||l>0?null:a.get(c)!=null?{index:c,depth:0}:null}setSize(t,n,s){t.setColumnWidth(n,s)}resetSize(t,n){t.resetColumnWidth(n)}updateSeparator(t,n){t.setState({draggingColumnSeparator:n,isDragging:n!==null})}}const tn=class{constructor(){this.getCachedTruncatedString=pt((e,t,n,s,o)=>tn.truncateToWidth(e,t,n,s,o),{max:1e4}),this.getCachedBackgroundColors=pt((e,t)=>e.split(" ").map(n=>{const s=[];for(let o=0;o<t;o+=1)s.push(Dr.darkenForDepth(n,o,t));return s}),{max:1e3}),this.getCachedColorWithAlpha=pt((e,t)=>Dr.colorWithAlpha(e,t),{max:1e3}),this.getCachedColorIsDark=pt(e=>Yo.isDark(e),{max:1e3})}static truncate(e,t){return t<e.length?e.substr(0,t)+"\u2026":e}static binaryTruncateToWidth(e,t,n,s=0,o=t.length,i){if(o>=t.length&&e.measureText(t).width<=n)return t;if(i!==void 0){const c=e.measureText(i).width;return i.repeat(Math.max(1,Math.floor(n/c)))}let r=s,l=Math.min(t.length-1,o),a=t;for(;l>=r;){const c=Math.ceil((l+r)/2),d=tn.truncate(t,c);if(e.measureText(d).width<=n){if(a=d,r===c)break;r=c}else if(c===0){a=d;break}else l=c-1}return a}static truncateToWidth(e,t,n,s=tn.DEFAULT_FONT_WIDTH,o){if(n<=0||t.length<=0)return"";const i=Math.min(Math.max(0,Math.floor(n/s/2)-5),t.length),r=Math.min(Math.ceil(n/s*2),t.length);return tn.binaryTruncateToWidth(e,t,n,i,r,o)}drawCanvas(e){const{context:t}=e;t.save(),this.configureContext(t,e),this.drawBackground(t,e),this.drawGrid(t,e),this.drawHeaders(t,e),this.drawFooters(t,e),this.drawDraggingColumn(t,e),this.drawDraggingRow(t,e),this.drawScrollBars(t,e),t.restore()}configureContext(e,t){const{theme:n}=t;e.font=n.font,e.textBaseline="middle",e.lineCap="butt"}drawBackground(e,t){const{theme:n,metrics:s}=t,{width:o,height:i}=s;e.fillStyle=n.backgroundColor,e.fillRect(0,0,o,i)}drawGrid(e,t){const{metrics:n,draggingRow:s,draggingColumn:o}=t,{gridX:i,gridY:r}=n;e.translate(i,r),this.drawGridBackground(e,t,s==null&&o==null),this.drawCellContents(e,t),this.drawFloatingRows(e,t),this.drawFloatingColumns(e,t),e.translate(-i,-r)}drawFloatingRows(e,t){const{draggingRow:n,draggingColumn:s,metrics:o,theme:i}=t,{floatingTopRowCount:r,floatingBottomRowCount:l,floatingRows:a,rowCount:c,visibleColumns:d,allRowYs:u,allRowHeights:h}=o;if(a.length!==0){i.floatingRowBackgroundColors&&this.drawRowStripesForRows(e,t,a,i.floatingRowBackgroundColors),n==null&&s==null&&this.drawFloatingMouseRowHover(e,t),this.drawGridLinesForItems(e,t,d,a,i.floatingGridColumnColor,i.floatingGridRowColor),this.drawCellBackgroundsForItems(e,t,d,a),this.drawFloatingBorders(e,t),r>0&&this.drawSelectedRanges(e,t,{top:0,bottom:r-1,maxY:O(u,r-1)+O(h,r-1)-.5}),l>0&&this.drawSelectedRanges(e,t,{top:c-l-1,bottom:c-1,minY:O(u,c-l)+.5,maxY:O(u,c-1)+O(h,c-1)-.5});for(let g=0;g<d.length;g+=1){const p=d[g];for(let f=0;f<a.length;f+=1){const C=a[f];this.drawCellContent(e,t,p,C)}}}}drawFloatingColumns(e,t){const{draggingRow:n,draggingColumn:s,metrics:o,theme:i}=t,{floatingLeftColumnCount:r,floatingRightColumnCount:l,floatingLeftWidth:a,floatingRightWidth:c,floatingColumns:d,gridX:u,maxX:h,columnCount:g,visibleRows:p,allColumnXs:f,allColumnWidths:C,width:w,height:S}=o;if(d.length!==0){i.floatingRowBackgroundColors&&(this.drawRowStripesForRows(e,t,p,i.floatingRowBackgroundColors,0,a),this.drawRowStripesForRows(e,t,p,i.floatingRowBackgroundColors,w-u-c,h)),n==null&&s==null&&this.drawFloatingMouseRowHover(e,t),e.save(),e.beginPath(),e.rect(0,0,a,S),e.clip(),this.drawGridLinesForItems(e,t,d,p,i.floatingGridColumnColor,i.floatingGridRowColor),e.restore(),this.drawCellBackgroundsForItems(e,t,d,p),this.drawFloatingBorders(e,t),r>0&&this.drawSelectedRanges(e,t,{left:0,maxX:O(f,r-1)+O(C,r-1)}),l>0&&this.drawSelectedRanges(e,t,{left:g-l,right:g-1,minX:O(f,g-l)+.5,maxX:O(f,g-1)+O(C,g-1)});for(let T=0;T<d.length;T+=1){const R=d[T];for(let b=0;b<p.length;b+=1){const v=p[b];this.drawCellContent(e,t,R,v)}}}}drawFloatingBorders(e,t){const{metrics:n,theme:s}=t,{floatingTopRowCount:o,floatingBottomRowCount:i,floatingLeftColumnCount:r,floatingRightColumnCount:l,rowCount:a,columnCount:c,allRowYs:d,allColumnXs:u,allRowHeights:h,allColumnWidths:g,maxX:p,maxY:f}=n,{floatingDividerOuterColor:C,floatingDividerInnerColor:w}=s;if(e.lineWidth=3,e.beginPath(),e.strokeStyle=C,o>0){const S=O(d,o-1)+O(h,o-1)+.5;e.moveTo(0,S),e.lineTo(p,S)}if(i>0){const S=O(d,a-i)-.5;e.moveTo(0,S),e.lineTo(p,S)}if(r>0){const S=O(u,r-1)+O(g,r-1)+.5;e.moveTo(S,0),e.lineTo(S,f)}if(l>0){const S=O(u,c-l)-.5;e.moveTo(S,0),e.lineTo(S,f)}if(e.stroke(),e.beginPath(),e.lineWidth=1,e.strokeStyle=w,o>0){const S=O(d,o-1)+O(h,o-1)+.5;e.moveTo(0,S),e.lineTo(p,S)}if(i>0){const S=O(d,a-i)-.5;e.moveTo(0,S),e.lineTo(p,S)}if(r>0){const S=O(u,r-1)+O(g,r-1)+.5;e.moveTo(S,0),e.lineTo(S,f)}if(l>0){const S=O(u,c-l)-.5;e.moveTo(S,0),e.lineTo(S,f)}e.stroke()}drawGridBackground(e,t,n=!1){this.drawRowStripes(e,t),n&&(this.drawMouseColumnHover(e,t),this.drawMouseRowHover(e,t)),this.drawGridLines(e,t),this.drawCellBackgrounds(e,t);const{metrics:s}=t,{bottom:o,right:i,floatingBottomRowCount:r,floatingLeftColumnCount:l,floatingRightColumnCount:a,floatingTopRowCount:c,columnCount:d,rowCount:u,allRowHeights:h,allRowYs:g,allColumnXs:p,allColumnWidths:f,width:C,height:w}=s;this.drawSelectedRanges(e,t,{bottom:Math.min(o,u-r-1),right:Math.min(i,d-a-1),minX:l>0&&p.has(l+1)?O(p,l+1):-10,minY:c>0&&g.has(c+1)?O(g,c+1):-10,maxX:a>0&&p.has(d-a-1)?O(p,d-a-1)+O(f,d-a-1)-.5:C+10,maxY:r>0&&g.has(u-r-1)?O(g,u-r-1)+O(h,u-r-1)-.5:w+10})}drawRowStripes(e,t){const{metrics:n,theme:s}=t,{visibleRows:o}=n,{rowBackgroundColors:i}=s;!i||this.drawRowStripesForRows(e,t,o,i)}drawRowStripesForRows(e,t,n,s,o=0,i=t.metrics.maxX){const{theme:r,metrics:l,model:a}=t,{maxDepth:c,shadowBlur:d,shadowColor:u}=r,h=this.getCachedBackgroundColors(s,c),{allRowYs:g,allRowHeights:p}=l,f=new Map,C=[],w=[],S=(T,R)=>{const b=Ae(a)?a.depthForRow(T):0,v=h[T%h.length],D=v[Math.min(b,v.length-1)];if(f.has(D)||f.set(D,[]),f.get(D).push(T),R!=null){const A=Ae(a)?a.depthForRow(R):0;A<b?C.push(T):A>b&&w.push(R)}};for(let T=0;T<n.length;T+=1){const R=n[T],b=T>0?n[T-1]:void 0;S(R,b)}if(f.forEach((T,R)=>{e.fillStyle=R,e.beginPath();for(let b=0;b<T.length;b+=1){const v=T[b],D=O(g,v),A=O(p,v);e.rect(o,D,i,A)}e.fill()}),C.length>0){e.save();const T=this.getCachedColorWithAlpha(u,.15),R=this.getCachedColorWithAlpha(u,0),b=e.createLinearGradient(0,0,0,d);b.addColorStop(0,T),b.addColorStop(1,R),e.fillStyle=b;for(let v=0;v<C.length;v+=1){const D=C[v],A=O(g,D);e.translate(0,A),e.fillRect(o,0,i,d),e.translate(0,-A)}e.restore()}if(w.length>0){e.save();const T=this.getCachedColorWithAlpha(u,0),R=this.getCachedColorWithAlpha(u,.15),b=e.createLinearGradient(0,0,0,d);b.addColorStop(0,T),b.addColorStop(1,R),e.fillStyle=b;for(let v=0;v<w.length;v+=1){const D=w[v],A=O(g,D),N=O(p,D),L=A+N-d;e.translate(0,L),e.fillRect(o,0,i,d),e.translate(0,-L)}e.restore()}}drawMouseColumnHover(e,t){const{mouseX:n,mouseY:s,theme:o,metrics:i}=t;if(n==null||s==null)return;const r=H.getColumnAtX(n,i);if(r==null||o.columnHoverBackgroundColor==null)return;const{allColumnWidths:l,allColumnXs:a,maxY:c}=i;if(s>c)return;const d=O(a,r),u=O(l,r);e.fillStyle=o.columnHoverBackgroundColor,e.fillRect(d,0,u,c)}drawMouseRowHover(e,t){const{mouseX:n,mouseY:s,theme:o,metrics:i}=t;if(n==null||s==null)return;const{maxX:r}=i;if(n>r||o.rowHoverBackgroundColor==null)return;const l=H.getRowAtY(s,i);l!=null&&this.drawMouseRowHoverForRow(e,t,l)}drawFloatingMouseRowHover(e,t){const{mouseX:n,mouseY:s,theme:o,metrics:i}=t,{maxX:r,floatingTopRowCount:l,floatingBottomRowCount:a,rowCount:c,rowFooterWidth:d}=i;if(n==null||s==null||n>r+d||o.rowHoverBackgroundColor==null)return;const u=H.getRowAtY(s,i);u!=null&&(u<l||c-a<=u)&&this.drawMouseRowHoverForRow(e,t,u)}drawMouseRowHoverForRow(e,t,n){const{metrics:s,selectedRanges:o,theme:i}=t,{allRowHeights:r,allRowYs:l,maxX:a}=s,c=O(l,n),d=O(r,n);i.rowHoverBackgroundColor!=null&&(e.fillStyle=i.rowHoverBackgroundColor);for(let u=0;u<o.length;u+=1){const{startRow:h,endRow:g}=o[u];if(h!=null&&g!=null&&h<=n&&g>=n){i.selectedRowHoverBackgroundColor!=null&&(e.fillStyle=i.selectedRowHoverBackgroundColor);break}}e.fillRect(0,c,a,d)}drawGridLines(e,t){const{metrics:n,theme:s}=t,{visibleColumns:o,visibleRows:i}=n;this.drawGridLinesForItems(e,t,o,i,s.gridColumnColor,s.gridRowColor)}drawGridLinesForItems(e,t,n,s,o,i){o==null&&i==null||(e.lineWidth=1,e.beginPath(),o!=null&&(e.strokeStyle=o,this.drawGridLinesForColumns(e,t,n)),i!=null&&(e.strokeStyle=i,this.drawGridLinesForRows(e,t,s)),e.stroke())}drawGridLinesForColumns(e,t,n){const{metrics:s}=t,{allColumnXs:o,maxY:i}=s;for(let r=0;r<n.length;r+=1){const l=n[r],a=O(o,l)+.5;e.moveTo(a,0),e.lineTo(a,i)}}drawGridLinesForRows(e,t,n){const{metrics:s}=t,{allRowYs:o,maxX:i}=s,r=i;for(let l=0;l<n.length;l+=1){const a=n[l],c=O(o,a)+.5;e.moveTo(.5,c),e.lineTo(r-.5,c)}}drawCellBackgrounds(e,t){const{metrics:n}=t,{visibleColumns:s,visibleRows:o}=n;this.drawCellBackgroundsForItems(e,t,s,o)}drawCellBackgroundsForItems(e,t,n,s){e.save();for(let o=0;o<n.length;o+=1){const i=n[o];for(let r=0;r<s.length;r+=1){const l=s[r],a=r+1<s.length?s[r+1]:void 0;this.drawCellBackground(e,t,i,l,a)}}e.restore()}drawCellBackground(e,t,n,s,o){const{metrics:i,model:r,theme:l}=t,{firstColumn:a,modelColumns:c,modelRows:d,allColumnXs:u,allColumnWidths:h,allRowYs:g,allRowHeights:p}=i,f=O(d,s),C=O(c,n),w=r.backgroundColorForCell(C,f,l),S=n===a,T=Ae(r)&&r.hasExpandableRows;if(w!=null){const R=O(u,n)+1,b=O(g,s)+1,v=O(h,n)-1,D=O(p,s)-1;e.fillStyle=w,e.fillRect(R,b,v,D)}S&&T&&this.drawCellRowTreeDepthLines(e,t,s,o)}drawCellContents(e,t){const{metrics:n}=t,{visibleColumns:s}=n;for(let o=0;o<s.length;o+=1){const i=s[o];this.drawColumnCellContents(e,t,i)}}drawColumnCellContents(e,t,n){const{metrics:s}=t,{allColumnXs:o,allColumnWidths:i,visibleRows:r,height:l}=s,a=O(o,n),c=O(i,n);e.save(),e.beginPath(),e.rect(a,0,c,l),e.clip();for(let d=0;d<r.length;d+=1){const u=r[d];this.drawCellContent(e,t,n,u)}e.restore()}getTextRenderMetrics(e,t,n,s){const{textAlign:o}=e,{metrics:i,model:r,theme:l}=t,{firstColumn:a,allColumnXs:c,allColumnWidths:d,allRowYs:u,allRowHeights:h}=i,{cellHorizontalPadding:g,treeDepthIndent:p,treeHorizontalPadding:f}=l,C=O(c,n),w=O(u,s),S=O(d,n),T=O(h,s),R=n===a;let b=0;Ae(r)&&r.hasExpandableRows&&R&&(b=p*(r.depthForRow(s)+1)+f);const v=S-b;let D=C+g;const A=w+T*.5;return o==="right"?D=C+v-g:o==="center"&&(D=C+v*.5),D+=b,{width:v-g*2,x:D,y:A}}drawCellContent(e,t,n,s,o){var R;const{metrics:i,model:r,theme:l}=t,{firstColumn:a,fontWidths:c,modelColumns:d,modelRows:u,allRowHeights:h}=i,{textColor:g}=l,p=O(h,s),f=O(u,s),C=O(d,n),w=o!=null?o:r.textForCell(C,f),S=r.truncationCharForCell(C,f),T=n===a;if(w&&p>0){const b=r.textAlignForCell(C,f)||"left";e.textAlign=b;const v=r.colorForCell(C,f,l)||g;e.fillStyle=v;const{width:D,x:A,y:N}=this.getTextRenderMetrics(e,t,n,s),L=(R=c.get(e.font))!=null?R:tn.DEFAULT_FONT_WIDTH,k=this.getCachedTruncatedString(e,w,D,L,S);k&&e.fillText(k,A,N)}T&&Ae(r)&&r.hasExpandableRows&&this.drawCellRowTreeMarker(e,t,s)}drawCellRowTreeMarker(e,t,n){const{metrics:s,model:o,mouseX:i,mouseY:r,theme:l}=t,{firstColumn:a,gridX:c,gridY:d,allColumnXs:u,allColumnWidths:h,allRowYs:g,allRowHeights:p,visibleRowTreeBoxes:f}=s,{treeMarkerColor:C,treeMarkerHoverColor:w}=l,S=O(u,a),T=O(h,a),R=O(g,n),b=O(p,n);if(!Ae(o)||!o.isRowExpandable(n))return;const v=O(f,n),D=i!=null&&r!=null&&i>=c+S&&i<=c+S+T&&r>=d+R&&r<=d+R+b?w:C;this.drawTreeMarker(e,t,S,R,v,D,o.isRowExpanded(n))}drawTreeMarker(e,t,n,s,o,i,r){const{x1:l,y1:a,x2:c,y2:d}=o,u=r?"\u229F":"\u229E",h=n+(l+c)*.5+.5,g=s+(a+d)*.5+.5;e.fillStyle=i,e.textAlign="center",e.fillText(u,h,g)}drawCellRowTreeDepthLines(e,t,n,s){const{metrics:o,model:i,theme:r}=t;if(!Ae(i))return;const l=i.depthForRow(n);if(l===0)return;const{firstColumn:a,allColumnXs:c,allRowYs:d,allRowHeights:u}=o,{treeDepthIndent:h,treeHorizontalPadding:g,treeLineColor:p}=r,f=O(c,a),C=O(d,n),w=O(u,n),S=s!==void 0?i.depthForRow(s):0,T=l>S?l-S:0;if(e.strokeStyle=p,e.lineWidth=1,l-T>0){e.beginPath();for(let R=0;R<l-T;R+=1){const b=f+R*h+h*.5+g+.5;e.moveTo(b,C),e.lineTo(b,C+w)}e.stroke()}if(T>0){e.beginPath();for(let R=l-T;R<l;R+=1){const b=f+R*h+h*.5+g+.5;e.moveTo(b,C),e.lineTo(b,C+Math.ceil(w/2)),e.moveTo(b-.5,C+Math.ceil(w/2)+.5),e.lineTo(b+h-.5,C+Math.ceil(w/2)+.5)}e.stroke()}}drawHeaders(e,t){const{theme:n}=t;e.font=n.headerFont,this.drawColumnHeaders(e,t),this.drawRowHeaders(e,t)}drawFooters(e,t){const{theme:n}=t;e.font=n.headerFont,this.drawRowFooters(e,t)}drawColumnHeaders(e,t){const{mouseX:n,mouseY:s,theme:o,metrics:i,draggingColumnSeparator:r,isDragging:l,model:a}=t,{columnHeaderHeight:c,floatingColumns:d,gridX:u,width:h,visibleColumns:g,allColumnWidths:p,allColumnXs:f,floatingLeftColumnCount:C,floatingLeftWidth:w,floatingRightWidth:S,modelColumns:T,columnHeaderMaxDepth:R}=i;if(c<=0)return;const{headerHiddenSeparatorSize:b,headerHiddenSeparatorHoverColor:v,headerSeparatorColor:D,headerSeparatorHoverColor:A}=o,N=c*.5,L=c*(R-1)+c*.5-N*.5,k=C>0;if(e.save(),this.drawColumnHeadersForRange(e,t,[g[0],g[g.length-1]],{minX:u+w,maxX:h-S}),k&&this.drawColumnHeadersForRange(e,t,[d[0],d[d.length-1]],{minX:u,maxX:u+w}),D){e.strokeStyle=D;const x=[...p.entries()].filter(([W,V])=>V===0).map(([W])=>W);e.beginPath(),e.fillStyle=D;for(let W=0;W<x.length;W+=1){const V=x[W],K=O(f,V),Z=O(p,V),$=u+K+Z+.5-b*.5;e.rect($,L,b,N)}e.fill()}if(A){let{index:x,depth:W}=r!=null?r:{};if(x==null&&n!=null&&s!=null){const K=Ko.getColumnSeparator(H.getGridPointFromXY(n,s,i),i,a,o);x=K==null?void 0:K.index,W=K==null?void 0:K.depth}let V;if(x==null)V=!1;else{const K=T.get(x),Z=T.get(x+1);K==null||Z==null?V=!1:V=a.textForColumnHeader(K,W)!==a.textForColumnHeader(Z,W)}if(V&&x!=null&&W!=null&&(!l||r!=null)){e.strokeStyle=A;const K=O(f,x),Z=O(p,x),$=u+K+Z+.5,P=g.indexOf(x),G=P<g.length-1?g[P+1]:null,X=G!=null?p.get(G):null,j=Z===0,de=X!=null&&X===0;j?(e.strokeStyle=v,e.fillStyle=v,e.fillRect($,L,b*.5,N)):de&&(e.fillStyle=A,e.fillRect($-b*.5,L,b*.5,N)),e.beginPath(),e.moveTo($,(R-W-1)*c),e.lineTo($,(R-W)*c-1),e.stroke()}}e.restore()}drawColumnHeadersForRange(e,t,n,s){const{model:o}=t,{columnHeaderMaxDepth:i}=o;if(i!==0)for(let r=0;r<=i;r+=1)this.drawColumnHeadersAtDepth(e,t,n,s,r)}drawColumnHeadersAtDepth(e,t,n,s,o){var D,A,N,L,k,x;const{metrics:i,model:r,theme:l}=t,{modelColumns:a,allColumnXs:c,gridX:d,calculatedColumnWidths:u,userColumnWidths:h,allColumnWidths:g,movedColumns:p}=i,{columnHeaderHeight:f,columnWidth:C}=l,{columnHeaderMaxDepth:w}=r,{minX:S,maxX:T}=s,R=T-S;if(w===0)return;const b=n[0],v=n[1];if(e.save(),e.translate(0,(w-o-1)*f),o===0){this.drawColumnHeader(e,t,"",S,T);for(let W=b;W<=v;W+=1)this.drawColumnHeaderAtIndex(e,t,W,s)}if(o>0){let W=b;for(;W<=v;){const{columnCount:V}=i,K=O(a,W),Z=r.textForColumnHeader(K,o),$=r.colorForColumnHeader(K,o);let P=O(c,W)+d,G=P+O(g,W);if(Z!=null){let X=W-1;for(;X>=0&&(G-P<R||P>S);){const Ce=(D=a.get(X))!=null?D:H.getModelIndex(X,p);if(Ce==null||r.textForColumnHeader(Ce,o)!==Z)break;P-=(N=(A=h.get(Ce))!=null?A:u.get(Ce))!=null?N:C,X-=1}let j=W+1;for(;j<V&&(G-P<R||G<T);){const Ce=(L=a.get(j))!=null?L:H.getModelIndex(j,p);if(r.textForColumnHeader(Ce,o)!==Z)break;G+=(x=(k=h.get(Ce))!=null?k:u.get(Ce))!=null?x:C,j+=1}W=j-1;const de=G-P>=R;let me=P;de&&(G<T?me=G-R:P<S&&(me=S)),this.drawColumnHeader(e,t,Z,me,Math.min(G-P,R),{backgroundColor:$!=null?$:void 0},s)}W+=1}}e.restore()}drawColumnHeaderAtIndex(e,t,n,s){var p;const{metrics:o,model:i}=t,{modelColumns:r,allColumnWidths:l,allColumnXs:a,gridX:c}=o,d=O(l,n),u=O(a,n)+c,h=O(r,n),g=i.textForColumnHeader(h);g!=null&&this.drawColumnHeader(e,t,g,u,d,{backgroundColor:(p=i.colorForColumnHeader(h))!=null?p:void 0},s)}drawColumnHeader(e,t,n,s,o,i,r){var j;if(o<=0)return;const{metrics:l,theme:a}=t,{headerHorizontalPadding:c,columnHeaderHeight:d,headerBackgroundColor:u,headerColor:h,headerSeparatorColor:g,black:p,white:f}=a,{fontWidths:C,width:w}=l,S=(j=C.get(e.font))!=null?j:tn.DEFAULT_FONT_WIDTH,R=(o-c*2)/S,{backgroundColor:b=u,separatorColor:v=g}=i!=null?i:{};let{textColor:D=h}=i!=null?i:{};try{const de=this.getCachedColorIsDark(b),me=this.getCachedColorIsDark(D);de&&me?D=f:!de&&!me&&(D=p)}catch{}let{minX:A=0,maxX:N=w}=r!=null?r:{};e.save(),e.rect(A,0,N-A,d),e.clip(),b!=null&&(e.fillStyle=b,e.fillRect(s,0,o,d)),v!=null&&(e.strokeStyle=v,e.beginPath(),s>0&&(e.moveTo(s+.5,0),e.lineTo(s+.5,d)),e.moveTo(s+o+.5,0),e.lineTo(s+o+.5,d),e.moveTo(s,d-.5),e.lineTo(s+o,d-.5),e.stroke()),e.beginPath(),e.rect(s,0,o,d),e.clip(),e.fillStyle=D;let L=n;R<=0?L="":L.length>R&&(L=`${L.substring(0,R-1)}\u2026`);const k=L.length*S;let x=s+o*.5;const W=d*.5;A+=c,N-=c;const V=s+c,K=Be(V,A,N),Z=s+o-c,P=Be(Z,A,N)-K,G=x-k*.5<A,X=x+k*.5>N;G?k<P?x=A+k*.5:x=Z-k*.5:X&&(k<P?x=N-k*.5:x=V+k*.5),e.textAlign="center",e.fillText(L,x,W),e.restore()}drawRowHeaders(e,t){const{mouseX:n,mouseY:s,metrics:o,theme:i,draggingRowSeparator:r}=t,{gridY:l,rowHeaderWidth:a,height:c,visibleRows:d,allRowHeights:u,allRowYs:h}=o;if(a<=0)return;const{headerBackgroundColor:g,headerColor:p,headerHiddenSeparatorSize:f,headerHiddenSeparatorHoverColor:C,headerSeparatorColor:w,headerSeparatorHoverColor:S}=i,T=a*.5,R=a*.5-T*.5;if(e.save(),e.beginPath(),e.fillStyle=g,e.fillRect(0,0,a,c),w){e.strokeStyle=w,e.beginPath(),e.moveTo(0,l+.5),e.lineTo(a,l+.5);const b=[];let v=!1;for(let D=0;D<d.length;D+=1){const A=d[D],N=O(h,A),L=O(u,A);if(L>0){const k=l+N+L+.5;e.moveTo(0,k),e.lineTo(a,k),v=!1}else v||(v=!0,b.push(A))}e.moveTo(a-.5,0),e.lineTo(a-.5,c),e.stroke(),e.beginPath(),e.fillStyle=w;for(let D=0;D<b.length;D+=1){const A=b[D],N=O(h,A),L=O(u,A),k=l+N+L+.5-f*.5;e.rect(R,k,T,f)}e.fill()}if(S){let{index:b=null}=r!=null?r:{};if(b==null&&n!=null&&s!=null&&(b=H.getRowSeparatorIndex(n,s,o,i)),b!=null){e.strokeStyle=S;const v=O(h,b),D=O(u,b),A=l+v+D+.5,N=d.indexOf(b),L=N<d.length-1?d[N+1]:null,k=L!=null?u.get(L):null,x=D===0,W=k!=null&&k===0;x?(e.strokeStyle=C,e.fillStyle=C,e.fillRect(R,A,T,f*.5)):W&&(e.fillStyle=S,e.fillRect(R,A-f*.5,T,f*.5)),e.beginPath(),e.moveTo(.5,A),e.lineTo(a+.5,A),e.stroke()}}e.beginPath(),e.rect(0,l,a,c),e.clip(),e.fillStyle=p,e.textAlign="right";for(let b=0;b<d.length;b+=1){const v=d[b],D=O(u,v),A=O(h,v)+l;this.drawRowHeader(e,t,v,A,D)}e.restore()}drawRowHeader(e,t,n,s,o){if(o<=0)return;const{metrics:i,model:r,theme:l}=t,{modelRows:a,rowHeaderWidth:c}=i,d=O(a,n),u=c-l.cellHorizontalPadding,h=s+o*.5;e.fillText(r.textForRowHeader(d),u,h)}drawRowFooters(e,t){const{mouseX:n,mouseY:s,metrics:o,model:i,theme:r,draggingRowSeparator:l}=t,{gridY:a,gridX:c,maxX:d,modelRows:u,rowFooterWidth:h,height:g,verticalBarWidth:p,visibleRows:f,allRowHeights:C,allRowYs:w,width:S}=o;if(h<=0)return;const{cellHorizontalPadding:T,headerBackgroundColor:R,headerColor:b,headerHiddenSeparatorSize:v,headerHiddenSeparatorHoverColor:D,headerSeparatorColor:A,headerSeparatorHoverColor:N}=r,L=h*.5,k=h*.5-L*.5,x=Math.min(c+d,S-h-p);if(e.save(),e.beginPath(),e.fillStyle=R,e.fillRect(x,a,h,g),A){e.strokeStyle=A,e.beginPath(),e.moveTo(x,a+.5),e.lineTo(h,a+.5);const V=[];let K=!1;for(let Z=0;Z<f.length;Z+=1){const $=f[Z],P=O(w,$),G=O(C,$);if(G>0){const X=a+P+G+.5;e.moveTo(x+.5,X),e.lineTo(x+h-.5,X),K=!1}else K||(K=!0,V.push($))}e.moveTo(x+.5,a),e.lineTo(x+.5,g),e.stroke(),e.beginPath(),e.fillStyle=A;for(let Z=0;Z<V.length;Z+=1){const $=V[Z],P=O(w,$),G=O(C,$),X=a+P+G+.5-v*.5;e.rect(x+k,X,L,v)}e.fill()}if(N){let{index:V=null}=l!=null?l:{};if(V==null&&n!=null&&s!=null&&(V=H.getRowSeparatorIndex(n,s,o,r)),V!=null){e.strokeStyle=N;const K=O(w,V),Z=O(C,V),$=a+K+Z+.5,P=f.indexOf(V),G=P<f.length-1?f[P+1]:null,X=G!=null?C.get(G):null,j=Z===0,de=X!=null&&X===0;j?(e.strokeStyle=D,e.fillStyle=D,e.fillRect(k,$,L,v*.5)):de&&(e.fillStyle=N,e.fillRect(k,$-v*.5,L,v*.5)),e.beginPath(),e.moveTo(x+.5,$),e.lineTo(x+h+.5,$),e.stroke()}}e.beginPath(),e.rect(x,a,h,g),e.clip(),e.fillStyle=b,e.textAlign="left";const W=x+T;for(let V=0;V<f.length;V+=1){const K=f[V],Z=O(C,K);if(Z>0){const $=O(w,K)+a,P=O(u,K),G=$+Z*.5;e.fillText(i.textForRowFooter(P),W,G)}}e.restore()}drawSelectedRanges(e,t,n={}){const{cursorColumn:s,cursorRow:o,draggingRow:i,draggingColumn:r,editingCell:l,metrics:a,model:c,selectedRanges:d,theme:u}=t,{allColumnWidths:h,allColumnXs:g,allRowHeights:p,allRowYs:f,width:C,height:w}=a,{left:S=a.left,top:T=a.top,right:R=a.right,bottom:b=a.bottom,minY:v=-10,maxY:D=w+10,minX:A=-10,maxX:N=C+10}=n;if(d.length===0)return;const L=ke(c)&&c.isEditable&&l==null&&i==null&&r==null&&s!=null&&o!=null&&g.has(s)&&f.has(o);if(L){const k=O(g,s),x=O(f,o),W=O(h,s),V=O(p,o);e.save(),e.beginPath(),e.rect(0,0,C,w),e.rect(k,x,W,V),e.clip("evenodd")}e.beginPath();for(let k=0;k<d.length;k+=1){const x=d[k],W=x.startColumn!==null?x.startColumn:S,V=x.startRow!==null?x.startRow:T,K=x.endColumn!==null?x.endColumn:R,Z=x.endRow!==null?x.endRow:b;if(Z>=T&&b>=V&&K>=S&&R>=W){const $=W>=S&&g.has(W)?Math.round(O(g,W))+.5:A,P=V>=T&&f.has(V)?Math.max(Math.round(O(f,V))+.5,.5):v,G=K<=R&&g.has(K)?Math.round(O(g,K)+O(h,K))-.5:N,X=Z<=b&&f.has(Z)?Math.round(O(f,Z)+O(p,Z))-.5:D;e.rect($,P,G-$,X-P)}e.fillStyle=u.selectionColor,e.fill(),e.save(),e.clip(),e.strokeStyle=u.selectionOutlineCasingColor,e.lineWidth=3,e.stroke(),e.restore(),e.strokeStyle=u.selectionOutlineColor,e.lineWidth=1,e.stroke()}L&&s!=null&&o!=null&&(e.restore(),this.drawActiveCell(e,t,s,o))}drawActiveCell(e,t,n,s,o=tn.ACTIVE_CELL_BORDER_WIDTH){const{metrics:i,theme:r}=t,{allColumnWidths:l,allColumnXs:a,allRowHeights:c,allRowYs:d}=i,u=O(a,n),h=O(d,s),g=O(l,n),p=O(c,s);let f=u-o*.5,C=h-o*.5,w=g+o,S=p+o;f<=0&&(w+=f-1,f=1),C<=0&&(S+=C-1,C=1);const{lineWidth:T}=e;e.beginPath(),e.lineWidth=o,e.strokeStyle=r.selectionOutlineColor,this.drawRoundedRect(e,f,C,w,S),e.stroke(),e.lineWidth=T}drawRoundedRect(e,t,n,s,o,i=tn.DEFAULT_EDGE_RADIUS){e.beginPath(),e.moveTo(t+i,n),e.lineTo(t+s-i,n),e.quadraticCurveTo(t+s,n,t+s,n+i),e.lineTo(t+s,n+o-i),e.quadraticCurveTo(t+s,n+o,t+s-i,n+o),e.lineTo(t+i,n+o),e.quadraticCurveTo(t,n+o,t,n+o-i),e.lineTo(t,n+i),e.quadraticCurveTo(t,n,t+i,n),e.closePath()}drawDraggingColumn(e,t){var X;const{draggingColumn:n,metrics:s,mouseX:o,theme:i,model:r}=t;if(n==null||o==null)return;const{range:l,depth:a}=n,{gridX:c,gridY:d,allColumnXs:u,allColumnWidths:h,height:g,width:p,columnHeaderMaxDepth:f,columnHeaderHeight:C,movedColumns:w,modelColumns:S,floatingLeftWidth:T}=s,R=(X=S.get(l[0]))!=null?X:H.getModelIndex(l[0],w),b=r.getColumnHeaderGroup(R,a);if(a>0&&!b)return;const[v,D]=l,A=O(u,v),L=O(u,D)+O(h,D)-A,k=n.left,{backgroundColor:x,font:W,headerFont:V,reorderOffset:K,shadowBlur:Z,shadowColor:$}=i,P=(f-a-1)*C;e.save(),e.translate(c,0),e.save(),e.beginPath(),e.rect(T,0,p,g),e.clip(),e.fillStyle=x,e.fillRect(A,P,L,g),e.restore(),e.translate(0,K),e.save(),e.shadowColor=$,e.shadowBlur=Z,e.fillStyle=x,e.fillRect(n.left,P+K,n.width,g),e.restore(),e.beginPath(),e.rect(n.left,P,n.width+1,g),e.clip(),e.translate(k-A,0),e.font=V;const G=[];for(let j=n.range[0];j<=n.range[1];j+=1)G.push(j);this.drawColumnHeaders(e,t),this.drawColumnHeadersForRange(e,t,[G[0],G[G.length-1]],{minX:A,maxX:p}),e.translate(0,d),e.font=W,this.drawGridBackground(e,t);for(let j=v;j<=D;j+=1)this.drawColumnCellContents(e,t,j);e.restore()}drawDraggingRow(e,t){const{draggingRow:n,draggingRowOffset:s,metrics:o,mouseY:i,theme:r}=t;if(n==null||i==null)return;const{gridX:l,gridY:a,allRowYs:c,allRowHeights:d,width:u}=o,h=O(c,n),g=O(d,n)+1,{backgroundColor:p,font:f,headerFont:C,reorderOffset:w,shadowBlur:S,shadowColor:T}=r;e.save(),e.translate(0,a),e.fillStyle=p,e.fillRect(0,h,u,g),e.translate(l+w,i-h-a-(s!=null?s:0)),e.save(),e.shadowColor=T,e.shadowBlur=S,e.fillStyle=p,e.fillRect(-l,h,u,g),e.restore(),e.beginPath(),e.rect(-l,h,u,g),e.clip(),e.font=f,this.drawGridBackground(e,t),this.drawCellContents(e,t),e.translate(-l,-a),e.font=C,this.drawRowHeaders(e,t),e.restore()}drawScrollBars(e,t){const{isDraggingHorizontalScrollBar:n,isDraggingVerticalScrollBar:s,isDragging:o,metrics:i,mouseX:r,mouseY:l,theme:a}=t;if(a.scrollBarSize<=0)return;const{width:c,height:d,handleHeight:u,handleWidth:h,scrollX:g,scrollY:p,hasHorizontalBar:f,hasVerticalBar:C,barWidth:w,barHeight:S,barLeft:T,barTop:R}=i,{scrollBarBackgroundColor:b,scrollBarHoverBackgroundColor:v,scrollBarCasingColor:D,scrollBarCornerColor:A,scrollBarColor:N,scrollBarHoverColor:L,scrollBarActiveColor:k,scrollBarSize:x,scrollBarHoverSize:W,scrollBarCasingWidth:V,scrollBarSelectionTick:K,scrollBarSelectionTickColor:Z,scrollBarActiveSelectionTickColor:$,autoSelectRow:P,autoSelectColumn:G}=a,X=r!=null&&l!=null&&r<=c&&l<=d,j=s||C&&!n&&!o&&r!=null&&l!=null&&r>=c-W&&l>=R&&X,de=n||f&&!s&&!o&&!j&&r!=null&&l!=null&&l>=d-W&&r>=T&&X,me=de?W:x,Ce=j?W:x;if(e.translate(T,R),f&&C&&(e.fillStyle=D,e.fillRect(c-T-x,d-R-x,x,x),e.fillStyle=A,e.fillRect(c-T-x+V,d-R-x+V,x-V,x-V)),f){const ye=g,fe=d-R-me;if(e.fillStyle=D,e.fillRect(0,fe,w,me-V),e.fillStyle=de?v:b,e.fillRect(0,fe+V,w,me-V),n?e.fillStyle=k:de?e.fillStyle=L:e.fillStyle=N,e.fillRect(ye,fe+V,h,me-V),!P&&K&&Z!=null&&$!=null){e.fillStyle=Z;const{selectedRanges:Je,cursorColumn:Xe}=t,{lastLeft:$e,columnCount:Ot}=i,hn=[...Je].filter(ge=>ge.startColumn!=null&&ge.endColumn!=null).map(ge=>[ge.startColumn,ge.endColumn]).sort(H.compareRanges),xt=H.mergeSortedRanges(hn),De=ge=>ge<=$e?ge/$e*(w-h):w-h+(ge-$e)/(Ot-$e)*h;for(let ge=0;ge<xt.length;ge+=1){const Ke=xt[ge],ze=Ke[0],lt=Ke[1];if(ze!=null&&lt!=null&&(ze!==Xe||lt!==Xe)){const wt=De(ze),mn=Math.max(1,Math.round(De(lt+1)-wt)),kt=me-V;e.fillRect(wt,fe+V+Math.round(kt/3),mn,Math.round(kt/3))}}if(Xe!=null){const ge=De(Xe),Ke=2,ze=me-V;e.fillStyle=$,e.fillRect(ge,fe+V,Ke,ze)}}}if(C){const ye=c-T-Ce,fe=p;if(e.fillStyle=D,e.fillRect(ye,0,Ce-V,S),e.fillStyle=j?v:b,e.fillRect(ye+V,0,Ce-V,S),s?e.fillStyle=k:j?e.fillStyle=L:e.fillStyle=N,e.fillRect(ye+V,fe,Ce-V,u),!G&&K&&Z!=null&&$!=null){const{selectedRanges:Je,cursorRow:Xe}=t,{lastTop:$e,rowCount:Ot}=i,Ct=ge=>ge<=$e?ge/$e*(S-u):S-u+(ge-$e)/(Ot-$e)*u;e.fillStyle=Z;const xt=[...Je].filter(ge=>ge.startRow!=null&&ge.endRow!=null).map(ge=>[ge.startRow,ge.endRow]).sort(H.compareRanges),De=H.mergeSortedRanges(xt);for(let ge=0;ge<De.length;ge+=1){const Ke=De[ge],ze=Ke[0],lt=Ke[1];if(ze!=null&&lt!=null&&(ze!==Xe||lt!==Xe)){const wt=Ct(ze),mn=Ce-V,kt=Math.max(1,Math.round(Ct(lt+1)-wt));e.fillRect(ye+V+Math.round(mn/3),wt,Math.round(mn/3),kt)}}if(Xe!=null){const ge=Math.round(Ct(Xe)),Ke=Ce-V,ze=2;e.fillStyle=$,e.fillRect(ye+V,ge,Ke,ze)}}}e.translate(-T,-R)}};let ts=tn;ts.DEFAULT_FONT_WIDTH=10;ts.DEFAULT_EDGE_RADIUS=2;ts.ACTIVE_CELL_BORDER_WIDTH=2;const Ir=100;class id extends Ye{constructor(){super(...arguments),this.hasExtendedFloating=!1}onDown(t,n,s){const{x:o,y:i,column:r,row:l}=t,{metrics:a}=n;if(!a)throw new Error("metrics not set");const{gridX:c,gridY:d,maxX:u,maxY:h}=a,g=o-c,p=i-d;if(g<0||p<0||r==null&&g>u||l==null&&p>h)return!1;const f=H.isModifierKeyDown(s),C=s.shiftKey;f||(C?n.trimSelectedRanges():n.clearSelectedRanges());const w=n.getTheme(),{autoSelectRow:S,autoSelectColumn:T}=w;return(r!==null||!T)&&(l!==null||!S)&&(n.focus(),n.moveCursorToPosition(r,l,C,!1,C&&f)),this.startPoint=t,this.hasExtendedFloating=!1,this.dragBounds=H.getScrollDragBounds(a,l,r),!0}onDrag(t,n){if(this.startPoint===void 0)return!1;this.stopTimer();const{row:s,column:o}=this.startPoint,{x:i,y:r}=t;let{row:l,column:a}=t;const{metrics:c}=n;if(!c)throw new Error("metrics not set");const{left:d,lastLeft:u,top:h,lastTop:g,columnWidth:p,rowHeight:f}=c,C=H.getScrollDragBounds(c,s,o);let w=0,S=0;if(d<u&&(i<C.x1?w=i-C.x1:i>C.x2&&(w=i-C.x2)),h<g&&(r<C.y1?S=r-C.y1:r>C.y2&&(S=r-C.y2)),w!==0||S!==0)this.startTimer(n,t,w>0?Math.ceil(w/p):Math.floor(w/p),S>0?Math.ceil(S/f):Math.floor(S/f));else if(l!=null&&a!=null){const{floatingTopRowCount:T,floatingBottomRowCount:R,floatingLeftColumnCount:b,floatingRightColumnCount:v,columnCount:D,rowCount:A,bottom:N,right:L,topVisible:k,bottomVisible:x,leftVisible:W,rightVisible:V}=c;this.hasExtendedFloating||(s!==null&&s<T&&l>=T?(l=T,this.hasExtendedFloating=!0):s!==null&&s>=A-R&&l<A-R&&(l=A-R-1,this.hasExtendedFloating=!0),o!==null&&o<b&&a>=b?(a=b,this.hasExtendedFloating=!0):o!==null&&o>=D-v&&a<D-v&&(a=D-v-1,this.hasExtendedFloating=!0)),s!==null&&!H.isFloatingRow(s,c)&&H.isFloatingRow(l,c)&&(s>l&&l<h?l=k-1:s<l&&l>N&&(l=x+1)),o!==null&&!H.isFloatingColumn(o,c)&&H.isFloatingColumn(a,c)&&(o>a&&a<d?a=W-1:o<a&&a>L&&(a=V+1)),n.moveCursorToPosition(a,l,!0,!0)}return!0}onUp(t,n){return this.startPoint!==void 0&&(this.startPoint=void 0,this.dragBounds=void 0,this.stopTimer(),n.commitSelection()),!1}moveSelection(t,n,s,o){const{row:i,column:r}=n,{metrics:l}=t;if(!l)throw new Error("metrics not set");const{selectionEndRow:a,selectionEndColumn:c}=t.state;if(a==null||c==null)throw new Error("selection not set");const{rowCount:d,columnCount:u}=l,h=s<0&&r!=null?r:0,g=s>0&&r!=null?r:u-1,p=o<0&&i!=null?i:0,f=o>0&&i!=null?i:d-1;t.moveCursorToPosition(Math.min(Math.max(h,c+s),g),Math.min(Math.max(p,a+o),f),!0),this.lastTriggerTime=Date.now()}startTimer(t,n,s,o){this.stopTimer();const i=this.lastTriggerTime!=null?Ir-Math.min(Ir,Date.now()-this.lastTriggerTime):0;this.timer=setTimeout(()=>{this.moveSelection(t,n,s,o),this.startTimer(t,n,s,o)},i)}stopTimer(){this.timer!==void 0&&(clearTimeout(this.timer),this.timer=void 0)}}const Nr=5,rd=1e3/60,Ro=10;function Sn(e,t,n,s){var T,R,b,v,D,A,N;const{modelColumns:o,movedColumns:i,allColumnXs:r,columnCount:l,allColumnWidths:a,userColumnWidths:c,calculatedColumnWidths:d,floatingLeftWidth:u,maxX:h}=n;if(t==null||e==null||e>l||e<0)return null;const g=(T=o.get(e))!=null?T:H.getModelIndex(e,i),p=s.getColumnHeaderGroup(g,t),f=p!=null;let C,w,S;if(p!=null){const[L,k]=p.getVisibleRange(i);C=(R=r.get(L))!=null?R:u,w=((b=r.get(k))!=null?b:h)+((v=a.get(k))!=null?v:0),S=[L,k]}else{const L=r.get(e);if(L==null)return null;C=L,w=C+((N=(A=(D=a.get(e))!=null?D:c.get(g))!=null?A:d.get(g))!=null?N:0),S=[e,e]}return{visibleIndex:e,modelIndex:g,left:C,right:w,width:w-C,isColumnGroup:f,range:S,depth:t}}class ld extends Ye{constructor(){super(...arguments),this.cursor=null,this.draggingColumn=null}setScrollInterval(t,n){this.scrollingInterval!=null&&n===this.scrollingDirection||(this.scrollingDirection=n,this.scrollingInterval=window.setInterval(()=>{var f,C;const{metrics:s}=t;if(!s)return;const{left:o,lastLeft:i,leftOffset:r,userColumnWidths:l,calculatedColumnWidths:a,movedColumns:c,allColumnWidths:d}=s;let u=o,h=r;if(n==="left")for(h-=Ro;h<0;){u-=1;const w=H.getModelIndex(o-1,c),S=(f=l.get(w))!=null?f:a.get(w);S===void 0?h=0:h+=S,u<0&&(h=0,u=0)}else{h+=Ro;let w=d.get(o);for(;w!==void 0&&h>w;){u+=1,h-=w;const S=H.getModelIndex(o+1,c);w=(C=l.get(S))!=null?C:a.get(S),u>i&&(h=0,u=i)}}const{mouseX:g,mouseY:p}=t.state;s==null||g==null||p==null||(this.moveDraggingColumn(g,t,n==="left"?-Ro:Ro),t.setState({left:u,leftOffset:h}),(n==="left"&&u===0&&r===0||n==="right"&&u===i)&&this.clearScrollInterval())},rd))}clearScrollInterval(){this.scrollingDirection=void 0,window.clearInterval(this.scrollingInterval),this.scrollingInterval=void 0}onLeave(){return this.clearScrollInterval(),!1}onDown(t,n){const{model:s}=n.props,{x:o,column:i,columnHeaderDepth:r}=t,{metrics:l}=n;if(!l)throw new Error("Metrics not set");const a=Sn(i,r,l,s);if(i==null||a==null||r==null||r>0&&!a.isColumnGroup)return!1;const{rowHeaderWidth:c}=l;return this.initialGridPoint=t,this.draggingColumn=null,this.cursor=null,a.modelIndex!=null&&r!=null&&s.isColumnMovable(a.modelIndex,r)&&(this.draggingOffset=o-a.left-c,this.initialOffset=this.draggingOffset),!1}onDrag(t,n,s){if(this.draggingOffset===void 0||this.initialGridPoint===void 0||this.initialOffset===void 0)return!1;const{x:o,y:i}=t,{columnHeaderDepth:r}=this.initialGridPoint,{model:l}=n.props;let{draggingColumn:a}=this;const{metrics:c}=n;if(!c)throw new Error("Metrics not set");if(!a&&Math.abs(this.initialGridPoint.x-o)<Nr&&Math.abs(this.initialGridPoint.y-i)<Nr)return!1;if(a==null){const d=Sn(this.initialGridPoint.column,r,c,l);if(!d||r==null||!l.isColumnMovable(d.modelIndex)||r>0&&!d.isColumnGroup||d.range[0]==null)return!1;a={range:d.range,depth:r,left:d.left,width:d.width};const u=Sn(a.range[0],0,c,l),h=Sn(a.range[1],0,c,l);if(!u||!h)return!1;this.draggingColumn=a,n.setState({draggingColumn:a,isDragging:!0})}return this.cursor="move",this.moveDraggingColumn(t.x,n,s.movementX),!0}moveDraggingColumn(t,n,s){var D,A,N,L,k;if(this.draggingOffset===void 0||this.initialGridPoint===void 0||this.initialOffset===void 0||this.draggingColumn==null||s===0)return;if(this.initialOffset!==this.draggingOffset){this.draggingOffset<this.initialOffset&&this.initialOffset<this.draggingOffset+s||this.draggingOffset>this.initialOffset&&this.initialOffset>this.draggingOffset+s?this.draggingOffset=this.initialOffset:this.draggingOffset+=s,this.draggingColumn={...this.draggingColumn,left:t-this.draggingOffset},n.setState({draggingColumn:this.draggingColumn});return}const{depth:o}=this.draggingColumn,{model:i}=n.props,{movedColumns:r}=n.state,{metrics:l}=n;if(!l)throw new Error("Metrics not set");const{floatingLeftWidth:a,width:c,columnHeaderMaxDepth:d,allColumnXs:u}=l,h=s<0,g=Sn(this.draggingColumn.range[0],o,l,i);if(!g)return;const p=t-this.draggingOffset,f=p+g.width;this.draggingColumn={...this.draggingColumn,left:p},n.setState({draggingColumn:this.draggingColumn});const C=Sn(H.getColumnAtX(Be(h?p:f,a,c),l,!0),o,l,i),w=i.getColumnHeaderParentGroup(g.modelIndex,g.depth);if(!C)return;if(w!==void 0){const x=w.getVisibleRange(r);if(C.visibleIndex<x[0]){const W=this.moveColumn(g,x[0],r);this.draggingOffset=t-((D=u.get(x[0]))!=null?D:0),this.draggingColumn={...this.draggingColumn,left:t-this.draggingOffset},this.clearScrollInterval(),n.setState({draggingColumn:this.draggingColumn,movedColumns:W});return}if(C.visibleIndex>x[1]){const W=this.moveColumn(g,x[1]-(g.range[1]-g.range[0]),r),{right:V=0}=(A=Sn(x[1],0,l,i))!=null?A:{};this.draggingOffset=t-(V-g.width),this.draggingColumn={...this.draggingColumn,left:t-this.draggingOffset},this.clearScrollInterval(),n.setState({draggingColumn:this.draggingColumn,movedColumns:W});return}}if(!i.isColumnMovable(C.modelIndex)){let x=C.visibleIndex;if(h)for(x+=1;x<g.visibleIndex&&!i.isColumnMovable(H.getModelIndex(x,r));)x+=1;else for(x-=1;x>g.visibleIndex&&!i.isColumnMovable(H.getModelIndex(x,r));)x-=1;if(x!==g.visibleIndex){h||(x-=g.range[1]-g.range[0]);const V=this.moveColumn(g,x,r);n.setState({movedColumns:V,draggingColumn:this.draggingColumn})}const W=Sn(x,0,l,i);h?this.draggingOffset=t-((N=W==null?void 0:W.left)!=null?N:0):this.draggingOffset=t-(((L=W==null?void 0:W.right)!=null?L:0)-g.width),this.draggingColumn={...this.draggingColumn,left:t-this.draggingOffset},n.setState({draggingColumn:this.draggingColumn});return}if(p<=a?this.setScrollInterval(n,"left"):f>c?this.setScrollInterval(n,"right"):this.clearScrollInterval(),C.visibleIndex===g.visibleIndex||h&&g.visibleIndex<C.visibleIndex||!h&&g.visibleIndex>C.visibleIndex)return;const S=C.left+C.width*.5,T=i.getColumnHeaderParentGroup(g.modelIndex,g.depth);let R,b=((k=T==null?void 0:T.depth)!=null?k:d)-1;for(;b>=0&&R===void 0;)R=i.getColumnHeaderGroup(C.modelIndex,b),b-=1;let v;h&&p<S&&(!R||C.visibleIndex===R.getVisibleRange(r)[0])&&(v=this.moveColumn(g,C.range[0],r)),!h&&f>S&&(!R||C.visibleIndex===R.getVisibleRange(r)[1])&&(v=this.moveColumn(g,C.range[1]-(g.range[1]-g.range[0]),r)),v&&(this.draggingColumn={...this.draggingColumn,left:p},n.setState({movedColumns:v,draggingColumn:this.draggingColumn}))}moveColumn(t,n,s){const o=t.isColumnGroup?H.moveRange(t.range,n,s):H.moveItem(t.visibleIndex,n,s),i=n-t.range[0],r=[t.range[0]+i,t.range[1]+i];return this.draggingColumn&&(this.draggingColumn={...this.draggingColumn,range:r}),o}onUp(t,n){return this.cursor=null,this.clearScrollInterval(),this.draggingOffset!=null?(this.draggingOffset=void 0,n.setState({draggingColumn:null,isDragging:!1}),!0):!1}}class qi extends Ye{constructor(){super(...arguments),this.cursor="default"}static getLeftWithOffsetFromRawLeft(t,n){const s=t.getTheme(),{metrics:o,metricCalculator:i}=t;if(!o)throw new Error("metrics not set");if(s.scrollSnapToColumn)return{left:Math.round(n),leftOffset:0};const r=Math.floor(n),l=n-r;let a=o.allColumnWidths.get(r);if(a==null){const d=t.getMetricState();a=i.getVisibleColumnWidth(r,d)}const c=a*l;return{left:r,leftOffset:c}}isInScrollBar(t,n){const s=n.getTheme(),{scrollBarSize:o,scrollBarHoverSize:i}=s,{metrics:r}=n;if(!r)throw new Error("metrics not set");const{x:l,y:a}=t,{barLeft:c,barWidth:d,height:u,hasHorizontalBar:h}=r;return h&&o>0&&a>=u-i&&a<u&&l>c&&l<c+d}getLeftWithOffset(t,n){var f;const{metrics:s}=n;if(!s)throw new Error("metrics not set");const{x:o}=t,{barWidth:i,handleWidth:r,lastLeft:l,barLeft:a,columnCount:c,scrollableContentWidth:d,scrollableViewportWidth:u}=s,h=o-a,g=Be((h-((f=this.dragOffset)!=null?f:0))/(i-r),0,1);if(c===1)return{left:0,leftOffset:g*(d-u)};const p=g*l;return qi.getLeftWithOffsetFromRawLeft(n,p)}onDown(t,n){const{metrics:s}=n;if(!s)throw new Error("metrics not set");const{x:o}=t,{handleWidth:i,barLeft:r,scrollX:l}=s;if(!this.isInScrollBar(t,n))return!1;const a=o-r;if(a>=l&&a<=l+i)this.dragOffset=a-l,n.setState({isDraggingHorizontalScrollBar:!0});else{this.dragOffset=0;const{left:c,leftOffset:d}=this.getLeftWithOffset(t,n);n.setViewState({left:c,leftOffset:d,isDraggingHorizontalScrollBar:!0,isDragging:!0})}return!0}onDrag(t,n){if(this.dragOffset!=null){const{left:s,leftOffset:o}=this.getLeftWithOffset(t,n);return n.setViewState({left:s,leftOffset:o,isDraggingHorizontalScrollBar:!0,isDragging:!0}),!0}return!1}onMove(t,n){return this.isInScrollBar(t,n)}onUp(t,n){return this.dragOffset!==void 0&&(this.dragOffset=void 0,n.setState({isDraggingHorizontalScrollBar:!1,isDragging:!1})),this.isInScrollBar(t,n)}onClick(t,n){return this.isInScrollBar(t,n)}}class ad extends Ye{constructor(){super(...arguments),this.cursor="move"}onDown(t,n){const{model:s}=n.props,{x:o,y:i,row:r}=t,{metrics:l}=n;if(!l)throw new Error("metrics not set");const{columnHeaderHeight:a,rowHeaderWidth:c,allRowYs:d}=l;if(o<=c&&r!==null&&s.isRowMovable(r)){const u=O(d,r);this.draggingOffset=i-u-a,n.setState({draggingRowOffset:this.draggingOffset})}return!1}onDrag(t,n){if(this.draggingOffset==null)return!1;const{model:s}=n.props;let{draggingRow:o}=n.state;const{mouseX:i,mouseY:r}=n.state;if(i==null||r==null)return!1;if(o==null){const{row:v}=n.getGridPointFromXY(i,r);if(v!=null&&!s.isRowMovable(v)||(o=v,n.setState({draggingRow:o,isDragging:!0}),o==null))return!1}const{metrics:l}=n;if(!l)throw new Error("metrics not set");const{top:a,lastTop:c,bottom:d,bottomVisible:u,rowCount:h,columnHeaderHeight:g,allRowHeights:p,allRowYs:f,height:C}=l;let w=g;if(a<o){const v=o-1;w=O(f,v)+O(p,v)*.5+g}let S=C;if(o<d){const v=o+1;S=O(f,v)+O(p,v)*.5+g}let{movedRows:T}=n.state;r<w&&o>0&&s.isRowMovable(o-1)?(T=H.moveItem(o,o-1,T),o-=1):S<r&&o<h-1&&s.isRowMovable(o+1)&&(T=H.moveItem(o,o+1,T),o+=1),n.setState({movedRows:T,draggingRow:o});const R=g+O(p,a)*.5,b=g+O(f,u)+O(p,u)*.5;return r<R&&a>0?n.setState({top:a-1}):r>b&&a<c&&n.setState({top:a+1}),!0}onUp(t,n){return this.draggingOffset!==void 0?(this.draggingOffset=void 0,n.setState({draggingRowOffset:null,draggingRow:null,isDragging:!1}),!0):!1}}class Yi extends Sl{constructor(){super(...arguments),this.hiddenCursor="s-resize",this.defaultCursor="row-resize",this.pointProperty="y",this.userSizesProperty="userRowHeights",this.visibleOffsetProperty="visibleRowYs",this.visibleSizesProperty="visibleRowHeights",this.marginProperty="columnHeaderHeight",this.calculatedSizesProperty="calculatedRowHeights",this.initialSizesProperty="initialRowHeights",this.modelIndexesProperty="modelRows",this.firstIndexProperty="firstRow",this.treePaddingProperty="treePaddingY",this.getHiddenItems=H.getHiddenRows,this.getNextShownItem=H.getNextShownRow,this.getSeparator=Yi.getRowSeparator}static getRowSeparator(t,n,s,o){if(!o.allowRowResize)return null;const{x:i,y:r}=t,l=H.getRowSeparatorIndex(i,r,n,o);return l!=null?{index:l,depth:0}:null}setSize(t,n,s){t.setRowHeight(n,s)}resetSize(t,n){t.resetRowHeight(n)}updateSeparator(t,n){t.setState({draggingRowSeparator:n,isDragging:n!==null})}}class Ts extends Ye{static isInTreeBox(t,n){const{column:s,row:o,x:i,y:r}=t,{metrics:l}=n;if(!l)throw new Error("metrics not set");const{gridX:a,gridY:c,firstColumn:d,allColumnXs:u,allColumnWidths:h,allRowHeights:g,allRowYs:p,visibleRowTreeBoxes:f}=l;if(s===d&&o!=null&&f.get(o)!=null&&i>a&&r>c){const C=O(u,s),w=O(h,s),S=O(p,o),T=O(g,o);if(i>=a+C&&i<=a+C+w&&r>=c+S&&r<=c+S+T)return!0}return!1}onDown(t,n){return Ts.isInTreeBox(t,n)}onClick(t,n,s){if(Ts.isInTreeBox(t,n)){const{row:o}=t;if(o!==null)return n.toggleRowExpanded(o,H.isModifierKeyDown(s)),!0}return!1}}class cd extends Ye{isInCorner(t,n){const s=n.getTheme(),{scrollBarSize:o}=s,{metrics:i}=n;if(!i)throw new Error("metrics not set");const{x:r,y:l}=t,{width:a,height:c,hasVerticalBar:d,hasHorizontalBar:u}=i;return o>0&&d&&u&&r>=a-o&&l>=c-o&&r<=a&&l<=c}onDown(t,n){return this.isInCorner(t,n)}onUp(t,n){return this.isInCorner(t,n)}onClick(t,n){return this.isInCorner(t,n)}}class Xi extends Ye{constructor(){super(...arguments),this.cursor="default"}static getTopWithOffsetFromRawTop(t,n){const s=t.getTheme(),{metrics:o,metricCalculator:i}=t;if(!o)throw new Error("metrics not set");if(s.scrollSnapToRow)return{top:Math.round(n),topOffset:0};const r=Math.floor(n),l=n-r;let a=o.allRowHeights.get(r);if(a==null){const d=t.getMetricState();a=i.getVisibleRowHeight(r,d)}const c=a*l;return{top:r,topOffset:c}}isInScrollBar(t,n){const s=n.getTheme(),{scrollBarSize:o,scrollBarHoverSize:i}=s,{metrics:r}=n;if(!r)throw new Error("metrics not set");const{x:l,y:a}=t,{barTop:c,barHeight:d,width:u,hasVerticalBar:h}=r;return h&&o>0&&l>=u-i&&l<u&&a>c&&a<c+d}getTopWithOffset(t,n){var f;const{metrics:s}=n;if(!s)throw new Error("metrics not set");const{y:o}=t,{barHeight:i,handleHeight:r,lastTop:l,barTop:a,rowCount:c,scrollableContentHeight:d,scrollableViewportHeight:u}=s,h=o-a,g=Be((h-((f=this.dragOffset)!=null?f:0))/(i-r),0,1);if(c===1)return{top:0,topOffset:g*(d-u)};const p=g*l;return Xi.getTopWithOffsetFromRawTop(n,p)}onDown(t,n){const{metrics:s}=n;if(!s)throw new Error("metrics not set");const{y:o}=t,{handleHeight:i,barTop:r,scrollY:l}=s;if(!this.isInScrollBar(t,n))return!1;const a=o-r;if(a>=l&&a<=l+i)this.dragOffset=a-l,n.setState({isDraggingVerticalScrollBar:!0});else{this.dragOffset=0;const{top:c,topOffset:d}=this.getTopWithOffset(t,n);n.setViewState({top:c,topOffset:d,isDraggingVerticalScrollBar:!0,isDragging:!0})}return!0}onMove(t,n){return this.isInScrollBar(t,n)}onDrag(t,n){if(this.dragOffset!=null){const{top:s,topOffset:o}=this.getTopWithOffset(t,n);return n.setViewState({top:s,topOffset:o,isDraggingVerticalScrollBar:!0,isDragging:!0}),!0}return!1}onUp(t,n){return this.dragOffset!==void 0&&(this.dragOffset=void 0,n.setState({isDraggingVerticalScrollBar:!1,isDragging:!1})),this.isInScrollBar(t,n)}onClick(t,n){return this.isInScrollBar(t,n)}}class dd extends Ye{onDoubleClick({column:t,row:n},s){const{model:o}=s.props;return ke(o)&&t!=null&&n!=null&&o.isEditableRange(Q.makeCell(t,n))?(s.startEditing(t,n),!0):!1}}class ss{constructor(t=5e3){this.order=t}onDown(t,n){return!1}}class ud extends ss{onDown(t,n){switch(t.key){case"a":if(H.isModifierKeyDown(t))return n.selectAll(),!0;break;case"ArrowUp":return this.handleArrowMove(0,-1,t,n);case"ArrowDown":return this.handleArrowMove(0,1,t,n);case"ArrowRight":return this.handleArrowMove(1,0,t,n);case"ArrowLeft":return this.handleArrowMove(-1,0,t,n);case"k":case"K":return H.isModifierKeyDown(t)?!1:this.handlePageUp(t,n);case"j":case"J":return H.isModifierKeyDown(t)?!1:this.handlePageDown(t,n);case"h":case"H":return H.isModifierKeyDown(t)?!1:(t.shiftKey||n.clearSelectedRanges(),n.moveCursorToPosition(0,n.state.cursorRow,t.shiftKey),!0);case"l":case"L":{if(H.isModifierKeyDown(t))return!1;const{model:s}=n.props,{columnCount:o}=s;return t.shiftKey||n.clearSelectedRanges(),n.moveCursorToPosition(o-1,n.state.cursorRow,t.shiftKey),!0}case"PageDown":return this.handlePageDown(t,n);case"PageUp":return this.handlePageUp(t,n);case"Home":return t.shiftKey||n.clearSelectedRanges(),n.moveCursorToPosition(H.isModifierKeyDown(t)?n.state.cursorColumn:0,H.isModifierKeyDown(t)?0:n.state.cursorRow,t.shiftKey,!0,!0),!0;case"End":{const{model:s}=n.props,{columnCount:o,rowCount:i}=s;return t.shiftKey||n.clearSelectedRanges(),n.moveCursorToPosition(H.isModifierKeyDown(t)?n.state.cursorColumn:o-1,H.isModifierKeyDown(t)?i-1:n.state.cursorRow,t.shiftKey,!0,!0),!0}case"Escape":return n.clearSelectedRanges(),{preventDefault:!1,stopPropagation:!1};case"Enter":if(n.state.selectedRanges.length>0)return n.moveCursorInDirection(t.shiftKey?Q.SELECTION_DIRECTION.UP:Q.SELECTION_DIRECTION.DOWN),!0;break;case"Tab":if(n.state.selectedRanges.length>0)return n.moveCursorInDirection(t.shiftKey?Q.SELECTION_DIRECTION.LEFT:Q.SELECTION_DIRECTION.RIGHT),!0;break}return!1}handleArrowMove(t,n,s,o){const i=s.shiftKey,r=H.isModifierKeyDown(s);i?o.trimSelectedRanges():o.clearSelectedRanges();const{cursorRow:l,cursorColumn:a,selectionEndColumn:c,selectionEndRow:d}=o.state,u=i?c:a,h=i?d:l;if(r){const{model:g}=o.props,{columnCount:p,rowCount:f}=g,C=r&&i;let w=null,S=null;t<0?(w=0,S=h):t>0?(w=p-1,S=h):n<0?(w=u,S=0):n>0&&(w=u,S=f-1),w!=null&&S!=null&&o.moveCursorToPosition(w,S,i,!0,C)}else{if(!o.metrics)throw new Error("grid.metrics are not set");const{theme:g}=o.props,{autoSelectRow:p=!1,autoSelectColumn:f=!1}=g;if(p&&t!==0){const{lastLeft:C}=o.metrics;let{left:w}=o.state;w=Be(w+t,0,C),o.moveCursorToPosition(w,l,i,!1),o.setViewState({left:w})}else if(f&&n!==0){const{lastTop:C}=o.metrics;let{top:w}=o.state;w=Be(w+n,0,C),o.moveCursorToPosition(w,a,i,!1),o.setViewState({top:w})}else o.moveCursor(t,n,i)}return!0}handlePageUp(t,n){const s=t.shiftKey;s?n.trimSelectedRanges():n.clearSelectedRanges();const{cursorColumn:o,selectionEndRow:i}=n.state,r=i,l=o;if(r==null)return!1;const a=n.getMetricState(),{metricCalculator:c}=n,{bottomVisible:d,topVisible:u,hasHorizontalBar:h}=c.getMetrics(a);let g=r-(d-u);g-=h?0:1,g=Math.max(g,0);const p=Math.max(g-(r-u),0);return n.moveCursorToPosition(l,g,s,!1),n.setViewState({top:p}),!0}handlePageDown(t,n){const s=t.shiftKey;s?n.trimSelectedRanges():n.clearSelectedRanges();const{selectionEndRow:o,cursorColumn:i}=n.state,r=o,l=i;if(r===null)return!1;const a=n.getMetricState(),{metricCalculator:c}=n,{bottomVisible:d,topVisible:u,hasHorizontalBar:h,rowCount:g,lastTop:p}=c.getMetrics(a),f=g-1;let C=d-u+r;C+=h?0:1,C=Math.min(C,f);const w=Math.min(p,C-(r-u));return n.moveCursorToPosition(l,C,s,!1),n.setViewState({top:w}),!0}}class hd extends ss{onDown(t,n){switch(t.key){case"Enter":case" ":return this.handleExpandKey(t,n)}return!1}handleExpandKey(t,n){const{selectedRanges:s}=n.state;if(s.length===1){const o=s[0];if(o.startRow===o.endRow&&o.startColumn===o.endColumn){if(!n.metrics)throw new Error("grid.metrics not set");const{model:i}=n.props,{startRow:r,startColumn:l}=o;if(r!=null){const a=n.getModelRow(r);if((l===0||l==null)&&Ae(i)&&i.isRowExpandable(a))return n.toggleRowExpanded(r),!0}}}return!1}}class md extends ss{onDown(t,n){if(H.isModifierKeyDown(t))return!1;const{model:s}=n.props,{cursorColumn:o,cursorRow:i}=n.state;if(o==null||i==null||!ke(s)||!s.isEditableRange(Q.makeCell(o,i)))return!1;const r=o,l=i;return r==null||l==null?!1:t.key.length===1?(n.startEditing(r,l,!0,[1,1],t.key),!0):t.key==="F2"?(n.startEditing(r,l),!0):t.key==="Backspace"?(n.startEditing(r,l,!0,void 0,""),!0):t.key==="Delete"?(n.setValueForCell(r,l,""),!0):!1}}function gd(e){var s,o;const t=[],n=e.querySelectorAll("tr");for(let i=0;i<n.length;i+=1){const l=n[i].querySelectorAll("td"),a=[];for(let c=0;c<l.length;c+=1){const d=l[c];a.push((o=(s=d.textContent)==null?void 0:s.trim())!=null?o:"")}t.push(a)}return t}function pd(e){const t=[];return e.forEach(n=>{var o;const s=(o=n.textContent)!=null?o:"";s.length>0&&t.push(s.split(/\t|\u00a0\u00a0 \u00a0/))}),t}function fd(e){var s,o;const t=e.querySelector("table");if(t!=null)return gd(t);const n=(o=(s=e.textContent)==null?void 0:s.trim())!=null?o:"";if(n.length>0){const{childNodes:i}=e,r=n.includes(" "),l=n.includes("\xA0\xA0 \xA0");return r&&i.length!==0&&(i.length===1||i.length>1&&(i[0].textContent==null||!i[0].textContent.includes(" ")))?n.split(`
2
+ `).map(a=>a.split(" ")):i.length>1||l?pd(e.childNodes):n}return null}class Cd extends ss{onDown(t,n){switch(t.key){case"v":if(H.isModifierKeyDown(t)){const s=document.createElement("div");document.body.appendChild(s),s.setAttribute("contenteditable","true"),s.setAttribute("style",'clip-path: "inset(50%)"; height: 1px; width: 1px; margin: -1px; overflow: hidden; padding 0; position: absolute;');const o=()=>{s.removeEventListener("input",o),s.remove(),n.focus();const i=fd(s);i!=null&&n.pasteValue(i)};return s.addEventListener("input",o),s.focus(),{preventDefault:!1,stopPropagation:!0}}break}return!1}}const wd=e=>{switch(e){case"ArrowDown":return At.DOWN;case"ArrowUp":return At.UP;case"ArrowLeft":return At.LEFT;case"ArrowRight":return At.RIGHT;default:return}};function Ki({selectionRange:e=void 0,className:t="",disabled:n=!1,value:s="",isQuickEdit:o=!0,onChange:i=()=>{},onCancel:r=()=>{},onDone:l=()=>{},onContextMenu:a=()=>{},style:c={}}){const d=F.exports.useRef(null),u=F.exports.useRef(!1),[h]=F.exports.useState(s),[g,p]=F.exports.useState(!1),[f,C]=F.exports.useState(o),[w,S]=F.exports.useState(s);F.exports.useEffect(function(){const{current:x}=d;x!=null&&(x.focus(),e?x.setSelectionRange(e[0],e[1]):x.setSelectionRange(x.value.length,x.value.length))},[e]);const T=F.exports.useCallback(k=>{i(k)},[i]),R=F.exports.useCallback(k=>{const{value:x}=k.target;S(x),p(!0),T(x)},[T,S,p]),b=F.exports.useCallback(()=>{u.current=!0,g&&T(h),p(!1),r()},[h,g,r,T]),v=F.exports.useCallback(()=>{C(!1)},[C]),D=F.exports.useCallback((k,x=!1)=>{l(w,{direction:k,fillRange:x})},[l,w]),A=F.exports.useCallback(()=>{u.current||D(null)},[u,D]),N=F.exports.useCallback(k=>{switch(k.stopPropagation(),k.key){case"Escape":k.preventDefault(),b();break;case"Enter":if(k.preventDefault(),H.isModifierKeyDown(k))D(void 0,!0);else if(k.altKey){const x=`${w}
3
+ `;S(x),p(!0),T(x)}else D(k.shiftKey?At.UP:At.DOWN);break;case"Tab":k.preventDefault(),D(k.shiftKey?At.LEFT:At.RIGHT);break;case"ArrowDown":case"ArrowUp":case"ArrowLeft":case"ArrowRight":f&&(k.preventDefault(),D(wd(k.key)));break}},[b,D,f,S,p,T,w]),L=F.exports.useCallback(k=>{a(k)},[a]);return m("textarea",{ref:d,className:ee("grid-cell-input-field",t),value:w,onBlur:A,onChange:R,onKeyDown:N,onContextMenu:L,onClick:v,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false",disabled:n,style:c})}Ki.propTypes={selectionRange:B.exports.arrayOf(B.exports.number),className:B.exports.string,disabled:B.exports.bool,isQuickEdit:B.exports.bool,value:B.exports.string,onChange:B.exports.func,onCancel:B.exports.func,onDone:B.exports.func,onContextMenu:B.exports.func,style:B.exports.shape({})};Ki.defaultProps={selectionRange:null,className:"",disabled:!1,value:"",isQuickEdit:!0,onChange:()=>{},onCancel:()=>{},onDone:()=>{},onContextMenu:()=>{},style:{}};const Sd=Fe.createContext({}),$n=class extends F.exports.PureComponent{constructor(e){super(e),this.getCachedKeyHandlers=Re(l=>[...l,...this.keyHandlers].sort((a,c)=>a.order-c.order)),this.getCachedMouseHandlers=Re(l=>[...l,...this.mouseHandlers].sort((a,c)=>a.order-c.order)),this.handleClick=this.handleClick.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleEditCellCancel=this.handleEditCellCancel.bind(this),this.handleEditCellChange=this.handleEditCellChange.bind(this),this.handleEditCellCommit=this.handleEditCellCommit.bind(this),this.handleDoubleClick=this.handleDoubleClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseDrag=this.handleMouseDrag.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleResize=this.handleResize.bind(this),this.handleWheel=this.handleWheel.bind(this);const{isStuckToBottom:t,isStuckToRight:n,metricCalculator:s,movedColumns:o,movedRows:i,renderer:r}=e;this.renderer=r||new ts,this.metricCalculator=s||new Ks,this.canvas=null,this.canvasContext=null,this.animationFrame=null,this.prevMetrics=null,this.metrics=null,this.documentCursor=null,this.dragTimer=null,this.keyHandlers=[new md(400),new Cd(450),new ud(500),new hd(900)],this.mouseHandlers=[new Yi(100),new Ko(200),new ad(300),new ld(400),new dd(450),new Xi(500),new qi(600),new cd(700),new Ts(800),new id(900)],this.state={top:0,left:0,topOffset:0,leftOffset:0,draggingColumn:null,draggingRow:null,draggingRowOffset:null,draggingColumnSeparator:null,draggingRowSeparator:null,isDraggingHorizontalScrollBar:!1,isDraggingVerticalScrollBar:!1,isDragging:!1,mouseX:null,mouseY:null,movedColumns:o,movedRows:i,cursorRow:null,cursorColumn:null,selectionStartRow:null,selectionStartColumn:null,selectionEndRow:null,selectionEndColumn:null,selectedRanges:ve,lastSelectedRanges:ve,cursor:null,editingCell:null,isStuckToBottom:t,isStuckToRight:n}}static getScale(e){var o,i,r,l,a;const t=window.devicePixelRatio||1,n=e,s=(a=(l=(r=(i=(o=n.webkitBackingStorePixelRatio)!=null?o:n.mozBackingStorePixelRatio)!=null?i:n.msBackingStorePixelRatio)!=null?r:n.oBackingStorePixelRatio)!=null?l:n.backingStorePixelRatio)!=null?a:1;return t/s}static getCursorClassName(e){return e!=null&&e!==""?`grid-cursor-${e}`:null}componentDidMount(){var n;this.initContext(),(n=this.canvas)==null||n.addEventListener("wheel",this.handleWheel,{passive:!1}),window.addEventListener("resize",this.handleResize),this.updateCanvasScale(),this.updateCanvas();const{isStuckToBottom:e,isStuckToRight:t}=this.props;e&&this.scrollToBottom(),t&&this.scrollToRight()}componentDidUpdate(e,t){const{isStickyBottom:n,isStickyRight:s,movedColumns:o,movedRows:i,onMovedColumnsChanged:r,onMoveColumnComplete:l,onMovedRowsChanged:a,onMoveRowComplete:c}=this.props,{isStickyBottom:d,isStickyRight:u,movedColumns:h,movedRows:g}=e,{movedColumns:p,movedRows:f}=t,{draggingColumn:C,draggingRow:w,movedColumns:S,movedRows:T}=this.state;if(h!==o&&this.setState({movedColumns:o}),g!==i&&this.setState({movedRows:i}),p!==S&&r(S),t.draggingColumn!=null&&C==null&&l(S),f!==T&&a(T),t.draggingRow!=null&&w==null&&c(T),n!==d&&this.setState({isStuckToBottom:!1}),s!==u&&this.setState({isStuckToRight:!1}),this.updateMetrics(),this.requestUpdateCanvas(),!this.metrics||!this.prevMetrics)return;const{rowCount:R,columnCount:b,height:v,width:D}=this.metrics,{rowCount:A,columnCount:N,height:L,width:k}=this.prevMetrics;if(A!==R||v!==L){const{isStuckToBottom:x}=this.state;x&&this.scrollToBottom()}if(N!==b||D!==k){const{isStuckToRight:x}=this.state;x&&this.scrollToRight()}this.validateSelection()&&this.checkSelectionChange(t)}componentWillUnmount(){var e;this.animationFrame!=null&&cancelAnimationFrame(this.animationFrame),(e=this.canvas)==null||e.removeEventListener("wheel",this.handleWheel),window.removeEventListener("mousemove",this.handleMouseDrag,!0),window.removeEventListener("mouseup",this.handleMouseUp,!0),window.removeEventListener("resize",this.handleResize),this.stopDragTimer()}getTheme(){const{theme:e}=this.props;return $n.getTheme(this.context,e)}getGridPointFromEvent(e){Rr(this.canvas);const t=this.canvas.getBoundingClientRect(),n=e.clientX-t.left,s=e.clientY-t.top;return this.getGridPointFromXY(n,s)}getGridPointFromXY(e,t){if(!this.metrics)throw new Error("metrics must be set");return H.getGridPointFromXY(e,t,this.metrics)}getMetricState(e=this.state){const t=this.getTheme(),{model:n,stateOverride:s}=this.props;if(!this.canvasContext||!this.canvas)throw new Error("Canvas and context must be defined to get metrics");const o=this.canvasContext,i=this.canvas.clientWidth,r=this.canvas.clientHeight,{left:l,top:a,leftOffset:c,topOffset:d,movedColumns:u,movedRows:h,isDraggingHorizontalScrollBar:g,isDraggingVerticalScrollBar:p,draggingColumn:f}=e;return{left:l,top:a,leftOffset:c,topOffset:d,width:i,height:r,context:o,theme:t,model:n,movedColumns:u,movedRows:h,isDraggingHorizontalScrollBar:g,isDraggingVerticalScrollBar:p,draggingColumn:f,...s}}getKeyHandlers(){const{keyHandlers:e}=this.props;return this.getCachedKeyHandlers(e)}getMouseHandlers(){const{mouseHandlers:e}=this.props;return this.getCachedMouseHandlers(e)}getModelColumn(e){var n,s;const t=(s=(n=this.metrics)==null?void 0:n.modelColumns)==null?void 0:s.get(e);if(t===void 0)throw new Error(`Unable to get ModelIndex for column ${e}`);return t}getModelRow(e){var n,s;const t=(s=(n=this.metrics)==null?void 0:n.modelRows)==null?void 0:s.get(e);if(t===void 0)throw new Error(`Unable to get ModelIndex for row ${e}`);return t}toggleRowExpanded(e,t=!1){const n=this.getModelRow(e),{model:s}=this.props;Ae(s)&&s.isRowExpandable(n)&&s.setRowExpanded(n,!s.isRowExpanded(n),t),this.clearSelectedRanges(),this.commitSelection(),this.moveCursorToPosition(0,e),this.commitSelection(),this.setState({isStuckToBottom:!1})}scrollToBottom(){if(!this.metrics)return;const{bottomVisible:e,rowCount:t,top:n,lastTop:s}=this.metrics;(e<t-1&&e>0||n>s)&&this.setState({top:s})}scrollToRight(){if(!this.metrics)return;const{rightVisible:e,columnCount:t,left:n,lastLeft:s}=this.metrics;(e<t-1&&e>0||n>s)&&this.setState({left:s})}setSelectedRanges(e){const{model:t}=this.props,{columnCount:n,rowCount:s}=t,{cursorRow:o,cursorColumn:i,selectedRanges:r}=this.state;if(this.setState({selectedRanges:e,lastSelectedRanges:r}),e.length>0){const l=Q.boundedRange(e[0],n,s);let a=o,c=i;l.containsCell(i,o)||({row:a,column:c}=l.startCell()),this.setState({selectionStartColumn:l.startColumn,selectionStartRow:l.startRow,selectionEndColumn:l.endColumn,selectionEndRow:l.endRow,cursorColumn:c,cursorRow:a})}}initContext(){const{canvas:e}=this,{canvasOptions:t}=this.props;if(!e)throw new Error("Canvas not set");this.canvasContext=e.getContext("2d",t)}requestUpdateCanvas(){this.animationFrame==null&&(this.animationFrame=requestAnimationFrame(()=>{if(this.animationFrame=null,!this.metrics)throw new Error("Metrics not set");this.updateCanvas(this.metrics)}))}updateCanvas(e=this.updateMetrics()){this.updateCanvasScale();const{onViewChanged:t}=this.props;t(e),this.drawCanvas(e)}updateCanvasScale(){const{canvas:e,canvasContext:t}=this;if(!e)throw new Error("canvas not set");if(!t)throw new Error("canvasContext not set");if(!e.parentElement)throw new Error("Canvas has no parent element");const n=$n.getScale(t),s=e.parentElement.getBoundingClientRect(),o=Math.floor(s.width),i=Math.floor(s.height);e.style.width=`${o}px`,e.style.height=`${i}px`,e.width=o*n,e.height=i*n,t.scale(n,n)}updateScrollBounds(){if(!this.metrics)throw new Error("metrics not set");const{left:e,top:t}=this.state,{lastLeft:n,lastTop:s}=this.metrics;e>n&&this.setState({left:n,leftOffset:0}),t>s&&this.setState({top:s,topOffset:0})}updateMetrics(e=this.state){this.prevMetrics=this.metrics;const{metricCalculator:t}=this,n=this.getMetricState(e);return this.metrics=t.getMetrics(n),this.updateScrollBounds(),this.metrics}checkSelectionChange(e){const{selectedRanges:t}=e,{selectedRanges:n}=this.state;if(n!==t){const{onSelectionChanged:s}=this.props;s(n)}}validateSelection(){const{model:e}=this.props,{selectedRanges:t}=this.state,{columnCount:n,rowCount:s}=e;for(let o=0;o<t.length;o+=1){const i=t[o];if(i.endColumn!=null&&i.endColumn>=n||i.endRow!=null&&i.endRow>=s)return this.setState({selectedRanges:[],lastSelectedRanges:[]}),!1}return!0}clearSelectedRanges(){const{selectedRanges:e}=this.state;this.setState({selectedRanges:[],lastSelectedRanges:e})}trimSelectedRanges(){const{selectedRanges:e}=this.state;e.length>0&&this.setState({selectedRanges:e.slice(e.length-1)})}beginSelection(e,t){this.setState({selectionStartColumn:e,selectionStartRow:t,selectionEndColumn:e,selectionEndRow:t,cursorColumn:e,cursorRow:t})}moveSelection(e,t,n=!1,s=!1){this.setState(o=>{var p,f,C,w;const{selectedRanges:i,selectionStartRow:r,selectionStartColumn:l}=o,{theme:a}=this.props,{autoSelectRow:c,autoSelectColumn:d}=a;if(n&&i.length>0){const S=i[i.length-1];let T=null,R=null,b=null,v=null;s?(T=c!==void 0&&c?null:Math.min(e!=null?e:0,(p=S.startColumn)!=null?p:0),R=d!==void 0&&d?null:Math.min(t!=null?t:0,(f=S.startRow)!=null?f:0),b=c!==void 0&&c?null:Math.max(e!=null?e:0,(C=S.endColumn)!=null?C:0),v=d!==void 0&&d?null:Math.max(t!=null?t:0,(w=S.endRow)!=null?w:0)):(T=S.startColumn,R=S.startRow,(l!=null||r!=null)&&((c===void 0||!c)&&(T=l),(d===void 0||!d)&&(R=r)),b=c!==void 0&&c?null:e,v=d!==void 0&&d?null:t);const D=Q.makeNormalized(T,R,b,v);if(S.equals(D))return null;const A=[...i];return A[A.length-1]=D,{selectedRanges:A,selectionEndColumn:e,selectionEndRow:t}}const u=[...i],h=c!==void 0&&c?null:e,g=d!==void 0&&d?null:t;return u.push(Q.makeNormalized(h,g,h,g)),{selectedRanges:u,selectionEndColumn:e,selectionEndRow:t}})}commitSelection(){this.setState(e=>{const{theme:t}=this.props,{autoSelectRow:n}=t,{selectedRanges:s,lastSelectedRanges:o,cursorRow:i,cursorColumn:r}=e;if(s.length===1&&(n!==void 0&&n?Q.rowCount(s)===1:Q.cellCount(s)===1)&&Q.rangeArraysEqual(s,o))return{selectedRanges:[],lastSelectedRanges:[],cursorColumn:null,cursorRow:null};let l=s.slice();if(l.length>1){const d=l[l.length-1];for(let u=0;u<l.length-1;u+=1){const h=l[u];if(h.contains(d)){const g=h.subtract(d);l.pop(),l.splice(u,1),l=l.concat(g);break}}l=Q.consolidate(l)}let a=r,c=i;if(!Q.containsCell(l,r,i)){const{model:d}=this.props,{columnCount:u,rowCount:h}=d,g=Q.nextCell(Q.boundedRanges(s,u,h));g!=null?{column:a,row:c}=g:(a=null,c=null)}return l.length===0&&(a=null,c=null),{cursorRow:c,cursorColumn:a,selectedRanges:l,lastSelectedRanges:s}})}setFocusRow(e){var u;if(!this.metrics||!this.prevMetrics)return;const{gridY:t,height:n,lastTop:s,userRowHeights:o,rowHeight:i}=this.metrics,r=n-t,l=Math.round(r/2)+((u=o.get(e))!=null?u:i),a=this.getMetricState(),c=this.metricCalculator.getLastTop(a,e+1,l);this.setState({top:Math.min(s,c),selectedRanges:[new Q(null,e,null,e)],isStuckToBottom:!1});const{cursorColumn:d}=this.state;this.moveCursorToPosition(d,e,!1,!1)}selectAll(){const{model:e,theme:t}=this.props,{autoSelectRow:n,autoSelectColumn:s}=t,o=s!==void 0&&s?null:0,i=s!==void 0&&s?null:e.rowCount-1,r=n!==void 0&&n?null:0,l=n!==void 0&&n?null:e.columnCount-1;this.setSelectedRanges([new Q(r,o,l,i)])}moveCursor(e,t,n){const{cursorRow:s,cursorColumn:o,selectionEndColumn:i,selectionEndRow:r}=this.state,l=n?i:o,a=n?r:s;if(a===null||l===null){const{left:c,top:d}=this.state;this.moveCursorToPosition(c,d,n)}else{const{model:c}=this.props,{columnCount:d,rowCount:u}=c,h=Be(l+e,0,d-1),g=Be(a+t,0,u-1);this.moveCursorToPosition(h,g,n)}}moveCursorInDirection(e=Q.SELECTION_DIRECTION.DOWN){var c;const{model:t}=this.props,{columnCount:n,rowCount:s}=t,{cursorRow:o,cursorColumn:i,selectedRanges:r}=this.state,l=r.length>0?r:[Q.makeCell(i,o)];let a=null;if(l.length===1&&Q.cellCount(l)===1){const d=new Q(0,0,n-1,s-1);a=(c=d.nextCell(i,o,e))!=null?c:d.startCell(e)}else a=Q.nextCell(Q.boundedRanges(l,n,s),i,o,e);if(a!=null){const{column:d,row:u}=a;this.setState({cursorColumn:d,cursorRow:u}),Q.containsCell(r,d,u)||this.setState({selectedRanges:[Q.makeCell(d,u)],selectionStartColumn:d,selectionStartRow:u,selectionEndColumn:d,selectionEndRow:u}),this.moveViewToCell(a.column,a.row)}}moveCursorToPosition(e,t,n=!1,s=!0,o=!1){n||this.beginSelection(e,t),this.moveSelection(e,t,n,o),s&&this.moveViewToCell(e,t)}moveViewToCell(e,t){if(!this.metrics)throw new Error("metrics not set");const{metricCalculator:n}=this,{bottomVisible:s,rightVisible:o,topVisible:i,leftVisible:r}=this.metrics,l=this.getMetricState(this.state);let{top:a,left:c,topOffset:d,leftOffset:u}=this.state;t!=null&&!H.isFloatingRow(t,this.metrics)&&(t<i?(a=n.getTopForTopVisible(l,t),d=0):t>s&&(a=n.getTopForBottomVisible(l,t),d=0)),e!=null&&!H.isFloatingColumn(e,this.metrics)&&(e<r?(c=n.getLeftForLeftVisible(l,e),u=0):e>o&&(c=n.getLeftForRightVisible(l,e),u=0)),this.setViewState({top:a,left:c,topOffset:d,leftOffset:u})}setViewState(e,t=!1){if(!this.metrics)throw new Error("metrics not set");const{isStickyBottom:n,isStickyRight:s}=this.props,{top:o,left:i}=e,{lastTop:r,lastLeft:l}=this.metrics;o!=null&&this.setState({isStuckToBottom:n&&o>=r}),i!=null&&this.setState({isStuckToRight:s&&i>=l}),this.setState(e),t&&this.forceUpdate()}startEditing(e,t,n=!1,s,o){const{model:i}=this.props;if(!ke(i))throw new Error("model is not editable");const r=this.getModelColumn(e),l=this.getModelRow(t),a={column:e,row:t,selectionRange:s,value:o!==void 0?o:i.editValueForCell(r,l),isQuickEdit:n};this.setState({editingCell:a,cursorColumn:e,cursorRow:t}),this.moveViewToCell(e,t)}isValidForCell(e,t,n){const{model:s}=this.props,o=this.getModelColumn(e),i=this.getModelRow(t);return ke(s)&&s.isValidForCell(o,i,n)}async pasteValue(e){const{model:t}=this.props,{movedColumns:n,movedRows:s,selectedRanges:o}=this.state;try{if(yr(t),!t.isEditable||!o.every(u=>t.isEditableRange(u)))throw new hi("Can't paste in to read-only area.");if(o.length<=0)throw new hi("Select an area to paste to.");if(typeof e=="string"){const u=[],h=H.getModelRanges(o,n,s);Q.forEachCell(h,(g,p)=>{u.push({column:g,row:p,text:e})}),await t.setValues(u);return}const i=e.length,r=e[0].length,{columnCount:l,rowCount:a}=t;let c=o;if(c.every(u=>{var h,g;return Q.cellCount([u])===1&&((h=u.startColumn)!=null?h:0)+r<=l&&((g=u.startRow)!=null?g:0)+i<=a})&&(c=c.map(u=>{var h,g;return new Q(u.startColumn,u.startRow,((h=u.startColumn)!=null?h:0)+r-1,((g=u.startRow)!=null?g:0)+i-1)}),this.setSelectedRanges(c)),!c.every(u=>Q.rowCount([u])===i&&Q.columnCount([u])===r))throw new hi("Copy and paste area are not same size.");const d=[];c.forEach(u=>{var h,g;for(let p=0;p<r;p+=1)for(let f=0;f<i;f+=1)d.push({column:((h=u.startColumn)!=null?h:0)+p,row:((g=u.startRow)!=null?g:0)+f,text:e[f][p]})}),await t.setValues(d)}catch(i){const{onError:r}=this.props;r(i instanceof Error?i:new Error(`${i}`))}}setValueForCell(e,t,n){const{model:s}=this.props;yr(s);const o=this.getModelColumn(e),i=this.getModelRow(t);return s.isValidForCell(o,i,n)?(s.setValueForCell(o,i,n),!0):!1}setValueForRanges(e,t){const{model:n}=this.props,{movedColumns:s,movedRows:o}=this.state,i=H.getModelRanges(e,s,o);ke(n)&&n.setValueForRanges(i,t)}isSelected(e,t){var s,o;const{selectedRanges:n}=this.state;for(let i=0;i<n.length;i+=1){const r=n[i],l=r.startRow===null||r.startRow<=e&&e<=((s=r.endRow)!=null?s:0),a=r.startColumn===null||r.startColumn<=t&&t<=((o=r.endColumn)!=null?o:0);if(l&&a)return!0}return!1}addDocumentCursor(e=null){this.documentCursor!==$n.getCursorClassName(e)&&(this.documentCursor!=null&&document.documentElement.classList.remove(this.documentCursor),this.documentCursor=$n.getCursorClassName(e),this.documentCursor!=null&&document.documentElement.classList.add(this.documentCursor),document.documentElement.classList.add("grid-block-events"))}removeDocumentCursor(){this.documentCursor!=null&&(document.documentElement.classList.remove(this.documentCursor),document.documentElement.classList.remove("grid-block-events"),this.documentCursor=null)}startDragTimer(e){this.stopDragTimer();const t=new MouseEvent("custom",e.nativeEvent);this.dragTimer=setTimeout(()=>{this.handleMouseDrag(t)},$n.dragTimeout)}stopDragTimer(){this.dragTimer&&(clearTimeout(this.dragTimer),this.dragTimer=null)}drawCanvas(e=this.updateMetrics()){if(!this.canvas)throw new Error("canvas is not set");if(!this.canvasContext)throw new Error("context not set");const{cursorColumn:t,cursorRow:n,draggingColumn:s,draggingColumnSeparator:o,draggingRow:i,draggingRowOffset:r,draggingRowSeparator:l,editingCell:a,isDraggingHorizontalScrollBar:c,isDraggingVerticalScrollBar:d,isDragging:u,mouseX:h,mouseY:g,selectedRanges:p}=this.state,{model:f,stateOverride:C}=this.props,{renderer:w}=this,S=this.canvasContext,T=this.getTheme(),R=this.canvas.clientWidth,b=this.canvas.clientHeight,v={width:R,height:b,context:S,theme:T,model:f,metrics:e,mouseX:h,mouseY:g,selectedRanges:p,draggingColumn:s,draggingColumnSeparator:o,draggingRow:i,draggingRowOffset:r,draggingRowSeparator:l,editingCell:a,isDraggingHorizontalScrollBar:c,isDraggingVerticalScrollBar:d,isDragging:u,cursorColumn:t,cursorRow:n,...C};S.save(),w.drawCanvas(v),S.restore()}focus(){var e;(e=this.canvas)==null||e.focus()}isFocused(){return document.activeElement===this.canvas}handleClick(e){var s;const t=this.getGridPointFromEvent(e),n=this.getMouseHandlers();for(let o=0;o<n.length;o+=1)if(n[o].onClick(t,this,e)!==!1){e.stopPropagation(),e.preventDefault();break}(s=this.canvas)==null||s.focus()}handleContextMenu(e){const t=this.getGridPointFromEvent(e),n=this.getMouseHandlers();for(let s=0;s<n.length;s+=1)if(n[s].onContextMenu(t,this,e)!==!1){e.stopPropagation(),e.preventDefault();break}}handleKeyDown(e){var n,s;const t=this.getKeyHandlers();for(let o=0;o<t.length;o+=1){const r=t[o].onDown(e,this);if(r!==!1){const l=r;((n=l==null?void 0:l.stopPropagation)==null||n)&&e.stopPropagation(),((s=l==null?void 0:l.preventDefault)==null||s)&&e.preventDefault();break}}}notifyMouseHandlers(e,t,n=!0,s=!1){var l,a;const o=this.getGridPointFromEvent(t),i=this.getMouseHandlers();let r=null;for(let c=0;c<i.length;c+=1){const d=i[c],u=d[e]!=null&&d[e](o,this,t);if(u!==!1){d.cursor!=null&&({cursor:r}=d,s&&this.addDocumentCursor(r));const h=u;((l=h==null?void 0:h.stopPropagation)==null||l)&&t.stopPropagation(),((a=h==null?void 0:h.preventDefault)==null||a)&&t.preventDefault();break}}if(this.setState({cursor:r}),n){const{x:c,y:d}=o;this.setState({mouseX:c,mouseY:d})}}handleMouseDown(e){window.addEventListener("mousemove",this.handleMouseDrag,!0),window.addEventListener("mouseup",this.handleMouseUp,!0),!(e.button!=null&&e.button!==0)&&(this.notifyMouseHandlers("onDown",e),this.startDragTimer(e))}handleDoubleClick(e){this.notifyMouseHandlers("onDoubleClick",e)}handleMouseMove(e){this.notifyMouseHandlers("onMove",e)}handleMouseLeave(e){this.notifyMouseHandlers("onLeave",e,!1),this.setState({mouseX:null,mouseY:null})}handleMouseDrag(e){this.setState({isDragging:!0}),this.notifyMouseHandlers("onDrag",e,!0,!0),this.stopDragTimer()}handleMouseUp(e){window.removeEventListener("mousemove",this.handleMouseDrag,!0),window.removeEventListener("mouseup",this.handleMouseUp,!0),!(e.button!=null&&e.button!==0)&&(this.notifyMouseHandlers("onUp",e,!1),this.stopDragTimer(),this.removeDocumentCursor())}handleResize(){if(this.updateCanvasScale(),this.updateCanvas(),!this.metrics)throw new Error("metrics not set");this.forceUpdate()}handleWheel(e){var b,v,D,A;if(this.notifyMouseHandlers("onWheel",e),e.defaultPrevented)return;const{metricCalculator:t,metrics:n}=this,s=this.getMetricState();if(!n)throw new Error("metrics not set");const{lastTop:o,lastLeft:i,columnCount:r,rowCount:l,scrollableContentWidth:a,scrollableViewportWidth:c,scrollableContentHeight:d,scrollableViewportHeight:u,hasHorizontalBar:h,hasVerticalBar:g}=n;let{top:p,left:f,topOffset:C,leftOffset:w}=n;const S=this.getTheme();let{deltaX:T,deltaY:R}=H.getScrollDelta(e,n.barWidth,n.barHeight,n.rowHeight,n.rowHeight);for(;h&&T!==0;){if(w+=T,T=0,r>1){if(w>0&&f>=i||w<0&&f<=0){w=0;break}}else{if(w<=0){w=0;break}const N=a-c;if(w>=N){w=N;break}}if(w>0){const N=(b=n.allColumnWidths.get(f))!=null?b:t.getVisibleColumnWidth(f,s);w>=N?(T=w-N,w=0,f+=1):S.scrollSnapToColumn&&r>1&&(w=0,f+=1)}else if(w<0){const N=(v=n.allColumnWidths.get(f-1))!=null?v:t.getVisibleColumnWidth(f-1,s);Math.abs(w)<=N&&S.scrollSnapToColumn&&r>1?(w=0,f-=1):(T=w+N,w=0,f-=1)}}for(;g&&R!==0;){if(C+=R,R=0,l>1){if(C>0&&p>=o||C<0&&p<=0){C=0;break}}else{if(C<=0){C=0;break}const N=d-u;if(C>=N){C=N;break}}if(C>0){const N=(D=n.allRowHeights.get(p))!=null?D:t.getVisibleRowHeight(p,s);C>=N?(R=C-N,C=0,p+=1):S.scrollSnapToRow&&l>1&&(C=0,p+=1)}else if(C<0){const N=(A=n.allRowHeights.get(p-1))!=null?A:t.getVisibleRowHeight(p-1,s);Math.abs(C)<=N&&S.scrollSnapToRow&&l>1?(C=0,p-=1):(R=C+N,C=0,p-=1)}}this.setViewState({top:p,left:f,leftOffset:w,topOffset:C}),e.stopPropagation(),e.preventDefault()}handleEditCellCancel(){this.setState({editingCell:null}),this.focus()}handleEditCellChange(e){this.setState(({editingCell:t})=>{try{return Rr(t),{editingCell:{...t,value:e}}}catch(n){const{onError:s}=this.props;return s(n instanceof Error?n:new Error(`${n}`)),null}})}handleEditCellCommit(e,{direction:t=At.DOWN,fillRange:n=!1}={}){const{editingCell:s,selectedRanges:o}=this.state;if(!s)throw new Error("editingCell not set");const{column:i,row:r}=s;if(!this.isValidForCell(i,r,e)){t===null&&this.setState({editingCell:null});return}n?this.setValueForRanges(o,e):this.setValueForCell(i,r,e),t!==null&&this.moveCursorInDirection(t),this.setState({editingCell:null}),this.focus()}renderInputField(){const{model:e}=this.props,{editingCell:t}=this.state,{metrics:n}=this;if(t==null||n==null||!ke(e))return null;const{selectionRange:s,value:o,isQuickEdit:i}=t,{column:r,row:l}=t,{gridX:a,gridY:c,allColumnXs:d,allRowYs:u,allColumnWidths:h,allRowHeights:g}=n,p=d.get(r),f=u.get(l),C=h.get(r),w=g.get(l),S=p!=null&&f!=null&&C!=null&&w!=null?{position:"absolute",left:a+p,top:c+f,width:C,height:w}:{opacity:0},T=this.getModelColumn(r),R=this.getModelRow(l),b=T!=null&&R!=null?{textAlign:e.textAlignForCell(T,R)}:void 0,v=e.isValidForCell(T,R,o);return m("div",{style:S,children:m(Ki,{selectionRange:s,className:ee({error:!v}),onCancel:this.handleEditCellCancel,onChange:this.handleEditCellChange,onDone:this.handleEditCellCommit,isQuickEdit:i,style:b,value:o},`${r},${l}`)})}render(){const{cursor:e}=this.state;return y(Oe,{children:[m("canvas",{className:ee("grid-canvas",$n.getCursorClassName(e)),ref:t=>{this.canvas=t},onClick:this.handleClick,onContextMenu:this.handleContextMenu,onDoubleClick:this.handleDoubleClick,onKeyDown:this.handleKeyDown,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,tabIndex:0,children:"Your browser does not support HTML canvas. Update your browser?"}),this.renderInputField()]})}};let Rs=$n;Rs.contextType=Sd;Rs.defaultProps={canvasOptions:{alpha:!1},isStickyBottom:!1,isStickyRight:!1,isStuckToBottom:!1,isStuckToRight:!1,keyHandlers:ve,mouseHandlers:ve,movedColumns:ve,movedRows:ve,onError:()=>{},onSelectionChanged:()=>{},onMovedColumnsChanged:e=>{},onMoveColumnComplete:()=>{},onMovedRowsChanged:()=>{},onMoveRowComplete:()=>{},onViewChanged:()=>{},stateOverride:{},theme:{autoSelectColumn:!1,autoSelectRow:!1}};Rs.pixelsPerLine=100/3;Rs.dragTimeout=1e3;Rs.getTheme=Re((e,t)=>({...nd,...e,...t}));class bl extends wa{get floatingTopRowCount(){return 0}get floatingBottomRowCount(){return 0}get floatingLeftColumnCount(){return 0}get floatingRightColumnCount(){return 0}get columnHeaderMaxDepth(){return 1}truncationCharForCell(t,n){}textAlignForCell(t,n){return"left"}colorForCell(t,n,s){return s.textColor}backgroundColorForCell(t,n,s){return null}colorForColumnHeader(t,n=0){return null}textForRowHeader(t){return""}textForRowFooter(t){return""}isColumnMovable(t,n=0){return!0}isRowMovable(t){return!0}getColumnHeaderGroup(t,n){}getColumnHeaderParentGroup(t,n){}}class bd extends bl{constructor({rowCount:t=1e9,columnCount:n=100,floatingTopRowCount:s=0,floatingBottomRowCount:o=0,floatingLeftColumnCount:i=0,floatingRightColumnCount:r=0,isEditable:l=!1,editedData:a=[]}={}){super(),this.numRows=t,this.numColumns=n,this.floatingTop=s,this.floatingBottom=o,this.floatingLeft=i,this.floatingRight=r,this.editable=l,this.editedData=a}get rowCount(){return this.numRows}get columnCount(){return this.numColumns}get floatingTopRowCount(){return this.floatingTop}get floatingBottomRowCount(){return this.floatingBottom}get floatingLeftColumnCount(){return this.floatingLeft}get floatingRightColumnCount(){return this.floatingRight}get isEditable(){return this.editable}textForCell(t,n){var s,o;return(o=(s=this.editedData[t])==null?void 0:s[n])!=null?o:`${t},${n}`}colorForCell(t,n,s){return s.textColor}textForColumnHeader(t,n=0){return`${t}`}textForRowHeader(t){return`${t}`}textForRowFooter(t){return`${t}`}async setValueForCell(t,n,s){this.editedData[t]==null&&(this.editedData[t]=[]),this.editedData[t][n]=`${s}`}async setValueForRanges(t,n){Q.forEachCell(t,(s,o)=>{this.setValueForCell(s,o,n)})}async setValues(t){var n,s;for(let o=0;o<t.length;o+=1){const i=t[o];this.setValueForCell((n=i.column)!=null?n:i.x,(s=i.row)!=null?s:i.y,i.text)}}editValueForCell(t,n){return this.textForCell(t,n)}isValidForCell(t,n,s){return!0}isEditableRange(t){return this.isEditable}delete(t){throw new Error("Method not implemented.")}}const zn=class extends bd{constructor({rowCount:e=zn.DEFAULT_ROW_COUNT,columnCount:t=zn.DEFAULT_COLUMN_COUNT,children:n=new Map,childRowCount:s=Math.ceil(Math.max(zn.MIN_CHILD_ROW_COUNT,e*zn.DEFAULT_CHILD_ROW_COUNT_FACTOR)),maxDepth:o=zn.MAX_DEPTH}={}){super({rowCount:e,columnCount:t}),this.getCachedModelRowOffset=pt((i,r)=>{let l=null,a=r;const c=[...i].sort((d,u)=>d[0]-u[0]);for(let d=0;d<c.length;d+=1){const[u,h]=c[d];if(a<=u)break;const g=h.rowCount;if(a<=u+g){l=u,a=a-u-1;break}a-=g}return{key:l,offsetRow:a}}),this.getCachedTextForRowHeader=pt((i,r)=>{const{key:l,offsetRow:a}=this.getCachedModelRowOffset(i,r);if(l!=null){const c=i.get(l);if(c!==void 0)return`${l}.${c.textForRowHeader(a)}`}return`${a}`}),this.getCachedTextForCell=pt((i,r,l)=>{const{key:a,offsetRow:c}=this.getCachedModelRowOffset(i,l);if(a!=null){const d=i.get(a);if(d!==void 0)return`${a}.${d.textForCell(r,c)}`}return`${r},${c}`}),this.getCachedIsRowExpandable=pt((i,r,l)=>this.getCachedDepthForRow(i,r)<l),this.getCachedIsRowExpanded=pt((i,r)=>{const{key:l,offsetRow:a}=this.getCachedModelRowOffset(i,r);if(l!=null){const c=i.get(l);if(c!==void 0)return c.isRowExpanded(a)}return i.has(a)}),this.getCachedDepthForRow=pt((i,r)=>{const{key:l,offsetRow:a}=this.getCachedModelRowOffset(i,r);if(l!=null){const c=i.get(l);if(c!==void 0)return c.depthForRow(a)+1}return 0}),this.children=n,this.childRowCount=s,this.maxDepth=o}textForCell(e,t){return this.getCachedTextForCell(this.children,e,t)}textForRowHeader(e){return this.getCachedTextForRowHeader(this.children,e)}isRowMovable(e){return!1}get hasExpandableRows(){return!0}get isExpandAllAvailable(){return!1}get floatingBottomRowCount(){return 0}isRowExpandable(e){return this.getCachedIsRowExpandable(this.children,e,this.maxDepth)}isRowExpanded(e){return this.getCachedIsRowExpanded(this.children,e)}setRowExpanded(e,t,n=!1){const{key:s,offsetRow:o}=this.getCachedModelRowOffset(this.children,e),i=new Map(this.children);if(s!=null){const r=this.children.get(s);if(r!==void 0){const{rowCount:l}=r;r.setRowExpanded(o,t,n),this.numRows+=r.rowCount-l}}else if(t){const r=new zn({rowCount:this.childRowCount,columnCount:this.numColumns});i.set(o,r),this.numRows+=r.rowCount}else{const r=i.get(o);r!==void 0&&(this.numRows-=r.rowCount,i.delete(o))}this.children=i}expandAll(){throw new Error("Expand all not implemented.")}collapseAll(){throw new Error("Collapse all not implemented.")}depthForRow(e){return this.getCachedDepthForRow(this.children,e)}};let Qs=zn;Qs.DEFAULT_ROW_COUNT=1e9;Qs.DEFAULT_COLUMN_COUNT=100;Qs.DEFAULT_CHILD_ROW_COUNT_FACTOR=.01;Qs.MIN_CHILD_ROW_COUNT=10;Qs.MAX_DEPTH=10;const{dh:E}=globalThis,Qo=B.exports.shape({name:B.exports.string.isRequired,type:B.exports.string.isRequired,description:B.exports.string,constituentType:B.exports.string}),Tl=B.exports.shape({not:B.exports.func.isRequired,and:B.exports.func.isRequired,or:B.exports.func.isRequired}),Td=B.exports.shape({asc:B.exports.func.isRequired,desc:B.exports.func.isRequired,abs:B.exports.func.isRequired,column:Qo.isRequired,direction:B.exports.string.isRequired,isAbs:B.exports.bool.isRequired}),Ed=B.exports.shape({columns:B.exports.arrayOf(Qo).isRequired,customColumns:B.exports.arrayOf(B.exports.string).isRequired,filter:B.exports.arrayOf(Tl),addEventListener:B.exports.func.isRequired,removeEventListener:B.exports.func.isRequired,size:B.exports.number.isRequired,sort:B.exports.arrayOf(B.exports.any),copy:B.exports.func.isRequired,applyFilter:B.exports.func.isRequired,applySort:B.exports.func.isRequired,applyCustomColumns:B.exports.func.isRequired,description:B.exports.string}),vd=B.exports.shape({columns:B.exports.arrayOf(Qo),filter:B.exports.arrayOf(B.exports.any),isExpanded:B.exports.func.isRequired,saveExpandedState:B.exports.func.isRequired,addEventListener:B.exports.func.isRequired,removeEventListener:B.exports.func.isRequired,size:B.exports.number.isRequired,sort:B.exports.arrayOf(B.exports.any),applyFilter:B.exports.func.isRequired,applySort:B.exports.func.isRequired}),Mo=B.exports.shape({name:B.exports.string.isRequired,type:B.exports.string.isRequired}),Rd=B.exports.shape({created:B.exports.arrayOf(Mo).isRequired,updated:B.exports.arrayOf(Mo).isRequired,removed:B.exports.arrayOf(Mo).isRequired}),yd=B.exports.shape({groupingColumns:B.exports.arrayOf(B.exports.string),aggregations:B.exports.shape({}),includeConstituents:B.exports.bool,includeOriginalColumns:B.exports.bool,includeDescriptions:B.exports.bool}),Fd=B.exports.shape({addEventListener:B.exports.func.isRequired,removeEventListener:B.exports.func.isRequired,onLogMessage:B.exports.func,getTable:B.exports.func.isRequired,runCode:B.exports.func.isRequired});Object.freeze({Column:Qo,FilterCondition:Tl,IdeSession:Fd,RollupConfig:yd,Sort:Td,Table:Ed,TreeTable:vd,VariableChanges:Rd,VariableDefinition:Mo});const Dd=1e4;function Id(e,t,n=Dd){return new Promise((s,o)=>{let i;const r=setTimeout(()=>{i==null||i(),o(new il(`Variable ${t} not found`))},n);function l(a){const c=a.created.find(d=>d.title===t);c!=null&&(clearTimeout(r),i==null||i(),s(c))}i=e.subscribeToFieldUpdates(l)})}class Le{static isValid(t){return!0}static isSameFormat(t,n){throw new Error("isSameFormat not implemented")}static makeFormat(t,n,s){return{label:t,formatString:n,type:s}}format(t,n){return""}}Le.TYPE_GLOBAL="type-global";Le.TYPE_CONTEXT_PRESET="type-context-preset";Le.TYPE_CONTEXT_CUSTOM="type-context-custom";class Nd extends Le{format(t){switch(t){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}class Ad extends Le{format(t){return String.fromCharCode(t)}}const Ar=ie.module("DateTimeColumnFormatter"),qn=class extends Le{constructor({timeZone:e="",showTimeZone:t=!0,showTSeparator:n=!1,defaultDateTimeFormatString:s=qn.DEFAULT_DATETIME_FORMAT_STRING}={}){super();const o=e||qn.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=E.i18n.TimeZone.getTimeZone(o)}catch{Ar.error("Unsupported time zone id",o),this.dhTimeZone=E.i18n.TimeZone.getTimeZone(qn.DEFAULT_TIME_ZONE_ID)}this.defaultDateTimeFormatString=s,this.showTimeZone=t,this.showTSeparator=n,this.formatStringMap=qn.makeFormatStringMap(t,n)}static isValid(e){try{return E.i18n.DateTimeFormat.format(e.formatString,new Date),!0}catch{return!1}}static makeFormat(e,t,n=Le.TYPE_CONTEXT_PRESET){return{label:e,formatString:t,type:n}}static isSameFormat(e,t){return e===t||e!==null&&t!==null&&e.type===t.type&&e.formatString===t.formatString}static makeGlobalFormatStringMap(e,t){const n=t?"'T'":" ",s=e?" z":"";return new Map([["yyyy-MM-dd HH:mm:ss",`yyyy-MM-dd${n}HH:mm:ss${s}`],["yyyy-MM-dd HH:mm:ss.SSS",`yyyy-MM-dd${n}HH:mm:ss.SSS${s}`],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS",`yyyy-MM-dd${n}HH:mm:ss.SSSSSSSSS${s}`]])}static getGlobalFormats(e,t){return[...qn.makeGlobalFormatStringMap(e,t).keys()]}static makeFormatStringMap(e,t){const n=t!==void 0&&t?"'T'":" ",s=e!==void 0&&e?" z":"";return new Map([["yyyy-MM-dd",`yyyy-MM-dd${s}`],["MM-dd-yyyy",`MM-dd-yyyy${s}`],["HH:mm:ss",`HH:mm:ss${s}`],["HH:mm:ss.SSS",`HH:mm:ss.SSS${s}`],["HH:mm:ss.SSSSSSSSS",`HH:mm:ss.SSSSSSSSS${s}`],["yyyy-MM-dd HH:mm:ss",`yyyy-MM-dd${n}HH:mm:ss${s}`],["yyyy-MM-dd HH:mm:ss.SSS",`yyyy-MM-dd${n}HH:mm:ss.SSS${s}`],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS",`yyyy-MM-dd${n}HH:mm:ss.SSSSSSSSS${s}`]])}static getFormats(e,t){return[...qn.makeFormatStringMap(e,t).keys()]}getEffectiveFormatString(e){var t;return(t=this.formatStringMap.get(e))!=null?t:e}format(e,t={}){const n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultDateTimeFormatString,s=this.getEffectiveFormatString(n);try{return E.i18n.DateTimeFormat.format(s,e,this.dhTimeZone)}catch{Ar.error("Invalid format arguments")}return""}};let kn=qn;kn.DEFAULT_DATETIME_FORMAT_STRING="yyyy-MM-dd HH:mm:ss.SSS";kn.DEFAULT_TIME_ZONE_ID="America/New_York";const Md=ie.module("DecimalColumnFormatter"),Mt=class extends Le{constructor({defaultFormatString:e=Mt.DEFAULT_FORMAT_STRING}={}){super(),this.defaultFormatString=e}static isValid(e){try{return E.i18n.NumberFormat.format(e.formatString,0),!0}catch{return!1}}static makeFormat(e,t,n=Le.TYPE_CONTEXT_PRESET,s){return{label:e,type:n,formatString:t,multiplier:s}}static makePresetFormat(e,t="",n){return Mt.makeFormat(e,t,Le.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(e="",t){return Mt.makeFormat("Custom Format",e,Le.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}format(e,t={}){const n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,s=t.multiplier!==void 0&&t.multiplier!==0?e*t.multiplier:e;try{return E.i18n.NumberFormat.format(n,s)}catch{Md.error("Invalid format arguments")}return""}};let _e=Mt;_e.DEFAULT_FORMAT_STRING="###,##0.0000";_e.FORMAT_PERCENT=Mt.makePresetFormat("Percent","##0.00%");_e.FORMAT_BASIS_POINTS=Mt.makePresetFormat("Basis Points","###,##0 bp",1e4);_e.FORMAT_MILLIONS=Mt.makePresetFormat("Millions","###,##0.000 mm",1e-6);_e.FORMAT_SCIENTIFIC_NOTATION=Mt.makePresetFormat("Scientific Notation","0.0000E0");_e.FORMAT_ROUND=Mt.makePresetFormat("Round","###,##0");_e.FORMAT_ROUND_TWO_DECIMALS=Mt.makePresetFormat("0.00","###,##0.00");_e.FORMAT_ROUND_FOUR_DECIMALS=Mt.makePresetFormat("0.0000","###,##0.0000");class Od extends Le{format(t){return`${t}`}}const xd=ie.module("IntegerColumnFormatter"),bs=class extends Le{constructor({defaultFormatString:e=bs.DEFAULT_FORMAT_STRING}={}){super(),this.defaultFormatString=e}static isValid(e){try{return E.i18n.NumberFormat.format(e.formatString,0),!0}catch{return!1}}static makeFormat(e,t,n=Le.TYPE_CONTEXT_PRESET,s){return{label:e,type:n,formatString:t,multiplier:s}}static makePresetFormat(e,t="",n){return bs.makeFormat(e,t,Le.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(e="",t){return bs.makeFormat("Custom Format",e,Le.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}format(e,t={}){const n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,s=t.multiplier!==void 0&&t.multiplier!==0?e*t.multiplier:e;try{return E.i18n.NumberFormat.format(n,s)}catch{xd.error("Invalid format arguments")}return""}};let It=bs;It.DEFAULT_FORMAT_STRING="###,##0";It.FORMAT_MILLIONS=bs.makePresetFormat("Millions","###,##0.000 mm",1e-6);It.FORMAT_SCIENTIFIC_NOTATION=bs.makePresetFormat("Scientific Notation","0.0000E0");class kd extends Le{format(t){return t}}const ct=class{static makeDateWrapper(e,t,n=0,s=1,o=0,i=0,r=0,l=0){if(!e)throw new Error("No timezone provided");const a=`${t}`.padStart(4,"0"),c=`${n+1}`.padStart(2,"0"),d=`${s}`.padStart(2,"0"),u=`${o}`.padStart(2,"0"),h=`${i}`.padStart(2,"0"),g=`${r}`.padStart(2,"0"),p=`${l}`.padStart(9,"0"),f=`${a}-${c}-${d} ${u}:${h}:${g}.${p}`;return E.i18n.DateTimeFormat.parse(ct.FULL_DATE_FORMAT,f,E.i18n.TimeZone.getTimeZone(e))}static getNextNanos(e){const t=parseInt(e,10),n="0".repeat(9-e.length),s=`${t+1}${n}`;return parseInt(s,10)}static getNextDate(e,t,n){let{year:s,month:o,date:i,hours:r,minutes:l,seconds:a,nanos:c}=t;if(e.nanos!=null){if(e.nanos.length===9)return null;c=ct.getNextNanos(e.nanos),c>999999999&&(a+=1,c=0)}else e.seconds!=null?a+=1:e.minutes!=null?l+=1:e.hours!=null?r+=1:e.date!=null?i+=1:e.month!=null?o+=1:s+=1;const d=new Date(s,o,i,r,l,a);return ct.makeDateWrapper(n,d.getFullYear(),d.getMonth(),d.getDate(),d.getHours(),d.getMinutes(),d.getSeconds(),c)}static parseMonth(e){const t=parseInt(e,10);if(!Number.isNaN(t))return t>=1&&t<=12?t-1:NaN;const n=e.trim().toLowerCase();if(n.length>=3){for(let s=0;s<ct.months.length;s+=1)if(ct.months[s].startsWith(n))return s}return NaN}static parseDateValues(e,t,n,s,o,i,r){const l=parseInt(e,10),a=t!=null?this.parseMonth(t):0,c=n!=null?parseInt(n,10):1,d=s!=null?parseInt(s,10):0,u=o!=null?parseInt(o,10):0,h=i!=null?parseInt(i,10):0,g=r!=null?parseInt(r.padEnd(9,"0"),10):0;return Number.isNaN(l)||Number.isNaN(a)||Number.isNaN(c)||Number.isNaN(d)||Number.isNaN(u)||Number.isNaN(h)||Number.isNaN(g)?null:{year:l,month:a,date:c,hours:d,minutes:u,seconds:h,nanos:g}}static parseDateTimeString(e){const n=/\s*(\d{4})([-./]([\da-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/.exec(e);if(n==null)throw new Error(`Unexpected date string: ${e}`);const[,s,,o,,i,,r,,l,,a,,c,d]=n;if(d!=null&&d.length>0)throw new Error(`Unexpected characters after date string '${e}': ${d}`);return{year:s,month:o,date:i,hours:r,minutes:l,seconds:a,nanos:c}}static parseDateRange(e,t){const n=e.trim().toLowerCase();if(n.length===0)throw new Error("Cannot parse date range from empty string");if(n==="null")return[null,null];if(n==="today"){const l=new Date(Date.now()),a=ct.makeDateWrapper(t,l.getFullYear(),l.getMonth(),l.getDate()),c=ct.makeDateWrapper(t,l.getFullYear(),l.getMonth(),l.getDate()+1);return[a,c]}if(n==="yesterday"){const l=new Date(Date.now()),a=ct.makeDateWrapper(t,l.getFullYear(),l.getMonth(),l.getDate()-1),c=ct.makeDateWrapper(t,l.getFullYear(),l.getMonth(),l.getDate());return[a,c]}if(n==="now"){const l=new Date(Date.now());return[E.DateWrapper.ofJsDate(l),null]}const s=ct.parseDateTimeString(n);if(s.year==null&&s.month==null&&s.date==null)throw new Error(`Unable to extract year, month, or day ${n}`);const o=ct.parseDateValues(s.year,s.month,s.date,s.hours,s.minutes,s.seconds,s.nanos);if(o==null)throw new Error(`Unable to extract date values from ${s}`);const i=ct.makeDateWrapper(t,o.year,o.month,o.date,o.hours,o.minutes,o.seconds,o.nanos),r=ct.getNextDate(s,o,t);return[i,r]}static getJsDate(e){return typeof e=="number"?new Date(e):e.asDate()}};let cn=ct;cn.FULL_DATE_FORMAT="yyyy-MM-dd HH:mm:ss.SSSSSSSSS";cn.months=["january","february","march","april","may","june","july","august","september","october","november","december"];class Gt{}Gt.not="not";Gt.and="and";Gt.or="or";function Ld(e){if(!(e==="not"||e==="and"||e==="or"))throw new Error("operator is not a valid FilterOperatorValue")}class _{}_.eq="eq";_.eqIgnoreCase="eqIgnoreCase";_.notEq="notEq";_.notEqIgnoreCase="notEqIgnoreCase";_.greaterThan="greaterThan";_.greaterThanOrEqualTo="greaterThanOrEqualTo";_.lessThan="lessThan";_.lessThanOrEqualTo="lessThanOrEqualTo";_.in="in";_.inIgnoreCase="inIgnoreCase";_.notIn="notIn";_.notInIgnoreCase="notInIgnoreCase";_.isTrue="isTrue";_.isFalse="isFalse";_.isNull="isNull";_.invoke="invoke";_.contains="contains";_.notContains="notContains";_.startsWith="startsWith";_.endsWith="endsWith";_.containsAny="containsAny";function Pd(e){switch(e){case _.eq:return"is exactly";case _.eqIgnoreCase:return"is exactly (ignore case)";case _.notEq:return"is not exactly";case _.notEqIgnoreCase:return"is not exactly (ignore case)";case _.contains:return"contains";case _.notContains:return"does not contain";case _.startsWith:return"starts with";case _.endsWith:return"ends with";default:throw new Error(`Unrecognized text filter type ${e}`)}}function _d(e){switch(e){case _.eq:return"is equal to";case _.notEq:return"is not equal to";case _.greaterThan:return"greater than";case _.greaterThanOrEqualTo:return"greater than or equal to";case _.lessThan:return"less than";case _.lessThanOrEqualTo:return"less than or equal to";default:throw new Error(`Unrecognized number filter type ${e}`)}}function Hd(e){switch(e){case _.eq:return"date is";case _.notEq:return"date is not";case _.notEqIgnoreCase:case _.greaterThan:return"date is after";case _.greaterThanOrEqualTo:return"date is after or equal";case _.lessThan:return"date is before";case _.lessThanOrEqualTo:return"date is before or equal";default:throw new Error(`Unrecognized date filter type ${e}`)}}function Vd(e){switch(e){case _.isTrue:return"Is True";case _.isFalse:return"Is False";case _.isNull:return"Is Null";default:throw new Error(`Unrecognized boolean filter type ${e}`)}}const jt=ie.module("TableUtils"),Y=class{static getSortIndex(e,t){var n;for(let s=0;s<e.length;s+=1)if(((n=e[s].column)==null?void 0:n.index)===t)return s;return null}static getSortForColumn(e,t){const n=Y.getSortIndex(e,t);return n!=null?e[n]:null}static getFilterText(e){return e?e.toString():null}static getFilterTypes(e){return Y.isBooleanType(e)?[_.isTrue,_.isFalse,_.isNull]:Y.isCharType(e)||Y.isNumberType(e)||Y.isDateType(e)?[_.eq,_.notEq,_.greaterThan,_.greaterThanOrEqualTo,_.lessThan,_.lessThanOrEqualTo]:Y.isTextType(e)?[_.eq,_.eqIgnoreCase,_.notEq,_.notEqIgnoreCase,_.contains,_.notContains,_.startsWith,_.endsWith]:[]}static getNextSort(e,t,n){if(e==null||n<0||n>=e.length)return null;const s=Y.getSortForColumn(t,n);return s===null?e[n].sort().asc():s.direction===Y.sortDirection.ascending?s.desc():null}static makeColumnSort(e,t,n,s){if(e==null||t<0||t>=e.length||n===Y.sortDirection.none)return null;let o=e[t].sort();switch(n){case Y.sortDirection.ascending:o=o.asc();break;case Y.sortDirection.descending:o=o.desc();break}return s&&(o=o.abs()),o}static toggleSortForColumn(e,t,n,s=!1){if(n<0||n>=t.length)return[];const o=Y.getNextSort(t,e,n);return Y.setSortForColumn(e,n,o,s)}static sortColumn(e,t,n,s,o,i){if(e==null||n<0||n>=t.length)return[];const r=Y.makeColumnSort(t,n,s,o);return Y.setSortForColumn(e,n,r,i)}static setSortForColumn(e,t,n,s=!1){const o=Y.getSortIndex(e,t);let i=[];return s&&(i=i.concat(e.filter(({direction:r})=>r!==Y.sortDirection.reverse)),o!==null&&i.splice(o,1)),n!==null&&i.push(n),i}static getNormalizedType(e){switch(e){case"boolean":case"java.lang.Boolean":case Y.dataType.BOOLEAN:return Y.dataType.BOOLEAN;case"char":case"java.lang.Character":case Y.dataType.CHAR:return Y.dataType.CHAR;case"java.lang.String":case Y.dataType.STRING:return Y.dataType.STRING;case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":case Y.dataType.DATETIME:return Y.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case Y.dataType.DECIMAL:return Y.dataType.DECIMAL;case"int":case"java.lang.Integer":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":case"java.math.BigInteger":case Y.dataType.INT:return Y.dataType.INT;default:return Y.dataType.UNKNOWN}}static isLongType(e){switch(e){case"long":case"java.lang.Long":return!0;default:return!1}}static isDateType(e){switch(e){case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":return!0;default:return!1}}static isNumberType(e){return Y.isIntegerType(e)||Y.isDecimalType(e)}static isIntegerType(e){switch(e){case"int":case"java.lang.Integer":case"java.math.BigInteger":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":return!0;default:return!1}}static isDecimalType(e){switch(e){case"double":case"java.lang.Double":case"java.math.BigDecimal":case"float":case"java.lang.Float":return!0;default:return!1}}static isBigDecimalType(e){switch(e){case"java.math.BigDecimal":return!0;default:return!1}}static isBigIntegerType(e){switch(e){case"java.math.BigInteger":return!0;default:return!1}}static isBooleanType(e){switch(e){case"boolean":case"java.lang.Boolean":return!0;default:return!1}}static isCharType(e){switch(e){case"char":case"java.lang.Character":return!0;default:return!1}}static isStringType(e){switch(e){case"java.lang.String":return!0;default:return!1}}static isTextType(e){return this.isStringType(e)||this.isCharType(e)}static getBaseType(e){return e.split("[]")[0]}static isCompatibleType(e,t){return Y.getNormalizedType(e)===Y.getNormalizedType(t)}static makeQuickFilter(e,t,n){const s=t.split("||");let o=null;for(let i=0;i<s.length;i+=1){const l=s[i].split("&&");let a=null;for(let c=0;c<l.length;c+=1){const d=l[c].trim();if(d.length>0){const u=Y.makeQuickFilterFromComponent(e,d,n);if(u)a?a=a.and(u):a=u;else throw new Error(`Unable to parse quick filter from text ${t}`)}}o&&a?o=o.or(a):o=a}return o}static makeQuickFilterFromComponent(e,t,n){const{type:s}=e;return Y.isNumberType(s)?this.makeQuickNumberFilter(e,t):Y.isBooleanType(s)?this.makeQuickBooleanFilter(e,t):n!=null&&Y.isDateType(s)?this.makeQuickDateFilter(e,t,n):Y.isCharType(s)?this.makeQuickCharFilter(e,t):this.makeQuickTextFilter(e,t)}static makeQuickNumberFilter(e,t){if(t==null)return null;const n=e.filter();let s=null;const i=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i.exec(t);let r=null,l=null,a=null,c=null,d=null;if(i!==null&&i.length>3&&([,r,l,a,c,d]=i),d!=null&&d.trim().length>0)return null;if(r==null&&(r="="),c!=null){if(!(r==="="||r==="!"||r==="!="))return null;switch(c=c.trim().toLowerCase(),c){case"null":s=n.isNull();break;case"nan":s=E.FilterCondition.invoke("isNaN",n);break;case"infinity":case"inf":case"\u221E":l!=null?s=E.FilterCondition.invoke("isInf",n).and(n.lessThan(E.FilterValue.ofNumber(0))):s=E.FilterCondition.invoke("isInf",n).and(n.greaterThan(E.FilterValue.ofNumber(0)));break}return s!==null&&(r==="!"||r==="!=")&&(s=s.not()),s}if(a==null)return null;if(a=Y.removeCommas(a),Y.isLongType(e.type))try{a=E.FilterValue.ofNumber(E.LongWrapper.ofString(`${l!=null?"-":""}${a}`))}catch(u){return jt.warn("Unable to create long filter",u),null}else{if(a=parseFloat(a),a==null||Number.isNaN(a))return null;a=E.FilterValue.ofNumber(l!=null?0-a:a)}return s=e.filter(),Y.makeRangeFilterWithOperation(s,r,a)}static makeQuickTextFilter(e,t){if(t==null)return null;const n=`${t}`.trim(),o=/^(!~|!=|~|=|!)?(.*)/.exec(n);let i=null,r=null;if(o!==null&&o.length>2&&([,i,r]=o,r!=null&&(r=r.trim())),r==null||r.length===0)return null;i==null&&(i="=");const l=e.filter();if(r.toLowerCase()==="null")switch(i){case"=":return l.isNull();case"!=":case"!":return l.isNull().not();default:return null}let a=null,c=null;switch(r.startsWith("*")?(a="*",r=r.substring(1)):r.endsWith("*")&&!r.endsWith("\\*")&&(c="*",r=r.substring(0,r.length-1)),r=r.replace("\\",""),i){case"~":return l.isNull().not().and(l.invoke("matches",E.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E.*`)));case"!~":return l.isNull().or(l.invoke("matches",E.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E.*`)).not());case"!=":return a==="*"?l.isNull().or(l.invoke("matches",E.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E$`)).not()):c==="*"?l.isNull().or(l.invoke("matches",E.FilterValue.ofString(`(?s)(?i)^\\Q${r}\\E.*`)).not()):l.notEqIgnoreCase(E.FilterValue.ofString(r.toLowerCase()));case"=":return a==="*"?l.isNull().not().and(l.invoke("matches",E.FilterValue.ofString(`(?s)(?i).*\\Q${r}\\E$`))):c==="*"?l.isNull().not().and(l.invoke("matches",E.FilterValue.ofString(`(?s)(?i)^\\Q${r}\\E.*`))):l.eqIgnoreCase(E.FilterValue.ofString(r.toLowerCase()))}return null}static makeQuickBooleanFilter(e,t){if(t==null)return null;const s=/^(!=|=|!)?(.*)/.exec(`${t}`.trim());if(s===null)return null;const[,o,i]=s,r=o==="!"||o==="!=",l=i.trim().toLowerCase();let a=e.filter();try{const c=Y.makeBooleanValue(l);return c!=null&&c?a=a.isTrue():c===null?a=a.isNull():a=a.isFalse(),r?a.not():a}catch{return null}}static makeQuickDateFilter(e,t,n){const s=t.trim(),i=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/.exec(s);if(i==null||i.length<=2)throw new Error(`Unable to parse date filter: ${t}`);let r=null,l=null;[,r,l]=i;let a=_.eq;switch(r){case"<":a=_.lessThan;break;case"<=":case"=<":a=_.lessThanOrEqualTo;break;case">":a=_.greaterThan;break;case">=":case"=>":a=_.greaterThanOrEqualTo;break;case"!=":case"!":a=_.notEq;break;case"=":case"==":default:a=_.eq;break}return Y.makeQuickDateFilterWithOperation(e,l,a,n)}static makeQuickDateFilterWithOperation(e,t,n,s){if(e==null)throw new Error("Column is null");const[o,i]=cn.parseDateRange(t,s),r=o!=null?E.FilterValue.ofNumber(o):null,l=i!=null?E.FilterValue.ofNumber(i):null,a=e.filter();if(r==null)return n===_.notEq?a.isNull().not():a.isNull();switch(n){case _.eq:{if(l!=null){const c=a.greaterThanOrEqualTo(r),d=a.lessThan(l);return c.and(d)}return a.eq(r)}case _.lessThan:return a.lessThan(r);case _.lessThanOrEqualTo:return l!=null?a.lessThan(l):a.lessThanOrEqualTo(r);case _.greaterThan:return l!=null?a.greaterThanOrEqualTo(l):a.greaterThan(r);case _.greaterThanOrEqualTo:return a.greaterThanOrEqualTo(r);case _.notEq:{if(l!=null){const c=a.lessThan(r),d=a.greaterThanOrEqualTo(l);return c.or(d)}return a.notEq(r)}default:throw new Error(`Invalid operator: ${n}`)}}static quoteValue(e){return e.length>=2&&(e.charAt(0)==='"'&&e.charAt(e.length-1)==='"'||e.charAt(0)==="'"&&e.charAt(e.length-1)==="'")?e:`"${e}"`}static isRangeOperation(e){switch(e){case"<":case"<=":case"=<":case">":case">=":case"=>":return!0;default:return!1}}static makeQuickCharFilter(e,t){if(t==null)return null;const n=`${t}`.trim(),o=/^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/.exec(n);let i=null,r=null,l=null;if(o!==null&&o.length>3&&([,i,r,l]=o),l!=null&&l.trim().length>0||r==null||r.length===0)return null;i==null&&(i="=");const a=e.filter();if(r.toLowerCase()==="null")switch(i){case"=":return a.isNull();case"!=":case"!":return a.isNull().not();default:return null}const c=E.FilterValue.ofString(Y.isRangeOperation(i)?Y.quoteValue(r):r);return Y.makeRangeFilterWithOperation(a,i,c)}static makeRangeFilterWithOperation(e,t,n){switch(t){case"=":return e.eq(n);case"<":return e.lessThan(n);case"<=":case"=<":return e.lessThanOrEqualTo(n);case">":return e.greaterThan(n);case">=":case"=>":return e.greaterThanOrEqualTo(n);case"!=":case"!":return e.notEq(n);default:return null}}static makeCancelableTablePromise(e){return Ge.makeCancelable(e,t=>{t.close()})}static makeCancelableTableEventPromise(e,t,n=0,s=null){let o,i,r=!0;const l=new Promise((a,c)=>{i=setTimeout(()=>{o(),r=!1,c(new il(`Event "${t}" timed out.`))},n),o=e.addEventListener(t,d=>{if(s!=null&&!s(d)){jt.debug2("Event triggered, but matcher returned false.");return}jt.debug2("Event triggered, resolving."),o(),clearTimeout(i),r=!1,a(d)})});return l.cancel=()=>{if(r){jt.debug2("Pending promise cleanup."),o(),clearTimeout(i),r=!1;return}jt.debug2("Ignoring non-pending promise cancel.")},l}static makeAdvancedFilter(e,t,n){const{filterItems:s,filterOperators:o,invertSelection:i,selectedValues:r}=t;let l=null;for(let c=0;c<s.length;c+=1){const d=s[c],{selectedType:u,value:h}=d;if(u!=null&&u.length>0&&h!=null&&h.length>0)try{const g=Y.makeAdvancedValueFilter(e,u,h,n);if(g!=null){if(c===0)l=g;else if(l!==null&&c-1<o.length){const p=o[c-1];if(p===Gt.and)l=l.and(g);else if(p===Gt.or)l=l.or(g);else{jt.error("Unexpected filter operator",p,g),l=null;break}}}else jt.debug2("Empty filter ignored for",u,h)}catch(g){jt.error("Unable to create filter",g),l=null;break}}const a=Y.makeSelectValueFilter(e,r,i);return a!=null&&(l!=null?l=l.and(a):l=a),l}static removeCommas(e){return e.replace(/[\s|,]/g,"")}static makeFilterValue(e,t){const n=Y.getBaseType(e);return Y.isTextType(n)?E.FilterValue.ofString(t):Y.isLongType(n)?E.FilterValue.ofNumber(E.LongWrapper.ofString(Y.removeCommas(t))):E.FilterValue.ofNumber(Y.removeCommas(t))}static makeFilterRawValue(e,t){return Y.isTextType(e)?E.FilterValue.ofString(t):Y.isBooleanType(e)?E.FilterValue.ofBoolean(t):E.FilterValue.ofNumber(t)}static makeValue(e,t,n){if(t==null||t==="null")return null;if(Y.isTextType(e))return t;if(Y.isLongType(e))return E.LongWrapper.ofString(Y.removeCommas(t));if(Y.isBooleanType(e))return Y.makeBooleanValue(t,!0);if(Y.isDateType(e)){const[s]=cn.parseDateRange(t,n);return s}return Y.isNumberType(e)?Y.makeNumberValue(t):(jt.error("Unexpected column type",e),null)}static makeBooleanValue(e,t=!1){if(e===""&&t)return null;switch(e==null?void 0:e.toLowerCase()){case"null":return null;case"0":case"f":case"fa":case"fal":case"fals":case"false":case"n":case"no":return!1;case"1":case"t":case"tr":case"tru":case"true":case"y":case"ye":case"yes":return!0;default:throw new Error(`Invalid boolean '${e}'`)}}static makeNumberValue(e){if(e==null||e==="null"||e==="")return null;const t=e.toLowerCase().trim();if(t==="\u221E"||t==="infinity"||t==="inf")return Number.POSITIVE_INFINITY;if(t==="-\u221E"||t==="-infinity"||t==="-inf")return Number.NEGATIVE_INFINITY;const n=Y.removeCommas(t);if(Y.NUMBER_REGEX.test(n))return parseFloat(n);throw new Error(`Invalid number '${e}'`)}static getFilterOperatorString(e){switch(e){case _.eq:return"=";case _.notEq:return"!=";case _.greaterThan:return">";case _.greaterThanOrEqualTo:return">=";case _.lessThan:return"<";case _.lessThanOrEqualTo:return"<=";case _.contains:return"~";case _.notContains:return"!~";default:throw new Error(`Unexpected filter type ${e}`)}}static makeAdvancedValueFilter(e,t,n,s){if(Y.isDateType(e.type))return Y.makeQuickDateFilterWithOperation(e,n,t,s);if(Y.isNumberType(e.type)||Y.isCharType(e.type))return Y.makeQuickFilter(e,`${Y.getFilterOperatorString(t)}${n}`);const o=Y.makeFilterValue(e.type,n),i=e.filter();switch(t){case _.eq:return i.eq(o);case _.eqIgnoreCase:return i.eqIgnoreCase(o);case _.notEq:return i.notEq(o);case _.notEqIgnoreCase:return i.notEqIgnoreCase(o);case _.greaterThan:return i.greaterThan(o);case _.greaterThanOrEqualTo:return i.greaterThanOrEqualTo(o);case _.lessThan:return i.lessThan(o);case _.lessThanOrEqualTo:return i.lessThanOrEqualTo(o);case _.isTrue:return i.isTrue();case _.isFalse:return i.isFalse();case _.isNull:return i.isNull();case _.contains:return i.isNull().not().and(i.invoke("matches",E.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E.*`)));case _.notContains:return i.isNull().or(i.invoke("matches",E.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E.*`)).not());case _.startsWith:return i.isNull().not().and(i.invoke("matches",E.FilterValue.ofString(`(?s)(?i)^\\Q${n}\\E.*`)));case _.endsWith:return i.isNull().not().and(i.invoke("matches",E.FilterValue.ofString(`(?s)(?i).*\\Q${n}\\E$`)));case _.in:case _.inIgnoreCase:case _.notIn:case _.notInIgnoreCase:case _.invoke:default:throw new Error(`Unexpected filter operation: ${t}`)}}static makeSelectValueFilter(e,t,n){if(t.length===0){if(n)return null;let i=null;Y.isTextType(e.type)?i=E.FilterValue.ofString("a"):Y.isBooleanType(e.type)?i=E.FilterValue.ofBoolean(!0):Y.isDateType(e.type)?i=E.FilterValue.ofNumber(E.DateWrapper.ofJsDate(new Date)):i=E.FilterValue.ofNumber(0);const r=e.filter().eq(i),l=e.filter().notEq(i);return r.and(l)}const s=[];let o=!1;for(let i=0;i<t.length;i+=1){const r=t[i];r==null?o=!0:Y.isTextType(e.type)?s.push(E.FilterValue.ofString(typeof r=="number"?String.fromCharCode(r):r)):Y.isBooleanType(e.type)?s.push(E.FilterValue.ofBoolean(Boolean(r))):s.push(E.FilterValue.ofNumber(r))}return o?s.length>0?n?e.filter().isNull().not().and(e.filter().notIn(s)):e.filter().isNull().or(e.filter().in(s)):n?e.filter().isNull().not():e.filter().isNull():n?e.filter().notIn(s):e.filter().in(s)}static isTreeTable(e){return e!=null&&e.expand!==void 0&&e.collapse!==void 0}static sortColumns(e,t=!0){return[...e].sort((n,s)=>{const o=n.name.toUpperCase(),i=s.name.toUpperCase();return Wi.sort(o,i,t)})}};let I=Y;I.dataType={BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"};I.sortDirection={ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null};I.REVERSE_TYPE=Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"});I.NUMBER_REGEX=/^-?\d+(\.\d+)?$/;class zt{static makeColumnFormatMap(t){return t==null?new Map:t.reduce((n,s)=>{const o=I.getNormalizedType(s.columnType);if(o===null)return n;n.has(o)||n.set(o,new Map);const i=n.get(o);return i==null||i.set(s.columnName,s.format),n},new Map)}static makeColumnFormattingRule(t,n,s){return{columnType:t,columnName:n,format:s}}constructor(t=[],n,s,o,i=!1){this.defaultColumnFormatter=new Od,this.typeFormatterMap=new Map([[I.dataType.BOOLEAN,new Nd],[I.dataType.CHAR,new Ad],[I.dataType.DATETIME,new kn(n)],[I.dataType.DECIMAL,new _e(s)],[I.dataType.INT,new It(o)],[I.dataType.STRING,new kd]]),this.columnFormatMap=zt.makeColumnFormatMap(t),this.truncateNumbersWithPound=i}getColumnFormatMapForType(t,n=!1){const s=I.getNormalizedType(t);if(s!==null)return n&&!this.columnFormatMap.has(s)&&this.columnFormatMap.set(s,new Map),this.columnFormatMap.get(s)}getColumnFormat(t,n){var o;const s=this.getColumnFormatMapForType(t);return(o=s==null?void 0:s.get(n))!=null?o:null}getColumnTypeFormatter(t){var o;const n=I.getNormalizedType(t);let s=this.defaultColumnFormatter;return n&&(s=(o=this.typeFormatterMap.get(n))!=null?o:s),s}getFormattedString(t,n,s="",o){if(t==null)return"";const i=this.getColumnTypeFormatter(n),r=o||this.getColumnFormat(n,s);return i.format(t,r!=null?r:void 0)}get timeZone(){var n;const t=this.typeFormatterMap.get(I.dataType.DATETIME);return(n=t==null?void 0:t.dhTimeZone)==null?void 0:n.id}}function Ud(e){if(e&&e.formatter){const{formatter:t}=e;return t}}function Bd(e){return{timeZone:e==null?void 0:e.timeZone,defaultDateTimeFormatString:e==null?void 0:e.defaultDateTimeFormat,showTimeZone:e==null?void 0:e.showTimeZone,showTSeparator:e==null?void 0:e.showTSeparator}}function Gd(e,t,n){const s=e.getColumnFormat(n,t);return s!=null&&(s.type===Le.TYPE_CONTEXT_PRESET||s.type===Le.TYPE_CONTEXT_CUSTOM)}const Jn={getColumnFormats:Ud,getDateTimeFormatterOptions:Bd,isCustomColumnFormatDefined:Gd};function Wd(e,t){const n=qd(e);return n===void 0?void 0:`${Zd(e)} ? ${n} : ${t}`}function $d(e){return dh.Column.formatRowColor(e)}function zd(e,t){return e.formatColor(t)}const mi=ie.module("ConditionalFormattingUtils");var qt=(e=>(e.CONDITIONAL="conditional",e.ROWS="rows",e))(qt||{}),Ne=(e=>(e.IS_EQUAL="is-equal",e.IS_NOT_EQUAL="is-not-equal",e.IS_BETWEEN="is-between",e.GREATER_THAN="greater-than",e.GREATER_THAN_OR_EQUAL="greater-than-or-equal",e.LESS_THAN="less-than",e.LESS_THAN_OR_EQUAL="less-than-or-equal",e.IS_NULL="is-null",e.IS_NOT_NULL="is-not-null",e))(Ne||{}),mt=(e=>(e.IS_EXACTLY="is-exactly",e.IS_NOT_EXACTLY="is-not-exactly",e.CONTAINS="contains",e.DOES_NOT_CONTAIN="does-not-contain",e.STARTS_WITH="starts-with",e.ENDS_WITH="ends-with",e.IS_NULL="is-null",e.IS_NOT_NULL="is-not-null",e))(mt||{}),it=(e=>(e.IS_EXACTLY="is-exactly",e.IS_NOT_EXACTLY="is-not-exactly",e.IS_BEFORE="is-before",e.IS_BEFORE_OR_EQUAL="is-before-or-equal",e.IS_AFTER="is-after",e.IS_AFTER_OR_EQUAL="is-after-or-equal",e.IS_NULL="is-null",e.IS_NOT_NULL="is-not-null",e))(it||{}),Us=(e=>(e.IS_TRUE="is-true",e.IS_FALSE="is-false",e.IS_NULL="is-null",e.IS_NOT_NULL="is-not-null",e))(Us||{}),Kn=(e=>(e.IS_EQUAL="is-equal",e.IS_NOT_EQUAL="is-not-equal",e.IS_NULL="is-null",e.IS_NOT_NULL="is-not-null",e))(Kn||{}),Ft=(e=>(e.NO_FORMATTING="no-formatting",e.POSITIVE="positive",e.NEGATIVE="negative",e.WARN="warn",e.NEUTRAL="neutral",e.ACCENT_1="accent-1",e.ACCENT_2="accent-2",e.CUSTOM="custom",e))(Ft||{});function Mr(e){switch(e){case"no-formatting":return"No formatting";case"positive":return"Positive";case"negative":return"Negative";case"warn":return"Warn";case"neutral":return"Neutral";case"accent-1":return"Accent 1";case"accent-2":return"Accent 2";case"custom":return"Custom..."}}function Po(e){const{type:t,customConfig:n}=e;switch(t){case"no-formatting":return;case"positive":return"#9fde6f";case"negative":return"#ff6087";case"warn":return"#f67f40";case"neutral":return"#ffd95c";case"accent-1":return"#78dce8";case"accent-2":return"#ab9bf5";case"custom":return n==null?void 0:n.background;default:return}}function _o(e){const{type:t,customConfig:n}=e;switch(t){case"no-formatting":return;case"positive":return"#526a3f";case"negative":return"#802f44";case"warn":return"#663318";case"neutral":return"#63562b";case"accent-1":return"#3f6469";case"accent-2":return"#554d72";case"custom":return n==null?void 0:n.color;default:return}}function qd(e){const t=_o(e.style),n=Po(e.style);if(!(t===void 0||n===void 0))return`bgfg(\`${n}\`, \`${t}\`)`}function Yd(e){const{column:t,value:n,start:s,end:o}=e;return cu(t.name,e.condition,n,s,o)}function Xd(e){const{column:t,value:n}=e;return du(t.name,e.condition,n)}function Kd(e){const{column:t,value:n}=e;return uu(t.name,e.condition,n)}function Qd(e){const{column:t}=e;return hu(t.name,e.condition)}function jd(e){const{column:t,value:n}=e;return mu(t.name,e.condition,n)}function Zd(e){const{column:t}=e;if(I.isNumberType(t.type))return Yd(e);if(I.isCharType(t.type))return jd(e);if(I.isStringType(t.type))return Xd(e);if(I.isDateType(t.type))return Kd(e);if(I.isBooleanType(t.type))return Qd(e);throw new Error("Invalid column type")}function Jd(e){switch(e){case"is-equal":return"is equal to";case"is-not-equal":return"is not equal to";case"is-between":return"is between";case"greater-than":return"greater than";case"greater-than-or-equal":return"greater than or equal to";case"less-than":return"less than";case"less-than-or-equal":return"less than or equal to";case"is-null":return"is null";case"is-not-null":return"is not null"}}function eu(e){switch(e){case"is-exactly":return"is exactly";case"is-not-exactly":return"is not exactly";case"contains":return"contains";case"does-not-contain":return"does not contain";case"starts-with":return"starts with";case"ends-with":return"ends with";case"is-null":return"is null";case"is-not-null":return"is not null"}}function tu(e){switch(e){case"is-exactly":return"is";case"is-not-exactly":return"is not";case"is-before":return"is before";case"is-before-or-equal":return"is before or equal";case"is-after":return"is after";case"is-after-or-equal":return"is after or equal";case"is-null":return"is null";case"is-not-null":return"is not null"}}function nu(e){switch(e){case"is-true":return"is true";case"is-false":return"is false";case"is-null":return"is null";case"is-not-null":return"is not null"}}function su(e){switch(e){case"is-equal":return"is";case"is-not-equal":return"is not";case"is-null":return"is null";case"is-not-null":return"is not null"}}function El(e){if(I.isNumberType(e)||I.isCharType(e))return"is-equal";if(I.isStringType(e)||I.isDateType(e))return"is-exactly";if(I.isBooleanType(e))return"is-true";throw new Error("Invalid column type")}function vl(e){if(I.isCharType(e)||I.isStringType(e))return""}function Rl(e){const{condition:t,value:n,start:s,end:o}=e;return{condition:t,value:n,start:s,end:o}}function jo(e){return{condition:El(e),value:vl(e),start:void 0,end:void 0}}function yl(){return{type:"no-formatting"}}function ou(e){switch(e){case"is-exactly":return"==";case"is-not-exactly":return"!=";case"contains":return"contains";case"does-not-contain":return"does not contain";case"starts-with":return"starts with";case"ends-with":return"ends with";case"is-null":return"is null";case"is-not-null":return"is not null"}}function iu(e){switch(e){case"is-exactly":return"==";case"is-not-exactly":return"!=";case"is-before":return"<";case"is-before-or-equal":return"<=";case"is-after":return">";case"is-after-or-equal":return">=";case"is-null":return"is null";case"is-not-null":return"is not null"}}function ru(e){switch(e){case"is-true":return"is true";case"is-false":return"is false";case"is-null":return"is null";case"is-not-null":return"is not null"}}function lu(e){switch(e){case"is-equal":return"==";case"is-not-equal":return"!=";case"is-null":return"is null";case"is-not-null":return"is not null"}}function au(e){switch(e){case"is-equal":return"==";case"is-not-equal":return"!=";case"is-between":return"==";case"greater-than":return">";case"greater-than-or-equal":return">=";case"less-than":return"<";case"less-than-or-equal":return"<=";case"is-null":return"is null";case"is-not-null":return"is not null"}}function cu(e,t,n,s,o){switch(t){case"is-equal":return`${e} == ${n}`;case"is-not-equal":return`${e} != ${n}`;case"is-between":return`${e} > ${s} && ${e} < ${o}`;case"greater-than":return`${e} > ${n}`;case"greater-than-or-equal":return`${e} >= ${n}`;case"less-than":return`${e} < ${n}`;case"less-than-or-equal":return`${e} <= ${n}`;case"is-null":return`${e} == null`;case"is-not-null":return`${e} != null`}}function du(e,t,n){switch(t){case"is-exactly":return`${e} == "${n}"`;case"is-not-exactly":return`${e} != "${n}"`;case"contains":return`${e} != null && ${e}.contains("${n}")`;case"does-not-contain":return`${e} != null && !${e}.contains("${n}")`;case"starts-with":return`${e} != null && ${e}.startsWith("${n}")`;case"ends-with":return`${e} != null && ${e}.endsWith("${n}")`;case"is-null":return`${e} == null`;case"is-not-null":return`${e} != null`}}function uu(e,t,n){switch(t){case"is-exactly":return`${e} == convertDateTime("${n}")`;case"is-not-exactly":return`${e} != convertDateTime(\`${n}\`)`;case"is-before":return`${e} < convertDateTime(\`${n}\`)`;case"is-before-or-equal":return`${e} <= convertDateTime("${n}")`;case"is-after":return`${e} > convertDateTime(\`${n}\`)`;case"is-after-or-equal":return`${e} >= convertDateTime(\`${n}\`)`;case"is-null":return`${e} == null`;case"is-not-null":return`${e} != null`}}function hu(e,t){switch(t){case"is-true":return`${e} == true`;case"is-false":return`${e} == false`;case"is-null":return`${e} == null`;case"is-not-null":return`${e} != null`}}function mu(e,t,n){switch(t){case"is-equal":return`${e} == '${n}'`;case"is-not-equal":return`${e} != '${n}'`;case"is-null":return`isNull(${e})`;case"is-not-null":return`!isNull(${e})`}}function gu(e,t){if(I.isNumberType(e))return au(t);if(I.isCharType(e))return lu(t);if(I.isStringType(e))return ou(t);if(I.isDateType(e))return iu(t);if(I.isBooleanType(e))return ru(t);throw new Error("Invalid column type")}function pu(e,t){if(t===void 0)return mi.debug("no rules passed."),[];const n=[];let s;const o=new Map;return t.forEach(({config:i,type:r})=>{var p;const{column:l}=i,a=e.find(({name:f,type:C})=>f===l.name&&C===l.type);if(a===void 0){mi.debug(`Column ${l.name}:${l.type} not found. Ignoring format rule.`,i);return}const[c,d]=(p=r==="conditional"?o.get(a.name):s)!=null?p:["null",void 0],u=Wd(i,c);if(u===void 0){mi.debug("Ignoring format rule.",i);return}const h=d===void 0?-1:n.indexOf(d);h>-1&&n.splice(h,1);const g=r==="conditional"?zd(a,u):$d(u);n.push(g),r==="conditional"?o.set(a.name,[u,g]):s=[u,g]}),n}function fu(e,t){switch(e){case"is-null":case"is-not-null":return!0;default:return t!=null&&t!==""}}function Cu({type:e}){return I.isNumberType(e)||I.isCharType(e)||I.isStringType(e)||I.isDateType(e)||I.isBooleanType(e)}function Zo({animation:e="iris-grid-bottom-bar-slide-up",children:t,className:n,isShown:s,onClick:o,onEntering:i,onEntered:r,onExiting:l,onExited:a}){return m($t,{in:s,timeout:Ue.transitionMs,classNames:e,onEntering:i,onEntered:r,onExiting:l,onExited:a,mountOnEnter:!0,unmountOnExit:!0,children:m("div",{className:ee("iris-grid-bottom-bar",n),role:"presentation",onClick:o,onKeyPress:o,children:t})})}const wu=3e3,Su=5;function bu({isSaving:e=!1,onSave:t,onDiscard:n,discardTooltip:s,saveTooltip:o,error:i,pendingDataErrors:r,pendingDataMap:l,onEntering:a,onEntered:c,onExiting:d,onExited:u}){const[h,g]=F.exports.useState(!1),[p,f]=F.exports.useState(!1),C=F.exports.useRef(),w=$i(e),S=F.exports.useMemo(()=>r.size===0?i:r.size<=Su?`Key can't be empty (on pending row${r.size>1?"s":""} ${Array.from(r.keys()).join(", ").trim()})`:`Key can't be empty (on ${r.size} rows)`,[i,r]);F.exports.useEffect(function(){w!=null&&w&&!e&&S==null&&(g(!0),f(!0),C.current=setTimeout(()=>{g(!1)},wu))},[S,e,w]),F.exports.useEffect(function(){C.current&&l.size>0&&(clearTimeout(C.current),g(!1),f(!1))},[l]),F.exports.useEffect(function(){return()=>C.current?clearTimeout(C.current):void 0},[]);const T=l.size;let R;return e?R=m(dn,{}):p&&(R=rl),y(Zo,{className:"pending-data-bottom-bar",isShown:T>0||h||S!=null,onEntering:a,onEntered:c,onExiting:d,onExited:()=>{f(!1),u&&u()},children:[S!=null&&S!==""&&y("div",{className:"error-message",children:[m(te,{icon:Qn}),m("span",{children:`${S}`})]}),(S==null||S==="")&&m("div",{className:"status-message",children:T>0&&m("span",{children:`${T} row${T>1?"s":""} pending`})}),y("div",{className:"buttons-container",children:[!e&&!p&&m(z,{kind:"secondary",onClick:n,tooltip:s,children:"Discard"}),y(z,{kind:p?"success":"primary",onClick:t,icon:R,disabled:e||p||S!=null,tooltip:o,children:[e&&"Committing...",!e&&p&&"Success",!e&&!p&&"Commit"]})]})]})}var Te=(e=>(e.COUNT="Count",e.MIN="Min",e.MAX="Max",e.SUM="Sum",e.ABS_SUM="AbsSum",e.VAR="Var",e.AVG="Avg",e.STD="Std",e.FIRST="First",e.LAST="Last",e.SKIP="Skip",e.COUNT_DISTINCT="CountDistinct",e.DISTINCT="Distinct",e.UNIQUE="Unique",e))(Te||{});const Tu=e=>{switch(e){default:return!1}},Eu=(e,t)=>{switch(e){case Te.COUNT:case Te.FIRST:case Te.LAST:case Te.COUNT_DISTINCT:case Te.DISTINCT:case Te.UNIQUE:return!0;case Te.MIN:case Te.MAX:return I.isNumberType(t)||I.isDateType(t)||I.isTextType(t);case Te.SUM:case Te.ABS_SUM:case Te.VAR:case Te.AVG:case Te.STD:return I.isNumberType(t);case Te.SKIP:return!1}},Qi=(e,t)=>e.filter(n=>Eu(t,n.type)),vu=(e,t,n,s)=>Qi(e,t).map(({name:o})=>o).filter(o=>n.includes(o)?!s:s),On={isRollupOperation:Tu,filterValidColumns:Qi,getOperationColumnNames:vu};var ns=(e=>(e.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS="filter-control-change-clears-all-filters",e.LINK_CHANGE_CLEARS_ALL_FILTERS="link-change-clears-all-filters",e))(ns||{});const Ru=Object.freeze([[ns.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS,!1],[ns.LINK_CHANGE_CLEARS_ALL_FILTERS,!1]]),yu={DEFAULTS:Ru},Fu=ie.module("ColumnHeaderGroup");function gi(e){return e instanceof Bt}const Fl=class{constructor({name:e,children:t,color:n,depth:s,childIndexes:o,parent:i}){this.getVisibleRange=Re(r=>{const l=this.childIndexes.flat(),a=H.getVisibleIndexes(l,r),c=Math.min(...a),d=Math.max(...a);return d-c!==l.length-1&&Fu.warn(`Column header group ${this.name} is not contiguous`),[c,d]}),this.name=e,this.children=t,this.color=n,this.depth=s,this.childIndexes=o,this.parent=i}setParent(e){this.parent=e}addChildren(e){const t=new Set(this.children.concat(e));this.children=[...t]}removeChildren(e){const t=new Set(this.children);e.forEach(n=>t.delete(n)),this.children=[...t]}get isNew(){return this.name.startsWith(Fl.NEW_GROUP_PREFIX)}};let Bt=Fl;Bt.NEW_GROUP_PREFIX=":newGroup";const ks=ie.module("IrisGridUtils");function bn(e,t){return e>=0&&e<t.length}class J{static dehydrateGridState(t,n){const{isStuckToBottom:s,isStuckToRight:o,movedColumns:i,movedRows:r}=n,{columns:l}=t;return{isStuckToBottom:s,isStuckToRight:o,movedColumns:[...i].filter(({to:a,from:c})=>bn(a,l)&&(typeof c=="number"&&bn(c,l)||Array.isArray(c)&&bn(c[0],l)&&bn(c[1],l))).map(({to:a,from:c})=>({to:l[a].name,from:Array.isArray(c)?[l[c[0]].name,l[c[1]].name]:l[c].name})),movedRows:[...r]}}static hydrateGridState(t,n,s=[]){const{isStuckToBottom:o,isStuckToRight:i,movedColumns:r,movedRows:l}=n,{columns:a}=t,c=J.parseCustomColumnNames(s),d=a.map(({name:u})=>u).concat(c);return{isStuckToBottom:o,isStuckToRight:i,movedColumns:[...r].map(({to:u,from:h})=>{const g=p=>typeof p=="string"?d.findIndex(f=>f===p):p;return{to:g(u),from:Array.isArray(h)?[g(h[0]),g(h[1])]:g(h)}}).filter(({to:u,from:h})=>bn(u,d)&&(typeof h=="number"&&bn(h,d)||Array.isArray(h)&&bn(h[0],d)&&bn(h[1],d))),movedRows:[...l]}}static dehydrateIrisGridState(t,n){const{aggregationSettings:s={aggregations:ve,showOnTop:!1},advancedFilters:o,customColumnFormatMap:i,isFilterBarShown:r,metrics:l,quickFilters:a,customColumns:c,conditionalFormats:d=ve,reverseType:u,rollupConfig:h=void 0,showSearchBar:g,searchValue:p,selectDistinctColumns:f=ve,selectedSearchColumns:C,sorts:w,invertSearchColumns:S,pendingDataMap:T=on,frozenColumns:R,columnHeaderGroups:b}=n;M(l);const{userColumnWidths:v,userRowHeights:D}=l,{columns:A}=t;return{advancedFilters:J.dehydrateAdvancedFilters(A,o),aggregationSettings:s,customColumnFormatMap:[...i],isFilterBarShown:r,quickFilters:J.dehydrateQuickFilters(a),sorts:J.dehydrateSort(w),userColumnWidths:[...v].filter(([N])=>N!=null&&N>=0&&N<A.length).map(([N,L])=>[A[N].name,L]),userRowHeights:[...D],customColumns:[...c],conditionalFormats:[...d],reverseType:u,rollupConfig:h,showSearchBar:g,searchValue:p,selectDistinctColumns:[...f],selectedSearchColumns:C,invertSearchColumns:S,pendingDataMap:J.dehydratePendingDataMap(A,T),frozenColumns:R,columnHeaderGroups:b==null?void 0:b.map(N=>({name:N.name,children:N.children,color:N.color}))}}static hydrateIrisGridState(t,n){var N,L;const{advancedFilters:s,aggregationSettings:o={aggregations:[],showOnTop:!1},customColumnFormatMap:i,isFilterBarShown:r,quickFilters:l,sorts:a,customColumns:c,conditionalFormats:d,userColumnWidths:u,userRowHeights:h,reverseType:g,rollupConfig:p=void 0,showSearchBar:f,searchValue:C,selectDistinctColumns:w,selectedSearchColumns:S,invertSearchColumns:T=!0,pendingDataMap:R=[],frozenColumns:b,columnHeaderGroups:v}=n,{columns:D,formatter:A}=t;return{advancedFilters:J.hydrateAdvancedFilters(D,s,A.timeZone),aggregationSettings:o,customColumnFormatMap:new Map(i),isFilterBarShown:r,quickFilters:J.hydrateQuickFilters(D,l,A.timeZone),sorts:J.hydrateSort(D,a),userColumnWidths:new Map(u.map(([k,x])=>typeof k=="string"||k instanceof String?[D.findIndex(({name:W})=>W===k),x]:[k,x]).filter(([k])=>k!=null&&k>=0&&k<D.length)),customColumns:c,conditionalFormats:d,userRowHeights:new Map(h),reverseType:g,rollupConfig:p,showSearchBar:f,searchValue:C,selectDistinctColumns:w,selectedSearchColumns:S,invertSearchColumns:T,pendingDataMap:J.hydratePendingDataMap(D,R),frozenColumns:b,columnHeaderGroups:J.parseColumnHeaderGroups(t,(L=v!=null?v:(N=t.layoutHints)==null?void 0:N.columnGroups)!=null?L:[]).groups}}static dehydrateIrisGridPanelState(t,n){const{isSelectingPartition:s,partition:o,partitionColumn:i,advancedSettings:r}=n;return{isSelectingPartition:s,partition:o,partitionColumn:i!=null?i.name:void 0,advancedSettings:[...r]}}static hydrateIrisGridPanelState(t,n){const{isSelectingPartition:s,partition:o,partitionColumn:i,advancedSettings:r}=n,{columns:l}=t;return{isSelectingPartition:s,partition:o,partitionColumn:i!=null?J.getColumnByName(l,i):void 0,advancedSettings:new Map([...yu.DEFAULTS,...r])}}static dehydrateQuickFilters(t){return[...t].map(([n,s])=>{const{text:o}=s;return[n,{text:o}]})}static hydrateQuickFilters(t,n,s){const o=n.map(([i,r])=>{const{text:l}=r;let a=null;try{const c=J.getColumn(t,i);c!=null&&(a=I.makeQuickFilter(c,l,s))}catch(c){ks.error("hydrateQuickFilters error with",l,c)}return[i,{text:l,filter:a}]});return new Map(o)}static dehydrateAdvancedFilters(t,n){return[...n].map(([s,o])=>{const i=J.getColumn(t,s);M(i);const r=J.dehydrateAdvancedFilterOptions(i,o.options);return[s,{options:r}]})}static hydrateAdvancedFilters(t,n,s){const o=n.map(([i,r])=>{const l=J.getColumn(t,i);M(l);const a=J.hydrateAdvancedFilterOptions(l,r.options);let c=null;try{J.getColumn(t,i)!=null&&(c=I.makeAdvancedFilter(l,a,s))}catch(d){ks.error("hydrateAdvancedFilters error with",a,d)}return[i,{options:a,filter:c}]});return new Map(o)}static dehydrateAdvancedFilterOptions(t,n){const{selectedValues:s,...o}=n;return{selectedValues:s==null?void 0:s.map(i=>J.dehydrateValue(i,t==null?void 0:t.type)),...o}}static hydrateAdvancedFilterOptions(t,n){const{selectedValues:s,...o}=n;return{selectedValues:s==null?void 0:s.map(i=>J.hydrateValue(i,t==null?void 0:t.type)),...o}}static dehydratePendingDataMap(t,n){return[...n].map(([s,{data:o}])=>[s,{data:[...o].map(([i,r])=>[t[i].name,J.dehydrateValue(r,t[i].type)])}])}static hydratePendingDataMap(t,n){const s=new Map,o=i=>(s.has(i)||s.set(i,t.findIndex(({name:r})=>r===i)),s.get(i));return new Map(n.map(([i,{data:r}])=>[i,{data:new Map(r.map(([l,a])=>{var d;const c=o(l);return M(c),[(d=o(l))!=null?d:null,J.hydrateValue(a,t[c].type)]}))}]))}static dehydrateValue(t,n){return I.isDateType(n)?J.dehydrateDateTime(t):I.isLongType(n)?J.dehydrateLong(t):t}static hydrateValue(t,n){return I.isDateType(n)?J.hydrateDateTime(t):I.isLongType(n)?J.hydrateLong(t):t}static dehydrateDateTime(t){return t!=null?E.i18n.DateTimeFormat.format(cn.FULL_DATE_FORMAT,t):null}static hydrateDateTime(t){return t!=null?E.i18n.DateTimeFormat.parse(cn.FULL_DATE_FORMAT,t):null}static dehydrateLong(t){return t!=null?`${t}`:null}static hydrateLong(t){return t!=null?E.LongWrapper.ofString(t):null}static dehydrateSort(t){return t.map(n=>{const{column:s,isAbs:o,direction:i}=n;return{column:s.index,isAbs:o,direction:i}})}static hydrateSort(t,n){return n.map(s=>{const{column:o,isAbs:i,direction:r}=s;if(r===I.sortDirection.reverse)return E.Table.reverse();const l=J.getColumn(t,o);if(l!=null){let a=l.sort();return i&&(a=a.abs()),r===I.sortDirection.descending?a=a.desc():a=a.asc(),a}return null}).filter(s=>s!=null&&s.direction!==I.sortDirection.reverse)}static extractTableSettings(t,n=[]){const{irisGridPanelState:s,irisGridState:o}=t,{partitionColumn:i,partition:r}=s,{advancedFilters:l,quickFilters:a,sorts:c}=o;return{advancedFilters:l,inputFilters:n,partition:r,partitionColumn:i,quickFilters:a,sorts:c}}static applyTableSettings(t,n,s){const{columns:o}=t;let i=[];n.quickFilters&&(i=J.getFiltersFromFilterMap(J.hydrateQuickFilters(o,n.quickFilters,s)));let r=[];n.advancedFilters&&(r=J.getFiltersFromFilterMap(J.hydrateAdvancedFilters(o,n.advancedFilters,s)));const l=J.getFiltersFromInputFilters(o,n.inputFilters,s);let a=[];n.sorts&&(a=J.hydrateSort(o,n.sorts));let c=[...i,...r];const{partition:d,partitionColumn:u}=n;if(d!=null&&u!=null){const h=J.getColumnByName(o,u);h&&(c=[h.filter().eq(E.FilterValue.ofString(d)),...c])}c=[...l,...c],t.applyFilter(c),t.applySort(a)}static getInputFiltersForColumns(t,n=[]){return n.filter(({name:s,type:o})=>t.find(({name:i,type:r})=>i===s&&r===o))}static getFiltersFromInputFilters(t,n=[],s){return n.map(({name:o,type:i,value:r})=>{const l=t.find(({name:a,type:c})=>a===o&&c===i);if(l)try{return I.makeQuickFilter(l,r,s)}catch(a){ks.debug("Unable to create input filter",a)}return null}).filter(o=>o!=null)}static getFiltersFromFilterMap(t){const n=[],s=Array.from(t.keys());for(let o=0;o<s.length;o+=1){const i=s[o],r=t.get(i);(r==null?void 0:r.filter)!=null&&n.push(r.filter)}return n}static getHiddenColumns(t){return[...t.entries()].filter(([,n])=>n===0).map(([n])=>n)}static parseCustomColumnNames(t){return t.map(n=>n.split("=")[0])}static getRemovedCustomColumnNames(t,n){const s=J.parseCustomColumnNames(t),o=J.parseCustomColumnNames(n);return s.filter(i=>!o.includes(i))}static removeSortsInColumns(t,n){return t.filter(s=>!n.includes(s.column.name))}static removeFiltersInColumns(t,n,s){const o=t.map(({name:r})=>r),i=new Map(n);return s.forEach(r=>i.delete(o.indexOf(r))),i}static removeColumnFromMovedColumns(t,n,s){const o=t.map(({name:r})=>r);let i=[...n];for(let r=0;r<s.length;r+=1){const l=s[r];let a=o.findIndex(d=>d===l);const c=[];for(let d=0;d<i.length;d+=1){const u=i[d],h={...u};let[g,p]=Array.isArray(u.from)?u.from:[u.from,u.from];a<=u.to&&(h.to-=1),a<g&&(g-=1),a<=p&&(p-=1),g<=p&&g!==h.to&&(g===p?c.push({...h,from:g}):c.push({...h,from:[g,p]})),a=H.applyItemMoves(a,a,[u])[0][0]}i=c,o.splice(o.findIndex(d=>d===l),1)}return i}static removeColumnsFromSelectDistinctColumns(t,n){return t.filter(s=>!n.includes(s))}static getVisibleColumnsInRange(t,n,s,o,i){const r=[];for(let l=n;l<=s;l+=1){const a=H.getModelIndex(l,o);a>=0&&a<t.length&&!i.includes(a)&&r.push(t[a])}return r}static getPrevVisibleColumns(t,n,s,o,i){const r=[];let l=n;for(;l>=0&&r.length<s;){const a=H.getModelIndex(l,o);a>=0&&a<t.length&&!i.includes(a)&&r.unshift(t[a]),l-=1}return r}static getNextVisibleColumns(t,n,s,o,i){const r=[];let l=n;for(;l<t.length&&r.length<s;){const a=H.getModelIndex(l,o);a>=0&&a<t.length&&!i.includes(a)&&r.push(t[a]),l+=1}return r}static getColumnsToFetch(t,n,s){const o=[...n];return s.forEach(i=>{const r=t.find(({name:l})=>l===i);r!=null&&!n.includes(r)&&o.push(r)}),o}static getModelViewportColumns(t,n,s,o,i=[],r=[],l=0){if(n==null||s==null)return null;const a=J.getVisibleColumnsInRange(t,n,s,o,i),c=a.length*l,d=J.getPrevVisibleColumns(t,n-1,c,o,i),u=J.getNextVisibleColumns(t,s+1,c,o,i),h=[...d,...a,...u];return J.getColumnsToFetch(t,h,r)}static rangeSetFromRanges(t){const n=t.slice().sort((s,o)=>(M(s.startRow),M(o.startRow),s.startRow-o.startRow)).map(s=>{const{startRow:o,endRow:i}=s;return M(o),M(i),E.RangeSet.ofRange(o,i)});return E.RangeSet.ofRanges(n)}static isValidSnapshotRanges(t){if(t==null||t.length===0)return!1;const n=new Map;for(let i=0;i<t.length;i+=1){const r=t[i],l=`${r.startRow}:${r.endRow}`,a=`${r.startColumn}:${r.endColumn}`;n.has(l)||n.set(l,[]),n.get(l).push(a)}const s=[...n.keys()],o=n.get(s[0]).sort().join(",");for(let i=1;i<s.length;i+=1)if(n.get(s[i]).sort().join(",")!==o)return!1;return!0}static isValidIndex(t){return!Number.isInteger(t)||typeof t!="number"?!1:t>=0}static columnsFromRanges(t,n){var o,i;if(t==null||t.length===0)return[];if(t[0].startColumn===null&&t[0].endColumn===null)return[...n];const s=new Set;for(let r=0;r<t.length;r+=1){const l=t[r];M(l.startColumn),M(l.endColumn);for(let a=(o=l.startColumn)!=null?o:0;a<=((i=l.endColumn)!=null?i:n.length-1);a+=1)s.add(a)}return[...s].map(r=>n[r])}static snapshotDataToMatrix(t){const{columns:n,rows:s}=t,o=[];for(let i=0;i<s.length;i+=1){const r=s[i],l=[];for(let a=0;a<n.length;a+=1){const c=n[a],d=r.get(c);l.push(d)}o.push(l)}return o}static getModelRollupConfig(t,n,s){var u,h,g;if(((h=(u=n==null?void 0:n.columns)==null?void 0:u.length)!=null?h:0)===0)return null;const{columns:o=[],showConstituents:i=!0,showNonAggregatedColumns:r=!0,includeDescriptions:l=!0}=n!=null?n:{},{aggregations:a=[]}=s!=null?s:{},c=a.map(({operation:p,selected:f,invert:C})=>On.isRollupOperation(p)?[]:On.getOperationColumnNames(t,p,f,C)),d={};for(let p=0;p<a.length;p+=1)d[a[p].operation]=c[p];if(r){const p=new Set(t.map(f=>f.name).filter(f=>!o.includes(f)));if(c.forEach(f=>{f.forEach(C=>p.delete(C))}),p.size>0){const f=(g=d[Te.FIRST])!=null?g:[];d[Te.FIRST]=[...f,...p]}}return{groupingColumns:o,includeConstituents:i,includeDescriptions:l,aggregations:d}}static getPendingErrors(t){t.forEach((n,s)=>{if(!J.isValidIndex(s))throw new Error(`Invalid rowIndex ${s}`);const{data:o}=n;o.forEach((i,r)=>{if(!J.isValidIndex(r))throw new Error(`Invalid columnIndex ${r}`)})})}static getColumn(t,n){return n<t.length?t[n]:(ks.error("Unable to retrieve column",n,">=",t.length),null)}static getColumnByName(t,n){const s=t.find(({name:o})=>o===n);return s==null&&ks.error("Unable to retrieve column by name",n,t.map(({name:o})=>o)),s}static changeFilterColumnNamesToIndexes(t,n){return n.map(({name:s,filter:o})=>{const i=t.findIndex(r=>r.name===s);return i<0?null:[i,o]}).filter(s=>s!=null)}static combineFiltersFromList(t,n){n.sort((o,i)=>o.operator==="eq"&&i.operator!=="eq"?1:o.operator!=="eq"&&i.operator==="eq"?-1:o.startColumnIndex-i.startColumnIndex);let s="";for(let o=0;o<n.length;o+=1){const{text:i,value:r,operator:l}=n[o];if(r!==void 0){let a="";l!==void 0&&(r==null&&l==="eq"?a="=":l!=="eq"&&(l==="startsWith"||l==="endsWith"?a="*":a=I.getFilterOperatorString(l)));let c=`${a}${i}`;l==="startsWith"&&(c=`${i}${a}`),t!=null&&r!==null&&I.isCharType(t)&&(c=`${a}${String.fromCharCode(parseInt(i,10))}`),o!==0&&(s+=l==="eq"?" || ":" && "),s+=c}}return s}static parseColumnHeaderGroups(t,n){let s=1;const o=new Map,i=new Map,r=n==null?void 0:n.filter(({children:u})=>u.length>0);if(r.length===0)return{groups:[],maxDepth:s,parentMap:o,groupMap:i};const l=new Map(r.map(u=>[u.name,u])),a=new Set,c=u=>{const{name:h}=u;if(t.getColumnIndexByName(h)!=null)throw new Error(`Column header group has same name as column: ${h}`);const g=i.get(h);if(g)return g;const p=[];let f=1;u.children.forEach(w=>{if(a.has(w))throw new Error(`Column group child ${w} specified in multiple groups`);a.add(w);const S=l.get(w),T=t.getColumnIndexByName(w);if(S){const R=c(S);p.push(...R.childIndexes),f=Math.max(f,R.depth+1)}else if(T!=null)p.push(T),f=Math.max(f,1);else throw new Error(`Unknown child ${w} in group ${h}`)});const C=new Bt({...u,depth:f,childIndexes:p.flat()});return i.set(h,C),u.children.forEach(w=>o.set(w,C)),s=Math.max(s,C.depth+1),C},d=new Set;return r.forEach(u=>{const{name:h}=u;if(d.has(h))throw new Error(`Duplicate column group name: ${h}`);d.add(h),c(u)}),i.forEach(u=>{var h;u.setParent((h=o.get(u.name))==null?void 0:h.name)}),{groups:[...i.values()],maxDepth:s,groupMap:i,parentMap:o}}}const ht=ie.module("IrisGridCopyHandler"),Ee=class extends F.exports.Component{constructor(e){super(e),this.handleBackgroundClick=this.handleBackgroundClick.bind(this),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleCopyClick=this.handleCopyClick.bind(this),this.handleHideTimeout=this.handleHideTimeout.bind(this),this.state={error:void 0,copyState:Ee.COPY_STATES.IDLE,buttonState:Ee.BUTTON_STATES.COPY,isShown:!1,rowCount:0}}static getStatusMessageText(e,t){switch(e){case Ee.COPY_STATES.CONFIRMATION_REQUIRED:return`Are you sure you want to copy ${t.toLocaleString()} rows to your clipboard?`;case Ee.COPY_STATES.CLICK_REQUIRED:return`Fetched ${t.toLocaleString()} rows!`;case Ee.COPY_STATES.FETCH_ERROR:return"Unable to copy data.";case Ee.COPY_STATES.FETCH_IN_PROGRESS:return`Fetching ${t.toLocaleString()} rows for clipboard...`;case Ee.COPY_STATES.DONE:return"Copied to Clipboard!";default:return""}}static getCopyButtonText(e){switch(e){case Ee.BUTTON_STATES.FETCH_IN_PROGRESS:return"Fetching";case Ee.BUTTON_STATES.CLICK_TO_COPY:return"Click to Copy";case Ee.BUTTON_STATES.RETRY:return"Retry";default:return"Copy"}}componentDidMount(){const{copyOperation:e}=this.props;e!=null&&this.startCopy()}componentDidUpdate(e){const{copyOperation:t}=this.props;e.copyOperation!==t&&this.startCopy()}componentWillUnmount(){this.stopCopy()}startCopy(){ht.debug2("startCopy"),this.stopCopy();const{copyOperation:e}=this.props;if(e==null){ht.debug2("No copy operation set, cancelling out"),this.setState({isShown:!1});return}const{ranges:t,error:n}=e;if(n!=null){ht.debug("Showing copy error",n),this.setState({isShown:!0,copyState:Ee.COPY_STATES.DONE,error:n}),this.startHideTimer();return}const s=Q.rowCount(t);this.setState({rowCount:s,isShown:!0,error:void 0}),s>Ee.NO_PROMPT_THRESHOLD?this.setState({buttonState:Ee.BUTTON_STATES.COPY,copyState:Ee.COPY_STATES.CONFIRMATION_REQUIRED}):this.startFetch()}stopCopy(){this.textData=void 0,this.stopFetch(),this.stopHideTimer()}handleBackgroundClick(){ht.debug2("handleBackgroundClick");const{copyState:e}=this.state;e===Ee.COPY_STATES.DONE&&this.setState({isShown:!1})}handleCancelClick(){ht.debug2("handleCancelClick"),this.stopFetch(),this.setState({isShown:!1})}handleCopyClick(){ht.debug2("handleCopyClick"),this.textData!=null?this.copyText(this.textData):this.startFetch()}handleHideTimeout(){ht.debug2("handleHideTimeout"),this.stopHideTimer(),this.setState({isShown:!1})}copyText(e){ht.debug2("copyText",e),this.textData=e,zo(e).then(()=>{this.setState({copyState:Ee.COPY_STATES.DONE}),this.startHideTimer()},t=>{ht.error("copyText error",t),this.setState({buttonState:Ee.BUTTON_STATES.CLICK_TO_COPY,copyState:Ee.COPY_STATES.CLICK_REQUIRED})})}startFetch(){this.stopFetch(),this.setState({buttonState:Ee.BUTTON_STATES.FETCH_IN_PROGRESS,copyState:Ee.COPY_STATES.FETCH_IN_PROGRESS});const{model:e,copyOperation:t}=this.props,{ranges:n,includeHeaders:s,userColumnWidths:o,movedColumns:i,formatValues:r}=t;ht.debug("startFetch",n);const l=J.getHiddenColumns(o);let a=H.getModelRanges(n,i);if(l.length>0){const d=l.map(Q.makeColumn);a=Q.subtractRangesFromRanges(a,d)}const c=r!=null&&r?(d,u)=>e.displayString(d,u.type,u.name):d=>`${d}`;this.fetchPromise=Ge.makeCancelable(e.textSnapshot(a,s,c)),this.fetchPromise.then(d=>{this.fetchPromise=void 0,this.copyText(d)}).catch(d=>{d instanceof xi?ht.debug("User cancelled copy."):(ht.error("Error fetching contents",d),this.fetchPromise=void 0,this.setState({buttonState:Ee.BUTTON_STATES.RETRY,copyState:Ee.COPY_STATES.FETCH_ERROR}))})}stopFetch(){this.fetchPromise&&(ht.debug2("stopFetch"),this.fetchPromise.cancel(),this.fetchPromise=void 0)}startHideTimer(){this.stopHideTimer(),this.hideTimer=setTimeout(this.handleHideTimeout,Ee.HIDE_TIMEOUT)}stopHideTimer(){this.hideTimer!=null&&(clearTimeout(this.hideTimer),this.hideTimer=void 0)}render(){const{onEntering:e,onEntered:t,onExiting:n,onExited:s}=this.props,{buttonState:o,copyState:i,isShown:r,rowCount:l,error:a}=this.state,c=i===Ee.COPY_STATES.DONE?"fade":"copy-slide-up",d=Ee.getCopyButtonText(o),u=a!=null?a:Ee.getStatusMessageText(i,l),h=i!==Ee.COPY_STATES.DONE,g=o===Ee.BUTTON_STATES.FETCH_IN_PROGRESS,p=i===Ee.COPY_STATES.DONE;return y(Zo,{animation:c,isShown:r,className:ee("iris-grid-copy-handler",{"copy-done":p}),onClick:this.handleBackgroundClick,onEntering:e,onEntered:t,onExiting:n,onExited:s,children:[m("div",{className:"status-message",children:m("span",{children:u})}),m($t,{in:h,timeout:Ue.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:y("div",{className:"buttons-container",children:[m("button",{type:"button",className:"btn btn-outline-secondary btn-cancel",onClick:this.handleCancelClick,children:"Cancel"}),y(z,{kind:g?"tertiary":"primary",className:ee("btn-copy",{"btn-spinner":g}),onClick:this.handleCopyClick,disabled:g,children:[g&&m(dn,{}),d]})]})})]})}};let ys=Ee;ys.NO_PROMPT_THRESHOLD=1e4;ys.HIDE_TIMEOUT=3e3;ys.COPY_STATES={IDLE:"IDLE",CONFIRMATION_REQUIRED:"CONFIRMATION_REQUIRED",FETCH_IN_PROGRESS:"FETCH_IN_PROGRESS",FETCH_ERROR:"FETCH_ERROR",CLICK_REQUIRED:"CLICK_REQUIRED",DONE:"DONE"};ys.BUTTON_STATES={COPY:"COPY",FETCH_IN_PROGRESS:"FETCH_IN_PROGRESS",CLICK_TO_COPY:"CLICK_TO_COPY",RETRY:"RETRY"};ys.defaultProps={copyOperation:null,onEntering:()=>{},onEntered:()=>{},onExiting:()=>{},onExited:()=>{}};class Dl extends F.exports.PureComponent{constructor(t){super(t);const{debounceMs:n}=t;this.debouncedSendUpdate=vt(this.sendUpdate.bind(this),n),this.handleCancel=this.handleCancel.bind(this),this.handleChange=this.handleChange.bind(this),this.handleCommit=this.handleCommit.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.inputField=null;const{value:s}=t;this.initialValue=s,this.state={isChanged:!1,value:s}}componentDidMount(){var t;(t=this.inputField)==null||t.focus()}componentDidUpdate(t){const{debounceMs:n}=this.props;t.debounceMs!==n&&(this.debouncedSendUpdate.flush(),this.debouncedSendUpdate=vt(this.sendUpdate.bind(this),n))}componentWillUnmount(){this.debouncedSendUpdate.cancel()}setValue(t){this.initialValue=t,this.setState({value:t})}focus(){var t;(t=this.inputField)==null||t.focus()}handleChange(t){const{value:n}=t.target;this.setState({value:n,isChanged:!0}),this.debouncedSendUpdate(n)}handleCancel(){this.debouncedSendUpdate.cancel();const{initialValue:t}=this,{isChanged:n}=this.state;n&&this.sendUpdate(t);const{onDone:s}=this.props;s()}handleCommit(t=!0,n=!0){this.debouncedSendUpdate.flush();const{onDone:s}=this.props;s(t,n)}handleFocus(){var t;(t=this.inputField)==null||t.select()}handleBlur(t){const{relatedTarget:n}=t;n!=null&&n.classList.contains("context-menu-container")?this.handleCommit(!1,!0):n!=null&&n.classList.contains("advanced-filter-button")?this.handleCommit(!1,!1):this.handleCommit(!0,!0)}handleTab(t=!1){this.debouncedSendUpdate.flush();const{onTab:n}=this.props;n(t)}handleKeyDown(t){switch(t.key){case"Escape":t.stopPropagation(),t.preventDefault(),this.handleCancel();break;case"Enter":t.stopPropagation(),t.preventDefault(),this.handleCommit();break;case"Tab":t.stopPropagation(),t.preventDefault(),this.handleTab(t.shiftKey);break}}handleContextMenu(t){const{onContextMenu:n}=this.props;n(t)}sendUpdate(t){const{onChange:n}=this.props;n(t)}render(){const{className:t,style:n,isAdvancedFilterSet:s,onAdvancedFiltersTriggered:o}=this.props,{value:i}=this.state;return y("div",{style:n,className:"iris-grid-input-autosized-wrapper","data-value":i,children:[m("input",{ref:r=>{this.inputField=r},className:ee("iris-grid-input-field",t),type:"text",value:i,onBlur:this.handleBlur,onFocus:this.handleFocus,onChange:this.handleChange,onKeyDown:this.handleKeyDown,onContextMenu:this.handleContextMenu,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false"}),m("div",{className:"advanced-filter-button-container",children:m(z,{kind:"ghost",className:ee("btn-link-icon advanced-filter-button",{"filter-set":s}),onClick:o,onContextMenu:this.handleContextMenu,children:y("div",{className:"fa-layers ",children:[m(te,{icon:ki,className:"filter-solid"}),m(te,{icon:Oo,className:"filter-light"})]})})})]})}}Dl.defaultProps={style:{},className:"",value:"",isAdvancedFilterSet:!1,onAdvancedFiltersTriggered:()=>{},onChange:()=>{},onDone:()=>{},onTab:()=>{},onContextMenu:()=>{},debounceMs:150};class Du extends ss{constructor(t){super(),this.irisGrid=t}onDown(t){const{selectedRanges:n}=this.irisGrid.state;return t.key==="c"&&_n.isModifierKeyDown(t)?(J.isValidSnapshotRanges(n)?this.irisGrid.copyRanges(n):this.irisGrid.copyRanges(n,!1,!1,"Invalid copy ranges"),!0):!1}}const Iu={TOGGLE_QUICK_FILTER:Ve.createAndAdd({id:"TABLE.TOGGLE_QUICK_FILTER",name:"Toggle Quick Filter",shortcut:[le.CTRL,he.F],macShortcut:[le.CMD,he.F]}),CLEAR_ALL_FILTERS:Ve.createAndAdd({id:"TABLE.CLEAR_ALL_FILTERS",name:"Clear All Table Filters",shortcut:[le.CTRL,he.E],macShortcut:[le.CMD,he.E]}),CLEAR_FILTERS:Ve.createAndAdd({id:"TABLE.CLEAR_FILTERS",name:"Clear Active Table Filters",shortcut:[le.CTRL,le.SHIFT,he.E],macShortcut:[le.CMD,le.SHIFT,he.E]}),REVERSE:Ve.createAndAdd({id:"TABLE.REVERSE",name:"Reverse",shortcut:[le.CTRL,he.I],macShortcut:[le.CMD,he.I]}),TOGGLE_SEARCH:Ve.createAndAdd({id:"TABLE.TOGGLE_SEARCH",name:"Toggle Search",shortcut:[le.CTRL,le.SHIFT,he.F],macShortcut:[le.CMD,le.SHIFT,he.F]}),GOTO_ROW:Ve.createAndAdd({id:"TABLE.GOTO_ROW",name:"Go to Row",shortcut:[le.CTRL,he.G],macShortcut:[le.CMD,he.G]})},Nu={COMMIT:Ve.createAndAdd({id:"INPUT_TABLE.COMMIT",name:"Commit",shortcut:[le.CTRL,he.S],macShortcut:[le.CMD,he.S]}),DISCARD:Ve.createAndAdd({id:"INPUT_TABLE.DISCARD",name:"Discard",shortcut:[le.CTRL,le.ALT,he.S],macShortcut:[le.CMD,le.OPTION,he.S]})},Nt={TABLE:Iu,INPUT_TABLE:Nu};class Au extends ss{constructor(t){super(),this.irisGrid=t}onDown(t){if(Nt.TABLE.REVERSE.matchesEvent(t)){if(!this.irisGrid.isReversible())return!1;const{reverseType:n}=this.irisGrid.state;return n===I.REVERSE_TYPE.NONE?this.irisGrid.reverse(I.REVERSE_TYPE.POST_SORT):this.irisGrid.reverse(I.REVERSE_TYPE.NONE),!0}return!1}}class Mu extends ss{constructor(t){super(),this.irisGrid=t}onDown(t){return Nt.TABLE.CLEAR_FILTERS.matchesEvent(t)?(this.irisGrid.clearAllFilters(),!0):!1}}class Ou extends Ye{constructor(t){super(850),this.irisGrid=t}destroyColumnTooltip(){this.irisGrid.setState({overflowButtonTooltipProps:null})}setCursor(t){return this.isHoveringOverflowButton(t)?(this.cursor="pointer",{stopPropagation:!1,preventDefault:!1}):(this.cursor=null,!1)}getButtonPosition({x:t,y:n,column:s,row:o}){if(s==null||o==null)return null;const{renderer:i,grid:r,state:l,props:a}=this.irisGrid;if(!r)return null;const{metrics:c}=l,{model:d}=a,{canvasContext:u}=r,h=r.getTheme(),g={context:u,mouseX:t,mouseY:n,metrics:c,model:d,theme:h},{left:p,top:f,width:C,height:w}=i.getCellOverflowButtonPosition(g);return p==null||C==null||f==null||w==null?null:{left:p,top:f,width:C,height:w}}isHoveringOverflowButton(t){var w;const{x:n,y:s}=t,{left:o,top:i,width:r,height:l}=(w=this.getButtonPosition(t))!=null?w:{};if(o==null||r==null||i==null||l==null)return!1;const{renderer:a,grid:c,state:d,props:u}=this.irisGrid;if(!c)return!1;const{metrics:h}=d,{model:g}=u,{canvasContext:p}=c,f=c.getTheme(),C={context:p,mouseX:n,mouseY:s,metrics:h,model:g,theme:f};return a.shouldRenderOverflowButton(C)&&n>=o&&n<=o+r&&s>=i&&s<=i+l}onMove(t){if(this.isHoveringOverflowButton(t)){const{overflowButtonTooltipProps:n}=this.irisGrid.state,s=this.getButtonPosition(t);rt(n,s)||this.irisGrid.setState({overflowButtonTooltipProps:s})}else this.destroyColumnTooltip();return this.setCursor(t)}onWheel(t){return this.destroyColumnTooltip(),this.onMove(t)}onDown(t){this.destroyColumnTooltip();const{column:n,row:s}=t;return this.isHoveringOverflowButton(t)&&this.irisGrid.setState({showOverflowModal:!0,overflowText:this.irisGrid.getValueForCell(n,s)}),!1}onContextMenu(){return this.destroyColumnTooltip(),!1}onLeave(){return this.destroyColumnTooltip(),!1}}class xu extends Ye{constructor(t){super(),this.irisGrid=t,this.cursor=null}isActive(){const{isSelectingColumn:t}=this.irisGrid.props;return t}isValidColumn(t){if(t==null)return!1;const{columnSelectionValidator:n}=this.irisGrid.props;return n!=null?n(t):!0}updateColumnSelectionStatus(){const{columnSelectionValidator:t}=this.irisGrid.props;t!=null&&t(null)}getTableColumn(t){if(t==null)return null;const{model:n}=this.irisGrid.props,s=this.irisGrid.getModelColumn(t);return s==null?null:n.columns[s]}onMove(t){if(!this.isActive())return!1;const{columnAllowedCursor:n,columnNotAllowedCursor:s}=this.irisGrid.props,{column:o}=t,i=this.getTableColumn(o);return this.isValidColumn(i)?(this.cursor=n,this.irisGrid.setState({hoverSelectColumn:o})):(this.cursor=s,this.irisGrid.setState({hoverSelectColumn:null})),!0}onWheel(t){if(!this.isActive())return!1;const{columnAllowedCursor:n,columnNotAllowedCursor:s}=this.irisGrid.props,{column:o}=t,i=this.getTableColumn(o);return this.isValidColumn(i)?this.cursor=n:this.cursor=s,{preventDefault:!1,stopPropagation:!1}}onLeave(){return this.isActive()&&this.irisGrid.setState({hoverSelectColumn:null}),this.updateColumnSelectionStatus(),!1}onDown(){return this.isActive()}onClick(t){if(!this.isActive())return!1;const{column:n}=t,s=this.getTableColumn(n);return s!=null&&this.isValidColumn(s)&&this.irisGrid.selectColumn(s),!0}}class ku extends Ye{constructor(t){super(),this.irisGrid=t}hideColumnTooltip(){const{tooltip:t}=this.irisGrid;t&&(t.stopTimer(),t.hide())}onDown(){return this.hideColumnTooltip(),!1}onContextMenu(){return this.hideColumnTooltip(),!1}onWheel(){return this.hideColumnTooltip(),!1}onLeave(t,n,s){const{relatedTarget:o}=s instanceof MouseEvent?s:s.nativeEvent,{tooltip:i}=this.irisGrid;if(!i)return!1;const r=i.popper.current;return r&&o instanceof Element&&r.element.contains(o)||this.hideColumnTooltip(),!1}onMove(t){const{column:n,row:s,columnHeaderDepth:o}=t,{shownColumnTooltip:i}=this.irisGrid.state;let r=null;return n!==null&&s===null&&o===0&&(r=n),r!==i&&this.irisGrid.setState({shownColumnTooltip:r}),!1}}const Il=class extends F.exports.Component{constructor(e=Il.defaultProps){super(e),this.handleInputChange=this.handleInputChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.inputRef=Fe.createRef()}handleInputChange(){const{onChange:e}=this.props;this.inputRef.current&&e(this.inputRef.current.value)}closeContextMenu(){const{forwardedProps:e}=this.props,{closeMenu:t}=e;t(!0)}revertToDefault(){const{onChange:e}=this.props;e(null)}returnFocusToContextMenu(){const e=Xc.getClosestByClassName(this.inputRef.current,"context-menu-container");e instanceof HTMLElement&&e.focus()}handleKeyDown(e){switch(e.key){case"Enter":e.stopPropagation(),this.closeContextMenu();break;case"Escape":e.stopPropagation(),this.revertToDefault(),this.closeContextMenu();break;case"ArrowRight":case"ArrowLeft":e.stopPropagation();break;case"ArrowUp":case"ArrowDown":this.returnFocusToContextMenu();break;default:e.stopPropagation()}}render(){const{formatString:e,forwardedProps:t,placeholder:n,title:s}=this.props,{menuItem:{description:o},iconElement:i}=t;return y("div",{className:"form-group flex-grow mb-0",children:[y("div",{className:"custom-format-title",children:[m("span",{className:"icon",children:i}),y("label",{className:"title mb-0",htmlFor:"custom-format-input",children:[s,o!=null&&m(Rt,{children:o})]})]}),m("div",{className:"pl-2 pr-2 pb-2",children:m("input",{id:"custom-format-input",className:"form-control text-right mb-0",type:"text",defaultValue:e,ref:this.inputRef,placeholder:n,onKeyDown:this.handleKeyDown,onChange:this.handleInputChange,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false"})})]})}};let Nl=Il;Nl.defaultProps={formatString:"",forwardedProps:{menuItem:{},closeMenu(e){},iconElement:null},placeholder:"",title:"",onChange(e){}};class ft{static isDefaultSelected(t){return!t||![Le.TYPE_CONTEXT_CUSTOM,Le.TYPE_CONTEXT_PRESET].includes(t.type)}static isCustomSelected(t){return t!=null&&t.type===Le.TYPE_CONTEXT_CUSTOM}static makeOption(t,n,s,o){return{title:t,description:t,group:s,format:n,isSelected:o}}static makeCustomFormatOption(t,n,s,o,i){return{title:t.label,description:t.label,format:t,group:n,isSelected:o,menuElement:m(Nl,{formatString:t.formatString,title:t.label,placeholder:s,onChange:i})}}}const Vt=class{static getOptions(e,t){const n=new Date,o=[{group:Vt.dateGroup,formatString:"yyyy-MM-dd"},{group:Vt.dateGroup,formatString:"MM-dd-yyyy"},{group:Vt.timeGroup,formatString:"HH:mm:ss"},{group:Vt.timeGroup,formatString:"HH:mm:ss.SSS"},{group:Vt.timeGroup,formatString:"HH:mm:ss.SSSSSSSSS"},{group:Vt.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss"},{group:Vt.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss.SSS"},{group:Vt.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss.SSSSSSSSS"}].map(r=>{const l=kn.makeFormat("",r.formatString,kn.TYPE_CONTEXT_PRESET),a=e.getFormattedString(n,I.dataType.DATETIME,"",l);return ft.makeOption(a,l,r.group,kn.isSameFormat(l,t))});return[ft.makeOption("Default",null,Vt.dateGroup,ft.isDefaultSelected(t)),...o]}};let Jo=Vt;Jo.dateGroup=10;Jo.timeGroup=20;Jo.dateTimeGroup=30;const Ut=class{static getOptions(e,t){const n=[{format:_e.FORMAT_PERCENT,group:Ut.presetGroup},{format:_e.FORMAT_BASIS_POINTS,group:Ut.presetGroup},{format:_e.FORMAT_MILLIONS,group:Ut.presetGroup},{format:_e.FORMAT_SCIENTIFIC_NOTATION,group:Ut.presetGroup},{format:_e.FORMAT_ROUND,group:Ut.presetRoundGroup},{format:_e.FORMAT_ROUND_TWO_DECIMALS,group:Ut.presetRoundGroup},{format:_e.FORMAT_ROUND_FOUR_DECIMALS,group:Ut.presetRoundGroup}],s=ft.makeOption("Default",null,Ut.defaultGroup,ft.isDefaultSelected(e)),o=n.map(a=>ft.makeOption(a.format.label,a.format,a.group,_e.isSameFormat(a.format,e))),i=ft.isCustomSelected(e),r=i?e:_e.makeCustomFormat(),l=ft.makeCustomFormatOption(r,Ut.customGroup,_e.DEFAULT_FORMAT_STRING,i,a=>{if(a!=null){const c=_e.makeCustomFormat(a);_e.isValid(c)&&t(c)}else t(null)});return[s,...o,l]}};let js=Ut;js.defaultGroup=10;js.presetGroup=20;js.presetRoundGroup=30;js.customGroup=40;const Bs=class{static getOptions(e,t){const n=[{format:It.FORMAT_MILLIONS,group:Bs.presetGroup},{format:It.FORMAT_SCIENTIFIC_NOTATION,group:Bs.presetGroup}],s=ft.makeOption("Default",null,Bs.defaultGroup,ft.isDefaultSelected(e)),o=n.map(a=>ft.makeOption(a.format.label,a.format,a.group,It.isSameFormat(a.format,e))),i=ft.isCustomSelected(e),r=i?e:It.makeCustomFormat(),l=ft.makeCustomFormatOption(r,Bs.customGroup,It.DEFAULT_FORMAT_STRING,i,a=>{if(a!=null){const c=It.makeCustomFormat(a);It.isValid(c)&&t(c)}else t(null)});return[s,...o,l]}};let ei=Bs;ei.defaultGroup=10;ei.presetGroup=20;ei.customGroup=30;const Or=ie.module("IrisGridContextMenuHandler"),Lu=150,xr="yyyy-MM-dd HH:mm:ss.SSSSSSSSS",U=class extends Ye{constructor(e){super(),this.debouncedUpdateCustomFormat=vt(e.handleFormatSelection,Lu),this.irisGrid=e}static getQuickFilterCondition(e,t,n){return e&&n==="&&"?e.and(t):e&&n==="||"?e.or(t):t}static getQuickFilterText(e,t,n){return n&&e!=null?`${e} ${n} ${t}`:t}static getOperatorAsText(e){return e==="&&"?"And":"Or"}static getNumberValueEqualsFilter(e,t){const n=e.filter();if(t===Number.POSITIVE_INFINITY)return E.FilterCondition.invoke("isInf",n).and(n.greaterThan(E.FilterValue.ofNumber(0)));if(t===Number.NEGATIVE_INFINITY)return E.FilterCondition.invoke("isInf",n).and(n.lessThan(E.FilterValue.ofNumber(0)));if(Number.isNaN(t))return E.FilterCondition.invoke("isNaN",n);const s=U.getFilterValueForNumberOrChar(e.type,t);return n.eq(s)}static getFilterValueForNumberOrChar(e,t){return I.isCharType(e)?E.FilterValue.ofString(String.fromCharCode(t)):E.FilterValue.ofNumber(t)}static getRowOptionFormatted(e,t,n=30){return`${e} "${ts.truncate(t,n-e.length-3)}"`}componentWillUnmount(){this.debouncedUpdateCustomFormat.flush()}getHeaderActions(e,t){var N;const{irisGrid:n}=this,{column:s}=t;M(s);const{model:o}=n.props,{columns:i}=o,r=i[e],l=[],{metrics:a,reverseType:c,quickFilters:d,advancedFilters:u,searchFilter:h}=n.state,g=n.getTheme();M(a);const{filterIconColor:p,filterBarActiveColor:f,contextMenuSortIconColor:C,contextMenuReverseIconColor:w}=g,S=o.sort,T=I.getSortForColumn(S,e),R=c!==I.REVERSE_TYPE.NONE,{userColumnWidths:b}=a,v=[...b.values()].some(L=>L===0),D=o.getColumnHeaderParentGroup(e,0)===void 0,A=o.isColumnFrozen(e);return l.push({title:"Hide Column",group:U.GROUP_HIDE_COLUMNS,action:()=>{this.irisGrid.hideColumnByVisibleIndex(s)}}),l.push({title:A?"Unfreeze Column":"Freeze Column",group:U.GROUP_HIDE_COLUMNS,disabled:!D,action:()=>{A?this.irisGrid.unFreezeColumnByColumnName(r.name):this.irisGrid.freezeColumnByColumnName(r.name)},order:10}),l.push({title:"Show All Columns",group:U.GROUP_HIDE_COLUMNS,action:()=>{this.irisGrid.showAllColumns()},disabled:!v}),l.push({title:"Quick Filters",icon:Qt,iconColor:f,shortcut:Nt.TABLE.TOGGLE_QUICK_FILTER,group:U.GROUP_FILTER,order:10,action:()=>{this.irisGrid.toggleFilterBar(s)}}),l.push({title:"Advanced Filters",icon:u.get(e)?ki:Oo,iconColor:p,group:U.GROUP_FILTER,order:20,action:()=>{this.irisGrid.handleAdvancedMenuOpened(s)}}),l.push({title:"Clear Table Filters",group:U.GROUP_FILTER,order:40,shortcut:Nt.TABLE.CLEAR_FILTERS,action:()=>{this.irisGrid.clearAllFilters()},disabled:!(d.size>0||u.size>0||h!=null)}),l.push({title:"Sort by",icon:Qt,iconColor:C,group:U.GROUP_SORT,order:10,actions:this.sortByActions(r,e,T)}),l.push({title:"Add Additional Sort",disabled:T&&S.length===1||R&&S.length===1||T&&R&&S.length===2||S.length===0,group:U.GROUP_SORT,order:20,actions:this.additionalSortActions(r,e)}),l.push({title:"Clear Table Sorting",disabled:S.length===0||R&&S.length===1,group:U.GROUP_SORT,action:()=>{this.irisGrid.sortColumn(s,U.COLUMN_SORT_DIRECTION.none)},order:30}),l.push({title:c===I.REVERSE_TYPE.NONE?"Reverse Table":"Clear Reverse Table",icon:Qt,iconColor:w,group:U.GROUP_SORT,order:40,disabled:!o.isReversible,shortcut:Nt.TABLE.REVERSE,action:()=>{c===I.REVERSE_TYPE.NONE?this.irisGrid.reverse(I.REVERSE_TYPE.POST_SORT):this.irisGrid.reverse(I.REVERSE_TYPE.NONE)}}),l.push({title:"Copy Column Name",group:U.GROUP_COPY,action:()=>{var L;zo((L=o.textForColumnHeader(e))!=null?L:"").catch(k=>Or.error("Unable to copy header",k))}}),I.isDateType(r.type)?l.push({title:"Date/Time Format",group:U.GROUP_FORMAT,actions:this.dateFormatActions(r)}):I.isNumberType(r.type)&&l.push({title:"Number Format",group:U.GROUP_FORMAT,actions:(N=this.numberFormatActions(r))!=null?N:void 0}),l}getCellActions(e,t,n){M(e);const{irisGrid:s}=this,{column:o,row:i}=n,{model:r,canCopy:l}=s.props,{columns:a}=r,c=s.getModelRow(i);M(c);const d=r.valueForCell(e,c),u=r.textForCell(e,c),h=a[e],g=[],{quickFilters:p}=s.state,f=s.getTheme(),{filterIconColor:C}=f,{settings:w}=s.props,S=new kn({timeZone:w==null?void 0:w.timeZone,showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:xr}),T=new kn({timeZone:w==null?void 0:w.timeZone,showTimeZone:w==null?void 0:w.showTimeZone,showTSeparator:w==null?void 0:w.showTSeparator,defaultDateTimeFormatString:xr});if(h==null||i==null)return g;if(r.isFilterable(e)){const b={title:"Filter by Value",icon:Qt,iconColor:C,group:U.GROUP_FILTER,order:10,actions:[]};if(d==null)p.get(e)&&b.actions.push({title:"And",actions:this.nullFilterActions(h,p.get(e),"&&"),order:2,group:se.groups.high}),b.actions.push(...this.nullFilterActions(h));else if(I.isBooleanType(h.type))p.get(e)&&b.actions.push({title:"Or",actions:this.booleanFilterActions(h,u,p.get(e),"||"),order:2,group:se.groups.high}),b.actions.push(...this.booleanFilterActions(h,u));else if(I.isNumberType(h.type)||I.isCharType(h.type)){M(e);const v=I.isCharType(h.type)?String.fromCharCode(d):`${d}`;p.get(e)&&b.actions.push({title:"And",actions:this.numberFilterActions(h,v,d,p.get(e),"&&"),order:2,group:se.groups.high}),b.actions.push(...this.numberFilterActions(h,v,d,p.get(e)))}else if(I.isDateType(h.type)){const v=S.format(d),D=T.format(d);p.get(e)&&b.actions.push({title:"And",actions:this.dateFilterActions(h,v,D,d,p.get(e),"&&"),order:2,group:se.groups.high}),b.actions.push(...this.dateFilterActions(h,v,D,d,p.get(e)))}else p.get(e)&&b.actions.push({title:"And",actions:this.stringFilterActions(h,u,d,p.get(e),"&&"),order:2,group:se.groups.high}),b.actions.push(...this.stringFilterActions(h,u,d));b.actions!=null&&b.actions.length>0&&g.push(b)}if(Ae(r)&&r.isRowExpandable(c)){const b=r.groupedColumns.length>0?r.depthForRow(c)-1:0,D=r.valueForCell(b,c)==null?"null":r.textForCell(b,c);g.push({title:U.getRowOptionFormatted(r.isRowExpanded(c)?"Collapse":"Expand",D),group:U.GROUP_EXPAND_COLLAPSE,order:10,action:()=>{r.setRowExpanded(c,!r.isRowExpanded(c))}}),r.isExpandAllAvailable===!0&&g.push({title:U.getRowOptionFormatted("Expand All in",D),group:U.GROUP_EXPAND_COLLAPSE,order:20,action:()=>{r.setRowExpanded(c,!0,!0)}})}Ae(r)&&r.hasExpandableRows&&r.isExpandAllAvailable===!0&&(g.push({title:"Expand Entire Table",group:U.GROUP_EXPAND_COLLAPSE,order:30,action:()=>{r.expandAll()}}),g.push({title:"Collapse Entire Table",group:U.GROUP_EXPAND_COLLAPSE,order:40,action:()=>{r.collapseAll()}}));const R={title:"Go to",iconColor:C,shortcut:Nt.TABLE.GOTO_ROW,group:U.GROUP_GOTO,order:10,action:()=>this.irisGrid.toggleGotoRow(`${i+1}`,`${d}`,h.name)};return g.push(R),l&&(g.push({title:"Copy Cell",group:U.GROUP_COPY,order:10,action:()=>{s.copyCell(o,i)}}),g.push({title:"Copy Cell Unformatted",group:U.GROUP_COPY,order:20,action:()=>{s.copyCell(o,i,!0)}})),g}onContextMenu(e,t,n){const{irisGrid:s}=this,{y:o,column:i,row:r,columnHeaderDepth:l}=e,a=s.getModelColumn(i),c=s.getModelRow(r),{model:d,canCopy:u}=s.props,{columns:h}=d,{metrics:g,isFilterBarShown:p,quickFilters:f,advancedFilters:C,selectedRanges:w}=s.state;M(g);const{columnHeaderHeight:S,gridY:T,columnHeaderMaxDepth:R}=g,b=[];if(a!=null&&c!=null){const v=d.valueForCell(a,c),D=d.textForCell(a,c),A=h[a],{onContextMenu:N}=s.props;A!=null&&b.push(N({model:d,value:v,valueText:D,column:A,rowIndex:r,columnIndex:i,modelRow:c,modelColumn:a}))}return a!=null&&d.isFilterable(a)&&b.push({title:"Clear Column Filter",group:U.GROUP_FILTER,order:30,action:()=>{this.irisGrid.removeColumnFilter(a)},disabled:!(f.has(a)||C.has(a))}),(p?o<=T:o<=S*R&&l===0)?a!=null&&b.push(...this.getHeaderActions(a,e)):(a!=null&&c!=null&&b.push(...this.getCellActions(a,t,e)),u&&w.length>0&&(b.push({title:"Copy Selection",shortcut:Li.COPY,group:U.GROUP_COPY,order:30,action:()=>{s.copyRanges(w)}}),b.push({title:"Copy Selection w/ Headers",group:U.GROUP_COPY,order:40,action:()=>{s.copyRanges(w,!0)}})),ke(d)&&d.isEditable&&w.length>0&&b.push({title:"Delete Selected Rows",group:U.GROUP_EDIT,order:50,action:()=>{this.irisGrid.deleteRanges(w)}})),b.length===0?!1:(M(s.gridWrapper),se.triggerMenu(s.gridWrapper,n.pageX,n.pageY,b),!0)}dateFormatActions(e){const{model:t}=this.irisGrid.props,{formatter:n}=t,s=n.getColumnFormat(e.type,e.name),o=Jo.getOptions(n,s),i=[];for(let r=0;r<o.length;r+=1){const{description:l,format:a,group:c,isSelected:d,title:u}=o[r];i.push({title:u,description:l,icon:d?jn:void 0,group:c,order:r,action:()=>{const h=t.getColumnIndexByName(e.name);M(h),this.irisGrid.handleFormatSelection(h,a)}})}return i}numberFormatActions(e){const{model:t}=this.irisGrid.props,{formatter:n}=t,s=n.getColumnFormat(e.type,e.name);let o;const i=t.getColumnIndexByName(e.name);if(I.isDecimalType(e.type))o=js.getOptions(s,l=>{M(i),this.debouncedUpdateCustomFormat(i,l)});else if(I.isIntegerType(e.type))o=ei.getOptions(s,l=>{M(i),this.debouncedUpdateCustomFormat(i,l)});else return Or.error("Invalid column type in numberFormatActions"),null;const r=[];for(let l=0;l<o.length;l+=1){const{format:a,isSelected:c}=o[l];r.push({...o[l],icon:c?jn:void 0,order:l,action:()=>{i===void 0&&a&&a.type===Le.TYPE_CONTEXT_CUSTOM||(M(i),this.irisGrid.handleFormatSelection(i,a))}})}return r}stringFilterActions(e,t,n,s,o){const i=E.FilterValue.ofString(n);let r=s;r||(r={filter:null,text:null});const{filter:l,text:a}=r,c=[],{model:d}=this.irisGrid.props,u=d.getColumnIndexByName(e.name);return M(u),c.push({menuElement:y("div",{className:"iris-grid-filter-menu-item-value",children:[o?U.getOperatorAsText(o):""," ",'"',t,'"']}),order:1,group:se.groups.high}),c.push({title:"text is exactly",description:`Show only rows where ${e.name} is ${n} (case sensitive)`,action:()=>{this.irisGrid.setQuickFilter(u,U.getQuickFilterCondition(l,e.filter().eq(i),o),U.getQuickFilterText(a,`=${t}`,o))},order:10,group:se.groups.low}),c.push({title:"text is not exactly",description:`Show only rows where ${e.name} is not ${t} (case sensitive)`,action:()=>{this.irisGrid.setQuickFilter(u,U.getQuickFilterCondition(l,e.filter().notEq(i),o),U.getQuickFilterText(a,`!=${t}`,o))},order:20,group:se.groups.low}),c.push({title:"text contains",description:`Show only rows where ${e.name} contains ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,U.getQuickFilterCondition(l,e.filter().contains(i),o),U.getQuickFilterText(a,`~${t}`,o))},order:30,group:se.groups.low}),c.push({title:"text does not contain",description:`Show only rows where ${e.name} does not contain ${n}`,action:()=>{this.irisGrid.setQuickFilter(u,U.getQuickFilterCondition(l,e.filter().contains(i).not(),o),U.getQuickFilterText(a,`!~${t}`,o))},order:40,group:se.groups.low}),c.push({title:"text starts with",description:`Show only rows where ${e.name} starts with ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,U.getQuickFilterCondition(l,e.filter().invoke("startsWith",i),o),U.getQuickFilterText(a,`${t}*`,o))},order:50,group:se.groups.low}),c.push({title:"text ends with",description:`Show only rows where ${e.name} ends with ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,U.getQuickFilterCondition(l,e.filter().invoke("endsWith",i),o),U.getQuickFilterText(a,`*${t}`,o))},order:60,group:se.groups.low}),c}numberFilterActions(e,t,n,s,o){const i=U.getFilterValueForNumberOrChar(e.type,n);let r=null,l=null;s&&(r=s.filter,l=s.text);const a=[],c=n!==Number.POSITIVE_INFINITY&&n!==Number.NEGATIVE_INFINITY&&!Number.isNaN(n),{model:d}=this.irisGrid.props,u=d.getColumnIndexByName(e.name);return M(u),a.push({menuElement:y("div",{className:"iris-grid-filter-menu-item-value",children:[o?U.getOperatorAsText(o):""," ",'"',t,'"']}),order:1,group:se.groups.high}),a.push({title:"is equal to",description:`Show only rows where ${e.name} is ${t}`,action:()=>{const h=U.getNumberValueEqualsFilter(e,n);this.irisGrid.setQuickFilter(u,U.getQuickFilterCondition(r,h,o),U.getQuickFilterText(l,`=${t}`,o))},order:10,group:se.groups.low}),a.push({title:"is not equal to",description:`Show only rows where ${e.name} is not ${t}`,action:()=>{const h=U.getNumberValueEqualsFilter(e,n).not();this.irisGrid.setQuickFilter(u,U.getQuickFilterCondition(r,h,o),U.getQuickFilterText(l,`!=${t}`,o))},order:20,group:se.groups.low}),c&&!I.isCharType(e.type)&&(a.push({title:"greater than",description:`Show only rows where ${e.name} is greater than ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,U.getQuickFilterCondition(r,e.filter().greaterThan(i),o),U.getQuickFilterText(l,`>${t}`,o))},order:30,group:se.groups.low}),a.push({title:"greater than or equal to",description:`Show only rows where ${e.name} is greater than or equal to ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,U.getQuickFilterCondition(r,e.filter().greaterThanOrEqualTo(i),o),U.getQuickFilterText(l,`>=${t}`,o))},order:40,group:se.groups.low}),a.push({title:"less than",description:`Show only rows where ${e.name} is less than ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,U.getQuickFilterCondition(r,e.filter().lessThan(i),o),U.getQuickFilterText(l,`<${t}`,o))},order:50,group:se.groups.low}),a.push({title:"less than or equal to",description:`Show only rows where ${e.name} is less than or equal to ${t}`,action:()=>{this.irisGrid.setQuickFilter(u,U.getQuickFilterCondition(r,e.filter().lessThanOrEqualTo(i),o),U.getQuickFilterText(l,`<=${t}`,o))},order:60,group:se.groups.low})),a}booleanFilterActions(e,t,n,s){const o=[],{model:i}=this.irisGrid.props,{filter:r,text:l}=n||{},a=i.getColumnIndexByName(e.name);return M(a),o.push({menuElement:y("div",{className:"iris-grid-filter-menu-item-value",children:[s?U.getOperatorAsText(s):""," ",'"',t!=null?t:"null",'"']}),order:1,group:se.groups.high}),o.push({title:"true",description:`Show only rows where ${e.name} is true`,action:()=>{this.irisGrid.setQuickFilter(a,U.getQuickFilterCondition(r,e.filter().isTrue(),s),U.getQuickFilterText(l,"true",s))},order:10,group:se.groups.low}),o.push({title:"false",description:`Show only rows where ${e.name} is false`,action:()=>{this.irisGrid.setQuickFilter(a,U.getQuickFilterCondition(r,e.filter().isFalse(),s),U.getQuickFilterText(l,"false",s))},order:20,group:se.groups.low}),o.push({title:"is null",description:`Show only rows where ${e.name} is null`,action:()=>{this.irisGrid.setQuickFilter(a,U.getQuickFilterCondition(r,e.filter().isNull(),s),U.getQuickFilterText(l,"null",s))},order:30,group:se.groups.low}),o.push({title:"is not null",description:`Show only rows where ${e.name} is not null`,action:()=>{this.irisGrid.setQuickFilter(a,U.getQuickFilterCondition(r,e.filter().isNull().not(),s),U.getQuickFilterText(l,"!null",s))},order:40,group:se.groups.low}),o}dateFilterActions(e,t,n,s,o,i){const r=E.FilterValue.ofNumber(s);let l=null,a=null;o&&(l=o.filter,a=o.text);const{model:c}=this.irisGrid.props,d=c.getColumnIndexByName(e.name);M(d);const u=[];return u.push({menuElement:y("div",{className:"iris-grid-filter-menu-item-value",children:[i?U.getOperatorAsText(i):""," ",'"',n,'"']}),order:1,group:se.groups.high}),u.push({title:"date is",description:`Show only rows where ${e.name} is ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,U.getQuickFilterCondition(l,e.filter().eq(r),i),U.getQuickFilterText(a,`=${t}`,i))},order:10,group:se.groups.low}),u.push({title:"date is not",description:`Show only rows where ${e.name} is not ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,U.getQuickFilterCondition(l,e.filter().notEq(r),i),U.getQuickFilterText(a,`!=${t}`,i))},order:20,group:se.groups.low}),u.push({title:"date is before",description:`Show only rows where ${e.name} is before ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,U.getQuickFilterCondition(l,e.filter().lessThan(r),i),U.getQuickFilterText(a,`<${t}`,i))},order:30,group:se.groups.low}),u.push({title:"date is before or equal",description:`Show only rows where ${e.name} is before or equal to ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,U.getQuickFilterCondition(l,e.filter().lessThanOrEqualTo(r),i),U.getQuickFilterText(a,`<=${t}`,i))},order:40,group:se.groups.low}),u.push({title:"date is after",description:`Show only rows where ${e.name} is greater than ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,U.getQuickFilterCondition(l,e.filter().greaterThan(r),i),U.getQuickFilterText(a,`>${t}`,i))},order:50,group:se.groups.low}),u.push({title:"date is after or equal",description:`Show only rows where ${e.name} is after or equal to ${n}`,action:()=>{this.irisGrid.setQuickFilter(d,U.getQuickFilterCondition(l,e.filter().greaterThanOrEqualTo(r),i),U.getQuickFilterText(a,`>=${t}`,i))},order:60,group:se.groups.low}),u}nullFilterActions(e,t,n){let s=null,o=null;t&&(s=t.filter,o=t.text);const i=[],{model:r}=this.irisGrid.props,l=r.getColumnIndexByName(e.name);return M(l),i.push({menuElement:y("div",{className:"iris-grid-filter-menu-item-value",children:[n?U.getOperatorAsText(n):""," ",'"null"']}),order:1,group:se.groups.high}),i.push({title:"is null",description:`Show only rows where ${e.name} is null`,action:()=>{this.irisGrid.setQuickFilter(l,U.getQuickFilterCondition(s,e.filter().isNull(),n),U.getQuickFilterText(o,"null",n))},order:10,group:se.groups.low}),i.push({title:"is not null",description:`Show only rows where ${e.name} is not null`,action:()=>{this.irisGrid.setQuickFilter(l,U.getQuickFilterCondition(s,e.filter().isNull().not(),n),U.getQuickFilterText(o,"!null",n))},order:20,group:se.groups.low}),i}sortByActions(e,t,n){const s=this.irisGrid.getTheme(),{contextMenuSortIconColor:o}=s,i=[{title:`${e.name} Ascending`,order:10,action:()=>{this.irisGrid.sortColumn(t,U.COLUMN_SORT_DIRECTION.ascending)},icon:this.checkColumnSort(n,U.COLUMN_SORT_DIRECTION.ascending)?Qt:void 0,iconColor:o},{title:`${e.name} Descending`,order:20,action:()=>{this.irisGrid.sortColumn(t,U.COLUMN_SORT_DIRECTION.descending)},icon:this.checkColumnSort(n,U.COLUMN_SORT_DIRECTION.descending)?Qt:void 0,iconColor:o},{title:"Remove Sort",order:50,action:()=>{this.irisGrid.sortColumn(t,U.COLUMN_SORT_DIRECTION.none,!1,!0)},disabled:!n}];return I.isNumberType(e.type)&&(i.push({title:`ABS(${e.name}) Ascending`,order:30,action:()=>{this.irisGrid.sortColumn(t,U.COLUMN_SORT_DIRECTION.ascending,!0)},icon:this.checkColumnSort(n,U.COLUMN_SORT_DIRECTION.ascending,!0)?Qt:void 0,iconColor:o}),i.push({title:`ABS(${e.name}) Descending`,order:40,action:()=>{this.irisGrid.sortColumn(t,U.COLUMN_SORT_DIRECTION.descending,!0)},icon:this.checkColumnSort(n,U.COLUMN_SORT_DIRECTION.descending,!0)?Qt:void 0,iconColor:o})),i}additionalSortActions(e,t){const n=this.irisGrid.getTheme(),{contextMenuSortIconColor:s}=n,o=[{title:"Add Sort By",menuElement:y("div",{className:"btn-context-menu menu-title",children:[m("span",{className:"icon",children:m(te,{icon:Qt,style:{color:s!=null?s:void 0}})}),m("span",{className:"title",children:"Add Additional Sort"}),m("span",{className:"shortcut",children:_n.isMacPlatform()?"\u2318Click":"Ctrl+Click"})]}),order:1},{title:`${e.name} Ascending`,order:10,action:()=>{this.irisGrid.sortColumn(t,U.COLUMN_SORT_DIRECTION.ascending,!1,!0)}},{title:`${e.name} Descending`,order:20,action:()=>{this.irisGrid.sortColumn(t,U.COLUMN_SORT_DIRECTION.descending,!1,!0)}}];return I.isNumberType(e.type)&&(o.push({title:`ABS(${e.name}) Ascending`,order:30,action:()=>{this.irisGrid.sortColumn(t,U.COLUMN_SORT_DIRECTION.ascending,!0,!0)}}),o.push({title:`ABS(${e.name}) Descending`,order:40,action:()=>{this.irisGrid.sortColumn(t,U.COLUMN_SORT_DIRECTION.descending,!0,!0)}})),o}checkColumnSort(e,t=null,n=!1){return e?e.direction===t&&e.isAbs===n:!1}};let Yt=U;Yt.GROUP_EDIT=se.groups.high+10;Yt.GROUP_HIDE_COLUMNS=se.groups.high+25;Yt.GROUP_FILTER=se.groups.high+50;Yt.GROUP_EXPAND_COLLAPSE=se.groups.high+55;Yt.GROUP_GOTO=se.groups.high+60;Yt.GROUP_SORT=se.groups.high+75;Yt.GROUP_COPY=se.groups.high+100;Yt.GROUP_FORMAT=se.groups.high+150;Yt.COLUMN_SORT_DIRECTION={ascending:"ASC",descending:"DESC",none:null};class Pu extends Ye{constructor(t){super(),this.irisGrid=t}onDoubleClick(t){const{column:n,row:s}=t;return s==null||n==null?!1:(this.irisGrid.selectData(n,s),!0)}}class _u extends Ye{constructor(t){super(),this.irisGrid=t}onDown(t){const{y:n,column:s,row:o}=t;if(s!==null&&o===null){const{isFilterBarShown:i,metrics:r}=this.irisGrid.state;if(!r)throw new Error("Metrics not set");const{columnHeaderMaxDepth:l}=r,a=this.irisGrid.getTheme();if(i&&a.columnHeaderHeight!=null&&a.filterBarHeight!=null&&n>a.columnHeaderHeight*l&&n<=a.columnHeaderHeight*l+a.filterBarHeight)return this.irisGrid.focusFilterBar(s),!0}return!1}onMove(t){const{y:n,column:s}=t,{isFilterBarShown:o,hoverAdvancedFilter:i,metrics:r}=this.irisGrid.state;if(!r)throw new Error("Metrics not set");const{columnHeaderMaxDepth:l}=r,a=this.irisGrid.getTheme();let c=null;return o&&a.columnHeaderHeight!=null&&a.filterBarHeight!=null&&s!==null&&n>=a.columnHeaderHeight*l&&n<=a.columnHeaderHeight*l+a.filterBarHeight&&(c=s),c!==i&&this.irisGrid.setState({hoverAdvancedFilter:c}),!1}onLeave(t){const{column:n}=t,{hoverAdvancedFilter:s}=this.irisGrid.state;return s!==null&&n!==s&&this.irisGrid.setState({hoverAdvancedFilter:null}),!1}}class Hu extends Ye{constructor(t){super(750),this.irisGrid=t}destroyTooltip(){this.irisGrid.setState({expandCellTooltipProps:null})}setCursor(t,n){return Ts.isInTreeBox(t,n)?(this.cursor="pointer",{stopPropagation:!1,preventDefault:!1}):(this.cursor=null,!1)}getButtonPosition({x:t,y:n,column:s,row:o}){if(s==null||o==null)return null;const{renderer:i,grid:r,state:l,props:a}=this.irisGrid;if(!r)return null;const{metrics:c}=l,{model:d}=a,{canvasContext:u}=r,h=r.getTheme(),g={context:u,mouseX:t,mouseY:n,metrics:c,model:d,theme:h},p=Ae(d)?d.depthForRow(o):null,{left:f,top:C,width:w,height:S}=i.getExpandButtonPosition(g,p);return f==null||w==null||C==null||S==null?null:{left:f,top:C,width:w,height:S}}onMove(t,n){if(Ts.isInTreeBox(t,n)){const{expandCellTooltipProps:s}=this.irisGrid.state,{model:o}=this.irisGrid.props,i=this.getButtonPosition(t),{row:r}=t;M(r);const l=Ae(o)&&o.isRowExpanded(r);rt(s,i)||this.irisGrid.setState({expandCellTooltipProps:i,expandTooltipDisplayValue:l?"collapse":"expand"})}else this.destroyTooltip();return this.setCursor(t,n)}onDown(){return this.destroyTooltip(),!1}onContextMenu(){return this.destroyTooltip(),!1}onWheel(){return this.destroyTooltip(),!1}onLeave(){return this.destroyTooltip(),!1}}class Vu extends Ye{constructor(t){super(),this.column=null,this.irisGrid=t}getColumnFromGridPoint(t){const{column:n,row:s,columnHeaderDepth:o}=t;return n!==null&&s===null&&o===0?n:null}onDown(t){return this.column=this.getColumnFromGridPoint(t),!1}onClick(t,n,s){const o=this.getColumnFromGridPoint(t);if(o!=null&&o===this.column){const i=_n.isModifierKeyDown(s);return this.irisGrid.toggleSort(o,i),!0}return!1}}class Uu extends Ye{constructor(t){super(),this.irisGrid=t}onWheel(t,n,s){const{irisGrid:o}=this,{model:i}=o.props,{metrics:r,pendingRowCount:l}=o.state;M(r);const{bottom:a,rowCount:c,rowHeight:d}=r,{deltaY:u}=H.getScrollDelta(s);return ke(i)&&i.isEditable&&a>=c-1&&u>0&&o.setState({pendingRowCount:l+Math.ceil(u/d)}),!1}}const Bu=3e3;function Gu({children:e=null,onEntering:t,onEntered:n,onExiting:s,onExited:o}){const[i,r]=F.exports.useState(!1),l=F.exports.useRef(),a=$i(e),c=F.exports.useCallback(()=>{r(!0),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{r(!1)},Bu)},[r,l]);return F.exports.useEffect(()=>{a!==e&&e!=null&&c()},[e,a,r,c]),F.exports.useEffect(()=>()=>l.current?clearTimeout(l.current):void 0,[]),m(Zo,{className:"toast-bottom-bar",isShown:i,onEntering:t,onEntered:n,onExiting:s,onExited:o,children:e})}class Wu extends Ks{getGridY(t){let n=super.getGridY(t);const{isFilterBarShown:s,theme:o,advancedFilters:i,quickFilters:r,sorts:l,reverseType:a}=t;return s?n+=o.filterBarHeight:(r!=null&&r.size>0||i!=null&&i.size>0)&&(n+=o.filterBarCollapsedHeight),a!==I.REVERSE_TYPE.NONE&&l!=null&&l.length>0&&(n+=o.reverseHeaderBarHeight),n}getUserColumnWidths(){return this.userColumnWidths}}const $u=1,Al=Fe.memo(({model:e,modelColumns:t,top:n,bottom:s,left:o,right:i,filter:r,formatter:l,reverseType:a=I.REVERSE_TYPE.NONE,sorts:c,customColumns:d,movedColumns:u,hiddenColumns:h,alwaysFetchColumns:g,rollupConfig:p=null,totalsConfig:f=null,selectDistinctColumns:C=ve,pendingRowCount:w=0,pendingDataMap:S=on,frozenColumns:T,formatColumns:R,columnHeaderGroups:b})=>{const v=F.exports.useMemo(()=>J.getModelViewportColumns(t,o,i,u,h,g,$u),[t,o,i,u,h,g]);return F.exports.useEffect(function(){e.filter=r},[e,r]),F.exports.useEffect(function(){const A=[...c];a!==I.REVERSE_TYPE.NONE&&A.push(E.Table.reverse()),e.sort=A},[e,c,a]),F.exports.useEffect(function(){e.formatter=l},[e,l]),F.exports.useEffect(function(){e.isCustomColumnsAvailable&&(e.customColumns=d)},[e,d]),F.exports.useEffect(function(){e.isFormatColumnsAvailable&&(e.formatColumns=R)},[e,R]),F.exports.useEffect(function(){e.setViewport(n,s,v)},[e,n,s,v]),F.exports.useEffect(function(){e.isRollupAvailable&&(e.rollupConfig=p)},[e,e.isRollupAvailable,p]),F.exports.useEffect(function(){e.isSelectDistinctAvailable&&(e.selectDistinctColumns=C)},[e,C]),F.exports.useEffect(function(){e.isTotalsAvailable&&(e.totalsConfig=f)},[e,e.isTotalsAvailable,f]),F.exports.useEffect(function(){e.pendingRowCount=w},[e,w]),F.exports.useEffect(function(){e.pendingDataMap=S},[e,S]),F.exports.useEffect(function(){T&&e.updateFrozenColumns(T)},[e,T]),F.exports.useEffect(function(){e.columnHeaderGroups=b},[e,b]),null});Al.displayName="IrisGridModelUpdater";const _t=Object.freeze({SORT_UP:"sortUp",SORT_DOWN:"sortDown",CARET_DOWN:"caretDown",CARET_RIGHT:"caretRight",CELL_OVERFLOW:"cellOverflow"}),kr=10,pi=16;class zs extends ts{constructor(){super(),this.icons={},this.initIcons()}static isFilterValid(t,n){const s=t==null||t.filter!=null,o=n==null||n.filter!=null;return s&&o}initIcons(){this.setIcon(_t.SORT_UP,Ba),this.setIcon(_t.SORT_DOWN,Ga),this.setIcon(_t.CARET_DOWN,Xn),this.setIcon(_t.CARET_RIGHT,ll),this.setIcon(_t.CELL_OVERFLOW,Wa)}setIcon(t,n){const s=Array.isArray(n.icon[4])?n.icon[4][0]:n.icon[4],o=new Path2D(s),i=new Path2D,r={a:pi/n.icon[0],d:pi/n.icon[1]};i.addPath(o,r),this.icons[t]=i}getIcon(t){return this.icons[t]}getSortIcon(t){return t?t.direction===I.sortDirection.ascending?this.getIcon(_t.SORT_UP):t.direction===I.sortDirection.descending?this.getIcon(_t.SORT_DOWN):null:null}drawCanvas(t){super.drawCanvas(t),this.drawScrim(t)}drawGrid(t,n){super.drawGrid(t,n),this.drawCellOverflowButton(n)}drawGridLines(t,n){super.drawGridLines(t,n),this.drawGroupedColumnLine(t,n),this.drawPendingRowLine(t,n)}drawCellContent(t,n,s,o){var h;const{metrics:i,model:r}=n,{modelColumns:l,modelRows:a}=i,c=O(a,o),d=l.get(s);if(d===void 0)return;const u=r.valueForCell(d,c);if(I.isTextType((h=r.columns[d])==null?void 0:h.type)&&(u===null||u==="")){const g=t.font;t.font=`italic ${g}`;const p=u===null?"null":"empty";super.drawCellContent(t,n,s,o,p),t.font=g;return}super.drawCellContent(t,n,s,o)}drawGroupedColumnLine(t,n){const{metrics:s,model:o,theme:i}=n,{groupedColumns:r,columns:l}=o,{maxY:a,allColumnWidths:c,allColumnXs:d}=s;if(r.length===0||i.groupedColumnDividerColor==null)return;const u=r[r.length-1],h=l.findIndex(C=>C.name===u.name),g=d.get(h),p=c.get(h);if(g==null||p==null)return;const f=g+p+.5;t.strokeStyle=i.groupedColumnDividerColor,t.lineWidth=1,t.beginPath(),t.moveTo(f,0),t.lineTo(f,a),t.stroke()}drawPendingRowLine(t,n){const{metrics:s,model:o,theme:i}=n,{allRowYs:r,maxX:l}=s,{pendingRowCount:a}=o;if(a<=0)return;const c=o.rowCount-o.pendingRowCount-o.floatingBottomRowCount;let d=r.get(c);d!=null&&(d-=.5,t.save(),t.setLineDash([4,2]),t.strokeStyle=i.pendingTextColor,t.lineWidth=1,t.beginPath(),t.moveTo(0,d),t.lineTo(l,d),t.stroke(),t.restore())}drawMouseColumnHover(t,n){const{theme:s,metrics:o,hoverSelectColumn:i}=n;if(i==null||s.linkerColumnHoverBackgroundColor==null)return;const{allColumnWidths:r,allColumnXs:l,maxY:a}=o,c=l.get(i),d=r.get(i);M(c),M(d),t.fillStyle=s.linkerColumnHoverBackgroundColor,t.fillRect(c,0,d,a)}drawMouseRowHover(t,n){const{isSelectingColumn:s}=n;s||super.drawMouseRowHover(t,n)}drawScrim(t){const{context:n,loadingScrimProgress:s,metrics:o,theme:i}=t;if(s==null)return;const{width:r,height:l,gridY:a}=o,{scrimBlurSize:c,scrimColor:d}=i;n.save(),n.globalCompositeOperation="color",n.filter=`blur(${c}px)`,d!=null&&(n.fillStyle=d),n.beginPath(),n.rect(0,a,r,l-a),n.clip(),n.fillRect(-c,-c+a,c*2+r,(c*2+(l-a))*s),n.globalCompositeOperation="overlay",n.filter=`blur(${c}px) opacity(15%)`,n.fillRect(-c,-c+a,c*2+r,(c*2+(l-a))*s),n.restore()}drawColumnHeaders(t,n){super.drawColumnHeaders(t,n);const{theme:s,metrics:o,model:i,reverseType:r}=n,{columnHeaderHeight:l}=o;if(this.drawFilterHeaders(t,n),l<=0)return;const{sort:a}=i;if(a.length===1){const c=r!==I.REVERSE_TYPE.NONE;let d;c?d=s.headerReverseBarColor:d=s.headerSortBarColor,this.drawHeaderBar(t,n,d,c?s.reverseHeaderBarHeight:s.sortHeaderBarHeight)}else a.length>1&&(r!==I.REVERSE_TYPE.NONE&&this.drawHeaderBar(t,n,s.headerReverseBarColor,s.reverseHeaderBarHeight,!1),this.drawHeaderBar(t,n,s.headerSortBarColor,s.sortHeaderBarHeight))}drawHeaderBar(t,n,s,o,i=!0){const{theme:r,metrics:l,model:a}=n,{columnHeaderHeight:c,width:d}=l;let u=0;i||(u=o),t.fillStyle=r.headerBarCasingColor,t.fillRect(0,a.columnHeaderMaxDepth*c-o-2+u,d,o+2),t.fillStyle=s,t.fillRect(0,a.columnHeaderMaxDepth*c-o-1+u,d,o)}drawColumnHeadersAtDepth(t,n,s,o,i){const{metrics:r,model:l,isMenuShown:a}=n,{columnHeaderMaxDepth:c}=l,{width:d}=r,u={...o,maxX:i===c-1&&o.maxX===d?d-(a?0:30):o.maxX};super.drawColumnHeadersAtDepth(t,n,s,u,i)}drawColumnHeaderAtIndex(t,n,s,o){var W;super.drawColumnHeaderAtIndex(t,n,s,o);const{metrics:i,model:r,theme:l}=n,{modelColumns:a,allColumnWidths:c,allColumnXs:d,gridX:u,columnHeaderHeight:h,fontWidths:g}=i,{headerHorizontalPadding:p}=l,f=O(c,s,0),C=O(d,s)+u,w=a.get(s);if(w==null)return;const S=I.getSortForColumn(r.sort,w);if(!S)return;const T=this.getSortIcon(S);if(!T)return;const R=r.textForColumnHeader(w);if(R===void 0)return;const b=(W=g.get(t.font))!=null?W:ts.DEFAULT_FONT_WIDTH;M(b);const v=R.length*b,D=u+C+v+p;let{maxX:A}=o;A-=p;const N=u+C+f-p-1,L=D>A?D+1:Math.min(A,N),k=S.direction===I.sortDirection.ascending?-6:-12,x=h*.5+k;t.save(),t.beginPath(),t.rect(C,0,f,h),t.clip(),t.fillStyle=l.headerSortBarColor,t.translate(L,x),t.fill(T),t.restore()}drawFilterHeaders(t,n){const{isFilterBarShown:s,quickFilters:o,advancedFilters:i}=n;s?this.drawExpandedFilterHeaders(t,n):(o!=null&&o.size>0||i!=null&&i.size>0)&&this.drawCollapsedFilterHeaders(t,n)}drawExpandedFilterHeaders(t,n){const{metrics:s,model:o,theme:i,quickFilters:r,advancedFilters:l}=n,{filterBarHeight:a}=i;if(a<=0)return;const{gridX:c,gridY:d,maxX:u,modelColumns:h,visibleColumns:g,allColumnWidths:p,allColumnXs:f}=s,C=d-a;t.save(),t.font=i.font,t.textAlign="left",r!=null&&r.size>0||l!=null&&l.size>0?t.fillStyle=i.filterBarExpandedActiveBackgroundColor:t.fillStyle=i.filterBarExpandedBackgroundColor,t.fillRect(c,C,u,a-1),t.fillStyle=i.headerBarCasingColor,t.fillRect(c,C+a-1,u,1);const w=C;t.strokeStyle=i.filterBarSeparatorColor,t.beginPath();for(let S=0;S<g.length;S+=1){const T=g[S],R=O(h,T),b=O(f,T),v=O(p,T);if(o.isFilterable(R)&&v>0){const D=c+(b!=null?b:0);t.rect(D+.5,w+.5,v,a-2)}}t.stroke();for(let S=0;S<g.length;S+=1){const T=g[S],R=O(p,T),v=O(f,T)+c;this.drawExpandedFilterHeader(t,n,T,v,R)}t.restore()}drawExpandedFilterHeader(t,n,s,o,i){if(i<=0)return;const{metrics:r,theme:l,quickFilters:a,advancedFilters:c}=n,{modelColumns:d,gridY:u}=r,{filterBarHeight:h,filterBarExpandedActiveCellBackgroundColor:g,filterBarErrorColor:p,filterBarHorizontalPadding:f,headerColor:C}=l,w=u-h,S=d.get(s);if(S===void 0)return;const T=a.get(S),R=c.get(S);if(T==null&&R==null)return;let b=null;if(T!=null){const{text:D}=T;if(b=D,b||(b=I.getFilterText(T.filter)),b!=null){const{fontWidths:A}=r;let N=A.get(t.font);(N==null||N===0)&&(N=t.measureText("8").width,N||(N=10));const L=(i-f*2)/N;L<=0?b="":b.length>L&&(b=`${b.substring(0,L-1)}\u2026`)}}if(t.save(),zs.isFilterValid(R,T)&&g!=null)t.fillStyle=g,t.fillRect(o+1,w+1,i-1,h-3);else if(p!=null){t.fillStyle=p,t.lineWidth=2,t.strokeStyle=p;const D=o+2,A=w+2,N=i-3,L=h-5;t.strokeRect(D,A,N,L)}if(b!=null&&b!==""){const D=o+f,A=w+h*.5+1;t.fillStyle=C,t.fillText(b,D,A)}t.restore()}drawCollapsedFilterHeaders(t,n){const{metrics:s,theme:o}=n,{headerSeparatorColor:i,filterBarCollapsedHeight:r}=o;if(r<=0)return;const{gridX:l,gridY:a,maxX:c,visibleColumns:d,allColumnWidths:u,allColumnXs:h}=s,g=a-r;t.save(),t.fillStyle=i,t.fillRect(l,g,c,r);for(let p=0;p<d.length;p+=1){const f=d[p],C=u.get(f),w=h.get(f);if(w!=null&&C!=null){const S=w+l;this.drawCollapsedFilterHeader(t,n,f,S,C)}}t.restore()}drawCollapsedFilterHeader(t,n,s,o,i){if(i<=0)return;const{metrics:r,theme:l,quickFilters:a,advancedFilters:c}=n,{modelColumns:d,gridY:u}=r,h=d.get(s);if(h===void 0)return;const g=a.get(h),p=c.get(h),{filterBarCollapsedHeight:f,filterBarActiveColor:C,filterBarActiveBackgroundColor:w,filterBarErrorColor:S}=l;t.save();const T=zs.isFilterValid(p,g);w!=null&&g==null&&p==null?t.fillStyle=w:C!=null&&T?t.fillStyle=C:S!=null&&(t.fillStyle=S);const R=o+1,b=u-f,v=i-1,D=f-1;t.fillRect(R,b,v,D),t.restore()}drawTreeMarker(t,n,s,o,i,r,l){t.save();const{x1:a,y1:c}=i,d=l?this.getIcon(_t.CARET_DOWN):this.getIcon(_t.CARET_RIGHT),u=s+a-2,h=o+c+2.5;t.fillStyle=r,t.textAlign="center",t.translate(u,h),t.fill(d),t.restore()}drawRowFooters(t,n){const{metrics:s,model:o,mouseX:i,mouseY:r,theme:l}=n,{gridY:a,gridX:c,maxX:d,modelRows:u,floatingTopHeight:h,floatingBottomHeight:g,floatingRows:p,rowFooterWidth:f,height:C,horizontalBarHeight:w,verticalBarWidth:S,allRowHeights:T,allRowYs:R,width:b}=s;if(f<=0||p.length===0)return;const{cellHorizontalPadding:v,floatingGridRowColor:D,floatingRowBackgroundColors:A,headerColor:N,rowHoverBackgroundColor:L}=l;t.translate(c,a),t.beginPath();const k=Math.min(d,b-f-S-c);t.fillStyle=A,h>0&&t.rect(k,0,f,h),g>0&&t.rect(k,C-a-w-g,f,g),t.fill();const x=i!=null&&r!=null&&i>=c&&i<=d+f?H.getRowAtY(r,s):null;if(L!=null&&x!==null&&p.includes(x)){t.fillStyle=L;const V=R.get(x),K=T.get(x);M(V),M(K),t.fillRect(k,V,f,K)}if(t.beginPath(),D!=null&&(t.strokeStyle=D),h>0&&(t.moveTo(k+.5,.5),t.lineTo(k+.5,h-.5)),g>0){const V=C-a-w-g;t.moveTo(k-.5,V+.5),t.lineTo(k-.5,V+g-.5)}t.stroke(),t.fillStyle=N,t.textAlign="left";const W=k+v;for(let V=0;V<p.length;V+=1){const K=p[V],Z=T.get(K),$=R.get(K),P=u.get(K);if($!=null&&Z!=null&&P!=null){const G=$+Z*.5;t.fillText(o.textForRowFooter(P),W,G)}}t.translate(-c,-a)}getTextRenderMetrics(t,n,s,o){const i=super.getTextRenderMetrics(t,n,s,o),{mouseX:r,mouseY:l,metrics:a}=n;if(r==null||l==null)return i;const{column:c,row:d}=H.getGridPointFromXY(r,l,a);if(s===c&&o===d){const{left:u}=this.getCellOverflowButtonPosition(n);this.shouldRenderOverflowButton(n)&&u!=null&&(i.width=u-a.gridX-i.x)}return i}shouldRenderOverflowButton(t){var C,w;const{context:n,mouseX:s,mouseY:o,metrics:i,model:r,theme:l}=t;if(s==null||o==null)return!1;const{row:a,column:c,modelRow:d,modelColumn:u}=H.getCellInfoFromXY(s,o,i);if(a==null||c==null||d==null||u==null||!I.isStringType(r.columns[u].type))return!1;const h=(C=r.textForCell(u,d))!=null?C:"",{width:g}=super.getTextRenderMetrics(n,t,c,a),p=(w=i.fontWidths.get(l.font))!=null?w:zs.DEFAULT_FONT_WIDTH;n.save(),n.font=l.font;const f=this.getCachedTruncatedString(n,h,g,p,r.truncationCharForCell(u,d));return n.restore(),h!==""&&f!==h}getCellOverflowButtonPosition({mouseX:t,mouseY:n,metrics:s,theme:o}){const i={left:null,top:null,width:null,height:null};if(t==null||n==null||!s)return i;const{rowHeight:r,columnWidth:l,left:a,top:c}=H.getCellInfoFromXY(t,n,s);M(a),M(l),M(c);const{width:d,verticalBarWidth:u}=s,{cellHorizontalPadding:h}=o,g=pi+2*h,p=r,C=Math.min(s.gridX+a+l,d-u)-g,w=s.gridY+c;return{left:C,top:w,width:g,height:p}}drawCellOverflowButton(t){const{context:n,mouseX:s,mouseY:o,theme:i}=t;if(s==null||o==null||!this.shouldRenderOverflowButton(t))return;const{left:r,top:l,width:a,height:c}=this.getCellOverflowButtonPosition(t),{cellHorizontalPadding:d,overflowButtonColor:u,overflowButtonHoverColor:h}=i;n.save(),h!=null&&r!=null&&a!=null&&l!=null&&c!=null&&s>=r&&s<=r+a&&o>=l&&o<=l+c?n.fillStyle=h:u!=null&&(n.fillStyle=u);const g=this.getIcon(_t.CELL_OVERFLOW);r!=null&&l!=null&&n.translate(r+d,l+2),n.fill(g),n.restore()}getExpandButtonPosition({mouseX:t,mouseY:n,metrics:s,theme:o},i){const r={left:null,top:null,width:null,height:null};if(t==null||n==null||i==null||!s)return r;const{rowHeight:l,left:a,top:c}=H.getCellInfoFromXY(t,n,s);M(a),M(l),M(c);const{cellHorizontalPadding:d}=o,u=kr+2*d,h=Math.max(a+kr*i,s.gridX),g=s.gridY+c;return{left:h,top:g,width:u,height:l}}}const zu="12px Fira Sans, sans-serif",qu="#f0f0ee",Yu="#1a171a",ne={"grid-bg":"#211f22",font:zu,white:qu,black:Yu,"header-bg":"#2d2a2e","header-color":"#f0f0ee","header-height":"30px","header-separator-color":"#211f22","header-separator-hover-color":"#929192","header-hidden-separator-hover-color":"#4878ea","header-sort-bar-color":"#aa9af4","header-reverse-bar-color":"#548d29","header-bar-casing-color":"#211f22","header-font":"600 12px Fira Sans, sans-serif","row-height":"19px","row-background-colors":"#373438 #2d2a2e","selection-color":"rgba(118, 217, 228, 0.09)","selection-outline-color":"#76d9e4","selection-outline-casing-color":"#211f22","row-hover-bg":"#4b494c","selected-row-hover-bg":"rgba(118, 217, 228, 0.25)","scroll-bar-active-selection-tick-color":"rgba(118, 217, 228, 0.5)","scroll-bar-bg":"#322f33","scroll-bar-hover-bg":"#373438","scroll-bar-casing-color":"#555356","scroll-bar-corner-color":"#322f33","scroll-bar-color":"#5b5a5c","scroll-bar-hover-color":"#929192","scroll-bar-active-color":"#c0bfbf","text-color":"#f0f0ee","positive-number-color":"#9edc6f","negative-number-color":"#f95d84","zero-number-color":"#fcd65b","date-color":"#fcd65b","pending-text-color":"#fde38d","error-text-color":"#f95d84","null-string-color":"#929192","filter-bar-active-bg":"#425175","filter-bar-active-color":"#4878ea","filter-bar-expanded-bg":"#373438","filter-bar-expanded-active-bg":"#313849","filter-bar-expanded-active-cell-bg":"#374d80","filter-bar-separator-color":"#929192","filter-bar-error-color":"#f95d84","filter-icon-color":"#4878ea","scrim-color":"#211f22","context-menu-sort-icon-color":"#aa9af4","context-menu-reverse-icon-color":"#548d29","linker-column-hover-bg":"rgba(118, 217, 228, 0.09)","tree-line-color":"#5b5a5c","tree-marker-color":"#c0bfbf","tree-marker-hover-color":"#fcfcfa","grouped-column-divider-color":"#1a171a","floating-grid-row-color":"#555356","floating-row-background-colors":"#403e41","floating-divider-inner-color":"#403e41","floating-divider-outer-color":"#211f22","overflow-button-color":"#c0bfbf","overflow-button-hover-color":"#fcfcfa"},Ml=Object.freeze({backgroundColor:ne["grid-bg"],white:ne.white,black:ne.black,font:ne.font,headerBackgroundColor:ne["header-bg"],headerColor:ne["header-color"],headerSeparatorColor:ne["header-separator-color"],headerSeparatorHoverColor:ne["header-separator-hover-color"],headerHiddenSeparatorHoverColor:ne["header-hidden-separator-hover-color"],headerSortBarColor:ne["header-sort-bar-color"],headerReverseBarColor:ne["header-reverse-bar-color"],headerBarCasingColor:ne["header-bar-casing-color"],headerFont:ne["header-font"],rowBackgroundColors:ne["row-background-colors"],rowHoverBackgroundColor:ne["row-hover-bg"],selectionColor:ne["selection-color"],selectionOutlineColor:ne["selection-outline-color"],selectionOutlineCasingColor:ne["selection-outline-casing-color"],selectedRowHoverBackgroundColor:ne["selected-row-hover-bg"],scrollBarBackgroundColor:ne["scroll-bar-bg"],scrollBarHoverBackgroundColor:ne["scroll-bar-hover-bg"],scrollBarCasingColor:ne["scroll-bar-casing-color"],scrollBarCornerColor:ne["scroll-bar-corner-color"],scrollBarColor:ne["scroll-bar-color"],scrollBarHoverColor:ne["scroll-bar-hover-color"],scrollBarActiveColor:ne["scroll-bar-active-color"],scrollBarSelectionTickColor:ne["selected-row-hover-bg"],scrollBarActiveSelectionTickColor:ne["scroll-bar-active-selection-tick-color"],textColor:ne["text-color"],positiveNumberColor:ne["positive-number-color"],negativeNumberColor:ne["negative-number-color"],zeroNumberColor:ne["zero-number-color"],dateColor:ne["date-color"],pendingTextColor:ne["pending-text-color"],errorTextColor:ne["error-text-color"],nullStringColor:ne["null-string-color"],filterBarActiveBackgroundColor:ne["filter-bar-active-bg"],filterBarExpandedBackgroundColor:ne["filter-bar-expanded-bg"],filterBarExpandedActiveBackgroundColor:ne["filter-bar-expanded-active-bg"],filterBarExpandedActiveCellBackgroundColor:ne["filter-bar-expanded-active-cell-bg"],filterBarSeparatorColor:ne["filter-bar-separator-color"],filterBarActiveColor:ne["filter-bar-active-color"],filterBarErrorColor:ne["filter-bar-error-color"],filterIconColor:ne["filter-icon-color"],scrimColor:ne["scrim-color"],contextMenuSortIconColor:ne["context-menu-sort-icon-color"],contextMenuReverseIconColor:ne["context-menu-reverse-icon-color"],allowRowResize:!1,autoSelectRow:!0,gridColumnColor:null,gridRowColor:null,groupedColumnDividerColor:ne["grouped-column-divider-color"],columnHoverBackgroundColor:null,headerHorizontalPadding:12,scrollBarSize:13,scrollBarHoverSize:16,minScrollHandleSize:24,rowHeight:parseInt(ne["row-height"],10)||19,columnWidth:100,rowHeaderWidth:0,rowFooterWidth:60,columnHeaderHeight:parseInt(ne["header-height"],10)||30,filterBarHeight:30,filterBarCollapsedHeight:5,sortHeaderBarHeight:2,reverseHeaderBarHeight:4,filterBarHorizontalPadding:4,scrimBlurSize:25,minScrimTransitionTime:150,maxScrimTransitionTime:350,scrollSnapToRow:!0,linkerColumnHoverBackgroundColor:ne["linker-column-hover-bg"],treeLineColor:ne["tree-line-color"],treeMarkerColor:ne["tree-marker-color"],treeMarkerHoverColor:ne["tree-marker-hover-color"],floatingGridColumnColor:null,floatingGridRowColor:ne["floating-grid-row-color"],floatingRowBackgroundColors:ne["floating-row-background-colors"],floatingDividerInnerColor:ne["floating-divider-inner-color"],floatingDividerOuterColor:ne["floating-divider-outer-color"],overflowButtonColor:ne["overflow-button-color"],overflowButtonHoverColor:ne["overflow-button-hover-color"]});const fi=ie.module("ColumnStatistics"),Xu={SIZE:"Number of Rows"},Ii=class extends F.exports.Component{constructor(e){super(e),this.handleError=this.handleError.bind(this),this.handleGenerateStatistics=this.handleGenerateStatistics.bind(this),this.handleStatistics=this.handleStatistics.bind(this),this.cancelablePromise=null,this.state={error:null,loading:!1,statistics:null,numRows:0}}static getStatsLabel(e){var t;return(t=Xu[e])!=null?t:e.split(" ").map(n=>n[0].toUpperCase()+n.substr(1).toLowerCase()).join(" ")}componentDidMount(){this.maybeGenerateStatistics()}componentWillUnmount(){this.cancelablePromise&&this.cancelablePromise.cancel()}maybeGenerateStatistics(){const{model:e}=this.props,t=e.rowCount-e.pendingRowCount;this.setState({numRows:t}),e.isColumnStatisticsAvailable?t<Ii.AUTO_GENERATE_LIMIT&&this.handleGenerateStatistics():this.setState({loading:!1})}handleGenerateStatistics(){this.setState({loading:!0});const{column:e,model:t}=this.props;this.cancelablePromise=Ge.makeCancelable(t.columnStatistics(e)),this.cancelablePromise.then(this.handleStatistics).catch(this.handleError)}handleStatistics(e){fi.debug("Received statistics",e);const{model:t,onStatistics:n}=this.props,s=[];e.statisticsMap.forEach((o,i)=>{s.push({operation:Ii.getStatsLabel(i),value:o,type:e.getType(i)})}),e.uniqueValues.forEach((o,i)=>{s.push({operation:i,className:"column-statistics-unique-value",value:o,type:"long"})}),this.setState({loading:!1,statistics:s,numRows:t.rowCount-t.pendingRowCount}),n()}handleError(e){if(e!=null&&Ge.isCanceled(e)){fi.debug("Called handleError on a cancelled promise result");return}fi.error("Error generating statistics",e),this.setState({error:e,loading:!1,statistics:null})}render(){const{column:e,model:t}=this.props,{error:n,loading:s,statistics:o,numRows:i}=this.state,r=!s&&n==null&&o==null&&t.isColumnStatisticsAvailable,l=[],a=e.type.substring(e.type.lastIndexOf(".")+1),c=e.description===null?null:e.description;if(o!=null)for(let g=0;g<o.length;g+=1){const{operation:p,className:f,value:C,type:w}=o[g],S=w?t.displayString(C,w):t.displayString(C,e.type,e.name),T=y(Fe.Fragment,{children:[m("div",{className:ee("column-statistic-operation",f),children:p}),m("div",{className:"column-statistic-value",children:S})]},p);l.push(T)}const d=Ae(t)&&t.hasExpandableRows?"Expanded Rows":"Number of Rows",u=t.displayString(i,"long"),h=t.getColumnIndexByName(e.name);return y("div",{className:"column-statistics",children:[y("div",{className:"column-statistics-title",children:[e.name,y("span",{className:"column-statistics-type",children:["\xA0(",a,")"]}),m(gl,{className:"column-statistics-copy",tooltip:"Copy column name",copy:e.name})]}),c!=null&&m("div",{className:"column-statistics-description",children:c}),h!=null&&!t.isColumnMovable(h)&&y("div",{className:"column-statistics-status",children:[m(te,{icon:t.isColumnFrozen(h)?$a:za,className:"mr-1"}),t.isColumnFrozen(h)?"Frozen":"Not movable"]}),y("div",{className:"column-statistics-grid",children:[o==null&&y(Oe,{children:[m("div",{className:"column-statistic-operation",children:d}),m("div",{className:"column-statistic-value",children:u})]}),l]}),r&&m(z,{kind:"ghost",className:"px-0",onClick:this.handleGenerateStatistics,children:"Generate Stats"}),n!=null&&m("div",{className:"error-message",children:`${n}`}),o&&!s&&m(z,{kind:"ghost",className:"px-0",onClick:this.handleGenerateStatistics,icon:m(te,{icon:qa,className:"mr-1"}),children:"Refresh"}),s&&y("div",{className:"column-statistics-loading",children:[m(dn,{className:"mr-2"}),"Calculating Stats..."]})]})}};let Ol=Ii;Ol.AUTO_GENERATE_LIMIT=1e5;const yo=ie.module("AdvancedFilterCreatorFilterItem");class ji extends F.exports.PureComponent{constructor(t){super(t),this.getCachedIsValid=Re((i,r,l,a)=>{try{return!l||I.makeAdvancedValueFilter(i,r,l,a)!=null}catch{return!1}}),this.handleDelete=this.handleDelete.bind(this),this.handleTypeChange=this.handleTypeChange.bind(this),this.handleValueChange=this.handleValueChange.bind(this),this.typeDropdown=null;const{value:n="",filterTypes:s,selectedType:o=s[0]}=t;this.state={selectedType:o,value:n}}static getLabelForFilter(t,n){try{if(I.isNumberType(t)||I.isCharType(t))return _d(n);if(I.isTextType(t))return Pd(n);if(I.isDateType(t))return Hd(n);if(I.isBooleanType(t))return Vd(n);throw new Error(`Unrecognized column type: ${t}`)}catch(s){return yo.warn(s),""}}componentDidMount(){var t;(t=this.typeDropdown)==null||t.focus()}componentDidUpdate(t){const{value:n,selectedType:s}=this.props;s!==void 0&&t.selectedType!==s&&this.setState({selectedType:s}),n!==void 0&&t.value!==n&&this.setState({value:n})}handleTypeChange(t){const n=t.target.value;yo.debug2("typeChange",n),this.setState({selectedType:n});const{onChange:s}=this.props,{value:o}=this.state;o!=null&&o.length>0&&s(n,o)}handleValueChange(t){yo.debug2("valueChange");const{value:n}=t.target;this.setState({value:n});const{onChange:s}=this.props,{selectedType:o}=this.state;o!=null&&s(o,n)}handleDelete(){yo.debug("delete");const{onDelete:t}=this.props;t()}render(){const{column:t,filterTypes:n,formatter:s}=this.props,{selectedType:o,value:i}=this.state,r=!I.isBooleanType(t.type),l=[],a=this.getCachedIsValid(t,o,i,s.timeZone);for(let c=0;c<n.length;c+=1){const d=n[c],u=ji.getLabelForFilter(t.type,d),h=m("option",{value:d,children:u},d);l.push(h)}return m("div",{className:"advanced-filter-creator-filter-item",children:y("div",{className:"form-row",children:[m("div",{className:"form-group col",children:m("select",{className:"form-control custom-select",value:o,onChange:this.handleTypeChange,ref:c=>{this.typeDropdown=c},children:l})}),r&&m("div",{className:"form-group col",children:m("div",{className:"input-group",children:m("input",{type:"text",className:ee("form-control",{error:!a}),placeholder:"Enter value",value:i,onChange:this.handleValueChange})})}),m("div",{className:"form-group col-1 px-0",children:m(z,{kind:"ghost",className:"w-100 h-100 p-0 m-0",onClick:this.handleDelete,icon:un,tooltip:"Remove Filter"})})]})})}}const Lr=ie.module("AdvancedFilterCreatorSelectValueList"),Ni=class extends F.exports.PureComponent{constructor(e){super(e),this.handleSelect=this.handleSelect.bind(this),this.handleViewportChange=this.handleViewportChange.bind(this),this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.handleTableUpdate=this.handleTableUpdate.bind(this),this.list=null;const{selectedValues:t}=this.props;this.state={itemCount:0,items:[],offset:0,selectedValues:t,isLoading:!0}}static indexOf(e,t){for(let n=0;n<t.length;n+=1){const s=t[n];if(s===e||s!=null&&s.valueOf!=null&&e!=null&&e.valueOf!=null&&s.valueOf()===e.valueOf())return n}return-1}componentDidMount(){const{table:e}=this.props;e&&this.startListening(e)}componentDidUpdate(e){const{filters:t,invertSelection:n,selectedValues:s,table:o}=this.props;e.table!==o&&(e.table&&this.stopListening(e.table),o&&this.startListening(o),this.resetViewport()),e.invertSelection!==n&&this.setState({selectedValues:[]},this.handleSelectionUpdate),e.selectedValues!==s&&this.setState({selectedValues:s},this.handleSelectionUpdate),e.filters!==t&&(o==null||o.applyFilter(t),this.resetViewport())}componentWillUnmount(){const{table:e}=this.props;e&&this.stopListening(e)}handleSelect(e,t){const{invertSelection:n}=this.props;let{selectedValues:s}=this.state;s=[...s];const o=Ni.indexOf(t,s);o>=0?s.splice(o,1):s.push(t);let i=o<0;n&&(i=!i);const{offset:r}=this.state;let{items:l}=this.state;l=[...l];const a=e-r;a>=0&&a<l.length&&(l[a].isSelected=i),this.setState({items:l,selectedValues:s});const{onChange:c}=this.props;c(s,n)}handleViewportChange(e,t){this.updateViewport(e,t)}handleSelectionUpdate(){this.updateItemSelection()}handleTableUpdate(e){const{table:t,formatter:n}=this.props;if(!t)return;const s=e.detail,{offset:o}=s,i=[],r=t.columns[0];for(let a=0;a<s.rows.length;a+=1){const d=s.rows[a].get(r),u=n.getFormattedString(d,r.type,r.name),h=this.isValueSelected(d);i.push({displayValue:u,value:d,isSelected:h})}Lr.debug2("Received table update:",o,i.length);const l=t.size;this.setState({itemCount:l,items:i,offset:o,isLoading:!1})}isValueSelected(e){const{invertSelection:t}=this.props,{selectedValues:n}=this.state,s=Ni.indexOf(e,n);return t?s<0:s>=0}startListening(e){e.addEventListener(E.Table.EVENT_UPDATED,this.handleTableUpdate)}stopListening(e){e.removeEventListener(E.Table.EVENT_UPDATED,this.handleTableUpdate)}resetViewport(){this.list&&this.list.topRow!=null&&this.list.bottomRow!=null&&this.updateViewport(this.list.topRow,this.list.bottomRow,!0)}updateItemSelection(){let{items:e}=this.state;e=[...e];for(let t=0;t<e.length;t+=1){const n=e[t],{value:s}=n;n.isSelected=this.isValueSelected(s)}this.setState({items:e})}updateViewport(e,t,n=!1){const{table:s}=this.props;if(s==null)return;n&&this.setState({isLoading:!0});const o=t-e+1,i=Math.max(0,e-o*3),r=Math.max(i,t+o*3);Lr.debug2("Setting viewport",i,",",r),s.setViewport(i,r)}render(){const{offset:e,isLoading:t,items:n,itemCount:s}=this.state;return y("div",{className:"select-value-list-wrapper",children:[m(Ya,{itemCount:s,items:n,offset:e,onSelect:this.handleSelect,onViewportChange:this.handleViewportChange,ref:o=>{this.list=o}}),m($t,{in:t,timeout:250,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:m("div",{className:"loading-list",children:m(dn,{className:"loading-spinner-large"})})})]})}};let xl=Ni;xl.defaultProps={invertSelection:!0,selectedValues:[],onChange:()=>{}};const kl=class extends F.exports.PureComponent{constructor(e){super(e),this.handleSelectAllClick=this.handleSelectAllClick.bind(this),this.handleClearAllClick=this.handleClearAllClick.bind(this),this.handleListChange=this.handleListChange.bind(this),this.handleSearchChange=this.handleSearchChange.bind(this),this.handleUpdateFilterTimeout=this.handleUpdateFilterTimeout.bind(this);const{invertSelection:t,selectedValues:n}=e;this.state={filters:[],invertSelection:t,selectedValues:n,searchText:""}}componentDidMount(){this.initSearchTable()}componentDidUpdate(e,t){const{invertSelection:n,selectedValues:s,table:o}=this.props;e.table!==o&&this.initSearchTable(),e.invertSelection!==n&&this.setState({invertSelection:n}),e.selectedValues!==s&&this.setState({selectedValues:s});const{table:i,searchText:r}=this.state;i!==t.table&&(t.table!=null&&t.table.close(),i!=null&&this.startUpdateFilterTimer()),r!==t.searchText&&this.startUpdateFilterTimer()}componentWillUnmount(){const{table:e}=this.state;e!=null&&e.close(),this.searchTablePromise=void 0,this.stopUpdateFilterTimer()}getColumnName(){const{table:e}=this.props;return e!=null?e.columns[0].name:""}getDisplayedValuesCount(){const{invertSelection:e,selectedValues:t,table:n}=this.state;return n==null?null:e?n.totalSize-t.length:t.length}getDisplayedValueText(){const e=this.getDisplayedValuesCount(),{table:t}=this.state,{formatter:n}=this.props;if(e!=null&&t!=null){const s=n.getFormattedString(e,"long"),o=n.getFormattedString(t.totalSize,"long");let i="";return e<1e6&&(i="Displaying "),`${i}${s} of ${o}`}return null}initSearchTable(){const{table:e}=this.props;if(e==null)return;const t=e.copy();this.searchTablePromise=t,this.searchTablePromise.then(n=>{this.searchTablePromise===t?(this.setState({table:n}),this.searchTablePromise=void 0):n.close()})}handleListChange(e,t){this.setState({selectedValues:e,invertSelection:t});const{onChange:n}=this.props;n(e,t)}handleSearchChange(e){const t=e.target.value;this.setState({searchText:t})}handleSelectAllClick(){this.resetSelection(!0)}handleClearAllClick(){this.resetSelection(!1)}handleUpdateFilterTimeout(){this.updateFilterTimer=void 0,this.updateTableFilter()}resetSelection(e){const t=[];this.setState({invertSelection:e,selectedValues:t});const{onChange:n}=this.props;n(t,e)}startUpdateFilterTimer(){this.stopUpdateFilterTimer(),this.updateFilterTimer=setTimeout(this.handleUpdateFilterTimeout,kl.searchDebounceTime)}stopUpdateFilterTimer(){this.updateFilterTimer!=null&&(clearTimeout(this.updateFilterTimer),this.updateFilterTimer=void 0)}updateTableFilter(){const{table:e,searchText:t}=this.state,{timeZone:n}=this.props,s=e==null?void 0:e.columns[0],o=[];if(s==null)return;let i;if(t.length>0){let r=null;I.isCharType(s.type)?r=I.makeQuickFilter(s,t):I.isTextType(s.type)?r=I.makeQuickFilter(s,`~${t}`,n):r=I.makeQuickFilter(s,`>=${t}`,n),r!=null?o.push(r):i="Invalid search text"}this.setState({filters:o,error:i})}render(){const{error:e,filters:t,invertSelection:n,selectedValues:s,searchText:o,table:i}=this.state,{formatter:r,showSearch:l}=this.props,a=this.getColumnName(),c=this.getDisplayedValueText(),d=a?`Find ${a}...`:"";return y("div",{className:"advanced-filter-creator-select-value",children:[y("div",{className:l?"form-group":"",children:[m("label",{htmlFor:"advanced-filter-creator-select-value-input",children:"Select Values"}),l&&m("input",{type:"text",className:ee("form-control",{"is-invalid":e!=null}),id:"advanced-filter-creator-select-value-input",placeholder:d,value:o,onChange:this.handleSearchChange})]}),m(xl,{table:i,filters:t,invertSelection:n,selectedValues:s,formatter:r,onChange:this.handleListChange}),y("div",{className:"advanced-filter-creator-select-meta-row",children:[y("div",{children:[m(z,{kind:"ghost",onClick:this.handleSelectAllClick,children:"Select All"}),m(z,{kind:"ghost",onClick:this.handleClearAllClick,children:"Clear"})]}),m($t,{in:c!=null,timeout:250,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:m("div",{className:"row-count-info",children:c})})]})]})}};let Zi=kl;Zi.searchDebounceTime=250;Zi.defaultProps={invertSelection:!0,selectedValues:[],onChange:()=>{},showSearch:!0};const Ls=ie.module("AdvancedFilterCreator"),Yn=class extends F.exports.PureComponent{constructor(e){var r,l;super(e),this.getFilterTypes=Re(a=>I.getFilterTypes(a)),this.handleAddAnd=this.handleAddAnd.bind(this),this.handleAddOr=this.handleAddOr.bind(this),this.handleChangeFilterOperator=this.handleChangeFilterOperator.bind(this),this.handleDone=this.handleDone.bind(this),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleFilterDelete=this.handleFilterDelete.bind(this),this.handleSelectValueChange=this.handleSelectValueChange.bind(this),this.handleReset=this.handleReset.bind(this),this.handleSortDown=this.handleSortDown.bind(this),this.handleSortUp=this.handleSortUp.bind(this),this.handleSubmit=this.handleSubmit.bind(this),this.handleFocusTrapStart=this.handleFocusTrapStart.bind(this),this.handleFocusTrapEnd=this.handleFocusTrapEnd.bind(this),this.handleUpdateTimeout=this.handleUpdateTimeout.bind(this),this.focusTrapContainer=Fe.createRef();const{options:t}=e;let{filterOperators:n,invertSelection:s,selectedValues:o}=t;const i=(l=(r=t.filterItems)==null?void 0:r.map(({selectedType:a,value:c})=>({selectedType:a,value:c,key:Ln()})))!=null?l:[];i.length===0&&i.push(Yn.makeFilterItem()),n==null&&(n=[]),s==null&&(s=!0),o==null&&(o=[]),this.state={filterItems:i,filterOperators:n,invertSelection:s,selectedValues:o,valuesTableError:null,valuesTable:void 0}}static makeFilterItem(){return{key:Ln()}}componentDidMount(){this.initValuesTable()}componentWillUnmount(){this.debounceTimeout!=null&&(clearTimeout(this.debounceTimeout),this.sendUpdate()),this.valuesTablePromise!=null&&this.valuesTablePromise.cancel()}getFilterChangeHandler(e){return this.handleFilterChange.bind(this,e)}getFilterDeleteHandler(e){return this.handleFilterDelete.bind(this,e)}initValuesTable(){const{model:e,column:t}=this.props;if(!e.isValuesTableAvailable){Ls.debug("No values table for this model, just ignore");return}this.valuesTablePromise=I.makeCancelableTablePromise(e.valuesTable(t)),this.valuesTablePromise.then(n=>{const s=n.columns[0].sort().asc();n.applySort([s]),this.setState({valuesTable:n})}).catch(n=>{Ge.isCanceled(n)||(Ls.error("Unable to open values table",n),this.setState({valuesTableError:n}))})}handleFocusTrapEnd(){var e,t;((t=(e=this.focusTrapContainer)==null?void 0:e.current)==null?void 0:t.querySelector("button,select,input,textarea")).focus()}handleFocusTrapStart(){var t,n;const e=(n=(t=this.focusTrapContainer)==null?void 0:t.current)==null?void 0:n.querySelectorAll("button,select,input,textarea");e&&e.length>0&&e[e.length-1].focus()}handleAddAnd(){let{filterItems:e,filterOperators:t}=this.state;e=e.concat(Yn.makeFilterItem()),t=t.concat(Gt.and),this.setState({filterItems:e,filterOperators:t})}handleAddOr(){let{filterItems:e,filterOperators:t}=this.state;e=e.concat(Yn.makeFilterItem()),t=t.concat(Gt.or),this.setState({filterItems:e,filterOperators:t})}handleChangeFilterOperator(e,t){let{filterOperators:n}=this.state;n=[...n],Ld(t),n[e]=t,this.setState({filterOperators:n}),this.startUpdateTimer()}handleFilterChange(e,t,n){let{filterItems:s}=this.state;s=[...s];const{key:o}=s[e];s[e]={key:o,selectedType:t,value:n},this.setState({filterItems:s}),this.startUpdateTimer()}handleFilterDelete(e){let{filterItems:t,filterOperators:n}=this.state;t=[...t],n=[...n],e<t.length&&t.splice(e,1),e<n.length?n.splice(e,1):e===n.length&&n.splice(n.length-1,1),t.length===0&&t.push(Yn.makeFilterItem()),this.setState({filterItems:t,filterOperators:n}),this.startUpdateTimer()}handleSelectValueChange(e,t){this.setState({selectedValues:e,invertSelection:t}),this.startUpdateTimer()}handleReset(){Ls.debug("Resetting Advanced Filter"),this.setState({filterItems:[Yn.makeFilterItem()],filterOperators:[],selectedValues:[],invertSelection:!0}),this.startUpdateTimer()}handleSortDown(e){const t=_n.isModifierKeyDown(e);this.sortTable(I.sortDirection.descending,t)}handleSortUp(e){const t=_n.isModifierKeyDown(e);this.sortTable(I.sortDirection.ascending,t)}handleSubmit(e){Ls.debug("Submitting Advanced Filter"),this.stopUpdateTimer(),this.sendUpdate(),e.preventDefault()}handleDone(e){Ls.debug("Submitting and Closing Advanced Filter"),this.stopUpdateTimer(),this.sendUpdate();const{onDone:t}=this.props;t(),e.preventDefault()}handleUpdateTimeout(){this.debounceTimeout=void 0,this.sendUpdate()}shouldShowAddFilter(){const{filterItems:e}=this.state;if(e.length===0)return!1;const t=e[e.length-1],{selectedType:n,value:s}=t;return n!=null&&n.length>0&&s!=null&&s.length>0}sortTable(e,t=!1){const{column:n,onSortChange:s}=this.props;s(n,e,t)}startUpdateTimer(){this.stopUpdateTimer(),this.debounceTimeout=setTimeout(this.handleUpdateTimeout,Yn.debounceFilterUpdate)}stopUpdateTimer(){this.debounceTimeout!==void 0&&(clearTimeout(this.debounceTimeout),this.debounceTimeout=void 0)}sendUpdate(){const{filterItems:e,filterOperators:t,invertSelection:n,selectedValues:s}=this.state,{column:o,onFilterChange:i,model:r}=this.props,{formatter:l}=r,a=e.filter(({selectedType:h,value:g})=>h!=null&&g!=null&&g!==""),c=t.filter((h,g)=>h!=null&&e[g].selectedType!=null&&e[g].value!=null&&e[g].value!=="").slice(0,a.length-1),d={filterItems:a,filterOperators:c,invertSelection:n,selectedValues:s},u=I.makeAdvancedFilter(o,d,l.timeZone);i(o,u,d)}render(){const{column:e,model:t,sortDirection:n,formatter:s}=this.props,{filterItems:o,filterOperators:i,invertSelection:r,selectedValues:l,valuesTable:a,valuesTableError:c}=this.state,{isValuesTableAvailable:d}=t,u=I.isBooleanType(e.type),h=I.isDateType(e.type),g=this.getFilterTypes(e.type),p=e.type.substring(e.type.lastIndexOf(".")+1),f=[];if(!u&&g.length)for(let S=0;S<o.length;S+=1){const T=o[S],{key:R,selectedType:b,value:v}=T,D=m(ji,{column:e,filterTypes:g,onChange:this.getFilterChangeHandler(S),onDelete:this.getFilterDeleteHandler(S),selectedType:b,value:v,formatter:s},R);if(f.push(D),S<i.length){const N=i[S]===Gt.and,L=y("div",{className:"form-row justify-content-end advanced-filter-creator-filter-operator",children:[m(z,{kind:"ghost",className:ee("filter-operator",{active:N}),onClick:()=>this.handleChangeFilterOperator(S,Gt.and),children:"AND"}),m(z,{kind:"ghost",className:ee("filter-operator",{active:!N}),onClick:()=>this.handleChangeFilterOperator(S,Gt.or),children:"OR"})]},`filterOperator${R}`);f.push(L)}}const C=this.shouldShowAddFilter(),w=y("div",{className:ee("form-row justify-content-end add-filter-item",{hidden:!C}),children:[m("span",{className:"text-muted",children:m(te,{icon:vs})}),m(z,{kind:"ghost",className:"btn-filter-item",onClick:this.handleAddAnd,disabled:!C,tooltip:"Add filter with AND",children:"AND"}),m(z,{kind:"ghost",className:"btn-filter-item",onClick:this.handleAddOr,disabled:!C,tooltip:"Add filter with OR",children:"OR"})]},"addFilterItem");return f.push(w),y("div",{className:"advanced-filter-creator",role:"presentation",children:[m("div",{tabIndex:0,onFocus:this.handleFocusTrapStart}),y("form",{onSubmit:this.handleSubmit,ref:this.focusTrapContainer,children:[y("div",{className:"title-bar",children:[m("h6",{className:"advanced-filter-title",children:"Advanced Filters"}),y("div",{className:"advanced-filter-menu-buttons",children:[m(z,{kind:"ghost",className:ee("sort-operator",{active:n===I.sortDirection.descending}),onClick:this.handleSortDown,icon:fr,tooltip:`Sort ${e.name} Descending`}),m(z,{kind:"ghost",className:ee("sort-operator",{active:n===I.sortDirection.ascending}),onClick:this.handleSortUp,icon:m(te,{icon:fr,rotation:180}),tooltip:`Sort ${e.name} Ascending`})]})]}),m("hr",{}),y("div",{className:"advanced-filter-column-name",children:[e.name,"\xA0",y("span",{className:"column-type",children:["(",p,")"]})]}),f,d&&c==null&&y(Oe,{children:[!u&&m("hr",{}),m("div",{className:"form-group",children:m(Zi,{table:a,onChange:this.handleSelectValueChange,invertSelection:r,selectedValues:l,formatter:s,showSearch:!h,timeZone:s.timeZone})})]}),y("div",{className:"form-row justify-content-end",children:[m(z,{kind:"secondary",className:"mr-2",onClick:this.handleReset,children:"Reset"}),m(z,{kind:"primary",onClick:this.handleDone,children:"Done"})]})]}),m("div",{tabIndex:0,onFocus:this.handleFocusTrapEnd})]})}};let Ji=Yn;Ji.debounceFilterUpdate=250;Ji.defaultProps={options:{filterItems:null,filterOperators:null,invertSelection:!0,selectedValues:[]},sortDirection:null};const Pr=ie.module("Aggregations"),Ku=[Te.SUM,Te.ABS_SUM,Te.MIN,Te.MAX,Te.VAR,Te.AVG,Te.STD,Te.FIRST,Te.LAST,Te.COUNT_DISTINCT,Te.DISTINCT,Te.COUNT,Te.UNIQUE];function Qu({isRollup:e,settings:t,onChange:n,onEdit:s}){const{aggregations:o,showOnTop:i}=t,r=F.exports.useMemo(()=>Ku.filter(N=>!o.some(L=>L.operation===N)),[o]),[l,a]=F.exports.useState(r[0]),[c,d]=F.exports.useState([]),u=F.exports.useCallback(N=>{n({...t,...N})},[n,t]),h=F.exports.useCallback(N=>{u({aggregations:N})},[u]),g=F.exports.useCallback(N=>{u({showOnTop:N})},[u]),p=F.exports.useCallback(()=>{Pr.debug("handleDragStart"),dt.startDragging()},[]),f=F.exports.useCallback(({destination:N,source:L})=>{if(Pr.debug("handleDragEnd",N,L),dt.stopDragging(),N===null)return;let k=N.index;L.index<N.index&&(k+=1);const x=[...o],W=dt.reorder(x,c,x,k),V=dt.adjustDestinationIndex(k,c),K=[[V,V+W.length-1]];h(x),d(K)},[h,o,c,d]),C=F.exports.useCallback(N=>{a(N)},[a]),w=F.exports.useCallback(()=>{h([...o,{operation:l,selected:[],invert:!0}])},[o,l,h]),S=F.exports.useCallback(N=>{h(o.filter((L,k)=>k!==N))},[o,h]),T=F.exports.useCallback(N=>{d(N)},[d]),R=F.exports.useCallback(N=>{const L=o[N];On.isRollupOperation(L.operation)||s(L)},[o,s]),b=F.exports.useCallback(N=>{g(N.target.value==="true")},[g]);F.exports.useEffect(function(){r.length>0&&!r.includes(l)&&a(r[0])},[r,l]);const v=F.exports.useCallback(({item:N,itemIndex:L,isClone:k=!1,selectedCount:x})=>{const W=N.operation,V=k?`${x}`:void 0,K=k?"item-list-item-clone":void 0,Z=On.isRollupOperation(N.operation),$=!k&&!Z;return y(Oe,{children:[y("div",{className:ee("item-list-item-content","draggable-item-list-item-content",K),children:[y("span",{className:"title",children:[W,!e&&Z&&y("span",{className:"small text-warning",children:[m(te,{icon:al})," Requires rollup"]})]}),Dt.renderBadge({text:V}),Dt.renderHandle()]}),!k&&y(Oe,{children:[m(z,{kind:"ghost",className:"btn-edit",icon:Pi,tooltip:"Edit Columns",onClick:()=>s(N),disabled:!$}),m(z,{kind:"ghost",className:"btn-delete",icon:un,tooltip:"Delete Aggregation",onClick:()=>S(L)})]})]})},[S,s,e]),D=r.length>0,A=o.length>0;return y("div",{className:"aggregations",children:[D&&y("div",{className:"form-inline",children:[m(ed,{onChange:C,value:l,children:r.map(N=>m(Jc,{value:N,children:N},N))}),y("button",{type:"button",className:"btn btn-link btn-add",onClick:w,children:[m(te,{icon:vs}),"Add Aggregation"]})]}),D&&A&&m("hr",{}),A&&y(Oe,{children:[!e&&y("div",{className:"form-inline",children:[m("label",{children:"Placement:\xA0"}),y(zi,{onChange:b,value:`${i}`,children:[m(Zn,{value:"true",children:"Top"}),m(Zn,{value:"false",children:"Bottom"})]})]}),m($o,{onDragStart:p,onDragEnd:f,children:m(Dt,{className:"selected-aggregations",itemCount:o.length,items:o,renderItem:v,offset:0,onSelectionChange:T,onSelect:R,selectedRanges:c,isMultiSelect:!0})})]})]})}const ju=30;function Zu({aggregation:e,columns:t,onChange:n}){const[s,o]=F.exports.useState(-1),[i,r]=F.exports.useState(-1),[l,a]=F.exports.useState(0),{invert:c,selected:d}=e,u=F.exports.useRef(null),h=F.exports.useCallback(b=>d.includes(b)?!c:c,[c,d]),g=F.exports.useMemo(()=>{let b=Qi(t,e.operation);return l!==0&&(b=I.sortColumns(b,l===1)),b},[t,e.operation,l]),p=F.exports.useMemo(()=>s>=0?g.slice(s,i+1).map(b=>({value:b.name,displayValue:b.name,isSelected:h(b.name)})):[],[g,h,i,s]),f=F.exports.useCallback(b=>{const{name:v}=g[b],D=d.indexOf(v);let A=[...d],N=c;D>=0?A.splice(D,1):(A.push(v),A.length===g.length&&(A=[],N=!c)),n({...e,selected:A,invert:N})},[e,c,g,d,n]),C=F.exports.useCallback(()=>{a(0),n({...e,selected:[],invert:!0})},[e,n]),w=F.exports.useCallback((b,v)=>{o(b),r(v)},[o,r]),S=F.exports.useCallback(()=>{d.length===0?n({...e,invert:!c}):n({...e,selected:[],invert:!0})},[e,c,n,d]),T=d.length===0?c:null,R=d.length!==0||!c||l!==0;return y("div",{role:"menu",className:"aggregation-edit",children:[m("div",{className:"top-menu",children:y("div",{className:"form-inline",children:[m(ln,{checked:T,onChange:S,children:"Toggle All"}),m("div",{className:"spacer"}),m($t,{in:R,timeout:Ue.transitionSlowMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:m(z,{kind:"ghost",className:"btn-reset",onClick:C,children:"Reset"})}),m(z,{kind:"ghost",className:ee({active:l===1}),icon:_i,tooltip:"Sort ascending",onClick:()=>a(1)}),m(z,{kind:"ghost",className:ee({active:l===2}),icon:Hi,tooltip:"Sort descending",onClick:()=>a(2)})]})}),m("div",{className:"aggregation-edit-item-list",children:m(xo,{itemCount:g.length,items:p,offset:s,renderItem:({item:b})=>m(ln,{checked:h(b.value),children:b.displayValue}),onSelect:f,onViewportChange:w,rowHeight:ju,focusSelector:"input",ref:u})})]})}function Ju(e){return m("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...e,children:y("g",{fill:"none",fillRule:"evenodd",children:[m("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),m("path",{fill:"#7DA4FF",d:"M8 26h4v15H8zM15 17h4v24h-4zM22 21h4v20h-4zM29 17h4v24h-4zM36 11h4v30h-4z"})]})})}function eh(e){return m("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...e,children:y("g",{fill:"none",fillRule:"evenodd",children:[m("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),m("path",{fill:"#7DA4FF",d:"M7 34h4v8H7zM12 31h4v11h-4zM17 27h4v15h-4zM22 22h4v20h-4zM27 27h4v15h-4zM32 29h4v13h-4zM37 31h4v11h-4z"})]})})}function th(e){return m("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...e,children:y("g",{fill:"none",fillRule:"evenodd",children:[m("path",{fill:"#C1C0C0",d:"M4 4h1v40H4zM44 43v1H5v-1z"}),m("path",{stroke:"#7DA4FF",d:"M7.984 32.44l7.982-11.378 5.273 3.739 9.952-10.838 2.826 1.894 7.45-5.802"}),m("path",{stroke:"#BECDEF",d:"M8.244 37.926L17 33.496l5 .87 10.637-10.35 10.615-1.381"})]})})}function nh(e){return m("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...e,children:y("g",{fill:"none",fillRule:"evenodd",children:[m("path",{d:"M24 10c7.732 0 14 6.268 14 14s-6.268 14-14 14-14-6.268-14-14h14V10z",fill:"#80A6FF"}),m("path",{d:"M10 24c0-7.732 6.268-14 14-14v14H10z",fill:"#C1C0C0"})]})})}function sh(e){return m("svg",{width:48,height:48,xmlns:"http://www.w3.org/2000/svg",...e,children:y("g",{fill:"none",fillRule:"evenodd",children:[m("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),m("path",{fill:"#939293",d:"M44 34v1H4v-1zM44 25v1H4v-1zM44 16v1H4v-1z"}),m("circle",{fill:"#7DA4FF",cx:9.5,cy:37.5,r:1.5}),m("circle",{fill:"#7DA4FF",cx:16.5,cy:30.5,r:1.5}),m("circle",{fill:"#7DA4FF",cx:22.5,cy:36.5,r:1.5}),m("circle",{fill:"#7DA4FF",cx:28.5,cy:30.5,r:1.5}),m("circle",{fill:"#7DA4FF",cx:15.5,cy:38.5,r:1.5}),m("circle",{fill:"#7DA4FF",cx:23.5,cy:25.5,r:1.5}),m("circle",{fill:"#7DA4FF",cx:19.5,cy:19.5,r:1.5}),m("circle",{fill:"#7DA4FF",cx:29.5,cy:19.5,r:1.5}),m("circle",{fill:"#7DA4FF",cx:32.5,cy:26.5,r:1.5}),m("circle",{fill:"#7DA4FF",cx:36.5,cy:13.5,r:1.5})]})})}function oh(e){return y("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[m("rect",{width:"48",height:"48",fill:"none"}),m("rect",{x:"26",y:"10",width:"15",height:"4",fill:"#9FDE70"}),m("rect",{x:"26",y:"22",width:"15",height:"4",fill:"#9FDE70"}),m("rect",{x:"26",y:"28",width:"15",height:"4",fill:"#FFD95C"}),m("rect",{x:"26",y:"34",width:"15",height:"4",fill:"#9FDE70"})]})}function ih(e){return y("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[m("rect",{width:"48",height:"48",fill:"none"}),m("rect",{x:"4",y:"16",width:"40",height:"4",fill:"#FFD95C"}),m("rect",{x:"4",y:"10",width:"40",height:"4",fill:"#78DCE8"}),m("rect",{x:"4",y:"34",width:"40",height:"4",fill:"#78DCE8"})]})}const _r=ie.module("ChartBuilder"),qe=class extends F.exports.PureComponent{static getTypeName(e){switch(e){case E.plot.SeriesPlotStyle.LINE:return"Line";case E.plot.SeriesPlotStyle.BAR:return"Bar";case E.plot.SeriesPlotStyle.SCATTER:return"Scatter";case E.plot.SeriesPlotStyle.PIE:return"Pie";case E.plot.SeriesPlotStyle.HISTOGRAM:return"Histogram";default:return e}}static getTypeIcon(e){switch(e){case E.plot.SeriesPlotStyle.LINE:return m(th,{});case E.plot.SeriesPlotStyle.BAR:return m(Ju,{});case E.plot.SeriesPlotStyle.SCATTER:return m(sh,{});case E.plot.SeriesPlotStyle.PIE:return m(nh,{});case E.plot.SeriesPlotStyle.HISTOGRAM:return m(eh,{});default:return null}}static getMaxSeriesCount(e){switch(e){case E.plot.SeriesPlotStyle.PIE:return 1;case E.plot.SeriesPlotStyle.HISTOGRAM:return 0;default:return 100}}static getXAxisLabel(e){switch(e){case E.plot.SeriesPlotStyle.PIE:return"Labels";case E.plot.SeriesPlotStyle.HISTOGRAM:return"Data";default:return"X-Axis"}}static getSeriesLabel(e){switch(e){case E.plot.SeriesPlotStyle.PIE:return"Values";default:return"Series"}}static makeSeriesItem(e){return{id:Ln.generate(),value:e}}static makeDefaultSeriesItems(e,t){if(qe.getMaxSeriesCount(e)===0||t==null||t.length===0)return[];const s=t.length>1?t[1].name:t[0].name;return[qe.makeSeriesItem(s)]}static getDefaultXAxis(e,t){return t!=null&&t.length>0?t[0].name:null}constructor(e){super(e),this.handleAddSeries=this.handleAddSeries.bind(this),this.handleLinkStateChange=this.handleLinkStateChange.bind(this),this.handleReset=this.handleReset.bind(this),this.handleSeriesChange=this.handleSeriesChange.bind(this),this.handleSeriesDeleteClick=this.handleSeriesDeleteClick.bind(this),this.handleSubmit=this.handleSubmit.bind(this),this.handleTypeClick=this.handleTypeClick.bind(this),this.handleXAxisChange=this.handleXAxisChange.bind(this),this.sendChange=this.sendChange.bind(this);const{model:t}=e,{columns:n}=t,s=qe.types[0],o=qe.getDefaultXAxis(s,n),i=qe.makeDefaultSeriesItems(s,n);this.state={type:s,seriesItems:i,xAxis:o,isLinked:!0}}handleAddSeries(){this.setState(e=>{const{seriesItems:t}=e,n=[...t],{model:s}=this.props,{columns:o}=s;return n.push({id:Ln.generate(),value:o[0].name}),{seriesItems:n}},this.sendChange)}handleLinkStateChange(e){this.setState({isLinked:e.target.value==="true"},this.sendChange)}handleReset(){const{model:e}=this.props,{columns:t}=e,n=qe.types[0],s=qe.getDefaultXAxis(n,t),o=qe.makeDefaultSeriesItems(n,t),i=!0;this.setState({type:n,seriesItems:o,xAxis:s,isLinked:i},this.sendChange)}handleSeriesChange(e){const{value:t}=e.target,n=e.target.getAttribute("data-index"),s=parseInt(n,10);this.setState(o=>{let{seriesItems:i}=o;return i=[...i],i[s].value=t,{seriesItems:i}},this.sendChange)}handleSeriesDeleteClick(e){const n=e.target.getAttribute("data-index"),s=parseInt(n,10);this.setState(o=>{const{seriesItems:i}=o,r=[...i];return r.splice(s,1),{seriesItems:r}},this.sendChange)}handleSubmit(e){e.preventDefault();const{onSubmit:t}=this.props,{type:n,seriesItems:s,xAxis:o,isLinked:i}=this.state,r=s.map(l=>l.value);t({type:`${n}`,series:r,xAxis:o,isLinked:i})}handleTypeClick(e){const n=e.target.getAttribute("data-index"),s=parseInt(n,10),o=qe.types[s];_r.debug2("handleTypeSelect",o),this.setState(i=>{const r=qe.getMaxSeriesCount(o);let{seriesItems:l}=i;if(l=l.slice(0,r),l.length===0&&r>0){const{model:a}=this.props,{columns:c}=a;l=qe.makeDefaultSeriesItems(o,c)}return{type:o,seriesItems:l}},this.sendChange)}handleXAxisChange(e){const t=e.target.value;_r.debug2("x-axis change",t),this.setState({xAxis:t},this.sendChange)}sendChange(){const{onChange:e}=this.props,{isLinked:t,type:n,seriesItems:s,xAxis:o}=this.state,i=s.map(r=>r.value);e({type:n,series:i,xAxis:o,isLinked:t})}render(){const{model:e}=this.props,{columns:t}=e,{seriesItems:n,type:s,xAxis:o,isLinked:i}=this.state,r=qe.getMaxSeriesCount(s),l=qe.getXAxisLabel(s),a=qe.getSeriesLabel(s),c=n.length>0,d=n.length<r;return m("div",{className:"chart-builder",children:y("form",{onSubmit:this.handleSubmit,children:[y("div",{className:"form-row",children:[m("label",{children:"Select Chart Type"}),m("div",{className:"form-row",children:qe.types.map((u,h)=>{const g=u;return m("div",{className:"col col-chart-type",children:y("button",{type:"button",className:ee("btn","btn-icon","btn-chart-type",{active:u===s}),"data-index":h,onClick:this.handleTypeClick,children:[qe.getTypeIcon(u),qe.getTypeName(u)]})},g)})})]}),m("hr",{}),y("div",{className:"form-row form-inline",children:[m("label",{className:"col-2 label-left",children:l}),m("select",{className:"form-control custom-select select-x-axis col",value:o,onChange:this.handleXAxisChange,children:t.map(u=>m("option",{value:u.name,children:u.name},u.name))})]}),c&&m("hr",{}),n.map((u,h)=>y("div",{className:"form-row form-inline form-series-item","data-testid":`form-series-item-${h}`,children:[m("label",{className:"col-2 label-left",children:h===0?a:""}),m("select",{className:"form-control custom-select select-series col",value:u.value,onChange:this.handleSeriesChange,"data-testid":`select-series-item-${h}`,"data-index":h,children:t.map(g=>m("option",{value:g.name,"data-index":h,children:g.name},g.name))}),n.length>1&&m(z,{kind:"ghost",className:"btn-delete-series ml-2 px-2","data-index":h,"data-testid":`delete-series-${h}`,onClick:this.handleSeriesDeleteClick,icon:un,tooltip:"Delete"})]},u.id)),d&&y("div",{className:"form-row",children:[m("div",{className:"col-2"}),m(z,{kind:"ghost",className:"btn-add-series mt-1",onClick:this.handleAddSeries,icon:vs,children:"Add Series"})]}),y("div",{className:"form-row chart-builder-link",children:[m("label",{className:"col-2 label-right",children:y("div",{className:"fa-md fa-layers",children:[m(te,{mask:Vi,icon:qo,transform:"right-5 down-5"}),m(te,{icon:i?Xa:Ka,transform:"grow-2 right-8 down-6"})]})}),y(zi,{onChange:this.handleLinkStateChange,value:`${i}`,children:[m(Zn,{value:"true",children:"Sync State"}),m(Zn,{value:"false",children:"Freeze State"})]})]}),y("div",{className:"form-row",children:[m("div",{className:"col-2 label-right"}),m("div",{className:"col chart-builder-link-info",children:i?"Charts with synced state will update to match any filters or user modifications applied to the parent table.":"Freeze State disconnects the chart state from the parent table. New filters or user modifications on the parent table will not be applied."})]}),y("div",{className:ee("form-row","justify-content-end","my-3"),children:[m(z,{kind:"secondary",className:"btn-reset",onClick:this.handleReset,children:"Reset"}),m(z,{kind:"primary",type:"submit",className:"btn-submit",children:"Create"})]})]})})}};let Ll=qe;Ll.types=[E.plot.SeriesPlotStyle.LINE,E.plot.SeriesPlotStyle.BAR,E.plot.SeriesPlotStyle.SCATTER,E.plot.SeriesPlotStyle.PIE];class Pl extends F.exports.Component{constructor(t){super(t),this.handleContentChanged=this.handleContentChanged.bind(this),this.handleEditorFocus=this.handleEditorFocus.bind(this),this.handleEditorBlur=this.handleEditorBlur.bind(this),this.handleContainerClick=this.handleContainerClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.state={isEditorFocused:!1,isEditorEmpty:!0},this.editorContainer=null}componentDidMount(){this.initEditor()}componentWillUnmount(){this.destroyEditor()}initEditor(){var o;const{value:t,editorSettings:n}=this.props,s={copyWithSyntaxHighlighting:"false",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"groovyDB",lineDecorationsWidth:8,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},scrollBeyondLastLine:!1,padding:{top:6,bottom:6},tabCompletion:"off",useTabStops:!0,value:t,wordWrap:"on",automaticLayout:!0,...n};if(!this.editorContainer)throw new Error("editorContainer is null");this.editor=an.create(this.editorContainer,s),this.editor.layout(),(o=this.editor.getModel())==null||o.updateOptions({tabSize:0}),this.editor.onKeyDown(this.handleKeyDown),this.editor.onDidChangeModelContent(this.handleContentChanged),this.editor.onDidFocusEditorText(this.handleEditorFocus),this.editor.onDidBlurEditorText(this.handleEditorBlur)}destroyEditor(){var t;(t=this.editor)==null||t.dispose(),this.editor=void 0}handleContentChanged(){var s,o;const{onContentChanged:t}=this.props,n=(o=(s=this.editor)==null?void 0:s.getModel())==null?void 0:o.getValue();n!==void 0&&this.setState({isEditorEmpty:n.length===0}),t(n)}handleEditorFocus(){this.setState({isEditorFocused:!0})}handleEditorBlur(){var n,s,o;const t=(o=(s=(n=this.editor)==null?void 0:n.getModel())==null?void 0:s.getValue())!=null?o:"";this.setState({isEditorEmpty:t.length===0,isEditorFocused:!1})}handleContainerClick(){var n;const{isEditorFocused:t}=this.state;t||(n=this.editor)==null||n.focus()}handleKeyDown(t){const{onTab:n,editorIndex:s}=this.props;t.code==="Tab"&&(t.stopPropagation(),t.preventDefault(),n(s,t.shiftKey))}render(){const{value:t,invalid:n}=this.props,{isEditorFocused:s,isEditorEmpty:o}=this.state;return y("div",{className:ee("input-editor-wrapper",{focused:s,invalid:n}),role:"presentation",onClick:this.handleContainerClick,children:[m("div",{className:"editor-container",ref:i=>{this.editorContainer=i}}),o&&!t&&m("div",{className:"editor-placeholder text-muted",children:"Column Formula"})]})}}Pl.defaultProps={value:"",onContentChanged:()=>{},editorSettings:{},editorIndex:0,onTab:()=>{},invalid:!1};const Hr=Object.freeze({NAME:"name",FORMULA:"formula"}),rh=()=>{};function lh({eventKey:e,name:t,inputIndex:n,formula:s,onChange:o,onDeleteColumn:i,onTabInEditor:r,invalid:l,isDuplicate:a}){const c=t===""||Ys.isValidColumnName(t),d=F.exports.useCallback(u=>{u!==void 0&&(u.replace(/(\r\n|\n|\r)/gm,""),o(e,Hr.FORMULA,u))},[o,e]);return m(sl,{draggableId:e,index:n,disableInteractiveElementBlocking:!0,children:(u,h)=>y("div",{className:ee("draggable-container",{dragging:h.isDragging}),ref:u.innerRef,...u.draggableProps,children:[y("div",{className:"custom-column-input-container",children:[y("div",{className:"pb-3",children:[y("div",{className:"d-flex flex-row custom-column-name",children:[m("input",{className:ee("form-control custom-column-input",{"is-invalid":l||!c||a}),placeholder:"Column Name",value:t,onChange:g=>{o(e,Hr.NAME,g.target.value)}}),m(z,{kind:"ghost",className:"ml-1 px-2",onClick:()=>{i(e)},icon:un,tooltip:"Delete custom column"}),m(z,{kind:"ghost",className:"btn-drag-handle",onClick:rh,...u.dragHandleProps,icon:Ui,tooltip:"Drag column to re-order"})]}),(!c||a)&&m("p",{className:"validate-label-error text-danger mb-0 mt-2 pl-1",children:c?"Duplicate name":"Invalid name"})]}),m(Pl,{editorSettings:{language:"deephavenDb"},editorIndex:n,value:s,onContentChanged:d,onTab:r,invalid:l})]}),m("hr",{})]})})}const Ci=[];class ce extends bl{constructor(){super(),this.listenerCount=0}addEventListener(t,n,s){super.addEventListener(t,n,s),this.listenerCount+=1,this.listenerCount===1&&this.startListening()}removeEventListener(t,n,s){super.removeEventListener(t,n,s),this.listenerCount-=1,this.listenerCount===0&&this.stopListening()}startListening(){}stopListening(){}get originalColumns(){return this.columns}get layoutHints(){return null}get frontColumns(){return Ci}get backColumns(){return Ci}get frozenColumns(){return Ci}isColumnFrozen(t){return!1}get isFilterRequired(){return!1}get isReversible(){return!0}get isColumnStatisticsAvailable(){return!1}get description(){return""}get isCustomColumnsAvailable(){return!1}get isFormatColumnsAvailable(){return!1}get isExportAvailable(){return!1}get isValuesTableAvailable(){return!1}get isChartBuilderAvailable(){return!1}get isRollupAvailable(){return!1}get isSelectDistinctAvailable(){return!1}get isTotalsAvailable(){return!1}isFilterable(t){return!1}close(){}isRowMovable(){return!1}get isSeekRowAvailable(){return!1}}ce.EVENT=Object.freeze({UPDATED:"UPDATED",FORMATTER_UPDATED:"FORMATTER_UPDATED",REQUEST_FAILED:"REQUEST_FAILED",COLUMNS_CHANGED:"COLUMNS_CHANGED",TABLE_CHANGED:"TABLE_CHANGED",FILTERS_CHANGED:"FILTERS_CHANGED",SORTS_CHANGED:"SORTS_CHANGED",DISCONNECT:"DISCONNECT",RECONNECT:"RECONNECT",TOTALS_UPDATED:"TOTALS_UPDATED",PENDING_DATA_UPDATED:"PENDING_DATA_UPDATED"});const fs=class extends F.exports.Component{constructor(e){super(e),this.getInput=Re((t,n)=>t.find(s=>s.eventKey===n)),this.getInputIndex=Re((t,n)=>t.findIndex(s=>s.eventKey===n)),this.handleAddColumnClick=this.handleAddColumnClick.bind(this),this.handleSaveClick=this.handleSaveClick.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleDeleteColumn=this.handleDeleteColumn.bind(this),this.handleCustomColumnUpdated=this.handleCustomColumnUpdated.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.resetRequestFailed=this.resetRequestFailed.bind(this),this.handleEditorTabNavigation=this.handleEditorTabNavigation.bind(this),this.state={inputs:[],isCustomColumnApplying:!1,errorMessage:null,hasRequestFailed:!1,isSuccessShowing:!1},this.container=null,this.successButtonTimer=null}static makeCustomColumnInputEventKey(){return Ln.generate()}static createCustomColumnInput(){return{eventKey:Ln.generate(),name:"",formula:""}}componentDidMount(){const{customColumns:e}=this.props;this.parseCustomColumns(e),this.startListening()}componentWillUnmount(){this.stopListening(),this.successButtonTimer&&clearTimeout(this.successButtonTimer)}resetErrorMessage(){this.setState({errorMessage:null})}startListening(){const{model:e}=this.props;e.addEventListener(ce.EVENT.COLUMNS_CHANGED,this.handleCustomColumnUpdated),e.addEventListener(ce.EVENT.UPDATED,this.handleCustomColumnUpdated),e.addEventListener(ce.EVENT.REQUEST_FAILED,this.handleRequestFailed)}stopListening(){const{model:e}=this.props;e.removeEventListener(ce.EVENT.COLUMNS_CHANGED,this.handleCustomColumnUpdated),e.removeEventListener(ce.EVENT.UPDATED,this.handleCustomColumnUpdated),e.removeEventListener(ce.EVENT.REQUEST_FAILED,this.handleRequestFailed)}parseCustomColumns(e){if(e.length>0){const t=e.map(n=>{const s=n.split(/=(.+)/,2);return{eventKey:fs.makeCustomColumnInputEventKey(),name:s[0],formula:s[1]}});this.setState({inputs:t})}else this.setState({inputs:[fs.createCustomColumnInput()]})}handleAddColumnClick(){const{inputs:e}=this.state,t=[...e];t.push(fs.createCustomColumnInput()),this.setState({inputs:t})}handleDeleteColumn(e){const{inputs:t}=this.state,n=this.getInputIndex(t,e),s=[...t];s.splice(n,1),s.length===0&&s.push(fs.createCustomColumnInput()),this.setState({inputs:s})}handleInputChange(e,t,n){const{inputs:s}=this.state,o=this.getInputIndex(s,e),r={...this.getInput(s,e)};r[t]=n;const l=[...s];l.splice(o,1,r),this.setState({inputs:l})}handleCustomColumnUpdated(){const{isCustomColumnApplying:e}=this.state;!e||this.setState({isCustomColumnApplying:!1,isSuccessShowing:!0},()=>{this.successButtonTimer=setTimeout(()=>this.setState({isSuccessShowing:!1}),fs.SUCCESS_SHOW_DURATION)})}handleRequestFailed(e){const t=e,{isCustomColumnApplying:n}=this.state;!n||this.setState({isCustomColumnApplying:!1,errorMessage:y(Oe,{children:[y("p",{children:[m(te,{icon:Qn})," Failed to apply custom columns."]}),y("div",{className:"error-box",children:[t.detail.errorMessage,m("br",{}),"Table configuration:"," ",JSON.stringify(t.detail.configuration)]})]}),hasRequestFailed:!0})}handleDragEnd(e){if(dt.stopDragging(),!e.destination)return;const{inputs:t}=this.state,n=e.source.index,s=e.destination.index,o=[...t],i=t[n];o.splice(n,1),o.splice(s,0,i),this.setState({inputs:o})}handleEditorTabNavigation(e,t){var s,o,i,r;const{inputs:n}=this.state;if(t){((s=this.container)==null?void 0:s.querySelectorAll(".btn-drag-handle")[e]).focus();return}if(e===n.length-1)(i=(o=this.container)==null?void 0:o.querySelector(".btn-add-column"))==null||i.focus();else{const l=e+1;((r=this.container)==null?void 0:r.querySelectorAll(".custom-column-input")[l]).focus()}}handleSaveClick(){const{onSave:e,customColumns:t}=this.props,{inputs:n,isCustomColumnApplying:s}=this.state;if(s)return;const o=[];n.forEach(i=>{const{name:r,formula:l}=i;r&&l&&o.push(`${r}=${l}`)}),this.resetErrorMessage(),this.setState({isCustomColumnApplying:o.length>0||t.length>0}),e(o)}resetRequestFailed(){this.setState(({hasRequestFailed:e})=>e?{hasRequestFailed:!1}:null)}renderInputs(){const{inputs:e,hasRequestFailed:t}=this.state,n=new Map;return e.forEach(({name:s})=>{var o;return n.set(s,((o=n.get(s))!=null?o:0)+1)}),e.map((s,o)=>{var c;const{eventKey:i,name:r,formula:l}=s,a=((c=n.get(r))!=null?c:0)>1;return m(lh,{inputIndex:o,eventKey:i,name:r,formula:l,onChange:this.handleInputChange,onDeleteColumn:this.handleDeleteColumn,onTabInEditor:this.handleEditorTabNavigation,invalid:t,isDuplicate:a},i)})}renderSaveButton(){const{inputs:e,isCustomColumnApplying:t,isSuccessShowing:n}=this.state,s=e.length>1?"Save Columns":"Save Column",o=e.every(({name:l})=>l===""||Ys.isValidColumnName(l)),i=e.filter(({name:l})=>l!=="").map(({name:l})=>l),r=new Set(i).size===i.length;return y(z,{kind:n?"success":"primary",className:ee("btn-apply",{"btn-spinner":t}),disabled:n||t||!o||!r,onClick:this.handleSaveClick,children:[t&&y("span",{children:[m(dn,{}),m("span",{className:"btn-normal-content",children:"Applying"})]}),!n&&!t&&s,n&&y(Oe,{children:[m(te,{icon:rl})," Success"]})]})}render(){const{onCancel:e}=this.props,{errorMessage:t}=this.state;return y("div",{role:"presentation",className:"custom-column-builder-container",ref:n=>{this.container=n},onClick:this.resetRequestFailed,onFocus:this.resetRequestFailed,children:[m("hr",{}),m($o,{onDragStart:dt.startDragging,onDragEnd:this.handleDragEnd,children:m(Oi,{droppableId:"droppable-custom-columns",children:(n,s)=>y("div",{ref:n.innerRef,...n.droppableProps,className:ee("droppable-container",{dragging:s.draggingFromThisWith}),children:[this.renderInputs(),n.placeholder]})})}),m("div",{className:"pt-1 px-3",children:m(z,{kind:"ghost",className:"btn-add-column",onClick:this.handleAddColumnClick,icon:vs,children:"Add Another Column"})}),y("div",{className:"custom-column-builder-footer",children:[t&&m("div",{className:"error-message",children:t}),y("div",{className:"d-flex justify-content-end",children:[m(z,{kind:"secondary",className:"mr-2",onClick:e,children:"Cancel"}),this.renderSaveButton()]})]})]})}};let _l=fs;_l.SUCCESS_SHOW_DURATION=750;var Se=(e=>(e.ADVANCED_SETTINGS="ADVANCED_SETTINGS",e.AGGREGATIONS="AGGREGATIONS",e.AGGREGATION_EDIT="AGGREGATIONS_EDIT",e.CHART_BUILDER="CHART_BUILDER",e.CUSTOM_COLUMN_BUILDER="CUSTOM_COLUMN_BUILDER",e.QUICK_FILTERS="QUICK_FILTERS",e.ROLLUP_ROWS="ROLLUP_ROWS",e.SEARCH_BAR="SEARCH_BAR",e.SELECT_DISTINCT="SELECT_DISTINCT",e.TABLE_EXPORTER="TABLE_EXPORTER",e.VISIBILITY_ORDERING_BUILDER="VISIBILITY_ORDERING_BUILDER",e.CONDITIONAL_FORMATTING="CONDITIONAL_FORMATTING",e.CONDITIONAL_FORMATTING_EDIT="CONDITIONAL_FORMATTING_EDIT",e.GOTO="GOTO",e))(Se||{});const Ps=ie.module("RollupRows"),ah=150,Fo="grouped-rollup-rows",Do="ungrouped-rollup-rows",yt=class extends F.exports.Component{constructor(e){super(e),this.search=vt(i=>{const r=this.getSortedUngroupedColumns(),l=[];let a=null;for(let c=0;c<r.length;c+=1)r[c].name.toLowerCase().includes(i.toLowerCase())&&(a==null&&(a=c),l.push([c,c]));M(a),this.setState({ungroupedSelectedRanges:l}),l.length>0&&this.ungroupedList.current&&this.ungroupedList.current.scrollToItem(a)},ah),this.getCachedUngroupedColumns=be((i,r)=>i.filter(l=>yt.isGroupable(l)&&r.find(a=>a===l.name)==null)),this.getCachedSortedColumns=be((i,r)=>r==null?[...i]:I.sortColumns(i,r===yt.SORT.ASCENDING)),this.handleDeleteClicked=this.handleDeleteClicked.bind(this),this.handleSearchChange=this.handleSearchChange.bind(this),this.handleUngroupedSelect=this.handleUngroupedSelect.bind(this),this.handleUngroupedSelectionChange=this.handleUngroupedSelectionChange.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleGroupedSelectionChange=this.handleGroupedSelectionChange.bind(this),this.handleShowConstituentsChange=this.handleShowConstituentsChange.bind(this),this.handleShowNonAggregatedColumnsChange=this.handleShowNonAggregatedColumnsChange.bind(this),this.handleSortAscending=this.handleSortAscending.bind(this),this.handleSortDescending=this.handleSortDescending.bind(this),this.renderGroupedItem=this.renderGroupedItem.bind(this),this.ungroupedList=Fe.createRef(),this.groupedList=Fe.createRef();const{config:t}=e,{columns:n=[],showConstituents:s=!0,showNonAggregatedColumns:o=!0}=t!=null?t:{};this.state={ungroupedSelectedRanges:[],columns:n,groupedSelectedRanges:[],searchFilter:"",showConstituents:s,showNonAggregatedColumns:o,dragSource:null,sort:null}}static renderColumn({item:e,isClone:t,selectedCount:n}){const s=e==null?void 0:e.name,o=t!==void 0&&t?`${n}`:void 0,i=t!==void 0&&t?"item-list-item-clone":"";return Dt.renderTextItem({text:s,badgeText:o,className:i})}static addGroupings(e,t,n=e.length){if(t==null||t.length===0)return e;let s=n;const o=e.filter((i,r)=>t.includes(i)?(r<s&&(s-=1),!1):!0);return o.splice(s,0,...t),o}static isGroupable(e){return!I.isDecimalType(e.type)}componentDidUpdate(e,t){const{config:n}=this.props,{columns:s,showConstituents:o,showNonAggregatedColumns:i}=this.state;n!==e.config?this.updateFromConfig():(s!==t.columns||o!==t.showConstituents||i!==t.showNonAggregatedColumns)&&(n==null||s!==n.columns||o!==n.showConstituents||i!==n.showNonAggregatedColumns)&&this.sendChange()}componentWillUnmount(){this.search.cancel()}handleSearchChange(e){const t=e.target.value;if(this.setState({searchFilter:t}),!t){this.search.cancel(),this.resetSelection();return}this.search(t)}handleSortAscending(){this.setState(({sort:e})=>({sort:e===yt.SORT.ASCENDING?null:yt.SORT.ASCENDING}))}handleSortDescending(){this.setState(({sort:e})=>({sort:e===yt.SORT.DESCENDING?null:yt.SORT.DESCENDING}))}resetSelection(){this.setState({ungroupedSelectedRanges:[],groupedSelectedRanges:[]})}handleDragStart(e){Ps.debug("handleDragStart",e),document.documentElement.classList.add("drag-pointer-events-none"),this.setState({dragSource:e.source})}handleDragEnd(e){Ps.debug("handleDragEnd",e),document.documentElement.classList.remove("drag-pointer-events-none"),this.setState({dragSource:null});const{destination:t,source:n}=e;if(t==null||n==null)return;if(t.droppableId===Do){this.setState(({groupedSelectedRanges:i,columns:r})=>{const l=[...r];return dt.reorder(l,i,[],0),{columns:l,ungroupedSelectedRanges:[],groupedSelectedRanges:[]}});return}const s=n.droppableId===Fo;let o=t.index;s&&n.index<t.index&&(o+=1),this.setState(({columns:i,ungroupedSelectedRanges:r,groupedSelectedRanges:l})=>{const a=[...i],c=s?a:this.getSortedUngroupedColumns().map(p=>p.name),d=s?l:r,u=dt.reorder(c,d,a,o),h=s?dt.adjustDestinationIndex(o,l):o,g=[[h,h+u.length-1]];return{columns:a,ungroupedSelectedRanges:[],groupedSelectedRanges:g}}),this.resetSelection()}handleUngroupedSelect(e){Ps.debug("handleUngroupedSelect"),this.setState(({columns:t})=>({columns:yt.addGroupings(t,[this.getSortedUngroupedColumns()[e].name]),ungroupedSelectedRanges:[],groupedSelectedRanges:[]}))}handleUngroupedSelectionChange(e){Ps.debug2("handleUngroupedSelectionChange",e),this.setState(({ungroupedSelectedRanges:t})=>e===t?null:{ungroupedSelectedRanges:e,groupedSelectedRanges:[]})}handleGroupedSelectionChange(e){Ps.debug2("handleGroupedSelectedRanges",e),this.setState(({groupedSelectedRanges:t})=>e===t?null:{groupedSelectedRanges:e,ungroupedSelectedRanges:[]})}handleDeleteClicked(e){this.setState(({columns:t})=>{const n=t.slice();return n.splice(e,1),{columns:n}})}handleShowConstituentsChange(){this.setState(({showConstituents:e})=>({showConstituents:!e}))}handleShowNonAggregatedColumnsChange(){this.setState(({showNonAggregatedColumns:e})=>({showNonAggregatedColumns:!e}))}updateFromConfig(){const{config:e}=this.props,{columns:t=[],showConstituents:n=!0,showNonAggregatedColumns:s=!0}=e!=null?e:{};this.setState({columns:t,showConstituents:n,showNonAggregatedColumns:s})}sendChange(){const{onChange:e}=this.props,{columns:t,showConstituents:n,showNonAggregatedColumns:s}=this.state;e({columns:t,showConstituents:n,showNonAggregatedColumns:s})}getUngroupedColumns(){const{model:e}=this.props,{columns:t}=this.state,{originalColumns:n}=e;return this.getCachedUngroupedColumns(n,t)}getSortedUngroupedColumns(){const{sort:e}=this.state,t=this.getUngroupedColumns();return this.getCachedSortedColumns(t,e)}renderGroupedItem({item:e,itemIndex:t,isClone:n,selectedCount:s}){const i=`${n!==void 0&&n?"":"\xA0\xA0".repeat(t)}${e}`,r=n!==void 0&&n?`${s}`:void 0,l=n!==void 0&&n?"item-list-item-clone":"";return y(Oe,{children:[Dt.renderTextItem({text:i,badgeText:r,className:l}),(n===void 0||!n)&&m(z,{kind:"ghost",className:"btn btn-link btn-link-icon btn-delete-grouping float-right",onClick:()=>this.handleDeleteClicked(t),children:m(te,{icon:un})})]})}render(){const{columns:e,dragSource:t,searchFilter:n,groupedSelectedRanges:s,ungroupedSelectedRanges:o,showConstituents:i,showNonAggregatedColumns:r,sort:l}=this.state,a=this.getSortedUngroupedColumns();let c=e.length*Dt.DEFAULT_ROW_HEIGHT;(t==null?void 0:t.droppableId)===Do&&(c+=Dt.DEFAULT_ROW_HEIGHT);const d=a.length*Dt.DEFAULT_ROW_HEIGHT+10,u=Math.min(3*Dt.DEFAULT_ROW_HEIGHT,d);return m("div",{role:"menu",className:ee("rollup-rows",{"is-dragging":t!=null}),tabIndex:0,children:y($o,{onDragEnd:this.handleDragEnd,onDragStart:this.handleDragStart,children:[y("div",{className:"rollup-rows-group-by",children:[m("div",{className:"section-title",children:"Group By"}),e.length===0&&m(Oi,{droppableId:"placeholder",children:(h,g)=>m("div",{className:ee("placeholder","text-muted",{"is-dragging-from-this":g.draggingFromThisWith,"is-dragging-over":g.isDraggingOver,"is-dropping":g.draggingOverWith}),ref:h.innerRef,...h.droppableProps,children:"Create rollup by dragging columns here, from the available columns list below."})}),e.length>0&&m(Dt,{draggingItemClassName:"rollup-rows-dragging-grouped-item",draggablePrefix:Fo,droppableId:Fo,itemCount:e.length,items:e,offset:0,onSelectionChange:this.handleGroupedSelectionChange,ref:this.groupedList,renderItem:this.renderGroupedItem,selectedRanges:s,style:{height:c},isMultiSelect:!0})]}),y("div",{className:"rollup-rows-available-columns",children:[m("div",{className:"section-title",children:"Available Grouping Columns"}),y("div",{className:"top-menu",children:[m(Xs,{className:"w-100",value:n,matchCount:n?o.length:void 0,placeholder:"Find column...",onChange:this.handleSearchChange}),y(z,{kind:"ghost",className:ee("btn-link btn-link-icon",{active:l===yt.SORT.ASCENDING}),onClick:this.handleSortAscending,children:[m(te,{icon:_i}),m(Rt,{children:"Sort ascending"})]}),y(z,{kind:"ghost",className:ee("btn-link btn-link-icon",{active:l===yt.SORT.DESCENDING}),onClick:this.handleSortDescending,children:[m(te,{icon:Hi}),m(Rt,{children:"Sort descending"})]})]}),m(Dt,{className:"rollup-available-grouping-columns",draggablePrefix:Do,droppableId:Do,itemCount:a.length,items:a,renderItem:yt.renderColumn,offset:0,onSelect:this.handleUngroupedSelect,onSelectionChange:this.handleUngroupedSelectionChange,ref:this.ungroupedList,selectedRanges:o,style:{maxHeight:d,minHeight:u},isDropDisabled:(t==null?void 0:t.droppableId)!==Fo,isMultiSelect:!0}),y("div",{className:"bottom-menu",children:[m("div",{className:"label",children:"Show:"}),m(ln,{checked:i,onChange:this.handleShowConstituentsChange,children:"Constituents"}),m(ln,{checked:r,onChange:this.handleShowNonAggregatedColumnsChange,children:"Non-Aggregated Columns"})]})]})]})})}};let er=yt;er.SORT=Object.freeze({ASCENDING:"ASC",DESCENDING:"DESC"});er.defaultProps={config:null,onChange:()=>{}};const ch=ie.module("TableCsvExporter"),Ie=class extends F.exports.Component{static getDateString(){return E.i18n.DateTimeFormat.format(Ie.FILENAME_DATE_FORMAT,new Date)}constructor(e){super(e),this.handleDownloadClick=this.handleDownloadClick.bind(this),this.handleDownloadRowOptionChanged=this.handleDownloadRowOptionChanged.bind(this),this.handleCustomizedDownloadRowOptionChanged=this.handleCustomizedDownloadRowOptionChanged.bind(this),this.handleCustomizedDownloadRowsChanged=this.handleCustomizedDownloadRowsChanged.bind(this),this.handleIncludeColumnHeadersChanged=this.handleIncludeColumnHeadersChanged.bind(this),this.handleIncludeHiddenColumnsChanged=this.handleIncludeHiddenColumnsChanged.bind(this),this.handleUseUnformattedValuesChanged=this.handleUseUnformattedValuesChanged.bind(this);const{name:t}=e;this.state={fileName:`${t}-${Ie.getDateString()}.csv`,downloadRowOption:Ie.DOWNLOAD_ROW_OPTIONS.ALL_ROWS,customizedDownloadRowOption:Ie.CUSTOMIZED_ROWS_OPTIONS.FIRST,customizedDownloadRows:Ie.DEFAULT_DOWNLOAD_ROWS,includeColumnHeaders:!0,includeHiddenColumns:!1,useUnformattedValues:!1,errorMessage:null,id:Ln.generate()}}getSnapshotRanges(){const{model:e,selectedRanges:t}=this.props,{downloadRowOption:n,customizedDownloadRowOption:s,customizedDownloadRows:o}=this.state,{rowCount:i,columnCount:r}=e;let l=[];switch(n){case Ie.DOWNLOAD_ROW_OPTIONS.ALL_ROWS:l.push(new Q(0,0,r-1,i-1));break;case Ie.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS:l=t.map(a=>({...a,startColumn:0,endColumn:r-1})).sort((a,c)=>a.startRow!=null&&c.startRow!=null?a.startRow-c.startRow:0);break;case Ie.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS:switch(s){case Ie.CUSTOMIZED_ROWS_OPTIONS.FIRST:l.push(new Q(0,0,r-1,Math.min(o-1,i-1)));break;case Ie.CUSTOMIZED_ROWS_OPTIONS.LAST:l.push(new Q(0,Math.max(0,i-o),r-1,i-1));break}break}return l}getModelRanges(e){const{userColumnWidths:t,movedColumns:n}=this.props,{includeHiddenColumns:s}=this.state,o=J.getHiddenColumns(t);let i=H.getModelRanges(e,n);if(!s&&o.length>0){const r=o.map(Q.makeColumn);i=Q.subtractRangesFromRanges(i,r)}return i}resetDownloadState(){this.setState({errorMessage:null})}async handleDownloadClick(){const{model:e,isDownloading:t,onDownloadStart:n,onDownload:s,onCancel:o}=this.props,{fileName:i,includeColumnHeaders:r,useUnformattedValues:l}=this.state;if(t){o();return}this.resetDownloadState();const a=this.getSnapshotRanges(),c=this.getModelRanges(a);if(this.validateOptionInput()){n();try{const d=await e.export(),u=d.setViewport(0,0);await u.getViewportData(),s(i,d,u,a,c,r,l)}catch(d){ch.error("CSV download failed",d),this.setState({errorMessage:y("p",{children:[m(te,{icon:Qn})," ",`${d}`]})}),o()}}}handleDownloadRowOptionChanged(e){this.setState({downloadRowOption:e.target.value})}handleCustomizedDownloadRowOptionChanged(e){this.setState({customizedDownloadRowOption:e.target.value})}handleCustomizedDownloadRowsChanged(e){this.setState({customizedDownloadRows:parseInt(e.target.value,10)})}handleIncludeColumnHeadersChanged(){this.setState(({includeColumnHeaders:e})=>({includeColumnHeaders:!e}))}handleIncludeHiddenColumnsChanged(){this.setState(({includeHiddenColumns:e})=>({includeHiddenColumns:!e}))}handleUseUnformattedValuesChanged(){this.setState(({useUnformattedValues:e})=>({useUnformattedValues:!e}))}validateOptionInput(){const{selectedRanges:e}=this.props,{downloadRowOption:t,customizedDownloadRows:n}=this.state;return t===Ie.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS&&e.length===0?(this.setState({errorMessage:y("p",{children:[m(te,{icon:Qn})," No rows selected. Please select some rows in the table."]})}),!1):t===Ie.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS&&n<=0?(this.setState({errorMessage:y("p",{children:[m(te,{icon:Qn})," Number of rows to output must be greater than 0"]})}),!1):!0}render(){const{model:e,isDownloading:t,tableDownloadProgress:n,tableDownloadEstimatedTime:s,selectedRanges:o,tableDownloadStatus:i}=this.props,{fileName:r,downloadRowOption:l,customizedDownloadRowOption:a,customizedDownloadRows:c,includeColumnHeaders:d,includeHiddenColumns:u,useUnformattedValues:h,errorMessage:g,id:p}=this.state,{rowCount:f}=e;return y("div",{className:"table-csv-exporter",children:[m("div",{className:"section-title",children:"Download Rows"}),m("div",{className:"form-group",children:y(zi,{onChange:this.handleDownloadRowOptionChanged,value:l,disabled:t,children:[y(Zn,{value:Ie.DOWNLOAD_ROW_OPTIONS.ALL_ROWS,"data-testid":"radio-csv-exporter-download-all",children:["All Rows",m("span",{className:"text-muted ml-2",children:`(${f.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")} rows)`})]}),y(Zn,{value:Ie.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS,"data-testid":"radio-csv-exporter-only-selected",children:["Only Selected Rows",m("span",{className:"text-muted ml-2",children:o.length>0?`(${Q.rowCount(o).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")} rows)`:null})]}),m(Zn,{value:Ie.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS,"data-testid":"radio-csv-exporter-customized-rows",children:y("div",{className:"radio-input-row",role:"presentation",onClick:()=>{this.setState({downloadRowOption:Ie.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS})},children:[y("select",{value:a,"data-testid":"select-csv-exporter-customized-rows",className:"custom-select",disabled:t,onChange:this.handleCustomizedDownloadRowOptionChanged,children:[m("option",{value:"FIRST",children:"First"}),m("option",{value:"LAST",children:"Last"})]}),m("input",{type:"number",className:"form-control",id:`customizedRows-${p}`,"data-testid":"input-csv-exporter-customized-rows",name:`customizedRows-${p}`,placeholder:"100",value:c,disabled:t,onChange:this.handleCustomizedDownloadRowsChanged}),m("div",{children:"Rows"})]})})]})}),y("div",{className:"form-group",children:[m("label",{htmlFor:`customizedRows-${p}`,children:"File Name"}),m("input",{type:"text",className:"form-control",id:`filename-${p}`,"data-testid":"input-csv-exporter-file-name",name:`filename-${p}`,value:r,onChange:C=>{this.setState({fileName:C.target.value})},disabled:t})]}),y("div",{className:"checkbox-options",children:[m(ln,{checked:d,onChange:this.handleIncludeColumnHeadersChanged,children:"Include column headers"}),m(ln,{checked:u,onChange:this.handleIncludeHiddenColumnsChanged,children:"Include hidden columns"}),m(ln,{checked:h,onChange:this.handleUseUnformattedValuesChanged,children:"Use unformatted values"})]}),y("div",{className:"section-footer flex-column",children:[g!=null&&m("div",{className:"error-message",children:g}),i&&y("div",{className:"download-status",children:[(i===Ie.DOWNLOAD_STATUS.DOWNLOADING||i===Ie.DOWNLOAD_STATUS.INITIATING)&&y(Oe,{children:[i===Ie.DOWNLOAD_STATUS.INITIATING&&m("div",{className:"text-muted",children:"Starting Download..."}),i===Ie.DOWNLOAD_STATUS.DOWNLOADING&&y("div",{className:"text-muted d-flex justify-content-between",children:[m("span",{children:s||s===0?`Estimated time: ${Bi.formatElapsedTime(s)}`:null}),m("span",{children:`${n}%`})]})]}),i===Ie.DOWNLOAD_STATUS.FINISHED&&m("div",{className:"text-muted text-right",children:"Download Completed"}),i===Ie.DOWNLOAD_STATUS.CANCELED&&m("div",{className:"text-muted",children:"Download Canceled"}),(i===Ie.DOWNLOAD_STATUS.DOWNLOADING||i===Ie.DOWNLOAD_STATUS.INITIATING)&&m("div",{className:"progress",children:m("div",{className:"progress-bar progress-bar-striped progress-bar-animated",style:{width:`${n}%`}})}),i===Ie.DOWNLOAD_STATUS.FINISHED&&m("div",{className:"progress",children:m("div",{className:"progress-bar bg-success",style:{width:`${n}%`}})})]}),y(z,{kind:"primary","data-testid":"btn-csv-exporter-download",className:ee("btn-downloading",{"btn-spinner btn-cancelable":t}),onClick:this.handleDownloadClick,children:[t&&y("span",{children:[m(dn,{}),m("span",{className:"btn-normal-content",children:"Downloading"}),m("span",{className:"btn-hover-content",children:"Cancel"})]}),!t&&"Download"]})]})]})}};let gt=Ie;gt.FILENAME_DATE_FORMAT="yyyy-MM-dd-HHmmss";gt.DOWNLOAD_STATUS={INITIATING:"INITIATING",DOWNLOADING:"DOWNLOADING",FINISHED:"FINISHED",CANCELED:"CANCELED"};gt.DOWNLOAD_ROW_OPTIONS={ALL_ROWS:"ALL_ROWS",SELECTED_ROWS:"SELECTED_ROWS",CUSTOMIZED_ROWS:"CUSTOMIZED_ROWS"};gt.CUSTOMIZED_ROWS_OPTIONS={FIRST:"FIRST",LAST:"LAST"};gt.DEFAULT_DOWNLOAD_ROWS=100;gt.defaultProps={onDownloadStart:()=>{},isDownloading:!1,tableDownloadStatus:"",tableDownloadProgress:0,tableDownloadEstimatedTime:null,selectedRanges:[]};const Zt=ie.module("TableSaver"),uh="yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS z";function hh(e){return e.added!==void 0}function mh(e){if(!hh(e))throw new Error("event is not UpdateEventData")}const Dn=class extends F.exports.PureComponent{constructor(e){var t,n;super(e),this.WritableStream=(t=window.WritableStream)!=null?t:mr,this.getCachedCustomColumnFormatFlag=pt(Jn.isCustomColumnFormatDefined,{max:1e4}),this.handlePortMessage=this.handlePortMessage.bind(this),this.handleSnapshotResolved=this.handleSnapshotResolved.bind(this),this.handleDownloadTimeout=this.handleDownloadTimeout.bind(this),this.state={},this.gridRanges=[],this.gridRangeCounter=0,this.rangedSnapshotsTotal=[],this.rangedSnapshotCounter=0,this.includeColumnHeaders=!0,this.useUnformattedValues=!1,this.snapshotsTotal=0,this.snapshotCounter=0,this.snapshotsBuffer=new Map,this.currentSnapshotIndex=0,this.snapshotPending=0,this.cancelableSnapshots=[],this.WritableStream=(n=window.WritableStream)!=null?n:mr,this.iframes=[],this.useBlobFallback=!1}static csvEscapeString(e){return`"${e.replace(/"/g,'""')}"`}componentDidMount(){const{getDownloadWorker:e}=this.props;e().then(t=>{Zt.info("found active service worker"),this.sw=t,this.sw.postMessage("ping")}).catch(t=>{Zt.warn("Download csv is not optimized.",t),this.useBlobFallback=!0})}componentWillUnmount(){this.iframes.length>0&&this.iframes.forEach(e=>{e.remove()}),this.streamTimeout&&clearTimeout(this.streamTimeout),this.snapshotHandlerTimeout&&clearTimeout(this.snapshotHandlerTimeout)}createWriterStream(e){const t=this.useBlobFallback,n=[];let s=null;t&&(s=TextEncoder.prototype.encode.bind(new TextEncoder));const{fileName:o}=this,i={};return t?(i.write=r=>{M(s),r.header!==void 0&&n.push(s(r.header)),r.rows!==void 0&&n.push(s(r.rows))},i.close=()=>{M(o);const r=new Blob(n,{type:"application/octet-stream; charset=utf-8"}),l=document.createElement("a");l.href=URL.createObjectURL(r),l.download=o,l.click()},i.abort=()=>{e.postMessage({cancel:!0}),e.close()}):(i.write=r=>{e.postMessage(r)},i.close=()=>{e.postMessage({end:!0}),e.close()},i.abort=()=>{e.postMessage({cancel:!0}),e.close()}),new this.WritableStream(i)}startDownload(e,t,n,s,o,i,r){const{isDownloading:l}=this.props;if(l)return;this.downloadStartTime=Date.now(),Zt.info(`start downloading ${e}`),this.table=t,this.columns=J.columnsFromRanges(o,t.columns),this.tableSubscription=n,this.gridRanges=s,this.includeColumnHeaders=i,this.useUnformattedValues=r;const a=encodeURIComponent(e.replace(/\//g,":")).replace(/['()]/g,escape).replace(/\*/g,"%2A"),c=new MessageChannel;if(this.port=c.port1,this.fileName=e,this.fileWriter=this.createWriterStream(this.port).getWriter(),this.useBlobFallback){this.writeCsvTable(i);return}this.sw&&this.sw.postMessage({encodedFileName:a},[c.port2]),this.port.onmessage=this.handlePortMessage}finishDownload(){this.table&&this.table.close(),this.tableSubscription&&this.tableSubscription.close(),this.fileWriter&&this.fileWriter.close();const{onDownloadCompleted:e}=this.props;e(),this.resetTableSaver(),this.downloadStartTime!==void 0&&Zt.info(`download finished, total elapsed time ${(Date.now()-this.downloadStartTime)/1e3} seconds`)}cancelDownload(){this.table&&this.table.close(),this.tableSubscription&&this.tableSubscription.close(),this.fileWriter&&this.fileWriter.abort(),this.cancelableSnapshots.forEach(t=>{t&&(t.catch(()=>null),t.cancel())});const{onDownloadCanceled:e}=this.props;e(),this.resetTableSaver()}resetTableSaver(){this.table=void 0,this.tableSubscription=void 0,this.columns=void 0,this.chunkRows=void 0,this.gridRanges=[],this.gridRangeCounter=0,this.rangedSnapshotsTotal=[],this.rangedSnapshotCounter=0,this.includeColumnHeaders=!0,this.useUnformattedValues=!1,this.snapshotsTotal=0,this.snapshotCounter=0,this.snapshotsBuffer=new Map,this.currentSnapshotIndex=0,this.snapshotPending=0,this.cancelableSnapshots=[],this.streamTimeout!=null&&clearTimeout(this.streamTimeout),this.snapshotHandlerTimeout!=null&&clearTimeout(this.snapshotHandlerTimeout),this.streamTimeout=void 0,this.snapshotHandlerTimeout=void 0}handleDownloadTimeout(){Zt.info("download canceled"),this.cancelDownload()}writeTableHeader(){var t;let e="";if(this.columns)for(let n=0;n<this.columns.length;n+=1)e+=this.columns[n].name,e+=n===this.columns.length-1?`
4
4
  `:",";(t=this.fileWriter)==null||t.write({header:e}).then(()=>null)}startWriteTableBody(){this.columns&&this.gridRanges!=null&&(this.chunkRows=Math.floor(Dn.DOWNLOAD_CELL_CHUNK/this.columns.length),this.rangedSnapshotsTotal=this.gridRanges.map(e=>(M(e.endRow),M(e.startRow),M(this.chunkRows),Math.ceil((e.endRow-e.startRow+1)/this.chunkRows))),this.snapshotsTotal=this.rangedSnapshotsTotal.reduce((e,t)=>e+t),Zt.info("start writing table, total snapshots: ",this.snapshotsTotal),this.makeSnapshot(Math.min(Dn.SNAPSHOT_BUFFER_SIZE,this.snapshotsTotal)))}writeCsvTable(e){e&&this.writeTableHeader(),this.startWriteTableBody()}writeSnapshot(e,t,n){if(this.currentSnapshotIndex===e&&this.fileWriter){for(;this.snapshotsBuffer.has(this.currentSnapshotIndex);){const s=this.snapshotsBuffer.get(this.currentSnapshotIndex);M(s),this.fileWriter.write({rows:this.convertSnapshotIntoCsv(s)}),this.snapshotsBuffer.delete(this.currentSnapshotIndex),this.currentSnapshotIndex+=1,this.updateDownloadProgress(e)}if(this.snapshotsTotal&&this.currentSnapshotIndex>=this.snapshotsTotal){this.finishDownload();return}}this.snapshotCounter&&this.snapshotsTotal&&this.snapshotCounter<this.snapshotsTotal&&(Zt.debug2(`
5
5
  current range index: ${this.gridRangeCounter},
6
6
  snapshotIndexCounter: ${this.snapshotCounter},
@@ -8,25 +8,25 @@ import{A as F,R as Fe,C as m,E as ee,T as fa,F as y,J as te,D as $t,K as Oe,L as
8
8
  snapshotpending: ${this.snapshotPending},
9
9
  buffered ${this.snapshotsBuffer.size}
10
10
  making ${Math.min(Dn.SNAPSHOT_BUFFER_SIZE-this.snapshotsBuffer.size-this.snapshotPending,this.snapshotsTotal-this.snapshotCounter)} more snapshots
11
- `),this.makeSnapshot(Math.min(Dn.SNAPSHOT_BUFFER_SIZE-this.snapshotsBuffer.size-this.snapshotPending,this.snapshotsTotal-this.snapshotCounter)))}updateDownloadProgress(e){if(e!=null&&this.snapshotsTotal!=null&&this.downloadStartTime!=null){const{onDownloadProgressUpdate:t}=this.props,n=Math.floor(e*100/this.snapshotsTotal),s=e>1?Math.floor((Date.now()-this.downloadStartTime)*(this.snapshotsTotal-e)/e/1e3):null;t(n,s)}}convertSnapshotIntoCsv(e){var r;let t="";const n=e.added.iterator(),{formatter:s}=this.props,o=[];for(;n.hasNext();)o.push(n.next().value);M(this.columns);const{useUnformattedValues:i}=this;for(let l=0;l<o.length;l+=1){const a=o[l];for(let c=0;c<this.columns.length;c+=1){const{type:d,name:u}=this.columns[c];let h=null;if(i){let g=(r=e.getData(a,this.columns[c]))!=null?r:"";g!==""&&I.isDateType(d)&&(g=E.i18n.DateTimeFormat.format(ch,g,E.i18n.TimeZone.getTimeZone(s.timeZone))),h=g.toString()}else{const g=this.getCachedCustomColumnFormatFlag(s,u,d);let p=null;if(!g){const f=e.getFormat(a,this.columns[c]);p=(f==null?void 0:f.formatString)!=null?f:null}p?h=s.getFormattedString(e.getData(a,this.columns[c]),d,u,p):h=s.getFormattedString(e.getData(a,this.columns[c]),d,u)}t+=Dn.csvEscapeString(h),t+=c===this.columns.length-1?`
12
- `:","}}return t}makeSnapshot(e){if(e<=0)return;M(this.gridRangeCounter);let t=0,n=this.gridRanges[this.gridRangeCounter];for(M(this.tableSubscription),M(this.columns);t<e;){M(n),M(n.startRow),M(n.endRow),M(this.rangedSnapshotCounter),M(this.chunkRows);const s=n.startRow+this.rangedSnapshotCounter*this.chunkRows,o=Math.min(s+this.chunkRows-1,n.endRow),i=this.snapshotCounter;this.cancelableSnapshots.push(Ge.makeCancelable(this.tableSubscription.snapshot(E.RangeSet.ofRange(s,o),this.columns).then(r=>(hh(r),this.handleSnapshotResolved(r,i,s,o),i)).catch(r=>{Zt.error(r)}),r=>{Zt.info(`snapshot ${r} has been canceled`)})),this.rangedSnapshotCounter+=1,this.snapshotCounter+=1,this.snapshotPending+=1,this.rangedSnapshotCounter>=this.rangedSnapshotsTotal[this.gridRangeCounter]&&(this.gridRangeCounter+=1,this.rangedSnapshotCounter=0,n=this.gridRanges[this.gridRangeCounter]),t+=1}}handlePortMessage({data:e}){const{download:t,readableStreamPulling:n}=e;if(!this.useBlobFallback){if(t!=null){const{includeColumnHeaders:s}=this;this.makeIframe(`${t}`),this.writeCsvTable(s)}n!=null&&(this.useBlobFallback||(this.streamTimeout!=null&&clearTimeout(this.streamTimeout),this.streamTimeout=setTimeout(this.handleDownloadTimeout,Dn.STREAM_TIMEOUT)))}}handleSnapshotResolved(e,t,n,s){this.snapshotHandlerTimeout=setTimeout(()=>{this.snapshotsBuffer.set(t,e),this.snapshotPending-=1,this.writeSnapshot(t,n,s),this.cancelableSnapshots[t]=null},Dn.SNAPSHOT_HANDLER_TIMEOUT)}makeIframe(e){const t=document.createElement("iframe");t.hidden=!0,t.src=`download/${e}`,t.name="iframe",document.body.appendChild(t),this.iframes.push(t)}render(){return null}};let Fs=Dn;Fs.DOWNLOAD_CELL_CHUNK=6e3;Fs.SNAPSHOT_BUFFER_SIZE=5;Fs.STREAM_TIMEOUT=8e3;Fs.SNAPSHOT_HANDLER_TIMEOUT=5;Fs.defaultProps={getDownloadWorker:()=>Promise.reject(new Error("Download worker not provided")),isDownloading:!1,onDownloadCompleted:()=>{},onDownloadCanceled:()=>{},onDownloadProgressUpdate:()=>{}};function mh(e){var b;const{group:t,onDelete:n,onColorChange:s,onNameChange:o,validateName:i}=e,{isNew:r}=t,l=F.exports.useRef(t),a=F.exports.useRef(null),c=F.exports.useRef(null),[d,u]=F.exports.useState(r?"":t.name),[h,g]=F.exports.useState(r),[p,f]=F.exports.useState(!1),C=d!==t.name?i(d):"",w=r&&!p||C==="";F.exports.useEffect(function(){h&&a.current&&(a.current.focus(),a.current.select())},[h]),F.exports.useEffect(function(){return()=>{l.current.isNew&&n(l.current)}},[n]);const S=()=>{w&&(o(t,d),g(!1))},T=()=>{if(r){n(t);return}u(t.name),g(!1)},R=v=>{f(!0),v.key==="Enter"&&(v.stopPropagation(),S()),v.key===" "&&v.stopPropagation(),v.key==="Escape"&&T()};return h?y(Oe,{children:[y("div",{className:"editing-container",children:[m("input",{ref:a,className:ee("form-control",{"is-invalid":!w}),value:d,placeholder:"Group Name",onChange:v=>u(v.target.value),onKeyDown:R}),m(z,{kind:"ghost",icon:Qn,tooltip:"Confirm",onClick:S}),m(z,{kind:"ghost",icon:Ka,tooltip:"Cancel",onClick:T})]}),!w&&m("p",{className:"mb-0 validate-label-error text-danger",children:C})]}):y("div",{className:"group-name-wrapper",children:[m("span",{className:"column-name",children:d}),m(z,{className:"p-1 mx-1",kind:"ghost",icon:Pi,tooltip:"Edit",onClick:()=>{g(!0)}}),y("span",{className:"right-buttons",children:[m(z,{kind:"ghost",icon:un,tooltip:"Delete group",onClick:()=>n(t)}),m(z,{kind:"ghost",className:"color-swatch mr-1",icon:t.color!==void 0?y("span",{className:"fa-layers",children:[m(te,{className:"color-swatch",icon:ko,color:Ue.white,transform:"down-1"}),m(te,{className:"color-swatch",icon:ko,color:t.color,transform:"shrink-2 down-1"})]}):Qa,tooltip:"Set color",onClick:()=>{var v,D;(v=c.current)==null||v.click(),(D=c.current)==null||D.focus()}}),m("input",{"aria-label":"Color input",ref:c,type:"color",list:"presetColors",value:(b=t.color)!=null?b:Ue["content-bg"],style:{visibility:"hidden",width:0,height:0,padding:0,border:0},onChange:v=>{t.color=v.target.value,s(t,v.target.value)}}),y("datalist",{id:"presetColors",children:[m("option",{children:Ue["content-bg"]}),m("option",{children:Ue.primary}),m("option",{children:Ue.foreground}),m("option",{children:Ue.green}),m("option",{children:Ue.yellow}),m("option",{children:Ue.orange}),m("option",{children:Ue.red}),m("option",{children:Ue.purple}),m("option",{children:Ue.blue}),m("option",{children:Ue["gray-400"]})]})]})]})}function gh(){}const ph=F.exports.forwardRef(function(t,n){const{value:s,clone:o,childCount:i,item:r,onVisibilityChange:l,onClick:a,onGroupDelete:c,onGroupColorChange:d,onGroupNameChange:u,validateGroupName:h,handleProps:g}=t,{group:p,modelIndex:f,isVisible:C}=r.data,w=F.exports.useRef(null),S=F.exports.useCallback(R=>{var b;R.buttons===1&&(l([f].flat(),!C),(b=w.current)==null||b.focus())},[l,f,C]),T=F.exports.useCallback(R=>{a(s,R)},[a,s]);return y("div",{ref:n,className:ee("tree-item",{isSelected:r.selected,"two-dragged":i===2,"multiple-dragged":i>2}),onClick:T,...g,children:[m(z,{ref:w,kind:"ghost",className:"px-1",onClick:gh,onMouseDown:S,onMouseEnter:S,icon:C?Gi:cl,tooltip:"Toggle visibility"}),m("span",{className:ee("column-name",p&&"column-group"),children:p&&!o?m(mh,{group:p,onDelete:c,onColorChange:d,onNameChange:u,validateName:h}):s}),y("div",{children:[o&&i>1&&m("span",{className:"item-count",children:i}),m(Rt,{children:"Drag to re-order"}),m(te,{icon:Ui})]})]})});function fh(e){return e.parentId!==void 0}function Ch(e,t){return Math.round(e/t)}function _l(e,t,n,s,o,i){const r=e.findIndex(l=>l.name===s);if(r===-1){const l=n.get(s);if(l==null)throw new Error(`Column or header group not found: ${s}`);const a=l.childIndexes.flat();return{id:s,selected:i.has(s),children:l.children.map(c=>_l(e,t,n,c,o,i)).sort((c,d)=>{const u=Array.isArray(c.data.visibleIndex)?c.data.visibleIndex[0]:c.data.visibleIndex,h=Array.isArray(d.data.visibleIndex)?d.data.visibleIndex[0]:d.data.visibleIndex;return u-h}),data:{modelIndex:a,visibleIndex:l.getVisibleRange(t),group:l,isVisible:a.some(c=>!o.has(c))}}}return{id:s,children:[],selected:i.has(s),data:{modelIndex:r,visibleIndex:H.getVisibleIndex(r,t),isVisible:!o.has(r)}}}function wh(e,t,n,s,o){const i=[],r=new Set(o),l=new Map(n.map(d=>[d.name,d])),a=new Set(s);let c=0;for(;c<e.length;){const d=H.getModelIndex(c,t),u=e[d].name;let h=n.find(({children:p})=>p.includes(u));for(;h!==void 0&&h.parent!==void 0;)h=l.get(h.parent);const g=_l(e,t,l,h?h.name:u,a,r);i.push(g),Array.isArray(g.data.visibleIndex)?c+=g.data.visibleIndex[1]-g.data.visibleIndex[0]+1:c+=1}return i}function Ho(e,t,n,s,o){const i=e.findIndex(({id:w})=>w===n),r=e.findIndex(({id:w})=>w===t),l=e[r],a=wa(e,r,i),c=a[i-1],d=a[i+1],u=Ch(s,o),h=l.depth+u,g=Sh({previousItem:c,nextItem:d}),p=bh({nextItem:d});let f=h;return h>=g?f=g:h<p&&(f=p),{depth:f,maxDepth:g,minDepth:p,parentId:C()};function C(){var S;if(f===0||!c)return null;if(f===c.depth)return c.parentId;if(f>c.depth)return c.id;const w=(S=a.slice(0,i).reverse().find(T=>T.depth===f))==null?void 0:S.parentId;return w!=null?w:null}}function Sh({previousItem:e,nextItem:t}){var n,s;return Math.max((n=e==null?void 0:e.depth)!=null?n:0,(s=t==null?void 0:t.depth)!=null?s:0)}function bh({nextItem:e}){return e?e.depth:0}function Hl(e,t=null,n=0){return e.reduce((s,o,i)=>[...s,{...o,parentId:t,depth:n,index:i},...Hl(o.children,o.id,n+1)],[])}function Tt(e){return e.every(fh)?[...e]:Hl(e)}function Vl(e,t){for(let n=0;n<e.length;n+=1){const s=e[n],{id:o,children:i}=s;if(o===t)return s;if(i.length){const r=Vl(i,t);if(r)return r}}}function Ul(e,t=0){return e.reduce((n,{children:s})=>s.length?Ul(s,n+1):n+1,t)}function Th(e,t){const n=Vl(e,t);return n?Ul(n.children):0}const Eh=[Wt.Down,Wt.Right,Wt.Up,Wt.Left],vh=[Wt.Left,Wt.Right];function Rh(e,t,n){return(s,{currentCoordinates:o,context:{active:i,over:r,collisionRect:l,droppableRects:a,droppableContainers:c}})=>{if(Eh.includes(s.code)){if(!i||!l)return;s.preventDefault();const{current:{items:d,offset:u}}=e;if(vh.includes(s.code)&&(r==null?void 0:r.id)!=null){const{depth:f,maxDepth:C,minDepth:w}=Ho(d,i.id,r.id,u,n);switch(s.code){case Wt.Left:if(f>w)return{...o,x:o.x-n};break;case Wt.Right:if(f<C)return{...o,x:o.x+n};break}return}const h=[];c.forEach(f=>{if((f==null?void 0:f.disabled)||f.id===(r==null?void 0:r.id))return;const C=a.get(f.id);if(!!C)switch(s.code){case Wt.Down:l.top<C.top&&h.push(f);break;case Wt.Up:l.top>C.top&&h.push(f);break}});const g=Sa({active:i,collisionRect:l,pointerCoordinates:null,droppableRects:a,droppableContainers:h});let p=ba(g,"id");if(p===(r==null?void 0:r.id)&&g.length>1&&(p=g[1].id),p!=null&&(r==null?void 0:r.id)!=null){const f=a.get(i.id),C=a.get(p),w=c.get(p);if(f&&C&&w){const S=d.findIndex(({id:v})=>v===p),T=d[S],R=d.findIndex(({id:v})=>v===i.id),b=d[R];if(T!=null&&b!=null){const{depth:v}=Ho(d,i.id,p,(T.depth-b.depth)*n,n),A=S>R?1:-1,N=t?(l.height-f.height)/2:0;return{x:C.left+v*n,y:C.top+A*N}}}}}}}class Bl extends Ta{}Bl.activators=[{eventName:"onPointerDown",handler:({nativeEvent:e})=>!(!e.isPrimary||e.button!==0||Fh(e.target))}];const yh=["button","input","textarea","select","option"];function Fh(e){return!!((e==null?void 0:e.tagName)!=null&&yh.includes(e.tagName.toLowerCase()))}function Gl(e){const{clone:t=!1,depth:n,disableInteraction:s=!1,ghost:o=!1,handleProps:i,value:r,dragRef:l=null,wrapperRef:a=null,renderItem:c,item:d,childCount:u}=e,h=F.exports.useMemo(()=>Array(n).fill(0).map((p,f)=>m("span",{className:"depth-line"},`depth-line-${f}`)),[n]),g=F.exports.useMemo(()=>({ref:l,clone:t,value:r,item:d,childCount:u,handleProps:i}),[l,t,r,d,u,i]);return y("li",{className:ee("item-wrapper",{clone:t,ghost:o,disableInteraction:s}),ref:a,children:[!t&&h,c(g)]},r)}Gl.displayName="TreeItem";const Dh=({isSorting:e,wasDragging:t})=>!(e||t);function Vr({id:e,depth:t,...n}){const{attributes:s,isDragging:o,isSorting:i,listeners:r,setDraggableNodeRef:l,setDroppableNodeRef:a,transform:c,transition:d}=Ea({id:e,animateLayoutChanges:Dh}),u=Fi.Translate.toString(c),h=F.exports.useMemo(()=>({transform:u,transition:d}),[u,d]),g=F.exports.useMemo(()=>({...s,...r,style:h}),[s,r,h]);return m(Gl,{dragRef:l,wrapperRef:a,depth:t,ghost:o,disableInteraction:i,handleProps:g,...n})}const Ih={keyframes({transform:e}){return[{opacity:1,transform:Fi.Transform.toString(e.initial)},{opacity:0,transform:Fi.Transform.toString({...e.final,x:e.final.x+5,y:e.final.y+5})}]},easing:"ease-out",sideEffects({active:e}){e.node.animate([{opacity:0},{opacity:1}],{duration:gr.duration,easing:gr.easing})}};let us=null;function Nh(e){return us==null&&e.activeNodeRect&&e.activatorEvent instanceof PointerEvent&&(us=Math.floor((e.activatorEvent.clientY-e.activeNodeRect.top)/e.activeNodeRect.height)*e.activeNodeRect.height),e.activeNodeRect||(us=null),{...e.transform,y:e.transform.y+(us!=null?us:0)}}function Ah({items:e,renderItem:t,indentationWidth:n=30,indicator:s=!1,activeId:o,overId:i,offsetLeft:r}){const l=va(),a=F.exports.useRef(l);F.exports.useEffect(function(){a.current=l},[l]),F.exports.useEffect(function(){a.current.measureDroppableContainers(e.map(({id:g})=>g))},[e]);const c=o!=null&&i!=null?Ho(e,o,i,r,n):null,d=F.exports.useRef({items:e,offset:r}),u=o!=null?e.find(({id:h})=>h===o):null;return F.exports.useEffect(()=>{d.current={items:e,offset:r}},[e,r]),y(Oe,{children:[m("div",{className:ee("tree-container",o!=null&&"marching-ants"),children:e.map(h=>{const{id:g,depth:p}=h;return m(Vr,{id:g,value:g,depth:g===o&&c?c.depth:p,item:h,renderItem:t},g)})}),Ra.exports.createPortal(m(ya,{dropAnimation:Ih,modifiers:[Nh],className:"visibility-ordering-list",children:o!=null&&u?m(Vr,{id:o,depth:u.depth,clone:!0,childCount:Th(e,o)+1,value:o.toString(),renderItem:t,item:u}):null}),document.body)]})}const Mh={droppable:{strategy:Fa.Always}},Oh={activationConstraint:{distance:5}};function xh({items:e,indicator:t=!1,indentationWidth:n=30,onDragStart:s,onDragEnd:o,renderItem:i}){const[r,l]=F.exports.useState(null),[a,c]=F.exports.useState(null),[d,u]=F.exports.useState(0),h=F.exports.useMemo(()=>{const A=Tt(e);return r!=null?A.filter(({id:N,selected:L})=>N===r||!L):A},[r,e]),g=r!=null&&a!=null?Ho(h,r,a,d,n):null,p=F.exports.useRef({items:h,offset:d}),f=F.exports.useMemo(()=>({coordinateGetter:Rh(p,t,n)}),[n,t]),C=Da(pr(Bl,Oh),pr(Oa,f)),w=F.exports.useMemo(()=>h.map(({id:A})=>A),[h]);F.exports.useEffect(()=>{p.current={items:h,offset:d}},[h,d]);const S=F.exports.useCallback(({active:{id:A}})=>{l(A),c(A),s==null||s(A),document.body.style.setProperty("cursor","grabbing")},[s]),T=F.exports.useCallback(({delta:A})=>{u(A.x)},[]),R=F.exports.useCallback(({over:A})=>{var N;c((N=A==null?void 0:A.id)!=null?N:null)},[]),b=F.exports.useCallback(()=>{c(null),l(null),u(0),document.body.style.setProperty("cursor","")},[]),v=F.exports.useCallback(({active:A,over:N})=>{if(b(),g&&N){const{depth:L,parentId:k}=g,x=JSON.parse(JSON.stringify(Tt(e))),W=x.findIndex(({id:Z})=>Z===N.id),V=x.findIndex(({id:Z})=>Z===A.id),K=x[V];x[V]={...K,depth:L,parentId:k},o==null||o(K,{...x[W],parentId:g.parentId})}},[e,o,g,b]),D=F.exports.useCallback(()=>{b()},[b]);return m(Ia,{sensors:C,collisionDetection:Na,measuring:Mh,onDragStart:S,onDragMove:T,onDragOver:R,onDragEnd:v,onDragCancel:D,children:m(Aa,{items:w,strategy:Ma,children:m(Ah,{items:h,renderItem:i,indicator:t,indentationWidth:n,activeId:r,overId:a,offsetLeft:d})})})}function kh(e,t,n,s,o,i,r,l){const a=o.map((S,T)=>({...S,index:T}));let c=[],d=s;const u=i[0].data.visibleIndex,h=a.findIndex(({id:S})=>S===e.id),g=a.findIndex(({id:S})=>S===t.id);let p=Array.isArray(u)?u[1]+1:u+1;d=An(i[0],t.parentId,d);for(let S=1;S<i.length;S+=1){const{data:{visibleIndex:T}}=i[S];c=H.moveItemOrRange(T,p,c,!0),p+=Array.isArray(T)?T[1]-T[0]+1:1,d=An(i[S],t.parentId,d)}const f=[Array.isArray(u)?u[0]:u,p-1],C=Array.isArray(t.data.visibleIndex)?t.data.visibleIndex[0]:t.data.visibleIndex;let w=H.getVisibleIndex(C,c);return h>g&&w>C&&(w-=1),t.children.length>0&&(Array.isArray(u)?u[0]:u)<w&&(w-=1),f[0]<w&&(w-=f[1]-f[0]),c=H.moveItemOrRange(f,Be(w,r,l),c),{groups:d,movedColumns:n.concat(c)}}function An(e,t,n){var a;if(e.parentId===t)return[...n];let s=n.map(c=>new Bt(c));const o=new Map(s.map(c=>[c.name,c])),i=s.find(c=>c.name===e.parentId),r=s.find(c=>c.name===t),l=s.find(c=>c.name===e.id);if(i!=null&&(i.children=i.children.filter(c=>c!==e.id),i.children.length===0)){const c=new Set([i.name]),{parent:d=""}=i;let u=o.get(d);for(u==null||u.removeChildren([i.name]);u&&u.children.length===0;){c.add(u.name);const h=(a=u==null?void 0:u.parent)!=null?a:"",g=o.get(h);g==null||g.removeChildren([u.name]),u=g}s=s.filter(({name:h})=>!c.has(h))}return r!=null&&r.addChildren([e.id]),l==null||l.setParent(t!=null?t:void 0),s}const Lh=150,Qe=class extends F.exports.Component{constructor(e){super(e),this.debouncedSearchColumns=vt(this.searchColumns,Lh),this.handleGroupColorChange=Pn((t,n)=>{const{columnHeaderGroups:s,onColumnHeaderGroupChanged:o}=this.props,i=[...s],r=new Bt({...t,color:n});i.splice(i.findIndex(({name:l})=>l===t.name),1,r),o(i)},250),this.renderItem=be(({value:t,clone:n,item:s,ref:o,handleProps:i})=>{const{onColumnVisibilityChanged:r}=this.props,{selectedColumns:l}=this.state;let a=t;return n&&(a=this.getSelectedParentItems().map(({id:d})=>d).join(", ")),m(ph,{ref:o,value:a,clone:n,item:s,childCount:l.size,onVisibilityChange:r,onClick:this.handleItemClick,onGroupDelete:this.handleGroupDelete,onGroupColorChange:this.handleGroupColorChange,onGroupNameChange:this.handleGroupNameChange,validateGroupName:this.validateGroupName,handleProps:i})}),this.getMemoizedFirstMovableIndex=be((t,n,s)=>{for(let o=0;o<n.length;o+=1){const i=H.getModelIndex(o,s);if(t.isColumnMovable(i))return o}return null}),this.getMemoizedLastMovableIndex=be((t,n,s)=>{for(let o=n.length-1;o>=0;o-=1){const i=H.getModelIndex(o,s);if(t.isColumnMovable(i))return o}return null}),this.memoizedGetTreeItems=be((t,n,s,o,i)=>wh(t,n,s,o,[...i.values()])),this.makeVisibilityOrderingList=be((t,n)=>{const{movedColumns:s}=this.props,o=[],i=this.getFirstMovableIndex(),r=this.getLastMovableIndex(),l=n.findIndex(({data:d})=>Array.isArray(d.visibleIndex)?d.visibleIndex[0]===i:d.visibleIndex===i),a=n.findIndex(({data:d})=>Array.isArray(d.visibleIndex)?d.visibleIndex[1]===r:d.visibleIndex===r),c=n.slice(l,a+1);if(i==null||r===null){for(let d=0;d<t.length;d+=1){const u=H.getModelIndex(d,s),h=t[u];o.push(this.renderImmovableItem(h.name))}return o}for(let d=0;d<i;d+=1){const u=H.getModelIndex(d,s),h=t[u];o.push(this.renderImmovableItem(h.name))}i!==null&&i>0&&o.push(m("hr",{},"top-horizontal-divider")),o.push(m(xh,{items:c,renderItem:this.renderItem,onDragStart:this.handleDragStart,onDragEnd:this.handleDragEnd},"movable-items")),r!=null&&r<t.length-1&&o.push(m("hr",{},"bottom-horizontal-divider"));for(let d=r+1;d<t.length;d+=1){const u=H.getModelIndex(d,s),h=t[u];o.push(this.renderImmovableItem(h.name))}return o}),this.renderImmovableItem=be(t=>m("div",{className:"visibility-ordering-list-item immovable",children:m("div",{className:"column-item",children:m("span",{className:"column-name",children:t})})},t)),this.handleSearchInputChange=this.handleSearchInputChange.bind(this),this.searchColumns=this.searchColumns.bind(this),this.handleItemClick=this.handleItemClick.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleGroupDelete=this.handleGroupDelete.bind(this),this.handleGroupNameChange=this.handleGroupNameChange.bind(this),this.handleGroupCreate=this.handleGroupCreate.bind(this),this.validateGroupName=this.validateGroupName.bind(this),this.addColumnToSelected=this.addColumnToSelected.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.state={selectedColumns:new Set,lastSelectedColumn:"",searchFilter:""},this.list=null}componentWillUnmount(){this.debouncedSearchColumns.cancel()}resetVisibilityOrdering(){const{model:e,onReset:t,onMovedColumnsChanged:n,onColumnHeaderGroupChanged:s}=this.props;this.setState({selectedColumns:new Set,lastSelectedColumn:"",searchFilter:""}),t(),s(e.initialColumnHeaderGroups),n(e.initialMovedColumns)}resetSelection(){this.setState({selectedColumns:new Set,lastSelectedColumn:""})}handleSearchInputChange(e){const t=e.target.value;if(this.setState({searchFilter:t}),!t){this.debouncedSearchColumns.cancel(),this.resetSelection();return}this.debouncedSearchColumns(t)}searchColumns(e){var i;const t=Tt(this.getTreeItems()),s=t.filter(({id:r})=>r.toLowerCase().includes(e.toLowerCase())).map(({id:r})=>r),o=t.findIndex(({id:r})=>r.toLowerCase().includes(e.toLowerCase()));if(this.addColumnToSelected(s,!1),s.length>0){const r=(i=this.list)==null?void 0:i.querySelectorAll(".item-wrapper")[o];r==null||r.scrollIntoView({block:"center"})}}moveSelectedColumns(e){var d;const{columnHeaderGroups:t}=this.props,{selectedColumns:n}=this.state,s=Tt(this.getTreeItems());let o=this.getFirstMovableIndex(),i=this.getLastMovableIndex();M(o),M(i);const r=this.getSelectedParentItems();e===Qe.MOVE_OPTIONS.UP||e===Qe.MOVE_OPTIONS.TOP||r.reverse();let a=[],c=t;for(let u=0;u<r.length;u+=1){const{id:h,parentId:g,depth:p,data:{visibleIndex:f}}=r[u];switch(e){case Qe.MOVE_OPTIONS.TOP:{a=H.moveItemOrRange(f,o,a,!0),o+=Array.isArray(f)?f[1]-f[0]+1:1,c=An(r[u],null,c);break}case Qe.MOVE_OPTIONS.BOTTOM:{a=H.moveItemOrRange(f,i,a,!0),i-=Array.isArray(f)?f[1]-f[0]+1:1,c=An(r[u],null,c);break}case Qe.MOVE_OPTIONS.UP:{const C=s.findIndex(T=>T.id===h),w=s.map((T,R)=>R<C&&!n.has(T.id)).lastIndexOf(!0),S=s[w];if(S!=null&&S.parentId!==g)if(Math.abs(S.depth-p)>1){const T=s.map((b,v)=>v<w&&b.depth===p).lastIndexOf(!0),R=s[T];c=An(r[u],R.id,c)}else c=An(r[u],S.parentId,c);else{const T=Be(Array.isArray(f)?f[0]-1:f-1,o,i);a=H.moveItemOrRange(f,T,a,!1),o+=Array.isArray(f)?f[1]-f[0]+1:1}break}case Qe.MOVE_OPTIONS.DOWN:{const C=s.findIndex(R=>R.id===h),w=s.find((R,b)=>b>C&&!n.has(R.id));if((w==null?void 0:w.parentId)!==g){const R=s.find(b=>b.id===g);c=An(r[u],(d=R==null?void 0:R.parentId)!=null?d:null,c);break}else if((w==null?void 0:w.children.length)>0){c=An(r[u],w.id,c);break}const S=Be(Array.isArray(f)?f[0]+1:f+1,o,i);a=H.moveItemOrRange(f,S,a,!1),i-=Array.isArray(f)?f[1]-f[0]+1:1;break}}}return{newMoves:a,groups:c}}handleMoveColumns(e){const{onMovedColumnsChanged:t,movedColumns:n,onColumnHeaderGroupChanged:s}=this.props,{newMoves:o,groups:i}=this.moveSelectedColumns(e);let r;e===Qe.MOVE_OPTIONS.TOP&&(r=()=>{var l,a;(a=(l=this.list)==null?void 0:l.parentElement)==null||a.scroll({top:0})}),e===Qe.MOVE_OPTIONS.BOTTOM&&(r=()=>{var l,a;(a=(l=this.list)==null?void 0:l.parentElement)==null||a.scroll({top:this.list.parentElement.scrollHeight})}),s(i),o.length>0&&t(n.concat(o),r)}getSortMoves(e,t,n){const s=[...e],o=t===Qe.SORTING_OPTIONS.ASC;s.sort((l,a)=>{const c=l.id.toUpperCase(),d=a.id.toUpperCase();return Wi.sort(c,d,o)});let i=[...n],r=Math.min(...s.flatMap(l=>{const{modelIndex:a}=l.data;return Array.isArray(a)?H.getVisibleIndexes(a,i):H.getVisibleIndex(a,i)}));for(let l=0;l<s.length;l+=1){const a=s[l],{modelIndex:c}=a.data,d=Array.isArray(c)?H.getVisibleIndexes(c,i):H.getVisibleIndex(c,i);i=Array.isArray(d)?H.moveRange([Math.min(...d),Math.max(...d)],r,i,!0):H.moveItem(d,r,i),Array.isArray(d)&&(i=this.getSortMoves(a.children,t,i)),r+=Array.isArray(c)?c.length:1}return i}handleSortColumns(e){const{model:t,onMovedColumnsChanged:n}=this.props,s=this.getSortMoves(this.getTreeItems(),e,t.initialMovedColumns);n(s)}handleItemClick(e,t){if(t.stopPropagation(),t.target instanceof HTMLElement&&(t.target.tagName==="BUTTON"||t.target.tagName==="INPUT"))return;t.currentTarget.focus();const{selectedColumns:n,lastSelectedColumn:s}=this.state,o=H.isModifierKeyDown(t),i=t.shiftKey,r=n.has(e),l=[e];if(r&&o){this.removeColumnFromSelected(e);return}const a=Tt(this.getTreeItems());if(r&&!i&&s===e){const c=a.find(({id:u})=>u===e);if(M(c),Tt(c.children).length+1===n.size){this.resetSelection();return}}if(i){const c=a.findIndex(u=>u.id===e),d=a.findIndex(u=>u.id===s);l.push(...a.slice(Math.min(d,c),Math.max(d,c)+1).map(u=>u.id))}this.addColumnToSelected(l,o||i),this.setState({lastSelectedColumn:e})}addColumnToSelected(e,t){const{selectedColumns:n}=this.state,s=new Set(t?[...n.values()].concat(e):e);Tt(this.getTreeItems()).forEach(({id:i,children:r})=>{s.has(i)&&r.forEach(l=>s.add(l.id))}),this.setState({selectedColumns:s})}removeColumnFromSelected(e){const{selectedColumns:t}=this.state,n=Tt(this.getTreeItems()),s=n.find(({id:i})=>i===e);M(s);let o=n.find(({id:i})=>i===s.parentId);for(Tt(s==null?void 0:s.children).forEach(i=>t.delete(i.id));o!=null;){t.delete(o.id);const i=o.parentId;o=n.find(({id:r})=>r===i)}t.delete(e),this.setState({selectedColumns:new Set(t)})}handleDragStart(e){const{selectedColumns:t}=this.state;t.has(e)||this.addColumnToSelected([e],!1)}handleDragEnd(e,t){const{movedColumns:n,onMovedColumnsChanged:s,columnHeaderGroups:o,onColumnHeaderGroupChanged:i}=this.props,r=this.getSelectedParentItems(),l=Tt(this.getTreeItems()).map((h,g)=>({...h,index:g})),a=this.getFirstMovableIndex(),c=this.getLastMovableIndex();M(a),M(c);const{groups:d,movedColumns:u}=kh(e,t,n,o,l,r,a,c);i(d),s(u)}handleGroupNameChange(e,t){const{columnHeaderGroups:n,onColumnHeaderGroupChanged:s}=this.props,o=[...n],i=e.name,r=o.findIndex(({name:d})=>d===i),l=o[r];M(l);const a=new Bt(l);a.name=t,o.splice(r,1,a);const c=o.findIndex(({name:d})=>d===a.parent);if(c>=0){const d=new Bt(o[c]);d.removeChildren([i]),d.addChildren([t]),o.splice(c,1,d)}s(o)}handleGroupDelete(e){const{columnHeaderGroups:t,onColumnHeaderGroupChanged:n}=this.props,s=t.filter(i=>i.name!==e.name),o=s.findIndex(i=>i.name===e.parent);if(o>=0){const i=new Bt(s[o]);i.addChildren(e.children),i.removeChildren([e.name]),s.splice(o,1,i)}n(s)}handleGroupCreate(){const{movedColumns:e,onMovedColumnsChanged:t,onColumnHeaderGroupChanged:n}=this.props,{newMoves:s,groups:o}=this.moveSelectedColumns(Qe.MOVE_OPTIONS.TOP),i=o.filter(d=>!d.isNew),r=this.getSelectedParentItems(),l=r.map(d=>d.data.modelIndex).flat().filter(d=>d>=0),a=`${Bt.NEW_GROUP_PREFIX}-${Date.now()}`,c=new Bt({name:a,children:r.map(({id:d})=>d),depth:0,childIndexes:[...new Set(l)]});t(e.concat(s),()=>{var d,u;(u=(d=this.list)==null?void 0:d.parentElement)==null||u.scroll({top:0})}),n(i.concat([c])),this.resetSelection()}validateGroupName(e){const{model:t,columnHeaderGroups:n}=this.props,{columns:s}=t;return Ys.isValidColumnName(e)?s.some(({name:o})=>o===e)||n.some(({name:o})=>o===e)?"Duplicate name":"":"Invalid name"}getFirstMovableIndex(){const{model:e,movedColumns:t}=this.props;return this.getMemoizedFirstMovableIndex(e,e.columns,t)}getLastMovableIndex(){const{model:e,movedColumns:t}=this.props;return this.getMemoizedLastMovableIndex(e,e.columns,t)}getTreeItems(){const{model:e,movedColumns:t,hiddenColumns:n,columnHeaderGroups:s}=this.props,{selectedColumns:o}=this.state;return this.memoizedGetTreeItems(e.columns,t,s,n,o)}getSelectedParentItems(){const{selectedColumns:e}=this.state;return Tt(this.getTreeItems()).filter(({id:n,parentId:s})=>e.has(n)&&!e.has(s!=null?s:""))}render(){const{model:e,hiddenColumns:t,onColumnVisibilityChanged:n}=this.props,{selectedColumns:s,searchFilter:o}=this.state,i=s.size>0,r=this.getTreeItems(),l=new Map(Tt(r).map(p=>[p.id,p.data.modelIndex])),a=new Set(t),c=[...new Set(i?[...s.values()].map(p=>l.get(p)).filter(p=>p!=null).flat():r.map(p=>p.data.modelIndex).flat())],d=c.some(p=>!a.has(p)),u=d?"Hide All":"Show All",h=d?"Hide Selected":"Show Selected",g=this.makeVisibilityOrderingList(e.columns,r);return y("div",{role:"menu",className:"visibility-ordering-builder",tabIndex:0,children:[y("div",{className:"top-menu",children:[m(z,{kind:"ghost",className:"toggle-visibility-btn",onClick:()=>{n(c,!d)},icon:d?Gi:cl,tooltip:"Toggle column visibility",children:i?h:u}),m(Xs,{className:"visibility-search",value:o,matchCount:o?s.size:void 0,onChange:this.handleSearchInputChange})]}),y("div",{className:"top-menu",children:[m(z,{kind:"ghost",icon:ja,tooltip:"Reset to default",onClick:()=>{this.resetVisibilityOrdering()},children:"Reset"}),m("span",{className:"vertical-divider"}),m(z,{kind:"ghost",icon:_i,tooltip:"Sort ascending",onClick:()=>{this.handleSortColumns(Qe.SORTING_OPTIONS.ASC)}}),m(z,{kind:"ghost",icon:Hi,tooltip:"Sort descending",onClick:()=>{this.handleSortColumns(Qe.SORTING_OPTIONS.DSC)}}),m("span",{className:"vertical-divider"}),y(z,{kind:"ghost",tooltip:"Create group from selection",disabled:!i,onClick:this.handleGroupCreate,children:[y("span",{className:"fa-layers",style:{marginRight:"0.75rem"},children:[m(te,{mask:Za,icon:qo,transform:"right-7 down-5 shrink-6"}),m(te,{icon:Ja,transform:"right-8 down-6 shrink-8"})]}),"Group"]}),m("span",{className:"vertical-divider"}),m(z,{kind:"ghost",icon:ec,tooltip:"Move selection up",onClick:()=>{this.handleMoveColumns(Qe.MOVE_OPTIONS.UP)},disabled:!i}),m(z,{kind:"ghost",icon:tc,tooltip:"Move selection down",onClick:()=>{this.handleMoveColumns(Qe.MOVE_OPTIONS.DOWN)},disabled:!i}),m(z,{kind:"ghost",icon:nc,tooltip:"Move selection to top",onClick:()=>{this.handleMoveColumns(Qe.MOVE_OPTIONS.TOP)},disabled:!i}),m(z,{kind:"ghost",icon:sc,tooltip:"Move selection to bottom",onClick:()=>{this.handleMoveColumns(Qe.MOVE_OPTIONS.BOTTOM)},disabled:!i})]}),m("div",{role:"menu",className:ee("visibility-ordering-list"),children:m("div",{className:"column-list",ref:p=>{this.list=p},children:g})})]})}};let tr=Qe;tr.SORTING_OPTIONS={DSC:"DSC",ASC:"ASC"};tr.MOVE_OPTIONS={TOP:"TOP",BOTTOM:"BOTTOM",UP:"UP",DOWN:"DOWN"};class Io extends F.exports.PureComponent{constructor(t){super(t),this.handleSearchValueChange=this.handleSearchValueChange.bind(this),this.toggleColumn=this.toggleColumn.bind(this),this.selectAll=this.selectAll.bind(this),this.clear=this.clear.bind(this),this.selectNumbers=this.selectNumbers.bind(this),this.searchField=Fe.createRef(),this.state={isConfigureColumnsShown:!1}}static createSearchFilter(t,n,s,o){const i=o?s.filter(r=>!n.includes(r.name)).map(r=>r.name):n;if(t&&i.length>0){const r=E.FilterValue.ofString(t);return i.length===s.length?E.FilterCondition.search(r):E.FilterCondition.search(r,s.filter(a=>i.includes(a.name)).map(a=>a.filter()))}}focus(){var t;(t=this.searchField.current)==null||t.focus()}handleSearchValueChange(t){const{onChange:n,selectedColumns:s,invertSelection:o}=this.props;n(t.target.value,s,o)}sendColumnChange(t,n){const{onChange:s,value:o}=this.props;s(o,t,n)}setInvertSelection(t){const{onChange:n,value:s}=this.props;n(s,[],t)}toggleColumn(t){const{selectedColumns:n,invertSelection:s}=this.props;if(n.includes(t))this.sendColumnChange(n.filter(o=>o!==t),s);else{const o=n.slice();o.push(t),this.sendColumnChange(o,s)}}selectAll(){this.setInvertSelection(!0)}clear(){this.setInvertSelection(!1)}selectNumbers(){const{columns:t}=this.props;this.sendColumnChange(t.filter(n=>I.isNumberType(n.type)).map(n=>n.name),!1)}render(){const{value:t,selectedColumns:n,invertSelection:s,columns:o}=this.props,{isConfigureColumnsShown:i}=this.state,r=n.length===0&&s===!0||n.length===o.length&&s===!1,l=n.length===0&&s===!1||n.length===o.length&&s===!0;let a;return r?a=y(Oe,{children:[m(te,{icon:ko,mask:di,transform:"shrink-2 down-5 right-7"}),m(te,{icon:oc,className:"text-primary",transform:"shrink-4 down-5 right-7"})]}):l?a=y(Oe,{children:[m(te,{icon:qo,mask:di,transform:"shrink-1 down-5 right-7"}),m(te,{icon:Cr,className:"text-danger",transform:"shrink-4 down-5 right-7"})]}):a=y(Oe,{children:[m(te,{icon:ko,mask:di,transform:"shrink-2 down-5 right-7"}),m(te,{icon:ic,className:"text-primary",transform:"shrink-4 down-5 right-7"})]}),y("div",{className:"cross-column-container",children:[m(Xs,{className:"cross-column-search",placeholder:"Search Data...",value:t,onChange:this.handleSearchValueChange,ref:this.searchField}),y("button",{type:"button",className:"btn btn-link btn-link-icon px-2",onClick:()=>{i?this.setState({isConfigureColumnsShown:!1}):this.setState({isConfigureColumnsShown:!0})},children:[m("div",{className:"fa-layers",children:a}),m(Rt,{children:"Configure Columns"}),m(dl,{isShown:i,className:"cross-column-popper",onExited:()=>{this.setState({isConfigureColumnsShown:!1})},closeOnBlur:!0,interactive:!0,children:y("div",{className:"cross-column-popup",children:["Searched Columns",m("div",{className:"cross-column-scroll",children:o.map(c=>y(Fe.Fragment,{children:[m(ln,{className:"cross-column-checkbox",checked:s?!n.includes(c.name):n.includes(c.name),onChange:()=>this.toggleColumn(c.name),children:c.name}),c.type.substring(c.type.lastIndexOf(".")+1)]},c.name))}),y("div",{className:"cross-column-button-bar",children:[m("button",{type:"button",className:"btn btn-link",onClick:this.selectAll,children:"Select All"}),m("button",{type:"button",className:"btn btn-link",onClick:this.clear,children:"Clear"}),m("button",{type:"button",className:"btn btn-link",onClick:this.selectNumbers,children:"Numbers Only"})]}),l&&y("p",{className:"text-danger",children:[m(te,{icon:Cr})," Select at least one column to search."]})]})})]})]})}}const Tn=ie.module("PartitionSelectorSearch"),Ph=150,Wl=class extends F.exports.Component{constructor(e){super(e),this.debounceUpdateFilter=vt(()=>{this.updateFilter()},Ph),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleInputFocus=this.handleInputFocus.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleListKeydown=this.handleListKeydown.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleTableUpdate=this.handleTableUpdate.bind(this),this.handleTextChange=this.handleTextChange.bind(this),this.handleViewportChange=this.handleViewportChange.bind(this),this.itemList=null,this.searchInput=null,this.timer=null,this.state={offset:0,itemCount:0,items:[],text:"",isLoading:!0}}static handleError(e){e instanceof xi||Tn.error(e)}componentDidMount(){this.startListening()}componentDidUpdate(e,t){const{isLoading:n,itemCount:s}=this.state,{onListResized:o}=this.props;(s!==t.itemCount||n!==t.isLoading)&&o()}componentWillUnmount(){this.debounceUpdateFilter.cancel(),this.stopListening()}handleKeyDown(e){if(this.itemList==null)return!1;const{items:t,itemCount:n}=this.state;switch(e.key){case"Enter":{let s=null;if(t.length>0)s=t[0].value;else{const{text:o}=this.state;s=o.trim()}if(s.length>0){const{onSelect:o}=this.props;o(s)}return e.stopPropagation(),e.preventDefault(),!0}case"ArrowDown":return n>0&&this.itemList.focusItem(1),e.stopPropagation(),e.preventDefault(),!0;default:return!1}}handleListKeydown(e){switch(e.key){case"Escape":break;default:this.focus();break}}handleFilterChange(){Tn.debug2("handleFilterChange");const{table:e}=this.props,t=e.size;this.setState({itemCount:t,isLoading:!0})}handleInputFocus(){this.itemList&&this.itemList.focusItem(0)}handleSelect(e){Tn.debug2("handleSelect",e);const{onSelect:t}=this.props,{offset:n,items:s}=this.state,o=e-n;if(o<0||s.length<=o){Tn.error("No data for item",e);return}const{value:i}=s[o];t(i)}handleTableUpdate(e){const t=e.detail,{offset:n}=t,s=[],{getFormattedString:o,table:i}=this.props,r=i.columns[0];for(let a=0;a<t.rows.length;a+=1){const d=t.rows[a].get(r),u=o(d,r.type,r.name);s.push({displayValue:u,value:d})}const l=i.size;Tn.debug2("handleTableUpdate",l,n,s.length),this.setState({itemCount:l,items:s,offset:n,isLoading:!1})}handleTextChange(e){Tn.debug2("handleTextChange");const{value:t}=e.target;this.setState({text:t}),this.debounceUpdateFilter()}handleViewportChange(e,t){Tn.debug2("handleViewportChange",e,t);const n=Math.max(1,t-e),s=Math.max(0,e-n),o=t+n,{table:i}=this.props;i.setViewport(s,o)}focus(){this.searchInput&&this.searchInput.focus()}startListening(){const{initialPageSize:e,table:t}=this.props;t.addEventListener(E.Table.EVENT_UPDATED,this.handleTableUpdate),t.addEventListener(E.Table.EVENT_FILTERCHANGED,this.handleFilterChange),t.setViewport(0,e)}stopListening(){const{table:e}=this.props;e.removeEventListener(E.Table.EVENT_UPDATED,this.handleTableUpdate),e.removeEventListener(E.Table.EVENT_FILTERCHANGED,this.handleFilterChange)}updateFilter(){const{initialPageSize:e,table:t}=this.props,{text:n}=this.state,s=n.trim(),o=[];if(s.length>0){const r=t.columns[0].filter().invoke("matches",E.FilterValue.ofString(`(?s)(?i).*\\Q${s}\\E.*`));o.push(r)}Tn.debug2("updateFilter",o),t.applyFilter(o),t.setViewport(0,e)}render(){const{isLoading:e,itemCount:t,items:n,offset:s,text:o}=this.state,i=Math.min(t,Wl.MAX_VISIBLE_ITEMS)*xo.DEFAULT_ROW_HEIGHT+11;return y("div",{className:"iris-grid-partition-selector-search",children:[m("div",{className:"search-container",children:m("input",{type:"text",ref:r=>{this.searchInput=r},value:o,placeholder:"Available Partitions",onChange:this.handleTextChange,onFocus:this.handleInputFocus,onKeyDown:this.handleKeyDown,className:"form-control input-partition"})}),!e&&t>0&&m("div",{className:"iris-grid-partition-selector-search-list",onKeyDown:this.handleListKeydown,role:"presentation",style:{height:i},children:m(xo,{ref:r=>{this.itemList=r},itemCount:t,items:n,offset:s,onSelect:this.handleSelect,onViewportChange:this.handleViewportChange})}),!e&&t===0&&m("div",{className:"iris-grid-partition-selector-search-empty",children:"No results"}),e&&y("div",{className:"iris-grid-partition-selector-loading",children:[m(dn,{}),"\xA0Loading..."]})]})}};let ti=Wl;ti.MAX_VISIBLE_ITEMS=12;ti.defaultProps={initialPageSize:100,onSelect:()=>{},onListResized:()=>{}};ti.propTypes={getFormattedString:B.exports.func.isRequired,table:B.exports.shape({addEventListener:B.exports.func.isRequired,removeEventListener:B.exports.func.isRequired,columns:B.exports.arrayOf(B.exports.shape({name:B.exports.string.isRequired,type:B.exports.string.isRequired,filter:B.exports.func.isRequired})),size:B.exports.number.isRequired,applyFilter:B.exports.func.isRequired,setViewport:B.exports.func.isRequired}).isRequired,initialPageSize:B.exports.number,onSelect:B.exports.func,onListResized:B.exports.func};const hs=ie.module("IrisGridPartitionSelector"),_h=250;class $l extends F.exports.Component{constructor(t){super(t),this.debounceUpdate=vt(()=>{this.sendUpdate()},_h),this.handleAppendClick=this.handleAppendClick.bind(this),this.handleCloseClick=this.handleCloseClick.bind(this),this.handleIgnoreClick=this.handleIgnoreClick.bind(this),this.handlePartitionChange=this.handlePartitionChange.bind(this),this.handlePartitionSelect=this.handlePartitionSelect.bind(this),this.handlePartitionListResized=this.handlePartitionListResized.bind(this),this.handleSearchOpened=this.handleSearchOpened.bind(this),this.handleSearchClosed=this.handleSearchClosed.bind(this),this.searchMenu=null,this.selectorSearch=null;const{partition:n}=t;this.state={partition:n}}componentWillUnmount(){this.debounceUpdate.cancel()}handleAppendClick(){hs.debug2("handleAppendClick");const{onAppend:t}=this.props,{partition:n}=this.state;t(n)}handleCloseClick(){hs.debug2("handleCloseClick"),this.sendDone()}handleIgnoreClick(){hs.debug2("handleIgnoreClick"),this.sendFetchAll()}handlePartitionChange(t){hs.debug2("handlePartitionChange");const{value:n}=t.target;this.setState({partition:n}),this.debounceUpdate()}handlePartitionSelect(t){this.searchMenu&&this.searchMenu.closeMenu(),this.setState({partition:t},()=>{this.sendUpdate()})}handlePartitionListResized(){this.searchMenu&&this.searchMenu.scheduleUpdate()}handleSearchClosed(){const{table:t}=this.props;t.applyFilter([])}handleSearchOpened(){this.selectorSearch&&this.selectorSearch.focus()}sendDone(){this.debounceUpdate.flush();const{onDone:t}=this.props;t()}sendUpdate(){hs.debug2("sendUpdate");const{onChange:t}=this.props,{partition:n}=this.state;t(n)}sendFetchAll(){hs.debug2("sendFetchAll"),this.debounceUpdate.cancel();const{onFetchAll:t}=this.props;t()}render(){const{columnName:t,getFormattedString:n,onDone:s,table:o}=this.props,{partition:i}=this.state,r=m(ti,{getFormattedString:n,table:o,onSelect:this.handlePartitionSelect,onListResized:this.handlePartitionListResized,ref:l=>{this.selectorSearch=l}},"search");return y("div",{className:"iris-grid-partition-selector",children:[m("div",{className:"status-message",children:y("span",{children:['Filtering "',t,'" partition to']})}),y("div",{className:"input-group",children:[m("input",{type:"text",value:i,onChange:this.handlePartitionChange,className:"form-control input-partition"}),m("div",{className:"input-group-append",children:y("button",{type:"button",className:"btn btn-outline-primary",children:[m(te,{icon:Yn}),m(Rt,{children:"Partitions"}),m(Ss,{ref:l=>{this.searchMenu=l},actions:[{menuElement:r}],onMenuOpened:this.handleSearchOpened,onMenuClosed:this.handleSearchClosed})]})})]}),m("div",{className:"iris-grid-partition-selector-spacer"}),m("button",{type:"button",className:"btn btn-outline-primary btn-ignore",onClick:this.handleIgnoreClick,children:"Ignore & Fetch All"}),m("button",{type:"button",className:"btn btn-outline-primary btn-append",onClick:this.handleAppendClick,children:"Append Command"}),m("button",{type:"button",className:"btn btn-link btn-link-icon btn-close",onClick:s,children:m(te,{icon:qs})})]})}}$l.defaultProps={onAppend:()=>{},onChange:()=>{},onFetchAll:()=>{},onDone:()=>{},partition:""};const Hh=ie.module("SelectDistinctBuilder");class zl extends F.exports.Component{constructor(t){super(t),this.handleAddColumnClick=this.handleAddColumnClick.bind(this),this.handleDeleteColumn=this.handleDeleteColumn.bind(this),this.handleDropdownChanged=this.handleDropdownChanged.bind(this);const{model:n,selectDistinctColumns:s}=this.props;this.state={inputs:s.length>0?[...s]:[""],columns:n.originalColumns}}componentDidUpdate(t,n){const{inputs:s}=this.state,{onChange:o}=this.props;if(n.inputs!==s){const i=s.filter(r=>r!=="");rt(n.inputs.filter(r=>r!==""),i)||o(i)}}handleAddColumnClick(){this.setState(({inputs:t})=>({inputs:[...t,""]}))}handleDeleteColumn(t){this.setState(({inputs:n})=>({inputs:n.length===1&&t===0?[""]:n.filter((s,o)=>t!==o)}))}handleDropdownChanged(t,n){Hh.debug("handleDropdownChanged",t,n);const{value:s}=n.target;this.setState(({inputs:o})=>{const i=[...o];return i[t]=s,{inputs:i}})}renderInputs(){const{columns:t,inputs:n}=this.state;return n.map((s,o)=>{const i=t.filter(({name:r})=>r===s||!n.includes(r)).map(({name:r})=>m("option",{value:r,children:r},r));return y("div",{className:"form-inline px-3 pb-3",children:[y("select",{className:"form-control custom-select col",value:s,onChange:r=>this.handleDropdownChanged(o,r),children:[m("option",{value:"",children:"Select a column"}),i]}),(n.length>1||s!=="")&&m(z,{kind:"ghost",className:"ml-1 px-2",onClick:()=>{this.handleDeleteColumn(o)},icon:m(te,{icon:un,transform:"grow-3"}),tooltip:"Delete column"})]},o)})}render(){const{columns:t,inputs:n}=this.state,s=n.length>=t.length;return y("div",{role:"presentation",className:"select-distinct-builder-container h-100",children:[m("div",{className:"select-distinct-title",children:"Display Unique Values From"}),this.renderInputs(),m("hr",{}),m("div",{className:"pt-1 px-3",children:m(z,{kind:"ghost",className:"btn-add-column",onClick:this.handleAddColumnClick,disabled:s,icon:vs,children:"Add Additional Column"})}),m("div",{className:"select-distinct-builder-footer",children:y("div",{className:"select-distinct-builder-hint",children:["Modifies a table to show unique value from a column, same as"," ",m("span",{className:"inline-code-snippet",children:'selectDistinct("Column")'}),". Filters will be reset and the resulting table will contain only the selected columns above."]})})]})}}zl.defaultProps={selectDistinctColumns:[],onChange:()=>{}};function nr({items:e,onChange:t=()=>{}}){return m(fl,{items:Array.from(e.entries()).map(([n,s])=>({title:nr.getAdvancedSettingsTitleForKey(n),isOn:s,onChange:o=>t(n,o)}))})}nr.getAdvancedSettingsTitleForKey=e=>{switch(e){case ts.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS:return"Control filters clear existing table filters";case ts.LINK_CHANGE_CLEARS_ALL_FILTERS:return"Inbound links clear existing table filters"}};const Ur=ie.module("ConditionalFormattingMenu"),wi=()=>{};function Vh(e){const{column:{type:t}}=e;if(I.isNumberType(t))return e.condition===Ne.IS_NULL||e.condition===Ne.IS_NOT_NULL?"":`${e.value}`;if(I.isCharType(t))return e.condition===it.IS_NULL||e.condition===it.IS_NOT_NULL?"":`${e.value}`;if(I.isStringType(t))return e.condition===mt.IS_NULL||e.condition===mt.IS_NOT_NULL?"":`"${e.value}"`;if(I.isDateType(t))return e.condition===it.IS_NULL||e.condition===it.IS_NOT_NULL?"":`${e.value}`;if(I.isBooleanType(t))return"";throw new Error(`Invalid column type ${t} in getRuleValue`)}function Uh(e){return I.isNumberType(e.column.type)&&e.condition===Ne.IS_BETWEEN?`${e.start} < ${e.column.name} < ${e.end}`:`${e.column.name} ${gu(e.column.type,e.condition)}
13
- ${Vh(e)}`}function Bh(e){const{rules:t=[],onChange:n=wi,onCreate:s=wi,onSelect:o=wi}=e,i=F.exports.useCallback((c,d,u)=>{c.stopPropagation(),Ur.debug("Rule clicked",d,u),o(u)},[o]),r=F.exports.useCallback((c,d,u)=>{c.stopPropagation(),Ur.debug("Delete button clicked",d,u);const h=[...t];h.splice(u,1),n(h)},[n,t]),l=F.exports.useCallback(c=>{c.stopPropagation()},[]),a=F.exports.useCallback(c=>{if(dt.stopDragging(),c.destination==null)return;const d=c.source.index,u=c.destination.index,h=[...t],g=t[d];h.splice(d,1),h.splice(u,0,g),n(h)},[n,t]);return y("div",{className:"conditional-formatting-rules",children:[m($o,{onDragStart:dt.startDragging,onDragEnd:a,children:m(Oi,{droppableId:"droppable-custom-columns",children:(c,d)=>y("div",{ref:c.innerRef,...c.droppableProps,className:ee("droppable-container",{dragging:d.draggingFromThisWith}),children:[t.length===0&&m("div",{className:"text-muted pl-2",children:"No formats defined"}),t.map((u,h)=>m(sl,{draggableId:`${h}-${u.type}`,index:h,disableInteractiveElementBlocking:!0,children:(g,p)=>m("div",{role:"menuitem",tabIndex:0,onClick:f=>i(f,u,h),className:ee("draggable-container",{dragging:p.isDragging}),ref:g.innerRef,...g.draggableProps,children:m("div",{className:"conditional-formatting-list-item",children:y("div",{className:"formatting-item",children:[m("div",{className:"rule-icon",children:m("span",{className:"rule-icon-bg",style:{backgroundColor:Po(u.config.style),color:_o(u.config.style)},children:u.type===qt.ROWS?"row":"col"})}),m("div",{className:"rule-title",children:Uh(u.config)}),m(z,{kind:"ghost",className:"ml-1 px-2",onClick:f=>r(f,u,h),icon:un,tooltip:"Delete rule"}),y("button",{type:"button",className:"btn btn-link btn-link-icon px-2 btn-drag-handle",onClick:l,...g.dragHandleProps,children:[m(Rt,{children:"Drag to re-order"}),m(te,{icon:Ui})]})]})})})},`${h}-${u.type}`)),c.placeholder]})})}),m("hr",{}),m(z,{kind:"ghost",onClick:s,icon:vs,children:"Add New Rule"})]})}const ms=ie.module("ConditionEditor"),Gh=()=>{},Wh=[Ne.IS_EQUAL,Ne.IS_NOT_EQUAL,Ne.IS_BETWEEN,Ne.GREATER_THAN,Ne.GREATER_THAN_OR_EQUAL,Ne.LESS_THAN,Ne.LESS_THAN_OR_EQUAL,Ne.IS_NULL,Ne.IS_NOT_NULL].map(e=>m("option",{value:e,children:Zd(e)},e)),$h=[mt.IS_EXACTLY,mt.IS_NOT_EXACTLY,mt.CONTAINS,mt.DOES_NOT_CONTAIN,mt.STARTS_WITH,mt.ENDS_WITH,mt.IS_NULL,mt.IS_NOT_NULL].map(e=>m("option",{value:e,children:Jd(e)},e)),zh=[it.IS_EXACTLY,it.IS_NOT_EXACTLY,it.IS_BEFORE,it.IS_BEFORE_OR_EQUAL,it.IS_AFTER,it.IS_AFTER_OR_EQUAL,it.IS_NULL,it.IS_NOT_NULL].map(e=>m("option",{value:e,children:eu(e)},e)),qh=[Us.IS_TRUE,Us.IS_FALSE,Us.IS_NULL,Us.IS_NOT_NULL].map(e=>m("option",{value:e,children:tu(e)},e)),Yh=[Xn.IS_EQUAL,Xn.IS_NOT_EQUAL,Xn.IS_NULL,Xn.IS_NOT_NULL].map(e=>m("option",{value:e,children:nu(e)},e));function Xh(e,t,n,s){return e===Ne.IS_NULL||e===Ne.IS_NOT_NULL||e===Ne.IS_BETWEEN&&n!=null&&n!==""&&!Number.isNaN(Number.parseFloat(n))&&s!=null&&s!==""&&!Number.isNaN(Number.parseFloat(s))||e!==Ne.IS_BETWEEN&&t!==void 0&&t!==""&&!Number.isNaN(Number.parseFloat(t))}function Kh(e,t,n,s,o,i,r){switch(e){case Ne.IS_EQUAL:case Ne.IS_NOT_EQUAL:case Ne.GREATER_THAN:case Ne.GREATER_THAN_OR_EQUAL:case Ne.LESS_THAN:case Ne.LESS_THAN_OR_EQUAL:return m("input",{type:"number",className:"form-control",placeholder:"Enter value",value:o!=null?o:"",onChange:t});case Ne.IS_BETWEEN:return y("div",{className:"d-flex flex-row",children:[m("input",{type:"number",className:"form-control d-flex mr-2",placeholder:"Start value",value:i!=null?i:"",onChange:n}),m("input",{type:"number",className:"form-control d-flex",placeholder:"End value",value:r!=null?r:"",onChange:s})]});case Ne.IS_NULL:case Ne.IS_NOT_NULL:return null}}function Qh(e,t,n){switch(e){case mt.IS_NULL:case mt.IS_NOT_NULL:return null;default:return m("input",{type:"text",className:"form-control",placeholder:"Enter value",value:n!=null?n:"",onChange:t})}}function jh(e,t,n){switch(e){case it.IS_NULL:case it.IS_NOT_NULL:return null;default:return m("input",{type:"text",className:"form-control",placeholder:"Enter value",value:n!=null?n:"",onChange:t})}}function Zh(){return null}function Jh(e,t,n){switch(e){case Xn.IS_NULL:case Xn.IS_NOT_NULL:return null;default:return m("input",{type:"text",className:"form-control",maxLength:1,placeholder:"Enter value",value:n!=null?n:"",onChange:t})}}function ql(e){const{column:t,config:n,onChange:s=Gh}=e,o=t.type,[i,r]=F.exports.useState(o),[l,a]=F.exports.useState(n.condition),[c,d]=F.exports.useState(n.value),[u,h]=F.exports.useState(n.start),[g,p]=F.exports.useState(n.end);o!==i&&(a(El(o)),d(void 0),h(void 0),p(void 0),r(o));const f=F.exports.useMemo(()=>{if(o===void 0)return[];if(I.isNumberType(o))return Wh;if(I.isCharType(o))return Yh;if(I.isStringType(o))return $h;if(I.isDateType(o))return zh;if(I.isBooleanType(o))return qh},[o]),C=F.exports.useCallback(b=>{const{value:v}=b.target;ms.debug("handleConditionChange",v),a(v)},[]),w=F.exports.useCallback(b=>{const{value:v}=b.target;ms.debug("handleValueChange",v),d(v)},[]),S=F.exports.useCallback(b=>{const{value:v}=b.target;ms.debug("handleStartValueChange",v),h(v)},[]),T=F.exports.useCallback(b=>{const{value:v}=b.target;ms.debug("handleEndValueChange",v),p(v)},[]);F.exports.useEffect(function(){let v=!0;l===void 0&&(ms.debug("Unable to create formatting rule. Condition is not selected."),v=!1),I.isNumberType(t.type)&&!Xh(l,c,u,g)&&(ms.debug("Unable to create formatting rule. Invalid value",c),v=!1),s({condition:l,value:c,start:u,end:g},v)},[s,t.type,l,c,u,g]);const R=F.exports.useMemo(()=>{if(o===void 0)return null;if(I.isNumberType(o))return Kh(l,w,S,T,c,u,g);if(I.isCharType(o))return Jh(l,w,c);if(I.isStringType(o))return Qh(l,w,c);if(I.isDateType(o))return jh(l,w,c);if(I.isBooleanType(o))return Zh()},[o,l,c,u,g,w,S,T]);return y("div",{className:"condition-editor mb-2",children:[m("select",{value:l,id:"condition-select",className:"custom-select mb-2",onChange:C,children:f}),R]})}const em=ie.module("StyleEditor"),tm="#fcfcfa",nm="#f0f0ee",sm="#1a171a",om=200,im=()=>{};function Yl(e){var T,R;const{config:t,onChange:n=im}=e,[s,o]=F.exports.useState(t.type),[i,r]=F.exports.useState((R=(T=t.customConfig)==null?void 0:T.background)!=null?R:tm),[l,a]=F.exports.useState(!1),[c,d]=F.exports.useState(om),u=F.exports.useRef(null),h=F.exports.useCallback(b=>{const{value:v}=b.target;em.debug("handleBackgroundChange",v),r(v)},[]),g=F.exports.useCallback(()=>{l&&a(!1)},[l]),p=F.exports.useCallback(()=>{l||C(),a(!l)},[l]),f=F.exports.useMemo(()=>[Ht.NO_FORMATTING,Ht.POSITIVE,Ht.NEGATIVE,Ht.WARN,Ht.NEUTRAL,Ht.ACCENT_1,Ht.ACCENT_2,Ht.CUSTOM],[]);function C(){u.current&&d(u.current.getBoundingClientRect().width)}F.exports.useEffect(function(){n({type:s,customConfig:{color:Yo.isDark(i)?nm:sm,background:i}})},[n,s,i]);const w=F.exports.useCallback(()=>{const b=[];for(let v=0;v<f.length;v+=1){const D=f[v],A=`option-${v}-${D}`;b.push(y(z,{kind:"inline",className:"style-option-btn",onClick:()=>{o(D),a(!1)},style:{color:_o({type:D}),background:Po({type:D})},children:[D===s&&m(te,{icon:Qn,className:"mr-2"}),D!==s&&m("span",{className:"mr-4"}),Mr(D)]},A))}return b},[f,s]),S=F.exports.useCallback(()=>m("div",{className:"style-menu-container",role:"presentation",style:{width:c},children:m("div",{className:"style-options",children:w()})}),[c,w]);return y("div",{className:"style-editor",children:[y("div",{className:"mb-2",ref:u,children:[m("label",{className:"mb-0",children:"Style"}),y(z,{kind:"inline",className:"cs-dropdown",style:{color:_o({type:s}),background:Po({type:s})},onClick:p,children:[Mr(s),m("span",{children:m(te,{icon:rc,className:"cs-caret"})}),m(Ss,{isShown:l,actions:{menuElement:S()},popperOptions:{placement:"bottom-start"},popperClassName:"style-dropdown-menu",onMenuClosed:g,menuStyle:{maxWidth:"100rem"}})]})]}),s===Ht.CUSTOM&&y("div",{className:"mb-2",children:[m("label",{className:"mb-0",children:"Background"}),m("input",{type:"color",value:i,className:"custom-select color-select",onChange:h})]})]})}const _s=ie.module("ColumnFormatEditor"),rm=()=>{};function lm(e){const{type:t,name:n}=e[0];return{column:{type:t,name:n},style:Rl(),...jo(t)}}function am(e){var C;const{columns:t,config:n=lm(t),onChange:s=rm}=e,[o,i]=F.exports.useState((C=t.find(w=>w.name===n.column.name&&w.type===n.column.type))!=null?C:t[0]),[r,l]=F.exports.useState(vl(n)),[a,c]=F.exports.useState(!1),[d,u]=F.exports.useState(n.style),h=F.exports.useCallback(w=>{const S=t.find(({name:T})=>T===w);S!==void 0?(i(S),o.type!==S.type&&(l(jo(S.type)),c(!1))):_s.error(`Column ${w} not found.`)},[t,o]),g=F.exports.useCallback((w,S)=>{_s.debug("handleConditionChange",w,S),l(w),c(S)},[]),p=F.exports.useCallback(w=>{_s.debug("handleStyleChange",w),u(w)},[]);F.exports.useEffect(function(){if(o===void 0){_s.debug("Column is not selected, skip update.");return}if(d===void 0){_s.debug("Style is not selected, skip update.");return}const{type:S,name:T}=o;s({column:{type:S,name:T},style:d,...r},a)},[s,o,d,r,a]);const f=t.map(({name:w})=>({title:w,value:w}));return y("div",{className:"conditional-rule-editor form",children:[y("div",{className:"mb-2",children:[m("label",{className:"mb-0",children:"Format Cell If"}),m(ul,{defaultValue:o==null?void 0:o.name,options:f,inputPlaceholder:"Select a column",spellCheck:!1,onChange:h,searchPlaceholder:"Filter columns"})]}),o!==void 0&&y(Oe,{children:[m(ql,{column:o,config:r,onChange:g}),m(Yl,{config:d,onChange:p})]})]})}const Hs=ie.module("RowFormatEditor"),cm=()=>{};function dm(e){const{type:t,name:n}=e[0];return{column:{type:t,name:n},style:Rl(),...jo(t)}}function um(e){var C;const{columns:t,config:n=dm(t),onChange:s=cm}=e,[o,i]=F.exports.useState((C=t.find(w=>w.name===n.column.name&&w.type===n.column.type))!=null?C:t[0]),[r,l]=F.exports.useState(vl(n)),[a,c]=F.exports.useState(!1),[d,u]=F.exports.useState(n.style),h=F.exports.useCallback(w=>{const S=t.find(({name:T})=>T===w);S!==void 0?(i(S),o.type!==S.type&&(l(jo(S.type)),c(!1))):Hs.error(`Column ${w} not found.`)},[t,o]),g=F.exports.useCallback((w,S)=>{Hs.debug("handleConditionChange",w,S),l(w),c(S)},[]),p=F.exports.useCallback(w=>{Hs.debug("handleStyleChange",w),u(w)},[]);F.exports.useEffect(function(){if(o===void 0){Hs.debug("Column is not selected, skip update.");return}if(d===void 0){Hs.debug("Style is not selected, skip update.");return}const{type:S,name:T}=o;s({column:{type:S,name:T},style:d,...r},a)},[s,o,d,r,a]);const f=t.map(({name:w})=>({title:w,value:w}));return y("div",{className:"conditional-rule-editor form",children:[y("div",{className:"mb-2",children:[m("label",{className:"mb-0",children:"Format Row If"}),m(ul,{defaultValue:o==null?void 0:o.name,options:f,inputPlaceholder:"Select a column",spellCheck:!1,onChange:h,searchPlaceholder:"Filter columns"})]}),o!==void 0&&y(Oe,{children:[m(ql,{column:o,config:r,onChange:g}),m(Yl,{config:d,onChange:p})]})]})}const Si=ie.module("ConditionalFormatEditor"),bi=()=>{};function hm(e){switch(e){case qt.CONDITIONAL:return m(sh,{});case qt.ROWS:return m(oh,{})}}function mm(e){switch(e){case qt.CONDITIONAL:return"Conditional";case qt.ROWS:return"Rows"}}const Br=[qt.CONDITIONAL,qt.ROWS];function gm(e){var w;const{columns:t,onSave:n=bi,onUpdate:s=bi,onCancel:o=bi,rule:i}=e,r=t.filter(fu),[l,a]=F.exports.useState((w=i==null?void 0:i.type)!=null?w:Br[0]),[c,d]=F.exports.useState(i),[u,h]=F.exports.useState(!1),g=F.exports.useCallback(()=>{o()},[o]),p=F.exports.useCallback(()=>{if(c===void 0){Si.error("Rule is not defined.");return}n(c)},[n,c]),f=F.exports.useCallback(S=>{Si.debug("handleFormatterChange",S),a(S)},[]),C=F.exports.useCallback((S,T)=>{Si.debug("handleRuleChange",S,T,l);const R={type:l,config:S};d(R),h(T),s(T?R:void 0)},[s,l]);return y("div",{className:"conditional-format-editor form",children:[y("div",{className:"mb-2",children:[m("label",{className:"mb-0",htmlFor:"formatter-select",children:"Select Formatter"}),m("div",{className:"formatter-list",children:Br.map((S,T)=>m("div",{className:"formatter-type",children:y("button",{type:"button",className:ee("btn","btn-icon","btn-formatter-type",{active:S===l}),"data-index":T,onClick:()=>f(S),children:[hm(S),mm(S)]})},S))})]}),l===qt.CONDITIONAL&&m(am,{columns:r,config:c==null?void 0:c.config,onChange:C}),l===qt.ROWS&&m(um,{columns:r,config:c==null?void 0:c.config,onChange:C}),m("hr",{}),y("div",{className:"d-flex justify-content-end my-3",children:[m(z,{kind:"secondary",onClick:g,className:"mr-2",children:"Cancel"}),m(z,{kind:"primary",onClick:p,disabled:c===void 0||!u,children:"Done"})]})]})}function pm({type:e}){switch(e){case E.VariableType.TABLE:case E.VariableType.TABLEMAP:case E.VariableType.TREETABLE:case E.VariableType.HIERARCHICALTABLE:return m(te,{icon:Vi});case E.VariableType.FIGURE:return m(te,{icon:hl});case E.VariableType.PANDAS:return m(te,{icon:ac});default:return m(te,{icon:lc})}}class Xl extends F.exports.Component{constructor(t){super(t),this.container=null}componentDidMount(){this.colorize()}colorize(){const{children:t}=this.props;this.container&&t!=null&&an.colorizeElement(this.container,{theme:"dh-dark"})}render(){const{children:t,language:n}=this.props;return m("div",{children:m("div",{"data-lang":n,ref:s=>{this.container=s},style:{pointerEvents:"none"},children:t})})}}class fm{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}class Es{static hasComment(t){return t.comment!==void 0}static hasPattern(t){return t.pattern!==void 0}static hasOp(t){return t.op!==void 0}static parseArguments(t){return t==null||!(typeof t=="string"||t instanceof String)?[]:xa.parse(t).filter(n=>!this.hasComment(n)).map(n=>this.hasPattern(n)?n.pattern:this.hasOp(n)?n.op:`${n}`)}static formatTimestamp(t){if(t==null||!(t instanceof Date))return null;const n=`${t.getHours()}`.padStart(2,"0"),s=`${t.getMinutes()}`.padStart(2,"0"),o=`${t.getSeconds()}`.padStart(2,"0"),i=`${t.getMilliseconds()}`.padStart(3,"0");return`${n}:${s}:${o}.${i}`}static isTableType(t){return t===E.VariableType.TABLE||t===E.VariableType.TREETABLE||t===E.VariableType.HIERARCHICALTABLE}static isWidgetType(t){return t===E.VariableType.FIGURE||t===E.VariableType.OTHERWIDGET||t===E.VariableType.PANDAS}static isOpenableType(t){return Es.isTableType(t)||Es.isWidgetType(t)}static isFigureType(t){return t===E.VariableType.FIGURE}static isPandas(t){return t===E.VariableType.PANDAS}}function Kl({children:e}){return y("div",{className:"console-history-item-result",children:[m("div",{className:"console-history-gutter",children:"-"}),m("div",{className:"console-history-content",children:e})]})}Kl.propTypes={children:B.exports.node.isRequired};class Ql extends F.exports.Component{constructor(t){super(t),this.updateElapsed=this.updateElapsed.bind(this),this.startTime=Date.now(),this.state={elapsed:0}}componentDidMount(){this.timer=setInterval(this.updateElapsed,1e3)}componentWillUnmount(){this.timer&&clearInterval(this.timer),this.timer=void 0}updateElapsed(){this.setState({elapsed:Math.round((Date.now()-this.startTime)/1e3)})}render(){const{disabled:t,onCancelClick:n}=this.props,{elapsed:s}=this.state;return m("div",{className:ee("console-history-result-in-progress",{disabled:t}),children:y("span",{className:"badge",children:[m(dn,{}),"\xA0Running... ",Bi.formatElapsedTime(s),"\xA0",m(z,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:qs,tooltip:"Cancel",onClick:n,disabled:t})]})})}}Ql.defaultProps={disabled:!1};const Ai=class extends F.exports.PureComponent{constructor(e){super(e),this.handleKeyPress=this.handleKeyPress.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleToggleError=this.handleToggleError.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.mouseX=null,this.mouseY=null,this.isClicking=!1,this.state={isExpanded:!1,isTriggerHovered:!1}}handleKeyPress(e){switch(e.key){case"Enter":case" ":this.handleToggleError(),e.stopPropagation(),e.preventDefault();break}}handleMouseDown(e){this.mouseX=e.clientX,this.mouseY=e.clientY,this.isClicking=!0}handleMouseMove(e){this.mouseX!=null&&this.mouseY!=null?(Math.abs(e.clientX-this.mouseX)>=Ai.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=Ai.mouseDragThreshold)&&(this.isClicking=!1):this.isClicking&&(this.isClicking=!1)}handleMouseUp(e){this.isClicking&&!e.shiftKey&&!e.metaKey&&!e.altKey&&this.handleToggleError(),this.mouseX=null,this.mouseY=null,this.isClicking=!1}handleToggleError(){this.setState(e=>({isExpanded:!e.isExpanded}))}handleMouseEnter(){this.setState({isTriggerHovered:!0})}handleMouseLeave(){this.setState({isTriggerHovered:!1})}render(){const{isExpanded:e,isTriggerHovered:t}=this.state,{message:n}=this.props;M(n);const s=n.indexOf(`
14
- `),o=s>-1;let i=n;o&&(i=n.slice(0,s));const r=n.slice(s),l=t?"error-btn-link error-btn-link--active":"error-btn-link";return y("div",{className:ee("error-message",{expanded:e}),children:[o&&y(Oe,{children:[m("div",{className:"error-gutter",children:m("button",{type:"button",onClick:this.handleToggleError,className:l,tabIndex:-1,children:m(te,{icon:e?Yn:ll,transform:"left-3"})})}),y("div",{className:"error-content",children:[m("div",{className:"console-error-text-trigger",role:"button",tabIndex:0,onKeyPress:this.handleKeyPress,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,onMouseUp:this.handleMouseUp,children:i}),e?r:""]})]}),!o&&m("div",{className:"error-content",children:m("div",{className:"console-error-text",children:i})})]},"error")}};let sr=Ai;sr.defaultProps={message:""};sr.mouseDragThreshold=5;const Gr=ie.module("ConsoleHistoryItem");class jl extends F.exports.PureComponent{constructor(t){super(t),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(t){Gr.debug("handleObjectClick",t);const{openObject:n}=this.props;n(t)}handleCancelClick(){const{item:t}=this.props;t!=null&&t.cancelResult&&(Gr.debug(`Cancelling command: ${t.command}`),t.cancelResult())}render(){var d;const{disabled:t,item:n,language:s}=this.props,{disabledObjects:o,result:i}=n;let r=null;n.command!=null&&n.command!==""&&(r=y("div",{className:"console-history-item-command",children:[m("div",{className:"console-history-gutter",children:">"}),m("div",{className:"console-history-content",children:m(Xl,{language:s,children:n.command})})]}));const l=[];let a=!1;if(i){const{error:u,message:h,changes:g}=i;if(g){const{created:p,updated:f}=g;[...p,...f].forEach(C=>{a=!0;const{title:w}=C,S=`${w}`,T=t===void 0||t||(o!=null?o:[]).indexOf(S)>=0,R=m(z,{kind:"primary",onClick:()=>this.handleObjectClick(C),className:"btn-console-object",disabled:T,icon:m(pm,{type:C.type}),children:w},S);l.push(R)})}if(u!=null&&n.command==null){let p=`${(d=u.message)!=null?d:u}`;p||(p=u);const f=m(sr,{message:p},"result-error");l.push(f)}if(h!==void 0&&h!==""){const p=m("div",{className:"log-message",children:h},"log-message");l.push(p)}}else{a=!0;const u=m(Ql,{onCancelClick:this.handleCancelClick,disabled:t},"in_progress");l.push(u)}let c=null;return l.length>0&&(c=m(Kl,{children:l})),y("div",{className:ee("console-command-result",{"console-result-buttons":a}),children:[r,c]})}}jl.defaultProps={disabled:!1};const Zl=class extends F.exports.Component{static itemKey(e,t){return`${e}.${t.command}.${t.result&&t.result.message}.${t.result&&t.result.error}`}render(){const{disabled:e,items:t,language:n,openObject:s}=this.props,o=[];for(let i=0;i<t.length;i+=1){const r=t[i],l=m(jl,{disabled:e,item:r,openObject:s,language:n},Zl.itemKey(i,r));o.push(l)}return m("div",{className:"container-fluid console-history",children:o})}};let Jl=Zl;Jl.defaultProps={disabled:!1};const Cm={name:"Console",CLEAR:Ve.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[le.CTRL,he.L],macShortcut:[le.CTRL,he.C]}),FOCUS_HISTORY:Ve.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[le.CTRL,he.H],macShortcut:[le.CTRL,le.OPTION,he.H]})},wm={name:"Command History",FOCUS_HISTORY:Ve.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[le.CTRL,he.H],macShortcut:[le.CTRL,le.OPTION,he.H]}),SEND_TO_CONSOLE:Ve.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[he.ENTER],macShortcut:[he.ENTER]}),SEND_TO_NOTEBOOK:Ve.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[le.CTRL,he.ENTER],macShortcut:[le.CMD,he.ENTER]}),RUN:Ve.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[le.ALT,he.R],macShortcut:[le.OPTION,he.R]})},Sm={name:"Notebook",RUN:Ve.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[le.ALT,he.R],macShortcut:[le.OPTION,he.R]}),RUN_SELECTED:Ve.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[le.ALT,le.SHIFT,he.R],macShortcut:[le.OPTION,le.SHIFT,he.R]}),FIND:Ve.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[le.CTRL,he.F],macShortcut:[le.CMD,he.F],isEditable:!1}),MINIMAP:Ve.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[le.ALT,he.M],macShortcut:[le.OPTION,he.M]}),WORDWRAP:Ve.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[le.ALT,he.Z],macShortcut:[le.OPTION,he.Z]})},Jn={CONSOLE:Cm,COMMAND_HISTORY:wm,NOTEBOOK:Sm},je=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),bm="#2d2a2e",Tm="#fcfcfa",Em="#fcd65b",vm="#b2b1b2",Rm="#9edc6f",ym="#76d9e4",Fm="#f95d84",Dm="#aa9af4",Im="#f95d84",Nm="#fcfcfa",Am="#7c7b7c",re={"error-foreground":"#f95d84",background:bm,foreground:Tm,"line-height":"19px",string:Em,"string-delim":"#929192",delimiter:vm,predefined:Rm,keyword:ym,storage:Fm,number:Dm,operator:Im,identifier:Nm,"namespace-identifier":"#f95d84","identifier-js":"#fcd65b",comment:Am,"input-option-active-border":"#929192","focus-border":"rgba(72, 120, 234, 0.85)","input-background":"#555356","input-foreground":"#f0f0ee","input-border":"#929192","editor-line-number-foreground":"#929192","editor-selection-background":"#676368","editor-line-highlight-bg":"#373438","context-menu-background":"#555356","context-menu-foreground":"#f0f0ee","menu-selection-background":"#4878ea","log-date":"#929192","log-error":"#f95d84","log-info":"#76d9e4","log-stdout":"#f0f0ee","log-warn":"#fcd65b","log-debug":"#aa9af4","log-trace":"#9edc6f","editor-find-match-background":"#3c5595","editor-find-match-highlight-background":"#343e5d","editor-widget-background":"#403e41","input-option-active-background":"#4878ea","input-option-active-foreground":"#f0f0ee","editor-suggest-widget-background":"#403e41","editor-suggest-widget-border":"#5b5a5c","editor-suggest-widget-foreground":"#f0f0ee","editor-suggest-widget-selected-background":"#41475a","editor-suggest-widget-highlightForeground":"#4878ea","list-hover-background":"#555356"},Mm="python",Om={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},xm={keywords:["and","del","from","not","while","as","elif","global","or","with","assert","else","if","pass","yield","break","except","import","print","exec","in","raise","continue","finally","is","return","for","try",":","=","isinstance","__debug__"],storage:["class","def","async","lambda"],operators:["+","-","*","**","/","//","%","<<",">>","&","|","^","~","<",">","<=",">=","==","!=","<>","+=","-=","*=","/","//=","%=","&=","|=","^=",">>=","<<=","**="],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[=><!~&|+\-*/^%]+/,delimiters:/[;=.@:,`]/,escapes:/\\(?:[abfnrtv\\"'\n\r]|x[0-9A-Fa-f]{2}|[0-7]{3}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}|N\{\w+\})/,rawpre:/(?:[rR]|ur|Ur|uR|UR|br|Br|bR|BR)/,strpre:/(?:[buBU])/,tokenizer:{root:[[/@strpre?("""|''')/,{token:"string.delim",bracket:"@open",next:"@mstring.$1"}],[/@strpre?"([^"\\]|\\.)*$/,"string.invalid"],[/@strpre?'([^'\\]|\\.)*$/,"string.invalid"],[/@strpre?(["])/,{token:"string.delim",bracket:"@open",next:"@sstring.$1",nextEmbedded:"deephavenDb"}],[/@strpre?(["'])/,{token:"string.delim",bracket:"@open",next:"@string.$1"}],[/@rawpre("""|''')/,{token:"string.delim",bracket:"@open",next:"@mrawstring.$1"}],[/@rawpre"([^"\\]|\\.)*$/,"string.invalid"],[/@rawpre'([^'\\]|\\.)*$/,"string.invalid"],[/@rawpre(["'])/,{token:"string.delim",bracket:"@open",next:"@rawstring.$1"}],[/__[\w$]*/,"predefined"],[/[a-z_$][\w$]*/,{cases:{"@keywords":"keyword","@storage":"storage","@default":"identifier"}}],[/[A-Z][\w]*/,{cases:{"~[A-Z0-9_]+":"constructor.identifier","@default":"namespace.identifier"}}],{include:"@whitespace"},[/[{}()[\]]/,"@brackets"],[/@symbols/,{cases:{"@keywords":"keyword","@operators":"operator","@default":""}}],[/\d*\.\d+([eE][-+]?\d+)?/,"number.float"],[/0[xX][0-9a-fA-F]+[lL]?/,"number.hex"],[/0[bB][0-1]+[lL]?/,"number.binary"],[/(0[oO][0-7]+|0[0-7]+)[lL]?/,"number.octal"],[/(0|[1-9]\d*)[lL]?/,"number"],[":",{token:"keyword",bracket:"@open"}],[/@delimiters/,{cases:{"@keywords":"keyword","@default":"delimiter"}}]],comment:[[/[^/*]+/,"comment"],[/\/\*/,"comment","@push"],["\\*/","comment","@pop"],[/[/*]/,"comment"]],mstring:[{include:"@strcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],sstring:[{include:"@strcontent"},[/["]/,{token:"string.delim",bracket:"@close",next:"@pop",nextEmbedded:"@pop"}],[/./,"string.invalid"]],string:[{include:"@strcontent"},[/[']/,{token:"string.delim",bracket:"@close",next:"@pop"}],[/./,"string.invalid"]],strcontent:[[/[^\\"']+/,"string"],[/\\$/,"string.escape"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"]],mrawstring:[{include:"@rawstrcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],rawstring:[{include:"@rawstrcontent"},[/["']/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/./,"string.invalid"]],rawstrcontent:[[/[^\\"']+/,"string"],[/\\["']/,"string"],[/\\u[0-9A-Fa-f]{4}/,"string.escape"],[/\\/,"string"]],whitespace:[[/\s+/,"white"],[/(^#.*$)/,"comment"],[/'''/,"string","@endDocString"],[/"""/,"string","@endDblDocString"]],endDocString:[[/[^']+/,"string"],[/\\'/,"string"],[/'''/,"string","@popall"],[/'/,"string"]],endDblDocString:[[/[^"]+/,"string"],[/\\"/,"string"],[/"""/,"string","@popall"],[/"/,"string"]]}},km={id:Mm,conf:Om,language:xm},Lm="groovy",Pm={comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},_m={keywords:["and","del","from","not","while","as","elif","global","or","with","assert","else","if","pass","yield","break","except","import","print","println","class","exec","in","raise","continue","finally","is","return","def","for","lambda","try",":","=","isinstance","__debug__"],operators:["+","-","*","**","/","//","%","<<",">>","&","|","^","~","<",">","<=",">=","==","!=","<>","+=","-=","*=","/","//=","%=","&=","|=","^=",">>=","<<=","**="],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[=><!~&|+\-*/^%]+/,delimiters:/[;=.@:,`]/,escapes:/\\(?:[abfnrtv\\"'\n\r]|x[0-9A-Fa-f]{2}|[0-7]{3}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}|N\{\w+\})/,rawpre:/(?:[rR]|ur|Ur|uR|UR|br|Br|bR|BR)/,strpre:/(?:[buBU])/,tokenizer:{root:[[/@strpre?("""|''')/,{token:"string.delim",bracket:"@open",next:"@mstring.$1"}],[/@strpre?"([^"\\]|\\.)*$/,"string.invalid"],[/@strpre?'([^'\\]|\\.)*$/,"string.invalid"],[/@strpre?(["])/,{token:"string.delim",bracket:"@open",next:"@sstring.$1",nextEmbedded:"deephavenDb"}],[/@strpre?(["'])/,{token:"string.delim",bracket:"@open",next:"@string.$1"}],[/@rawpre("""|''')/,{token:"string.delim",bracket:"@open",next:"@mrawstring.$1"}],[/@rawpre"([^"\\]|\\.)*$/,"string.invalid"],[/@rawpre'([^'\\]|\\.)*$/,"string.invalid"],[/@rawpre(["'])/,{token:"string.delim",bracket:"@open",next:"@rawstring.$1"}],[/__[\w$]*/,"predefined"],[/[a-z_$][\w$]*/,{cases:{"@keywords":"keyword","@default":"identifier"}}],[/[A-Z][\w]*/,{cases:{"~[A-Z0-9_]+":"constructor.identifier","@default":"namespace.identifier"}}],{include:"@whitespace"},[/[{}()[\]]/,"@brackets"],[/@symbols/,{cases:{"@keywords":"keyword","@operators":"operator","@default":""}}],[/\d*\.\d+([eE][-+]?\d+)?/,"number.float"],[/0[xX][0-9a-fA-F]+[lL]?/,"number.hex"],[/0[bB][0-1]+[lL]?/,"number.binary"],[/(0[oO][0-7]+|0[0-7]+)[lL]?/,"number.octal"],[/(0|[1-9]\d*)[lL]?/,"number"],[":",{token:"keyword",bracket:"@open"}],[/@delimiters/,{cases:{"@keywords":"keyword","@default":"delimiter"}}]],mstring:[{include:"@strcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],sstring:[{include:"@strcontent"},[/["]/,{token:"string.delim",bracket:"@close",next:"@pop",nextEmbedded:"@pop"}],[/./,"string.invalid"]],string:[{include:"@strcontent"},[/[']/,{token:"string.delim",bracket:"@close",next:"@pop"}],[/./,"string.invalid"]],strcontent:[[/[^\\"']+/,"string"],[/\\$/,"string.escape"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"]],mrawstring:[{include:"@rawstrcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],rawstring:[{include:"@rawstrcontent"},[/["']/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/./,"string.invalid"]],rawstrcontent:[[/[^\\"']+/,"string"],[/\\["']/,"string"],[/\\u[0-9A-Fa-f]{4}/,"string.escape"],[/\\/,"string"]],whitespace:[[/[ \t\r\n]+/,""],[/\/\*\*(?!\/)/,"comment.doc","@doccomment"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]],comment:[[/[^/*]+/,"comment"],[/\*\//,"comment","@pop"],[/[/*]/,"comment"]],doccomment:[[/[^/*]+/,"comment.doc"],[/\*\//,"comment.doc","@pop"],[/[/*]/,"comment.doc"]]}},Hm={id:Lm,conf:Pm,language:_m},Vm="scala",Um={wordPattern:/(unary_[@~!#%^&*()\-=+\\|:<>/?]+)|([a-zA-Z_$][\w$]*?_=)|(`[^`]+`)|([a-zA-Z_$][\w$]*)/g,comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],folding:{markers:{start:/^\s*\/\/\s*(?:(?:#?region\b)|(?:<editor-fold\b))/,end:/^\s*\/\/\s*(?:(?:#?endregion\b)|(?:<\/editor-fold>))/}}},Bm={keywords:["asInstanceOf","catch","class","classOf","def","do","else","extends","finally","for","foreach","forSome","if","import","isInstanceOf","macro","match","new","object","package","return","throw","trait","try","type","until","val","var","while","with","yield","given","enum","then"],softKeywords:["as","export","extension","end","derives","on"],constants:["true","false","null","this","super"],modifiers:["abstract","final","implicit","lazy","override","private","protected","sealed"],softModifiers:["inline","opaque","open","transparent","using"],name:/(?:[a-z_$][\w$]*|`[^`]+`)/,type:/(?:[A-Z][\w$]*)/,symbols:/[=><!~?:&|+\-*/^\\%@#]+/,digits:/\d+(_+\d+)*/,hexdigits:/[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,escapes:/\\(?:[btnfr\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,fstring_conv:/[bBhHsScCdoxXeEfgGaAt]|[Tn](?:[HIklMSLNpzZsQ]|[BbhAaCYyjmde]|[RTrDFC])/,tokenizer:{root:[[/\braw"""/,{token:"string.quote",bracket:"@open",next:"@rawstringt"}],[/\braw"/,{token:"string.quote",bracket:"@open",next:"@rawstring"}],[/\bs"""/,{token:"string.quote",bracket:"@open",next:"@sstringt"}],[/\bs"/,{token:"string.quote",bracket:"@open",next:"@sstring"}],[/\bf""""/,{token:"string.quote",bracket:"@open",next:"@fstringt"}],[/\bf"/,{token:"string.quote",bracket:"@open",next:"@fstring"}],[/"""/,{token:"string.quote",bracket:"@open",next:"@stringt"}],[/"/,{token:"string.quote",bracket:"@open",next:"@string"}],[/(@digits)[eE]([-+]?(@digits))?[fFdD]?/,"number.float","@allowMethod"],[/(@digits)\.(@digits)([eE][-+]?(@digits))?[fFdD]?/,"number.float","@allowMethod"],[/0[xX](@hexdigits)[Ll]?/,"number.hex","@allowMethod"],[/(@digits)[fFdD]/,"number.float","@allowMethod"],[/(@digits)[lL]?/,"number","@allowMethod"],[/\b_\*/,"key"],[/\b(_)\b/,"keyword","@allowMethod"],[/\bimport\b/,"keyword","@import"],[/\b(case)([ \t]+)(class)\b/,["keyword.modifier","white","keyword"]],[/\bcase\b/,"keyword","@case"],[/\bva[lr]\b/,"keyword","@vardef"],[/\b(def)([ \t]+)((?:unary_)?@symbols|@name(?:_=)|@name)/,["keyword","white","identifier"]],[/@name(?=[ \t]*:(?!:))/,"variable"],[/(\.)(@name|@symbols)/,[{token:"operator"},{token:"@rematch",next:"@allowMethod"}]],[/([{(])(\s*)(@name(?=\s*=>))/,["@brackets","white","variable"]],[/@name/,{cases:{"@keywords":"keyword","@softKeywords":"keyword","@modifiers":"keyword.modifier","@softModifiers":"keyword.modifier","@constants":{token:"constant",next:"@allowMethod"},"@default":{token:"identifier",next:"@allowMethod"}}}],[/@type/,"type","@allowMethod"],{include:"@whitespace"},[/@[a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*)*/,"annotation"],[/[{(]/,"@brackets"],[/[})]/,"@brackets","@allowMethod"],[/\[/,"operator.square"],[/](?!\s*(?:va[rl]|def|type)\b)/,"operator.square","@allowMethod"],[/]/,"operator.square"],[/([=-]>|<-|>:|<:|:>|<%)(?=[\s\w()[\]{},."'`])/,"keyword"],[/@symbols/,"operator"],[/[;,.]/,"delimiter"],[/'[a-zA-Z$][\w$]*(?!')/,"attribute.name"],[/'[^\\']'/,"string","@allowMethod"],[/(')(@escapes)(')/,[{token:"string"},{token:"string.escape"},{token:"string",next:"@allowMethod"}]],[/'/,"string.invalid"]],import:[[/;/,"delimiter","@pop"],[/^|$/,"","@pop"],[/[ \t]+/,"white"],[/[\n\r]+/,"white","@pop"],[/\/\*/,"comment","@comment"],[/@name|@type/,"type"],[/[(){}]/,"@brackets"],[/[[\]]/,"operator.square"],[/[.,]/,"delimiter"]],allowMethod:[[/^|$/,"","@pop"],[/[ \t]+/,"white"],[/[\n\r]+/,"white","@pop"],[/\/\*/,"comment","@comment"],[/(?==>[\s\w([{])/,"keyword","@pop"],[/(@name|@symbols)(?=[ \t]*[[({"'`]|[ \t]+(?:[+-]?\.?\d|\w))/,{cases:{"@keywords":{token:"keyword",next:"@pop"},"->|<-|>:|<:|<%":{token:"keyword",next:"@pop"},"@default":{token:"@rematch",next:"@pop"}}}],["","","@pop"]],comment:[[/[^/*]+/,"comment"],[/\/\*/,"comment","@push"],[/\*\//,"comment","@pop"],[/[/*]/,"comment"]],case:[[/\b_\*/,"key"],[/\b(_|true|false|null|this|super)\b/,"keyword","@allowMethod"],[/\bif\b|=>/,"keyword","@pop"],[/`[^`]+`/,"identifier","@allowMethod"],[/@name/,"variable","@allowMethod"],[/:::?|\||@(?![a-z_$])/,"keyword"],{include:"@root"}],vardef:[[/\b_\*/,"key"],[/\b(_|true|false|null|this|super)\b/,"keyword"],[/@name/,"variable"],[/:::?|\||@(?![a-z_$])/,"keyword"],[/=|:(?!:)/,"operator","@pop"],[/$/,"white","@pop"],{include:"@root"}],string:[[/[^\\"\n\r]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}]],stringt:[[/[^\\"\n\r]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/"/,"string"]],fstring:[[/@escapes/,"string.escape"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/%%/,"string"],[/(%)([-#+ 0,(])(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","keyword.modifier","number","metatag"]],[/(%)(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","number","metatag"]],[/(%)([-#+ 0,(])(@fstring_conv)/,["metatag","keyword.modifier","metatag"]],[/(%)(@fstring_conv)/,["metatag","metatag"]],[/./,"string"]],fstringt:[[/@escapes/,"string.escape"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/%%/,"string"],[/(%)([-#+ 0,(])(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","keyword.modifier","number","metatag"]],[/(%)(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","number","metatag"]],[/(%)([-#+ 0,(])(@fstring_conv)/,["metatag","keyword.modifier","metatag"]],[/(%)(@fstring_conv)/,["metatag","metatag"]],[/./,"string"]],sstring:[[/@escapes/,"string.escape"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/./,"string"]],sstringt:[[/@escapes/,"string.escape"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/./,"string"]],interp:[[/{/,"operator","@push"],[/}/,"operator","@pop"],{include:"@root"}],rawstring:[[/[^"]/,"string"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}]],rawstringt:[[/[^"]/,"string"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/"/,"string"]],whitespace:[[/[ \t\r\n]+/,"white"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]]}},Gm={id:Vm,conf:Um,language:Bm},Wm="deephavenDb",$m={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},zm={tokenPostfix:".js",keywords:["boolean","break","byte","case","catch","char","class","const","continue","debugger","default","delete","do","double","else","enum","export","extends","false","final","finally","float","for","function","goto","if","implements","import","in","instanceof","int","interface","long","native","new","null","package","private","protected","public","return","short","static","super","switch","synchronized","this","throw","throws","transient","true","try","typeof","var","void","volatile","while","with"],builtins:["define","require","window","document","undefined"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.bracket"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[~!@#%\^&*-+=|\\:`<>.?\/]+/,escapes:/\\(?:[btnfr\\"']|[0-7][0-7]?|[0-3][0-7]{2})/,exponent:/[eE][\-+]?[0-9]+/,regexpctl:/[(){}\[\]\$\^|\-*+?\.]/,regexpesc:/\\(?:[bBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/,tokenizer:{root:[[/([a-zA-Z_\$][\w\$]*)(\s*)(:?)/,{cases:{"$1@keywords":["keyword","white","delimiter"],$3:["key.identifier","white","delimiter"],"$1@builtins":["predefined.identifier","white","delimiter"],"@default":["identifier","white","delimiter"]}}],{include:"@whitespace"},[/\/(?=([^\\\/]|\\.)+\/)/,{token:"regexp.slash",bracket:"@open",next:"@regexp"}],[/[{}()\[\]]/,"@brackets"],[/[;,.]/,"delimiter"],[/@symbols/,{cases:{"@operators":"operator","@default":""}}],[/\d+\.\d*(@exponent)?/,"number.float"],[/\.\d+(@exponent)?/,"number.float"],[/\d+@exponent/,"number.float"],[/0[xX][\da-fA-F]+/,"number.hex"],[/0[0-7]+/,"number.octal"],[/\d+/,"number"],[/"([^"\\]|\\.)*$/,"string.invalid"],[/'([^'\\]|\\.)*$/,"string.invalid"],[/"/,"string",'@string."'],[/'/,"string","@string.'"]],whitespace:[[/[ \t\r\n]+/,"white"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]],comment:[[/[^\/*]+/,"comment"],[/\/\*/,"comment.invalid"],["\\*/","comment","@pop"],[/[\/*]/,"comment"]],string:[[/[^\\"']+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/["']/,{cases:{"$#==$S2":{token:"string",next:"@pop"},"@default":"string"}}]],regexp:[[/(\{)(\d+(?:,\d*)?)(\})/,["@brackets.regexp.escape.control","regexp.escape.control","@brackets.regexp.escape.control"]],[/(\[)(\^?)(?=(?:[^\]\\\/]|\\.)+)/,[{token:"@brackets.regexp.escape.control"},{token:"regexp.escape.control",next:"@regexrange"}]],[/(\()(\?:|\?=|\?!)/,["@brackets.regexp.escape.control","regexp.escape.control"]],[/[()]/,"@brackets.regexp.escape.control"],[/@regexpctl/,"regexp.escape.control"],[/[^\\\/]/,"regexp"],[/@regexpesc/,"regexp.escape"],[/\\\./,"regexp.invalid"],["/",{token:"regexp.slash",bracket:"@close"},"@pop"]],regexrange:[[/-/,"regexp.escape.control"],[/\^/,"regexp.invalid"],[/@regexpesc/,"regexp.escape"],[/[^\]]/,"regexp"],[/\]/,"@brackets.regexp.escape.control","@pop"]]}},qm={id:Wm,conf:$m,language:zm},Ym="log",Xm={},Km={tokenizer:{root:[[/ FATAL[\s\S]*/,{token:"error",next:"@error"}],[/ ERROR[\s\S]*/,{token:"error",next:"@error"}],[/ STDERR[\s\S]*/,{token:"error",next:"@error"}],[/ STDOUT.*/,{token:"stdout",next:"@stdout"}],[/ INFO[\s\S]*/,{token:"info",next:"@info"}],[/ WARN.*/,{token:"warn",next:"@warn"}],[/ TRACE[\s\S]*/,{token:"trace",next:"@trace"}],[/ DEBUG[.\s\S]*/,{token:"debug",next:"@debug"}],[/^\d{2}:\d{2}:\d{2}.\d{3}/,"date"]],error:[{include:"@body"}],info:[{include:"@body"}],warn:[{include:"@body"}],stdout:[{include:"@body"}],trace:[{include:"@body"}],debug:[{include:"@body"}],body:[[/^\d{2}:\d{2}:\d{2}.\d{3}/,{token:"date",next:"@pop"}],[/[\s\S]*/,{token:"$S0"}]]}},Qm={id:Ym,conf:Xm,language:Km},_t=ie.module("MonacoUtils");class He{static init({getWorker:t}={}){_t.debug("Initializing Monaco..."),t!==void 0&&He.registerGetWorker(t);const{registerLanguages:n,removeHashtag:s}=He,o=[{token:"",foreground:s(re.foreground)},{token:"string",foreground:s(re.string)},{token:"string.delim",foreground:s(re["string-delim"])},{token:"keyword",foreground:s(re.keyword)},{token:"identifier.js",foreground:s(re["identifier-js"])},{token:"delimiter",foreground:s(re.delimiter)},{token:"comment",foreground:s(re.comment)},{token:"number",foreground:s(re.number)},{token:"storage",foreground:s(re.storage)},{token:"identifier",foreground:s(re.identifier)},{token:"namespace.identifier",foreground:s(re["namespace-identifier"])},{token:"operator",foreground:s(re.operator)},{token:"predefined",foreground:s(re.predefined)},{token:"error.log",foreground:re["log-error"].substring(1)},{token:"warn.log",foreground:s(re["log-warn"])},{token:"info.log",foreground:s(re["log-info"])},{token:"stdout.log",foreground:s(re["log-stdout"])},{token:"trace.log",foreground:s(re["log-trace"])},{token:"debug.log",foreground:s(re["log-debug"])},{token:"date.log",foreground:s(re["log-date"])}],i={errorForeground:re["error-foreground"],"inputOption.activeBorder":re["input-option-active-border"],"editor.background":re.background,"editor.foreground":re.foreground,"editor.lineHighlightBackground":re["editor-line-highlight-bg"],"editorLineNumber.foreground":re["editor-line-number-foreground"],"editor.selectionBackground":re["editor-selection-background"],"editor.findMatchBackground":re["editor-find-match-background"],"editor.findMatchHighlightBackground":re["editor-find-match-highlight-background"],"editorSuggestWidget.background":re["editor-suggest-widget-background"],"editorSuggestWidget.border":re["editor-suggest-widget-border"],"editorSuggestWidget.foreground":re["editor-suggest-widget-foreground"],"editorSuggestWidget.selectedBackground":re["editor-suggest-widget-selected-background"],"editorSuggestWidget.highlightForeground":re["editor-suggest-widget-highlightForeground"],"list.hoverBackground":re["list-hover-background"],"dropdown.background":re["context-menu-background"],"dropdown.foreground":re["context-menu-foreground"],"menu.selectionBackground":re["menu-selection-background"],"list.focusBackground":re["menu-selection-background"],"editorWidget.background":re["editor-widget-background"],"inputOption.activeBackground":re["input-option-active-background"],"inputOption.activeForeground":re["input-option-active-foreground"],focusBorder:re["focus-border"],"input.background":re["input-background"],"input.foreground":re["input-foreground"],"input.border":re["input-border"]};an.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:o,colors:i}),_t.debug2("monaco theme: ",re),an.setTheme("dh-dark"),n([qm,km,Hm,Qm,Gm]),_t.debug("Monaco initialized.")}static registerGetWorker(t){window.MonacoEnvironment={...window.MonacoEnvironment,getWorker:t}}static removeHashtag(t){return t.substring(1)}static registerLanguages(t){const n=t.map(({id:s})=>s);ps.getLanguages().filter(({id:s})=>n.includes(s)).forEach(s=>{const o=s;_t.debug2("Overriding default language loader:",o.id)}),t.forEach(s=>{He.registerLanguage(s)})}static registerLanguage(t){_t.debug2("Registering language: ",t.id),ps.register(t),ps.onLanguage(t.id,()=>{ps.setLanguageConfiguration(t.id,t.conf),ps.setMonarchTokensProvider(t.id,t.language)})}static setEOL(t,n=an.EndOfLineSequence.LF){var s;(s=t.getModel())==null||s.setEOL(n)}static openDocument(t,n){const s=t.getModel();M(s);const o={textDocument:{uri:`${s.uri}`,languageId:s.getLanguageId(),version:s.getVersionId(),text:s.getValue()}};return _t.debug2("didOpenDocumentParams: ",o),n.openDocument(o),t.onDidChangeModelContent(r=>{const{changes:l,versionId:a}=r,c=[];for(let d=0;d<l.length;d+=1){const u=l[d],{range:h,rangeLength:g,text:p}=u,f={range:{start:{line:h.startLineNumber-1,character:h.startColumn-1},end:{line:h.endLineNumber-1,character:h.endColumn-1}},rangeLength:g,text:p};c.push(f)}if(c.length>0){const d={textDocument:{version:a,uri:`${s.uri}`},contentChanges:c};_t.debug2("didChangeDocumentParams",d),n.changeDocument(d)}})}static closeDocument(t,n){const s=t.getModel();M(s);const o={textDocument:{uri:`${s.uri}`}};n.closeDocument(o)}static registerPasteHandler(t){t.onDidPaste(n=>{const s=/“|”/g,o=/\u200b/g,i=/\u00A0/g,r=t.getModel();M(r);const l=r.getValueInRange(n.range);(s.test(l)||o.test(l)||i.test(l))&&r.applyEdits([{range:n.range,text:l.replace(s,'"').replace(o,"").replace(i," ")}])})}static isMacPlatform(){const{platform:t}=window.navigator;return t.startsWith("Mac")}static removeConflictingKeybindings(t){const n=[{windows:"ctrl+D",mac:"meta+D"},{windows:"ctrl+H"}];try{n.forEach(s=>{He.isMacPlatform()&&s.mac===""||!He.isMacPlatform()&&s.windows===""||He.removeKeybinding(t,He.isMacPlatform()?s.mac:s.windows)})}catch(s){_t.error(s)}}static removeKeybinding(t,n){if(n===void 0)return;const s=t._standaloneKeybindingService._getResolver()._map.get(n);s!=null?s.forEach(o=>{_t.debug2(`Removing Monaco keybinding ${n} for ${o.command}`),t._standaloneKeybindingService.addDynamicKeybinding(`-${o.command}`,null,()=>{})}):_t.warn(`Did not find any keybindings to remove for ${n}`)}static getMonacoKeyCodeFromShortcut(t){const{keyState:n}=t,{keyValue:s}=n;return s===null?0:He.isMacPlatform()?(n.metaKey?Et.CtrlCmd:0)|(n.shiftKey?Et.Shift:0)|(n.altKey?Et.Alt:0)|(n.ctrlKey?Et.WinCtrl:0)|Tr.fromString(s):(n.ctrlKey?Et.CtrlCmd:0)|(n.shiftKey?Et.Shift:0)|(n.altKey?Et.Alt:0)|(n.metaKey?Et.WinCtrl:0)|Tr.fromString(s)}}const Wr=ie.module("MonacoCompletionProvider");class ea extends F.exports.PureComponent{constructor(t){super(t),this.handleCompletionRequest=this.handleCompletionRequest.bind(this)}componentDidMount(){const{language:t}=this.props;this.registeredCompletionProvider=ps.registerCompletionItemProvider(t!=null?t:"",{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:['"',".","'","(","[","{",","]})}componentWillUnmount(){var t;(t=this.registeredCompletionProvider)==null||t.dispose()}handleCompletionRequest(t,n,s){const{model:o,session:i}=this.props;if(t!==o)return null;const r={textDocument:{uri:`${t.uri}`,version:t.getVersionId()},position:{line:n.lineNumber-1,character:n.column-1},context:s},l=i.getCompletionItems(r);return Wr.debug("Completion items received: ",r,l),l.then(c=>{const d=c.map(u=>{const{label:h,kind:g,detail:p,documentation:f,sortText:C,filterText:w,textEdit:S,insertTextFormat:T}=u,{start:R,end:b}=S.range,v={startLineNumber:R.line+1,startColumn:R.character+1,endLineNumber:b.line+1,endColumn:b.character+1};return{label:h,kind:g,detail:p,documentation:f,sortText:C,filterText:w,insertText:S.text,insertTextRules:T===2?4:T,range:v}});return{incomplete:!0,suggestions:d}}).catch(c=>(Wr.error("There was an error retrieving completion items",c),{suggestions:[]}))}render(){return null}}const Ti=ie.module("ConsoleInput"),Vo=parseInt(re["line-height"],10),ta=6,na=6,jm=Vo+ta+na,Ei=100,sa=class extends F.exports.PureComponent{constructor(e){super(e),this.handleWindowResize=this.handleWindowResize.bind(this),this.commandContainer=Fe.createRef(),this.commandHistoryIndex=null,this.timestamp=Date.now(),this.bufferIndex=0,this.history=[],this.modifiedCommands=new Map,this.state={commandEditorHeight:Vo,isFocused:!1,model:null}}componentDidMount(){this.initCommandEditor(),window.addEventListener("resize",this.handleWindowResize),this.loadMoreHistory()}componentDidUpdate(){this.layoutEditor()}componentWillUnmount(){window.removeEventListener("resize",this.handleWindowResize),this.loadingPromise!=null&&this.loadingPromise.cancel(),this.destroyCommandEditor()}setConsoleText(e,t=!0,n=!1){var s;!e||(Ti.debug("Command received: ",e),n||(this.commandHistoryIndex=null,(s=this.commandEditor)==null||s.setValue(e)),t&&this.focusEnd(),this.updateDimensions(),n&&this.processCommand(e))}initCommandEditor(){const{language:e,session:t}=this.props,n={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:e,lineHeight:Vo,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:ta,bottom:na},tabCompletion:"on",value:"",wordWrap:"on"},s=this.commandContainer.current;M(s),this.commandEditor=an.create(s,n),He.setEOL(this.commandEditor),He.openDocument(this.commandEditor,t),this.commandEditor.onDidChangeModelContent(()=>{var i;const o=(i=this.commandEditor)==null?void 0:i.getValue();this.modifiedCommands.set(this.commandHistoryIndex,o!=null?o:null),this.updateDimensions()}),this.commandEditor.onDidFocusEditorText(()=>{this.setState({isFocused:!0})}),this.commandEditor.onDidBlurEditorText(()=>{this.setState({isFocused:!1})}),this.commandEditor.onKeyDown(o=>{var d,u,h;const{commandEditor:i,commandHistoryIndex:r}=this,l=i==null?void 0:i.getPosition();M(l);const{lineNumber:a}=l,c=i==null?void 0:i.getModel();if(o.code==="ArrowUp"&&!this.isSuggestionMenuPopulated()&&a===1){r!=null?this.loadCommand(r+1):this.loadCommand(0),this.focusStart(),o.stopPropagation(),o.preventDefault();return}if(o.code==="ArrowDown"&&!this.isSuggestionMenuPopulated()&&a===(c==null?void 0:c.getLineCount())){r!=null&&r>0?this.loadCommand(r-1):this.loadCommand(null),this.focusEnd(),o.stopPropagation(),o.preventDefault();return}if(!o.altKey&&!o.shiftKey&&!o.metaKey)if(o.keyCode===Mn.Enter){if(!this.isSuggestionMenuPopulated()){o.stopPropagation(),o.preventDefault();const g=(d=this.commandEditor)==null?void 0:d.getValue().trim();g!==void 0&&(this.processCommand(g),(u=this.commandEditor)==null||u.setValue(""))}}else o.keyCode===Mn.Tab&&(this.isSuggestionMenuActive()?this.isSuggestionMenuPopulated()||(o.stopPropagation(),o.preventDefault()):(o.stopPropagation(),o.preventDefault(),(h=this.commandEditor)==null||h.trigger("Tab key trigger suggestions","editor.action.triggerSuggest",{})))}),this.commandEditor.addCommand(Et.CtrlCmd|Mn.KeyF,()=>{}),He.removeConflictingKeybindings(this.commandEditor),He.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){const{session:e}=this.props;this.commandEditor&&(He.closeDocument(this.commandEditor,e),this.commandEditor.dispose(),this.commandEditor=void 0)}handleWindowResize(){this.updateDimensions()}isSuggestionMenuActive(){var e,t,n;return this.commandSuggestionContainer||(this.commandSuggestionContainer=(t=(e=this.commandEditor)==null?void 0:e.getDomNode())==null?void 0:t.querySelector(".suggest-widget")),(n=this.commandSuggestionContainer&&this.commandSuggestionContainer.classList.contains("visible"))!=null?n:!1}isSuggestionMenuPopulated(){var e,t,n;return this.isSuggestionMenuActive()&&((n=(t=(e=this.commandSuggestionContainer)==null?void 0:e.querySelector(".monaco-list-rows"))==null?void 0:t.childElementCount)!=null?n:0)>0}focus(){var e;(e=this.commandEditor)==null||e.focus()}focusStart(){var s,o,i,r,l;const e=(s=this.commandEditor)==null?void 0:s.getModel();M(e);const t=e.getLineLength(1)+1,n=(o=this.commandEditor)==null?void 0:o.getTopForPosition(1,t);M(n),(i=this.commandEditor)==null||i.setPosition({lineNumber:1,column:t}),(r=this.commandEditor)==null||r.setScrollTop(n),(l=this.commandEditor)==null||l.focus()}focusEnd(){var o,i,r,l,a;const e=(o=this.commandEditor)==null?void 0:o.getModel();M(e);const t=e.getLineCount(),n=e.getLineLength(t)+1,s=(i=this.commandEditor)==null?void 0:i.getTopForPosition(t,n);M(s),(r=this.commandEditor)==null||r.setPosition({lineNumber:t,column:n}),(l=this.commandEditor)==null||l.setScrollTop(s),(a=this.commandEditor)==null||a.focus()}clear(){var e,t,n;(e=this.commandEditor)==null||e.focus(),(n=(t=this.commandEditor)==null?void 0:t.getModel())==null||n.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(e){var s,o;if(e!==null&&e>=this.history.length)return;const t=this.modifiedCommands.get(e),n=e===null?"":this.history[this.history.length-e-1];this.commandHistoryIndex=e,(o=(s=this.commandEditor)==null?void 0:s.getModel())==null||o.setValue(t!=null?t:n),e!==null&&e>this.history.length-Ei&&this.loadMoreHistory()}async loadMoreHistory(){try{if(this.loadingPromise!=null||this.bufferIndex==null)return;const{commandHistoryStorage:e,language:t,scope:n}=this.props;this.loadingPromise=Ge.makeCancelable(e.getTable(t,n!=null?n:"",this.timestamp),i=>i.close());const s=await this.loadingPromise;s.setReversed(!0),s.setViewport({top:this.bufferIndex,bottom:this.bufferIndex+Ei-1}),this.loadingPromise=Ge.makeCancelable(s.getViewportData(),()=>s.close());const o=await this.loadingPromise;this.bufferIndex+=Ei,this.bufferIndex>=s.size&&(this.bufferIndex=null),this.history=[...o.items.filter(({name:i},r,l)=>r===0||i!==l[r-1].name).map(({name:i})=>i).reverse(),...this.history],this.loadingPromise=void 0,s.close()}catch(e){if(this.loadingPromise=void 0,Ge.isCanceled(e)){Ti.debug2("Promise canceled, not loading history");return}Ti.error("Error fetching history",e)}}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),M(e),e!==""&&(this.history.length===0||e!==this.history[this.history.length-1])&&this.history.push(e),this.updateDimensions();const{onSubmit:t}=this.props;t(e)}updateDimensions(){if(!this.commandEditor)return;const{maxHeight:e}=this.props;M(e);const t=this.commandEditor.getContentHeight(),n=Math.max(Math.min(t,e),jm),o={overviewRulerLanes:t>n?void 0:0};this.setState({commandEditorHeight:n},()=>{var i,r;(i=this.commandEditor)==null||i.updateOptions(o),(r=this.commandEditor)==null||r.layout()})}render(){const{disabled:e,language:t,session:n}=this.props,{commandEditorHeight:s,isFocused:o,model:i}=this.state;return m("div",{className:ee("console-input-wrapper",{disabled:e}),children:y("div",{className:ee("console-input-inner-wrapper",{focus:o}),children:[m("div",{className:sa.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:s}}),i&&m(ea,{model:i,language:t,session:n})]})})}};let Uo=sa;Uo.defaultProps={maxHeight:Vo*10,scope:null,disabled:!1};Uo.INPUT_CLASS_NAME="console-input";const $r="pasted values",Zm=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],vi=[".csv",".tsv",".tab",".psv",".dsv",".txt"],zr=[".zip"],Cs=class extends F.exports.Component{constructor(e){super(e),this.getValidExtensions=Re(t=>t?[...vi,...zr]:[...vi]),this.getAcceptString=Re(t=>this.getValidExtensions(t).join(", ")),this.getFileTypeErrorString=Re(t=>Wi.join(this.getValidExtensions(t),"or")),this.handleSelectFile=this.handleSelectFile.bind(this),this.handleFiles=this.handleFiles.bind(this),this.handleDrop=this.handleDrop.bind(this),this.unstageFile=this.unstageFile.bind(this),this.handleMenuPaste=this.handleMenuPaste.bind(this),this.handlePasteEvent=this.handlePasteEvent.bind(this),this.fileElem=Fe.createRef(),this.divElem=Fe.createRef(),this.state={selectedFileName:""}}static isValidDropItem(e){return e!=null&&e.kind==="file"&&!Zm.find(t=>t.test(e.type))}static isValidExtension(e,t=!1){return vi.some(n=>e.endsWith(n))||t&&zr.some(n=>e.endsWith(n))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===$r?wr:e.endsWith(".csv")?cc:e.endsWith(".zip")?dc:uc}componentDidMount(){var e,t;(e=this.divElem.current)==null||e.addEventListener("paste",this.handlePasteEvent),(t=this.divElem.current)==null||t.focus()}componentWillUnmount(){var e;(e=this.divElem.current)==null||e.removeEventListener("paste",this.handlePasteEvent)}handleSelectFile(){var e;this.fileElem.current&&(this.fileElem.current.value="",(e=this.fileElem.current)==null||e.click())}handleFiles(e){e.stopPropagation(),e.preventDefault();const{files:t}=e.target;t!=null&&this.handleFile(t[0])}handleDrop(e){const{allowZip:t,clearDragError:n,dragError:s}=this.props;if(e.preventDefault(),e.stopPropagation(),s!=null){n();return}if(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0)return;const o=e.dataTransfer.items[0].getAsFile();M(o),Cs.isValidExtension(o.name,t)?this.handleFile(o):this.setState({dropError:Cs.FILE_TYPE_ERROR})}unstageFile(e){const{onCancel:t}=this.props;e.stopPropagation(),e.preventDefault(),t(),this.setState({selectedFileName:"",dropError:void 0})}handleFile(e){const{onFileOpened:t}=this.props;t(e),this.setState({selectedFileName:e.name,dropError:void 0})}handleMenuPaste(){const{onPaste:e,onError:t,uploadInProgress:n}=this.props;n||navigator.clipboard.readText().then(s=>{e(s),this.setState({selectedFileName:$r,dropError:void 0})}).catch(s=>t(s))}handlePasteEvent(e){e.stopPropagation(),e.preventDefault(),this.handleMenuPaste()}makeContextMenuItems(){const{uploadInProgress:e}=this.props;return[{title:"Paste",icon:wr,action:this.handleMenuPaste,shortcut:Li.PASTE,disabled:e}]}render(){const{allowZip:e,dragError:t,uploadInProgress:n}=this.props,{selectedFileName:s,dropError:o}=this.state,i=t!=null?t:o,r=this.makeContextMenuItems();return y("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:Cs.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[m(se,{actions:r}),m("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(e),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!s&&(i===void 0||i==="")&&y("div",{className:"message-content",children:[m("div",{className:"message-icon",children:m(te,{icon:hc})}),m("label",{children:"Drop file (or paste values) here to import"}),m("div",{className:"message-small",children:m("label",{children:"or"})}),m(z,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),s&&(i===void 0||i==="")&&y("div",{className:"selected-content",children:[m("div",{className:"selected-icon",children:m(te,{icon:Cs.getIcon(s)})}),y("div",{className:"selected-text",children:[m("label",{children:"Selected File"}),y("label",{className:"selected-name",children:[s,!n&&m(z,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:un,tooltip:"Remove"})]})]})]}),Boolean(i)&&y("div",{className:"message-content",children:[m("div",{className:"message-icon",children:m(te,{icon:Kn})}),m("label",{children:i}),i===Cs.FILE_TYPE_ERROR&&m("div",{className:"message-small",children:m("label",{children:this.getFileTypeErrorString(e)})})]})]})}};let rn=Cs;rn.defaultProps={allowZip:!1,dragError:null};rn.MULTIPLE_FILE_ERROR="Please select only one file";rn.FILE_TYPE_ERROR="Filetype not supported.";class pe{}pe.INTEGER="int";pe.LONG="long";pe.DOUBLE="double";pe.BOOLEAN="bool";pe.STRING="string";pe.DATE_TIME="datetime";pe.LOCAL_TIME="localtime";const qr="unknown",Jm=2147483647,eg=-2147483648,Yr=/^[0-9]{4}-[0-1][0-9]-[0-3][0-9][ T][0-2][0-9]:[0-5][0-9]:[0-6][0-9](?:\.[0-9]{1,9})?(?: [a-zA-Z]+)?$/,Xr=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class tt{static determineType(t,n,s){if(!t||t===s)return n;switch(n){case pe.STRING:return pe.STRING;case pe.INTEGER:return tt.checkInteger(t);case pe.LONG:return tt.checkLong(t);case pe.DOUBLE:return tt.checkDouble(t);case pe.BOOLEAN:return tt.checkBoolean(t);case pe.DATE_TIME:return tt.checkDateTime(t);case pe.LOCAL_TIME:return tt.checkLocalTime(t);default:return tt.getTypeFromUnknown(t)}}static isNotParsableNumber(t){return isNaN(t)||t==="Infinity"||t==="-Infinity"}static checkInteger(t){const n=t.replace(/,/g,"");return tt.isNotParsableNumber(n)?pe.STRING:tt.getNumberType(n)}static checkLong(t){const n=t.replace(/,/g,"");return tt.isNotParsableNumber(n)?pe.STRING:n.includes(".")?pe.DOUBLE:pe.LONG}static checkDouble(t){const n=t.replace(/,/g,"");return tt.isNotParsableNumber(n)?pe.STRING:pe.DOUBLE}static checkBoolean(t){const n=t.toLowerCase();return n==="true"||n==="false"?pe.BOOLEAN:pe.STRING}static checkDateTime(t){return Yr.test(t)?pe.DATE_TIME:pe.STRING}static checkLocalTime(t){return Xr.test(t)?pe.LOCAL_TIME:pe.STRING}static getTypeFromUnknown(t){const n=t.replace(/,/g,"");if(tt.isNotParsableNumber(n)){const s=t.toLowerCase();return s==="true"||s==="false"?pe.BOOLEAN:Yr.test(t)&&t.includes(":")?pe.DATE_TIME:Xr.test(t)?pe.LOCAL_TIME:pe.STRING}return tt.getNumberType(n)}static getNumberType(t){if(t.includes("."))return pe.DOUBLE;const n=t.startsWith("-")?11:10;if(t.length>n)return pe.LONG;const s=parseInt(t,10);return s>Jm||s<eg?pe.LONG:pe.INTEGER}constructor(t,n,s,o,i,r,l,a,c,d){this.onFileCompleted=t,this.file=n,this.readHeaders=s,this.nullString=i,this.onProgress=r,this.onError=l,this.chunks=0,this.totalChunks=a,this.isZip=c,this.shouldTrim=d,this.zipProgress=0,this.handleChunk=this.handleChunk.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleError=this.handleError.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.config={...o,error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete}}parse(){const t=this.isZip?this.file.nodeStream("nodebuffer",this.handleNodeUpdate):this.file;Di.parse(t,this.config)}handleChunk(t,n){let{data:s}=t;if(!this.types){if(s==null||s.length===0){n.abort(),this.onError("Error parsing CSV: no data in file.");return}this.types=new Array(s[0].length).fill(qr),this.readHeaders&&(s=s.slice(1))}M(this.types);const o=[...this.types];s.forEach(l=>{if(l.length>=o.length){for(let a=0;a<o.length;a+=1)o[a]=tt.determineType(this.shouldTrim?l[a].trim():l[a],o[a],this.nullString);this.types=o}else n.abort(),this.onError(`Error parsing CSV: Insufficient data in row.
11
+ `),this.makeSnapshot(Math.min(Dn.SNAPSHOT_BUFFER_SIZE-this.snapshotsBuffer.size-this.snapshotPending,this.snapshotsTotal-this.snapshotCounter)))}updateDownloadProgress(e){if(e!=null&&this.snapshotsTotal!=null&&this.downloadStartTime!=null){const{onDownloadProgressUpdate:t}=this.props,n=Math.floor(e*100/this.snapshotsTotal),s=e>1?Math.floor((Date.now()-this.downloadStartTime)*(this.snapshotsTotal-e)/e/1e3):null;t(n,s)}}convertSnapshotIntoCsv(e){var r;let t="";const n=e.added.iterator(),{formatter:s}=this.props,o=[];for(;n.hasNext();)o.push(n.next().value);M(this.columns);const{useUnformattedValues:i}=this;for(let l=0;l<o.length;l+=1){const a=o[l];for(let c=0;c<this.columns.length;c+=1){const{type:d,name:u}=this.columns[c];let h=null;if(i){let g=(r=e.getData(a,this.columns[c]))!=null?r:"";g!==""&&I.isDateType(d)&&(g=E.i18n.DateTimeFormat.format(uh,g,E.i18n.TimeZone.getTimeZone(s.timeZone))),h=g.toString()}else{const g=this.getCachedCustomColumnFormatFlag(s,u,d);let p=null;if(!g){const f=e.getFormat(a,this.columns[c]);p=(f==null?void 0:f.formatString)!=null?f:null}p?h=s.getFormattedString(e.getData(a,this.columns[c]),d,u,p):h=s.getFormattedString(e.getData(a,this.columns[c]),d,u)}t+=Dn.csvEscapeString(h),t+=c===this.columns.length-1?`
12
+ `:","}}return t}makeSnapshot(e){if(e<=0)return;M(this.gridRangeCounter);let t=0,n=this.gridRanges[this.gridRangeCounter];for(M(this.tableSubscription),M(this.columns);t<e;){M(n),M(n.startRow),M(n.endRow),M(this.rangedSnapshotCounter),M(this.chunkRows);const s=n.startRow+this.rangedSnapshotCounter*this.chunkRows,o=Math.min(s+this.chunkRows-1,n.endRow),i=this.snapshotCounter;this.cancelableSnapshots.push(Ge.makeCancelable(this.tableSubscription.snapshot(E.RangeSet.ofRange(s,o),this.columns).then(r=>(mh(r),this.handleSnapshotResolved(r,i,s,o),i)).catch(r=>{Zt.error(r)}),r=>{Zt.info(`snapshot ${r} has been canceled`)})),this.rangedSnapshotCounter+=1,this.snapshotCounter+=1,this.snapshotPending+=1,this.rangedSnapshotCounter>=this.rangedSnapshotsTotal[this.gridRangeCounter]&&(this.gridRangeCounter+=1,this.rangedSnapshotCounter=0,n=this.gridRanges[this.gridRangeCounter]),t+=1}}handlePortMessage({data:e}){const{download:t,readableStreamPulling:n}=e;if(!this.useBlobFallback){if(t!=null){const{includeColumnHeaders:s}=this;this.makeIframe(`${t}`),this.writeCsvTable(s)}n!=null&&(this.useBlobFallback||(this.streamTimeout!=null&&clearTimeout(this.streamTimeout),this.streamTimeout=setTimeout(this.handleDownloadTimeout,Dn.STREAM_TIMEOUT)))}}handleSnapshotResolved(e,t,n,s){this.snapshotHandlerTimeout=setTimeout(()=>{this.snapshotsBuffer.set(t,e),this.snapshotPending-=1,this.writeSnapshot(t,n,s),this.cancelableSnapshots[t]=null},Dn.SNAPSHOT_HANDLER_TIMEOUT)}makeIframe(e){const t=document.createElement("iframe");t.hidden=!0,t.src=`download/${e}`,t.name="iframe",document.body.appendChild(t),this.iframes.push(t)}render(){return null}};let Fs=Dn;Fs.DOWNLOAD_CELL_CHUNK=6e3;Fs.SNAPSHOT_BUFFER_SIZE=5;Fs.STREAM_TIMEOUT=8e3;Fs.SNAPSHOT_HANDLER_TIMEOUT=5;Fs.defaultProps={getDownloadWorker:()=>Promise.reject(new Error("Download worker not provided")),isDownloading:!1,onDownloadCompleted:()=>{},onDownloadCanceled:()=>{},onDownloadProgressUpdate:()=>{}};function gh(e){var b;const{group:t,onDelete:n,onColorChange:s,onNameChange:o,validateName:i}=e,{isNew:r}=t,l=F.exports.useRef(t),a=F.exports.useRef(null),c=F.exports.useRef(null),[d,u]=F.exports.useState(r?"":t.name),[h,g]=F.exports.useState(r),[p,f]=F.exports.useState(!1),C=d!==t.name?i(d):"",w=r&&!p||C==="";F.exports.useEffect(function(){h&&a.current&&(a.current.focus(),a.current.select())},[h]),F.exports.useEffect(function(){return()=>{l.current.isNew&&n(l.current)}},[n]);const S=()=>{w&&(o(t,d),g(!1))},T=()=>{if(r){n(t);return}u(t.name),g(!1)},R=v=>{f(!0),v.key==="Enter"&&(v.stopPropagation(),S()),v.key===" "&&v.stopPropagation(),v.key==="Escape"&&T()};return h?y(Oe,{children:[y("div",{className:"editing-container",children:[m("input",{ref:a,className:ee("form-control",{"is-invalid":!w}),value:d,placeholder:"Group Name",onChange:v=>u(v.target.value),onKeyDown:R}),m(z,{kind:"ghost",icon:jn,tooltip:"Confirm",onClick:S}),m(z,{kind:"ghost",icon:Qa,tooltip:"Cancel",onClick:T})]}),!w&&m("p",{className:"mb-0 validate-label-error text-danger",children:C})]}):y("div",{className:"group-name-wrapper",children:[m("span",{className:"column-name",children:d}),m(z,{className:"p-1 mx-1",kind:"ghost",icon:Pi,tooltip:"Edit",onClick:()=>{g(!0)}}),y("span",{className:"right-buttons",children:[m(z,{kind:"ghost",icon:un,tooltip:"Delete group",onClick:()=>n(t)}),m(z,{kind:"ghost",className:"color-swatch mr-1",icon:t.color!==void 0?y("span",{className:"fa-layers",children:[m(te,{className:"color-swatch",icon:ko,color:Ue.white,transform:"down-1"}),m(te,{className:"color-swatch",icon:ko,color:t.color,transform:"shrink-2 down-1"})]}):ja,tooltip:"Set color",onClick:()=>{var v,D;(v=c.current)==null||v.click(),(D=c.current)==null||D.focus()}}),m("input",{"aria-label":"Color input",ref:c,type:"color",list:"presetColors",value:(b=t.color)!=null?b:Ue["content-bg"],style:{visibility:"hidden",width:0,height:0,padding:0,border:0},onChange:v=>{t.color=v.target.value,s(t,v.target.value)}}),y("datalist",{id:"presetColors",children:[m("option",{children:Ue["content-bg"]}),m("option",{children:Ue.primary}),m("option",{children:Ue.foreground}),m("option",{children:Ue.green}),m("option",{children:Ue.yellow}),m("option",{children:Ue.orange}),m("option",{children:Ue.red}),m("option",{children:Ue.purple}),m("option",{children:Ue.blue}),m("option",{children:Ue["gray-400"]})]})]})]})}function ph(){}const fh=F.exports.forwardRef(function(t,n){const{value:s,clone:o,childCount:i,item:r,onVisibilityChange:l,onClick:a,onGroupDelete:c,onGroupColorChange:d,onGroupNameChange:u,validateGroupName:h,handleProps:g}=t,{group:p,modelIndex:f,isVisible:C}=r.data,w=F.exports.useRef(null),S=F.exports.useCallback(R=>{var b;R.buttons===1&&(l([f].flat(),!C),(b=w.current)==null||b.focus())},[l,f,C]),T=F.exports.useCallback(R=>{a(s,R)},[a,s]);return y("div",{ref:n,className:ee("tree-item",{isSelected:r.selected,"two-dragged":i===2,"multiple-dragged":i>2}),onClick:T,...g,children:[m(z,{ref:w,kind:"ghost",className:"px-1",onClick:ph,onMouseDown:S,onMouseEnter:S,icon:C?Gi:cl,tooltip:"Toggle visibility"}),m("span",{className:ee("column-name",p&&"column-group"),children:p&&!o?m(gh,{group:p,onDelete:c,onColorChange:d,onNameChange:u,validateName:h}):s}),y("div",{children:[o&&i>1&&m("span",{className:"item-count",children:i}),m(Rt,{children:"Drag to re-order"}),m(te,{icon:Ui})]})]})});function Ch(e){return e.parentId!==void 0}function wh(e,t){return Math.round(e/t)}function Hl(e,t,n,s,o,i){const r=e.findIndex(l=>l.name===s);if(r===-1){const l=n.get(s);if(l==null)throw new Error(`Column or header group not found: ${s}`);const a=l.childIndexes.flat();return{id:s,selected:i.has(s),children:l.children.map(c=>Hl(e,t,n,c,o,i)).sort((c,d)=>{const u=Array.isArray(c.data.visibleIndex)?c.data.visibleIndex[0]:c.data.visibleIndex,h=Array.isArray(d.data.visibleIndex)?d.data.visibleIndex[0]:d.data.visibleIndex;return u-h}),data:{modelIndex:a,visibleIndex:l.getVisibleRange(t),group:l,isVisible:a.some(c=>!o.has(c))}}}return{id:s,children:[],selected:i.has(s),data:{modelIndex:r,visibleIndex:H.getVisibleIndex(r,t),isVisible:!o.has(r)}}}function Sh(e,t,n,s,o){const i=[],r=new Set(o),l=new Map(n.map(d=>[d.name,d])),a=new Set(s);let c=0;for(;c<e.length;){const d=H.getModelIndex(c,t),u=e[d].name;let h=n.find(({children:p})=>p.includes(u));for(;h!==void 0&&h.parent!==void 0;)h=l.get(h.parent);const g=Hl(e,t,l,h?h.name:u,a,r);i.push(g),Array.isArray(g.data.visibleIndex)?c+=g.data.visibleIndex[1]-g.data.visibleIndex[0]+1:c+=1}return i}function Ho(e,t,n,s,o){const i=e.findIndex(({id:w})=>w===n),r=e.findIndex(({id:w})=>w===t),l=e[r],a=Sa(e,r,i),c=a[i-1],d=a[i+1],u=wh(s,o),h=l.depth+u,g=bh({previousItem:c,nextItem:d}),p=Th({nextItem:d});let f=h;return h>=g?f=g:h<p&&(f=p),{depth:f,maxDepth:g,minDepth:p,parentId:C()};function C(){var S;if(f===0||!c)return null;if(f===c.depth)return c.parentId;if(f>c.depth)return c.id;const w=(S=a.slice(0,i).reverse().find(T=>T.depth===f))==null?void 0:S.parentId;return w!=null?w:null}}function bh({previousItem:e,nextItem:t}){var n,s;return Math.max((n=e==null?void 0:e.depth)!=null?n:0,(s=t==null?void 0:t.depth)!=null?s:0)}function Th({nextItem:e}){return e?e.depth:0}function Vl(e,t=null,n=0){return e.reduce((s,o,i)=>[...s,{...o,parentId:t,depth:n,index:i},...Vl(o.children,o.id,n+1)],[])}function Tt(e){return e.every(Ch)?[...e]:Vl(e)}function Ul(e,t){for(let n=0;n<e.length;n+=1){const s=e[n],{id:o,children:i}=s;if(o===t)return s;if(i.length){const r=Ul(i,t);if(r)return r}}}function Bl(e,t=0){return e.reduce((n,{children:s})=>s.length?Bl(s,n+1):n+1,t)}function Eh(e,t){const n=Ul(e,t);return n?Bl(n.children):0}const vh=[Wt.Down,Wt.Right,Wt.Up,Wt.Left],Rh=[Wt.Left,Wt.Right];function yh(e,t,n){return(s,{currentCoordinates:o,context:{active:i,over:r,collisionRect:l,droppableRects:a,droppableContainers:c}})=>{if(vh.includes(s.code)){if(!i||!l)return;s.preventDefault();const{current:{items:d,offset:u}}=e;if(Rh.includes(s.code)&&(r==null?void 0:r.id)!=null){const{depth:f,maxDepth:C,minDepth:w}=Ho(d,i.id,r.id,u,n);switch(s.code){case Wt.Left:if(f>w)return{...o,x:o.x-n};break;case Wt.Right:if(f<C)return{...o,x:o.x+n};break}return}const h=[];c.forEach(f=>{if((f==null?void 0:f.disabled)||f.id===(r==null?void 0:r.id))return;const C=a.get(f.id);if(!!C)switch(s.code){case Wt.Down:l.top<C.top&&h.push(f);break;case Wt.Up:l.top>C.top&&h.push(f);break}});const g=ba({active:i,collisionRect:l,pointerCoordinates:null,droppableRects:a,droppableContainers:h});let p=Ta(g,"id");if(p===(r==null?void 0:r.id)&&g.length>1&&(p=g[1].id),p!=null&&(r==null?void 0:r.id)!=null){const f=a.get(i.id),C=a.get(p),w=c.get(p);if(f&&C&&w){const S=d.findIndex(({id:v})=>v===p),T=d[S],R=d.findIndex(({id:v})=>v===i.id),b=d[R];if(T!=null&&b!=null){const{depth:v}=Ho(d,i.id,p,(T.depth-b.depth)*n,n),A=S>R?1:-1,N=t?(l.height-f.height)/2:0;return{x:C.left+v*n,y:C.top+A*N}}}}}}}class Gl extends Ea{}Gl.activators=[{eventName:"onPointerDown",handler:({nativeEvent:e})=>!(!e.isPrimary||e.button!==0||Dh(e.target))}];const Fh=["button","input","textarea","select","option"];function Dh(e){return!!((e==null?void 0:e.tagName)!=null&&Fh.includes(e.tagName.toLowerCase()))}function Wl(e){const{clone:t=!1,depth:n,disableInteraction:s=!1,ghost:o=!1,handleProps:i,value:r,dragRef:l=null,wrapperRef:a=null,renderItem:c,item:d,childCount:u}=e,h=F.exports.useMemo(()=>Array(n).fill(0).map((p,f)=>m("span",{className:"depth-line"},`depth-line-${f}`)),[n]),g=F.exports.useMemo(()=>({ref:l,clone:t,value:r,item:d,childCount:u,handleProps:i}),[l,t,r,d,u,i]);return y("li",{className:ee("item-wrapper",{clone:t,ghost:o,disableInteraction:s}),ref:a,children:[!t&&h,c(g)]},r)}Wl.displayName="TreeItem";const Ih=({isSorting:e,wasDragging:t})=>!(e||t);function Vr({id:e,depth:t,...n}){const{attributes:s,isDragging:o,isSorting:i,listeners:r,setDraggableNodeRef:l,setDroppableNodeRef:a,transform:c,transition:d}=va({id:e,animateLayoutChanges:Ih}),u=Fi.Translate.toString(c),h=F.exports.useMemo(()=>({transform:u,transition:d}),[u,d]),g=F.exports.useMemo(()=>({...s,...r,style:h}),[s,r,h]);return m(Wl,{dragRef:l,wrapperRef:a,depth:t,ghost:o,disableInteraction:i,handleProps:g,...n})}const Nh={keyframes({transform:e}){return[{opacity:1,transform:Fi.Transform.toString(e.initial)},{opacity:0,transform:Fi.Transform.toString({...e.final,x:e.final.x+5,y:e.final.y+5})}]},easing:"ease-out",sideEffects({active:e}){e.node.animate([{opacity:0},{opacity:1}],{duration:gr.duration,easing:gr.easing})}};let hs=null;function Ah(e){return hs==null&&e.activeNodeRect&&e.activatorEvent instanceof PointerEvent&&(hs=Math.floor((e.activatorEvent.clientY-e.activeNodeRect.top)/e.activeNodeRect.height)*e.activeNodeRect.height),e.activeNodeRect||(hs=null),{...e.transform,y:e.transform.y+(hs!=null?hs:0)}}function Mh({items:e,renderItem:t,indentationWidth:n=30,indicator:s=!1,activeId:o,overId:i,offsetLeft:r}){const l=Ra(),a=F.exports.useRef(l);F.exports.useEffect(function(){a.current=l},[l]),F.exports.useEffect(function(){a.current.measureDroppableContainers(e.map(({id:g})=>g))},[e]);const c=o!=null&&i!=null?Ho(e,o,i,r,n):null,d=F.exports.useRef({items:e,offset:r}),u=o!=null?e.find(({id:h})=>h===o):null;return F.exports.useEffect(()=>{d.current={items:e,offset:r}},[e,r]),y(Oe,{children:[m("div",{className:ee("tree-container",o!=null&&"marching-ants"),children:e.map(h=>{const{id:g,depth:p}=h;return m(Vr,{id:g,value:g,depth:g===o&&c?c.depth:p,item:h,renderItem:t},g)})}),ya.exports.createPortal(m(Fa,{dropAnimation:Nh,modifiers:[Ah],className:"visibility-ordering-list",children:o!=null&&u?m(Vr,{id:o,depth:u.depth,clone:!0,childCount:Eh(e,o)+1,value:o.toString(),renderItem:t,item:u}):null}),document.body)]})}const Oh={droppable:{strategy:Da.Always}},xh={activationConstraint:{distance:5}};function kh({items:e,indicator:t=!1,indentationWidth:n=30,onDragStart:s,onDragEnd:o,renderItem:i}){const[r,l]=F.exports.useState(null),[a,c]=F.exports.useState(null),[d,u]=F.exports.useState(0),h=F.exports.useMemo(()=>{const A=Tt(e);return r!=null?A.filter(({id:N,selected:L})=>N===r||!L):A},[r,e]),g=r!=null&&a!=null?Ho(h,r,a,d,n):null,p=F.exports.useRef({items:h,offset:d}),f=F.exports.useMemo(()=>({coordinateGetter:yh(p,t,n)}),[n,t]),C=Ia(pr(Gl,xh),pr(xa,f)),w=F.exports.useMemo(()=>h.map(({id:A})=>A),[h]);F.exports.useEffect(()=>{p.current={items:h,offset:d}},[h,d]);const S=F.exports.useCallback(({active:{id:A}})=>{l(A),c(A),s==null||s(A),document.body.style.setProperty("cursor","grabbing")},[s]),T=F.exports.useCallback(({delta:A})=>{u(A.x)},[]),R=F.exports.useCallback(({over:A})=>{var N;c((N=A==null?void 0:A.id)!=null?N:null)},[]),b=F.exports.useCallback(()=>{c(null),l(null),u(0),document.body.style.setProperty("cursor","")},[]),v=F.exports.useCallback(({active:A,over:N})=>{if(b(),g&&N){const{depth:L,parentId:k}=g,x=JSON.parse(JSON.stringify(Tt(e))),W=x.findIndex(({id:Z})=>Z===N.id),V=x.findIndex(({id:Z})=>Z===A.id),K=x[V];x[V]={...K,depth:L,parentId:k},o==null||o(K,{...x[W],parentId:g.parentId})}},[e,o,g,b]),D=F.exports.useCallback(()=>{b()},[b]);return m(Na,{sensors:C,collisionDetection:Aa,measuring:Oh,onDragStart:S,onDragMove:T,onDragOver:R,onDragEnd:v,onDragCancel:D,children:m(Ma,{items:w,strategy:Oa,children:m(Mh,{items:h,renderItem:i,indicator:t,indentationWidth:n,activeId:r,overId:a,offsetLeft:d})})})}function Lh(e,t,n,s,o,i,r,l){const a=o.map((S,T)=>({...S,index:T}));let c=[],d=s;const u=i[0].data.visibleIndex,h=a.findIndex(({id:S})=>S===e.id),g=a.findIndex(({id:S})=>S===t.id);let p=Array.isArray(u)?u[1]+1:u+1;d=An(i[0],t.parentId,d);for(let S=1;S<i.length;S+=1){const{data:{visibleIndex:T}}=i[S];c=H.moveItemOrRange(T,p,c,!0),p+=Array.isArray(T)?T[1]-T[0]+1:1,d=An(i[S],t.parentId,d)}const f=[Array.isArray(u)?u[0]:u,p-1],C=Array.isArray(t.data.visibleIndex)?t.data.visibleIndex[0]:t.data.visibleIndex;let w=H.getVisibleIndex(C,c);return h>g&&w>C&&(w-=1),t.children.length>0&&(Array.isArray(u)?u[0]:u)<w&&(w-=1),f[0]<w&&(w-=f[1]-f[0]),c=H.moveItemOrRange(f,Be(w,r,l),c),{groups:d,movedColumns:n.concat(c)}}function An(e,t,n){var a;if(e.parentId===t)return[...n];let s=n.map(c=>new Bt(c));const o=new Map(s.map(c=>[c.name,c])),i=s.find(c=>c.name===e.parentId),r=s.find(c=>c.name===t),l=s.find(c=>c.name===e.id);if(i!=null&&(i.children=i.children.filter(c=>c!==e.id),i.children.length===0)){const c=new Set([i.name]),{parent:d=""}=i;let u=o.get(d);for(u==null||u.removeChildren([i.name]);u&&u.children.length===0;){c.add(u.name);const h=(a=u==null?void 0:u.parent)!=null?a:"",g=o.get(h);g==null||g.removeChildren([u.name]),u=g}s=s.filter(({name:h})=>!c.has(h))}return r!=null&&r.addChildren([e.id]),l==null||l.setParent(t!=null?t:void 0),s}const Ph=150,Qe=class extends F.exports.Component{constructor(e){super(e),this.debouncedSearchColumns=vt(this.searchColumns,Ph),this.handleGroupColorChange=Pn((t,n)=>{const{columnHeaderGroups:s,onColumnHeaderGroupChanged:o}=this.props,i=[...s],r=new Bt({...t,color:n});i.splice(i.findIndex(({name:l})=>l===t.name),1,r),o(i)},250),this.renderItem=be(({value:t,clone:n,item:s,ref:o,handleProps:i})=>{const{onColumnVisibilityChanged:r}=this.props,{selectedColumns:l}=this.state;let a=t;return n&&(a=this.getSelectedParentItems().map(({id:d})=>d).join(", ")),m(fh,{ref:o,value:a,clone:n,item:s,childCount:l.size,onVisibilityChange:r,onClick:this.handleItemClick,onGroupDelete:this.handleGroupDelete,onGroupColorChange:this.handleGroupColorChange,onGroupNameChange:this.handleGroupNameChange,validateGroupName:this.validateGroupName,handleProps:i})}),this.getMemoizedFirstMovableIndex=be((t,n,s)=>{for(let o=0;o<n.length;o+=1){const i=H.getModelIndex(o,s);if(t.isColumnMovable(i))return o}return null}),this.getMemoizedLastMovableIndex=be((t,n,s)=>{for(let o=n.length-1;o>=0;o-=1){const i=H.getModelIndex(o,s);if(t.isColumnMovable(i))return o}return null}),this.memoizedGetTreeItems=be((t,n,s,o,i)=>Sh(t,n,s,o,[...i.values()])),this.makeVisibilityOrderingList=be((t,n)=>{const{movedColumns:s}=this.props,o=[],i=this.getFirstMovableIndex(),r=this.getLastMovableIndex(),l=n.findIndex(({data:d})=>Array.isArray(d.visibleIndex)?d.visibleIndex[0]===i:d.visibleIndex===i),a=n.findIndex(({data:d})=>Array.isArray(d.visibleIndex)?d.visibleIndex[1]===r:d.visibleIndex===r),c=n.slice(l,a+1);if(i==null||r===null){for(let d=0;d<t.length;d+=1){const u=H.getModelIndex(d,s),h=t[u];o.push(this.renderImmovableItem(h.name))}return o}for(let d=0;d<i;d+=1){const u=H.getModelIndex(d,s),h=t[u];o.push(this.renderImmovableItem(h.name))}i!==null&&i>0&&o.push(m("hr",{},"top-horizontal-divider")),o.push(m(kh,{items:c,renderItem:this.renderItem,onDragStart:this.handleDragStart,onDragEnd:this.handleDragEnd},"movable-items")),r!=null&&r<t.length-1&&o.push(m("hr",{},"bottom-horizontal-divider"));for(let d=r+1;d<t.length;d+=1){const u=H.getModelIndex(d,s),h=t[u];o.push(this.renderImmovableItem(h.name))}return o}),this.renderImmovableItem=be(t=>m("div",{className:"visibility-ordering-list-item immovable",children:m("div",{className:"column-item",children:m("span",{className:"column-name",children:t})})},t)),this.handleSearchInputChange=this.handleSearchInputChange.bind(this),this.searchColumns=this.searchColumns.bind(this),this.handleItemClick=this.handleItemClick.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleGroupDelete=this.handleGroupDelete.bind(this),this.handleGroupNameChange=this.handleGroupNameChange.bind(this),this.handleGroupCreate=this.handleGroupCreate.bind(this),this.validateGroupName=this.validateGroupName.bind(this),this.addColumnToSelected=this.addColumnToSelected.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.state={selectedColumns:new Set,lastSelectedColumn:"",searchFilter:""},this.list=null}componentWillUnmount(){this.debouncedSearchColumns.cancel()}resetVisibilityOrdering(){const{model:e,onReset:t,onMovedColumnsChanged:n,onColumnHeaderGroupChanged:s}=this.props;this.setState({selectedColumns:new Set,lastSelectedColumn:"",searchFilter:""}),t(),s(e.initialColumnHeaderGroups),n(e.initialMovedColumns)}resetSelection(){this.setState({selectedColumns:new Set,lastSelectedColumn:""})}handleSearchInputChange(e){const t=e.target.value;if(this.setState({searchFilter:t}),!t){this.debouncedSearchColumns.cancel(),this.resetSelection();return}this.debouncedSearchColumns(t)}searchColumns(e){var i;const t=Tt(this.getTreeItems()),s=t.filter(({id:r})=>r.toLowerCase().includes(e.toLowerCase())).map(({id:r})=>r),o=t.findIndex(({id:r})=>r.toLowerCase().includes(e.toLowerCase()));if(this.addColumnToSelected(s,!1),s.length>0){const r=(i=this.list)==null?void 0:i.querySelectorAll(".item-wrapper")[o];r==null||r.scrollIntoView({block:"center"})}}moveSelectedColumns(e){var d;const{columnHeaderGroups:t}=this.props,{selectedColumns:n}=this.state,s=Tt(this.getTreeItems());let o=this.getFirstMovableIndex(),i=this.getLastMovableIndex();M(o),M(i);const r=this.getSelectedParentItems();e===Qe.MOVE_OPTIONS.UP||e===Qe.MOVE_OPTIONS.TOP||r.reverse();let a=[],c=t;for(let u=0;u<r.length;u+=1){const{id:h,parentId:g,depth:p,data:{visibleIndex:f}}=r[u];switch(e){case Qe.MOVE_OPTIONS.TOP:{a=H.moveItemOrRange(f,o,a,!0),o+=Array.isArray(f)?f[1]-f[0]+1:1,c=An(r[u],null,c);break}case Qe.MOVE_OPTIONS.BOTTOM:{a=H.moveItemOrRange(f,i,a,!0),i-=Array.isArray(f)?f[1]-f[0]+1:1,c=An(r[u],null,c);break}case Qe.MOVE_OPTIONS.UP:{const C=s.findIndex(T=>T.id===h),w=s.map((T,R)=>R<C&&!n.has(T.id)).lastIndexOf(!0),S=s[w];if(S!=null&&S.parentId!==g)if(Math.abs(S.depth-p)>1){const T=s.map((b,v)=>v<w&&b.depth===p).lastIndexOf(!0),R=s[T];c=An(r[u],R.id,c)}else c=An(r[u],S.parentId,c);else{const T=Be(Array.isArray(f)?f[0]-1:f-1,o,i);a=H.moveItemOrRange(f,T,a,!1),o+=Array.isArray(f)?f[1]-f[0]+1:1}break}case Qe.MOVE_OPTIONS.DOWN:{const C=s.findIndex(R=>R.id===h),w=s.find((R,b)=>b>C&&!n.has(R.id));if((w==null?void 0:w.parentId)!==g){const R=s.find(b=>b.id===g);c=An(r[u],(d=R==null?void 0:R.parentId)!=null?d:null,c);break}else if((w==null?void 0:w.children.length)>0){c=An(r[u],w.id,c);break}const S=Be(Array.isArray(f)?f[0]+1:f+1,o,i);a=H.moveItemOrRange(f,S,a,!1),i-=Array.isArray(f)?f[1]-f[0]+1:1;break}}}return{newMoves:a,groups:c}}handleMoveColumns(e){const{onMovedColumnsChanged:t,movedColumns:n,onColumnHeaderGroupChanged:s}=this.props,{newMoves:o,groups:i}=this.moveSelectedColumns(e);let r;e===Qe.MOVE_OPTIONS.TOP&&(r=()=>{var l,a;(a=(l=this.list)==null?void 0:l.parentElement)==null||a.scroll({top:0})}),e===Qe.MOVE_OPTIONS.BOTTOM&&(r=()=>{var l,a;(a=(l=this.list)==null?void 0:l.parentElement)==null||a.scroll({top:this.list.parentElement.scrollHeight})}),s(i),o.length>0&&t(n.concat(o),r)}getSortMoves(e,t,n){const s=[...e],o=t===Qe.SORTING_OPTIONS.ASC;s.sort((l,a)=>{const c=l.id.toUpperCase(),d=a.id.toUpperCase();return Wi.sort(c,d,o)});let i=[...n],r=Math.min(...s.flatMap(l=>{const{modelIndex:a}=l.data;return Array.isArray(a)?H.getVisibleIndexes(a,i):H.getVisibleIndex(a,i)}));for(let l=0;l<s.length;l+=1){const a=s[l],{modelIndex:c}=a.data,d=Array.isArray(c)?H.getVisibleIndexes(c,i):H.getVisibleIndex(c,i);i=Array.isArray(d)?H.moveRange([Math.min(...d),Math.max(...d)],r,i,!0):H.moveItem(d,r,i),Array.isArray(d)&&(i=this.getSortMoves(a.children,t,i)),r+=Array.isArray(c)?c.length:1}return i}handleSortColumns(e){const{model:t,onMovedColumnsChanged:n}=this.props,s=this.getSortMoves(this.getTreeItems(),e,t.initialMovedColumns);n(s)}handleItemClick(e,t){if(t.stopPropagation(),t.target instanceof HTMLElement&&(t.target.tagName==="BUTTON"||t.target.tagName==="INPUT"))return;t.currentTarget.focus();const{selectedColumns:n,lastSelectedColumn:s}=this.state,o=H.isModifierKeyDown(t),i=t.shiftKey,r=n.has(e),l=[e];if(r&&o){this.removeColumnFromSelected(e);return}const a=Tt(this.getTreeItems());if(r&&!i&&s===e){const c=a.find(({id:u})=>u===e);if(M(c),Tt(c.children).length+1===n.size){this.resetSelection();return}}if(i){const c=a.findIndex(u=>u.id===e),d=a.findIndex(u=>u.id===s);l.push(...a.slice(Math.min(d,c),Math.max(d,c)+1).map(u=>u.id))}this.addColumnToSelected(l,o||i),this.setState({lastSelectedColumn:e})}addColumnToSelected(e,t){const{selectedColumns:n}=this.state,s=new Set(t?[...n.values()].concat(e):e);Tt(this.getTreeItems()).forEach(({id:i,children:r})=>{s.has(i)&&r.forEach(l=>s.add(l.id))}),this.setState({selectedColumns:s})}removeColumnFromSelected(e){const{selectedColumns:t}=this.state,n=Tt(this.getTreeItems()),s=n.find(({id:i})=>i===e);M(s);let o=n.find(({id:i})=>i===s.parentId);for(Tt(s==null?void 0:s.children).forEach(i=>t.delete(i.id));o!=null;){t.delete(o.id);const i=o.parentId;o=n.find(({id:r})=>r===i)}t.delete(e),this.setState({selectedColumns:new Set(t)})}handleDragStart(e){const{selectedColumns:t}=this.state;t.has(e)||this.addColumnToSelected([e],!1)}handleDragEnd(e,t){const{movedColumns:n,onMovedColumnsChanged:s,columnHeaderGroups:o,onColumnHeaderGroupChanged:i}=this.props,r=this.getSelectedParentItems(),l=Tt(this.getTreeItems()).map((h,g)=>({...h,index:g})),a=this.getFirstMovableIndex(),c=this.getLastMovableIndex();M(a),M(c);const{groups:d,movedColumns:u}=Lh(e,t,n,o,l,r,a,c);i(d),s(u)}handleGroupNameChange(e,t){const{columnHeaderGroups:n,onColumnHeaderGroupChanged:s}=this.props,o=[...n],i=e.name,r=o.findIndex(({name:d})=>d===i),l=o[r];M(l);const a=new Bt(l);a.name=t,o.splice(r,1,a);const c=o.findIndex(({name:d})=>d===a.parent);if(c>=0){const d=new Bt(o[c]);d.removeChildren([i]),d.addChildren([t]),o.splice(c,1,d)}s(o)}handleGroupDelete(e){const{columnHeaderGroups:t,onColumnHeaderGroupChanged:n}=this.props,s=t.filter(i=>i.name!==e.name),o=s.findIndex(i=>i.name===e.parent);if(o>=0){const i=new Bt(s[o]);i.addChildren(e.children),i.removeChildren([e.name]),s.splice(o,1,i)}n(s)}handleGroupCreate(){const{movedColumns:e,onMovedColumnsChanged:t,onColumnHeaderGroupChanged:n}=this.props,{newMoves:s,groups:o}=this.moveSelectedColumns(Qe.MOVE_OPTIONS.TOP),i=o.filter(d=>!d.isNew),r=this.getSelectedParentItems(),l=r.map(d=>d.data.modelIndex).flat().filter(d=>d>=0),a=`${Bt.NEW_GROUP_PREFIX}-${Date.now()}`,c=new Bt({name:a,children:r.map(({id:d})=>d),depth:0,childIndexes:[...new Set(l)]});t(e.concat(s),()=>{var d,u;(u=(d=this.list)==null?void 0:d.parentElement)==null||u.scroll({top:0})}),n(i.concat([c])),this.resetSelection()}validateGroupName(e){const{model:t,columnHeaderGroups:n}=this.props,{columns:s}=t;return Ys.isValidColumnName(e)?s.some(({name:o})=>o===e)||n.some(({name:o})=>o===e)?"Duplicate name":"":"Invalid name"}getFirstMovableIndex(){const{model:e,movedColumns:t}=this.props;return this.getMemoizedFirstMovableIndex(e,e.columns,t)}getLastMovableIndex(){const{model:e,movedColumns:t}=this.props;return this.getMemoizedLastMovableIndex(e,e.columns,t)}getTreeItems(){const{model:e,movedColumns:t,hiddenColumns:n,columnHeaderGroups:s}=this.props,{selectedColumns:o}=this.state;return this.memoizedGetTreeItems(e.columns,t,s,n,o)}getSelectedParentItems(){const{selectedColumns:e}=this.state;return Tt(this.getTreeItems()).filter(({id:n,parentId:s})=>e.has(n)&&!e.has(s!=null?s:""))}render(){const{model:e,hiddenColumns:t,onColumnVisibilityChanged:n}=this.props,{selectedColumns:s,searchFilter:o}=this.state,i=s.size>0,r=this.getTreeItems(),l=new Map(Tt(r).map(p=>[p.id,p.data.modelIndex])),a=new Set(t),c=[...new Set(i?[...s.values()].map(p=>l.get(p)).filter(p=>p!=null).flat():r.map(p=>p.data.modelIndex).flat())],d=c.some(p=>!a.has(p)),u=d?"Hide All":"Show All",h=d?"Hide Selected":"Show Selected",g=this.makeVisibilityOrderingList(e.columns,r);return y("div",{role:"menu",className:"visibility-ordering-builder",tabIndex:0,children:[y("div",{className:"top-menu",children:[m(z,{kind:"ghost",className:"toggle-visibility-btn",onClick:()=>{n(c,!d)},icon:d?Gi:cl,tooltip:"Toggle column visibility",children:i?h:u}),m(Xs,{className:"visibility-search",value:o,matchCount:o?s.size:void 0,onChange:this.handleSearchInputChange})]}),y("div",{className:"top-menu",children:[m(z,{kind:"ghost",icon:Za,tooltip:"Reset to default",onClick:()=>{this.resetVisibilityOrdering()},children:"Reset"}),m("span",{className:"vertical-divider"}),m(z,{kind:"ghost",icon:_i,tooltip:"Sort ascending",onClick:()=>{this.handleSortColumns(Qe.SORTING_OPTIONS.ASC)}}),m(z,{kind:"ghost",icon:Hi,tooltip:"Sort descending",onClick:()=>{this.handleSortColumns(Qe.SORTING_OPTIONS.DSC)}}),m("span",{className:"vertical-divider"}),y(z,{kind:"ghost",tooltip:"Create group from selection",disabled:!i,onClick:this.handleGroupCreate,children:[y("span",{className:"fa-layers",style:{marginRight:"0.75rem"},children:[m(te,{mask:Ja,icon:qo,transform:"right-7 down-5 shrink-6"}),m(te,{icon:ec,transform:"right-8 down-6 shrink-8"})]}),"Group"]}),m("span",{className:"vertical-divider"}),m(z,{kind:"ghost",icon:tc,tooltip:"Move selection up",onClick:()=>{this.handleMoveColumns(Qe.MOVE_OPTIONS.UP)},disabled:!i}),m(z,{kind:"ghost",icon:nc,tooltip:"Move selection down",onClick:()=>{this.handleMoveColumns(Qe.MOVE_OPTIONS.DOWN)},disabled:!i}),m(z,{kind:"ghost",icon:sc,tooltip:"Move selection to top",onClick:()=>{this.handleMoveColumns(Qe.MOVE_OPTIONS.TOP)},disabled:!i}),m(z,{kind:"ghost",icon:oc,tooltip:"Move selection to bottom",onClick:()=>{this.handleMoveColumns(Qe.MOVE_OPTIONS.BOTTOM)},disabled:!i})]}),m("div",{role:"menu",className:ee("visibility-ordering-list"),children:m("div",{className:"column-list",ref:p=>{this.list=p},children:g})})]})}};let tr=Qe;tr.SORTING_OPTIONS={DSC:"DSC",ASC:"ASC"};tr.MOVE_OPTIONS={TOP:"TOP",BOTTOM:"BOTTOM",UP:"UP",DOWN:"DOWN"};class Io extends F.exports.PureComponent{constructor(t){super(t),this.handleSearchValueChange=this.handleSearchValueChange.bind(this),this.toggleColumn=this.toggleColumn.bind(this),this.selectAll=this.selectAll.bind(this),this.clear=this.clear.bind(this),this.selectNumbers=this.selectNumbers.bind(this),this.searchField=Fe.createRef(),this.state={isConfigureColumnsShown:!1}}static createSearchFilter(t,n,s,o){const i=o?s.filter(r=>!n.includes(r.name)).map(r=>r.name):n;if(t&&i.length>0){const r=E.FilterValue.ofString(t);return i.length===s.length?E.FilterCondition.search(r):E.FilterCondition.search(r,s.filter(a=>i.includes(a.name)).map(a=>a.filter()))}}focus(){var t;(t=this.searchField.current)==null||t.focus()}handleSearchValueChange(t){const{onChange:n,selectedColumns:s,invertSelection:o}=this.props;n(t.target.value,s,o)}sendColumnChange(t,n){const{onChange:s,value:o}=this.props;s(o,t,n)}setInvertSelection(t){const{onChange:n,value:s}=this.props;n(s,[],t)}toggleColumn(t){const{selectedColumns:n,invertSelection:s}=this.props;if(n.includes(t))this.sendColumnChange(n.filter(o=>o!==t),s);else{const o=n.slice();o.push(t),this.sendColumnChange(o,s)}}selectAll(){this.setInvertSelection(!0)}clear(){this.setInvertSelection(!1)}selectNumbers(){const{columns:t}=this.props;this.sendColumnChange(t.filter(n=>I.isNumberType(n.type)).map(n=>n.name),!1)}render(){const{value:t,selectedColumns:n,invertSelection:s,columns:o}=this.props,{isConfigureColumnsShown:i}=this.state,r=n.length===0&&s===!0||n.length===o.length&&s===!1,l=n.length===0&&s===!1||n.length===o.length&&s===!0;let a;return r?a=y(Oe,{children:[m(te,{icon:ko,mask:di,transform:"shrink-2 down-5 right-7"}),m(te,{icon:ic,className:"text-primary",transform:"shrink-4 down-5 right-7"})]}):l?a=y(Oe,{children:[m(te,{icon:qo,mask:di,transform:"shrink-1 down-5 right-7"}),m(te,{icon:Cr,className:"text-danger",transform:"shrink-4 down-5 right-7"})]}):a=y(Oe,{children:[m(te,{icon:ko,mask:di,transform:"shrink-2 down-5 right-7"}),m(te,{icon:rc,className:"text-primary",transform:"shrink-4 down-5 right-7"})]}),y("div",{className:"cross-column-container",children:[m(Xs,{className:"cross-column-search",placeholder:"Search Data...",value:t,onChange:this.handleSearchValueChange,ref:this.searchField}),y("button",{type:"button",className:"btn btn-link btn-link-icon px-2",onClick:()=>{i?this.setState({isConfigureColumnsShown:!1}):this.setState({isConfigureColumnsShown:!0})},children:[m("div",{className:"fa-layers",children:a}),m(Rt,{children:"Configure Columns"}),m(dl,{isShown:i,className:"cross-column-popper",onExited:()=>{this.setState({isConfigureColumnsShown:!1})},closeOnBlur:!0,interactive:!0,children:y("div",{className:"cross-column-popup",children:["Searched Columns",m("div",{className:"cross-column-scroll",children:o.map(c=>y(Fe.Fragment,{children:[m(ln,{className:"cross-column-checkbox",checked:s?!n.includes(c.name):n.includes(c.name),onChange:()=>this.toggleColumn(c.name),children:c.name}),c.type.substring(c.type.lastIndexOf(".")+1)]},c.name))}),y("div",{className:"cross-column-button-bar",children:[m("button",{type:"button",className:"btn btn-link",onClick:this.selectAll,children:"Select All"}),m("button",{type:"button",className:"btn btn-link",onClick:this.clear,children:"Clear"}),m("button",{type:"button",className:"btn btn-link",onClick:this.selectNumbers,children:"Numbers Only"})]}),l&&y("p",{className:"text-danger",children:[m(te,{icon:Cr})," Select at least one column to search."]})]})})]})]})}}const Tn=ie.module("PartitionSelectorSearch"),_h=150,$l=class extends F.exports.Component{constructor(e){super(e),this.debounceUpdateFilter=vt(()=>{this.updateFilter()},_h),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleInputFocus=this.handleInputFocus.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleListKeydown=this.handleListKeydown.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleTableUpdate=this.handleTableUpdate.bind(this),this.handleTextChange=this.handleTextChange.bind(this),this.handleViewportChange=this.handleViewportChange.bind(this),this.itemList=null,this.searchInput=null,this.timer=null,this.state={offset:0,itemCount:0,items:[],text:"",isLoading:!0}}static handleError(e){e instanceof xi||Tn.error(e)}componentDidMount(){this.startListening()}componentDidUpdate(e,t){const{isLoading:n,itemCount:s}=this.state,{onListResized:o}=this.props;(s!==t.itemCount||n!==t.isLoading)&&o()}componentWillUnmount(){this.debounceUpdateFilter.cancel(),this.stopListening()}handleKeyDown(e){if(this.itemList==null)return!1;const{items:t,itemCount:n}=this.state;switch(e.key){case"Enter":{let s=null;if(t.length>0)s=t[0].value;else{const{text:o}=this.state;s=o.trim()}if(s.length>0){const{onSelect:o}=this.props;o(s)}return e.stopPropagation(),e.preventDefault(),!0}case"ArrowDown":return n>0&&this.itemList.focusItem(1),e.stopPropagation(),e.preventDefault(),!0;default:return!1}}handleListKeydown(e){switch(e.key){case"Escape":break;default:this.focus();break}}handleFilterChange(){Tn.debug2("handleFilterChange");const{table:e}=this.props,t=e.size;this.setState({itemCount:t,isLoading:!0})}handleInputFocus(){this.itemList&&this.itemList.focusItem(0)}handleSelect(e){Tn.debug2("handleSelect",e);const{onSelect:t}=this.props,{offset:n,items:s}=this.state,o=e-n;if(o<0||s.length<=o){Tn.error("No data for item",e);return}const{value:i}=s[o];t(i)}handleTableUpdate(e){const t=e.detail,{offset:n}=t,s=[],{getFormattedString:o,table:i}=this.props,r=i.columns[0];for(let a=0;a<t.rows.length;a+=1){const d=t.rows[a].get(r),u=o(d,r.type,r.name);s.push({displayValue:u,value:d})}const l=i.size;Tn.debug2("handleTableUpdate",l,n,s.length),this.setState({itemCount:l,items:s,offset:n,isLoading:!1})}handleTextChange(e){Tn.debug2("handleTextChange");const{value:t}=e.target;this.setState({text:t}),this.debounceUpdateFilter()}handleViewportChange(e,t){Tn.debug2("handleViewportChange",e,t);const n=Math.max(1,t-e),s=Math.max(0,e-n),o=t+n,{table:i}=this.props;i.setViewport(s,o)}focus(){this.searchInput&&this.searchInput.focus()}startListening(){const{initialPageSize:e,table:t}=this.props;t.addEventListener(E.Table.EVENT_UPDATED,this.handleTableUpdate),t.addEventListener(E.Table.EVENT_FILTERCHANGED,this.handleFilterChange),t.setViewport(0,e)}stopListening(){const{table:e}=this.props;e.removeEventListener(E.Table.EVENT_UPDATED,this.handleTableUpdate),e.removeEventListener(E.Table.EVENT_FILTERCHANGED,this.handleFilterChange)}updateFilter(){const{initialPageSize:e,table:t}=this.props,{text:n}=this.state,s=n.trim(),o=[];if(s.length>0){const r=t.columns[0].filter().invoke("matches",E.FilterValue.ofString(`(?s)(?i).*\\Q${s}\\E.*`));o.push(r)}Tn.debug2("updateFilter",o),t.applyFilter(o),t.setViewport(0,e)}render(){const{isLoading:e,itemCount:t,items:n,offset:s,text:o}=this.state,i=Math.min(t,$l.MAX_VISIBLE_ITEMS)*xo.DEFAULT_ROW_HEIGHT+11;return y("div",{className:"iris-grid-partition-selector-search",children:[m("div",{className:"search-container",children:m("input",{type:"text",ref:r=>{this.searchInput=r},value:o,placeholder:"Available Partitions",onChange:this.handleTextChange,onFocus:this.handleInputFocus,onKeyDown:this.handleKeyDown,className:"form-control input-partition"})}),!e&&t>0&&m("div",{className:"iris-grid-partition-selector-search-list",onKeyDown:this.handleListKeydown,role:"presentation",style:{height:i},children:m(xo,{ref:r=>{this.itemList=r},itemCount:t,items:n,offset:s,onSelect:this.handleSelect,onViewportChange:this.handleViewportChange})}),!e&&t===0&&m("div",{className:"iris-grid-partition-selector-search-empty",children:"No results"}),e&&y("div",{className:"iris-grid-partition-selector-loading",children:[m(dn,{}),"\xA0Loading..."]})]})}};let ti=$l;ti.MAX_VISIBLE_ITEMS=12;ti.defaultProps={initialPageSize:100,onSelect:()=>{},onListResized:()=>{}};ti.propTypes={getFormattedString:B.exports.func.isRequired,table:B.exports.shape({addEventListener:B.exports.func.isRequired,removeEventListener:B.exports.func.isRequired,columns:B.exports.arrayOf(B.exports.shape({name:B.exports.string.isRequired,type:B.exports.string.isRequired,filter:B.exports.func.isRequired})),size:B.exports.number.isRequired,applyFilter:B.exports.func.isRequired,setViewport:B.exports.func.isRequired}).isRequired,initialPageSize:B.exports.number,onSelect:B.exports.func,onListResized:B.exports.func};const ms=ie.module("IrisGridPartitionSelector"),Hh=250;class zl extends F.exports.Component{constructor(t){super(t),this.debounceUpdate=vt(()=>{this.sendUpdate()},Hh),this.handleAppendClick=this.handleAppendClick.bind(this),this.handleCloseClick=this.handleCloseClick.bind(this),this.handleIgnoreClick=this.handleIgnoreClick.bind(this),this.handlePartitionChange=this.handlePartitionChange.bind(this),this.handlePartitionSelect=this.handlePartitionSelect.bind(this),this.handlePartitionListResized=this.handlePartitionListResized.bind(this),this.handleSearchOpened=this.handleSearchOpened.bind(this),this.handleSearchClosed=this.handleSearchClosed.bind(this),this.searchMenu=null,this.selectorSearch=null;const{partition:n}=t;this.state={partition:n}}componentWillUnmount(){this.debounceUpdate.cancel()}handleAppendClick(){ms.debug2("handleAppendClick");const{onAppend:t}=this.props,{partition:n}=this.state;t(n)}handleCloseClick(){ms.debug2("handleCloseClick"),this.sendDone()}handleIgnoreClick(){ms.debug2("handleIgnoreClick"),this.sendFetchAll()}handlePartitionChange(t){ms.debug2("handlePartitionChange");const{value:n}=t.target;this.setState({partition:n}),this.debounceUpdate()}handlePartitionSelect(t){this.searchMenu&&this.searchMenu.closeMenu(),this.setState({partition:t},()=>{this.sendUpdate()})}handlePartitionListResized(){this.searchMenu&&this.searchMenu.scheduleUpdate()}handleSearchClosed(){const{table:t}=this.props;t.applyFilter([])}handleSearchOpened(){this.selectorSearch&&this.selectorSearch.focus()}sendDone(){this.debounceUpdate.flush();const{onDone:t}=this.props;t()}sendUpdate(){ms.debug2("sendUpdate");const{onChange:t}=this.props,{partition:n}=this.state;t(n)}sendFetchAll(){ms.debug2("sendFetchAll"),this.debounceUpdate.cancel();const{onFetchAll:t}=this.props;t()}render(){const{columnName:t,getFormattedString:n,onDone:s,table:o}=this.props,{partition:i}=this.state,r=m(ti,{getFormattedString:n,table:o,onSelect:this.handlePartitionSelect,onListResized:this.handlePartitionListResized,ref:l=>{this.selectorSearch=l}},"search");return y("div",{className:"iris-grid-partition-selector",children:[m("div",{className:"status-message",children:y("span",{children:['Filtering "',t,'" partition to']})}),y("div",{className:"input-group",children:[m("input",{type:"text",value:i,onChange:this.handlePartitionChange,className:"form-control input-partition"}),m("div",{className:"input-group-append",children:y("button",{type:"button",className:"btn btn-outline-primary",children:[m(te,{icon:Xn}),m(Rt,{children:"Partitions"}),m(Ss,{ref:l=>{this.searchMenu=l},actions:[{menuElement:r}],onMenuOpened:this.handleSearchOpened,onMenuClosed:this.handleSearchClosed})]})})]}),m("div",{className:"iris-grid-partition-selector-spacer"}),m("button",{type:"button",className:"btn btn-outline-primary btn-ignore",onClick:this.handleIgnoreClick,children:"Ignore & Fetch All"}),m("button",{type:"button",className:"btn btn-outline-primary btn-append",onClick:this.handleAppendClick,children:"Append Command"}),m("button",{type:"button",className:"btn btn-link btn-link-icon btn-close",onClick:s,children:m(te,{icon:qs})})]})}}zl.defaultProps={onAppend:()=>{},onChange:()=>{},onFetchAll:()=>{},onDone:()=>{},partition:""};const Vh=ie.module("SelectDistinctBuilder");class ql extends F.exports.Component{constructor(t){super(t),this.handleAddColumnClick=this.handleAddColumnClick.bind(this),this.handleDeleteColumn=this.handleDeleteColumn.bind(this),this.handleDropdownChanged=this.handleDropdownChanged.bind(this);const{model:n,selectDistinctColumns:s}=this.props;this.state={inputs:s.length>0?[...s]:[""],columns:n.originalColumns}}componentDidUpdate(t,n){const{inputs:s}=this.state,{onChange:o}=this.props;if(n.inputs!==s){const i=s.filter(r=>r!=="");rt(n.inputs.filter(r=>r!==""),i)||o(i)}}handleAddColumnClick(){this.setState(({inputs:t})=>({inputs:[...t,""]}))}handleDeleteColumn(t){this.setState(({inputs:n})=>({inputs:n.length===1&&t===0?[""]:n.filter((s,o)=>t!==o)}))}handleDropdownChanged(t,n){Vh.debug("handleDropdownChanged",t,n);const{value:s}=n.target;this.setState(({inputs:o})=>{const i=[...o];return i[t]=s,{inputs:i}})}renderInputs(){const{columns:t,inputs:n}=this.state;return n.map((s,o)=>{const i=t.filter(({name:r})=>r===s||!n.includes(r)).map(({name:r})=>m("option",{value:r,children:r},r));return y("div",{className:"form-inline px-3 pb-3",children:[y("select",{className:"form-control custom-select col",value:s,onChange:r=>this.handleDropdownChanged(o,r),children:[m("option",{value:"",children:"Select a column"}),i]}),(n.length>1||s!=="")&&m(z,{kind:"ghost",className:"ml-1 px-2",onClick:()=>{this.handleDeleteColumn(o)},icon:m(te,{icon:un,transform:"grow-3"}),tooltip:"Delete column"})]},o)})}render(){const{columns:t,inputs:n}=this.state,s=n.length>=t.length;return y("div",{role:"presentation",className:"select-distinct-builder-container h-100",children:[m("div",{className:"select-distinct-title",children:"Display Unique Values From"}),this.renderInputs(),m("hr",{}),m("div",{className:"pt-1 px-3",children:m(z,{kind:"ghost",className:"btn-add-column",onClick:this.handleAddColumnClick,disabled:s,icon:vs,children:"Add Additional Column"})}),m("div",{className:"select-distinct-builder-footer",children:y("div",{className:"select-distinct-builder-hint",children:["Modifies a table to show unique value from a column, same as"," ",m("span",{className:"inline-code-snippet",children:'selectDistinct("Column")'}),". Filters will be reset and the resulting table will contain only the selected columns above."]})})]})}}ql.defaultProps={selectDistinctColumns:[],onChange:()=>{}};function nr({items:e,onChange:t=()=>{}}){return m(fl,{items:Array.from(e.entries()).map(([n,s])=>({title:nr.getAdvancedSettingsTitleForKey(n),isOn:s,onChange:o=>t(n,o)}))})}nr.getAdvancedSettingsTitleForKey=e=>{switch(e){case ns.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS:return"Control filters clear existing table filters";case ns.LINK_CHANGE_CLEARS_ALL_FILTERS:return"Inbound links clear existing table filters"}};const Ur=ie.module("ConditionalFormattingMenu"),wi=()=>{};function Uh(e){const{column:{type:t}}=e;if(I.isNumberType(t))return e.condition===Ne.IS_NULL||e.condition===Ne.IS_NOT_NULL?"":`${e.value}`;if(I.isCharType(t))return e.condition===it.IS_NULL||e.condition===it.IS_NOT_NULL?"":`${e.value}`;if(I.isStringType(t))return e.condition===mt.IS_NULL||e.condition===mt.IS_NOT_NULL?"":`"${e.value}"`;if(I.isDateType(t))return e.condition===it.IS_NULL||e.condition===it.IS_NOT_NULL?"":`${e.value}`;if(I.isBooleanType(t))return"";throw new Error(`Invalid column type ${t} in getRuleValue`)}function Bh(e){return I.isNumberType(e.column.type)&&e.condition===Ne.IS_BETWEEN?`${e.start} < ${e.column.name} < ${e.end}`:`${e.column.name} ${gu(e.column.type,e.condition)}
13
+ ${Uh(e)}`}function Gh(e){const{rules:t=[],onChange:n=wi,onCreate:s=wi,onSelect:o=wi}=e,i=F.exports.useCallback((c,d,u)=>{c.stopPropagation(),Ur.debug("Rule clicked",d,u),o(u)},[o]),r=F.exports.useCallback((c,d,u)=>{c.stopPropagation(),Ur.debug("Delete button clicked",d,u);const h=[...t];h.splice(u,1),n(h)},[n,t]),l=F.exports.useCallback(c=>{c.stopPropagation()},[]),a=F.exports.useCallback(c=>{if(dt.stopDragging(),c.destination==null)return;const d=c.source.index,u=c.destination.index,h=[...t],g=t[d];h.splice(d,1),h.splice(u,0,g),n(h)},[n,t]);return y("div",{className:"conditional-formatting-rules",children:[m($o,{onDragStart:dt.startDragging,onDragEnd:a,children:m(Oi,{droppableId:"droppable-custom-columns",children:(c,d)=>y("div",{ref:c.innerRef,...c.droppableProps,className:ee("droppable-container",{dragging:d.draggingFromThisWith}),children:[t.length===0&&m("div",{className:"text-muted pl-2",children:"No formats defined"}),t.map((u,h)=>m(sl,{draggableId:`${h}-${u.type}`,index:h,disableInteractiveElementBlocking:!0,children:(g,p)=>m("div",{role:"menuitem",tabIndex:0,onClick:f=>i(f,u,h),className:ee("draggable-container",{dragging:p.isDragging}),ref:g.innerRef,...g.draggableProps,children:m("div",{className:"conditional-formatting-list-item",children:y("div",{className:"formatting-item",children:[m("div",{className:"rule-icon",children:m("span",{className:"rule-icon-bg",style:{backgroundColor:Po(u.config.style),color:_o(u.config.style)},children:u.type===qt.ROWS?"row":"col"})}),m("div",{className:"rule-title",children:Bh(u.config)}),m(z,{kind:"ghost",className:"ml-1 px-2",onClick:f=>r(f,u,h),icon:un,tooltip:"Delete rule"}),y("button",{type:"button",className:"btn btn-link btn-link-icon px-2 btn-drag-handle",onClick:l,...g.dragHandleProps,children:[m(Rt,{children:"Drag to re-order"}),m(te,{icon:Ui})]})]})})})},`${h}-${u.type}`)),c.placeholder]})})}),m("hr",{}),m(z,{kind:"ghost",onClick:s,icon:vs,children:"Add New Rule"})]})}const Wn=ie.module("ConditionEditor"),Wh=()=>{},$h=[Ne.IS_EQUAL,Ne.IS_NOT_EQUAL,Ne.IS_BETWEEN,Ne.GREATER_THAN,Ne.GREATER_THAN_OR_EQUAL,Ne.LESS_THAN,Ne.LESS_THAN_OR_EQUAL,Ne.IS_NULL,Ne.IS_NOT_NULL].map(e=>m("option",{value:e,children:Jd(e)},e)),zh=[mt.IS_EXACTLY,mt.IS_NOT_EXACTLY,mt.CONTAINS,mt.DOES_NOT_CONTAIN,mt.STARTS_WITH,mt.ENDS_WITH,mt.IS_NULL,mt.IS_NOT_NULL].map(e=>m("option",{value:e,children:eu(e)},e)),qh=[it.IS_EXACTLY,it.IS_NOT_EXACTLY,it.IS_BEFORE,it.IS_BEFORE_OR_EQUAL,it.IS_AFTER,it.IS_AFTER_OR_EQUAL,it.IS_NULL,it.IS_NOT_NULL].map(e=>m("option",{value:e,children:tu(e)},e)),Yh=[Us.IS_TRUE,Us.IS_FALSE,Us.IS_NULL,Us.IS_NOT_NULL].map(e=>m("option",{value:e,children:nu(e)},e)),Xh=[Kn.IS_EQUAL,Kn.IS_NOT_EQUAL,Kn.IS_NULL,Kn.IS_NOT_NULL].map(e=>m("option",{value:e,children:su(e)},e));function Kh(e,t,n,s){return e===Ne.IS_NULL||e===Ne.IS_NOT_NULL||e===Ne.IS_BETWEEN&&n!=null&&n!==""&&!Number.isNaN(Number.parseFloat(n))&&s!=null&&s!==""&&!Number.isNaN(Number.parseFloat(s))||e!==Ne.IS_BETWEEN&&t!==void 0&&t!==""&&!Number.isNaN(Number.parseFloat(t))}function Qh(e,t,n,s,o,i,r){switch(e){case Ne.IS_EQUAL:case Ne.IS_NOT_EQUAL:case Ne.GREATER_THAN:case Ne.GREATER_THAN_OR_EQUAL:case Ne.LESS_THAN:case Ne.LESS_THAN_OR_EQUAL:return m("input",{type:"number",className:"form-control",placeholder:"Enter value",value:o!=null?o:"",onChange:t});case Ne.IS_BETWEEN:return y("div",{className:"d-flex flex-row",children:[m("input",{type:"number",className:"form-control d-flex mr-2",placeholder:"Start value",value:i!=null?i:"",onChange:n}),m("input",{type:"number",className:"form-control d-flex",placeholder:"End value",value:r!=null?r:"",onChange:s})]});case Ne.IS_NULL:case Ne.IS_NOT_NULL:return null}}function jh(e,t,n){switch(e){case mt.IS_NULL:case mt.IS_NOT_NULL:return null;default:return m("input",{type:"text",className:"form-control",placeholder:"Enter value",value:n!=null?n:"",onChange:t})}}function Zh(e,t,n){switch(e){case it.IS_NULL:case it.IS_NOT_NULL:return null;default:return m("input",{type:"text",className:"form-control",placeholder:"Enter value",value:n!=null?n:"",onChange:t})}}function Jh(){return null}function em(e,t,n){switch(e){case Kn.IS_NULL:case Kn.IS_NOT_NULL:return null;default:return m("input",{type:"text",className:"form-control",maxLength:1,placeholder:"Enter value",value:n!=null?n:"",onChange:t})}}function Yl(e){const{column:t,config:n,onChange:s=Wh}=e,o=t.type,[i,r]=F.exports.useState(o),[l,a]=F.exports.useState(n.condition),[c,d]=F.exports.useState(n.value),[u,h]=F.exports.useState(n.start),[g,p]=F.exports.useState(n.end);o!==i&&(a(El(o)),d(vl(o)),h(void 0),p(void 0),r(o));const f=F.exports.useMemo(()=>{if(o===void 0)return[];if(I.isNumberType(o))return $h;if(I.isCharType(o))return Xh;if(I.isStringType(o))return zh;if(I.isDateType(o))return qh;if(I.isBooleanType(o))return Yh},[o]),C=F.exports.useCallback(b=>{const{value:v}=b.target;Wn.debug("handleConditionChange",v),a(v)},[]),w=F.exports.useCallback(b=>{const{value:v}=b.target;Wn.debug("handleValueChange",v),d(v)},[]),S=F.exports.useCallback(b=>{const{value:v}=b.target;Wn.debug("handleStartValueChange",v),h(v)},[]),T=F.exports.useCallback(b=>{const{value:v}=b.target;Wn.debug("handleEndValueChange",v),p(v)},[]);F.exports.useEffect(function(){let v=!0;l===void 0?(Wn.debug("Unable to create formatting rule. Condition is not selected."),v=!1):I.isNumberType(t.type)&&!Kh(l,c,u,g)?(Wn.debug("Unable to create formatting rule. Invalid value",c),v=!1):I.isDateType(t.type)&&!fu(l,c)&&(Wn.debug("Unable to create formatting rule. Invalid date condition",c),v=!1),s({condition:l,value:c,start:u,end:g},v)},[s,t.type,l,c,u,g]);const R=F.exports.useMemo(()=>{if(o===void 0)return null;if(I.isNumberType(o))return Qh(l,w,S,T,c,u,g);if(I.isCharType(o))return em(l,w,c);if(I.isStringType(o))return jh(l,w,c);if(I.isDateType(o))return Zh(l,w,c);if(I.isBooleanType(o))return Jh()},[o,l,c,u,g,w,S,T]);return y("div",{className:"condition-editor mb-2",children:[m("select",{value:l,id:"condition-select",className:"custom-select mb-2",onChange:C,children:f}),R]})}const tm=ie.module("StyleEditor"),nm="#fcfcfa",sm="#f0f0ee",om="#1a171a",im=200,rm=()=>{};function Xl(e){var T,R;const{config:t,onChange:n=rm}=e,[s,o]=F.exports.useState(t.type),[i,r]=F.exports.useState((R=(T=t.customConfig)==null?void 0:T.background)!=null?R:nm),[l,a]=F.exports.useState(!1),[c,d]=F.exports.useState(im),u=F.exports.useRef(null),h=F.exports.useCallback(b=>{const{value:v}=b.target;tm.debug("handleBackgroundChange",v),r(v)},[]),g=F.exports.useCallback(()=>{l&&a(!1)},[l]),p=F.exports.useCallback(()=>{l||C(),a(!l)},[l]),f=F.exports.useMemo(()=>[Ft.NO_FORMATTING,Ft.POSITIVE,Ft.NEGATIVE,Ft.WARN,Ft.NEUTRAL,Ft.ACCENT_1,Ft.ACCENT_2,Ft.CUSTOM],[]);function C(){u.current&&d(u.current.getBoundingClientRect().width)}F.exports.useEffect(function(){n({type:s,customConfig:{color:Yo.isDark(i)?sm:om,background:i}})},[n,s,i]);const w=F.exports.useCallback(()=>{const b=[];for(let v=0;v<f.length;v+=1){const D=f[v],A=`option-${v}-${D}`;b.push(y(z,{kind:"inline",className:"style-option-btn",onClick:()=>{o(D),a(!1)},style:{color:_o({type:D}),background:Po({type:D})},children:[D===s&&m(te,{icon:jn,className:"mr-2"}),D!==s&&m("span",{className:"mr-4"}),Mr(D)]},A))}return b},[f,s]),S=F.exports.useCallback(()=>m("div",{className:"style-menu-container",role:"presentation",style:{width:c},children:m("div",{className:"style-options",children:w()})}),[c,w]);return y("div",{className:"style-editor",children:[y("div",{className:"mb-2",ref:u,children:[m("label",{className:"mb-0",children:"Style"}),y(z,{kind:"inline",className:"cs-dropdown",style:{color:_o({type:s}),background:Po({type:s})},onClick:p,children:[Mr(s),m("span",{children:m(te,{icon:lc,className:"cs-caret"})}),m(Ss,{isShown:l,actions:{menuElement:S()},popperOptions:{placement:"bottom-start"},popperClassName:"style-dropdown-menu",onMenuClosed:g,menuStyle:{maxWidth:"100rem"}})]})]}),s===Ft.CUSTOM&&y("div",{className:"mb-2",children:[m("label",{className:"mb-0",children:"Background"}),m("input",{type:"color",value:i,className:"custom-select color-select",onChange:h})]})]})}const _s=ie.module("ColumnFormatEditor"),lm=()=>{};function am(e){const{type:t,name:n}=e[0];return{column:{type:t,name:n},style:yl(),...jo(t)}}function cm(e){var C;const{columns:t,config:n=am(t),onChange:s=lm}=e,[o,i]=F.exports.useState((C=t.find(w=>w.name===n.column.name&&w.type===n.column.type))!=null?C:t[0]),[r,l]=F.exports.useState(Rl(n)),[a,c]=F.exports.useState(!1),[d,u]=F.exports.useState(n.style),h=F.exports.useCallback(w=>{const S=t.find(({name:T})=>T===w);S!==void 0?(i(S),o.type!==S.type&&(l(jo(S.type)),c(!1))):_s.error(`Column ${w} not found.`)},[t,o]),g=F.exports.useCallback((w,S)=>{_s.debug("handleConditionChange",w,S),l(w),c(S)},[]),p=F.exports.useCallback(w=>{_s.debug("handleStyleChange",w),u(w)},[]);F.exports.useEffect(function(){let S=a;o===void 0&&(_s.debug("Column is not selected, invalidating update."),S=!1),(d===void 0||d.type===Ft.NO_FORMATTING)&&(_s.debug("Style is not selected, invalidating update."),S=!1);const{type:T,name:R}=o;s({column:{type:T,name:R},style:d,...r},S)},[s,o,d,r,a]);const f=t.map(({name:w})=>({title:w,value:w}));return y("div",{className:"conditional-rule-editor form",children:[y("div",{className:"mb-2",children:[m("label",{className:"mb-0",children:"Format Cell If"}),m(ul,{defaultValue:o==null?void 0:o.name,options:f,inputPlaceholder:"Select a column",spellCheck:!1,onChange:h,searchPlaceholder:"Filter columns"})]}),o!==void 0&&y(Oe,{children:[m(Yl,{column:o,config:r,onChange:g}),m(Xl,{config:d,onChange:p})]})]})}const Hs=ie.module("RowFormatEditor"),dm=()=>{};function um(e){const{type:t,name:n}=e[0];return{column:{type:t,name:n},style:yl(),...jo(t)}}function hm(e){var C;const{columns:t,config:n=um(t),onChange:s=dm}=e,[o,i]=F.exports.useState((C=t.find(w=>w.name===n.column.name&&w.type===n.column.type))!=null?C:t[0]),[r,l]=F.exports.useState(Rl(n)),[a,c]=F.exports.useState(!1),[d,u]=F.exports.useState(n.style),h=F.exports.useCallback(w=>{const S=t.find(({name:T})=>T===w);S!==void 0?(i(S),o.type!==S.type&&(l(jo(S.type)),c(!1))):Hs.error(`Column ${w} not found.`)},[t,o]),g=F.exports.useCallback((w,S)=>{Hs.debug("handleConditionChange",w,S),l(w),c(S)},[]),p=F.exports.useCallback(w=>{Hs.debug("handleStyleChange",w),u(w)},[]);F.exports.useEffect(function(){if(o===void 0){Hs.debug("Column is not selected, skip update.");return}if(d===void 0){Hs.debug("Style is not selected, skip update.");return}const{type:S,name:T}=o;s({column:{type:S,name:T},style:d,...r},a)},[s,o,d,r,a]);const f=t.map(({name:w})=>({title:w,value:w}));return y("div",{className:"conditional-rule-editor form",children:[y("div",{className:"mb-2",children:[m("label",{className:"mb-0",children:"Format Row If"}),m(ul,{defaultValue:o==null?void 0:o.name,options:f,inputPlaceholder:"Select a column",spellCheck:!1,onChange:h,searchPlaceholder:"Filter columns"})]}),o!==void 0&&y(Oe,{children:[m(Yl,{column:o,config:r,onChange:g}),m(Xl,{config:d,onChange:p})]})]})}const Si=ie.module("ConditionalFormatEditor"),bi=()=>{};function mm(e){switch(e){case qt.CONDITIONAL:return m(oh,{});case qt.ROWS:return m(ih,{})}}function gm(e){switch(e){case qt.CONDITIONAL:return"Conditional";case qt.ROWS:return"Rows"}}const Br=[qt.CONDITIONAL,qt.ROWS];function pm(e){var w;const{columns:t,onSave:n=bi,onUpdate:s=bi,onCancel:o=bi,rule:i}=e,r=t.filter(Cu),[l,a]=F.exports.useState((w=i==null?void 0:i.type)!=null?w:Br[0]),[c,d]=F.exports.useState(i),[u,h]=F.exports.useState(!1),g=F.exports.useCallback(()=>{o()},[o]),p=F.exports.useCallback(()=>{if(c===void 0){Si.error("Rule is not defined.");return}n(c)},[n,c]),f=F.exports.useCallback(S=>{Si.debug("handleFormatterChange",S),a(S)},[]),C=F.exports.useCallback((S,T)=>{Si.debug("handleRuleChange",S,T,l);const R={type:l,config:S};d(R),h(T),s(T?R:void 0)},[s,l]);return y("div",{className:"conditional-format-editor form",children:[y("div",{className:"mb-2",children:[m("label",{className:"mb-0",htmlFor:"formatter-select",children:"Select Formatter"}),m("div",{className:"formatter-list",children:Br.map((S,T)=>m("div",{className:"formatter-type",children:y("button",{type:"button",className:ee("btn","btn-icon","btn-formatter-type",{active:S===l}),"data-index":T,onClick:()=>f(S),children:[mm(S),gm(S)]})},S))})]}),l===qt.CONDITIONAL&&m(cm,{columns:r,config:c==null?void 0:c.config,onChange:C}),l===qt.ROWS&&m(hm,{columns:r,config:c==null?void 0:c.config,onChange:C}),m("hr",{}),y("div",{className:"d-flex justify-content-end my-3",children:[m(z,{kind:"secondary",onClick:g,className:"mr-2",children:"Cancel"}),m(z,{kind:"primary",onClick:p,disabled:c===void 0||!u,children:"Done"})]})]})}function fm({type:e}){switch(e){case E.VariableType.TABLE:case E.VariableType.TABLEMAP:case E.VariableType.TREETABLE:case E.VariableType.HIERARCHICALTABLE:return m(te,{icon:Vi});case E.VariableType.FIGURE:return m(te,{icon:hl});case E.VariableType.PANDAS:return m(te,{icon:cc});default:return m(te,{icon:ac})}}class Kl extends F.exports.Component{constructor(t){super(t),this.container=null}componentDidMount(){this.colorize()}colorize(){const{children:t}=this.props;this.container&&t!=null&&an.colorizeElement(this.container,{theme:"dh-dark"})}render(){const{children:t,language:n}=this.props;return m("div",{children:m("div",{"data-lang":n,ref:s=>{this.container=s},style:{pointerEvents:"none"},children:t})})}}class Cm{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}class Es{static hasComment(t){return t.comment!==void 0}static hasPattern(t){return t.pattern!==void 0}static hasOp(t){return t.op!==void 0}static parseArguments(t){return t==null||!(typeof t=="string"||t instanceof String)?[]:ka.parse(t).filter(n=>!this.hasComment(n)).map(n=>this.hasPattern(n)?n.pattern:this.hasOp(n)?n.op:`${n}`)}static formatTimestamp(t){if(t==null||!(t instanceof Date))return null;const n=`${t.getHours()}`.padStart(2,"0"),s=`${t.getMinutes()}`.padStart(2,"0"),o=`${t.getSeconds()}`.padStart(2,"0"),i=`${t.getMilliseconds()}`.padStart(3,"0");return`${n}:${s}:${o}.${i}`}static isTableType(t){return t===E.VariableType.TABLE||t===E.VariableType.TREETABLE||t===E.VariableType.HIERARCHICALTABLE}static isWidgetType(t){return t===E.VariableType.FIGURE||t===E.VariableType.OTHERWIDGET||t===E.VariableType.PANDAS}static isOpenableType(t){return Es.isTableType(t)||Es.isWidgetType(t)}static isFigureType(t){return t===E.VariableType.FIGURE}static isPandas(t){return t===E.VariableType.PANDAS}}function Ql({children:e}){return y("div",{className:"console-history-item-result",children:[m("div",{className:"console-history-gutter",children:"-"}),m("div",{className:"console-history-content",children:e})]})}Ql.propTypes={children:B.exports.node.isRequired};class jl extends F.exports.Component{constructor(t){super(t),this.updateElapsed=this.updateElapsed.bind(this),this.startTime=Date.now(),this.state={elapsed:0}}componentDidMount(){this.timer=setInterval(this.updateElapsed,1e3)}componentWillUnmount(){this.timer&&clearInterval(this.timer),this.timer=void 0}updateElapsed(){this.setState({elapsed:Math.round((Date.now()-this.startTime)/1e3)})}render(){const{disabled:t,onCancelClick:n}=this.props,{elapsed:s}=this.state;return m("div",{className:ee("console-history-result-in-progress",{disabled:t}),children:y("span",{className:"badge",children:[m(dn,{}),"\xA0Running... ",Bi.formatElapsedTime(s),"\xA0",m(z,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:qs,tooltip:"Cancel",onClick:n,disabled:t})]})})}}jl.defaultProps={disabled:!1};const Ai=class extends F.exports.PureComponent{constructor(e){super(e),this.handleKeyPress=this.handleKeyPress.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleToggleError=this.handleToggleError.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.mouseX=null,this.mouseY=null,this.isClicking=!1,this.state={isExpanded:!1,isTriggerHovered:!1}}handleKeyPress(e){switch(e.key){case"Enter":case" ":this.handleToggleError(),e.stopPropagation(),e.preventDefault();break}}handleMouseDown(e){this.mouseX=e.clientX,this.mouseY=e.clientY,this.isClicking=!0}handleMouseMove(e){this.mouseX!=null&&this.mouseY!=null?(Math.abs(e.clientX-this.mouseX)>=Ai.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=Ai.mouseDragThreshold)&&(this.isClicking=!1):this.isClicking&&(this.isClicking=!1)}handleMouseUp(e){this.isClicking&&!e.shiftKey&&!e.metaKey&&!e.altKey&&this.handleToggleError(),this.mouseX=null,this.mouseY=null,this.isClicking=!1}handleToggleError(){this.setState(e=>({isExpanded:!e.isExpanded}))}handleMouseEnter(){this.setState({isTriggerHovered:!0})}handleMouseLeave(){this.setState({isTriggerHovered:!1})}render(){const{isExpanded:e,isTriggerHovered:t}=this.state,{message:n}=this.props;M(n);const s=n.indexOf(`
14
+ `),o=s>-1;let i=n;o&&(i=n.slice(0,s));const r=n.slice(s),l=t?"error-btn-link error-btn-link--active":"error-btn-link";return y("div",{className:ee("error-message",{expanded:e}),children:[o&&y(Oe,{children:[m("div",{className:"error-gutter",children:m("button",{type:"button",onClick:this.handleToggleError,className:l,tabIndex:-1,children:m(te,{icon:e?Xn:ll,transform:"left-3"})})}),y("div",{className:"error-content",children:[m("div",{className:"console-error-text-trigger",role:"button",tabIndex:0,onKeyPress:this.handleKeyPress,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,onMouseUp:this.handleMouseUp,children:i}),e?r:""]})]}),!o&&m("div",{className:"error-content",children:m("div",{className:"console-error-text",children:i})})]},"error")}};let sr=Ai;sr.defaultProps={message:""};sr.mouseDragThreshold=5;const Gr=ie.module("ConsoleHistoryItem");class Zl extends F.exports.PureComponent{constructor(t){super(t),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(t){Gr.debug("handleObjectClick",t);const{openObject:n}=this.props;n(t)}handleCancelClick(){const{item:t}=this.props;t!=null&&t.cancelResult&&(Gr.debug(`Cancelling command: ${t.command}`),t.cancelResult())}render(){var d;const{disabled:t,item:n,language:s}=this.props,{disabledObjects:o,result:i}=n;let r=null;n.command!=null&&n.command!==""&&(r=y("div",{className:"console-history-item-command",children:[m("div",{className:"console-history-gutter",children:">"}),m("div",{className:"console-history-content",children:m(Kl,{language:s,children:n.command})})]}));const l=[];let a=!1;if(i){const{error:u,message:h,changes:g}=i;if(g){const{created:p,updated:f}=g;[...p,...f].forEach(C=>{a=!0;const{title:w}=C,S=`${w}`,T=t===void 0||t||(o!=null?o:[]).indexOf(S)>=0,R=m(z,{kind:"primary",onClick:()=>this.handleObjectClick(C),className:"btn-console-object",disabled:T,icon:m(fm,{type:C.type}),children:w},S);l.push(R)})}if(u!=null&&n.command==null){let p=`${(d=u.message)!=null?d:u}`;p||(p=u);const f=m(sr,{message:p},"result-error");l.push(f)}if(h!==void 0&&h!==""){const p=m("div",{className:"log-message",children:h},"log-message");l.push(p)}}else{a=!0;const u=m(jl,{onCancelClick:this.handleCancelClick,disabled:t},"in_progress");l.push(u)}let c=null;return l.length>0&&(c=m(Ql,{children:l})),y("div",{className:ee("console-command-result",{"console-result-buttons":a}),children:[r,c]})}}Zl.defaultProps={disabled:!1};const Jl=class extends F.exports.Component{static itemKey(e,t){return`${e}.${t.command}.${t.result&&t.result.message}.${t.result&&t.result.error}`}render(){const{disabled:e,items:t,language:n,openObject:s}=this.props,o=[];for(let i=0;i<t.length;i+=1){const r=t[i],l=m(Zl,{disabled:e,item:r,openObject:s,language:n},Jl.itemKey(i,r));o.push(l)}return m("div",{className:"container-fluid console-history",children:o})}};let ea=Jl;ea.defaultProps={disabled:!1};const wm={name:"Console",CLEAR:Ve.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[le.CTRL,he.L],macShortcut:[le.CTRL,he.C]}),FOCUS_HISTORY:Ve.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[le.CTRL,he.H],macShortcut:[le.CTRL,le.OPTION,he.H]})},Sm={name:"Command History",FOCUS_HISTORY:Ve.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[le.CTRL,he.H],macShortcut:[le.CTRL,le.OPTION,he.H]}),SEND_TO_CONSOLE:Ve.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[he.ENTER],macShortcut:[he.ENTER]}),SEND_TO_NOTEBOOK:Ve.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[le.CTRL,he.ENTER],macShortcut:[le.CMD,he.ENTER]}),RUN:Ve.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[le.ALT,he.R],macShortcut:[le.OPTION,he.R]})},bm={name:"Notebook",RUN:Ve.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[le.ALT,he.R],macShortcut:[le.OPTION,he.R]}),RUN_SELECTED:Ve.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[le.ALT,le.SHIFT,he.R],macShortcut:[le.OPTION,le.SHIFT,he.R]}),FIND:Ve.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[le.CTRL,he.F],macShortcut:[le.CMD,he.F],isEditable:!1}),MINIMAP:Ve.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[le.ALT,he.M],macShortcut:[le.OPTION,he.M]}),WORDWRAP:Ve.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[le.ALT,he.Z],macShortcut:[le.OPTION,he.Z]})},es={CONSOLE:wm,COMMAND_HISTORY:Sm,NOTEBOOK:bm},je=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),Tm="#2d2a2e",Em="#fcfcfa",vm="#fcd65b",Rm="#b2b1b2",ym="#9edc6f",Fm="#76d9e4",Dm="#f95d84",Im="#aa9af4",Nm="#f95d84",Am="#fcfcfa",Mm="#7c7b7c",re={"error-foreground":"#f95d84",background:Tm,foreground:Em,"line-height":"19px",string:vm,"string-delim":"#929192",delimiter:Rm,predefined:ym,keyword:Fm,storage:Dm,number:Im,operator:Nm,identifier:Am,"namespace-identifier":"#f95d84","identifier-js":"#fcd65b",comment:Mm,"input-option-active-border":"#929192","focus-border":"rgba(72, 120, 234, 0.85)","input-background":"#555356","input-foreground":"#f0f0ee","input-border":"#929192","editor-line-number-foreground":"#929192","editor-selection-background":"#676368","editor-line-highlight-bg":"#373438","context-menu-background":"#555356","context-menu-foreground":"#f0f0ee","menu-selection-background":"#4878ea","log-date":"#929192","log-error":"#f95d84","log-info":"#76d9e4","log-stdout":"#f0f0ee","log-warn":"#fcd65b","log-debug":"#aa9af4","log-trace":"#9edc6f","editor-find-match-background":"#3c5595","editor-find-match-highlight-background":"#343e5d","editor-widget-background":"#403e41","input-option-active-background":"#4878ea","input-option-active-foreground":"#f0f0ee","editor-suggest-widget-background":"#403e41","editor-suggest-widget-border":"#5b5a5c","editor-suggest-widget-foreground":"#f0f0ee","editor-suggest-widget-selected-background":"#41475a","editor-suggest-widget-highlightForeground":"#4878ea","list-hover-background":"#555356"},Om="python",xm={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},km={keywords:["and","del","from","not","while","as","elif","global","or","with","assert","else","if","pass","yield","break","except","import","print","exec","in","raise","continue","finally","is","return","for","try",":","=","isinstance","__debug__"],storage:["class","def","async","lambda"],operators:["+","-","*","**","/","//","%","<<",">>","&","|","^","~","<",">","<=",">=","==","!=","<>","+=","-=","*=","/","//=","%=","&=","|=","^=",">>=","<<=","**="],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[=><!~&|+\-*/^%]+/,delimiters:/[;=.@:,`]/,escapes:/\\(?:[abfnrtv\\"'\n\r]|x[0-9A-Fa-f]{2}|[0-7]{3}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}|N\{\w+\})/,rawpre:/(?:[rR]|ur|Ur|uR|UR|br|Br|bR|BR)/,strpre:/(?:[buBU])/,tokenizer:{root:[[/@strpre?("""|''')/,{token:"string.delim",bracket:"@open",next:"@mstring.$1"}],[/@strpre?"([^"\\]|\\.)*$/,"string.invalid"],[/@strpre?'([^'\\]|\\.)*$/,"string.invalid"],[/@strpre?(["])/,{token:"string.delim",bracket:"@open",next:"@sstring.$1",nextEmbedded:"deephavenDb"}],[/@strpre?(["'])/,{token:"string.delim",bracket:"@open",next:"@string.$1"}],[/@rawpre("""|''')/,{token:"string.delim",bracket:"@open",next:"@mrawstring.$1"}],[/@rawpre"([^"\\]|\\.)*$/,"string.invalid"],[/@rawpre'([^'\\]|\\.)*$/,"string.invalid"],[/@rawpre(["'])/,{token:"string.delim",bracket:"@open",next:"@rawstring.$1"}],[/__[\w$]*/,"predefined"],[/[a-z_$][\w$]*/,{cases:{"@keywords":"keyword","@storage":"storage","@default":"identifier"}}],[/[A-Z][\w]*/,{cases:{"~[A-Z0-9_]+":"constructor.identifier","@default":"namespace.identifier"}}],{include:"@whitespace"},[/[{}()[\]]/,"@brackets"],[/@symbols/,{cases:{"@keywords":"keyword","@operators":"operator","@default":""}}],[/\d*\.\d+([eE][-+]?\d+)?/,"number.float"],[/0[xX][0-9a-fA-F]+[lL]?/,"number.hex"],[/0[bB][0-1]+[lL]?/,"number.binary"],[/(0[oO][0-7]+|0[0-7]+)[lL]?/,"number.octal"],[/(0|[1-9]\d*)[lL]?/,"number"],[":",{token:"keyword",bracket:"@open"}],[/@delimiters/,{cases:{"@keywords":"keyword","@default":"delimiter"}}]],comment:[[/[^/*]+/,"comment"],[/\/\*/,"comment","@push"],["\\*/","comment","@pop"],[/[/*]/,"comment"]],mstring:[{include:"@strcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],sstring:[{include:"@strcontent"},[/["]/,{token:"string.delim",bracket:"@close",next:"@pop",nextEmbedded:"@pop"}],[/./,"string.invalid"]],string:[{include:"@strcontent"},[/[']/,{token:"string.delim",bracket:"@close",next:"@pop"}],[/./,"string.invalid"]],strcontent:[[/[^\\"']+/,"string"],[/\\$/,"string.escape"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"]],mrawstring:[{include:"@rawstrcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],rawstring:[{include:"@rawstrcontent"},[/["']/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/./,"string.invalid"]],rawstrcontent:[[/[^\\"']+/,"string"],[/\\["']/,"string"],[/\\u[0-9A-Fa-f]{4}/,"string.escape"],[/\\/,"string"]],whitespace:[[/\s+/,"white"],[/(^#.*$)/,"comment"],[/'''/,"string","@endDocString"],[/"""/,"string","@endDblDocString"]],endDocString:[[/[^']+/,"string"],[/\\'/,"string"],[/'''/,"string","@popall"],[/'/,"string"]],endDblDocString:[[/[^"]+/,"string"],[/\\"/,"string"],[/"""/,"string","@popall"],[/"/,"string"]]}},Lm={id:Om,conf:xm,language:km},Pm="groovy",_m={comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},Hm={keywords:["and","del","from","not","while","as","elif","global","or","with","assert","else","if","pass","yield","break","except","import","print","println","class","exec","in","raise","continue","finally","is","return","def","for","lambda","try",":","=","isinstance","__debug__"],operators:["+","-","*","**","/","//","%","<<",">>","&","|","^","~","<",">","<=",">=","==","!=","<>","+=","-=","*=","/","//=","%=","&=","|=","^=",">>=","<<=","**="],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[=><!~&|+\-*/^%]+/,delimiters:/[;=.@:,`]/,escapes:/\\(?:[abfnrtv\\"'\n\r]|x[0-9A-Fa-f]{2}|[0-7]{3}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}|N\{\w+\})/,rawpre:/(?:[rR]|ur|Ur|uR|UR|br|Br|bR|BR)/,strpre:/(?:[buBU])/,tokenizer:{root:[[/@strpre?("""|''')/,{token:"string.delim",bracket:"@open",next:"@mstring.$1"}],[/@strpre?"([^"\\]|\\.)*$/,"string.invalid"],[/@strpre?'([^'\\]|\\.)*$/,"string.invalid"],[/@strpre?(["])/,{token:"string.delim",bracket:"@open",next:"@sstring.$1",nextEmbedded:"deephavenDb"}],[/@strpre?(["'])/,{token:"string.delim",bracket:"@open",next:"@string.$1"}],[/@rawpre("""|''')/,{token:"string.delim",bracket:"@open",next:"@mrawstring.$1"}],[/@rawpre"([^"\\]|\\.)*$/,"string.invalid"],[/@rawpre'([^'\\]|\\.)*$/,"string.invalid"],[/@rawpre(["'])/,{token:"string.delim",bracket:"@open",next:"@rawstring.$1"}],[/__[\w$]*/,"predefined"],[/[a-z_$][\w$]*/,{cases:{"@keywords":"keyword","@default":"identifier"}}],[/[A-Z][\w]*/,{cases:{"~[A-Z0-9_]+":"constructor.identifier","@default":"namespace.identifier"}}],{include:"@whitespace"},[/[{}()[\]]/,"@brackets"],[/@symbols/,{cases:{"@keywords":"keyword","@operators":"operator","@default":""}}],[/\d*\.\d+([eE][-+]?\d+)?/,"number.float"],[/0[xX][0-9a-fA-F]+[lL]?/,"number.hex"],[/0[bB][0-1]+[lL]?/,"number.binary"],[/(0[oO][0-7]+|0[0-7]+)[lL]?/,"number.octal"],[/(0|[1-9]\d*)[lL]?/,"number"],[":",{token:"keyword",bracket:"@open"}],[/@delimiters/,{cases:{"@keywords":"keyword","@default":"delimiter"}}]],mstring:[{include:"@strcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],sstring:[{include:"@strcontent"},[/["]/,{token:"string.delim",bracket:"@close",next:"@pop",nextEmbedded:"@pop"}],[/./,"string.invalid"]],string:[{include:"@strcontent"},[/[']/,{token:"string.delim",bracket:"@close",next:"@pop"}],[/./,"string.invalid"]],strcontent:[[/[^\\"']+/,"string"],[/\\$/,"string.escape"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"]],mrawstring:[{include:"@rawstrcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],rawstring:[{include:"@rawstrcontent"},[/["']/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/./,"string.invalid"]],rawstrcontent:[[/[^\\"']+/,"string"],[/\\["']/,"string"],[/\\u[0-9A-Fa-f]{4}/,"string.escape"],[/\\/,"string"]],whitespace:[[/[ \t\r\n]+/,""],[/\/\*\*(?!\/)/,"comment.doc","@doccomment"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]],comment:[[/[^/*]+/,"comment"],[/\*\//,"comment","@pop"],[/[/*]/,"comment"]],doccomment:[[/[^/*]+/,"comment.doc"],[/\*\//,"comment.doc","@pop"],[/[/*]/,"comment.doc"]]}},Vm={id:Pm,conf:_m,language:Hm},Um="scala",Bm={wordPattern:/(unary_[@~!#%^&*()\-=+\\|:<>/?]+)|([a-zA-Z_$][\w$]*?_=)|(`[^`]+`)|([a-zA-Z_$][\w$]*)/g,comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],folding:{markers:{start:/^\s*\/\/\s*(?:(?:#?region\b)|(?:<editor-fold\b))/,end:/^\s*\/\/\s*(?:(?:#?endregion\b)|(?:<\/editor-fold>))/}}},Gm={keywords:["asInstanceOf","catch","class","classOf","def","do","else","extends","finally","for","foreach","forSome","if","import","isInstanceOf","macro","match","new","object","package","return","throw","trait","try","type","until","val","var","while","with","yield","given","enum","then"],softKeywords:["as","export","extension","end","derives","on"],constants:["true","false","null","this","super"],modifiers:["abstract","final","implicit","lazy","override","private","protected","sealed"],softModifiers:["inline","opaque","open","transparent","using"],name:/(?:[a-z_$][\w$]*|`[^`]+`)/,type:/(?:[A-Z][\w$]*)/,symbols:/[=><!~?:&|+\-*/^\\%@#]+/,digits:/\d+(_+\d+)*/,hexdigits:/[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,escapes:/\\(?:[btnfr\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,fstring_conv:/[bBhHsScCdoxXeEfgGaAt]|[Tn](?:[HIklMSLNpzZsQ]|[BbhAaCYyjmde]|[RTrDFC])/,tokenizer:{root:[[/\braw"""/,{token:"string.quote",bracket:"@open",next:"@rawstringt"}],[/\braw"/,{token:"string.quote",bracket:"@open",next:"@rawstring"}],[/\bs"""/,{token:"string.quote",bracket:"@open",next:"@sstringt"}],[/\bs"/,{token:"string.quote",bracket:"@open",next:"@sstring"}],[/\bf""""/,{token:"string.quote",bracket:"@open",next:"@fstringt"}],[/\bf"/,{token:"string.quote",bracket:"@open",next:"@fstring"}],[/"""/,{token:"string.quote",bracket:"@open",next:"@stringt"}],[/"/,{token:"string.quote",bracket:"@open",next:"@string"}],[/(@digits)[eE]([-+]?(@digits))?[fFdD]?/,"number.float","@allowMethod"],[/(@digits)\.(@digits)([eE][-+]?(@digits))?[fFdD]?/,"number.float","@allowMethod"],[/0[xX](@hexdigits)[Ll]?/,"number.hex","@allowMethod"],[/(@digits)[fFdD]/,"number.float","@allowMethod"],[/(@digits)[lL]?/,"number","@allowMethod"],[/\b_\*/,"key"],[/\b(_)\b/,"keyword","@allowMethod"],[/\bimport\b/,"keyword","@import"],[/\b(case)([ \t]+)(class)\b/,["keyword.modifier","white","keyword"]],[/\bcase\b/,"keyword","@case"],[/\bva[lr]\b/,"keyword","@vardef"],[/\b(def)([ \t]+)((?:unary_)?@symbols|@name(?:_=)|@name)/,["keyword","white","identifier"]],[/@name(?=[ \t]*:(?!:))/,"variable"],[/(\.)(@name|@symbols)/,[{token:"operator"},{token:"@rematch",next:"@allowMethod"}]],[/([{(])(\s*)(@name(?=\s*=>))/,["@brackets","white","variable"]],[/@name/,{cases:{"@keywords":"keyword","@softKeywords":"keyword","@modifiers":"keyword.modifier","@softModifiers":"keyword.modifier","@constants":{token:"constant",next:"@allowMethod"},"@default":{token:"identifier",next:"@allowMethod"}}}],[/@type/,"type","@allowMethod"],{include:"@whitespace"},[/@[a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*)*/,"annotation"],[/[{(]/,"@brackets"],[/[})]/,"@brackets","@allowMethod"],[/\[/,"operator.square"],[/](?!\s*(?:va[rl]|def|type)\b)/,"operator.square","@allowMethod"],[/]/,"operator.square"],[/([=-]>|<-|>:|<:|:>|<%)(?=[\s\w()[\]{},."'`])/,"keyword"],[/@symbols/,"operator"],[/[;,.]/,"delimiter"],[/'[a-zA-Z$][\w$]*(?!')/,"attribute.name"],[/'[^\\']'/,"string","@allowMethod"],[/(')(@escapes)(')/,[{token:"string"},{token:"string.escape"},{token:"string",next:"@allowMethod"}]],[/'/,"string.invalid"]],import:[[/;/,"delimiter","@pop"],[/^|$/,"","@pop"],[/[ \t]+/,"white"],[/[\n\r]+/,"white","@pop"],[/\/\*/,"comment","@comment"],[/@name|@type/,"type"],[/[(){}]/,"@brackets"],[/[[\]]/,"operator.square"],[/[.,]/,"delimiter"]],allowMethod:[[/^|$/,"","@pop"],[/[ \t]+/,"white"],[/[\n\r]+/,"white","@pop"],[/\/\*/,"comment","@comment"],[/(?==>[\s\w([{])/,"keyword","@pop"],[/(@name|@symbols)(?=[ \t]*[[({"'`]|[ \t]+(?:[+-]?\.?\d|\w))/,{cases:{"@keywords":{token:"keyword",next:"@pop"},"->|<-|>:|<:|<%":{token:"keyword",next:"@pop"},"@default":{token:"@rematch",next:"@pop"}}}],["","","@pop"]],comment:[[/[^/*]+/,"comment"],[/\/\*/,"comment","@push"],[/\*\//,"comment","@pop"],[/[/*]/,"comment"]],case:[[/\b_\*/,"key"],[/\b(_|true|false|null|this|super)\b/,"keyword","@allowMethod"],[/\bif\b|=>/,"keyword","@pop"],[/`[^`]+`/,"identifier","@allowMethod"],[/@name/,"variable","@allowMethod"],[/:::?|\||@(?![a-z_$])/,"keyword"],{include:"@root"}],vardef:[[/\b_\*/,"key"],[/\b(_|true|false|null|this|super)\b/,"keyword"],[/@name/,"variable"],[/:::?|\||@(?![a-z_$])/,"keyword"],[/=|:(?!:)/,"operator","@pop"],[/$/,"white","@pop"],{include:"@root"}],string:[[/[^\\"\n\r]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}]],stringt:[[/[^\\"\n\r]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/"/,"string"]],fstring:[[/@escapes/,"string.escape"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/%%/,"string"],[/(%)([-#+ 0,(])(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","keyword.modifier","number","metatag"]],[/(%)(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","number","metatag"]],[/(%)([-#+ 0,(])(@fstring_conv)/,["metatag","keyword.modifier","metatag"]],[/(%)(@fstring_conv)/,["metatag","metatag"]],[/./,"string"]],fstringt:[[/@escapes/,"string.escape"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/%%/,"string"],[/(%)([-#+ 0,(])(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","keyword.modifier","number","metatag"]],[/(%)(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","number","metatag"]],[/(%)([-#+ 0,(])(@fstring_conv)/,["metatag","keyword.modifier","metatag"]],[/(%)(@fstring_conv)/,["metatag","metatag"]],[/./,"string"]],sstring:[[/@escapes/,"string.escape"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/./,"string"]],sstringt:[[/@escapes/,"string.escape"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/./,"string"]],interp:[[/{/,"operator","@push"],[/}/,"operator","@pop"],{include:"@root"}],rawstring:[[/[^"]/,"string"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}]],rawstringt:[[/[^"]/,"string"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/"/,"string"]],whitespace:[[/[ \t\r\n]+/,"white"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]]}},Wm={id:Um,conf:Bm,language:Gm},$m="deephavenDb",zm={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},qm={tokenPostfix:".js",keywords:["boolean","break","byte","case","catch","char","class","const","continue","debugger","default","delete","do","double","else","enum","export","extends","false","final","finally","float","for","function","goto","if","implements","import","in","instanceof","int","interface","long","native","new","null","package","private","protected","public","return","short","static","super","switch","synchronized","this","throw","throws","transient","true","try","typeof","var","void","volatile","while","with"],builtins:["define","require","window","document","undefined"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.bracket"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[~!@#%\^&*-+=|\\:`<>.?\/]+/,escapes:/\\(?:[btnfr\\"']|[0-7][0-7]?|[0-3][0-7]{2})/,exponent:/[eE][\-+]?[0-9]+/,regexpctl:/[(){}\[\]\$\^|\-*+?\.]/,regexpesc:/\\(?:[bBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/,tokenizer:{root:[[/([a-zA-Z_\$][\w\$]*)(\s*)(:?)/,{cases:{"$1@keywords":["keyword","white","delimiter"],$3:["key.identifier","white","delimiter"],"$1@builtins":["predefined.identifier","white","delimiter"],"@default":["identifier","white","delimiter"]}}],{include:"@whitespace"},[/\/(?=([^\\\/]|\\.)+\/)/,{token:"regexp.slash",bracket:"@open",next:"@regexp"}],[/[{}()\[\]]/,"@brackets"],[/[;,.]/,"delimiter"],[/@symbols/,{cases:{"@operators":"operator","@default":""}}],[/\d+\.\d*(@exponent)?/,"number.float"],[/\.\d+(@exponent)?/,"number.float"],[/\d+@exponent/,"number.float"],[/0[xX][\da-fA-F]+/,"number.hex"],[/0[0-7]+/,"number.octal"],[/\d+/,"number"],[/"([^"\\]|\\.)*$/,"string.invalid"],[/'([^'\\]|\\.)*$/,"string.invalid"],[/"/,"string",'@string."'],[/'/,"string","@string.'"]],whitespace:[[/[ \t\r\n]+/,"white"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]],comment:[[/[^\/*]+/,"comment"],[/\/\*/,"comment.invalid"],["\\*/","comment","@pop"],[/[\/*]/,"comment"]],string:[[/[^\\"']+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/["']/,{cases:{"$#==$S2":{token:"string",next:"@pop"},"@default":"string"}}]],regexp:[[/(\{)(\d+(?:,\d*)?)(\})/,["@brackets.regexp.escape.control","regexp.escape.control","@brackets.regexp.escape.control"]],[/(\[)(\^?)(?=(?:[^\]\\\/]|\\.)+)/,[{token:"@brackets.regexp.escape.control"},{token:"regexp.escape.control",next:"@regexrange"}]],[/(\()(\?:|\?=|\?!)/,["@brackets.regexp.escape.control","regexp.escape.control"]],[/[()]/,"@brackets.regexp.escape.control"],[/@regexpctl/,"regexp.escape.control"],[/[^\\\/]/,"regexp"],[/@regexpesc/,"regexp.escape"],[/\\\./,"regexp.invalid"],["/",{token:"regexp.slash",bracket:"@close"},"@pop"]],regexrange:[[/-/,"regexp.escape.control"],[/\^/,"regexp.invalid"],[/@regexpesc/,"regexp.escape"],[/[^\]]/,"regexp"],[/\]/,"@brackets.regexp.escape.control","@pop"]]}},Ym={id:$m,conf:zm,language:qm},Xm="log",Km={},Qm={tokenizer:{root:[[/ FATAL[\s\S]*/,{token:"error",next:"@error"}],[/ ERROR[\s\S]*/,{token:"error",next:"@error"}],[/ STDERR[\s\S]*/,{token:"error",next:"@error"}],[/ STDOUT.*/,{token:"stdout",next:"@stdout"}],[/ INFO[\s\S]*/,{token:"info",next:"@info"}],[/ WARN.*/,{token:"warn",next:"@warn"}],[/ TRACE[\s\S]*/,{token:"trace",next:"@trace"}],[/ DEBUG[.\s\S]*/,{token:"debug",next:"@debug"}],[/^\d{2}:\d{2}:\d{2}.\d{3}/,"date"]],error:[{include:"@body"}],info:[{include:"@body"}],warn:[{include:"@body"}],stdout:[{include:"@body"}],trace:[{include:"@body"}],debug:[{include:"@body"}],body:[[/^\d{2}:\d{2}:\d{2}.\d{3}/,{token:"date",next:"@pop"}],[/[\s\S]*/,{token:"$S0"}]]}},jm={id:Xm,conf:Km,language:Qm},Ht=ie.module("MonacoUtils");class He{static init({getWorker:t}={}){Ht.debug("Initializing Monaco..."),t!==void 0&&He.registerGetWorker(t);const{registerLanguages:n,removeHashtag:s}=He,o=[{token:"",foreground:s(re.foreground)},{token:"string",foreground:s(re.string)},{token:"string.delim",foreground:s(re["string-delim"])},{token:"keyword",foreground:s(re.keyword)},{token:"identifier.js",foreground:s(re["identifier-js"])},{token:"delimiter",foreground:s(re.delimiter)},{token:"comment",foreground:s(re.comment)},{token:"number",foreground:s(re.number)},{token:"storage",foreground:s(re.storage)},{token:"identifier",foreground:s(re.identifier)},{token:"namespace.identifier",foreground:s(re["namespace-identifier"])},{token:"operator",foreground:s(re.operator)},{token:"predefined",foreground:s(re.predefined)},{token:"error.log",foreground:re["log-error"].substring(1)},{token:"warn.log",foreground:s(re["log-warn"])},{token:"info.log",foreground:s(re["log-info"])},{token:"stdout.log",foreground:s(re["log-stdout"])},{token:"trace.log",foreground:s(re["log-trace"])},{token:"debug.log",foreground:s(re["log-debug"])},{token:"date.log",foreground:s(re["log-date"])}],i={errorForeground:re["error-foreground"],"inputOption.activeBorder":re["input-option-active-border"],"editor.background":re.background,"editor.foreground":re.foreground,"editor.lineHighlightBackground":re["editor-line-highlight-bg"],"editorLineNumber.foreground":re["editor-line-number-foreground"],"editor.selectionBackground":re["editor-selection-background"],"editor.findMatchBackground":re["editor-find-match-background"],"editor.findMatchHighlightBackground":re["editor-find-match-highlight-background"],"editorSuggestWidget.background":re["editor-suggest-widget-background"],"editorSuggestWidget.border":re["editor-suggest-widget-border"],"editorSuggestWidget.foreground":re["editor-suggest-widget-foreground"],"editorSuggestWidget.selectedBackground":re["editor-suggest-widget-selected-background"],"editorSuggestWidget.highlightForeground":re["editor-suggest-widget-highlightForeground"],"list.hoverBackground":re["list-hover-background"],"dropdown.background":re["context-menu-background"],"dropdown.foreground":re["context-menu-foreground"],"menu.selectionBackground":re["menu-selection-background"],"list.focusBackground":re["menu-selection-background"],"editorWidget.background":re["editor-widget-background"],"inputOption.activeBackground":re["input-option-active-background"],"inputOption.activeForeground":re["input-option-active-foreground"],focusBorder:re["focus-border"],"input.background":re["input-background"],"input.foreground":re["input-foreground"],"input.border":re["input-border"]};an.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:o,colors:i}),Ht.debug2("monaco theme: ",re),an.setTheme("dh-dark"),n([Ym,Lm,Vm,jm,Wm]),Ht.debug("Monaco initialized.")}static registerGetWorker(t){window.MonacoEnvironment={...window.MonacoEnvironment,getWorker:t}}static removeHashtag(t){return t.substring(1)}static registerLanguages(t){const n=t.map(({id:s})=>s);ps.getLanguages().filter(({id:s})=>n.includes(s)).forEach(s=>{const o=s;Ht.debug2("Overriding default language loader:",o.id)}),t.forEach(s=>{He.registerLanguage(s)})}static registerLanguage(t){Ht.debug2("Registering language: ",t.id),ps.register(t),ps.onLanguage(t.id,()=>{ps.setLanguageConfiguration(t.id,t.conf),ps.setMonarchTokensProvider(t.id,t.language)})}static setEOL(t,n=an.EndOfLineSequence.LF){var s;(s=t.getModel())==null||s.setEOL(n)}static openDocument(t,n){const s=t.getModel();M(s);const o={textDocument:{uri:`${s.uri}`,languageId:s.getLanguageId(),version:s.getVersionId(),text:s.getValue()}};return Ht.debug2("didOpenDocumentParams: ",o),n.openDocument(o),t.onDidChangeModelContent(r=>{const{changes:l,versionId:a}=r,c=[];for(let d=0;d<l.length;d+=1){const u=l[d],{range:h,rangeLength:g,text:p}=u,f={range:{start:{line:h.startLineNumber-1,character:h.startColumn-1},end:{line:h.endLineNumber-1,character:h.endColumn-1}},rangeLength:g,text:p};c.push(f)}if(c.length>0){const d={textDocument:{version:a,uri:`${s.uri}`},contentChanges:c};Ht.debug2("didChangeDocumentParams",d),n.changeDocument(d)}})}static closeDocument(t,n){const s=t.getModel();M(s);const o={textDocument:{uri:`${s.uri}`}};n.closeDocument(o)}static registerPasteHandler(t){t.onDidPaste(n=>{const s=/“|”/g,o=/\u200b/g,i=/\u00A0/g,r=t.getModel();M(r);const l=r.getValueInRange(n.range);(s.test(l)||o.test(l)||i.test(l))&&r.applyEdits([{range:n.range,text:l.replace(s,'"').replace(o,"").replace(i," ")}])})}static isMacPlatform(){const{platform:t}=window.navigator;return t.startsWith("Mac")}static removeConflictingKeybindings(t){const n=[{windows:"ctrl+D",mac:"meta+D"},{windows:"ctrl+H"}];try{n.forEach(s=>{He.isMacPlatform()&&s.mac===""||!He.isMacPlatform()&&s.windows===""||He.removeKeybinding(t,He.isMacPlatform()?s.mac:s.windows)})}catch(s){Ht.error(s)}}static removeKeybinding(t,n){if(n===void 0)return;const s=t._standaloneKeybindingService._getResolver()._map.get(n);s!=null?s.forEach(o=>{Ht.debug2(`Removing Monaco keybinding ${n} for ${o.command}`),t._standaloneKeybindingService.addDynamicKeybinding(`-${o.command}`,null,()=>{})}):Ht.warn(`Did not find any keybindings to remove for ${n}`)}static getMonacoKeyCodeFromShortcut(t){const{keyState:n}=t,{keyValue:s}=n;return s===null?0:He.isMacPlatform()?(n.metaKey?Et.CtrlCmd:0)|(n.shiftKey?Et.Shift:0)|(n.altKey?Et.Alt:0)|(n.ctrlKey?Et.WinCtrl:0)|Tr.fromString(s):(n.ctrlKey?Et.CtrlCmd:0)|(n.shiftKey?Et.Shift:0)|(n.altKey?Et.Alt:0)|(n.metaKey?Et.WinCtrl:0)|Tr.fromString(s)}}const Wr=ie.module("MonacoCompletionProvider");class ta extends F.exports.PureComponent{constructor(t){super(t),this.handleCompletionRequest=this.handleCompletionRequest.bind(this)}componentDidMount(){const{language:t}=this.props;this.registeredCompletionProvider=ps.registerCompletionItemProvider(t!=null?t:"",{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:['"',".","'","(","[","{",","]})}componentWillUnmount(){var t;(t=this.registeredCompletionProvider)==null||t.dispose()}handleCompletionRequest(t,n,s){const{model:o,session:i}=this.props;if(t!==o)return null;const r={textDocument:{uri:`${t.uri}`,version:t.getVersionId()},position:{line:n.lineNumber-1,character:n.column-1},context:s},l=i.getCompletionItems(r);return Wr.debug("Completion items received: ",r,l),l.then(c=>{const d=c.map(u=>{const{label:h,kind:g,detail:p,documentation:f,sortText:C,filterText:w,textEdit:S,insertTextFormat:T}=u,{start:R,end:b}=S.range,v={startLineNumber:R.line+1,startColumn:R.character+1,endLineNumber:b.line+1,endColumn:b.character+1};return{label:h,kind:g,detail:p,documentation:f,sortText:C,filterText:w,insertText:S.text,insertTextRules:T===2?4:T,range:v}});return{incomplete:!0,suggestions:d}}).catch(c=>(Wr.error("There was an error retrieving completion items",c),{suggestions:[]}))}render(){return null}}const Ti=ie.module("ConsoleInput"),Vo=parseInt(re["line-height"],10),na=6,sa=6,Zm=Vo+na+sa,Ei=100,oa=class extends F.exports.PureComponent{constructor(e){super(e),this.handleWindowResize=this.handleWindowResize.bind(this),this.commandContainer=Fe.createRef(),this.commandHistoryIndex=null,this.timestamp=Date.now(),this.bufferIndex=0,this.history=[],this.modifiedCommands=new Map,this.state={commandEditorHeight:Vo,isFocused:!1,model:null}}componentDidMount(){this.initCommandEditor(),window.addEventListener("resize",this.handleWindowResize),this.loadMoreHistory()}componentDidUpdate(){this.layoutEditor()}componentWillUnmount(){window.removeEventListener("resize",this.handleWindowResize),this.loadingPromise!=null&&this.loadingPromise.cancel(),this.destroyCommandEditor()}setConsoleText(e,t=!0,n=!1){var s;!e||(Ti.debug("Command received: ",e),n||(this.commandHistoryIndex=null,(s=this.commandEditor)==null||s.setValue(e)),t&&this.focusEnd(),this.updateDimensions(),n&&this.processCommand(e))}initCommandEditor(){const{language:e,session:t}=this.props,n={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:e,lineHeight:Vo,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:na,bottom:sa},tabCompletion:"on",value:"",wordWrap:"on"},s=this.commandContainer.current;M(s),this.commandEditor=an.create(s,n),He.setEOL(this.commandEditor),He.openDocument(this.commandEditor,t),this.commandEditor.onDidChangeModelContent(()=>{var i;const o=(i=this.commandEditor)==null?void 0:i.getValue();this.modifiedCommands.set(this.commandHistoryIndex,o!=null?o:null),this.updateDimensions()}),this.commandEditor.onDidFocusEditorText(()=>{this.setState({isFocused:!0})}),this.commandEditor.onDidBlurEditorText(()=>{this.setState({isFocused:!1})}),this.commandEditor.onKeyDown(o=>{var d,u,h;const{commandEditor:i,commandHistoryIndex:r}=this,l=i==null?void 0:i.getPosition();M(l);const{lineNumber:a}=l,c=i==null?void 0:i.getModel();if(o.code==="ArrowUp"&&!this.isSuggestionMenuPopulated()&&a===1){r!=null?this.loadCommand(r+1):this.loadCommand(0),this.focusStart(),o.stopPropagation(),o.preventDefault();return}if(o.code==="ArrowDown"&&!this.isSuggestionMenuPopulated()&&a===(c==null?void 0:c.getLineCount())){r!=null&&r>0?this.loadCommand(r-1):this.loadCommand(null),this.focusEnd(),o.stopPropagation(),o.preventDefault();return}if(!o.altKey&&!o.shiftKey&&!o.metaKey)if(o.keyCode===Mn.Enter){if(!this.isSuggestionMenuPopulated()){o.stopPropagation(),o.preventDefault();const g=(d=this.commandEditor)==null?void 0:d.getValue().trim();g!==void 0&&(this.processCommand(g),(u=this.commandEditor)==null||u.setValue(""))}}else o.keyCode===Mn.Tab&&(this.isSuggestionMenuActive()?this.isSuggestionMenuPopulated()||(o.stopPropagation(),o.preventDefault()):(o.stopPropagation(),o.preventDefault(),(h=this.commandEditor)==null||h.trigger("Tab key trigger suggestions","editor.action.triggerSuggest",{})))}),this.commandEditor.addCommand(Et.CtrlCmd|Mn.KeyF,()=>{}),He.removeConflictingKeybindings(this.commandEditor),He.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){const{session:e}=this.props;this.commandEditor&&(He.closeDocument(this.commandEditor,e),this.commandEditor.dispose(),this.commandEditor=void 0)}handleWindowResize(){this.updateDimensions()}isSuggestionMenuActive(){var e,t,n;return this.commandSuggestionContainer||(this.commandSuggestionContainer=(t=(e=this.commandEditor)==null?void 0:e.getDomNode())==null?void 0:t.querySelector(".suggest-widget")),(n=this.commandSuggestionContainer&&this.commandSuggestionContainer.classList.contains("visible"))!=null?n:!1}isSuggestionMenuPopulated(){var e,t,n;return this.isSuggestionMenuActive()&&((n=(t=(e=this.commandSuggestionContainer)==null?void 0:e.querySelector(".monaco-list-rows"))==null?void 0:t.childElementCount)!=null?n:0)>0}focus(){var e;(e=this.commandEditor)==null||e.focus()}focusStart(){var s,o,i,r,l;const e=(s=this.commandEditor)==null?void 0:s.getModel();M(e);const t=e.getLineLength(1)+1,n=(o=this.commandEditor)==null?void 0:o.getTopForPosition(1,t);M(n),(i=this.commandEditor)==null||i.setPosition({lineNumber:1,column:t}),(r=this.commandEditor)==null||r.setScrollTop(n),(l=this.commandEditor)==null||l.focus()}focusEnd(){var o,i,r,l,a;const e=(o=this.commandEditor)==null?void 0:o.getModel();M(e);const t=e.getLineCount(),n=e.getLineLength(t)+1,s=(i=this.commandEditor)==null?void 0:i.getTopForPosition(t,n);M(s),(r=this.commandEditor)==null||r.setPosition({lineNumber:t,column:n}),(l=this.commandEditor)==null||l.setScrollTop(s),(a=this.commandEditor)==null||a.focus()}clear(){var e,t,n;(e=this.commandEditor)==null||e.focus(),(n=(t=this.commandEditor)==null?void 0:t.getModel())==null||n.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(e){var s,o;if(e!==null&&e>=this.history.length)return;const t=this.modifiedCommands.get(e),n=e===null?"":this.history[this.history.length-e-1];this.commandHistoryIndex=e,(o=(s=this.commandEditor)==null?void 0:s.getModel())==null||o.setValue(t!=null?t:n),e!==null&&e>this.history.length-Ei&&this.loadMoreHistory()}async loadMoreHistory(){try{if(this.loadingPromise!=null||this.bufferIndex==null)return;const{commandHistoryStorage:e,language:t,scope:n}=this.props;this.loadingPromise=Ge.makeCancelable(e.getTable(t,n!=null?n:"",this.timestamp),i=>i.close());const s=await this.loadingPromise;s.setReversed(!0),s.setViewport({top:this.bufferIndex,bottom:this.bufferIndex+Ei-1}),this.loadingPromise=Ge.makeCancelable(s.getViewportData(),()=>s.close());const o=await this.loadingPromise;this.bufferIndex+=Ei,this.bufferIndex>=s.size&&(this.bufferIndex=null),this.history=[...o.items.filter(({name:i},r,l)=>r===0||i!==l[r-1].name).map(({name:i})=>i).reverse(),...this.history],this.loadingPromise=void 0,s.close()}catch(e){if(this.loadingPromise=void 0,Ge.isCanceled(e)){Ti.debug2("Promise canceled, not loading history");return}Ti.error("Error fetching history",e)}}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),M(e),e!==""&&(this.history.length===0||e!==this.history[this.history.length-1])&&this.history.push(e),this.updateDimensions();const{onSubmit:t}=this.props;t(e)}updateDimensions(){if(!this.commandEditor)return;const{maxHeight:e}=this.props;M(e);const t=this.commandEditor.getContentHeight(),n=Math.max(Math.min(t,e),Zm),o={overviewRulerLanes:t>n?void 0:0};this.setState({commandEditorHeight:n},()=>{var i,r;(i=this.commandEditor)==null||i.updateOptions(o),(r=this.commandEditor)==null||r.layout()})}render(){const{disabled:e,language:t,session:n}=this.props,{commandEditorHeight:s,isFocused:o,model:i}=this.state;return m("div",{className:ee("console-input-wrapper",{disabled:e}),children:y("div",{className:ee("console-input-inner-wrapper",{focus:o}),children:[m("div",{className:oa.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:s}}),i&&m(ta,{model:i,language:t,session:n})]})})}};let Uo=oa;Uo.defaultProps={maxHeight:Vo*10,scope:null,disabled:!1};Uo.INPUT_CLASS_NAME="console-input";const $r="pasted values",Jm=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],vi=[".csv",".tsv",".tab",".psv",".dsv",".txt"],zr=[".zip"],Cs=class extends F.exports.Component{constructor(e){super(e),this.getValidExtensions=Re(t=>t?[...vi,...zr]:[...vi]),this.getAcceptString=Re(t=>this.getValidExtensions(t).join(", ")),this.getFileTypeErrorString=Re(t=>Wi.join(this.getValidExtensions(t),"or")),this.handleSelectFile=this.handleSelectFile.bind(this),this.handleFiles=this.handleFiles.bind(this),this.handleDrop=this.handleDrop.bind(this),this.unstageFile=this.unstageFile.bind(this),this.handleMenuPaste=this.handleMenuPaste.bind(this),this.handlePasteEvent=this.handlePasteEvent.bind(this),this.fileElem=Fe.createRef(),this.divElem=Fe.createRef(),this.state={selectedFileName:""}}static isValidDropItem(e){return e!=null&&e.kind==="file"&&!Jm.find(t=>t.test(e.type))}static isValidExtension(e,t=!1){return vi.some(n=>e.endsWith(n))||t&&zr.some(n=>e.endsWith(n))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===$r?wr:e.endsWith(".csv")?dc:e.endsWith(".zip")?uc:hc}componentDidMount(){var e,t;(e=this.divElem.current)==null||e.addEventListener("paste",this.handlePasteEvent),(t=this.divElem.current)==null||t.focus()}componentWillUnmount(){var e;(e=this.divElem.current)==null||e.removeEventListener("paste",this.handlePasteEvent)}handleSelectFile(){var e;this.fileElem.current&&(this.fileElem.current.value="",(e=this.fileElem.current)==null||e.click())}handleFiles(e){e.stopPropagation(),e.preventDefault();const{files:t}=e.target;t!=null&&this.handleFile(t[0])}handleDrop(e){const{allowZip:t,clearDragError:n,dragError:s}=this.props;if(e.preventDefault(),e.stopPropagation(),s!=null){n();return}if(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0)return;const o=e.dataTransfer.items[0].getAsFile();M(o),Cs.isValidExtension(o.name,t)?this.handleFile(o):this.setState({dropError:Cs.FILE_TYPE_ERROR})}unstageFile(e){const{onCancel:t}=this.props;e.stopPropagation(),e.preventDefault(),t(),this.setState({selectedFileName:"",dropError:void 0})}handleFile(e){const{onFileOpened:t}=this.props;t(e),this.setState({selectedFileName:e.name,dropError:void 0})}handleMenuPaste(){const{onPaste:e,onError:t,uploadInProgress:n}=this.props;n||navigator.clipboard.readText().then(s=>{e(s),this.setState({selectedFileName:$r,dropError:void 0})}).catch(s=>t(s))}handlePasteEvent(e){e.stopPropagation(),e.preventDefault(),this.handleMenuPaste()}makeContextMenuItems(){const{uploadInProgress:e}=this.props;return[{title:"Paste",icon:wr,action:this.handleMenuPaste,shortcut:Li.PASTE,disabled:e}]}render(){const{allowZip:e,dragError:t,uploadInProgress:n}=this.props,{selectedFileName:s,dropError:o}=this.state,i=t!=null?t:o,r=this.makeContextMenuItems();return y("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:Cs.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[m(se,{actions:r}),m("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(e),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!s&&(i===void 0||i==="")&&y("div",{className:"message-content",children:[m("div",{className:"message-icon",children:m(te,{icon:mc})}),m("label",{children:"Drop file (or paste values) here to import"}),m("div",{className:"message-small",children:m("label",{children:"or"})}),m(z,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),s&&(i===void 0||i==="")&&y("div",{className:"selected-content",children:[m("div",{className:"selected-icon",children:m(te,{icon:Cs.getIcon(s)})}),y("div",{className:"selected-text",children:[m("label",{children:"Selected File"}),y("label",{className:"selected-name",children:[s,!n&&m(z,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:un,tooltip:"Remove"})]})]})]}),Boolean(i)&&y("div",{className:"message-content",children:[m("div",{className:"message-icon",children:m(te,{icon:Qn})}),m("label",{children:i}),i===Cs.FILE_TYPE_ERROR&&m("div",{className:"message-small",children:m("label",{children:this.getFileTypeErrorString(e)})})]})]})}};let rn=Cs;rn.defaultProps={allowZip:!1,dragError:null};rn.MULTIPLE_FILE_ERROR="Please select only one file";rn.FILE_TYPE_ERROR="Filetype not supported.";class pe{}pe.INTEGER="int";pe.LONG="long";pe.DOUBLE="double";pe.BOOLEAN="bool";pe.STRING="string";pe.DATE_TIME="datetime";pe.LOCAL_TIME="localtime";const qr="unknown",eg=2147483647,tg=-2147483648,Yr=/^[0-9]{4}-[0-1][0-9]-[0-3][0-9][ T][0-2][0-9]:[0-5][0-9]:[0-6][0-9](?:\.[0-9]{1,9})?(?: [a-zA-Z]+)?$/,Xr=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class tt{static determineType(t,n,s){if(!t||t===s)return n;switch(n){case pe.STRING:return pe.STRING;case pe.INTEGER:return tt.checkInteger(t);case pe.LONG:return tt.checkLong(t);case pe.DOUBLE:return tt.checkDouble(t);case pe.BOOLEAN:return tt.checkBoolean(t);case pe.DATE_TIME:return tt.checkDateTime(t);case pe.LOCAL_TIME:return tt.checkLocalTime(t);default:return tt.getTypeFromUnknown(t)}}static isNotParsableNumber(t){return isNaN(t)||t==="Infinity"||t==="-Infinity"}static checkInteger(t){const n=t.replace(/,/g,"");return tt.isNotParsableNumber(n)?pe.STRING:tt.getNumberType(n)}static checkLong(t){const n=t.replace(/,/g,"");return tt.isNotParsableNumber(n)?pe.STRING:n.includes(".")?pe.DOUBLE:pe.LONG}static checkDouble(t){const n=t.replace(/,/g,"");return tt.isNotParsableNumber(n)?pe.STRING:pe.DOUBLE}static checkBoolean(t){const n=t.toLowerCase();return n==="true"||n==="false"?pe.BOOLEAN:pe.STRING}static checkDateTime(t){return Yr.test(t)?pe.DATE_TIME:pe.STRING}static checkLocalTime(t){return Xr.test(t)?pe.LOCAL_TIME:pe.STRING}static getTypeFromUnknown(t){const n=t.replace(/,/g,"");if(tt.isNotParsableNumber(n)){const s=t.toLowerCase();return s==="true"||s==="false"?pe.BOOLEAN:Yr.test(t)&&t.includes(":")?pe.DATE_TIME:Xr.test(t)?pe.LOCAL_TIME:pe.STRING}return tt.getNumberType(n)}static getNumberType(t){if(t.includes("."))return pe.DOUBLE;const n=t.startsWith("-")?11:10;if(t.length>n)return pe.LONG;const s=parseInt(t,10);return s>eg||s<tg?pe.LONG:pe.INTEGER}constructor(t,n,s,o,i,r,l,a,c,d){this.onFileCompleted=t,this.file=n,this.readHeaders=s,this.nullString=i,this.onProgress=r,this.onError=l,this.chunks=0,this.totalChunks=a,this.isZip=c,this.shouldTrim=d,this.zipProgress=0,this.handleChunk=this.handleChunk.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleError=this.handleError.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.config={...o,error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete}}parse(){const t=this.isZip?this.file.nodeStream("nodebuffer",this.handleNodeUpdate):this.file;Di.parse(t,this.config)}handleChunk(t,n){let{data:s}=t;if(!this.types){if(s==null||s.length===0){n.abort(),this.onError("Error parsing CSV: no data in file.");return}this.types=new Array(s[0].length).fill(qr),this.readHeaders&&(s=s.slice(1))}M(this.types);const o=[...this.types];s.forEach(l=>{if(l.length>=o.length){for(let a=0;a<o.length;a+=1)o[a]=tt.determineType(this.shouldTrim?l[a].trim():l[a],o[a],this.nullString);this.types=o}else n.abort(),this.onError(`Error parsing CSV: Insufficient data in row.
15
15
  Expected length ${o.length} but found ${l.length}.
16
- Row = ${l}`)}),this.chunks+=1;let i=0;this.totalChunks>0?i=Math.round(this.chunks/this.totalChunks*50):i=Math.round(this.zipProgress/2),this.onProgress(i)&&n.abort()}handleComplete(t){const{types:n,onFileCompleted:s}=this;M(n),(t==null||!t.meta.aborted)&&s(n.map(o=>o===qr?pe.STRING:o))}handleError(t){const{onError:n}=this;n(t)}handleNodeUpdate(t){this.zipProgress=t.percent}}const No=ie.module("CsvParser"),tg=650,Bo=class{static generateHeaderRecursive(e){let t="",n=e;return e>=26&&(t=t.concat(Bo.generateHeaderRecursive(Math.floor(e/26)-1)),n=e%26),t.concat(String.fromCharCode(65+n))}constructor({onFileCompleted:e,session:t,file:n,type:s,readHeaders:o=!0,onProgress:i,onError:r,timeZone:l,isZip:a}){this.onFileCompleted=e,this.session=t,this.file=n,this.isZip=a,this.type=s,this.readHeaders=o,this.timeZone=l,this.onProgress=i,this.onError=r,this.tables=[],this.chunks=0,this.totalChunks=a?0:Math.ceil(n.size/Di.LocalChunkSize),this.isComplete=!1,this.zipProgress=0,this.numConsolidated=0,this.isCancelled=!1,this.handleChunk=this.handleChunk.bind(this),this.handleError=this.handleError.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.handleCreateTable=this.handleCreateTable.bind(this),this.config={delimiter:s.delimiter,newline:s.newline,escapeChar:s.escapeChar,dynamicTyping:!1,error:this.handleError,skipEmptyLines:s.skipEmptyLines,chunk:this.handleChunk,complete:this.handleComplete,fastMode:!1}}cancel(){this.isCancelled=!0}transpose(e,t){const n=t.length,s=new Array(e).fill(null).map(()=>new Array(n));for(let o=0;o<n;o+=1){const i=t[o];if(i.length<e)throw new Error(`Insufficient columns. Expected ${e} but found ${i.length}
17
- ${i}`);for(let r=0;r<e;r+=1){const l=this.type.shouldTrim?t[o][r].trim():t[o][r];s[r][o]=this.nullCheck(l)}}return s}nullCheck(e){return e===this.type.nullString?"":e}parse(){const e=n=>{const s=this.isZip?this.file.nodeStream("nodebuffer",this.handleNodeUpdate):this.file;this.types=n,Di.parse(s,this.config)};new tt(e,this.file,this.readHeaders,this.config,this.type.nullString,this.onProgress,this.onError,this.totalChunks,this.isZip,this.type.shouldTrim).parse()}handleChunk(e,t){const{readHeaders:n,onError:s,handleCreateTable:o,isZip:i,tables:r}=this;if(this.isCancelled){No.debug2("CSV parser cancelled."),t.abort(),r.forEach(c=>c.close());return}let{data:l}=e;this.headers||(n?(this.headers=Ys.legalizeColumnNames(l[0]),l=l.slice(1)):this.headers=Bo.generateHeaders(l[0].length));let a=[];try{if(a=this.transpose(this.headers.length,l),i)this.consolidateChunks(a,t);else{const c=this.chunks;this.chunks+=1,o(c,a,t)}}catch(c){s(c)}}consolidateChunks(e,t){if(!this.consolidatedChunks)this.consolidatedChunks=e.slice();else for(let n=0;n<e.length;n+=1)this.consolidatedChunks[n]=this.consolidatedChunks[n].concat(e[n]);this.numConsolidated+=1,(this.numConsolidated>=tg||this.isComplete)&&this.uploadConsolidatedChunks(t)}uploadConsolidatedChunks(e){var o;const{handleCreateTable:t}=this,n=this.chunks;this.chunks+=1;const s=(o=this.consolidatedChunks)==null?void 0:o.slice();this.consolidatedChunks=void 0,this.numConsolidated=0,M(s),t(n,s,e)}handleCreateTable(e,t,n){const{session:s,tables:o,onFileCompleted:i,totalChunks:r,types:l,onProgress:a,onError:c}=this;n&&n.pause(),M(this.headers),M(l),s.newTable(this.headers,l,t,this.timeZone).then(d=>{if(this.isCancelled){No.debug2("CSV parser cancelled."),n&&n.abort(),o.forEach(h=>h.close());return}n&&n.resume(),o[e]=d;let u=0;r>0?u=Math.round(o.length/r*50)+50:u=Math.round(50+this.zipProgress/2),No.debug2(`CSV parser progress ${u}`),a(u),this.isComplete&&o.length===this.chunks&&(No.debug2("CSV parser complete."),i(o))}).catch(d=>{!this.isComplete&&n&&n.abort(),c(d)})}handleComplete(e){(e==null||e.meta.aborted==null)&&(this.isComplete=!0,this.consolidatedChunks&&this.uploadConsolidatedChunks(null))}handleError(e){const{onError:t}=this;t(e)}handleNodeUpdate(e){this.zipProgress=e.percent}};let oa=Bo;oa.generateHeaders=e=>{const t=[];for(let n=0;n<e;n+=1)t.push(Bo.generateHeaderRecursive(n));return t};class xn{static fromExtension(t){return t.endsWith(".csv")?"DEFAULT_CSV":t.endsWith(".tsv")||t.endsWith(".tab")?"TSV":t.endsWith(".psv")?"PIPE_SV":"AUTODETECT"}}xn.DEFAULT_TYPE="DEFAULT_CSV";xn.AUTO="AUTODETECT";xn.TYPES=Object.freeze({DEFAULT_CSV:{name:"Default csv (trimmed)",delimiter:",",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},TSV:{name:"Tab seperated (tsv)",delimiter:" ",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},APACHE_COMMON_CSV:{name:"Apache Common csv",delimiter:",",newline:`\r
16
+ Row = ${l}`)}),this.chunks+=1;let i=0;this.totalChunks>0?i=Math.round(this.chunks/this.totalChunks*50):i=Math.round(this.zipProgress/2),this.onProgress(i)&&n.abort()}handleComplete(t){const{types:n,onFileCompleted:s}=this;M(n),(t==null||!t.meta.aborted)&&s(n.map(o=>o===qr?pe.STRING:o))}handleError(t){const{onError:n}=this;n(t)}handleNodeUpdate(t){this.zipProgress=t.percent}}const No=ie.module("CsvParser"),ng=650,Bo=class{static generateHeaderRecursive(e){let t="",n=e;return e>=26&&(t=t.concat(Bo.generateHeaderRecursive(Math.floor(e/26)-1)),n=e%26),t.concat(String.fromCharCode(65+n))}constructor({onFileCompleted:e,session:t,file:n,type:s,readHeaders:o=!0,onProgress:i,onError:r,timeZone:l,isZip:a}){this.onFileCompleted=e,this.session=t,this.file=n,this.isZip=a,this.type=s,this.readHeaders=o,this.timeZone=l,this.onProgress=i,this.onError=r,this.tables=[],this.chunks=0,this.totalChunks=a?0:Math.ceil(n.size/Di.LocalChunkSize),this.isComplete=!1,this.zipProgress=0,this.numConsolidated=0,this.isCancelled=!1,this.handleChunk=this.handleChunk.bind(this),this.handleError=this.handleError.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.handleCreateTable=this.handleCreateTable.bind(this),this.config={delimiter:s.delimiter,newline:s.newline,escapeChar:s.escapeChar,dynamicTyping:!1,error:this.handleError,skipEmptyLines:s.skipEmptyLines,chunk:this.handleChunk,complete:this.handleComplete,fastMode:!1}}cancel(){this.isCancelled=!0}transpose(e,t){const n=t.length,s=new Array(e).fill(null).map(()=>new Array(n));for(let o=0;o<n;o+=1){const i=t[o];if(i.length<e)throw new Error(`Insufficient columns. Expected ${e} but found ${i.length}
17
+ ${i}`);for(let r=0;r<e;r+=1){const l=this.type.shouldTrim?t[o][r].trim():t[o][r];s[r][o]=this.nullCheck(l)}}return s}nullCheck(e){return e===this.type.nullString?"":e}parse(){const e=n=>{const s=this.isZip?this.file.nodeStream("nodebuffer",this.handleNodeUpdate):this.file;this.types=n,Di.parse(s,this.config)};new tt(e,this.file,this.readHeaders,this.config,this.type.nullString,this.onProgress,this.onError,this.totalChunks,this.isZip,this.type.shouldTrim).parse()}handleChunk(e,t){const{readHeaders:n,onError:s,handleCreateTable:o,isZip:i,tables:r}=this;if(this.isCancelled){No.debug2("CSV parser cancelled."),t.abort(),r.forEach(c=>c.close());return}let{data:l}=e;this.headers||(n?(this.headers=Ys.legalizeColumnNames(l[0]),l=l.slice(1)):this.headers=Bo.generateHeaders(l[0].length));let a=[];try{if(a=this.transpose(this.headers.length,l),i)this.consolidateChunks(a,t);else{const c=this.chunks;this.chunks+=1,o(c,a,t)}}catch(c){s(c)}}consolidateChunks(e,t){if(!this.consolidatedChunks)this.consolidatedChunks=e.slice();else for(let n=0;n<e.length;n+=1)this.consolidatedChunks[n]=this.consolidatedChunks[n].concat(e[n]);this.numConsolidated+=1,(this.numConsolidated>=ng||this.isComplete)&&this.uploadConsolidatedChunks(t)}uploadConsolidatedChunks(e){var o;const{handleCreateTable:t}=this,n=this.chunks;this.chunks+=1;const s=(o=this.consolidatedChunks)==null?void 0:o.slice();this.consolidatedChunks=void 0,this.numConsolidated=0,M(s),t(n,s,e)}handleCreateTable(e,t,n){const{session:s,tables:o,onFileCompleted:i,totalChunks:r,types:l,onProgress:a,onError:c}=this;n&&n.pause(),M(this.headers),M(l),s.newTable(this.headers,l,t,this.timeZone).then(d=>{if(this.isCancelled){No.debug2("CSV parser cancelled."),n&&n.abort(),o.forEach(h=>h.close());return}n&&n.resume(),o[e]=d;let u=0;r>0?u=Math.round(o.length/r*50)+50:u=Math.round(50+this.zipProgress/2),No.debug2(`CSV parser progress ${u}`),a(u),this.isComplete&&o.length===this.chunks&&(No.debug2("CSV parser complete."),i(o))}).catch(d=>{!this.isComplete&&n&&n.abort(),c(d)})}handleComplete(e){(e==null||e.meta.aborted==null)&&(this.isComplete=!0,this.consolidatedChunks&&this.uploadConsolidatedChunks(null))}handleError(e){const{onError:t}=this;t(e)}handleNodeUpdate(e){this.zipProgress=e.percent}};let ia=Bo;ia.generateHeaders=e=>{const t=[];for(let n=0;n<e;n+=1)t.push(Bo.generateHeaderRecursive(n));return t};class xn{static fromExtension(t){return t.endsWith(".csv")?"DEFAULT_CSV":t.endsWith(".tsv")||t.endsWith(".tab")?"TSV":t.endsWith(".psv")?"PIPE_SV":"AUTODETECT"}}xn.DEFAULT_TYPE="DEFAULT_CSV";xn.AUTO="AUTODETECT";xn.TYPES=Object.freeze({DEFAULT_CSV:{name:"Default csv (trimmed)",delimiter:",",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},TSV:{name:"Tab seperated (tsv)",delimiter:" ",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},APACHE_COMMON_CSV:{name:"Apache Common csv",delimiter:",",newline:`\r
18
18
  `,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:null},EXCEL_CSV:{name:"Excel csv (strict)",delimiter:",",newline:`\r
19
19
  `,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!1,nullString:null},MY_SQL_CSV:{name:"MySQL csv",delimiter:" ",newline:`
20
20
  `,escapeChar:"\\",shouldTrim:!0,skipEmptyLines:!1,nullString:"\\N"},RFC4180_CSV:{name:"RFC4180 csv",delimiter:",",newline:`\r
21
- `,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!1,nullString:null},COLON_SV:{name:": colon sv",delimiter:":",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},SEMI_COLON_SV:{name:"; semi-colon sv",delimiter:";",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},PIPE_SV:{name:"| pipe separated (psv)",delimiter:"|",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},SPACE_SV:{name:'" " space sv',delimiter:" ",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},AUTODETECT:{name:"autodetect",delimiter:void 0,newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"}});const Kr=ie.module("CsvInputBar"),ng=Object.entries(xn.TYPES).map(([e,t])=>m("option",{value:e,children:t.name},e));class ia extends F.exports.Component{constructor(t){super(t),this.handleUpload=this.handleUpload.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleError=this.handleError.bind(this),this.handleTableName=this.handleTableName.bind(this),this.toggleFirstRowHeaders=this.toggleFirstRowHeaders.bind(this),this.handleProgress=this.handleProgress.bind(this),this.handleCancelInProgress=this.handleCancelInProgress.bind(this),this.handleQueryTypeChange=this.handleQueryTypeChange.bind(this),this.inputRef=Fe.createRef(),this.state={tableName:"",tableNameSet:!1,isFirstRowHeaders:!0,showProgress:!1,progressValue:0,type:xn.DEFAULT_TYPE,parser:null}}componentDidUpdate(t){var r;const{file:n,paste:s}=this.props,{tableName:o,tableNameSet:i}=this.state;if(!i&&n!=null&&!o){const l=n.name.lastIndexOf("."),a=Ys.legalizeTableName(n.name.substring(0,l));this.setState({tableName:a,tableNameSet:!0}),(r=this.inputRef.current)==null||r.focus()}else(n==null&&t.file!=null||s==null&&t.paste!=null)&&this.setState({tableName:"",tableNameSet:!1});s!=null&&s!==""&&!o&&this.inputRef.current&&this.inputRef.current.focus(),n!=null&&n!==t.file?this.setState({type:xn.fromExtension(n.name)}):s!=null&&s!==""&&(t.paste===void 0||t.paste==="")&&this.setState({type:xn.AUTO})}componentWillUnmount(){const{parser:t}=this.state;t&&t.cancel()}handleCancel(){const{onClose:t}=this.props;t()}handleError(t){const{onClose:n,onError:s}=this.props;Kr.error(t),s(t),n()}handleTableName(t){this.setState({tableName:t.target.value,tableNameSet:!0})}toggleFirstRowHeaders(){const{isFirstRowHeaders:t}=this.state;this.setState({isFirstRowHeaders:!t})}handleUpload(t){t.stopPropagation(),t.preventDefault();const{file:n,paste:s}=this.props;n!=null?n.name.endsWith(".zip")?this.handleZipFile(n):this.handleFile(n):s!==void 0&&s!==""&&this.handleFile(new Blob([s],{type:"text/plain"}))}handleFile(t,n=!1){Kr.info(`Starting CSV parser for ${t instanceof File?t.name:"pasted values"} ${n?"":t.size} bytes`);const{session:s,timeZone:o,onInProgress:i}=this.props,{tableName:r,isFirstRowHeaders:l,type:a}=this.state,c=u=>{u.length===1?s.bindTableToVariable(u[0],r).then(()=>this.openTable()).catch(h=>this.handleError(h)):s.mergeTables(u).then(h=>{s.bindTableToVariable(h,r).then(()=>this.openTable()).catch(g=>this.handleError(g)),u.forEach(g=>g.close())}).catch(h=>this.handleError(h))},d=new oa({onFileCompleted:c,session:s,file:t,type:xn.TYPES[a],readHeaders:l,onProgress:this.handleProgress,onError:this.handleError,timeZone:o,isZip:n});d.parse(),this.setState({showProgress:!0,parser:d}),i(!0)}handleZipFile(t){const{onUpdate:n,unzip:s}=this.props;if(s==null){this.handleError(new Error("No support for zip files available."));return}s(t).then(o=>{let i=!1;for(let r=0;r<o.length;r+=1){const l=o[r];if(rn.isValidExtension(l.name)){n(`Loading ${l.name} as csv from ${t.name}`),i=!0,this.handleFile(l,!0);break}}if(!i)throw new Error(`No csv file found in ${t.name}`)}).catch(o=>this.handleError(o))}handleProgress(t){const{showProgress:n}=this.state;return n&&this.setState({progressValue:t}),!n}handleCancelInProgress(){const{onInProgress:t}=this.props,{parser:n}=this.state;n&&n.cancel(),this.setState({showProgress:!1,progressValue:0}),t(!1)}openTable(){const{onOpenTable:t,onClose:n}=this.props,{tableName:s}=this.state;t(s),n()}handleQueryTypeChange(t){this.setState({type:t.target.value})}render(){const{file:t,paste:n}=this.props,{tableName:s,isFirstRowHeaders:o,showProgress:i,progressValue:r,type:l}=this.state,a=Boolean(n)&&!s;return y("div",{className:"csv-input-bar",children:[!i&&y("form",{onSubmit:this.handleUpload,className:"csv-input-bar-container form-inline",children:[y("div",{className:"form-group",children:[m("label",{htmlFor:"tableNameInput",children:"Table name"}),m("input",{ref:this.inputRef,id:"tableNameInput",type:"text",className:ee("form-control",{"is-invalid":a}),value:s,onChange:this.handleTableName})]}),y("div",{className:"form-group",children:[m("label",{htmlFor:"formatSelect",children:"File format"}),m("select",{id:"formatSelect",className:"custom-select",value:l,onChange:this.handleQueryTypeChange,children:ng})]}),m(ln,{className:"firstRowHeaders",checked:o,onChange:this.toggleFirstRowHeaders,children:"First row is column headers"}),y("div",{className:"csv-input-buttons form-group",children:[m(z,{kind:"secondary",onClick:this.handleCancel,children:"Cancel"}),m(z,{kind:"primary",type:"submit",disabled:!(t!==null||n!==void 0&&n!=="")||!s,children:"Upload"})]})]}),i&&y("div",{className:"csv-progress-container",children:[m("label",{children:"Uploading Table"}),m("div",{className:"progress",children:m("div",{className:"progress-bar bg-primary",style:{width:`${r}%`},"aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100})}),y("label",{children:[r,"%"]}),m(z,{kind:"primary",onClick:this.handleCancelInProgress,children:"Cancel"})]})]})}}ia.defaultProps={file:null,paste:null,unzip:null};const Qr=ie.module("ConsoleMenu");class Go extends F.exports.PureComponent{constructor(t){super(t),this.makeTableActions=Re((n,s,o)=>{const i=n.filter(r=>Es.isTableType(r.type));return Go.makeItemActions(i,s,r=>{this.tableSearchField=r},this.handleTableFilterChange,o)}),this.makeWidgetActions=Re((n,s,o)=>{const i=n.filter(r=>Es.isWidgetType(r.type));return Go.makeItemActions(i,s,r=>{this.widgetSearchField=r},this.handleWidgetFilterChange,o)}),this.handleTableFilterChange=this.handleTableFilterChange.bind(this),this.handleTableMenuClosed=this.handleTableMenuClosed.bind(this),this.handleTableMenuOpened=this.handleTableMenuOpened.bind(this),this.handleWidgetFilterChange=this.handleWidgetFilterChange.bind(this),this.handleWidgetMenuClosed=this.handleWidgetMenuClosed.bind(this),this.handleWidgetMenuOpened=this.handleWidgetMenuOpened.bind(this),this.state={tableFilterText:"",widgetFilterText:""}}static makeItemActions(t,n,s,o,i){if(t.length===0)return[];const r={menuElement:m(Xs,{value:n,onChange:o,className:"console-menu",ref:s})};let l=t;n&&(l=l.filter(({title:c})=>c!=null&&c.toLowerCase().indexOf(n.toLowerCase())>=0));const a=l.map(c=>({title:c.title,action:()=>{i(c)}}));return[r,...a]}handleTableFilterChange(t){Qr.debug("filtering tables..."),this.setState({tableFilterText:t.target.value})}handleTableMenuClosed(){this.setState({tableFilterText:""})}handleTableMenuOpened(){var t;(t=this.tableSearchField)==null||t.focus()}handleWidgetFilterChange(t){Qr.debug("filtering widgets..."),this.setState({widgetFilterText:t.target.value})}handleWidgetMenuClosed(){this.setState({widgetFilterText:""})}handleWidgetMenuOpened(){var t;(t=this.widgetSearchField)==null||t.focus()}render(){const{overflowActions:t,objects:n,openObject:s}=this.props,{tableFilterText:o,widgetFilterText:i}=this.state,r=this.makeTableActions(n,o,s),l=this.makeWidgetActions(n,i,s),a={placement:"bottom-end"},c=r.length===0,d=l.length===0;return y("div",{className:"console-pane-menu",children:[y(z,{kind:"ghost",className:"btn-link-icon",disabled:c,onClick:()=>{},tooltip:c?"No tables available":"Tables",children:[y("div",{className:"fa-md fa-layers",children:[m(te,{mask:Vi,icon:Yn,transform:"right-5 down-5"}),m(te,{icon:Yn,transform:"right-8 down-6"})]}),m(Ss,{actions:r,onMenuOpened:this.handleTableMenuOpened,onMenuClosed:this.handleTableMenuClosed,options:{initialKeyboardIndex:1},popperOptions:a},"table-actions ")]}),y(z,{kind:"ghost",className:"btn-link-icon",disabled:l.length===0,onClick:()=>{},tooltip:d?"No widgets available":"Widgets",children:[y("div",{className:"fa-md fa-layers",children:[m(te,{mask:hl,icon:Yn,transform:"right-5 down-5"}),m(te,{icon:Yn,transform:"right-8 down-6"})]}),m(Ss,{actions:l,onMenuOpened:this.handleWidgetMenuOpened,onMenuClosed:this.handleWidgetMenuClosed,options:{initialKeyboardIndex:1},popperOptions:a},"table-actions")]}),m(z,{kind:"ghost",className:"btn-overflow btn-link-icon",icon:mc,tooltip:"More Actions...",onClick:()=>{},children:m(Ss,{actions:t,popperOptions:a})})]})}}class ra extends F.exports.PureComponent{constructor(t){super(t),this.handleCommandStarted=this.handleCommandStarted.bind(this),this.handleCommandCompleted=this.handleCommandCompleted.bind(this),this.pending=new Xo,this.state={isDisconnected:!1,isCommandRunning:!1}}componentDidMount(){this.startListening()}componentWillUnmount(){this.stopListening(),this.cancelPendingPromises()}startListening(){const{session:t}=this.props;t.addEventListener(E.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted)}stopListening(){const{session:t}=this.props;t.removeEventListener(E.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted)}cancelPendingPromises(){this.pending.cancel()}handleCommandStarted(t){const{result:n}=t.detail;this.pending.add(n).then(()=>this.handleCommandCompleted(null)).catch(s=>this.handleCommandCompleted(s)),this.setState({isCommandRunning:!0})}handleCommandCompleted(t){t instanceof xi||this.setState({isCommandRunning:this.pending.pending.length>0})}render(){const{children:t,openObject:n,overflowActions:s,objects:o}=this.props,{isDisconnected:i,isCommandRunning:r}=this.state;let l=null,a=null;return i?(l="console-status-icon-disconnected",a="Worker is disconnected"):r?(l="console-status-icon-pending",a="Worker is busy"):(l="console-status-icon-idle",a="Worker is idle"),y("div",{className:"console-pane-status-bar",children:[y("div",{children:[m("div",{className:ee("console-status-icon",l)}),m(Rt,{children:a})]}),t,m(Go,{overflowActions:s,openObject:n,objects:o})]})}}ra.defaultProps={children:null};const Jt=ie.module("Console"),jr={isAutoLaunchPanelsEnabled:!0,isPrintStdOutEnabled:!0,isClosePanelsOnDisconnectEnabled:!0},Gs=class extends F.exports.PureComponent{constructor(e){super(e),this.processLogMessageQueue=Pn(()=>{this.scrollConsoleHistoryToBottom(),this.setState(s=>{Jt.debug2("processLogMessageQueue",this.queuedLogMessages.length," items");let{consoleHistory:o}=s;return o=o.concat(this.queuedLogMessages),this.queuedLogMessages=[],{consoleHistory:o}})},Gs.LOG_THROTTLE),this.getObjects=Re(s=>[...s.values()]),this.getContextActions=Re(s=>[...s,{action:this.handleClearShortcut,shortcut:Jn.CONSOLE.CLEAR},{action:this.handleFocusHistory,shortcut:Jn.CONSOLE.FOCUS_HISTORY}]),this.handleCommandResult=this.handleCommandResult.bind(this),this.handleCommandStarted=this.handleCommandStarted.bind(this),this.handleCommandSubmit=this.handleCommandSubmit.bind(this),this.handleClearShortcut=this.handleClearShortcut.bind(this),this.handleFocusHistory=this.handleFocusHistory.bind(this),this.handleLogMessage=this.handleLogMessage.bind(this),this.handleOverflowActions=this.handleOverflowActions.bind(this),this.handleScrollPaneScroll=this.handleScrollPaneScroll.bind(this),this.handleToggleAutoLaunchPanels=this.handleToggleAutoLaunchPanels.bind(this),this.handleToggleClosePanelsOnDisconnect=this.handleToggleClosePanelsOnDisconnect.bind(this),this.handleTogglePrintStdout=this.handleTogglePrintStdout.bind(this),this.handleUploadCsv=this.handleUploadCsv.bind(this),this.handleHideCsv=this.handleHideCsv.bind(this),this.handleCsvFileCanceled=this.handleCsvFileCanceled.bind(this),this.handleCsvFileOpened=this.handleCsvFileOpened.bind(this),this.handleCsvPaste=this.handleCsvPaste.bind(this),this.handleDragEnter=this.handleDragEnter.bind(this),this.handleDragLeave=this.handleDragLeave.bind(this),this.handleClearDragError=this.handleClearDragError.bind(this),this.handleOpenCsvTable=this.handleOpenCsvTable.bind(this),this.handleCsvUpdate=this.handleCsvUpdate.bind(this),this.handleCsvError=this.handleCsvError.bind(this),this.handleCsvInProgress=this.handleCsvInProgress.bind(this),this.consolePane=Fe.createRef(),this.consoleInput=Fe.createRef(),this.consoleHistoryScrollPane=Fe.createRef(),this.pending=new Xo,this.queuedLogMessages=[];const{objectMap:t,settings:n}=this.props;this.state={consoleHistory:[],consoleHeight:0,isScrollDecorationShown:!1,objectHistoryMap:new Map,objectMap:new Map(t),showCsvOverlay:!1,csvFile:null,csvPaste:null,dragError:null,csvUploadInProgress:!1,...jr,...n}}static isErrorLevel(e){return e===je.STDERR||e===je.ERROR||e===je.FATAL}static isOutputLevel(e){return e===je.STDOUT||Gs.isErrorLevel(e)}componentDidMount(){this.initConsoleLogging();const{session:e}=this.props;e.addEventListener(E.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted),this.updateDimensions()}componentDidUpdate(e,t){const{props:n,state:s}=this;this.sendSettingsChange(t,s),n.objectMap!==e.objectMap&&this.updateObjectMap()}componentWillUnmount(){const{session:e}=this.props;e.removeEventListener(E.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted),this.pending.cancel(),this.processLogMessageQueue.cancel(),this.deinitConsoleLogging()}initConsoleLogging(){const{session:e}=this.props;this.cancelListener=e.onLogMessage(this.handleLogMessage)}deinitConsoleLogging(){this.cancelListener!=null&&(this.cancelListener(),this.cancelListener=void 0)}handleClearShortcut(e){var t;e.preventDefault(),e.stopPropagation(),(t=this.consoleInput.current)==null||t.clear()}handleCommandStarted(e){const{code:t,result:n}=e.detail,s=this.pending.add(n),o={command:t,disabledObjects:[],startTime:Date.now(),cancelResult:()=>{n.cancel()},wrappedResult:s},{commandHistoryStorage:i,language:r,scope:l}=this.props,a=i.addItem(r,l,t,{command:t,startTime:new Date().toJSON()});a.catch(c=>{Jt.debug("Error adding workspace item",c)}),this.setState(c=>({consoleHistory:c.consoleHistory.concat(o)}),()=>{this.scrollConsoleHistoryToBottom(!0)}),s.then(c=>{this.handleCommandResult(c,o,a)}).catch(c=>{this.handleCommandError(c,o,a)})}handleCommandResult(e,t,n){const s={...t,wrappedResult:void 0,cancelResult:void 0,result:e!=null?e:t.result};this.setState(({consoleHistory:o})=>{const i=o.lastIndexOf(t);if(i<0)return Jt.error("historyItem not found in consoleHistory"),null;const r=o.concat();return r[i]=s,{consoleHistory:r}}),e&&(this.updateHistory(e,s),this.updateKnownObjects(s),this.updateWorkspaceHistoryItem({error:e.error},n),this.closeRemovedItems(e.changes),this.openUpdatedItems(e.changes))}handleCommandError(e,t,n){if(Ge.isCanceled(e)){Jt.debug("Called handleCommandError on a cancelled promise result");return}this.updateWorkspaceHistoryItem({error:`${e}`},n),this.setState(s=>{const o=s.consoleHistory.concat(),i=o.lastIndexOf(t),r={...t};return r.wrappedResult=void 0,r.cancelResult=void 0,r.endTime=Date.now(),r.result={error:e},o[i]=r,{consoleHistory:o}})}handleFocusHistory(e){e.preventDefault(),e.stopPropagation();const{focusCommandHistory:t}=this.props;t()}handleLogMessage(e){const{isPrintStdOutEnabled:t}=this.state;!t||Gs.isOutputLevel(e.logLevel)&&this.queueLogMessage(e.message,e.logLevel)}queueLogMessage(e,t){const n={};Gs.isErrorLevel(t)?n.error=e:n.message=e;const s={command:void 0,result:n};this.queuedLogMessages.push(s),this.processLogMessageQueue()}openUpdatedItems(e){const{isAutoLaunchPanelsEnabled:t}=this.state;if(e==null||!t)return;const{openObject:n}=this.props;[...e.created,...e.updated].forEach(s=>n(s))}closeRemovedItems(e){if(e==null||e.removed==null||e.removed.length===0)return;const{closeObject:t}=this.props,{removed:n}=e;n.forEach(s=>t(s))}updateHistory(e,t){const n=t;e==null||e.changes==null||n==null||(n.endTime=Date.now(),this.scrollConsoleHistoryToBottom(),this.setState(s=>({consoleHistory:s.consoleHistory.concat()})))}updateKnownObjects(e){let t;if(e.result&&(t=e.result.changes),!t||(t.created==null||t.created.length===0)&&(t.updated==null||t.updated.length===0)&&(t.removed==null||t.removed.length===0)){Jt.debug2("updateKnownObjects no changes");return}this.setState(n=>{let{consoleHistory:s}=n;const o=s.lastIndexOf(e);if(o<0)return Jt.error("historyItem not found in state.consoleHistory"),null;const i=new Map(n.objectHistoryMap),r=new Map(n.objectMap),l=(a,c=!1)=>{var h;const{title:d}=a;M(d);const u=i.get(d);if(u!=null&&u>=0){s===n.consoleHistory&&(s=s.concat());const g={...s[u],disabledObjects:[...(h=s[u].disabledObjects)!=null?h:[],d]};s[u]=g}i.set(d,o),c?r.delete(d):r.set(d,a)};return t==null||t.updated.forEach(a=>l(a)),t==null||t.removed.forEach(a=>l(a,!0)),t==null||t.created.forEach(a=>{const{title:c}=a;M(c),i.set(c,o),r.set(c,a)}),{objectHistoryMap:i,objectMap:r,consoleHistory:s}})}updateObjectMap(){const{objectMap:e}=this.props;this.setState({objectMap:e})}updateWorkspaceHistoryItem(e,t){const n=this.pending.add(t),s=new Date().toJSON();n.then(o=>{const i={...o,data:{...o.data,endTime:s,result:e}},{commandHistoryStorage:r,language:l}=this.props;r.updateItem(l,i).catch(a=>{Jt.warn("Error updating command history storage",a)})}).catch(o=>{Jt.debug("Error updating workspace history item",o)})}scrollConsoleHistoryToBottom(e=!1){const t=this.consoleHistoryScrollPane.current;M(t),!(!e&&t.scrollTop<t.scrollHeight-t.offsetHeight)&&window.requestAnimationFrame(()=>{t.scrollTop=t.scrollHeight})}handleScrollPaneScroll(){const e=this.consoleHistoryScrollPane.current;M(e),e.scrollTop>0&&e.scrollHeight>e.clientHeight?this.setState({isScrollDecorationShown:!0}):this.setState({isScrollDecorationShown:!1})}handleToggleAutoLaunchPanels(){this.setState(e=>({isAutoLaunchPanelsEnabled:!e.isAutoLaunchPanelsEnabled}))}handleToggleClosePanelsOnDisconnect(){this.setState(e=>({isClosePanelsOnDisconnectEnabled:!e.isClosePanelsOnDisconnectEnabled}))}handleTogglePrintStdout(){this.setState(e=>({isPrintStdOutEnabled:!e.isPrintStdOutEnabled}))}handleUploadCsv(){this.setState({showCsvOverlay:!0,dragError:null,csvUploadInProgress:!1})}handleHideCsv(){this.setState({showCsvOverlay:!1,csvFile:null,csvPaste:null,dragError:null,csvUploadInProgress:!1})}handleCsvFileCanceled(){this.setState({csvFile:null,csvPaste:null})}handleCsvFileOpened(e){this.setState({csvFile:e,csvPaste:null})}handleCsvPaste(e){this.setState({csvFile:null,csvPaste:e})}handleDragEnter(e){if(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0||e.dataTransfer.items[0].kind==="string")return;e.preventDefault(),e.stopPropagation(),this.setState({showCsvOverlay:!0});const{items:t}=e.dataTransfer;if(t.length>1){this.setState({dragError:rn.MULTIPLE_FILE_ERROR});return}const n=t[0];rn.isValidDropItem(n)?this.setState({dragError:null}):this.setState({dragError:rn.FILE_TYPE_ERROR})}handleDragLeave(e){e.currentTarget==null||e.currentTarget instanceof Element&&e.relatedTarget instanceof Element&&e.currentTarget.contains(e.relatedTarget)||(e.preventDefault(),e.stopPropagation(),this.setState({showCsvOverlay:!1,dragError:null}))}handleClearDragError(){this.setState({dragError:null})}handleOpenCsvTable(e){const{openObject:t,commandHistoryStorage:n,language:s,scope:o}=this.props,{consoleHistory:i,objectMap:r}=this.state,l={name:e,title:e,type:E.VariableType.TABLE},a=r.has(e),c={startTime:Date.now(),endTime:Date.now(),disabledObjects:[],result:{changes:{created:[],updated:[],removed:[],[a?"updated":"created"]:[l]}}},d=i.concat(c);this.setState({consoleHistory:d}),this.scrollConsoleHistoryToBottom(!0),this.updateKnownObjects(c),t({name:e,title:e,type:E.VariableType.TABLE}),n.addItem(s,o,e,{command:e,startTime:new Date().toJSON(),endTime:new Date().toJSON()})}addConsoleHistoryMessage(e,t){const{consoleHistory:n}=this.state,s={command:"",startTime:Date.now(),endTime:Date.now(),result:{message:e,error:t}},o=n.concat(s);this.setState({consoleHistory:o})}handleCsvUpdate(e){this.addConsoleHistoryMessage(e)}handleCsvError(e){this.addConsoleHistoryMessage(void 0,e!=null?`${e}`:void 0)}handleCsvInProgress(e){this.setState({csvUploadInProgress:e})}handleOverflowActions(){const{isAutoLaunchPanelsEnabled:e,isClosePanelsOnDisconnectEnabled:t,isPrintStdOutEnabled:n}=this.state,{actions:s}=this.props;return[...s,{title:"Print Stdout",action:this.handleTogglePrintStdout,group:se.groups.high,icon:n?Qn:void 0,order:10},{title:"Auto Launch Panels",action:this.handleToggleAutoLaunchPanels,group:se.groups.high,icon:e?Qn:void 0,order:20},{title:"Close Panels on Disconnect",action:this.handleToggleClosePanelsOnDisconnect,group:se.groups.high,icon:t?Qn:void 0,order:30},{title:"Upload Table from File",action:this.handleUploadCsv,group:se.groups.high+10,order:40}]}handleCommandSubmit(e){if(e==="clear"||e==="cls")this.clearConsoleHistory();else if(e.length>0){const{session:t}=this.props;t.runCode(e).catch(n=>{Jt.error("There was an error initiating the command",n)})}else{const t={command:" ",result:{},startTime:Date.now(),endTime:Date.now()};this.scrollConsoleHistoryToBottom(!0),this.setState(n=>({consoleHistory:n.consoleHistory.concat(t)}))}}clearConsoleHistory(){this.pending.cancel(),this.setState(e=>{const t=new Map([...e.objectHistoryMap.keys()].map(n=>[n,-1]));return{consoleHistory:[],objectHistoryMap:t}})}addCommand(e,t=!0,n=!1){!this.consoleInput.current||(this.consoleInput.current.setConsoleText(e,t,n),t&&this.scrollConsoleHistoryToBottom(!0))}focus(){var e;(e=this.consoleInput.current)==null||e.focus()}sendSettingsChange(e,t,n=!0){const s=Object.keys(jr),o={};let i=!1;for(let l=0;l<s.length;l+=1){const a=s[l],{[a]:c}=t,{[a]:d}=e;c!==d&&(i=!0),o[a]=c}if(n&&!i)return;const{onSettingsChange:r}=this.props;r(o)}updateDimensions(){this.consolePane.current&&this.setState({consoleHeight:this.consolePane.current.clientHeight}),this.consoleInput.current&&this.consoleInput.current.updateDimensions()}render(){const{actions:e,historyChildren:t,language:n,statusBarChildren:s,openObject:o,session:i,scope:r,commandHistoryStorage:l,timeZone:a,disabled:c,unzip:d}=this.props,{consoleHeight:u,consoleHistory:h,isScrollDecorationShown:g,objectMap:p,showCsvOverlay:f,csvFile:C,csvPaste:w,dragError:S,csvUploadInProgress:T}=this.state,R=this.getObjects(p),b=Math.round(u*.7),v=this.getContextActions(e);return y("div",{role:"presentation",className:ee("iris-console","h-100","w-100",{disabled:c}),children:[y("div",{className:"console-pane",ref:this.consolePane,children:[m(ra,{session:i,overflowActions:this.handleOverflowActions,openObject:o,objects:R,children:s}),y("div",{className:"console-csv-container",onDragOver:rn.handleDragOver,onDragEnter:this.handleDragEnter,onDragLeave:this.handleDragLeave,children:[f&&m(rn,{onCancel:this.handleCsvFileCanceled,onFileOpened:this.handleCsvFileOpened,onPaste:this.handleCsvPaste,clearDragError:this.handleClearDragError,dragError:S,onError:this.handleCsvError,uploadInProgress:T,allowZip:d!=null}),y("div",{role:"presentation",className:ee("scroll-pane no-scroll-x",{"scroll-decoration":g}),onScroll:this.handleScrollPaneScroll,ref:this.consoleHistoryScrollPane,children:[m(Jl,{items:h,openObject:o,language:n,disabled:c}),t]})]}),!f&&m(Uo,{ref:this.consoleInput,session:i,language:n,scope:r,onSubmit:this.handleCommandSubmit,maxHeight:b,commandHistoryStorage:l}),f&&m(ia,{session:i,onOpenTable:this.handleOpenCsvTable,onClose:this.handleHideCsv,onUpdate:this.handleCsvUpdate,onError:this.handleCsvError,file:C!=null?C:void 0,paste:w!=null?w:void 0,onInProgress:this.handleCsvInProgress,timeZone:a,unzip:d})]}),m(se,{actions:v,ignoreClassNames:[Uo.INPUT_CLASS_NAME]})]})}};let la=Gs;la.defaultProps={statusBarChildren:null,settings:{},onSettingsChange:()=>{},scope:null,actions:[],historyChildren:null,timeZone:"America/New_York",objectMap:new Map,disabled:!1,unzip:null};la.LOG_THROTTLE=500;class or extends F.exports.Component{constructor(t){super(t),this.handleResize=this.handleResize.bind(this),this.container=null,this.state={}}componentDidMount(){this.initEditor(),window.addEventListener("resize",this.handleResize)}componentWillUnmount(){window.removeEventListener("resize",this.handleResize),this.destroyEditor()}setLanguage(t){if(this.editor){const n=this.editor.getModel();M(n),an.setModelLanguage(n,t)}}handleResize(){this.updateDimensions()}toggleFind(){this.editor&&(this.editor.focus(),this.editor.trigger("toggleFind","actions.find",void 0))}updateDimensions(){var t;(t=this.editor)==null||t.layout()}initEditor(){const{onEditorInitialized:t}=this.props;let{settings:n}=this.props;n={copyWithSyntaxHighlighting:!1,fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"python",lineNumbersMinChars:3,minimap:{enabled:!1},scrollBeyondLastLine:!1,tabCompletion:"on",value:"",wordWrap:"off",...n},M(this.container),this.editor=an.create(this.container,n),this.editor.addAction({id:"find",label:"Find",keybindings:[Et.CtrlCmd|Mn.KeyF],precondition:void 0,keybindingContext:void 0,contextMenuGroupId:"navigation",contextMenuOrder:1,run:()=>{this.toggleFind()}}),this.editor.layout(),He.removeConflictingKeybindings(this.editor),t(this.editor)}destroyEditor(){const{onEditorWillDestroy:t}=this.props;M(this.editor),t(this.editor),this.editor.dispose(),this.editor=void 0}render(){const{className:t}=this.props;return m("div",{className:ee("editor-container",t),ref:n=>{this.container=n}})}}or.defaultProps={className:"fill-parent-absolute",onEditorInitialized:()=>{},onEditorWillDestroy:()=>{},settings:{}};const bt=ie.module("ScriptEditor");class sg extends F.exports.Component{constructor(t){super(t),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorWillDestroy=this.handleEditorWillDestroy.bind(this),this.handleRun=this.handleRun.bind(this),this.handleRunSelected=this.handleRunSelected.bind(this),this.updateShortcuts=this.updateShortcuts.bind(this),this.contextActionCleanups=[],this.editorComponent=Fe.createRef(),this.state={model:null}}componentDidMount(){Ve.addEventListener("onUpdate",this.updateShortcuts)}componentDidUpdate(t){var d,u;const{sessionLanguage:n,settings:s}=this.props,o=s==null?void 0:s.language;o!==((d=t.settings)==null?void 0:d.language)&&(bt.debug("Set language",o),this.setLanguage(o));const r=n==null&&t.sessionLanguage!=null,l=o===n,a=((u=t.settings)==null?void 0:u.language)===t.sessionLanguage;(r||n!==void 0&&a&&!l)&&(bt.debug("De-init completion and context actions"),this.deInitContextActions(),this.deInitCodeCompletion()),(n!=null&&t.sessionLanguage==null&&l||n!==void 0&&!a&&l)&&(bt.debug("Init completion and context actions"),this.initContextActions(),this.initCodeCompletion())}componentWillUnmount(){Ve.removeEventListener("onUpdate",this.updateShortcuts)}getValue(){return this.editor?this.editor.getValue():(bt.error("Editor not initialized"),null)}getSelectedCommand(){var c,d;const t=(c=this.editor)==null?void 0:c.getSelection();M(t);const n=(d=this.editor)==null?void 0:d.getModel();M(n);const{startLineNumber:s,endColumn:o}=t;let{endLineNumber:i}=t;o===1&&i>s&&(i-=1);const r=n==null?void 0:n.getLineMinColumn(s),l=n==null?void 0:n.getLineMaxColumn(i),a=t.setStartPosition(s,r).setEndPosition(i,l);return n==null?void 0:n.getValueInRange(a)}handleEditorInitialized(t){const{focusOnMount:n,onChange:s,onEditorInitialized:o,settings:i,session:r,sessionLanguage:l}=this.props;bt.debug("handleEditorInitialized",l,r,i),this.editor=t,this.setState({model:this.editor.getModel()}),He.setEOL(t),He.registerPasteHandler(t),r!=null&&i&&l===i.language&&(this.initContextActions(),this.initCodeCompletion()),t.onDidChangeModelContent(s),n!=null&&n&&t.focus(),o(this.editor)}handleEditorWillDestroy(t){bt.debug("handleEditorWillDestroy");const{onEditorWillDestroy:n}=this.props;n(t),this.deInitContextActions(),this.deInitCodeCompletion(),this.setState({model:null}),this.editor=void 0}handleRun(){const{onRunCommand:t}=this.props,n=this.getValue();n!=null&&t(n)}handleRunSelected(){const{onRunCommand:t}=this.props,n=this.getSelectedCommand();t(n)}initContextActions(){if(this.contextActionCleanups.length>0){bt.error("Context actions already initialized.");return}if(!this.editor)return;const t=[];t.push(this.editor.addAction({id:"run-code",label:"Run",keybindings:[He.getMonacoKeyCodeFromShortcut(Jn.NOTEBOOK.RUN)],contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:()=>{this.handleRun()}})),t.push(this.editor.addAction({id:"run-selected-code",label:"Run Selected",keybindings:[He.getMonacoKeyCodeFromShortcut(Jn.NOTEBOOK.RUN_SELECTED)],contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:()=>{this.handleRunSelected()}})),this.contextActionCleanups=t}deInitContextActions(){this.contextActionCleanups.length>0&&(this.contextActionCleanups.forEach(t=>t.dispose()),this.contextActionCleanups=[])}updateShortcuts(){this.deInitContextActions(),this.initContextActions()}initCodeCompletion(){if(this.completionCleanup!=null){bt.error("Code completion already initialized.");return}const{session:t}=this.props;bt.debug("initCodeCompletion",this.editor,t),this.editor&&t!=null&&(this.completionCleanup=He.openDocument(this.editor,t))}deInitCodeCompletion(){const{session:t}=this.props;bt.debug("deInitCodeCompletion",this.editor,t),this.completionCleanup&&(this.completionCleanup.dispose(),this.completionCleanup=void 0,this.editor&&t!=null&&He.closeDocument(this.editor,t))}append(t,n=!0){M(this.editor);const s=this.editor.getModel();M(s);const o=s.getValue();o?s.setValue(`${o}
22
- ${t}`):s.setValue(`${t}`);const i=s.getLineCount(),r=s.getLineLength(i)+1;this.editor.setPosition({lineNumber:i,column:r}),n&&this.editor.focus()}updateDimensions(){bt.debug("updateDimensions"),this.editor&&this.editor.layout()}focus(){bt.debug("focus"),this.editor&&this.editor.focus()}toggleFind(){this.editorComponent.current&&this.editorComponent.current.toggleFind()}setLanguage(t){this.editorComponent.current&&t!==void 0&&this.editorComponent.current.setLanguage(t)}render(){var u;const{error:t,isLoaded:n,isLoading:s,session:o,sessionLanguage:i,settings:r}=this.props,{model:l}=this.state,a=t?`Unable to open document. ${t}`:null,c=r&&(u=r.language)!=null?u:null,d=l&&o&&c===i;return y(Oe,{children:[(t||s)&&m("div",{className:"h-100 w-100 position-relative",children:m(ml,{errorMessage:a,isLoading:s,isLoaded:n})}),n&&m("div",{className:"h-100 w-100 script-editor",children:r&&y(Oe,{children:[m(or,{ref:this.editorComponent,settings:r,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy}),d!=null&&d&&m(ea,{model:l,language:c,session:o})]})})]})}}sg.defaultProps={error:null,isLoading:!1,isLoaded:!1,focusOnMount:!0,onChange:()=>{},onEditorInitialized:()=>{},onEditorWillDestroy:()=>{},session:null};const og=250,ig=2500,aa=class extends F.exports.Component{constructor(e){super(e),this.loadData=vt(()=>{const{commandHistoryStorage:t,item:n,language:s}=this.props,{id:o}=n;this.cleanup=t.listenItem(s,o,this.handleUpdate,this.handleError)},og),this.getPreviewText=be(t=>t.split(`
23
- `,ig).join(`
24
- `),{max:1}),this.handleUpdate=this.handleUpdate.bind(this),this.handleError=this.handleError.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.state={currentTime:Date.now()}}static getTimeString(e,t){if(e==null||t===""||t===0)return null;const n=Math.round((new Date(t).valueOf()-new Date(e).valueOf())/1e3);return n<1?"<1s":Bi.formatElapsedTime(n)}componentDidMount(){this.loadData()}componentDidUpdate(e,t){var s;const{data:n}=this.state;this.timer==null&&!(n!=null&&n.result)&&Boolean(n==null?void 0:n.startTime)&&!(n==null||n.endTime===void 0)?this.startTimer():((n==null?void 0:n.result)&&!((s=t.data)!=null&&s.result)||Boolean(n==null?void 0:n.endTime)&&!(t.data==null||t.data.endTime===void 0))&&this.stopTimer()}componentWillUnmount(){this.loadData.cancel(),this.cleanup!=null&&this.cleanup(),this.stopTimer()}startTimer(){this.stopTimer(),this.timer=setInterval(this.handleTimeout,1e3)}stopTimer(){this.timer&&(clearInterval(this.timer),this.timer=void 0)}updateTime(){this.setState({currentTime:Date.now()})}handleError(e){this.setState({error:`${e}`})}handleUpdate(e){const{data:t}=e!=null?e:{};this.setState({data:t});const{onUpdate:n}=this.props;n==null||n(t)}handleTimeout(){this.updateTime()}render(){var h;const{item:{name:e},language:t}=this.props,{currentTime:n,data:s,error:o}=this.state,{result:i,startTime:r,endTime:l}=s!=null?s:{},a=(h=i==null?void 0:i.error)!=null?h:o,c=aa.getTimeString(r,l!=null?l:n),d=this.getPreviewText(e),u=Boolean(c);return y("div",{className:"command-history-item-tooltip",children:[y("div",{className:"scroll-container",children:[m(Xl,{language:t,children:d}),d.length<e.length&&m("p",{children:"Preview Truncated..."})]}),y("div",{className:"result-info",children:[y("div",{className:"d-flex justify-content-between",children:[Boolean(a)&&y("div",{className:"text-danger mr-1",children:[m(te,{icon:Kn})," Executed with errors"]}),y("div",{className:"time-wrapper",children:["Elapsed time:"," ",u?m("span",{className:"time-string",children:c}):m(dn,{})]})]}),Boolean(a)&&m("div",{className:"error-message",children:a})]})]})}};let ca=aa;ca.defaultProps={onUpdate:()=>{}};const rg=512;function da(e){const{item:t,language:n,isSelected:s,commandHistoryStorage:o}=e,i=t.name.substring(0,rg),r=F.exports.useRef(null),l=F.exports.useCallback(()=>{var a;(a=r.current)==null||a.update()},[r]);return y("div",{className:ee("command-history-item",{selected:s}),children:[i,m(Rt,{ref:r,interactive:!0,options:{placement:"left",modifiers:{preventOverflow:{enabled:!0,boundariesElement:"viewport",order:825}}},popperClassName:"command-history-item-popper",children:m(ca,{item:t,language:n,onUpdate:l,commandHistoryStorage:o})})]})}da.defaultProps={isSelected:!1};class Wo extends F.exports.Component{static itemKey(t,n){return`${n.title}`}static renderContent(t){return t.selectionRequired!==void 0&&t.selectionRequired?y("div",{className:"fa-md fa-layers",children:[m(te,{icon:qo,mask:t.icon,transform:"right-5 down-5 shrink-4"}),m(te,{icon:gc,transform:"shrink-3 right-7 down-6"})]}):m(te,{icon:t.icon})}render(){const{actions:t,hasSelection:n}=this.props;return m("div",{className:"command-history-actions",children:t.map((s,o)=>m(z,{kind:"inline",className:ee(s.className),onClick:s.action,tooltip:s.description,disabled:s.selectionRequired!==void 0&&s.selectionRequired&&!n,icon:Wo.renderContent(s)},Wo.itemKey(o,s)))})}}const lg=150,Zr=3,Jr=ie.module("CommandHistoryViewportUpdater");function ag({table:e,columns:t,top:n=0,bottom:s=0,search:o,isReversed:i=!1,onUpdate:r}){const l=F.exports.useMemo(()=>Pn(a=>{const c=a.bottom-a.top,d=Math.max(0,a.top-c*Zr),u=a.bottom+c*Zr;e.setViewport({top:d,bottom:u,columns:a.columns})},lg),[e]);return F.exports.useEffect(function(){const c=e.onUpdate(d=>{var u,h;r({items:(u=d.items)!=null?u:[],offset:(h=d.offset)!=null?h:0})});return()=>{Jr.debug("onUpdate cleanup"),c()}},[e,r]),F.exports.useEffect(function(){e.setSearch(o!=null?o:"")},[e,o]),F.exports.useEffect(function(){l({top:n,bottom:s,columns:t})},[l,n,s,t,o,i]),F.exports.useEffect(()=>()=>{Jr.debug2("Cancel throttledUpdateViewport"),l.cancel()},[l]),null}const En=ie.module("CommandHistory"),nn=class extends F.exports.Component{constructor(e){super(e),this.copySelectedCommands=this.copySelectedCommands.bind(this),this.createNotebook=this.createNotebook.bind(this),this.sendToConsole=this.sendToConsole.bind(this),this.renderItem=this.renderItem.bind(this),this.runInConsole=this.runInConsole.bind(this),this.sendToNotebook=this.sendToNotebook.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleSelectionChange=this.handleSelectionChange.bind(this),this.handleSearchChange=this.handleSearchChange.bind(this),this.handleViewportChange=this.handleViewportChange.bind(this),this.handleViewportUpdate=this.handleViewportUpdate.bind(this),this.itemActions=[{title:"Copy Selection",description:"Copy selected commands to clipboard",icon:pc,shortcut:Li.COPY,action:this.copySelectedCommands,group:se.groups.edit},{title:"Send to Console",description:"Open selected commands in the console",icon:Sr,shortcut:Jn.COMMAND_HISTORY.SEND_TO_CONSOLE,action:this.sendToConsole,group:nn.menuGroups.send,order:10},{title:"Run in Console",description:"Run selected commands in the console",icon:fc,shortcut:Jn.COMMAND_HISTORY.RUN,action:this.runInConsole,group:nn.menuGroups.send,order:10},{title:"Send to Active Notebook",description:"Open selected commands in a notebook",icon:br,shortcut:Jn.COMMAND_HISTORY.SEND_TO_NOTEBOOK,action:this.sendToNotebook,group:nn.menuGroups.send,order:20},{title:"Send to New Notebook",description:"Open selected commands in a new notebook",icon:Cc,action:this.createNotebook,group:nn.menuGroups.send,order:30}],this.historyActions=[{title:"Send to Console",icon:Sr,selectionRequired:!0,description:"Open selected commands in the console",action:this.sendToConsole},{title:"Send to Notebook",icon:br,selectionRequired:!0,description:"Open selected commands in a notebook",action:this.sendToNotebook}],this.pending=new Xo,this.searchInputRef=Fe.createRef(),this.itemListRef=Fe.createRef();const{table:t}=e;this.state={actions:[],historyActions:this.historyActions,top:0,bottom:0,itemCount:t.size,items:[],offset:0,selectedRanges:[],searchText:""}}static getCommandsFromViewport(e,t,n){const s=[];for(let o=0;o<n.length;o+=1){const i=n[o];for(let r=i[0];r<=i[1];r+=1)if(r>=t&&r<t+e.length){const{name:l}=e[r-t];s.push(l)}}return s}static async getCommandsFromSnapshot(e,t){return[...(await e.getSnapshot(t)).values()].map(s=>s.name)}componentWillUnmount(){this.pending.cancel()}async getSelectedCommands(){const{items:e,offset:t,selectedRanges:n}=this.state,s=n.slice().sort((i,r)=>i[0]-r[0]);if(s.length===0)return[];if(s[0][0]>=t&&s[s.length-1][1]<t+e.length)return nn.getCommandsFromViewport(e,t,s);const{table:o}=this.props;return this.pending.add(nn.getCommandsFromSnapshot(o,s))}getSelectedCommandText(){return this.getSelectedCommands().then(e=>e.join(`
25
- `))}updateActions(){this.setState(e=>{const{selectedRanges:t}=e,n=t.reduce((s,o)=>s+o[1]-o[0]+1,0);return n>0&&n<nn.MAX_SELECTION_COUNT?(En.debug("Updating actions",this.itemActions),{actions:this.itemActions}):(En.debug("Disabling actions",n),{actions:[]})})}copySelectedCommands(){this.getSelectedCommandText().then(zo).catch(En.error)}createNotebook(){this.getSelectedCommandText().then(e=>{const{language:t,sendToNotebook:n}=this.props;n({value:e,language:t},!0)}).catch(En.error)}sendToNotebook(){this.getSelectedCommandText().then(e=>{const{language:t,sendToNotebook:n}=this.props;n({value:e,language:t})}).catch(En.error)}sendToConsole(){const{sendToConsole:e}=this.props;this.getSelectedCommandText().then(e).catch(En.error)}runInConsole(){this.getSelectedCommandText().then(e=>{const{sendToConsole:t}=this.props;t(e,!0,!0)}).catch(En.error)}handleSelect(e){const{sendToConsole:t}=this.props,{items:n,offset:s}=this.state;if(e<s||e>=s+n.length){En.error("Invalid index!",e);return}const{name:o}=n[e-s];t(o)}handleSelectionChange(e){this.setState({selectedRanges:e}),this.updateActions()}handleViewportChange(e,t){this.setState({top:e,bottom:t})}handleSearchChange(e){this.setState({searchText:e.target.value,selectedRanges:[]})}handleViewportUpdate({items:e,offset:t}){const{table:n}=this.props,s=n.size;this.setState({items:e,itemCount:s,offset:t})}renderItem({item:e,itemIndex:t,isSelected:n}){const{language:s,commandHistoryStorage:o}=this.props;return m(da,{isSelected:n,item:e,language:s,commandHistoryStorage:o})}focus(){this.searchInputRef.current&&this.searchInputRef.current.focus()}restoreScrollPosition(){var e;(e=this.itemListRef.current)==null||e.restoreScrollPosition()}render(){var h;const{language:e,table:t}=this.props,{actions:n,historyActions:s,searchText:o,top:i,bottom:r,items:l,itemCount:a,offset:c,selectedRanges:d}=this.state,u=(h=fm.LANGUAGE_MAP.get(e))!=null?h:"";return y("div",{className:"command-history",children:[y("div",{className:"command-history-search-bar",children:[m(Xs,{ref:this.searchInputRef,value:o,placeholder:`${u} Command History`,onChange:this.handleSearchChange}),m(Wo,{actions:s,hasSelection:d.length>0})]}),y("div",{className:"command-history-list",children:[m(xo,{ref:this.itemListRef,itemCount:a,items:l,offset:c,selectedRanges:d,onSelect:this.handleSelect,onSelectionChange:this.handleSelectionChange,onViewportChange:this.handleViewportChange,renderItem:this.renderItem,rowHeight:nn.ITEM_HEIGHT,isDoubleClickSelect:!0,isMultiSelect:!0,isStickyBottom:!0}),m(ag,{table:t,top:i,bottom:r,search:o,onUpdate:this.handleViewportUpdate}),m(se,{actions:n})]})]})}};let ir=nn;ir.ITEM_HEIGHT=29;ir.MAX_SELECTION_COUNT=1e4;ir.menuGroups={send:se.groups.medium+100};class cg extends F.exports.PureComponent{constructor(t){super(t),this.handleSwitchClick=this.handleSwitchClick.bind(this)}handleSwitchClick(){const{logLevel:t,onClick:n}=this.props;n(t)}render(){const{logLevel:t,on:n}=this.props;return y("div",{className:ee("log-level-menu-item",t),children:[m(pl,{on:n,onClick:this.handleSwitchClick}),t]})}}const ot=class extends F.exports.PureComponent{constructor(e){super(e),this.handleClearClick=this.handleClearClick.bind(this),this.handleFlushTimeout=this.handleFlushTimeout.bind(this),this.handleLogMessage=this.handleLogMessage.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleResetClick=this.handleResetClick.bind(this),this.handleResize=this.handleResize.bind(this),this.handleToggleAllClick=this.handleToggleAllClick.bind(this),this.logLevelMenuItems={},this.editorContainer=null,this.bufferedMessages=[],this.messages=[],this.state={shownLogLevels:{}}}static getLogText(e){const t=new Date(e.micros/1e3);return`${Es.formatTimestamp(t)} ${e.logLevel} ${e.message}`}componentDidMount(){this.resetLogLevels(),this.initMonaco(),this.startListening(),window.addEventListener("resize",this.handleResize)}componentDidUpdate(e,t){this.updateDimensions();const{shownLogLevels:n}=this.state;t.shownLogLevels!==n&&this.refreshLogText();const{session:s}=this.props;e.session!==s&&(this.stopListening(),this.startListening(),this.clearLogs())}componentWillUnmount(){this.stopFlushTimer(),this.stopListening(),this.destroyMonaco(),window.removeEventListener("resize",this.handleResize)}getMenuActions(e){const t=[];t.push({menuElement:m("div",{className:"log-level-menu-title",children:"Display Log Levels"}),group:1,order:10});for(let n=0;n<ot.AllLogLevels.length;n+=1){const s=ot.AllLogLevels[n],o=e[s]!=null?e[s]:!1;t.push({title:s,group:1,order:n+100,menuElement:m(cg,{logLevel:s,on:o,onClick:this.handleMenuItemClick,ref:i=>{i!=null&&(this.logLevelMenuItems[s]=i)}})})}return t.push({group:1,order:1e3,menuElement:y("div",{className:"log-level-menu-controls",children:[m(z,{kind:"ghost",className:"log-level-toggle-all",onClick:this.handleToggleAllClick,children:"Toggle All"}),m(z,{kind:"ghost",onClick:this.handleResetClick,children:"Reset"})]})}),t}resetLogLevels(){const e={};for(let t=0;t<ot.AllLogLevels.length;t+=1){const n=ot.AllLogLevels[t],s=ot.DefaultLogLevels.some(o=>o===n);e[n]=s}this.setState({shownLogLevels:e})}startListening(){const{session:e}=this.props;this.cancelListener=e.onLogMessage(this.handleLogMessage)}stopListening(){this.cancelListener!=null&&(this.cancelListener(),this.cancelListener=void 0)}initMonaco(){M(this.editorContainer),this.editor=an.create(this.editorContainer,{copyWithSyntaxHighlighting:!1,fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"log",lineDecorationsWidth:0,lineNumbers:"off",lineNumbersMinChars:0,minimap:{enabled:!1},readOnly:!0,renderLineHighlight:"none",scrollBeyondLastLine:!1,value:"",wordWrap:"on"}),this.editor.addCommand(Mn.Escape,()=>{}),this.editor.addCommand(Et.Shift|Mn.Escape,()=>{}),this.editor.addCommand(Mn.Escape,()=>{var t,n;const e=(t=this.editor)==null?void 0:t.getPosition();M(e),(n=this.editor)==null||n.setPosition(e)},"findWidgetVisible && editorTextFocus"),this.editor.addCommand(Et.Shift|Mn.Escape,()=>{var t,n;const e=(t=this.editor)==null?void 0:t.getPosition();M(e),(n=this.editor)==null||n.setPosition(e)},"findWidgetVisible && editorTextFocus")}destroyMonaco(){this.editor&&(this.editor.dispose(),this.editor=void 0)}triggerFindWidget(){var e,t;(e=this.editor)==null||e.focus(),(t=this.editor)==null||t.trigger("keyboard","actions.find",void 0)}toggleAll(){const{shownLogLevels:e}=this.state;let t=!0;for(let n=0;n<ot.AllLogLevels.length;n+=1){const s=ot.AllLogLevels[n];if(!e[s]){t=!1;break}}if(t)this.setState({shownLogLevels:{}});else{const n={};for(let s=0;s<ot.AllLogLevels.length;s+=1){const o=ot.AllLogLevels[s];n[o]=!0}this.setState({shownLogLevels:n})}}toggleLogLevel(e){const{shownLogLevels:t}=this.state,n=t[e],s={};s[e]=!n,this.updateLogLevels(s)}updateLogLevels(e){let{shownLogLevels:t}=this.state;t={...t,...e},this.setState({shownLogLevels:t})}appendLogText(e){if(!this.editor)return;const t=this.editor.getModel();let n=t==null?void 0:t.getLineCount();M(n);let s=t==null?void 0:t.getLineLength(n);M(s);const o=this.isBottomVisible(),i=[];if(s>0&&(i.push({range:{startLineNumber:n,startColumn:s+1,endLineNumber:n,endColumn:s+1},text:`
21
+ `,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!1,nullString:null},COLON_SV:{name:": colon sv",delimiter:":",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},SEMI_COLON_SV:{name:"; semi-colon sv",delimiter:";",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},PIPE_SV:{name:"| pipe separated (psv)",delimiter:"|",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},SPACE_SV:{name:'" " space sv',delimiter:" ",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},AUTODETECT:{name:"autodetect",delimiter:void 0,newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"}});const Kr=ie.module("CsvInputBar"),sg=Object.entries(xn.TYPES).map(([e,t])=>m("option",{value:e,children:t.name},e));class ra extends F.exports.Component{constructor(t){super(t),this.handleUpload=this.handleUpload.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleError=this.handleError.bind(this),this.handleTableName=this.handleTableName.bind(this),this.toggleFirstRowHeaders=this.toggleFirstRowHeaders.bind(this),this.handleProgress=this.handleProgress.bind(this),this.handleCancelInProgress=this.handleCancelInProgress.bind(this),this.handleQueryTypeChange=this.handleQueryTypeChange.bind(this),this.inputRef=Fe.createRef(),this.state={tableName:"",tableNameSet:!1,isFirstRowHeaders:!0,showProgress:!1,progressValue:0,type:xn.DEFAULT_TYPE,parser:null}}componentDidUpdate(t){var r;const{file:n,paste:s}=this.props,{tableName:o,tableNameSet:i}=this.state;if(!i&&n!=null&&!o){const l=n.name.lastIndexOf("."),a=Ys.legalizeTableName(n.name.substring(0,l));this.setState({tableName:a,tableNameSet:!0}),(r=this.inputRef.current)==null||r.focus()}else(n==null&&t.file!=null||s==null&&t.paste!=null)&&this.setState({tableName:"",tableNameSet:!1});s!=null&&s!==""&&!o&&this.inputRef.current&&this.inputRef.current.focus(),n!=null&&n!==t.file?this.setState({type:xn.fromExtension(n.name)}):s!=null&&s!==""&&(t.paste===void 0||t.paste==="")&&this.setState({type:xn.AUTO})}componentWillUnmount(){const{parser:t}=this.state;t&&t.cancel()}handleCancel(){const{onClose:t}=this.props;t()}handleError(t){const{onClose:n,onError:s}=this.props;Kr.error(t),s(t),n()}handleTableName(t){this.setState({tableName:t.target.value,tableNameSet:!0})}toggleFirstRowHeaders(){const{isFirstRowHeaders:t}=this.state;this.setState({isFirstRowHeaders:!t})}handleUpload(t){t.stopPropagation(),t.preventDefault();const{file:n,paste:s}=this.props;n!=null?n.name.endsWith(".zip")?this.handleZipFile(n):this.handleFile(n):s!==void 0&&s!==""&&this.handleFile(new Blob([s],{type:"text/plain"}))}handleFile(t,n=!1){Kr.info(`Starting CSV parser for ${t instanceof File?t.name:"pasted values"} ${n?"":t.size} bytes`);const{session:s,timeZone:o,onInProgress:i}=this.props,{tableName:r,isFirstRowHeaders:l,type:a}=this.state,c=u=>{u.length===1?s.bindTableToVariable(u[0],r).then(()=>this.openTable()).catch(h=>this.handleError(h)):s.mergeTables(u).then(h=>{s.bindTableToVariable(h,r).then(()=>this.openTable()).catch(g=>this.handleError(g)),u.forEach(g=>g.close())}).catch(h=>this.handleError(h))},d=new ia({onFileCompleted:c,session:s,file:t,type:xn.TYPES[a],readHeaders:l,onProgress:this.handleProgress,onError:this.handleError,timeZone:o,isZip:n});d.parse(),this.setState({showProgress:!0,parser:d}),i(!0)}handleZipFile(t){const{onUpdate:n,unzip:s}=this.props;if(s==null){this.handleError(new Error("No support for zip files available."));return}s(t).then(o=>{let i=!1;for(let r=0;r<o.length;r+=1){const l=o[r];if(rn.isValidExtension(l.name)){n(`Loading ${l.name} as csv from ${t.name}`),i=!0,this.handleFile(l,!0);break}}if(!i)throw new Error(`No csv file found in ${t.name}`)}).catch(o=>this.handleError(o))}handleProgress(t){const{showProgress:n}=this.state;return n&&this.setState({progressValue:t}),!n}handleCancelInProgress(){const{onInProgress:t}=this.props,{parser:n}=this.state;n&&n.cancel(),this.setState({showProgress:!1,progressValue:0}),t(!1)}openTable(){const{onOpenTable:t,onClose:n}=this.props,{tableName:s}=this.state;t(s),n()}handleQueryTypeChange(t){this.setState({type:t.target.value})}render(){const{file:t,paste:n}=this.props,{tableName:s,isFirstRowHeaders:o,showProgress:i,progressValue:r,type:l}=this.state,a=Boolean(n)&&!s;return y("div",{className:"csv-input-bar",children:[!i&&y("form",{onSubmit:this.handleUpload,className:"csv-input-bar-container form-inline",children:[y("div",{className:"form-group",children:[m("label",{htmlFor:"tableNameInput",children:"Table name"}),m("input",{ref:this.inputRef,id:"tableNameInput",type:"text",className:ee("form-control",{"is-invalid":a}),value:s,onChange:this.handleTableName})]}),y("div",{className:"form-group",children:[m("label",{htmlFor:"formatSelect",children:"File format"}),m("select",{id:"formatSelect",className:"custom-select",value:l,onChange:this.handleQueryTypeChange,children:sg})]}),m(ln,{className:"firstRowHeaders",checked:o,onChange:this.toggleFirstRowHeaders,children:"First row is column headers"}),y("div",{className:"csv-input-buttons form-group",children:[m(z,{kind:"secondary",onClick:this.handleCancel,children:"Cancel"}),m(z,{kind:"primary",type:"submit",disabled:!(t!==null||n!==void 0&&n!=="")||!s,children:"Upload"})]})]}),i&&y("div",{className:"csv-progress-container",children:[m("label",{children:"Uploading Table"}),m("div",{className:"progress",children:m("div",{className:"progress-bar bg-primary",style:{width:`${r}%`},"aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100})}),y("label",{children:[r,"%"]}),m(z,{kind:"primary",onClick:this.handleCancelInProgress,children:"Cancel"})]})]})}}ra.defaultProps={file:null,paste:null,unzip:null};const Qr=ie.module("ConsoleMenu");class Go extends F.exports.PureComponent{constructor(t){super(t),this.makeTableActions=Re((n,s,o)=>{const i=n.filter(r=>Es.isTableType(r.type));return Go.makeItemActions(i,s,r=>{this.tableSearchField=r},this.handleTableFilterChange,o)}),this.makeWidgetActions=Re((n,s,o)=>{const i=n.filter(r=>Es.isWidgetType(r.type));return Go.makeItemActions(i,s,r=>{this.widgetSearchField=r},this.handleWidgetFilterChange,o)}),this.handleTableFilterChange=this.handleTableFilterChange.bind(this),this.handleTableMenuClosed=this.handleTableMenuClosed.bind(this),this.handleTableMenuOpened=this.handleTableMenuOpened.bind(this),this.handleWidgetFilterChange=this.handleWidgetFilterChange.bind(this),this.handleWidgetMenuClosed=this.handleWidgetMenuClosed.bind(this),this.handleWidgetMenuOpened=this.handleWidgetMenuOpened.bind(this),this.state={tableFilterText:"",widgetFilterText:""}}static makeItemActions(t,n,s,o,i){if(t.length===0)return[];const r={menuElement:m(Xs,{value:n,onChange:o,className:"console-menu",ref:s})};let l=t;n&&(l=l.filter(({title:c})=>c!=null&&c.toLowerCase().indexOf(n.toLowerCase())>=0));const a=l.map(c=>({title:c.title,action:()=>{i(c)}}));return[r,...a]}handleTableFilterChange(t){Qr.debug("filtering tables..."),this.setState({tableFilterText:t.target.value})}handleTableMenuClosed(){this.setState({tableFilterText:""})}handleTableMenuOpened(){var t;(t=this.tableSearchField)==null||t.focus()}handleWidgetFilterChange(t){Qr.debug("filtering widgets..."),this.setState({widgetFilterText:t.target.value})}handleWidgetMenuClosed(){this.setState({widgetFilterText:""})}handleWidgetMenuOpened(){var t;(t=this.widgetSearchField)==null||t.focus()}render(){const{overflowActions:t,objects:n,openObject:s}=this.props,{tableFilterText:o,widgetFilterText:i}=this.state,r=this.makeTableActions(n,o,s),l=this.makeWidgetActions(n,i,s),a={placement:"bottom-end"},c=r.length===0,d=l.length===0;return y("div",{className:"console-pane-menu",children:[y(z,{kind:"ghost",className:"btn-link-icon",disabled:c,onClick:()=>{},tooltip:c?"No tables available":"Tables",children:[y("div",{className:"fa-md fa-layers",children:[m(te,{mask:Vi,icon:Xn,transform:"right-5 down-5"}),m(te,{icon:Xn,transform:"right-8 down-6"})]}),m(Ss,{actions:r,onMenuOpened:this.handleTableMenuOpened,onMenuClosed:this.handleTableMenuClosed,options:{initialKeyboardIndex:1},popperOptions:a},"table-actions ")]}),y(z,{kind:"ghost",className:"btn-link-icon",disabled:l.length===0,onClick:()=>{},tooltip:d?"No widgets available":"Widgets",children:[y("div",{className:"fa-md fa-layers",children:[m(te,{mask:hl,icon:Xn,transform:"right-5 down-5"}),m(te,{icon:Xn,transform:"right-8 down-6"})]}),m(Ss,{actions:l,onMenuOpened:this.handleWidgetMenuOpened,onMenuClosed:this.handleWidgetMenuClosed,options:{initialKeyboardIndex:1},popperOptions:a},"table-actions")]}),m(z,{kind:"ghost",className:"btn-overflow btn-link-icon",icon:gc,tooltip:"More Actions...",onClick:()=>{},children:m(Ss,{actions:t,popperOptions:a})})]})}}class la extends F.exports.PureComponent{constructor(t){super(t),this.handleCommandStarted=this.handleCommandStarted.bind(this),this.handleCommandCompleted=this.handleCommandCompleted.bind(this),this.pending=new Xo,this.state={isDisconnected:!1,isCommandRunning:!1}}componentDidMount(){this.startListening()}componentWillUnmount(){this.stopListening(),this.cancelPendingPromises()}startListening(){const{session:t}=this.props;t.addEventListener(E.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted)}stopListening(){const{session:t}=this.props;t.removeEventListener(E.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted)}cancelPendingPromises(){this.pending.cancel()}handleCommandStarted(t){const{result:n}=t.detail;this.pending.add(n).then(()=>this.handleCommandCompleted(null)).catch(s=>this.handleCommandCompleted(s)),this.setState({isCommandRunning:!0})}handleCommandCompleted(t){t instanceof xi||this.setState({isCommandRunning:this.pending.pending.length>0})}render(){const{children:t,openObject:n,overflowActions:s,objects:o}=this.props,{isDisconnected:i,isCommandRunning:r}=this.state;let l=null,a=null;return i?(l="console-status-icon-disconnected",a="Worker is disconnected"):r?(l="console-status-icon-pending",a="Worker is busy"):(l="console-status-icon-idle",a="Worker is idle"),y("div",{className:"console-pane-status-bar",children:[y("div",{children:[m("div",{className:ee("console-status-icon",l)}),m(Rt,{children:a})]}),t,m(Go,{overflowActions:s,openObject:n,objects:o})]})}}la.defaultProps={children:null};const Jt=ie.module("Console"),jr={isAutoLaunchPanelsEnabled:!0,isPrintStdOutEnabled:!0,isClosePanelsOnDisconnectEnabled:!0},Gs=class extends F.exports.PureComponent{constructor(e){super(e),this.processLogMessageQueue=Pn(()=>{this.scrollConsoleHistoryToBottom(),this.setState(s=>{Jt.debug2("processLogMessageQueue",this.queuedLogMessages.length," items");let{consoleHistory:o}=s;return o=o.concat(this.queuedLogMessages),this.queuedLogMessages=[],{consoleHistory:o}})},Gs.LOG_THROTTLE),this.getObjects=Re(s=>[...s.values()]),this.getContextActions=Re(s=>[...s,{action:this.handleClearShortcut,shortcut:es.CONSOLE.CLEAR},{action:this.handleFocusHistory,shortcut:es.CONSOLE.FOCUS_HISTORY}]),this.handleCommandResult=this.handleCommandResult.bind(this),this.handleCommandStarted=this.handleCommandStarted.bind(this),this.handleCommandSubmit=this.handleCommandSubmit.bind(this),this.handleClearShortcut=this.handleClearShortcut.bind(this),this.handleFocusHistory=this.handleFocusHistory.bind(this),this.handleLogMessage=this.handleLogMessage.bind(this),this.handleOverflowActions=this.handleOverflowActions.bind(this),this.handleScrollPaneScroll=this.handleScrollPaneScroll.bind(this),this.handleToggleAutoLaunchPanels=this.handleToggleAutoLaunchPanels.bind(this),this.handleToggleClosePanelsOnDisconnect=this.handleToggleClosePanelsOnDisconnect.bind(this),this.handleTogglePrintStdout=this.handleTogglePrintStdout.bind(this),this.handleUploadCsv=this.handleUploadCsv.bind(this),this.handleHideCsv=this.handleHideCsv.bind(this),this.handleCsvFileCanceled=this.handleCsvFileCanceled.bind(this),this.handleCsvFileOpened=this.handleCsvFileOpened.bind(this),this.handleCsvPaste=this.handleCsvPaste.bind(this),this.handleDragEnter=this.handleDragEnter.bind(this),this.handleDragLeave=this.handleDragLeave.bind(this),this.handleClearDragError=this.handleClearDragError.bind(this),this.handleOpenCsvTable=this.handleOpenCsvTable.bind(this),this.handleCsvUpdate=this.handleCsvUpdate.bind(this),this.handleCsvError=this.handleCsvError.bind(this),this.handleCsvInProgress=this.handleCsvInProgress.bind(this),this.consolePane=Fe.createRef(),this.consoleInput=Fe.createRef(),this.consoleHistoryScrollPane=Fe.createRef(),this.pending=new Xo,this.queuedLogMessages=[];const{objectMap:t,settings:n}=this.props;this.state={consoleHistory:[],consoleHeight:0,isScrollDecorationShown:!1,objectHistoryMap:new Map,objectMap:new Map(t),showCsvOverlay:!1,csvFile:null,csvPaste:null,dragError:null,csvUploadInProgress:!1,...jr,...n}}static isErrorLevel(e){return e===je.STDERR||e===je.ERROR||e===je.FATAL}static isOutputLevel(e){return e===je.STDOUT||Gs.isErrorLevel(e)}componentDidMount(){this.initConsoleLogging();const{session:e}=this.props;e.addEventListener(E.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted),this.updateDimensions()}componentDidUpdate(e,t){const{props:n,state:s}=this;this.sendSettingsChange(t,s),n.objectMap!==e.objectMap&&this.updateObjectMap()}componentWillUnmount(){const{session:e}=this.props;e.removeEventListener(E.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted),this.pending.cancel(),this.processLogMessageQueue.cancel(),this.deinitConsoleLogging()}initConsoleLogging(){const{session:e}=this.props;this.cancelListener=e.onLogMessage(this.handleLogMessage)}deinitConsoleLogging(){this.cancelListener!=null&&(this.cancelListener(),this.cancelListener=void 0)}handleClearShortcut(e){var t;e.preventDefault(),e.stopPropagation(),(t=this.consoleInput.current)==null||t.clear()}handleCommandStarted(e){const{code:t,result:n}=e.detail,s=this.pending.add(n),o={command:t,disabledObjects:[],startTime:Date.now(),cancelResult:()=>{n.cancel()},wrappedResult:s},{commandHistoryStorage:i,language:r,scope:l}=this.props,a=i.addItem(r,l,t,{command:t,startTime:new Date().toJSON()});a.catch(c=>{Jt.debug("Error adding workspace item",c)}),this.setState(c=>({consoleHistory:c.consoleHistory.concat(o)}),()=>{this.scrollConsoleHistoryToBottom(!0)}),s.then(c=>{this.handleCommandResult(c,o,a)}).catch(c=>{this.handleCommandError(c,o,a)})}handleCommandResult(e,t,n){const s={...t,wrappedResult:void 0,cancelResult:void 0,result:e!=null?e:t.result};this.setState(({consoleHistory:o})=>{const i=o.lastIndexOf(t);if(i<0)return Jt.error("historyItem not found in consoleHistory"),null;const r=o.concat();return r[i]=s,{consoleHistory:r}}),e&&(this.updateHistory(e,s),this.updateKnownObjects(s),this.updateWorkspaceHistoryItem({error:e.error},n),this.closeRemovedItems(e.changes),this.openUpdatedItems(e.changes))}handleCommandError(e,t,n){if(Ge.isCanceled(e)){Jt.debug("Called handleCommandError on a cancelled promise result");return}this.updateWorkspaceHistoryItem({error:`${e}`},n),this.setState(s=>{const o=s.consoleHistory.concat(),i=o.lastIndexOf(t),r={...t};return r.wrappedResult=void 0,r.cancelResult=void 0,r.endTime=Date.now(),r.result={error:e},o[i]=r,{consoleHistory:o}})}handleFocusHistory(e){e.preventDefault(),e.stopPropagation();const{focusCommandHistory:t}=this.props;t()}handleLogMessage(e){const{isPrintStdOutEnabled:t}=this.state;!t||Gs.isOutputLevel(e.logLevel)&&this.queueLogMessage(e.message,e.logLevel)}queueLogMessage(e,t){const n={};Gs.isErrorLevel(t)?n.error=e:n.message=e;const s={command:void 0,result:n};this.queuedLogMessages.push(s),this.processLogMessageQueue()}openUpdatedItems(e){const{isAutoLaunchPanelsEnabled:t}=this.state;if(e==null||!t)return;const{openObject:n}=this.props;[...e.created,...e.updated].forEach(s=>n(s))}closeRemovedItems(e){if(e==null||e.removed==null||e.removed.length===0)return;const{closeObject:t}=this.props,{removed:n}=e;n.forEach(s=>t(s))}updateHistory(e,t){const n=t;e==null||e.changes==null||n==null||(n.endTime=Date.now(),this.scrollConsoleHistoryToBottom(),this.setState(s=>({consoleHistory:s.consoleHistory.concat()})))}updateKnownObjects(e){let t;if(e.result&&(t=e.result.changes),!t||(t.created==null||t.created.length===0)&&(t.updated==null||t.updated.length===0)&&(t.removed==null||t.removed.length===0)){Jt.debug2("updateKnownObjects no changes");return}this.setState(n=>{let{consoleHistory:s}=n;const o=s.lastIndexOf(e);if(o<0)return Jt.error("historyItem not found in state.consoleHistory"),null;const i=new Map(n.objectHistoryMap),r=new Map(n.objectMap),l=(a,c=!1)=>{var h;const{title:d}=a;M(d);const u=i.get(d);if(u!=null&&u>=0){s===n.consoleHistory&&(s=s.concat());const g={...s[u],disabledObjects:[...(h=s[u].disabledObjects)!=null?h:[],d]};s[u]=g}i.set(d,o),c?r.delete(d):r.set(d,a)};return t==null||t.updated.forEach(a=>l(a)),t==null||t.removed.forEach(a=>l(a,!0)),t==null||t.created.forEach(a=>{const{title:c}=a;M(c),i.set(c,o),r.set(c,a)}),{objectHistoryMap:i,objectMap:r,consoleHistory:s}})}updateObjectMap(){const{objectMap:e}=this.props;this.setState({objectMap:e})}updateWorkspaceHistoryItem(e,t){const n=this.pending.add(t),s=new Date().toJSON();n.then(o=>{const i={...o,data:{...o.data,endTime:s,result:e}},{commandHistoryStorage:r,language:l}=this.props;r.updateItem(l,i).catch(a=>{Jt.warn("Error updating command history storage",a)})}).catch(o=>{Jt.debug("Error updating workspace history item",o)})}scrollConsoleHistoryToBottom(e=!1){const t=this.consoleHistoryScrollPane.current;M(t),!(!e&&t.scrollTop<t.scrollHeight-t.offsetHeight)&&window.requestAnimationFrame(()=>{t.scrollTop=t.scrollHeight})}handleScrollPaneScroll(){const e=this.consoleHistoryScrollPane.current;M(e),e.scrollTop>0&&e.scrollHeight>e.clientHeight?this.setState({isScrollDecorationShown:!0}):this.setState({isScrollDecorationShown:!1})}handleToggleAutoLaunchPanels(){this.setState(e=>({isAutoLaunchPanelsEnabled:!e.isAutoLaunchPanelsEnabled}))}handleToggleClosePanelsOnDisconnect(){this.setState(e=>({isClosePanelsOnDisconnectEnabled:!e.isClosePanelsOnDisconnectEnabled}))}handleTogglePrintStdout(){this.setState(e=>({isPrintStdOutEnabled:!e.isPrintStdOutEnabled}))}handleUploadCsv(){this.setState({showCsvOverlay:!0,dragError:null,csvUploadInProgress:!1})}handleHideCsv(){this.setState({showCsvOverlay:!1,csvFile:null,csvPaste:null,dragError:null,csvUploadInProgress:!1})}handleCsvFileCanceled(){this.setState({csvFile:null,csvPaste:null})}handleCsvFileOpened(e){this.setState({csvFile:e,csvPaste:null})}handleCsvPaste(e){this.setState({csvFile:null,csvPaste:e})}handleDragEnter(e){if(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0||e.dataTransfer.items[0].kind==="string")return;e.preventDefault(),e.stopPropagation(),this.setState({showCsvOverlay:!0});const{items:t}=e.dataTransfer;if(t.length>1){this.setState({dragError:rn.MULTIPLE_FILE_ERROR});return}const n=t[0];rn.isValidDropItem(n)?this.setState({dragError:null}):this.setState({dragError:rn.FILE_TYPE_ERROR})}handleDragLeave(e){e.currentTarget==null||e.currentTarget instanceof Element&&e.relatedTarget instanceof Element&&e.currentTarget.contains(e.relatedTarget)||(e.preventDefault(),e.stopPropagation(),this.setState({showCsvOverlay:!1,dragError:null}))}handleClearDragError(){this.setState({dragError:null})}handleOpenCsvTable(e){const{openObject:t,commandHistoryStorage:n,language:s,scope:o}=this.props,{consoleHistory:i,objectMap:r}=this.state,l={name:e,title:e,type:E.VariableType.TABLE},a=r.has(e),c={startTime:Date.now(),endTime:Date.now(),disabledObjects:[],result:{changes:{created:[],updated:[],removed:[],[a?"updated":"created"]:[l]}}},d=i.concat(c);this.setState({consoleHistory:d}),this.scrollConsoleHistoryToBottom(!0),this.updateKnownObjects(c),t({name:e,title:e,type:E.VariableType.TABLE}),n.addItem(s,o,e,{command:e,startTime:new Date().toJSON(),endTime:new Date().toJSON()})}addConsoleHistoryMessage(e,t){const{consoleHistory:n}=this.state,s={command:"",startTime:Date.now(),endTime:Date.now(),result:{message:e,error:t}},o=n.concat(s);this.setState({consoleHistory:o})}handleCsvUpdate(e){this.addConsoleHistoryMessage(e)}handleCsvError(e){this.addConsoleHistoryMessage(void 0,e!=null?`${e}`:void 0)}handleCsvInProgress(e){this.setState({csvUploadInProgress:e})}handleOverflowActions(){const{isAutoLaunchPanelsEnabled:e,isClosePanelsOnDisconnectEnabled:t,isPrintStdOutEnabled:n}=this.state,{actions:s}=this.props;return[...s,{title:"Print Stdout",action:this.handleTogglePrintStdout,group:se.groups.high,icon:n?jn:void 0,order:10},{title:"Auto Launch Panels",action:this.handleToggleAutoLaunchPanels,group:se.groups.high,icon:e?jn:void 0,order:20},{title:"Close Panels on Disconnect",action:this.handleToggleClosePanelsOnDisconnect,group:se.groups.high,icon:t?jn:void 0,order:30},{title:"Upload Table from File",action:this.handleUploadCsv,group:se.groups.high+10,order:40}]}handleCommandSubmit(e){if(e==="clear"||e==="cls")this.clearConsoleHistory();else if(e.length>0){const{session:t}=this.props;t.runCode(e).catch(n=>{Jt.error("There was an error initiating the command",n)})}else{const t={command:" ",result:{},startTime:Date.now(),endTime:Date.now()};this.scrollConsoleHistoryToBottom(!0),this.setState(n=>({consoleHistory:n.consoleHistory.concat(t)}))}}clearConsoleHistory(){this.pending.cancel(),this.setState(e=>{const t=new Map([...e.objectHistoryMap.keys()].map(n=>[n,-1]));return{consoleHistory:[],objectHistoryMap:t}})}addCommand(e,t=!0,n=!1){!this.consoleInput.current||(this.consoleInput.current.setConsoleText(e,t,n),t&&this.scrollConsoleHistoryToBottom(!0))}focus(){var e;(e=this.consoleInput.current)==null||e.focus()}sendSettingsChange(e,t,n=!0){const s=Object.keys(jr),o={};let i=!1;for(let l=0;l<s.length;l+=1){const a=s[l],{[a]:c}=t,{[a]:d}=e;c!==d&&(i=!0),o[a]=c}if(n&&!i)return;const{onSettingsChange:r}=this.props;r(o)}updateDimensions(){this.consolePane.current&&this.setState({consoleHeight:this.consolePane.current.clientHeight}),this.consoleInput.current&&this.consoleInput.current.updateDimensions()}render(){const{actions:e,historyChildren:t,language:n,statusBarChildren:s,openObject:o,session:i,scope:r,commandHistoryStorage:l,timeZone:a,disabled:c,unzip:d}=this.props,{consoleHeight:u,consoleHistory:h,isScrollDecorationShown:g,objectMap:p,showCsvOverlay:f,csvFile:C,csvPaste:w,dragError:S,csvUploadInProgress:T}=this.state,R=this.getObjects(p),b=Math.round(u*.7),v=this.getContextActions(e);return y("div",{role:"presentation",className:ee("iris-console","h-100","w-100",{disabled:c}),children:[y("div",{className:"console-pane",ref:this.consolePane,children:[m(la,{session:i,overflowActions:this.handleOverflowActions,openObject:o,objects:R,children:s}),y("div",{className:"console-csv-container",onDragOver:rn.handleDragOver,onDragEnter:this.handleDragEnter,onDragLeave:this.handleDragLeave,children:[f&&m(rn,{onCancel:this.handleCsvFileCanceled,onFileOpened:this.handleCsvFileOpened,onPaste:this.handleCsvPaste,clearDragError:this.handleClearDragError,dragError:S,onError:this.handleCsvError,uploadInProgress:T,allowZip:d!=null}),y("div",{role:"presentation",className:ee("scroll-pane no-scroll-x",{"scroll-decoration":g}),onScroll:this.handleScrollPaneScroll,ref:this.consoleHistoryScrollPane,children:[m(ea,{items:h,openObject:o,language:n,disabled:c}),t]})]}),!f&&m(Uo,{ref:this.consoleInput,session:i,language:n,scope:r,onSubmit:this.handleCommandSubmit,maxHeight:b,commandHistoryStorage:l}),f&&m(ra,{session:i,onOpenTable:this.handleOpenCsvTable,onClose:this.handleHideCsv,onUpdate:this.handleCsvUpdate,onError:this.handleCsvError,file:C!=null?C:void 0,paste:w!=null?w:void 0,onInProgress:this.handleCsvInProgress,timeZone:a,unzip:d})]}),m(se,{actions:v,ignoreClassNames:[Uo.INPUT_CLASS_NAME]})]})}};let aa=Gs;aa.defaultProps={statusBarChildren:null,settings:{},onSettingsChange:()=>{},scope:null,actions:[],historyChildren:null,timeZone:"America/New_York",objectMap:new Map,disabled:!1,unzip:null};aa.LOG_THROTTLE=500;class or extends F.exports.Component{constructor(t){super(t),this.handleResize=this.handleResize.bind(this),this.container=null,this.state={}}componentDidMount(){this.initEditor(),window.addEventListener("resize",this.handleResize)}componentWillUnmount(){window.removeEventListener("resize",this.handleResize),this.destroyEditor()}setLanguage(t){if(this.editor){const n=this.editor.getModel();M(n),an.setModelLanguage(n,t)}}handleResize(){this.updateDimensions()}toggleFind(){this.editor&&(this.editor.focus(),this.editor.trigger("toggleFind","actions.find",void 0))}updateDimensions(){var t;(t=this.editor)==null||t.layout()}initEditor(){const{onEditorInitialized:t}=this.props;let{settings:n}=this.props;n={copyWithSyntaxHighlighting:!1,fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"python",lineNumbersMinChars:3,minimap:{enabled:!1},scrollBeyondLastLine:!1,tabCompletion:"on",value:"",wordWrap:"off",...n},M(this.container),this.editor=an.create(this.container,n),this.editor.addAction({id:"find",label:"Find",keybindings:[Et.CtrlCmd|Mn.KeyF],precondition:void 0,keybindingContext:void 0,contextMenuGroupId:"navigation",contextMenuOrder:1,run:()=>{this.toggleFind()}}),this.editor.layout(),He.removeConflictingKeybindings(this.editor),t(this.editor)}destroyEditor(){const{onEditorWillDestroy:t}=this.props;M(this.editor),t(this.editor),this.editor.dispose(),this.editor=void 0}render(){const{className:t}=this.props;return m("div",{className:ee("editor-container",t),ref:n=>{this.container=n}})}}or.defaultProps={className:"fill-parent-absolute",onEditorInitialized:()=>{},onEditorWillDestroy:()=>{},settings:{}};const bt=ie.module("ScriptEditor");class og extends F.exports.Component{constructor(t){super(t),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorWillDestroy=this.handleEditorWillDestroy.bind(this),this.handleRun=this.handleRun.bind(this),this.handleRunSelected=this.handleRunSelected.bind(this),this.updateShortcuts=this.updateShortcuts.bind(this),this.contextActionCleanups=[],this.editorComponent=Fe.createRef(),this.state={model:null}}componentDidMount(){Ve.addEventListener("onUpdate",this.updateShortcuts)}componentDidUpdate(t){var d,u;const{sessionLanguage:n,settings:s}=this.props,o=s==null?void 0:s.language;o!==((d=t.settings)==null?void 0:d.language)&&(bt.debug("Set language",o),this.setLanguage(o));const r=n==null&&t.sessionLanguage!=null,l=o===n,a=((u=t.settings)==null?void 0:u.language)===t.sessionLanguage;(r||n!==void 0&&a&&!l)&&(bt.debug("De-init completion and context actions"),this.deInitContextActions(),this.deInitCodeCompletion()),(n!=null&&t.sessionLanguage==null&&l||n!==void 0&&!a&&l)&&(bt.debug("Init completion and context actions"),this.initContextActions(),this.initCodeCompletion())}componentWillUnmount(){Ve.removeEventListener("onUpdate",this.updateShortcuts)}getValue(){return this.editor?this.editor.getValue():(bt.error("Editor not initialized"),null)}getSelectedCommand(){var c,d;const t=(c=this.editor)==null?void 0:c.getSelection();M(t);const n=(d=this.editor)==null?void 0:d.getModel();M(n);const{startLineNumber:s,endColumn:o}=t;let{endLineNumber:i}=t;o===1&&i>s&&(i-=1);const r=n==null?void 0:n.getLineMinColumn(s),l=n==null?void 0:n.getLineMaxColumn(i),a=t.setStartPosition(s,r).setEndPosition(i,l);return n==null?void 0:n.getValueInRange(a)}handleEditorInitialized(t){const{focusOnMount:n,onChange:s,onEditorInitialized:o,settings:i,session:r,sessionLanguage:l}=this.props;bt.debug("handleEditorInitialized",l,r,i),this.editor=t,this.setState({model:this.editor.getModel()}),He.setEOL(t),He.registerPasteHandler(t),r!=null&&i&&l===i.language&&(this.initContextActions(),this.initCodeCompletion()),t.onDidChangeModelContent(s),n!=null&&n&&t.focus(),o(this.editor)}handleEditorWillDestroy(t){bt.debug("handleEditorWillDestroy");const{onEditorWillDestroy:n}=this.props;n(t),this.deInitContextActions(),this.deInitCodeCompletion(),this.setState({model:null}),this.editor=void 0}handleRun(){const{onRunCommand:t}=this.props,n=this.getValue();n!=null&&t(n)}handleRunSelected(){const{onRunCommand:t}=this.props,n=this.getSelectedCommand();t(n)}initContextActions(){if(this.contextActionCleanups.length>0){bt.error("Context actions already initialized.");return}if(!this.editor)return;const t=[];t.push(this.editor.addAction({id:"run-code",label:"Run",keybindings:[He.getMonacoKeyCodeFromShortcut(es.NOTEBOOK.RUN)],contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:()=>{this.handleRun()}})),t.push(this.editor.addAction({id:"run-selected-code",label:"Run Selected",keybindings:[He.getMonacoKeyCodeFromShortcut(es.NOTEBOOK.RUN_SELECTED)],contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:()=>{this.handleRunSelected()}})),this.contextActionCleanups=t}deInitContextActions(){this.contextActionCleanups.length>0&&(this.contextActionCleanups.forEach(t=>t.dispose()),this.contextActionCleanups=[])}updateShortcuts(){this.deInitContextActions(),this.initContextActions()}initCodeCompletion(){if(this.completionCleanup!=null){bt.error("Code completion already initialized.");return}const{session:t}=this.props;bt.debug("initCodeCompletion",this.editor,t),this.editor&&t!=null&&(this.completionCleanup=He.openDocument(this.editor,t))}deInitCodeCompletion(){const{session:t}=this.props;bt.debug("deInitCodeCompletion",this.editor,t),this.completionCleanup&&(this.completionCleanup.dispose(),this.completionCleanup=void 0,this.editor&&t!=null&&He.closeDocument(this.editor,t))}append(t,n=!0){M(this.editor);const s=this.editor.getModel();M(s);const o=s.getValue();o?s.setValue(`${o}
22
+ ${t}`):s.setValue(`${t}`);const i=s.getLineCount(),r=s.getLineLength(i)+1;this.editor.setPosition({lineNumber:i,column:r}),n&&this.editor.focus()}updateDimensions(){bt.debug("updateDimensions"),this.editor&&this.editor.layout()}focus(){bt.debug("focus"),this.editor&&this.editor.focus()}toggleFind(){this.editorComponent.current&&this.editorComponent.current.toggleFind()}setLanguage(t){this.editorComponent.current&&t!==void 0&&this.editorComponent.current.setLanguage(t)}render(){var u;const{error:t,isLoaded:n,isLoading:s,session:o,sessionLanguage:i,settings:r}=this.props,{model:l}=this.state,a=t?`Unable to open document. ${t}`:null,c=r&&(u=r.language)!=null?u:null,d=l&&o&&c===i;return y(Oe,{children:[(t||s)&&m("div",{className:"h-100 w-100 position-relative",children:m(ml,{errorMessage:a,isLoading:s,isLoaded:n})}),n&&m("div",{className:"h-100 w-100 script-editor",children:r&&y(Oe,{children:[m(or,{ref:this.editorComponent,settings:r,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy}),d!=null&&d&&m(ta,{model:l,language:c,session:o})]})})]})}}og.defaultProps={error:null,isLoading:!1,isLoaded:!1,focusOnMount:!0,onChange:()=>{},onEditorInitialized:()=>{},onEditorWillDestroy:()=>{},session:null};const ig=250,rg=2500,ca=class extends F.exports.Component{constructor(e){super(e),this.loadData=vt(()=>{const{commandHistoryStorage:t,item:n,language:s}=this.props,{id:o}=n;this.cleanup=t.listenItem(s,o,this.handleUpdate,this.handleError)},ig),this.getPreviewText=be(t=>t.split(`
23
+ `,rg).join(`
24
+ `),{max:1}),this.handleUpdate=this.handleUpdate.bind(this),this.handleError=this.handleError.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.state={currentTime:Date.now()}}static getTimeString(e,t){if(e==null||t===""||t===0)return null;const n=Math.round((new Date(t).valueOf()-new Date(e).valueOf())/1e3);return n<1?"<1s":Bi.formatElapsedTime(n)}componentDidMount(){this.loadData()}componentDidUpdate(e,t){var s;const{data:n}=this.state;this.timer==null&&!(n!=null&&n.result)&&Boolean(n==null?void 0:n.startTime)&&!(n==null||n.endTime===void 0)?this.startTimer():((n==null?void 0:n.result)&&!((s=t.data)!=null&&s.result)||Boolean(n==null?void 0:n.endTime)&&!(t.data==null||t.data.endTime===void 0))&&this.stopTimer()}componentWillUnmount(){this.loadData.cancel(),this.cleanup!=null&&this.cleanup(),this.stopTimer()}startTimer(){this.stopTimer(),this.timer=setInterval(this.handleTimeout,1e3)}stopTimer(){this.timer&&(clearInterval(this.timer),this.timer=void 0)}updateTime(){this.setState({currentTime:Date.now()})}handleError(e){this.setState({error:`${e}`})}handleUpdate(e){const{data:t}=e!=null?e:{};this.setState({data:t});const{onUpdate:n}=this.props;n==null||n(t)}handleTimeout(){this.updateTime()}render(){var h;const{item:{name:e},language:t}=this.props,{currentTime:n,data:s,error:o}=this.state,{result:i,startTime:r,endTime:l}=s!=null?s:{},a=(h=i==null?void 0:i.error)!=null?h:o,c=ca.getTimeString(r,l!=null?l:n),d=this.getPreviewText(e),u=Boolean(c);return y("div",{className:"command-history-item-tooltip",children:[y("div",{className:"scroll-container",children:[m(Kl,{language:t,children:d}),d.length<e.length&&m("p",{children:"Preview Truncated..."})]}),y("div",{className:"result-info",children:[y("div",{className:"d-flex justify-content-between",children:[Boolean(a)&&y("div",{className:"text-danger mr-1",children:[m(te,{icon:Qn})," Executed with errors"]}),y("div",{className:"time-wrapper",children:["Elapsed time:"," ",u?m("span",{className:"time-string",children:c}):m(dn,{})]})]}),Boolean(a)&&m("div",{className:"error-message",children:a})]})]})}};let da=ca;da.defaultProps={onUpdate:()=>{}};const lg=512;function ua(e){const{item:t,language:n,isSelected:s,commandHistoryStorage:o}=e,i=t.name.substring(0,lg),r=F.exports.useRef(null),l=F.exports.useCallback(()=>{var a;(a=r.current)==null||a.update()},[r]);return y("div",{className:ee("command-history-item",{selected:s}),children:[i,m(Rt,{ref:r,interactive:!0,options:{placement:"left",modifiers:{preventOverflow:{enabled:!0,boundariesElement:"viewport",order:825}}},popperClassName:"command-history-item-popper",children:m(da,{item:t,language:n,onUpdate:l,commandHistoryStorage:o})})]})}ua.defaultProps={isSelected:!1};class Wo extends F.exports.Component{static itemKey(t,n){return`${n.title}`}static renderContent(t){return t.selectionRequired!==void 0&&t.selectionRequired?y("div",{className:"fa-md fa-layers",children:[m(te,{icon:qo,mask:t.icon,transform:"right-5 down-5 shrink-4"}),m(te,{icon:pc,transform:"shrink-3 right-7 down-6"})]}):m(te,{icon:t.icon})}render(){const{actions:t,hasSelection:n}=this.props;return m("div",{className:"command-history-actions",children:t.map((s,o)=>m(z,{kind:"inline",className:ee(s.className),onClick:s.action,tooltip:s.description,disabled:s.selectionRequired!==void 0&&s.selectionRequired&&!n,icon:Wo.renderContent(s)},Wo.itemKey(o,s)))})}}const ag=150,Zr=3,Jr=ie.module("CommandHistoryViewportUpdater");function cg({table:e,columns:t,top:n=0,bottom:s=0,search:o,isReversed:i=!1,onUpdate:r}){const l=F.exports.useMemo(()=>Pn(a=>{const c=a.bottom-a.top,d=Math.max(0,a.top-c*Zr),u=a.bottom+c*Zr;e.setViewport({top:d,bottom:u,columns:a.columns})},ag),[e]);return F.exports.useEffect(function(){const c=e.onUpdate(d=>{var u,h;r({items:(u=d.items)!=null?u:[],offset:(h=d.offset)!=null?h:0})});return()=>{Jr.debug("onUpdate cleanup"),c()}},[e,r]),F.exports.useEffect(function(){e.setSearch(o!=null?o:"")},[e,o]),F.exports.useEffect(function(){l({top:n,bottom:s,columns:t})},[l,n,s,t,o,i]),F.exports.useEffect(()=>()=>{Jr.debug2("Cancel throttledUpdateViewport"),l.cancel()},[l]),null}const En=ie.module("CommandHistory"),nn=class extends F.exports.Component{constructor(e){super(e),this.copySelectedCommands=this.copySelectedCommands.bind(this),this.createNotebook=this.createNotebook.bind(this),this.sendToConsole=this.sendToConsole.bind(this),this.renderItem=this.renderItem.bind(this),this.runInConsole=this.runInConsole.bind(this),this.sendToNotebook=this.sendToNotebook.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleSelectionChange=this.handleSelectionChange.bind(this),this.handleSearchChange=this.handleSearchChange.bind(this),this.handleViewportChange=this.handleViewportChange.bind(this),this.handleViewportUpdate=this.handleViewportUpdate.bind(this),this.itemActions=[{title:"Copy Selection",description:"Copy selected commands to clipboard",icon:fc,shortcut:Li.COPY,action:this.copySelectedCommands,group:se.groups.edit},{title:"Send to Console",description:"Open selected commands in the console",icon:Sr,shortcut:es.COMMAND_HISTORY.SEND_TO_CONSOLE,action:this.sendToConsole,group:nn.menuGroups.send,order:10},{title:"Run in Console",description:"Run selected commands in the console",icon:Cc,shortcut:es.COMMAND_HISTORY.RUN,action:this.runInConsole,group:nn.menuGroups.send,order:10},{title:"Send to Active Notebook",description:"Open selected commands in a notebook",icon:br,shortcut:es.COMMAND_HISTORY.SEND_TO_NOTEBOOK,action:this.sendToNotebook,group:nn.menuGroups.send,order:20},{title:"Send to New Notebook",description:"Open selected commands in a new notebook",icon:wc,action:this.createNotebook,group:nn.menuGroups.send,order:30}],this.historyActions=[{title:"Send to Console",icon:Sr,selectionRequired:!0,description:"Open selected commands in the console",action:this.sendToConsole},{title:"Send to Notebook",icon:br,selectionRequired:!0,description:"Open selected commands in a notebook",action:this.sendToNotebook}],this.pending=new Xo,this.searchInputRef=Fe.createRef(),this.itemListRef=Fe.createRef();const{table:t}=e;this.state={actions:[],historyActions:this.historyActions,top:0,bottom:0,itemCount:t.size,items:[],offset:0,selectedRanges:[],searchText:""}}static getCommandsFromViewport(e,t,n){const s=[];for(let o=0;o<n.length;o+=1){const i=n[o];for(let r=i[0];r<=i[1];r+=1)if(r>=t&&r<t+e.length){const{name:l}=e[r-t];s.push(l)}}return s}static async getCommandsFromSnapshot(e,t){return[...(await e.getSnapshot(t)).values()].map(s=>s.name)}componentWillUnmount(){this.pending.cancel()}async getSelectedCommands(){const{items:e,offset:t,selectedRanges:n}=this.state,s=n.slice().sort((i,r)=>i[0]-r[0]);if(s.length===0)return[];if(s[0][0]>=t&&s[s.length-1][1]<t+e.length)return nn.getCommandsFromViewport(e,t,s);const{table:o}=this.props;return this.pending.add(nn.getCommandsFromSnapshot(o,s))}getSelectedCommandText(){return this.getSelectedCommands().then(e=>e.join(`
25
+ `))}updateActions(){this.setState(e=>{const{selectedRanges:t}=e,n=t.reduce((s,o)=>s+o[1]-o[0]+1,0);return n>0&&n<nn.MAX_SELECTION_COUNT?(En.debug("Updating actions",this.itemActions),{actions:this.itemActions}):(En.debug("Disabling actions",n),{actions:[]})})}copySelectedCommands(){this.getSelectedCommandText().then(zo).catch(En.error)}createNotebook(){this.getSelectedCommandText().then(e=>{const{language:t,sendToNotebook:n}=this.props;n({value:e,language:t},!0)}).catch(En.error)}sendToNotebook(){this.getSelectedCommandText().then(e=>{const{language:t,sendToNotebook:n}=this.props;n({value:e,language:t})}).catch(En.error)}sendToConsole(){const{sendToConsole:e}=this.props;this.getSelectedCommandText().then(e).catch(En.error)}runInConsole(){this.getSelectedCommandText().then(e=>{const{sendToConsole:t}=this.props;t(e,!0,!0)}).catch(En.error)}handleSelect(e){const{sendToConsole:t}=this.props,{items:n,offset:s}=this.state;if(e<s||e>=s+n.length){En.error("Invalid index!",e);return}const{name:o}=n[e-s];t(o)}handleSelectionChange(e){this.setState({selectedRanges:e}),this.updateActions()}handleViewportChange(e,t){this.setState({top:e,bottom:t})}handleSearchChange(e){this.setState({searchText:e.target.value,selectedRanges:[]})}handleViewportUpdate({items:e,offset:t}){const{table:n}=this.props,s=n.size;this.setState({items:e,itemCount:s,offset:t})}renderItem({item:e,itemIndex:t,isSelected:n}){const{language:s,commandHistoryStorage:o}=this.props;return m(ua,{isSelected:n,item:e,language:s,commandHistoryStorage:o})}focus(){this.searchInputRef.current&&this.searchInputRef.current.focus()}restoreScrollPosition(){var e;(e=this.itemListRef.current)==null||e.restoreScrollPosition()}render(){var h;const{language:e,table:t}=this.props,{actions:n,historyActions:s,searchText:o,top:i,bottom:r,items:l,itemCount:a,offset:c,selectedRanges:d}=this.state,u=(h=Cm.LANGUAGE_MAP.get(e))!=null?h:"";return y("div",{className:"command-history",children:[y("div",{className:"command-history-search-bar",children:[m(Xs,{ref:this.searchInputRef,value:o,placeholder:`${u} Command History`,onChange:this.handleSearchChange}),m(Wo,{actions:s,hasSelection:d.length>0})]}),y("div",{className:"command-history-list",children:[m(xo,{ref:this.itemListRef,itemCount:a,items:l,offset:c,selectedRanges:d,onSelect:this.handleSelect,onSelectionChange:this.handleSelectionChange,onViewportChange:this.handleViewportChange,renderItem:this.renderItem,rowHeight:nn.ITEM_HEIGHT,isDoubleClickSelect:!0,isMultiSelect:!0,isStickyBottom:!0}),m(cg,{table:t,top:i,bottom:r,search:o,onUpdate:this.handleViewportUpdate}),m(se,{actions:n})]})]})}};let ir=nn;ir.ITEM_HEIGHT=29;ir.MAX_SELECTION_COUNT=1e4;ir.menuGroups={send:se.groups.medium+100};class dg extends F.exports.PureComponent{constructor(t){super(t),this.handleSwitchClick=this.handleSwitchClick.bind(this)}handleSwitchClick(){const{logLevel:t,onClick:n}=this.props;n(t)}render(){const{logLevel:t,on:n}=this.props;return y("div",{className:ee("log-level-menu-item",t),children:[m(pl,{on:n,onClick:this.handleSwitchClick}),t]})}}const ot=class extends F.exports.PureComponent{constructor(e){super(e),this.handleClearClick=this.handleClearClick.bind(this),this.handleFlushTimeout=this.handleFlushTimeout.bind(this),this.handleLogMessage=this.handleLogMessage.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleResetClick=this.handleResetClick.bind(this),this.handleResize=this.handleResize.bind(this),this.handleToggleAllClick=this.handleToggleAllClick.bind(this),this.logLevelMenuItems={},this.editorContainer=null,this.bufferedMessages=[],this.messages=[],this.state={shownLogLevels:{}}}static getLogText(e){const t=new Date(e.micros/1e3);return`${Es.formatTimestamp(t)} ${e.logLevel} ${e.message}`}componentDidMount(){this.resetLogLevels(),this.initMonaco(),this.startListening(),window.addEventListener("resize",this.handleResize)}componentDidUpdate(e,t){this.updateDimensions();const{shownLogLevels:n}=this.state;t.shownLogLevels!==n&&this.refreshLogText();const{session:s}=this.props;e.session!==s&&(this.stopListening(),this.startListening(),this.clearLogs())}componentWillUnmount(){this.stopFlushTimer(),this.stopListening(),this.destroyMonaco(),window.removeEventListener("resize",this.handleResize)}getMenuActions(e){const t=[];t.push({menuElement:m("div",{className:"log-level-menu-title",children:"Display Log Levels"}),group:1,order:10});for(let n=0;n<ot.AllLogLevels.length;n+=1){const s=ot.AllLogLevels[n],o=e[s]!=null?e[s]:!1;t.push({title:s,group:1,order:n+100,menuElement:m(dg,{logLevel:s,on:o,onClick:this.handleMenuItemClick,ref:i=>{i!=null&&(this.logLevelMenuItems[s]=i)}})})}return t.push({group:1,order:1e3,menuElement:y("div",{className:"log-level-menu-controls",children:[m(z,{kind:"ghost",className:"log-level-toggle-all",onClick:this.handleToggleAllClick,children:"Toggle All"}),m(z,{kind:"ghost",onClick:this.handleResetClick,children:"Reset"})]})}),t}resetLogLevels(){const e={};for(let t=0;t<ot.AllLogLevels.length;t+=1){const n=ot.AllLogLevels[t],s=ot.DefaultLogLevels.some(o=>o===n);e[n]=s}this.setState({shownLogLevels:e})}startListening(){const{session:e}=this.props;this.cancelListener=e.onLogMessage(this.handleLogMessage)}stopListening(){this.cancelListener!=null&&(this.cancelListener(),this.cancelListener=void 0)}initMonaco(){M(this.editorContainer),this.editor=an.create(this.editorContainer,{copyWithSyntaxHighlighting:!1,fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"log",lineDecorationsWidth:0,lineNumbers:"off",lineNumbersMinChars:0,minimap:{enabled:!1},readOnly:!0,renderLineHighlight:"none",scrollBeyondLastLine:!1,value:"",wordWrap:"on"}),this.editor.addCommand(Mn.Escape,()=>{}),this.editor.addCommand(Et.Shift|Mn.Escape,()=>{}),this.editor.addCommand(Mn.Escape,()=>{var t,n;const e=(t=this.editor)==null?void 0:t.getPosition();M(e),(n=this.editor)==null||n.setPosition(e)},"findWidgetVisible && editorTextFocus"),this.editor.addCommand(Et.Shift|Mn.Escape,()=>{var t,n;const e=(t=this.editor)==null?void 0:t.getPosition();M(e),(n=this.editor)==null||n.setPosition(e)},"findWidgetVisible && editorTextFocus")}destroyMonaco(){this.editor&&(this.editor.dispose(),this.editor=void 0)}triggerFindWidget(){var e,t;(e=this.editor)==null||e.focus(),(t=this.editor)==null||t.trigger("keyboard","actions.find",void 0)}toggleAll(){const{shownLogLevels:e}=this.state;let t=!0;for(let n=0;n<ot.AllLogLevels.length;n+=1){const s=ot.AllLogLevels[n];if(!e[s]){t=!1;break}}if(t)this.setState({shownLogLevels:{}});else{const n={};for(let s=0;s<ot.AllLogLevels.length;s+=1){const o=ot.AllLogLevels[s];n[o]=!0}this.setState({shownLogLevels:n})}}toggleLogLevel(e){const{shownLogLevels:t}=this.state,n=t[e],s={};s[e]=!n,this.updateLogLevels(s)}updateLogLevels(e){let{shownLogLevels:t}=this.state;t={...t,...e},this.setState({shownLogLevels:t})}appendLogText(e){if(!this.editor)return;const t=this.editor.getModel();let n=t==null?void 0:t.getLineCount();M(n);let s=t==null?void 0:t.getLineLength(n);M(s);const o=this.isBottomVisible(),i=[];if(s>0&&(i.push({range:{startLineNumber:n,startColumn:s+1,endLineNumber:n,endColumn:s+1},text:`
26
26
  `,forceMoveMarkers:!0}),n+=1,s=0),i.push({range:{startLineNumber:n,startColumn:s,endLineNumber:n,endColumn:s},text:e,forceMoveMarkers:!0}),t==null||t.applyEdits(i),o){const r=t==null?void 0:t.getLineCount();M(r),this.editor.revealLine(r,1)}}refreshLogText(){var s;if(!this.editor)return;this.truncateLogIfNecessary();const{shownLogLevels:e}=this.state,t=this.isBottomVisible();let n="";for(let o=0;o<this.messages.length;o+=1){const i=this.messages[o];if(e[i.logLevel]){const r=ot.getLogText(i);r.length>0&&(n+=r,r.charAt(r.length-1)!==`
27
27
  `&&(n+=`
28
28
  `))}}if(n=n.trimRight(),this.editor.setValue(n),t){const o=(s=this.editor.getModel())==null?void 0:s.getLineCount();M(o),this.editor.revealLine(o,1)}this.stopFlushTimer(),this.bufferedMessages=[]}truncateLogIfNecessary(){this.messages.length>ot.maxLogSize&&(this.messages=this.messages.splice(this.messages.length-ot.truncateSize))}scrollToBottom(){var t,n,s;if(!this.editor)return;const e=(s=(n=(t=this.editor)==null?void 0:t.getModel)==null?void 0:n.call(t))==null?void 0:s.getLineCount();M(e),this.editor.revealLine(e,1)}isBottomVisible(){if(!this.editor)return!0;const e=this.editor.getModel(),t=e==null?void 0:e.getLineCount();return M(t),this.isLineVisible(t)}isLineVisible(e){var n;const t=(n=this.editor)==null?void 0:n.getVisibleRanges();if(t==null||t.length===0)return!1;for(let s=0;s<t.length;s+=1){const o=t[s];if(o.startLineNumber<=e&&e<=o.endLineNumber)return!0}return!1}isLogItemVisible(e){const{shownLogLevels:t}=this.state;return t[e.logLevel]}flush(){let e="";for(let t=0;t<this.bufferedMessages.length;t+=1){const n=this.bufferedMessages[t],s=ot.getLogText(n);e+=s,s.charAt(s.length-1)!==`
29
29
  `&&(e+=`
30
- `)}this.bufferedMessages=[],this.appendLogText(e)}queue(e){this.bufferedMessages.push(e),this.bufferedMessages.length===1&&(this.flushTimer=setTimeout(this.handleFlushTimeout,ot.bufferTimeout))}stopFlushTimer(){this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=void 0)}updateDimensions(){this.editor&&this.editor.layout()}handleClearClick(){this.clearLogs()}clearLogs(){this.messages=[],this.refreshLogText()}handleFlushTimeout(){this.stopFlushTimer(),this.flush()}handleLogMessage(e){this.messages.push(e),this.editor&&this.isLogItemVisible(e)&&this.queue(e)}handleMenuItemClick(e){this.toggleLogLevel(e)}handleResetClick(){this.resetLogLevels()}handleResize(){this.updateDimensions()}handleToggleAllClick(){this.toggleAll()}render(){const e={placement:"bottom-end"},{shownLogLevels:t}=this.state,n=this.getMenuActions(t);return y("div",{className:"log-pane h-100 w-100",children:[y("div",{className:"log-pane-menu",children:[m(z,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:wc,tooltip:"Clear log"}),m(z,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:Sc,tooltip:"Log Settings",onClick:()=>{},children:m(Ss,{actions:n,popperClassName:"log-level-menu-popper",popperOptions:e})})]}),m("div",{className:"log-pane-editor h-100 w-100",ref:s=>{this.editorContainer=s}})]})}};let Zs=ot;Zs.DefaultLogLevels=[je.STDOUT,je.ERROR,je.FATAL,je.STDERR,je.WARN];Zs.AllLogLevels=[je.INFO,je.STDOUT,je.ERROR,je.FATAL,je.STDERR,je.WARN,je.DEBUG,je.TRACE];Zs.bufferTimeout=16;Zs.maxLogSize=131072;Zs.truncateSize=65536;Lo.register([Uc,Bc,Gc,Wc,$c,zc]);const dg=typeof ui=="function"?ui(Lo):ui.default(Lo),sn=class{constructor(){this.listeners=[],this.isDownsamplingDisabled=!1}getData(){return[]}getDefaultTitle(){return""}getLayout(){return{}}getFilterColumnMap(){return new Map}isFilterRequired(){return!1}setFilter(e){}close(){}setFormatter(e){this.formatter=e}setDownsamplingDisabled(e){this.isDownsamplingDisabled=e}setDimensions(e){this.rect=e}setTitle(e){this.title=e}subscribe(e){this.listeners.push(e)}unsubscribe(e){this.listeners=this.listeners.filter(t=>t!==e)}fireEvent(e){for(let t=0;t<this.listeners.length;t+=1)this.listeners[t](e)}fireUpdate(e){this.fireEvent(new CustomEvent(sn.EVENT_UPDATED,{detail:e}))}fireDisconnect(){this.fireEvent(new CustomEvent(sn.EVENT_DISCONNECT))}fireReconnect(){this.fireEvent(new CustomEvent(sn.EVENT_RECONNECT))}fireDownsampleStart(e){this.fireEvent(new CustomEvent(sn.EVENT_DOWNSAMPLESTARTED,{detail:e}))}fireDownsampleFinish(e){this.fireEvent(new CustomEvent(sn.EVENT_DOWNSAMPLEFINISHED,{detail:e}))}fireDownsampleFail(e){this.fireEvent(new CustomEvent(sn.EVENT_DOWNSAMPLEFAILED,{detail:e}))}fireDownsampleNeeded(e){this.fireEvent(new CustomEvent(sn.EVENT_DOWNSAMPLENEEDED,{detail:e}))}fireLoadFinished(){this.fireEvent(new CustomEvent(sn.EVENT_LOADFINISHED))}};let Ze=sn;Ze.EVENT_UPDATED="ChartModel.EVENT_UPDATED";Ze.EVENT_DISCONNECT="ChartModel.EVENT_DISCONNECT";Ze.EVENT_RECONNECT="ChartModel.EVENT_RECONNECT";Ze.EVENT_DOWNSAMPLESTARTED="ChartModel.EVENT_DOWNSAMPLESTARTED";Ze.EVENT_DOWNSAMPLEFINISHED="ChartModel.EVENT_DOWNSAMPLEFINISHED";Ze.EVENT_DOWNSAMPLEFAILED="ChartModel.EVENT_DOWNSAMPLEFAILED";Ze.EVENT_DOWNSAMPLENEEDED="ChartModel.EVENT_DOWNSAMPLENEEDED";Ze.EVENT_LOADFINISHED="ChartModel.EVENT_LOADFINISHED";const ug="#76d9e4 #9edc6f #fcd65b #aa9af4 #f37e3f #f95d84 #f0f0ee",hg="#403e41",mg="#5b5a5c",gg="#c0bfbf",pg="#4878ea",fg="rgba(91, 90, 92, 0.7)",et={"paper-bgcolor":"#2d2a2e","plot-bgcolor":"#322f33","title-color":"#f0f0ee",colorway:ug,gridcolor:hg,linecolor:mg,zerolinecolor:gg,activecolor:pg,rangebgcolor:fg,"area-color":"#76d9e4","trend-color":"#d5f0c1","line-color":"#9edc6f","error-band-line-color":"white","error-band-fill-color":"rgba(213, 240, 193, 0.1)","ohlc-increasing":"#9edc6f","ohlc-decreasing":"#f95d84"},In=Object.freeze({paper_bgcolor:et["paper-bgcolor"],plot_bgcolor:et["plot-bgcolor"],title_color:et["title-color"],colorway:et.colorway,gridcolor:et.gridcolor,linecolor:et.linecolor,zerolinecolor:et.zerolinecolor,activecolor:et.activecolor,rangebgcolor:et.rangebgcolor,area_color:et["area-color"],trend_color:et["trend-color"],line_color:et["line-color"],error_band_line_color:et["error-band-line-color"],error_band_fill_color:et["error-band-fill-color"],ohlc_increasing:et["ohlc-increasing"],ohlc_decreasing:et["ohlc-decreasing"]}),Vs=ie.module("ChartUtils"),vn=Object.freeze(E.calendar.DayOfWeek.values()),el="io.deephaven.time.DateTime",Cg=36e5,wg=1e6;function Sg(e){return e.asDate!==void 0}function bg(e){return e.asNumber!==void 0}function tl(e){return e.dhTimeZone!==void 0}function Tg(e){return e!=null&&e.range!=null&&(e.autorange===!1||e.autorange===void 0)}const q=class{static getPlotlyChartType(e,t){switch(e){case E.plot.SeriesPlotStyle.SCATTER:return t?"scatter":"scattergl";case E.plot.SeriesPlotStyle.LINE:return"scatter";case E.plot.SeriesPlotStyle.BAR:case E.plot.SeriesPlotStyle.STACKED_BAR:return"bar";case E.plot.SeriesPlotStyle.PIE:return"pie";case E.plot.SeriesPlotStyle.TREEMAP:return"treemap";case E.plot.SeriesPlotStyle.HISTOGRAM:return"histogram";case E.plot.SeriesPlotStyle.OHLC:return"ohlc";default:return}}static getPlotlyChartMode(e,t,n){const s=new Set;switch(e){case E.plot.SeriesPlotStyle.SCATTER:t!=null&&t&&s.add(q.MODE_LINES),(n==null||n)&&s.add(q.MODE_MARKERS);break;case E.plot.SeriesPlotStyle.LINE:(t==null||t)&&s.add(q.MODE_LINES),n!=null&&n&&s.add(q.MODE_MARKERS);break}return s.size>0?[...s].join("+"):void 0}static getPlotlyProperty(e,t){switch(e){case E.plot.SeriesPlotStyle.PIE:switch(t){case E.plot.SourceType.X:return"labels";case E.plot.SourceType.Y:return"values"}break;case E.plot.SeriesPlotStyle.OHLC:switch(t){case E.plot.SourceType.TIME:return"x"}break;case E.plot.SeriesPlotStyle.TREEMAP:switch(t){case E.plot.SourceType.X:return"ids";case E.plot.SourceType.Y:return"values";case E.plot.SourceType.LABEL:return"labels";case E.plot.SourceType.PARENT:return"parents";case E.plot.SourceType.COLOR:return"marker.colors"}break}switch(t){case E.plot.SourceType.X:return"x";case E.plot.SourceType.Y:return"y";case E.plot.SourceType.Z:return"z";case E.plot.SourceType.X_LOW:return"xLow";case E.plot.SourceType.X_HIGH:return"xHigh";case E.plot.SourceType.Y_LOW:return"yLow";case E.plot.SourceType.Y_HIGH:return"yHigh";case E.plot.SourceType.TIME:return"time";case E.plot.SourceType.OPEN:return"open";case E.plot.SourceType.HIGH:return"high";case E.plot.SourceType.LOW:return"low";case E.plot.SourceType.CLOSE:return"close";case E.plot.SourceType.SHAPE:return"shape";case E.plot.SourceType.SIZE:return"size";case E.plot.SourceType.LABEL:return"label";case E.plot.SourceType.COLOR:return"color";case E.plot.SourceType.PARENT:return"parent";case E.plot.SourceType.HOVER_TEXT:return"hovertext";case E.plot.SourceType.TEXT:return"text";default:throw new Error(`Unrecognized source type: ${t}`)}}static getPlotlySeriesOrientation(e){var n,s;const{sources:t}=e;return t.length===2&&((s=(n=t[0])==null?void 0:n.axis)==null?void 0:s.type)===E.plot.AxisType.Y?q.ORIENTATION.HORIZONTAL:q.ORIENTATION.VERTICAL}static getPlotlyErrorBars(e,t,n){const s=n.map((i,r)=>i-e[r]),o=t.map((i,r)=>e[r]-i);return{type:"data",symmetric:!1,array:s,arrayminus:o}}static getPlotlyDateFormat(e,t,n){const s=n==null?void 0:n.replace("%","%%").replace(/S{9}/g,"%9f").replace(/S{8}/g,"%8f").replace(/S{7}/g,"%7f").replace(/S{6}/g,"%6f").replace(/S{5}/g,"%5f").replace(/S{4}/g,"%4f").replace(/S{3}/g,"%3f").replace(/S{2}/g,"%2f").replace(/S{1}/g,"%1f").replace(/y{4}/g,"%Y").replace(/y{2}/g,"%y").replace(/M{4}/g,"%B").replace(/M{3}/g,"%b").replace(/M{2}/g,"%m").replace(/M{1}/g,"%-m").replace(/E{4,}/g,"%A").replace(/E{1,}/g,"%a").replace(/d{2}/g,"%d").replace(/([^%]|^)d{1}/g,"$1%-d").replace(/H{2}/g,"%H").replace(/h{2}/g,"%I").replace(/h{1}/g,"%-I").replace(/m{2}/g,"%M").replace(/s{2}/g,"%S").replace("'T'","T").replace(" z","");let o;const i=e==null?void 0:e.getColumnTypeFormatter(t);return i!=null&&tl(i)&&i.dhTimeZone!=null&&i.showTimeZone&&(o=E.i18n.DateTimeFormat.format(" z",new Date,i.dhTimeZone)),{tickformat:s,ticksuffix:o,automargin:!0}}static convertNumberPrefix(e){return e.replace(/\u00A4\u00A4/g,"USD").replace(/\u00A4/g,"$")}static getPlotlyNumberFormat(e,t,n){if(!n)return null;const o=n.split(";")[0].match(/^([^#,0.]*)([#,]*)([0,]*)(\.?)(0*)(#*)(E?0*)(%?)(.*)/);M(o);const[,i,r,l,,a,c,d,u,h]=o,g=l.replace(",","").length,f=r.indexOf(",")>=0||l.indexOf(",")>=0?",":"",C=d!=null&&d!==""?"e":"f",w=u!==""?u:C,S=a.length+c.length,R=`0${g}${f}.${S}${w}`,b=q.convertNumberPrefix(i),v=q.convertNumberPrefix(h);return{tickformat:R,tickprefix:b,ticksuffix:v,automargin:!0}}static getPlotlyAxisFormat(e,t=null){const{axis:n,columnType:s}=e,{formatPattern:o}=n;let i=null;return I.isDateType(s)?(i=q.getPlotlyDateFormat(t,s,o),i=q.addTickSpacing(i,n,!0)):I.isNumberType(s)&&(i=q.getPlotlyNumberFormat(t,s,o),i=q.addTickSpacing(i,n,!1)),n.formatType===E.plot.AxisFormatType.CATEGORY&&(i?i.type="category":i={type:"category",tickformat:void 0,ticksuffix:void 0}),i}static addTickSpacing(e,t,n){const{gapBetweenMajorTicks:s}=t;if(s>0){const o=e||{};let i=s;return n&&(i=s/wg),t.log&&(i=Math.log(i)),o.tickmode="linear",o.dtick=i,o}return e}static getSourceForAxis(e,t){for(let n=0;n<e.series.length;n+=1){const s=e.series[n];for(let o=0;o<s.sources.length;o+=1){const i=s.sources[o];if(i.axis===t)return i}}return null}static getSeriesVisibility(e,t){return t!=null&&t.hiddenSeries!=null&&t.hiddenSeries.includes(e)?"legendonly":!0}static getHiddenLabels(e){return e!=null&&e.hiddenSeries?[...e.hiddenSeries]:[]}static makeSeriesData(e,t,n,s,o=q.ORIENTATION.VERTICAL){return{type:e,mode:t,name:n,orientation:o,showlegend:s!=null?s:void 0}}static makeSeriesDataFromSeries(e,t,n,s=null,o=In){const{name:i,isLinesVisible:r,isShapesVisible:l,plotStyle:a,lineColor:c,shapeColor:d,sources:u,shape:h,shapeSize:g}=e,p=u.some(T=>{var R;return(R=T.axis)==null?void 0:R.businessCalendar}),f=q.getChartType(a,p),C=q.getPlotlyChartMode(a,r!=null?r:void 0,l!=null?l:void 0),w=q.getPlotlySeriesOrientation(e),S=q.makeSeriesData(f,C,i,s,w);return q.addSourcesToSeriesData(S,a,u,t),q.addStylingToSeriesData(S,a,o,c,d,h,g,n),S}static addSourcesToSeriesData(e,t,n,s){const o=e;for(let i=0;i<n.length;i+=1){const r=n[i],{axis:l,type:a}=r,c=q.getPlotlyProperty(t,a);ol(o,c,[]);const d=l!=null?q.getAxisPropertyName(l.type):null;if(d!=null){const u=s.get(l.type);if(u){const h=u.indexOf(l),g=h>0?`${h+1}`:"";o[`${d}axis`]=`${d}${g}`}}}}static addStylingToSeriesData(e,t,n=In,s=null,o=null,i=null,r=null,l=null){const a=e;if(a.marker={line:{}},a.line={width:1},t===E.plot.SeriesPlotStyle.AREA?a.fill="tozeroy":t===E.plot.SeriesPlotStyle.STACKED_AREA?a.stackgroup="stack":t===E.plot.SeriesPlotStyle.STEP?a.line.shape="hv":t===E.plot.SeriesPlotStyle.HISTOGRAM?(a.width=[],a.marker.line!==void 0&&Object.assign(a.marker.line,{color:n.paper_bgcolor,width:1})):t===E.plot.SeriesPlotStyle.OHLC?(a.increasing={line:{color:n.ohlc_increasing}},a.decreasing={line:{color:n.ohlc_decreasing}}):t===E.plot.SeriesPlotStyle.PIE?(a.textinfo="label+percent",a.outsidetextfont={color:n.title_color}):t===E.plot.SeriesPlotStyle.TREEMAP&&(a.hoverinfo="text",a.textinfo="label+text",a.tiling={packing:"squarify",pad:0},a.textposition="middle center",a.outsidetextfont={color:n.title_color}),s!=null&&(t===E.plot.SeriesPlotStyle.BAR?a.marker.color=s:a.line.color=s),o!=null&&(a.marker.color=o),i!=null&&i.length>0)try{a.marker.symbol=q.getMarkerSymbol(i)}catch(c){Vs.warn("Unable to handle shape",i,":",c)}r!=null&&(a.marker.size=r*q.DEFAULT_MARKER_SIZE),l!=null&&t!==E.plot.SeriesPlotStyle.PIE&&(a.visible=l)}static getMarkerSymbol(e){switch(e){case"SQUARE":return"square";case"CIRCLE":return"circle";case"DIAMOND":return"diamond";case"UP_TRIANGLE":return"triangle-up";case"DOWN_TRIANGLE":return"triangle-down";case"RIGHT_TRIANGLE":return"triangle-right";case"LEFT_TRIANGLE":return"triangle-left";case"ELLIPSE":case"HORIZONTAL_RECTANGLE":case"VERTICAL_RECTANGLE":default:throw new Error(`Unrecognized shape ${e}`)}}static getAxisFormats(e,t){const n=new Map,s={tickformat:null,ticksuffix:null},o=q.getAllAxes(e),i=q.groupArray(o,"type"),{charts:r}=e;for(let l=0;l<r.length;l+=1){const a=r[l];for(let c=0;c<a.series.length;c+=1){const d=a.series[c],{sources:u}=d,h=u.filter(g=>g.axis);for(let g=0;g<h.length;g+=1){const p=h[g],{axis:f}=p,{type:C}=f,w=i.get(C);M(w);const S=w.indexOf(f),T=q.getAxisPropertyName(C);if(T!=null){const R=q.getAxisLayoutProperty(T,S);if(n.has(R))Vs.debug(`${R} already added.`);else{Vs.debug(`Adding ${R} to axisFormats.`);const b=q.getPlotlyAxisFormat(p,t);if(b===null)n.set(R,s);else{n.set(R,b);const{businessCalendar:v}=f;if(v!=null){const D=[],{businessPeriods:A,businessDays:N,holidays:L,timeZone:k}=v,x=t==null?void 0:t.getColumnTypeFormatter(el);let W;tl(x)&&(W=x.dhTimeZone);const V=W?(k.standardOffset-W.standardOffset)/60:0;L.length>0&&D.push(...q.createRangeBreakValuesFromHolidays(L,k,W)),A.forEach(K=>D.push({pattern:"hour",bounds:[q.periodToDecimal(K.close)+V,q.periodToDecimal(K.open)+V]})),N.length<vn.length&&q.createBoundsFromDays(N).forEach(K=>D.push({pattern:"day of week",bounds:K})),b.rangebreaks=D}if(n.size===a.axes.length)return n}}}}}}return n}static getChartType(e,t){switch(e){case E.plot.SeriesPlotStyle.HISTOGRAM:return"bar";default:return q.getPlotlyChartType(e,t)}}static getAxisPropertyName(e){switch(e){case E.plot.AxisType.X:return"x";case E.plot.AxisType.Y:return"y";default:return null}}static getAxisSide(e){switch(e){case E.plot.AxisPosition.BOTTOM:return"bottom";case E.plot.AxisPosition.TOP:return"top";case E.plot.AxisPosition.LEFT:return"left";case E.plot.AxisPosition.RIGHT:return"right";default:return}}static getAllAxes(e){return e.charts.reduce((t,n)=>[...t,...n.axes],[])}static getChartForSeries(e,t){const{charts:n}=e;for(let s=0;s<n.length;s+=1){const o=n[s];for(let i=0;i<o.series.length;i+=1)if(t===o.series[i])return o}return null}static getLayoutRanges(e){const t={},n=Object.keys(e).filter(s=>s.indexOf("axis")>=0);for(let s=0;s<n.length;s+=1){const o=n[s],i=e[o];Tg(i)&&(t[o]=[...i.range])}return t}static updateFigureAxes(e,t,n,s=0,o=0,i=In){const r=e,l=q.getAllAxes(t);for(let a=0;a<t.charts.length;a+=1){const c=t.charts[a],d=n==null?void 0:n(c),u=q.getChartBounds(t,c,s,o);q.updateLayoutAxes(r,c.axes,l,s,o,u,d,i)}q.removeStaleAxes(r,l)}static getChartBounds(e,t,n=0,s=0){var T;const{cols:o,rows:i}=e,{column:r,colspan:l,row:a,rowspan:c}=t,d=r+l,u=a+c,h=1/o,g=1/i,p=q.AXIS_SIZE_PX/n,f=q.AXIS_SIZE_PX/s,C={left:r*h+(r>0?p/2:0),bottom:a*g+(a>0?f/2:0),top:u*g-(u<i?f/2:0),right:d*h-(d<o?p/2:0)};return((T=q.groupArray(t.axes,"position").get(E.plot.AxisPosition.RIGHT))!=null?T:[]).length>0&&(n>0?C.right-=(C.right-C.left)*Math.max(0,Math.min(q.LEGEND_WIDTH_PX/n,q.MAX_LEGEND_SIZE)):C.right-=(C.right-C.left)*q.DEFAULT_AXIS_SIZE),C}static updateLayoutAxes(e,t,n,s=0,o=0,i={left:0,top:0,right:1,bottom:1},r,l=In){const a=s>0?Math.max(q.MIN_AXIS_SIZE,Math.min(q.AXIS_SIZE_PX/o,q.MAX_AXIS_SIZE)):q.DEFAULT_AXIS_SIZE,c=o>0?Math.max(q.MIN_AXIS_SIZE,Math.min(q.AXIS_SIZE_PX/s,q.MAX_AXIS_SIZE)):q.DEFAULT_AXIS_SIZE,d=e,u=q.groupArray(t,"position"),h=q.groupArray(t,"type"),g=[...h.keys()],p=q.groupArray(n,"type");for(let f=0;f<g.length;f+=1){const C=g[f],w=q.getAxisPropertyName(C);if(w!=null){const S=h.get(C),T=p.get(C),b=C===E.plot.AxisType.Y?o:s;M(S),M(T);for(let v=0;v<S.length;v+=1){const D=S[v],A=T.indexOf(D),N=q.getAxisLayoutProperty(w,A);d[N]==null&&(d[N]=q.makeLayoutAxis(C,l));const L=d[N];if(L!=null){q.updateLayoutAxis(L,D,v,u,a,c,i);const{range:k,autorange:x}=L;if(r!=null&&k!==void 0&&(x===void 0||x===!1)){const W=r(D),[V,K]=W(k);Vs.debug("Setting downsample range",b,V,K),D.range(b,V,K)}else D.range(b)}}}}}static removeStaleAxes(e,t){const n=e,s=q.groupArray(t,"type"),o=[...s.keys()];for(let i=0;i<o.length;i+=1){const r=o[i],l=s.get(r);M(l);let a=l.length;const c=q.getAxisPropertyName(r);if(c!=null){let d=q.getAxisLayoutProperty(c,a);for(;n[d]!=null;)delete n[d],a+=1,d=q.getAxisLayoutProperty(c,a)}}}static getAxisLayoutProperty(e,t){const n=t>0?`${t+1}`:"";return`${e!=null?e:""}axis${n}`}static updateLayoutAxis(e,t,n,s,o,i,r){var u,h,g;const a=t.type===E.plot.AxisType.Y?i:o,c=e,d=(u=t.label)!=null?u:"";if(c.title!==void 0&&typeof c.title!="string"?c.title.text=d:c.title={text:d},t.log&&(c.type="log"),c.side=q.getAxisSide(t.position),n>0){c.overlaying=(h=q.getAxisPropertyName(t.type))!=null?h:void 0;const p=(g=s.get(t.position))!=null?g:[],f=p.indexOf(t);f>0&&(c.anchor="free",t.position===E.plot.AxisPosition.RIGHT?c.position=r.right+(f-p.length+1)*a:t.position===E.plot.AxisPosition.TOP?c.position=r.top+(f-p.length+1)*a:t.position===E.plot.AxisPosition.BOTTOM?c.position=r.bottom+(p.length-f+1)*a:t.position===E.plot.AxisPosition.LEFT&&(c.position=r.left+(p.length-f+1)*a))}else if(t.type===E.plot.AxisType.X){const p=s.get(E.plot.AxisPosition.LEFT)||[],f=s.get(E.plot.AxisPosition.RIGHT)||[],C=Math.max(r.left,r.left+(p.length-1)*i),w=Math.min(r.right-(f.length-1)*i,r.right);c.domain=[C,w]}else if(t.type===E.plot.AxisType.Y){const p=s.get(E.plot.AxisPosition.BOTTOM)||[],f=s.get(E.plot.AxisPosition.TOP)||[],C=Math.max(r.bottom,r.bottom+(p.length-1)*o),w=Math.min(r.top-(f.length-1)*o,r.top);c.domain=[C,w]}}static periodToDecimal(e){const t=e.split(":");return Number(t[0])+Number(t[1])/60}static createBoundsFromDays(e){const t=e.map(i=>vn.indexOf(i)),n=vn.filter(i=>!e.includes(i)).map(i=>vn.indexOf(i)),s=new Set;n.forEach(i=>{for(let r=i+1;r<i+vn.length;r+=1){const l=r%vn.length;if(t.includes(l)){s.add(l);break}}});const o=[];return s.forEach(i=>{for(let r=i-1;r>i-vn.length;r-=1){const l=r<0?r+vn.length:r;if(t.includes(l)){const a=(l+1)%7;o.push([a,i]);break}}}),o}static createRangeBreakValuesFromHolidays(e,t,n){const s=[],o=[];return e.forEach(i=>{i.businessPeriods.length>0?o.push(...q.createPartialHoliday(i,t,n)):s.push(q.createFullHoliday(i,t,n))}),[{values:s},...o]}static createFullHoliday(e,t,n){return q.adjustDateForTimeZone(`${e.date.toString()} 00:00:00.000000`,t,n)}static createPartialHoliday(e,t,n){const s=e.date.toString(),o=["00:00"];e.businessPeriods.forEach(r=>{o.push(r.open),o.push(r.close)}),o.push("24:00");const i=[];for(let r=0;r<o.length;r+=2){const l=o[r],a=o[r+1];if(l!==a){const c=[q.adjustDateForTimeZone(`${s} ${l}:00.000000`,t,n)],d=Cg*(q.periodToDecimal(a)-q.periodToDecimal(l));i.push({values:c,dvalue:d})}}return i}static adjustDateForTimeZone(e,t,n){return n&&n.standardOffset!==t.standardOffset?q.unwrapValue(q.wrapValue(e,el,t),n):e}static groupArray(e,t){return e.reduce((n,s)=>{var r;const o=s[t],i=(r=n.get(o))!=null?r:[];return i.push(s),n.set(o,i),n},new Map)}static unwrapValue(e,t){if(e!=null){if(Sg(e))return E.i18n.DateTimeFormat.format(q.DATE_FORMAT,e,t);if(bg(e))return e.asNumber()}return e}static wrapValue(e,t,n=null){if(I.isDateType(t)&&typeof e=="string"){const s=e,o=q.DATE_FORMAT.substr(0,e.length),i=E.i18n.DateTimeFormat.parse(o,s);if(!n)return i;const r=`${o} Z`,l=E.i18n.DateTimeFormat.format("Z",i,n),a=E.i18n.DateTimeFormat.parse(r,`${s} ${l}`),c=E.i18n.DateTimeFormat.format("Z",a,n);return E.i18n.DateTimeFormat.parse(r,`${s} ${c}`)}return e}static makeLayoutAxis(e,t=In){const n={automargin:!0,gridcolor:t.gridcolor,linecolor:t.linecolor,rangeslider:{visible:!1},showline:!0,ticklen:5,tickcolor:t.paper_bgcolor,tickfont:{color:t.zerolinecolor},title:{font:{color:t.title_color}}};return e===E.plot.AxisType.X?Object.assign(n,{showgrid:!0}):e===E.plot.AxisType.Y&&Object.assign(n,{zerolinecolor:t.zerolinecolor,zerolinewidth:2}),n}static getColorwayFromTheme(e=In){let t=[];return e.colorway&&(Array.isArray(e.colorway)?t=e.colorway:typeof e.colorway=="string"?t=e.colorway.split(" "):Vs.warn(`Unable to handle colorway property: ${e.colorway}`)),t}static makeDefaultLayout(e=In){const t={...e,autosize:!0,colorway:q.getColorwayFromTheme(e),font:{family:"'Fira Sans', sans-serif"},title:{font:{color:e.title_color},yanchor:"top",pad:{...q.DEFAULT_TITLE_PADDING},y:1},legend:{font:{color:e.title_color}},margin:{...q.DEFAULT_MARGIN},xaxis:q.makeLayoutAxis(E.plot.AxisType.X,e),yaxis:q.makeLayoutAxis(E.plot.AxisType.Y,e)};return t.datarevision=0,t}static hydrateSettings(e){return{...e,type:E.plot.SeriesPlotStyle[e.type]}}static titleFromSettings(e){const{series:t,xAxis:n,title:s=`${t.join(", ")} by ${n}`}=e;return s}static makeFigureSettings(e,t){const{series:n,xAxis:s,type:o}=e,i=q.titleFromSettings(e),r={formatType:`${E.plot.AxisFormatType.NUMBER}`,type:`${E.plot.AxisType.X}`,position:`${E.plot.AxisPosition.BOTTOM}`},l={formatType:`${E.plot.AxisFormatType.NUMBER}`,type:`${E.plot.AxisType.Y}`,position:`${E.plot.AxisPosition.LEFT}`};return{charts:[{chartType:`${E.plot.ChartType.XY}`,axes:[r,l],series:n.map(a=>({plotStyle:`${o}`,name:a,dataSources:[{type:`${E.plot.SourceType.X}`,columnName:s,axis:r,table:t},{type:`${E.plot.SourceType.Y}`,columnName:a,axis:l,table:t}]}))}],title:i}}};let we=q;we.DEFAULT_AXIS_SIZE=.15;we.MIN_AXIS_SIZE=.025;we.MAX_AXIS_SIZE=.2;we.AXIS_SIZE_PX=75;we.LEGEND_WIDTH_PX=50;we.MAX_LEGEND_SIZE=.25;we.ORIENTATION=Object.freeze({HORIZONTAL:"h",VERTICAL:"v"});we.DATE_FORMAT="yyyy-MM-dd HH:mm:ss.SSSSSS";we.DEFAULT_MARGIN=Object.freeze({l:60,r:50,t:30,b:60,pad:0});we.DEFAULT_TITLE_PADDING=Object.freeze({t:8});we.SUBTITLE_LINE_HEIGHT=25;we.DEFAULT_MARKER_SIZE=6;we.MODE_MARKERS="markers";we.MODE_LINES="lines";const Rn=ie.module("Chart"),Ws=class extends F.exports.Component{constructor(e){super(e),this.getCachedConfig=Re((t,n,s,o)=>{const i=[],r=Boolean(t);if(r&&i.push({name:`Downsampling failed: ${t}`,click:()=>{},icon:Ws.convertIcon(al),attr:"fill-warning"}),n||s||o||r){const l=Ws.downsampleButtonTitle(s,o),a=Ws.downsampleButtonAttr(s,o),c=s?bc:Tc;i.push({name:l,icon:Ws.convertIcon(c),click:this.handleDownsampleClick,attr:a})}return{displaylogo:!1,displayModeBar:s||r?!0:"hover",modeBarButtons:[i,["toImage"],["zoom2d","pan2d"],["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]]}}),this.handleAfterPlot=this.handleAfterPlot.bind(this),this.handleDownsampleClick=this.handleDownsampleClick.bind(this),this.handleModelEvent=this.handleModelEvent.bind(this),this.handlePlotUpdate=this.handlePlotUpdate.bind(this),this.handleRelayout=this.handleRelayout.bind(this),this.handleRestyle=this.handleRestyle.bind(this),this.plot=Fe.createRef(),this.plotWrapper=Fe.createRef(),this.columnFormats=[],this.dateTimeFormatterOptions={},this.decimalFormatOptions={},this.integerFormatOptions={},this.isSubscribed=!1,this.isLoadedFired=!1,this.currentSeries=0,this.state={data:null,downsamplingError:null,isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,layout:{datarevision:0},revision:0}}static convertIcon(e){const[t,,,,n]=e.icon,s=`${n}`;return{width:t,path:s,ascent:t,descent:0,transform:"matrix(1, 0, 0, 1, 0, 0)"}}static downsampleButtonTitle(e,t){return e?"Downsampling in progress...":t?"Downsampling disabled, click to enable":"Downsampling enabled, click to disable"}static downsampleButtonAttr(e,t){return e?"animation-spin":t?void 0:"fill-active"}componentDidMount(){this.updateDimensions(),this.updateModelDimensions(),this.initData(),this.initFormatter();const{isActive:e}=this.props;e&&this.subscribe()}componentDidUpdate(e){const{isActive:t,settings:n}=this.props;this.updateFormatterSettings(n),t!==e.isActive&&(t?this.subscribe():this.unsubscribe())}componentWillUnmount(){this.unsubscribe()}getPlotRect(){var e,t;return(t=(e=this.plotWrapper.current)==null?void 0:e.getBoundingClientRect())!=null?t:null}initData(){const{model:e}=this.props,{layout:t}=this.state;this.setState({data:e.getData(),layout:{...t,...e.getLayout()}})}subscribe(){if(this.isSubscribed)return;const{model:e}=this.props;if(!this.rect||this.rect.width===0||this.rect.height===0){Rn.debug2("Delaying subscription until model dimensions are set");return}e.subscribe(this.handleModelEvent),this.isSubscribed=!0}unsubscribe(){if(!this.isSubscribed)return;const{model:e}=this.props;e.unsubscribe(this.handleModelEvent),this.isSubscribed=!1}handleAfterPlot(){this.plot.current!=null}handleDownsampleClick(){this.setState(({isDownsamplingDisabled:e})=>({downsamplingError:null,isDownsampleInProgress:!1,isDownsampleFinished:!1,isDownsamplingDisabled:!e}),()=>{const{model:e}=this.props,{isDownsamplingDisabled:t}=this.state;e.setDownsamplingDisabled(t)})}handleModelEvent(e){var s;const{type:t,detail:n}=e;switch(Rn.debug2("Received data update",t,n),t){case Ze.EVENT_UPDATED:{this.currentSeries+=1,this.setState(i=>{const{layout:r,revision:l}=i;return typeof r.datarevision=="number"&&(r.datarevision+=1),{data:n,layout:r,revision:l+1}});const{onUpdate:o}=this.props;o({isLoading:!this.isLoadedFired});break}case Ze.EVENT_LOADFINISHED:{const{onUpdate:o}=this.props;this.isLoadedFired=!0,o({isLoading:!1});break}case Ze.EVENT_DISCONNECT:{const{onDisconnect:o}=this.props;o();break}case Ze.EVENT_RECONNECT:{const{onReconnect:o}=this.props;o();break}case Ze.EVENT_DOWNSAMPLESTARTED:{this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!0,downsamplingError:null});break}case Ze.EVENT_DOWNSAMPLEFINISHED:{this.setState({isDownsampleFinished:!0,isDownsampleInProgress:!1,downsamplingError:null});break}case Ze.EVENT_DOWNSAMPLENEEDED:case Ze.EVENT_DOWNSAMPLEFAILED:{const o=(s=n.message)!=null?s:n;this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,downsamplingError:o});const{onError:i}=this.props;i(new Error(o));break}default:Rn.debug("Unknown event type",t,e)}}handlePlotUpdate(e){const{layout:t}=e,n=we.getLayoutRanges(t);!rt(n,this.ranges)&&(this.ranges=n,this.updateModelDimensions(!0))}handleRelayout(e){if(Rn.debug("handleRelayout",e),e.hiddenlabels!=null){const{onSettingsChanged:t}=this.props,n=[...e.hiddenlabels];t({hiddenSeries:n})}this.updateModelDimensions()}handleRestyle([e,t]){if(Rn.debug("handleRestyle",e,t),Object.keys(e).includes("visible")){const{data:n}=this.state,{onSettingsChanged:s}=this.props;if(n!=null){const o=n.reduce((i,{name:r,visible:l})=>r!=null&&l==="legendonly"?[...i,r]:i,[]);s({hiddenSeries:o})}}}updateModelDimensions(e=!1){const t=this.getPlotRect();if(!t){Rn.warn("Unable to get plotting rect");return}if(!this.rect||this.rect.width!==t.width||this.rect.height!==t.height||e){this.rect=t;const{isActive:s,model:o}=this.props;o.setDimensions(t),s&&this.subscribe()}}initFormatter(){const{settings:e}=this.props;this.updateFormatterSettings(e)}updateFormatterSettings(e){const t=Zn.getColumnFormats(e),n=Zn.getDateTimeFormatterOptions(e),{decimalFormatOptions:s={},integerFormatOptions:o={}}=e;(!rt(this.columnFormats,t)||!rt(this.dateTimeFormatterOptions,n)||!rt(this.decimalFormatOptions,s)||!rt(this.integerFormatOptions,o))&&(this.columnFormats=Zn.getColumnFormats(e),this.dateTimeFormatterOptions=n,this.decimalFormatOptions=s,this.integerFormatOptions=o,this.updateFormatter())}updateFormatter(){const e=new zt(this.columnFormats,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions),{model:t}=this.props;t.setFormatter(e)}updateDimensions(){const e=this.getPlotRect();this.plot.current!=null&&e!=null&&e.width>0&&e.height>0&&Lo.relayout(this.plot.current.el,{autosize:!0}).catch(t=>{Rn.debug("Unable to resize, promise rejected",t)})}render(){const{data:e,downsamplingError:t,isDownsampleFinished:n,isDownsampleInProgress:s,isDownsamplingDisabled:o,layout:i,revision:r}=this.state,l=this.getCachedConfig(t,n,s,o),a=e!=null;return m("div",{className:"h-100 w-100 chart-wrapper",ref:this.plotWrapper,children:a&&m(dg,{ref:this.plot,data:e,layout:i,revision:r,config:l,onAfterPlot:this.handleAfterPlot,onError:Rn.error,onRelayout:this.handleRelayout,onUpdate:this.handlePlotUpdate,onRestyle:this.handleRestyle,useResizeHandler:!0,style:{height:"100%",width:"100%"}})})}};let Eg=Ws;Eg.defaultProps={isActive:!0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:cn.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,formatter:[]},onDisconnect:()=>{},onReconnect:()=>{},onUpdate:()=>{},onError:()=>{},onSettingsChanged:()=>{}};const st=ie.module("FigureChartModel"),ua=class extends Ze{constructor(e,t={},n=In){super(),this.addPendingSeries=vt(()=>{var r;const o=we.getAllAxes(this.figure),{pendingSeries:i}=this;for(let l=0;l<i.length;l+=1){const a=i[l],c=this.figure.charts.find(d=>d.series.includes(a));this.addSeries(a,o,(r=c==null?void 0:c.showLegend)!=null?r:null),a.subscribe()}this.pendingSeries=[]},ua.ADD_SERIES_DEBOUNCE),this.getTimeZone=be((o,i)=>{if(i!=null){const r=i.getColumnTypeFormatter(o);if(r!=null)return r.dhTimeZone}}),this.getValueTranslator=be((o,i)=>{const r=this.getTimeZone(o,i);return l=>we.unwrapValue(l,r)}),this.getValueParser=be((o,i)=>{const r=this.getTimeZone(o,i);return l=>we.wrapValue(l,o,r)}),this.getRangeParser=be((o,i)=>r=>{let[l,a]=r;const c=this.getValueParser(o,i);return l=c(l),a=c(a),[l,a]}),this.getAxisRangeParser=be((o,i)=>r=>{const l=we.getSourceForAxis(o,r);return l?this.getRangeParser(l.columnType,i):a=>a}),this.handleFigureUpdated=this.handleFigureUpdated.bind(this),this.handleFigureDisconnected=this.handleFigureDisconnected.bind(this),this.handleFigureReconnected=this.handleFigureReconnected.bind(this),this.handleFigureSeriesAdded=this.handleFigureSeriesAdded.bind(this),this.handleDownsampleStart=this.handleDownsampleStart.bind(this),this.handleDownsampleFinish=this.handleDownsampleFinish.bind(this),this.handleDownsampleFail=this.handleDownsampleFail.bind(this),this.handleDownsampleNeeded=this.handleDownsampleNeeded.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.figure=e,this.settings=t,this.theme=n,this.data=[];const s={data:{},layout:we.makeDefaultLayout(n)};this.layout={grid:{rows:e.rows,columns:e.cols,pattern:"independent"},template:s},this.seriesDataMap=new Map,this.pendingSeries=[],this.oneClicks=[],this.filterColumnMap=new Map,this.lastFilter=new Map,this.isConnected=!0,this.seriesToProcess=new Set,this.setTitle(this.getDefaultTitle()),this.initAllSeries(),this.updateAxisPositions(),this.startListeningFigure()}close(){this.figure.close(),this.addPendingSeries.cancel(),this.stopListeningFigure()}getDefaultTitle(){return this.figure.charts.length>0?this.figure.charts[0].title:""}initAllSeries(){this.oneClicks=[],this.filterColumnMap.clear();const{charts:e}=this.figure,t=we.getAllAxes(this.figure),n=[];for(let i=0;i<e.length;i+=1){const r=e[i];for(let l=0;l<r.series.length;l+=1){const a=r.series[l];n.push(a.name),this.addSeries(a,t,r.showLegend)}}const o=[...this.seriesDataMap.keys()].filter(i=>n.indexOf(i)<0);for(let i=0;i<o.length;i+=1){const r=o[i];this.seriesDataMap.delete(r)}this.seriesToProcess=new Set([...this.seriesDataMap.keys()])}addSeries(e,t,n){const s=we.groupArray(t,"type"),o=we.makeSeriesDataFromSeries(e,s,we.getSeriesVisibility(e.name,this.settings),n,this.theme);if(this.seriesDataMap.set(e.name,o),this.data=[...this.seriesDataMap.values()],e.plotStyle===E.plot.SeriesPlotStyle.STACKED_BAR?this.layout.barmode="stack":e.plotStyle===E.plot.SeriesPlotStyle.PIE&&(this.layout.hiddenlabels=we.getHiddenLabels(this.settings)),this.layout.showlegend=this.data.length>1||e.plotStyle===E.plot.SeriesPlotStyle.PIE?n!=null?n:void 0:!1,e.oneClick!=null){const{oneClick:i}=e,{columns:r}=i;for(let l=0;l<r.length;l+=1)this.filterColumnMap.set(r[l].name,r[l]);this.oneClicks.push(i)}this.updateLayoutFormats()}subscribe(e){super.subscribe(e),this.listeners.length===1&&(this.initAllSeries(),this.subscribeFigure())}unsubscribe(e){super.unsubscribe(e),this.listeners.length===0&&this.unsubscribeFigure()}subscribeFigure(){if(!this.isConnected){st.debug("Ignoring subscribe when figure in disconnected state");return}this.figure.subscribe(this.isDownsamplingDisabled?E.plot.DownsampleOptions.DISABLE:E.plot.DownsampleOptions.DEFAULT)}unsubscribeFigure(){this.figure.unsubscribe()}startListeningFigure(){this.figure.addEventListener(E.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.addEventListener(E.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.addEventListener(E.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.addEventListener(E.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.addEventListener(E.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.addEventListener(E.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.addEventListener(E.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.addEventListener(E.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.addEventListener(E.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}stopListeningFigure(){this.figure.removeEventListener(E.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.removeEventListener(E.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.removeEventListener(E.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.removeEventListener(E.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.removeEventListener(E.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.removeEventListener(E.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.removeEventListener(E.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.removeEventListener(E.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.removeEventListener(E.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}handleDownsampleStart(e){st.debug("Downsample started",e),this.fireDownsampleStart(e.detail)}handleDownsampleFinish(e){st.debug("Downsample finished",e),this.fireDownsampleFinish(e.detail)}handleDownsampleFail(e){st.error("Downsample failed",e),this.fireDownsampleFail(e.detail)}handleDownsampleNeeded(e){st.info("Downsample needed",e),this.fireDownsampleNeeded(e.detail)}handleFigureUpdated(e){const{detail:t}=e,{series:n}=t;st.debug2("handleFigureUpdated",n);for(let o=0;o<n.length;o+=1){const i=n[o];st.debug2("handleFigureUpdated updating series",i.name);const{sources:r}=i;for(let l=0;l<r.length;l+=1){const a=r[l],{columnType:c,type:d}=a,u=this.getValueTranslator(c,this.formatter),h=t.getArray(i,d,u);this.setDataArrayForSeries(i,d,h)}this.seriesToProcess.delete(i.name),this.seriesToProcess.size===0&&this.fireLoadFinished(),this.cleanSeries(i)}const{data:s}=this;this.fireUpdate(s)}handleRequestFailed(e){st.error("Request failed",e)}resubscribe(){this.listeners.length>0&&(this.unsubscribeFigure(),this.subscribeFigure())}setFormatter(e){super.setFormatter(e),this.updateLayoutFormats(),this.resubscribe()}setDownsamplingDisabled(e){super.setDownsamplingDisabled(e),this.resubscribe()}handleFigureDisconnected(e){st.debug("Figure disconnected",e),this.isConnected=!1,this.listeners.length>0&&this.unsubscribeFigure(),this.fireDisconnect()}handleFigureReconnected(e){st.debug("Figure reconnected",e),this.isConnected=!0,this.initAllSeries(),this.fireReconnect(),this.listeners.length>0&&this.subscribeFigure()}handleFigureSeriesAdded(e){const{detail:t}=e;st.debug("handleFigureSeriesAdded",t),this.pendingSeries.push(t),this.addPendingSeries()}setDimensions(e){super.setDimensions(e),this.updateAxisPositions()}setTitle(e){var s,o;super.setTitle(e);const t=(o=(s=(e!=null?e:"").match(/<br>/g))==null?void 0:s.length)!=null?o:0,n=we.DEFAULT_MARGIN.t+t*we.SUBTITLE_LINE_HEIGHT;this.layout.margin?this.layout.margin.t=n:this.layout.margin={t:n},typeof this.layout.title=="string"?this.layout.title=e:(this.layout.title={...this.layout.title},this.layout.title.text=e,this.layout.title.pad={...this.layout.title.pad},this.layout.title.pad.t=we.DEFAULT_TITLE_PADDING.t+t*we.SUBTITLE_LINE_HEIGHT*.5)}getPlotWidth(){var e,t,n,s;return!this.rect||!this.rect.width?0:Math.max(this.rect.width-((t=(e=this.layout.margin)==null?void 0:e.l)!=null?t:0)-((s=(n=this.layout.margin)==null?void 0:n.r)!=null?s:0),0)}getPlotHeight(){var e,t,n,s;return!this.rect||!this.rect.height?0:Math.max(this.rect.height-((t=(e=this.layout.margin)==null?void 0:e.t)!=null?t:0)-((s=(n=this.layout.margin)==null?void 0:n.b)!=null?s:0),0)}updateAxisPositions(){const e=this.getPlotWidth(),t=this.getPlotHeight();we.updateFigureAxes(this.layout,this.figure,n=>this.getAxisRangeParser(n,this.formatter),e,t,this.theme)}updateLayoutFormats(){if(!this.formatter)return;we.getAxisFormats(this.figure,this.formatter).forEach((t,n)=>{st.debug(`Assigning ${n}`,this.layout[n],t);const s=this.layout[n];s!=null?Object.assign(s,t):st.debug(`Ignoring null layout.${n}`)})}setDataArrayForSeries(e,t,n){const{name:s,plotStyle:o}=e,i=this.seriesDataMap.get(s),r=we.getPlotlyProperty(o,t);i&&ol(i,r,n)}cleanSeries(e){const{name:t,plotStyle:n}=e,s=this.seriesDataMap.get(t);if(s!=null){if(n===E.plot.SeriesPlotStyle.HISTOGRAM){const{xLow:o,xHigh:i}=s;if(o&&i&&o.length===i.length){const r=[];for(let l=0;l<o.length;l+=1)r.push(i[l]-o[l]);s.width=r}}else if(n===E.plot.SeriesPlotStyle.LINE){const{x:o,xLow:i,xHigh:r,y:l,yLow:a,yHigh:c}=s;i&&r&&i!==o&&(s.error_x=we.getPlotlyErrorBars(o,i,r)),a&&c&&a!==l&&(s.error_y=we.getPlotlyErrorBars(l,a,c))}else if(n===E.plot.SeriesPlotStyle.TREEMAP){const{ids:o,labels:i}=s;o!==void 0&&i===void 0&&(s.labels=o)}}}getData(){return this.data}getLayout(){return this.layout}getFilterColumnMap(){return new Map(this.filterColumnMap)}isFilterRequired(){return this.oneClicks.find(e=>e.requireAllFiltersToDisplay)!=null}setFilter(e){if(this.oneClicks.length===0){st.warn("Trying to set a filter, but no one click!");return}st.debug("setFilter",e);for(let t=0;t<this.oneClicks.length;t+=1){const n=this.oneClicks[t],{columns:s}=n;new Set([...e.keys(),...this.lastFilter.keys()]).forEach(i=>{const r=e.get(i);this.lastFilter.get(i)!==r&&s.find(l=>l.name===i)!=null&&n.setValueForColumn(i,r)})}this.lastFilter=new Map(e)}setFigure(e){this.close(),this.figure=e,this.setTitle(this.getDefaultTitle()),this.initAllSeries(),this.updateAxisPositions(),this.startListeningFigure(),this.listeners.length>0&&this.subscribeFigure()}updateSettings(e){this.settings=e}};let vg=ua;vg.ADD_SERIES_DEBOUNCE=50;function Rg({text:e,isOpen:t,onClose:n}){var T,R;const[s,o]=F.exports.useState(!1),[i,r]=F.exports.useState(0),[l,a]=F.exports.useState(!1),[c,d]=F.exports.useState(!1),[u,h]=F.exports.useState(!1),g=F.exports.useRef();F.exports.useEffect(function(){if(!!t){try{JSON.parse(e),h(!0)}catch{h(!1)}d(!1)}},[t,e]),F.exports.useEffect(function(){g.current&&g.current.layout()},[i]),F.exports.useEffect(function(){g.current&&g.current.updateOptions({lineNumbers:l?"on":"off"})},[l]);function p(){a(!l)}function f(){var v;const b=(v=g.current)==null?void 0:v.getModel();!u||!b||(c?(b.setValue(e),d(!1)):(b.setValue(JSON.stringify(JSON.parse(e),void 0,2)),d(!0)),C())}function C(){var v,D;const b=g.current;!b||a(((D=(v=b.getModel())==null?void 0:v.getLineCount())!=null?D:0)>1)}function w(){s&&(g.current=void 0,n())}function S(b){g.current=b,r(b.getContentHeight()),b.onDidContentSizeChange(({contentHeight:v})=>r(v)),C()}return!t&&!s?null:y(Ec,{isOpen:t,centered:!0,keyboard:!0,toggle:w,onOpened:()=>o(!0),onClosed:()=>{o(!1),r(0)},className:"theme-bg-dark cell-overflow-modal",size:"xl",children:[y(vc,{toggle:n,children:[m("h5",{className:"overflow-modal-title",children:"Cell Contents"}),m(gl,{kind:"inline",tooltip:"Copy cell contents",copy:(R=(T=g.current)==null?void 0:T.getValue())!=null?R:e}),m(z,{kind:"inline",active:l,icon:Rc,tooltip:"Toggle line numbers",onClick:p}),u&&m(z,{kind:"inline",icon:yc,active:c,tooltip:"Format as JSON",onClick:f})]}),m(Fc,{style:{height:i},children:m(or,{onEditorInitialized:S,settings:{value:e,readOnly:!0,wordWrap:"on",language:u?"typescript":"plaintext",folding:u,padding:{bottom:16},lineNumbers:l?"on":"off",overviewRulerLanes:0,renderLineHighlight:"none",find:{seedSearchStringFromSelection:"never"}}})})]})}function yg(e){return e.model!==void 0}const Fg="###,##0";function Dg({gotoRow:e,gotoRowError:t,gotoValueError:n,onGotoRowSubmit:s,isShown:o,onEntering:i,onEntered:r,onExiting:l,onExited:a,model:c,onGotoRowNumberChanged:d,onClose:u,gotoValueSelectedColumnName:h,gotoValue:g,onGotoValueSelectedColumnNameChanged:p,onGotoValueSelectedFilterChanged:f,onGotoValueChanged:C,onGotoValueSubmit:w}){const S=F.exports.useRef(null),T=F.exports.useRef(null),[R,b]=F.exports.useState(!1);let v=[];yg(c)&&c.table!==void 0&&({columns:v}=c.table);const D="Row number",{rowCount:A}=c,N=$=>{$.key==="Enter"&&($.stopPropagation(),$.preventDefault(),w())},L=c.getColumnIndexByName(h),k=v[L!=null?L:0],x=k==null?void 0:k.type,W=I.getNormalizedType(x),V=$=>{C($!=null?$:"")},K=()=>{var $,P;R&&document.activeElement!==S.current?($=S.current)==null||$.select():!R&&document.activeElement!==T.current&&((P=T.current)==null||P.select())};F.exports.useEffect(K,[R,e,g]);const Z=()=>{switch(W){case I.dataType.DECIMAL:case I.dataType.INT:return m("div",{className:"goto-row-input",children:m("input",{ref:T,type:"number",className:ee("form-control",{"is-invalid":n!==""}),onKeyDown:N,placeholder:"value",onChange:$=>V($.target.value),value:g})});case I.dataType.DATETIME:return m("div",{className:"goto-value-date-time-input",children:m(Nc,{className:ee("form-control","goto-value-date-time-input",{"is-invalid":n!==""}),onChange:V})});case I.dataType.STRING:return y(Oe,{children:[m("div",{className:"goto-row-input",children:y("select",{className:"custom-select",onChange:$=>{f($.target.value)},children:[m("option",{value:_.eq,children:"Equals"},_.eq),m("option",{value:_.contains,children:"Contains"},_.contains),m("option",{value:_.eqIgnoreCase,children:"EqIgnoreCase"},_.eqIgnoreCase)]})}),m("div",{className:"goto-row-input",children:m("input",{ref:T,className:ee("form-control",{"is-invalid":n!==""}),onKeyDown:N,placeholder:"value",onChange:$=>V($.target.value),value:g})})]});case I.dataType.BOOLEAN:return m("div",{className:"goto-row-input",children:y("select",{className:"custom-select",onChange:$=>{V($.target.value)},value:g,children:[m("option",{value:"true",children:"true"},"true"),m("option",{value:"false",children:"false"},"false")]})});default:return m("div",{className:"goto-row-input",children:m("input",{ref:T,className:"form-control",onKeyDown:N,placeholder:"value",onChange:$=>V($.target.value),value:g})})}};return m(Zo,{isShown:o,className:ee("goto-row"),onEntering:i,onEntered:()=>{r(),K()},onExiting:l,onExited:a,children:y(Oe,{children:[y("div",{className:"goto-row-row",children:[y("div",{className:ee("goto-row-wrapper",{"is-inactive":!R}),onClick:()=>b(!0),onFocus:()=>b(!0),role:"group",children:[m("div",{className:"goto-row-text",children:"Go to row"}),m("div",{className:"goto-row-input",children:m("input",{ref:S,type:"number",onKeyDown:$=>{$.key==="Enter"&&($.stopPropagation(),$.preventDefault(),s())},className:ee("form-control",{"is-invalid":t!==""}),placeholder:D,onChange:$=>{d($)},value:e})}),y("div",{className:"goto-row-text",children:["of ",dh.i18n.NumberFormat.format(Fg,A)]}),t&&m("div",{className:"text-danger",children:t})]}),m("div",{className:"goto-row-close",children:m(z,{kind:"ghost",onClick:u,children:m(te,{icon:qs,style:{marginRight:"0"}})})})]}),c.isSeekRowAvailable&&m("div",{className:"goto-row-row",children:y("div",{className:ee("goto-row-wrapper",{"is-inactive":R}),onClick:()=>b(!1),onFocus:()=>b(!1),role:"group",children:[m("div",{className:"goto-row-text",children:"Go to value"}),m("div",{className:"goto-row-input",children:m("select",{className:"custom-select",onChange:$=>{const P=$.target.value;p(P)},value:h,children:v.map($=>m("option",{value:$.name,children:$.name},$.name))})}),Z(),y("div",{children:[m(z,{kind:"ghost",disabled:g==="",onClick:()=>{w(!0)},children:m(te,{icon:Dc})}),m(z,{kind:"ghost",disabled:g==="",onClick:()=>{w(!1)},children:m(te,{icon:Ic})})]}),n&&m("div",{className:"text-danger",children:n})]})})]})})}const oe=ie.module("IrisGrid"),Ig=500,Ng=250,Ag=250,Mg=250,ha=Object.freeze({aggregations:ve,showOnTop:!1}),Og="yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS z";function nl({advancedFilters:e,aggregationSettings:t,customColumns:n,quickFilters:s,reverseType:o,rollupConfig:i,searchFilter:r,selectDistinctColumns:l,sorts:a}){return e.size===0&&t.aggregations.length===0&&n.length===0&&s.size===0&&o===I.REVERSE_TYPE.NONE&&i==null&&r==null&&l.length===0&&a.length===0}const Nn=class extends F.exports.Component{constructor(e){var Z,$;super(e),this.getAdvancedMenuOpenedHandler=be(P=>this.handleAdvancedMenuOpened.bind(this,P),{max:100}),this.getCachedAdvancedFilterMenuActions=be((P,G,X,j,de)=>m(Ji,{model:P,column:G,onFilterChange:this.handleAdvancedFilterChange,onSortChange:this.handleAdvancedFilterSortChange,onDone:this.handleAdvancedFilterDone,options:X,sortDirection:j,formatter:de}),{max:50}),this.getCachedOptionItems=be((P,G,X,j,de,me,Ce,ye,fe,Je,Xe,$e,Mt,Ct,hn,Ot)=>{const De=[];return P&&De.push({type:Se.CHART_BUILDER,title:"Chart Builder",icon:Ac}),De.push({type:Se.VISIBILITY_ORDERING_BUILDER,title:"Hide, Group, and Order Columns",icon:Gi}),X&&De.push({type:Se.CONDITIONAL_FORMATTING,title:"Conditional Formatting",icon:Pi}),G&&De.push({type:Se.CUSTOM_COLUMN_BUILDER,title:"Custom Columns",icon:Mc}),j&&De.push({type:Se.ROLLUP_ROWS,title:"Rollup Rows",icon:Oc}),de&&De.push({type:Se.AGGREGATIONS,title:"Aggregate Columns",icon:xc}),me&&De.push({type:Se.SELECT_DISTINCT,title:"Select Distinct Values",icon:kc}),Ce&&Mt&&De.push({type:Se.TABLE_EXPORTER,title:"Download CSV",icon:Lc}),Ot&&De.push({type:Se.ADVANCED_SETTINGS,title:"Advanced Settings",icon:Pc}),De.push({type:Se.QUICK_FILTERS,title:"Quick Filters",subtitle:ye.shortcut.getDisplayText(),icon:Oo,isOn:Xe,onChange:ye.action}),Ct&&De.push({type:Se.SEARCH_BAR,title:"Search Bar",subtitle:fe.shortcut.getDisplayText(),icon:_c,isOn:$e,onChange:fe.action}),De.push({type:Se.GOTO,title:"Go to",subtitle:Je.shortcut.getDisplayText(),icon:Hc,isOn:hn,onChange:Je.action}),Object.freeze(De)},{max:1}),this.getCachedHiddenColumns=be((P,G)=>J.getHiddenColumns(new Map([...P.initialColumnWidths,...G])),{max:1}),this.getAggregationMap=be((P,G)=>{const X={};return G.forEach(({operation:j,selected:de,invert:me})=>{X[j]=On.getOperationColumnNames(P,j,de,me)}),X}),this.getOperationMap=be((P,G)=>{const X={};return G.filter(j=>!On.isRollupOperation(j.operation)).forEach(({operation:j,selected:de,invert:me})=>{On.getOperationColumnNames(P,j,de,me).forEach(Ce=>{var fe;const ye=[...(fe=X[Ce])!=null?fe:[],j];X[Ce]=Object.freeze(ye)})}),X}),this.getOperationOrder=be(P=>P.map(G=>G.operation).filter(G=>!On.isRollupOperation(G))),this.getCachedFormatColumns=be((P,G)=>pu(P,G)),this.getCachedModelColumns=be((P,G)=>P.columns),this.getCachedPreviewFormatColumns=be((P,G,X,j)=>{if(oe.debug("getCachedPreviewFormatColumns",G,X,j),X!==void 0&&j!==void 0){const de=[...G];return de[j]=X,this.getCachedFormatColumns(P,de)}return this.getCachedFormatColumns(P,G)}),this.getModelRollupConfig=be((P,G,X)=>J.getModelRollupConfig(P,G,X)),this.getModelTotalsConfig=be((P,G,X)=>{var ye,fe,Je;const{aggregations:j,showOnTop:de}=X;if(((fe=(ye=G==null?void 0:G.columns)==null?void 0:ye.length)!=null?fe:0)>0||((Je=j==null?void 0:j.length)!=null?Je:0)===0)return null;const me=this.getOperationMap(P,j),Ce=this.getOperationOrder(j);return{operationMap:me,operationOrder:Ce,showOnTop:de}}),this.getCachedStateOverride=be((P,G,X,j,de,me,Ce,ye,fe,Je)=>({hoverSelectColumn:P,isFilterBarShown:G,isSelectingColumn:X,loadingScrimProgress:j,quickFilters:de,advancedFilters:me,sorts:Ce,reverseType:ye,rollupConfig:fe,isMenuShown:Je}),{max:1}),this.getCachedFilter=be((P,G,X,j,de)=>[...P!=null?P:[],...j!=null?j:[],...J.getFiltersFromFilterMap(G),...J.getFiltersFromFilterMap(X),...de!==void 0?[de]:[]],{max:1}),this.getCachedTheme=be((P,G,X)=>({...Al,...P,autoSelectRow:!G,rowFooterWidth:X>0?P.rowFooterWidth:0}),{max:1}),this.getAlwaysFetchColumns=be((P,G,X,j,de,me)=>{const Ce=[];for(let fe=0;fe<j;fe+=1)Ce.push(G[H.getModelIndex(fe,X)].name);for(let fe=0;fe<de;fe+=1)Ce.push(G[H.getModelIndex(G.length-1-fe,X)].name);if(me)for(let fe=me[0];fe<=me[1];fe+=1)Ce.push(G[H.getModelIndex(fe,X)].name);const ye=new Set([...P,...Ce]);return Object.freeze([...ye])}),this.updateSearchFilter=vt((P,G,X,j)=>{const de=Io.createSearchFilter(P,G,X,j);this.setState({searchFilter:de})},Ng),this.handleConditionalFormatEditorUpdate=vt(P=>{this.setState({conditionalFormatPreview:P})},Mg),this.handleDownloadProgressUpdate=Pn((P,G)=>{const{tableDownloadStatus:X}=this.state;X===gt.DOWNLOAD_STATUS.DOWNLOADING&&this.setState({tableDownloadProgress:P,tableDownloadEstimatedTime:G})},Ig),this.getOverflowButtonTooltip=be(P=>{if(P==null)return null;const G={position:"absolute",...P,pointerEvents:"none"};return m("div",{style:G,children:m(Rt,{options:{placement:"left",modifiers:{flip:{behavior:["left","right"]}}},ref:this.handleTooltipRef,children:"View full contents"},Date.now())})}),this.getExpandCellTooltip=be(P=>{if(P==null)return null;const{expandTooltipDisplayValue:G}=this.state,X={position:"absolute",...P,pointerEvents:"none"};return m("div",{style:X,children:m(Rt,{options:{placement:"bottom-start"},ref:this.handleTooltipRef,children:y("div",{style:{textAlign:"left"},children:["Click to ",G," row",m("br",{}),_n.isMacPlatform()?"\u2318":"Ctrl+","Click to expand row and all children"]})},Date.now())})}),this.handleGotoValueChanged=P=>{this.setState({gotoValue:P}),this.debouncedSeekRow(P)},this.debouncedSeekRow=vt(P=>{this.seekRow(P)},Ag),this.handleAdvancedFilterChange=this.handleAdvancedFilterChange.bind(this),this.handleAdvancedFilterSortChange=this.handleAdvancedFilterSortChange.bind(this),this.handleAdvancedFilterDone=this.handleAdvancedFilterDone.bind(this),this.handleAdvancedMenuOpened=this.handleAdvancedMenuOpened.bind(this),this.handleGotoRowOpened=this.handleGotoRowOpened.bind(this),this.handleGotoRowClosed=this.handleGotoRowClosed.bind(this),this.handleAdvancedMenuClosed=this.handleAdvancedMenuClosed.bind(this),this.handleAggregationChange=this.handleAggregationChange.bind(this),this.handleAggregationsChange=this.handleAggregationsChange.bind(this),this.handleAggregationEdit=this.handleAggregationEdit.bind(this),this.handleAnimationLoop=this.handleAnimationLoop.bind(this),this.handleAnimationStart=this.handleAnimationStart.bind(this),this.handleAnimationEnd=this.handleAnimationEnd.bind(this),this.handleChartChange=this.handleChartChange.bind(this),this.handleChartCreate=this.handleChartCreate.bind(this),this.handleGridError=this.handleGridError.bind(this),this.handleFilterBarChange=this.handleFilterBarChange.bind(this),this.handleFilterBarDone=this.handleFilterBarDone.bind(this),this.handleFilterBarTab=this.handleFilterBarTab.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleMenu=this.handleMenu.bind(this),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleMenuSelect=this.handleMenuSelect.bind(this),this.handleMenuBack=this.handleMenuBack.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.handleSelectionChanged=this.handleSelectionChanged.bind(this),this.handleMovedColumnsChanged=this.handleMovedColumnsChanged.bind(this),this.handleHeaderGroupsChanged=this.handleHeaderGroupsChanged.bind(this),this.handleUpdate=this.handleUpdate.bind(this),this.handleTooltipRef=this.handleTooltipRef.bind(this),this.handleViewChanged=this.handleViewChanged.bind(this),this.handleFormatSelection=this.handleFormatSelection.bind(this),this.handleConditionalFormatCreate=this.handleConditionalFormatCreate.bind(this),this.handleConditionalFormatEdit=this.handleConditionalFormatEdit.bind(this),this.handleConditionalFormatsChange=this.handleConditionalFormatsChange.bind(this),this.handleConditionalFormatEditorSave=this.handleConditionalFormatEditorSave.bind(this),this.handleConditionalFormatEditorCancel=this.handleConditionalFormatEditorCancel.bind(this),this.handleUpdateCustomColumns=this.handleUpdateCustomColumns.bind(this),this.handleCustomColumnsChanged=this.handleCustomColumnsChanged.bind(this),this.handleSelectDistinctChanged=this.handleSelectDistinctChanged.bind(this),this.handlePendingDataUpdated=this.handlePendingDataUpdated.bind(this),this.handlePendingCommitClicked=this.handlePendingCommitClicked.bind(this),this.handlePendingDiscardClicked=this.handlePendingDiscardClicked.bind(this),this.handleGotoRowSelectedRowNumberSubmit=this.handleGotoRowSelectedRowNumberSubmit.bind(this),this.focusRowInGrid=this.focusRowInGrid.bind(this),this.handleDownloadTable=this.handleDownloadTable.bind(this),this.handleDownloadTableStart=this.handleDownloadTableStart.bind(this),this.handleCancelDownloadTable=this.handleCancelDownloadTable.bind(this),this.handleDownloadCanceled=this.handleDownloadCanceled.bind(this),this.handleDownloadCompleted=this.handleDownloadCompleted.bind(this),this.handlePartitionAppend=this.handlePartitionAppend.bind(this),this.handlePartitionChange=this.handlePartitionChange.bind(this),this.handlePartitionFetchAll=this.handlePartitionFetchAll.bind(this),this.handlePartitionDone=this.handlePartitionDone.bind(this),this.handleColumnVisibilityChanged=this.handleColumnVisibilityChanged.bind(this),this.handleColumnVisibilityReset=this.handleColumnVisibilityReset.bind(this),this.handleCrossColumnSearch=this.handleCrossColumnSearch.bind(this),this.handleRollupChange=this.handleRollupChange.bind(this),this.handleOverflowClose=this.handleOverflowClose.bind(this),this.getColumnBoundingRect=this.getColumnBoundingRect.bind(this),this.handleGotoRowSelectedRowNumberChanged=this.handleGotoRowSelectedRowNumberChanged.bind(this),this.handleGotoValueSelectedColumnNameChanged=this.handleGotoValueSelectedColumnNameChanged.bind(this),this.handleGotoValueSelectedFilterChanged=this.handleGotoValueSelectedFilterChanged.bind(this),this.handleGotoValueChanged=this.handleGotoValueChanged.bind(this),this.handleGotoValueSubmitted=this.handleGotoValueSubmitted.bind(this),this.grid=null,this.gridWrapper=null,this.lastLoadedConfig=null,this.pending=new Xo,this.globalColumnFormats=ve,this.decimalFormatOptions={},this.integerFormatOptions={},this.truncateNumbersWithPound=!1,this.renderer=new zs,this.tableSaver=null,this.crossColumnRef=Fe.createRef(),this.isAnimating=!1,this.filterInputRef=Fe.createRef(),this.toggleFilterBarAction={action:()=>this.toggleFilterBar(),shortcut:It.TABLE.TOGGLE_QUICK_FILTER},this.toggleSearchBarAction={action:()=>this.toggleSearchBar(),shortcut:It.TABLE.TOGGLE_SEARCH},this.toggleGotoRowAction={action:()=>this.toggleGotoRow(),shortcut:It.TABLE.GOTO_ROW},this.discardAction={action:()=>{const{model:P}=this.props;ke(P)&&P.isEditable&&P.pendingDataMap.size>0&&this.discardPending().catch(oe.error)},shortcut:It.INPUT_TABLE.DISCARD},this.commitAction={action:()=>{const{model:P}=this.props;ke(P)&&P.isEditable&&P.pendingDataMap.size>0&&P.pendingDataErrors.size===0&&this.commitPending().catch(oe.error)},shortcut:It.INPUT_TABLE.COMMIT},this.contextActions=[this.toggleFilterBarAction,this.toggleSearchBarAction,this.toggleGotoRowAction,this.discardAction,this.commitAction];const{aggregationSettings:t,conditionalFormats:n,customColumnFormatMap:s,isFilterBarShown:o,isSelectingPartition:i,model:r,movedColumns:l,movedRows:a,partition:c,partitionColumn:d,rollupConfig:u,userColumnWidths:h,userRowHeights:g,showSearchBar:p,searchValue:f,selectedSearchColumns:C,invertSearchColumns:w,advancedFilters:S,quickFilters:T,selectDistinctColumns:R,pendingDataMap:b,canCopy:v,frozenColumns:D,columnHeaderGroups:A}=e,N=[new Nu(this),new Au(this)];v&&N.push(new Fu(this));const L=[new Mu(this),new _u(this),new Ou(this),new xu(this),new Hu(this),new Pu(this),new Yt(this),new Lu(this),new Vu(this)],k=l.length>0?l:r.initialMovedColumns,x=a.length>0?a:r.initialMovedRows,W=new Gu({userColumnWidths:new Map(h),userRowHeights:new Map(g),movedColumns:k,initialColumnWidths:new Map(($=(Z=r==null?void 0:r.layoutHints)==null?void 0:Z.hiddenColumns)==null?void 0:$.map(P=>[r.getColumnIndexByName(P),0]))}),V=C!=null?C:[],K=Io.createSearchFilter(f,V,r.columns,w);this.state={isFilterBarShown:o,isSelectingPartition:i,focusedFilterBarColumn:null,metricCalculator:W,metrics:void 0,keyHandlers:N,mouseHandlers:L,partition:c,partitionColumn:d,partitionTable:null,partitionFilters:[],quickFilters:T?new Map(T):new Map,advancedFilters:new Map(S),shownAdvancedFilter:null,hoverAdvancedFilter:null,sorts:[],reverseType:I.REVERSE_TYPE.NONE,customColumns:[],selectDistinctColumns:R,selectedRanges:[],copyOperation:null,loadingText:null,loadingScrimProgress:null,loadingSpinnerShown:!1,movedColumns:k,movedRows:x,shownColumnTooltip:null,formatter:new zt,isMenuShown:!1,customColumnFormatMap:new Map(s),conditionalFormats:n,conditionalFormatEditIndex:null,conditionalFormatPreview:void 0,hoverSelectColumn:null,isTableDownloading:!1,isReady:!1,tableDownloadStatus:"",tableDownloadProgress:0,tableDownloadEstimatedTime:0,showSearchBar:p,searchFilter:K,searchValue:f,selectedSearchColumns:V,invertSearchColumns:w,rollupConfig:u,rollupSelectedColumns:[],aggregationSettings:t,selectedAggregation:null,openOptions:[],pendingRowCount:0,pendingDataMap:b!=null?b:new Map,pendingDataErrors:new Map,pendingSavePromise:null,pendingSaveError:null,toastMessage:null,frozenColumns:D,showOverflowModal:!1,overflowText:"",overflowButtonTooltipProps:null,expandCellTooltipProps:null,expandTooltipDisplayValue:"expand",isGotoShown:!1,gotoRow:"",gotoRowError:"",gotoValueError:"",gotoValueSelectedColumnName:r.columns[0].name,gotoValueSelectedFilter:_.eq,gotoValue:"",columnHeaderGroups:A!=null?A:r.initialColumnHeaderGroups}}static makeQuickFilter(e,t,n){try{return I.makeQuickFilter(e,t,n)}catch(s){oe.error("Error creating quick filter",s)}return null}componentDidMount(){const{partitionColumn:e,model:t}=this.props,n=e!=null?e:t.columns.find(s=>s.isPartitionColumn);t.isFilterRequired&&t.isValuesTableAvailable&&n!=null?this.loadPartitionsTable(n):this.initState(),this.startListening(t)}componentDidUpdate(e){var d;const{inputFilters:t,isSelectingColumn:n,settings:s,model:o,customFilters:i,sorts:r}=this.props;o!==e.model&&(this.stopListening(e.model),this.startListening(o));const l=t!==e.inputFilters?t.filter(u=>!e.inputFilters.includes(u)):[];if(l.length>0){const{advancedSettings:u}=this.props,h=(d=u.get(ts.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS))!=null?d:!1;h&&(this.clearGridInputField(),this.clearCrossColumSearch()),this.startLoading("Filtering...",!0),this.applyInputFilters(l,h)}n!==e.isSelectingColumn&&this.resetColumnSelection(),s!==e.settings&&this.updateFormatterSettings(s),i!==e.customFilters&&this.startLoading("Filtering...",!0),r!==e.sorts&&this.updateSorts(r);const{loadingScrimStartTime:a,loadingScrimFinishTime:c}=this;a!=null&&c!=null&&window.requestAnimationFrame(()=>{const u=Date.now(),h=u-a,g=c-a,p=Math.min(h/g,1);c<u&&(this.loadingScrimStartTime=void 0,this.loadingScrimFinishTime=void 0),this.setState(f=>f.loadingScrimProgress==null?(oe.debug2("Ignoring scrim update because loading cancelled."),null):{loadingScrimProgress:p})}),this.sendStateChange()}componentWillUnmount(){const{model:e}=this.props;this.stopListening(e),this.pending.cancel(),this.updateSearchFilter.cancel(),this.loadingTimer&&clearTimeout(this.loadingTimer),this.handleDownloadProgressUpdate.cancel(),this.animationFrame!==void 0&&cancelAnimationFrame(this.animationFrame)}getValueForCell(e,t,n=!1){const{model:s}=this.props,o=this.getModelColumn(e),i=this.getModelRow(t);if(n&&o!=null&&i!=null){const r=s.valueForCell(o,i);if(I.isDateType(s.columns[o].type)){const{formatter:l}=s;return E.i18n.DateTimeFormat.format(Og,r,E.i18n.TimeZone.getTimeZone(l.timeZone))}return r}return n?null:o!=null&&i!=null?s.textForCell(o,i):""}getModelColumn(e){const{metrics:t}=this.state;M(t);const{modelColumns:n}=t;return n==null?null:e!=null?n.get(e):null}getModelRow(e){const{metrics:t}=this.state;M(t);const{modelRows:n}=t;return n==null?null:e!=null?n.get(e):null}getTheme(){var n;const{model:e,theme:t}=this.props;return this.getCachedTheme(t,(n=ke(e)&&e.isEditable)!=null?n:!1,e.floatingTopRowCount+e.floatingBottomRowCount)}getVisibleColumn(e){const{movedColumns:t}=this.state;return H.getVisibleIndex(e,t)}applyInputFilters(e,t=!1){const{model:n}=this.props,{advancedFilters:s,quickFilters:o}=this.state,i=t?new Map:new Map(s),r=t?new Map:new Map(o);let l=t&&s.size>0;e.forEach(({name:a,type:c,value:d})=>{const u=n.columns.findIndex(({name:h,type:g})=>h===a&&g===c);u>=0?(l=i.delete(u)||l,l=this.applyQuickFilter(u,d,r)||l):oe.error("Unable to find column for inputFilter",a,c,d)}),l&&this.setState({quickFilters:r,advancedFilters:i})}applyQuickFilter(e,t,n){const{model:s}=this.props,{formatter:o}=s,i=s.columns[e];if(t!=null&&`${t}`.trim().length>0){const r=n.get(e);if(r!=null){const{text:l}=r;if(l===t)return oe.debug2("Ignoring change to existing filter"),!1}return n.set(e,{text:t,filter:Nn.makeQuickFilter(i,t,o.timeZone)}),!0}return n.delete(e)}setAdvancedFilterMap(e){this.setState({advancedFilters:e})}setAdvancedFilter(e,t,n){oe.debug("Setting advanced filter",e,t),this.startLoading("Filtering...",!0),this.setState(({advancedFilters:s})=>{const o=new Map(s);return t==null?o.delete(e):o.set(e,{filter:t,options:n}),{advancedFilters:o}})}setQuickFilter(e,t,n){oe.debug("Setting quick filter",e,t,n),this.startLoading("Filtering...",!0),this.setState(({quickFilters:s})=>{const o=new Map(s);return o.set(e,{filter:t,text:n}),{quickFilters:o}})}setFilterMap(e){var o;oe.debug("setFilterMap",e);const{advancedSettings:t}=this.props;((o=t.get(ts.LINK_CHANGE_CLEARS_ALL_FILTERS))!=null?o:!1)&&this.clearAllFilters();const{model:s}=this.props;e.forEach(({columnType:i,filterList:r},l)=>{const a=s.columns.find(u=>u.name===l&&u.type===i);if(a==null)return;const c=s.getColumnIndexByName(a.name);M(c);const d=J.combineFiltersFromList(i,r);if(d.length===0)this.removeQuickFilter(c);else{const{formatter:u}=s;this.setQuickFilter(c,Nn.makeQuickFilter(a,d,u.timeZone),`${d}`)}})}removeColumnFilter(e){this.startLoading("Filtering...",!0),this.setState(({advancedFilters:t,quickFilters:n})=>{const s=t?new Map(t):new Map,o=n?new Map(n):new Map;return o.delete(e),s.delete(e),{quickFilters:o,advancedFilters:s}})}removeQuickFilter(e){this.startLoading("Clearing Filter...",!0),this.setState(({quickFilters:t})=>{const n=new Map(t);return n.delete(e),{quickFilters:n}})}clearAllFilters(){oe.debug("Clearing all filters");const{advancedFilters:e,quickFilters:t,searchFilter:n}=this.state;t.size===0&&e.size===0&&n===null||(this.clearGridInputField(),this.startLoading("Clearing Filters...",!0),this.setState({quickFilters:new Map,advancedFilters:new Map,searchValue:"",searchFilter:void 0}))}clearCrossColumSearch(){oe.debug("Clearing cross-column search"),this.setState({searchValue:"",searchFilter:void 0})}clearGridInputField(){this.filterInputRef.current!=null&&this.filterInputRef.current.setValue("")}rebuildFilters(){oe.debug("Rebuilding filters");const{model:e}=this.props,{advancedFilters:t,quickFilters:n}=this.state,{columns:s,formatter:o}=e,i=new Map,r=new Map;t.forEach((l,a)=>{const{options:c}=l,d=s[a],u=I.makeAdvancedFilter(d,c,o.timeZone);i.set(a,{options:c,filter:u})}),n.forEach((l,a)=>{const{text:c}=l,d=s[a];r.set(a,{text:c,filter:Nn.makeQuickFilter(d,c,o.timeZone)})}),this.startLoading("Rebuilding filters...",!0),this.setState({quickFilters:r,advancedFilters:i})}setFilters({quickFilters:e,advancedFilters:t}){this.setState({quickFilters:e,advancedFilters:t})}updateFormatterSettings(e,t=!0){var h,g,p;const n=Zn.getColumnFormats(e),s=Zn.getDateTimeFormatterOptions(e),o=(h=e==null?void 0:e.defaultDecimalFormatOptions)!=null?h:{},i=(g=e==null?void 0:e.defaultIntegerFormatOptions)!=null?g:{},r=(p=e==null?void 0:e.truncateNumbersWithPound)!=null?p:!1,l=!rt(this.globalColumnFormats,n),a=!rt(this.dateTimeFormatterOptions,s),c=!rt(this.decimalFormatOptions,e==null?void 0:e.defaultDecimalFormatOptions),d=!rt(this.integerFormatOptions,i),u=this.truncateNumbersWithPound!==r;(l||a||c||d||u)&&(this.globalColumnFormats=n,this.dateTimeFormatterOptions=s,this.decimalFormatOptions=o,this.integerFormatOptions=i,this.truncateNumbersWithPound=r,this.updateFormatter({},t),a&&t&&this.rebuildFilters())}updateFormatter(e,t=!0){var r;const{customColumnFormatMap:n}=this.state,s={customColumnFormatMap:n,...e},o=[...(r=this.globalColumnFormats)!=null?r:[],...s.customColumnFormatMap.values()],i=new zt(o,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions,this.truncateNumbersWithPound);oe.debug("updateFormatter",this.globalColumnFormats,o),this.setState({...s,formatter:i},()=>{t&&this.grid&&this.grid.forceUpdate()})}initFormatter(){const{settings:e}=this.props;this.updateFormatterSettings(e)}initState(){const{applyInputFiltersOnInit:e,inputFilters:t,sorts:n,model:s,reverseType:o,customColumns:i,searchValue:r,selectedSearchColumns:l,invertSearchColumns:a}=this.props,c=l!=null?l:[],d=Io.createSearchFilter(r,c,s.columns,a);if(e){const u=t.filter(h=>h.value!=null);this.applyInputFilters(u)}this.setState({sorts:n,reverseType:o,customColumns:i,isReady:!0,searchFilter:d}),this.initFormatter()}async loadPartitionsTable(e){const{model:t}=this.props;this.setState({isSelectingPartition:!0});try{const n=await this.pending.add(t.valuesTable(e),r=>r.close()),s=n.columns[0],o=s.sort().desc();n.applySort([o]),n.setViewport(0,0,[s]);const i=await this.pending.add(n.getViewportData());if(i.rows.length>0){const l=i.rows[0].get(s);this.updatePartition(l,e),this.setState({isSelectingPartition:!0})}else oe.info("Table does not have any data, just fetching all"),this.setState({isSelectingPartition:!1}),this.handlePartitionFetchAll();this.setState({partitionTable:n,partitionColumn:e},()=>{this.initState()})}catch(n){this.handleTableLoadError(n)}}updatePartition(e,t){const s=[t.filter().eq(E.FilterValue.ofString(e))];this.setState({partition:e,partitionFilters:s})}copyCell(e,t,n=!1){const{canCopy:s}=this.props;if(s){const o=String(this.getValueForCell(e,t,n));zo(o).catch(i=>oe.error("Unable to copy cell",i))}else oe.error("Attempted to copyCell for user without copy permission.")}copyRanges(e,t=!1,n=!0,s){const{model:o,canCopy:i}=this.props,{metricCalculator:r,movedColumns:l}=this.state,a=r.getUserColumnWidths();if(i){const c={ranges:Q.boundedRanges(e,o.columnCount,o.rowCount),includeHeaders:t,formatValues:n,movedColumns:l,userColumnWidths:a,error:s};this.setState({copyOperation:c})}else oe.error("Attempted copyRanges for user without copy permission.")}startLoading(e,t=!1){var s,o;this.setState({loadingText:e});const n=this.getTheme();if(t&&this.grid&&(this.grid.clearSelectedRanges(),this.grid.setViewState({top:0},!0)),this.loadingScrimStartTime==null){const{minScrimTransitionTime:i,maxScrimTransitionTime:r}=n;M(i),M(r);const l=(o=(s=this.gridWrapper)==null?void 0:s.getBoundingClientRect().height)!=null?o:0,a=Math.max(i,Math.min(l/2,r));this.loadingScrimStartTime=Date.now(),this.loadingScrimFinishTime=this.loadingScrimStartTime+a,this.setState({loadingScrimProgress:0}),this.loadingTimer=setTimeout(()=>{this.setState({loadingSpinnerShown:!0})},Nn.loadingSpinnerDelay)}}stopLoading(){this.loadingScrimStartTime=void 0,this.loadingScrimFinishTime=void 0,this.setState({loadingText:null,loadingScrimProgress:null,loadingSpinnerShown:!1}),this.loadingTimer!=null&&(clearTimeout(this.loadingTimer),this.loadingTimer=void 0)}rollback(){if(this.lastLoadedConfig){oe.debug("loading last loading config",this.lastLoadedConfig);const{advancedFilters:e,aggregationSettings:t,customColumns:n,quickFilters:s,reverseType:o,rollupConfig:i,searchFilter:r,selectDistinctColumns:l,sorts:a}=this.lastLoadedConfig;this.lastLoadedConfig=null,this.setState({advancedFilters:e,aggregationSettings:t,customColumns:n,quickFilters:s,reverseType:o,rollupConfig:i,searchFilter:r,selectDistinctColumns:l,sorts:a})}else oe.debug("remove all sorts, filters, and custom columns"),this.setState({advancedFilters:new Map,aggregationSettings:ha,customColumns:[],quickFilters:new Map,reverseType:I.REVERSE_TYPE.NONE,rollupConfig:void 0,selectDistinctColumns:[],sorts:[]})}canRollback(){return this.lastLoadedConfig!=null||!nl(this.state)}startListening(e){e.addEventListener(ce.EVENT.UPDATED,this.handleUpdate),e.addEventListener(ce.EVENT.REQUEST_FAILED,this.handleRequestFailed),e.addEventListener(ce.EVENT.COLUMNS_CHANGED,this.handleCustomColumnsChanged),e.addEventListener(ce.EVENT.PENDING_DATA_UPDATED,this.handlePendingDataUpdated)}stopListening(e){e.removeEventListener(ce.EVENT.UPDATED,this.handleUpdate),e.removeEventListener(ce.EVENT.REQUEST_FAILED,this.handleRequestFailed),e.removeEventListener(ce.EVENT.COLUMNS_CHANGED,this.handleCustomColumnsChanged),e.removeEventListener(ce.EVENT.PENDING_DATA_UPDATED,this.handlePendingDataUpdated)}focus(){var e;(e=this.grid)==null||e.focus()}focusFilterBar(e){var d,u,h;const{movedColumns:t}=this.state,{model:n}=this.props,{columnCount:s}=n,o=H.getModelIndex(e,t);if(e==null||e<0||s<=e||!n.isFilterable(o)){this.setState({focusedFilterBarColumn:null});return}const{metricCalculator:i,metrics:r}=this.state;M(r);const{left:l,rightVisible:a,lastLeft:c}=r;if(e<l)(d=this.grid)==null||d.setViewState({left:e},!0);else if(a<e){const g=(u=this.grid)==null?void 0:u.getMetricState();M(g);const p=i.getLastLeft(g,e,i.getVisibleWidth(g));(h=this.grid)==null||h.setViewState({left:Math.min(p,c),leftOffset:0},!0)}this.lastFocusedFilterBarColumn=e,this.setState({focusedFilterBarColumn:e,isFilterBarShown:!0})}hideColumnByVisibleIndex(e){var s;const{metricCalculator:t,movedColumns:n}=this.state;t.setColumnWidth(H.getModelIndex(e,n),0),(s=this.grid)==null||s.forceUpdate()}freezeColumnByColumnName(e){const{frozenColumns:t,movedColumns:n}=this.state,{model:s}=this.props;oe.debug2("freezing column",e);const o=t==null?new Set(s.frozenColumns):new Set(t);o.add(e);const i=s.getColumnIndexByName(e);M(i);const r=H.getVisibleIndex(i,n),l=H.moveItem(r,o.size-1,n);this.setState({frozenColumns:[...o],movedColumns:l})}unFreezeColumnByColumnName(e){const{frozenColumns:t,movedColumns:n}=this.state,{model:s}=this.props;oe.debug2("unfreezing column",e);const o=t==null?new Set(s.frozenColumns):new Set(t);o.delete(e);const i=s.getColumnIndexByName(e);M(i);const r=H.getVisibleIndex(i,n),l=H.moveItem(r,o.size+s.frontColumns.length,n);this.setState({frozenColumns:[...o],movedColumns:l})}handleColumnVisibilityChanged(e,t){var o;const{metricCalculator:n,metrics:s}=this.state;M(s),t?e.forEach(i=>{const r=n.initialColumnWidths.get(i),l=O(s.calculatedColumnWidths,i);r!==l?n.setColumnWidth(i,l):n.resetColumnWidth(i)}):e.forEach(i=>{n.setColumnWidth(i,0)}),(o=this.grid)==null||o.forceUpdate()}handleColumnVisibilityReset(){var s,o;const{metricCalculator:e,metrics:t}=this.state,{model:n}=this.props;M(t);for(let i=0;i<t.columnCount;i+=1)e.resetColumnWidth(i);this.handleMovedColumnsChanged(n.initialMovedColumns),this.handleHeaderGroupsChanged(n.initialColumnHeaderGroups),this.setState({frozenColumns:(o=(s=n.layoutHints)==null?void 0:s.frozenColumns)!=null?o:[]})}handleCrossColumnSearch(e,t,n){const{model:s}=this.props;this.updateSearchFilter(e,t,s.columns,n),this.setState({searchValue:e,selectedSearchColumns:t,invertSearchColumns:n})}handleAnimationLoop(){var e,t;(e=this.grid)==null||e.updateCanvasScale(),(t=this.grid)==null||t.updateCanvas(),this.isAnimating&&(this.animationFrame=requestAnimationFrame(this.handleAnimationLoop))}handleAnimationStart(){oe.debug2("handleAnimationStart"),this.isAnimating=!0,this.animationFrame=requestAnimationFrame(this.handleAnimationLoop)}handleAnimationEnd(){oe.debug2("handleAnimationEnd"),this.isAnimating=!1}handlePartitionAppend(e){const{onPartitionAppend:t}=this.props,{partitionColumn:n}=this.state;n!=null&&t(n,e)}handlePartitionChange(e){const{partitionColumn:t}=this.state;t!=null&&this.updatePartition(e,t)}handlePartitionFetchAll(){this.setState({partitionFilters:[],isSelectingPartition:!1})}handlePartitionDone(){this.setState({isSelectingPartition:!1})}handleTableLoadError(e){if(Ge.isCanceled(e))return;oe.error(e);const{onError:t}=this.props;t(e)}showAllColumns(){var s;const{metricCalculator:e}=this.state,n=[...e.getUserColumnWidths().entries()];for(let o=0;o<n.length;o+=1){const[i,r]=n[o];r===0&&e.resetColumnWidth(i)}(s=this.grid)==null||s.forceUpdate()}toggleSort(e,t){oe.info("Toggling sort for column",e);const{model:n}=this.props,{sorts:s}=this.state,o=this.getModelColumn(e);M(o);const i=I.toggleSortForColumn(s,n.columns,o,t);this.updateSorts(i)}updateSorts(e){var t;this.startLoading("Sorting..."),this.setState({sorts:e}),(t=this.grid)==null||t.forceUpdate()}sortColumn(e,t=I.sortDirection.none,n=!1,s=!1){var r;M(e);const{model:o}=this.props,i=I.sortColumn(o.sort,o.columns,e,t,n,s);this.startLoading("Sorting..."),this.setState({sorts:i}),(r=this.grid)==null||r.forceUpdate()}reverse(e){var t;this.startLoading("Reversing..."),this.setState({reverseType:e}),(t=this.grid)==null||t.forceUpdate()}isReversible(){const{model:e}=this.props;return e.isReversible}toggleFilterBar(e=this.lastFocusedFilterBarColumn){var n;let{isFilterBarShown:t}=this.state;if(t=!t,this.setState({isFilterBarShown:t}),t)if(e!=null)this.focusFilterBar(e);else{let s=0;const{model:o}=this.props,{columnCount:i}=o;for(let r=0;r<i;r+=1){const l=this.getModelColumn(r);if(l!=null){const a=o.columns[l];if(a!=null&&I.isTextType(a.type)){s=r;break}}}this.focusFilterBar(s)}else(n=this.grid)==null||n.focus()}isTableSearchAvailable(){var s,o,i;const{model:e,canToggleSearch:t}=this.props,n=(s=e==null?void 0:e.layoutHints)==null?void 0:s.searchDisplayMode;return n===((o=E.SearchDisplayMode)==null?void 0:o.SEARCH_DISPLAY_HIDE)?!1:n===((i=E.SearchDisplayMode)==null?void 0:i.SEARCH_DISPLAY_SHOW)?!0:t}toggleSearchBar(){const{showSearchBar:e}=this.state;if(!this.isTableSearchAvailable())return;const t=!e;this.setState({showSearchBar:t},()=>{var n,s,o;t&&((n=this.crossColumnRef)==null?void 0:n.current)?(s=this.crossColumnRef)==null||s.current.focus():(o=this.grid)==null||o.focus()})}toggleGotoRow(e="",t="",n=""){const{isGotoShown:s}=this.state;if(e||t){this.setState({isGotoShown:!0,gotoRow:e,gotoValue:t,gotoValueSelectedColumnName:n,gotoRowError:"",gotoValueError:""}),this.focusRowInGrid(e);return}this.setState({isGotoShown:!s,gotoRow:"",gotoValue:"",gotoRowError:"",gotoValueError:""})}async commitPending(){var o,i;const{model:e}=this.props;if(!ke(e)||!e.isEditable)throw new Error("Cannot save, table is not editable");const{pendingSavePromise:t}=this.state;if(t!=null)throw new Error("Save already in progress");const n=(o=document==null?void 0:document.activeElement)==null?void 0:o.classList.contains("grid-cell-input-field");if(n!=null&&n){if(document.activeElement!=null&&document.activeElement.classList.contains("error"))throw new Xc("Current input is invalid");(i=this.grid)==null||i.focus()}const s=this.pending.add(e.commitPending()).then(()=>{this.setState({pendingSaveError:null,pendingSavePromise:null})}).catch(r=>{Ge.isCanceled(r)||this.setState({pendingSaveError:r,pendingSavePromise:null})});return this.setState({pendingSavePromise:s}),s}async discardPending(){const{pendingSavePromise:e}=this.state;if(e!=null)throw new Error("Cannot cancel a save in progress");this.setState({pendingSavePromise:null,pendingSaveError:null,pendingDataMap:new Map,pendingDataErrors:new Map})}selectColumn(e){const{onColumnSelected:t}=this.props;t(e)}selectData(e,t){const{model:n}=this.props,{columns:s,groupedColumns:o}=n,i={};for(let l=0;l<s.length;l+=1){const a=s[l],{name:c,type:d}=a,u=n.valueForCell(l,t),h=n.textForCell(l,t),g=this.getVisibleColumn(l),p=Ae(n)&&n.isRowExpandable(t),f=o.find(C=>C.name===c)!=null;i[c]={value:u,text:h,type:d,isGrouped:f,isExpandable:p,visibleIndex:g}}const{onDataSelected:r}=this.props;r(t,i)}handleAdvancedFilterChange(e,t,n){const{model:s}=this.props,o=s.getColumnIndexByName(e.name);M(o),this.setAdvancedFilter(o,t,n)}handleAdvancedFilterSortChange(e,t,n=!1){var a;const{model:s}=this.props,o=s.getColumnIndexByName(e.name);M(o);const i=I.getSortForColumn(s.sort,o);let r=null;(i==null||i.direction!==t)&&(t===I.sortDirection.descending?r=e.sort().desc():r=e.sort().asc());const l=I.setSortForColumn(s.sort,o,r,n);oe.info("Setting table sorts",l),this.startLoading("Sorting..."),this.setState({sorts:l}),(a=this.grid)==null||a.forceUpdate()}handleAdvancedFilterDone(){var e;(e=this.grid)==null||e.focus()}handleAdvancedMenuOpened(e){this.setState({shownAdvancedFilter:e})}handleGotoRowOpened(){this.setState({isGotoShown:!0})}handleGotoRowClosed(){this.setState({isGotoShown:!1})}handleAdvancedMenuClosed(e){var s,o;const{focusedFilterBarColumn:t,isFilterBarShown:n}=this.state;n&&t===e&&((s=this.filterInputRef)==null?void 0:s.current)!==null?((o=this.filterInputRef)==null||o.current.focus(),this.setState({shownAdvancedFilter:null})):this.setState({focusedFilterBarColumn:null,shownAdvancedFilter:null})}handleCancel(){this.rollback()}handleChartChange(){}handleChartCreate(e){const{model:t,onCreateChart:n}=this.props;n(e,t)}handleGridError(e){oe.warn("Grid Error",e),this.setState({toastMessage:m("div",{className:"error-message",children:`${e}`})})}handleFilterBarChange(e){this.startLoading("Filtering...",!0),this.setState(({focusedFilterBarColumn:t,quickFilters:n})=>{const s=new Map(n);if(t!=null){const o=this.getModelColumn(t);M(o),this.applyQuickFilter(o,e,s)}return{quickFilters:s}})}handleFilterBarDone(e=!0,t=!0){var n;e&&((n=this.grid)==null||n.focus()),t&&this.setState({focusedFilterBarColumn:null})}handleFilterBarTab(e){const{focusedFilterBarColumn:t}=this.state;M(t),e?this.focusFilterBar(t-1):this.focusFilterBar(t+1)}handleFormatSelection(e,t){const{model:n}=this.props,s=n.columns[e],{customColumnFormatMap:o}=this.state,i=new Map(o);if(t!=null){const r=I.getNormalizedType(s.type);M(r);const l=zt.makeColumnFormattingRule(r,s.name,t);i.set(s.name,l)}else i.delete(s.name);this.updateFormatter({customColumnFormatMap:i})}handleMenu(e){e.stopPropagation(),this.setState({isMenuShown:!0})}handleMenuClose(){this.setState({isMenuShown:!1,openOptions:[]})}handleMenuBack(){this.setState(({openOptions:e})=>{const t=[...e];return t.pop(),{openOptions:t}})}handleMenuSelect(e){this.setState(({openOptions:t})=>({openOptions:[...t,e]}))}handleRequestFailed(e){const t=e;if(oe.error("request failed:",t.detail),this.stopLoading(),this.canRollback())this.startLoading("Rolling back changes...",!0),this.rollback();else{oe.error("Table failed and unable to rollback");const{onError:n}=this.props;n(new Error(`Error displaying table: ${t.detail}`))}}handleUpdate(){var d;this.stopLoading(),oe.debug2("Received model update");const{advancedFilters:e,aggregationSettings:t,customColumns:n,quickFilters:s,reverseType:o,rollupConfig:i,searchFilter:r,selectDistinctColumns:l,sorts:a}=this.state,c={advancedFilters:e,aggregationSettings:t,customColumns:n,quickFilters:s,reverseType:o,rollupConfig:i,searchFilter:r,selectDistinctColumns:l,sorts:a};nl(c)?this.lastLoadedConfig=null:this.lastLoadedConfig=c,(d=this.grid)==null||d.forceUpdate()}handleViewChanged(e){var o,i;const{model:t}=this.props,{selectionEndRow:n=0}=(i=(o=this.grid)==null?void 0:o.state)!=null?i:{};let s=0;if(ke(t)&&t.isEditable){M(e);const{bottomViewport:r}=e,l=t.rowCount-t.floatingBottomRowCount;n===l-1?s=t.pendingRowCount+1:n===l-2?s=t.pendingRowCount:s=Math.max(0,r-(t.rowCount-t.pendingRowCount)-t.floatingTopRowCount-t.floatingBottomRowCount-1)}this.setState({metrics:e,pendingRowCount:s})}handleSelectionChanged(e){M(e);const{onSelectionChanged:t}=this.props,{copyOperation:n}=this.state;this.setState({selectedRanges:e}),n!=null&&this.setState({copyOperation:null}),t(e)}handleMovedColumnsChanged(e,t){this.setState({movedColumns:e},t)}handleHeaderGroupsChanged(e){const{model:t}=this.props;this.setState({columnHeaderGroups:J.parseColumnHeaderGroups(t,e).groups},()=>{var n;return(n=this.grid)==null?void 0:n.forceUpdate()})}handleTooltipRef(e){e!=null&&e.startTimer(),this.tooltip=e}handleConditionalFormatsChange(e){oe.debug("Updated conditional formats",e),this.setState({conditionalFormats:e})}handleConditionalFormatCreate(){oe.debug("Create new conditional format");const{openOptions:e,conditionalFormats:t}=this.state;this.setState({openOptions:[...e,{type:Se.CONDITIONAL_FORMATTING_EDIT,title:"Create Formatting Rule"}],conditionalFormatEditIndex:t.length,conditionalFormatPreview:void 0})}handleConditionalFormatEdit(e){oe.debug("Edit conditional format",e);const{openOptions:t,conditionalFormats:n}=this.state;this.setState({openOptions:[...t,{type:Se.CONDITIONAL_FORMATTING_EDIT,title:"Edit Formatting Rule"}],conditionalFormatEditIndex:e,conditionalFormatPreview:{...n[e]}})}handleConditionalFormatEditorSave(e){oe.debug("Save conditional format changes",e),this.setState(t=>{if(t.conditionalFormatEditIndex===null)return oe.debug("Invalid format index"),null;const n=[...t.conditionalFormats];return n[t.conditionalFormatEditIndex]=e,{conditionalFormats:n}},()=>{this.handleMenuBack()})}handleConditionalFormatEditorCancel(){this.handleMenuBack(),this.setState({conditionalFormatEditIndex:null})}handleUpdateCustomColumns(e){oe.info("handleUpdateCustomColumns:",e);const{model:t}=this.props,{movedColumns:n,sorts:s,quickFilters:o,advancedFilters:i,selectDistinctColumns:r}=this.state,{columns:l}=t,a=t.customColumns.map(d=>`${d}`),c=J.getRemovedCustomColumnNames(a,e);if(c.length>0){const d=J.removeSortsInColumns(s,c),u=J.removeFiltersInColumns(l,o,c),h=J.removeFiltersInColumns(l,i,c),g=J.removeColumnFromMovedColumns(l,n,c),p=J.removeColumnsFromSelectDistinctColumns(r,c);d.length!==s.length&&(oe.debug("removing sorts from removed custom columns..."),this.setState({sorts:d})),(u.size!==o.size||h.size!==i.size)&&(oe.debug("removing filters from removed custom columns..."),this.setState({quickFilters:u,advancedFilters:h})),rt(n,g)||(oe.debug("change moved columns for removed custom columns",g),this.setState({movedColumns:g})),rt(r,p)||(oe.debug("change selectDistinct columns for removed custom columns",g),this.setState({selectDistinctColumns:p}))}this.setState({customColumns:e}),e.length>0&&this.startLoading("Applying custom columns...")}handleCustomColumnsChanged(){var t;oe.debug("custom columns changed");const{isReady:e}=this.state;e?(this.stopLoading(),(t=this.grid)==null||t.forceUpdate()):this.initState()}handlePendingCommitClicked(){return this.commitPending()}handlePendingDiscardClicked(){return this.discardPending()}handlePendingDataUpdated(){var s;oe.debug("pending data updated");const{model:e}=this.props,{pendingDataMap:t,pendingDataErrors:n}=e;this.setState({pendingDataMap:t,pendingDataErrors:n,pendingSaveError:null}),(s=this.grid)==null||s.forceUpdate()}handleAggregationsChange(e){oe.debug("handleAggregationsChange",e),this.startLoading(`Aggregating ${e.aggregations.map(t=>t.operation).join(", ")}...`),this.setState({aggregationSettings:e})}handleAggregationChange(e){oe.debug("handleAggregationChange",e),this.startLoading(`Aggregating ${e.operation}...`),this.setState(({aggregationSettings:t})=>({selectedAggregation:e,aggregationSettings:{...t,aggregations:t.aggregations.map(n=>n.operation===e.operation?e:n)}}))}handleAggregationEdit(e){oe.debug("handleAggregationEdit",e);const{openOptions:t}=this.state;this.setState({openOptions:[...t,{type:Se.AGGREGATION_EDIT,title:`Edit Columns to ${e.operation}`}],selectedAggregation:e})}handleRollupChange(e){var t,n;oe.info("Rollup change",e),this.resetGridViewState(),this.showAllColumns(),this.clearAllFilters(),this.startLoading(`Grouping by columns ${(n=(t=e==null?void 0:e.columns)==null?void 0:t.join(", "))!=null?n:""}...`),this.setState({rollupConfig:e,movedColumns:[],sorts:[],reverseType:I.REVERSE_TYPE.NONE,selectDistinctColumns:[]})}handleSelectDistinctChanged(e){oe.debug("SelectDistinct change",e),this.resetGridViewState(),this.showAllColumns(),this.clearAllFilters(),this.startLoading(`Selecting distinct values in ${e.length>0?e.join(", "):""}...`),this.setState({selectDistinctColumns:e,movedColumns:[],sorts:[],reverseType:I.REVERSE_TYPE.NONE})}handleDownloadTableStart(){const{canDownloadCsv:e}=this.props;e?this.setState({isTableDownloading:!0,tableDownloadProgress:0,tableDownloadEstimatedTime:null,tableDownloadStatus:gt.DOWNLOAD_STATUS.INITIATING}):oe.error("Attempted to handleDownloadTableStart for user without download CSV permission.")}handleDownloadTable(e,t,n,s,o,i,r){const{canDownloadCsv:l}=this.props;l?(oe.info("start table downloading",e,t,n,s,o,i,r),this.setState(()=>(this.tableSaver&&this.tableSaver.startDownload(e,t,n,s,o,i,r),{tableDownloadStatus:gt.DOWNLOAD_STATUS.DOWNLOADING}))):oe.error("Attempted to handleDownloadTable for user without download CSV permission.")}async seekRow(e,t=!1){var d;const{gotoValueSelectedColumnName:n,gotoValueSelectedFilter:s}=this.state,{model:o}=this.props;if(!o.isSeekRowAvailable||e==="")return;const i=o.getColumnIndexByName(n);if(i===void 0)return;const r=o.columns[i];let l;this.grid&&({selectionEndRow:l}=this.grid.state),l==null&&(l=0);const a=s===_.contains,c=s===_.eq||s===_.eqIgnoreCase;try{const u=I.getNormalizedType(r.type);let h;switch(u){case I.dataType.STRING:{h=await o.seekRow(t===!0?l-1:l+1,r,E.ValueType.STRING,e,c,a,t!=null?t:!1);break}case I.dataType.DATETIME:{const{formatter:g}=o,[p]=cn.parseDateRange(e,g.timeZone);h=await o.seekRow(t===!0?l-1:l+1,r,E.ValueType.DATETIME,p,void 0,void 0,t!=null?t:!1);break}case I.dataType.DECIMAL:case I.dataType.INT:{if(!I.isBigDecimalType(r.type)&&!I.isBigIntegerType(r.type)){const g=parseInt(e,10);h=await o.seekRow(l,r,E.ValueType.NUMBER,g,void 0,void 0,t!=null?t:!1)}else h=await o.seekRow(l,r,E.ValueType.STRING,e,void 0,void 0,t!=null?t:!1);break}default:h=await o.seekRow(l,r,E.ValueType.STRING,e,void 0,void 0,t!=null?t:!1)}(d=this.grid)==null||d.setFocusRow(h),this.setState({gotoValueError:""})}catch{this.setState({gotoValueError:"invalid input"})}}handleCancelDownloadTable(){var e;(e=this.tableSaver)==null||e.cancelDownload(),this.setState({isTableDownloading:!1})}handleDownloadCompleted(){this.setState({isTableDownloading:!1,tableDownloadProgress:100,tableDownloadStatus:gt.DOWNLOAD_STATUS.FINISHED})}handleDownloadCanceled(){this.setState({isTableDownloading:!1,tableDownloadProgress:0,tableDownloadStatus:gt.DOWNLOAD_STATUS.CANCELED})}deleteRanges(e){const{model:t}=this.props;this.pending.add(t.delete(e)).catch(n=>{Ge.isCanceled(n)||oe.error("Unable to delete ranges",e,n)})}resetColumnSelection(){if(this.grid==null)return;const{isSelectingColumn:e}=this.props;if(e){const{columnAllowedCursor:t}=this.props;this.grid.setState({cursor:t})}else this.grid.setState({cursor:null}),this.setState({hoverSelectColumn:null})}resetGridViewState(e=!0){!this.grid||(this.grid.clearSelectedRanges(),this.grid.setViewState({left:0,top:0,topOffset:0,leftOffset:0},e))}sendStateChange(){if(!this.grid)return;const{state:e}=this,{state:t}=this.grid,{onStateChange:n}=this.props;n(e,t)}handleOverflowClose(){this.setState({showOverflowModal:!1})}getColumnBoundingRect(){var h;const{metrics:e,shownColumnTooltip:t}=this.state;M(e),M(t);const n=(h=this.gridWrapper)==null?void 0:h.getBoundingClientRect(),s=20;M(n);const{columnHeaderHeight:o,allColumnXs:i,allColumnWidths:r,width:l,columnHeaderMaxDepth:a}=e,c=i.get(t),d=r.get(t);M(c),M(d);const u=n.left+Be(c+d/2,s,l-s);return{top:n.top+(a-1)*o,left:n.left+Be(c+d/2,s,l-s),bottom:n.top+a*o,right:n.left+Be(c+d/2,s,l-s)+1,width:1,height:o,x:u,y:n.top,toJSON:()=>{throw new Error("not implemented")}}}handleGotoRowSelectedRowNumberSubmit(){const{gotoRow:e}=this.state;this.focusRowInGrid(e)}focusRowInGrid(e){var o,i,r;const{model:t}=this.props,{rowCount:n}=t;if(this.setState({gotoRow:e}),e===""){this.setState({gotoRowError:"",gotoValueError:""});return}const s=parseInt(e,10);s>n||s<-n?this.setState({gotoRowError:"Invalid row index"}):s===0?(this.setState({gotoRowError:"",gotoValueError:""}),(o=this.grid)==null||o.setFocusRow(0)):s<0?(this.setState({gotoRowError:"",gotoValueError:""}),(i=this.grid)==null||i.setFocusRow(s+n)):((r=this.grid)==null||r.setFocusRow(s-1),this.setState({gotoRowError:"",gotoValueError:""}))}handleGotoRowSelectedRowNumberChanged(e){const t=e.target.value;this.focusRowInGrid(t)}getColumnTooltip(e,t,n){const{columnHeaderHeight:s,columnHeaderMaxDepth:o,allColumnXs:i,allColumnWidths:r,width:l}=t,a=i.get(e),c=r.get(e);if(a==null||c==null)return null;const d=Math.max(0,a);let u=c;a+c>l?u=l-a:a<0&&(u=c-Math.abs(a));const h={position:"absolute",top:(o-1)*s,left:d,width:u,height:s,pointerEvents:"none"},g={clientWidth:1,clientHeight:s,getBoundingClientRect:this.getColumnBoundingRect},p={placement:"bottom",modifiers:{flip:{behavior:["bottom","top"]}}},f=this.getModelColumn(e);if(f==null)return null;const C=n.columns[f];return C==null?null:m("div",{style:h,children:m(Rt,{timeout:400,interactive:!0,options:p,ref:this.handleTooltipRef,referenceObject:g,onExited:()=>{this.setState({shownColumnTooltip:null})},children:m(Ml,{model:n,column:C,onStatistics:()=>{var w;(w=this.tooltip)==null||w.update()}})},C.name)})}handleGotoValueSelectedColumnNameChanged(e){this.setState({gotoValueSelectedColumnName:e,gotoValueError:""})}handleGotoValueSelectedFilterChanged(e){this.setState({gotoValueSelectedFilter:e,gotoValueError:""})}handleGotoValueSubmitted(e){const{gotoValue:t}=this.state;this.seekRow(t,e)}render(){var wo,So,bo,We,rs,ar,cr,dr,ur;const{children:e,customFilters:t,getDownloadWorker:n,isSelectingColumn:s,isStuckToBottom:o,isStuckToRight:i,model:r,name:l,onlyFetchVisibleColumns:a,alwaysFetchColumns:c,advancedSettings:d,onAdvancedSettingsChange:u,canDownloadCsv:h,onCreateChart:g}=this.props,{metricCalculator:p,metrics:f,isFilterBarShown:C,isSelectingPartition:w,isMenuShown:S,isReady:T,copyOperation:R,focusedFilterBarColumn:b,loadingText:v,loadingScrimProgress:D,loadingSpinnerShown:A,keyHandlers:N,mouseHandlers:L,shownColumnTooltip:k,hoverAdvancedFilter:x,shownAdvancedFilter:W,hoverSelectColumn:V,quickFilters:K,advancedFilters:Z,partition:$,partitionFilters:P,partitionTable:G,partitionColumn:X,searchFilter:j,selectDistinctColumns:de,movedColumns:me,movedRows:Ce,formatter:ye,conditionalFormats:fe,conditionalFormatPreview:Je,conditionalFormatEditIndex:Xe,sorts:$e,reverseType:Mt,customColumns:Ct,selectedRanges:hn,isTableDownloading:Ot,tableDownloadStatus:De,tableDownloadProgress:ge,tableDownloadEstimatedTime:Ke,showSearchBar:ze,searchValue:lt,selectedSearchColumns:wt,invertSearchColumns:mn,aggregationSettings:xt,selectedAggregation:eo,rollupConfig:Xt,openOptions:St,pendingSavePromise:gn,pendingSaveError:ss,pendingRowCount:Ds,pendingDataErrors:os,pendingDataMap:is,toastMessage:to,frozenColumns:no,columnHeaderGroups:pn,showOverflowModal:Hn,overflowText:ni,overflowButtonTooltipProps:so,expandCellTooltipProps:Is,isGotoShown:Ns,gotoRow:oo,gotoRowError:io,gotoValueError:si,gotoValueSelectedColumnName:oi,gotoValue:ii}=this.state;if(!T)return null;const Vn=this.getTheme(),ri=this.getCachedFilter(t,K,Z,P,j),ro=p.getUserColumnWidths(),lo=this.getCachedStateOverride(V,C,s,D,K,Z,$e,Mt,Xt,S),As=f?f.top:0,ao=f?f.bottomViewport:0;let fn=null,Ms=null;a&&(fn=f?f.left:0,Ms=f?f.right:0);const co=f!=null&&f.width>0&&f.height>0,uo=((So=(wo=Xt==null?void 0:Xt.columns)==null?void 0:wo.length)!=null?So:0)>0;let Os=null;const li=f?Math.min(Math.max(Nn.minDebounce,Math.round(f.rowCount/200)),Nn.maxDebounce):Nn.maxDebounce;if(C&&b!=null&&f!=null){const{gridX:xe,gridY:ut,allColumnXs:Cn,allColumnWidths:xs,width:ls}=f,kt=Cn.get(b),at=xs.get(b);if(kt!=null&&at!=null){const nt=xe+kt,Kt=ut-((bo=Vn.filterBarHeight)!=null?bo:0),Un=at+1,Bn=((We=Vn.filterBarHeight)!=null?We:0)-1,To={top:Kt,left:nt,minWidth:Math.min(Un,ls-nt),height:Bn};let Lt="",as=!0;const Gn=this.getModelColumn(b);M(Gn);const cs=K.get(Gn),wn=Z.get(Gn);cs!=null&&(Lt=cs.text,as=cs.filter!=null);const ds=K.size!==0||Z.size!==0;Os=m(Fl,{ref:this.filterInputRef,style:To,className:ee({error:!as,active:Lt!==""||wn!=null,"iris-grid-has-filter":ds}),isAdvancedFilterSet:wn!=null,onAdvancedFiltersTriggered:()=>{this.setState({shownAdvancedFilter:b})},onChange:this.handleFilterBarChange,onDone:this.handleFilterBarDone,onTab:this.handleFilterBarTab,onContextMenu:(rs=this.grid)==null?void 0:rs.handleContextMenu,debounceMs:li,value:Lt},b)}}let ho=null;if(v!=null){const xe=y("div",{className:"iris-grid-loading-status",children:[m("div",{className:ee("iris-grid-loading-status-bar",{show:A}),children:v}),y("button",{type:"button",onClick:this.handleCancel,className:ee("iris-grid-btn-cancel",{show:A}),children:[m(te,{icon:qs,transform:"down-1"}),"Cancel"]})]}),ut=f?f.gridY:0;ho=m("div",{className:"iris-grid-loading",style:{top:ut},children:xe})}let mo=null;k!=null&&f&&(mo=this.getColumnTooltip(k,f,r),(ar=this.tooltip)==null||ar.update());const go=[];if(f&&C){const{gridX:xe,gridY:ut,visibleColumns:Cn,allColumnXs:xs,allColumnWidths:ls}=f,{filterBarHeight:kt}=Vn;for(let at=0;at<Cn.length;at+=1){const nt=Cn[at],Kt=xs.get(nt),Un=ls.get(nt),Bn=this.getModelColumn(nt);if(Bn!=null&&r.isFilterable(Bn)&&Kt!=null&&Un!=null&&Un>0){const Lt=xe+Kt+Un-24,as=ut-(kt!=null?kt:0)+2,Gn={position:"absolute",top:as,left:Lt},wn=Z.get(Bn)!=null,ds=nt===x||nt===b||wn,ci=m("div",{className:ee("advanced-filter-button-container",{hidden:!ds}),style:Gn,children:ds&&m(z,{kind:"ghost",className:ee("btn-link-icon advanced-filter-button",{"filter-set":wn}),onClick:()=>{this.setState({shownAdvancedFilter:nt})},onContextMenu:pa=>{var hr;(hr=this.grid)==null||hr.handleContextMenu(pa)},onMouseEnter:()=>{this.setState({hoverAdvancedFilter:nt})},onMouseLeave:()=>{this.setState({hoverAdvancedFilter:null})},children:y("div",{className:"fa-layers",children:[m(te,{icon:ki,className:"filter-solid"}),m(te,{icon:Oo,className:"filter-light"})]})})},nt);go.push(ci)}}}const po=[];if(f){const{gridX:xe,visibleColumns:ut,allColumnXs:Cn,allColumnWidths:xs,columnHeaderHeight:ls}=f;for(let kt=0;kt<ut.length;kt+=1){const at=ut[kt],nt=Cn.get(at),Kt=xs.get(at);if(nt!=null&&Kt!=null&&Kt>0){const Un=xe+nt,Bn=xe+nt+Kt-20,To=C?{position:"absolute",top:ls,left:Bn,width:20,height:Vn.filterBarHeight}:{position:"absolute",top:0,left:Un,width:Kt,height:ls},Lt=this.getModelColumn(at);if(Lt!=null){const as=r.columns[Lt],Gn=Z.get(Lt),{options:cs}=Gn||{},wn=I.getSortForColumn(r.sort,Lt),ds=wn?wn.direction:null,ci=m("div",{className:"advanced-filter-menu-container",style:To,children:m(dl,{className:"advanced-filter-menu-popper",onEntered:this.getAdvancedMenuOpenedHandler(at),onExited:()=>{this.handleAdvancedMenuClosed(at)},isShown:W===at,interactive:!0,closeOnBlur:!0,options:{positionFixed:!0},children:this.getCachedAdvancedFilterMenuActions(r,as,cs,ds,ye)})},at);po.push(ci)}}}}const fo=this.getCachedOptionItems(g!==void 0&&r.isChartBuilderAvailable,r.isCustomColumnsAvailable,r.isFormatColumnsAvailable,r.isRollupAvailable,r.isTotalsAvailable,r.isSelectDistinctAvailable,r.isExportAvailable,this.toggleFilterBarAction,this.toggleSearchBarAction,this.toggleGotoRowAction,C,ze,h,this.isTableSearchAvailable(),Ns,d.size>0),Co=this.getCachedHiddenColumns(p,ro),ai=St.map(xe=>{switch(xe.type){case Se.CHART_BUILDER:return m(kl,{model:r,onChange:this.handleChartChange,onSubmit:this.handleChartCreate},Se.CHART_BUILDER);case Se.VISIBILITY_ORDERING_BUILDER:return m(tr,{model:r,movedColumns:me,hiddenColumns:Co,columnHeaderGroups:pn,onColumnVisibilityChanged:this.handleColumnVisibilityChanged,onReset:this.handleColumnVisibilityReset,onMovedColumnsChanged:this.handleMovedColumnsChanged,onColumnHeaderGroupChanged:this.handleHeaderGroupsChanged},Se.VISIBILITY_ORDERING_BUILDER);case Se.CONDITIONAL_FORMATTING:return m(Bh,{rules:fe,onChange:this.handleConditionalFormatsChange,onCreate:this.handleConditionalFormatCreate,onSelect:this.handleConditionalFormatEdit});case Se.CONDITIONAL_FORMATTING_EDIT:return M(r.columns),M(this.handleConditionalFormatEditorUpdate),m(gm,{columns:r.columns,rule:Je,onUpdate:this.handleConditionalFormatEditorUpdate,onSave:this.handleConditionalFormatEditorSave,onCancel:this.handleConditionalFormatEditorCancel});case Se.CUSTOM_COLUMN_BUILDER:return m(Pl,{model:r,customColumns:Ct,onSave:this.handleUpdateCustomColumns,onCancel:this.handleMenuBack},Se.CUSTOM_COLUMN_BUILDER);case Se.ROLLUP_ROWS:return m(er,{model:r,onChange:this.handleRollupChange,config:Xt},Se.ROLLUP_ROWS);case Se.AGGREGATIONS:return m(Ku,{settings:xt,isRollup:uo,onChange:this.handleAggregationsChange,onEdit:this.handleAggregationEdit});case Se.AGGREGATION_EDIT:return eo&&m(ju,{aggregation:eo,columns:r.originalColumns,onChange:this.handleAggregationChange});case Se.TABLE_EXPORTER:return m(gt,{model:r,name:l,userColumnWidths:ro,movedColumns:me,isDownloading:Ot,tableDownloadStatus:De,tableDownloadProgress:ge,tableDownloadEstimatedTime:Ke!=null?Ke:void 0,onDownload:this.handleDownloadTable,onDownloadStart:this.handleDownloadTableStart,onCancel:this.handleCancelDownloadTable,selectedRanges:hn},Se.TABLE_EXPORTER);case Se.SELECT_DISTINCT:return m(zl,{model:r,selectDistinctColumns:de,onChange:this.handleSelectDistinctChanged});case Se.ADVANCED_SETTINGS:return m(nr,{items:d,onChange:u});default:throw Error(`Unexpected option type ${xe.type}`)}});return y("div",{className:"iris-grid",role:"presentation",children:[y("div",{className:"iris-grid-column",children:[e!=null&&m("div",{className:"iris-grid-bar",children:e}),m($t,{in:w,timeout:Ue.transitionSlowMs,classNames:"iris-grid-bar-horizontal",onEnter:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExit:this.handleAnimationStart,onExited:this.handleAnimationEnd,mountOnEnter:!0,unmountOnExit:!0,children:m("div",{className:"iris-grid-partition-selector-wrapper iris-grid-bar iris-grid-bar-primary",children:G&&X&&$!=null&&m($l,{table:G,getFormattedString:(xe,ut,Cn)=>r.displayString(xe,ut,Cn),columnName:X.name,partition:$,onChange:this.handlePartitionChange,onFetchAll:this.handlePartitionFetchAll,onAppend:this.handlePartitionAppend,onDone:this.handlePartitionDone})})}),m($t,{in:ze,timeout:Ue.transitionSlowMs,classNames:"iris-grid-bar-horizontal",onEnter:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExit:this.handleAnimationStart,onExited:this.handleAnimationEnd,mountOnEnter:!0,unmountOnExit:!0,children:m("div",{className:"iris-grid-bar",children:m(Io,{value:lt,selectedColumns:wt,invertSelection:mn,onChange:this.handleCrossColumnSearch,columns:r.columns,ref:this.crossColumnRef})})}),y("div",{className:"grid-wrapper",ref:xe=>{this.gridWrapper=xe},children:[m(Rs,{ref:xe=>{this.grid=xe},isStickyBottom:!ke(r)||!r.isEditable,isStuckToBottom:o,isStuckToRight:i,metricCalculator:p,model:r,keyHandlers:N,mouseHandlers:L,movedColumns:me,movedRows:Ce,onError:this.handleGridError,onViewChanged:this.handleViewChanged,onSelectionChanged:this.handleSelectionChanged,onMovedColumnsChanged:this.handleMovedColumnsChanged,renderer:this.renderer,stateOverride:lo,theme:Vn}),m(Rg,{isOpen:Hn,text:ni,onClose:this.handleOverflowClose}),co&&m(Nl,{model:r,modelColumns:r.columns,top:As,bottom:ao,left:fn,right:Ms,filter:ri,formatter:ye,sorts:$e,reverseType:Mt,movedColumns:me,customColumns:Ct,hiddenColumns:Co,alwaysFetchColumns:this.getAlwaysFetchColumns(c,r.columns,me,r.floatingLeftColumnCount,r.floatingRightColumnCount,(dr=(cr=this.grid)==null?void 0:cr.state.draggingColumn)==null?void 0:dr.range),formatColumns:this.getCachedPreviewFormatColumns(this.getCachedModelColumns(r,Ct),fe,Je,((ur=St[St.length-1])==null?void 0:ur.type)===Se.CONDITIONAL_FORMATTING_EDIT&&Xe!=null?Xe:void 0),rollupConfig:this.getModelRollupConfig(r.originalColumns,Xt,xt),totalsConfig:this.getModelTotalsConfig(r.columns,Xt,xt),selectDistinctColumns:de,pendingRowCount:Ds,pendingDataMap:is,frozenColumns:no,columnHeaderGroups:pn}),!S&&m("div",{className:"grid-settings-button",children:m(z,{kind:"ghost","data-testid":`btn-iris-grid-settings-button-${l}`,onClick:this.handleMenu,icon:m(te,{icon:Vc,transform:"up-1"}),tooltip:"Table Options"})}),Os,ho,go,mo,po,so&&this.getOverflowButtonTooltip(so),Is&&this.getExpandCellTooltip(Is)]}),m(Dg,{model:r,isShown:Ns,gotoRow:oo,gotoRowError:io,gotoValueError:si,onGotoRowSubmit:this.handleGotoRowSelectedRowNumberSubmit,onGotoRowNumberChanged:this.handleGotoRowSelectedRowNumberChanged,onClose:this.handleGotoRowClosed,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:()=>{this.handleAnimationStart(),this.focus()},onExited:this.handleAnimationEnd,gotoValueSelectedColumnName:oi,gotoValue:ii,onGotoValueSelectedColumnNameChanged:this.handleGotoValueSelectedColumnNameChanged,onGotoValueSelectedFilterChanged:this.handleGotoValueSelectedFilterChanged,onGotoValueChanged:this.handleGotoValueChanged,onGotoValueSubmit:this.handleGotoValueSubmitted}),m(Su,{error:ss,isSaving:gn!=null,saveTooltip:`Commit (${this.commitAction.shortcut.getDisplayText()})`,discardTooltip:`Discard (${this.discardAction.shortcut.getDisplayText()})`,pendingDataErrors:os,pendingDataMap:is,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd,onSave:this.handlePendingCommitClicked,onDiscard:this.handlePendingDiscardClicked}),m(Bu,{children:to}),m(ys,{model:r,copyOperation:R!=null?R:void 0,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd}),m(Fs,{ref:xe=>{this.tableSaver=xe},getDownloadWorker:n,onDownloadCompleted:this.handleDownloadCompleted,onDownloadCanceled:this.handleDownloadCanceled,onDownloadProgressUpdate:this.handleDownloadProgressUpdate,isDownloading:De===gt.DOWNLOAD_STATUS.DOWNLOADING,formatter:ye})]}),m($t,{in:S,timeout:Ue.transitionMidMs,classNames:"slide-left",onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd,mountOnEnter:!0,unmountOnExit:!0,children:m("div",{className:"table-sidebar",children:y(jc,{children:[m(vr,{title:"Table Options",onClose:this.handleMenuClose,children:m(fl,{onSelect:xe=>this.handleMenuSelect(fo[xe]),items:fo})}),ai.map((xe,ut)=>m(vr,{title:St[ut].title,onBack:this.handleMenuBack,onClose:this.handleMenuClose,children:xe},St[ut].type))]})})}),m(se,{actions:this.contextActions})]})}};let Js=Nn;Js.minDebounce=150;Js.maxDebounce=500;Js.loadingSpinnerDelay=800;Js.defaultProps={children:null,advancedFilters:on,advancedSettings:on,alwaysFetchColumns:ve,conditionalFormats:ve,customColumnFormatMap:on,isFilterBarShown:!1,applyInputFiltersOnInit:!1,movedColumns:ve,movedRows:ve,inputFilters:ve,customFilters:ve,onCreateChart:void 0,onColumnSelected:()=>{},onDataSelected:()=>{},onError:()=>{},onStateChange:()=>{},onPartitionAppend:()=>{},onAdvancedSettingsChange:()=>{},partition:null,partitionColumn:null,quickFilters:on,selectDistinctColumns:ve,sorts:ve,reverseType:I.REVERSE_TYPE.NONE,customColumns:ve,aggregationSettings:ha,rollupConfig:void 0,userColumnWidths:on,userRowHeights:on,onSelectionChanged:()=>{},isSelectingColumn:!1,isSelectingPartition:!1,isStuckToBottom:!1,isStuckToRight:!1,columnSelectionValidator:null,columnAllowedCursor:null,columnNotAllowedCursor:null,name:"table",onlyFetchVisibleColumns:!0,showSearchBar:!1,searchValue:"",selectedSearchColumns:null,invertSearchColumns:!0,onContextMenu:()=>{},pendingDataMap:on,getDownloadWorker:void 0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:cn.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,truncateNumbersWithPound:!1,formatter:ve,decimalFormatOptions:B.exports.shape({defaultFormatString:B.exports.string}),integerFormatOptions:B.exports.shape({defaultFormatString:B.exports.string})},canCopy:!0,canDownloadCsv:!0,frozenColumns:null,theme:Al,canToggleSearch:!0};class xg extends Error{constructor(t,n){super(`${n} can't be empty (on pending row ${t+1})`),this.isMissingKey=!0,this.rowIndex=t,this.columnName=n}}const Pe=ie.module("IrisGridTableModel"),kg=150,Lg=0,Pg=[];function Ao(e){return e.table!==void 0}const Mi=class extends ce{constructor(e,t=new zt,n=null){var s,o;super(),this.pendingNewRowCount=0,this._columnHeaderGroupMap=new Map,this.columnHeaderParentMap=new Map,this._columnHeaderMaxDepth=null,this._columnHeaderGroups=[],this._movedColumns=null,this.getMemoizedInitialMovedColumns=Re(i=>{var p;if(!i)return[];let r=[];const{groupMap:l}=J.parseColumnHeaderGroups(this,(p=i==null?void 0:i.columnGroups)!=null?p:[]),a=(f,C)=>{const w=this.getColumnIndexByName(f);if(w==null)throw new Error(`Unknown layout hint column: ${f}`);const S=H.getVisibleIndex(w,r);r=H.moveItem(S,C,r)},c=(f,C)=>{const w=l.get(f);if(w==null)throw new Error(`Unknown layout hint group: ${f}`);const S=w.getVisibleRange(r);r=H.moveRange(S,C,r)},{frontColumns:d=[],backColumns:u=[],frozenColumns:h=[]}=i;if(d.length||u.length||h.length){const f=new Set;let C=0;h.forEach(S=>{if(f.has(S))throw new Error(`Column specified in multiple layout hints: ${S}`);a(S,C),C+=1}),d.forEach(S=>{if(f.has(S))throw new Error(`Column specified in multiple layout hints: ${S}`);a(S,C),C+=1});let w=this.columnMap.size-1;u.forEach(S=>{if(f.has(S))throw new Error(`Column specified in multiple layout hints: ${S}`);a(S,w),w-=1})}if(i==null?void 0:i.columnGroups){const f=[...l.values()];f.sort((C,w)=>C.depth-w.depth),f.forEach(C=>{const w=C.children[0],S=this.getColumnIndexByName(w);let T;if(S!=null)T=H.getVisibleIndex(S,r);else{const R=l.get(w);if(!R)throw new Error(`Unknown column ${w} in group ${C.name}`);[,T]=R.getVisibleRange(r)}for(let R=1;R<C.children.length;R+=1){const b=C.children[R],v=l.get(b),D=this.getColumnIndexByName(b);if(v){const N=v.getVisibleRange(r)[0]<T?T-v.childIndexes.length+1:T+1;c(b,N),T=N+v.childIndexes.length-1}else if(D!=null){const N=H.getVisibleIndex(D,r)<T?T:T+1;a(b,N),T=N}}})}return this._movedColumns=r,r}),this.getMemoizedInitialColumnHeaderGroups=Re(i=>{var r;return J.parseColumnHeaderGroups(this,(r=i==null?void 0:i.columnGroups)!=null?r:[]).groups}),this.getMemoizedColumnMap=Re(i=>{const r=new Map;return i.forEach(l=>r.set(l.name,l)),r}),this.getColumnIndicesByNameMap=Re(i=>{const r=new Map;return i.forEach(({name:l},a)=>r.set(l,a)),r}),this.setViewport=Pn((i,r,l)=>{if(r<i){Pe.error("Invalid viewport",i,r);return}const{viewport:a}=this;if(a!=null&&a.top===i&&a.bottom===r&&a.columns===l){Pe.debug2("Ignoring duplicate viewport",a);return}this.viewport={top:i,bottom:r,columns:l},Pe.debug2("setViewport",this.viewport),this.applyViewport()},kg),this.applyViewport=Pn(()=>{if(!this.viewport)return;Pe.debug2("applyViewport",this.viewport);const{top:i,bottom:r,columns:l}=this.viewport,[a,c]=this.getCachedViewportRowRange(i,r);this.applyBufferedViewport(a,c,l)},Lg,{leading:!1}),this.getCachedFormattedString=pt((i,r,l,a,c)=>i.getFormattedString(r,l,a,c),{max:1e4}),this.getCachedCustomColumnFormatFlag=pt(Zn.isCustomColumnFormatDefined,{max:1e4}),this.getCachedViewportRowRange=Re((i,r)=>{const l=r-i,a=Math.max(0,i-l*Mi.ROW_BUFFER_PAGES),c=r+l*Mi.ROW_BUFFER_PAGES;return[a,c]}),this.getCachedPendingErrors=Re((i,r,l)=>{const a=new Map;return i.forEach((c,d)=>{var h;const{data:u}=c;for(let g=0;g<l;g+=1)u.has(g)||(a.has(d)||a.set(d,[]),(h=a.get(d))==null||h.push(new xg(d,r[g].name)))}),a}),this.handleTableDisconnect=this.handleTableDisconnect.bind(this),this.handleTableReconnect=this.handleTableReconnect.bind(this),this.handleTableUpdate=this.handleTableUpdate.bind(this),this.handleTotalsUpdate=this.handleTotalsUpdate.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.handleCustomColumnsChanged=this.handleCustomColumnsChanged.bind(this),this.irisFormatter=t,this.inputTable=n,this.subscription=null,this.table=e,this.viewport=null,this.viewportData=null,this.formattedStringData=[],this.pendingStringData=[],this.isSaveInProgress=!1,this.totalsTable=null,this.totalsTablePromise=null,this.totals=null,this.totalsDataMap=null,this.pendingNewDataMap=new Map,this.pendingNewRowCount=0,this.columnHeaderGroups=J.parseColumnHeaderGroups(this,(o=(s=this.layoutHints)==null?void 0:s.columnGroups)!=null?o:[]).groups}seekRow(e,t,n,s,o,i,r){throw new Error("Method not implemented.")}export(){throw new Error("Method not implemented.")}columnStatistics(e){throw new Error("Method not implemented.")}get customColumns(){return[]}set customColumns(e){throw new Error("Method not implemented.")}get formatColumns(){return[]}set formatColumns(e){throw new Error("Method not implemented.")}updateFrozenColumns(e){throw new Error("Method not implemented.")}get rollupConfig(){throw new Error("Method not implemented.")}set rollupConfig(e){throw new Error("Method not implemented.")}get selectDistinctColumns(){throw new Error("Method not implemented.")}set selectDistinctColumns(e){throw new Error("Method not implemented.")}get columns(){return this.table.columns}close(){this.table.close(),this.totalsTable!==null&&this.totalsTable.close(),this.totalsTablePromise!==null&&this.totalsTablePromise.cancel()}startListening(){super.startListening(),this.table.addEventListener(E.Table.EVENT_DISCONNECT,this.handleTableDisconnect),this.table.addEventListener(E.Table.EVENT_RECONNECT,this.handleTableReconnect),this.table.addEventListener(E.Table.EVENT_UPDATED,this.handleTableUpdate),this.table.addEventListener(E.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed),this.table.addEventListener(E.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleCustomColumnsChanged),this.totalsTable!=null&&this.addTotalsListeners(this.totalsTable),this.applyViewport()}stopListening(){super.stopListening(),this.table.removeEventListener(E.Table.EVENT_DISCONNECT,this.handleTableDisconnect),this.table.removeEventListener(E.Table.EVENT_RECONNECT,this.handleTableReconnect),this.table.removeEventListener(E.Table.EVENT_UPDATED,this.handleTableUpdate),this.table.removeEventListener(E.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed),this.table.removeEventListener(E.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleCustomColumnsChanged),this.totalsTable!=null&&this.removeTotalsListeners(this.totalsTable),this.closeSubscription()}addTotalsListeners(e){e.addEventListener(E.Table.EVENT_UPDATED,this.handleTotalsUpdate),e.setViewport(0,0)}removeTotalsListeners(e){e.removeEventListener(E.Table.EVENT_UPDATED,this.handleTotalsUpdate)}handleTableDisconnect(){this.dispatchEvent(new Me(ce.EVENT.DISCONNECT))}handleTableReconnect(){this.dispatchEvent(new Me(ce.EVENT.RECONNECT))}handleTableUpdate(e){this.copyViewportData(e.detail),this.dispatchEvent(new Me(ce.EVENT.UPDATED))}handleTotalsUpdate(e){this.copyTotalsData(e.detail),this.dispatchEvent(new Me(ce.EVENT.UPDATED))}handleRequestFailed(e){this.dispatchEvent(new Me(ce.EVENT.REQUEST_FAILED,e))}handleCustomColumnsChanged(){this.dispatchEvent(new Me(ce.EVENT.COLUMNS_CHANGED,{detail:this.columns}))}get rowCount(){var e,t,n;return this.table.size+this.pendingNewRowCount+((n=(t=(e=this.totals)==null?void 0:e.operationOrder)==null?void 0:t.length)!=null?n:0)}get pendingDataErrors(){var e,t;return this.getCachedPendingErrors(this.pendingNewDataMap,this.columns,(t=(e=this.inputTable)==null?void 0:e.keyColumns.length)!=null?t:0)}get pendingDataMap(){return this.pendingNewDataMap}set pendingDataMap(e){e!==this.pendingNewDataMap&&(e.forEach((t,n)=>{if(!J.isValidIndex(n))throw new Error(`Invalid rowIndex ${n}`);const{data:s}=t;s.forEach((o,i)=>{if(!J.isValidIndex(i))throw new Error(`Invalid columnIndex ${i}`)})}),this.pendingNewDataMap=e,this.pendingNewRowCount=Math.max(this.pendingNewRowCount,this.maxPendingDataRow),this.formattedStringData=[],this.dispatchEvent(new Me(ce.EVENT.PENDING_DATA_UPDATED)))}get pendingRowCount(){return this.pendingNewRowCount}set pendingRowCount(e){e!==this.pendingNewRowCount&&(this.pendingNewRowCount=Math.max(0,e,this.maxPendingDataRow),this.dispatchEvent(new Me(ce.EVENT.UPDATED)))}get maxPendingDataRow(){return this.pendingNewDataMap.size>0?Math.max(...this.pendingNewDataMap.keys())+1:0}get columnCount(){return this.columns.length}get floatingBottomRowCount(){var e,t,n;return this.totals!=null&&this.totals.showOnTop?0:(n=(t=(e=this.totals)==null?void 0:e.operationOrder)==null?void 0:t.length)!=null?n:0}get floatingTopRowCount(){var e,t,n;return this.totals!=null&&this.totals.showOnTop&&(n=(t=(e=this.totals)==null?void 0:e.operationOrder)==null?void 0:t.length)!=null?n:0}get isChartBuilderAvailable(){return!0}get isTotalsAvailable(){return this.table.getTotalsTable!=null}get isEditable(){return!this.isSaveInProgress&&this.inputTable!=null}cacheFormattedValue(e,t,n){this.formattedStringData[e]==null&&(this.formattedStringData[e]=[]),this.formattedStringData[e][t]=n}cachePendingValue(e,t,n){this.pendingStringData[e]==null&&(this.pendingStringData[e]=[]),this.pendingStringData[e][t]=n}clearPendingValue(e,t){const n=this.pendingStringData[e];n!=null&&delete n[t]}textValueForCell(e,t){var n,s,o;if(((n=this.pendingStringData[e])==null?void 0:n[t])!==void 0)return this.pendingStringData[e][t];if(((s=this.formattedStringData[e])==null?void 0:s[t])===void 0){const i=this.valueForCell(e,t);if(i==null)return null;const r=(o=this.totalsColumn(e,t))!=null?o:this.columns[e],l=this.getCachedCustomColumnFormatFlag(this.formatter,r.name,r.type);let a;if(!l){const d=this.formatForCell(e,t);(d==null?void 0:d.formatString)!=null&&(a=d)}const c=this.displayString(i,r.type,r.name,a);this.cacheFormattedValue(e,t,c)}return this.formattedStringData[e][t]}textForCell(e,t){const n=this.textValueForCell(e,t);if(n==null&&this.isKeyColumn(e)){const s=this.pendingRow(t);if(s!=null&&this.pendingDataMap.has(s))return"*"}return n!=null?n:""}truncationCharForCell(e){const t=this.columns[e],{type:n}=t;if(I.isNumberType(n)&&this.formatter.truncateNumbersWithPound)return"#"}colorForCell(e,t,n){var o;const s=this.dataForCell(e,t);if(s){const{format:i,value:r}=s;if(r==null||r==="")return M(n.nullStringColor),n.nullStringColor;if(i&&i.color)return i.color;if(this.isPendingRow(t))return M(n.pendingTextColor),n.pendingTextColor;if(r!=null){const l=(o=this.totalsColumn(e,t))!=null?o:this.columns[e];if(I.isDateType(l.type)||l.name==="Date")return M(n.dateColor),n.dateColor;if(I.isNumberType(l.type))return r>0?(M(n.positiveNumberColor),n.positiveNumberColor):r<0?(M(n.negativeNumberColor),n.negativeNumberColor):(M(n.zeroNumberColor),n.zeroNumberColor)}}else if(this.isPendingRow(t)&&this.isKeyColumn(e))return M(n.errorTextColor),n.errorTextColor;return n.textColor}backgroundColorForCell(e,t){var n,s;return(s=(n=this.formatForCell(e,t))==null?void 0:n.backgroundColor)!=null?s:null}textAlignForCell(e){const t=this.columns[e],{type:n}=t;return I.isNumberType(n)?"right":I.isDateType(n)||t.name==="Date"?"center":"left"}textForColumnHeader(e,t=0){const n=this.columnAtDepth(e,t);return gi(n)?n.isNew?"":n.name:n==null?void 0:n.name}colorForColumnHeader(e,t=0){var s;const n=this.columnAtDepth(e,t);return gi(n)&&(s=n.color)!=null?s:null}getColumnHeaderGroup(e,t){const n=this.columnAtDepth(e,t);if(gi(n))return n}getColumnHeaderParentGroup(e,t){var n,s;return this.columnHeaderParentMap.get((s=(n=this.columnAtDepth(e,t))==null?void 0:n.name)!=null?s:"")}columnAtDepth(e,t=0){var i;if(t===0)return this.columns[e];const n=(i=this.columns[e])==null?void 0:i.name;let s=this.columnHeaderParentMap.get(n);if(!s)return;let o=s.depth;for(;o<t;){if(s=this.columnHeaderParentMap.get(s.name),!s)return;o=s.depth}if(s.depth===t)return s}textForRowFooter(e){const t=this.totalsRow(e);return t!=null&&this.totals?this.totals.operationOrder[t]:""}get initialMovedColumns(){var e;return this.getMemoizedInitialMovedColumns((e=this.layoutHints)!=null?e:void 0)}get initialMovedRows(){return Pg}get initialColumnHeaderGroups(){var e;return this.getMemoizedInitialColumnHeaderGroups((e=this.layoutHints)!=null?e:void 0)}get columnMap(){return this.getMemoizedColumnMap(this.table.columns)}get columnHeaderMaxDepth(){var e;return(e=this._columnHeaderMaxDepth)!=null?e:1}set columnHeaderMaxDepth(e){this._columnHeaderMaxDepth=e}get columnHeaderGroupMap(){return this._columnHeaderGroupMap}get columnHeaderGroups(){return this._columnHeaderGroups}set columnHeaderGroups(e){if(e===this._columnHeaderGroups)return;const{groups:t,maxDepth:n,parentMap:s,groupMap:o}=J.parseColumnHeaderGroups(this,e!=null?e:this.initialColumnHeaderGroups);this._columnHeaderGroups=t,this.columnHeaderMaxDepth=n,this.columnHeaderParentMap=s,this._columnHeaderGroupMap=o}get groupedColumns(){return[]}row(e){var l,a,c,d,u,h,g,p,f,C,w,S,T,R;const t=(c=(a=(l=this.totals)==null?void 0:l.operationOrder)==null?void 0:a.length)!=null?c:0,n=(u=(d=this.totals)==null?void 0:d.showOnTop)!=null?u:!1,s=this.totalsRow(e);if(s!=null){const b=(h=this.totals)==null?void 0:h.operationOrder[s];return M(b),(p=(g=this.totalsDataMap)==null?void 0:g.get(b))!=null?p:null}const o=this.pendingRow(e);if(o!=null)return(f=this.pendingNewDataMap.get(o))!=null?f:null;const i=(w=(C=this.viewportData)==null?void 0:C.offset)!=null?w:0,r=(n?e-t:e)-i;return(R=(T=(S=this.viewportData)==null?void 0:S.rows)==null?void 0:T[r])!=null?R:null}totalsColumn(e,t){var r,l,a,c;const n=this.totalsRow(t);if(n==null)return null;const s=(r=this.totals)==null?void 0:r.operationOrder[n],o=(a=(l=this.totals)==null?void 0:l.defaultOperation)!=null?a:Te.SUM,i=this.columns[e];return(c=this.totalsTable)==null?void 0:c.columns.find(d=>{var u;return d.name===`${i.name}__${s}`||(s===o||((u=this.totals)==null?void 0:u.operationOrder.length)===1)&&d.name===i.name})}totalsRow(e){var o,i,r,l,a;const t=(r=(i=(o=this.totals)==null?void 0:o.operationOrder)==null?void 0:i.length)!=null?r:0,s=((a=(l=this.totals)==null?void 0:l.showOnTop)!=null?a:!1)?e:e-this.table.size;return s>=0&&s<t?s:null}pendingRow(e){const t=e-this.floatingTopRowCount-this.table.size;return t>=0&&t<this.pendingNewRowCount?t:null}isTotalsRow(e){return this.totalsRow(e)!=null}isPendingRow(e){return this.pendingRow(e)!=null}dataForCell(e,t){var n;return(n=this.row(t))==null?void 0:n.data.get(e)}formatForCell(e,t){var n;return(n=this.dataForCell(e,t))==null?void 0:n.format}valueForCell(e,t){var s;const n=this.dataForCell(e,t);if(n)return(s=n.value)!=null?s:null}copyViewportData(e){if(e==null){Pe.warn("invalid data!");return}this.viewportData=this.extractViewportData(e),this.formattedStringData=[]}copyTotalsData(e){var l,a,c,d,u;if(e==null){Pe.warn("invalid data!");return}const{columns:t,rows:n}=e;if(n.length!==1){Pe.error("Unexpected number of rows received for totals table, ignoring update");return}const s=new Map,o=n[0],i=(a=(l=this.totals)==null?void 0:l.defaultOperation)!=null?a:Te.SUM,r=(c=this.totals)==null?void 0:c.operationMap;for(let h=0;h<t.length;h+=1){const g=t[h],[p,f=(u=(d=r==null?void 0:r[p])==null?void 0:d[0])!=null?u:i]=g.name.split("__");s.has(f)||s.set(f,{data:new Map});const{data:C}=s.get(f),w=this.columns.findIndex(S=>S.name===p);C.set(w,{value:o.get(g),format:o.getFormat(g)})}Pe.debug2("copyTotalsData",s),this.totalsDataMap=s,this.formattedStringData=[]}getColumnIndexByName(e){return this.getColumnIndicesByNameMap(this.columns).get(e)}extractViewportData(e){const t={offset:e.offset,rows:[]},{columns:n}=e;for(let s=0;s<e.rows.length;s+=1){const o=e.rows[s],i=this.extractViewportRow(o,n);t.rows.push(i)}return t}extractViewportRow(e,t){const n=new Map;for(let s=0;s<t.length;s+=1){const o=t[s],i=this.getColumnIndexByName(o.name);M(i),n.set(i,{value:e.get(o),format:e.getFormat(o)})}return{data:n}}closeSubscription(){Pe.debug2("closeSubscription",this.subscription),this.subscription&&(this.subscription.close(),this.subscription=null),this.setViewport.cancel(),this.applyViewport.cancel()}get filter(){return this.table.filter}set filter(e){this.closeSubscription(),this.table.applyFilter(e),this.applyViewport()}get formatter(){return this.irisFormatter}set formatter(e){this.irisFormatter=e,this.formattedStringData=[],this.dispatchEvent(new Me(ce.EVENT.FORMATTER_UPDATED))}displayString(e,t,n="",s){return this.getCachedFormattedString(this.formatter,e,t,n,s)}get sort(){return this.table.sort}set sort(e){this.closeSubscription(),this.table.applySort(e),this.applyViewport()}set totalsConfig(e){if(Pe.debug("set totalsConfig",e),e!==this.totals){if(this.totals=e,this.formattedStringData=[],this.totalsTablePromise!=null&&this.totalsTablePromise.cancel(),this.setTotalsTable(null),e==null){this.dispatchEvent(new Me(ce.EVENT.UPDATED));return}this.totalsTablePromise=Ge.makeCancelable(this.table.getTotalsTable(e),t=>t.close()),this.totalsTablePromise.then(t=>{this.totalsTablePromise=null,this.setTotalsTable(t)}).catch(t=>{Ge.isCanceled(t)||(Pe.error("Unable to set next totalsTable",t),this.totalsTablePromise=null,this.dispatchEvent(new Me(ce.EVENT.REQUEST_FAILED,{detail:t})))})}}setTotalsTable(e){Pe.debug("setTotalsTable",e),this.totalsTable!==null&&(this.listenerCount>0&&this.removeTotalsListeners(this.totalsTable),this.totalsTable.close()),this.totalsTable=e,this.totalsDataMap=null,this.listenerCount>0&&this.totalsTable!=null&&this.addTotalsListeners(this.totalsTable)}applyBufferedViewport(e,t,n){Pe.debug2("applyBufferedViewport",e,t,n),this.subscription==null?(Pe.debug2("applyBufferedViewport creating new subscription"),this.subscription=this.table.setViewport(e,t,n)):(Pe.debug2("applyBufferedViewport using existing subscription"),this.subscription.setViewport(e,t,n))}async snapshot(e,t=!1,n=o=>o,s=!0){if(this.subscription==null)throw new Error("No subscription available");const o=s?Q.consolidate(e):e;if(!J.isValidSnapshotRanges(o))throw new Error(`Invalid snapshot ranges ${e}`);const i=new Set,r=[],l=new Set;for(let h=0;h<o.length;h+=1){const g=o[h];M(g.endRow),M(g.startRow);for(let p=g.startRow;p<=g.endRow&&p<this.floatingTopRowCount;p+=1)i.add(p);g.endRow>=this.floatingTopRowCount&&g.startRow<=this.floatingTopRowCount+this.table.size&&r.push(new Q(g.startColumn,Math.min(Math.max(0,g.startRow-this.floatingTopRowCount)),g.endColumn,Math.min(Math.max(0,g.endRow-this.floatingTopRowCount),this.table.size-this.floatingTopRowCount)));for(let p=Math.max(g.startRow,this.floatingTopRowCount+this.table.size);p<=g.endRow&&p<this.floatingTopRowCount+this.table.size+this.floatingBottomRowCount;p+=1)l.add(p)}const a=J.columnsFromRanges(o,this.columns),c=[];t&&c.push(a.map(h=>h.name));const d=[...i].sort();for(let h=0;h<d.length;h+=1){const g=d[h],p=a.map(f=>{const C=this.getColumnIndexByName(f.name);return M(C),n(this.valueForCell(C,g),f)});t&&p.push(this.textForRowFooter(g)),c.push(p)}if(r.length>0){const h=J.rangeSetFromRanges(r),g=await this.subscription.snapshot(h,a);c.push(...g.rows.map(p=>a.map(f=>n(p.get(f),f))))}const u=[...l].sort();for(let h=0;h<u.length;h+=1){const g=u[h],p=a.map(f=>{const C=this.getColumnIndexByName(f.name);return M(C),n(this.valueForCell(C,g),f)});t&&p.push(this.textForRowFooter(g)),c.push(p)}return c}async textSnapshot(e,t=!1,n=s=>`${s}`){return Pe.debug2("textSnapshot",e,t),(await this.snapshot(e,t,n,!1)).map(o=>o.join(" ")).join(`
31
- `)}async valuesTable(e){let t=null;try{return t=await this.table.copy(),t.applyFilter([]),t.applySort([]),t.selectDistinct([e])}finally{t!=null&&t.close()}}isColumnMovable(e,t){if(e<0||e>=this.columnCount)return!1;if(t>0)return!0;const n=this.columns[e].name;return this.frontColumns.includes(n)||this.backColumns.includes(n)||this.frozenColumns.includes(n)||!n?!1:!this.isKeyColumn(e)}isKeyColumn(e){var t,n;return e<((n=(t=this.inputTable)==null?void 0:t.keyColumns.length)!=null?n:0)}isRowMovable(){return!1}isEditableRange(e){return!(this.inputTable==null||!Q.isBounded(e)||!(this.isPendingRow(e.startRow)&&this.isPendingRow(e.endRow)||this.inputTable.keyColumns.length!==0&&e.startColumn>=this.inputTable.keyColumns.length&&e.endColumn>=this.inputTable.keyColumns.length)||e.startRow<this.floatingTopRowCount||e.startRow>=this.floatingTopRowCount+this.table.size+this.pendingRowCount||e.endRow>=this.floatingTopRowCount+this.table.size+this.pendingRowCount)}isDeletableRange(e){return this.inputTable!=null&&e.startRow!=null&&e.endRow!=null&&e.startRow>=this.floatingTopRowCount&&e.startRow<this.floatingTopRowCount+this.table.size+this.pendingRowCount&&e.endRow<this.floatingTopRowCount+this.table.size+this.pendingRowCount}isEditableRanges(e){return e.every(t=>this.isEditableRange(t))}isDeletableRanges(e){return e.every(t=>this.isDeletableRange(t))}getTableAreaRange(){return new Q(null,this.floatingTopRowCount,null,this.floatingTopRowCount+this.table.size-1)}getPendingAreaRange(){return new Q(null,this.floatingTopRowCount+this.table.size,null,this.floatingTopRowCount+this.table.size+this.pendingNewRowCount-1)}async setValueForCell(e,t,n){return this.setValueForRanges([new Q(e,t,e,t)],n)}async setValueForRanges(e,t){var n;if(!this.isEditableRanges(e))throw new Error(`Uneditable ranges ${e}`);try{const s=new Set,o=[];Q.forEachCell(e,(c,d)=>{const u=this.columns[c];if(s.add(u),o[c]===void 0){const h=I.makeValue(u.type,t,this.formatter.timeZone);o[c]=h!=null?this.displayString(h,u.type,u.name):null}this.cachePendingValue(c,d,o[c])});const i=this.getPendingAreaRange(),r=e.map(c=>Q.intersection(i,c)).filter(c=>c!=null).map(c=>(M(c),Q.offset(c,0,-(this.floatingTopRowCount+this.table.size))));if(r.length>0){const c=new Map(this.pendingNewDataMap);Q.forEachCell(r,(d,u)=>{c.has(u)||c.set(u,{data:new Map});const h=this.columns[d],g=c.get(u);M(g);const{data:p}=g,f=new Map(p),C=I.makeValue(h.type,t,this.formatter.timeZone);C!=null?f.set(d,{value:C}):f.delete(d),f.size>0?c.set(u,{...g,data:f}):c.delete(u)}),this.pendingDataMap=c}this.dispatchEvent(new Me(ce.EVENT.UPDATED));const l=this.getTableAreaRange(),a=e.map(c=>Q.intersection(l,c)).filter(c=>c!=null);if(a.length>0){const d=(await this.snapshot(a.map(h=>{var g,p;return new Q(null,(g=h==null?void 0:h.startRow)!=null?g:null,null,(p=h==null?void 0:h.endRow)!=null?p:null)}))).map(h=>{const g={};for(let p=0;p<this.columns.length;p+=1)g[this.columns[p].name]=h[p];return s.forEach(p=>{g[p.name]=I.makeValue(p.type,t,this.formatter.timeZone)}),g}),u=await((n=this.inputTable)==null?void 0:n.addRows(d));Pe.debug("setValueForRanges(",e,",",t,") set tableRanges",a,"result",u)}Q.forEachCell(e,(c,d)=>{const u=o[c];M(u),this.cacheFormattedValue(c,d,u)})}catch(s){Pe.error("Unable to set ranges",e,t,s)}finally{Q.forEachCell(e,(s,o)=>{this.clearPendingValue(s,o)})}}async setValues(e=[]){var t;if(Pe.debug("setValues(",e,")"),!e.every(n=>{var s,o;return this.isEditableRange(Q.makeCell((s=n.column)!=null?s:n.x,(o=n.row)!=null?o:n.y))}))throw new Error(`Uneditable ranges ${e}`);try{const n=new Map(this.pendingNewDataMap);e.forEach(l=>{var f,C;const{text:a}=l,c=(f=l.column)!=null?f:l.x,d=(C=l.row)!=null?C:l.y,u=this.columns[c],h=I.makeValue(u.type,a,this.formatter.timeZone),g=h!=null?this.displayString(h,u.type,u.name):null;this.cachePendingValue(c,d,g);const p=this.pendingRow(d);if(p!=null){n.has(p)||n.set(p,{data:new Map});const w=n.get(p);M(w);const{data:S}=w,T=new Map(S);h!=null?T.set(c,{value:h}):T.delete(c),T.size>0?n.set(p,{...w,data:T}):n.delete(p)}}),this.pendingDataMap=n,this.dispatchEvent(new Me(ce.EVENT.UPDATED));const s=e.reduce((l,a)=>{var d,u;const c=(d=a.row)!=null?d:a.y;return l.has(c)||l.set(c,[]),(u=l.get(c))==null||u.push(a),l},new Map),o=Q.consolidate(e.map(l=>{var a,c;return Q.makeCell((a=l.column)!=null?a:l.x,(c=l.row)!=null?c:l.y)})),i=this.getTableAreaRange(),r=o.map(l=>Q.intersection(i,l)).filter(l=>l!=null);if(r.length>0){const a=(await this.snapshot(r.map(d=>(M(d),new Q(null,d.startRow,null,d.endRow))))).map((d,u)=>{let h=null,g=u;for(let C=0;C<r.length;C+=1){const w=r[C];M(w);const S=Q.rowCount([w]);if(g<S){M(w.startRow),h=w.startRow+g;break}g-=S}const p={};for(let C=0;C<this.columns.length;C+=1)p[this.columns[C].name]=d[C];M(h);const f=s.get(h);return f!=null&&f.forEach(C=>{var S;const w=this.columns[(S=C.column)!=null?S:C.x];p[w.name]=I.makeValue(w.type,C.text,this.formatter.timeZone)}),p});Pe.info("setValues setting tableRanges",r);const c=await((t=this.inputTable)==null?void 0:t.addRows(a));Pe.info("setValues set tableRanges",r,"SUCCESS",c)}e.forEach(l=>{var p,f;const{text:a}=l,c=(p=l.column)!=null?p:l.x,d=(f=l.row)!=null?f:l.y,u=this.columns[c],h=I.makeValue(u.type,a,this.formatter.timeZone),g=h!=null?this.displayString(h,u.type,u.name):null;this.cacheFormattedValue(c,d,g)})}finally{e.forEach(n=>{this.clearPendingValue(n.column,n.row)})}}async commitPending(){var e,t,n;if(this.pendingNewDataMap.size<=0)throw new Error("No pending changes to commit");try{this.isSaveInProgress=!0;const s=[];this.pendingNewDataMap.forEach(i=>{const r={};i.data.forEach(({value:l},a)=>{const c=this.columns[a];r[c.name]=l}),s.push(r)});const o=await((e=this.inputTable)==null?void 0:e.addRows(s));Pe.debug("commitPending()",this.pendingNewDataMap,"result",o),this.pendingNewDataMap=new Map,this.pendingNewRowCount=Math.max(0,((n=(t=this.viewport)==null?void 0:t.bottom)!=null?n:0)-this.table.size),this.formattedStringData=[],this.dispatchEvent(new Me(ce.EVENT.PENDING_DATA_UPDATED))}finally{this.isSaveInProgress=!1}}editValueForCell(e,t){return this.textValueForCell(e,t)}async delete(e){if(!this.isDeletableRanges(e))throw new Error(`Undeletable ranges ${e}`);M(this.inputTable);const{keyColumns:t}=this.inputTable;if(t.length===0)throw new Error("No key columns to allow deletion");const n=this.getPendingAreaRange(),s=e.map(d=>Q.intersection(n,d)).filter(d=>d!=null).map(d=>(M(d),Q.offset(d,0,-(this.floatingTopRowCount+this.table.size))));if(s.length>0){const d=new Map(this.pendingNewDataMap);for(let u=0;u<s.length;u+=1){const h=s[u];M(h.startRow),M(h.endRow);for(let g=h.startRow;g<=h.endRow;g+=1)d.delete(g)}this.pendingNewDataMap=d,this.formattedStringData=[],this.dispatchEvent(new Me(ce.EVENT.PENDING_DATA_UPDATED)),this.dispatchEvent(new Me(ce.EVENT.UPDATED))}const o=this.getTableAreaRange(),i=e.map(d=>Q.intersection(o,d)).filter(d=>d!=null);if(i.length<=0)return;const[r,l]=await Promise.all([this.snapshot(i.map(d=>(M(d),new Q(0,d.startRow,t.length-1,d.endRow)))),this.table.copy()]),c=r.map(d=>{const u=[];for(let h=0;h<t.length;h+=1){const g=t[h],p=d[h],f=I.makeFilterRawValue(g.type,p),C=g.filter().eq(f);u.push(C)}return u.reduce((h,g)=>{var p;return(p=h==null?void 0:h.and(g))!=null?p:g})}).reduce((d,u)=>{var h;return(h=d==null?void 0:d.or(u))!=null?h:u});l.applyFilter([c]),l.close()}isValidForCell(e,t,n){try{const s=this.columns[e];return I.makeValue(s.type,n,this.formatter.timeZone),!0}catch{return!1}}};let rr=Mi;rr.ROW_BUFFER_PAGES=1;const yn=ie.module("IrisGridTableModel");class _g extends rr{constructor(t,n=new zt,s=null){super(t,n,s),this.getMemoizedFrontColumns=Re(o=>o!=null?o:[]),this.getMemoizedBackColumns=Re(o=>o!=null?o:[]),this.getMemoizedFrozenColumns=Re((o,i)=>{var r;return(r=i!=null?i:o)!=null?r:[]}),this.getCachedFilterableColumnSet=Re(o=>new Set(o.map((i,r)=>r))),this.customColumnList=[],this.formatColumnList=[]}get isExportAvailable(){return this.table.freeze!=null}get isColumnStatisticsAvailable(){return this.table.getColumnStatistics!=null}get isValuesTableAvailable(){return this.table.selectDistinct!=null&&this.table.copy!=null}get isRollupAvailable(){return this.table.rollup!=null}get isSelectDistinctAvailable(){return this.table.selectDistinct!=null}get isCustomColumnsAvailable(){return this.table.applyCustomColumns!=null}get isFormatColumnsAvailable(){return this.table.applyCustomColumns!=null}get frontColumns(){var t;return this.getMemoizedFrontColumns((t=this.layoutHints)==null?void 0:t.frontColumns)}get backColumns(){var t;return this.getMemoizedBackColumns((t=this.layoutHints)==null?void 0:t.backColumns)}get frozenColumns(){var t;return this.getMemoizedFrozenColumns((t=this.layoutHints)==null?void 0:t.frozenColumns,this.userFrozenColumns)}get layoutHints(){return this.table.layoutHints}get floatingLeftColumnCount(){return this.frozenColumns.length}get description(){return this.table.description}get customColumns(){return this.customColumnList}set customColumns(t){if(yn.debug2("set customColumns",t,this.customColumnList,t===this.customColumnList),this.customColumnList.length===0&&t.length===0){yn.debug("Ignore empty initial customColumns"),this.customColumnList=t;return}if(this.customColumnList===t){yn.debug("Ignore same customColumns");return}this.closeSubscription(),this.customColumnList=t,this.table.applyCustomColumns([...t,...this.formatColumns]),this.applyViewport()}get formatColumns(){return this.formatColumnList}set formatColumns(t){if(yn.debug2("set formatColumns",t,this.formatColumnList,t===this.formatColumnList),this.formatColumnList.length===0&&t.length===0){yn.debug("Ignore empty initial formatColumns"),this.formatColumnList=t;return}if(this.formatColumnList===t){yn.debug("Ignore same formatColumns");return}this.closeSubscription(),this.formatColumnList=t,this.table.applyCustomColumns([...this.customColumns,...t]),this.applyViewport()}updateFrozenColumns(t){this.userFrozenColumns=t,this.dispatchEvent(new Me(ce.EVENT.TABLE_CHANGED,{detail:this.table}))}set totalsConfig(t){if(yn.debug("set totalsConfig",t),t!==this.totals){if(this.totals=t,this.formattedStringData=[],this.totalsTablePromise!=null&&this.totalsTablePromise.cancel(),this.setTotalsTable(null),t==null){this.dispatchEvent(new Me(ce.EVENT.UPDATED));return}this.totalsTablePromise=Ge.makeCancelable(this.table.getTotalsTable(t),n=>n.close()),this.totalsTablePromise.then(n=>{this.totalsTablePromise=null,this.setTotalsTable(n)}).catch(n=>{Ge.isCanceled(n)||(yn.error("Unable to set next totalsTable",n),this.totalsTablePromise=null,this.dispatchEvent(new Me(ce.EVENT.REQUEST_FAILED,{detail:n})))})}}get isFilterRequired(){return this.table.isUncoalesced}isFilterable(t){return this.getCachedFilterableColumnSet(this.columns).has(t)}async export(){return this.table.freeze()}columnStatistics(t){return this.table.getColumnStatistics(t)}isColumnMovable(t){const n=this.columns[t].name;return this.frontColumns.includes(n)||this.backColumns.includes(n)||this.frozenColumns.includes(n)?!1:!this.isKeyColumn(t)}isColumnFrozen(t){return this.frozenColumns.includes(this.columns[t].name)}async delete(t){var u;if(!this.isDeletableRanges(t))throw new Error(`Undeletable ranges ${t}`);M(this.inputTable);const{keyColumns:n}=this.inputTable;if(n.length===0)throw new Error("No key columns to allow deletion");const s=this.getPendingAreaRange(),o=t.map(h=>Q.intersection(s,h)).filter(h=>h!=null).map(h=>(M(h),Q.offset(h,0,-(this.floatingTopRowCount+this.table.size))));if(o.length>0){const h=new Map(super.pendingDataMap);for(let g=0;g<o.length;g+=1){const p=o[g];M(p.startRow),M(p.endRow);for(let f=p.startRow;f<=p.endRow;f+=1)h.delete(f)}super.pendingDataMap=h,this.formattedStringData=[],this.dispatchEvent(new Me(ce.EVENT.PENDING_DATA_UPDATED)),this.dispatchEvent(new Me(ce.EVENT.UPDATED))}const i=this.getTableAreaRange(),r=t.map(h=>Q.intersection(i,h)).filter(h=>h!=null);if(r.length<=0)return;const[l,a]=await Promise.all([this.snapshot(r.map(h=>(M(h),new Q(0,h.startRow,n.length-1,h.endRow)))),this.table.copy()]),d=l.map(h=>{const g=[];for(let p=0;p<n.length;p+=1){const f=n[p],C=h[p],w=I.makeFilterRawValue(f.type,C),S=f.filter().eq(w);g.push(S)}return g.reduce((p,f)=>{var C;return(C=p==null?void 0:p.and(f))!=null?C:f})}).reduce((h,g)=>{var p;return(p=h==null?void 0:h.or(g))!=null?p:g});a.applyFilter([d]),await((u=this.inputTable)==null?void 0:u.deleteTable(a)),a.close()}async seekRow(t,n,s,o,i,r,l){return this.table.seekRow(t,n,s,o,i,r,l)}get isSeekRowAvailable(){return this.table.seekRow!=null}}class Hg extends rr{constructor(){super(...arguments),this.getCachedFilterableColumnSet=Re((t,n)=>new Set(((n==null?void 0:n.length)>0?n:t).map(s=>t.findIndex(o=>s.name===o.name))))}applyBufferedViewport(t,n,s){this.table.setViewport(t,n,s)}textForCell(t,n){const s=this.columns[t],o=this.row(n);if(o!=null&&s!=null&&!o.hasChildren&&s.constituentType!=null){const i=this.valueForCell(t,n);return this.displayString(i,s.constituentType,s.name)}return super.textForCell(t,n)}extractViewportRow(t,n){const{isExpanded:s,hasChildren:o,depth:i}=t;return{...super.extractViewportRow(t,n),isExpanded:s,hasChildren:o,depth:i}}async snapshot(t,n,s){var l,a;M(this.viewport),M(this.viewportData);const{columns:o}=this.viewport,i=[];n!=null&&n&&i.push(o.map(c=>c.name));const r=new Q(0,(l=this.viewportData)==null?void 0:l.offset,o.length,this.viewportData.offset+this.viewportData.rows.length);for(let c=0;c<t.length;c+=1){const d=Q.intersection(r,t[c]);M(d),M(d.startRow),M(d.endRow);for(let u=d.startRow;u<=d.endRow;u+=1){const h=[],g=this.viewportData.rows[u-this.viewportData.offset];M(d.startColumn),M(d.endColumn);for(let p=d.startColumn;p<=d.endColumn;p+=1)M(s),h.push(s((a=g.data.get(p))==null?void 0:a.value,this.columns[p]));i.push(h)}}return i}get groupedColumns(){return this.table.groupedColumns}get hasExpandableRows(){return!0}get isExpandAllAvailable(){return this.table.expandAll!==void 0}get isChartBuilderAvailable(){return!1}get isSelectDistinctAvailable(){return!1}get isReversible(){return!1}isFilterable(t){return this.getCachedFilterableColumnSet(this.columns,this.groupedColumns).has(t)}isColumnMovable(t){return t>=this.groupedColumns.length}isRowExpandable(t){var s;const n=this.row(t);return(s=n==null?void 0:n.hasChildren)!=null?s:!1}isRowExpanded(t){var s;const n=this.row(t);return(s=n==null?void 0:n.isExpanded)!=null?s:!1}setRowExpanded(t,n,s=!1){this.isExpandAllAvailable?this.table.setExpanded(t,n,s):this.table.setExpanded(t,n)}expandAll(){this.table.expandAll&&this.table.expandAll()}collapseAll(){this.table.collapseAll&&this.table.collapseAll()}depthForRow(t){var s;const n=this.row(t);return((s=n==null?void 0:n.depth)!=null?s:1)-1}}const Fn=ie.module("IrisGridProxyModel");function Ri(e,t,n){return I.isTreeTable(e)?new Hg(e,t):new _g(e,t,n)}class Vg extends ce{constructor(t,n=new zt,s=null){super(),this.textForCell=(...i)=>this.model.textForCell(...i),this.truncationCharForCell=(...i)=>this.model.truncationCharForCell(...i),this.textAlignForCell=(...i)=>this.model.textAlignForCell(...i),this.colorForCell=(...i)=>this.model.colorForCell(...i),this.backgroundColorForCell=(...i)=>this.model.backgroundColorForCell(...i),this.textForColumnHeader=(...i)=>this.model.textForColumnHeader(...i),this.colorForColumnHeader=(...i)=>this.model.colorForColumnHeader(...i),this.textForRowHeader=(...i)=>this.model.textForRowHeader(...i),this.textForRowFooter=(...i)=>this.model.textForRowFooter(...i),this.isRowMovable=(...i)=>this.model.isRowMovable(...i),this.isColumnMovable=(...i)=>this.model.isColumnMovable(...i),this.isRowExpandable=(...i)=>Ae(this.model)?this.model.isRowExpandable(...i):!1,this.isRowExpanded=(...i)=>Ae(this.model)?this.model.isRowExpanded(...i):!1,this.setRowExpanded=(...i)=>{if(Ae(this.model))return this.model.setRowExpanded(...i);throw Error("Function setRowExpanded does not exist on IrisGridTableModel")},this.expandAll=()=>{if(Ae(this.model))return this.model.expandAll();throw Error("Function expandAll does not exist on IrisGridTableModel")},this.collapseAll=()=>{if(Ae(this.model))return this.model.collapseAll();throw Error("Function collapseAll does not exist on IrisGridTableModel")},this.depthForRow=(...i)=>Ae(this.model)?this.model.depthForRow(...i):0,this.getColumnHeaderGroup=(...i)=>this.model.getColumnHeaderGroup(...i),this.getColumnHeaderParentGroup=(...i)=>this.model.getColumnHeaderParentGroup(...i),this.formatForCell=(...i)=>this.model.formatForCell(...i),this.valueForCell=(...i)=>this.model.valueForCell(...i),this.displayString=(...i)=>this.model.displayString(...i),this.isEditableRange=(...i)=>ke(this.model)?this.model.isEditableRange(...i):!1,this.isFilterable=(...i)=>this.model.isFilterable(...i),this.setViewport=(i,r,l)=>this.model.setViewport(i,r,l),this.snapshot=(...i)=>this.model.snapshot(...i),this.textSnapshot=(...i)=>this.model.textSnapshot(...i),this.valuesTable=(...i)=>this.model.valuesTable(...i),this.editValueForCell=(...i)=>ke(this.model)?this.model.editValueForCell(...i):"",this.setValueForCell=(...i)=>ke(this.model)?this.model.setValueForCell(...i):Promise.reject(new Error("Model is not editable")),this.setValueForRanges=(...i)=>ke(this.model)?this.model.setValueForRanges(...i):Promise.reject(new Error("Model is not editable")),this.setValues=(...i)=>ke(this.model)?this.model.setValues(...i):Promise.resolve(),this.isValidForCell=(...i)=>ke(this.model)?this.model.isValidForCell(...i):!1,this.delete=(...i)=>this.model.delete(...i),this.commitPending=(...i)=>this.model.commitPending(...i),this.handleModelEvent=this.handleModelEvent.bind(this);const o=Ri(t,n,s);this.originalModel=o,this.model=o,this.modelPromise=null,this.rollup=null,this.selectDistinct=[]}close(){this.originalModel.close(),this.model!==this.originalModel&&this.model.close(),this.modelPromise!=null&&this.modelPromise.cancel()}handleModelEvent(t){Fn.debug2("handleModelEvent",t);const{detail:n,type:s}=t;this.dispatchEvent(new Me(s,{detail:n}))}setModel(t){Fn.debug("setModel",t);const n=this.model;n!==this.originalModel&&n.close(),this.model=t,this.listenerCount>0&&this.addListeners(t),this.dispatchEvent(new Me(ce.EVENT.COLUMNS_CHANGED,{detail:t.columns})),Ao(t)&&this.dispatchEvent(new Me(ce.EVENT.TABLE_CHANGED,{detail:t.table}))}setNextModel(t){Fn.debug2("setNextModel"),this.modelPromise&&this.modelPromise.cancel(),this.listenerCount>0&&this.removeListeners(this.model),this.modelPromise=Ge.makeCancelable(t,n=>n.close()),this.modelPromise.then(n=>{this.modelPromise=null,this.setModel(n)}).catch(n=>{if(Ge.isCanceled(n)){Fn.debug2("setNextModel cancelled");return}Fn.error("Unable to set next model",n),this.modelPromise=null,this.dispatchEvent(new Me(ce.EVENT.REQUEST_FAILED,{detail:n}))})}startListening(){super.startListening(),this.addListeners(this.model)}stopListening(){super.stopListening(),this.removeListeners(this.model)}addListeners(t){const n=Object.keys(ce.EVENT);for(let s=0;s<n.length;s+=1)t.addEventListener(n[s],this.handleModelEvent)}removeListeners(t){const n=Object.keys(ce.EVENT);for(let s=0;s<n.length;s+=1)t.removeEventListener(n[s],this.handleModelEvent)}get rowCount(){return this.model.rowCount}get columnCount(){return this.model.columnCount}get floatingTopRowCount(){return this.model.floatingTopRowCount}get floatingBottomRowCount(){return this.model.floatingBottomRowCount}get floatingLeftColumnCount(){return this.model.floatingLeftColumnCount}get floatingRightColumnCount(){return this.model.floatingRightColumnCount}isColumnFrozen(t){return this.model.isColumnFrozen(t)}get hasExpandableRows(){return Ae(this.model)?this.model.hasExpandableRows:!1}get isExpandAllAvailable(){var t;return Ae(this.model)&&(t=this.model.isExpandAllAvailable)!=null?t:!1}get isExportAvailable(){return this.model.isExportAvailable}get isColumnStatisticsAvailable(){return this.model.isColumnStatisticsAvailable}get isValuesTableAvailable(){return this.model.isValuesTableAvailable}get isCustomColumnsAvailable(){return this.model.isCustomColumnsAvailable&&!(this.isSelectDistinctAvailable&&this.selectDistinctColumns.length>0)}get isFormatColumnsAvailable(){return this.model.isFormatColumnsAvailable}get isChartBuilderAvailable(){return this.model.isChartBuilderAvailable}get isRollupAvailable(){return(this.originalModel.isRollupAvailable||this.rollup!=null)&&this.selectDistinct.length===0}get isSelectDistinctAvailable(){return(this.originalModel.isSelectDistinctAvailable||this.selectDistinct.length>0)&&this.rollup==null}get isTotalsAvailable(){return this.model.isTotalsAvailable}get isReversible(){return this.model.isReversible}get columns(){return this.model.columns}get initialMovedColumns(){return this.model.initialMovedColumns}get initialMovedRows(){return this.model.initialMovedRows}get layoutHints(){return this.model.layoutHints}get frontColumns(){return this.model.frontColumns}get backColumns(){return this.model.backColumns}get frozenColumns(){return this.model.frozenColumns}get columnHeaderGroups(){return this.model.columnHeaderGroups}set columnHeaderGroups(t){this.model.columnHeaderGroups=t}get initialColumnHeaderGroups(){return this.model.initialColumnHeaderGroups}get columnHeaderGroupMap(){return this.model.columnHeaderGroupMap}get columnHeaderMaxDepth(){return this.model.columnHeaderMaxDepth}updateFrozenColumns(t){return this.model.updateFrozenColumns(t)}get originalColumns(){return this.originalModel.columns}get groupedColumns(){return this.model.groupedColumns}get description(){return this.model.description}get filter(){return this.model.filter}set filter(t){this.model.filter=t}get formatter(){return this.model.formatter}set formatter(t){this.model.formatter=t}get sort(){return this.model.sort}set sort(t){this.model.sort=t}get customColumns(){return this.model.customColumns}set customColumns(t){this.model.customColumns=t}get formatColumns(){return this.model.formatColumns}set formatColumns(t){this.model.formatColumns=t}get rollupConfig(){return this.rollup}set rollupConfig(t){if(Fn.debug("set rollupConfig",t),!this.isRollupAvailable)throw new Error("Rollup Rows are not available");if(rt(t,this.rollup))return;this.rollup=t;let n=Promise.resolve(this.originalModel);Ao(this.originalModel)&&t!=null&&(n=this.originalModel.table.rollup(t).then(s=>Ri(s,this.formatter))),this.setNextModel(n)}get selectDistinctColumns(){return this.selectDistinct}set selectDistinctColumns(t){if(Fn.debug("set selectDistinctColumns",t),!this.isSelectDistinctAvailable)throw new Error("Select distinct is not available");if(t===this.selectDistinctColumns||t.length===0&&this.selectDistinctColumns.length===0){Fn.debug("Ignore same selectDistinctColumns",t);return}this.selectDistinct=t;const n=t.map(o=>this.originalColumns.find(i=>i.name===o)).filter(o=>o!=null);let s=Promise.resolve(this.originalModel);Ao(this.originalModel)&&n.length>0&&(s=this.originalModel.table.selectDistinct(n).then(o=>Ri(o,this.formatter))),this.setNextModel(s)}get table(){if(Ao(this.model))return this.model.table}get totalsConfig(){return this.model.totalsConfig}set totalsConfig(t){this.model.totalsConfig=t}get isFilterRequired(){return this.model.isFilterRequired}get isEditable(){return ke(this.model)&&this.model.isEditable}export(){if(I.isTreeTable(this.model))throw new Error("TreeTable has no 'export' property");return this.model.export()}columnStatistics(t){if(I.isTreeTable(this.model))throw new Error("TreeTable has no 'columnStatistics' function");return this.model.columnStatistics(t)}get pendingDataMap(){return this.model.pendingDataMap}set pendingDataMap(t){this.model.pendingDataMap=t}get pendingRowCount(){return this.model.pendingRowCount}set pendingRowCount(t){this.model.pendingRowCount=t}get pendingDataErrors(){return this.model.pendingDataErrors}getColumnIndexByName(t){return this.model.getColumnIndexByName(t)}async seekRow(t,n,s,o,i,r,l){return this.model.seekRow(t,n,s,o,i,r,l)}get isSeekRowAvailable(){return this.model.isSeekRowAvailable}}class Ug{static async makeModel(t,n=new zt){let s=null;return!I.isTreeTable(t)&&t.hasInputTable&&(s=await t.inputTable()),new Vg(t,n,s)}}const en=ie.module("TableViewportUpdater"),Bg=150,$s=class extends F.exports.PureComponent{constructor(){super(...arguments),this.getViewportRowRange=Re((e,t,n)=>{const s=n-t,o=Math.max(0,t-s*$s.ROW_BUFFER_PAGES),i=n+s*$s.ROW_BUFFER_PAGES;return[o,i]}),this.getViewportColumns=Re((e,t,n,s)=>{if(t==null||n==null)return null;const o=n-t,i=Math.max(0,t-o*$s.COLUMN_BUFFER_PAGES),r=Math.min(n+o*$s.COLUMN_BUFFER_PAGES,e.columns.length-1),l=[];for(let a=i;a<=r;a+=1){const c=H.getModelIndex(a,s);l.push(e.columns[c])}return l}),this.updateViewport=Pn((e,t,n,s,o)=>{if(t<e){en.error("Invalid viewport",e,t);return}if(e===0&&t===0){en.debug2("Ignoring 0-0 viewport");return}const{movedColumns:i,table:r}=this.props,[l,a]=this.getViewportRowRange(r,e,t),c=o!=null?o:this.getViewportColumns(r,n,s,i);if(en.debug2("Setting Viewport Top:",l,"Bottom:",a,"Columns:",c),this.subscription==null){en.debug2("updateViewport creating new subscription"),this.subscription=r.setViewport(l,a,c);const{onSubscription:d}=this.props;d(this.subscription)}else en.debug2("updateViewport using existing subscription"),this.subscription.setViewport(l,a,c)},Bg)}componentDidMount(){const{top:e,bottom:t,left:n,right:s,table:o,filters:i,sorts:r,columns:l,customColumns:a}=this.props;o.applyFilter(i),o.applySort(r),o.applyCustomColumns(a),this.updateViewport(e,t,n,s,l)}componentDidUpdate(e){const{top:t,bottom:n,left:s,right:o,table:i,filters:r,sorts:l,customColumns:a,columns:c}=this.props,d=r!==e.filters,u=l!==e.sorts,h=a!==e.customColumns,g=i!==e.table;(d||u||h||g)&&this.closeSubscription(),(d||g)&&(en.debug("update table filter",r),i.applyFilter(r)),(u||g)&&(en.debug("update table sort",l),i.applySort(l)),(h||g)&&(en.debug("update table custom columns",a),i.applyCustomColumns(a)),this.updateViewport(t,n,s,o,c)}componentWillUnmount(){this.closeSubscription()}closeSubscription(){if(en.debug2("closeSubscription",this.subscription),this.subscription){this.subscription.close(),this.subscription=void 0;const{onSubscription:e}=this.props;e()}this.updateViewport.cancel()}render(){return null}};let lr=$s;lr.ROW_BUFFER_PAGES=3;lr.COLUMN_BUFFER_PAGES=1;lr.defaultProps={top:0,bottom:0,left:null,right:null,columns:null,onSubscription:()=>{},filters:[],sorts:[],customColumns:[],movedColumns:[]};const gs=ie.module("TreeTableViewportUpdater"),Gg=150,ma=class extends F.exports.PureComponent{constructor(e){super(e),this.updateViewport=Pn((t,n)=>{if(n<t){gs.error("Invalid viewport",t,n);return}if(t===0&&n===0){gs.debug2("Ignoring 0-0 viewport");return}const{table:s,updateInterval:o}=this.props,i=n-t,r=Math.max(0,t-i*3),l=n+i*3+1;if(gs.debug2("Setting Viewport Top:",r,"Bottom:",l,s),!this.listenerCleanup){const{onViewportUpdate:a}=this.props;this.listenerCleanup=s.addEventListener(E.TreeTable.EVENT_UPDATED,a)}s.setViewport(r,l,void 0,o)},Gg),this.listenerCleanup=null}componentDidMount(){const{top:e,bottom:t,table:n,filters:s,sorts:o}=this.props;gs.debug("componentDidMount",this.props),n.applyFilter(s),n.applySort(o),this.updateViewport(e,t)}componentDidUpdate(e){const{top:t,bottom:n,table:s,filters:o,sorts:i}=this.props;o!==e.filters&&(gs.debug("update table filter",o),s.applyFilter(o)),i!==e.sorts&&(gs.debug("update table sort",i),s.applySort(i)),this.updateViewport(t,n)}componentWillUnmount(){this.updateViewport.cancel(),this.listenerCleanup&&this.listenerCleanup()}render(){return null}};let ga=ma;ga.UPDATE_INTERVAL=1e3;ga.defaultProps={top:0,bottom:0,onViewportUpdate:()=>{},filters:[],sorts:[],updateInterval:ma.UPDATE_INTERVAL};ie.setLogLevel(parseInt("2",10));const ws=ie.module("EmbedGrid.App"),Wg=[E.VariableType.TABLE,E.VariableType.TREETABLE,E.VariableType.HIERARCHICALTABLE,E.VariableType.PANDAS];async function $g(e,t){ws.info(`Fetching table ${t}...`);const n=await Dd(e,t);if(!Wg.includes(n.type))throw new Error(`Unsupported type '${n.type}' for variable named '${t}'`);return await e.getObject(n)}function Qg(){const[e,t]=F.exports.useState(),[n,s]=F.exports.useState(),[o,i]=F.exports.useState(),[r,l]=F.exports.useState(),[a,c]=F.exports.useState(!0),d=F.exports.useMemo(()=>new URLSearchParams(window.location.search),[]),u=d.get("canCopy")!=null,h=d.get("canDownloadCsv")!=null;F.exports.useEffect(function(){async function f(){try{const C=d.get("name");if(C==null)throw new Error("No name param provided");const w=new URL("/jsapi",`${window.location}`),S=`${w.protocol}//${w.host}`;ws.debug("Starting connection...");const T=new E.IdeConnection(S);ws.debug("Loading table",C,"...");const R=await $g(T,C);ws.debug("Creating model...");const b=await Ug.makeModel(R);t(b),ws.debug("Table successfully loaded!")}catch(C){ws.error("Unable to load table",C),s(`${C}`)}c(!1)}f()},[d]),F.exports.useEffect(function(){function f(C){const{command:w,value:S}=C.data;switch(w){case"filter":{const R=S.map(({name:b,value:v})=>{const D=e==null?void 0:e.columns.find(A=>A.name===b);if(D==null)throw new Error(`Could not find column named ${b}`);return{name:b,value:v,type:I.getNormalizedType(D.type)}});i(R);break}case"sort":{const R=S.map(({name:b,direction:v})=>{const D=e==null?void 0:e.columns.find(A=>A.name===b);if(D==null)throw new Error(`Could not find column named ${b}`);return v==="DESC"?D.sort().desc():D.sort().asc()});l(R);break}}}return window.addEventListener("message",f),()=>{window.removeEventListener("message",f)}},[e]);const g=e!=null;return y("div",{className:"App",children:[g&&m(Js,{canCopy:u,canDownloadCsv:h,model:e,inputFilters:o,sorts:r}),!g&&m(ml,{isLoaded:g,isLoading:a,errorMessage:n!=null?n:null}),m(Kc,{})]})}export{Wg as SUPPORTED_TYPES,Qg as default};
32
- //# sourceMappingURL=App.227130f4.js.map
30
+ `)}this.bufferedMessages=[],this.appendLogText(e)}queue(e){this.bufferedMessages.push(e),this.bufferedMessages.length===1&&(this.flushTimer=setTimeout(this.handleFlushTimeout,ot.bufferTimeout))}stopFlushTimer(){this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=void 0)}updateDimensions(){this.editor&&this.editor.layout()}handleClearClick(){this.clearLogs()}clearLogs(){this.messages=[],this.refreshLogText()}handleFlushTimeout(){this.stopFlushTimer(),this.flush()}handleLogMessage(e){this.messages.push(e),this.editor&&this.isLogItemVisible(e)&&this.queue(e)}handleMenuItemClick(e){this.toggleLogLevel(e)}handleResetClick(){this.resetLogLevels()}handleResize(){this.updateDimensions()}handleToggleAllClick(){this.toggleAll()}render(){const e={placement:"bottom-end"},{shownLogLevels:t}=this.state,n=this.getMenuActions(t);return y("div",{className:"log-pane h-100 w-100",children:[y("div",{className:"log-pane-menu",children:[m(z,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:Sc,tooltip:"Clear log"}),m(z,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:bc,tooltip:"Log Settings",onClick:()=>{},children:m(Ss,{actions:n,popperClassName:"log-level-menu-popper",popperOptions:e})})]}),m("div",{className:"log-pane-editor h-100 w-100",ref:s=>{this.editorContainer=s}})]})}};let Zs=ot;Zs.DefaultLogLevels=[je.STDOUT,je.ERROR,je.FATAL,je.STDERR,je.WARN];Zs.AllLogLevels=[je.INFO,je.STDOUT,je.ERROR,je.FATAL,je.STDERR,je.WARN,je.DEBUG,je.TRACE];Zs.bufferTimeout=16;Zs.maxLogSize=131072;Zs.truncateSize=65536;Lo.register([Bc,Gc,Wc,$c,zc,qc]);const ug=typeof ui=="function"?ui(Lo):ui.default(Lo),sn=class{constructor(){this.listeners=[],this.isDownsamplingDisabled=!1}getData(){return[]}getDefaultTitle(){return""}getLayout(){return{}}getFilterColumnMap(){return new Map}isFilterRequired(){return!1}setFilter(e){}close(){}setFormatter(e){this.formatter=e}setDownsamplingDisabled(e){this.isDownsamplingDisabled=e}setDimensions(e){this.rect=e}setTitle(e){this.title=e}subscribe(e){this.listeners.push(e)}unsubscribe(e){this.listeners=this.listeners.filter(t=>t!==e)}fireEvent(e){for(let t=0;t<this.listeners.length;t+=1)this.listeners[t](e)}fireUpdate(e){this.fireEvent(new CustomEvent(sn.EVENT_UPDATED,{detail:e}))}fireDisconnect(){this.fireEvent(new CustomEvent(sn.EVENT_DISCONNECT))}fireReconnect(){this.fireEvent(new CustomEvent(sn.EVENT_RECONNECT))}fireDownsampleStart(e){this.fireEvent(new CustomEvent(sn.EVENT_DOWNSAMPLESTARTED,{detail:e}))}fireDownsampleFinish(e){this.fireEvent(new CustomEvent(sn.EVENT_DOWNSAMPLEFINISHED,{detail:e}))}fireDownsampleFail(e){this.fireEvent(new CustomEvent(sn.EVENT_DOWNSAMPLEFAILED,{detail:e}))}fireDownsampleNeeded(e){this.fireEvent(new CustomEvent(sn.EVENT_DOWNSAMPLENEEDED,{detail:e}))}fireLoadFinished(){this.fireEvent(new CustomEvent(sn.EVENT_LOADFINISHED))}};let Ze=sn;Ze.EVENT_UPDATED="ChartModel.EVENT_UPDATED";Ze.EVENT_DISCONNECT="ChartModel.EVENT_DISCONNECT";Ze.EVENT_RECONNECT="ChartModel.EVENT_RECONNECT";Ze.EVENT_DOWNSAMPLESTARTED="ChartModel.EVENT_DOWNSAMPLESTARTED";Ze.EVENT_DOWNSAMPLEFINISHED="ChartModel.EVENT_DOWNSAMPLEFINISHED";Ze.EVENT_DOWNSAMPLEFAILED="ChartModel.EVENT_DOWNSAMPLEFAILED";Ze.EVENT_DOWNSAMPLENEEDED="ChartModel.EVENT_DOWNSAMPLENEEDED";Ze.EVENT_LOADFINISHED="ChartModel.EVENT_LOADFINISHED";const hg="#76d9e4 #9edc6f #fcd65b #aa9af4 #f37e3f #f95d84 #f0f0ee",mg="#403e41",gg="#5b5a5c",pg="#c0bfbf",fg="#4878ea",Cg="rgba(91, 90, 92, 0.7)",et={"paper-bgcolor":"#2d2a2e","plot-bgcolor":"#322f33","title-color":"#f0f0ee",colorway:hg,gridcolor:mg,linecolor:gg,zerolinecolor:pg,activecolor:fg,rangebgcolor:Cg,"area-color":"#76d9e4","trend-color":"#d5f0c1","line-color":"#9edc6f","error-band-line-color":"white","error-band-fill-color":"rgba(213, 240, 193, 0.1)","ohlc-increasing":"#9edc6f","ohlc-decreasing":"#f95d84"},In=Object.freeze({paper_bgcolor:et["paper-bgcolor"],plot_bgcolor:et["plot-bgcolor"],title_color:et["title-color"],colorway:et.colorway,gridcolor:et.gridcolor,linecolor:et.linecolor,zerolinecolor:et.zerolinecolor,activecolor:et.activecolor,rangebgcolor:et.rangebgcolor,area_color:et["area-color"],trend_color:et["trend-color"],line_color:et["line-color"],error_band_line_color:et["error-band-line-color"],error_band_fill_color:et["error-band-fill-color"],ohlc_increasing:et["ohlc-increasing"],ohlc_decreasing:et["ohlc-decreasing"]}),Vs=ie.module("ChartUtils"),vn=Object.freeze(E.calendar.DayOfWeek.values()),el="io.deephaven.time.DateTime",wg=36e5,Sg=1e6;function bg(e){return e.asDate!==void 0}function Tg(e){return e.asNumber!==void 0}function tl(e){return e.dhTimeZone!==void 0}function Eg(e){return e!=null&&e.range!=null&&(e.autorange===!1||e.autorange===void 0)}const q=class{static getPlotlyChartType(e,t){switch(e){case E.plot.SeriesPlotStyle.SCATTER:return t?"scatter":"scattergl";case E.plot.SeriesPlotStyle.LINE:return"scatter";case E.plot.SeriesPlotStyle.BAR:case E.plot.SeriesPlotStyle.STACKED_BAR:return"bar";case E.plot.SeriesPlotStyle.PIE:return"pie";case E.plot.SeriesPlotStyle.TREEMAP:return"treemap";case E.plot.SeriesPlotStyle.HISTOGRAM:return"histogram";case E.plot.SeriesPlotStyle.OHLC:return"ohlc";default:return}}static getPlotlyChartMode(e,t,n){const s=new Set;switch(e){case E.plot.SeriesPlotStyle.SCATTER:t!=null&&t&&s.add(q.MODE_LINES),(n==null||n)&&s.add(q.MODE_MARKERS);break;case E.plot.SeriesPlotStyle.LINE:(t==null||t)&&s.add(q.MODE_LINES),n!=null&&n&&s.add(q.MODE_MARKERS);break}return s.size>0?[...s].join("+"):void 0}static getPlotlyProperty(e,t){switch(e){case E.plot.SeriesPlotStyle.PIE:switch(t){case E.plot.SourceType.X:return"labels";case E.plot.SourceType.Y:return"values"}break;case E.plot.SeriesPlotStyle.OHLC:switch(t){case E.plot.SourceType.TIME:return"x"}break;case E.plot.SeriesPlotStyle.TREEMAP:switch(t){case E.plot.SourceType.X:return"ids";case E.plot.SourceType.Y:return"values";case E.plot.SourceType.LABEL:return"labels";case E.plot.SourceType.PARENT:return"parents";case E.plot.SourceType.COLOR:return"marker.colors"}break}switch(t){case E.plot.SourceType.X:return"x";case E.plot.SourceType.Y:return"y";case E.plot.SourceType.Z:return"z";case E.plot.SourceType.X_LOW:return"xLow";case E.plot.SourceType.X_HIGH:return"xHigh";case E.plot.SourceType.Y_LOW:return"yLow";case E.plot.SourceType.Y_HIGH:return"yHigh";case E.plot.SourceType.TIME:return"time";case E.plot.SourceType.OPEN:return"open";case E.plot.SourceType.HIGH:return"high";case E.plot.SourceType.LOW:return"low";case E.plot.SourceType.CLOSE:return"close";case E.plot.SourceType.SHAPE:return"shape";case E.plot.SourceType.SIZE:return"size";case E.plot.SourceType.LABEL:return"label";case E.plot.SourceType.COLOR:return"color";case E.plot.SourceType.PARENT:return"parent";case E.plot.SourceType.HOVER_TEXT:return"hovertext";case E.plot.SourceType.TEXT:return"text";default:throw new Error(`Unrecognized source type: ${t}`)}}static getPlotlySeriesOrientation(e){var n,s;const{sources:t}=e;return t.length===2&&((s=(n=t[0])==null?void 0:n.axis)==null?void 0:s.type)===E.plot.AxisType.Y?q.ORIENTATION.HORIZONTAL:q.ORIENTATION.VERTICAL}static getPlotlyErrorBars(e,t,n){const s=n.map((i,r)=>i-e[r]),o=t.map((i,r)=>e[r]-i);return{type:"data",symmetric:!1,array:s,arrayminus:o}}static getPlotlyDateFormat(e,t,n){const s=n==null?void 0:n.replace("%","%%").replace(/S{9}/g,"%9f").replace(/S{8}/g,"%8f").replace(/S{7}/g,"%7f").replace(/S{6}/g,"%6f").replace(/S{5}/g,"%5f").replace(/S{4}/g,"%4f").replace(/S{3}/g,"%3f").replace(/S{2}/g,"%2f").replace(/S{1}/g,"%1f").replace(/y{4}/g,"%Y").replace(/y{2}/g,"%y").replace(/M{4}/g,"%B").replace(/M{3}/g,"%b").replace(/M{2}/g,"%m").replace(/M{1}/g,"%-m").replace(/E{4,}/g,"%A").replace(/E{1,}/g,"%a").replace(/d{2}/g,"%d").replace(/([^%]|^)d{1}/g,"$1%-d").replace(/H{2}/g,"%H").replace(/h{2}/g,"%I").replace(/h{1}/g,"%-I").replace(/m{2}/g,"%M").replace(/s{2}/g,"%S").replace("'T'","T").replace(" z","");let o;const i=e==null?void 0:e.getColumnTypeFormatter(t);return i!=null&&tl(i)&&i.dhTimeZone!=null&&i.showTimeZone&&(o=E.i18n.DateTimeFormat.format(" z",new Date,i.dhTimeZone)),{tickformat:s,ticksuffix:o,automargin:!0}}static convertNumberPrefix(e){return e.replace(/\u00A4\u00A4/g,"USD").replace(/\u00A4/g,"$")}static getPlotlyNumberFormat(e,t,n){if(!n)return null;const o=n.split(";")[0].match(/^([^#,0.]*)([#,]*)([0,]*)(\.?)(0*)(#*)(E?0*)(%?)(.*)/);M(o);const[,i,r,l,,a,c,d,u,h]=o,g=l.replace(",","").length,f=r.indexOf(",")>=0||l.indexOf(",")>=0?",":"",C=d!=null&&d!==""?"e":"f",w=u!==""?u:C,S=a.length+c.length,R=`0${g}${f}.${S}${w}`,b=q.convertNumberPrefix(i),v=q.convertNumberPrefix(h);return{tickformat:R,tickprefix:b,ticksuffix:v,automargin:!0}}static getPlotlyAxisFormat(e,t=null){const{axis:n,columnType:s}=e,{formatPattern:o}=n;let i=null;return I.isDateType(s)?(i=q.getPlotlyDateFormat(t,s,o),i=q.addTickSpacing(i,n,!0)):I.isNumberType(s)&&(i=q.getPlotlyNumberFormat(t,s,o),i=q.addTickSpacing(i,n,!1)),n.formatType===E.plot.AxisFormatType.CATEGORY&&(i?i.type="category":i={type:"category",tickformat:void 0,ticksuffix:void 0}),i}static addTickSpacing(e,t,n){const{gapBetweenMajorTicks:s}=t;if(s>0){const o=e||{};let i=s;return n&&(i=s/Sg),t.log&&(i=Math.log(i)),o.tickmode="linear",o.dtick=i,o}return e}static getSourceForAxis(e,t){for(let n=0;n<e.series.length;n+=1){const s=e.series[n];for(let o=0;o<s.sources.length;o+=1){const i=s.sources[o];if(i.axis===t)return i}}return null}static getSeriesVisibility(e,t){return t!=null&&t.hiddenSeries!=null&&t.hiddenSeries.includes(e)?"legendonly":!0}static getHiddenLabels(e){return e!=null&&e.hiddenSeries?[...e.hiddenSeries]:[]}static makeSeriesData(e,t,n,s,o=q.ORIENTATION.VERTICAL){return{type:e,mode:t,name:n,orientation:o,showlegend:s!=null?s:void 0}}static makeSeriesDataFromSeries(e,t,n,s=null,o=In){const{name:i,isLinesVisible:r,isShapesVisible:l,plotStyle:a,lineColor:c,shapeColor:d,sources:u,shape:h,shapeSize:g}=e,p=u.some(T=>{var R;return(R=T.axis)==null?void 0:R.businessCalendar}),f=q.getChartType(a,p),C=q.getPlotlyChartMode(a,r!=null?r:void 0,l!=null?l:void 0),w=q.getPlotlySeriesOrientation(e),S=q.makeSeriesData(f,C,i,s,w);return q.addSourcesToSeriesData(S,a,u,t),q.addStylingToSeriesData(S,a,o,c,d,h,g,n),S}static addSourcesToSeriesData(e,t,n,s){const o=e;for(let i=0;i<n.length;i+=1){const r=n[i],{axis:l,type:a}=r,c=q.getPlotlyProperty(t,a);ol(o,c,[]);const d=l!=null?q.getAxisPropertyName(l.type):null;if(d!=null){const u=s.get(l.type);if(u){const h=u.indexOf(l),g=h>0?`${h+1}`:"";o[`${d}axis`]=`${d}${g}`}}}}static addStylingToSeriesData(e,t,n=In,s=null,o=null,i=null,r=null,l=null){const a=e;if(a.marker={line:{}},a.line={width:1},t===E.plot.SeriesPlotStyle.AREA?a.fill="tozeroy":t===E.plot.SeriesPlotStyle.STACKED_AREA?a.stackgroup="stack":t===E.plot.SeriesPlotStyle.STEP?a.line.shape="hv":t===E.plot.SeriesPlotStyle.HISTOGRAM?(a.width=[],a.marker.line!==void 0&&Object.assign(a.marker.line,{color:n.paper_bgcolor,width:1})):t===E.plot.SeriesPlotStyle.OHLC?(a.increasing={line:{color:n.ohlc_increasing}},a.decreasing={line:{color:n.ohlc_decreasing}}):t===E.plot.SeriesPlotStyle.PIE?(a.textinfo="label+percent",a.outsidetextfont={color:n.title_color}):t===E.plot.SeriesPlotStyle.TREEMAP&&(a.hoverinfo="text",a.textinfo="label+text",a.tiling={packing:"squarify",pad:0},a.textposition="middle center",a.outsidetextfont={color:n.title_color}),s!=null&&(t===E.plot.SeriesPlotStyle.BAR?a.marker.color=s:a.line.color=s),o!=null&&(a.marker.color=o),i!=null&&i.length>0)try{a.marker.symbol=q.getMarkerSymbol(i)}catch(c){Vs.warn("Unable to handle shape",i,":",c)}r!=null&&(a.marker.size=r*q.DEFAULT_MARKER_SIZE),l!=null&&t!==E.plot.SeriesPlotStyle.PIE&&(a.visible=l)}static getMarkerSymbol(e){switch(e){case"SQUARE":return"square";case"CIRCLE":return"circle";case"DIAMOND":return"diamond";case"UP_TRIANGLE":return"triangle-up";case"DOWN_TRIANGLE":return"triangle-down";case"RIGHT_TRIANGLE":return"triangle-right";case"LEFT_TRIANGLE":return"triangle-left";case"ELLIPSE":case"HORIZONTAL_RECTANGLE":case"VERTICAL_RECTANGLE":default:throw new Error(`Unrecognized shape ${e}`)}}static getAxisFormats(e,t){const n=new Map,s={tickformat:null,ticksuffix:null},o=q.getAllAxes(e),i=q.groupArray(o,"type"),{charts:r}=e;for(let l=0;l<r.length;l+=1){const a=r[l];for(let c=0;c<a.series.length;c+=1){const d=a.series[c],{sources:u}=d,h=u.filter(g=>g.axis);for(let g=0;g<h.length;g+=1){const p=h[g],{axis:f}=p,{type:C}=f,w=i.get(C);M(w);const S=w.indexOf(f),T=q.getAxisPropertyName(C);if(T!=null){const R=q.getAxisLayoutProperty(T,S);if(n.has(R))Vs.debug(`${R} already added.`);else{Vs.debug(`Adding ${R} to axisFormats.`);const b=q.getPlotlyAxisFormat(p,t);if(b===null)n.set(R,s);else{n.set(R,b);const{businessCalendar:v}=f;if(v!=null){const D=[],{businessPeriods:A,businessDays:N,holidays:L,timeZone:k}=v,x=t==null?void 0:t.getColumnTypeFormatter(el);let W;tl(x)&&(W=x.dhTimeZone);const V=W?(k.standardOffset-W.standardOffset)/60:0;L.length>0&&D.push(...q.createRangeBreakValuesFromHolidays(L,k,W)),A.forEach(K=>D.push({pattern:"hour",bounds:[q.periodToDecimal(K.close)+V,q.periodToDecimal(K.open)+V]})),N.length<vn.length&&q.createBoundsFromDays(N).forEach(K=>D.push({pattern:"day of week",bounds:K})),b.rangebreaks=D}if(n.size===a.axes.length)return n}}}}}}return n}static getChartType(e,t){switch(e){case E.plot.SeriesPlotStyle.HISTOGRAM:return"bar";default:return q.getPlotlyChartType(e,t)}}static getAxisPropertyName(e){switch(e){case E.plot.AxisType.X:return"x";case E.plot.AxisType.Y:return"y";default:return null}}static getAxisSide(e){switch(e){case E.plot.AxisPosition.BOTTOM:return"bottom";case E.plot.AxisPosition.TOP:return"top";case E.plot.AxisPosition.LEFT:return"left";case E.plot.AxisPosition.RIGHT:return"right";default:return}}static getAllAxes(e){return e.charts.reduce((t,n)=>[...t,...n.axes],[])}static getChartForSeries(e,t){const{charts:n}=e;for(let s=0;s<n.length;s+=1){const o=n[s];for(let i=0;i<o.series.length;i+=1)if(t===o.series[i])return o}return null}static getLayoutRanges(e){const t={},n=Object.keys(e).filter(s=>s.indexOf("axis")>=0);for(let s=0;s<n.length;s+=1){const o=n[s],i=e[o];Eg(i)&&(t[o]=[...i.range])}return t}static updateFigureAxes(e,t,n,s=0,o=0,i=In){const r=e,l=q.getAllAxes(t);for(let a=0;a<t.charts.length;a+=1){const c=t.charts[a],d=n==null?void 0:n(c),u=q.getChartBounds(t,c,s,o);q.updateLayoutAxes(r,c.axes,l,s,o,u,d,i)}q.removeStaleAxes(r,l)}static getChartBounds(e,t,n=0,s=0){var T;const{cols:o,rows:i}=e,{column:r,colspan:l,row:a,rowspan:c}=t,d=r+l,u=a+c,h=1/o,g=1/i,p=q.AXIS_SIZE_PX/n,f=q.AXIS_SIZE_PX/s,C={left:r*h+(r>0?p/2:0),bottom:a*g+(a>0?f/2:0),top:u*g-(u<i?f/2:0),right:d*h-(d<o?p/2:0)};return((T=q.groupArray(t.axes,"position").get(E.plot.AxisPosition.RIGHT))!=null?T:[]).length>0&&(n>0?C.right-=(C.right-C.left)*Math.max(0,Math.min(q.LEGEND_WIDTH_PX/n,q.MAX_LEGEND_SIZE)):C.right-=(C.right-C.left)*q.DEFAULT_AXIS_SIZE),C}static updateLayoutAxes(e,t,n,s=0,o=0,i={left:0,top:0,right:1,bottom:1},r,l=In){const a=s>0?Math.max(q.MIN_AXIS_SIZE,Math.min(q.AXIS_SIZE_PX/o,q.MAX_AXIS_SIZE)):q.DEFAULT_AXIS_SIZE,c=o>0?Math.max(q.MIN_AXIS_SIZE,Math.min(q.AXIS_SIZE_PX/s,q.MAX_AXIS_SIZE)):q.DEFAULT_AXIS_SIZE,d=e,u=q.groupArray(t,"position"),h=q.groupArray(t,"type"),g=[...h.keys()],p=q.groupArray(n,"type");for(let f=0;f<g.length;f+=1){const C=g[f],w=q.getAxisPropertyName(C);if(w!=null){const S=h.get(C),T=p.get(C),b=C===E.plot.AxisType.Y?o:s;M(S),M(T);for(let v=0;v<S.length;v+=1){const D=S[v],A=T.indexOf(D),N=q.getAxisLayoutProperty(w,A);d[N]==null&&(d[N]=q.makeLayoutAxis(C,l));const L=d[N];if(L!=null){q.updateLayoutAxis(L,D,v,u,a,c,i);const{range:k,autorange:x}=L;if(r!=null&&k!==void 0&&(x===void 0||x===!1)){const W=r(D),[V,K]=W(k);Vs.debug("Setting downsample range",b,V,K),D.range(b,V,K)}else D.range(b)}}}}}static removeStaleAxes(e,t){const n=e,s=q.groupArray(t,"type"),o=[...s.keys()];for(let i=0;i<o.length;i+=1){const r=o[i],l=s.get(r);M(l);let a=l.length;const c=q.getAxisPropertyName(r);if(c!=null){let d=q.getAxisLayoutProperty(c,a);for(;n[d]!=null;)delete n[d],a+=1,d=q.getAxisLayoutProperty(c,a)}}}static getAxisLayoutProperty(e,t){const n=t>0?`${t+1}`:"";return`${e!=null?e:""}axis${n}`}static updateLayoutAxis(e,t,n,s,o,i,r){var u,h,g;const a=t.type===E.plot.AxisType.Y?i:o,c=e,d=(u=t.label)!=null?u:"";if(c.title!==void 0&&typeof c.title!="string"?c.title.text=d:c.title={text:d},t.log&&(c.type="log"),c.side=q.getAxisSide(t.position),n>0){c.overlaying=(h=q.getAxisPropertyName(t.type))!=null?h:void 0;const p=(g=s.get(t.position))!=null?g:[],f=p.indexOf(t);f>0&&(c.anchor="free",t.position===E.plot.AxisPosition.RIGHT?c.position=r.right+(f-p.length+1)*a:t.position===E.plot.AxisPosition.TOP?c.position=r.top+(f-p.length+1)*a:t.position===E.plot.AxisPosition.BOTTOM?c.position=r.bottom+(p.length-f+1)*a:t.position===E.plot.AxisPosition.LEFT&&(c.position=r.left+(p.length-f+1)*a))}else if(t.type===E.plot.AxisType.X){const p=s.get(E.plot.AxisPosition.LEFT)||[],f=s.get(E.plot.AxisPosition.RIGHT)||[],C=Math.max(r.left,r.left+(p.length-1)*i),w=Math.min(r.right-(f.length-1)*i,r.right);c.domain=[C,w]}else if(t.type===E.plot.AxisType.Y){const p=s.get(E.plot.AxisPosition.BOTTOM)||[],f=s.get(E.plot.AxisPosition.TOP)||[],C=Math.max(r.bottom,r.bottom+(p.length-1)*o),w=Math.min(r.top-(f.length-1)*o,r.top);c.domain=[C,w]}}static periodToDecimal(e){const t=e.split(":");return Number(t[0])+Number(t[1])/60}static createBoundsFromDays(e){const t=e.map(i=>vn.indexOf(i)),n=vn.filter(i=>!e.includes(i)).map(i=>vn.indexOf(i)),s=new Set;n.forEach(i=>{for(let r=i+1;r<i+vn.length;r+=1){const l=r%vn.length;if(t.includes(l)){s.add(l);break}}});const o=[];return s.forEach(i=>{for(let r=i-1;r>i-vn.length;r-=1){const l=r<0?r+vn.length:r;if(t.includes(l)){const a=(l+1)%7;o.push([a,i]);break}}}),o}static createRangeBreakValuesFromHolidays(e,t,n){const s=[],o=[];return e.forEach(i=>{i.businessPeriods.length>0?o.push(...q.createPartialHoliday(i,t,n)):s.push(q.createFullHoliday(i,t,n))}),[{values:s},...o]}static createFullHoliday(e,t,n){return q.adjustDateForTimeZone(`${e.date.toString()} 00:00:00.000000`,t,n)}static createPartialHoliday(e,t,n){const s=e.date.toString(),o=["00:00"];e.businessPeriods.forEach(r=>{o.push(r.open),o.push(r.close)}),o.push("24:00");const i=[];for(let r=0;r<o.length;r+=2){const l=o[r],a=o[r+1];if(l!==a){const c=[q.adjustDateForTimeZone(`${s} ${l}:00.000000`,t,n)],d=wg*(q.periodToDecimal(a)-q.periodToDecimal(l));i.push({values:c,dvalue:d})}}return i}static adjustDateForTimeZone(e,t,n){return n&&n.standardOffset!==t.standardOffset?q.unwrapValue(q.wrapValue(e,el,t),n):e}static groupArray(e,t){return e.reduce((n,s)=>{var r;const o=s[t],i=(r=n.get(o))!=null?r:[];return i.push(s),n.set(o,i),n},new Map)}static unwrapValue(e,t){if(e!=null){if(bg(e))return E.i18n.DateTimeFormat.format(q.DATE_FORMAT,e,t);if(Tg(e))return e.asNumber()}return e}static wrapValue(e,t,n=null){if(I.isDateType(t)&&typeof e=="string"){const s=e,o=q.DATE_FORMAT.substr(0,e.length),i=E.i18n.DateTimeFormat.parse(o,s);if(!n)return i;const r=`${o} Z`,l=E.i18n.DateTimeFormat.format("Z",i,n),a=E.i18n.DateTimeFormat.parse(r,`${s} ${l}`),c=E.i18n.DateTimeFormat.format("Z",a,n);return E.i18n.DateTimeFormat.parse(r,`${s} ${c}`)}return e}static makeLayoutAxis(e,t=In){const n={automargin:!0,gridcolor:t.gridcolor,linecolor:t.linecolor,rangeslider:{visible:!1},showline:!0,ticklen:5,tickcolor:t.paper_bgcolor,tickfont:{color:t.zerolinecolor},title:{font:{color:t.title_color}}};return e===E.plot.AxisType.X?Object.assign(n,{showgrid:!0}):e===E.plot.AxisType.Y&&Object.assign(n,{zerolinecolor:t.zerolinecolor,zerolinewidth:2}),n}static getColorwayFromTheme(e=In){let t=[];return e.colorway&&(Array.isArray(e.colorway)?t=e.colorway:typeof e.colorway=="string"?t=e.colorway.split(" "):Vs.warn(`Unable to handle colorway property: ${e.colorway}`)),t}static makeDefaultLayout(e=In){const t={...e,autosize:!0,colorway:q.getColorwayFromTheme(e),font:{family:"'Fira Sans', sans-serif"},title:{font:{color:e.title_color},yanchor:"top",pad:{...q.DEFAULT_TITLE_PADDING},y:1},legend:{font:{color:e.title_color}},margin:{...q.DEFAULT_MARGIN},xaxis:q.makeLayoutAxis(E.plot.AxisType.X,e),yaxis:q.makeLayoutAxis(E.plot.AxisType.Y,e)};return t.datarevision=0,t}static hydrateSettings(e){return{...e,type:E.plot.SeriesPlotStyle[e.type]}}static titleFromSettings(e){const{series:t,xAxis:n,title:s=`${t.join(", ")} by ${n}`}=e;return s}static makeFigureSettings(e,t){const{series:n,xAxis:s,type:o}=e,i=q.titleFromSettings(e),r={formatType:`${E.plot.AxisFormatType.NUMBER}`,type:`${E.plot.AxisType.X}`,position:`${E.plot.AxisPosition.BOTTOM}`},l={formatType:`${E.plot.AxisFormatType.NUMBER}`,type:`${E.plot.AxisType.Y}`,position:`${E.plot.AxisPosition.LEFT}`};return{charts:[{chartType:`${E.plot.ChartType.XY}`,axes:[r,l],series:n.map(a=>({plotStyle:`${o}`,name:a,dataSources:[{type:`${E.plot.SourceType.X}`,columnName:s,axis:r,table:t},{type:`${E.plot.SourceType.Y}`,columnName:a,axis:l,table:t}]}))}],title:i}}};let we=q;we.DEFAULT_AXIS_SIZE=.15;we.MIN_AXIS_SIZE=.025;we.MAX_AXIS_SIZE=.2;we.AXIS_SIZE_PX=75;we.LEGEND_WIDTH_PX=50;we.MAX_LEGEND_SIZE=.25;we.ORIENTATION=Object.freeze({HORIZONTAL:"h",VERTICAL:"v"});we.DATE_FORMAT="yyyy-MM-dd HH:mm:ss.SSSSSS";we.DEFAULT_MARGIN=Object.freeze({l:60,r:50,t:30,b:60,pad:0});we.DEFAULT_TITLE_PADDING=Object.freeze({t:8});we.SUBTITLE_LINE_HEIGHT=25;we.DEFAULT_MARKER_SIZE=6;we.MODE_MARKERS="markers";we.MODE_LINES="lines";const Rn=ie.module("Chart"),Ws=class extends F.exports.Component{constructor(e){super(e),this.getCachedConfig=Re((t,n,s,o)=>{const i=[],r=Boolean(t);if(r&&i.push({name:`Downsampling failed: ${t}`,click:()=>{},icon:Ws.convertIcon(al),attr:"fill-warning"}),n||s||o||r){const l=Ws.downsampleButtonTitle(s,o),a=Ws.downsampleButtonAttr(s,o),c=s?Tc:Ec;i.push({name:l,icon:Ws.convertIcon(c),click:this.handleDownsampleClick,attr:a})}return{displaylogo:!1,displayModeBar:s||r?!0:"hover",modeBarButtons:[i,["toImage"],["zoom2d","pan2d"],["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]]}}),this.handleAfterPlot=this.handleAfterPlot.bind(this),this.handleDownsampleClick=this.handleDownsampleClick.bind(this),this.handleModelEvent=this.handleModelEvent.bind(this),this.handlePlotUpdate=this.handlePlotUpdate.bind(this),this.handleRelayout=this.handleRelayout.bind(this),this.handleRestyle=this.handleRestyle.bind(this),this.plot=Fe.createRef(),this.plotWrapper=Fe.createRef(),this.columnFormats=[],this.dateTimeFormatterOptions={},this.decimalFormatOptions={},this.integerFormatOptions={},this.isSubscribed=!1,this.isLoadedFired=!1,this.currentSeries=0,this.state={data:null,downsamplingError:null,isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,layout:{datarevision:0},revision:0}}static convertIcon(e){const[t,,,,n]=e.icon,s=`${n}`;return{width:t,path:s,ascent:t,descent:0,transform:"matrix(1, 0, 0, 1, 0, 0)"}}static downsampleButtonTitle(e,t){return e?"Downsampling in progress...":t?"Downsampling disabled, click to enable":"Downsampling enabled, click to disable"}static downsampleButtonAttr(e,t){return e?"animation-spin":t?void 0:"fill-active"}componentDidMount(){this.updateDimensions(),this.updateModelDimensions(),this.initData(),this.initFormatter();const{isActive:e}=this.props;e&&this.subscribe()}componentDidUpdate(e){const{isActive:t,settings:n}=this.props;this.updateFormatterSettings(n),t!==e.isActive&&(t?this.subscribe():this.unsubscribe())}componentWillUnmount(){this.unsubscribe()}getPlotRect(){var e,t;return(t=(e=this.plotWrapper.current)==null?void 0:e.getBoundingClientRect())!=null?t:null}initData(){const{model:e}=this.props,{layout:t}=this.state;this.setState({data:e.getData(),layout:{...t,...e.getLayout()}})}subscribe(){if(this.isSubscribed)return;const{model:e}=this.props;if(!this.rect||this.rect.width===0||this.rect.height===0){Rn.debug2("Delaying subscription until model dimensions are set");return}e.subscribe(this.handleModelEvent),this.isSubscribed=!0}unsubscribe(){if(!this.isSubscribed)return;const{model:e}=this.props;e.unsubscribe(this.handleModelEvent),this.isSubscribed=!1}handleAfterPlot(){this.plot.current!=null}handleDownsampleClick(){this.setState(({isDownsamplingDisabled:e})=>({downsamplingError:null,isDownsampleInProgress:!1,isDownsampleFinished:!1,isDownsamplingDisabled:!e}),()=>{const{model:e}=this.props,{isDownsamplingDisabled:t}=this.state;e.setDownsamplingDisabled(t)})}handleModelEvent(e){var s;const{type:t,detail:n}=e;switch(Rn.debug2("Received data update",t,n),t){case Ze.EVENT_UPDATED:{this.currentSeries+=1,this.setState(i=>{const{layout:r,revision:l}=i;return typeof r.datarevision=="number"&&(r.datarevision+=1),{data:n,layout:r,revision:l+1}});const{onUpdate:o}=this.props;o({isLoading:!this.isLoadedFired});break}case Ze.EVENT_LOADFINISHED:{const{onUpdate:o}=this.props;this.isLoadedFired=!0,o({isLoading:!1});break}case Ze.EVENT_DISCONNECT:{const{onDisconnect:o}=this.props;o();break}case Ze.EVENT_RECONNECT:{const{onReconnect:o}=this.props;o();break}case Ze.EVENT_DOWNSAMPLESTARTED:{this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!0,downsamplingError:null});break}case Ze.EVENT_DOWNSAMPLEFINISHED:{this.setState({isDownsampleFinished:!0,isDownsampleInProgress:!1,downsamplingError:null});break}case Ze.EVENT_DOWNSAMPLENEEDED:case Ze.EVENT_DOWNSAMPLEFAILED:{const o=(s=n.message)!=null?s:n;this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,downsamplingError:o});const{onError:i}=this.props;i(new Error(o));break}default:Rn.debug("Unknown event type",t,e)}}handlePlotUpdate(e){const{layout:t}=e,n=we.getLayoutRanges(t);!rt(n,this.ranges)&&(this.ranges=n,this.updateModelDimensions(!0))}handleRelayout(e){if(Rn.debug("handleRelayout",e),e.hiddenlabels!=null){const{onSettingsChanged:t}=this.props,n=[...e.hiddenlabels];t({hiddenSeries:n})}this.updateModelDimensions()}handleRestyle([e,t]){if(Rn.debug("handleRestyle",e,t),Object.keys(e).includes("visible")){const{data:n}=this.state,{onSettingsChanged:s}=this.props;if(n!=null){const o=n.reduce((i,{name:r,visible:l})=>r!=null&&l==="legendonly"?[...i,r]:i,[]);s({hiddenSeries:o})}}}updateModelDimensions(e=!1){const t=this.getPlotRect();if(!t){Rn.warn("Unable to get plotting rect");return}if(!this.rect||this.rect.width!==t.width||this.rect.height!==t.height||e){this.rect=t;const{isActive:s,model:o}=this.props;o.setDimensions(t),s&&this.subscribe()}}initFormatter(){const{settings:e}=this.props;this.updateFormatterSettings(e)}updateFormatterSettings(e){const t=Jn.getColumnFormats(e),n=Jn.getDateTimeFormatterOptions(e),{decimalFormatOptions:s={},integerFormatOptions:o={}}=e;(!rt(this.columnFormats,t)||!rt(this.dateTimeFormatterOptions,n)||!rt(this.decimalFormatOptions,s)||!rt(this.integerFormatOptions,o))&&(this.columnFormats=Jn.getColumnFormats(e),this.dateTimeFormatterOptions=n,this.decimalFormatOptions=s,this.integerFormatOptions=o,this.updateFormatter())}updateFormatter(){const e=new zt(this.columnFormats,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions),{model:t}=this.props;t.setFormatter(e)}updateDimensions(){const e=this.getPlotRect();this.plot.current!=null&&e!=null&&e.width>0&&e.height>0&&Lo.relayout(this.plot.current.el,{autosize:!0}).catch(t=>{Rn.debug("Unable to resize, promise rejected",t)})}render(){const{data:e,downsamplingError:t,isDownsampleFinished:n,isDownsampleInProgress:s,isDownsamplingDisabled:o,layout:i,revision:r}=this.state,l=this.getCachedConfig(t,n,s,o),a=e!=null;return m("div",{className:"h-100 w-100 chart-wrapper",ref:this.plotWrapper,children:a&&m(ug,{ref:this.plot,data:e,layout:i,revision:r,config:l,onAfterPlot:this.handleAfterPlot,onError:Rn.error,onRelayout:this.handleRelayout,onUpdate:this.handlePlotUpdate,onRestyle:this.handleRestyle,useResizeHandler:!0,style:{height:"100%",width:"100%"}})})}};let vg=Ws;vg.defaultProps={isActive:!0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:cn.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,formatter:[]},onDisconnect:()=>{},onReconnect:()=>{},onUpdate:()=>{},onError:()=>{},onSettingsChanged:()=>{}};const st=ie.module("FigureChartModel"),ha=class extends Ze{constructor(e,t={},n=In){super(),this.addPendingSeries=vt(()=>{var r;const o=we.getAllAxes(this.figure),{pendingSeries:i}=this;for(let l=0;l<i.length;l+=1){const a=i[l],c=this.figure.charts.find(d=>d.series.includes(a));this.addSeries(a,o,(r=c==null?void 0:c.showLegend)!=null?r:null),a.subscribe()}this.pendingSeries=[]},ha.ADD_SERIES_DEBOUNCE),this.getTimeZone=be((o,i)=>{if(i!=null){const r=i.getColumnTypeFormatter(o);if(r!=null)return r.dhTimeZone}}),this.getValueTranslator=be((o,i)=>{const r=this.getTimeZone(o,i);return l=>we.unwrapValue(l,r)}),this.getValueParser=be((o,i)=>{const r=this.getTimeZone(o,i);return l=>we.wrapValue(l,o,r)}),this.getRangeParser=be((o,i)=>r=>{let[l,a]=r;const c=this.getValueParser(o,i);return l=c(l),a=c(a),[l,a]}),this.getAxisRangeParser=be((o,i)=>r=>{const l=we.getSourceForAxis(o,r);return l?this.getRangeParser(l.columnType,i):a=>a}),this.handleFigureUpdated=this.handleFigureUpdated.bind(this),this.handleFigureDisconnected=this.handleFigureDisconnected.bind(this),this.handleFigureReconnected=this.handleFigureReconnected.bind(this),this.handleFigureSeriesAdded=this.handleFigureSeriesAdded.bind(this),this.handleDownsampleStart=this.handleDownsampleStart.bind(this),this.handleDownsampleFinish=this.handleDownsampleFinish.bind(this),this.handleDownsampleFail=this.handleDownsampleFail.bind(this),this.handleDownsampleNeeded=this.handleDownsampleNeeded.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.figure=e,this.settings=t,this.theme=n,this.data=[];const s={data:{},layout:we.makeDefaultLayout(n)};this.layout={grid:{rows:e.rows,columns:e.cols,pattern:"independent"},template:s},this.seriesDataMap=new Map,this.pendingSeries=[],this.oneClicks=[],this.filterColumnMap=new Map,this.lastFilter=new Map,this.isConnected=!0,this.seriesToProcess=new Set,this.setTitle(this.getDefaultTitle()),this.initAllSeries(),this.updateAxisPositions(),this.startListeningFigure()}close(){this.figure.close(),this.addPendingSeries.cancel(),this.stopListeningFigure()}getDefaultTitle(){return this.figure.charts.length>0?this.figure.charts[0].title:""}initAllSeries(){this.oneClicks=[],this.filterColumnMap.clear();const{charts:e}=this.figure,t=we.getAllAxes(this.figure),n=[];for(let i=0;i<e.length;i+=1){const r=e[i];for(let l=0;l<r.series.length;l+=1){const a=r.series[l];n.push(a.name),this.addSeries(a,t,r.showLegend)}}const o=[...this.seriesDataMap.keys()].filter(i=>n.indexOf(i)<0);for(let i=0;i<o.length;i+=1){const r=o[i];this.seriesDataMap.delete(r)}this.seriesToProcess=new Set([...this.seriesDataMap.keys()])}addSeries(e,t,n){const s=we.groupArray(t,"type"),o=we.makeSeriesDataFromSeries(e,s,we.getSeriesVisibility(e.name,this.settings),n,this.theme);if(this.seriesDataMap.set(e.name,o),this.data=[...this.seriesDataMap.values()],e.plotStyle===E.plot.SeriesPlotStyle.STACKED_BAR?this.layout.barmode="stack":e.plotStyle===E.plot.SeriesPlotStyle.PIE&&(this.layout.hiddenlabels=we.getHiddenLabels(this.settings)),this.layout.showlegend=this.data.length>1||e.plotStyle===E.plot.SeriesPlotStyle.PIE?n!=null?n:void 0:!1,e.oneClick!=null){const{oneClick:i}=e,{columns:r}=i;for(let l=0;l<r.length;l+=1)this.filterColumnMap.set(r[l].name,r[l]);this.oneClicks.push(i)}this.updateLayoutFormats()}subscribe(e){super.subscribe(e),this.listeners.length===1&&(this.initAllSeries(),this.subscribeFigure())}unsubscribe(e){super.unsubscribe(e),this.listeners.length===0&&this.unsubscribeFigure()}subscribeFigure(){if(!this.isConnected){st.debug("Ignoring subscribe when figure in disconnected state");return}this.figure.subscribe(this.isDownsamplingDisabled?E.plot.DownsampleOptions.DISABLE:E.plot.DownsampleOptions.DEFAULT)}unsubscribeFigure(){this.figure.unsubscribe()}startListeningFigure(){this.figure.addEventListener(E.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.addEventListener(E.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.addEventListener(E.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.addEventListener(E.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.addEventListener(E.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.addEventListener(E.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.addEventListener(E.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.addEventListener(E.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.addEventListener(E.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}stopListeningFigure(){this.figure.removeEventListener(E.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.removeEventListener(E.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.removeEventListener(E.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.removeEventListener(E.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.removeEventListener(E.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.removeEventListener(E.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.removeEventListener(E.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.removeEventListener(E.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.removeEventListener(E.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}handleDownsampleStart(e){st.debug("Downsample started",e),this.fireDownsampleStart(e.detail)}handleDownsampleFinish(e){st.debug("Downsample finished",e),this.fireDownsampleFinish(e.detail)}handleDownsampleFail(e){st.error("Downsample failed",e),this.fireDownsampleFail(e.detail)}handleDownsampleNeeded(e){st.info("Downsample needed",e),this.fireDownsampleNeeded(e.detail)}handleFigureUpdated(e){const{detail:t}=e,{series:n}=t;st.debug2("handleFigureUpdated",n);for(let o=0;o<n.length;o+=1){const i=n[o];st.debug2("handleFigureUpdated updating series",i.name);const{sources:r}=i;for(let l=0;l<r.length;l+=1){const a=r[l],{columnType:c,type:d}=a,u=this.getValueTranslator(c,this.formatter),h=t.getArray(i,d,u);this.setDataArrayForSeries(i,d,h)}this.seriesToProcess.delete(i.name),this.seriesToProcess.size===0&&this.fireLoadFinished(),this.cleanSeries(i)}const{data:s}=this;this.fireUpdate(s)}handleRequestFailed(e){st.error("Request failed",e)}resubscribe(){this.listeners.length>0&&(this.unsubscribeFigure(),this.subscribeFigure())}setFormatter(e){super.setFormatter(e),this.updateLayoutFormats(),this.resubscribe()}setDownsamplingDisabled(e){super.setDownsamplingDisabled(e),this.resubscribe()}handleFigureDisconnected(e){st.debug("Figure disconnected",e),this.isConnected=!1,this.listeners.length>0&&this.unsubscribeFigure(),this.fireDisconnect()}handleFigureReconnected(e){st.debug("Figure reconnected",e),this.isConnected=!0,this.initAllSeries(),this.fireReconnect(),this.listeners.length>0&&this.subscribeFigure()}handleFigureSeriesAdded(e){const{detail:t}=e;st.debug("handleFigureSeriesAdded",t),this.pendingSeries.push(t),this.addPendingSeries()}setDimensions(e){super.setDimensions(e),this.updateAxisPositions()}setTitle(e){var s,o;super.setTitle(e);const t=(o=(s=(e!=null?e:"").match(/<br>/g))==null?void 0:s.length)!=null?o:0,n=we.DEFAULT_MARGIN.t+t*we.SUBTITLE_LINE_HEIGHT;this.layout.margin?this.layout.margin.t=n:this.layout.margin={t:n},typeof this.layout.title=="string"?this.layout.title=e:(this.layout.title={...this.layout.title},this.layout.title.text=e,this.layout.title.pad={...this.layout.title.pad},this.layout.title.pad.t=we.DEFAULT_TITLE_PADDING.t+t*we.SUBTITLE_LINE_HEIGHT*.5)}getPlotWidth(){var e,t,n,s;return!this.rect||!this.rect.width?0:Math.max(this.rect.width-((t=(e=this.layout.margin)==null?void 0:e.l)!=null?t:0)-((s=(n=this.layout.margin)==null?void 0:n.r)!=null?s:0),0)}getPlotHeight(){var e,t,n,s;return!this.rect||!this.rect.height?0:Math.max(this.rect.height-((t=(e=this.layout.margin)==null?void 0:e.t)!=null?t:0)-((s=(n=this.layout.margin)==null?void 0:n.b)!=null?s:0),0)}updateAxisPositions(){const e=this.getPlotWidth(),t=this.getPlotHeight();we.updateFigureAxes(this.layout,this.figure,n=>this.getAxisRangeParser(n,this.formatter),e,t,this.theme)}updateLayoutFormats(){if(!this.formatter)return;we.getAxisFormats(this.figure,this.formatter).forEach((t,n)=>{st.debug(`Assigning ${n}`,this.layout[n],t);const s=this.layout[n];s!=null?Object.assign(s,t):st.debug(`Ignoring null layout.${n}`)})}setDataArrayForSeries(e,t,n){const{name:s,plotStyle:o}=e,i=this.seriesDataMap.get(s),r=we.getPlotlyProperty(o,t);i&&ol(i,r,n)}cleanSeries(e){const{name:t,plotStyle:n}=e,s=this.seriesDataMap.get(t);if(s!=null){if(n===E.plot.SeriesPlotStyle.HISTOGRAM){const{xLow:o,xHigh:i}=s;if(o&&i&&o.length===i.length){const r=[];for(let l=0;l<o.length;l+=1)r.push(i[l]-o[l]);s.width=r}}else if(n===E.plot.SeriesPlotStyle.LINE){const{x:o,xLow:i,xHigh:r,y:l,yLow:a,yHigh:c}=s;i&&r&&i!==o&&(s.error_x=we.getPlotlyErrorBars(o,i,r)),a&&c&&a!==l&&(s.error_y=we.getPlotlyErrorBars(l,a,c))}else if(n===E.plot.SeriesPlotStyle.TREEMAP){const{ids:o,labels:i}=s;o!==void 0&&i===void 0&&(s.labels=o)}}}getData(){return this.data}getLayout(){return this.layout}getFilterColumnMap(){return new Map(this.filterColumnMap)}isFilterRequired(){return this.oneClicks.find(e=>e.requireAllFiltersToDisplay)!=null}setFilter(e){if(this.oneClicks.length===0){st.warn("Trying to set a filter, but no one click!");return}st.debug("setFilter",e);for(let t=0;t<this.oneClicks.length;t+=1){const n=this.oneClicks[t],{columns:s}=n;new Set([...e.keys(),...this.lastFilter.keys()]).forEach(i=>{const r=e.get(i);this.lastFilter.get(i)!==r&&s.find(l=>l.name===i)!=null&&n.setValueForColumn(i,r)})}this.lastFilter=new Map(e)}setFigure(e){this.close(),this.figure=e,this.setTitle(this.getDefaultTitle()),this.initAllSeries(),this.updateAxisPositions(),this.startListeningFigure(),this.listeners.length>0&&this.subscribeFigure()}updateSettings(e){this.settings=e}};let Rg=ha;Rg.ADD_SERIES_DEBOUNCE=50;function yg({text:e,isOpen:t,onClose:n}){var T,R;const[s,o]=F.exports.useState(!1),[i,r]=F.exports.useState(0),[l,a]=F.exports.useState(!1),[c,d]=F.exports.useState(!1),[u,h]=F.exports.useState(!1),g=F.exports.useRef();F.exports.useEffect(function(){if(!!t){try{JSON.parse(e),h(!0)}catch{h(!1)}d(!1)}},[t,e]),F.exports.useEffect(function(){g.current&&g.current.layout()},[i]),F.exports.useEffect(function(){g.current&&g.current.updateOptions({lineNumbers:l?"on":"off"})},[l]);function p(){a(!l)}function f(){var v;const b=(v=g.current)==null?void 0:v.getModel();!u||!b||(c?(b.setValue(e),d(!1)):(b.setValue(JSON.stringify(JSON.parse(e),void 0,2)),d(!0)),C())}function C(){var v,D;const b=g.current;!b||a(((D=(v=b.getModel())==null?void 0:v.getLineCount())!=null?D:0)>1)}function w(){s&&(g.current=void 0,n())}function S(b){g.current=b,r(b.getContentHeight()),b.onDidContentSizeChange(({contentHeight:v})=>r(v)),C()}return!t&&!s?null:y(vc,{isOpen:t,centered:!0,keyboard:!0,toggle:w,onOpened:()=>o(!0),onClosed:()=>{o(!1),r(0)},className:"theme-bg-dark cell-overflow-modal",size:"xl",children:[y(Rc,{toggle:n,children:[m("h5",{className:"overflow-modal-title",children:"Cell Contents"}),m(gl,{kind:"inline",tooltip:"Copy cell contents",copy:(R=(T=g.current)==null?void 0:T.getValue())!=null?R:e}),m(z,{kind:"inline",active:l,icon:yc,tooltip:"Toggle line numbers",onClick:p}),u&&m(z,{kind:"inline",icon:Fc,active:c,tooltip:"Format as JSON",onClick:f})]}),m(Dc,{style:{height:i},children:m(or,{onEditorInitialized:S,settings:{value:e,readOnly:!0,wordWrap:"on",language:u?"typescript":"plaintext",folding:u,padding:{bottom:16},lineNumbers:l?"on":"off",overviewRulerLanes:0,renderLineHighlight:"none",find:{seedSearchStringFromSelection:"never"}}})})]})}function Fg(e){return e.model!==void 0}const Dg="###,##0";function Ig({gotoRow:e,gotoRowError:t,gotoValueError:n,onGotoRowSubmit:s,isShown:o,onEntering:i,onEntered:r,onExiting:l,onExited:a,model:c,onGotoRowNumberChanged:d,onClose:u,gotoValueSelectedColumnName:h,gotoValue:g,onGotoValueSelectedColumnNameChanged:p,onGotoValueSelectedFilterChanged:f,onGotoValueChanged:C,onGotoValueSubmit:w}){const S=F.exports.useRef(null),T=F.exports.useRef(null),[R,b]=F.exports.useState(!1);let v=[];Fg(c)&&c.table!==void 0&&({columns:v}=c.table);const D="Row number",{rowCount:A}=c,N=$=>{$.key==="Enter"&&($.stopPropagation(),$.preventDefault(),w())},L=c.getColumnIndexByName(h),k=v[L!=null?L:0],x=k==null?void 0:k.type,W=I.getNormalizedType(x),V=$=>{C($!=null?$:"")},K=()=>{var $,P;R&&document.activeElement!==S.current?($=S.current)==null||$.select():!R&&document.activeElement!==T.current&&((P=T.current)==null||P.select())};F.exports.useEffect(K,[R,e,g]);const Z=()=>{switch(W){case I.dataType.DECIMAL:case I.dataType.INT:return m("div",{className:"goto-row-input",children:m("input",{ref:T,type:"number",className:ee("form-control",{"is-invalid":n!==""}),onKeyDown:N,placeholder:"value",onChange:$=>V($.target.value),value:g})});case I.dataType.DATETIME:return m("div",{className:"goto-value-date-time-input",children:m(Ac,{className:ee("form-control","goto-value-date-time-input",{"is-invalid":n!==""}),onChange:V})});case I.dataType.STRING:return y(Oe,{children:[m("div",{className:"goto-row-input",children:y("select",{className:"custom-select",onChange:$=>{f($.target.value)},children:[m("option",{value:_.eq,children:"Equals"},_.eq),m("option",{value:_.contains,children:"Contains"},_.contains),m("option",{value:_.eqIgnoreCase,children:"EqIgnoreCase"},_.eqIgnoreCase)]})}),m("div",{className:"goto-row-input",children:m("input",{ref:T,className:ee("form-control",{"is-invalid":n!==""}),onKeyDown:N,placeholder:"value",onChange:$=>V($.target.value),value:g})})]});case I.dataType.BOOLEAN:return m("div",{className:"goto-row-input",children:y("select",{className:"custom-select",onChange:$=>{V($.target.value)},value:g,children:[m("option",{value:"true",children:"true"},"true"),m("option",{value:"false",children:"false"},"false")]})});default:return m("div",{className:"goto-row-input",children:m("input",{ref:T,className:"form-control",onKeyDown:N,placeholder:"value",onChange:$=>V($.target.value),value:g})})}};return m(Zo,{isShown:o,className:ee("goto-row"),onEntering:i,onEntered:()=>{r(),K()},onExiting:l,onExited:a,children:y(Oe,{children:[y("div",{className:"goto-row-row",children:[y("div",{className:ee("goto-row-wrapper",{"is-inactive":!R}),onClick:()=>b(!0),onFocus:()=>b(!0),role:"group",children:[m("div",{className:"goto-row-text",children:"Go to row"}),m("div",{className:"goto-row-input",children:m("input",{ref:S,type:"number",onKeyDown:$=>{$.key==="Enter"&&($.stopPropagation(),$.preventDefault(),s())},className:ee("form-control",{"is-invalid":t!==""}),placeholder:D,onChange:$=>{d($)},value:e})}),y("div",{className:"goto-row-text",children:["of ",dh.i18n.NumberFormat.format(Dg,A)]}),t&&m("div",{className:"text-danger",children:t})]}),m("div",{className:"goto-row-close",children:m(z,{kind:"ghost",onClick:u,children:m(te,{icon:qs,style:{marginRight:"0"}})})})]}),c.isSeekRowAvailable&&m("div",{className:"goto-row-row",children:y("div",{className:ee("goto-row-wrapper",{"is-inactive":R}),onClick:()=>b(!1),onFocus:()=>b(!1),role:"group",children:[m("div",{className:"goto-row-text",children:"Go to value"}),m("div",{className:"goto-row-input",children:m("select",{className:"custom-select",onChange:$=>{const P=$.target.value;p(P)},value:h,children:v.map($=>m("option",{value:$.name,children:$.name},$.name))})}),Z(),y("div",{children:[m(z,{kind:"ghost",disabled:g==="",onClick:()=>{w(!0)},children:m(te,{icon:Ic})}),m(z,{kind:"ghost",disabled:g==="",onClick:()=>{w(!1)},children:m(te,{icon:Nc})})]}),n&&m("div",{className:"text-danger",children:n})]})})]})})}const oe=ie.module("IrisGrid"),Ng=500,Ag=250,Mg=250,Og=250,ma=Object.freeze({aggregations:ve,showOnTop:!1}),xg="yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS z";function nl({advancedFilters:e,aggregationSettings:t,customColumns:n,quickFilters:s,reverseType:o,rollupConfig:i,searchFilter:r,selectDistinctColumns:l,sorts:a}){return e.size===0&&t.aggregations.length===0&&n.length===0&&s.size===0&&o===I.REVERSE_TYPE.NONE&&i==null&&r==null&&l.length===0&&a.length===0}const Nn=class extends F.exports.Component{constructor(e){var Z,$;super(e),this.getAdvancedMenuOpenedHandler=be(P=>this.handleAdvancedMenuOpened.bind(this,P),{max:100}),this.getCachedAdvancedFilterMenuActions=be((P,G,X,j,de)=>m(Ji,{model:P,column:G,onFilterChange:this.handleAdvancedFilterChange,onSortChange:this.handleAdvancedFilterSortChange,onDone:this.handleAdvancedFilterDone,options:X,sortDirection:j,formatter:de}),{max:50}),this.getCachedOptionItems=be((P,G,X,j,de,me,Ce,ye,fe,Je,Xe,$e,Ot,Ct,hn,xt)=>{const De=[];return P&&De.push({type:Se.CHART_BUILDER,title:"Chart Builder",icon:Mc}),De.push({type:Se.VISIBILITY_ORDERING_BUILDER,title:"Hide, Group, and Order Columns",icon:Gi}),X&&De.push({type:Se.CONDITIONAL_FORMATTING,title:"Conditional Formatting",icon:Pi}),G&&De.push({type:Se.CUSTOM_COLUMN_BUILDER,title:"Custom Columns",icon:Oc}),j&&De.push({type:Se.ROLLUP_ROWS,title:"Rollup Rows",icon:xc}),de&&De.push({type:Se.AGGREGATIONS,title:"Aggregate Columns",icon:kc}),me&&De.push({type:Se.SELECT_DISTINCT,title:"Select Distinct Values",icon:Lc}),Ce&&Ot&&De.push({type:Se.TABLE_EXPORTER,title:"Download CSV",icon:Pc}),xt&&De.push({type:Se.ADVANCED_SETTINGS,title:"Advanced Settings",icon:_c}),De.push({type:Se.QUICK_FILTERS,title:"Quick Filters",subtitle:ye.shortcut.getDisplayText(),icon:Oo,isOn:Xe,onChange:ye.action}),Ct&&De.push({type:Se.SEARCH_BAR,title:"Search Bar",subtitle:fe.shortcut.getDisplayText(),icon:Hc,isOn:$e,onChange:fe.action}),De.push({type:Se.GOTO,title:"Go to",subtitle:Je.shortcut.getDisplayText(),icon:Vc,isOn:hn,onChange:Je.action}),Object.freeze(De)},{max:1}),this.getCachedHiddenColumns=be((P,G)=>J.getHiddenColumns(new Map([...P.initialColumnWidths,...G])),{max:1}),this.getAggregationMap=be((P,G)=>{const X={};return G.forEach(({operation:j,selected:de,invert:me})=>{X[j]=On.getOperationColumnNames(P,j,de,me)}),X}),this.getOperationMap=be((P,G)=>{const X={};return G.filter(j=>!On.isRollupOperation(j.operation)).forEach(({operation:j,selected:de,invert:me})=>{On.getOperationColumnNames(P,j,de,me).forEach(Ce=>{var fe;const ye=[...(fe=X[Ce])!=null?fe:[],j];X[Ce]=Object.freeze(ye)})}),X}),this.getOperationOrder=be(P=>P.map(G=>G.operation).filter(G=>!On.isRollupOperation(G))),this.getCachedFormatColumns=be((P,G)=>pu(P,G)),this.getCachedModelColumns=be((P,G)=>P.columns),this.getCachedPreviewFormatColumns=be((P,G,X,j)=>{if(oe.debug("getCachedPreviewFormatColumns",G,X,j),X!==void 0&&j!==void 0){const de=[...G];return de[j]=X,this.getCachedFormatColumns(P,de)}return this.getCachedFormatColumns(P,G)}),this.getModelRollupConfig=be((P,G,X)=>J.getModelRollupConfig(P,G,X)),this.getModelTotalsConfig=be((P,G,X)=>{var ye,fe,Je;const{aggregations:j,showOnTop:de}=X;if(((fe=(ye=G==null?void 0:G.columns)==null?void 0:ye.length)!=null?fe:0)>0||((Je=j==null?void 0:j.length)!=null?Je:0)===0)return null;const me=this.getOperationMap(P,j),Ce=this.getOperationOrder(j);return{operationMap:me,operationOrder:Ce,showOnTop:de}}),this.getCachedStateOverride=be((P,G,X,j,de,me,Ce,ye,fe,Je)=>({hoverSelectColumn:P,isFilterBarShown:G,isSelectingColumn:X,loadingScrimProgress:j,quickFilters:de,advancedFilters:me,sorts:Ce,reverseType:ye,rollupConfig:fe,isMenuShown:Je}),{max:1}),this.getCachedFilter=be((P,G,X,j,de)=>[...P!=null?P:[],...j!=null?j:[],...J.getFiltersFromFilterMap(G),...J.getFiltersFromFilterMap(X),...de!==void 0?[de]:[]],{max:1}),this.getCachedTheme=be((P,G,X)=>({...Ml,...P,autoSelectRow:!G,rowFooterWidth:X>0?P.rowFooterWidth:0}),{max:1}),this.getAlwaysFetchColumns=be((P,G,X,j,de,me)=>{const Ce=[];for(let fe=0;fe<j;fe+=1)Ce.push(G[H.getModelIndex(fe,X)].name);for(let fe=0;fe<de;fe+=1)Ce.push(G[H.getModelIndex(G.length-1-fe,X)].name);if(me)for(let fe=me[0];fe<=me[1];fe+=1)Ce.push(G[H.getModelIndex(fe,X)].name);const ye=new Set([...P,...Ce]);return Object.freeze([...ye])}),this.updateSearchFilter=vt((P,G,X,j)=>{const de=Io.createSearchFilter(P,G,X,j);this.setState({searchFilter:de})},Ag),this.handleConditionalFormatEditorUpdate=vt(P=>{this.setState({conditionalFormatPreview:P})},Og),this.handleDownloadProgressUpdate=Pn((P,G)=>{const{tableDownloadStatus:X}=this.state;X===gt.DOWNLOAD_STATUS.DOWNLOADING&&this.setState({tableDownloadProgress:P,tableDownloadEstimatedTime:G})},Ng),this.getOverflowButtonTooltip=be(P=>{if(P==null)return null;const G={position:"absolute",...P,pointerEvents:"none"};return m("div",{style:G,children:m(Rt,{options:{placement:"left",modifiers:{flip:{behavior:["left","right"]}}},ref:this.handleTooltipRef,children:"View full contents"},Date.now())})}),this.getExpandCellTooltip=be(P=>{if(P==null)return null;const{expandTooltipDisplayValue:G}=this.state,X={position:"absolute",...P,pointerEvents:"none"};return m("div",{style:X,children:m(Rt,{options:{placement:"bottom-start"},ref:this.handleTooltipRef,children:y("div",{style:{textAlign:"left"},children:["Click to ",G," row",m("br",{}),_n.isMacPlatform()?"\u2318":"Ctrl+","Click to expand row and all children"]})},Date.now())})}),this.handleGotoValueChanged=P=>{this.setState({gotoValue:P}),this.debouncedSeekRow(P)},this.debouncedSeekRow=vt(P=>{this.seekRow(P)},Mg),this.handleAdvancedFilterChange=this.handleAdvancedFilterChange.bind(this),this.handleAdvancedFilterSortChange=this.handleAdvancedFilterSortChange.bind(this),this.handleAdvancedFilterDone=this.handleAdvancedFilterDone.bind(this),this.handleAdvancedMenuOpened=this.handleAdvancedMenuOpened.bind(this),this.handleGotoRowOpened=this.handleGotoRowOpened.bind(this),this.handleGotoRowClosed=this.handleGotoRowClosed.bind(this),this.handleAdvancedMenuClosed=this.handleAdvancedMenuClosed.bind(this),this.handleAggregationChange=this.handleAggregationChange.bind(this),this.handleAggregationsChange=this.handleAggregationsChange.bind(this),this.handleAggregationEdit=this.handleAggregationEdit.bind(this),this.handleAnimationLoop=this.handleAnimationLoop.bind(this),this.handleAnimationStart=this.handleAnimationStart.bind(this),this.handleAnimationEnd=this.handleAnimationEnd.bind(this),this.handleChartChange=this.handleChartChange.bind(this),this.handleChartCreate=this.handleChartCreate.bind(this),this.handleGridError=this.handleGridError.bind(this),this.handleFilterBarChange=this.handleFilterBarChange.bind(this),this.handleFilterBarDone=this.handleFilterBarDone.bind(this),this.handleFilterBarTab=this.handleFilterBarTab.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleMenu=this.handleMenu.bind(this),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleMenuSelect=this.handleMenuSelect.bind(this),this.handleMenuBack=this.handleMenuBack.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.handleSelectionChanged=this.handleSelectionChanged.bind(this),this.handleMovedColumnsChanged=this.handleMovedColumnsChanged.bind(this),this.handleHeaderGroupsChanged=this.handleHeaderGroupsChanged.bind(this),this.handleUpdate=this.handleUpdate.bind(this),this.handleTooltipRef=this.handleTooltipRef.bind(this),this.handleViewChanged=this.handleViewChanged.bind(this),this.handleFormatSelection=this.handleFormatSelection.bind(this),this.handleConditionalFormatCreate=this.handleConditionalFormatCreate.bind(this),this.handleConditionalFormatEdit=this.handleConditionalFormatEdit.bind(this),this.handleConditionalFormatsChange=this.handleConditionalFormatsChange.bind(this),this.handleConditionalFormatEditorSave=this.handleConditionalFormatEditorSave.bind(this),this.handleConditionalFormatEditorCancel=this.handleConditionalFormatEditorCancel.bind(this),this.handleUpdateCustomColumns=this.handleUpdateCustomColumns.bind(this),this.handleCustomColumnsChanged=this.handleCustomColumnsChanged.bind(this),this.handleSelectDistinctChanged=this.handleSelectDistinctChanged.bind(this),this.handlePendingDataUpdated=this.handlePendingDataUpdated.bind(this),this.handlePendingCommitClicked=this.handlePendingCommitClicked.bind(this),this.handlePendingDiscardClicked=this.handlePendingDiscardClicked.bind(this),this.handleGotoRowSelectedRowNumberSubmit=this.handleGotoRowSelectedRowNumberSubmit.bind(this),this.focusRowInGrid=this.focusRowInGrid.bind(this),this.handleDownloadTable=this.handleDownloadTable.bind(this),this.handleDownloadTableStart=this.handleDownloadTableStart.bind(this),this.handleCancelDownloadTable=this.handleCancelDownloadTable.bind(this),this.handleDownloadCanceled=this.handleDownloadCanceled.bind(this),this.handleDownloadCompleted=this.handleDownloadCompleted.bind(this),this.handlePartitionAppend=this.handlePartitionAppend.bind(this),this.handlePartitionChange=this.handlePartitionChange.bind(this),this.handlePartitionFetchAll=this.handlePartitionFetchAll.bind(this),this.handlePartitionDone=this.handlePartitionDone.bind(this),this.handleColumnVisibilityChanged=this.handleColumnVisibilityChanged.bind(this),this.handleColumnVisibilityReset=this.handleColumnVisibilityReset.bind(this),this.handleCrossColumnSearch=this.handleCrossColumnSearch.bind(this),this.handleRollupChange=this.handleRollupChange.bind(this),this.handleOverflowClose=this.handleOverflowClose.bind(this),this.getColumnBoundingRect=this.getColumnBoundingRect.bind(this),this.handleGotoRowSelectedRowNumberChanged=this.handleGotoRowSelectedRowNumberChanged.bind(this),this.handleGotoValueSelectedColumnNameChanged=this.handleGotoValueSelectedColumnNameChanged.bind(this),this.handleGotoValueSelectedFilterChanged=this.handleGotoValueSelectedFilterChanged.bind(this),this.handleGotoValueChanged=this.handleGotoValueChanged.bind(this),this.handleGotoValueSubmitted=this.handleGotoValueSubmitted.bind(this),this.grid=null,this.gridWrapper=null,this.lastLoadedConfig=null,this.pending=new Xo,this.globalColumnFormats=ve,this.decimalFormatOptions={},this.integerFormatOptions={},this.truncateNumbersWithPound=!1,this.renderer=new zs,this.tableSaver=null,this.crossColumnRef=Fe.createRef(),this.isAnimating=!1,this.filterInputRef=Fe.createRef(),this.toggleFilterBarAction={action:()=>this.toggleFilterBar(),shortcut:Nt.TABLE.TOGGLE_QUICK_FILTER},this.toggleSearchBarAction={action:()=>this.toggleSearchBar(),shortcut:Nt.TABLE.TOGGLE_SEARCH},this.toggleGotoRowAction={action:()=>this.toggleGotoRow(),shortcut:Nt.TABLE.GOTO_ROW},this.discardAction={action:()=>{const{model:P}=this.props;ke(P)&&P.isEditable&&P.pendingDataMap.size>0&&this.discardPending().catch(oe.error)},shortcut:Nt.INPUT_TABLE.DISCARD},this.commitAction={action:()=>{const{model:P}=this.props;ke(P)&&P.isEditable&&P.pendingDataMap.size>0&&P.pendingDataErrors.size===0&&this.commitPending().catch(oe.error)},shortcut:Nt.INPUT_TABLE.COMMIT},this.contextActions=[this.toggleFilterBarAction,this.toggleSearchBarAction,this.toggleGotoRowAction,this.discardAction,this.commitAction];const{aggregationSettings:t,conditionalFormats:n,customColumnFormatMap:s,isFilterBarShown:o,isSelectingPartition:i,model:r,movedColumns:l,movedRows:a,partition:c,partitionColumn:d,rollupConfig:u,userColumnWidths:h,userRowHeights:g,showSearchBar:p,searchValue:f,selectedSearchColumns:C,invertSearchColumns:w,advancedFilters:S,quickFilters:T,selectDistinctColumns:R,pendingDataMap:b,canCopy:v,frozenColumns:D,columnHeaderGroups:A}=e,N=[new Au(this),new Mu(this)];v&&N.push(new Du(this));const L=[new Ou(this),new Hu(this),new xu(this),new ku(this),new Vu(this),new _u(this),new Yt(this),new Pu(this),new Uu(this)],k=l.length>0?l:r.initialMovedColumns,x=a.length>0?a:r.initialMovedRows,W=new Wu({userColumnWidths:new Map(h),userRowHeights:new Map(g),movedColumns:k,initialColumnWidths:new Map(($=(Z=r==null?void 0:r.layoutHints)==null?void 0:Z.hiddenColumns)==null?void 0:$.map(P=>[r.getColumnIndexByName(P),0]))}),V=C!=null?C:[],K=Io.createSearchFilter(f,V,r.columns,w);this.state={isFilterBarShown:o,isSelectingPartition:i,focusedFilterBarColumn:null,metricCalculator:W,metrics:void 0,keyHandlers:N,mouseHandlers:L,partition:c,partitionColumn:d,partitionTable:null,partitionFilters:[],quickFilters:T?new Map(T):new Map,advancedFilters:new Map(S),shownAdvancedFilter:null,hoverAdvancedFilter:null,sorts:[],reverseType:I.REVERSE_TYPE.NONE,customColumns:[],selectDistinctColumns:R,selectedRanges:[],copyOperation:null,loadingText:null,loadingScrimProgress:null,loadingSpinnerShown:!1,movedColumns:k,movedRows:x,shownColumnTooltip:null,formatter:new zt,isMenuShown:!1,customColumnFormatMap:new Map(s),conditionalFormats:n,conditionalFormatEditIndex:null,conditionalFormatPreview:void 0,hoverSelectColumn:null,isTableDownloading:!1,isReady:!1,tableDownloadStatus:"",tableDownloadProgress:0,tableDownloadEstimatedTime:0,showSearchBar:p,searchFilter:K,searchValue:f,selectedSearchColumns:V,invertSearchColumns:w,rollupConfig:u,rollupSelectedColumns:[],aggregationSettings:t,selectedAggregation:null,openOptions:[],pendingRowCount:0,pendingDataMap:b!=null?b:new Map,pendingDataErrors:new Map,pendingSavePromise:null,pendingSaveError:null,toastMessage:null,frozenColumns:D,showOverflowModal:!1,overflowText:"",overflowButtonTooltipProps:null,expandCellTooltipProps:null,expandTooltipDisplayValue:"expand",isGotoShown:!1,gotoRow:"",gotoRowError:"",gotoValueError:"",gotoValueSelectedColumnName:r.columns[0].name,gotoValueSelectedFilter:_.eq,gotoValue:"",columnHeaderGroups:A!=null?A:r.initialColumnHeaderGroups}}static makeQuickFilter(e,t,n){try{return I.makeQuickFilter(e,t,n)}catch(s){oe.error("Error creating quick filter",s)}return null}componentDidMount(){const{partitionColumn:e,model:t}=this.props,n=e!=null?e:t.columns.find(s=>s.isPartitionColumn);t.isFilterRequired&&t.isValuesTableAvailable&&n!=null?this.loadPartitionsTable(n):this.initState(),this.startListening(t)}componentDidUpdate(e){var d;const{inputFilters:t,isSelectingColumn:n,settings:s,model:o,customFilters:i,sorts:r}=this.props;o!==e.model&&(this.stopListening(e.model),this.startListening(o));const l=t!==e.inputFilters?t.filter(u=>!e.inputFilters.includes(u)):[];if(l.length>0){const{advancedSettings:u}=this.props,h=(d=u.get(ns.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS))!=null?d:!1;h&&(this.clearGridInputField(),this.clearCrossColumSearch()),this.startLoading("Filtering...",!0),this.applyInputFilters(l,h)}n!==e.isSelectingColumn&&this.resetColumnSelection(),s!==e.settings&&this.updateFormatterSettings(s),i!==e.customFilters&&this.startLoading("Filtering...",!0),r!==e.sorts&&this.updateSorts(r);const{loadingScrimStartTime:a,loadingScrimFinishTime:c}=this;a!=null&&c!=null&&window.requestAnimationFrame(()=>{const u=Date.now(),h=u-a,g=c-a,p=Math.min(h/g,1);c<u&&(this.loadingScrimStartTime=void 0,this.loadingScrimFinishTime=void 0),this.setState(f=>f.loadingScrimProgress==null?(oe.debug2("Ignoring scrim update because loading cancelled."),null):{loadingScrimProgress:p})}),this.sendStateChange()}componentWillUnmount(){const{model:e}=this.props;this.stopListening(e),this.pending.cancel(),this.updateSearchFilter.cancel(),this.loadingTimer&&clearTimeout(this.loadingTimer),this.handleDownloadProgressUpdate.cancel(),this.animationFrame!==void 0&&cancelAnimationFrame(this.animationFrame)}getValueForCell(e,t,n=!1){const{model:s}=this.props,o=this.getModelColumn(e),i=this.getModelRow(t);if(n&&o!=null&&i!=null){const r=s.valueForCell(o,i);if(I.isDateType(s.columns[o].type)){const{formatter:l}=s;return E.i18n.DateTimeFormat.format(xg,r,E.i18n.TimeZone.getTimeZone(l.timeZone))}return r}return n?null:o!=null&&i!=null?s.textForCell(o,i):""}getModelColumn(e){const{metrics:t}=this.state;M(t);const{modelColumns:n}=t;return n==null?null:e!=null?n.get(e):null}getModelRow(e){const{metrics:t}=this.state;M(t);const{modelRows:n}=t;return n==null?null:e!=null?n.get(e):null}getTheme(){var n;const{model:e,theme:t}=this.props;return this.getCachedTheme(t,(n=ke(e)&&e.isEditable)!=null?n:!1,e.floatingTopRowCount+e.floatingBottomRowCount)}getVisibleColumn(e){const{movedColumns:t}=this.state;return H.getVisibleIndex(e,t)}applyInputFilters(e,t=!1){const{model:n}=this.props,{advancedFilters:s,quickFilters:o}=this.state,i=t?new Map:new Map(s),r=t?new Map:new Map(o);let l=t&&s.size>0;e.forEach(({name:a,type:c,value:d})=>{const u=n.columns.findIndex(({name:h,type:g})=>h===a&&g===c);u>=0?(l=i.delete(u)||l,l=this.applyQuickFilter(u,d,r)||l):oe.error("Unable to find column for inputFilter",a,c,d)}),l&&this.setState({quickFilters:r,advancedFilters:i})}applyQuickFilter(e,t,n){const{model:s}=this.props,{formatter:o}=s,i=s.columns[e];if(t!=null&&`${t}`.trim().length>0){const r=n.get(e);if(r!=null){const{text:l}=r;if(l===t)return oe.debug2("Ignoring change to existing filter"),!1}return n.set(e,{text:t,filter:Nn.makeQuickFilter(i,t,o.timeZone)}),!0}return n.delete(e)}setAdvancedFilterMap(e){this.setState({advancedFilters:e})}setAdvancedFilter(e,t,n){oe.debug("Setting advanced filter",e,t),this.startLoading("Filtering...",!0),this.setState(({advancedFilters:s})=>{const o=new Map(s);return t==null?o.delete(e):o.set(e,{filter:t,options:n}),{advancedFilters:o}})}setQuickFilter(e,t,n){oe.debug("Setting quick filter",e,t,n),this.startLoading("Filtering...",!0),this.setState(({quickFilters:s})=>{const o=new Map(s);return o.set(e,{filter:t,text:n}),{quickFilters:o}})}setFilterMap(e){var o;oe.debug("setFilterMap",e);const{advancedSettings:t}=this.props;((o=t.get(ns.LINK_CHANGE_CLEARS_ALL_FILTERS))!=null?o:!1)&&this.clearAllFilters();const{model:s}=this.props;e.forEach(({columnType:i,filterList:r},l)=>{const a=s.columns.find(u=>u.name===l&&u.type===i);if(a==null)return;const c=s.getColumnIndexByName(a.name);M(c);const d=J.combineFiltersFromList(i,r);if(d.length===0)this.removeQuickFilter(c);else{const{formatter:u}=s;this.setQuickFilter(c,Nn.makeQuickFilter(a,d,u.timeZone),`${d}`)}})}removeColumnFilter(e){this.startLoading("Filtering...",!0),this.setState(({advancedFilters:t,quickFilters:n})=>{const s=t?new Map(t):new Map,o=n?new Map(n):new Map;return o.delete(e),s.delete(e),{quickFilters:o,advancedFilters:s}})}removeQuickFilter(e){this.startLoading("Clearing Filter...",!0),this.setState(({quickFilters:t})=>{const n=new Map(t);return n.delete(e),{quickFilters:n}})}clearAllFilters(){oe.debug("Clearing all filters");const{advancedFilters:e,quickFilters:t,searchFilter:n}=this.state;t.size===0&&e.size===0&&n===null||(this.clearGridInputField(),this.startLoading("Clearing Filters...",!0),this.setState({quickFilters:new Map,advancedFilters:new Map,searchValue:"",searchFilter:void 0}))}clearCrossColumSearch(){oe.debug("Clearing cross-column search"),this.setState({searchValue:"",searchFilter:void 0})}clearGridInputField(){this.filterInputRef.current!=null&&this.filterInputRef.current.setValue("")}rebuildFilters(){oe.debug("Rebuilding filters");const{model:e}=this.props,{advancedFilters:t,quickFilters:n}=this.state,{columns:s,formatter:o}=e,i=new Map,r=new Map;t.forEach((l,a)=>{const{options:c}=l,d=s[a],u=I.makeAdvancedFilter(d,c,o.timeZone);i.set(a,{options:c,filter:u})}),n.forEach((l,a)=>{const{text:c}=l,d=s[a];r.set(a,{text:c,filter:Nn.makeQuickFilter(d,c,o.timeZone)})}),this.startLoading("Rebuilding filters...",!0),this.setState({quickFilters:r,advancedFilters:i})}setFilters({quickFilters:e,advancedFilters:t}){this.setState({quickFilters:e,advancedFilters:t})}updateFormatterSettings(e,t=!0){var h,g,p;const n=Jn.getColumnFormats(e),s=Jn.getDateTimeFormatterOptions(e),o=(h=e==null?void 0:e.defaultDecimalFormatOptions)!=null?h:{},i=(g=e==null?void 0:e.defaultIntegerFormatOptions)!=null?g:{},r=(p=e==null?void 0:e.truncateNumbersWithPound)!=null?p:!1,l=!rt(this.globalColumnFormats,n),a=!rt(this.dateTimeFormatterOptions,s),c=!rt(this.decimalFormatOptions,e==null?void 0:e.defaultDecimalFormatOptions),d=!rt(this.integerFormatOptions,i),u=this.truncateNumbersWithPound!==r;(l||a||c||d||u)&&(this.globalColumnFormats=n,this.dateTimeFormatterOptions=s,this.decimalFormatOptions=o,this.integerFormatOptions=i,this.truncateNumbersWithPound=r,this.updateFormatter({},t),a&&t&&this.rebuildFilters())}updateFormatter(e,t=!0){var r;const{customColumnFormatMap:n}=this.state,s={customColumnFormatMap:n,...e},o=[...(r=this.globalColumnFormats)!=null?r:[],...s.customColumnFormatMap.values()],i=new zt(o,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions,this.truncateNumbersWithPound);oe.debug("updateFormatter",this.globalColumnFormats,o),this.setState({...s,formatter:i},()=>{t&&this.grid&&this.grid.forceUpdate()})}initFormatter(){const{settings:e}=this.props;this.updateFormatterSettings(e)}initState(){const{applyInputFiltersOnInit:e,inputFilters:t,sorts:n,model:s,reverseType:o,customColumns:i,searchValue:r,selectedSearchColumns:l,invertSearchColumns:a}=this.props,c=l!=null?l:[],d=Io.createSearchFilter(r,c,s.columns,a);if(e){const u=t.filter(h=>h.value!=null);this.applyInputFilters(u)}this.setState({sorts:n,reverseType:o,customColumns:i,isReady:!0,searchFilter:d}),this.initFormatter()}async loadPartitionsTable(e){const{model:t}=this.props;this.setState({isSelectingPartition:!0});try{const n=await this.pending.add(t.valuesTable(e),r=>r.close()),s=n.columns[0],o=s.sort().desc();n.applySort([o]),n.setViewport(0,0,[s]);const i=await this.pending.add(n.getViewportData());if(i.rows.length>0){const l=i.rows[0].get(s);this.updatePartition(l,e),this.setState({isSelectingPartition:!0})}else oe.info("Table does not have any data, just fetching all"),this.setState({isSelectingPartition:!1}),this.handlePartitionFetchAll();this.setState({partitionTable:n,partitionColumn:e},()=>{this.initState()})}catch(n){this.handleTableLoadError(n)}}updatePartition(e,t){const s=[t.filter().eq(E.FilterValue.ofString(e))];this.setState({partition:e,partitionFilters:s})}copyCell(e,t,n=!1){const{canCopy:s}=this.props;if(s){const o=String(this.getValueForCell(e,t,n));zo(o).catch(i=>oe.error("Unable to copy cell",i))}else oe.error("Attempted to copyCell for user without copy permission.")}copyRanges(e,t=!1,n=!0,s){const{model:o,canCopy:i}=this.props,{metricCalculator:r,movedColumns:l}=this.state,a=r.getUserColumnWidths();if(i){const c={ranges:Q.boundedRanges(e,o.columnCount,o.rowCount),includeHeaders:t,formatValues:n,movedColumns:l,userColumnWidths:a,error:s};this.setState({copyOperation:c})}else oe.error("Attempted copyRanges for user without copy permission.")}startLoading(e,t=!1){var s,o;this.setState({loadingText:e});const n=this.getTheme();if(t&&this.grid&&(this.grid.clearSelectedRanges(),this.grid.setViewState({top:0},!0)),this.loadingScrimStartTime==null){const{minScrimTransitionTime:i,maxScrimTransitionTime:r}=n;M(i),M(r);const l=(o=(s=this.gridWrapper)==null?void 0:s.getBoundingClientRect().height)!=null?o:0,a=Math.max(i,Math.min(l/2,r));this.loadingScrimStartTime=Date.now(),this.loadingScrimFinishTime=this.loadingScrimStartTime+a,this.setState({loadingScrimProgress:0}),this.loadingTimer=setTimeout(()=>{this.setState({loadingSpinnerShown:!0})},Nn.loadingSpinnerDelay)}}stopLoading(){this.loadingScrimStartTime=void 0,this.loadingScrimFinishTime=void 0,this.setState({loadingText:null,loadingScrimProgress:null,loadingSpinnerShown:!1}),this.loadingTimer!=null&&(clearTimeout(this.loadingTimer),this.loadingTimer=void 0)}rollback(){if(this.lastLoadedConfig){oe.debug("loading last loading config",this.lastLoadedConfig);const{advancedFilters:e,aggregationSettings:t,customColumns:n,quickFilters:s,reverseType:o,rollupConfig:i,searchFilter:r,selectDistinctColumns:l,sorts:a}=this.lastLoadedConfig;this.lastLoadedConfig=null,this.setState({advancedFilters:e,aggregationSettings:t,customColumns:n,quickFilters:s,reverseType:o,rollupConfig:i,searchFilter:r,selectDistinctColumns:l,sorts:a})}else oe.debug("remove all sorts, filters, and custom columns"),this.setState({advancedFilters:new Map,aggregationSettings:ma,customColumns:[],quickFilters:new Map,reverseType:I.REVERSE_TYPE.NONE,rollupConfig:void 0,selectDistinctColumns:[],sorts:[]})}canRollback(){return this.lastLoadedConfig!=null||!nl(this.state)}startListening(e){e.addEventListener(ce.EVENT.UPDATED,this.handleUpdate),e.addEventListener(ce.EVENT.REQUEST_FAILED,this.handleRequestFailed),e.addEventListener(ce.EVENT.COLUMNS_CHANGED,this.handleCustomColumnsChanged),e.addEventListener(ce.EVENT.PENDING_DATA_UPDATED,this.handlePendingDataUpdated)}stopListening(e){e.removeEventListener(ce.EVENT.UPDATED,this.handleUpdate),e.removeEventListener(ce.EVENT.REQUEST_FAILED,this.handleRequestFailed),e.removeEventListener(ce.EVENT.COLUMNS_CHANGED,this.handleCustomColumnsChanged),e.removeEventListener(ce.EVENT.PENDING_DATA_UPDATED,this.handlePendingDataUpdated)}focus(){var e;(e=this.grid)==null||e.focus()}focusFilterBar(e){var d,u,h;const{movedColumns:t}=this.state,{model:n}=this.props,{columnCount:s}=n,o=H.getModelIndex(e,t);if(e==null||e<0||s<=e||!n.isFilterable(o)){this.setState({focusedFilterBarColumn:null});return}const{metricCalculator:i,metrics:r}=this.state;M(r);const{left:l,rightVisible:a,lastLeft:c}=r;if(e<l)(d=this.grid)==null||d.setViewState({left:e},!0);else if(a<e){const g=(u=this.grid)==null?void 0:u.getMetricState();M(g);const p=i.getLastLeft(g,e,i.getVisibleWidth(g));(h=this.grid)==null||h.setViewState({left:Math.min(p,c),leftOffset:0},!0)}this.lastFocusedFilterBarColumn=e,this.setState({focusedFilterBarColumn:e,isFilterBarShown:!0})}hideColumnByVisibleIndex(e){var s;const{metricCalculator:t,movedColumns:n}=this.state;t.setColumnWidth(H.getModelIndex(e,n),0),(s=this.grid)==null||s.forceUpdate()}freezeColumnByColumnName(e){const{frozenColumns:t,movedColumns:n}=this.state,{model:s}=this.props;oe.debug2("freezing column",e);const o=t==null?new Set(s.frozenColumns):new Set(t);o.add(e);const i=s.getColumnIndexByName(e);M(i);const r=H.getVisibleIndex(i,n),l=H.moveItem(r,o.size-1,n);this.setState({frozenColumns:[...o],movedColumns:l})}unFreezeColumnByColumnName(e){const{frozenColumns:t,movedColumns:n}=this.state,{model:s}=this.props;oe.debug2("unfreezing column",e);const o=t==null?new Set(s.frozenColumns):new Set(t);o.delete(e);const i=s.getColumnIndexByName(e);M(i);const r=H.getVisibleIndex(i,n),l=H.moveItem(r,o.size+s.frontColumns.length,n);this.setState({frozenColumns:[...o],movedColumns:l})}handleColumnVisibilityChanged(e,t){var o;const{metricCalculator:n,metrics:s}=this.state;M(s),t?e.forEach(i=>{const r=n.initialColumnWidths.get(i),l=O(s.calculatedColumnWidths,i);r!==l?n.setColumnWidth(i,l):n.resetColumnWidth(i)}):e.forEach(i=>{n.setColumnWidth(i,0)}),(o=this.grid)==null||o.forceUpdate()}handleColumnVisibilityReset(){var s,o;const{metricCalculator:e,metrics:t}=this.state,{model:n}=this.props;M(t);for(let i=0;i<t.columnCount;i+=1)e.resetColumnWidth(i);this.handleMovedColumnsChanged(n.initialMovedColumns),this.handleHeaderGroupsChanged(n.initialColumnHeaderGroups),this.setState({frozenColumns:(o=(s=n.layoutHints)==null?void 0:s.frozenColumns)!=null?o:[]})}handleCrossColumnSearch(e,t,n){const{model:s}=this.props;this.updateSearchFilter(e,t,s.columns,n),this.setState({searchValue:e,selectedSearchColumns:t,invertSearchColumns:n})}handleAnimationLoop(){var e,t;(e=this.grid)==null||e.updateCanvasScale(),(t=this.grid)==null||t.updateCanvas(),this.isAnimating&&(this.animationFrame=requestAnimationFrame(this.handleAnimationLoop))}handleAnimationStart(){oe.debug2("handleAnimationStart"),this.isAnimating=!0,this.animationFrame=requestAnimationFrame(this.handleAnimationLoop)}handleAnimationEnd(){oe.debug2("handleAnimationEnd"),this.isAnimating=!1}handlePartitionAppend(e){const{onPartitionAppend:t}=this.props,{partitionColumn:n}=this.state;n!=null&&t(n,e)}handlePartitionChange(e){const{partitionColumn:t}=this.state;t!=null&&this.updatePartition(e,t)}handlePartitionFetchAll(){this.setState({partitionFilters:[],isSelectingPartition:!1})}handlePartitionDone(){this.setState({isSelectingPartition:!1})}handleTableLoadError(e){if(Ge.isCanceled(e))return;oe.error(e);const{onError:t}=this.props;t(e)}showAllColumns(){var s;const{metricCalculator:e}=this.state,n=[...e.getUserColumnWidths().entries()];for(let o=0;o<n.length;o+=1){const[i,r]=n[o];r===0&&e.resetColumnWidth(i)}(s=this.grid)==null||s.forceUpdate()}toggleSort(e,t){oe.info("Toggling sort for column",e);const{model:n}=this.props,{sorts:s}=this.state,o=this.getModelColumn(e);M(o);const i=I.toggleSortForColumn(s,n.columns,o,t);this.updateSorts(i)}updateSorts(e){var t;this.startLoading("Sorting..."),this.setState({sorts:e}),(t=this.grid)==null||t.forceUpdate()}sortColumn(e,t=I.sortDirection.none,n=!1,s=!1){var r;M(e);const{model:o}=this.props,i=I.sortColumn(o.sort,o.columns,e,t,n,s);this.startLoading("Sorting..."),this.setState({sorts:i}),(r=this.grid)==null||r.forceUpdate()}reverse(e){var t;this.startLoading("Reversing..."),this.setState({reverseType:e}),(t=this.grid)==null||t.forceUpdate()}isReversible(){const{model:e}=this.props;return e.isReversible}toggleFilterBar(e=this.lastFocusedFilterBarColumn){var n;let{isFilterBarShown:t}=this.state;if(t=!t,this.setState({isFilterBarShown:t}),t)if(e!=null)this.focusFilterBar(e);else{let s=0;const{model:o}=this.props,{columnCount:i}=o;for(let r=0;r<i;r+=1){const l=this.getModelColumn(r);if(l!=null){const a=o.columns[l];if(a!=null&&I.isTextType(a.type)){s=r;break}}}this.focusFilterBar(s)}else(n=this.grid)==null||n.focus()}isTableSearchAvailable(){var s,o,i;const{model:e,canToggleSearch:t}=this.props,n=(s=e==null?void 0:e.layoutHints)==null?void 0:s.searchDisplayMode;return n===((o=E.SearchDisplayMode)==null?void 0:o.SEARCH_DISPLAY_HIDE)?!1:n===((i=E.SearchDisplayMode)==null?void 0:i.SEARCH_DISPLAY_SHOW)?!0:t}toggleSearchBar(){const{showSearchBar:e}=this.state;if(!this.isTableSearchAvailable())return;const t=!e;this.setState({showSearchBar:t},()=>{var n,s,o;t&&((n=this.crossColumnRef)==null?void 0:n.current)?(s=this.crossColumnRef)==null||s.current.focus():(o=this.grid)==null||o.focus()})}toggleGotoRow(e="",t="",n=""){const{isGotoShown:s}=this.state;if(e||t){this.setState({isGotoShown:!0,gotoRow:e,gotoValue:t,gotoValueSelectedColumnName:n,gotoRowError:"",gotoValueError:""}),this.focusRowInGrid(e);return}this.setState({isGotoShown:!s,gotoRow:"",gotoValue:"",gotoRowError:"",gotoValueError:""})}async commitPending(){var o,i;const{model:e}=this.props;if(!ke(e)||!e.isEditable)throw new Error("Cannot save, table is not editable");const{pendingSavePromise:t}=this.state;if(t!=null)throw new Error("Save already in progress");const n=(o=document==null?void 0:document.activeElement)==null?void 0:o.classList.contains("grid-cell-input-field");if(n!=null&&n){if(document.activeElement!=null&&document.activeElement.classList.contains("error"))throw new Kc("Current input is invalid");(i=this.grid)==null||i.focus()}const s=this.pending.add(e.commitPending()).then(()=>{this.setState({pendingSaveError:null,pendingSavePromise:null})}).catch(r=>{Ge.isCanceled(r)||this.setState({pendingSaveError:r,pendingSavePromise:null})});return this.setState({pendingSavePromise:s}),s}async discardPending(){const{pendingSavePromise:e}=this.state;if(e!=null)throw new Error("Cannot cancel a save in progress");this.setState({pendingSavePromise:null,pendingSaveError:null,pendingDataMap:new Map,pendingDataErrors:new Map})}selectColumn(e){const{onColumnSelected:t}=this.props;t(e)}selectData(e,t){const{model:n}=this.props,{columns:s,groupedColumns:o}=n,i={};for(let l=0;l<s.length;l+=1){const a=s[l],{name:c,type:d}=a,u=n.valueForCell(l,t),h=n.textForCell(l,t),g=this.getVisibleColumn(l),p=Ae(n)&&n.isRowExpandable(t),f=o.find(C=>C.name===c)!=null;i[c]={value:u,text:h,type:d,isGrouped:f,isExpandable:p,visibleIndex:g}}const{onDataSelected:r}=this.props;r(t,i)}handleAdvancedFilterChange(e,t,n){const{model:s}=this.props,o=s.getColumnIndexByName(e.name);M(o),this.setAdvancedFilter(o,t,n)}handleAdvancedFilterSortChange(e,t,n=!1){var a;const{model:s}=this.props,o=s.getColumnIndexByName(e.name);M(o);const i=I.getSortForColumn(s.sort,o);let r=null;(i==null||i.direction!==t)&&(t===I.sortDirection.descending?r=e.sort().desc():r=e.sort().asc());const l=I.setSortForColumn(s.sort,o,r,n);oe.info("Setting table sorts",l),this.startLoading("Sorting..."),this.setState({sorts:l}),(a=this.grid)==null||a.forceUpdate()}handleAdvancedFilterDone(){var e;(e=this.grid)==null||e.focus()}handleAdvancedMenuOpened(e){this.setState({shownAdvancedFilter:e})}handleGotoRowOpened(){this.setState({isGotoShown:!0})}handleGotoRowClosed(){this.setState({isGotoShown:!1})}handleAdvancedMenuClosed(e){var s,o;const{focusedFilterBarColumn:t,isFilterBarShown:n}=this.state;n&&t===e&&((s=this.filterInputRef)==null?void 0:s.current)!==null?((o=this.filterInputRef)==null||o.current.focus(),this.setState({shownAdvancedFilter:null})):this.setState({focusedFilterBarColumn:null,shownAdvancedFilter:null})}handleCancel(){this.rollback()}handleChartChange(){}handleChartCreate(e){const{model:t,onCreateChart:n}=this.props;n(e,t)}handleGridError(e){oe.warn("Grid Error",e),this.setState({toastMessage:m("div",{className:"error-message",children:`${e}`})})}handleFilterBarChange(e){this.startLoading("Filtering...",!0),this.setState(({focusedFilterBarColumn:t,quickFilters:n})=>{const s=new Map(n);if(t!=null){const o=this.getModelColumn(t);M(o),this.applyQuickFilter(o,e,s)}return{quickFilters:s}})}handleFilterBarDone(e=!0,t=!0){var n;e&&((n=this.grid)==null||n.focus()),t&&this.setState({focusedFilterBarColumn:null})}handleFilterBarTab(e){const{focusedFilterBarColumn:t}=this.state;M(t),e?this.focusFilterBar(t-1):this.focusFilterBar(t+1)}handleFormatSelection(e,t){const{model:n}=this.props,s=n.columns[e],{customColumnFormatMap:o}=this.state,i=new Map(o);if(t!=null){const r=I.getNormalizedType(s.type);M(r);const l=zt.makeColumnFormattingRule(r,s.name,t);i.set(s.name,l)}else i.delete(s.name);this.updateFormatter({customColumnFormatMap:i})}handleMenu(e){e.stopPropagation(),this.setState({isMenuShown:!0})}handleMenuClose(){this.setState({isMenuShown:!1,openOptions:[]})}handleMenuBack(){this.setState(({openOptions:e})=>{const t=[...e];return t.pop(),{openOptions:t}})}handleMenuSelect(e){this.setState(({openOptions:t})=>({openOptions:[...t,e]}))}handleRequestFailed(e){const t=e;if(oe.error("request failed:",t.detail),this.stopLoading(),this.canRollback())this.startLoading("Rolling back changes...",!0),this.rollback();else{oe.error("Table failed and unable to rollback");const{onError:n}=this.props;n(new Error(`Error displaying table: ${t.detail}`))}}handleUpdate(){var d;this.stopLoading(),oe.debug2("Received model update");const{advancedFilters:e,aggregationSettings:t,customColumns:n,quickFilters:s,reverseType:o,rollupConfig:i,searchFilter:r,selectDistinctColumns:l,sorts:a}=this.state,c={advancedFilters:e,aggregationSettings:t,customColumns:n,quickFilters:s,reverseType:o,rollupConfig:i,searchFilter:r,selectDistinctColumns:l,sorts:a};nl(c)?this.lastLoadedConfig=null:this.lastLoadedConfig=c,(d=this.grid)==null||d.forceUpdate()}handleViewChanged(e){var o,i;const{model:t}=this.props,{selectionEndRow:n=0}=(i=(o=this.grid)==null?void 0:o.state)!=null?i:{};let s=0;if(ke(t)&&t.isEditable){M(e);const{bottomViewport:r}=e,l=t.rowCount-t.floatingBottomRowCount;n===l-1?s=t.pendingRowCount+1:n===l-2?s=t.pendingRowCount:s=Math.max(0,r-(t.rowCount-t.pendingRowCount)-t.floatingTopRowCount-t.floatingBottomRowCount-1)}this.setState({metrics:e,pendingRowCount:s})}handleSelectionChanged(e){M(e);const{onSelectionChanged:t}=this.props,{copyOperation:n}=this.state;this.setState({selectedRanges:e}),n!=null&&this.setState({copyOperation:null}),t(e)}handleMovedColumnsChanged(e,t){this.setState({movedColumns:e},t)}handleHeaderGroupsChanged(e){const{model:t}=this.props;this.setState({columnHeaderGroups:J.parseColumnHeaderGroups(t,e).groups},()=>{var n;return(n=this.grid)==null?void 0:n.forceUpdate()})}handleTooltipRef(e){e!=null&&e.startTimer(),this.tooltip=e}handleConditionalFormatsChange(e){oe.debug("Updated conditional formats",e),this.setState({conditionalFormats:e})}handleConditionalFormatCreate(){oe.debug("Create new conditional format");const{openOptions:e,conditionalFormats:t}=this.state;this.setState({openOptions:[...e,{type:Se.CONDITIONAL_FORMATTING_EDIT,title:"Create Formatting Rule"}],conditionalFormatEditIndex:t.length,conditionalFormatPreview:void 0})}handleConditionalFormatEdit(e){oe.debug("Edit conditional format",e);const{openOptions:t,conditionalFormats:n}=this.state;this.setState({openOptions:[...t,{type:Se.CONDITIONAL_FORMATTING_EDIT,title:"Edit Formatting Rule"}],conditionalFormatEditIndex:e,conditionalFormatPreview:{...n[e]}})}handleConditionalFormatEditorSave(e){oe.debug("Save conditional format changes",e),this.setState(t=>{if(t.conditionalFormatEditIndex===null)return oe.debug("Invalid format index"),null;const n=[...t.conditionalFormats];return n[t.conditionalFormatEditIndex]=e,{conditionalFormats:n}},()=>{this.handleMenuBack()})}handleConditionalFormatEditorCancel(){this.handleMenuBack(),this.setState({conditionalFormatEditIndex:null})}handleUpdateCustomColumns(e){oe.info("handleUpdateCustomColumns:",e);const{model:t}=this.props,{movedColumns:n,sorts:s,quickFilters:o,advancedFilters:i,selectDistinctColumns:r}=this.state,{columns:l}=t,a=t.customColumns.map(d=>`${d}`),c=J.getRemovedCustomColumnNames(a,e);if(c.length>0){const d=J.removeSortsInColumns(s,c),u=J.removeFiltersInColumns(l,o,c),h=J.removeFiltersInColumns(l,i,c),g=J.removeColumnFromMovedColumns(l,n,c),p=J.removeColumnsFromSelectDistinctColumns(r,c);d.length!==s.length&&(oe.debug("removing sorts from removed custom columns..."),this.setState({sorts:d})),(u.size!==o.size||h.size!==i.size)&&(oe.debug("removing filters from removed custom columns..."),this.setState({quickFilters:u,advancedFilters:h})),rt(n,g)||(oe.debug("change moved columns for removed custom columns",g),this.setState({movedColumns:g})),rt(r,p)||(oe.debug("change selectDistinct columns for removed custom columns",g),this.setState({selectDistinctColumns:p}))}this.setState({customColumns:e}),e.length>0&&this.startLoading("Applying custom columns...")}handleCustomColumnsChanged(){var t;oe.debug("custom columns changed");const{isReady:e}=this.state;e?(this.stopLoading(),(t=this.grid)==null||t.forceUpdate()):this.initState()}handlePendingCommitClicked(){return this.commitPending()}handlePendingDiscardClicked(){return this.discardPending()}handlePendingDataUpdated(){var s;oe.debug("pending data updated");const{model:e}=this.props,{pendingDataMap:t,pendingDataErrors:n}=e;this.setState({pendingDataMap:t,pendingDataErrors:n,pendingSaveError:null}),(s=this.grid)==null||s.forceUpdate()}handleAggregationsChange(e){oe.debug("handleAggregationsChange",e),this.startLoading(`Aggregating ${e.aggregations.map(t=>t.operation).join(", ")}...`),this.setState({aggregationSettings:e})}handleAggregationChange(e){oe.debug("handleAggregationChange",e),this.startLoading(`Aggregating ${e.operation}...`),this.setState(({aggregationSettings:t})=>({selectedAggregation:e,aggregationSettings:{...t,aggregations:t.aggregations.map(n=>n.operation===e.operation?e:n)}}))}handleAggregationEdit(e){oe.debug("handleAggregationEdit",e);const{openOptions:t}=this.state;this.setState({openOptions:[...t,{type:Se.AGGREGATION_EDIT,title:`Edit Columns to ${e.operation}`}],selectedAggregation:e})}handleRollupChange(e){var t,n;oe.info("Rollup change",e),this.resetGridViewState(),this.showAllColumns(),this.clearAllFilters(),this.startLoading(`Grouping by columns ${(n=(t=e==null?void 0:e.columns)==null?void 0:t.join(", "))!=null?n:""}...`),this.setState({rollupConfig:e,movedColumns:[],sorts:[],reverseType:I.REVERSE_TYPE.NONE,selectDistinctColumns:[]})}handleSelectDistinctChanged(e){oe.debug("SelectDistinct change",e),this.resetGridViewState(),this.showAllColumns(),this.clearAllFilters(),this.startLoading(`Selecting distinct values in ${e.length>0?e.join(", "):""}...`),this.setState({selectDistinctColumns:e,movedColumns:[],sorts:[],reverseType:I.REVERSE_TYPE.NONE})}handleDownloadTableStart(){const{canDownloadCsv:e}=this.props;e?this.setState({isTableDownloading:!0,tableDownloadProgress:0,tableDownloadEstimatedTime:null,tableDownloadStatus:gt.DOWNLOAD_STATUS.INITIATING}):oe.error("Attempted to handleDownloadTableStart for user without download CSV permission.")}handleDownloadTable(e,t,n,s,o,i,r){const{canDownloadCsv:l}=this.props;l?(oe.info("start table downloading",e,t,n,s,o,i,r),this.setState(()=>(this.tableSaver&&this.tableSaver.startDownload(e,t,n,s,o,i,r),{tableDownloadStatus:gt.DOWNLOAD_STATUS.DOWNLOADING}))):oe.error("Attempted to handleDownloadTable for user without download CSV permission.")}async seekRow(e,t=!1){var d;const{gotoValueSelectedColumnName:n,gotoValueSelectedFilter:s}=this.state,{model:o}=this.props;if(!o.isSeekRowAvailable||e==="")return;const i=o.getColumnIndexByName(n);if(i===void 0)return;const r=o.columns[i];let l;this.grid&&({selectionEndRow:l}=this.grid.state),l==null&&(l=0);const a=s===_.contains,c=s===_.eq||s===_.eqIgnoreCase;try{const u=I.getNormalizedType(r.type);let h;switch(u){case I.dataType.STRING:{h=await o.seekRow(t===!0?l-1:l+1,r,E.ValueType.STRING,e,c,a,t!=null?t:!1);break}case I.dataType.DATETIME:{const{formatter:g}=o,[p]=cn.parseDateRange(e,g.timeZone);h=await o.seekRow(t===!0?l-1:l+1,r,E.ValueType.DATETIME,p,void 0,void 0,t!=null?t:!1);break}case I.dataType.DECIMAL:case I.dataType.INT:{if(!I.isBigDecimalType(r.type)&&!I.isBigIntegerType(r.type)){const g=parseInt(e,10);h=await o.seekRow(l,r,E.ValueType.NUMBER,g,void 0,void 0,t!=null?t:!1)}else h=await o.seekRow(l,r,E.ValueType.STRING,e,void 0,void 0,t!=null?t:!1);break}default:h=await o.seekRow(l,r,E.ValueType.STRING,e,void 0,void 0,t!=null?t:!1)}(d=this.grid)==null||d.setFocusRow(h),this.setState({gotoValueError:""})}catch{this.setState({gotoValueError:"invalid input"})}}handleCancelDownloadTable(){var e;(e=this.tableSaver)==null||e.cancelDownload(),this.setState({isTableDownloading:!1})}handleDownloadCompleted(){this.setState({isTableDownloading:!1,tableDownloadProgress:100,tableDownloadStatus:gt.DOWNLOAD_STATUS.FINISHED})}handleDownloadCanceled(){this.setState({isTableDownloading:!1,tableDownloadProgress:0,tableDownloadStatus:gt.DOWNLOAD_STATUS.CANCELED})}deleteRanges(e){const{model:t}=this.props;this.pending.add(t.delete(e)).catch(n=>{Ge.isCanceled(n)||oe.error("Unable to delete ranges",e,n)})}resetColumnSelection(){if(this.grid==null)return;const{isSelectingColumn:e}=this.props;if(e){const{columnAllowedCursor:t}=this.props;this.grid.setState({cursor:t})}else this.grid.setState({cursor:null}),this.setState({hoverSelectColumn:null})}resetGridViewState(e=!0){!this.grid||(this.grid.clearSelectedRanges(),this.grid.setViewState({left:0,top:0,topOffset:0,leftOffset:0},e))}sendStateChange(){if(!this.grid)return;const{state:e}=this,{state:t}=this.grid,{onStateChange:n}=this.props;n(e,t)}handleOverflowClose(){this.setState({showOverflowModal:!1})}getColumnBoundingRect(){var h;const{metrics:e,shownColumnTooltip:t}=this.state;M(e),M(t);const n=(h=this.gridWrapper)==null?void 0:h.getBoundingClientRect(),s=20;M(n);const{columnHeaderHeight:o,allColumnXs:i,allColumnWidths:r,width:l,columnHeaderMaxDepth:a}=e,c=i.get(t),d=r.get(t);M(c),M(d);const u=n.left+Be(c+d/2,s,l-s);return{top:n.top+(a-1)*o,left:n.left+Be(c+d/2,s,l-s),bottom:n.top+a*o,right:n.left+Be(c+d/2,s,l-s)+1,width:1,height:o,x:u,y:n.top,toJSON:()=>{throw new Error("not implemented")}}}handleGotoRowSelectedRowNumberSubmit(){const{gotoRow:e}=this.state;this.focusRowInGrid(e)}focusRowInGrid(e){var o,i,r;const{model:t}=this.props,{rowCount:n}=t;if(this.setState({gotoRow:e}),e===""){this.setState({gotoRowError:"",gotoValueError:""});return}const s=parseInt(e,10);s>n||s<-n?this.setState({gotoRowError:"Invalid row index"}):s===0?(this.setState({gotoRowError:"",gotoValueError:""}),(o=this.grid)==null||o.setFocusRow(0)):s<0?(this.setState({gotoRowError:"",gotoValueError:""}),(i=this.grid)==null||i.setFocusRow(s+n)):((r=this.grid)==null||r.setFocusRow(s-1),this.setState({gotoRowError:"",gotoValueError:""}))}handleGotoRowSelectedRowNumberChanged(e){const t=e.target.value;this.focusRowInGrid(t)}getColumnTooltip(e,t,n){const{columnHeaderHeight:s,columnHeaderMaxDepth:o,allColumnXs:i,allColumnWidths:r,width:l}=t,a=i.get(e),c=r.get(e);if(a==null||c==null)return null;const d=Math.max(0,a);let u=c;a+c>l?u=l-a:a<0&&(u=c-Math.abs(a));const h={position:"absolute",top:(o-1)*s,left:d,width:u,height:s,pointerEvents:"none"},g={clientWidth:1,clientHeight:s,getBoundingClientRect:this.getColumnBoundingRect},p={placement:"bottom",modifiers:{flip:{behavior:["bottom","top"]}}},f=this.getModelColumn(e);if(f==null)return null;const C=n.columns[f];return C==null?null:m("div",{style:h,children:m(Rt,{timeout:400,interactive:!0,options:p,ref:this.handleTooltipRef,referenceObject:g,onExited:()=>{this.setState({shownColumnTooltip:null})},children:m(Ol,{model:n,column:C,onStatistics:()=>{var w;(w=this.tooltip)==null||w.update()}})},C.name)})}handleGotoValueSelectedColumnNameChanged(e){this.setState({gotoValueSelectedColumnName:e,gotoValueError:""})}handleGotoValueSelectedFilterChanged(e){this.setState({gotoValueSelectedFilter:e,gotoValueError:""})}handleGotoValueSubmitted(e){const{gotoValue:t}=this.state;this.seekRow(t,e)}render(){var wo,So,bo,We,ls,ar,cr,dr,ur;const{children:e,customFilters:t,getDownloadWorker:n,isSelectingColumn:s,isStuckToBottom:o,isStuckToRight:i,model:r,name:l,onlyFetchVisibleColumns:a,alwaysFetchColumns:c,advancedSettings:d,onAdvancedSettingsChange:u,canDownloadCsv:h,onCreateChart:g}=this.props,{metricCalculator:p,metrics:f,isFilterBarShown:C,isSelectingPartition:w,isMenuShown:S,isReady:T,copyOperation:R,focusedFilterBarColumn:b,loadingText:v,loadingScrimProgress:D,loadingSpinnerShown:A,keyHandlers:N,mouseHandlers:L,shownColumnTooltip:k,hoverAdvancedFilter:x,shownAdvancedFilter:W,hoverSelectColumn:V,quickFilters:K,advancedFilters:Z,partition:$,partitionFilters:P,partitionTable:G,partitionColumn:X,searchFilter:j,selectDistinctColumns:de,movedColumns:me,movedRows:Ce,formatter:ye,conditionalFormats:fe,conditionalFormatPreview:Je,conditionalFormatEditIndex:Xe,sorts:$e,reverseType:Ot,customColumns:Ct,selectedRanges:hn,isTableDownloading:xt,tableDownloadStatus:De,tableDownloadProgress:ge,tableDownloadEstimatedTime:Ke,showSearchBar:ze,searchValue:lt,selectedSearchColumns:wt,invertSearchColumns:mn,aggregationSettings:kt,selectedAggregation:eo,rollupConfig:Xt,openOptions:St,pendingSavePromise:gn,pendingSaveError:os,pendingRowCount:Ds,pendingDataErrors:is,pendingDataMap:rs,toastMessage:to,frozenColumns:no,columnHeaderGroups:pn,showOverflowModal:Hn,overflowText:ni,overflowButtonTooltipProps:so,expandCellTooltipProps:Is,isGotoShown:Ns,gotoRow:oo,gotoRowError:io,gotoValueError:si,gotoValueSelectedColumnName:oi,gotoValue:ii}=this.state;if(!T)return null;const Vn=this.getTheme(),ri=this.getCachedFilter(t,K,Z,P,j),ro=p.getUserColumnWidths(),lo=this.getCachedStateOverride(V,C,s,D,K,Z,$e,Ot,Xt,S),As=f?f.top:0,ao=f?f.bottomViewport:0;let fn=null,Ms=null;a&&(fn=f?f.left:0,Ms=f?f.right:0);const co=f!=null&&f.width>0&&f.height>0,uo=((So=(wo=Xt==null?void 0:Xt.columns)==null?void 0:wo.length)!=null?So:0)>0;let Os=null;const li=f?Math.min(Math.max(Nn.minDebounce,Math.round(f.rowCount/200)),Nn.maxDebounce):Nn.maxDebounce;if(C&&b!=null&&f!=null){const{gridX:xe,gridY:ut,allColumnXs:Cn,allColumnWidths:xs,width:as}=f,Lt=Cn.get(b),at=xs.get(b);if(Lt!=null&&at!=null){const nt=xe+Lt,Kt=ut-((bo=Vn.filterBarHeight)!=null?bo:0),Un=at+1,Bn=((We=Vn.filterBarHeight)!=null?We:0)-1,To={top:Kt,left:nt,minWidth:Math.min(Un,as-nt),height:Bn};let Pt="",cs=!0;const Gn=this.getModelColumn(b);M(Gn);const ds=K.get(Gn),wn=Z.get(Gn);ds!=null&&(Pt=ds.text,cs=ds.filter!=null);const us=K.size!==0||Z.size!==0;Os=m(Dl,{ref:this.filterInputRef,style:To,className:ee({error:!cs,active:Pt!==""||wn!=null,"iris-grid-has-filter":us}),isAdvancedFilterSet:wn!=null,onAdvancedFiltersTriggered:()=>{this.setState({shownAdvancedFilter:b})},onChange:this.handleFilterBarChange,onDone:this.handleFilterBarDone,onTab:this.handleFilterBarTab,onContextMenu:(ls=this.grid)==null?void 0:ls.handleContextMenu,debounceMs:li,value:Pt},b)}}let ho=null;if(v!=null){const xe=y("div",{className:"iris-grid-loading-status",children:[m("div",{className:ee("iris-grid-loading-status-bar",{show:A}),children:v}),y("button",{type:"button",onClick:this.handleCancel,className:ee("iris-grid-btn-cancel",{show:A}),children:[m(te,{icon:qs,transform:"down-1"}),"Cancel"]})]}),ut=f?f.gridY:0;ho=m("div",{className:"iris-grid-loading",style:{top:ut},children:xe})}let mo=null;k!=null&&f&&(mo=this.getColumnTooltip(k,f,r),(ar=this.tooltip)==null||ar.update());const go=[];if(f&&C){const{gridX:xe,gridY:ut,visibleColumns:Cn,allColumnXs:xs,allColumnWidths:as}=f,{filterBarHeight:Lt}=Vn;for(let at=0;at<Cn.length;at+=1){const nt=Cn[at],Kt=xs.get(nt),Un=as.get(nt),Bn=this.getModelColumn(nt);if(Bn!=null&&r.isFilterable(Bn)&&Kt!=null&&Un!=null&&Un>0){const Pt=xe+Kt+Un-24,cs=ut-(Lt!=null?Lt:0)+2,Gn={position:"absolute",top:cs,left:Pt},wn=Z.get(Bn)!=null,us=nt===x||nt===b||wn,ci=m("div",{className:ee("advanced-filter-button-container",{hidden:!us}),style:Gn,children:us&&m(z,{kind:"ghost",className:ee("btn-link-icon advanced-filter-button",{"filter-set":wn}),onClick:()=>{this.setState({shownAdvancedFilter:nt})},onContextMenu:fa=>{var hr;(hr=this.grid)==null||hr.handleContextMenu(fa)},onMouseEnter:()=>{this.setState({hoverAdvancedFilter:nt})},onMouseLeave:()=>{this.setState({hoverAdvancedFilter:null})},children:y("div",{className:"fa-layers",children:[m(te,{icon:ki,className:"filter-solid"}),m(te,{icon:Oo,className:"filter-light"})]})})},nt);go.push(ci)}}}const po=[];if(f){const{gridX:xe,visibleColumns:ut,allColumnXs:Cn,allColumnWidths:xs,columnHeaderHeight:as}=f;for(let Lt=0;Lt<ut.length;Lt+=1){const at=ut[Lt],nt=Cn.get(at),Kt=xs.get(at);if(nt!=null&&Kt!=null&&Kt>0){const Un=xe+nt,Bn=xe+nt+Kt-20,To=C?{position:"absolute",top:as,left:Bn,width:20,height:Vn.filterBarHeight}:{position:"absolute",top:0,left:Un,width:Kt,height:as},Pt=this.getModelColumn(at);if(Pt!=null){const cs=r.columns[Pt],Gn=Z.get(Pt),{options:ds}=Gn||{},wn=I.getSortForColumn(r.sort,Pt),us=wn?wn.direction:null,ci=m("div",{className:"advanced-filter-menu-container",style:To,children:m(dl,{className:"advanced-filter-menu-popper",onEntered:this.getAdvancedMenuOpenedHandler(at),onExited:()=>{this.handleAdvancedMenuClosed(at)},isShown:W===at,interactive:!0,closeOnBlur:!0,options:{positionFixed:!0},children:this.getCachedAdvancedFilterMenuActions(r,cs,ds,us,ye)})},at);po.push(ci)}}}}const fo=this.getCachedOptionItems(g!==void 0&&r.isChartBuilderAvailable,r.isCustomColumnsAvailable,r.isFormatColumnsAvailable,r.isRollupAvailable,r.isTotalsAvailable,r.isSelectDistinctAvailable,r.isExportAvailable,this.toggleFilterBarAction,this.toggleSearchBarAction,this.toggleGotoRowAction,C,ze,h,this.isTableSearchAvailable(),Ns,d.size>0),Co=this.getCachedHiddenColumns(p,ro),ai=St.map(xe=>{switch(xe.type){case Se.CHART_BUILDER:return m(Ll,{model:r,onChange:this.handleChartChange,onSubmit:this.handleChartCreate},Se.CHART_BUILDER);case Se.VISIBILITY_ORDERING_BUILDER:return m(tr,{model:r,movedColumns:me,hiddenColumns:Co,columnHeaderGroups:pn,onColumnVisibilityChanged:this.handleColumnVisibilityChanged,onReset:this.handleColumnVisibilityReset,onMovedColumnsChanged:this.handleMovedColumnsChanged,onColumnHeaderGroupChanged:this.handleHeaderGroupsChanged},Se.VISIBILITY_ORDERING_BUILDER);case Se.CONDITIONAL_FORMATTING:return m(Gh,{rules:fe,onChange:this.handleConditionalFormatsChange,onCreate:this.handleConditionalFormatCreate,onSelect:this.handleConditionalFormatEdit});case Se.CONDITIONAL_FORMATTING_EDIT:return M(r.columns),M(this.handleConditionalFormatEditorUpdate),m(pm,{columns:r.columns,rule:Je,onUpdate:this.handleConditionalFormatEditorUpdate,onSave:this.handleConditionalFormatEditorSave,onCancel:this.handleConditionalFormatEditorCancel});case Se.CUSTOM_COLUMN_BUILDER:return m(_l,{model:r,customColumns:Ct,onSave:this.handleUpdateCustomColumns,onCancel:this.handleMenuBack},Se.CUSTOM_COLUMN_BUILDER);case Se.ROLLUP_ROWS:return m(er,{model:r,onChange:this.handleRollupChange,config:Xt},Se.ROLLUP_ROWS);case Se.AGGREGATIONS:return m(Qu,{settings:kt,isRollup:uo,onChange:this.handleAggregationsChange,onEdit:this.handleAggregationEdit});case Se.AGGREGATION_EDIT:return eo&&m(Zu,{aggregation:eo,columns:r.originalColumns,onChange:this.handleAggregationChange});case Se.TABLE_EXPORTER:return m(gt,{model:r,name:l,userColumnWidths:ro,movedColumns:me,isDownloading:xt,tableDownloadStatus:De,tableDownloadProgress:ge,tableDownloadEstimatedTime:Ke!=null?Ke:void 0,onDownload:this.handleDownloadTable,onDownloadStart:this.handleDownloadTableStart,onCancel:this.handleCancelDownloadTable,selectedRanges:hn},Se.TABLE_EXPORTER);case Se.SELECT_DISTINCT:return m(ql,{model:r,selectDistinctColumns:de,onChange:this.handleSelectDistinctChanged});case Se.ADVANCED_SETTINGS:return m(nr,{items:d,onChange:u});default:throw Error(`Unexpected option type ${xe.type}`)}});return y("div",{className:"iris-grid",role:"presentation",children:[y("div",{className:"iris-grid-column",children:[e!=null&&m("div",{className:"iris-grid-bar",children:e}),m($t,{in:w,timeout:Ue.transitionSlowMs,classNames:"iris-grid-bar-horizontal",onEnter:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExit:this.handleAnimationStart,onExited:this.handleAnimationEnd,mountOnEnter:!0,unmountOnExit:!0,children:m("div",{className:"iris-grid-partition-selector-wrapper iris-grid-bar iris-grid-bar-primary",children:G&&X&&$!=null&&m(zl,{table:G,getFormattedString:(xe,ut,Cn)=>r.displayString(xe,ut,Cn),columnName:X.name,partition:$,onChange:this.handlePartitionChange,onFetchAll:this.handlePartitionFetchAll,onAppend:this.handlePartitionAppend,onDone:this.handlePartitionDone})})}),m($t,{in:ze,timeout:Ue.transitionSlowMs,classNames:"iris-grid-bar-horizontal",onEnter:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExit:this.handleAnimationStart,onExited:this.handleAnimationEnd,mountOnEnter:!0,unmountOnExit:!0,children:m("div",{className:"iris-grid-bar",children:m(Io,{value:lt,selectedColumns:wt,invertSelection:mn,onChange:this.handleCrossColumnSearch,columns:r.columns,ref:this.crossColumnRef})})}),y("div",{className:"grid-wrapper",ref:xe=>{this.gridWrapper=xe},children:[m(Rs,{ref:xe=>{this.grid=xe},isStickyBottom:!ke(r)||!r.isEditable,isStuckToBottom:o,isStuckToRight:i,metricCalculator:p,model:r,keyHandlers:N,mouseHandlers:L,movedColumns:me,movedRows:Ce,onError:this.handleGridError,onViewChanged:this.handleViewChanged,onSelectionChanged:this.handleSelectionChanged,onMovedColumnsChanged:this.handleMovedColumnsChanged,renderer:this.renderer,stateOverride:lo,theme:Vn}),m(yg,{isOpen:Hn,text:ni,onClose:this.handleOverflowClose}),co&&m(Al,{model:r,modelColumns:r.columns,top:As,bottom:ao,left:fn,right:Ms,filter:ri,formatter:ye,sorts:$e,reverseType:Ot,movedColumns:me,customColumns:Ct,hiddenColumns:Co,alwaysFetchColumns:this.getAlwaysFetchColumns(c,r.columns,me,r.floatingLeftColumnCount,r.floatingRightColumnCount,(dr=(cr=this.grid)==null?void 0:cr.state.draggingColumn)==null?void 0:dr.range),formatColumns:this.getCachedPreviewFormatColumns(this.getCachedModelColumns(r,Ct),fe,Je,((ur=St[St.length-1])==null?void 0:ur.type)===Se.CONDITIONAL_FORMATTING_EDIT&&Xe!=null?Xe:void 0),rollupConfig:this.getModelRollupConfig(r.originalColumns,Xt,kt),totalsConfig:this.getModelTotalsConfig(r.columns,Xt,kt),selectDistinctColumns:de,pendingRowCount:Ds,pendingDataMap:rs,frozenColumns:no,columnHeaderGroups:pn}),!S&&m("div",{className:"grid-settings-button",children:m(z,{kind:"ghost","data-testid":`btn-iris-grid-settings-button-${l}`,onClick:this.handleMenu,icon:m(te,{icon:Uc,transform:"up-1"}),tooltip:"Table Options"})}),Os,ho,go,mo,po,so&&this.getOverflowButtonTooltip(so),Is&&this.getExpandCellTooltip(Is)]}),m(Ig,{model:r,isShown:Ns,gotoRow:oo,gotoRowError:io,gotoValueError:si,onGotoRowSubmit:this.handleGotoRowSelectedRowNumberSubmit,onGotoRowNumberChanged:this.handleGotoRowSelectedRowNumberChanged,onClose:this.handleGotoRowClosed,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:()=>{this.handleAnimationStart(),this.focus()},onExited:this.handleAnimationEnd,gotoValueSelectedColumnName:oi,gotoValue:ii,onGotoValueSelectedColumnNameChanged:this.handleGotoValueSelectedColumnNameChanged,onGotoValueSelectedFilterChanged:this.handleGotoValueSelectedFilterChanged,onGotoValueChanged:this.handleGotoValueChanged,onGotoValueSubmit:this.handleGotoValueSubmitted}),m(bu,{error:os,isSaving:gn!=null,saveTooltip:`Commit (${this.commitAction.shortcut.getDisplayText()})`,discardTooltip:`Discard (${this.discardAction.shortcut.getDisplayText()})`,pendingDataErrors:is,pendingDataMap:rs,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd,onSave:this.handlePendingCommitClicked,onDiscard:this.handlePendingDiscardClicked}),m(Gu,{children:to}),m(ys,{model:r,copyOperation:R!=null?R:void 0,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd}),m(Fs,{ref:xe=>{this.tableSaver=xe},getDownloadWorker:n,onDownloadCompleted:this.handleDownloadCompleted,onDownloadCanceled:this.handleDownloadCanceled,onDownloadProgressUpdate:this.handleDownloadProgressUpdate,isDownloading:De===gt.DOWNLOAD_STATUS.DOWNLOADING,formatter:ye})]}),m($t,{in:S,timeout:Ue.transitionMidMs,classNames:"slide-left",onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd,mountOnEnter:!0,unmountOnExit:!0,children:m("div",{className:"table-sidebar",children:y(Zc,{children:[m(vr,{title:"Table Options",onClose:this.handleMenuClose,children:m(fl,{onSelect:xe=>this.handleMenuSelect(fo[xe]),items:fo})}),ai.map((xe,ut)=>m(vr,{title:St[ut].title,onBack:this.handleMenuBack,onClose:this.handleMenuClose,children:xe},St[ut].type))]})})}),m(se,{actions:this.contextActions})]})}};let Js=Nn;Js.minDebounce=150;Js.maxDebounce=500;Js.loadingSpinnerDelay=800;Js.defaultProps={children:null,advancedFilters:on,advancedSettings:on,alwaysFetchColumns:ve,conditionalFormats:ve,customColumnFormatMap:on,isFilterBarShown:!1,applyInputFiltersOnInit:!1,movedColumns:ve,movedRows:ve,inputFilters:ve,customFilters:ve,onCreateChart:void 0,onColumnSelected:()=>{},onDataSelected:()=>{},onError:()=>{},onStateChange:()=>{},onPartitionAppend:()=>{},onAdvancedSettingsChange:()=>{},partition:null,partitionColumn:null,quickFilters:on,selectDistinctColumns:ve,sorts:ve,reverseType:I.REVERSE_TYPE.NONE,customColumns:ve,aggregationSettings:ma,rollupConfig:void 0,userColumnWidths:on,userRowHeights:on,onSelectionChanged:()=>{},isSelectingColumn:!1,isSelectingPartition:!1,isStuckToBottom:!1,isStuckToRight:!1,columnSelectionValidator:null,columnAllowedCursor:null,columnNotAllowedCursor:null,name:"table",onlyFetchVisibleColumns:!0,showSearchBar:!1,searchValue:"",selectedSearchColumns:null,invertSearchColumns:!0,onContextMenu:()=>{},pendingDataMap:on,getDownloadWorker:void 0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:cn.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,truncateNumbersWithPound:!1,formatter:ve,decimalFormatOptions:B.exports.shape({defaultFormatString:B.exports.string}),integerFormatOptions:B.exports.shape({defaultFormatString:B.exports.string})},canCopy:!0,canDownloadCsv:!0,frozenColumns:null,theme:Ml,canToggleSearch:!0};class kg extends Error{constructor(t,n){super(`${n} can't be empty (on pending row ${t+1})`),this.isMissingKey=!0,this.rowIndex=t,this.columnName=n}}const Pe=ie.module("IrisGridTableModel"),Lg=150,Pg=0,_g=[];function Ao(e){return e.table!==void 0}const Mi=class extends ce{constructor(e,t=new zt,n=null){var s,o;super(),this.pendingNewRowCount=0,this._columnHeaderGroupMap=new Map,this.columnHeaderParentMap=new Map,this._columnHeaderMaxDepth=null,this._columnHeaderGroups=[],this._movedColumns=null,this.getMemoizedInitialMovedColumns=Re(i=>{var p;if(!i)return[];let r=[];const{groupMap:l}=J.parseColumnHeaderGroups(this,(p=i==null?void 0:i.columnGroups)!=null?p:[]),a=(f,C)=>{const w=this.getColumnIndexByName(f);if(w==null)throw new Error(`Unknown layout hint column: ${f}`);const S=H.getVisibleIndex(w,r);r=H.moveItem(S,C,r)},c=(f,C)=>{const w=l.get(f);if(w==null)throw new Error(`Unknown layout hint group: ${f}`);const S=w.getVisibleRange(r);r=H.moveRange(S,C,r)},{frontColumns:d=[],backColumns:u=[],frozenColumns:h=[]}=i;if(d.length||u.length||h.length){const f=new Set;let C=0;h.forEach(S=>{if(f.has(S))throw new Error(`Column specified in multiple layout hints: ${S}`);a(S,C),C+=1}),d.forEach(S=>{if(f.has(S))throw new Error(`Column specified in multiple layout hints: ${S}`);a(S,C),C+=1});let w=this.columnMap.size-1;u.forEach(S=>{if(f.has(S))throw new Error(`Column specified in multiple layout hints: ${S}`);a(S,w),w-=1})}if(i==null?void 0:i.columnGroups){const f=[...l.values()];f.sort((C,w)=>C.depth-w.depth),f.forEach(C=>{const w=C.children[0],S=this.getColumnIndexByName(w);let T;if(S!=null)T=H.getVisibleIndex(S,r);else{const R=l.get(w);if(!R)throw new Error(`Unknown column ${w} in group ${C.name}`);[,T]=R.getVisibleRange(r)}for(let R=1;R<C.children.length;R+=1){const b=C.children[R],v=l.get(b),D=this.getColumnIndexByName(b);if(v){const N=v.getVisibleRange(r)[0]<T?T-v.childIndexes.length+1:T+1;c(b,N),T=N+v.childIndexes.length-1}else if(D!=null){const N=H.getVisibleIndex(D,r)<T?T:T+1;a(b,N),T=N}}})}return this._movedColumns=r,r}),this.getMemoizedInitialColumnHeaderGroups=Re(i=>{var r;return J.parseColumnHeaderGroups(this,(r=i==null?void 0:i.columnGroups)!=null?r:[]).groups}),this.getMemoizedColumnMap=Re(i=>{const r=new Map;return i.forEach(l=>r.set(l.name,l)),r}),this.getColumnIndicesByNameMap=Re(i=>{const r=new Map;return i.forEach(({name:l},a)=>r.set(l,a)),r}),this.setViewport=Pn((i,r,l)=>{if(r<i){Pe.error("Invalid viewport",i,r);return}const{viewport:a}=this;if(a!=null&&a.top===i&&a.bottom===r&&a.columns===l){Pe.debug2("Ignoring duplicate viewport",a);return}this.viewport={top:i,bottom:r,columns:l},Pe.debug2("setViewport",this.viewport),this.applyViewport()},Lg),this.applyViewport=Pn(()=>{if(!this.viewport)return;Pe.debug2("applyViewport",this.viewport);const{top:i,bottom:r,columns:l}=this.viewport,[a,c]=this.getCachedViewportRowRange(i,r);this.applyBufferedViewport(a,c,l)},Pg,{leading:!1}),this.getCachedFormattedString=pt((i,r,l,a,c)=>i.getFormattedString(r,l,a,c),{max:1e4}),this.getCachedCustomColumnFormatFlag=pt(Jn.isCustomColumnFormatDefined,{max:1e4}),this.getCachedViewportRowRange=Re((i,r)=>{const l=r-i,a=Math.max(0,i-l*Mi.ROW_BUFFER_PAGES),c=r+l*Mi.ROW_BUFFER_PAGES;return[a,c]}),this.getCachedPendingErrors=Re((i,r,l)=>{const a=new Map;return i.forEach((c,d)=>{var h;const{data:u}=c;for(let g=0;g<l;g+=1)u.has(g)||(a.has(d)||a.set(d,[]),(h=a.get(d))==null||h.push(new kg(d,r[g].name)))}),a}),this.handleTableDisconnect=this.handleTableDisconnect.bind(this),this.handleTableReconnect=this.handleTableReconnect.bind(this),this.handleTableUpdate=this.handleTableUpdate.bind(this),this.handleTotalsUpdate=this.handleTotalsUpdate.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.handleCustomColumnsChanged=this.handleCustomColumnsChanged.bind(this),this.irisFormatter=t,this.inputTable=n,this.subscription=null,this.table=e,this.viewport=null,this.viewportData=null,this.formattedStringData=[],this.pendingStringData=[],this.isSaveInProgress=!1,this.totalsTable=null,this.totalsTablePromise=null,this.totals=null,this.totalsDataMap=null,this.pendingNewDataMap=new Map,this.pendingNewRowCount=0,this.columnHeaderGroups=J.parseColumnHeaderGroups(this,(o=(s=this.layoutHints)==null?void 0:s.columnGroups)!=null?o:[]).groups}seekRow(e,t,n,s,o,i,r){throw new Error("Method not implemented.")}export(){throw new Error("Method not implemented.")}columnStatistics(e){throw new Error("Method not implemented.")}get customColumns(){return[]}set customColumns(e){throw new Error("Method not implemented.")}get formatColumns(){return[]}set formatColumns(e){throw new Error("Method not implemented.")}updateFrozenColumns(e){throw new Error("Method not implemented.")}get rollupConfig(){throw new Error("Method not implemented.")}set rollupConfig(e){throw new Error("Method not implemented.")}get selectDistinctColumns(){throw new Error("Method not implemented.")}set selectDistinctColumns(e){throw new Error("Method not implemented.")}get columns(){return this.table.columns}close(){this.table.close(),this.totalsTable!==null&&this.totalsTable.close(),this.totalsTablePromise!==null&&this.totalsTablePromise.cancel()}startListening(){super.startListening(),this.table.addEventListener(E.Table.EVENT_DISCONNECT,this.handleTableDisconnect),this.table.addEventListener(E.Table.EVENT_RECONNECT,this.handleTableReconnect),this.table.addEventListener(E.Table.EVENT_UPDATED,this.handleTableUpdate),this.table.addEventListener(E.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed),this.table.addEventListener(E.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleCustomColumnsChanged),this.totalsTable!=null&&this.addTotalsListeners(this.totalsTable),this.applyViewport()}stopListening(){super.stopListening(),this.table.removeEventListener(E.Table.EVENT_DISCONNECT,this.handleTableDisconnect),this.table.removeEventListener(E.Table.EVENT_RECONNECT,this.handleTableReconnect),this.table.removeEventListener(E.Table.EVENT_UPDATED,this.handleTableUpdate),this.table.removeEventListener(E.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed),this.table.removeEventListener(E.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleCustomColumnsChanged),this.totalsTable!=null&&this.removeTotalsListeners(this.totalsTable),this.closeSubscription()}addTotalsListeners(e){e.addEventListener(E.Table.EVENT_UPDATED,this.handleTotalsUpdate),e.setViewport(0,0)}removeTotalsListeners(e){e.removeEventListener(E.Table.EVENT_UPDATED,this.handleTotalsUpdate)}handleTableDisconnect(){this.dispatchEvent(new Me(ce.EVENT.DISCONNECT))}handleTableReconnect(){this.dispatchEvent(new Me(ce.EVENT.RECONNECT))}handleTableUpdate(e){this.copyViewportData(e.detail),this.dispatchEvent(new Me(ce.EVENT.UPDATED))}handleTotalsUpdate(e){this.copyTotalsData(e.detail),this.dispatchEvent(new Me(ce.EVENT.UPDATED))}handleRequestFailed(e){this.dispatchEvent(new Me(ce.EVENT.REQUEST_FAILED,e))}handleCustomColumnsChanged(){this.dispatchEvent(new Me(ce.EVENT.COLUMNS_CHANGED,{detail:this.columns}))}get rowCount(){var e,t,n;return this.table.size+this.pendingNewRowCount+((n=(t=(e=this.totals)==null?void 0:e.operationOrder)==null?void 0:t.length)!=null?n:0)}get pendingDataErrors(){var e,t;return this.getCachedPendingErrors(this.pendingNewDataMap,this.columns,(t=(e=this.inputTable)==null?void 0:e.keyColumns.length)!=null?t:0)}get pendingDataMap(){return this.pendingNewDataMap}set pendingDataMap(e){e!==this.pendingNewDataMap&&(e.forEach((t,n)=>{if(!J.isValidIndex(n))throw new Error(`Invalid rowIndex ${n}`);const{data:s}=t;s.forEach((o,i)=>{if(!J.isValidIndex(i))throw new Error(`Invalid columnIndex ${i}`)})}),this.pendingNewDataMap=e,this.pendingNewRowCount=Math.max(this.pendingNewRowCount,this.maxPendingDataRow),this.formattedStringData=[],this.dispatchEvent(new Me(ce.EVENT.PENDING_DATA_UPDATED)))}get pendingRowCount(){return this.pendingNewRowCount}set pendingRowCount(e){e!==this.pendingNewRowCount&&(this.pendingNewRowCount=Math.max(0,e,this.maxPendingDataRow),this.dispatchEvent(new Me(ce.EVENT.UPDATED)))}get maxPendingDataRow(){return this.pendingNewDataMap.size>0?Math.max(...this.pendingNewDataMap.keys())+1:0}get columnCount(){return this.columns.length}get floatingBottomRowCount(){var e,t,n;return this.totals!=null&&this.totals.showOnTop?0:(n=(t=(e=this.totals)==null?void 0:e.operationOrder)==null?void 0:t.length)!=null?n:0}get floatingTopRowCount(){var e,t,n;return this.totals!=null&&this.totals.showOnTop&&(n=(t=(e=this.totals)==null?void 0:e.operationOrder)==null?void 0:t.length)!=null?n:0}get isChartBuilderAvailable(){return!0}get isTotalsAvailable(){return this.table.getTotalsTable!=null}get isEditable(){return!this.isSaveInProgress&&this.inputTable!=null}cacheFormattedValue(e,t,n){this.formattedStringData[e]==null&&(this.formattedStringData[e]=[]),this.formattedStringData[e][t]=n}cachePendingValue(e,t,n){this.pendingStringData[e]==null&&(this.pendingStringData[e]=[]),this.pendingStringData[e][t]=n}clearPendingValue(e,t){const n=this.pendingStringData[e];n!=null&&delete n[t]}textValueForCell(e,t){var n,s,o;if(((n=this.pendingStringData[e])==null?void 0:n[t])!==void 0)return this.pendingStringData[e][t];if(((s=this.formattedStringData[e])==null?void 0:s[t])===void 0){const i=this.valueForCell(e,t);if(i==null)return null;const r=(o=this.totalsColumn(e,t))!=null?o:this.columns[e],l=this.getCachedCustomColumnFormatFlag(this.formatter,r.name,r.type);let a;if(!l){const d=this.formatForCell(e,t);(d==null?void 0:d.formatString)!=null&&(a=d)}const c=this.displayString(i,r.type,r.name,a);this.cacheFormattedValue(e,t,c)}return this.formattedStringData[e][t]}textForCell(e,t){const n=this.textValueForCell(e,t);if(n==null&&this.isKeyColumn(e)){const s=this.pendingRow(t);if(s!=null&&this.pendingDataMap.has(s))return"*"}return n!=null?n:""}truncationCharForCell(e){const t=this.columns[e],{type:n}=t;if(I.isNumberType(n)&&this.formatter.truncateNumbersWithPound)return"#"}colorForCell(e,t,n){var o;const s=this.dataForCell(e,t);if(s){const{format:i,value:r}=s;if(r==null||r==="")return M(n.nullStringColor),n.nullStringColor;if(i&&i.color)return i.color;if(this.isPendingRow(t))return M(n.pendingTextColor),n.pendingTextColor;if(r!=null){const l=(o=this.totalsColumn(e,t))!=null?o:this.columns[e];if(I.isDateType(l.type)||l.name==="Date")return M(n.dateColor),n.dateColor;if(I.isNumberType(l.type))return r>0?(M(n.positiveNumberColor),n.positiveNumberColor):r<0?(M(n.negativeNumberColor),n.negativeNumberColor):(M(n.zeroNumberColor),n.zeroNumberColor)}}else if(this.isPendingRow(t)&&this.isKeyColumn(e))return M(n.errorTextColor),n.errorTextColor;return n.textColor}backgroundColorForCell(e,t){var n,s;return(s=(n=this.formatForCell(e,t))==null?void 0:n.backgroundColor)!=null?s:null}textAlignForCell(e){const t=this.columns[e],{type:n}=t;return I.isNumberType(n)?"right":I.isDateType(n)||t.name==="Date"?"center":"left"}textForColumnHeader(e,t=0){const n=this.columnAtDepth(e,t);return gi(n)?n.isNew?"":n.name:n==null?void 0:n.name}colorForColumnHeader(e,t=0){var s;const n=this.columnAtDepth(e,t);return gi(n)&&(s=n.color)!=null?s:null}getColumnHeaderGroup(e,t){const n=this.columnAtDepth(e,t);if(gi(n))return n}getColumnHeaderParentGroup(e,t){var n,s;return this.columnHeaderParentMap.get((s=(n=this.columnAtDepth(e,t))==null?void 0:n.name)!=null?s:"")}columnAtDepth(e,t=0){var i;if(t===0)return this.columns[e];const n=(i=this.columns[e])==null?void 0:i.name;let s=this.columnHeaderParentMap.get(n);if(!s)return;let o=s.depth;for(;o<t;){if(s=this.columnHeaderParentMap.get(s.name),!s)return;o=s.depth}if(s.depth===t)return s}textForRowFooter(e){const t=this.totalsRow(e);return t!=null&&this.totals?this.totals.operationOrder[t]:""}get initialMovedColumns(){var e;return this.getMemoizedInitialMovedColumns((e=this.layoutHints)!=null?e:void 0)}get initialMovedRows(){return _g}get initialColumnHeaderGroups(){var e;return this.getMemoizedInitialColumnHeaderGroups((e=this.layoutHints)!=null?e:void 0)}get columnMap(){return this.getMemoizedColumnMap(this.table.columns)}get columnHeaderMaxDepth(){var e;return(e=this._columnHeaderMaxDepth)!=null?e:1}set columnHeaderMaxDepth(e){this._columnHeaderMaxDepth=e}get columnHeaderGroupMap(){return this._columnHeaderGroupMap}get columnHeaderGroups(){return this._columnHeaderGroups}set columnHeaderGroups(e){if(e===this._columnHeaderGroups)return;const{groups:t,maxDepth:n,parentMap:s,groupMap:o}=J.parseColumnHeaderGroups(this,e!=null?e:this.initialColumnHeaderGroups);this._columnHeaderGroups=t,this.columnHeaderMaxDepth=n,this.columnHeaderParentMap=s,this._columnHeaderGroupMap=o}get groupedColumns(){return[]}row(e){var l,a,c,d,u,h,g,p,f,C,w,S,T,R;const t=(c=(a=(l=this.totals)==null?void 0:l.operationOrder)==null?void 0:a.length)!=null?c:0,n=(u=(d=this.totals)==null?void 0:d.showOnTop)!=null?u:!1,s=this.totalsRow(e);if(s!=null){const b=(h=this.totals)==null?void 0:h.operationOrder[s];return M(b),(p=(g=this.totalsDataMap)==null?void 0:g.get(b))!=null?p:null}const o=this.pendingRow(e);if(o!=null)return(f=this.pendingNewDataMap.get(o))!=null?f:null;const i=(w=(C=this.viewportData)==null?void 0:C.offset)!=null?w:0,r=(n?e-t:e)-i;return(R=(T=(S=this.viewportData)==null?void 0:S.rows)==null?void 0:T[r])!=null?R:null}totalsColumn(e,t){var r,l,a,c;const n=this.totalsRow(t);if(n==null)return null;const s=(r=this.totals)==null?void 0:r.operationOrder[n],o=(a=(l=this.totals)==null?void 0:l.defaultOperation)!=null?a:Te.SUM,i=this.columns[e];return(c=this.totalsTable)==null?void 0:c.columns.find(d=>{var u;return d.name===`${i.name}__${s}`||(s===o||((u=this.totals)==null?void 0:u.operationOrder.length)===1)&&d.name===i.name})}totalsRow(e){var o,i,r,l,a;const t=(r=(i=(o=this.totals)==null?void 0:o.operationOrder)==null?void 0:i.length)!=null?r:0,s=((a=(l=this.totals)==null?void 0:l.showOnTop)!=null?a:!1)?e:e-this.table.size;return s>=0&&s<t?s:null}pendingRow(e){const t=e-this.floatingTopRowCount-this.table.size;return t>=0&&t<this.pendingNewRowCount?t:null}isTotalsRow(e){return this.totalsRow(e)!=null}isPendingRow(e){return this.pendingRow(e)!=null}dataForCell(e,t){var n;return(n=this.row(t))==null?void 0:n.data.get(e)}formatForCell(e,t){var n;return(n=this.dataForCell(e,t))==null?void 0:n.format}valueForCell(e,t){var s;const n=this.dataForCell(e,t);if(n)return(s=n.value)!=null?s:null}copyViewportData(e){if(e==null){Pe.warn("invalid data!");return}this.viewportData=this.extractViewportData(e),this.formattedStringData=[]}copyTotalsData(e){var l,a,c,d,u;if(e==null){Pe.warn("invalid data!");return}const{columns:t,rows:n}=e;if(n.length!==1){Pe.error("Unexpected number of rows received for totals table, ignoring update");return}const s=new Map,o=n[0],i=(a=(l=this.totals)==null?void 0:l.defaultOperation)!=null?a:Te.SUM,r=(c=this.totals)==null?void 0:c.operationMap;for(let h=0;h<t.length;h+=1){const g=t[h],[p,f=(u=(d=r==null?void 0:r[p])==null?void 0:d[0])!=null?u:i]=g.name.split("__");s.has(f)||s.set(f,{data:new Map});const{data:C}=s.get(f),w=this.columns.findIndex(S=>S.name===p);C.set(w,{value:o.get(g),format:o.getFormat(g)})}Pe.debug2("copyTotalsData",s),this.totalsDataMap=s,this.formattedStringData=[]}getColumnIndexByName(e){return this.getColumnIndicesByNameMap(this.columns).get(e)}extractViewportData(e){const t={offset:e.offset,rows:[]},{columns:n}=e;for(let s=0;s<e.rows.length;s+=1){const o=e.rows[s],i=this.extractViewportRow(o,n);t.rows.push(i)}return t}extractViewportRow(e,t){const n=new Map;for(let s=0;s<t.length;s+=1){const o=t[s],i=this.getColumnIndexByName(o.name);M(i),n.set(i,{value:e.get(o),format:e.getFormat(o)})}return{data:n}}closeSubscription(){Pe.debug2("closeSubscription",this.subscription),this.subscription&&(this.subscription.close(),this.subscription=null),this.setViewport.cancel(),this.applyViewport.cancel()}get filter(){return this.table.filter}set filter(e){this.closeSubscription(),this.table.applyFilter(e),this.applyViewport()}get formatter(){return this.irisFormatter}set formatter(e){this.irisFormatter=e,this.formattedStringData=[],this.dispatchEvent(new Me(ce.EVENT.FORMATTER_UPDATED))}displayString(e,t,n="",s){return this.getCachedFormattedString(this.formatter,e,t,n,s)}get sort(){return this.table.sort}set sort(e){this.closeSubscription(),this.table.applySort(e),this.applyViewport()}set totalsConfig(e){if(Pe.debug("set totalsConfig",e),e!==this.totals){if(this.totals=e,this.formattedStringData=[],this.totalsTablePromise!=null&&this.totalsTablePromise.cancel(),this.setTotalsTable(null),e==null){this.dispatchEvent(new Me(ce.EVENT.UPDATED));return}this.totalsTablePromise=Ge.makeCancelable(this.table.getTotalsTable(e),t=>t.close()),this.totalsTablePromise.then(t=>{this.totalsTablePromise=null,this.setTotalsTable(t)}).catch(t=>{Ge.isCanceled(t)||(Pe.error("Unable to set next totalsTable",t),this.totalsTablePromise=null,this.dispatchEvent(new Me(ce.EVENT.REQUEST_FAILED,{detail:t})))})}}setTotalsTable(e){Pe.debug("setTotalsTable",e),this.totalsTable!==null&&(this.listenerCount>0&&this.removeTotalsListeners(this.totalsTable),this.totalsTable.close()),this.totalsTable=e,this.totalsDataMap=null,this.listenerCount>0&&this.totalsTable!=null&&this.addTotalsListeners(this.totalsTable)}applyBufferedViewport(e,t,n){Pe.debug2("applyBufferedViewport",e,t,n),this.subscription==null?(Pe.debug2("applyBufferedViewport creating new subscription"),this.subscription=this.table.setViewport(e,t,n)):(Pe.debug2("applyBufferedViewport using existing subscription"),this.subscription.setViewport(e,t,n))}async snapshot(e,t=!1,n=o=>o,s=!0){if(this.subscription==null)throw new Error("No subscription available");const o=s?Q.consolidate(e):e;if(!J.isValidSnapshotRanges(o))throw new Error(`Invalid snapshot ranges ${e}`);const i=new Set,r=[],l=new Set;for(let h=0;h<o.length;h+=1){const g=o[h];M(g.endRow),M(g.startRow);for(let p=g.startRow;p<=g.endRow&&p<this.floatingTopRowCount;p+=1)i.add(p);g.endRow>=this.floatingTopRowCount&&g.startRow<=this.floatingTopRowCount+this.table.size&&r.push(new Q(g.startColumn,Math.min(Math.max(0,g.startRow-this.floatingTopRowCount)),g.endColumn,Math.min(Math.max(0,g.endRow-this.floatingTopRowCount),this.table.size-this.floatingTopRowCount)));for(let p=Math.max(g.startRow,this.floatingTopRowCount+this.table.size);p<=g.endRow&&p<this.floatingTopRowCount+this.table.size+this.floatingBottomRowCount;p+=1)l.add(p)}const a=J.columnsFromRanges(o,this.columns),c=[];t&&c.push(a.map(h=>h.name));const d=[...i].sort();for(let h=0;h<d.length;h+=1){const g=d[h],p=a.map(f=>{const C=this.getColumnIndexByName(f.name);return M(C),n(this.valueForCell(C,g),f)});t&&p.push(this.textForRowFooter(g)),c.push(p)}if(r.length>0){const h=J.rangeSetFromRanges(r),g=await this.subscription.snapshot(h,a);c.push(...g.rows.map(p=>a.map(f=>n(p.get(f),f))))}const u=[...l].sort();for(let h=0;h<u.length;h+=1){const g=u[h],p=a.map(f=>{const C=this.getColumnIndexByName(f.name);return M(C),n(this.valueForCell(C,g),f)});t&&p.push(this.textForRowFooter(g)),c.push(p)}return c}async textSnapshot(e,t=!1,n=s=>`${s}`){return Pe.debug2("textSnapshot",e,t),(await this.snapshot(e,t,n,!1)).map(o=>o.join(" ")).join(`
31
+ `)}async valuesTable(e){let t=null;try{return t=await this.table.copy(),t.applyFilter([]),t.applySort([]),t.selectDistinct([e])}finally{t!=null&&t.close()}}isColumnMovable(e,t){if(e<0||e>=this.columnCount)return!1;if(t>0)return!0;const n=this.columns[e].name;return this.frontColumns.includes(n)||this.backColumns.includes(n)||this.frozenColumns.includes(n)||!n?!1:!this.isKeyColumn(e)}isKeyColumn(e){var t,n;return e<((n=(t=this.inputTable)==null?void 0:t.keyColumns.length)!=null?n:0)}isRowMovable(){return!1}isEditableRange(e){return!(this.inputTable==null||!Q.isBounded(e)||!(this.isPendingRow(e.startRow)&&this.isPendingRow(e.endRow)||this.inputTable.keyColumns.length!==0&&e.startColumn>=this.inputTable.keyColumns.length&&e.endColumn>=this.inputTable.keyColumns.length)||e.startRow<this.floatingTopRowCount||e.startRow>=this.floatingTopRowCount+this.table.size+this.pendingRowCount||e.endRow>=this.floatingTopRowCount+this.table.size+this.pendingRowCount)}isDeletableRange(e){return this.inputTable!=null&&e.startRow!=null&&e.endRow!=null&&e.startRow>=this.floatingTopRowCount&&e.startRow<this.floatingTopRowCount+this.table.size+this.pendingRowCount&&e.endRow<this.floatingTopRowCount+this.table.size+this.pendingRowCount}isEditableRanges(e){return e.every(t=>this.isEditableRange(t))}isDeletableRanges(e){return e.every(t=>this.isDeletableRange(t))}getTableAreaRange(){return new Q(null,this.floatingTopRowCount,null,this.floatingTopRowCount+this.table.size-1)}getPendingAreaRange(){return new Q(null,this.floatingTopRowCount+this.table.size,null,this.floatingTopRowCount+this.table.size+this.pendingNewRowCount-1)}async setValueForCell(e,t,n){return this.setValueForRanges([new Q(e,t,e,t)],n)}async setValueForRanges(e,t){var n;if(!this.isEditableRanges(e))throw new Error(`Uneditable ranges ${e}`);try{const s=new Set,o=[];Q.forEachCell(e,(c,d)=>{const u=this.columns[c];if(s.add(u),o[c]===void 0){const h=I.makeValue(u.type,t,this.formatter.timeZone);o[c]=h!=null?this.displayString(h,u.type,u.name):null}this.cachePendingValue(c,d,o[c])});const i=this.getPendingAreaRange(),r=e.map(c=>Q.intersection(i,c)).filter(c=>c!=null).map(c=>(M(c),Q.offset(c,0,-(this.floatingTopRowCount+this.table.size))));if(r.length>0){const c=new Map(this.pendingNewDataMap);Q.forEachCell(r,(d,u)=>{c.has(u)||c.set(u,{data:new Map});const h=this.columns[d],g=c.get(u);M(g);const{data:p}=g,f=new Map(p),C=I.makeValue(h.type,t,this.formatter.timeZone);C!=null?f.set(d,{value:C}):f.delete(d),f.size>0?c.set(u,{...g,data:f}):c.delete(u)}),this.pendingDataMap=c}this.dispatchEvent(new Me(ce.EVENT.UPDATED));const l=this.getTableAreaRange(),a=e.map(c=>Q.intersection(l,c)).filter(c=>c!=null);if(a.length>0){const d=(await this.snapshot(a.map(h=>{var g,p;return new Q(null,(g=h==null?void 0:h.startRow)!=null?g:null,null,(p=h==null?void 0:h.endRow)!=null?p:null)}))).map(h=>{const g={};for(let p=0;p<this.columns.length;p+=1)g[this.columns[p].name]=h[p];return s.forEach(p=>{g[p.name]=I.makeValue(p.type,t,this.formatter.timeZone)}),g}),u=await((n=this.inputTable)==null?void 0:n.addRows(d));Pe.debug("setValueForRanges(",e,",",t,") set tableRanges",a,"result",u)}Q.forEachCell(e,(c,d)=>{const u=o[c];M(u),this.cacheFormattedValue(c,d,u)})}catch(s){Pe.error("Unable to set ranges",e,t,s)}finally{Q.forEachCell(e,(s,o)=>{this.clearPendingValue(s,o)})}}async setValues(e=[]){var t;if(Pe.debug("setValues(",e,")"),!e.every(n=>{var s,o;return this.isEditableRange(Q.makeCell((s=n.column)!=null?s:n.x,(o=n.row)!=null?o:n.y))}))throw new Error(`Uneditable ranges ${e}`);try{const n=new Map(this.pendingNewDataMap);e.forEach(l=>{var f,C;const{text:a}=l,c=(f=l.column)!=null?f:l.x,d=(C=l.row)!=null?C:l.y,u=this.columns[c],h=I.makeValue(u.type,a,this.formatter.timeZone),g=h!=null?this.displayString(h,u.type,u.name):null;this.cachePendingValue(c,d,g);const p=this.pendingRow(d);if(p!=null){n.has(p)||n.set(p,{data:new Map});const w=n.get(p);M(w);const{data:S}=w,T=new Map(S);h!=null?T.set(c,{value:h}):T.delete(c),T.size>0?n.set(p,{...w,data:T}):n.delete(p)}}),this.pendingDataMap=n,this.dispatchEvent(new Me(ce.EVENT.UPDATED));const s=e.reduce((l,a)=>{var d,u;const c=(d=a.row)!=null?d:a.y;return l.has(c)||l.set(c,[]),(u=l.get(c))==null||u.push(a),l},new Map),o=Q.consolidate(e.map(l=>{var a,c;return Q.makeCell((a=l.column)!=null?a:l.x,(c=l.row)!=null?c:l.y)})),i=this.getTableAreaRange(),r=o.map(l=>Q.intersection(i,l)).filter(l=>l!=null);if(r.length>0){const a=(await this.snapshot(r.map(d=>(M(d),new Q(null,d.startRow,null,d.endRow))))).map((d,u)=>{let h=null,g=u;for(let C=0;C<r.length;C+=1){const w=r[C];M(w);const S=Q.rowCount([w]);if(g<S){M(w.startRow),h=w.startRow+g;break}g-=S}const p={};for(let C=0;C<this.columns.length;C+=1)p[this.columns[C].name]=d[C];M(h);const f=s.get(h);return f!=null&&f.forEach(C=>{var S;const w=this.columns[(S=C.column)!=null?S:C.x];p[w.name]=I.makeValue(w.type,C.text,this.formatter.timeZone)}),p});Pe.info("setValues setting tableRanges",r);const c=await((t=this.inputTable)==null?void 0:t.addRows(a));Pe.info("setValues set tableRanges",r,"SUCCESS",c)}e.forEach(l=>{var p,f;const{text:a}=l,c=(p=l.column)!=null?p:l.x,d=(f=l.row)!=null?f:l.y,u=this.columns[c],h=I.makeValue(u.type,a,this.formatter.timeZone),g=h!=null?this.displayString(h,u.type,u.name):null;this.cacheFormattedValue(c,d,g)})}finally{e.forEach(n=>{this.clearPendingValue(n.column,n.row)})}}async commitPending(){var e,t,n;if(this.pendingNewDataMap.size<=0)throw new Error("No pending changes to commit");try{this.isSaveInProgress=!0;const s=[];this.pendingNewDataMap.forEach(i=>{const r={};i.data.forEach(({value:l},a)=>{const c=this.columns[a];r[c.name]=l}),s.push(r)});const o=await((e=this.inputTable)==null?void 0:e.addRows(s));Pe.debug("commitPending()",this.pendingNewDataMap,"result",o),this.pendingNewDataMap=new Map,this.pendingNewRowCount=Math.max(0,((n=(t=this.viewport)==null?void 0:t.bottom)!=null?n:0)-this.table.size),this.formattedStringData=[],this.dispatchEvent(new Me(ce.EVENT.PENDING_DATA_UPDATED))}finally{this.isSaveInProgress=!1}}editValueForCell(e,t){return this.textValueForCell(e,t)}async delete(e){if(!this.isDeletableRanges(e))throw new Error(`Undeletable ranges ${e}`);M(this.inputTable);const{keyColumns:t}=this.inputTable;if(t.length===0)throw new Error("No key columns to allow deletion");const n=this.getPendingAreaRange(),s=e.map(d=>Q.intersection(n,d)).filter(d=>d!=null).map(d=>(M(d),Q.offset(d,0,-(this.floatingTopRowCount+this.table.size))));if(s.length>0){const d=new Map(this.pendingNewDataMap);for(let u=0;u<s.length;u+=1){const h=s[u];M(h.startRow),M(h.endRow);for(let g=h.startRow;g<=h.endRow;g+=1)d.delete(g)}this.pendingNewDataMap=d,this.formattedStringData=[],this.dispatchEvent(new Me(ce.EVENT.PENDING_DATA_UPDATED)),this.dispatchEvent(new Me(ce.EVENT.UPDATED))}const o=this.getTableAreaRange(),i=e.map(d=>Q.intersection(o,d)).filter(d=>d!=null);if(i.length<=0)return;const[r,l]=await Promise.all([this.snapshot(i.map(d=>(M(d),new Q(0,d.startRow,t.length-1,d.endRow)))),this.table.copy()]),c=r.map(d=>{const u=[];for(let h=0;h<t.length;h+=1){const g=t[h],p=d[h],f=I.makeFilterRawValue(g.type,p),C=g.filter().eq(f);u.push(C)}return u.reduce((h,g)=>{var p;return(p=h==null?void 0:h.and(g))!=null?p:g})}).reduce((d,u)=>{var h;return(h=d==null?void 0:d.or(u))!=null?h:u});l.applyFilter([c]),l.close()}isValidForCell(e,t,n){try{const s=this.columns[e];return I.makeValue(s.type,n,this.formatter.timeZone),!0}catch{return!1}}};let rr=Mi;rr.ROW_BUFFER_PAGES=1;const yn=ie.module("IrisGridTableModel");class Hg extends rr{constructor(t,n=new zt,s=null){super(t,n,s),this.getMemoizedFrontColumns=Re(o=>o!=null?o:[]),this.getMemoizedBackColumns=Re(o=>o!=null?o:[]),this.getMemoizedFrozenColumns=Re((o,i)=>{var r;return(r=i!=null?i:o)!=null?r:[]}),this.getCachedFilterableColumnSet=Re(o=>new Set(o.map((i,r)=>r))),this.customColumnList=[],this.formatColumnList=[]}get isExportAvailable(){return this.table.freeze!=null}get isColumnStatisticsAvailable(){return this.table.getColumnStatistics!=null}get isValuesTableAvailable(){return this.table.selectDistinct!=null&&this.table.copy!=null}get isRollupAvailable(){return this.table.rollup!=null}get isSelectDistinctAvailable(){return this.table.selectDistinct!=null}get isCustomColumnsAvailable(){return this.table.applyCustomColumns!=null}get isFormatColumnsAvailable(){return this.table.applyCustomColumns!=null}get frontColumns(){var t;return this.getMemoizedFrontColumns((t=this.layoutHints)==null?void 0:t.frontColumns)}get backColumns(){var t;return this.getMemoizedBackColumns((t=this.layoutHints)==null?void 0:t.backColumns)}get frozenColumns(){var t;return this.getMemoizedFrozenColumns((t=this.layoutHints)==null?void 0:t.frozenColumns,this.userFrozenColumns)}get layoutHints(){return this.table.layoutHints}get floatingLeftColumnCount(){return this.frozenColumns.length}get description(){return this.table.description}get customColumns(){return this.customColumnList}set customColumns(t){if(yn.debug2("set customColumns",t,this.customColumnList,t===this.customColumnList),this.customColumnList.length===0&&t.length===0){yn.debug("Ignore empty initial customColumns"),this.customColumnList=t;return}if(this.customColumnList===t){yn.debug("Ignore same customColumns");return}this.closeSubscription(),this.customColumnList=t,this.table.applyCustomColumns([...t,...this.formatColumns]),this.applyViewport()}get formatColumns(){return this.formatColumnList}set formatColumns(t){if(yn.debug2("set formatColumns",t,this.formatColumnList,t===this.formatColumnList),this.formatColumnList.length===0&&t.length===0){yn.debug("Ignore empty initial formatColumns"),this.formatColumnList=t;return}if(this.formatColumnList===t){yn.debug("Ignore same formatColumns");return}this.closeSubscription(),this.formatColumnList=t,this.table.applyCustomColumns([...this.customColumns,...t]),this.applyViewport()}updateFrozenColumns(t){this.userFrozenColumns=t,this.dispatchEvent(new Me(ce.EVENT.TABLE_CHANGED,{detail:this.table}))}set totalsConfig(t){if(yn.debug("set totalsConfig",t),t!==this.totals){if(this.totals=t,this.formattedStringData=[],this.totalsTablePromise!=null&&this.totalsTablePromise.cancel(),this.setTotalsTable(null),t==null){this.dispatchEvent(new Me(ce.EVENT.UPDATED));return}this.totalsTablePromise=Ge.makeCancelable(this.table.getTotalsTable(t),n=>n.close()),this.totalsTablePromise.then(n=>{this.totalsTablePromise=null,this.setTotalsTable(n)}).catch(n=>{Ge.isCanceled(n)||(yn.error("Unable to set next totalsTable",n),this.totalsTablePromise=null,this.dispatchEvent(new Me(ce.EVENT.REQUEST_FAILED,{detail:n})))})}}get isFilterRequired(){return this.table.isUncoalesced}isFilterable(t){return this.getCachedFilterableColumnSet(this.columns).has(t)}async export(){return this.table.freeze()}columnStatistics(t){return this.table.getColumnStatistics(t)}isColumnMovable(t){const n=this.columns[t].name;return this.frontColumns.includes(n)||this.backColumns.includes(n)||this.frozenColumns.includes(n)?!1:!this.isKeyColumn(t)}isColumnFrozen(t){return this.frozenColumns.includes(this.columns[t].name)}async delete(t){var u;if(!this.isDeletableRanges(t))throw new Error(`Undeletable ranges ${t}`);M(this.inputTable);const{keyColumns:n}=this.inputTable;if(n.length===0)throw new Error("No key columns to allow deletion");const s=this.getPendingAreaRange(),o=t.map(h=>Q.intersection(s,h)).filter(h=>h!=null).map(h=>(M(h),Q.offset(h,0,-(this.floatingTopRowCount+this.table.size))));if(o.length>0){const h=new Map(super.pendingDataMap);for(let g=0;g<o.length;g+=1){const p=o[g];M(p.startRow),M(p.endRow);for(let f=p.startRow;f<=p.endRow;f+=1)h.delete(f)}super.pendingDataMap=h,this.formattedStringData=[],this.dispatchEvent(new Me(ce.EVENT.PENDING_DATA_UPDATED)),this.dispatchEvent(new Me(ce.EVENT.UPDATED))}const i=this.getTableAreaRange(),r=t.map(h=>Q.intersection(i,h)).filter(h=>h!=null);if(r.length<=0)return;const[l,a]=await Promise.all([this.snapshot(r.map(h=>(M(h),new Q(0,h.startRow,n.length-1,h.endRow)))),this.table.copy()]),d=l.map(h=>{const g=[];for(let p=0;p<n.length;p+=1){const f=n[p],C=h[p],w=I.makeFilterRawValue(f.type,C),S=f.filter().eq(w);g.push(S)}return g.reduce((p,f)=>{var C;return(C=p==null?void 0:p.and(f))!=null?C:f})}).reduce((h,g)=>{var p;return(p=h==null?void 0:h.or(g))!=null?p:g});a.applyFilter([d]),await((u=this.inputTable)==null?void 0:u.deleteTable(a)),a.close()}async seekRow(t,n,s,o,i,r,l){return this.table.seekRow(t,n,s,o,i,r,l)}get isSeekRowAvailable(){return this.table.seekRow!=null}}class Vg extends rr{constructor(){super(...arguments),this.getCachedFilterableColumnSet=Re((t,n)=>new Set(((n==null?void 0:n.length)>0?n:t).map(s=>t.findIndex(o=>s.name===o.name))))}applyBufferedViewport(t,n,s){this.table.setViewport(t,n,s)}textForCell(t,n){const s=this.columns[t],o=this.row(n);if(o!=null&&s!=null&&!o.hasChildren&&s.constituentType!=null){const i=this.valueForCell(t,n);return this.displayString(i,s.constituentType,s.name)}return super.textForCell(t,n)}extractViewportRow(t,n){const{isExpanded:s,hasChildren:o,depth:i}=t;return{...super.extractViewportRow(t,n),isExpanded:s,hasChildren:o,depth:i}}async snapshot(t,n,s){var l,a;M(this.viewport),M(this.viewportData);const{columns:o}=this.viewport,i=[];n!=null&&n&&i.push(o.map(c=>c.name));const r=new Q(0,(l=this.viewportData)==null?void 0:l.offset,o.length,this.viewportData.offset+this.viewportData.rows.length);for(let c=0;c<t.length;c+=1){const d=Q.intersection(r,t[c]);M(d),M(d.startRow),M(d.endRow);for(let u=d.startRow;u<=d.endRow;u+=1){const h=[],g=this.viewportData.rows[u-this.viewportData.offset];M(d.startColumn),M(d.endColumn);for(let p=d.startColumn;p<=d.endColumn;p+=1)M(s),h.push(s((a=g.data.get(p))==null?void 0:a.value,this.columns[p]));i.push(h)}}return i}get groupedColumns(){return this.table.groupedColumns}get hasExpandableRows(){return!0}get isExpandAllAvailable(){return this.table.expandAll!==void 0}get isChartBuilderAvailable(){return!1}get isSelectDistinctAvailable(){return!1}get isReversible(){return!1}isFilterable(t){return this.getCachedFilterableColumnSet(this.columns,this.groupedColumns).has(t)}isColumnMovable(t){return t>=this.groupedColumns.length}isRowExpandable(t){var s;const n=this.row(t);return(s=n==null?void 0:n.hasChildren)!=null?s:!1}isRowExpanded(t){var s;const n=this.row(t);return(s=n==null?void 0:n.isExpanded)!=null?s:!1}setRowExpanded(t,n,s=!1){this.isExpandAllAvailable?this.table.setExpanded(t,n,s):this.table.setExpanded(t,n)}expandAll(){this.table.expandAll&&this.table.expandAll()}collapseAll(){this.table.collapseAll&&this.table.collapseAll()}depthForRow(t){var s;const n=this.row(t);return((s=n==null?void 0:n.depth)!=null?s:1)-1}}const Fn=ie.module("IrisGridProxyModel");function Ri(e,t,n){return I.isTreeTable(e)?new Vg(e,t):new Hg(e,t,n)}class Ug extends ce{constructor(t,n=new zt,s=null){super(),this.textForCell=(...i)=>this.model.textForCell(...i),this.truncationCharForCell=(...i)=>this.model.truncationCharForCell(...i),this.textAlignForCell=(...i)=>this.model.textAlignForCell(...i),this.colorForCell=(...i)=>this.model.colorForCell(...i),this.backgroundColorForCell=(...i)=>this.model.backgroundColorForCell(...i),this.textForColumnHeader=(...i)=>this.model.textForColumnHeader(...i),this.colorForColumnHeader=(...i)=>this.model.colorForColumnHeader(...i),this.textForRowHeader=(...i)=>this.model.textForRowHeader(...i),this.textForRowFooter=(...i)=>this.model.textForRowFooter(...i),this.isRowMovable=(...i)=>this.model.isRowMovable(...i),this.isColumnMovable=(...i)=>this.model.isColumnMovable(...i),this.isRowExpandable=(...i)=>Ae(this.model)?this.model.isRowExpandable(...i):!1,this.isRowExpanded=(...i)=>Ae(this.model)?this.model.isRowExpanded(...i):!1,this.setRowExpanded=(...i)=>{if(Ae(this.model))return this.model.setRowExpanded(...i);throw Error("Function setRowExpanded does not exist on IrisGridTableModel")},this.expandAll=()=>{if(Ae(this.model))return this.model.expandAll();throw Error("Function expandAll does not exist on IrisGridTableModel")},this.collapseAll=()=>{if(Ae(this.model))return this.model.collapseAll();throw Error("Function collapseAll does not exist on IrisGridTableModel")},this.depthForRow=(...i)=>Ae(this.model)?this.model.depthForRow(...i):0,this.getColumnHeaderGroup=(...i)=>this.model.getColumnHeaderGroup(...i),this.getColumnHeaderParentGroup=(...i)=>this.model.getColumnHeaderParentGroup(...i),this.formatForCell=(...i)=>this.model.formatForCell(...i),this.valueForCell=(...i)=>this.model.valueForCell(...i),this.displayString=(...i)=>this.model.displayString(...i),this.isEditableRange=(...i)=>ke(this.model)?this.model.isEditableRange(...i):!1,this.isFilterable=(...i)=>this.model.isFilterable(...i),this.setViewport=(i,r,l)=>this.model.setViewport(i,r,l),this.snapshot=(...i)=>this.model.snapshot(...i),this.textSnapshot=(...i)=>this.model.textSnapshot(...i),this.valuesTable=(...i)=>this.model.valuesTable(...i),this.editValueForCell=(...i)=>ke(this.model)?this.model.editValueForCell(...i):"",this.setValueForCell=(...i)=>ke(this.model)?this.model.setValueForCell(...i):Promise.reject(new Error("Model is not editable")),this.setValueForRanges=(...i)=>ke(this.model)?this.model.setValueForRanges(...i):Promise.reject(new Error("Model is not editable")),this.setValues=(...i)=>ke(this.model)?this.model.setValues(...i):Promise.resolve(),this.isValidForCell=(...i)=>ke(this.model)?this.model.isValidForCell(...i):!1,this.delete=(...i)=>this.model.delete(...i),this.commitPending=(...i)=>this.model.commitPending(...i),this.handleModelEvent=this.handleModelEvent.bind(this);const o=Ri(t,n,s);this.originalModel=o,this.model=o,this.modelPromise=null,this.rollup=null,this.selectDistinct=[]}close(){this.originalModel.close(),this.model!==this.originalModel&&this.model.close(),this.modelPromise!=null&&this.modelPromise.cancel()}handleModelEvent(t){Fn.debug2("handleModelEvent",t);const{detail:n,type:s}=t;this.dispatchEvent(new Me(s,{detail:n}))}setModel(t){Fn.debug("setModel",t);const n=this.model;n!==this.originalModel&&n.close(),this.model=t,this.listenerCount>0&&this.addListeners(t),this.dispatchEvent(new Me(ce.EVENT.COLUMNS_CHANGED,{detail:t.columns})),Ao(t)&&this.dispatchEvent(new Me(ce.EVENT.TABLE_CHANGED,{detail:t.table}))}setNextModel(t){Fn.debug2("setNextModel"),this.modelPromise&&this.modelPromise.cancel(),this.listenerCount>0&&this.removeListeners(this.model),this.modelPromise=Ge.makeCancelable(t,n=>n.close()),this.modelPromise.then(n=>{this.modelPromise=null,this.setModel(n)}).catch(n=>{if(Ge.isCanceled(n)){Fn.debug2("setNextModel cancelled");return}Fn.error("Unable to set next model",n),this.modelPromise=null,this.dispatchEvent(new Me(ce.EVENT.REQUEST_FAILED,{detail:n}))})}startListening(){super.startListening(),this.addListeners(this.model)}stopListening(){super.stopListening(),this.removeListeners(this.model)}addListeners(t){const n=Object.keys(ce.EVENT);for(let s=0;s<n.length;s+=1)t.addEventListener(n[s],this.handleModelEvent)}removeListeners(t){const n=Object.keys(ce.EVENT);for(let s=0;s<n.length;s+=1)t.removeEventListener(n[s],this.handleModelEvent)}get rowCount(){return this.model.rowCount}get columnCount(){return this.model.columnCount}get floatingTopRowCount(){return this.model.floatingTopRowCount}get floatingBottomRowCount(){return this.model.floatingBottomRowCount}get floatingLeftColumnCount(){return this.model.floatingLeftColumnCount}get floatingRightColumnCount(){return this.model.floatingRightColumnCount}isColumnFrozen(t){return this.model.isColumnFrozen(t)}get hasExpandableRows(){return Ae(this.model)?this.model.hasExpandableRows:!1}get isExpandAllAvailable(){var t;return Ae(this.model)&&(t=this.model.isExpandAllAvailable)!=null?t:!1}get isExportAvailable(){return this.model.isExportAvailable}get isColumnStatisticsAvailable(){return this.model.isColumnStatisticsAvailable}get isValuesTableAvailable(){return this.model.isValuesTableAvailable}get isCustomColumnsAvailable(){return this.model.isCustomColumnsAvailable&&!(this.isSelectDistinctAvailable&&this.selectDistinctColumns.length>0)}get isFormatColumnsAvailable(){return this.model.isFormatColumnsAvailable}get isChartBuilderAvailable(){return this.model.isChartBuilderAvailable}get isRollupAvailable(){return(this.originalModel.isRollupAvailable||this.rollup!=null)&&this.selectDistinct.length===0}get isSelectDistinctAvailable(){return(this.originalModel.isSelectDistinctAvailable||this.selectDistinct.length>0)&&this.rollup==null}get isTotalsAvailable(){return this.model.isTotalsAvailable}get isReversible(){return this.model.isReversible}get columns(){return this.model.columns}get initialMovedColumns(){return this.model.initialMovedColumns}get initialMovedRows(){return this.model.initialMovedRows}get layoutHints(){return this.model.layoutHints}get frontColumns(){return this.model.frontColumns}get backColumns(){return this.model.backColumns}get frozenColumns(){return this.model.frozenColumns}get columnHeaderGroups(){return this.model.columnHeaderGroups}set columnHeaderGroups(t){this.model.columnHeaderGroups=t}get initialColumnHeaderGroups(){return this.model.initialColumnHeaderGroups}get columnHeaderGroupMap(){return this.model.columnHeaderGroupMap}get columnHeaderMaxDepth(){return this.model.columnHeaderMaxDepth}updateFrozenColumns(t){return this.model.updateFrozenColumns(t)}get originalColumns(){return this.originalModel.columns}get groupedColumns(){return this.model.groupedColumns}get description(){return this.model.description}get filter(){return this.model.filter}set filter(t){this.model.filter=t}get formatter(){return this.model.formatter}set formatter(t){this.model.formatter=t}get sort(){return this.model.sort}set sort(t){this.model.sort=t}get customColumns(){return this.model.customColumns}set customColumns(t){this.model.customColumns=t}get formatColumns(){return this.model.formatColumns}set formatColumns(t){this.model.formatColumns=t}get rollupConfig(){return this.rollup}set rollupConfig(t){if(Fn.debug("set rollupConfig",t),!this.isRollupAvailable)throw new Error("Rollup Rows are not available");if(rt(t,this.rollup))return;this.rollup=t;let n=Promise.resolve(this.originalModel);Ao(this.originalModel)&&t!=null&&(n=this.originalModel.table.rollup(t).then(s=>Ri(s,this.formatter))),this.setNextModel(n)}get selectDistinctColumns(){return this.selectDistinct}set selectDistinctColumns(t){if(Fn.debug("set selectDistinctColumns",t),!this.isSelectDistinctAvailable)throw new Error("Select distinct is not available");if(t===this.selectDistinctColumns||t.length===0&&this.selectDistinctColumns.length===0){Fn.debug("Ignore same selectDistinctColumns",t);return}this.selectDistinct=t;const n=t.map(o=>this.originalColumns.find(i=>i.name===o)).filter(o=>o!=null);let s=Promise.resolve(this.originalModel);Ao(this.originalModel)&&n.length>0&&(s=this.originalModel.table.selectDistinct(n).then(o=>Ri(o,this.formatter))),this.setNextModel(s)}get table(){if(Ao(this.model))return this.model.table}get totalsConfig(){return this.model.totalsConfig}set totalsConfig(t){this.model.totalsConfig=t}get isFilterRequired(){return this.model.isFilterRequired}get isEditable(){return ke(this.model)&&this.model.isEditable}export(){if(I.isTreeTable(this.model))throw new Error("TreeTable has no 'export' property");return this.model.export()}columnStatistics(t){if(I.isTreeTable(this.model))throw new Error("TreeTable has no 'columnStatistics' function");return this.model.columnStatistics(t)}get pendingDataMap(){return this.model.pendingDataMap}set pendingDataMap(t){this.model.pendingDataMap=t}get pendingRowCount(){return this.model.pendingRowCount}set pendingRowCount(t){this.model.pendingRowCount=t}get pendingDataErrors(){return this.model.pendingDataErrors}getColumnIndexByName(t){return this.model.getColumnIndexByName(t)}async seekRow(t,n,s,o,i,r,l){return this.model.seekRow(t,n,s,o,i,r,l)}get isSeekRowAvailable(){return this.model.isSeekRowAvailable}}class Bg{static async makeModel(t,n=new zt){let s=null;return!I.isTreeTable(t)&&t.hasInputTable&&(s=await t.inputTable()),new Ug(t,n,s)}}const en=ie.module("TableViewportUpdater"),Gg=150,$s=class extends F.exports.PureComponent{constructor(){super(...arguments),this.getViewportRowRange=Re((e,t,n)=>{const s=n-t,o=Math.max(0,t-s*$s.ROW_BUFFER_PAGES),i=n+s*$s.ROW_BUFFER_PAGES;return[o,i]}),this.getViewportColumns=Re((e,t,n,s)=>{if(t==null||n==null)return null;const o=n-t,i=Math.max(0,t-o*$s.COLUMN_BUFFER_PAGES),r=Math.min(n+o*$s.COLUMN_BUFFER_PAGES,e.columns.length-1),l=[];for(let a=i;a<=r;a+=1){const c=H.getModelIndex(a,s);l.push(e.columns[c])}return l}),this.updateViewport=Pn((e,t,n,s,o)=>{if(t<e){en.error("Invalid viewport",e,t);return}if(e===0&&t===0){en.debug2("Ignoring 0-0 viewport");return}const{movedColumns:i,table:r}=this.props,[l,a]=this.getViewportRowRange(r,e,t),c=o!=null?o:this.getViewportColumns(r,n,s,i);if(en.debug2("Setting Viewport Top:",l,"Bottom:",a,"Columns:",c),this.subscription==null){en.debug2("updateViewport creating new subscription"),this.subscription=r.setViewport(l,a,c);const{onSubscription:d}=this.props;d(this.subscription)}else en.debug2("updateViewport using existing subscription"),this.subscription.setViewport(l,a,c)},Gg)}componentDidMount(){const{top:e,bottom:t,left:n,right:s,table:o,filters:i,sorts:r,columns:l,customColumns:a}=this.props;o.applyFilter(i),o.applySort(r),o.applyCustomColumns(a),this.updateViewport(e,t,n,s,l)}componentDidUpdate(e){const{top:t,bottom:n,left:s,right:o,table:i,filters:r,sorts:l,customColumns:a,columns:c}=this.props,d=r!==e.filters,u=l!==e.sorts,h=a!==e.customColumns,g=i!==e.table;(d||u||h||g)&&this.closeSubscription(),(d||g)&&(en.debug("update table filter",r),i.applyFilter(r)),(u||g)&&(en.debug("update table sort",l),i.applySort(l)),(h||g)&&(en.debug("update table custom columns",a),i.applyCustomColumns(a)),this.updateViewport(t,n,s,o,c)}componentWillUnmount(){this.closeSubscription()}closeSubscription(){if(en.debug2("closeSubscription",this.subscription),this.subscription){this.subscription.close(),this.subscription=void 0;const{onSubscription:e}=this.props;e()}this.updateViewport.cancel()}render(){return null}};let lr=$s;lr.ROW_BUFFER_PAGES=3;lr.COLUMN_BUFFER_PAGES=1;lr.defaultProps={top:0,bottom:0,left:null,right:null,columns:null,onSubscription:()=>{},filters:[],sorts:[],customColumns:[],movedColumns:[]};const gs=ie.module("TreeTableViewportUpdater"),Wg=150,ga=class extends F.exports.PureComponent{constructor(e){super(e),this.updateViewport=Pn((t,n)=>{if(n<t){gs.error("Invalid viewport",t,n);return}if(t===0&&n===0){gs.debug2("Ignoring 0-0 viewport");return}const{table:s,updateInterval:o}=this.props,i=n-t,r=Math.max(0,t-i*3),l=n+i*3+1;if(gs.debug2("Setting Viewport Top:",r,"Bottom:",l,s),!this.listenerCleanup){const{onViewportUpdate:a}=this.props;this.listenerCleanup=s.addEventListener(E.TreeTable.EVENT_UPDATED,a)}s.setViewport(r,l,void 0,o)},Wg),this.listenerCleanup=null}componentDidMount(){const{top:e,bottom:t,table:n,filters:s,sorts:o}=this.props;gs.debug("componentDidMount",this.props),n.applyFilter(s),n.applySort(o),this.updateViewport(e,t)}componentDidUpdate(e){const{top:t,bottom:n,table:s,filters:o,sorts:i}=this.props;o!==e.filters&&(gs.debug("update table filter",o),s.applyFilter(o)),i!==e.sorts&&(gs.debug("update table sort",i),s.applySort(i)),this.updateViewport(t,n)}componentWillUnmount(){this.updateViewport.cancel(),this.listenerCleanup&&this.listenerCleanup()}render(){return null}};let pa=ga;pa.UPDATE_INTERVAL=1e3;pa.defaultProps={top:0,bottom:0,onViewportUpdate:()=>{},filters:[],sorts:[],updateInterval:ga.UPDATE_INTERVAL};ie.setLogLevel(parseInt("2",10));const ws=ie.module("EmbedGrid.App"),$g=[E.VariableType.TABLE,E.VariableType.TREETABLE,E.VariableType.HIERARCHICALTABLE,E.VariableType.PANDAS];async function zg(e,t){ws.info(`Fetching table ${t}...`);const n=await Id(e,t);if(!$g.includes(n.type))throw new Error(`Unsupported type '${n.type}' for variable named '${t}'`);return await e.getObject(n)}function jg(){const[e,t]=F.exports.useState(),[n,s]=F.exports.useState(),[o,i]=F.exports.useState(),[r,l]=F.exports.useState(),[a,c]=F.exports.useState(!0),d=F.exports.useMemo(()=>new URLSearchParams(window.location.search),[]),u=d.get("canCopy")!=null,h=d.get("canDownloadCsv")!=null;F.exports.useEffect(function(){async function f(){try{const C=d.get("name");if(C==null)throw new Error("No name param provided");const w=new URL("/jsapi",`${window.location}`),S=`${w.protocol}//${w.host}`;ws.debug("Starting connection...");const T=new E.IdeConnection(S);ws.debug("Loading table",C,"...");const R=await zg(T,C);ws.debug("Creating model...");const b=await Bg.makeModel(R);t(b),ws.debug("Table successfully loaded!")}catch(C){ws.error("Unable to load table",C),s(`${C}`)}c(!1)}f()},[d]),F.exports.useEffect(function(){function f(C){const{command:w,value:S}=C.data;switch(w){case"filter":{const R=S.map(({name:b,value:v})=>{const D=e==null?void 0:e.columns.find(A=>A.name===b);if(D==null)throw new Error(`Could not find column named ${b}`);return{name:b,value:v,type:I.getNormalizedType(D.type)}});i(R);break}case"sort":{const R=S.map(({name:b,direction:v})=>{const D=e==null?void 0:e.columns.find(A=>A.name===b);if(D==null)throw new Error(`Could not find column named ${b}`);return v==="DESC"?D.sort().desc():D.sort().asc()});l(R);break}}}return window.addEventListener("message",f),()=>{window.removeEventListener("message",f)}},[e]);const g=e!=null;return y("div",{className:"App",children:[g&&m(Js,{canCopy:u,canDownloadCsv:h,model:e,inputFilters:o,sorts:r}),!g&&m(ml,{isLoaded:g,isLoading:a,errorMessage:n!=null?n:null}),m(Qc,{})]})}export{$g as SUPPORTED_TYPES,jg as default};
32
+ //# sourceMappingURL=App.0d475a5c.js.map