@deephaven/code-studio 1.10.2-lerna-v9.0 → 1.10.2

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.
Files changed (40) hide show
  1. package/build/assets/{AppRoot-Dsp0-nx9.js → AppRoot-BY4a1UaK.js} +6 -6
  2. package/build/assets/{AppRoot-Dsp0-nx9.js.map → AppRoot-BY4a1UaK.js.map} +1 -1
  3. package/build/assets/{Chart-P_gTGGZ1.js → Chart-DmqNQtr3.js} +2 -2
  4. package/build/assets/{Chart-P_gTGGZ1.js.map → Chart-DmqNQtr3.js.map} +1 -1
  5. package/build/assets/{ControlType-lgZLQmfY.js → ControlType-RBsIk8KS.js} +4 -4
  6. package/build/assets/{ControlType-lgZLQmfY.js.map → ControlType-RBsIk8KS.js.map} +1 -1
  7. package/build/assets/{FormatterUtils-C9ixv8yB.js → FormatterUtils-C3xgIs6_.js} +2 -2
  8. package/build/assets/{FormatterUtils-C9ixv8yB.js.map → FormatterUtils-C3xgIs6_.js.map} +1 -1
  9. package/build/assets/{Grid-DQPrZJGB.js → Grid-B7dO0Sbi.js} +2 -2
  10. package/build/assets/{Grid-DQPrZJGB.js.map → Grid-B7dO0Sbi.js.map} +1 -1
  11. package/build/assets/{GridTokenMouseHandler-X2JErABm.js → GridTokenMouseHandler-Ds5xKqrO.js} +2 -2
  12. package/build/assets/{GridTokenMouseHandler-X2JErABm.js.map → GridTokenMouseHandler-Ds5xKqrO.js.map} +1 -1
  13. package/build/assets/{IrisGrid-m82zJTmT.js → IrisGrid-CFqfz-_M.js} +2 -2
  14. package/build/assets/{IrisGrid-m82zJTmT.js.map → IrisGrid-CFqfz-_M.js.map} +1 -1
  15. package/build/assets/{IrisGridModel-BWX_u8pv.js → IrisGridModel-CfNBLna8.js} +3 -3
  16. package/build/assets/{IrisGridModel-BWX_u8pv.js.map → IrisGridModel-CfNBLna8.js.map} +1 -1
  17. package/build/assets/{IrisGridShortcuts-QN2zgZUQ.js → IrisGridShortcuts-Bw5ADLgT.js} +2 -2
  18. package/build/assets/{IrisGridShortcuts-QN2zgZUQ.js.map → IrisGridShortcuts-Bw5ADLgT.js.map} +1 -1
  19. package/build/assets/{IrisGridThemeProvider-DtrPDGfJ.js → IrisGridThemeProvider-CggmgZiA.js} +2 -2
  20. package/build/assets/{IrisGridThemeProvider-DtrPDGfJ.js.map → IrisGridThemeProvider-CggmgZiA.js.map} +1 -1
  21. package/build/assets/{LocalWorkspaceStorage-C6dxwi4z.js → LocalWorkspaceStorage-DXAI74vd.js} +2 -2
  22. package/build/assets/{LocalWorkspaceStorage-C6dxwi4z.js.map → LocalWorkspaceStorage-DXAI74vd.js.map} +1 -1
  23. package/build/assets/{MarkdownEditor-B4WFJDBT.js → MarkdownEditor-CjiUT8XD.js} +2 -2
  24. package/build/assets/{MarkdownEditor-B4WFJDBT.js.map → MarkdownEditor-CjiUT8XD.js.map} +1 -1
  25. package/build/assets/{MarkdownNotebook-Bw-fDcJ8.js → MarkdownNotebook-CsCP6Muy.js} +2 -2
  26. package/build/assets/{MarkdownNotebook-Bw-fDcJ8.js.map → MarkdownNotebook-CsCP6Muy.js.map} +1 -1
  27. package/build/assets/{MissingPartitionError-Cw7iLwy0.js → MissingPartitionError-DXkc6F4C.js} +2 -2
  28. package/build/assets/{MissingPartitionError-Cw7iLwy0.js.map → MissingPartitionError-DXkc6F4C.js.map} +1 -1
  29. package/build/assets/{MockChartModel-C5m_XRVw.js → MockChartModel-B0Gv2sr1.js} +2 -2
  30. package/build/assets/{MockChartModel-C5m_XRVw.js.map → MockChartModel-B0Gv2sr1.js.map} +1 -1
  31. package/build/assets/{StyleGuideRoot-DGm-hysw.js → StyleGuideRoot-BAYFLFTM.js} +2 -2
  32. package/build/assets/{StyleGuideRoot-DGm-hysw.js.map → StyleGuideRoot-BAYFLFTM.js.map} +1 -1
  33. package/build/assets/{index-LXmN419B.js → index-Bjvh6jhx.js} +4 -4
  34. package/build/assets/{index-LXmN419B.js.map → index-Bjvh6jhx.js.map} +1 -1
  35. package/build/assets/{index-CqIl8EDR.js → index-CVle8e1T.js} +2 -2
  36. package/build/assets/{index-CqIl8EDR.js.map → index-CVle8e1T.js.map} +1 -1
  37. package/build/assets/{index-DmVB6hX1.js → index-Cwc_E41j.js} +3 -3
  38. package/build/assets/{index-DmVB6hX1.js.map → index-Cwc_E41j.js.map} +1 -1
  39. package/build/index.html +2 -2
  40. package/package.json +31 -31
@@ -1,3 +1,3 @@
1
- import{r as v,I as s,K as W,ad as fi,H as sn,U as xe,M as z,L as on,a0 as dt,a1 as Q,bD as Me,bx as ja,by as Pa,bw as Ua,bA as Qn,av as Yt}from"./vendor-DVrAV4v1.js";import{L as ue,f as mn,a3 as Ft,e as U,g as gn,cf as Yn,W as ln,aO as Ma,aP as ka,c8 as Ci,c9 as dn,cg as Va,ch as Ga,ci as qn,aT as Ba,cj as Xn,ck as qt,bI as Zn,cl as Ha,aU as Wa,cm as $a,aK as Ka,cn as za,co as Qa,aX as Ya,br as qa,bm as Xa,M as Si,b as bi,cp as Za,cq as Ja,c as Ti,k as Ei,G as er,cr as tr,cs as nr,bZ as ir,aS as ar,ct as rr,w as sr,cu as or,cv as lr,cw as dr,t as ur,b2 as hr,cx as cr,bB as Xt,bM as mr}from"./index-DmVB6hX1.js";import{c as b,S as Ye,B as k,y as vn,P as be,O as it,dN as gr,v as ct,bm as pn,aR as yi,ae as wi,d7 as vr,as as Z,dj as Ee,U as Ni,Z as pr,t as ze,at as Fi,C as fr,du as Ai,X as Cr,b$ as Sr,T as ce,Q as br,a$ as Tr,F as Zt,av as Er,bF as yr,dO as wr}from"./ControlType-lgZLQmfY.js";import{o as Nr,p as Fr,q as Ar,s as Or,I as ee,g as _r,k as Tt,a as yt,f as xr,c as We,b as Rr,n as Ir,i as Dr}from"./MissingPartitionError-Cw7iLwy0.js";import{G as qe,d as Ce,e as un,I as fe}from"./IrisGridModel-BWX_u8pv.js";import{u as he,P as Lr,y as jr,F as Pr,Y as G,a4 as Ur,O as Mr,a1 as Pe,B as kr,Q as Vr,W as Gr,E as Br,G as Hr,R as Wr,L as $r,H as Kr,K as zr,Z as Qr,N as Yr,J as qr,a5 as Jt,a6 as Xr,A as Zr,v as Jr,$ as es,x as ts,a3 as ns,C as is,a2 as as,T as rs,M as ss}from"./IrisGridThemeProvider-DtrPDGfJ.js";import{S as os,o as _e,e as Oi,C as _i,b as ls,h as ds,P as Jn}from"./GridTokenMouseHandler-X2JErABm.js";import{I as ke,m as ei,S as us,D as hs}from"./IrisGridShortcuts-QN2zgZUQ.js";import{K as At,G as cs}from"./Grid-DQPrZJGB.js";import{F as ti}from"./FormatterUtils-C9ixv8yB.js";import"./helpers-BosuxZz1.js";import"./monaco-DaE0jI-i.js";import"./useMergeRef-8Wi3k_Y6.js";function ni(i,e,t){return(e=ms(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ms(i){var e=gs(i,"string");return typeof e=="symbol"?e:e+""}function gs(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var Ct=ue.module("AdvancedFilterCreatorFilterItem");class fn extends v.PureComponent{static getLabelForFilter(e,t){try{if(b.isNumberType(e)||b.isCharType(e))return Nr(t);if(b.isTextType(e))return Fr(t);if(b.isDateType(e))return Ar(t);if(b.isBooleanType(e))return Or(t);throw new Error("Unrecognized column type: ".concat(e))}catch(n){return Ct.warn(n),""}}constructor(e){super(e),ni(this,"typeDropdown",void 0),ni(this,"getCachedIsValid",fi((r,o,l,d,u)=>{try{return!l||u.makeAdvancedValueFilter(r,o,l,d)!=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;var{value:t="",filterTypes:n,selectedType:a=n[0]}=e;this.state={selectedType:a,value:t}}componentDidMount(){var e;(e=this.typeDropdown)===null||e===void 0||e.focus()}componentDidUpdate(e){var{value:t,selectedType:n}=this.props;n!==void 0&&e.selectedType!==n&&this.setState({selectedType:n}),t!==void 0&&e.value!==t&&this.setState({value:t})}handleTypeChange(e){var t=e;Ct.debug2("typeChange",t),this.setState({selectedType:t});var{onChange:n}=this.props,{value:a}=this.state;a!=null&&a.length>0&&n(t,a)}handleValueChange(e){Ct.debug2("valueChange");var{value:t}=e.target;this.setState({value:t});var{onChange:n}=this.props,{selectedType:a}=this.state;a!=null&&n(a,t)}handleDelete(){Ct.debug("delete");var{onDelete:e}=this.props;e()}render(){for(var{column:e,filterTypes:t,formatter:n,tableUtils:a}=this.props,{selectedType:r,value:o}=this.state,l=!b.isBooleanType(e.type),d=[],u=this.getCachedIsValid(e,r,o,n.timeZone,a),h=0;h<t.length;h+=1){var m=t[h],c=fn.getLabelForFilter(e.type,m),g=s.jsx("option",{value:m,children:c},m);d.push(g)}return s.jsx("div",{className:"advanced-filter-creator-filter-item",children:s.jsxs("div",{className:"form-row",children:[s.jsx("div",{className:"form-group col",children:s.jsx(Ye,{className:"form-control",value:r,onChange:this.handleTypeChange,ref:p=>{this.typeDropdown=p},children:d})}),l&&s.jsx("div",{className:"form-group col",children:s.jsx("div",{className:"input-group",children:s.jsx("input",{type:"text",className:W("form-control",{error:!u}),placeholder:"Enter value",value:o,onChange:this.handleValueChange})})}),s.jsx("div",{className:"form-group col-1 px-0",children:s.jsx(k,{kind:"ghost",className:"w-100 h-100 p-0 m-0",onClick:this.handleDelete,icon:mn,tooltip:"Remove Filter"})})]})})}}function hn(i,e,t){return(e=vs(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function vs(i){var e=ps(i,"string");return typeof e=="symbol"?e:e+""}function ps(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var ii=ue.module("AdvancedFilterCreatorSelectValueList");class mt extends v.PureComponent{static indexOf(e,t){for(var n=0;n<t.length;n+=1){var a=t[n];if(a===e||a!=null&&a.valueOf!=null&&e!=null&&e.valueOf!=null&&a.valueOf()===e.valueOf())return n}return-1}constructor(e){super(e),hn(this,"dh",void 0),hn(this,"list",void 0),this.handleSelect=this.handleSelect.bind(this),this.handleViewportChange=this.handleViewportChange.bind(this),this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.handleTableUpdate=this.handleTableUpdate.bind(this);var{selectedValues:t,dh:n}=this.props;this.dh=n,this.list=null,this.state={itemCount:0,items:[],offset:0,selectedValues:t,isLoading:!0}}componentDidMount(){var{table:e}=this.props;e&&this.startListening(e)}componentDidUpdate(e){var{filters:t,invertSelection:n,selectedValues:a,table:r}=this.props;e.table!==r&&(e.table&&this.stopListening(e.table),r&&this.startListening(r),this.resetViewport()),e.invertSelection!==n&&this.setState({selectedValues:[]},this.handleSelectionUpdate),e.selectedValues!==a&&this.setState({selectedValues:a},this.handleSelectionUpdate),e.filters!==t&&(r==null||r.applyFilter(t),this.resetViewport())}componentWillUnmount(){var{table:e}=this.props;e&&this.stopListening(e)}handleSelect(e,t){var{invertSelection:n}=this.props,{selectedValues:a}=this.state;a=[...a];var r=mt.indexOf(t,a);r>=0?a.splice(r,1):a.push(t);var o=r<0;n&&(o=!o);var{offset:l}=this.state,{items:d}=this.state;d=[...d];var u=e-l;u>=0&&u<d.length&&(d[u].isSelected=o),this.setState({items:d,selectedValues:a});var{onChange:h}=this.props;h(a,n)}handleViewportChange(e,t){this.updateViewport(e,t)}handleSelectionUpdate(){this.updateItemSelection()}handleTableUpdate(e){var{table:t,formatter:n}=this.props;if(t){for(var a=e.detail,{offset:r}=a,o=[],l=t.columns[0],d=0;d<a.rows.length;d+=1){var u=a.rows[d],h=u.get(l),m=void 0;h==null?m=s.jsx("i",{className:"text-muted",children:"null"}):h===""?m=s.jsx("i",{className:"text-muted",children:"empty"}):m=n.getFormattedString(h,l.type,l.name);var c=this.isValueSelected(h);o.push({displayValue:m,value:h,isSelected:c})}ii.debug2("Received table update:",r,o.length);var g=t.size;this.setState({itemCount:g,items:o,offset:r,isLoading:!1})}}isValueSelected(e){var{invertSelection:t}=this.props,{selectedValues:n}=this.state,a=mt.indexOf(e,n);return t?a<0:a>=0}startListening(e){e.addEventListener(this.dh.Table.EVENT_UPDATED,this.handleTableUpdate)}stopListening(e){e.removeEventListener(this.dh.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(){var{items:e}=this.state;e=[...e];for(var t=0;t<e.length;t+=1){var n=e[t],{value:a}=n;n.isSelected=this.isValueSelected(a)}this.setState({items:e})}updateViewport(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,{table:a}=this.props;if(a!=null){n&&this.setState({isLoading:!0});var r=t-e+1,o=Math.max(0,e-r*3),l=Math.max(o,t+r*3);ii.debug2("Setting viewport",o,",",l),a.setViewport(o,l)}}render(){var{offset:e,isLoading:t,items:n,itemCount:a}=this.state;return s.jsxs("div",{className:"select-value-list-wrapper",children:[s.jsx(os,{itemCount:a,items:n,offset:e,onSelect:this.handleSelect,onViewportChange:this.handleViewportChange,ref:r=>{this.list=r}}),s.jsx(vn,{in:t,mountOnEnter:!0,unmountOnExit:!0,children:s.jsx("div",{className:"loading-list",children:s.jsx(Ft,{className:"loading-spinner-large"})})})]})}}hn(mt,"defaultProps",{invertSelection:!0,selectedValues:[],onChange:()=>{}});function ut(i,e,t){return(e=fs(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function fs(i){var e=Cs(i,"string");return typeof e=="symbol"?e:e+""}function Cs(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class vt extends v.PureComponent{constructor(e){super(e),ut(this,"searchTablePromise",void 0),ut(this,"tableUtils",void 0),ut(this,"updateFilterTimer",void 0),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);var{dh:t,invertSelection:n,selectedValues:a}=e;this.tableUtils=new b(t),this.state={filters:[],invertSelection:n,selectedValues:a,searchText:""}}componentDidMount(){this.initSearchTable()}componentDidUpdate(e,t){var{invertSelection:n,selectedValues:a,table:r}=this.props;e.table!==r&&this.initSearchTable(),e.invertSelection!==n&&this.setState({invertSelection:n}),e.selectedValues!==a&&this.setState({selectedValues:a});var{table:o,searchText:l}=this.state;o!==t.table&&(t.table!=null&&t.table.close(),o!=null&&this.startUpdateFilterTimer()),l!==t.searchText&&this.startUpdateFilterTimer()}componentWillUnmount(){var{table:e}=this.state;e!=null&&e.close(),this.searchTablePromise=void 0,this.stopUpdateFilterTimer()}getColumnName(){var{table:e}=this.props;return e!=null?e.columns[0].name:""}getDisplayedValuesCount(){var{invertSelection:e,selectedValues:t,table:n}=this.state;return n==null?null:e?n.totalSize-t.length:t.length}getDisplayedValueText(){var e=this.getDisplayedValuesCount(),{table:t}=this.state,{formatter:n}=this.props;if(e!=null&&t!=null){var a=n.getFormattedString(e,"long"),r=n.getFormattedString(t.totalSize,"long"),o="";return e<1e6&&(o="Displaying "),"".concat(o).concat(a," of ").concat(r)}return null}initSearchTable(){var{table:e}=this.props;if(e!=null){var 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});var{onChange:n}=this.props;n(e,t)}handleSearchChange(e){var 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){var t=[];this.setState({invertSelection:e,selectedValues:t});var{onChange:n}=this.props;n(t,e)}startUpdateFilterTimer(){this.stopUpdateFilterTimer(),this.updateFilterTimer=setTimeout(this.handleUpdateFilterTimeout,vt.searchDebounceTime)}stopUpdateFilterTimer(){this.updateFilterTimer!=null&&(clearTimeout(this.updateFilterTimer),this.updateFilterTimer=void 0)}updateTableFilter(){var{table:e,searchText:t}=this.state,{timeZone:n}=this.props,{tableUtils:a}=this,r=e==null?void 0:e.columns[0],o=[];if(r!=null){var l;if(t.length>0){var d=null;b.isCharType(r.type)?d=a.makeQuickFilter(r,t):b.isTextType(r.type)?d=a.makeQuickFilter(r,"~".concat(t),n):d=a.makeQuickFilter(r,">=".concat(t),n),d!=null?o.push(d):l="Invalid search text"}this.setState({filters:o,error:l})}}render(){var{error:e,filters:t,invertSelection:n,selectedValues:a,searchText:r,table:o}=this.state,{dh:l,formatter:d,showSearch:u}=this.props,h=this.getColumnName(),m=this.getDisplayedValueText(),c=h?"Find ".concat(h,"..."):"";return s.jsxs("div",{className:"advanced-filter-creator-select-value",children:[s.jsxs("div",{className:u?"form-group":"",children:[s.jsx("label",{htmlFor:"advanced-filter-creator-select-value-input",children:"Select Values"}),u&&s.jsx("input",{type:"text",className:W("form-control",{"is-invalid":e!=null}),id:"advanced-filter-creator-select-value-input",placeholder:c,value:r,onChange:this.handleSearchChange})]}),s.jsx(mt,{dh:l,table:o,filters:t,invertSelection:n,selectedValues:a,formatter:d,onChange:this.handleListChange}),s.jsxs("div",{className:"advanced-filter-creator-select-meta-row",children:[s.jsxs("div",{children:[s.jsx(k,{kind:"ghost",onClick:this.handleSelectAllClick,children:"Select All"}),s.jsx(k,{kind:"ghost",onClick:this.handleClearAllClick,children:"Clear"})]}),s.jsx(vn,{in:m!=null,mountOnEnter:!0,unmountOnExit:!0,children:s.jsx("div",{className:"row-count-info",children:m})})]})]})}}ut(vt,"searchDebounceTime",250);ut(vt,"defaultProps",{invertSelection:!0,selectedValues:[],onChange:()=>{},showSearch:!0});function Qe(i,e,t){return(e=Ss(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Ss(i){var e=bs(i,"string");return typeof e=="symbol"?e:e+""}function bs(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var at=ue.module("AdvancedFilterCreator");class ye extends v.PureComponent{static makeFilterItem(){return{key:sn()}}constructor(e){var t,n;super(e),Qe(this,"focusTrapContainer",void 0),Qe(this,"debounceTimeout",void 0),Qe(this,"valuesTablePromise",void 0),Qe(this,"getFilterTypes",fi(g=>b.getFilterTypes(g))),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=xe.createRef();var{model:a,column:r,options:o}=e,{filterOperators:l,invertSelection:d,selectedValues:u}=o,h=(t=(n=o.filterItems)===null||n===void 0?void 0:n.map(g=>{var{selectedType:p,value:f}=g;return{selectedType:p,value:f,key:sn()}}))!==null&&t!==void 0?t:[];h.length===0&&h.push(ye.makeFilterItem()),l==null&&(l=[]),d==null&&(d=!0),u==null&&(u=[]);var m=a.getColumnIndexByName(r.name);U(m);var c=a.isColumnSortable(m);this.state={filterItems:h,filterOperators:l,invertSelection:d,selectedValues:u,valuesTableError:null,valuesTable:void 0,isSortable:c}}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(){var{model:e,column:t}=this.props;if(!e.isValuesTableAvailable){at.debug("No values table for this model, just ignore");return}this.valuesTablePromise=b.makeCancelableTablePromise(e.valuesTable(t)),this.valuesTablePromise.then(n=>{var a;if(!((a=n.columns[0].isSortable)!==null&&a!==void 0)||a){var r=n.columns[0].sort().asc();n.applySort([r])}this.setState({valuesTable:n})}).catch(n=>{be.isCanceled(n)||(at.error("Unable to open values table",n),this.setState({valuesTableError:n}))})}handleFocusTrapEnd(){var e;((e=this.focusTrapContainer)===null||e===void 0||(e=e.current)===null||e===void 0?void 0:e.querySelector("button,select,input,textarea")).focus()}handleFocusTrapStart(){var e,t=(e=this.focusTrapContainer)===null||e===void 0||(e=e.current)===null||e===void 0?void 0:e.querySelectorAll("button,select,input,textarea");if(t&&t.length>0){var n=t[t.length-1];n.focus()}}handleAddAnd(){var{filterItems:e,filterOperators:t}=this.state;e=e.concat(ye.makeFilterItem()),t=t.concat(it.and),this.setState({filterItems:e,filterOperators:t})}handleAddOr(){var{filterItems:e,filterOperators:t}=this.state;e=e.concat(ye.makeFilterItem()),t=t.concat(it.or),this.setState({filterItems:e,filterOperators:t})}handleChangeFilterOperator(e,t){var{filterOperators:n}=this.state;n=[...n],gr(t),n[e]=t,this.setState({filterOperators:n}),this.startUpdateTimer()}handleFilterChange(e,t,n){var{filterItems:a}=this.state;a=[...a];var{key:r}=a[e];a[e]={key:r,selectedType:t,value:n},this.setState({filterItems:a}),this.startUpdateTimer()}handleFilterDelete(e){var{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(ye.makeFilterItem()),this.setState({filterItems:t,filterOperators:n}),this.startUpdateTimer()}handleSelectValueChange(e,t){this.setState({selectedValues:e,invertSelection:t}),this.startUpdateTimer()}handleReset(){at.debug("Resetting Advanced Filter"),this.setState({filterItems:[ye.makeFilterItem()],filterOperators:[],selectedValues:[],invertSelection:!0}),this.startUpdateTimer()}handleSortDown(e){var t=ct.isModifierKeyDown(e);this.sortTable(b.sortDirection.descending,t)}handleSortUp(e){var t=ct.isModifierKeyDown(e);this.sortTable(b.sortDirection.ascending,t)}handleSubmit(e){at.debug("Submitting Advanced Filter"),this.stopUpdateTimer(),this.sendUpdate(),e.preventDefault()}handleDone(e){at.debug("Submitting and Closing Advanced Filter"),this.stopUpdateTimer(),this.sendUpdate();var{onDone:t}=this.props;t(),e.preventDefault()}handleUpdateTimeout(){this.debounceTimeout=void 0,this.sendUpdate()}shouldShowAddFilter(){var{filterItems:e}=this.state;if(e.length===0)return!1;var t=e[e.length-1],{selectedType:n,value:a}=t;return n!=null&&n.length>0&&a!=null&&a.length>0}sortTable(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{column:n,onSortChange:a}=this.props,{isSortable:r}=this.state;r&&a(n,e,t)}startUpdateTimer(){this.stopUpdateTimer(),this.debounceTimeout=setTimeout(this.handleUpdateTimeout,ye.debounceFilterUpdate)}stopUpdateTimer(){this.debounceTimeout!==void 0&&(clearTimeout(this.debounceTimeout),this.debounceTimeout=void 0)}sendUpdate(){var{filterItems:e,filterOperators:t,invertSelection:n,selectedValues:a}=this.state,{column:r,onFilterChange:o,model:l,tableUtils:d}=this.props,{formatter:u}=l,h=e.filter(p=>{var{selectedType:f,value:y}=p;return f!=null&&y!=null&&y!==""}),m=t.filter((p,f)=>p!=null&&e[f].selectedType!=null&&e[f].value!=null&&e[f].value!=="").slice(0,h.length-1),c={filterItems:h,filterOperators:m,invertSelection:n,selectedValues:a},g=d.makeAdvancedFilter(r,c,u.timeZone);o(r,g,c)}render(){var e=this,{column:t,model:n,sortDirection:a,formatter:r,tableUtils:o}=this.props,{filterItems:l,filterOperators:d,invertSelection:u,selectedValues:h,valuesTable:m,valuesTableError:c,isSortable:g}=this.state,{dh:p,isValuesTableAvailable:f}=n,y=b.isBooleanType(t.type),F=b.isDateType(t.type),T=this.getFilterTypes(t.type),C=t.type.substring(t.type.lastIndexOf(".")+1),_=[];if(!y&&T.length)for(var E=function(Y){var re=l[Y],{key:K,selectedType:me,value:Ne}=re,ge=s.jsx(fn,{column:t,filterTypes:T,onChange:e.getFilterChangeHandler(Y),onDelete:e.getFilterDeleteHandler(Y),selectedType:me,value:Ne,formatter:r,tableUtils:o},K);if(_.push(ge),Y<d.length){var Te=d[Y],Fe=Te===it.and,Re=s.jsxs("div",{className:"form-row justify-content-end advanced-filter-creator-filter-operator",children:[s.jsx(k,{kind:"ghost",className:W("filter-operator",{active:Fe}),onClick:()=>e.handleChangeFilterOperator(Y,it.and),children:"AND"}),s.jsx(k,{kind:"ghost",className:W("filter-operator",{active:!Fe}),onClick:()=>e.handleChangeFilterOperator(Y,it.or),children:"OR"})]},"filterOperator".concat(K));_.push(Re)}},A=0;A<l.length;A+=1)E(A);var D=this.shouldShowAddFilter(),$=s.jsxs("div",{className:W("form-row justify-content-end add-filter-item",{hidden:!D}),children:[s.jsx("span",{className:"text-muted",children:s.jsx(z,{icon:gn})}),s.jsx(k,{kind:"ghost",className:"btn-filter-item",onClick:this.handleAddAnd,disabled:!D,tooltip:"Add filter with AND",children:"AND"}),s.jsx(k,{kind:"ghost",className:"btn-filter-item",onClick:this.handleAddOr,disabled:!D,tooltip:"Add filter with OR",children:"OR"})]},"addFilterItem");return _.push($),s.jsxs("div",{className:"advanced-filter-creator",role:"presentation",children:[s.jsx("div",{tabIndex:0,onFocus:this.handleFocusTrapStart}),s.jsxs("form",{onSubmit:this.handleSubmit,ref:this.focusTrapContainer,children:[s.jsxs("div",{className:"title-bar",children:[s.jsx("h6",{className:"advanced-filter-title",children:"Advanced Filters"}),s.jsxs("div",{className:"advanced-filter-menu-buttons",children:[s.jsx(k,{kind:"ghost",className:W("sort-operator",{active:a===b.sortDirection.descending}),onClick:this.handleSortDown,icon:Yn,tooltip:g?"Sort ".concat(t.name," Descending"):"Not sortable",disabled:!g}),s.jsx(k,{kind:"ghost",className:W("sort-operator",{active:a===b.sortDirection.ascending}),onClick:this.handleSortUp,icon:s.jsx(z,{icon:Yn,rotation:180}),tooltip:g?"Sort ".concat(t.name," Ascending"):"Not sortable",disabled:!g})]})]}),s.jsx("hr",{}),s.jsxs("div",{className:"advanced-filter-column-name",children:[t.name," ",s.jsxs("span",{className:"column-type",children:["(",C,")"]})]}),_,f&&c==null&&s.jsxs(s.Fragment,{children:[!y&&s.jsx("hr",{}),s.jsx("div",{className:"form-group",children:s.jsx(vt,{dh:p,table:m,onChange:this.handleSelectValueChange,invertSelection:u,selectedValues:h,formatter:r,showSearch:!F,timeZone:r.timeZone})})]}),s.jsxs("div",{className:"form-row justify-content-end",children:[s.jsx(k,{kind:"secondary",className:"mr-2",onClick:this.handleReset,children:"Reset"}),s.jsx(k,{kind:"primary",onClick:this.handleDone,children:"Done"})]})]}),s.jsx("div",{tabIndex:0,onFocus:this.handleFocusTrapEnd})]})}}Qe(ye,"debounceFilterUpdate",250);Qe(ye,"defaultProps",{options:{filterItems:null,filterOperators:null,invertSelection:!0,selectedValues:[]},sortDirection:null});function Ts(i,e){var t=ws(i);if(t!==void 0){var n=xs(i);return"".concat(n," ? ").concat(t," : ").concat(e)}}function Es(i,e){return i.Column.formatRowColor(e)}function ys(i,e){return i.formatColor(e)}var ht=ue.module("ConditionalFormattingUtils"),Se=function(i){return i.CONDITIONAL="conditional",i.ROWS="rows",i}({}),R=function(i){return i.IS_EQUAL="is-equal",i.IS_NOT_EQUAL="is-not-equal",i.IS_BETWEEN="is-between",i.GREATER_THAN="greater-than",i.GREATER_THAN_OR_EQUAL="greater-than-or-equal",i.LESS_THAN="less-than",i.LESS_THAN_OR_EQUAL="less-than-or-equal",i.IS_NULL="is-null",i.IS_NOT_NULL="is-not-null",i}({}),P=function(i){return i.IS_EXACTLY="is-exactly",i.IS_NOT_EXACTLY="is-not-exactly",i.CONTAINS="contains",i.DOES_NOT_CONTAIN="does-not-contain",i.STARTS_WITH="starts-with",i.ENDS_WITH="ends-with",i.IS_NULL="is-null",i.IS_NOT_NULL="is-not-null",i}({}),L=function(i){return i.IS_EXACTLY="is-exactly",i.IS_NOT_EXACTLY="is-not-exactly",i.IS_BEFORE="is-before",i.IS_BEFORE_OR_EQUAL="is-before-or-equal",i.IS_AFTER="is-after",i.IS_AFTER_OR_EQUAL="is-after-or-equal",i.IS_NULL="is-null",i.IS_NOT_NULL="is-not-null",i}({}),oe=function(i){return i.IS_TRUE="is-true",i.IS_FALSE="is-false",i.IS_NULL="is-null",i.IS_NOT_NULL="is-not-null",i}({}),ie=function(i){return i.IS_EQUAL="is-equal",i.IS_NOT_EQUAL="is-not-equal",i.IS_NULL="is-null",i.IS_NOT_NULL="is-not-null",i}({}),M=function(i){return i.NO_FORMATTING="no-formatting",i.POSITIVE="positive",i.NEGATIVE="negative",i.WARN="warn",i.NEUTRAL="neutral",i.ACCENT_1="accent-1",i.ACCENT_2="accent-2",i.CUSTOM="custom",i}({});function ai(i){switch(i){case M.NO_FORMATTING:return"No formatting";case M.POSITIVE:return"Positive";case M.NEGATIVE:return"Negative";case M.WARN:return"Warn";case M.NEUTRAL:return"Neutral";case M.ACCENT_1:return"Accent 1";case M.ACCENT_2:return"Accent 2";case M.CUSTOM:return"Custom..."}}function wt(i){var{type:e,customConfig:t}=i;switch(e){case M.NO_FORMATTING:return;case M.POSITIVE:return"#9fde6f";case M.NEGATIVE:return"#ff6087";case M.WARN:return"#f67f40";case M.NEUTRAL:return"#ffd95c";case M.ACCENT_1:return"#78dce8";case M.ACCENT_2:return"#ab9bf5";case M.CUSTOM:return t==null?void 0:t.background;default:return}}function Nt(i){var{type:e,customConfig:t}=i;switch(e){case M.NO_FORMATTING:return;case M.POSITIVE:return"#526a3f";case M.NEGATIVE:return"#802f44";case M.WARN:return"#663318";case M.NEUTRAL:return"#63562b";case M.ACCENT_1:return"#3f6469";case M.ACCENT_2:return"#554d72";case M.CUSTOM:return t==null?void 0:t.color;default:return}}function ws(i){var e=Nt(i.style),t=wt(i.style);if(!(e===void 0||t===void 0))return"bgfg(`".concat(t,"`, `").concat(e,"`)")}function Ns(i){var{column:e,value:t,start:n,end:a}=i;return Gs(e.name,i.condition,t,n,a)}function Fs(i){var{column:e,value:t}=i;return Bs(e.name,i.condition,t)}function As(i){var{column:e,value:t}=i;return Hs(e.name,i.condition,t)}function Os(i){var{column:e}=i;return Ws(e.name,i.condition)}function _s(i){var{column:e,value:t}=i;return $s(e.name,i.condition,t)}function xs(i){var{column:e}=i;if(b.isNumberType(e.type))return Ns(i);if(b.isCharType(e.type))return _s(i);if(b.isStringType(e.type))return Fs(i);if(b.isDateType(e.type))return As(i);if(b.isBooleanType(e.type))return Os(i);throw new Error("Invalid column type")}function Rs(i){switch(i){case R.IS_EQUAL:return"is equal to";case R.IS_NOT_EQUAL:return"is not equal to";case R.IS_BETWEEN:return"is between";case R.GREATER_THAN:return"greater than";case R.GREATER_THAN_OR_EQUAL:return"greater than or equal to";case R.LESS_THAN:return"less than";case R.LESS_THAN_OR_EQUAL:return"less than or equal to";case R.IS_NULL:return"is null";case R.IS_NOT_NULL:return"is not null"}}function Is(i){switch(i){case P.IS_EXACTLY:return"is exactly";case P.IS_NOT_EXACTLY:return"is not exactly";case P.CONTAINS:return"contains";case P.DOES_NOT_CONTAIN:return"does not contain";case P.STARTS_WITH:return"starts with";case P.ENDS_WITH:return"ends with";case P.IS_NULL:return"is null";case P.IS_NOT_NULL:return"is not null"}}function Ds(i){switch(i){case L.IS_EXACTLY:return"is";case L.IS_NOT_EXACTLY:return"is not";case L.IS_BEFORE:return"is before";case L.IS_BEFORE_OR_EQUAL:return"is before or equal";case L.IS_AFTER:return"is after";case L.IS_AFTER_OR_EQUAL:return"is after or equal";case L.IS_NULL:return"is null";case L.IS_NOT_NULL:return"is not null"}}function Ls(i){switch(i){case oe.IS_TRUE:return"is true";case oe.IS_FALSE:return"is false";case oe.IS_NULL:return"is null";case oe.IS_NOT_NULL:return"is not null"}}function js(i){switch(i){case ie.IS_EQUAL:return"is";case ie.IS_NOT_EQUAL:return"is not";case ie.IS_NULL:return"is null";case ie.IS_NOT_NULL:return"is not null"}}function xi(i){if(b.isNumberType(i))return R.IS_EQUAL;if(b.isCharType(i))return ie.IS_EQUAL;if(b.isStringType(i))return P.IS_EXACTLY;if(b.isDateType(i))return L.IS_EXACTLY;if(b.isBooleanType(i))return oe.IS_TRUE;throw new Error("Invalid column type")}function Ri(i){if(b.isCharType(i)||b.isStringType(i))return""}function Ii(i){var{condition:e,value:t,start:n,end:a}=i;return{condition:e,value:t,start:n,end:a}}function Ot(i){return{condition:xi(i),value:Ri(i),start:void 0,end:void 0}}function Di(){return{type:M.NO_FORMATTING}}function Ps(i){switch(i){case P.IS_EXACTLY:return"==";case P.IS_NOT_EXACTLY:return"!=";case P.CONTAINS:return"contains";case P.DOES_NOT_CONTAIN:return"does not contain";case P.STARTS_WITH:return"starts with";case P.ENDS_WITH:return"ends with";case P.IS_NULL:return"is null";case P.IS_NOT_NULL:return"is not null"}}function Us(i){switch(i){case L.IS_EXACTLY:return"==";case L.IS_NOT_EXACTLY:return"!=";case L.IS_BEFORE:return"<";case L.IS_BEFORE_OR_EQUAL:return"<=";case L.IS_AFTER:return">";case L.IS_AFTER_OR_EQUAL:return">=";case L.IS_NULL:return"is null";case L.IS_NOT_NULL:return"is not null"}}function Ms(i){switch(i){case oe.IS_TRUE:return"is true";case oe.IS_FALSE:return"is false";case oe.IS_NULL:return"is null";case oe.IS_NOT_NULL:return"is not null"}}function ks(i){switch(i){case ie.IS_EQUAL:return"==";case ie.IS_NOT_EQUAL:return"!=";case ie.IS_NULL:return"is null";case ie.IS_NOT_NULL:return"is not null"}}function Vs(i){switch(i){case R.IS_EQUAL:return"==";case R.IS_NOT_EQUAL:return"!=";case R.IS_BETWEEN:return"==";case R.GREATER_THAN:return">";case R.GREATER_THAN_OR_EQUAL:return">=";case R.LESS_THAN:return"<";case R.LESS_THAN_OR_EQUAL:return"<=";case R.IS_NULL:return"is null";case R.IS_NOT_NULL:return"is not null"}}function Gs(i,e,t,n,a){switch(e){case R.IS_EQUAL:return"".concat(i," == ").concat(t);case R.IS_NOT_EQUAL:return"".concat(i," != ").concat(t);case R.IS_BETWEEN:return"".concat(i," > ").concat(n," && ").concat(i," < ").concat(a);case R.GREATER_THAN:return"".concat(i," > ").concat(t);case R.GREATER_THAN_OR_EQUAL:return"".concat(i," >= ").concat(t);case R.LESS_THAN:return"".concat(i," < ").concat(t);case R.LESS_THAN_OR_EQUAL:return"".concat(i," <= ").concat(t);case R.IS_NULL:return"".concat(i," == null");case R.IS_NOT_NULL:return"".concat(i," != null")}}function Bs(i,e,t){switch(e){case P.IS_EXACTLY:return"".concat(i,' == "').concat(t,'"');case P.IS_NOT_EXACTLY:return"".concat(i,' != "').concat(t,'"');case P.CONTAINS:return"".concat(i," != null && ").concat(i,'.contains("').concat(t,'")');case P.DOES_NOT_CONTAIN:return"".concat(i," != null && !").concat(i,'.contains("').concat(t,'")');case P.STARTS_WITH:return"".concat(i," != null && ").concat(i,'.startsWith("').concat(t,'")');case P.ENDS_WITH:return"".concat(i," != null && ").concat(i,'.endsWith("').concat(t,'")');case P.IS_NULL:return"".concat(i," == null");case P.IS_NOT_NULL:return"".concat(i," != null")}}function Hs(i,e,t){switch(e){case L.IS_EXACTLY:return"".concat(i,' == convertDateTime("').concat(t,'")');case L.IS_NOT_EXACTLY:return"".concat(i," != convertDateTime(`").concat(t,"`)");case L.IS_BEFORE:return"".concat(i," < convertDateTime(`").concat(t,"`)");case L.IS_BEFORE_OR_EQUAL:return"".concat(i,' <= convertDateTime("').concat(t,'")');case L.IS_AFTER:return"".concat(i," > convertDateTime(`").concat(t,"`)");case L.IS_AFTER_OR_EQUAL:return"".concat(i," >= convertDateTime(`").concat(t,"`)");case L.IS_NULL:return"".concat(i," == null");case L.IS_NOT_NULL:return"".concat(i," != null")}}function Ws(i,e){switch(e){case oe.IS_TRUE:return"".concat(i," == true");case oe.IS_FALSE:return"".concat(i," == false");case oe.IS_NULL:return"".concat(i," == null");case oe.IS_NOT_NULL:return"".concat(i," != null")}}function $s(i,e,t){switch(e){case ie.IS_EQUAL:return"".concat(i," == '").concat(t,"'");case ie.IS_NOT_EQUAL:return"".concat(i," != '").concat(t,"'");case ie.IS_NULL:return"isNull(".concat(i,")");case ie.IS_NOT_NULL:return"!isNull(".concat(i,")")}}function Ks(i,e){if(b.isNumberType(i))return Vs(e);if(b.isCharType(i))return ks(e);if(b.isStringType(i))return Ps(e);if(b.isDateType(i))return Us(e);if(b.isBooleanType(i))return Ms(e);throw new Error("Invalid column type")}function zs(i,e,t){if(t===void 0)return ht.debug("no rules passed."),[];var n=[],a,r=new Map;return t.forEach(o=>{var l,{config:d,type:u}=o,{column:h}=d,m=e.find(F=>{var{name:T,type:C}=F;return T===h.name&&C===h.type});if(m===void 0){ht.debug("Column ".concat(h.name,":").concat(h.type," not found. Ignoring format rule."),d);return}var[c,g]=(l=u===Se.CONDITIONAL?r.get(m.name):a)!==null&&l!==void 0?l:["null",void 0],p=Ts(d,c);if(p===void 0){ht.debug("Ignoring format rule.",d);return}var f=g===void 0?-1:n.indexOf(g);f>-1&&n.splice(f,1);var y=u===Se.CONDITIONAL?ys(m,p):Es(i,p);n.push(y),u===Se.CONDITIONAL?r.set(m.name,[p,y]):a=[p,y]}),n}function Qs(i,e,t){switch(e){case L.IS_NULL:case L.IS_NOT_NULL:return!0;default:{var[n,...a]=(t??"").split(" "),r=a.join(" ");try{pn.parseDateTimeString(n)}catch{return ht.debug("Invalid datetime string",n),!1}try{i.i18n.TimeZone.getTimeZone(r)}catch{return ht.debug("Invalid timezone string",r),!1}return!0}}}function Ys(i){var{type:e}=i;return b.isNumberType(e)||b.isCharType(e)||b.isStringType(e)||b.isDateType(e)||b.isBooleanType(e)}function _t(i){var{animation:e="iris-grid-bottom-bar-slide-up",children:t,className:n,isShown:a,onClick:r,onEntering:o,onEntered:l,onExiting:d,onExited:u}=i,h=v.useRef(null);return s.jsx(on,{in:a,timeout:ln.transitionMs,classNames:e,onEntering:o,onEntered:l,onExiting:d,onExited:u,mountOnEnter:!0,unmountOnExit:!0,nodeRef:h,children:s.jsx("div",{ref:h,className:W("iris-grid-bottom-bar",n),role:"presentation",onClick:r,onKeyPress:r,children:t})})}var qs=3e3,Xs=5;function Zs(i){var{isSaving:e=!1,onSave:t,onDiscard:n,discardTooltip:a,saveTooltip:r,error:o,pendingDataErrors:l,pendingDataMap:d,onEntering:u,onEntered:h,onExiting:m,onExited:c}=i,[g,p]=v.useState(!1),[f,y]=v.useState(!1),F=v.useRef(),T=yi(e),C=v.useMemo(()=>l.size===0?o:l.size<=Xs?"Key can't be empty (on pending row".concat(l.size>1?"s":""," ").concat(Array.from(l.keys()).join(", ").trim(),")"):"Key can't be empty (on ".concat(l.size," rows)"),[o,l]);v.useEffect(function(){T!=null&&T&&!e&&C==null&&(p(!0),y(!0),F.current=setTimeout(()=>{p(!1)},qs))},[C,e,T]),v.useEffect(function(){F.current&&d.size>0&&(clearTimeout(F.current),p(!1),y(!1))},[d]),v.useEffect(function(){return()=>F.current?clearTimeout(F.current):void 0},[]);var _=d.size,E;return e?E=s.jsx(Ft,{className:"loading-spinner-vertical-align"}):f&&(E=ka),s.jsxs(_t,{className:"pending-data-bottom-bar",isShown:_>0||g||C!=null,onEntering:u,onEntered:h,onExiting:m,onExited:()=>{y(!1),c&&c()},children:[C!=null&&C!==""&&s.jsxs("div",{className:"error-message",children:[s.jsx(z,{icon:Ma}),s.jsx("span",{children:"".concat(C)})]}),(C==null||C==="")&&s.jsx("div",{className:"status-message",children:_>0&&s.jsx("span",{children:"".concat(_," row").concat(_>1?"s":""," pending")})}),s.jsxs("div",{className:"buttons-container",children:[!e&&!f&&s.jsx(k,{kind:"secondary",onClick:n,tooltip:a,children:"Discard"}),s.jsxs(k,{kind:f?"success":"primary",onClick:t,icon:E,disabled:e||f||C!=null,tooltip:r,children:[e&&"Committing...",!e&&f&&"Success",!e&&!f&&"Commit"]})]})]})}function ri(i,e,t,n,a,r,o){try{var l=i[r](o),d=l.value}catch(u){return void t(u)}l.done?e(d):Promise.resolve(d).then(n,a)}function en(i){return function(){var e=this,t=arguments;return new Promise(function(n,a){var r=i.apply(e,t);function o(d){ri(r,n,a,o,l,"next",d)}function l(d){ri(r,n,a,o,l,"throw",d)}o(void 0)})}}function De(i,e,t){return(e=Js(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Js(i){var e=eo(i,"string");return typeof e=="symbol"?e:e+""}function eo(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var de=ue.module("IrisGridCopyHandler");function to(i){return i.ranges!=null}function no(i){return i.columnIndex!=null}class j extends v.Component{static getStatusMessageText(e,t){switch(e){case j.COPY_STATES.CONFIRMATION_REQUIRED:return"Are you sure you want to copy ".concat(t.toLocaleString()," rows to your clipboard?");case j.COPY_STATES.CLICK_REQUIRED:return"Fetched ".concat(t.toLocaleString()," rows!");case j.COPY_STATES.FETCH_ERROR:return"Unable to copy data.";case j.COPY_STATES.FETCH_RANGES_IN_PROGRESS:return"Fetching ".concat(t.toLocaleString()," rows for clipboard...");case j.COPY_STATES.FETCH_HEADER_IN_PROGRESS:return"Fetching header for clipboard...";case j.COPY_STATES.DONE:return"Copied to Clipboard!";default:return""}}static getCopyButtonText(e){switch(e){case j.BUTTON_STATES.FETCH_IN_PROGRESS:return"Fetching";case j.BUTTON_STATES.CLICK_TO_COPY:return"Click to Copy";case j.BUTTON_STATES.RETRY:return"Retry";default:return"Copy"}}constructor(e){super(e),De(this,"textData",void 0),De(this,"hideTimer",void 0),De(this,"fetchPromise",void 0),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:j.COPY_STATES.IDLE,buttonState:j.BUTTON_STATES.COPY,isShown:!1,rowCount:0}}componentDidMount(){var{copyOperation:e}=this.props;e!=null&&this.startCopy()}componentDidUpdate(e){var{copyOperation:t}=this.props;e.copyOperation!==t&&this.startCopy()}componentWillUnmount(){this.stopCopy()}startCopy(){de.debug2("startCopy"),this.stopCopy();var{copyOperation:e}=this.props;if(e==null){de.debug2("No copy operation set, cancelling out"),this.setState({isShown:!1});return}var{error:t}=e;if(t!=null){de.debug("Showing copy error",t),this.setState({isShown:!0,copyState:j.COPY_STATES.DONE,error:t}),this.startHideTimer();return}if(this.setState({isShown:!0,error:void 0}),to(e)){var{ranges:n}=e,a=qe.rowCount(n);if(this.setState({rowCount:a}),a>j.NO_PROMPT_THRESHOLD){this.setState({buttonState:j.BUTTON_STATES.COPY,copyState:j.COPY_STATES.CONFIRMATION_REQUIRED});return}}this.startFetch()}stopCopy(){this.textData=void 0,this.stopFetch(),this.stopHideTimer()}handleBackgroundClick(){de.debug2("handleBackgroundClick");var{copyState:e}=this.state;e===j.COPY_STATES.DONE&&this.setState({isShown:!1})}handleCancelClick(){de.debug2("handleCancelClick"),this.stopFetch(),this.setState({isShown:!1})}handleCopyClick(){var e=this;return en(function*(){if(de.debug2("handleCopyClick"),e.textData!=null)try{yield e.copyText(e.textData),e.showCopyDone()}catch(t){de.error("Error copying text",t),e.setState({error:"Unable to copy. Verify your browser permissions."})}else e.startFetch()})()}handleHideTimeout(){de.debug2("handleHideTimeout"),this.stopHideTimer(),this.setState({isShown:!1})}copyText(e){var t=this;return en(function*(){de.debug2("copyText",e),t.textData=e,yield wi(e)})()}showCopyDone(){this.setState({copyState:j.COPY_STATES.DONE}),this.startHideTimer()}startFetch(){var e=this;return en(function*(){e.stopFetch();var{model:t,copyOperation:n}=e.props;if(no(n)){var{columnIndex:a,columnDepth:r,movedColumns:o}=n;de.debug("startFetch copyHeader",a,r),e.setState({buttonState:j.BUTTON_STATES.FETCH_IN_PROGRESS,copyState:j.COPY_STATES.FETCH_HEADER_IN_PROGRESS});var l=Ce.getModelIndex(a,o),d=t.textForColumnHeader(l,r);if(d===void 0){e.fetchPromise=void 0,e.setState({error:"Invalid column header selected.",copyState:j.COPY_STATES.DONE});return}e.fetchPromise=be.makeCancelable(d)}else{var{ranges:u,includeHeaders:h,userColumnWidths:m,movedColumns:c,formatValues:g}=n;de.debug("startFetch copyRanges",u),e.setState({buttonState:j.BUTTON_STATES.FETCH_IN_PROGRESS,copyState:j.COPY_STATES.FETCH_RANGES_IN_PROGRESS});var p=ee.getHiddenColumns(m),f=Ce.getModelRanges(u,c);if(p.length>0){var y=p.map(qe.makeColumn);f=qe.subtractRangesFromRanges(f,y)}var F=g!=null&&g?(C,_)=>t.displayString(C,_.type,_.name):C=>"".concat(C);e.fetchPromise=be.makeCancelable(t.textSnapshot(f,h,F))}try{var T=yield e.fetchPromise;e.fetchPromise=void 0;try{yield e.copyText(T),e.showCopyDone()}catch(C){de.error("Error copying text",C),e.setState({buttonState:j.BUTTON_STATES.CLICK_TO_COPY,copyState:j.COPY_STATES.CLICK_REQUIRED})}}catch(C){C instanceof vr?de.debug("User cancelled copy."):(de.error("Error fetching contents",C),e.fetchPromise=void 0,e.setState({buttonState:j.BUTTON_STATES.RETRY,copyState:j.COPY_STATES.FETCH_ERROR}))}})()}stopFetch(){this.fetchPromise&&(de.debug2("stopFetch"),this.fetchPromise.cancel(),this.fetchPromise=void 0)}startHideTimer(){this.stopHideTimer(),this.hideTimer=setTimeout(this.handleHideTimeout,j.HIDE_TIMEOUT)}stopHideTimer(){this.hideTimer!=null&&(clearTimeout(this.hideTimer),this.hideTimer=void 0)}render(){var{onEntering:e,onEntered:t,onExiting:n,onExited:a}=this.props,{buttonState:r,copyState:o,isShown:l,rowCount:d,error:u}=this.state,h=o===j.COPY_STATES.DONE?"fade":"copy-slide-up",m=j.getCopyButtonText(r),c=u??j.getStatusMessageText(o,d),g=o!==j.COPY_STATES.DONE,p=r===j.BUTTON_STATES.FETCH_IN_PROGRESS,f=o===j.COPY_STATES.DONE;return s.jsxs(_t,{animation:h,isShown:l,className:W("iris-grid-copy-handler",{"copy-done":f}),onClick:this.handleBackgroundClick,onEntering:e,onEntered:t,onExiting:n,onExited:a,children:[s.jsx("div",{className:"status-message",children:s.jsx("span",{children:c})}),s.jsx(vn,{in:g,mountOnEnter:!0,unmountOnExit:!0,children:s.jsxs("div",{className:"buttons-container",children:[s.jsx("button",{type:"button",className:"btn btn-outline-secondary btn-cancel",onClick:this.handleCancelClick,children:"Cancel"}),s.jsxs(k,{kind:p?"tertiary":"primary",className:W("btn-copy",{"btn-spinner":p}),onClick:this.handleCopyClick,disabled:p,children:[p&&s.jsx(Ft,{className:"loading-spinner-vertical-align"}),m]})]})})]})}}De(j,"NO_PROMPT_THRESHOLD",1e4);De(j,"HIDE_TIMEOUT",3e3);De(j,"COPY_STATES",{IDLE:"IDLE",CONFIRMATION_REQUIRED:"CONFIRMATION_REQUIRED",FETCH_RANGES_IN_PROGRESS:"FETCH_RANGES_IN_PROGRESS",FETCH_HEADER_IN_PROGRESS:"FETCH_HEADER_IN_PROGRESS",FETCH_ERROR:"FETCH_ERROR",CLICK_REQUIRED:"CLICK_REQUIRED",DONE:"DONE"});De(j,"BUTTON_STATES",{COPY:"COPY",FETCH_IN_PROGRESS:"FETCH_IN_PROGRESS",CLICK_TO_COPY:"CLICK_TO_COPY",RETRY:"RETRY"});De(j,"defaultProps",{copyOperation:null,onEntering:()=>{},onEntered:()=>{},onExiting:()=>{},onExited:()=>{}});function Et(i,e,t){return(e=io(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function io(i){var e=ao(i,"string");return typeof e=="symbol"?e:e+""}function ao(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Li extends v.PureComponent{constructor(e){super(e),Et(this,"inputField",void 0),Et(this,"initialValue",void 0),Et(this,"debouncedSendUpdate",void 0);var{debounceMs:t}=e;this.debouncedSendUpdate=dt(this.sendUpdate.bind(this),t),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;var{value:n}=e;this.initialValue=n,this.state={isChanged:!1,value:n}}componentDidMount(){var e;(e=this.inputField)===null||e===void 0||e.focus()}componentDidUpdate(e){var{debounceMs:t}=this.props;e.debounceMs!==t&&(this.debouncedSendUpdate.flush(),this.debouncedSendUpdate=dt(this.sendUpdate.bind(this),t))}componentWillUnmount(){this.debouncedSendUpdate.cancel()}setValue(e){this.initialValue=e,this.setState({value:e})}focus(){var e;(e=this.inputField)===null||e===void 0||e.focus()}handleChange(e){var{value:t}=e.target;this.setState({value:t,isChanged:!0}),this.debouncedSendUpdate(t)}handleCancel(){this.debouncedSendUpdate.cancel();var{initialValue:e}=this,{isChanged:t}=this.state;t&&this.sendUpdate(e);var{onDone:n}=this.props;n()}handleCommit(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;this.debouncedSendUpdate.flush();var{onDone:n}=this.props;n(e,t)}handleFocus(){var e;(e=this.inputField)===null||e===void 0||e.select()}handleBlur(e){var{relatedTarget:t}=e;t!=null&&t.classList.contains("context-menu-container")?this.handleCommit(!1,!0):t!=null&&t.classList.contains("advanced-filter-button")?this.handleCommit(!1,!1):this.handleCommit(!0,!0)}handleTab(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.debouncedSendUpdate.flush();var{onTab:t}=this.props;t(e)}handleKeyDown(e){switch(e.key){case"Escape":e.stopPropagation(),e.preventDefault(),this.handleCancel();break;case"Enter":e.stopPropagation(),e.preventDefault(),this.handleCommit();break;case"Tab":e.stopPropagation(),e.preventDefault(),this.handleTab(e.shiftKey);break}}handleContextMenu(e){var{onContextMenu:t}=this.props;t(e)}sendUpdate(e){var{onChange:t}=this.props;t(e)}render(){var{className:e,style:t,isAdvancedFilterSet:n,onAdvancedFiltersTriggered:a}=this.props,{value:r}=this.state;return s.jsxs("div",{style:t,className:"iris-grid-input-autosized-wrapper","data-value":r,children:[s.jsx("input",{ref:o=>{this.inputField=o},className:W("iris-grid-input-field",e),type:"text",value:r,onBlur:this.handleBlur,onFocus:this.handleFocus,onChange:this.handleChange,onKeyDown:this.handleKeyDown,onContextMenu:this.handleContextMenu,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false"}),s.jsx("div",{className:"advanced-filter-button-container",children:s.jsx(k,{kind:"ghost",className:W("btn-link-icon advanced-filter-button",{"filter-set":n}),onClick:a,onContextMenu:this.handleContextMenu,children:s.jsxs("div",{className:"fa-layers ",children:[s.jsx(z,{icon:Ci,className:"filter-solid"}),s.jsx(z,{icon:dn,className:"filter-light"})]})})})]})}}Et(Li,"defaultProps",{style:{},className:"",value:"",isAdvancedFilterSet:!1,onAdvancedFiltersTriggered:()=>{},onChange:()=>{},onDone:()=>{},onTab:()=>{},onContextMenu:()=>{},debounceMs:150});function ro(i,e,t){return(e=so(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function so(i){var e=oo(i,"string");return typeof e=="symbol"?e:e+""}function oo(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class lo extends At{constructor(e){super(),ro(this,"irisGrid",void 0),this.irisGrid=e,this.cursor=null}onDown(e,t){if(e.altKey&&!ct.isModifierKeyDown(e)&&!e.shiftKey){var{mouseX:n,mouseY:a}=t.state;if(n==null||a==null)return!1;var r=t.getGridPointFromXY(n,a);if(r.column!=null&&r.row!=null)return this.cursor=this.irisGrid.props.copyCursor,!0}return!1}onUp(e,t){return this.cursor===this.irisGrid.props.copyCursor?(this.cursor=null,!0):!1}}function uo(i,e,t){return(e=ho(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ho(i){var e=co(i,"string");return typeof e=="symbol"?e:e+""}function co(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class mo extends At{constructor(e){super(),uo(this,"irisGrid",void 0),this.irisGrid=e}onDown(e){var{selectedRanges:t}=this.irisGrid.state;return e.key==="c"&&ct.isModifierKeyDown(e)?(ee.isValidSnapshotRanges(t)?this.irisGrid.copyRanges(t):this.irisGrid.copyRanges(t,!1,!1,"Invalid copy ranges"),!0):!1}}function go(i,e,t){return(e=vo(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function vo(i){var e=po(i,"string");return typeof e=="symbol"?e:e+""}function po(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class fo extends At{constructor(e){super(),go(this,"irisGrid",void 0),this.irisGrid=e}onDown(e){if(ke.TABLE.REVERSE.matchesEvent(e)){if(!this.irisGrid.isReversible())return!1;var{reverse:t}=this.irisGrid.state;return this.irisGrid.reverse(!t),!0}return!1}}function Co(i,e,t){return(e=So(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function So(i){var e=bo(i,"string");return typeof e=="symbol"?e:e+""}function bo(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class To extends At{constructor(e){super(),Co(this,"irisGrid",void 0),this.irisGrid=e}onDown(e){return ke.TABLE.CLEAR_FILTERS.matchesEvent(e)?(this.irisGrid.clearAllFilters(),!0):!1}}var Eo=3e3;function yo(i){var{children:e=null,onEntering:t,onEntered:n,onExiting:a,onExited:r}=i,[o,l]=v.useState(!1),d=v.useRef(),u=yi(e),h=v.useCallback(()=>{l(!0),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{l(!1)},Eo)},[l,d]);return v.useEffect(()=>{u!==e&&e!=null&&h()},[e,u,l,h]),v.useEffect(()=>()=>d.current?clearTimeout(d.current):void 0,[]),s.jsx(_t,{className:"toast-bottom-bar",isShown:o,onEntering:t,onEntered:n,onExiting:a,onExited:r,children:e})}var wo=1;function ji(i){var{model:e,top:t,bottom:n,left:a,right:r,filter:o,formatter:l,columnAlignmentMap:d,reverse:u=!1,sorts:h,customColumns:m,movedColumns:c,hiddenColumns:g,alwaysFetchColumns:p,rollupConfig:f=null,totalsConfig:y=null,selectDistinctColumns:F=Z,pendingRowCount:T=0,pendingDataMap:C=Ee,frozenColumns:_,formatColumns:E,columnHeaderGroups:A,partitionConfig:D,showExtraGroupColumn:$}=i,{isTotalsAvailable:te,isRollupAvailable:Y}=e;he(()=>{_r(e)&&$!=null&&(e.showExtraGroupColumn=$)},[e,$]);var re=v.useMemo(()=>ee.getModelViewportColumns(e.columns,a,r,c,g,p,wo),[e.columns,a,r,c,g,p]);return he(function(){e.filter=o},[e,o]),he(function(){var me=[...h];u&&me.push(e.dh.Table.reverse()),e.sort=me},[e,h,u]),he(function(){e.formatter=l},[e,l]),he(function(){e.columnAlignmentMap=d},[e,d]),he(function(){e.isCustomColumnsAvailable&&(e.customColumns=m)},[e,m]),he(function(){e.isFormatColumnsAvailable&&(e.formatColumns=E)},[e,E]),he(function(){e.setViewport(t,n,re)},[e,t,n,re]),he(function(){Y&&(e.rollupConfig=f)},[e,Y,f]),he(function(){e.isSelectDistinctAvailable&&(e.selectDistinctColumns=F)},[e,F]),he(function(){te&&(e.totalsConfig=y)},[e,te,y]),he(function(){e.columnHeaderGroups=A},[e,A]),he(function(){D&&Tt(e)&&(e.partitionConfig=D)},[e,D]),v.useEffect(function(){_&&e.updateFrozenColumns(_)},[e,_]),v.useEffect(function(){e.pendingRowCount=T},[e,T]),v.useEffect(function(){e.pendingDataMap=C},[e,C]),null}ji.displayName="IrisGridModelUpdater";function Pi(i,e,t){return(e=No(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function No(i){var e=Fo(i,"string");return typeof e=="symbol"?e:e+""}function Fo(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var tn=ue.module("ColumnStatistics"),Ao={SIZE:"Number of Rows"};class gt extends v.Component{static getStatsLabel(e){var t;return(t=Ao[e])!==null&&t!==void 0?t:e.split(" ").map(n=>n[0].toUpperCase()+n.substr(1).toLowerCase()).join(" ")}constructor(e){super(e),Pi(this,"cancelablePromise",void 0),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}}componentDidMount(){this.maybeGenerateStatistics()}componentWillUnmount(){this.cancelablePromise&&this.cancelablePromise.cancel()}maybeGenerateStatistics(){var{column:e,model:t}=this.props,n=t.rowCount-t.pendingRowCount-t.floatingBottomRowCount-t.floatingTopRowCount;this.setState({numRows:n}),!t.isColumnStatisticsAvailable||e.isProxy===!0?this.setState({loading:!1}):n<gt.AUTO_GENERATE_LIMIT&&this.handleGenerateStatistics()}handleGenerateStatistics(){this.setState({loading:!0});var{column:e,model:t}=this.props;this.cancelablePromise=be.makeCancelable(t.columnStatistics(e)),this.cancelablePromise.then(this.handleStatistics).catch(this.handleError)}handleStatistics(e){tn.debug("Received statistics",e);var{model:t,onStatistics:n}=this.props,a=[];e.statisticsMap.forEach((r,o)=>{a.push({operation:gt.getStatsLabel(o),value:r,type:e.getType(o)})}),e.uniqueValues.forEach((r,o)=>{a.push({operation:o,className:"column-statistics-unique-value",value:r,type:"long"})}),this.setState({loading:!1,statistics:a,numRows:t.rowCount-t.pendingRowCount-t.floatingBottomRowCount-t.floatingTopRowCount}),n()}handleError(e){if(e!=null&&be.isCanceled(e)){tn.debug("Called handleError on a cancelled promise result");return}tn.error("Error generating statistics",e),this.setState({error:e,loading:!1,statistics:null})}render(){var e,{column:t,model:n}=this.props,{error:a,loading:r,statistics:o,numRows:l}=this.state,d=!r&&a==null&&o==null&&n.isColumnStatisticsAvailable,u=[],h=t.type.substring(t.type.lastIndexOf(".")+1),m=t.description===null?null:t.description;if(o!=null)for(var c=0;c<o.length;c+=1){var{operation:g,className:p,value:f,type:y}=o[c],F=y?n.displayString(f,y):n.displayString(f,t.type,t.name),T=s.jsxs(xe.Fragment,{children:[s.jsx("div",{className:W("column-statistic-operation",p),children:g}),s.jsx("div",{className:"column-statistic-value",children:F})]},g);u.push(T)}var C=un(n)&&n.hasExpandableRows?"Expanded Rows":"Number of Rows",_=n.displayString(l,"long"),E=n.getColumnIndexByName(t.name);return s.jsxs("div",{className:"column-statistics",children:[s.jsxs("div",{className:"column-statistics-title",children:[(e=t.displayName)!==null&&e!==void 0?e:t.name,s.jsxs("span",{className:"column-statistics-type",children:[" (",h,")"]}),s.jsx(Ni,{className:"column-statistics-copy",tooltip:"Copy column name",copy:t.name})]}),m!=null&&s.jsx("div",{className:"column-statistics-description",children:m}),E!=null&&!n.isColumnSortable(E)&&s.jsxs("div",{className:"column-statistics-status",children:[s.jsx(z,{icon:Va,className:"mr-1"}),"Not sortable"]}),E!=null&&!n.isColumnMovable(E)&&s.jsxs("div",{className:"column-statistics-status",children:[s.jsx(z,{icon:n.isColumnFrozen(E)?Ga:qn,className:"mr-1"}),n.isColumnFrozen(E)?"Frozen":"Not movable"]}),E!=null&&_e(n)&&n.isEditable&&!n.keyColumnSet.has(t.name)&&!n.valueColumnSet.has(t.name)&&s.jsxs("div",{className:"column-statistics-status",children:[s.jsx(z,{icon:qn,className:"mr-1"}),"Not editable"]}),s.jsxs("div",{className:"column-statistics-grid",children:[o==null&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"column-statistic-operation",children:C}),s.jsx("div",{className:"column-statistic-value",children:_})]}),u]}),d&&s.jsx(k,{kind:"ghost",className:"px-0",onClick:this.handleGenerateStatistics,children:"Generate Stats"}),a!=null&&s.jsx("div",{className:"error-message",children:"".concat(a)}),o&&!r&&s.jsx(k,{kind:"ghost",className:"px-0",onClick:this.handleGenerateStatistics,icon:Ba,children:"Refresh"}),r&&s.jsxs("div",{className:"column-statistics-loading",children:[s.jsx(Ft,{className:"loading-spinner-vertical-align"}),"Calculating Stats..."]})]})}}Pi(gt,"AUTO_GENERATE_LIMIT",1e5);function Oo(i,e,t){return(e=_o(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function _o(i){var e=xo(i,"string");return typeof e=="symbol"?e:e+""}function xo(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class St extends v.PureComponent{static createSearchFilter(e,t,n,a,r){var o=r?a.filter(u=>!n.includes(u.name)).map(u=>u.name):n;if(t&&o.length>0){var l=e.FilterValue.ofString(t),d=o.length===a.length?e.FilterCondition.search(l):e.FilterCondition.search(l,a.filter(u=>o.includes(u.name)).map(u=>u.filter()));return d}}constructor(e){super(e),Oo(this,"searchField",void 0),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=xe.createRef(),this.state={isConfigureColumnsShown:!1}}focus(){var e;(e=this.searchField.current)===null||e===void 0||e.focus()}handleSearchValueChange(e){var{onChange:t,selectedColumns:n,invertSelection:a}=this.props;t(e.target.value,n,a)}sendColumnChange(e,t){var{onChange:n,value:a}=this.props;n(a,e,t)}setInvertSelection(e){var{onChange:t,value:n}=this.props;t(n,[],e)}toggleColumn(e){var{selectedColumns:t,invertSelection:n}=this.props;if(t.includes(e))this.sendColumnChange(t.filter(r=>r!==e),n);else{var a=t.slice();a.push(e),this.sendColumnChange(a,n)}}selectAll(){this.setInvertSelection(!0)}clear(){this.setInvertSelection(!1)}selectNumbers(){var{columns:e}=this.props;this.sendColumnChange(e.filter(t=>b.isNumberType(t.type)).map(t=>t.name),!1)}render(){var{value:e,selectedColumns:t,invertSelection:n,columns:a}=this.props,{isConfigureColumnsShown:r}=this.state,o=t.length===0&&n===!0||t.length===a.length&&n===!1,l=t.length===0&&n===!1||t.length===a.length&&n===!0,d;return o?d=s.jsxs(s.Fragment,{children:[s.jsx(z,{icon:Zn,mask:qt,transform:"shrink-2 down-5 right-7"}),s.jsx(z,{icon:Ha,className:"text-primary",transform:"shrink-4 down-5 right-7"})]}):l?d=s.jsxs(s.Fragment,{children:[s.jsx(z,{icon:Wa,mask:qt,transform:"shrink-1 down-5 right-7"}),s.jsx(z,{icon:Xn,className:"text-danger",transform:"shrink-4 down-5 right-7"})]}):d=s.jsxs(s.Fragment,{children:[s.jsx(z,{icon:Zn,mask:qt,transform:"shrink-2 down-5 right-7"}),s.jsx(z,{icon:$a,className:"text-primary",transform:"shrink-4 down-5 right-7"})]}),s.jsxs("div",{className:"cross-column-container",children:[s.jsx(pr,{className:"cross-column-search",placeholder:"Search Data...","data-testid":"cross-column-search",value:e,onChange:this.handleSearchValueChange,ref:this.searchField}),s.jsxs("button",{type:"button",className:"btn btn-link btn-link-icon px-2",onClick:()=>{r?this.setState({isConfigureColumnsShown:!1}):this.setState({isConfigureColumnsShown:!0})},children:[s.jsx("div",{className:"fa-layers",children:d}),s.jsx(ze,{children:"Configure Columns"}),s.jsx(Fi,{isShown:r,className:"cross-column-popper",onExited:()=>{this.setState({isConfigureColumnsShown:!1})},closeOnBlur:!0,interactive:!0,children:s.jsxs("div",{className:"cross-column-popup",children:["Searched Columns",s.jsx("div",{className:"cross-column-scroll",children:a.map(u=>u.isProxy===!0?null:s.jsxs(xe.Fragment,{children:[s.jsx(fr,{className:"cross-column-checkbox",checked:n?!t.includes(u.name):t.includes(u.name),onChange:()=>this.toggleColumn(u.name),children:u.name}),u.type.substring(u.type.lastIndexOf(".")+1)]},u.name))}),s.jsxs("div",{className:"cross-column-button-bar",children:[s.jsx("button",{type:"button",className:"btn btn-link",onClick:this.selectAll,children:"Select All"}),s.jsx("button",{type:"button",className:"btn btn-link",onClick:this.clear,children:"Clear"}),s.jsx("button",{type:"button",className:"btn btn-link",onClick:this.selectNumbers,children:"Numbers Only"})]}),l&&s.jsxs("p",{className:"text-danger",children:[s.jsx(z,{icon:Xn})," Select at least one column to search."]})]})})]})]})}}function si(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(i,a).enumerable})),t.push.apply(t,n)}return t}function oi(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?si(Object(t),!0).forEach(function(n){lt(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):si(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function li(i,e,t,n,a,r,o){try{var l=i[r](o),d=l.value}catch(u){return void t(u)}l.done?e(d):Promise.resolve(d).then(n,a)}function bt(i){return function(){var e=this,t=arguments;return new Promise(function(n,a){var r=i.apply(e,t);function o(d){li(r,n,a,o,l,"next",d)}function l(d){li(r,n,a,o,l,"throw",d)}o(void 0)})}}function lt(i,e,t){return(e=Ro(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Ro(i){var e=Io(i,"string");return typeof e=="symbol"?e:e+""}function Io(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var $e=ue.module("IrisGridPartitionSelector");class Do extends v.Component{constructor(e){super(e),lt(this,"pending",void 0),lt(this,"tableUtils",void 0),lt(this,"getCachedChangeCallback",Q(n=>a=>this.handlePartitionSelect(n,a),{max:100})),lt(this,"getCachedFormatValueCallback",Q(n=>a=>this.getDisplayValue(n,a),{max:100})),this.handlePartitionTableClick=this.handlePartitionTableClick.bind(this),this.handleMergeClick=this.handleMergeClick.bind(this),this.handlePartitionSelect=this.handlePartitionSelect.bind(this);var{model:t}=e;this.tableUtils=new b(t.dh),this.pending=new Ai,this.state={isLoading:!0,baseTable:null,keysTable:null,partitionTables:null}}componentDidMount(){var e=this;return bt(function*(){var{model:t}=e.props;try{var n=yield e.pending.add(t.partitionKeysTable().then(r=>r),r=>r.close()),a=yield e.pending.add(t.partitionBaseTable(),r=>r.close());e.setState({keysTable:n,baseTable:a,isLoading:!1},e.updatePartitionOptions)}catch(r){if(!be.isCanceled(r))throw r}})()}componentDidUpdate(e){var{partitionConfig:t}=e,{partitionConfig:n}=this.props;t!==n&&this.updatePartitionOptions()}componentWillUnmount(){this.pending.cancel();var{keysTable:e,baseTable:t,partitionTables:n}=this.state;t==null||t.close(),e==null||e.close(),n==null||n.forEach(a=>a.close())}handlePartitionTableClick(){$e.debug2("handlePartitionTableClick");var{partitionConfig:e}=this.props;U(e);var t=oi({},e);t.mode=e.mode==="keys"?"partition":"keys",this.sendUpdate(t)}handleMergeClick(){$e.debug2("handleMergeClick");var{partitionConfig:e}=this.props;U(e);var t=oi({},e);t.mode=e.mode==="merged"?"partition":"merged",this.sendUpdate(t)}handlePartitionSelect(e,t){var n=this;return bt(function*(){var{partitionConfig:a}=n.props;U(a),$e.debug("handlePartitionSelect",e,t,a);var r=[...a.partitions];r[e]=t;var{baseTable:o}=n.state,{keysTable:l}=n.state;U(o),U(l);try{n.setState({isLoading:!0});var d=yield n.pending.add(o.copy(),c=>c.close()),u=r.slice(0,e+1).map((c,g)=>{var p=d.columns[g];return n.tableUtils.makeNullableEqFilter(p,c)});d.applyFilter(u),d.setViewport(0,0,d.columns);var h=yield n.pending.add(d.getViewportData()),m={partitions:l.columns.map(c=>h.rows[0].get(c)),mode:"partition"};d.close(),n.sendUpdate(m)}catch(c){be.isCanceled(c)||$e.error("Unable to get partition tables",c)}finally{n.setState({isLoading:!1})}})()}sendUpdate(e){$e.debug2("sendUpdate",e);var{onChange:t}=this.props;t(e)}getDisplayValue(e,t){var{model:n}=this.props;if(t===null)return"(null)";if(t===void 0||t==="")return"";var a=n.partitionColumns[e];return b.isCharType(a.type)&&t.toString().length>0?String.fromCharCode(parseInt(t.toString(),10)):n.displayString(t,a.type,a.name)}updatePartitionOptions(){var e=this;return bt(function*(){var{model:t}=e.props,{partitionConfig:n}=e.props;if(n!=null){var{keysTable:a}=e.state;U(a);var r=[...n.partitions].map((l,d)=>{var u=a.columns[d];return e.tableUtils.makeNullableEqFilter(u,l)}),o=yield Promise.all(t.partitionColumns.map(function(){var l=bt(function*(d,u){return a.applyFilter(r.slice(0,u)),a.selectDistinct(t.partitionColumns.slice(0,u+1))});return function(d,u){return l.apply(this,arguments)}}()));e.setState({partitionTables:o})}})()}getPartitionFilters(e){var{model:t,partitionConfig:n}=this.props;U(n);var{partitions:a}=n;if($e.debug("getPartitionFilters",n),a.length!==e.length)throw new Error("Invalid partition config set. Expected ".concat(e.length," partitions, but got ").concat(a.length));for(var r=[],o=0;o<a.length;o+=1)if(o===0)r.push([]);else{var l=r[o-1],d=a[o-1],u=t.partitionColumns[o-1],h=[...l,this.tableUtils.makeNullableEqFilter(u,d)];r.push(h)}return r}render(){var{model:e,partitionConfig:t}=this.props,{isLoading:n,partitionTables:a}=this.state,r=e.partitionColumns.map((o,l)=>s.jsxs("div",{className:"column-selector",children:[(a==null?void 0:a[l])&&s.jsx(Lr,{label:o.name,labelPosition:"side",table:a[l],direction:"bottom",shouldFlip:!1,keyColumn:a[l].columns[l].name,selectedKey:(t==null?void 0:t.mode)==="partition"?t.partitions[l]:null,placeholder:"Select a key",labelColumn:a[l].columns[l].name,onChange:this.getCachedChangeCallback(l),isDisabled:n||t==null}),e.partitionColumns.length-1===l||s.jsx(z,{icon:Ka})]},"selector-".concat(o.name)));return s.jsxs("div",{className:"iris-grid-partition-selector",children:[s.jsxs("div",{className:"partition-button-group",children:[s.jsx(k,{onClick:this.handlePartitionTableClick,kind:"inline",tooltip:e.isPartitionAwareSourceTable?"View keys as table":"View underlying partition table",icon:za,active:(t==null?void 0:t.mode)==="keys",disabled:n||t==null,children:"Partitions"}),s.jsx(k,{onClick:this.handleMergeClick,kind:"inline",tooltip:"View all partitions as one merged table",icon:s.jsx(z,{icon:Qa,rotation:90}),active:(t==null?void 0:t.mode)==="merged",disabled:n||t==null,children:e.isPartitionAwareSourceTable?"Coalesce":"Merge"})]}),r]})}}function Lo(i,e,t){return(e=jo(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function jo(i){var e=Po(i,"string");return typeof e=="symbol"?e:e+""}function Po(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var Uo=ue.module("SelectDistinctBuilder");class Ui extends v.Component{constructor(e){super(e),this.handleAddColumnClick=this.handleAddColumnClick.bind(this),this.handleDeleteColumn=this.handleDeleteColumn.bind(this),this.handleDropdownChanged=this.handleDropdownChanged.bind(this);var{model:t,selectDistinctColumns:n}=this.props;this.state={inputs:n.length>0?[...n]:[""],columns:t.originalColumns}}componentDidUpdate(e,t){var{inputs:n}=this.state,{onChange:a}=this.props;if(t.inputs!==n){var r=n.filter(o=>o!=="");Me(t.inputs.filter(o=>o!==""),r)||a(r)}}handleAddColumnClick(){this.setState(e=>{var{inputs:t}=e;return{inputs:[...t,""]}})}handleDeleteColumn(e){this.setState(t=>{var{inputs:n}=t;return{inputs:n.length===1&&e===0?[""]:n.filter((a,r)=>e!==r)}})}handleDropdownChanged(e,t){Uo.debug("handleDropdownChanged",e,t),this.setState(n=>{var{inputs:a}=n,r=[...a];return r[e]=t,{inputs:r}})}renderInputs(){var{columns:e,inputs:t}=this.state;return t.map((n,a)=>{var r=e.filter(o=>{var{name:l}=o;return l===n||!t.includes(l)}).map(o=>{var{name:l}=o;return s.jsx("option",{value:l,children:l},l)});return s.jsxs("div",{className:"form-inline px-3 pb-3",children:[s.jsxs(Ye,{className:"form-control custom-select col",value:n,onChange:o=>this.handleDropdownChanged(a,o),children:[s.jsx("option",{value:"",children:"Select a column"}),r]}),(t.length>1||n!=="")&&s.jsx(k,{kind:"ghost",className:"ml-1 px-2",onClick:()=>{this.handleDeleteColumn(a)},icon:s.jsx(z,{icon:mn,transform:"grow-3"}),tooltip:"Delete column"})]},a)})}render(){var{columns:e,inputs:t}=this.state,n=t.length>=e.length;return s.jsxs("div",{role:"presentation",className:"select-distinct-builder-container h-100",children:[s.jsx("div",{className:"select-distinct-title",children:"Display Unique Values From"}),this.renderInputs(),s.jsx("hr",{}),s.jsx("div",{className:"pt-1 px-3",children:s.jsx(k,{kind:"ghost",className:"btn-add-column",onClick:this.handleAddColumnClick,disabled:n,icon:gn,children:"Add Additional Column"})}),s.jsx("div",{className:"select-distinct-builder-footer",children:s.jsx("div",{className:"select-distinct-builder-hint",children:"Display only unique values from the selected table columns. Note that this will reset any filters and display only the selected columns."})})]})}}Lo(Ui,"defaultProps",{selectDistinctColumns:[],onChange:()=>{}});function Cn(i){var{items:e,onChange:t=()=>{}}=i;return s.jsx(Oi,{items:Array.from(e.entries()).map(n=>{var[a,r]=n;return{title:Cn.getAdvancedSettingsTitleForKey(a),isOn:r,onChange:o=>t(a,o)}})})}Cn.getAdvancedSettingsTitleForKey=i=>{switch(i){case yt.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS:return"Clear current table filters before applying new filters from a control";case yt.LINK_CHANGE_CLEARS_ALL_FILTERS:return"Clear current table filters before applying new filters from an incoming link filter"}};function di(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(i,a).enumerable})),t.push.apply(t,n)}return t}function Ke(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?di(Object(t),!0).forEach(function(n){Mo(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):di(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Mo(i,e,t){return(e=ko(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ko(i){var e=Vo(i,"string");return typeof e=="symbol"?e:e+""}function Vo(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var ui=ue.module("ConditionalFormattingMenu"),nn=()=>{};function Go(i){var{column:{type:e}}=i;if(b.isNumberType(e))return i.condition===R.IS_NULL||i.condition===R.IS_NOT_NULL?"":"".concat(i.value);if(b.isCharType(e))return i.condition===L.IS_NULL||i.condition===L.IS_NOT_NULL?"":"".concat(i.value);if(b.isStringType(e))return i.condition===P.IS_NULL||i.condition===P.IS_NOT_NULL?"":'"'.concat(i.value,'"');if(b.isDateType(e))return i.condition===L.IS_NULL||i.condition===L.IS_NOT_NULL?"":"".concat(i.value);if(b.isBooleanType(e))return"";throw new Error("Invalid column type ".concat(e," in getRuleValue"))}function Bo(i){return b.isNumberType(i.column.type)&&i.condition===R.IS_BETWEEN?"".concat(i.start," < ").concat(i.column.name," < ").concat(i.end):"".concat(i.column.name," ").concat(Ks(i.column.type,i.condition),`
1
+ import{r as v,I as s,K as W,ad as fi,H as sn,U as xe,M as z,L as on,a0 as dt,a1 as Q,bD as Me,bx as ja,by as Pa,bw as Ua,bA as Qn,av as Yt}from"./vendor-DVrAV4v1.js";import{L as ue,f as mn,a3 as Ft,e as U,g as gn,cf as Yn,W as ln,aO as Ma,aP as ka,c8 as Ci,c9 as dn,cg as Va,ch as Ga,ci as qn,aT as Ba,cj as Xn,ck as qt,bI as Zn,cl as Ha,aU as Wa,cm as $a,aK as Ka,cn as za,co as Qa,aX as Ya,br as qa,bm as Xa,M as Si,b as bi,cp as Za,cq as Ja,c as Ti,k as Ei,G as er,cr as tr,cs as nr,bZ as ir,aS as ar,ct as rr,w as sr,cu as or,cv as lr,cw as dr,t as ur,b2 as hr,cx as cr,bB as Xt,bM as mr}from"./index-Cwc_E41j.js";import{c as b,S as Ye,B as k,y as vn,P as be,O as it,dN as gr,v as ct,bm as pn,aR as yi,ae as wi,d7 as vr,as as Z,dj as Ee,U as Ni,Z as pr,t as ze,at as Fi,C as fr,du as Ai,X as Cr,b$ as Sr,T as ce,Q as br,a$ as Tr,F as Zt,av as Er,bF as yr,dO as wr}from"./ControlType-RBsIk8KS.js";import{o as Nr,p as Fr,q as Ar,s as Or,I as ee,g as _r,k as Tt,a as yt,f as xr,c as We,b as Rr,n as Ir,i as Dr}from"./MissingPartitionError-DXkc6F4C.js";import{G as qe,d as Ce,e as un,I as fe}from"./IrisGridModel-CfNBLna8.js";import{u as he,P as Lr,y as jr,F as Pr,Y as G,a4 as Ur,O as Mr,a1 as Pe,B as kr,Q as Vr,W as Gr,E as Br,G as Hr,R as Wr,L as $r,H as Kr,K as zr,Z as Qr,N as Yr,J as qr,a5 as Jt,a6 as Xr,A as Zr,v as Jr,$ as es,x as ts,a3 as ns,C as is,a2 as as,T as rs,M as ss}from"./IrisGridThemeProvider-CggmgZiA.js";import{S as os,o as _e,e as Oi,C as _i,b as ls,h as ds,P as Jn}from"./GridTokenMouseHandler-Ds5xKqrO.js";import{I as ke,m as ei,S as us,D as hs}from"./IrisGridShortcuts-Bw5ADLgT.js";import{K as At,G as cs}from"./Grid-B7dO0Sbi.js";import{F as ti}from"./FormatterUtils-C3xgIs6_.js";import"./helpers-BosuxZz1.js";import"./monaco-DaE0jI-i.js";import"./useMergeRef-8Wi3k_Y6.js";function ni(i,e,t){return(e=ms(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ms(i){var e=gs(i,"string");return typeof e=="symbol"?e:e+""}function gs(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var Ct=ue.module("AdvancedFilterCreatorFilterItem");class fn extends v.PureComponent{static getLabelForFilter(e,t){try{if(b.isNumberType(e)||b.isCharType(e))return Nr(t);if(b.isTextType(e))return Fr(t);if(b.isDateType(e))return Ar(t);if(b.isBooleanType(e))return Or(t);throw new Error("Unrecognized column type: ".concat(e))}catch(n){return Ct.warn(n),""}}constructor(e){super(e),ni(this,"typeDropdown",void 0),ni(this,"getCachedIsValid",fi((r,o,l,d,u)=>{try{return!l||u.makeAdvancedValueFilter(r,o,l,d)!=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;var{value:t="",filterTypes:n,selectedType:a=n[0]}=e;this.state={selectedType:a,value:t}}componentDidMount(){var e;(e=this.typeDropdown)===null||e===void 0||e.focus()}componentDidUpdate(e){var{value:t,selectedType:n}=this.props;n!==void 0&&e.selectedType!==n&&this.setState({selectedType:n}),t!==void 0&&e.value!==t&&this.setState({value:t})}handleTypeChange(e){var t=e;Ct.debug2("typeChange",t),this.setState({selectedType:t});var{onChange:n}=this.props,{value:a}=this.state;a!=null&&a.length>0&&n(t,a)}handleValueChange(e){Ct.debug2("valueChange");var{value:t}=e.target;this.setState({value:t});var{onChange:n}=this.props,{selectedType:a}=this.state;a!=null&&n(a,t)}handleDelete(){Ct.debug("delete");var{onDelete:e}=this.props;e()}render(){for(var{column:e,filterTypes:t,formatter:n,tableUtils:a}=this.props,{selectedType:r,value:o}=this.state,l=!b.isBooleanType(e.type),d=[],u=this.getCachedIsValid(e,r,o,n.timeZone,a),h=0;h<t.length;h+=1){var m=t[h],c=fn.getLabelForFilter(e.type,m),g=s.jsx("option",{value:m,children:c},m);d.push(g)}return s.jsx("div",{className:"advanced-filter-creator-filter-item",children:s.jsxs("div",{className:"form-row",children:[s.jsx("div",{className:"form-group col",children:s.jsx(Ye,{className:"form-control",value:r,onChange:this.handleTypeChange,ref:p=>{this.typeDropdown=p},children:d})}),l&&s.jsx("div",{className:"form-group col",children:s.jsx("div",{className:"input-group",children:s.jsx("input",{type:"text",className:W("form-control",{error:!u}),placeholder:"Enter value",value:o,onChange:this.handleValueChange})})}),s.jsx("div",{className:"form-group col-1 px-0",children:s.jsx(k,{kind:"ghost",className:"w-100 h-100 p-0 m-0",onClick:this.handleDelete,icon:mn,tooltip:"Remove Filter"})})]})})}}function hn(i,e,t){return(e=vs(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function vs(i){var e=ps(i,"string");return typeof e=="symbol"?e:e+""}function ps(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var ii=ue.module("AdvancedFilterCreatorSelectValueList");class mt extends v.PureComponent{static indexOf(e,t){for(var n=0;n<t.length;n+=1){var a=t[n];if(a===e||a!=null&&a.valueOf!=null&&e!=null&&e.valueOf!=null&&a.valueOf()===e.valueOf())return n}return-1}constructor(e){super(e),hn(this,"dh",void 0),hn(this,"list",void 0),this.handleSelect=this.handleSelect.bind(this),this.handleViewportChange=this.handleViewportChange.bind(this),this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.handleTableUpdate=this.handleTableUpdate.bind(this);var{selectedValues:t,dh:n}=this.props;this.dh=n,this.list=null,this.state={itemCount:0,items:[],offset:0,selectedValues:t,isLoading:!0}}componentDidMount(){var{table:e}=this.props;e&&this.startListening(e)}componentDidUpdate(e){var{filters:t,invertSelection:n,selectedValues:a,table:r}=this.props;e.table!==r&&(e.table&&this.stopListening(e.table),r&&this.startListening(r),this.resetViewport()),e.invertSelection!==n&&this.setState({selectedValues:[]},this.handleSelectionUpdate),e.selectedValues!==a&&this.setState({selectedValues:a},this.handleSelectionUpdate),e.filters!==t&&(r==null||r.applyFilter(t),this.resetViewport())}componentWillUnmount(){var{table:e}=this.props;e&&this.stopListening(e)}handleSelect(e,t){var{invertSelection:n}=this.props,{selectedValues:a}=this.state;a=[...a];var r=mt.indexOf(t,a);r>=0?a.splice(r,1):a.push(t);var o=r<0;n&&(o=!o);var{offset:l}=this.state,{items:d}=this.state;d=[...d];var u=e-l;u>=0&&u<d.length&&(d[u].isSelected=o),this.setState({items:d,selectedValues:a});var{onChange:h}=this.props;h(a,n)}handleViewportChange(e,t){this.updateViewport(e,t)}handleSelectionUpdate(){this.updateItemSelection()}handleTableUpdate(e){var{table:t,formatter:n}=this.props;if(t){for(var a=e.detail,{offset:r}=a,o=[],l=t.columns[0],d=0;d<a.rows.length;d+=1){var u=a.rows[d],h=u.get(l),m=void 0;h==null?m=s.jsx("i",{className:"text-muted",children:"null"}):h===""?m=s.jsx("i",{className:"text-muted",children:"empty"}):m=n.getFormattedString(h,l.type,l.name);var c=this.isValueSelected(h);o.push({displayValue:m,value:h,isSelected:c})}ii.debug2("Received table update:",r,o.length);var g=t.size;this.setState({itemCount:g,items:o,offset:r,isLoading:!1})}}isValueSelected(e){var{invertSelection:t}=this.props,{selectedValues:n}=this.state,a=mt.indexOf(e,n);return t?a<0:a>=0}startListening(e){e.addEventListener(this.dh.Table.EVENT_UPDATED,this.handleTableUpdate)}stopListening(e){e.removeEventListener(this.dh.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(){var{items:e}=this.state;e=[...e];for(var t=0;t<e.length;t+=1){var n=e[t],{value:a}=n;n.isSelected=this.isValueSelected(a)}this.setState({items:e})}updateViewport(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,{table:a}=this.props;if(a!=null){n&&this.setState({isLoading:!0});var r=t-e+1,o=Math.max(0,e-r*3),l=Math.max(o,t+r*3);ii.debug2("Setting viewport",o,",",l),a.setViewport(o,l)}}render(){var{offset:e,isLoading:t,items:n,itemCount:a}=this.state;return s.jsxs("div",{className:"select-value-list-wrapper",children:[s.jsx(os,{itemCount:a,items:n,offset:e,onSelect:this.handleSelect,onViewportChange:this.handleViewportChange,ref:r=>{this.list=r}}),s.jsx(vn,{in:t,mountOnEnter:!0,unmountOnExit:!0,children:s.jsx("div",{className:"loading-list",children:s.jsx(Ft,{className:"loading-spinner-large"})})})]})}}hn(mt,"defaultProps",{invertSelection:!0,selectedValues:[],onChange:()=>{}});function ut(i,e,t){return(e=fs(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function fs(i){var e=Cs(i,"string");return typeof e=="symbol"?e:e+""}function Cs(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class vt extends v.PureComponent{constructor(e){super(e),ut(this,"searchTablePromise",void 0),ut(this,"tableUtils",void 0),ut(this,"updateFilterTimer",void 0),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);var{dh:t,invertSelection:n,selectedValues:a}=e;this.tableUtils=new b(t),this.state={filters:[],invertSelection:n,selectedValues:a,searchText:""}}componentDidMount(){this.initSearchTable()}componentDidUpdate(e,t){var{invertSelection:n,selectedValues:a,table:r}=this.props;e.table!==r&&this.initSearchTable(),e.invertSelection!==n&&this.setState({invertSelection:n}),e.selectedValues!==a&&this.setState({selectedValues:a});var{table:o,searchText:l}=this.state;o!==t.table&&(t.table!=null&&t.table.close(),o!=null&&this.startUpdateFilterTimer()),l!==t.searchText&&this.startUpdateFilterTimer()}componentWillUnmount(){var{table:e}=this.state;e!=null&&e.close(),this.searchTablePromise=void 0,this.stopUpdateFilterTimer()}getColumnName(){var{table:e}=this.props;return e!=null?e.columns[0].name:""}getDisplayedValuesCount(){var{invertSelection:e,selectedValues:t,table:n}=this.state;return n==null?null:e?n.totalSize-t.length:t.length}getDisplayedValueText(){var e=this.getDisplayedValuesCount(),{table:t}=this.state,{formatter:n}=this.props;if(e!=null&&t!=null){var a=n.getFormattedString(e,"long"),r=n.getFormattedString(t.totalSize,"long"),o="";return e<1e6&&(o="Displaying "),"".concat(o).concat(a," of ").concat(r)}return null}initSearchTable(){var{table:e}=this.props;if(e!=null){var 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});var{onChange:n}=this.props;n(e,t)}handleSearchChange(e){var 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){var t=[];this.setState({invertSelection:e,selectedValues:t});var{onChange:n}=this.props;n(t,e)}startUpdateFilterTimer(){this.stopUpdateFilterTimer(),this.updateFilterTimer=setTimeout(this.handleUpdateFilterTimeout,vt.searchDebounceTime)}stopUpdateFilterTimer(){this.updateFilterTimer!=null&&(clearTimeout(this.updateFilterTimer),this.updateFilterTimer=void 0)}updateTableFilter(){var{table:e,searchText:t}=this.state,{timeZone:n}=this.props,{tableUtils:a}=this,r=e==null?void 0:e.columns[0],o=[];if(r!=null){var l;if(t.length>0){var d=null;b.isCharType(r.type)?d=a.makeQuickFilter(r,t):b.isTextType(r.type)?d=a.makeQuickFilter(r,"~".concat(t),n):d=a.makeQuickFilter(r,">=".concat(t),n),d!=null?o.push(d):l="Invalid search text"}this.setState({filters:o,error:l})}}render(){var{error:e,filters:t,invertSelection:n,selectedValues:a,searchText:r,table:o}=this.state,{dh:l,formatter:d,showSearch:u}=this.props,h=this.getColumnName(),m=this.getDisplayedValueText(),c=h?"Find ".concat(h,"..."):"";return s.jsxs("div",{className:"advanced-filter-creator-select-value",children:[s.jsxs("div",{className:u?"form-group":"",children:[s.jsx("label",{htmlFor:"advanced-filter-creator-select-value-input",children:"Select Values"}),u&&s.jsx("input",{type:"text",className:W("form-control",{"is-invalid":e!=null}),id:"advanced-filter-creator-select-value-input",placeholder:c,value:r,onChange:this.handleSearchChange})]}),s.jsx(mt,{dh:l,table:o,filters:t,invertSelection:n,selectedValues:a,formatter:d,onChange:this.handleListChange}),s.jsxs("div",{className:"advanced-filter-creator-select-meta-row",children:[s.jsxs("div",{children:[s.jsx(k,{kind:"ghost",onClick:this.handleSelectAllClick,children:"Select All"}),s.jsx(k,{kind:"ghost",onClick:this.handleClearAllClick,children:"Clear"})]}),s.jsx(vn,{in:m!=null,mountOnEnter:!0,unmountOnExit:!0,children:s.jsx("div",{className:"row-count-info",children:m})})]})]})}}ut(vt,"searchDebounceTime",250);ut(vt,"defaultProps",{invertSelection:!0,selectedValues:[],onChange:()=>{},showSearch:!0});function Qe(i,e,t){return(e=Ss(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Ss(i){var e=bs(i,"string");return typeof e=="symbol"?e:e+""}function bs(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var at=ue.module("AdvancedFilterCreator");class ye extends v.PureComponent{static makeFilterItem(){return{key:sn()}}constructor(e){var t,n;super(e),Qe(this,"focusTrapContainer",void 0),Qe(this,"debounceTimeout",void 0),Qe(this,"valuesTablePromise",void 0),Qe(this,"getFilterTypes",fi(g=>b.getFilterTypes(g))),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=xe.createRef();var{model:a,column:r,options:o}=e,{filterOperators:l,invertSelection:d,selectedValues:u}=o,h=(t=(n=o.filterItems)===null||n===void 0?void 0:n.map(g=>{var{selectedType:p,value:f}=g;return{selectedType:p,value:f,key:sn()}}))!==null&&t!==void 0?t:[];h.length===0&&h.push(ye.makeFilterItem()),l==null&&(l=[]),d==null&&(d=!0),u==null&&(u=[]);var m=a.getColumnIndexByName(r.name);U(m);var c=a.isColumnSortable(m);this.state={filterItems:h,filterOperators:l,invertSelection:d,selectedValues:u,valuesTableError:null,valuesTable:void 0,isSortable:c}}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(){var{model:e,column:t}=this.props;if(!e.isValuesTableAvailable){at.debug("No values table for this model, just ignore");return}this.valuesTablePromise=b.makeCancelableTablePromise(e.valuesTable(t)),this.valuesTablePromise.then(n=>{var a;if(!((a=n.columns[0].isSortable)!==null&&a!==void 0)||a){var r=n.columns[0].sort().asc();n.applySort([r])}this.setState({valuesTable:n})}).catch(n=>{be.isCanceled(n)||(at.error("Unable to open values table",n),this.setState({valuesTableError:n}))})}handleFocusTrapEnd(){var e;((e=this.focusTrapContainer)===null||e===void 0||(e=e.current)===null||e===void 0?void 0:e.querySelector("button,select,input,textarea")).focus()}handleFocusTrapStart(){var e,t=(e=this.focusTrapContainer)===null||e===void 0||(e=e.current)===null||e===void 0?void 0:e.querySelectorAll("button,select,input,textarea");if(t&&t.length>0){var n=t[t.length-1];n.focus()}}handleAddAnd(){var{filterItems:e,filterOperators:t}=this.state;e=e.concat(ye.makeFilterItem()),t=t.concat(it.and),this.setState({filterItems:e,filterOperators:t})}handleAddOr(){var{filterItems:e,filterOperators:t}=this.state;e=e.concat(ye.makeFilterItem()),t=t.concat(it.or),this.setState({filterItems:e,filterOperators:t})}handleChangeFilterOperator(e,t){var{filterOperators:n}=this.state;n=[...n],gr(t),n[e]=t,this.setState({filterOperators:n}),this.startUpdateTimer()}handleFilterChange(e,t,n){var{filterItems:a}=this.state;a=[...a];var{key:r}=a[e];a[e]={key:r,selectedType:t,value:n},this.setState({filterItems:a}),this.startUpdateTimer()}handleFilterDelete(e){var{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(ye.makeFilterItem()),this.setState({filterItems:t,filterOperators:n}),this.startUpdateTimer()}handleSelectValueChange(e,t){this.setState({selectedValues:e,invertSelection:t}),this.startUpdateTimer()}handleReset(){at.debug("Resetting Advanced Filter"),this.setState({filterItems:[ye.makeFilterItem()],filterOperators:[],selectedValues:[],invertSelection:!0}),this.startUpdateTimer()}handleSortDown(e){var t=ct.isModifierKeyDown(e);this.sortTable(b.sortDirection.descending,t)}handleSortUp(e){var t=ct.isModifierKeyDown(e);this.sortTable(b.sortDirection.ascending,t)}handleSubmit(e){at.debug("Submitting Advanced Filter"),this.stopUpdateTimer(),this.sendUpdate(),e.preventDefault()}handleDone(e){at.debug("Submitting and Closing Advanced Filter"),this.stopUpdateTimer(),this.sendUpdate();var{onDone:t}=this.props;t(),e.preventDefault()}handleUpdateTimeout(){this.debounceTimeout=void 0,this.sendUpdate()}shouldShowAddFilter(){var{filterItems:e}=this.state;if(e.length===0)return!1;var t=e[e.length-1],{selectedType:n,value:a}=t;return n!=null&&n.length>0&&a!=null&&a.length>0}sortTable(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{column:n,onSortChange:a}=this.props,{isSortable:r}=this.state;r&&a(n,e,t)}startUpdateTimer(){this.stopUpdateTimer(),this.debounceTimeout=setTimeout(this.handleUpdateTimeout,ye.debounceFilterUpdate)}stopUpdateTimer(){this.debounceTimeout!==void 0&&(clearTimeout(this.debounceTimeout),this.debounceTimeout=void 0)}sendUpdate(){var{filterItems:e,filterOperators:t,invertSelection:n,selectedValues:a}=this.state,{column:r,onFilterChange:o,model:l,tableUtils:d}=this.props,{formatter:u}=l,h=e.filter(p=>{var{selectedType:f,value:y}=p;return f!=null&&y!=null&&y!==""}),m=t.filter((p,f)=>p!=null&&e[f].selectedType!=null&&e[f].value!=null&&e[f].value!=="").slice(0,h.length-1),c={filterItems:h,filterOperators:m,invertSelection:n,selectedValues:a},g=d.makeAdvancedFilter(r,c,u.timeZone);o(r,g,c)}render(){var e=this,{column:t,model:n,sortDirection:a,formatter:r,tableUtils:o}=this.props,{filterItems:l,filterOperators:d,invertSelection:u,selectedValues:h,valuesTable:m,valuesTableError:c,isSortable:g}=this.state,{dh:p,isValuesTableAvailable:f}=n,y=b.isBooleanType(t.type),F=b.isDateType(t.type),T=this.getFilterTypes(t.type),C=t.type.substring(t.type.lastIndexOf(".")+1),_=[];if(!y&&T.length)for(var E=function(Y){var re=l[Y],{key:K,selectedType:me,value:Ne}=re,ge=s.jsx(fn,{column:t,filterTypes:T,onChange:e.getFilterChangeHandler(Y),onDelete:e.getFilterDeleteHandler(Y),selectedType:me,value:Ne,formatter:r,tableUtils:o},K);if(_.push(ge),Y<d.length){var Te=d[Y],Fe=Te===it.and,Re=s.jsxs("div",{className:"form-row justify-content-end advanced-filter-creator-filter-operator",children:[s.jsx(k,{kind:"ghost",className:W("filter-operator",{active:Fe}),onClick:()=>e.handleChangeFilterOperator(Y,it.and),children:"AND"}),s.jsx(k,{kind:"ghost",className:W("filter-operator",{active:!Fe}),onClick:()=>e.handleChangeFilterOperator(Y,it.or),children:"OR"})]},"filterOperator".concat(K));_.push(Re)}},A=0;A<l.length;A+=1)E(A);var D=this.shouldShowAddFilter(),$=s.jsxs("div",{className:W("form-row justify-content-end add-filter-item",{hidden:!D}),children:[s.jsx("span",{className:"text-muted",children:s.jsx(z,{icon:gn})}),s.jsx(k,{kind:"ghost",className:"btn-filter-item",onClick:this.handleAddAnd,disabled:!D,tooltip:"Add filter with AND",children:"AND"}),s.jsx(k,{kind:"ghost",className:"btn-filter-item",onClick:this.handleAddOr,disabled:!D,tooltip:"Add filter with OR",children:"OR"})]},"addFilterItem");return _.push($),s.jsxs("div",{className:"advanced-filter-creator",role:"presentation",children:[s.jsx("div",{tabIndex:0,onFocus:this.handleFocusTrapStart}),s.jsxs("form",{onSubmit:this.handleSubmit,ref:this.focusTrapContainer,children:[s.jsxs("div",{className:"title-bar",children:[s.jsx("h6",{className:"advanced-filter-title",children:"Advanced Filters"}),s.jsxs("div",{className:"advanced-filter-menu-buttons",children:[s.jsx(k,{kind:"ghost",className:W("sort-operator",{active:a===b.sortDirection.descending}),onClick:this.handleSortDown,icon:Yn,tooltip:g?"Sort ".concat(t.name," Descending"):"Not sortable",disabled:!g}),s.jsx(k,{kind:"ghost",className:W("sort-operator",{active:a===b.sortDirection.ascending}),onClick:this.handleSortUp,icon:s.jsx(z,{icon:Yn,rotation:180}),tooltip:g?"Sort ".concat(t.name," Ascending"):"Not sortable",disabled:!g})]})]}),s.jsx("hr",{}),s.jsxs("div",{className:"advanced-filter-column-name",children:[t.name," ",s.jsxs("span",{className:"column-type",children:["(",C,")"]})]}),_,f&&c==null&&s.jsxs(s.Fragment,{children:[!y&&s.jsx("hr",{}),s.jsx("div",{className:"form-group",children:s.jsx(vt,{dh:p,table:m,onChange:this.handleSelectValueChange,invertSelection:u,selectedValues:h,formatter:r,showSearch:!F,timeZone:r.timeZone})})]}),s.jsxs("div",{className:"form-row justify-content-end",children:[s.jsx(k,{kind:"secondary",className:"mr-2",onClick:this.handleReset,children:"Reset"}),s.jsx(k,{kind:"primary",onClick:this.handleDone,children:"Done"})]})]}),s.jsx("div",{tabIndex:0,onFocus:this.handleFocusTrapEnd})]})}}Qe(ye,"debounceFilterUpdate",250);Qe(ye,"defaultProps",{options:{filterItems:null,filterOperators:null,invertSelection:!0,selectedValues:[]},sortDirection:null});function Ts(i,e){var t=ws(i);if(t!==void 0){var n=xs(i);return"".concat(n," ? ").concat(t," : ").concat(e)}}function Es(i,e){return i.Column.formatRowColor(e)}function ys(i,e){return i.formatColor(e)}var ht=ue.module("ConditionalFormattingUtils"),Se=function(i){return i.CONDITIONAL="conditional",i.ROWS="rows",i}({}),R=function(i){return i.IS_EQUAL="is-equal",i.IS_NOT_EQUAL="is-not-equal",i.IS_BETWEEN="is-between",i.GREATER_THAN="greater-than",i.GREATER_THAN_OR_EQUAL="greater-than-or-equal",i.LESS_THAN="less-than",i.LESS_THAN_OR_EQUAL="less-than-or-equal",i.IS_NULL="is-null",i.IS_NOT_NULL="is-not-null",i}({}),P=function(i){return i.IS_EXACTLY="is-exactly",i.IS_NOT_EXACTLY="is-not-exactly",i.CONTAINS="contains",i.DOES_NOT_CONTAIN="does-not-contain",i.STARTS_WITH="starts-with",i.ENDS_WITH="ends-with",i.IS_NULL="is-null",i.IS_NOT_NULL="is-not-null",i}({}),L=function(i){return i.IS_EXACTLY="is-exactly",i.IS_NOT_EXACTLY="is-not-exactly",i.IS_BEFORE="is-before",i.IS_BEFORE_OR_EQUAL="is-before-or-equal",i.IS_AFTER="is-after",i.IS_AFTER_OR_EQUAL="is-after-or-equal",i.IS_NULL="is-null",i.IS_NOT_NULL="is-not-null",i}({}),oe=function(i){return i.IS_TRUE="is-true",i.IS_FALSE="is-false",i.IS_NULL="is-null",i.IS_NOT_NULL="is-not-null",i}({}),ie=function(i){return i.IS_EQUAL="is-equal",i.IS_NOT_EQUAL="is-not-equal",i.IS_NULL="is-null",i.IS_NOT_NULL="is-not-null",i}({}),M=function(i){return i.NO_FORMATTING="no-formatting",i.POSITIVE="positive",i.NEGATIVE="negative",i.WARN="warn",i.NEUTRAL="neutral",i.ACCENT_1="accent-1",i.ACCENT_2="accent-2",i.CUSTOM="custom",i}({});function ai(i){switch(i){case M.NO_FORMATTING:return"No formatting";case M.POSITIVE:return"Positive";case M.NEGATIVE:return"Negative";case M.WARN:return"Warn";case M.NEUTRAL:return"Neutral";case M.ACCENT_1:return"Accent 1";case M.ACCENT_2:return"Accent 2";case M.CUSTOM:return"Custom..."}}function wt(i){var{type:e,customConfig:t}=i;switch(e){case M.NO_FORMATTING:return;case M.POSITIVE:return"#9fde6f";case M.NEGATIVE:return"#ff6087";case M.WARN:return"#f67f40";case M.NEUTRAL:return"#ffd95c";case M.ACCENT_1:return"#78dce8";case M.ACCENT_2:return"#ab9bf5";case M.CUSTOM:return t==null?void 0:t.background;default:return}}function Nt(i){var{type:e,customConfig:t}=i;switch(e){case M.NO_FORMATTING:return;case M.POSITIVE:return"#526a3f";case M.NEGATIVE:return"#802f44";case M.WARN:return"#663318";case M.NEUTRAL:return"#63562b";case M.ACCENT_1:return"#3f6469";case M.ACCENT_2:return"#554d72";case M.CUSTOM:return t==null?void 0:t.color;default:return}}function ws(i){var e=Nt(i.style),t=wt(i.style);if(!(e===void 0||t===void 0))return"bgfg(`".concat(t,"`, `").concat(e,"`)")}function Ns(i){var{column:e,value:t,start:n,end:a}=i;return Gs(e.name,i.condition,t,n,a)}function Fs(i){var{column:e,value:t}=i;return Bs(e.name,i.condition,t)}function As(i){var{column:e,value:t}=i;return Hs(e.name,i.condition,t)}function Os(i){var{column:e}=i;return Ws(e.name,i.condition)}function _s(i){var{column:e,value:t}=i;return $s(e.name,i.condition,t)}function xs(i){var{column:e}=i;if(b.isNumberType(e.type))return Ns(i);if(b.isCharType(e.type))return _s(i);if(b.isStringType(e.type))return Fs(i);if(b.isDateType(e.type))return As(i);if(b.isBooleanType(e.type))return Os(i);throw new Error("Invalid column type")}function Rs(i){switch(i){case R.IS_EQUAL:return"is equal to";case R.IS_NOT_EQUAL:return"is not equal to";case R.IS_BETWEEN:return"is between";case R.GREATER_THAN:return"greater than";case R.GREATER_THAN_OR_EQUAL:return"greater than or equal to";case R.LESS_THAN:return"less than";case R.LESS_THAN_OR_EQUAL:return"less than or equal to";case R.IS_NULL:return"is null";case R.IS_NOT_NULL:return"is not null"}}function Is(i){switch(i){case P.IS_EXACTLY:return"is exactly";case P.IS_NOT_EXACTLY:return"is not exactly";case P.CONTAINS:return"contains";case P.DOES_NOT_CONTAIN:return"does not contain";case P.STARTS_WITH:return"starts with";case P.ENDS_WITH:return"ends with";case P.IS_NULL:return"is null";case P.IS_NOT_NULL:return"is not null"}}function Ds(i){switch(i){case L.IS_EXACTLY:return"is";case L.IS_NOT_EXACTLY:return"is not";case L.IS_BEFORE:return"is before";case L.IS_BEFORE_OR_EQUAL:return"is before or equal";case L.IS_AFTER:return"is after";case L.IS_AFTER_OR_EQUAL:return"is after or equal";case L.IS_NULL:return"is null";case L.IS_NOT_NULL:return"is not null"}}function Ls(i){switch(i){case oe.IS_TRUE:return"is true";case oe.IS_FALSE:return"is false";case oe.IS_NULL:return"is null";case oe.IS_NOT_NULL:return"is not null"}}function js(i){switch(i){case ie.IS_EQUAL:return"is";case ie.IS_NOT_EQUAL:return"is not";case ie.IS_NULL:return"is null";case ie.IS_NOT_NULL:return"is not null"}}function xi(i){if(b.isNumberType(i))return R.IS_EQUAL;if(b.isCharType(i))return ie.IS_EQUAL;if(b.isStringType(i))return P.IS_EXACTLY;if(b.isDateType(i))return L.IS_EXACTLY;if(b.isBooleanType(i))return oe.IS_TRUE;throw new Error("Invalid column type")}function Ri(i){if(b.isCharType(i)||b.isStringType(i))return""}function Ii(i){var{condition:e,value:t,start:n,end:a}=i;return{condition:e,value:t,start:n,end:a}}function Ot(i){return{condition:xi(i),value:Ri(i),start:void 0,end:void 0}}function Di(){return{type:M.NO_FORMATTING}}function Ps(i){switch(i){case P.IS_EXACTLY:return"==";case P.IS_NOT_EXACTLY:return"!=";case P.CONTAINS:return"contains";case P.DOES_NOT_CONTAIN:return"does not contain";case P.STARTS_WITH:return"starts with";case P.ENDS_WITH:return"ends with";case P.IS_NULL:return"is null";case P.IS_NOT_NULL:return"is not null"}}function Us(i){switch(i){case L.IS_EXACTLY:return"==";case L.IS_NOT_EXACTLY:return"!=";case L.IS_BEFORE:return"<";case L.IS_BEFORE_OR_EQUAL:return"<=";case L.IS_AFTER:return">";case L.IS_AFTER_OR_EQUAL:return">=";case L.IS_NULL:return"is null";case L.IS_NOT_NULL:return"is not null"}}function Ms(i){switch(i){case oe.IS_TRUE:return"is true";case oe.IS_FALSE:return"is false";case oe.IS_NULL:return"is null";case oe.IS_NOT_NULL:return"is not null"}}function ks(i){switch(i){case ie.IS_EQUAL:return"==";case ie.IS_NOT_EQUAL:return"!=";case ie.IS_NULL:return"is null";case ie.IS_NOT_NULL:return"is not null"}}function Vs(i){switch(i){case R.IS_EQUAL:return"==";case R.IS_NOT_EQUAL:return"!=";case R.IS_BETWEEN:return"==";case R.GREATER_THAN:return">";case R.GREATER_THAN_OR_EQUAL:return">=";case R.LESS_THAN:return"<";case R.LESS_THAN_OR_EQUAL:return"<=";case R.IS_NULL:return"is null";case R.IS_NOT_NULL:return"is not null"}}function Gs(i,e,t,n,a){switch(e){case R.IS_EQUAL:return"".concat(i," == ").concat(t);case R.IS_NOT_EQUAL:return"".concat(i," != ").concat(t);case R.IS_BETWEEN:return"".concat(i," > ").concat(n," && ").concat(i," < ").concat(a);case R.GREATER_THAN:return"".concat(i," > ").concat(t);case R.GREATER_THAN_OR_EQUAL:return"".concat(i," >= ").concat(t);case R.LESS_THAN:return"".concat(i," < ").concat(t);case R.LESS_THAN_OR_EQUAL:return"".concat(i," <= ").concat(t);case R.IS_NULL:return"".concat(i," == null");case R.IS_NOT_NULL:return"".concat(i," != null")}}function Bs(i,e,t){switch(e){case P.IS_EXACTLY:return"".concat(i,' == "').concat(t,'"');case P.IS_NOT_EXACTLY:return"".concat(i,' != "').concat(t,'"');case P.CONTAINS:return"".concat(i," != null && ").concat(i,'.contains("').concat(t,'")');case P.DOES_NOT_CONTAIN:return"".concat(i," != null && !").concat(i,'.contains("').concat(t,'")');case P.STARTS_WITH:return"".concat(i," != null && ").concat(i,'.startsWith("').concat(t,'")');case P.ENDS_WITH:return"".concat(i," != null && ").concat(i,'.endsWith("').concat(t,'")');case P.IS_NULL:return"".concat(i," == null");case P.IS_NOT_NULL:return"".concat(i," != null")}}function Hs(i,e,t){switch(e){case L.IS_EXACTLY:return"".concat(i,' == convertDateTime("').concat(t,'")');case L.IS_NOT_EXACTLY:return"".concat(i," != convertDateTime(`").concat(t,"`)");case L.IS_BEFORE:return"".concat(i," < convertDateTime(`").concat(t,"`)");case L.IS_BEFORE_OR_EQUAL:return"".concat(i,' <= convertDateTime("').concat(t,'")');case L.IS_AFTER:return"".concat(i," > convertDateTime(`").concat(t,"`)");case L.IS_AFTER_OR_EQUAL:return"".concat(i," >= convertDateTime(`").concat(t,"`)");case L.IS_NULL:return"".concat(i," == null");case L.IS_NOT_NULL:return"".concat(i," != null")}}function Ws(i,e){switch(e){case oe.IS_TRUE:return"".concat(i," == true");case oe.IS_FALSE:return"".concat(i," == false");case oe.IS_NULL:return"".concat(i," == null");case oe.IS_NOT_NULL:return"".concat(i," != null")}}function $s(i,e,t){switch(e){case ie.IS_EQUAL:return"".concat(i," == '").concat(t,"'");case ie.IS_NOT_EQUAL:return"".concat(i," != '").concat(t,"'");case ie.IS_NULL:return"isNull(".concat(i,")");case ie.IS_NOT_NULL:return"!isNull(".concat(i,")")}}function Ks(i,e){if(b.isNumberType(i))return Vs(e);if(b.isCharType(i))return ks(e);if(b.isStringType(i))return Ps(e);if(b.isDateType(i))return Us(e);if(b.isBooleanType(i))return Ms(e);throw new Error("Invalid column type")}function zs(i,e,t){if(t===void 0)return ht.debug("no rules passed."),[];var n=[],a,r=new Map;return t.forEach(o=>{var l,{config:d,type:u}=o,{column:h}=d,m=e.find(F=>{var{name:T,type:C}=F;return T===h.name&&C===h.type});if(m===void 0){ht.debug("Column ".concat(h.name,":").concat(h.type," not found. Ignoring format rule."),d);return}var[c,g]=(l=u===Se.CONDITIONAL?r.get(m.name):a)!==null&&l!==void 0?l:["null",void 0],p=Ts(d,c);if(p===void 0){ht.debug("Ignoring format rule.",d);return}var f=g===void 0?-1:n.indexOf(g);f>-1&&n.splice(f,1);var y=u===Se.CONDITIONAL?ys(m,p):Es(i,p);n.push(y),u===Se.CONDITIONAL?r.set(m.name,[p,y]):a=[p,y]}),n}function Qs(i,e,t){switch(e){case L.IS_NULL:case L.IS_NOT_NULL:return!0;default:{var[n,...a]=(t??"").split(" "),r=a.join(" ");try{pn.parseDateTimeString(n)}catch{return ht.debug("Invalid datetime string",n),!1}try{i.i18n.TimeZone.getTimeZone(r)}catch{return ht.debug("Invalid timezone string",r),!1}return!0}}}function Ys(i){var{type:e}=i;return b.isNumberType(e)||b.isCharType(e)||b.isStringType(e)||b.isDateType(e)||b.isBooleanType(e)}function _t(i){var{animation:e="iris-grid-bottom-bar-slide-up",children:t,className:n,isShown:a,onClick:r,onEntering:o,onEntered:l,onExiting:d,onExited:u}=i,h=v.useRef(null);return s.jsx(on,{in:a,timeout:ln.transitionMs,classNames:e,onEntering:o,onEntered:l,onExiting:d,onExited:u,mountOnEnter:!0,unmountOnExit:!0,nodeRef:h,children:s.jsx("div",{ref:h,className:W("iris-grid-bottom-bar",n),role:"presentation",onClick:r,onKeyPress:r,children:t})})}var qs=3e3,Xs=5;function Zs(i){var{isSaving:e=!1,onSave:t,onDiscard:n,discardTooltip:a,saveTooltip:r,error:o,pendingDataErrors:l,pendingDataMap:d,onEntering:u,onEntered:h,onExiting:m,onExited:c}=i,[g,p]=v.useState(!1),[f,y]=v.useState(!1),F=v.useRef(),T=yi(e),C=v.useMemo(()=>l.size===0?o:l.size<=Xs?"Key can't be empty (on pending row".concat(l.size>1?"s":""," ").concat(Array.from(l.keys()).join(", ").trim(),")"):"Key can't be empty (on ".concat(l.size," rows)"),[o,l]);v.useEffect(function(){T!=null&&T&&!e&&C==null&&(p(!0),y(!0),F.current=setTimeout(()=>{p(!1)},qs))},[C,e,T]),v.useEffect(function(){F.current&&d.size>0&&(clearTimeout(F.current),p(!1),y(!1))},[d]),v.useEffect(function(){return()=>F.current?clearTimeout(F.current):void 0},[]);var _=d.size,E;return e?E=s.jsx(Ft,{className:"loading-spinner-vertical-align"}):f&&(E=ka),s.jsxs(_t,{className:"pending-data-bottom-bar",isShown:_>0||g||C!=null,onEntering:u,onEntered:h,onExiting:m,onExited:()=>{y(!1),c&&c()},children:[C!=null&&C!==""&&s.jsxs("div",{className:"error-message",children:[s.jsx(z,{icon:Ma}),s.jsx("span",{children:"".concat(C)})]}),(C==null||C==="")&&s.jsx("div",{className:"status-message",children:_>0&&s.jsx("span",{children:"".concat(_," row").concat(_>1?"s":""," pending")})}),s.jsxs("div",{className:"buttons-container",children:[!e&&!f&&s.jsx(k,{kind:"secondary",onClick:n,tooltip:a,children:"Discard"}),s.jsxs(k,{kind:f?"success":"primary",onClick:t,icon:E,disabled:e||f||C!=null,tooltip:r,children:[e&&"Committing...",!e&&f&&"Success",!e&&!f&&"Commit"]})]})]})}function ri(i,e,t,n,a,r,o){try{var l=i[r](o),d=l.value}catch(u){return void t(u)}l.done?e(d):Promise.resolve(d).then(n,a)}function en(i){return function(){var e=this,t=arguments;return new Promise(function(n,a){var r=i.apply(e,t);function o(d){ri(r,n,a,o,l,"next",d)}function l(d){ri(r,n,a,o,l,"throw",d)}o(void 0)})}}function De(i,e,t){return(e=Js(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Js(i){var e=eo(i,"string");return typeof e=="symbol"?e:e+""}function eo(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var de=ue.module("IrisGridCopyHandler");function to(i){return i.ranges!=null}function no(i){return i.columnIndex!=null}class j extends v.Component{static getStatusMessageText(e,t){switch(e){case j.COPY_STATES.CONFIRMATION_REQUIRED:return"Are you sure you want to copy ".concat(t.toLocaleString()," rows to your clipboard?");case j.COPY_STATES.CLICK_REQUIRED:return"Fetched ".concat(t.toLocaleString()," rows!");case j.COPY_STATES.FETCH_ERROR:return"Unable to copy data.";case j.COPY_STATES.FETCH_RANGES_IN_PROGRESS:return"Fetching ".concat(t.toLocaleString()," rows for clipboard...");case j.COPY_STATES.FETCH_HEADER_IN_PROGRESS:return"Fetching header for clipboard...";case j.COPY_STATES.DONE:return"Copied to Clipboard!";default:return""}}static getCopyButtonText(e){switch(e){case j.BUTTON_STATES.FETCH_IN_PROGRESS:return"Fetching";case j.BUTTON_STATES.CLICK_TO_COPY:return"Click to Copy";case j.BUTTON_STATES.RETRY:return"Retry";default:return"Copy"}}constructor(e){super(e),De(this,"textData",void 0),De(this,"hideTimer",void 0),De(this,"fetchPromise",void 0),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:j.COPY_STATES.IDLE,buttonState:j.BUTTON_STATES.COPY,isShown:!1,rowCount:0}}componentDidMount(){var{copyOperation:e}=this.props;e!=null&&this.startCopy()}componentDidUpdate(e){var{copyOperation:t}=this.props;e.copyOperation!==t&&this.startCopy()}componentWillUnmount(){this.stopCopy()}startCopy(){de.debug2("startCopy"),this.stopCopy();var{copyOperation:e}=this.props;if(e==null){de.debug2("No copy operation set, cancelling out"),this.setState({isShown:!1});return}var{error:t}=e;if(t!=null){de.debug("Showing copy error",t),this.setState({isShown:!0,copyState:j.COPY_STATES.DONE,error:t}),this.startHideTimer();return}if(this.setState({isShown:!0,error:void 0}),to(e)){var{ranges:n}=e,a=qe.rowCount(n);if(this.setState({rowCount:a}),a>j.NO_PROMPT_THRESHOLD){this.setState({buttonState:j.BUTTON_STATES.COPY,copyState:j.COPY_STATES.CONFIRMATION_REQUIRED});return}}this.startFetch()}stopCopy(){this.textData=void 0,this.stopFetch(),this.stopHideTimer()}handleBackgroundClick(){de.debug2("handleBackgroundClick");var{copyState:e}=this.state;e===j.COPY_STATES.DONE&&this.setState({isShown:!1})}handleCancelClick(){de.debug2("handleCancelClick"),this.stopFetch(),this.setState({isShown:!1})}handleCopyClick(){var e=this;return en(function*(){if(de.debug2("handleCopyClick"),e.textData!=null)try{yield e.copyText(e.textData),e.showCopyDone()}catch(t){de.error("Error copying text",t),e.setState({error:"Unable to copy. Verify your browser permissions."})}else e.startFetch()})()}handleHideTimeout(){de.debug2("handleHideTimeout"),this.stopHideTimer(),this.setState({isShown:!1})}copyText(e){var t=this;return en(function*(){de.debug2("copyText",e),t.textData=e,yield wi(e)})()}showCopyDone(){this.setState({copyState:j.COPY_STATES.DONE}),this.startHideTimer()}startFetch(){var e=this;return en(function*(){e.stopFetch();var{model:t,copyOperation:n}=e.props;if(no(n)){var{columnIndex:a,columnDepth:r,movedColumns:o}=n;de.debug("startFetch copyHeader",a,r),e.setState({buttonState:j.BUTTON_STATES.FETCH_IN_PROGRESS,copyState:j.COPY_STATES.FETCH_HEADER_IN_PROGRESS});var l=Ce.getModelIndex(a,o),d=t.textForColumnHeader(l,r);if(d===void 0){e.fetchPromise=void 0,e.setState({error:"Invalid column header selected.",copyState:j.COPY_STATES.DONE});return}e.fetchPromise=be.makeCancelable(d)}else{var{ranges:u,includeHeaders:h,userColumnWidths:m,movedColumns:c,formatValues:g}=n;de.debug("startFetch copyRanges",u),e.setState({buttonState:j.BUTTON_STATES.FETCH_IN_PROGRESS,copyState:j.COPY_STATES.FETCH_RANGES_IN_PROGRESS});var p=ee.getHiddenColumns(m),f=Ce.getModelRanges(u,c);if(p.length>0){var y=p.map(qe.makeColumn);f=qe.subtractRangesFromRanges(f,y)}var F=g!=null&&g?(C,_)=>t.displayString(C,_.type,_.name):C=>"".concat(C);e.fetchPromise=be.makeCancelable(t.textSnapshot(f,h,F))}try{var T=yield e.fetchPromise;e.fetchPromise=void 0;try{yield e.copyText(T),e.showCopyDone()}catch(C){de.error("Error copying text",C),e.setState({buttonState:j.BUTTON_STATES.CLICK_TO_COPY,copyState:j.COPY_STATES.CLICK_REQUIRED})}}catch(C){C instanceof vr?de.debug("User cancelled copy."):(de.error("Error fetching contents",C),e.fetchPromise=void 0,e.setState({buttonState:j.BUTTON_STATES.RETRY,copyState:j.COPY_STATES.FETCH_ERROR}))}})()}stopFetch(){this.fetchPromise&&(de.debug2("stopFetch"),this.fetchPromise.cancel(),this.fetchPromise=void 0)}startHideTimer(){this.stopHideTimer(),this.hideTimer=setTimeout(this.handleHideTimeout,j.HIDE_TIMEOUT)}stopHideTimer(){this.hideTimer!=null&&(clearTimeout(this.hideTimer),this.hideTimer=void 0)}render(){var{onEntering:e,onEntered:t,onExiting:n,onExited:a}=this.props,{buttonState:r,copyState:o,isShown:l,rowCount:d,error:u}=this.state,h=o===j.COPY_STATES.DONE?"fade":"copy-slide-up",m=j.getCopyButtonText(r),c=u??j.getStatusMessageText(o,d),g=o!==j.COPY_STATES.DONE,p=r===j.BUTTON_STATES.FETCH_IN_PROGRESS,f=o===j.COPY_STATES.DONE;return s.jsxs(_t,{animation:h,isShown:l,className:W("iris-grid-copy-handler",{"copy-done":f}),onClick:this.handleBackgroundClick,onEntering:e,onEntered:t,onExiting:n,onExited:a,children:[s.jsx("div",{className:"status-message",children:s.jsx("span",{children:c})}),s.jsx(vn,{in:g,mountOnEnter:!0,unmountOnExit:!0,children:s.jsxs("div",{className:"buttons-container",children:[s.jsx("button",{type:"button",className:"btn btn-outline-secondary btn-cancel",onClick:this.handleCancelClick,children:"Cancel"}),s.jsxs(k,{kind:p?"tertiary":"primary",className:W("btn-copy",{"btn-spinner":p}),onClick:this.handleCopyClick,disabled:p,children:[p&&s.jsx(Ft,{className:"loading-spinner-vertical-align"}),m]})]})})]})}}De(j,"NO_PROMPT_THRESHOLD",1e4);De(j,"HIDE_TIMEOUT",3e3);De(j,"COPY_STATES",{IDLE:"IDLE",CONFIRMATION_REQUIRED:"CONFIRMATION_REQUIRED",FETCH_RANGES_IN_PROGRESS:"FETCH_RANGES_IN_PROGRESS",FETCH_HEADER_IN_PROGRESS:"FETCH_HEADER_IN_PROGRESS",FETCH_ERROR:"FETCH_ERROR",CLICK_REQUIRED:"CLICK_REQUIRED",DONE:"DONE"});De(j,"BUTTON_STATES",{COPY:"COPY",FETCH_IN_PROGRESS:"FETCH_IN_PROGRESS",CLICK_TO_COPY:"CLICK_TO_COPY",RETRY:"RETRY"});De(j,"defaultProps",{copyOperation:null,onEntering:()=>{},onEntered:()=>{},onExiting:()=>{},onExited:()=>{}});function Et(i,e,t){return(e=io(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function io(i){var e=ao(i,"string");return typeof e=="symbol"?e:e+""}function ao(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Li extends v.PureComponent{constructor(e){super(e),Et(this,"inputField",void 0),Et(this,"initialValue",void 0),Et(this,"debouncedSendUpdate",void 0);var{debounceMs:t}=e;this.debouncedSendUpdate=dt(this.sendUpdate.bind(this),t),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;var{value:n}=e;this.initialValue=n,this.state={isChanged:!1,value:n}}componentDidMount(){var e;(e=this.inputField)===null||e===void 0||e.focus()}componentDidUpdate(e){var{debounceMs:t}=this.props;e.debounceMs!==t&&(this.debouncedSendUpdate.flush(),this.debouncedSendUpdate=dt(this.sendUpdate.bind(this),t))}componentWillUnmount(){this.debouncedSendUpdate.cancel()}setValue(e){this.initialValue=e,this.setState({value:e})}focus(){var e;(e=this.inputField)===null||e===void 0||e.focus()}handleChange(e){var{value:t}=e.target;this.setState({value:t,isChanged:!0}),this.debouncedSendUpdate(t)}handleCancel(){this.debouncedSendUpdate.cancel();var{initialValue:e}=this,{isChanged:t}=this.state;t&&this.sendUpdate(e);var{onDone:n}=this.props;n()}handleCommit(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;this.debouncedSendUpdate.flush();var{onDone:n}=this.props;n(e,t)}handleFocus(){var e;(e=this.inputField)===null||e===void 0||e.select()}handleBlur(e){var{relatedTarget:t}=e;t!=null&&t.classList.contains("context-menu-container")?this.handleCommit(!1,!0):t!=null&&t.classList.contains("advanced-filter-button")?this.handleCommit(!1,!1):this.handleCommit(!0,!0)}handleTab(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.debouncedSendUpdate.flush();var{onTab:t}=this.props;t(e)}handleKeyDown(e){switch(e.key){case"Escape":e.stopPropagation(),e.preventDefault(),this.handleCancel();break;case"Enter":e.stopPropagation(),e.preventDefault(),this.handleCommit();break;case"Tab":e.stopPropagation(),e.preventDefault(),this.handleTab(e.shiftKey);break}}handleContextMenu(e){var{onContextMenu:t}=this.props;t(e)}sendUpdate(e){var{onChange:t}=this.props;t(e)}render(){var{className:e,style:t,isAdvancedFilterSet:n,onAdvancedFiltersTriggered:a}=this.props,{value:r}=this.state;return s.jsxs("div",{style:t,className:"iris-grid-input-autosized-wrapper","data-value":r,children:[s.jsx("input",{ref:o=>{this.inputField=o},className:W("iris-grid-input-field",e),type:"text",value:r,onBlur:this.handleBlur,onFocus:this.handleFocus,onChange:this.handleChange,onKeyDown:this.handleKeyDown,onContextMenu:this.handleContextMenu,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false"}),s.jsx("div",{className:"advanced-filter-button-container",children:s.jsx(k,{kind:"ghost",className:W("btn-link-icon advanced-filter-button",{"filter-set":n}),onClick:a,onContextMenu:this.handleContextMenu,children:s.jsxs("div",{className:"fa-layers ",children:[s.jsx(z,{icon:Ci,className:"filter-solid"}),s.jsx(z,{icon:dn,className:"filter-light"})]})})})]})}}Et(Li,"defaultProps",{style:{},className:"",value:"",isAdvancedFilterSet:!1,onAdvancedFiltersTriggered:()=>{},onChange:()=>{},onDone:()=>{},onTab:()=>{},onContextMenu:()=>{},debounceMs:150});function ro(i,e,t){return(e=so(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function so(i){var e=oo(i,"string");return typeof e=="symbol"?e:e+""}function oo(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class lo extends At{constructor(e){super(),ro(this,"irisGrid",void 0),this.irisGrid=e,this.cursor=null}onDown(e,t){if(e.altKey&&!ct.isModifierKeyDown(e)&&!e.shiftKey){var{mouseX:n,mouseY:a}=t.state;if(n==null||a==null)return!1;var r=t.getGridPointFromXY(n,a);if(r.column!=null&&r.row!=null)return this.cursor=this.irisGrid.props.copyCursor,!0}return!1}onUp(e,t){return this.cursor===this.irisGrid.props.copyCursor?(this.cursor=null,!0):!1}}function uo(i,e,t){return(e=ho(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ho(i){var e=co(i,"string");return typeof e=="symbol"?e:e+""}function co(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class mo extends At{constructor(e){super(),uo(this,"irisGrid",void 0),this.irisGrid=e}onDown(e){var{selectedRanges:t}=this.irisGrid.state;return e.key==="c"&&ct.isModifierKeyDown(e)?(ee.isValidSnapshotRanges(t)?this.irisGrid.copyRanges(t):this.irisGrid.copyRanges(t,!1,!1,"Invalid copy ranges"),!0):!1}}function go(i,e,t){return(e=vo(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function vo(i){var e=po(i,"string");return typeof e=="symbol"?e:e+""}function po(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class fo extends At{constructor(e){super(),go(this,"irisGrid",void 0),this.irisGrid=e}onDown(e){if(ke.TABLE.REVERSE.matchesEvent(e)){if(!this.irisGrid.isReversible())return!1;var{reverse:t}=this.irisGrid.state;return this.irisGrid.reverse(!t),!0}return!1}}function Co(i,e,t){return(e=So(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function So(i){var e=bo(i,"string");return typeof e=="symbol"?e:e+""}function bo(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class To extends At{constructor(e){super(),Co(this,"irisGrid",void 0),this.irisGrid=e}onDown(e){return ke.TABLE.CLEAR_FILTERS.matchesEvent(e)?(this.irisGrid.clearAllFilters(),!0):!1}}var Eo=3e3;function yo(i){var{children:e=null,onEntering:t,onEntered:n,onExiting:a,onExited:r}=i,[o,l]=v.useState(!1),d=v.useRef(),u=yi(e),h=v.useCallback(()=>{l(!0),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{l(!1)},Eo)},[l,d]);return v.useEffect(()=>{u!==e&&e!=null&&h()},[e,u,l,h]),v.useEffect(()=>()=>d.current?clearTimeout(d.current):void 0,[]),s.jsx(_t,{className:"toast-bottom-bar",isShown:o,onEntering:t,onEntered:n,onExiting:a,onExited:r,children:e})}var wo=1;function ji(i){var{model:e,top:t,bottom:n,left:a,right:r,filter:o,formatter:l,columnAlignmentMap:d,reverse:u=!1,sorts:h,customColumns:m,movedColumns:c,hiddenColumns:g,alwaysFetchColumns:p,rollupConfig:f=null,totalsConfig:y=null,selectDistinctColumns:F=Z,pendingRowCount:T=0,pendingDataMap:C=Ee,frozenColumns:_,formatColumns:E,columnHeaderGroups:A,partitionConfig:D,showExtraGroupColumn:$}=i,{isTotalsAvailable:te,isRollupAvailable:Y}=e;he(()=>{_r(e)&&$!=null&&(e.showExtraGroupColumn=$)},[e,$]);var re=v.useMemo(()=>ee.getModelViewportColumns(e.columns,a,r,c,g,p,wo),[e.columns,a,r,c,g,p]);return he(function(){e.filter=o},[e,o]),he(function(){var me=[...h];u&&me.push(e.dh.Table.reverse()),e.sort=me},[e,h,u]),he(function(){e.formatter=l},[e,l]),he(function(){e.columnAlignmentMap=d},[e,d]),he(function(){e.isCustomColumnsAvailable&&(e.customColumns=m)},[e,m]),he(function(){e.isFormatColumnsAvailable&&(e.formatColumns=E)},[e,E]),he(function(){e.setViewport(t,n,re)},[e,t,n,re]),he(function(){Y&&(e.rollupConfig=f)},[e,Y,f]),he(function(){e.isSelectDistinctAvailable&&(e.selectDistinctColumns=F)},[e,F]),he(function(){te&&(e.totalsConfig=y)},[e,te,y]),he(function(){e.columnHeaderGroups=A},[e,A]),he(function(){D&&Tt(e)&&(e.partitionConfig=D)},[e,D]),v.useEffect(function(){_&&e.updateFrozenColumns(_)},[e,_]),v.useEffect(function(){e.pendingRowCount=T},[e,T]),v.useEffect(function(){e.pendingDataMap=C},[e,C]),null}ji.displayName="IrisGridModelUpdater";function Pi(i,e,t){return(e=No(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function No(i){var e=Fo(i,"string");return typeof e=="symbol"?e:e+""}function Fo(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var tn=ue.module("ColumnStatistics"),Ao={SIZE:"Number of Rows"};class gt extends v.Component{static getStatsLabel(e){var t;return(t=Ao[e])!==null&&t!==void 0?t:e.split(" ").map(n=>n[0].toUpperCase()+n.substr(1).toLowerCase()).join(" ")}constructor(e){super(e),Pi(this,"cancelablePromise",void 0),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}}componentDidMount(){this.maybeGenerateStatistics()}componentWillUnmount(){this.cancelablePromise&&this.cancelablePromise.cancel()}maybeGenerateStatistics(){var{column:e,model:t}=this.props,n=t.rowCount-t.pendingRowCount-t.floatingBottomRowCount-t.floatingTopRowCount;this.setState({numRows:n}),!t.isColumnStatisticsAvailable||e.isProxy===!0?this.setState({loading:!1}):n<gt.AUTO_GENERATE_LIMIT&&this.handleGenerateStatistics()}handleGenerateStatistics(){this.setState({loading:!0});var{column:e,model:t}=this.props;this.cancelablePromise=be.makeCancelable(t.columnStatistics(e)),this.cancelablePromise.then(this.handleStatistics).catch(this.handleError)}handleStatistics(e){tn.debug("Received statistics",e);var{model:t,onStatistics:n}=this.props,a=[];e.statisticsMap.forEach((r,o)=>{a.push({operation:gt.getStatsLabel(o),value:r,type:e.getType(o)})}),e.uniqueValues.forEach((r,o)=>{a.push({operation:o,className:"column-statistics-unique-value",value:r,type:"long"})}),this.setState({loading:!1,statistics:a,numRows:t.rowCount-t.pendingRowCount-t.floatingBottomRowCount-t.floatingTopRowCount}),n()}handleError(e){if(e!=null&&be.isCanceled(e)){tn.debug("Called handleError on a cancelled promise result");return}tn.error("Error generating statistics",e),this.setState({error:e,loading:!1,statistics:null})}render(){var e,{column:t,model:n}=this.props,{error:a,loading:r,statistics:o,numRows:l}=this.state,d=!r&&a==null&&o==null&&n.isColumnStatisticsAvailable,u=[],h=t.type.substring(t.type.lastIndexOf(".")+1),m=t.description===null?null:t.description;if(o!=null)for(var c=0;c<o.length;c+=1){var{operation:g,className:p,value:f,type:y}=o[c],F=y?n.displayString(f,y):n.displayString(f,t.type,t.name),T=s.jsxs(xe.Fragment,{children:[s.jsx("div",{className:W("column-statistic-operation",p),children:g}),s.jsx("div",{className:"column-statistic-value",children:F})]},g);u.push(T)}var C=un(n)&&n.hasExpandableRows?"Expanded Rows":"Number of Rows",_=n.displayString(l,"long"),E=n.getColumnIndexByName(t.name);return s.jsxs("div",{className:"column-statistics",children:[s.jsxs("div",{className:"column-statistics-title",children:[(e=t.displayName)!==null&&e!==void 0?e:t.name,s.jsxs("span",{className:"column-statistics-type",children:[" (",h,")"]}),s.jsx(Ni,{className:"column-statistics-copy",tooltip:"Copy column name",copy:t.name})]}),m!=null&&s.jsx("div",{className:"column-statistics-description",children:m}),E!=null&&!n.isColumnSortable(E)&&s.jsxs("div",{className:"column-statistics-status",children:[s.jsx(z,{icon:Va,className:"mr-1"}),"Not sortable"]}),E!=null&&!n.isColumnMovable(E)&&s.jsxs("div",{className:"column-statistics-status",children:[s.jsx(z,{icon:n.isColumnFrozen(E)?Ga:qn,className:"mr-1"}),n.isColumnFrozen(E)?"Frozen":"Not movable"]}),E!=null&&_e(n)&&n.isEditable&&!n.keyColumnSet.has(t.name)&&!n.valueColumnSet.has(t.name)&&s.jsxs("div",{className:"column-statistics-status",children:[s.jsx(z,{icon:qn,className:"mr-1"}),"Not editable"]}),s.jsxs("div",{className:"column-statistics-grid",children:[o==null&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"column-statistic-operation",children:C}),s.jsx("div",{className:"column-statistic-value",children:_})]}),u]}),d&&s.jsx(k,{kind:"ghost",className:"px-0",onClick:this.handleGenerateStatistics,children:"Generate Stats"}),a!=null&&s.jsx("div",{className:"error-message",children:"".concat(a)}),o&&!r&&s.jsx(k,{kind:"ghost",className:"px-0",onClick:this.handleGenerateStatistics,icon:Ba,children:"Refresh"}),r&&s.jsxs("div",{className:"column-statistics-loading",children:[s.jsx(Ft,{className:"loading-spinner-vertical-align"}),"Calculating Stats..."]})]})}}Pi(gt,"AUTO_GENERATE_LIMIT",1e5);function Oo(i,e,t){return(e=_o(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function _o(i){var e=xo(i,"string");return typeof e=="symbol"?e:e+""}function xo(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class St extends v.PureComponent{static createSearchFilter(e,t,n,a,r){var o=r?a.filter(u=>!n.includes(u.name)).map(u=>u.name):n;if(t&&o.length>0){var l=e.FilterValue.ofString(t),d=o.length===a.length?e.FilterCondition.search(l):e.FilterCondition.search(l,a.filter(u=>o.includes(u.name)).map(u=>u.filter()));return d}}constructor(e){super(e),Oo(this,"searchField",void 0),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=xe.createRef(),this.state={isConfigureColumnsShown:!1}}focus(){var e;(e=this.searchField.current)===null||e===void 0||e.focus()}handleSearchValueChange(e){var{onChange:t,selectedColumns:n,invertSelection:a}=this.props;t(e.target.value,n,a)}sendColumnChange(e,t){var{onChange:n,value:a}=this.props;n(a,e,t)}setInvertSelection(e){var{onChange:t,value:n}=this.props;t(n,[],e)}toggleColumn(e){var{selectedColumns:t,invertSelection:n}=this.props;if(t.includes(e))this.sendColumnChange(t.filter(r=>r!==e),n);else{var a=t.slice();a.push(e),this.sendColumnChange(a,n)}}selectAll(){this.setInvertSelection(!0)}clear(){this.setInvertSelection(!1)}selectNumbers(){var{columns:e}=this.props;this.sendColumnChange(e.filter(t=>b.isNumberType(t.type)).map(t=>t.name),!1)}render(){var{value:e,selectedColumns:t,invertSelection:n,columns:a}=this.props,{isConfigureColumnsShown:r}=this.state,o=t.length===0&&n===!0||t.length===a.length&&n===!1,l=t.length===0&&n===!1||t.length===a.length&&n===!0,d;return o?d=s.jsxs(s.Fragment,{children:[s.jsx(z,{icon:Zn,mask:qt,transform:"shrink-2 down-5 right-7"}),s.jsx(z,{icon:Ha,className:"text-primary",transform:"shrink-4 down-5 right-7"})]}):l?d=s.jsxs(s.Fragment,{children:[s.jsx(z,{icon:Wa,mask:qt,transform:"shrink-1 down-5 right-7"}),s.jsx(z,{icon:Xn,className:"text-danger",transform:"shrink-4 down-5 right-7"})]}):d=s.jsxs(s.Fragment,{children:[s.jsx(z,{icon:Zn,mask:qt,transform:"shrink-2 down-5 right-7"}),s.jsx(z,{icon:$a,className:"text-primary",transform:"shrink-4 down-5 right-7"})]}),s.jsxs("div",{className:"cross-column-container",children:[s.jsx(pr,{className:"cross-column-search",placeholder:"Search Data...","data-testid":"cross-column-search",value:e,onChange:this.handleSearchValueChange,ref:this.searchField}),s.jsxs("button",{type:"button",className:"btn btn-link btn-link-icon px-2",onClick:()=>{r?this.setState({isConfigureColumnsShown:!1}):this.setState({isConfigureColumnsShown:!0})},children:[s.jsx("div",{className:"fa-layers",children:d}),s.jsx(ze,{children:"Configure Columns"}),s.jsx(Fi,{isShown:r,className:"cross-column-popper",onExited:()=>{this.setState({isConfigureColumnsShown:!1})},closeOnBlur:!0,interactive:!0,children:s.jsxs("div",{className:"cross-column-popup",children:["Searched Columns",s.jsx("div",{className:"cross-column-scroll",children:a.map(u=>u.isProxy===!0?null:s.jsxs(xe.Fragment,{children:[s.jsx(fr,{className:"cross-column-checkbox",checked:n?!t.includes(u.name):t.includes(u.name),onChange:()=>this.toggleColumn(u.name),children:u.name}),u.type.substring(u.type.lastIndexOf(".")+1)]},u.name))}),s.jsxs("div",{className:"cross-column-button-bar",children:[s.jsx("button",{type:"button",className:"btn btn-link",onClick:this.selectAll,children:"Select All"}),s.jsx("button",{type:"button",className:"btn btn-link",onClick:this.clear,children:"Clear"}),s.jsx("button",{type:"button",className:"btn btn-link",onClick:this.selectNumbers,children:"Numbers Only"})]}),l&&s.jsxs("p",{className:"text-danger",children:[s.jsx(z,{icon:Xn})," Select at least one column to search."]})]})})]})]})}}function si(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(i,a).enumerable})),t.push.apply(t,n)}return t}function oi(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?si(Object(t),!0).forEach(function(n){lt(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):si(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function li(i,e,t,n,a,r,o){try{var l=i[r](o),d=l.value}catch(u){return void t(u)}l.done?e(d):Promise.resolve(d).then(n,a)}function bt(i){return function(){var e=this,t=arguments;return new Promise(function(n,a){var r=i.apply(e,t);function o(d){li(r,n,a,o,l,"next",d)}function l(d){li(r,n,a,o,l,"throw",d)}o(void 0)})}}function lt(i,e,t){return(e=Ro(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Ro(i){var e=Io(i,"string");return typeof e=="symbol"?e:e+""}function Io(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var $e=ue.module("IrisGridPartitionSelector");class Do extends v.Component{constructor(e){super(e),lt(this,"pending",void 0),lt(this,"tableUtils",void 0),lt(this,"getCachedChangeCallback",Q(n=>a=>this.handlePartitionSelect(n,a),{max:100})),lt(this,"getCachedFormatValueCallback",Q(n=>a=>this.getDisplayValue(n,a),{max:100})),this.handlePartitionTableClick=this.handlePartitionTableClick.bind(this),this.handleMergeClick=this.handleMergeClick.bind(this),this.handlePartitionSelect=this.handlePartitionSelect.bind(this);var{model:t}=e;this.tableUtils=new b(t.dh),this.pending=new Ai,this.state={isLoading:!0,baseTable:null,keysTable:null,partitionTables:null}}componentDidMount(){var e=this;return bt(function*(){var{model:t}=e.props;try{var n=yield e.pending.add(t.partitionKeysTable().then(r=>r),r=>r.close()),a=yield e.pending.add(t.partitionBaseTable(),r=>r.close());e.setState({keysTable:n,baseTable:a,isLoading:!1},e.updatePartitionOptions)}catch(r){if(!be.isCanceled(r))throw r}})()}componentDidUpdate(e){var{partitionConfig:t}=e,{partitionConfig:n}=this.props;t!==n&&this.updatePartitionOptions()}componentWillUnmount(){this.pending.cancel();var{keysTable:e,baseTable:t,partitionTables:n}=this.state;t==null||t.close(),e==null||e.close(),n==null||n.forEach(a=>a.close())}handlePartitionTableClick(){$e.debug2("handlePartitionTableClick");var{partitionConfig:e}=this.props;U(e);var t=oi({},e);t.mode=e.mode==="keys"?"partition":"keys",this.sendUpdate(t)}handleMergeClick(){$e.debug2("handleMergeClick");var{partitionConfig:e}=this.props;U(e);var t=oi({},e);t.mode=e.mode==="merged"?"partition":"merged",this.sendUpdate(t)}handlePartitionSelect(e,t){var n=this;return bt(function*(){var{partitionConfig:a}=n.props;U(a),$e.debug("handlePartitionSelect",e,t,a);var r=[...a.partitions];r[e]=t;var{baseTable:o}=n.state,{keysTable:l}=n.state;U(o),U(l);try{n.setState({isLoading:!0});var d=yield n.pending.add(o.copy(),c=>c.close()),u=r.slice(0,e+1).map((c,g)=>{var p=d.columns[g];return n.tableUtils.makeNullableEqFilter(p,c)});d.applyFilter(u),d.setViewport(0,0,d.columns);var h=yield n.pending.add(d.getViewportData()),m={partitions:l.columns.map(c=>h.rows[0].get(c)),mode:"partition"};d.close(),n.sendUpdate(m)}catch(c){be.isCanceled(c)||$e.error("Unable to get partition tables",c)}finally{n.setState({isLoading:!1})}})()}sendUpdate(e){$e.debug2("sendUpdate",e);var{onChange:t}=this.props;t(e)}getDisplayValue(e,t){var{model:n}=this.props;if(t===null)return"(null)";if(t===void 0||t==="")return"";var a=n.partitionColumns[e];return b.isCharType(a.type)&&t.toString().length>0?String.fromCharCode(parseInt(t.toString(),10)):n.displayString(t,a.type,a.name)}updatePartitionOptions(){var e=this;return bt(function*(){var{model:t}=e.props,{partitionConfig:n}=e.props;if(n!=null){var{keysTable:a}=e.state;U(a);var r=[...n.partitions].map((l,d)=>{var u=a.columns[d];return e.tableUtils.makeNullableEqFilter(u,l)}),o=yield Promise.all(t.partitionColumns.map(function(){var l=bt(function*(d,u){return a.applyFilter(r.slice(0,u)),a.selectDistinct(t.partitionColumns.slice(0,u+1))});return function(d,u){return l.apply(this,arguments)}}()));e.setState({partitionTables:o})}})()}getPartitionFilters(e){var{model:t,partitionConfig:n}=this.props;U(n);var{partitions:a}=n;if($e.debug("getPartitionFilters",n),a.length!==e.length)throw new Error("Invalid partition config set. Expected ".concat(e.length," partitions, but got ").concat(a.length));for(var r=[],o=0;o<a.length;o+=1)if(o===0)r.push([]);else{var l=r[o-1],d=a[o-1],u=t.partitionColumns[o-1],h=[...l,this.tableUtils.makeNullableEqFilter(u,d)];r.push(h)}return r}render(){var{model:e,partitionConfig:t}=this.props,{isLoading:n,partitionTables:a}=this.state,r=e.partitionColumns.map((o,l)=>s.jsxs("div",{className:"column-selector",children:[(a==null?void 0:a[l])&&s.jsx(Lr,{label:o.name,labelPosition:"side",table:a[l],direction:"bottom",shouldFlip:!1,keyColumn:a[l].columns[l].name,selectedKey:(t==null?void 0:t.mode)==="partition"?t.partitions[l]:null,placeholder:"Select a key",labelColumn:a[l].columns[l].name,onChange:this.getCachedChangeCallback(l),isDisabled:n||t==null}),e.partitionColumns.length-1===l||s.jsx(z,{icon:Ka})]},"selector-".concat(o.name)));return s.jsxs("div",{className:"iris-grid-partition-selector",children:[s.jsxs("div",{className:"partition-button-group",children:[s.jsx(k,{onClick:this.handlePartitionTableClick,kind:"inline",tooltip:e.isPartitionAwareSourceTable?"View keys as table":"View underlying partition table",icon:za,active:(t==null?void 0:t.mode)==="keys",disabled:n||t==null,children:"Partitions"}),s.jsx(k,{onClick:this.handleMergeClick,kind:"inline",tooltip:"View all partitions as one merged table",icon:s.jsx(z,{icon:Qa,rotation:90}),active:(t==null?void 0:t.mode)==="merged",disabled:n||t==null,children:e.isPartitionAwareSourceTable?"Coalesce":"Merge"})]}),r]})}}function Lo(i,e,t){return(e=jo(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function jo(i){var e=Po(i,"string");return typeof e=="symbol"?e:e+""}function Po(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var Uo=ue.module("SelectDistinctBuilder");class Ui extends v.Component{constructor(e){super(e),this.handleAddColumnClick=this.handleAddColumnClick.bind(this),this.handleDeleteColumn=this.handleDeleteColumn.bind(this),this.handleDropdownChanged=this.handleDropdownChanged.bind(this);var{model:t,selectDistinctColumns:n}=this.props;this.state={inputs:n.length>0?[...n]:[""],columns:t.originalColumns}}componentDidUpdate(e,t){var{inputs:n}=this.state,{onChange:a}=this.props;if(t.inputs!==n){var r=n.filter(o=>o!=="");Me(t.inputs.filter(o=>o!==""),r)||a(r)}}handleAddColumnClick(){this.setState(e=>{var{inputs:t}=e;return{inputs:[...t,""]}})}handleDeleteColumn(e){this.setState(t=>{var{inputs:n}=t;return{inputs:n.length===1&&e===0?[""]:n.filter((a,r)=>e!==r)}})}handleDropdownChanged(e,t){Uo.debug("handleDropdownChanged",e,t),this.setState(n=>{var{inputs:a}=n,r=[...a];return r[e]=t,{inputs:r}})}renderInputs(){var{columns:e,inputs:t}=this.state;return t.map((n,a)=>{var r=e.filter(o=>{var{name:l}=o;return l===n||!t.includes(l)}).map(o=>{var{name:l}=o;return s.jsx("option",{value:l,children:l},l)});return s.jsxs("div",{className:"form-inline px-3 pb-3",children:[s.jsxs(Ye,{className:"form-control custom-select col",value:n,onChange:o=>this.handleDropdownChanged(a,o),children:[s.jsx("option",{value:"",children:"Select a column"}),r]}),(t.length>1||n!=="")&&s.jsx(k,{kind:"ghost",className:"ml-1 px-2",onClick:()=>{this.handleDeleteColumn(a)},icon:s.jsx(z,{icon:mn,transform:"grow-3"}),tooltip:"Delete column"})]},a)})}render(){var{columns:e,inputs:t}=this.state,n=t.length>=e.length;return s.jsxs("div",{role:"presentation",className:"select-distinct-builder-container h-100",children:[s.jsx("div",{className:"select-distinct-title",children:"Display Unique Values From"}),this.renderInputs(),s.jsx("hr",{}),s.jsx("div",{className:"pt-1 px-3",children:s.jsx(k,{kind:"ghost",className:"btn-add-column",onClick:this.handleAddColumnClick,disabled:n,icon:gn,children:"Add Additional Column"})}),s.jsx("div",{className:"select-distinct-builder-footer",children:s.jsx("div",{className:"select-distinct-builder-hint",children:"Display only unique values from the selected table columns. Note that this will reset any filters and display only the selected columns."})})]})}}Lo(Ui,"defaultProps",{selectDistinctColumns:[],onChange:()=>{}});function Cn(i){var{items:e,onChange:t=()=>{}}=i;return s.jsx(Oi,{items:Array.from(e.entries()).map(n=>{var[a,r]=n;return{title:Cn.getAdvancedSettingsTitleForKey(a),isOn:r,onChange:o=>t(a,o)}})})}Cn.getAdvancedSettingsTitleForKey=i=>{switch(i){case yt.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS:return"Clear current table filters before applying new filters from a control";case yt.LINK_CHANGE_CLEARS_ALL_FILTERS:return"Clear current table filters before applying new filters from an incoming link filter"}};function di(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(i,a).enumerable})),t.push.apply(t,n)}return t}function Ke(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?di(Object(t),!0).forEach(function(n){Mo(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):di(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Mo(i,e,t){return(e=ko(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ko(i){var e=Vo(i,"string");return typeof e=="symbol"?e:e+""}function Vo(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var ui=ue.module("ConditionalFormattingMenu"),nn=()=>{};function Go(i){var{column:{type:e}}=i;if(b.isNumberType(e))return i.condition===R.IS_NULL||i.condition===R.IS_NOT_NULL?"":"".concat(i.value);if(b.isCharType(e))return i.condition===L.IS_NULL||i.condition===L.IS_NOT_NULL?"":"".concat(i.value);if(b.isStringType(e))return i.condition===P.IS_NULL||i.condition===P.IS_NOT_NULL?"":'"'.concat(i.value,'"');if(b.isDateType(e))return i.condition===L.IS_NULL||i.condition===L.IS_NOT_NULL?"":"".concat(i.value);if(b.isBooleanType(e))return"";throw new Error("Invalid column type ".concat(e," in getRuleValue"))}function Bo(i){return b.isNumberType(i.column.type)&&i.condition===R.IS_BETWEEN?"".concat(i.start," < ").concat(i.column.name," < ").concat(i.end):"".concat(i.column.name," ").concat(Ks(i.column.type,i.condition),`
2
2
  `).concat(Go(i))}function Ho(i){var{rules:e=[],onChange:t=nn,onCreate:n=nn,onSelect:a=nn}=i,r=v.useCallback((u,h,m)=>{u.stopPropagation(),ui.debug("Rule clicked",h,m),a(m)},[a]),o=v.useCallback((u,h,m)=>{u.stopPropagation(),ui.debug("Delete button clicked",h,m);var c=[...e];c.splice(m,1),t(c)},[t,e]),l=v.useCallback(u=>{u.stopPropagation()},[]),d=v.useCallback(u=>{if(ei.stopDragging(),u.destination!=null){var h=u.source.index,m=u.destination.index,c=[...e],g=e[h];c.splice(h,1),c.splice(m,0,g),t(c)}},[t,e]);return s.jsxs("div",{className:"conditional-formatting-rules",children:[s.jsx(ja,{onDragStart:ei.startDragging,onDragEnd:d,children:s.jsx(Pa,{droppableId:"droppable-custom-columns",children:(u,h)=>s.jsxs("div",Ke(Ke({ref:u.innerRef},u.droppableProps),{},{className:W("droppable-container",{dragging:h.draggingFromThisWith}),children:[e.length===0&&s.jsx("div",{className:"text-muted pl-2",children:"No formats defined"}),e.map((m,c)=>s.jsx(Ua,{draggableId:"".concat(c,"-").concat(m.type),index:c,disableInteractiveElementBlocking:!0,children:(g,p)=>s.jsx("div",Ke(Ke({role:"menuitem",tabIndex:0,onClick:f=>r(f,m,c),className:W("draggable-container",{dragging:p.isDragging}),ref:g.innerRef},g.draggableProps),{},{children:s.jsx("div",{className:"conditional-formatting-list-item",children:s.jsxs("div",{className:"formatting-item",children:[s.jsx("div",{className:"rule-icon",children:s.jsx("span",{className:"rule-icon-bg",style:{backgroundColor:wt(m.config.style),color:Nt(m.config.style)},children:m.type===Se.ROWS?"row":"col"})}),s.jsx("div",{className:"rule-title",children:Bo(m.config)}),s.jsx(k,{kind:"ghost",className:"ml-1 px-2",onClick:f=>o(f,m,c),icon:mn,tooltip:"Delete rule"}),s.jsxs("button",Ke(Ke({type:"button",className:"btn btn-link btn-link-icon px-2 btn-drag-handle",onClick:l},g.dragHandleProps),{},{children:[s.jsx(ze,{children:"Drag to re-order"}),s.jsx(z,{icon:Ya})]}))]})})}))},"".concat(c,"-").concat(m.type))),u.placeholder]}))})}),s.jsx("hr",{}),s.jsx(k,{kind:"ghost",onClick:n,icon:gn,children:"Add New Rule"})]})}var Ue=ue.module("ConditionEditor"),Wo=()=>{},$o=[R.IS_EQUAL,R.IS_NOT_EQUAL,R.IS_BETWEEN,R.GREATER_THAN,R.GREATER_THAN_OR_EQUAL,R.LESS_THAN,R.LESS_THAN_OR_EQUAL,R.IS_NULL,R.IS_NOT_NULL].map(i=>s.jsx("option",{value:i,children:Rs(i)},i)),Ko=[P.IS_EXACTLY,P.IS_NOT_EXACTLY,P.CONTAINS,P.DOES_NOT_CONTAIN,P.STARTS_WITH,P.ENDS_WITH,P.IS_NULL,P.IS_NOT_NULL].map(i=>s.jsx("option",{value:i,children:Is(i)},i)),zo=[L.IS_EXACTLY,L.IS_NOT_EXACTLY,L.IS_BEFORE,L.IS_BEFORE_OR_EQUAL,L.IS_AFTER,L.IS_AFTER_OR_EQUAL,L.IS_NULL,L.IS_NOT_NULL].map(i=>s.jsx("option",{value:i,children:Ds(i)},i)),Qo=[oe.IS_TRUE,oe.IS_FALSE,oe.IS_NULL,oe.IS_NOT_NULL].map(i=>s.jsx("option",{value:i,children:Ls(i)},i)),Yo=[ie.IS_EQUAL,ie.IS_NOT_EQUAL,ie.IS_NULL,ie.IS_NOT_NULL].map(i=>s.jsx("option",{value:i,children:js(i)},i));function qo(i,e,t,n){return i===R.IS_NULL||i===R.IS_NOT_NULL||i===R.IS_BETWEEN&&t!=null&&t!==""&&!Number.isNaN(Number.parseFloat(t))&&n!=null&&n!==""&&!Number.isNaN(Number.parseFloat(n))||i!==R.IS_BETWEEN&&e!==void 0&&e!==""&&!Number.isNaN(Number.parseFloat(e))}function Xo(i,e,t,n,a,r,o){switch(i){case R.IS_EQUAL:case R.IS_NOT_EQUAL:case R.GREATER_THAN:case R.GREATER_THAN_OR_EQUAL:case R.LESS_THAN:case R.LESS_THAN_OR_EQUAL:return s.jsx("input",{type:"number",className:"form-control",placeholder:"Enter value",value:a??"",onChange:e});case R.IS_BETWEEN:return s.jsxs("div",{className:"d-flex flex-row",children:[s.jsx("input",{type:"number",className:"form-control d-flex mr-2",placeholder:"Start value",value:r??"",onChange:t}),s.jsx("input",{type:"number",className:"form-control d-flex",placeholder:"End value",value:o??"",onChange:n})]});case R.IS_NULL:case R.IS_NOT_NULL:return null}}function Zo(i,e,t){switch(i){case P.IS_NULL:case P.IS_NOT_NULL:return null;default:return s.jsx("input",{type:"text",className:"form-control",placeholder:"Enter value",value:t??"",onChange:e})}}function Jo(i,e,t){switch(i){case L.IS_NULL:case L.IS_NOT_NULL:return null;default:return s.jsx("input",{type:"text",className:"form-control",placeholder:"Enter value",value:t??"",onChange:e})}}function el(){return null}function tl(i,e,t){switch(i){case ie.IS_NULL:case ie.IS_NOT_NULL:return null;default:return s.jsx("input",{type:"text",className:"form-control",maxLength:1,placeholder:"Enter value",value:t??"",onChange:e})}}function Mi(i){var{column:e,config:t,dh:n,onChange:a=Wo}=i,r=e.type,[o,l]=v.useState(r),[d,u]=v.useState(t.condition),[h,m]=v.useState(t.value),[c,g]=v.useState(t.start),[p,f]=v.useState(t.end);r!==o&&(u(xi(r)),m(Ri(r)),g(void 0),f(void 0),l(r));var y=v.useMemo(()=>{if(r===void 0)return[];if(b.isNumberType(r))return $o;if(b.isCharType(r))return Yo;if(b.isStringType(r))return Ko;if(b.isDateType(r))return zo;if(b.isBooleanType(r))return Qo},[r]),F=v.useCallback(A=>{Ue.debug("handleConditionChange",A),u(A)},[]),T=v.useCallback(A=>{var{value:D}=A.target;Ue.debug("handleValueChange",D),m(D)},[]),C=v.useCallback(A=>{var{value:D}=A.target;Ue.debug("handleStartValueChange",D),g(D)},[]),_=v.useCallback(A=>{var{value:D}=A.target;Ue.debug("handleEndValueChange",D),f(D)},[]);v.useEffect(function(){var D=!0;d===void 0?(Ue.debug("Unable to create formatting rule. Condition is not selected."),D=!1):b.isNumberType(e.type)&&!qo(d,h,c,p)?(Ue.debug("Unable to create formatting rule. Invalid value",h),D=!1):b.isDateType(e.type)&&!Qs(n,d,h)&&(Ue.debug("Unable to create formatting rule. Invalid date condition",h),D=!1),a({condition:d,value:h,start:c,end:p},D)},[a,e.type,n,d,h,c,p]);var E=v.useMemo(()=>{if(r===void 0)return null;if(b.isNumberType(r))return Xo(d,T,C,_,h,c,p);if(b.isCharType(r))return tl(d,T,h);if(b.isStringType(r))return Zo(d,T,h);if(b.isDateType(r))return Jo(d,T,h);if(b.isBooleanType(r))return el()},[r,d,h,c,p,T,C,_]);return s.jsxs("div",{className:"condition-editor mb-2",children:[s.jsx(Ye,{value:d,"data-testid":"condition-select",className:"custom-select mb-2",onChange:F,children:y}),E]})}var nl=ue.module("StyleEditor"),il="#fcfcfa",al="#f0f0ee",rl="#1a171a",sl=200,ol=()=>{};function ki(i){var e,t,{config:n,onChange:a=ol}=i,[r,o]=v.useState(n.type),[l,d]=v.useState((e=(t=n.customConfig)===null||t===void 0?void 0:t.background)!==null&&e!==void 0?e:il),[u,h]=v.useState(!1),[m,c]=v.useState(sl),g=v.useRef(null),p=v.useCallback(E=>{var{value:A}=E.target;nl.debug("handleBackgroundChange",A),d(A)},[]),f=v.useCallback(()=>{u&&h(!1)},[u]),y=v.useCallback(()=>{u||T(),h(!u)},[u]),F=v.useMemo(()=>[M.NO_FORMATTING,M.POSITIVE,M.NEGATIVE,M.WARN,M.NEUTRAL,M.ACCENT_1,M.ACCENT_2,M.CUSTOM],[]);function T(){g.current&&c(g.current.getBoundingClientRect().width)}v.useEffect(function(){a({type:r,customConfig:{color:qa.isDark(l)?al:rl,background:l}})},[a,r,l]);var C=v.useCallback(()=>{for(var E=[],A=function(){var te=F[D],Y="option-".concat(D,"-").concat(te);E.push(s.jsxs(k,{kind:"inline",className:"style-option-btn",onClick:()=>{o(te),h(!1)},style:{color:Nt({type:te}),background:wt({type:te})},children:[te===r&&s.jsx(z,{icon:Xa,className:"mr-2"}),te!==r&&s.jsx("span",{className:"mr-4"}),ai(te)]},Y))},D=0;D<F.length;D+=1)A();return E},[F,r]),_=v.useCallback(()=>s.jsx("div",{className:"style-menu-container",role:"presentation",style:{width:m},children:s.jsx("div",{className:"style-options",children:C()})}),[m,C]);return s.jsxs("div",{className:"style-editor",children:[s.jsxs("div",{className:"mb-2",ref:g,children:[s.jsx("label",{className:"mb-0",children:"Style"}),s.jsxs(k,{kind:"inline",className:"cs-dropdown custom-select",style:{color:Nt({type:r}),background:wt({type:r})},onClick:y,children:[ai(r),s.jsx(Cr,{isShown:u,actions:{menuElement:_()},popperOptions:{placement:"bottom-start"},popperClassName:"style-dropdown-menu",onMenuClosed:f,menuStyle:{maxWidth:"100rem"}})]})]}),r===M.CUSTOM&&s.jsxs("div",{className:"mb-2",children:[s.jsx("label",{className:"mb-0",children:"Background"}),s.jsx("input",{type:"color",value:l,className:"custom-select color-select",onChange:p})]})]})}function hi(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(i,a).enumerable})),t.push.apply(t,n)}return t}function Vi(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?hi(Object(t),!0).forEach(function(n){ll(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):hi(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function ll(i,e,t){return(e=dl(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function dl(i){var e=ul(i,"string");return typeof e=="symbol"?e:e+""}function ul(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var rt=ue.module("ColumnFormatEditor"),hl=()=>{};function cl(i){var{type:e,name:t}=i[0],n={type:e,name:t},a=Vi({column:n,style:Di()},Ot(e));return a}function ml(i){var e,{columns:t,config:n=cl(t),dh:a,onChange:r=hl}=i,[o,l]=v.useState((e=t.find(T=>T.name===n.column.name&&T.type===n.column.type))!==null&&e!==void 0?e:t[0]),[d,u]=v.useState(Ii(n)),[h,m]=v.useState(!1),[c,g]=v.useState(n.style),p=v.useCallback(T=>{var C=t.find(_=>{var{name:E}=_;return E===T});C!==void 0?(l(C),o.type!==C.type&&(u(Ot(C.type)),m(!1))):rt.error("Column ".concat(T," not found."))},[t,o]),f=v.useCallback((T,C)=>{rt.debug("handleConditionChange",T,C),u(T),m(C)},[]),y=v.useCallback(T=>{rt.debug("handleStyleChange",T),g(T)},[]);v.useEffect(function(){var C=h;o===void 0&&(rt.debug("Column is not selected, invalidating update."),C=!1),(c===void 0||c.type===M.NO_FORMATTING)&&(rt.debug("Style is not selected, invalidating update."),C=!1);var{type:_,name:E}=o,A={type:_,name:E};r(Vi({column:A,style:c},d),C)},[r,o,c,d,h]);var F=v.useMemo(()=>t.map(T=>{var{name:C}=T;return C}),[t]);return s.jsxs("div",{className:"conditional-rule-editor form",children:[s.jsxs("div",{className:"mb-2",children:[s.jsx("label",{className:"mb-0",children:"Format Cell If"}),s.jsx(_i,{"aria-label":"Select column to format",defaultSelectedKey:o==null?void 0:o.name,onChange:p,children:F})]}),o!==void 0&&s.jsxs(s.Fragment,{children:[s.jsx(Mi,{dh:a,column:o,config:d,onChange:f}),s.jsx(ki,{config:c,onChange:y})]})]})}function ci(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(i,a).enumerable})),t.push.apply(t,n)}return t}function Gi(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ci(Object(t),!0).forEach(function(n){gl(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):ci(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function gl(i,e,t){return(e=vl(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function vl(i){var e=pl(i,"string");return typeof e=="symbol"?e:e+""}function pl(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var st=ue.module("RowFormatEditor"),fl=()=>{};function Cl(i){var{type:e,name:t}=i[0],n={type:e,name:t},a=Gi({column:n,style:Di()},Ot(e));return a}function Sl(i){var e,{columns:t,config:n=Cl(t),dh:a,onChange:r=fl}=i,[o,l]=v.useState((e=t.find(T=>T.name===n.column.name&&T.type===n.column.type))!==null&&e!==void 0?e:t[0]),[d,u]=v.useState(Ii(n)),[h,m]=v.useState(!1),[c,g]=v.useState(n.style),p=v.useCallback(T=>{var C=t.find(_=>{var{name:E}=_;return E===T});C!==void 0?(l(C),o.type!==C.type&&(u(Ot(C.type)),m(!1))):st.error("Column ".concat(T," not found."))},[t,o]),f=v.useCallback((T,C)=>{st.debug("handleConditionChange",T,C),u(T),m(C)},[]),y=v.useCallback(T=>{st.debug("handleStyleChange",T),g(T)},[]);v.useEffect(function(){if(o===void 0){st.debug("Column is not selected, skip update.");return}if(c===void 0){st.debug("Style is not selected, skip update.");return}var{type:C,name:_}=o,E={type:C,name:_};r(Gi({column:E,style:c},d),h)},[r,o,c,d,h]);var F=v.useMemo(()=>t.map(T=>{var{name:C}=T;return C}),[t]);return s.jsxs("div",{className:"conditional-rule-editor form",children:[s.jsxs("div",{className:"mb-2",children:[s.jsx("label",{className:"mb-0",children:"Format Row If"}),s.jsx(_i,{"aria-label":"Select column to format row by",defaultSelectedKey:o==null?void 0:o.name,onChange:p,children:F})]}),o!==void 0&&s.jsxs(s.Fragment,{children:[s.jsx(Mi,{column:o,config:d,dh:a,onChange:f}),s.jsx(ki,{config:c,onChange:y})]})]})}var an=ue.module("ConditionalFormatEditor"),rn=()=>{};function bl(i){switch(i){case Se.CONDITIONAL:return s.jsx(Pr,{});case Se.ROWS:return s.jsx(jr,{})}}function Tl(i){switch(i){case Se.CONDITIONAL:return"Conditional";case Se.ROWS:return"Rows"}}var mi=[Se.CONDITIONAL,Se.ROWS];function El(i){var e,{columns:t,dh:n,onSave:a=rn,onUpdate:r=rn,onCancel:o=rn,rule:l}=i,d=t.filter(Ys),[u,h]=v.useState((e=l==null?void 0:l.type)!==null&&e!==void 0?e:mi[0]),[m,c]=v.useState(l),[g,p]=v.useState(!1),f=v.useCallback(()=>{o()},[o]),y=v.useCallback(()=>{if(m===void 0){an.error("Rule is not defined.");return}a(m)},[a,m]),F=v.useCallback(C=>{an.debug("handleFormatterChange",C),h(C)},[]),T=v.useCallback((C,_)=>{an.debug("handleRuleChange",C,_,u);var E={type:u,config:C};c(E),p(_),r(_?E:void 0)},[r,u]);return s.jsxs("div",{className:"conditional-format-editor form",children:[s.jsxs("div",{className:"mb-2",children:[s.jsx("label",{className:"mb-0",htmlFor:"formatter-select",children:"Select Formatter"}),s.jsx("div",{className:"formatter-list",children:mi.map((C,_)=>s.jsx("div",{className:"formatter-type",children:s.jsxs("button",{type:"button",className:W("btn","btn-icon","btn-formatter-type",{active:C===u}),"data-index":_,onClick:()=>F(C),children:[bl(C),Tl(C)]})},C))})]}),u===Se.CONDITIONAL&&s.jsx(ml,{columns:d,dh:n,config:m==null?void 0:m.config,onChange:T}),u===Se.ROWS&&s.jsx(Sl,{columns:d,config:m==null?void 0:m.config,dh:n,onChange:T}),s.jsx("hr",{}),s.jsxs("div",{className:"d-flex justify-content-end my-3",children:[s.jsx(k,{kind:"secondary",onClick:f,className:"mr-2",children:"Cancel"}),s.jsx(k,{kind:"primary",onClick:y,disabled:m===void 0||!g,children:"Done"})]})]})}function yl(i){var e,t,{text:n,isOpen:a,onClose:r}=i,[o,l]=v.useState(!1),[d,u]=v.useState(0),[h,m]=v.useState(!1),[c,g]=v.useState(!1),[p,f]=v.useState(!1),y=v.useRef();v.useEffect(function(){if(a){try{JSON.parse(n),f(!0)}catch{f(!1)}g(!1)}},[a,n]),v.useEffect(function(){y.current&&y.current.layout()},[d]),v.useEffect(function(){y.current&&y.current.updateOptions({lineNumbers:h?"on":"off"})},[h]);function F(){m(!h)}function T(){var A,D=(A=y.current)===null||A===void 0?void 0:A.getModel();!p||!D||(c?(D.setValue(n),g(!1)):(D.setValue(JSON.stringify(JSON.parse(n),void 0,2)),g(!0)),C())}function C(){var A,D,$=y.current;$&&m(((A=(D=$.getModel())===null||D===void 0?void 0:D.getLineCount())!==null&&A!==void 0?A:0)>1)}function _(){o&&(y.current=void 0,r())}function E(A){y.current=A,u(A.getContentHeight()),A.onDidContentSizeChange(D=>{var{contentHeight:$}=D;return u($)}),C()}return!a&&!o?null:s.jsxs(Si,{isOpen:a,centered:!0,keyboard:!0,toggle:_,onOpened:()=>l(!0),onClosed:()=>{l(!1),u(0)},className:"cell-overflow-modal",size:"xl",children:[s.jsxs(bi,{toggle:r,children:[s.jsx("h5",{className:"overflow-modal-title",children:"Cell Contents"}),s.jsx(Ni,{kind:"inline",tooltip:"Copy cell contents",copy:(e=(t=y.current)===null||t===void 0?void 0:t.getValue())!==null&&e!==void 0?e:n}),s.jsx(k,{kind:"inline",active:h,icon:Za,tooltip:"Toggle line numbers",onClick:F}),p&&s.jsx(k,{kind:"inline",icon:Ja,active:c,tooltip:"Format as JSON",onClick:T})]}),s.jsx(Ti,{style:{height:d},children:s.jsx(Sr,{onEditorInitialized:E,settings:{value:n,readOnly:!0,wordWrap:"on",language:p?"typescript":"plaintext",folding:p,padding:{bottom:16},lineNumbers:h?"on":"off",overviewRulerLanes:0,renderLineHighlight:"none",find:{seedSearchStringFromSelection:"never"}}})})]})}var wl="###,##0",Bi=v.forwardRef((i,e)=>{var{gotoRow:t,gotoRowError:n,gotoValueError:a,onGotoRowSubmit:r,isShown:o,onEntering:l,onEntered:d,onExiting:u,onExited:h,model:m,onGotoRowNumberChanged:c,onClose:g,gotoValueSelectedColumnName:p,gotoValue:f,gotoValueFilter:y,onGotoValueSelectedColumnNameChanged:F,onGotoValueSelectedFilterChanged:T,onGotoValueChanged:C,onGotoValueSubmit:_}=i,E=v.useRef(null),A=v.useRef(null),[D,$]=v.useState(!1),te=[];xr(m)&&({columns:te}=m.table);var{dh:Y,rowCount:re}=m,K=v.useMemo(()=>"goto-row-input-".concat(sn()),[]),me=x=>{x.key==="Enter"?(x.stopPropagation(),x.preventDefault(),_()):(x.key==="Backspace"||x.key==="Delete")&&(f==="".concat(Number.POSITIVE_INFINITY)||f==="".concat(Number.NEGATIVE_INFINITY))&&ve("")},Ne=x=>{x.key==="Enter"&&(x.stopPropagation(),x.preventDefault(),_(x.shiftKey))},ge=m.getColumnIndexByName(p),Te=te[ge??0],Fe=Te==null?void 0:Te.type,Re=b.getNormalizedType(Fe),ve=x=>{C(x??"")};v.useImperativeHandle(e,()=>({focus(){var x;$(!0),(x=E.current)===null||x===void 0||x.select()}}));var Ve=()=>{if(D&&document.activeElement!==E.current){var x;(x=E.current)===null||x===void 0||x.select()}else if(!D&&document.activeElement!==A.current){var S;(S=A.current)===null||S===void 0||S.select()}};v.useEffect(Ve,[D]);var Ae=()=>{switch(Re){case b.dataType.DECIMAL:case b.dataType.INT:return s.jsx("div",{className:"goto-row-input",children:s.jsx("input",{ref:A,className:W("form-control",{"is-invalid":a!==""}),onKeyDown:me,placeholder:"value",onChange:x=>{var S=x.target.value.toLowerCase();/^-?[0-9]*\.?[0-9]*$/.test(x.target.value)?ve(x.target.value):S==="-i"||S==="-infinity"?ve("".concat(Number.NEGATIVE_INFINITY)):(S==="i"||S==="infinity")&&ve("".concat(Number.POSITIVE_INFINITY))},value:f,"aria-label":"Value Input"})});case b.dataType.DATETIME:return s.jsx("div",{className:"goto-value-date-time-input",children:s.jsx(ls,{ref:A,className:W("form-control","goto-value-date-time-input",{"is-invalid":a!==""}),defaultValue:f,onChange:ve,onSubmit:Ne,"aria-label":"Value Input"})});case b.dataType.STRING:return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"goto-row-input",children:s.jsxs(Ye,{className:"custom-select",onChange:x=>{T(x)},value:y,"aria-label":"filter-type-select",children:[s.jsx("option",{value:ce.eqIgnoreCase,children:"Equals (case-insensitive)"},ce.eqIgnoreCase),s.jsx("option",{value:ce.containsIgnoreCase,children:"Contains (case-insensitive)"},ce.containsIgnoreCase),s.jsx("option",{value:ce.eq,children:"Equals"},ce.eq),s.jsx("option",{value:ce.contains,children:"Contains"},ce.contains)]})}),s.jsx("div",{className:"goto-row-input",children:s.jsx("input",{ref:A,className:W("form-control",{"is-invalid":a!==""}),onKeyDown:Ne,placeholder:"value",onChange:x=>ve(x.target.value),value:f,"aria-label":"Value Input"})})]});case b.dataType.BOOLEAN:return s.jsx("div",{className:"goto-row-input",children:s.jsxs(Ye,{className:"custom-select",onChange:x=>{ve(x)},value:f,"aria-label":"Value Input",children:[s.jsx("option",{"aria-label":"null value",value:""},"null"),s.jsx("option",{value:"true",children:"true"},"true"),s.jsx("option",{value:"false",children:"false"},"false")]})});default:return s.jsx("div",{className:"goto-row-input",children:s.jsx("input",{ref:A,className:"form-control",onKeyDown:Ne,placeholder:"value",onChange:x=>ve(x.target.value),value:f,"aria-label":"Value Input"})})}};return s.jsx(_t,{isShown:o,className:W("goto-row"),onEntering:l,onEntered:()=>{d(),Ve()},onExiting:u,onExited:h,children:s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"goto-row-row",children:[s.jsxs("div",{className:W("goto-row-wrapper",{"is-inactive":!D}),onClick:()=>$(!0),onFocus:()=>$(!0),role:"group",children:[s.jsx("label",{className:"goto-row-text",htmlFor:K,children:"Go to row"}),s.jsx("div",{className:"goto-row-input",children:s.jsx("input",{ref:E,"data-testid":"goto-row-input",type:"number",onKeyDown:x=>{x.key==="Enter"&&(x.stopPropagation(),x.preventDefault(),r())},className:W("form-control",{"is-invalid":n!==""}),placeholder:"Row number",onChange:x=>{c(x)},value:t,id:K})}),s.jsxs("div",{className:"goto-row-text",children:["of"," ",Y.i18n.NumberFormat.format(wl,re)]}),n&&s.jsx("div",{className:"text-danger",children:n})]}),s.jsx("div",{className:"goto-row-close",children:s.jsx(k,{kind:"ghost",onClick:g,children:s.jsx(z,{icon:Ei,style:{marginRight:"0"}})})})]}),m.isSeekRowAvailable&&s.jsx("div",{className:"goto-row-row",children:s.jsxs("div",{className:W("goto-row-wrapper",{"is-inactive":D}),onClick:()=>$(!1),onFocus:()=>$(!1),role:"group",children:[s.jsx("div",{className:"goto-row-text",children:"Go to value"}),s.jsx("div",{className:"goto-row-input",children:s.jsx(Ye,{className:"custom-select",onChange:x=>{var S=x;F(S)},value:p,"aria-label":"column-name-select",id:"column-name-select",children:te.map(x=>s.jsx("option",{value:x.name,children:x.name},x.name))})}),Ae(),s.jsxs("div",{children:[s.jsx(k,{tooltip:"Previous match",icon:er,kind:"ghost",disabled:f==="",onClick:()=>{_(!0)}}),s.jsx(k,{tooltip:"Next match",icon:tr,kind:"ghost",disabled:f==="",onClick:()=>{_(!1)}})]}),a&&s.jsx("div",{className:"text-danger",children:a})]})})]})})});Bi.displayName="GotoRow";function Nl(i){var{isOpen:e,onClose:t,errorMessage:n}=i,a=br.PASTE.getDisplayText();return s.jsxs(Si,{isOpen:e,toggle:t,centered:!0,children:[s.jsx(bi,{closeButton:!1,children:"No Paste Permission"}),s.jsxs(Ti,{children:[s.jsx("p",{children:n}),s.jsxs("p",{children:["You can still use ",a," to paste."]})]}),s.jsx(Tr,{children:s.jsx(k,{kind:"primary",onClick:t,children:"Dismiss"})})]})}function gi(i,e,t,n,a,r,o){try{var l=i[r](o),d=l.value}catch(u){return void t(u)}l.done?e(d):Promise.resolve(d).then(n,a)}function ot(i){return function(){var e=this,t=arguments;return new Promise(function(n,a){var r=i.apply(e,t);function o(d){gi(r,n,a,o,l,"next",d)}function l(d){gi(r,n,a,o,l,"throw",d)}o(void 0)})}}function vi(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(i,a).enumerable})),t.push.apply(t,n)}return t}function X(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vi(Object(t),!0).forEach(function(n){w(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):vi(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function w(i,e,t){return(e=Fl(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Fl(i){var e=Al(i,"string");return typeof e=="symbol"?e:e+""}function Al(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var N=ue.module("IrisGrid"),Ol=500,_l=500,xl=250,Rl=250,Il=250,cn=Object.freeze({aggregations:Z,showOnTop:!1}),Dl="yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS z";function pi(i){var{advancedFilters:e,aggregationSettings:t,customColumns:n,quickFilters:a,reverse:r,rollupConfig:o,searchFilter:l,selectDistinctColumns:d,sorts:u}=i;return e.size===0&&t.aggregations.length===0&&n.length===0&&a.size===0&&!r&&o==null&&l==null&&d.length===0&&u.length===0}class we extends v.Component{constructor(e){var t,n,a;super(e),w(this,"grid",void 0),w(this,"lastFocusedFilterBarColumn",void 0),w(this,"lastLoadedConfig",void 0),w(this,"tooltip",void 0),w(this,"pending",void 0),w(this,"globalColumnFormats",void 0),w(this,"dateTimeFormatterOptions",void 0),w(this,"decimalFormatOptions",void 0),w(this,"integerFormatOptions",void 0),w(this,"truncateNumbersWithPound",void 0),w(this,"showEmptyStrings",void 0),w(this,"showNullStrings",void 0),w(this,"showExtraGroupColumn",void 0),w(this,"loadingScrimStartTime",void 0),w(this,"loadingScrimFinishTime",void 0),w(this,"animationFrame",void 0),w(this,"loadingTimer",void 0),w(this,"tableSaver",void 0),w(this,"crossColumnRef",void 0),w(this,"isAnimating",void 0),w(this,"filterInputRef",void 0),w(this,"gotoRowRef",void 0),w(this,"isCopying",void 0),w(this,"toggleFilterBarAction",void 0),w(this,"toggleSearchBarAction",void 0),w(this,"toggleGotoRowAction",void 0),w(this,"discardAction",void 0),w(this,"commitAction",void 0),w(this,"contextActions",void 0),w(this,"tableUtils",void 0),w(this,"keyHandlers",void 0),w(this,"mouseHandlers",void 0),w(this,"slideTransitionRef",xe.createRef()),w(this,"bottomTransitionRef",xe.createRef()),w(this,"getAdvancedMenuOpenedHandler",Q(S=>this.handleAdvancedMenuOpened.bind(this,S),{max:100})),w(this,"getCachedAdvancedFilterMenuActions",Q((S,O,I,V,B)=>s.jsx(ye,{model:S,column:O,onFilterChange:this.handleAdvancedFilterChange,onSortChange:this.handleAdvancedFilterSortChange,onDone:this.handleAdvancedFilterDone,options:I,sortDirection:V,formatter:B,tableUtils:this.tableUtils}),{max:50})),w(this,"getCachedOptionItems",Q((S,O,I,V,B,H,q,ae,J,se,Oe,Ge,xt,Rt,pt,It,Xe)=>{var le=[];return S&&le.push({type:G.CHART_BUILDER,title:"Chart Builder",icon:nr}),V&&le.push({type:G.VISIBILITY_ORDERING_BUILDER,title:"Organize Columns",icon:ir}),I&&le.push({type:G.CONDITIONAL_FORMATTING,title:"Conditional Formatting",icon:ar}),O&&le.push({type:G.CUSTOM_COLUMN_BUILDER,title:"Custom Columns",icon:rr}),B&&le.push({type:G.ROLLUP_ROWS,title:"Rollup Rows",icon:sr}),H&&le.push({type:G.AGGREGATIONS,title:"Aggregate Columns",icon:or}),q&&le.push({type:G.SELECT_DISTINCT,title:"Select Distinct Values",icon:lr}),ae&&Rt&&le.push({type:G.TABLE_EXPORTER,title:"Download CSV",icon:dr}),Xe&&le.push({type:G.ADVANCED_SETTINGS,title:"Advanced Settings",icon:ur}),le.push({type:G.QUICK_FILTERS,title:"Quick Filters",subtitle:J.shortcut.getDisplayText(),icon:dn,isOn:Ge,onChange:J.action}),pt&&le.push({type:G.SEARCH_BAR,title:"Search Bar",subtitle:se.shortcut.getDisplayText(),icon:hr,isOn:xt,onChange:se.action}),le.push({type:G.GOTO,title:"Go to",subtitle:Oe.shortcut.getDisplayText(),icon:cr,isOn:It,onChange:Oe.action}),Object.freeze(le)},{max:1})),w(this,"getCachedHiddenColumns",Q((S,O)=>ee.getHiddenColumns(new Map([...S.initialColumnWidths,...O])),{max:1})),w(this,"getAggregationMap",Q((S,O)=>{var I={};return O.forEach(V=>{var{operation:B,selected:H,invert:q}=V;I[B]=We.getOperationColumnNames(S,B,H,q)}),I},{max:1})),w(this,"getOperationMap",Q((S,O)=>{var I={};return O.filter(V=>!We.isRollupOperation(V.operation)).forEach(V=>{var{operation:B,selected:H,invert:q}=V;We.getOperationColumnNames(S,B,H,q).forEach(ae=>{var J,se=[...(J=I[ae])!==null&&J!==void 0?J:[],B];I[ae]=Object.freeze(se)})}),I},{max:1})),w(this,"getOperationOrder",Q(S=>S.map(O=>O.operation).filter(O=>!We.isRollupOperation(O)),{max:1})),w(this,"getCachedFormatColumns",Q((S,O,I)=>zs(S,O,I),{max:1e3})),w(this,"getCachedPreviewFormatColumns",Q((S,O,I,V,B)=>{if(N.debug("getCachedPreviewFormatColumns",I,V,B),V!==void 0&&B!==void 0){var H=[...I];return H[B]=V,this.getCachedFormatColumns(S,O,H)}return this.getCachedFormatColumns(S,O,I)},{max:1})),w(this,"getModelRollupConfig",Q((S,O,I)=>ee.getModelRollupConfig(S,O,I),{max:1})),w(this,"getModelTotalsConfig",Q((S,O,I)=>{var V,B;if(((V=O==null||(B=O.columns)===null||B===void 0?void 0:B.length)!==null&&V!==void 0?V:0)>0)return null;var H=I.aggregations.filter(J=>J.selected.length>0||J.invert);if(H.length===0)return null;var q=this.getOperationMap(S,H),ae=this.getOperationOrder(H);return{operationMap:q,operationOrder:ae,showOnTop:I.showOnTop,defaultOperation:Rr.SKIP}},{max:1})),w(this,"getCachedStateOverride",Q((S,O,I,V,B,H,q,ae,J,se,Oe,Ge)=>({model:S,theme:O,hoverSelectColumn:I,isFilterBarShown:V,isSelectingColumn:B,loadingScrimProgress:H,quickFilters:q,advancedFilters:ae,sorts:J,reverse:se,rollupConfig:Oe,isMenuShown:Ge}),{max:1})),w(this,"getCachedFilter",Q((S,O,I,V)=>[...S??[],...ee.getFiltersFromFilterMap(O),...ee.getFiltersFromFilterMap(I),...V!==void 0?[V]:[]],{max:1})),w(this,"getCachedTheme",Q((S,O,I,V,B)=>{var H,q=S??Ur(),ae=V>0?(H=O==null?void 0:O.rowFooterWidth)!==null&&H!==void 0?H:q.rowFooterWidth:0,{metricCalculator:J}=this.state;J!=null&&(J.resetCalculatedColumnWidths(),J.resetCalculatedRowHeights());var se={};return B==="compact"?se=q.density.compact:B==="spacious"&&(se=q.density.spacious),X(X(X(X({},q),se),O),{},{autoSelectRow:!I,rowFooterWidth:ae})},{max:1})),w(this,"getCachedKeyHandlers",Q(S=>[...S,...this.keyHandlers].sort((O,I)=>O.order-I.order),{max:1})),w(this,"getCachedMouseHandlers",Q(S=>[...S,...this.mouseHandlers].map(O=>typeof O=="function"?O(this):O),{max:1})),w(this,"getCachedRenderer",Q(S=>S??new Mr,{max:1})),w(this,"getAlwaysFetchColumns",Q((S,O,I,V,B,H)=>{for(var q=[],ae=0;ae<V;ae+=1)q.push(O[Ce.getModelIndex(ae,I)].name);for(var J=0;J<B;J+=1)q.push(O[Ce.getModelIndex(O.length-1-J,I)].name);if(H)for(var se=H[0];se<=H[1];se+=1)q.push(O[Ce.getModelIndex(se,I)].name);var Oe=new Set([...S,...q]);return Object.freeze([...Oe])},{max:1})),w(this,"updateSearchFilter",dt((S,O,I,V)=>{var{model:B}=this.props,H=St.createSearchFilter(B.dh,S,O,I,V);this.setState({searchFilter:H})},xl)),w(this,"showViewportLoading",Qn(()=>{var{model:S}=this.props,{loadingSpinnerShown:O}=this.state;S.isViewportPending&&!O&&this.startLoading("Waiting for viewport...",{loadingCancelShown:!1,loadingBlocksGrid:!1})},Ol,{leading:!1,trailing:!0})),w(this,"handleConditionalFormatEditorUpdate",dt(S=>{this.setState({conditionalFormatPreview:S})},Il)),w(this,"handleDownloadProgressUpdate",Qn((S,O)=>{var{tableDownloadStatus:I}=this.state;I===Pe.DOWNLOAD_STATUS.DOWNLOADING&&this.setState({tableDownloadProgress:S,tableDownloadEstimatedTime:O})},_l)),w(this,"getOverflowButtonTooltip",Q(S=>{if(S==null)return null;var O=X(X({position:"absolute"},S),{},{pointerEvents:"none"}),I={placement:"left",modifiers:{flip:{behavior:["left","right"]}}};return s.jsx("div",{style:O,children:s.jsx(ze,{options:I,ref:this.handleTooltipRef,children:"View full contents"},Date.now())})},{max:1})),w(this,"getExpandCellTooltip",Q(S=>{if(S==null)return null;var{expandTooltipDisplayValue:O}=this.state,{model:I}=this.props,V=un(I)&&I.isExpandAllAvailable,B=X(X({position:"absolute"},S),{},{pointerEvents:"none"}),H={placement:"bottom-start"};return s.jsx("div",{style:B,children:s.jsx(ze,{options:H,ref:this.handleTooltipRef,children:s.jsxs("div",{style:{textAlign:"left"},children:["Click to ",O," row",V&&s.jsxs(s.Fragment,{children:[s.jsx("br",{}),ct.isMacPlatform()?"⌘":"Ctrl+","Click to expand row and all children"]})]})},Date.now())})},{max:1})),w(this,"getHoverTooltip",Q(S=>{if(S==null)return null;var{hoverDisplayValue:O}=this.state,I=X(X({position:"absolute"},S),{},{pointerEvents:"none"}),V={placement:"bottom"};return s.jsx("div",{style:I,children:s.jsx(ze,{options:V,ref:this.handleTooltipRef,children:s.jsx("div",{className:"link-hover-tooltip",children:O})})})},{max:1})),w(this,"handleGotoValueChanged",S=>{this.setState({gotoValue:S,gotoValueManuallyChanged:!0}),this.debouncedSeekRow(S)}),w(this,"debouncedSeekRow",dt(S=>{this.seekRow(S)},Rl)),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.handleTableChanged=this.handleTableChanged.bind(this),this.handleTooltipRef=this.handleTooltipRef.bind(this),this.handleViewChanged=this.handleViewChanged.bind(this),this.handleFormatSelection=this.handleFormatSelection.bind(this),this.handleColumnAlignmentChange=this.handleColumnAlignmentChange.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.handleViewportUpdated=this.handleViewportUpdated.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.handlePartitionChange=this.handlePartitionChange.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.handleCloseNoPastePermissionModal=this.handleCloseNoPastePermissionModal.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.handleViewportUpdated=this.handleViewportUpdated.bind(this),this.makeQuickFilter=this.makeQuickFilter.bind(this),this.setFilterMap=this.setFilterMap.bind(this),this.handleFrozenColumnsChanged=this.handleFrozenColumnsChanged.bind(this),this.grid=null,this.lastLoadedConfig=null,this.pending=new Ai,this.globalColumnFormats=Z,this.decimalFormatOptions={},this.integerFormatOptions={},this.truncateNumbersWithPound=!1,this.showEmptyStrings=!0,this.showNullStrings=!0,this.showExtraGroupColumn=!0,this.tableSaver=null,this.crossColumnRef=xe.createRef(),this.isAnimating=!1,this.filterInputRef=xe.createRef(),this.gotoRowRef=xe.createRef(),this.isCopying=!1,this.toggleFilterBarAction={action:()=>this.toggleFilterBar(),shortcut:ke.TABLE.TOGGLE_QUICK_FILTER},this.toggleSearchBarAction={action:()=>this.toggleSearchBar(),shortcut:ke.TABLE.TOGGLE_SEARCH},this.toggleGotoRowAction={action:()=>this.toggleGotoRow(),shortcut:ke.TABLE.GOTO_ROW},this.discardAction={action:()=>{var{model:S}=this.props;_e(S)&&S.isEditable&&S.pendingDataMap.size>0&&this.discardPending().catch(N.error)},shortcut:ke.INPUT_TABLE.DISCARD},this.commitAction={action:()=>{var{model:S}=this.props;_e(S)&&S.isEditable&&S.pendingDataMap.size>0&&S.pendingDataErrors.size===0&&this.commitPending().catch(N.error)},shortcut:ke.INPUT_TABLE.COMMIT},this.contextActions=[this.toggleFilterBarAction,this.toggleSearchBarAction,this.toggleGotoRowAction,this.discardAction,this.commitAction];var{aggregationSettings:r,conditionalFormats:o,customColumnFormatMap:l,columnAlignmentMap:d,isFilterBarShown:u,isSelectingPartition:h,partitions:m,partitionConfig:c,model:g,movedColumns:p,movedRows:f,rollupConfig:y,userColumnWidths:F,userRowHeights:T,showSearchBar:C,searchValue:_,selectedSearchColumns:E,invertSearchColumns:A,advancedFilters:D,quickFilters:$,selectDistinctColumns:te,pendingDataMap:Y,canCopy:re,frozenColumns:K,columnHeaderGroups:me,getMetricCalculator:Ne}=e,{dh:ge}=g,Te=[new lo(this),new fo(this),new To(this)],Fe=[new kr(this),new Vr(this),new Gr(this),new Br(this),new Hr(this),new Wr(this),new $r(this),new Kr(this,ge),new zr(this),new Qr(this),new Yr(this),...re?[new qr(this)]:[]];re&&Te.push(new mo(this));var Re=p.length>0?p:g.initialMovedColumns,ve=f.length>0?f:g.initialMovedRows,Ve=Ne({userColumnWidths:new Map(F),userRowHeights:new Map(T),movedColumns:Re,initialColumnWidths:new Map(g==null||(t=g.layoutHints)===null||t===void 0||(t=t.hiddenColumns)===null||t===void 0?void 0:t.map(S=>[g.getColumnIndexByName(S),0]))}),Ae=E??[],x=St.createSearchFilter(ge,_,Ae,g.columns,A);this.tableUtils=new b(ge),this.mouseHandlers=Fe,this.keyHandlers=Te,this.state={isFilterBarShown:u,isSelectingPartition:h,focusedFilterBarColumn:null,metricCalculator:Ve,metrics:void 0,partitionConfig:c??(m&&m.length?{partitions:m,mode:"partition"}:void 0),quickFilters:$?new Map($):new Map,advancedFilters:new Map(D),shownAdvancedFilter:null,hoverAdvancedFilter:null,sorts:[],reverse:!1,customColumns:[],selectDistinctColumns:te,selectedRanges:[],copyOperation:null,loadingText:null,loadingScrimProgress:null,loadingSpinnerShown:!1,loadingCancelShown:!1,loadingBlocksGrid:!1,movedColumns:Re,movedRows:ve,shownColumnTooltip:null,formatter:new Zt(ge),isMenuShown:!1,customColumnFormatMap:new Map(l),columnAlignmentMap:new Map(d),conditionalFormats:o,conditionalFormatEditIndex:null,conditionalFormatPreview:void 0,hoverSelectColumn:null,isTableDownloading:!1,isReady:!1,tableDownloadStatus:"",tableDownloadProgress:0,tableDownloadEstimatedTime:0,showSearchBar:C,searchFilter:x,searchValue:_,selectedSearchColumns:Ae,invertSearchColumns:A,rollupConfig:y,rollupSelectedColumns:[],aggregationSettings:_e(g)&&g.isEditable?X(X({},r),{},{showOnTop:!0}):r,selectedAggregation:null,openOptions:[],pendingRowCount:0,pendingDataMap:Y??new Map,pendingDataErrors:new Map,pendingSavePromise:null,pendingSaveError:null,toastMessage:null,frozenColumns:K,showOverflowModal:!1,showNoPastePermissionModal:!1,noPastePermissionError:"",overflowText:"",overflowButtonTooltipProps:null,expandCellTooltipProps:null,expandTooltipDisplayValue:"expand",hoverTooltipProps:null,hoverDisplayValue:"",isGotoShown:!1,gotoRow:"",gotoRowError:"",gotoValueError:"",gotoValueSelectedColumnName:(n=(a=g.columns[0])===null||a===void 0?void 0:a.name)!==null&&n!==void 0?n:"",gotoValueSelectedFilter:ce.eqIgnoreCase,gotoValue:"",gotoValueManuallyChanged:!1,columnHeaderGroups:me??g.initialColumnHeaderGroups}}componentDidMount(){var{model:e}=this.props;this.initState(),this.startListening(e)}componentDidUpdate(e,t){var{inputFilters:n,isSelectingColumn:a,settings:r,model:o,customFilters:l,sorts:d}=this.props;o!==e.model&&(this.stopListening(e.model),this.startListening(o));var u=n!==e.inputFilters?n.filter(F=>!e.inputFilters.includes(F)):[];if(u.length>0){var h,{advancedSettings:m}=this.props,c=(h=m.get(yt.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS))!==null&&h!==void 0?h:!1;c&&(this.clearGridInputField(),this.clearCrossColumSearch()),this.startLoading("Filtering...",{resetRanges:!0}),this.applyInputFilters(u,c)}a!==e.isSelectingColumn&&this.resetColumnSelection(),r!==e.settings&&this.updateFormatterSettings(r),l!==e.customFilters&&this.startLoading("Filtering...",{resetRanges:!0}),d!==e.sorts&&this.updateSorts(d);var{loadingScrimStartTime:g,loadingScrimFinishTime:p}=this;g!=null&&p!=null&&window.requestAnimationFrame(()=>{var F=Date.now(),T=F-g,C=p-g,_=Math.min(T/C,1);p<F&&(this.loadingScrimStartTime=void 0,this.loadingScrimFinishTime=void 0),this.setState(E=>E.loadingScrimProgress==null?(N.debug2("Ignoring scrim update because loading cancelled."),null):{loadingScrimProgress:_})});var{openOptions:f}=this.state;if(f!==t.openOptions){var y=F=>F.type===G.AGGREGATION_EDIT;!f.some(y)&&t.openOptions.some(y)&&this.removeEmptyAggregations()}this.sendStateChange()}componentWillUnmount(){var{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),this.showViewportLoading.cancel()}get gridWrapper(){var e,t;return(e=(t=this.grid)===null||t===void 0?void 0:t.canvasWrapper.current)!==null&&e!==void 0?e:null}getKeyHandlers(){var{keyHandlers:e}=this.props;return this.getCachedKeyHandlers(e)}getMetricState(){var e,t=(e=this.grid)===null||e===void 0?void 0:e.getMetricState();if(t!=null){var{advancedFilters:n,hoverSelectColumn:a,isFilterBarShown:r,isMenuShown:o,loadingScrimProgress:l,quickFilters:d,sorts:u,reverse:h,rollupConfig:m}=this.state,{model:c,isSelectingColumn:g}=this.props;return X(X({},t),this.getCachedStateOverride(c,this.getTheme(),a,r,g,l,d,n,u,h,m,o))}}get renderer(){var{renderer:e}=this.props;return this.getCachedRenderer(e)}getMouseHandlers(){var{mouseHandlers:e}=this.props;return this.getCachedMouseHandlers(e)}getValueForCell(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,{model:a}=this.props,{dh:r}=a,o=this.getModelColumn(e),l=this.getModelRow(t);if(n&&o!=null&&l!=null){var d=a.valueForCell(o,l);if(b.isDateType(a.columns[o].type)){var{formatter:u}=a;return r.i18n.DateTimeFormat.format(Dl,d,r.i18n.TimeZone.getTimeZone(u.timeZone))}return d}return n?null:o!=null&&l!=null?a.textForCell(o,l):""}getModelColumn(e){var{metrics:t}=this.state;U(t);var{modelColumns:n}=t;return n==null?null:e!=null&&e<0?e:e!=null?n.get(e):null}getModelRow(e){var{metrics:t}=this.state;U(t);var{modelRows:n}=t;return n==null?null:e!=null?n.get(e):null}getTheme(){var e,{model:t,theme:n,density:a}=this.props,{theme:r,density:o}=this.context;return this.getCachedTheme(r,n,(e=_e(t)&&t.isEditable)!==null&&e!==void 0?e:!1,t.floatingTopRowCount+t.floatingBottomRowCount,a??o)}getVisibleColumn(e){var{movedColumns:t}=this.state;return Ce.getVisibleIndex(e,t)}makeQuickFilter(e,t,n){try{return this.tableUtils.makeQuickFilter(e,t,n)}catch(a){N.error("Error creating quick filter",a)}return null}applyInputFilters(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{model:n}=this.props,{advancedFilters:a,quickFilters:r}=this.state,o=t?new Map:new Map(a),l=t?new Map:new Map(r),d=t&&a.size>0;e.forEach(u=>{var{name:h,type:m,value:c}=u,g=n.columns.findIndex(p=>{var{name:f,type:y}=p;return f===h&&y===m});g>=0?(d=o.delete(g)||d,d=this.applyQuickFilter(g,c,l)||d):N.error("Unable to find column for inputFilter",h,m,c)}),d&&this.setState({quickFilters:l,advancedFilters:o})}applyQuickFilter(e,t,n){var{model:a}=this.props,{formatter:r}=a,o=a.columns[e];if(t!=null&&"".concat(t).trim().length>0){var l=n.get(e);if(l!=null){var{text:d}=l;if(d===t)return N.debug2("Ignoring change to existing filter"),!1}return n.set(e,{text:t,filter:this.makeQuickFilter(o,t,r.timeZone)}),!0}return n.delete(e)}setAdvancedFilterMap(e){this.setState({advancedFilters:e})}setAdvancedFilter(e,t,n){N.debug("Setting advanced filter",e,t),this.startLoading("Filtering...",{resetRanges:!0}),this.setState(a=>{var{advancedFilters:r}=a,o=new Map(r);return t==null?o.delete(e):o.set(e,{filter:t,options:n}),{advancedFilters:o}})}setQuickFilter(e,t,n){N.debug("Setting quick filter",e,t,n),this.startLoading("Filtering...",{resetRanges:!0}),this.setState(a=>{var{quickFilters:r}=a,o=new Map(r);return o.set(e,{filter:t,text:n}),{quickFilters:o}})}setFilterMap(e){var t;N.debug("setFilterMap",e);var{advancedSettings:n}=this.props,a=(t=n.get(yt.LINK_CHANGE_CLEARS_ALL_FILTERS))!==null&&t!==void 0?t:!1;a&&this.clearAllFilters();var{model:r}=this.props;e.forEach((o,l)=>{var{columnType:d,filterList:u}=o,h=r.columns.find(p=>p.name===l&&p.type===d);if(h!=null){var m=r.getColumnIndexByName(h.name);U(m);var c=ee.combineFiltersFromList(d,u);if(c.length===0)this.removeQuickFilter(m);else{var{formatter:g}=r;this.setQuickFilter(m,this.makeQuickFilter(h,c,g.timeZone),"".concat(c))}}})}removeColumnFilter(e){this.startLoading("Filtering...",{resetRanges:!0});var t=Array.isArray(e)?e:[e,e];this.setState(n=>{var{advancedFilters:a,quickFilters:r}=n,o=a?new Map(a):new Map,l=r?new Map(r):new Map;return o.forEach((d,u)=>{u>=t[0]&&u<=t[1]&&o.delete(u)}),l.forEach((d,u)=>{u>=t[0]&&u<=t[1]&&l.delete(u)}),{quickFilters:l,advancedFilters:o}})}removeQuickFilter(e){this.startLoading("Clearing Filter...",{resetRanges:!0}),this.setState(t=>{var{quickFilters:n}=t,a=new Map(n);return a.delete(e),{quickFilters:a}})}clearAllFilters(){N.debug("Clearing all filters");var{advancedFilters:e,quickFilters:t,searchFilter:n}=this.state;t.size===0&&e.size===0&&n===null||(this.clearGridInputField(),this.startLoading("Clearing Filters...",{resetRanges:!0}),this.setState({quickFilters:new Map,advancedFilters:new Map,searchValue:"",searchFilter:void 0}))}clearAllAggregations(){N.debug("Clearing all aggregations"),this.setState({aggregationSettings:cn})}clearCrossColumSearch(){N.debug("Clearing cross-column search"),this.setState({searchValue:"",searchFilter:void 0})}clearGridInputField(){this.filterInputRef.current!=null&&this.filterInputRef.current.setValue("")}rebuildFilters(){var{model:e}=this.props,{advancedFilters:t,quickFilters:n}=this.state;if(t.size===0&&n.size===0){N.debug("No filters to rebuild");return}var{columns:a,formatter:r}=e;N.debug("Rebuilding filters");var o=new Map,l=new Map;t.forEach((d,u)=>{var{options:h}=d,m=a[u],c=this.tableUtils.makeAdvancedFilter(m,h,r.timeZone);o.set(u,{options:h,filter:c})}),n.forEach((d,u)=>{var{text:h}=d,m=a[u];l.set(u,{text:h,filter:this.makeQuickFilter(m,h,r.timeZone)})}),this.startLoading("Rebuilding filters...",{resetRanges:!0}),this.setState({quickFilters:l,advancedFilters:o})}setFilters(e){var{quickFilters:t,advancedFilters:n}=e;this.setState({quickFilters:t,advancedFilters:n})}updateFormatterSettings(e){var t,n,a,r,o,l,d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,u=ti.getColumnFormats(e),h=ti.getDateTimeFormatterOptions(e),m=(t=e==null?void 0:e.defaultDecimalFormatOptions)!==null&&t!==void 0?t:{},c=(n=e==null?void 0:e.defaultIntegerFormatOptions)!==null&&n!==void 0?n:{},g=(a=e==null?void 0:e.truncateNumbersWithPound)!==null&&a!==void 0?a:!1,p=(r=e==null?void 0:e.showEmptyStrings)!==null&&r!==void 0?r:!0,f=(o=e==null?void 0:e.showNullStrings)!==null&&o!==void 0?o:!0,y=(l=e==null?void 0:e.showExtraGroupColumn)!==null&&l!==void 0?l:!0,F=!Me(this.globalColumnFormats,u),T=!Me(this.dateTimeFormatterOptions,h),C=!Me(this.decimalFormatOptions,e==null?void 0:e.defaultDecimalFormatOptions),_=!Me(this.integerFormatOptions,c),E=this.truncateNumbersWithPound!==g,A=this.showEmptyStrings!==p,D=this.showNullStrings!==f,$=this.showExtraGroupColumn!==y;(F||T||C||_||E||A||D||$)&&(this.globalColumnFormats=u,this.dateTimeFormatterOptions=h,this.decimalFormatOptions=m,this.integerFormatOptions=c,this.truncateNumbersWithPound=g,this.showEmptyStrings=p,this.showNullStrings=f,this.showExtraGroupColumn=y,this.updateFormatter({},d),T&&d&&this.rebuildFilters())}updateFormatter(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{customColumnFormatMap:a}=this.state,{model:r}=this.props,o=X({customColumnFormatMap:a},e),l=[...(t=this.globalColumnFormats)!==null&&t!==void 0?t:[],...o.customColumnFormatMap.values()],d=new Zt(r.dh,l,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions,this.truncateNumbersWithPound,this.showEmptyStrings,this.showNullStrings);N.debug("updateFormatter",this.globalColumnFormats,l),this.setState(X(X({},o),{},{formatter:d}),()=>{n&&this.grid&&this.grid.forceUpdate()})}initFormatter(){var{settings:e}=this.props;this.updateFormatterSettings(e)}initState(){var{model:e}=this.props;try{Tt(e)&&e.isPartitionRequired?this.loadPartitionsTable(e):this.loadTableState()}catch(t){this.handleTableLoadError(t)}}loadTableState(){var{applyInputFiltersOnInit:e,inputFilters:t,sorts:n,model:a,reverse:r,reverseType:o,customColumns:l,searchValue:d,selectedSearchColumns:u,invertSearchColumns:h}=this.props,m=u??[],c=St.createSearchFilter(a.dh,d,m,a.columns,h);if(e){var g=t.filter(p=>p.value!=null);this.applyInputFilters(g)}this.setState({sorts:n,reverse:r||o===b.REVERSE_TYPE.POST_SORT,customColumns:l,isReady:!0,searchFilter:c}),this.initFormatter()}loadPartitionsTable(e){var t=this;return ot(function*(){try{var{partitionConfig:n}=t.state;n||(t.startLoading("Loading partitions...",{loadingCancelShown:!1,resetRanges:!0}),t.initializePartitionConfig(e)),t.setState({isSelectingPartition:!0},t.loadTableState)}catch(a){be.isCanceled(a)||t.handleTableLoadError(a)}})()}initializePartitionConfig(e){var t=this;return ot(function*(){var n=yield t.pending.add(e.partitionKeysTable(),o=>o.close()),{dh:a}=e,r=n.columns.map(o=>o.sort().desc());n.applySort(r),n.setViewport(0,0),n.addEventListener(a.Table.EVENT_UPDATED,o=>{try{var{detail:l}=o;if(l.rows.length===0){t.stopLoading();return}var d=l.rows[0],u=n.columns.map(m=>d.get(m)),h={partitions:u,mode:e.isPartitionAwareSourceTable?"partition":"keys"};n.close(),t.setState({loadingSpinnerShown:!1,partitionConfig:h})}catch(m){n.close(),N.error("Error getting initial partition config",m)}})})()}selectPartitionKeyFromTable(e){var{model:t}=this.props;if(U(e),Tt(t)){var n=this.getRowDataMap(e),a=new Set(t.partitionColumns.map(l=>l.name)),r=Object.entries(n).filter(l=>{var[d,u]=l;return a.has(d)}).map(l=>{var[d,u]=l;return u.value}),o={partitions:r,mode:"partition"};this.setState({isSelectingPartition:!0,partitionConfig:o})}}copyCell(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,{canCopy:a}=this.props;if(a){var r=String(this.getValueForCell(e,t,n));wi(r).catch(o=>N.error("Unable to copy cell",o))}else N.error("Attempted to copyCell for user without copy permission.")}copyColumnHeader(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(e!==null){var{canCopy:n}=this.props,{movedColumns:a}=this.state;if(n){var r={columnIndex:e,columnDepth:t,movedColumns:a};this.setState({copyOperation:r})}else N.error("Attempted copyColumnHeader for user without copy permission.")}}copyRanges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3?arguments[3]:void 0,{model:r,canCopy:o}=this.props,{metricCalculator:l,movedColumns:d}=this.state,u=l.getUserColumnWidths();if(o){var h={ranges:qe.boundedRanges(e,r.columnCount,r.rowCount),includeHeaders:t,formatValues:n,movedColumns:d,userColumnWidths:u,error:a};this.setState({copyOperation:h})}else N.error("Attempted copyRanges for user without copy permission.")}startLoading(e){var{resetRanges:t=!1,loadingCancelShown:n=!0,loadingBlocksGrid:a=!0}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.setState({loadingText:e,loadingCancelShown:n,loadingBlocksGrid:a});var r=this.getTheme();if(t&&this.grid&&(this.grid.clearSelectedRanges(),this.grid.setViewState({top:0},!0)),this.loadingScrimStartTime==null){var o,l,{minScrimTransitionTime:d,maxScrimTransitionTime:u}=r;U(d),U(u);var h=(o=(l=this.gridWrapper)===null||l===void 0?void 0:l.getBoundingClientRect().height)!==null&&o!==void 0?o:0,m=Math.max(d,Math.min(h/2,u));this.loadingScrimStartTime=Date.now(),this.loadingScrimFinishTime=this.loadingScrimStartTime+m,this.setState({loadingScrimProgress:0}),this.loadingTimer=setTimeout(()=>{this.setState({loadingSpinnerShown:!0})},we.loadingSpinnerDelay)}}stopLoading(){this.showViewportLoading.cancel(),this.loadingScrimStartTime=void 0,this.loadingScrimFinishTime=void 0,this.setState({loadingText:null,loadingScrimProgress:null,loadingSpinnerShown:!1,loadingCancelShown:!1}),this.loadingTimer!=null&&(clearTimeout(this.loadingTimer),this.loadingTimer=void 0)}rollback(){if(this.lastLoadedConfig){N.debug("loading last loading config",this.lastLoadedConfig);var{advancedFilters:e,aggregationSettings:t,customColumns:n,quickFilters:a,reverse:r,rollupConfig:o,searchFilter:l,selectDistinctColumns:d,sorts:u}=this.lastLoadedConfig;this.lastLoadedConfig=null,this.setState({advancedFilters:e,aggregationSettings:t,customColumns:n,quickFilters:a,reverse:r,rollupConfig:o,searchFilter:l,selectDistinctColumns:d,sorts:u})}else N.debug("remove all sorts, filters, and custom columns"),this.setState({advancedFilters:new Map,aggregationSettings:cn,customColumns:[],quickFilters:new Map,reverse:!1,rollupConfig:void 0,selectDistinctColumns:[],sorts:[]})}canRollback(){return this.lastLoadedConfig!=null||!pi(this.state)}startListening(e){e.addEventListener(fe.EVENT.UPDATED,this.handleUpdate),e.addEventListener(fe.EVENT.REQUEST_FAILED,this.handleRequestFailed),e.addEventListener(fe.EVENT.COLUMNS_CHANGED,this.handleCustomColumnsChanged),e.addEventListener(fe.EVENT.PENDING_DATA_UPDATED,this.handlePendingDataUpdated),e.addEventListener(fe.EVENT.VIEWPORT_UPDATED,this.handleViewportUpdated),e.addEventListener(fe.EVENT.TABLE_CHANGED,this.handleTableChanged)}stopListening(e){e.removeEventListener(fe.EVENT.UPDATED,this.handleUpdate),e.removeEventListener(fe.EVENT.REQUEST_FAILED,this.handleRequestFailed),e.removeEventListener(fe.EVENT.COLUMNS_CHANGED,this.handleCustomColumnsChanged),e.removeEventListener(fe.EVENT.PENDING_DATA_UPDATED,this.handlePendingDataUpdated),e.removeEventListener(fe.EVENT.VIEWPORT_UPDATED,this.handleViewportUpdated),e.removeEventListener(fe.EVENT.TABLE_CHANGED,this.handleTableChanged)}focus(){var e;(e=this.grid)===null||e===void 0||e.focus()}focusFilterBar(e){var{movedColumns:t}=this.state,{model:n}=this.props,{columnCount:a}=n,r=Ce.getModelIndex(e,t);if(e==null||e<0||a<=e||!n.isFilterable(r)){this.setState({focusedFilterBarColumn:null});return}var{metricCalculator:o,metrics:l}=this.state;U(l);var{left:d,rightVisible:u,lastLeft:h}=l;if(e<d){var m;(m=this.grid)===null||m===void 0||m.setViewState({left:e},!0)}else if(u<e){var c,g=this.getMetricState();U(g);var p=o.getLastLeft(g,e,o.getVisibleWidth(g));(c=this.grid)===null||c===void 0||c.setViewState({left:Math.min(p,h),leftOffset:0},!0)}this.lastFocusedFilterBarColumn=e,this.setState({focusedFilterBarColumn:e,isFilterBarShown:!0})}hideColumnByVisibleIndex(e){var t,{metricCalculator:n,movedColumns:a}=this.state;n.setColumnWidth(Ce.getModelIndex(e,a),0),(t=this.grid)===null||t===void 0||t.forceUpdate()}freezeColumnByColumnName(e){var{frozenColumns:t,movedColumns:n}=this.state,{model:a}=this.props;N.debug2("freezing column",e);var r=t==null?new Set(a.frozenColumns):new Set(t);r.add(e);var o=a.getColumnIndexByName(e);U(o);var l=Ce.getVisibleIndex(o,n),d=Ce.moveItem(l,r.size-1,n);this.setState({frozenColumns:[...r],movedColumns:d})}unFreezeColumnByColumnName(e){var{frozenColumns:t,movedColumns:n}=this.state,{model:a}=this.props;N.debug2("unfreezing column",e);var r=t==null?new Set(a.frozenColumns):new Set(t);r.delete(e);var o=a.getColumnIndexByName(e);U(o);var l=Ce.getVisibleIndex(o,n),d=Ce.moveItem(l,r.size+a.frontColumns.length,n);this.setState({frozenColumns:[...r],movedColumns:d})}handleFrozenColumnsChanged(e){this.setState({frozenColumns:e})}toggleExpandColumn(e,t){N.debug2("Toggle expand column",e);var{model:n}=this.props;Jt(n)&&n.hasExpandableColumns&&n.setColumnExpanded(e,!n.isColumnExpanded(e),t)}expandAllColumns(){N.debug2("Expand all columns");var{model:e}=this.props;Jt(e)&&e.isExpandAllColumnsAvailable&&e.expandAllColumns()}collapseAllColumns(){N.debug2("Collapse all columns");var{model:e}=this.props;Jt(e)&&e.isExpandAllColumnsAvailable&&e.collapseAllColumns()}handleColumnVisibilityChanged(e,t){var n,{metricCalculator:a,metrics:r}=this.state;U(r),t?e.forEach(o=>{var l=a.initialColumnWidths.get(o),d=r.calculatedColumnWidths.get(o);l!==d&&d!=null?a.setColumnWidth(o,d):a.resetColumnWidth(o)}):e.forEach(o=>{a.setColumnWidth(o,0)}),(n=this.grid)===null||n===void 0||n.forceUpdate()}handleColumnVisibilityReset(){var e,t,{metricCalculator:n}=this.state,{model:a}=this.props;n.resetAllColumnWidths(),this.handleMovedColumnsChanged(a.initialMovedColumns),this.handleHeaderGroupsChanged(a.initialColumnHeaderGroups),this.setState({frozenColumns:(e=(t=a.layoutHints)===null||t===void 0?void 0:t.frozenColumns)!==null&&e!==void 0?e:Z})}handleCrossColumnSearch(e,t,n){var{model:a}=this.props;this.startLoading("Searching..."),this.updateSearchFilter(e,t,a.columns,n),this.setState({searchValue:e,selectedSearchColumns:t,invertSearchColumns:n})}handleAnimationLoop(){var e;(e=this.grid)===null||e===void 0||e.updateCanvas(),this.isAnimating&&(this.animationFrame=requestAnimationFrame(this.handleAnimationLoop))}handleAnimationStart(){N.debug2("handleAnimationStart"),this.isAnimating=!0,this.animationFrame=requestAnimationFrame(this.handleAnimationLoop)}handleAnimationEnd(){N.debug2("handleAnimationEnd"),this.isAnimating=!1}handlePartitionChange(e){this.startLoading("Partitioning...");var{partitionConfig:t}=this.state;t!==e&&this.setState({partitionConfig:e})}handleTableLoadError(e){if(!be.isCanceled(e)){N.error(e);var{onError:t}=this.props;t(e)}}handleViewportUpdated(){var{model:e}=this.props,{loadingText:t,loadingSpinnerShown:n}=this.state,a="Waiting for viewport...";e.isViewportPending&&!n?this.showViewportLoading():t===a&&!e.isViewportPending&&this.stopLoading()}showAllColumns(){for(var e,{metricCalculator:t}=this.state,n=t.getUserColumnWidths(),a=[...n.entries()],r=0;r<a.length;r+=1){var[o,l]=a[r];l===0&&t.resetColumnWidth(o)}(e=this.grid)===null||e===void 0||e.forceUpdate()}updateMetrics(){var e;this.setState({metrics:(e=this.grid)===null||e===void 0?void 0:e.updateMetrics()})}toggleSort(e,t){N.info("Toggling sort for column",e);var{model:n}=this.props,a=this.getModelColumn(e);if(U(a),n.isColumnSortable(e)){var{sorts:r}=this.state,o=b.toggleSortForColumn(r,n.columns,a,t);this.updateSorts(o)}else N.debug("Column type was not sortable",n.columns[e])}updateSorts(e){var t;this.startLoading("Sorting..."),this.setState({sorts:e}),(t=this.grid)===null||t===void 0||t.forceUpdate()}sortColumn(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:b.sortDirection.none,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;U(e);var{model:o}=this.props,l=b.sortColumn(o.sort,o.columns,e,n,a,r);this.startLoading("Sorting..."),this.setState({sorts:l}),(t=this.grid)===null||t===void 0||t.forceUpdate()}reverse(e){var t;this.startLoading("Reversing..."),this.setState({reverse:e}),(t=this.grid)===null||t===void 0||t.forceUpdate()}isReversible(){var{model:e}=this.props;return e.isReversible}toggleFilterBar(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.lastFocusedFilterBarColumn,{isFilterBarShown:t}=this.state;if(t=!t,this.setState({isFilterBarShown:t}),t)if(e!=null)this.focusFilterBar(e);else{for(var n=0,{model:a}=this.props,{columnCount:r}=a,o=0;o<r;o+=1){var l=this.getModelColumn(o);if(l!=null){var d=a.columns[l];if(d!=null&&b.isTextType(d.type)){n=o;break}}}this.focusFilterBar(n)}else{var u;(u=this.grid)===null||u===void 0||u.focus()}}isTableSearchAvailable(){var e,t,n,{model:a,canToggleSearch:r}=this.props,{dh:o}=a,l=a==null||(e=a.layoutHints)===null||e===void 0?void 0:e.searchDisplayMode;return l===((t=o.SearchDisplayMode)===null||t===void 0?void 0:t.SEARCH_DISPLAY_HIDE)?!1:l===((n=o.SearchDisplayMode)===null||n===void 0?void 0:n.SEARCH_DISPLAY_SHOW)?!0:r}toggleSearchBar(){var{showSearchBar:e}=this.state;if(this.isTableSearchAvailable()){var t=!e;this.setState({showSearchBar:t},()=>{var n;if(t&&(n=this.crossColumnRef)!==null&&n!==void 0&&n.current){var a;(a=this.crossColumnRef)===null||a===void 0||a.current.focus()}else{var r;(r=this.grid)===null||r===void 0||r.focus()}})}}toggleGotoRow(){var e,t,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",{isGotoShown:o}=this.state;if(n||a){var l;this.setState({isGotoShown:!0,gotoValue:a,gotoValueSelectedColumnName:r,gotoRowError:"",gotoValueError:"",gotoValueManuallyChanged:!1}),this.focusRowInGrid(n),(l=this.gotoRowRef.current)===null||l===void 0||l.focus();return}var d=(e=this.grid)===null||e===void 0?void 0:e.state.cursorRow,u=(t=this.grid)===null||t===void 0?void 0:t.state.cursorColumn;if(d==null||u==null){this.setState({isGotoShown:!o,gotoRow:"",gotoValue:"",gotoRowError:"",gotoValueError:"",gotoValueManuallyChanged:!1});return}var{model:h}=this.props,{name:m,type:c}=h.columns[u],g=h.valueForCell(u,d),p=ee.convertValueToText(g,c);this.setState({isGotoShown:!o,gotoRow:"".concat(d+1),gotoValue:p,gotoValueSelectedColumnName:m,gotoRowError:"",gotoValueError:"",gotoValueManuallyChanged:!1})}commitPending(){var e=this;return ot(function*(){var t,{model:n}=e.props;if(!_e(n)||!n.isEditable)throw new Error("Cannot save, table is not editable");var{pendingSavePromise:a}=e.state;if(a!=null)throw new Error("Save already in progress");var r=(t=document)===null||t===void 0||(t=t.activeElement)===null||t===void 0?void 0:t.classList.contains("grid-cell-input-field");if(r!=null&&r){var o;if(document.activeElement!=null&&document.activeElement.classList.contains("error"))throw new wr("Current input is invalid");(o=e.grid)===null||o===void 0||o.focus()}var l=e.pending.add(n.commitPending()).then(()=>{e.setState({pendingSaveError:null,pendingSavePromise:null})}).catch(d=>{be.isCanceled(d)||e.setState({pendingSaveError:d,pendingSavePromise:null})});return e.setState({pendingSavePromise:l}),l})()}discardPending(){var e=this;return ot(function*(){var{pendingSavePromise:t}=e.state;if(t!=null)throw new Error("Cannot cancel a save in progress");e.setState({pendingSavePromise:null,pendingSaveError:null,pendingDataMap:new Map,pendingDataErrors:new Map})})()}selectColumn(e){var{onColumnSelected:t}=this.props;t(e)}selectData(e,t){var n=this.getRowDataMap(t),{onDataSelected:a}=this.props;a(t,n)}getRowDataMap(e){for(var t=this,{model:n}=this.props,{columns:a,groupedColumns:r}=n,o={},l=function(){var h=a[d],{name:m,type:c}=h,g=n.valueForCell(d,e),p=n.textForCell(d,e),f=t.getVisibleColumn(d),y=un(n)&&n.isRowExpandable(e),F=r.find(T=>T.name===m)!=null;o[m]={value:g,text:p,type:c,isGrouped:F,isExpandable:y,visibleIndex:f}},d=0;d<a.length;d+=1)l();return o}handleAdvancedFilterChange(e,t,n){var{model:a}=this.props,r=a.getColumnIndexByName(e.name);U(r),this.setAdvancedFilter(r,t,n)}handleAdvancedFilterSortChange(e,t){var n,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,{model:r}=this.props,o=r.getColumnIndexByName(e.name);U(o);var l=r.columns[o].name,d=b.getSortForColumn(r.sort,l),u=null;(d==null||d.direction!==t)&&(t===b.sortDirection.descending?u=e.sort().desc():u=e.sort().asc());var h=b.setSortForColumn(r.sort,l,u,a);N.info("Setting table sorts",h),this.startLoading("Sorting..."),this.setState({sorts:h}),(n=this.grid)===null||n===void 0||n.forceUpdate()}handleAdvancedFilterDone(){var e;(e=this.grid)===null||e===void 0||e.focus()}handleAdvancedMenuOpened(e){this.setState({shownAdvancedFilter:e})}handleGotoRowOpened(){this.setState({isGotoShown:!0,gotoValueManuallyChanged:!1})}handleGotoRowClosed(){this.setState({isGotoShown:!1,gotoValueManuallyChanged:!1})}handleAdvancedMenuClosed(e){var t,{focusedFilterBarColumn:n,isFilterBarShown:a}=this.state;if(a&&n===e&&((t=this.filterInputRef)===null||t===void 0?void 0:t.current)!==null){var r;(r=this.filterInputRef)===null||r===void 0||r.current.focus(),this.setState({shownAdvancedFilter:null})}else this.setState({focusedFilterBarColumn:null,shownAdvancedFilter:null})}handleCancel(){this.rollback()}handleChartChange(){}handleChartCreate(e){var{model:t,onCreateChart:n}=this.props;n(e,t)}handleGridError(e){N.warn("Grid Error",e),this.setState({toastMessage:s.jsx("div",{className:"error-message",children:"".concat(e)})})}handleFilterBarChange(e){this.startLoading("Filtering...",{resetRanges:!0}),this.setState(t=>{var{focusedFilterBarColumn:n,quickFilters:a}=t,r=new Map(a);if(n!=null){var o=this.getModelColumn(n);U(o),this.applyQuickFilter(o,e,r)}return{quickFilters:r}})}handleFilterBarDone(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e){var n;(n=this.grid)===null||n===void 0||n.focus()}t&&this.setState({focusedFilterBarColumn:null})}handleFilterBarTab(e){var{focusedFilterBarColumn:t}=this.state;U(t),e?this.focusFilterBar(t-1):this.focusFilterBar(t+1)}handleFormatSelection(e,t){var{model:n}=this.props,a=n.columns[e],{customColumnFormatMap:r}=this.state,o=new Map(r);if(t!=null){var l=b.getNormalizedType(a.type);U(l);var d=Zt.makeColumnFormattingRule(l,a.name,t);o.set(a.name,d)}else o.delete(a.name);this.updateFormatter({customColumnFormatMap:o})}handleColumnAlignmentChange(e,t){var{model:n}=this.props,a=n.columns[e];this.setState(r=>{var{columnAlignmentMap:o=Ee}=r,l=new Map(o);return t!=null?l.set(a.name,t):l.delete(a.name),{columnAlignmentMap:l}})}handleMenu(e){e.stopPropagation(),this.setState({isMenuShown:!0})}handleMenuClose(){this.setState({isMenuShown:!1,openOptions:[]})}handleMenuBack(){this.setState(e=>{var{openOptions:t}=e,n=[...t];return n.pop(),{openOptions:n}})}handleMenuSelect(e){this.setState(t=>{var{openOptions:n}=t;return{openOptions:[...n,e]}})}handleRequestFailed(e){var{detail:t}=e;N.error("request failed:",t),this.stopLoading();var{partitionConfig:n}=this.state;if(Ir(t)&&n!=null)this.startLoading("Reloading partition...",{resetRanges:!0}),this.setState({partitionConfig:void 0},()=>{this.initState()});else if(this.canRollback())this.startLoading("Rolling back changes...",{resetRanges:!0}),this.rollback();else{N.error("Table failed and unable to rollback");var{onError:a}=this.props;a(new Error("Error displaying table: ".concat(t)))}}handleUpdate(){var e;N.debug2("Received model update");var{advancedFilters:t,aggregationSettings:n,customColumns:a,quickFilters:r,reverse:o,rollupConfig:l,searchFilter:d,selectDistinctColumns:u,sorts:h}=this.state,m={advancedFilters:t,aggregationSettings:n,customColumns:a,quickFilters:r,reverse:o,rollupConfig:l,searchFilter:d,selectDistinctColumns:u,sorts:h};pi(m)?this.lastLoadedConfig=null:this.lastLoadedConfig=m,(e=this.grid)===null||e===void 0||e.forceUpdate(),this.stopLoading()}handleTableChanged(){var{model:e}=this.props;this.setState({movedColumns:e.initialMovedColumns})}handleViewChanged(e){var t,n,{model:a}=this.props,{selectionEndRow:r=0}=(t=(n=this.grid)===null||n===void 0?void 0:n.state)!==null&&t!==void 0?t:{},o=0;if(_e(a)&&a.isEditable){U(e);var{bottomViewport:l}=e,d=a.rowCount-a.floatingBottomRowCount;r===d-1?o=a.pendingRowCount+1:r===d-2?o=a.pendingRowCount:o=Math.max(0,l-(a.rowCount-a.pendingRowCount)-a.floatingTopRowCount-a.floatingBottomRowCount-1)}this.setState({metrics:e,pendingRowCount:o})}handleSelectionChanged(e){U(e);var{onSelectionChanged:t}=this.props,{copyOperation:n}=this.state;this.setState({selectedRanges:e}),n!=null&&this.setState({copyOperation:null}),qe.rowCount(qe.consolidate(e))===1&&e[0].startRow!=null&&this.setState({gotoRow:"".concat(e[0].startRow+1)}),t(e)}handleMovedColumnsChanged(e,t){this.setState({movedColumns:e},t)}handleHeaderGroupsChanged(e){var{model:t}=this.props,{columnHeaderGroups:n}=this.state;n!==e&&this.setState({columnHeaderGroups:e.every(a=>Dr(a)&&a.isValid())?e:ee.parseColumnHeaderGroups(t,e).groups},()=>{var a;return(a=this.grid)===null||a===void 0?void 0:a.forceUpdate()})}handleTooltipRef(e){e!=null&&e.startTimer(),this.tooltip=e}handleConditionalFormatsChange(e){N.debug("Updated conditional formats",e),this.setState({conditionalFormats:e})}handleConditionalFormatCreate(){N.debug("Create new conditional format");var{openOptions:e,conditionalFormats:t}=this.state;this.setState({openOptions:[...e,{type:G.CONDITIONAL_FORMATTING_EDIT,title:"Create Formatting Rule"}],conditionalFormatEditIndex:t.length,conditionalFormatPreview:void 0})}handleConditionalFormatEdit(e){N.debug("Edit conditional format",e);var{openOptions:t,conditionalFormats:n}=this.state;this.setState({openOptions:[...t,{type:G.CONDITIONAL_FORMATTING_EDIT,title:"Edit Formatting Rule"}],conditionalFormatEditIndex:e,conditionalFormatPreview:X({},n[e])})}handleConditionalFormatEditorSave(e){N.debug("Save conditional format changes",e),this.setState(t=>{if(t.conditionalFormatEditIndex===null)return N.debug("Invalid format index"),null;var n=[...t.conditionalFormats];return n[t.conditionalFormatEditIndex]=e,{conditionalFormats:n}},()=>{this.handleMenuBack()})}handleConditionalFormatEditorCancel(){this.handleMenuBack(),this.setState({conditionalFormatEditIndex:null})}handleUpdateCustomColumns(e){N.info("handleUpdateCustomColumns:",e);var{model:t}=this.props,{movedColumns:n,sorts:a,quickFilters:r,advancedFilters:o,selectDistinctColumns:l}=this.state,{columns:d}=t,u=t.customColumns.map(y=>"".concat(y)),h=ee.getRemovedCustomColumnNames(u,e);if(h.length>0){var m=ee.removeSortsInColumns(a,h),c=ee.removeFiltersInColumns(d,r,h),g=ee.removeFiltersInColumns(d,o,h),p=ee.removeColumnFromMovedColumns(d,n,h),f=ee.removeColumnsFromSelectDistinctColumns(l,h);m.length!==a.length&&(N.debug("removing sorts from removed custom columns..."),this.setState({sorts:m})),(c.size!==r.size||g.size!==o.size)&&(N.debug("removing filters from removed custom columns..."),this.setState({quickFilters:c,advancedFilters:g})),Me(n,p)||(N.debug("change moved columns for removed custom columns",p),this.setState({movedColumns:p})),Me(l,f)||(N.debug("change selectDistinct columns for removed custom columns",p),this.setState({selectDistinctColumns:f}))}this.setState({customColumns:e}),e.length>0&&this.startLoading("Applying custom columns...")}handleCustomColumnsChanged(){N.debug("Model columns changed");var{isReady:e}=this.state;e?(this.updateMetrics(),this.stopLoading()):this.loadTableState()}handlePendingCommitClicked(){return this.commitPending()}handlePendingDiscardClicked(){return this.discardPending()}handlePendingDataUpdated(){var e;N.debug("pending data updated");var{model:t}=this.props,{pendingDataMap:n,pendingDataErrors:a}=t;this.setState({pendingDataMap:n,pendingDataErrors:a,pendingSaveError:null}),(e=this.grid)===null||e===void 0||e.forceUpdate()}handleResizeColumn(e){var t,{metrics:n,metricCalculator:a}=this.state;if(!n)throw new Error("Metrics not set");var r=Xt(n.contentColumnWidths,e),o=a.getUserColumnWidths();o.has(e)?(a.resetColumnWidth(e),a.setCalculatedColumnWidth(e,r)):a.setColumnWidth(e,r),(t=this.grid)===null||t===void 0||t.forceUpdate()}handleResizeAllColumns(){var e,{metrics:t,metricCalculator:n}=this.state;if(!t)throw new Error("Metrics not set");var a=[...t.allColumnWidths.entries()],r=a.filter(f=>{var[y,F]=f;return F!==0}).map(f=>{var[y]=f;return y}),o=t.contentColumnWidths,l=n.getUserColumnWidths(),d=r.filter(f=>l.has(f));if(r.length===d.length)for(var u=0;u<r.length;u+=1){var h=r[u],m=Xt(o,h);n.resetColumnWidth(h),n.setCalculatedColumnWidth(h,m)}else for(var c=0;c<r.length;c+=1){var g=r[c],p=Xt(o,g);n.setColumnWidth(g,p)}(e=this.grid)===null||e===void 0||e.forceUpdate()}handleAggregationsChange(e){var t,n,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];N.debug("handleAggregationsChange",e,a,r);var{rollupConfig:o}=this.state,l=((t=o==null||(n=o.columns)===null||n===void 0?void 0:n.length)!==null&&t!==void 0?t:0)>0,d=[...a,...r],u=!(l&&d.length>0&&d.every(h=>We.isRollupProhibited(h)));u&&this.startLoading("Aggregating ".concat(e.aggregations.map(h=>h.operation).join(", "),"...")),this.setState({aggregationSettings:e})}handleAggregationChange(e){var t,n;N.debug("handleAggregationChange",e);var{rollupConfig:a}=this.state,r=((t=a==null||(n=a.columns)===null||n===void 0?void 0:n.length)!==null&&t!==void 0?t:0)>0,o=!(r&&We.isRollupProhibited(e.operation));o&&this.startLoading("Aggregating ".concat(e.operation,"...")),this.setState(l=>{var{aggregationSettings:d}=l;return{selectedAggregation:e,aggregationSettings:X(X({},d),{},{aggregations:d.aggregations.map(u=>u.operation===e.operation?e:u)})}})}handleAggregationEdit(e){N.debug("handleAggregationEdit",e);var{openOptions:t}=this.state;this.setState({openOptions:[...t,{type:G.AGGREGATION_EDIT,title:"Edit Columns to ".concat(e.operation)}],selectedAggregation:e})}handleRollupChange(e){var t,n;N.info("Rollup change",e),this.resetGridViewState(),this.showAllColumns(),this.clearAllFilters(),this.startLoading("Grouping by columns ".concat((t=e==null||(n=e.columns)===null||n===void 0?void 0:n.join(", "))!==null&&t!==void 0?t:"","...")),this.setState({rollupConfig:e,movedColumns:Z,frozenColumns:Z,sorts:Z,reverse:!1,selectDistinctColumns:Z})}handleSelectDistinctChanged(e){N.debug("SelectDistinct change",e),this.resetGridViewState(),this.showAllColumns(),this.clearAllFilters(),this.clearAllAggregations(),this.startLoading("Selecting distinct values in ".concat(e.length>0?e.join(", "):"","...")),this.setState({selectDistinctColumns:e,movedColumns:[],sorts:[],reverse:!1})}handleDownloadTableStart(){var{canDownloadCsv:e}=this.props;e?this.setState({isTableDownloading:!0,tableDownloadProgress:0,tableDownloadEstimatedTime:null,tableDownloadStatus:Pe.DOWNLOAD_STATUS.INITIATING}):N.error("Attempted to handleDownloadTableStart for user without download CSV permission.")}handleDownloadTable(e,t,n,a,r,o,l){var{canDownloadCsv:d}=this.props;d?(N.info("start table downloading",e,t,n,a,r,o,l),this.setState(()=>(this.tableSaver&&this.tableSaver.startDownload(e,t,n,a,r,o,l),{tableDownloadStatus:Pe.DOWNLOAD_STATUS.DOWNLOADING}))):N.error("Attempted to handleDownloadTable for user without download CSV permission.")}removeEmptyAggregations(){N.debug("removeEmptyAggregations"),this.setState(e=>{var{aggregationSettings:t}=e,{aggregations:n}=t,a=n.filter(r=>r.selected.length>0||r.invert);return a.length!==n.length?{selectedAggregation:null,aggregationSettings:X(X({},t),{},{aggregations:a})}:{selectedAggregation:null,aggregationSettings:t}})}seekRow(e){var t=arguments,n=this;return ot(function*(){var a,r=t.length>1&&t[1]!==void 0?t[1]:!1,{gotoValueSelectedColumnName:o,gotoValueSelectedFilter:l}=n.state,{model:d}=n.props,{dh:u}=d;if(d.isSeekRowAvailable&&e!==""){var h=ee.getColumnByName(d.columns,o);if(h!==void 0){var m=(a=n.grid)===null||a===void 0?void 0:a.state.cursorRow;m==null&&(m=0);var c=l===ce.contains||l===ce.containsIgnoreCase,g=l===ce.eqIgnoreCase||l===ce.containsIgnoreCase;try{var p,{formatter:f}=d,y=b.getNormalizedType(h.type),F;switch(y){case b.dataType.CHAR:case b.dataType.STRING:{F=yield d.seekRow(m,h,u.ValueType.STRING,e,g,c,r??!1);break}case b.dataType.DATETIME:{var[T]=pn.parseDateRange(u,e,f.timeZone);F=yield d.seekRow(m,h,u.ValueType.DATETIME,T,void 0,void 0,r??!1);break}case b.dataType.DECIMAL:case b.dataType.INT:{if(!b.isBigDecimalType(h.type)&&!b.isBigIntegerType(h.type)){var C=parseInt(e,10);e==="-Infinity"?C=Number.NEGATIVE_INFINITY:e==="Infinity"&&(C=Number.POSITIVE_INFINITY),F=yield d.seekRow(m,h,u.ValueType.NUMBER,C,void 0,void 0,r??!1)}else F=yield d.seekRow(m,h,u.ValueType.STRING,e,void 0,void 0,r??!1);break}default:F=yield d.seekRow(m,h,u.ValueType.STRING,n.tableUtils.makeValue(h.type,e,f.timeZone),void 0,void 0,r??!1)}(p=n.grid)===null||p===void 0||p.setFocusRow(F),n.setState({gotoValueError:""})}catch{n.setState({gotoValueError:"invalid input"})}}}})()}handleCancelDownloadTable(){var e;(e=this.tableSaver)===null||e===void 0||e.cancelDownload(),this.setState({isTableDownloading:!1})}handleDownloadCompleted(){this.setState({isTableDownloading:!1,tableDownloadProgress:100,tableDownloadStatus:Pe.DOWNLOAD_STATUS.FINISHED})}handleDownloadCanceled(){this.setState({isTableDownloading:!1,tableDownloadProgress:0,tableDownloadStatus:Pe.DOWNLOAD_STATUS.CANCELED})}deleteRanges(e){var{model:t}=this.props;if(!Xr(t)||!t.isDeletable)throw new Error("Model does not support deleting ranges");this.pending.add(t.delete(e)).catch(n=>{be.isCanceled(n)||N.error("Unable to delete ranges",e,n)})}resetColumnSelection(){if(this.grid!=null){var{isSelectingColumn:e}=this.props;if(e){var{columnAllowedCursor:t}=this.props;this.grid.setState({cursor:t})}else this.grid.setState({cursor:null}),this.setState({hoverSelectColumn:null})}}resetGridViewState(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.grid&&(this.grid.clearSelectedRanges(),this.grid.setViewState({left:0,top:0,topOffset:0,leftOffset:0},e))}sendStateChange(){if(this.grid){var{state:e}=this,{state:t}=this.grid,{onStateChange:n}=this.props;n(e,t)}}handleOverflowClose(){this.setState({showOverflowModal:!1})}handleOpenNoPastePermissionModal(e){this.setState({showNoPastePermissionModal:!0,noPastePermissionError:e})}handleCloseNoPastePermissionModal(){this.setState({showNoPastePermissionModal:!1})}getColumnBoundingRect(){var e,{metrics:t,shownColumnTooltip:n}=this.state;U(t),U(n);var a=(e=this.gridWrapper)===null||e===void 0?void 0:e.getBoundingClientRect(),r=20;U(a);var{columnHeaderHeight:o,allColumnXs:l,allColumnWidths:d,width:u,columnHeaderMaxDepth:h}=t,m=l.get(n),c=d.get(n);U(m),U(c);var g=a.left+Yt(m+c/2,r,u-r);return{top:a.top+(h-1)*o,left:a.left+Yt(m+c/2,r,u-r),bottom:a.top+h*o,right:a.left+Yt(m+c/2,r,u-r)+1,width:1,height:o,x:g,y:a.top,toJSON:()=>{throw new Error("not implemented")}}}handleGotoRowSelectedRowNumberSubmit(){var{gotoRow:e}=this.state;this.focusRowInGrid(e)}focusRowInGrid(e){var{model:t}=this.props,{rowCount:n}=t;if(this.setState({gotoRow:e}),e===""){this.setState({gotoRowError:"",gotoValueError:""});return}var a=parseInt(e,10);if(a>n||a<-n)this.setState({gotoRowError:"Invalid row index"});else if(a===0){var r;this.setState({gotoRowError:"",gotoValueError:""}),(r=this.grid)===null||r===void 0||r.setFocusRow(0)}else if(a<0){var o;this.setState({gotoRowError:"",gotoValueError:""}),(o=this.grid)===null||o===void 0||o.setFocusRow(a+n)}else{var l;(l=this.grid)===null||l===void 0||l.setFocusRow(a-1),this.setState({gotoRowError:"",gotoValueError:""})}}handleGotoRowSelectedRowNumberChanged(e){var t=e.target.value;this.focusRowInGrid(t)}getColumnTooltip(e,t,n){var{columnHeaderHeight:a,columnHeaderMaxDepth:r,allColumnXs:o,allColumnWidths:l,width:d}=t,u=o.get(e),h=l.get(e);if(u==null||h==null)return null;var m=Math.max(0,u),c=h;u+h>d?c=d-u:u<0&&(c=h-Math.abs(u));var g={position:"absolute",top:(r-1)*a,left:m,width:c,height:a,pointerEvents:"none"},p={clientWidth:1,clientHeight:a,getBoundingClientRect:this.getColumnBoundingRect},f={placement:"bottom",modifiers:{flip:{behavior:["bottom","top"]}}},y=this.getModelColumn(e);if(y==null)return null;var F=n.columns[y];return F==null?null:s.jsx("div",{style:g,children:s.jsx(ze,{timeout:400,interactive:!0,options:f,ref:this.handleTooltipRef,referenceObject:p,onExited:()=>{this.setState({shownColumnTooltip:null})},children:s.jsx(gt,{model:n,column:F,onStatistics:()=>{var T;(T=this.tooltip)===null||T===void 0||T.update()}})},F.name)})}handleGotoValueSelectedColumnNameChanged(e){var t,{model:n}=this.props,a=(t=this.grid)===null||t===void 0?void 0:t.state.cursorRow,{gotoValueSelectedColumnName:r,gotoValueManuallyChanged:o}=this.state;if(a!=null){var l=n.getColumnIndexByName(e),d=ee.getColumnByName(n.columns,e),u=ee.getColumnByName(n.columns,r);if(l==null||d==null)return;var h=n.valueForCell(l,a),m=ee.convertValueToText(h,d.type);o&&d.type===(u==null?void 0:u.type)?this.setState({gotoValueSelectedColumnName:e,gotoValueError:""}):this.setState({gotoValueSelectedColumnName:e,gotoValue:m,gotoValueError:"",gotoValueManuallyChanged:!1})}this.setState({gotoValueSelectedColumnName:e,gotoValueError:""})}handleGotoValueSelectedFilterChanged(e){this.setState({gotoValueSelectedFilter:e,gotoValueError:""})}handleGotoValueSubmitted(e){var{gotoValue:t}=this.state;this.seekRow(t,e)}render(){var e,t,n=this,a,r,{children:o,customFilters:l,getDownloadWorker:d,isSelectingColumn:u,isStuckToBottom:h,isStuckToRight:m,model:c,name:g,onlyFetchVisibleColumns:p,alwaysFetchColumns:f,advancedSettings:y,onAdvancedSettingsChange:F,canDownloadCsv:T,onCreateChart:C}=this.props,{metricCalculator:_,metrics:E,isFilterBarShown:A,isSelectingPartition:D,isMenuShown:$,isReady:te,copyOperation:Y,focusedFilterBarColumn:re,loadingText:K,loadingScrimProgress:me,loadingSpinnerShown:Ne,loadingCancelShown:ge,loadingBlocksGrid:Te,shownColumnTooltip:Fe,hoverAdvancedFilter:Re,shownAdvancedFilter:ve,hoverSelectColumn:Ve,quickFilters:Ae,advancedFilters:x,searchFilter:S,selectDistinctColumns:O,movedColumns:I,movedRows:V,formatter:B,conditionalFormats:H,conditionalFormatPreview:q,conditionalFormatEditIndex:ae,columnAlignmentMap:J,sorts:se,reverse:Oe,customColumns:Ge,selectedRanges:xt,isTableDownloading:Rt,tableDownloadStatus:pt,tableDownloadProgress:It,tableDownloadEstimatedTime:Xe,showSearchBar:le,searchValue:Hi,selectedSearchColumns:Wi,invertSearchColumns:$i,aggregationSettings:Dt,selectedAggregation:Sn,rollupConfig:Le,openOptions:Ze,pendingSavePromise:Ki,pendingSaveError:zi,pendingRowCount:Qi,pendingDataErrors:Yi,pendingDataMap:bn,toastMessage:qi,frozenColumns:Xi,columnHeaderGroups:Tn,showOverflowModal:Zi,showNoPastePermissionModal:Ji,noPastePermissionError:ea,overflowText:ta,overflowButtonTooltipProps:En,expandCellTooltipProps:yn,hoverTooltipProps:wn,isGotoShown:Nn,gotoRow:na,gotoRowError:ia,gotoValueError:aa,gotoValueSelectedColumnName:ra,gotoValue:sa,gotoValueSelectedFilter:oa,partitionConfig:Fn}=this.state;if(!te)return null;var je=this.getTheme(),{columnHeaderHeight:An}=je,la=this.getCachedFilter(l,Ae,x,S),On=_.getUserColumnWidths(),da=this.getCachedStateOverride(c,je,Ve,A,u,me,Ae,x,se,Oe,Le,$),ua=E?E.top:0,ha=E?E.bottomViewport:0,_n=null,xn=null;p&&(_n=E?E.left:0,xn=E?E.right:0);var ca=E!=null&&E.width>0&&E.height>0,Rn=((e=Le==null||(t=Le.columns)===null||t===void 0?void 0:t.length)!==null&&e!==void 0?e:0)>0,In=null,ma=E?Math.min(Math.max(we.minDebounce,Math.round(E.rowCount/200)),we.maxDebounce):we.maxDebounce;if(A&&re!=null&&E!=null){var{gridX:ga,gridY:va,allColumnXs:pa,allColumnWidths:fa,width:Ca}=E,Dn=pa.get(re),Ln=fa.get(re);if(Dn!=null&&Ln!=null){var Lt,jt,Pt,jn=ga+Dn,Sa=va-((Lt=je.filterBarHeight)!==null&&Lt!==void 0?Lt:0),ba=Ln+1,Ta=((jt=je.filterBarHeight)!==null&&jt!==void 0?jt:0)-1,Ea={top:Sa,left:jn,minWidth:Math.min(ba,Ca-jn),height:Ta},Ut="",Pn=!0,Mt=this.getModelColumn(re);U(Mt);var kt=Ae.get(Mt),Un=x.get(Mt);kt!=null&&(Ut=kt.text,Pn=kt.filter!=null);var ya=Ae.size!==0||x.size!==0;In=s.jsx(Li,{ref:this.filterInputRef,style:Ea,className:W({error:!Pn,active:Ut!==""||Un!=null,"iris-grid-has-filter":ya}),isAdvancedFilterSet:Un!=null,onAdvancedFiltersTriggered:()=>{this.setState({shownAdvancedFilter:re})},onChange:this.handleFilterBarChange,onDone:this.handleFilterBarDone,onTab:this.handleFilterBarTab,onContextMenu:(Pt=this.grid)===null||Pt===void 0?void 0:Pt.handleContextMenu,debounceMs:ma,value:Ut},re)}}var Mn=null;if(K!=null){var wa=s.jsxs("div",{className:"iris-grid-loading-status",children:[s.jsx("div",{className:W("iris-grid-loading-status-bar",{show:Ne}),children:K}),s.jsxs("button",{type:"button",onClick:this.handleCancel,className:W("iris-grid-btn-cancel",{show:ge}),children:[s.jsx(z,{icon:Ei,transform:"down-1"}),"Cancel"]})]}),Na=E?E.gridY:0;Mn=s.jsx("div",{className:"iris-grid-loading",style:Te?{top:Na}:{},children:wa})}var kn=null;if(Fe!=null&&E){var Vt;kn=this.getColumnTooltip(Fe,E,c),(Vt=this.tooltip)===null||Vt===void 0||Vt.update()}var Vn=[];if(E&&A)for(var{gridX:Fa,gridY:Aa,visibleColumns:Gn,allColumnXs:Oa,allColumnWidths:_a}=E,{filterBarHeight:Gt}=je,xa=function(){var ne=Gn[Bt],Be=Oa.get(ne),Ie=_a.get(ne),Je=n.getModelColumn(ne);if(Je!=null){var Wt=c.isFilterable(Je);if(Wt&&Be!=null&&Ie!=null&&Ie>0){var $t=Fa+Be+Ie-24,He=Aa-(Gt??0)+2,et={position:"absolute",top:He,left:$t},Kt=x.get(Je),ft=Kt!=null,tt=ne===Re||ne===re||ft,nt=s.jsx("div",{className:W("advanced-filter-button-container",{hidden:!tt}),style:et,children:tt&&s.jsx(k,{kind:"ghost",className:W("btn-link-icon advanced-filter-button",{"filter-set":ft}),onClick:()=>{n.setState({shownAdvancedFilter:ne})},onContextMenu:zt=>{var Qt;(Qt=n.grid)===null||Qt===void 0||Qt.handleContextMenu(zt)},onMouseEnter:()=>{n.setState({hoverAdvancedFilter:ne})},onMouseLeave:()=>{n.setState({hoverAdvancedFilter:null})},children:s.jsxs("div",{className:"fa-layers",children:[s.jsx(z,{icon:Ci,className:"filter-solid"}),s.jsx(z,{icon:dn,className:"filter-light"})]})})},ne);Vn.push(nt)}}},Bt=0;Bt<Gn.length;Bt+=1)xa();var Bn=[];if(E)for(var{gridX:Hn,visibleColumns:Wn,allColumnXs:Ra,allColumnWidths:Ia,columnHeaderHeight:$n}=E,Da=function(){var ne=Wn[Ht],Be=Ra.get(ne),Ie=Ia.get(ne);if(Be!=null&&Ie!=null&&Ie>0){var Je=Hn+Be,Wt=Hn+Be+Ie-20,$t=A?{position:"absolute",top:$n,left:Wt,width:20,height:je.filterBarHeight}:{position:"absolute",top:0,left:Je,width:Ie,height:$n},He=n.getModelColumn(ne);if(He!=null){var et=c.columns[He];if(et==null)return N.warn("Column does not exist at index ".concat(He," for column array of length ").concat(c.columns.length)),1;var Kt=x.get(He),{options:ft}=Kt||{},tt=b.getSortForColumn(c.sort,et.name),nt=tt?tt.direction:null;if(!yr(nt))throw new Error("Invalid sort direction: ".concat(nt));var zt=s.jsx("div",{className:"advanced-filter-menu-container",style:$t,children:s.jsx(Fi,{className:"advanced-filter-menu-popper",onEntered:n.getAdvancedMenuOpenedHandler(ne),onExited:()=>{n.handleAdvancedMenuClosed(ne)},isShown:ve===ne,interactive:!0,closeOnBlur:!0,options:{positionFixed:!0},children:n.getCachedAdvancedFilterMenuActions(c,et,ft,nt,B)})},ne);Bn.push(zt)}}},Ht=0;Ht<Wn.length;Ht+=1)Da();var Kn=this.getCachedOptionItems(C!==void 0&&c.isChartBuilderAvailable,c.isCustomColumnsAvailable,c.isFormatColumnsAvailable,c.isOrganizeColumnsAvailable,c.isRollupAvailable,c.isTotalsAvailable||Rn,c.isSelectDistinctAvailable,c.isExportAvailable,this.toggleFilterBarAction,this.toggleSearchBarAction,this.toggleGotoRowAction,A,le,T,this.isTableSearchAvailable(),Nn,y.size>0),zn=this.getCachedHiddenColumns(_,On),La=Ze.map(pe=>{switch(pe.type){case G.CHART_BUILDER:return s.jsx(is,{model:c,onChange:this.handleChartChange,onSubmit:this.handleChartCreate},G.CHART_BUILDER);case G.VISIBILITY_ORDERING_BUILDER:return s.jsx(ns,{model:c,movedColumns:I,hiddenColumns:zn,columnHeaderGroups:Tn,onColumnVisibilityChanged:this.handleColumnVisibilityChanged,onReset:this.handleColumnVisibilityReset,onMovedColumnsChanged:this.handleMovedColumnsChanged,onColumnHeaderGroupChanged:this.handleHeaderGroupsChanged,onFrozenColumnsChanged:this.handleFrozenColumnsChanged},G.VISIBILITY_ORDERING_BUILDER);case G.CONDITIONAL_FORMATTING:return s.jsx(Ho,{rules:H,onChange:this.handleConditionalFormatsChange,onCreate:this.handleConditionalFormatCreate,onSelect:this.handleConditionalFormatEdit});case G.CONDITIONAL_FORMATTING_EDIT:return U(c.columns),U(this.handleConditionalFormatEditorUpdate),s.jsx(El,{dh:c.dh,columns:c.columns,rule:q,onUpdate:this.handleConditionalFormatEditorUpdate,onSave:this.handleConditionalFormatEditorSave,onCancel:this.handleConditionalFormatEditorCancel});case G.CUSTOM_COLUMN_BUILDER:return s.jsx(ts,{model:c,customColumns:Ge,onSave:this.handleUpdateCustomColumns,onCancel:this.handleMenuBack},G.CUSTOM_COLUMN_BUILDER);case G.ROLLUP_ROWS:return s.jsx(es,{model:c,onChange:this.handleRollupChange,config:Le},G.ROLLUP_ROWS);case G.AGGREGATIONS:return s.jsx(Jr,{settings:Dt,isRollup:Rn,availablePlacements:_e(c)&&c.isEditable?["top"]:["top","bottom"],onChange:this.handleAggregationsChange,onEdit:this.handleAggregationEdit,dh:c.dh});case G.AGGREGATION_EDIT:return Sn&&s.jsx(Zr,{aggregation:Sn,columns:c.originalColumns,onChange:this.handleAggregationChange});case G.TABLE_EXPORTER:return s.jsx(Pe,{model:c,name:g,userColumnWidths:On,movedColumns:I,isDownloading:Rt,tableDownloadStatus:pt,tableDownloadProgress:It,tableDownloadEstimatedTime:Xe??void 0,onDownload:this.handleDownloadTable,onDownloadStart:this.handleDownloadTableStart,onCancel:this.handleCancelDownloadTable,selectedRanges:xt},G.TABLE_EXPORTER);case G.SELECT_DISTINCT:return s.jsx(Ui,{model:c,selectDistinctColumns:O,onChange:this.handleSelectDistinctChanged});case G.ADVANCED_SETTINGS:return s.jsx(Cn,{items:y,onChange:F});default:throw Error("Unexpected option type ".concat(pe.type))}});return s.jsxs("div",{className:"iris-grid",role:"presentation",children:[s.jsxs("div",{className:"iris-grid-column",children:[o!=null&&s.jsx("div",{className:"iris-grid-bar",children:o}),s.jsx(on,{in:D,timeout:ln.transitionSlowMs,classNames:"iris-grid-bar-horizontal",onEnter:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExit:this.handleAnimationStart,onExited:this.handleAnimationEnd,mountOnEnter:!0,unmountOnExit:!0,nodeRef:this.slideTransitionRef,children:s.jsx("div",{ref:this.slideTransitionRef,className:"iris-grid-partition-selector-wrapper iris-grid-bar iris-grid-bar-primary",children:Tt(c)&&c.isPartitionRequired&&s.jsx(Do,{model:c,partitionConfig:Fn,onChange:this.handlePartitionChange})})}),s.jsx(on,{in:le,timeout:ln.transitionSlowMs,classNames:"iris-grid-bar-horizontal",onEnter:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExit:this.handleAnimationStart,onExited:this.handleAnimationEnd,mountOnEnter:!0,unmountOnExit:!0,nodeRef:this.bottomTransitionRef,children:s.jsx("div",{ref:this.bottomTransitionRef,className:"iris-grid-bar",children:s.jsx(St,{value:Hi,selectedColumns:Wi,invertSelection:$i,onChange:this.handleCrossColumnSearch,columns:c.columns,ref:this.crossColumnRef})})}),s.jsxs(cs,{ref:pe=>{this.grid=pe},isStickyBottom:!_e(c)||!c.isEditable,isStuckToBottom:h,isStuckToRight:m,metricCalculator:_,model:c,keyHandlers:this.getKeyHandlers(),mouseHandlers:this.getMouseHandlers(),movedColumns:I,movedRows:V,onError:this.handleGridError,onViewChanged:this.handleViewChanged,onSelectionChanged:this.handleSelectionChanged,onMovedColumnsChanged:this.handleMovedColumnsChanged,renderer:this.renderer,stateOverride:da,theme:je,children:[s.jsx(yl,{isOpen:Zi,text:ta,onClose:this.handleOverflowClose}),ca&&s.jsx(ji,{model:c,top:ua,bottom:ha,left:_n,right:xn,filter:la,formatter:B,columnAlignmentMap:J,sorts:se,reverse:Oe,movedColumns:I,customColumns:Ge,hiddenColumns:zn,alwaysFetchColumns:this.getAlwaysFetchColumns(f,c.columns,I,c.floatingLeftColumnCount,c.floatingRightColumnCount,(a=this.grid)===null||a===void 0||(a=a.state.draggingColumn)===null||a===void 0?void 0:a.range),formatColumns:this.getCachedPreviewFormatColumns(c.dh,c.columns,H,q,((r=Ze[Ze.length-1])===null||r===void 0?void 0:r.type)===G.CONDITIONAL_FORMATTING_EDIT?ae??void 0:void 0),rollupConfig:this.getModelRollupConfig(c.originalColumns,Le,Dt),totalsConfig:this.getModelTotalsConfig(c.columns,Le,Dt),selectDistinctColumns:O,pendingRowCount:Qi,pendingDataMap:bn,frozenColumns:Xi,columnHeaderGroups:Tn,partitionConfig:Fn,showExtraGroupColumn:this.showExtraGroupColumn}),!$&&s.jsx("div",{className:"grid-settings-button",style:{height:"".concat(An,"px"),width:"".concat(An,"px")},children:s.jsx(k,{kind:"ghost","data-testid":"btn-iris-grid-settings-button-".concat(g),onClick:this.handleMenu,icon:s.jsx(z,{icon:mr,transform:"up-1"}),tooltip:"Table Options"})}),In,Mn,Vn,kn,Bn,En&&this.getOverflowButtonTooltip(En),yn&&this.getExpandCellTooltip(yn),wn&&this.getHoverTooltip(wn)]}),s.jsx(Bi,{ref:this.gotoRowRef,model:c,isShown:Nn,gotoRow:na,gotoRowError:ia,gotoValueError:aa,onGotoRowSubmit:this.handleGotoRowSelectedRowNumberSubmit,onGotoRowNumberChanged:this.handleGotoRowSelectedRowNumberChanged,onClose:this.handleGotoRowClosed,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:()=>{this.handleAnimationStart(),this.focus()},onExited:this.handleAnimationEnd,gotoValueSelectedColumnName:ra,gotoValue:sa,gotoValueFilter:oa,onGotoValueSelectedColumnNameChanged:this.handleGotoValueSelectedColumnNameChanged,onGotoValueSelectedFilterChanged:this.handleGotoValueSelectedFilterChanged,onGotoValueChanged:this.handleGotoValueChanged,onGotoValueSubmit:this.handleGotoValueSubmitted}),s.jsx(Zs,{error:zi,isSaving:Ki!=null,saveTooltip:"Commit (".concat(this.commitAction.shortcut.getDisplayText(),")"),discardTooltip:"Discard (".concat(this.discardAction.shortcut.getDisplayText(),")"),pendingDataErrors:Yi,pendingDataMap:bn,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd,onSave:this.handlePendingCommitClicked,onDiscard:this.handlePendingDiscardClicked}),s.jsx(yo,{children:qi}),s.jsx(j,{model:c,copyOperation:Y??void 0,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd}),s.jsx(as,{dh:c.dh,ref:pe=>{this.tableSaver=pe},getDownloadWorker:d,onDownloadCompleted:this.handleDownloadCompleted,onDownloadCanceled:this.handleDownloadCanceled,onDownloadProgressUpdate:this.handleDownloadProgressUpdate,isDownloading:pt===Pe.DOWNLOAD_STATUS.DOWNLOADING,formatter:B})]}),s.jsx(us,{in:$,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd,mountOnEnter:!0,unmountOnExit:!0,children:s.jsx("div",{className:"table-sidebar",children:s.jsxs(ds,{children:[s.jsx(Jn,{title:"Table Options",onClose:this.handleMenuClose,children:s.jsx(Oi,{onSelect:pe=>this.handleMenuSelect(Kn[pe]),items:Kn})}),La.map((pe,ne)=>s.jsx(Jn,{title:Ze[ne].title,onBack:this.handleMenuBack,onClose:this.handleMenuClose,children:pe},Ze[ne].type))]})})}),s.jsx(Er,{actions:this.contextActions}),s.jsx(Nl,{isOpen:Ji,onClose:this.handleCloseNoPastePermissionModal,errorMessage:ea})]})}}w(we,"contextType",rs);w(we,"minDebounce",150);w(we,"maxDebounce",500);w(we,"loadingSpinnerDelay",800);w(we,"defaultProps",{advancedFilters:Ee,advancedSettings:Ee,alwaysFetchColumns:Z,conditionalFormats:Z,customColumnFormatMap:Ee,columnAlignmentMap:Ee,isFilterBarShown:!1,applyInputFiltersOnInit:!1,movedColumns:Z,movedRows:Z,inputFilters:Z,customFilters:Z,onCreateChart:void 0,onColumnSelected:()=>{},onDataSelected:()=>{},onError:()=>{},onStateChange:()=>{},onAdvancedSettingsChange:()=>{},partitions:void 0,partitionConfig:void 0,quickFilters:Ee,selectDistinctColumns:Z,sorts:Z,reverse:!1,customColumns:Z,aggregationSettings:cn,rollupConfig:void 0,userColumnWidths:Ee,userRowHeights:Ee,onSelectionChanged:()=>{},isSelectingColumn:!1,isSelectingPartition:!1,isStuckToBottom:!1,isStuckToRight:!1,columnAllowedCursor:"linker",columnNotAllowedCursor:"linker-not-allowed",copyCursor:"copy",name:"table",onlyFetchVisibleColumns:!0,showSearchBar:!1,searchValue:"",invertSearchColumns:!0,onContextMenu:()=>Z,pendingDataMap:Ee,getDownloadWorker:hs.getServiceWorker,settings:{timeZone:"America/New_York",defaultDateTimeFormat:pn.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,truncateNumbersWithPound:!1,showEmptyStrings:!0,showNullStrings:!0,showExtraGroupColumn:!0,formatter:Z},canCopy:!0,canDownloadCsv:!0,frozenColumns:Z,density:void 0,canToggleSearch:!0,mouseHandlers:Z,keyHandlers:Z,getMetricCalculator:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return new ss(...t)}});export{we as default};
3
- //# sourceMappingURL=IrisGrid-m82zJTmT.js.map
3
+ //# sourceMappingURL=IrisGrid-CFqfz-_M.js.map