@deephaven/code-studio 0.89.1-beta.0 → 0.89.1-beta.3

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