@deephaven/code-studio 0.82.1-beta.6 → 0.82.1-beta.7
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.
- package/build/assets/{AppRoot-e0623c71.js → AppRoot-98ad8cf7.js} +3 -3
- package/build/assets/{AppRoot-e0623c71.js.map → AppRoot-98ad8cf7.js.map} +1 -1
- package/build/assets/{Chart-e5224823.js → Chart-a9c6e441.js} +2 -2
- package/build/assets/{Chart-e5224823.js.map → Chart-a9c6e441.js.map} +1 -1
- package/build/assets/{ControlType-ee9c672e.js → ControlType-c918f1cd.js} +3 -3
- package/build/assets/{ControlType-ee9c672e.js.map → ControlType-c918f1cd.js.map} +1 -1
- package/build/assets/FontBootstrap-93399df4.js +4 -0
- package/build/assets/FontBootstrap-93399df4.js.map +1 -0
- package/build/assets/{FormatterUtils-aa7386ef.js → FormatterUtils-8bc07bb9.js} +2 -2
- package/build/assets/{FormatterUtils-aa7386ef.js.map → FormatterUtils-8bc07bb9.js.map} +1 -1
- package/build/assets/{Grid-4206eb66.js → Grid-68f28f7c.js} +2 -2
- package/build/assets/{Grid-4206eb66.js.map → Grid-68f28f7c.js.map} +1 -1
- package/build/assets/GridRenderer-beadd456.js +2 -0
- package/build/assets/GridRenderer-beadd456.js.map +1 -0
- package/build/assets/{IrisGrid-c5f818f4.js → IrisGrid-8471fc12.js} +2 -2
- package/build/assets/{IrisGrid-c5f818f4.js.map → IrisGrid-8471fc12.js.map} +1 -1
- package/build/assets/{IrisGridModel-f63f94cc.js → IrisGridModel-db71cdf7.js} +2 -2
- package/build/assets/{IrisGridModel-f63f94cc.js.map → IrisGridModel-db71cdf7.js.map} +1 -1
- package/build/assets/{IrisGridShortcuts-c8a512d6.js → IrisGridShortcuts-6b660c54.js} +2 -2
- package/build/assets/{IrisGridShortcuts-c8a512d6.js.map → IrisGridShortcuts-6b660c54.js.map} +1 -1
- package/build/assets/{IrisGridThemeProvider-ed895144.js → IrisGridThemeProvider-98bbe2be.js} +2 -2
- package/build/assets/{IrisGridThemeProvider-ed895144.js.map → IrisGridThemeProvider-98bbe2be.js.map} +1 -1
- package/build/assets/{LocalWorkspaceStorage-8e43291a.js → LocalWorkspaceStorage-20cf2372.js} +2 -2
- package/build/assets/{LocalWorkspaceStorage-8e43291a.js.map → LocalWorkspaceStorage-20cf2372.js.map} +1 -1
- package/build/assets/{MarkdownEditor-d90e4bef.js → MarkdownEditor-92833d91.js} +2 -2
- package/build/assets/{MarkdownEditor-d90e4bef.js.map → MarkdownEditor-92833d91.js.map} +1 -1
- package/build/assets/{MarkdownNotebook-7c4e9125.js → MarkdownNotebook-58af34d7.js} +2 -2
- package/build/assets/{MarkdownNotebook-7c4e9125.js.map → MarkdownNotebook-58af34d7.js.map} +1 -1
- package/build/assets/{MissingPartitionError-1e490bac.js → MissingPartitionError-6ffc79b5.js} +2 -2
- package/build/assets/{MissingPartitionError-1e490bac.js.map → MissingPartitionError-6ffc79b5.js.map} +1 -1
- package/build/assets/{StyleGuideRoot-42855334.js → StyleGuideRoot-d45b2596.js} +12 -12
- package/build/assets/{StyleGuideRoot-42855334.js.map → StyleGuideRoot-d45b2596.js.map} +1 -1
- package/build/assets/index-0b8d9e03.js +2 -0
- package/build/assets/{index-0e1c1551.js.map → index-0b8d9e03.js.map} +1 -1
- package/build/assets/{index-2f2129be.js → index-7440403e.js} +2 -2
- package/build/assets/{index-2f2129be.js.map → index-7440403e.js.map} +1 -1
- package/build/assets/{index-1f683a88.js → index-ea785fe0.js} +3 -3
- package/build/assets/{index-1f683a88.js.map → index-ea785fe0.js.map} +1 -1
- package/build/index.html +1 -1
- package/package.json +30 -30
- package/build/assets/FontBootstrap-4f906e56.js +0 -4
- package/build/assets/FontBootstrap-4f906e56.js.map +0 -1
- package/build/assets/GridRenderer-bf66c0c9.js +0 -2
- package/build/assets/GridRenderer-bf66c0c9.js.map +0 -1
- package/build/assets/index-0e1c1551.js +0 -2
package/build/assets/{IrisGridThemeProvider-ed895144.js → IrisGridThemeProvider-98bbe2be.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as p,I as s,K as U,L as W,aL as Ve,aK as he,bb as Ke,Z as we,ba as Rt,bc as ot,_ as er,T as lt,U as le,M as rr,bN as At,bO as re,bP as Mt,bQ as kt,bR as Ft,bS as _t,bT as He,bU as Lt,bV as Ht,bW as $t,bX as tr,bY as Gt,bZ as nr,b_ as Ut,b$ as Bt,c0 as Wt,c1 as zt,c2 as Vt,c3 as Kt,ag as $e,bd as qt}from"./vendor-6ba620f4.js";import{L as te,bb as Xt,al as st,f as Oe,g as qe,T as K,bc as Xe,bd as Ye,ap as Yt,an as dt,u as Zt,be as Qt,aq as ut,ah as Ne,ai as Jt,P as ct,e as k,aE as en,bf as rn,a$ as ar,n as tn,bg as ht,bh as vt,v as nn,bi as an,G as on,b4 as ln,bj as sn,bk as dn,bl as un,bm as cn,bn as hn,d as vn,ax as mn,bo as fn,aU as Z,a6 as gn,a0 as pn,aK as bn}from"./index-2f2129be.js";import{S as Cn,b as ir,n as Sn,I as mt,C as ce}from"./MissingPartitionError-1e490bac.js";import{a as ae}from"./IrisGridShortcuts-c8a512d6.js";import{n as ee,O as wn,a8 as On,a9 as yn,aa as ft,ab as xn,ac as In,a6 as jn,a0 as Pn,v as Dn}from"./GridRenderer-bf66c0c9.js";import{B as E,S as Ee,c as z,C as ve,x as Tn,aH as Nn,a5 as gt,D as Ze,Q as pt,s as Ge,d as En,P as Rn,ch as An,u as ke,bh as bt,bg as or,bk as Mn,bi as lr,ba as kn,cF as Fn,bf as _n,cD as Ln,cE as Hn,aT as $n}from"./ControlType-ee9c672e.js";import{e as Gn}from"./monaco-b5248072.js";import{b as fe,G as ge,c as M,m as Ct}from"./IrisGridModel-f63f94cc.js";import{F as Un,c as Bn}from"./FormatterUtils-aa7386ef.js";function Wn(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=p.useRef(),a=p.useRef(0);return p.useCallback(i=>{window.clearTimeout(n.current),n.current=window.setTimeout(()=>{var o=Math.floor(i.target.scrollTop/t);a.current!==o&&(a.current=o,e(o))},r)},[r,t,e])}function zn(){var{getKey:t=Vn}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},[e,r]=p.useState([]),[n,a]=p.useState(()=>new Set),i=p.useCallback(v=>g=>t(g)===v,[t]),o=p.useCallback(v=>{var g;return(g=e.find(i(v)))!==null&&g!==void 0?g:null},[e,i]),l=p.useCallback(v=>{var g=o(v);if(g==null)throw new Error("No item found matching key: ".concat(v));return g},[o]),d=p.useCallback(v=>{r(g=>[...g,...v])},[]),u=p.useCallback((v,g)=>{r(C=>[...C.slice(0,v),...g,...C.slice(v)])},[]),c=p.useCallback(v=>{var g=new Set(v);r(C=>C.filter(b=>!g.has(t(b))))},[t]),h=p.useCallback((v,g)=>{var C=e.findIndex(i(v));C!==-1&&r(b=>[...b.slice(0,C),g,...b.slice(C+1)])},[e,i]),m=p.useCallback(v=>{if(v.size!==0){var g=[],C=new Map;for(var b of v.keys()){var w=e.findIndex(i(b));g.push(w),C.set(w,b)}g.sort((j,y)=>j-y);var S=[];e.forEach((j,y)=>{if(g[0]===y){var I=C.get(g.shift()),T=v.get(I);S.push(T)}else S.push(j)}),r(S)}},[e,i]),f=p.useMemo(()=>({items:e,selectedKeys:n,append:d,bulkUpdate:m,findItem:o,getItem:l,insert:u,remove:c,setItems:r,setSelectedKeys:a,update:h}),[d,m,o,l,u,e,c,r,n,h]);return f}function Vn(t){var e=t!=null&&typeof t=="object"&&"key"in t;if(!e)throw new Error("Item does not have a `key` prop.");return t.key}function sr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function dr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?sr(Object(r),!0).forEach(function(n){Kn(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):sr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Kn(t,e,r){return e=qn(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function qn(t){var e=Xn(t,"string");return typeof e=="symbol"?e:String(e)}function Xn(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ur=te.module("Aggregations");function Uo(t){var{isRollup:e,settings:r,onChange:n,onEdit:a}=t,{aggregations:i,showOnTop:o}=r,l=p.useMemo(()=>Cn.filter(O=>!i.some(P=>P.operation===O)),[i]),[d,u]=p.useState(l[0]),[c,h]=p.useState([]),m=p.useCallback(O=>{n(dr(dr({},r),O))},[n,r]),f=p.useCallback(O=>{m({aggregations:O})},[m]),v=p.useCallback(O=>{m({showOnTop:O})},[m]),g=p.useCallback(()=>{ur.debug("handleDragStart"),ae.startDragging()},[]),C=p.useCallback(O=>{var{destination:P,source:R}=O;if(ur.debug("handleDragEnd",P,R),ae.stopDragging(),P!==null){var L=P.index;R.index<P.index&&(L+=1);var _=[...i],F=ae.reorder(_,c,_,L),G=ae.adjustDestinationIndex(L,c),$=[[G,G+F.length-1]];f(_),h($)}},[f,i,c,h]),b=p.useCallback(O=>{u(O)},[u]),w=p.useCallback(()=>{f([...i,{operation:d,selected:[],invert:!0}])},[i,d,f]),S=p.useCallback(O=>{f(i.filter((P,R)=>R!==O))},[i,f]),j=p.useCallback(O=>{h(O)},[h]),y=p.useCallback(O=>{var P=i[O];ir.isRollupOperation(P.operation)||a(P)},[i,a]),I=p.useCallback(O=>{v(O==="true")},[v]);p.useEffect(function(){l.length>0&&!l.includes(d)&&u(l[0])},[l,d]);var T=p.useCallback(O=>{var{item:P,itemIndex:R,isClone:L=!1,selectedCount:_}=O,F=P.operation,G=L?"".concat(_):void 0,$=L?"item-list-item-clone":void 0,B=ir.isRollupOperation(P.operation),ie=!L&&!B;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:U("item-list-item-content","draggable-item-list-item-content",$),children:[s.jsxs("span",{className:"title",children:[F,!e&&B&&s.jsxs("span",{className:"small text-warning",children:[s.jsx(W,{icon:Xt})," Requires rollup"]})]}),ee.renderBadge({text:G}),ee.renderHandle()]}),!L&&s.jsxs(s.Fragment,{children:[s.jsx(E,{kind:"ghost",className:"btn-edit",icon:st,tooltip:"Edit Columns",onClick:()=>a(P),disabled:!ie}),s.jsx(E,{kind:"ghost",className:"btn-delete",icon:Oe,tooltip:"Delete Aggregation",onClick:()=>S(R)})]})]})},[S,a,e]),D=l.length>0,x=i.length>0;return s.jsxs("div",{className:"aggregations",children:[D&&s.jsxs("div",{className:"form-inline",children:[s.jsx(Ee,{onChange:b,value:d,children:l.map(O=>s.jsx(wn,{value:O,children:O},O))}),s.jsxs("button",{type:"button",className:"btn btn-link btn-add",onClick:w,children:[s.jsx(W,{icon:qe}),"Add Aggregation"]})]}),D&&x&&s.jsx("hr",{}),x&&s.jsxs(s.Fragment,{children:[!e&&s.jsxs("div",{children:[s.jsx("label",{id:"placement-options-label",children:"Placement: "}),s.jsxs(Ve,{"aria-labelledby":"placement-options-label",marginStart:"size-125",orientation:"horizontal",onChange:I,value:"".concat(o),children:[s.jsx(he,{value:"true",children:"Top"}),s.jsx(he,{value:"false",children:"Bottom"})]})]}),s.jsx(Ke,{onDragStart:g,onDragEnd:C,children:s.jsx(ee,{className:"selected-aggregations",itemCount:i.length,items:i,renderItem:T,offset:0,onSelectionChange:j,onSelect:y,selectedRanges:c,isMultiSelect:!0})})]})]})}function cr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function oe(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?cr(Object(r),!0).forEach(function(n){Yn(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):cr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Yn(t,e,r){return e=Zn(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Zn(t){var e=Qn(t,"string");return typeof e=="symbol"?e:String(e)}function Qn(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Q;(function(t){t[t.NONE=0]="NONE",t[t.ASCENDING=1]="ASCENDING",t[t.DESCENDING=2]="DESCENDING"})(Q||(Q={}));var Jn=30;function Bo(t){var{aggregation:e,columns:r,onChange:n}=t,[a,i]=p.useState(-1),[o,l]=p.useState(-1),[d,u]=p.useState(Q.NONE),{invert:c,selected:h}=e,m=p.useRef(null),f=p.useCallback(I=>h.includes(I)?!c:c,[c,h]),v=p.useMemo(()=>{var I=Sn(r,e.operation);return d!==Q.NONE&&(I=z.sortColumns(I,d===Q.ASCENDING)),I},[r,e.operation,d]),g=p.useMemo(()=>a>=0?v.slice(a,o+1).map(I=>({value:I.name,displayValue:I.name,isSelected:f(I.name)})):[],[v,f,o,a]),C=p.useCallback(I=>{var{name:T}=v[I],D=h.indexOf(T),x=[...h],O=c;D>=0?x.splice(D,1):(x.push(T),x.length===v.length&&(x=[],O=!c)),n(oe(oe({},e),{},{selected:x,invert:O}))},[e,c,v,h,n]),b=p.useCallback(()=>{u(Q.NONE),n(oe(oe({},e),{},{selected:[],invert:!0}))},[e,n]),w=p.useCallback((I,T)=>{i(I),l(T)},[i,l]),S=p.useCallback(()=>{h.length===0?n(oe(oe({},e),{},{invert:!c})):n(oe(oe({},e),{},{selected:[],invert:!0}))},[e,c,n,h]),j=h.length===0?c:null,y=h.length!==0||!c||d!==Q.NONE;return s.jsxs("div",{role:"menu",className:"aggregation-edit",children:[s.jsx("div",{className:"top-menu",children:s.jsxs("div",{className:"form-inline",children:[s.jsx(ve,{checked:j,onChange:S,children:"Toggle All"}),s.jsx("div",{className:"spacer"}),s.jsx(Tn,{in:y,timeout:K.transitionSlowMs,mountOnEnter:!0,unmountOnExit:!0,children:s.jsx(E,{kind:"ghost",className:"btn-reset",onClick:b,children:"Reset"})}),s.jsx(E,{kind:"ghost",className:U({active:d===Q.ASCENDING}),icon:Xe,tooltip:"Sort ascending",onClick:()=>u(Q.ASCENDING)}),s.jsx(E,{kind:"ghost",className:U({active:d===Q.DESCENDING}),icon:Ye,tooltip:"Sort descending",onClick:()=>u(Q.DESCENDING)})]})}),s.jsx("div",{className:"aggregation-edit-item-list",children:s.jsx(Nn,{itemCount:v.length,items:g,offset:a,renderItem:I=>{var{item:T}=I;return s.jsx(ve,{checked:f(T.value),children:T.displayValue})},onSelect:C,onViewportChange:w,rowHeight:Jn,focusSelector:"input",ref:m})})]})}function hr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function vr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?hr(Object(r),!0).forEach(function(n){ea(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):hr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ea(t,e,r){return e=ra(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ra(t){var e=ta(t,"string");return typeof e=="symbol"?e:String(e)}function ta(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function na(t){return s.jsx("svg",vr(vr({width:48,height:48,xmlns:"http://www.w3.org/2000/svg"},t),{},{children:s.jsxs("g",{fill:"none",fillRule:"evenodd",children:[s.jsx("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),s.jsx("path",{fill:"#7DA4FF",d:"M8 26h4v15H8zM15 17h4v24h-4zM22 21h4v20h-4zM29 17h4v24h-4zM36 11h4v30h-4z"})]})}))}function mr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function fr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?mr(Object(r),!0).forEach(function(n){aa(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):mr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function aa(t,e,r){return e=ia(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ia(t){var e=oa(t,"string");return typeof e=="symbol"?e:String(e)}function oa(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function la(t){return s.jsx("svg",fr(fr({width:48,height:48,xmlns:"http://www.w3.org/2000/svg"},t),{},{children:s.jsxs("g",{fill:"none",fillRule:"evenodd",children:[s.jsx("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),s.jsx("path",{fill:"#7DA4FF",d:"M7 34h4v8H7zM12 31h4v11h-4zM17 27h4v15h-4zM22 22h4v20h-4zM27 27h4v15h-4zM32 29h4v13h-4zM37 31h4v11h-4z"})]})}))}function gr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function pr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?gr(Object(r),!0).forEach(function(n){sa(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):gr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function sa(t,e,r){return e=da(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function da(t){var e=ua(t,"string");return typeof e=="symbol"?e:String(e)}function ua(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ca(t){return s.jsx("svg",pr(pr({width:48,height:48,xmlns:"http://www.w3.org/2000/svg"},t),{},{children:s.jsxs("g",{fill:"none",fillRule:"evenodd",children:[s.jsx("path",{fill:"#C1C0C0",d:"M4 4h1v40H4zM44 43v1H5v-1z"}),s.jsx("path",{stroke:"#7DA4FF",d:"M7.984 32.44l7.982-11.378 5.273 3.739 9.952-10.838 2.826 1.894 7.45-5.802"}),s.jsx("path",{stroke:"#BECDEF",d:"M8.244 37.926L17 33.496l5 .87 10.637-10.35 10.615-1.381"})]})}))}function br(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Cr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?br(Object(r),!0).forEach(function(n){ha(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):br(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ha(t,e,r){return e=va(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function va(t){var e=ma(t,"string");return typeof e=="symbol"?e:String(e)}function ma(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function fa(t){return s.jsx("svg",Cr(Cr({width:48,height:48,xmlns:"http://www.w3.org/2000/svg"},t),{},{children:s.jsxs("g",{fill:"none",fillRule:"evenodd",children:[s.jsx("path",{d:"M24 10c7.732 0 14 6.268 14 14s-6.268 14-14 14-14-6.268-14-14h14V10z",fill:"#80A6FF"}),s.jsx("path",{d:"M10 24c0-7.732 6.268-14 14-14v14H10z",fill:"#C1C0C0"})]})}))}function Sr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function wr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Sr(Object(r),!0).forEach(function(n){ga(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Sr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ga(t,e,r){return e=pa(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function pa(t){var e=ba(t,"string");return typeof e=="symbol"?e:String(e)}function ba(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ca(t){return s.jsx("svg",wr(wr({width:48,height:48,xmlns:"http://www.w3.org/2000/svg"},t),{},{children:s.jsxs("g",{fill:"none",fillRule:"evenodd",children:[s.jsx("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),s.jsx("path",{fill:"#939293",d:"M44 34v1H4v-1zM44 25v1H4v-1zM44 16v1H4v-1z"}),s.jsx("circle",{fill:"#7DA4FF",cx:9.5,cy:37.5,r:1.5}),s.jsx("circle",{fill:"#7DA4FF",cx:16.5,cy:30.5,r:1.5}),s.jsx("circle",{fill:"#7DA4FF",cx:22.5,cy:36.5,r:1.5}),s.jsx("circle",{fill:"#7DA4FF",cx:28.5,cy:30.5,r:1.5}),s.jsx("circle",{fill:"#7DA4FF",cx:15.5,cy:38.5,r:1.5}),s.jsx("circle",{fill:"#7DA4FF",cx:23.5,cy:25.5,r:1.5}),s.jsx("circle",{fill:"#7DA4FF",cx:19.5,cy:19.5,r:1.5}),s.jsx("circle",{fill:"#7DA4FF",cx:29.5,cy:19.5,r:1.5}),s.jsx("circle",{fill:"#7DA4FF",cx:32.5,cy:26.5,r:1.5}),s.jsx("circle",{fill:"#7DA4FF",cx:36.5,cy:13.5,r:1.5})]})}))}function Or(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function yr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Or(Object(r),!0).forEach(function(n){Sa(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Or(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Sa(t,e,r){return e=wa(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wa(t){var e=Oa(t,"string");return typeof e=="symbol"?e:String(e)}function Oa(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Wo(t){return s.jsxs("svg",yr(yr({width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),{},{children:[s.jsx("rect",{width:"48",height:"48",fill:"none"}),s.jsx("rect",{x:"26",y:"10",width:"15",height:"4",fill:"#9FDE70"}),s.jsx("rect",{x:"26",y:"22",width:"15",height:"4",fill:"#9FDE70"}),s.jsx("rect",{x:"26",y:"28",width:"15",height:"4",fill:"#FFD95C"}),s.jsx("rect",{x:"26",y:"34",width:"15",height:"4",fill:"#9FDE70"})]}))}function xr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Ir(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?xr(Object(r),!0).forEach(function(n){ya(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):xr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ya(t,e,r){return e=xa(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function xa(t){var e=Ia(t,"string");return typeof e=="symbol"?e:String(e)}function Ia(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function zo(t){return s.jsxs("svg",Ir(Ir({width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),{},{children:[s.jsx("rect",{width:"48",height:"48",fill:"none"}),s.jsx("rect",{x:"4",y:"16",width:"40",height:"4",fill:"#FFD95C"}),s.jsx("rect",{x:"4",y:"10",width:"40",height:"4",fill:"#78DCE8"}),s.jsx("rect",{x:"4",y:"34",width:"40",height:"4",fill:"#78DCE8"})]}))}var jr=te.module("ChartBuilder");class J extends p.PureComponent{static getMaxSeriesCount(e,r){switch(r){case e.plot.SeriesPlotStyle.PIE:return 1;case e.plot.SeriesPlotStyle.HISTOGRAM:return 0;default:return 100}}static makeSeriesItem(e){return{id:we(),value:e}}static makeDefaultSeriesItems(e,r,n){var a=J.getMaxSeriesCount(e,r);if(a===0||n==null||n.length===0)return[];var i=n.length>1?n[1].name:n[0].name;return[J.makeSeriesItem(i)]}static getDefaultXAxis(e,r){return r!=null&&r.length>0?r[0].name:null}constructor(e){super(e),gt(this);var{model:r}=e,{columns:n,dh:a}=r,i=this.getTypes()[0],o=J.getDefaultXAxis(i,n),l=J.makeDefaultSeriesItems(a,i,n);this.state={type:i,seriesItems:l,xAxis:o,isLinked:!0}}getTypes(){var{model:e}=this.props,{dh:r}=e;return[r.plot.SeriesPlotStyle.LINE,r.plot.SeriesPlotStyle.BAR,r.plot.SeriesPlotStyle.SCATTER,r.plot.SeriesPlotStyle.PIE]}getTypeName(e){var{model:r}=this.props,{dh:n}=r;switch(e){case n.plot.SeriesPlotStyle.LINE:return"Line";case n.plot.SeriesPlotStyle.BAR:return"Bar";case n.plot.SeriesPlotStyle.SCATTER:return"Scatter";case n.plot.SeriesPlotStyle.PIE:return"Pie";case n.plot.SeriesPlotStyle.HISTOGRAM:return"Histogram";default:return e}}getTypeIcon(e){var{model:r}=this.props,{dh:n}=r;switch(e){case n.plot.SeriesPlotStyle.LINE:return s.jsx(ca,{});case n.plot.SeriesPlotStyle.BAR:return s.jsx(na,{});case n.plot.SeriesPlotStyle.SCATTER:return s.jsx(Ca,{});case n.plot.SeriesPlotStyle.PIE:return s.jsx(fa,{});case n.plot.SeriesPlotStyle.HISTOGRAM:return s.jsx(la,{});default:return null}}getXAxisLabel(e){var{model:r}=this.props,{dh:n}=r;switch(e){case n.plot.SeriesPlotStyle.PIE:return"Labels";case n.plot.SeriesPlotStyle.HISTOGRAM:return"Data";default:return"X-Axis"}}getSeriesLabel(e){var{model:r}=this.props,{dh:n}=r;switch(e){case n.plot.SeriesPlotStyle.PIE:return"Values";default:return"Series"}}handleAddSeries(){this.setState(e=>{var{seriesItems:r}=e,n=[...r],{model:a}=this.props,{columns:i}=a;return n.push({id:we(),value:i[0].name}),{seriesItems:n}},this.sendChange)}handleLinkStateChange(e){this.setState({isLinked:e==="true"},this.sendChange)}handleReset(){var{model:e}=this.props,{columns:r,dh:n}=e,a=this.getTypes()[0],i=J.getDefaultXAxis(a,r),o=J.makeDefaultSeriesItems(n,a,r),l=!0;this.setState({type:a,seriesItems:o,xAxis:i,isLinked:l},this.sendChange)}handleSeriesChange(e,r){var n=e;this.setState(a=>{var{seriesItems:i}=a;return i=[...i],i[r].value=n,{seriesItems:i}},this.sendChange)}handleSeriesDeleteClick(e){this.setState(r=>{var{seriesItems:n}=r,a=[...n];return a.splice(e,1),{seriesItems:a}},this.sendChange)}handleSubmit(e){e.preventDefault();var{onSubmit:r}=this.props,{type:n,seriesItems:a,xAxis:i,isLinked:o}=this.state,l=a.map(d=>d.value);r({type:n,series:l,xAxis:i,isLinked:o})}handleTypeClick(e){var r=this.getTypes()[e];jr.debug2("handleTypeSelect",r),this.setState(n=>{var{model:a}=this.props,{dh:i}=a,o=J.getMaxSeriesCount(i,r),{seriesItems:l}=n;if(l=l.slice(0,o),l.length===0&&o>0){var{columns:d}=a;l=J.makeDefaultSeriesItems(i,r,d)}return{type:r,seriesItems:l}},this.sendChange)}handleXAxisChange(e){var r=e;jr.debug2("x-axis change",r),this.setState({xAxis:r},this.sendChange)}sendChange(){var{onChange:e}=this.props,{isLinked:r,type:n,seriesItems:a,xAxis:i}=this.state,o=a.map(l=>l.value);e({type:n,series:o,xAxis:i,isLinked:r})}render(){var{model:e}=this.props,{columns:r,dh:n}=e,{seriesItems:a,type:i,xAxis:o,isLinked:l}=this.state,d=J.getMaxSeriesCount(n,i),u=this.getXAxisLabel(i),c=this.getSeriesLabel(i),h=a.length>0,m=a.length<d;return s.jsx("div",{className:"chart-builder",children:s.jsxs("form",{onSubmit:this.handleSubmit,children:[s.jsxs("div",{className:"form-row",children:[s.jsx("label",{children:"Select Chart Type"}),s.jsx("div",{className:"form-row",children:this.getTypes().map((f,v)=>{var g=f;return s.jsx("div",{className:"col col-chart-type",children:s.jsxs("button",{type:"button",className:U("btn","btn-icon","btn-chart-type",{active:f===i}),onClick:()=>this.handleTypeClick(v),children:[this.getTypeIcon(f),this.getTypeName(f)]})},g)})})]}),s.jsx("hr",{}),s.jsxs("div",{className:"form-row form-inline",children:[s.jsx("label",{className:"col-2 label-left",children:u}),s.jsx(Ee,{className:"form-control select-x-axis col",value:o,onChange:this.handleXAxisChange,children:r.map(f=>s.jsx("option",{value:f.name,children:f.name},f.name))})]}),h&&s.jsx("hr",{}),a.map((f,v)=>s.jsxs("div",{className:"form-row form-inline form-series-item","data-testid":"form-series-item-".concat(v),children:[s.jsx("label",{className:"col-2 label-left",children:v===0?c:""}),s.jsx(Ee,{className:"form-control select-series col",value:f.value,onChange:g=>this.handleSeriesChange(g,v),"data-testid":"select-series-item-".concat(v),children:r.map(g=>s.jsx("option",{value:g.name,children:g.name},g.name))}),a.length>1&&s.jsx(E,{kind:"ghost",className:"btn-delete-series ml-2 px-2","data-testid":"delete-series-".concat(v),onClick:()=>{this.handleSeriesDeleteClick(v)},icon:Oe,tooltip:"Delete"})]},f.id)),m&&s.jsxs("div",{className:"form-row",children:[s.jsx("div",{className:"col-2"}),s.jsx(E,{kind:"ghost",className:"btn-add-series mt-1",onClick:this.handleAddSeries,icon:qe,children:"Add Series"})]}),s.jsxs("div",{className:"form-row chart-builder-link",children:[s.jsx("label",{className:"col-2 label-right",children:s.jsxs("div",{className:"fa-md fa-layers",children:[s.jsx(W,{mask:Yt,icon:dt,transform:"right-5 down-5"}),s.jsx(W,{icon:l?Zt:Qt,transform:"grow-2 right-8 down-6"})]})}),s.jsxs(Ve,{"aria-label":"Link state options",orientation:"horizontal",onChange:this.handleLinkStateChange,value:"".concat(l),children:[s.jsx(he,{value:"true",children:"Sync State"}),s.jsx(he,{value:"false",children:"Freeze State"})]})]}),s.jsxs("div",{className:"form-row",children:[s.jsx("div",{className:"col-2 label-right"}),s.jsx("div",{className:"col chart-builder-link-info",children:l?"Charts with synced state will update to match any filters or user modifications applied to the parent table.":"Freeze State disconnects the chart state from the parent table. New filters or user modifications on the parent table will not be applied."})]}),s.jsxs("div",{className:U("form-row","justify-content-end","my-3"),children:[s.jsx(E,{kind:"secondary",className:"btn-reset",onClick:this.handleReset,children:"Reset"}),s.jsx(E,{kind:"primary",type:"submit",className:"btn-submit",children:"Create"})]})]})})}}const Vo=J;function Pr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function ja(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Pr(Object(r),!0).forEach(function(n){Re(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Pr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Re(t,e,r){return e=Pa(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Pa(t){var e=Da(t,"string");return typeof e=="symbol"?e:String(e)}function Da(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class St extends p.Component{constructor(e){super(e),Re(this,"editorContainer",void 0),Re(this,"editor",void 0),this.handleContentChanged=this.handleContentChanged.bind(this),this.handleEditorFocus=this.handleEditorFocus.bind(this),this.handleEditorBlur=this.handleEditorBlur.bind(this),this.handleContainerClick=this.handleContainerClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.state={isEditorFocused:!1,isEditorEmpty:!0},this.editorContainer=null}componentDidMount(){this.initEditor()}componentWillUnmount(){this.destroyEditor()}initEditor(){var e,{value:r,editorSettings:n}=this.props,a=ja({copyWithSyntaxHighlighting:"false",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"groovyDB",lineDecorationsWidth:8,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},scrollBeyondLastLine:!1,padding:{top:6,bottom:6},tabCompletion:"off",useTabStops:!0,value:r,wordWrap:"on",automaticLayout:!0,autoClosingBrackets:"beforeWhitespace"},n);if(!this.editorContainer)throw new Error("editorContainer is null");this.editor=Gn.create(this.editorContainer,a),this.editor.layout(),(e=this.editor.getModel())===null||e===void 0||e.updateOptions({tabSize:0}),this.editor.onKeyDown(this.handleKeyDown),this.editor.onDidChangeModelContent(this.handleContentChanged),this.editor.onDidFocusEditorText(this.handleEditorFocus),this.editor.onDidBlurEditorText(this.handleEditorBlur)}destroyEditor(){var e;(e=this.editor)===null||e===void 0||e.dispose(),this.editor=void 0}handleContentChanged(){var e,r,{onContentChanged:n}=this.props,a=(e=this.editor)===null||e===void 0||(r=e.getModel())===null||r===void 0?void 0:r.getValue();a!==void 0&&this.setState({isEditorEmpty:a.length===0}),n(a)}handleEditorFocus(){this.setState({isEditorFocused:!0})}handleEditorBlur(){var e,r,n,a=(e=(r=this.editor)===null||r===void 0||(n=r.getModel())===null||n===void 0?void 0:n.getValue())!==null&&e!==void 0?e:"";this.setState({isEditorEmpty:a.length===0,isEditorFocused:!1})}handleContainerClick(){var e,{isEditorFocused:r}=this.state;r||(e=this.editor)===null||e===void 0||e.focus()}handleKeyDown(e){var{onTab:r,editorIndex:n}=this.props;e.code==="Tab"&&(e.stopPropagation(),e.preventDefault(),r(n,e.shiftKey))}render(){var{className:e,invalid:r,placeholder:n="",value:a}=this.props,{isEditorFocused:i,isEditorEmpty:o}=this.state;return s.jsxs("div",{className:U("input-editor-wrapper",{focused:i,invalid:r},e),role:"presentation",onClick:this.handleContainerClick,children:[s.jsx("div",{className:"editor-container",ref:l=>{this.editorContainer=l},"data-testid":"custom-column-formula"}),o&&!a&&n.length>0&&s.jsx("div",{className:"editor-placeholder text-muted",children:n})]})}}Re(St,"defaultProps",{value:"",onContentChanged:()=>{},editorSettings:{},editorIndex:0,onTab:()=>{},invalid:!1});function Dr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function ye(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Dr(Object(r),!0).forEach(function(n){Ta(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Dr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Ta(t,e,r){return e=Na(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Na(t){var e=Ea(t,"string");return typeof e=="symbol"?e:String(e)}function Ea(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Tr=Object.freeze({NAME:"name",FORMULA:"formula"}),Ra=()=>{};function Aa(t){var{eventKey:e,name:r,inputIndex:n,formula:a,onChange:i,onDeleteColumn:o,onTabInEditor:l,invalid:d,isDuplicate:u}=t,c=r===""||Ze.isValidColumnName(r),h=p.useCallback(m=>{m!==void 0&&(m.replace(/(\r\n|\n|\r)/gm,""),i(e,Tr.FORMULA,m))},[i,e]);return s.jsx(Rt,{draggableId:e,index:n,disableInteractiveElementBlocking:!0,children:(m,f)=>s.jsxs("div",ye(ye({className:U("draggable-container",{dragging:f.isDragging}),ref:m.innerRef},m.draggableProps),{},{children:[s.jsxs("div",{className:"custom-column-input-container",children:[s.jsxs("div",{className:"pb-3",children:[s.jsxs("div",{className:"d-flex flex-row custom-column-name",children:[s.jsx("input",{className:U("form-control custom-column-input",{"is-invalid":d||!c||u}),placeholder:"Column Name",value:r,onChange:v=>{i(e,Tr.NAME,v.target.value)}}),s.jsx(E,{kind:"ghost",className:"ml-1 px-2",onClick:()=>{o(e)},icon:Oe,tooltip:"Delete custom column"}),s.jsx(E,ye(ye({kind:"ghost",className:"btn-drag-handle",onClick:Ra},m.dragHandleProps),{},{icon:ut,tooltip:"Drag column to re-order"}))]}),(!c||u)&&s.jsx("p",{className:"validate-label-error text-danger mb-0 mt-2 pl-1",children:c?"Duplicate name":"Invalid name"})]}),s.jsx(St,{editorSettings:{language:"deephavenDb"},editorIndex:n,placeholder:"Column Formula",value:a,onContentChanged:h,onTab:l,invalid:d})]}),s.jsx("hr",{})]}))})}function Nr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Fe(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Nr(Object(r),!0).forEach(function(n){be(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Nr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function be(t,e,r){return e=Ma(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ma(t){var e=ka(t,"string");return typeof e=="symbol"?e:String(e)}function ka(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class de extends p.Component{static makeCustomColumnInputEventKey(){return we()}static createCustomColumnInput(){return{eventKey:we(),name:"",formula:""}}constructor(e){super(e),be(this,"container",void 0),be(this,"successButtonTimer",void 0),be(this,"getInput",er((r,n)=>r.find(a=>a.eventKey===n))),be(this,"getInputIndex",er((r,n)=>r.findIndex(a=>a.eventKey===n))),this.handleAddColumnClick=this.handleAddColumnClick.bind(this),this.handleSaveClick=this.handleSaveClick.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleDeleteColumn=this.handleDeleteColumn.bind(this),this.handleCustomColumnUpdated=this.handleCustomColumnUpdated.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.resetRequestFailed=this.resetRequestFailed.bind(this),this.handleEditorTabNavigation=this.handleEditorTabNavigation.bind(this),this.state={inputs:[],isCustomColumnApplying:!1,errorMessage:null,hasRequestFailed:!1,isSuccessShowing:!1},this.container=null,this.successButtonTimer=null}componentDidMount(){var{customColumns:e}=this.props;this.parseCustomColumns(e),this.startListening()}componentWillUnmount(){this.stopListening(),this.successButtonTimer&&clearTimeout(this.successButtonTimer)}resetErrorMessage(){this.setState({errorMessage:null})}startListening(){var{model:e}=this.props;e.addEventListener(fe.EVENT.COLUMNS_CHANGED,this.handleCustomColumnUpdated),e.addEventListener(fe.EVENT.UPDATED,this.handleCustomColumnUpdated),e.addEventListener(fe.EVENT.REQUEST_FAILED,this.handleRequestFailed)}stopListening(){var{model:e}=this.props;e.removeEventListener(fe.EVENT.COLUMNS_CHANGED,this.handleCustomColumnUpdated),e.removeEventListener(fe.EVENT.UPDATED,this.handleCustomColumnUpdated),e.removeEventListener(fe.EVENT.REQUEST_FAILED,this.handleRequestFailed)}parseCustomColumns(e){if(e.length>0){var r=e.map(n=>{var a=n.split(/=(.+)/,2);return{eventKey:de.makeCustomColumnInputEventKey(),name:a[0],formula:a[1]}});this.setState({inputs:r})}else this.setState({inputs:[de.createCustomColumnInput()]})}handleAddColumnClick(){var{inputs:e}=this.state,r=[...e];r.push(de.createCustomColumnInput()),this.setState({inputs:r})}handleDeleteColumn(e){var{inputs:r}=this.state,n=this.getInputIndex(r,e),a=[...r];a.splice(n,1),a.length===0&&a.push(de.createCustomColumnInput()),this.setState({inputs:a})}handleInputChange(e,r,n){var{inputs:a}=this.state,i=this.getInputIndex(a,e),o=this.getInput(a,e),l=Fe({},o);l[r]=n;var d=[...a];d.splice(i,1,l),this.setState({inputs:d})}handleCustomColumnUpdated(){var{isCustomColumnApplying:e}=this.state;e&&this.setState({isCustomColumnApplying:!1,isSuccessShowing:!0},()=>{this.successButtonTimer=setTimeout(()=>this.setState({isSuccessShowing:!1}),de.SUCCESS_SHOW_DURATION)})}handleRequestFailed(e){var r=e,{isCustomColumnApplying:n}=this.state;n&&this.setState({isCustomColumnApplying:!1,errorMessage:s.jsxs(s.Fragment,{children:[s.jsxs("p",{children:[s.jsx(W,{icon:Ne})," Failed to apply custom columns."]}),s.jsxs("div",{className:"error-box",children:[r.detail.errorMessage,s.jsx("br",{}),"Table configuration:"," ",JSON.stringify(r.detail.configuration)]})]}),hasRequestFailed:!0})}handleDragEnd(e){if(ae.stopDragging(),!!e.destination){var{inputs:r}=this.state,n=e.source.index,a=e.destination.index,i=[...r],o=r[n];i.splice(n,1),i.splice(a,0,o),this.setState({inputs:i})}}handleEditorTabNavigation(e,r){var{inputs:n}=this.state;if(r){var a;((a=this.container)===null||a===void 0?void 0:a.querySelectorAll(".btn-drag-handle")[e]).focus();return}if(e===n.length-1){var i,o;(i=this.container)===null||i===void 0||(o=i.querySelector(".btn-add-column"))===null||o===void 0||o.focus()}else{var l,d=e+1;((l=this.container)===null||l===void 0?void 0:l.querySelectorAll(".custom-column-input")[d]).focus()}}handleSaveClick(){var{onSave:e,customColumns:r}=this.props,{inputs:n,isCustomColumnApplying:a}=this.state;if(!a){var i=[];n.forEach(o=>{var{name:l,formula:d}=o;l&&d&&i.push("".concat(l,"=").concat(d))}),this.resetErrorMessage(),this.setState({isCustomColumnApplying:i.length>0||r.length>0}),e(i)}}resetRequestFailed(){this.setState(e=>{var{hasRequestFailed:r}=e;return r?{hasRequestFailed:!1}:null})}renderInputs(){var{inputs:e,hasRequestFailed:r}=this.state,n=new Map;return e.forEach(a=>{var i,{name:o}=a;return n.set(o,((i=n.get(o))!==null&&i!==void 0?i:0)+1)}),e.map((a,i)=>{var o,{eventKey:l,name:d,formula:u}=a,c=((o=n.get(d))!==null&&o!==void 0?o:0)>1;return s.jsx(Aa,{inputIndex:i,eventKey:l,name:d,formula:u,onChange:this.handleInputChange,onDeleteColumn:this.handleDeleteColumn,onTabInEditor:this.handleEditorTabNavigation,invalid:r,isDuplicate:c},l)})}renderSaveButton(){var{inputs:e,isCustomColumnApplying:r,isSuccessShowing:n}=this.state,a=e.length>1?"Save Columns":"Save Column",i=e.every(d=>{var{name:u}=d;return u===""||Ze.isValidColumnName(u)}),o=e.filter(d=>{var{name:u}=d;return u!==""}).map(d=>{var{name:u}=d;return u}),l=new Set(o).size===o.length;return s.jsxs(E,{kind:n?"success":"primary",className:U("btn-apply",{"btn-spinner":r}),disabled:n||r||!i||!l,onClick:this.handleSaveClick,icon:n?Jt:void 0,children:[r&&s.jsxs("span",{children:[s.jsx(ct,{className:"mr-2 loading-spinner-vertical-align"}),s.jsx("span",{className:"btn-normal-content",children:"Applying"})]}),!n&&!r&&a,n&&"Success"]})}render(){var{onCancel:e}=this.props,{errorMessage:r}=this.state;return s.jsxs("div",{role:"presentation",className:"custom-column-builder-container",ref:n=>{this.container=n},onClick:this.resetRequestFailed,onFocus:this.resetRequestFailed,children:[s.jsx("hr",{}),s.jsx(Ke,{onDragStart:ae.startDragging,onDragEnd:this.handleDragEnd,children:s.jsx(ot,{droppableId:"droppable-custom-columns",children:(n,a)=>s.jsxs("div",Fe(Fe({ref:n.innerRef},n.droppableProps),{},{className:U("droppable-container",{dragging:a.draggingFromThisWith}),children:[this.renderInputs(),n.placeholder]}))})}),s.jsx("div",{className:"pt-1 px-3",children:s.jsx(E,{kind:"ghost",className:"btn-add-column",onClick:this.handleAddColumnClick,icon:qe,children:"Add Another Column"})}),s.jsxs("div",{className:"custom-column-builder-footer",children:[r&&s.jsx("div",{className:"error-message",children:r}),s.jsxs("div",{className:"d-flex justify-content-end",children:[s.jsx(E,{kind:"secondary",className:"mr-2",onClick:e,children:"Cancel"}),this.renderSaveButton()]})]})]})}}be(de,"SUCCESS_SHOW_DURATION",750);const Ko=de;var Ue;(function(t){t.ADVANCED_SETTINGS="ADVANCED_SETTINGS",t.AGGREGATIONS="AGGREGATIONS",t.AGGREGATION_EDIT="AGGREGATIONS_EDIT",t.CHART_BUILDER="CHART_BUILDER",t.CUSTOM_COLUMN_BUILDER="CUSTOM_COLUMN_BUILDER",t.QUICK_FILTERS="QUICK_FILTERS",t.ROLLUP_ROWS="ROLLUP_ROWS",t.SEARCH_BAR="SEARCH_BAR",t.SELECT_DISTINCT="SELECT_DISTINCT",t.TABLE_EXPORTER="TABLE_EXPORTER",t.VISIBILITY_ORDERING_BUILDER="VISIBILITY_ORDERING_BUILDER",t.CONDITIONAL_FORMATTING="CONDITIONAL_FORMATTING",t.CONDITIONAL_FORMATTING_EDIT="CONDITIONAL_FORMATTING_EDIT",t.GOTO="GOTO"})(Ue||(Ue={}));const qo=Ue;function Er(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Rr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Er(Object(r),!0).forEach(function(n){ue(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Er(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ue(t,e,r){return e=Fa(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Fa(t){var e=_a(t,"string");return typeof e=="symbol"?e:String(e)}function _a(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Ce=te.module("RollupRows"),La=150,xe="grouped-rollup-rows",Ie="ungrouped-rollup-rows";class V extends p.Component{static renderColumn(e){var{item:r,isClone:n,selectedCount:a}=e,i=r?.name,o=n!==void 0&&n?"".concat(a):void 0,l=n!==void 0&&n?"item-list-item-clone":"";return ee.renderTextItem({text:i,badgeText:o,className:l})}static addGroupings(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length;if(r==null||r.length===0)return e;var a=n,i=e.filter((o,l)=>r.includes(o)?(l<a&&(a-=1),!1):!0);return i.splice(a,0,...r),i}static isGroupable(e){return!z.isDecimalType(e.type)}constructor(e){super(e),ue(this,"ungroupedList",void 0),ue(this,"groupedList",void 0),ue(this,"search",lt(o=>{for(var l=this.getSortedUngroupedColumns(),d=[],u=null,c=0;c<l.length;c+=1){var h=l[c];h.name.toLowerCase().includes(o.toLowerCase())&&(u==null&&(u=c),d.push([c,c]))}k(u),this.setState({ungroupedSelectedRanges:d}),d.length>0&&this.ungroupedList.current&&this.ungroupedList.current.scrollToItem(u)},La)),ue(this,"getCachedUngroupedColumns",le((o,l)=>o.filter(d=>V.isGroupable(d)&&l.find(u=>u===d.name)==null))),ue(this,"getCachedSortedColumns",le((o,l)=>l==null?[...o]:z.sortColumns(o,l===V.SORT.ASCENDING))),this.handleDeleteClicked=this.handleDeleteClicked.bind(this),this.handleSearchChange=this.handleSearchChange.bind(this),this.handleUngroupedSelect=this.handleUngroupedSelect.bind(this),this.handleUngroupedSelectionChange=this.handleUngroupedSelectionChange.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleGroupedSelectionChange=this.handleGroupedSelectionChange.bind(this),this.handleShowConstituentsChange=this.handleShowConstituentsChange.bind(this),this.handleShowNonAggregatedColumnsChange=this.handleShowNonAggregatedColumnsChange.bind(this),this.handleSortAscending=this.handleSortAscending.bind(this),this.handleSortDescending=this.handleSortDescending.bind(this),this.renderGroupedItem=this.renderGroupedItem.bind(this),this.ungroupedList=rr.createRef(),this.groupedList=rr.createRef();var{config:r}=e,{columns:n=[],showConstituents:a=!0,showNonAggregatedColumns:i=!0}=r??{};this.state={ungroupedSelectedRanges:[],columns:n,groupedSelectedRanges:[],searchFilter:"",showConstituents:a,showNonAggregatedColumns:i,dragSource:null,sort:null}}componentDidUpdate(e,r){var{config:n}=this.props,{columns:a,showConstituents:i,showNonAggregatedColumns:o}=this.state;n!==e.config?this.updateFromConfig():(a!==r.columns||i!==r.showConstituents||o!==r.showNonAggregatedColumns)&&(n==null||a!==n.columns||i!==n.showConstituents||o!==n.showNonAggregatedColumns)&&this.sendChange()}componentWillUnmount(){this.search.cancel()}handleSearchChange(e){var r=e.target.value;if(this.setState({searchFilter:r}),!r){this.search.cancel(),this.resetSelection();return}this.search(r)}handleSortAscending(){this.setState(e=>{var{sort:r}=e;return{sort:r===V.SORT.ASCENDING?null:V.SORT.ASCENDING}})}handleSortDescending(){this.setState(e=>{var{sort:r}=e;return{sort:r===V.SORT.DESCENDING?null:V.SORT.DESCENDING}})}resetSelection(){this.setState({ungroupedSelectedRanges:[],groupedSelectedRanges:[]})}handleDragStart(e){Ce.debug("handleDragStart",e),document.documentElement.classList.add("drag-pointer-events-none"),this.setState({dragSource:e.source})}handleDragEnd(e){Ce.debug("handleDragEnd",e),document.documentElement.classList.remove("drag-pointer-events-none"),this.setState({dragSource:null});var{destination:r,source:n}=e;if(!(r==null||n==null)){if(r.droppableId===Ie){this.setState(o=>{var{groupedSelectedRanges:l,columns:d}=o,u=[...d];return ae.reorder(u,l,[],0),{columns:u,ungroupedSelectedRanges:[],groupedSelectedRanges:[]}});return}var a=n.droppableId===xe,i=r.index;a&&n.index<r.index&&(i+=1),this.setState(o=>{var{columns:l,ungroupedSelectedRanges:d,groupedSelectedRanges:u}=o,c=[...l],h=a?c:this.getSortedUngroupedColumns().map(C=>C.name),m=a?u:d,f=ae.reorder(h,m,c,i),v=a?ae.adjustDestinationIndex(i,u):i,g=[[v,v+f.length-1]];return{columns:c,ungroupedSelectedRanges:[],groupedSelectedRanges:g}}),this.resetSelection()}}handleUngroupedSelect(e){Ce.debug("handleUngroupedSelect"),this.setState(r=>{var{columns:n}=r;return{columns:V.addGroupings(n,[this.getSortedUngroupedColumns()[e].name]),ungroupedSelectedRanges:[],groupedSelectedRanges:[]}})}handleUngroupedSelectionChange(e){Ce.debug2("handleUngroupedSelectionChange",e),this.setState(r=>{var{ungroupedSelectedRanges:n}=r;return e===n?null:{ungroupedSelectedRanges:e,groupedSelectedRanges:[]}})}handleGroupedSelectionChange(e){Ce.debug2("handleGroupedSelectedRanges",e),this.setState(r=>{var{groupedSelectedRanges:n}=r;return e===n?null:{groupedSelectedRanges:e,ungroupedSelectedRanges:[]}})}handleDeleteClicked(e){this.setState(r=>{var{columns:n}=r,a=n.slice();return a.splice(e,1),{columns:a}})}handleShowConstituentsChange(){this.setState(e=>{var{showConstituents:r}=e;return{showConstituents:!r}})}handleShowNonAggregatedColumnsChange(){this.setState(e=>{var{showNonAggregatedColumns:r}=e;return{showNonAggregatedColumns:!r}})}updateFromConfig(){var{config:e}=this.props,{columns:r=[],showConstituents:n=!0,showNonAggregatedColumns:a=!0}=e??{};this.setState({columns:r,showConstituents:n,showNonAggregatedColumns:a})}sendChange(){var{onChange:e}=this.props,{columns:r,showConstituents:n,showNonAggregatedColumns:a}=this.state;e({columns:r,showConstituents:n,showNonAggregatedColumns:a})}getUngroupedColumns(){var{model:e}=this.props,{columns:r}=this.state,{originalColumns:n}=e;return this.getCachedUngroupedColumns(n,r)}getSortedUngroupedColumns(){var{sort:e}=this.state,r=this.getUngroupedColumns();return this.getCachedSortedColumns(r,e)}renderGroupedItem(e){var{item:r,itemIndex:n,isClone:a,selectedCount:i}=e,o=a!==void 0&&a?"":" ".repeat(n),l="".concat(o).concat(r),d=a!==void 0&&a?"".concat(i):void 0,u=a!==void 0&&a?"item-list-item-clone":"";return s.jsxs(s.Fragment,{children:[ee.renderTextItem({text:l,badgeText:d,className:u}),(a===void 0||!a)&&s.jsx(E,{kind:"ghost",className:"btn btn-link btn-link-icon btn-delete-grouping float-right",onClick:()=>this.handleDeleteClicked(n),children:s.jsx(W,{icon:Oe})})]})}render(){var{columns:e,dragSource:r,searchFilter:n,groupedSelectedRanges:a,ungroupedSelectedRanges:i,showConstituents:o,showNonAggregatedColumns:l,sort:d}=this.state,u=this.getSortedUngroupedColumns(),c=e.length*ee.DEFAULT_ROW_HEIGHT;r?.droppableId===Ie&&(c+=ee.DEFAULT_ROW_HEIGHT);var h=u.length*ee.DEFAULT_ROW_HEIGHT+10,m=Math.min(3*ee.DEFAULT_ROW_HEIGHT,h);return s.jsx("div",{role:"menu",className:U("rollup-rows",{"is-dragging":r!=null}),tabIndex:0,children:s.jsxs(Ke,{onDragEnd:this.handleDragEnd,onDragStart:this.handleDragStart,children:[s.jsxs("div",{className:"rollup-rows-group-by",children:[s.jsx("div",{className:"section-title",children:"Group By"}),e.length===0&&s.jsx(ot,{droppableId:"placeholder",children:(f,v)=>s.jsx("div",Rr(Rr({className:U("placeholder","text-muted",{"is-dragging-from-this":v.draggingFromThisWith,"is-dragging-over":v.isDraggingOver,"is-dropping":v.draggingOverWith}),ref:f.innerRef},f.droppableProps),{},{children:"To create a rollup, drag columns from the list below and drop them into this area."}))}),e.length>0&&s.jsx(ee,{draggingItemClassName:"rollup-rows-dragging-grouped-item",draggablePrefix:xe,droppableId:xe,itemCount:e.length,items:e,offset:0,onSelectionChange:this.handleGroupedSelectionChange,ref:this.groupedList,renderItem:this.renderGroupedItem,selectedRanges:a,style:{height:c},isMultiSelect:!0})]}),s.jsxs("div",{className:"rollup-rows-available-columns",children:[s.jsx("div",{className:"section-title",children:"Available Grouping Columns"}),s.jsxs("div",{className:"top-menu",children:[s.jsx(pt,{className:"w-100",value:n,matchCount:n?i.length:void 0,placeholder:"Find column...",onChange:this.handleSearchChange}),s.jsxs(E,{kind:"ghost",className:U("btn-link btn-link-icon",{active:d===V.SORT.ASCENDING}),onClick:this.handleSortAscending,children:[s.jsx(W,{icon:Xe}),s.jsx(Ge,{children:"Sort ascending"})]}),s.jsxs(E,{kind:"ghost",className:U("btn-link btn-link-icon",{active:d===V.SORT.DESCENDING}),onClick:this.handleSortDescending,children:[s.jsx(W,{icon:Ye}),s.jsx(Ge,{children:"Sort descending"})]})]}),s.jsx(ee,{className:"rollup-available-grouping-columns",draggablePrefix:Ie,droppableId:Ie,itemCount:u.length,items:u,renderItem:V.renderColumn,offset:0,onSelect:this.handleUngroupedSelect,onSelectionChange:this.handleUngroupedSelectionChange,ref:this.ungroupedList,selectedRanges:i,style:{maxHeight:h,minHeight:m},isDropDisabled:r?.droppableId!==xe,isMultiSelect:!0}),s.jsxs("div",{className:"bottom-menu",children:[s.jsx("div",{className:"label",children:"Show:"}),s.jsx(ve,{checked:o,onChange:this.handleShowConstituentsChange,children:"Constituents"}),s.jsx(ve,{checked:l,onChange:this.handleShowNonAggregatedColumnsChange,children:"Non-Aggregated Columns"})]})]})]})})}}ue(V,"SORT",Object.freeze({ASCENDING:"ASC",DESCENDING:"DESC"}));ue(V,"defaultProps",{config:null,onChange:()=>{}});const Xo=V;function Ar(t,e,r,n,a,i,o){try{var l=t[i](o),d=l.value}catch(u){r(u);return}l.done?e(d):Promise.resolve(d).then(n,a)}function Ha(t){return function(){var e=this,r=arguments;return new Promise(function(n,a){var i=t.apply(e,r);function o(d){Ar(i,n,a,o,l,"next",d)}function l(d){Ar(i,n,a,o,l,"throw",d)}o(void 0)})}}function Mr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function kr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Mr(Object(r),!0).forEach(function(n){me(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Mr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function me(t,e,r){return e=$a(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function $a(t){var e=Ga(t,"string");return typeof e=="symbol"?e:String(e)}function Ga(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Ua=te.module("TableCsvExporter");class N extends p.Component{static getDateString(e){return e.i18n.DateTimeFormat.format(N.FILENAME_DATE_FORMAT,new Date)}constructor(e){super(e),this.handleDownloadClick=this.handleDownloadClick.bind(this),this.handleDownloadRowOptionChanged=this.handleDownloadRowOptionChanged.bind(this),this.handleCustomizedDownloadRowOptionChanged=this.handleCustomizedDownloadRowOptionChanged.bind(this),this.handleCustomizedDownloadRowsChanged=this.handleCustomizedDownloadRowsChanged.bind(this),this.handleIncludeColumnHeadersChanged=this.handleIncludeColumnHeadersChanged.bind(this),this.handleIncludeHiddenColumnsChanged=this.handleIncludeHiddenColumnsChanged.bind(this),this.handleUseUnformattedValuesChanged=this.handleUseUnformattedValuesChanged.bind(this);var{model:r,name:n}=e;this.state={fileName:"".concat(n,"-").concat(N.getDateString(r.dh),".csv"),downloadRowOption:N.DOWNLOAD_ROW_OPTIONS.ALL_ROWS,customizedDownloadRowOption:N.CUSTOMIZED_ROWS_OPTIONS.FIRST,customizedDownloadRows:N.DEFAULT_DOWNLOAD_ROWS,includeColumnHeaders:!0,includeHiddenColumns:!1,useUnformattedValues:!1,errorMessage:null,id:we()}}getSnapshotRanges(){var{model:e,selectedRanges:r}=this.props,{downloadRowOption:n,customizedDownloadRowOption:a,customizedDownloadRows:i}=this.state,{rowCount:o,columnCount:l}=e,d=[];switch(n){case N.DOWNLOAD_ROW_OPTIONS.ALL_ROWS:d.push(new ge(0,0,l-1,o-1));break;case N.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS:d=r.map(u=>kr(kr({},u),{},{startColumn:0,endColumn:l-1})).sort((u,c)=>u.startRow!=null&&c.startRow!=null?u.startRow-c.startRow:0);break;case N.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS:switch(a){case N.CUSTOMIZED_ROWS_OPTIONS.FIRST:d.push(new ge(0,0,l-1,Math.min(i-1,o-1)));break;case N.CUSTOMIZED_ROWS_OPTIONS.LAST:d.push(new ge(0,Math.max(0,o-i),l-1,o-1));break}break}return d}getModelRanges(e){var{userColumnWidths:r,movedColumns:n}=this.props,{includeHiddenColumns:a}=this.state,i=mt.getHiddenColumns(r),o=M.getModelRanges(e,n);if(!a&&i.length>0){var l=i.map(ge.makeColumn);o=ge.subtractRangesFromRanges(o,l)}return o}resetDownloadState(){this.setState({errorMessage:null})}handleDownloadClick(){var e=this;return Ha(function*(){var{model:r,isDownloading:n,onDownloadStart:a,onDownload:i,onCancel:o}=e.props,{fileName:l,includeColumnHeaders:d,useUnformattedValues:u}=e.state;if(n){o();return}e.resetDownloadState();var c=e.getSnapshotRanges(),h=e.getModelRanges(c);if(e.validateOptionInput()){a();try{var m=yield r.export(),f=m.setViewport(0,0);yield f.getViewportData(),i(l,m,f,c,h,d,u)}catch(v){Ua.error("CSV download failed",v),e.setState({errorMessage:s.jsxs("p",{children:[s.jsx(W,{icon:Ne})," ","".concat(v)]})}),o()}}})()}handleDownloadRowOptionChanged(e){this.setState({downloadRowOption:e})}handleCustomizedDownloadRowOptionChanged(e){this.setState({customizedDownloadRowOption:e})}handleCustomizedDownloadRowsChanged(e){this.setState({customizedDownloadRows:parseInt(e.target.value,10)})}handleIncludeColumnHeadersChanged(){this.setState(e=>{var{includeColumnHeaders:r}=e;return{includeColumnHeaders:!r}})}handleIncludeHiddenColumnsChanged(){this.setState(e=>{var{includeHiddenColumns:r}=e;return{includeHiddenColumns:!r}})}handleUseUnformattedValuesChanged(){this.setState(e=>{var{useUnformattedValues:r}=e;return{useUnformattedValues:!r}})}validateOptionInput(){var{selectedRanges:e}=this.props,{downloadRowOption:r,customizedDownloadRows:n}=this.state;return r===N.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS&&e.length===0?(this.setState({errorMessage:s.jsxs("p",{children:[s.jsx(W,{icon:Ne})," No rows selected. Please select some rows in the table."]})}),!1):r===N.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS&&n<=0?(this.setState({errorMessage:s.jsxs("p",{children:[s.jsx(W,{icon:Ne})," Number of rows to output must be greater than 0"]})}),!1):!0}render(){var{model:e,isDownloading:r,tableDownloadProgress:n,tableDownloadEstimatedTime:a,selectedRanges:i,tableDownloadStatus:o}=this.props,{fileName:l,downloadRowOption:d,customizedDownloadRowOption:u,customizedDownloadRows:c,includeColumnHeaders:h,includeHiddenColumns:m,useUnformattedValues:f,errorMessage:v,id:g}=this.state,{rowCount:C}=e;return s.jsxs("div",{className:"table-csv-exporter",children:[s.jsx("div",{id:"download-rows-label",className:"section-title",children:"Download Rows"}),s.jsx("div",{className:"form-group",children:s.jsxs(Ve,{"aria-labelledby":"download-rows-label",onChange:this.handleDownloadRowOptionChanged,value:d,isDisabled:r,children:[s.jsxs(he,{value:N.DOWNLOAD_ROW_OPTIONS.ALL_ROWS,"data-testid":"radio-csv-exporter-download-all",children:["All Rows",s.jsx("span",{className:"text-muted ml-2",children:"(".concat(C.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")," rows)")})]}),s.jsxs(he,{value:N.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS,"data-testid":"radio-csv-exporter-only-selected",children:["Only Selected Rows",s.jsx("span",{className:"text-muted ml-2",children:i.length>0?"(".concat(ge.rowCount(i).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")," rows)"):null})]}),s.jsx(he,{value:N.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS,"data-testid":"radio-csv-exporter-customized-rows",children:s.jsxs("div",{className:"radio-input-row",role:"presentation",onClick:()=>{this.setState({downloadRowOption:N.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS})},children:[s.jsxs(Ee,{value:u,"data-testid":"select-csv-exporter-customized-rows",className:"custom-select",disabled:r,onChange:this.handleCustomizedDownloadRowOptionChanged,children:[s.jsx("option",{value:"FIRST",children:"First"}),s.jsx("option",{value:"LAST",children:"Last"})]}),s.jsx("input",{type:"number",className:"form-control",id:"customizedRows-".concat(g),"data-testid":"input-csv-exporter-customized-rows",name:"customizedRows-".concat(g),placeholder:"100",value:c,disabled:r,onChange:this.handleCustomizedDownloadRowsChanged}),s.jsx("div",{children:"Rows"})]})})]})}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{htmlFor:"customizedRows-".concat(g),children:"File Name"}),s.jsx("input",{type:"text",className:"form-control",id:"filename-".concat(g),"data-testid":"input-csv-exporter-file-name",name:"filename-".concat(g),value:l,onChange:b=>{this.setState({fileName:b.target.value})},disabled:r})]}),s.jsxs("div",{className:"checkbox-options",children:[s.jsx(ve,{checked:h,onChange:this.handleIncludeColumnHeadersChanged,children:"Include column headers"}),s.jsx(ve,{checked:m,onChange:this.handleIncludeHiddenColumnsChanged,children:"Include hidden columns"}),s.jsx(ve,{checked:f,onChange:this.handleUseUnformattedValuesChanged,children:"Use unformatted values"})]}),s.jsxs("div",{className:"section-footer flex-column",children:[v!=null&&s.jsx("div",{className:"error-message",children:v}),o&&s.jsxs("div",{className:"download-status",children:[(o===N.DOWNLOAD_STATUS.DOWNLOADING||o===N.DOWNLOAD_STATUS.INITIATING)&&s.jsxs(s.Fragment,{children:[o===N.DOWNLOAD_STATUS.INITIATING&&s.jsx("div",{className:"text-muted",children:"Starting Download..."}),o===N.DOWNLOAD_STATUS.DOWNLOADING&&s.jsxs("div",{className:"text-muted d-flex justify-content-between",children:[s.jsx("span",{children:a||a===0?"Estimated time: ".concat(En.formatElapsedTime(a)):null}),s.jsx("span",{children:"".concat(n,"%")})]})]}),o===N.DOWNLOAD_STATUS.FINISHED&&s.jsx("div",{className:"text-muted text-right",children:"Download Completed"}),o===N.DOWNLOAD_STATUS.CANCELED&&s.jsx("div",{className:"text-muted",children:"Download Canceled"}),(o===N.DOWNLOAD_STATUS.DOWNLOADING||o===N.DOWNLOAD_STATUS.INITIATING)&&s.jsx("div",{className:"progress",children:s.jsx("div",{className:"progress-bar progress-bar-striped progress-bar-animated",style:{width:"".concat(n,"%")}})}),o===N.DOWNLOAD_STATUS.FINISHED&&s.jsx("div",{className:"progress",children:s.jsx("div",{className:"progress-bar bg-success",style:{width:"".concat(n,"%")}})})]}),s.jsxs(E,{kind:"primary","data-testid":"btn-csv-exporter-download",className:U("btn-downloading",{"btn-spinner btn-cancelable":r}),onClick:this.handleDownloadClick,children:[r&&s.jsxs("span",{children:[s.jsx(ct,{className:"mr-2 loading-spinner-vertical-align"}),s.jsx("span",{className:"btn-normal-content",children:"Downloading"}),s.jsx("span",{className:"btn-hover-content",children:"Cancel"})]}),!r&&"Download"]})]})]})}}me(N,"FILENAME_DATE_FORMAT","yyyy-MM-dd-HHmmss");me(N,"DOWNLOAD_STATUS",{INITIATING:"INITIATING",DOWNLOADING:"DOWNLOADING",FINISHED:"FINISHED",CANCELED:"CANCELED"});me(N,"DOWNLOAD_ROW_OPTIONS",{ALL_ROWS:"ALL_ROWS",SELECTED_ROWS:"SELECTED_ROWS",CUSTOMIZED_ROWS:"CUSTOMIZED_ROWS"});me(N,"CUSTOMIZED_ROWS_OPTIONS",{FIRST:"FIRST",LAST:"LAST"});me(N,"DEFAULT_DOWNLOAD_ROWS",100);me(N,"defaultProps",{onDownloadStart:()=>{},isDownloading:!1,tableDownloadStatus:"",tableDownloadProgress:0,tableDownloadEstimatedTime:null,selectedRanges:[]});const Yo=N;function A(t,e,r){return e=Ba(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ba(t){var e=Wa(t,"string");return typeof e=="symbol"?e:String(e)}function Wa(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ne=te.module("TableSaver"),za="yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS z";function Va(t){return t.added!==void 0}function Ka(t){if(!Va(t))throw new Error("event is not UpdateEventData")}class X extends p.PureComponent{static csvEscapeString(e){return'"'.concat(e.replace(/"/g,'""'),'"')}constructor(e){super(e),A(this,"sw",void 0),A(this,"port",void 0),A(this,"fileWriter",void 0),A(this,"table",void 0),A(this,"tableSubscription",void 0),A(this,"columns",void 0),A(this,"fileName",void 0),A(this,"includeColumnHeaders",void 0),A(this,"useUnformattedValues",void 0),A(this,"chunkRows",void 0),A(this,"gridRanges",void 0),A(this,"gridRangeCounter",void 0),A(this,"rangedSnapshotsTotal",void 0),A(this,"rangedSnapshotCounter",void 0),A(this,"snapshotsTotal",void 0),A(this,"snapshotCounter",void 0),A(this,"snapshotsBuffer",void 0),A(this,"currentSnapshotIndex",void 0),A(this,"snapshotPending",void 0),A(this,"cancelableSnapshots",void 0),A(this,"streamTimeout",void 0),A(this,"snapshotHandlerTimeout",void 0),A(this,"downloadStartTime",void 0),A(this,"iframe",void 0),A(this,"useBlobFallback",void 0),A(this,"getCachedCustomColumnFormatFlag",Ct(Un.isCustomColumnFormatDefined,{max:1e4})),this.handlePortMessage=this.handlePortMessage.bind(this),this.handleSnapshotResolved=this.handleSnapshotResolved.bind(this),this.handleDownloadTimeout=this.handleDownloadTimeout.bind(this),this.state={},this.gridRanges=[],this.gridRangeCounter=0,this.rangedSnapshotsTotal=[],this.rangedSnapshotCounter=0,this.includeColumnHeaders=!0,this.useUnformattedValues=!1,this.snapshotsTotal=0,this.snapshotCounter=0,this.snapshotsBuffer=new Map,this.currentSnapshotIndex=0,this.snapshotPending=0,this.cancelableSnapshots=[],this.useBlobFallback=!1}componentDidMount(){var{getDownloadWorker:e}=this.props;e().then(r=>{ne.info("found active service worker"),this.sw=r,this.sw.postMessage("ping")}).catch(r=>{ne.warn("Download csv is not optimized.",r),this.useBlobFallback=!0})}componentWillUnmount(){this.removeIframe(),this.streamTimeout&&clearTimeout(this.streamTimeout),this.snapshotHandlerTimeout&&clearTimeout(this.snapshotHandlerTimeout)}createWriterStream(e){var r=this.useBlobFallback,n=[],a=null;r&&(a=TextEncoder.prototype.encode.bind(new TextEncoder));var{fileName:i}=this,o={};return r?(o.write=l=>{k(a),l.header!==void 0&&n.push(a(l.header)),l.rows!==void 0&&n.push(a(l.rows))},o.close=()=>{k(i);var l=new Blob(n,{type:"application/octet-stream; charset=utf-8"}),d=document.createElement("a");d.href=URL.createObjectURL(l),d.download=i,d.click()},o.abort=()=>{e.postMessage({cancel:!0}),e.close()}):(o.write=l=>{e.postMessage(l)},o.close=()=>{e.postMessage({end:!0}),e.close()},o.abort=()=>{e.postMessage({cancel:!0}),e.close()}),new WritableStream(o)}startDownload(e,r,n,a,i,o,l){var{isDownloading:d}=this.props;if(!d){this.downloadStartTime=Date.now(),ne.info("start downloading ".concat(e)),this.table=r,this.columns=mt.columnsFromRanges(i,r.columns),this.tableSubscription=n,this.gridRanges=a,this.includeColumnHeaders=o,this.useUnformattedValues=l;var u=encodeURIComponent(e.replace(/\//g,":")).replace(/['()]/g,escape).replace(/\*/g,"%2A"),c=new MessageChannel;if(this.port=c.port1,this.fileName=e,this.fileWriter=this.createWriterStream(this.port).getWriter(),this.useBlobFallback){this.writeCsvTable(o);return}this.sw&&this.sw.postMessage({encodedFileName:u},[c.port2]),this.port.onmessage=this.handlePortMessage}}finishDownload(){this.table&&this.table.close(),this.tableSubscription&&this.tableSubscription.close(),this.fileWriter&&this.fileWriter.close();var{onDownloadCompleted:e}=this.props;e(),this.resetTableSaver(),this.downloadStartTime!==void 0&&ne.info("download finished, total elapsed time ".concat((Date.now()-this.downloadStartTime)/1e3," seconds"))}cancelDownload(){var e,r,n;(e=this.table)===null||e===void 0||e.close(),(r=this.tableSubscription)===null||r===void 0||r.close(),(n=this.fileWriter)===null||n===void 0||n.abort(),this.cancelableSnapshots.forEach(i=>{i&&(i.catch(()=>null),i.cancel())});var{onDownloadCanceled:a}=this.props;a(),this.resetTableSaver()}resetTableSaver(){this.table=void 0,this.tableSubscription=void 0,this.columns=void 0,this.chunkRows=void 0,this.removeIframe(),this.gridRanges=[],this.gridRangeCounter=0,this.rangedSnapshotsTotal=[],this.rangedSnapshotCounter=0,this.includeColumnHeaders=!0,this.useUnformattedValues=!1,this.snapshotsTotal=0,this.snapshotCounter=0,this.snapshotsBuffer=new Map,this.currentSnapshotIndex=0,this.snapshotPending=0,this.cancelableSnapshots=[],this.streamTimeout!=null&&clearTimeout(this.streamTimeout),this.snapshotHandlerTimeout!=null&&clearTimeout(this.snapshotHandlerTimeout),this.streamTimeout=void 0,this.snapshotHandlerTimeout=void 0}handleDownloadTimeout(){ne.info("download canceled"),this.cancelDownload()}writeTableHeader(){var e,r="";if(this.columns)for(var n=0;n<this.columns.length;n+=1)r+=this.columns[n].name,r+=n===this.columns.length-1?`
|
|
1
|
+
import{r as p,I as s,K as U,L as W,aL as Ve,aK as he,bb as Ke,Z as we,ba as Rt,bc as ot,_ as er,T as lt,U as le,M as rr,bN as At,bO as re,bP as Mt,bQ as kt,bR as Ft,bS as _t,bT as He,bU as Lt,bV as Ht,bW as $t,bX as tr,bY as Gt,bZ as nr,b_ as Ut,b$ as Bt,c0 as Wt,c1 as zt,c2 as Vt,c3 as Kt,ag as $e,bd as qt}from"./vendor-6ba620f4.js";import{L as te,bb as Xt,al as st,f as Oe,g as qe,T as K,bc as Xe,bd as Ye,ap as Yt,an as dt,u as Zt,be as Qt,aq as ut,ah as Ne,ai as Jt,P as ct,e as k,aE as en,bf as rn,a$ as ar,n as tn,bg as ht,bh as vt,v as nn,bi as an,G as on,b4 as ln,bj as sn,bk as dn,bl as un,bm as cn,bn as hn,d as vn,ax as mn,bo as fn,aU as Z,a6 as gn,a0 as pn,aK as bn}from"./index-7440403e.js";import{S as Cn,b as ir,n as Sn,I as mt,C as ce}from"./MissingPartitionError-6ffc79b5.js";import{a as ae}from"./IrisGridShortcuts-6b660c54.js";import{n as ee,O as wn,a9 as On,aa as yn,ab as ft,ac as xn,ad as In,a7 as jn,a1 as Pn,v as Dn}from"./GridRenderer-beadd456.js";import{B as E,S as Ee,c as z,C as ve,x as Tn,aH as Nn,a5 as gt,D as Ze,Q as pt,s as Ge,d as En,P as Rn,ch as An,u as ke,bh as bt,bg as or,bk as Mn,bi as lr,ba as kn,cF as Fn,bf as _n,cD as Ln,cE as Hn,aT as $n}from"./ControlType-c918f1cd.js";import{e as Gn}from"./monaco-b5248072.js";import{b as fe,G as ge,c as M,m as Ct}from"./IrisGridModel-db71cdf7.js";import{F as Un,c as Bn}from"./FormatterUtils-8bc07bb9.js";function Wn(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=p.useRef(),a=p.useRef(0);return p.useCallback(i=>{window.clearTimeout(n.current),n.current=window.setTimeout(()=>{var o=Math.floor(i.target.scrollTop/t);a.current!==o&&(a.current=o,e(o))},r)},[r,t,e])}function zn(){var{getKey:t=Vn}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},[e,r]=p.useState([]),[n,a]=p.useState(()=>new Set),i=p.useCallback(v=>g=>t(g)===v,[t]),o=p.useCallback(v=>{var g;return(g=e.find(i(v)))!==null&&g!==void 0?g:null},[e,i]),l=p.useCallback(v=>{var g=o(v);if(g==null)throw new Error("No item found matching key: ".concat(v));return g},[o]),d=p.useCallback(v=>{r(g=>[...g,...v])},[]),u=p.useCallback((v,g)=>{r(C=>[...C.slice(0,v),...g,...C.slice(v)])},[]),c=p.useCallback(v=>{var g=new Set(v);r(C=>C.filter(b=>!g.has(t(b))))},[t]),h=p.useCallback((v,g)=>{var C=e.findIndex(i(v));C!==-1&&r(b=>[...b.slice(0,C),g,...b.slice(C+1)])},[e,i]),m=p.useCallback(v=>{if(v.size!==0){var g=[],C=new Map;for(var b of v.keys()){var w=e.findIndex(i(b));g.push(w),C.set(w,b)}g.sort((j,y)=>j-y);var S=[];e.forEach((j,y)=>{if(g[0]===y){var I=C.get(g.shift()),T=v.get(I);S.push(T)}else S.push(j)}),r(S)}},[e,i]),f=p.useMemo(()=>({items:e,selectedKeys:n,append:d,bulkUpdate:m,findItem:o,getItem:l,insert:u,remove:c,setItems:r,setSelectedKeys:a,update:h}),[d,m,o,l,u,e,c,r,n,h]);return f}function Vn(t){var e=t!=null&&typeof t=="object"&&"key"in t;if(!e)throw new Error("Item does not have a `key` prop.");return t.key}function sr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function dr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?sr(Object(r),!0).forEach(function(n){Kn(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):sr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Kn(t,e,r){return e=qn(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function qn(t){var e=Xn(t,"string");return typeof e=="symbol"?e:String(e)}function Xn(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ur=te.module("Aggregations");function Uo(t){var{isRollup:e,settings:r,onChange:n,onEdit:a}=t,{aggregations:i,showOnTop:o}=r,l=p.useMemo(()=>Cn.filter(O=>!i.some(P=>P.operation===O)),[i]),[d,u]=p.useState(l[0]),[c,h]=p.useState([]),m=p.useCallback(O=>{n(dr(dr({},r),O))},[n,r]),f=p.useCallback(O=>{m({aggregations:O})},[m]),v=p.useCallback(O=>{m({showOnTop:O})},[m]),g=p.useCallback(()=>{ur.debug("handleDragStart"),ae.startDragging()},[]),C=p.useCallback(O=>{var{destination:P,source:R}=O;if(ur.debug("handleDragEnd",P,R),ae.stopDragging(),P!==null){var L=P.index;R.index<P.index&&(L+=1);var _=[...i],F=ae.reorder(_,c,_,L),G=ae.adjustDestinationIndex(L,c),$=[[G,G+F.length-1]];f(_),h($)}},[f,i,c,h]),b=p.useCallback(O=>{u(O)},[u]),w=p.useCallback(()=>{f([...i,{operation:d,selected:[],invert:!0}])},[i,d,f]),S=p.useCallback(O=>{f(i.filter((P,R)=>R!==O))},[i,f]),j=p.useCallback(O=>{h(O)},[h]),y=p.useCallback(O=>{var P=i[O];ir.isRollupOperation(P.operation)||a(P)},[i,a]),I=p.useCallback(O=>{v(O==="true")},[v]);p.useEffect(function(){l.length>0&&!l.includes(d)&&u(l[0])},[l,d]);var T=p.useCallback(O=>{var{item:P,itemIndex:R,isClone:L=!1,selectedCount:_}=O,F=P.operation,G=L?"".concat(_):void 0,$=L?"item-list-item-clone":void 0,B=ir.isRollupOperation(P.operation),ie=!L&&!B;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:U("item-list-item-content","draggable-item-list-item-content",$),children:[s.jsxs("span",{className:"title",children:[F,!e&&B&&s.jsxs("span",{className:"small text-warning",children:[s.jsx(W,{icon:Xt})," Requires rollup"]})]}),ee.renderBadge({text:G}),ee.renderHandle()]}),!L&&s.jsxs(s.Fragment,{children:[s.jsx(E,{kind:"ghost",className:"btn-edit",icon:st,tooltip:"Edit Columns",onClick:()=>a(P),disabled:!ie}),s.jsx(E,{kind:"ghost",className:"btn-delete",icon:Oe,tooltip:"Delete Aggregation",onClick:()=>S(R)})]})]})},[S,a,e]),D=l.length>0,x=i.length>0;return s.jsxs("div",{className:"aggregations",children:[D&&s.jsxs("div",{className:"form-inline",children:[s.jsx(Ee,{onChange:b,value:d,children:l.map(O=>s.jsx(wn,{value:O,children:O},O))}),s.jsxs("button",{type:"button",className:"btn btn-link btn-add",onClick:w,children:[s.jsx(W,{icon:qe}),"Add Aggregation"]})]}),D&&x&&s.jsx("hr",{}),x&&s.jsxs(s.Fragment,{children:[!e&&s.jsxs("div",{children:[s.jsx("label",{id:"placement-options-label",children:"Placement: "}),s.jsxs(Ve,{"aria-labelledby":"placement-options-label",marginStart:"size-125",orientation:"horizontal",onChange:I,value:"".concat(o),children:[s.jsx(he,{value:"true",children:"Top"}),s.jsx(he,{value:"false",children:"Bottom"})]})]}),s.jsx(Ke,{onDragStart:g,onDragEnd:C,children:s.jsx(ee,{className:"selected-aggregations",itemCount:i.length,items:i,renderItem:T,offset:0,onSelectionChange:j,onSelect:y,selectedRanges:c,isMultiSelect:!0})})]})]})}function cr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function oe(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?cr(Object(r),!0).forEach(function(n){Yn(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):cr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Yn(t,e,r){return e=Zn(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Zn(t){var e=Qn(t,"string");return typeof e=="symbol"?e:String(e)}function Qn(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Q;(function(t){t[t.NONE=0]="NONE",t[t.ASCENDING=1]="ASCENDING",t[t.DESCENDING=2]="DESCENDING"})(Q||(Q={}));var Jn=30;function Bo(t){var{aggregation:e,columns:r,onChange:n}=t,[a,i]=p.useState(-1),[o,l]=p.useState(-1),[d,u]=p.useState(Q.NONE),{invert:c,selected:h}=e,m=p.useRef(null),f=p.useCallback(I=>h.includes(I)?!c:c,[c,h]),v=p.useMemo(()=>{var I=Sn(r,e.operation);return d!==Q.NONE&&(I=z.sortColumns(I,d===Q.ASCENDING)),I},[r,e.operation,d]),g=p.useMemo(()=>a>=0?v.slice(a,o+1).map(I=>({value:I.name,displayValue:I.name,isSelected:f(I.name)})):[],[v,f,o,a]),C=p.useCallback(I=>{var{name:T}=v[I],D=h.indexOf(T),x=[...h],O=c;D>=0?x.splice(D,1):(x.push(T),x.length===v.length&&(x=[],O=!c)),n(oe(oe({},e),{},{selected:x,invert:O}))},[e,c,v,h,n]),b=p.useCallback(()=>{u(Q.NONE),n(oe(oe({},e),{},{selected:[],invert:!0}))},[e,n]),w=p.useCallback((I,T)=>{i(I),l(T)},[i,l]),S=p.useCallback(()=>{h.length===0?n(oe(oe({},e),{},{invert:!c})):n(oe(oe({},e),{},{selected:[],invert:!0}))},[e,c,n,h]),j=h.length===0?c:null,y=h.length!==0||!c||d!==Q.NONE;return s.jsxs("div",{role:"menu",className:"aggregation-edit",children:[s.jsx("div",{className:"top-menu",children:s.jsxs("div",{className:"form-inline",children:[s.jsx(ve,{checked:j,onChange:S,children:"Toggle All"}),s.jsx("div",{className:"spacer"}),s.jsx(Tn,{in:y,timeout:K.transitionSlowMs,mountOnEnter:!0,unmountOnExit:!0,children:s.jsx(E,{kind:"ghost",className:"btn-reset",onClick:b,children:"Reset"})}),s.jsx(E,{kind:"ghost",className:U({active:d===Q.ASCENDING}),icon:Xe,tooltip:"Sort ascending",onClick:()=>u(Q.ASCENDING)}),s.jsx(E,{kind:"ghost",className:U({active:d===Q.DESCENDING}),icon:Ye,tooltip:"Sort descending",onClick:()=>u(Q.DESCENDING)})]})}),s.jsx("div",{className:"aggregation-edit-item-list",children:s.jsx(Nn,{itemCount:v.length,items:g,offset:a,renderItem:I=>{var{item:T}=I;return s.jsx(ve,{checked:f(T.value),children:T.displayValue})},onSelect:C,onViewportChange:w,rowHeight:Jn,focusSelector:"input",ref:m})})]})}function hr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function vr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?hr(Object(r),!0).forEach(function(n){ea(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):hr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ea(t,e,r){return e=ra(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ra(t){var e=ta(t,"string");return typeof e=="symbol"?e:String(e)}function ta(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function na(t){return s.jsx("svg",vr(vr({width:48,height:48,xmlns:"http://www.w3.org/2000/svg"},t),{},{children:s.jsxs("g",{fill:"none",fillRule:"evenodd",children:[s.jsx("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),s.jsx("path",{fill:"#7DA4FF",d:"M8 26h4v15H8zM15 17h4v24h-4zM22 21h4v20h-4zM29 17h4v24h-4zM36 11h4v30h-4z"})]})}))}function mr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function fr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?mr(Object(r),!0).forEach(function(n){aa(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):mr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function aa(t,e,r){return e=ia(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ia(t){var e=oa(t,"string");return typeof e=="symbol"?e:String(e)}function oa(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function la(t){return s.jsx("svg",fr(fr({width:48,height:48,xmlns:"http://www.w3.org/2000/svg"},t),{},{children:s.jsxs("g",{fill:"none",fillRule:"evenodd",children:[s.jsx("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),s.jsx("path",{fill:"#7DA4FF",d:"M7 34h4v8H7zM12 31h4v11h-4zM17 27h4v15h-4zM22 22h4v20h-4zM27 27h4v15h-4zM32 29h4v13h-4zM37 31h4v11h-4z"})]})}))}function gr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function pr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?gr(Object(r),!0).forEach(function(n){sa(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):gr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function sa(t,e,r){return e=da(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function da(t){var e=ua(t,"string");return typeof e=="symbol"?e:String(e)}function ua(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ca(t){return s.jsx("svg",pr(pr({width:48,height:48,xmlns:"http://www.w3.org/2000/svg"},t),{},{children:s.jsxs("g",{fill:"none",fillRule:"evenodd",children:[s.jsx("path",{fill:"#C1C0C0",d:"M4 4h1v40H4zM44 43v1H5v-1z"}),s.jsx("path",{stroke:"#7DA4FF",d:"M7.984 32.44l7.982-11.378 5.273 3.739 9.952-10.838 2.826 1.894 7.45-5.802"}),s.jsx("path",{stroke:"#BECDEF",d:"M8.244 37.926L17 33.496l5 .87 10.637-10.35 10.615-1.381"})]})}))}function br(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Cr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?br(Object(r),!0).forEach(function(n){ha(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):br(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ha(t,e,r){return e=va(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function va(t){var e=ma(t,"string");return typeof e=="symbol"?e:String(e)}function ma(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function fa(t){return s.jsx("svg",Cr(Cr({width:48,height:48,xmlns:"http://www.w3.org/2000/svg"},t),{},{children:s.jsxs("g",{fill:"none",fillRule:"evenodd",children:[s.jsx("path",{d:"M24 10c7.732 0 14 6.268 14 14s-6.268 14-14 14-14-6.268-14-14h14V10z",fill:"#80A6FF"}),s.jsx("path",{d:"M10 24c0-7.732 6.268-14 14-14v14H10z",fill:"#C1C0C0"})]})}))}function Sr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function wr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Sr(Object(r),!0).forEach(function(n){ga(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Sr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ga(t,e,r){return e=pa(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function pa(t){var e=ba(t,"string");return typeof e=="symbol"?e:String(e)}function ba(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ca(t){return s.jsx("svg",wr(wr({width:48,height:48,xmlns:"http://www.w3.org/2000/svg"},t),{},{children:s.jsxs("g",{fill:"none",fillRule:"evenodd",children:[s.jsx("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),s.jsx("path",{fill:"#939293",d:"M44 34v1H4v-1zM44 25v1H4v-1zM44 16v1H4v-1z"}),s.jsx("circle",{fill:"#7DA4FF",cx:9.5,cy:37.5,r:1.5}),s.jsx("circle",{fill:"#7DA4FF",cx:16.5,cy:30.5,r:1.5}),s.jsx("circle",{fill:"#7DA4FF",cx:22.5,cy:36.5,r:1.5}),s.jsx("circle",{fill:"#7DA4FF",cx:28.5,cy:30.5,r:1.5}),s.jsx("circle",{fill:"#7DA4FF",cx:15.5,cy:38.5,r:1.5}),s.jsx("circle",{fill:"#7DA4FF",cx:23.5,cy:25.5,r:1.5}),s.jsx("circle",{fill:"#7DA4FF",cx:19.5,cy:19.5,r:1.5}),s.jsx("circle",{fill:"#7DA4FF",cx:29.5,cy:19.5,r:1.5}),s.jsx("circle",{fill:"#7DA4FF",cx:32.5,cy:26.5,r:1.5}),s.jsx("circle",{fill:"#7DA4FF",cx:36.5,cy:13.5,r:1.5})]})}))}function Or(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function yr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Or(Object(r),!0).forEach(function(n){Sa(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Or(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Sa(t,e,r){return e=wa(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wa(t){var e=Oa(t,"string");return typeof e=="symbol"?e:String(e)}function Oa(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Wo(t){return s.jsxs("svg",yr(yr({width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),{},{children:[s.jsx("rect",{width:"48",height:"48",fill:"none"}),s.jsx("rect",{x:"26",y:"10",width:"15",height:"4",fill:"#9FDE70"}),s.jsx("rect",{x:"26",y:"22",width:"15",height:"4",fill:"#9FDE70"}),s.jsx("rect",{x:"26",y:"28",width:"15",height:"4",fill:"#FFD95C"}),s.jsx("rect",{x:"26",y:"34",width:"15",height:"4",fill:"#9FDE70"})]}))}function xr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Ir(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?xr(Object(r),!0).forEach(function(n){ya(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):xr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ya(t,e,r){return e=xa(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function xa(t){var e=Ia(t,"string");return typeof e=="symbol"?e:String(e)}function Ia(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function zo(t){return s.jsxs("svg",Ir(Ir({width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),{},{children:[s.jsx("rect",{width:"48",height:"48",fill:"none"}),s.jsx("rect",{x:"4",y:"16",width:"40",height:"4",fill:"#FFD95C"}),s.jsx("rect",{x:"4",y:"10",width:"40",height:"4",fill:"#78DCE8"}),s.jsx("rect",{x:"4",y:"34",width:"40",height:"4",fill:"#78DCE8"})]}))}var jr=te.module("ChartBuilder");class J extends p.PureComponent{static getMaxSeriesCount(e,r){switch(r){case e.plot.SeriesPlotStyle.PIE:return 1;case e.plot.SeriesPlotStyle.HISTOGRAM:return 0;default:return 100}}static makeSeriesItem(e){return{id:we(),value:e}}static makeDefaultSeriesItems(e,r,n){var a=J.getMaxSeriesCount(e,r);if(a===0||n==null||n.length===0)return[];var i=n.length>1?n[1].name:n[0].name;return[J.makeSeriesItem(i)]}static getDefaultXAxis(e,r){return r!=null&&r.length>0?r[0].name:null}constructor(e){super(e),gt(this);var{model:r}=e,{columns:n,dh:a}=r,i=this.getTypes()[0],o=J.getDefaultXAxis(i,n),l=J.makeDefaultSeriesItems(a,i,n);this.state={type:i,seriesItems:l,xAxis:o,isLinked:!0}}getTypes(){var{model:e}=this.props,{dh:r}=e;return[r.plot.SeriesPlotStyle.LINE,r.plot.SeriesPlotStyle.BAR,r.plot.SeriesPlotStyle.SCATTER,r.plot.SeriesPlotStyle.PIE]}getTypeName(e){var{model:r}=this.props,{dh:n}=r;switch(e){case n.plot.SeriesPlotStyle.LINE:return"Line";case n.plot.SeriesPlotStyle.BAR:return"Bar";case n.plot.SeriesPlotStyle.SCATTER:return"Scatter";case n.plot.SeriesPlotStyle.PIE:return"Pie";case n.plot.SeriesPlotStyle.HISTOGRAM:return"Histogram";default:return e}}getTypeIcon(e){var{model:r}=this.props,{dh:n}=r;switch(e){case n.plot.SeriesPlotStyle.LINE:return s.jsx(ca,{});case n.plot.SeriesPlotStyle.BAR:return s.jsx(na,{});case n.plot.SeriesPlotStyle.SCATTER:return s.jsx(Ca,{});case n.plot.SeriesPlotStyle.PIE:return s.jsx(fa,{});case n.plot.SeriesPlotStyle.HISTOGRAM:return s.jsx(la,{});default:return null}}getXAxisLabel(e){var{model:r}=this.props,{dh:n}=r;switch(e){case n.plot.SeriesPlotStyle.PIE:return"Labels";case n.plot.SeriesPlotStyle.HISTOGRAM:return"Data";default:return"X-Axis"}}getSeriesLabel(e){var{model:r}=this.props,{dh:n}=r;switch(e){case n.plot.SeriesPlotStyle.PIE:return"Values";default:return"Series"}}handleAddSeries(){this.setState(e=>{var{seriesItems:r}=e,n=[...r],{model:a}=this.props,{columns:i}=a;return n.push({id:we(),value:i[0].name}),{seriesItems:n}},this.sendChange)}handleLinkStateChange(e){this.setState({isLinked:e==="true"},this.sendChange)}handleReset(){var{model:e}=this.props,{columns:r,dh:n}=e,a=this.getTypes()[0],i=J.getDefaultXAxis(a,r),o=J.makeDefaultSeriesItems(n,a,r),l=!0;this.setState({type:a,seriesItems:o,xAxis:i,isLinked:l},this.sendChange)}handleSeriesChange(e,r){var n=e;this.setState(a=>{var{seriesItems:i}=a;return i=[...i],i[r].value=n,{seriesItems:i}},this.sendChange)}handleSeriesDeleteClick(e){this.setState(r=>{var{seriesItems:n}=r,a=[...n];return a.splice(e,1),{seriesItems:a}},this.sendChange)}handleSubmit(e){e.preventDefault();var{onSubmit:r}=this.props,{type:n,seriesItems:a,xAxis:i,isLinked:o}=this.state,l=a.map(d=>d.value);r({type:n,series:l,xAxis:i,isLinked:o})}handleTypeClick(e){var r=this.getTypes()[e];jr.debug2("handleTypeSelect",r),this.setState(n=>{var{model:a}=this.props,{dh:i}=a,o=J.getMaxSeriesCount(i,r),{seriesItems:l}=n;if(l=l.slice(0,o),l.length===0&&o>0){var{columns:d}=a;l=J.makeDefaultSeriesItems(i,r,d)}return{type:r,seriesItems:l}},this.sendChange)}handleXAxisChange(e){var r=e;jr.debug2("x-axis change",r),this.setState({xAxis:r},this.sendChange)}sendChange(){var{onChange:e}=this.props,{isLinked:r,type:n,seriesItems:a,xAxis:i}=this.state,o=a.map(l=>l.value);e({type:n,series:o,xAxis:i,isLinked:r})}render(){var{model:e}=this.props,{columns:r,dh:n}=e,{seriesItems:a,type:i,xAxis:o,isLinked:l}=this.state,d=J.getMaxSeriesCount(n,i),u=this.getXAxisLabel(i),c=this.getSeriesLabel(i),h=a.length>0,m=a.length<d;return s.jsx("div",{className:"chart-builder",children:s.jsxs("form",{onSubmit:this.handleSubmit,children:[s.jsxs("div",{className:"form-row",children:[s.jsx("label",{children:"Select Chart Type"}),s.jsx("div",{className:"form-row",children:this.getTypes().map((f,v)=>{var g=f;return s.jsx("div",{className:"col col-chart-type",children:s.jsxs("button",{type:"button",className:U("btn","btn-icon","btn-chart-type",{active:f===i}),onClick:()=>this.handleTypeClick(v),children:[this.getTypeIcon(f),this.getTypeName(f)]})},g)})})]}),s.jsx("hr",{}),s.jsxs("div",{className:"form-row form-inline",children:[s.jsx("label",{className:"col-2 label-left",children:u}),s.jsx(Ee,{className:"form-control select-x-axis col",value:o,onChange:this.handleXAxisChange,children:r.map(f=>s.jsx("option",{value:f.name,children:f.name},f.name))})]}),h&&s.jsx("hr",{}),a.map((f,v)=>s.jsxs("div",{className:"form-row form-inline form-series-item","data-testid":"form-series-item-".concat(v),children:[s.jsx("label",{className:"col-2 label-left",children:v===0?c:""}),s.jsx(Ee,{className:"form-control select-series col",value:f.value,onChange:g=>this.handleSeriesChange(g,v),"data-testid":"select-series-item-".concat(v),children:r.map(g=>s.jsx("option",{value:g.name,children:g.name},g.name))}),a.length>1&&s.jsx(E,{kind:"ghost",className:"btn-delete-series ml-2 px-2","data-testid":"delete-series-".concat(v),onClick:()=>{this.handleSeriesDeleteClick(v)},icon:Oe,tooltip:"Delete"})]},f.id)),m&&s.jsxs("div",{className:"form-row",children:[s.jsx("div",{className:"col-2"}),s.jsx(E,{kind:"ghost",className:"btn-add-series mt-1",onClick:this.handleAddSeries,icon:qe,children:"Add Series"})]}),s.jsxs("div",{className:"form-row chart-builder-link",children:[s.jsx("label",{className:"col-2 label-right",children:s.jsxs("div",{className:"fa-md fa-layers",children:[s.jsx(W,{mask:Yt,icon:dt,transform:"right-5 down-5"}),s.jsx(W,{icon:l?Zt:Qt,transform:"grow-2 right-8 down-6"})]})}),s.jsxs(Ve,{"aria-label":"Link state options",orientation:"horizontal",onChange:this.handleLinkStateChange,value:"".concat(l),children:[s.jsx(he,{value:"true",children:"Sync State"}),s.jsx(he,{value:"false",children:"Freeze State"})]})]}),s.jsxs("div",{className:"form-row",children:[s.jsx("div",{className:"col-2 label-right"}),s.jsx("div",{className:"col chart-builder-link-info",children:l?"Charts with synced state will update to match any filters or user modifications applied to the parent table.":"Freeze State disconnects the chart state from the parent table. New filters or user modifications on the parent table will not be applied."})]}),s.jsxs("div",{className:U("form-row","justify-content-end","my-3"),children:[s.jsx(E,{kind:"secondary",className:"btn-reset",onClick:this.handleReset,children:"Reset"}),s.jsx(E,{kind:"primary",type:"submit",className:"btn-submit",children:"Create"})]})]})})}}const Vo=J;function Pr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function ja(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Pr(Object(r),!0).forEach(function(n){Re(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Pr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Re(t,e,r){return e=Pa(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Pa(t){var e=Da(t,"string");return typeof e=="symbol"?e:String(e)}function Da(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class St extends p.Component{constructor(e){super(e),Re(this,"editorContainer",void 0),Re(this,"editor",void 0),this.handleContentChanged=this.handleContentChanged.bind(this),this.handleEditorFocus=this.handleEditorFocus.bind(this),this.handleEditorBlur=this.handleEditorBlur.bind(this),this.handleContainerClick=this.handleContainerClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.state={isEditorFocused:!1,isEditorEmpty:!0},this.editorContainer=null}componentDidMount(){this.initEditor()}componentWillUnmount(){this.destroyEditor()}initEditor(){var e,{value:r,editorSettings:n}=this.props,a=ja({copyWithSyntaxHighlighting:"false",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"groovyDB",lineDecorationsWidth:8,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},scrollBeyondLastLine:!1,padding:{top:6,bottom:6},tabCompletion:"off",useTabStops:!0,value:r,wordWrap:"on",automaticLayout:!0,autoClosingBrackets:"beforeWhitespace"},n);if(!this.editorContainer)throw new Error("editorContainer is null");this.editor=Gn.create(this.editorContainer,a),this.editor.layout(),(e=this.editor.getModel())===null||e===void 0||e.updateOptions({tabSize:0}),this.editor.onKeyDown(this.handleKeyDown),this.editor.onDidChangeModelContent(this.handleContentChanged),this.editor.onDidFocusEditorText(this.handleEditorFocus),this.editor.onDidBlurEditorText(this.handleEditorBlur)}destroyEditor(){var e;(e=this.editor)===null||e===void 0||e.dispose(),this.editor=void 0}handleContentChanged(){var e,r,{onContentChanged:n}=this.props,a=(e=this.editor)===null||e===void 0||(r=e.getModel())===null||r===void 0?void 0:r.getValue();a!==void 0&&this.setState({isEditorEmpty:a.length===0}),n(a)}handleEditorFocus(){this.setState({isEditorFocused:!0})}handleEditorBlur(){var e,r,n,a=(e=(r=this.editor)===null||r===void 0||(n=r.getModel())===null||n===void 0?void 0:n.getValue())!==null&&e!==void 0?e:"";this.setState({isEditorEmpty:a.length===0,isEditorFocused:!1})}handleContainerClick(){var e,{isEditorFocused:r}=this.state;r||(e=this.editor)===null||e===void 0||e.focus()}handleKeyDown(e){var{onTab:r,editorIndex:n}=this.props;e.code==="Tab"&&(e.stopPropagation(),e.preventDefault(),r(n,e.shiftKey))}render(){var{className:e,invalid:r,placeholder:n="",value:a}=this.props,{isEditorFocused:i,isEditorEmpty:o}=this.state;return s.jsxs("div",{className:U("input-editor-wrapper",{focused:i,invalid:r},e),role:"presentation",onClick:this.handleContainerClick,children:[s.jsx("div",{className:"editor-container",ref:l=>{this.editorContainer=l},"data-testid":"custom-column-formula"}),o&&!a&&n.length>0&&s.jsx("div",{className:"editor-placeholder text-muted",children:n})]})}}Re(St,"defaultProps",{value:"",onContentChanged:()=>{},editorSettings:{},editorIndex:0,onTab:()=>{},invalid:!1});function Dr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function ye(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Dr(Object(r),!0).forEach(function(n){Ta(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Dr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Ta(t,e,r){return e=Na(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Na(t){var e=Ea(t,"string");return typeof e=="symbol"?e:String(e)}function Ea(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Tr=Object.freeze({NAME:"name",FORMULA:"formula"}),Ra=()=>{};function Aa(t){var{eventKey:e,name:r,inputIndex:n,formula:a,onChange:i,onDeleteColumn:o,onTabInEditor:l,invalid:d,isDuplicate:u}=t,c=r===""||Ze.isValidColumnName(r),h=p.useCallback(m=>{m!==void 0&&(m.replace(/(\r\n|\n|\r)/gm,""),i(e,Tr.FORMULA,m))},[i,e]);return s.jsx(Rt,{draggableId:e,index:n,disableInteractiveElementBlocking:!0,children:(m,f)=>s.jsxs("div",ye(ye({className:U("draggable-container",{dragging:f.isDragging}),ref:m.innerRef},m.draggableProps),{},{children:[s.jsxs("div",{className:"custom-column-input-container",children:[s.jsxs("div",{className:"pb-3",children:[s.jsxs("div",{className:"d-flex flex-row custom-column-name",children:[s.jsx("input",{className:U("form-control custom-column-input",{"is-invalid":d||!c||u}),placeholder:"Column Name",value:r,onChange:v=>{i(e,Tr.NAME,v.target.value)}}),s.jsx(E,{kind:"ghost",className:"ml-1 px-2",onClick:()=>{o(e)},icon:Oe,tooltip:"Delete custom column"}),s.jsx(E,ye(ye({kind:"ghost",className:"btn-drag-handle",onClick:Ra},m.dragHandleProps),{},{icon:ut,tooltip:"Drag column to re-order"}))]}),(!c||u)&&s.jsx("p",{className:"validate-label-error text-danger mb-0 mt-2 pl-1",children:c?"Duplicate name":"Invalid name"})]}),s.jsx(St,{editorSettings:{language:"deephavenDb"},editorIndex:n,placeholder:"Column Formula",value:a,onContentChanged:h,onTab:l,invalid:d})]}),s.jsx("hr",{})]}))})}function Nr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Fe(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Nr(Object(r),!0).forEach(function(n){be(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Nr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function be(t,e,r){return e=Ma(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ma(t){var e=ka(t,"string");return typeof e=="symbol"?e:String(e)}function ka(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class de extends p.Component{static makeCustomColumnInputEventKey(){return we()}static createCustomColumnInput(){return{eventKey:we(),name:"",formula:""}}constructor(e){super(e),be(this,"container",void 0),be(this,"successButtonTimer",void 0),be(this,"getInput",er((r,n)=>r.find(a=>a.eventKey===n))),be(this,"getInputIndex",er((r,n)=>r.findIndex(a=>a.eventKey===n))),this.handleAddColumnClick=this.handleAddColumnClick.bind(this),this.handleSaveClick=this.handleSaveClick.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleDeleteColumn=this.handleDeleteColumn.bind(this),this.handleCustomColumnUpdated=this.handleCustomColumnUpdated.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.resetRequestFailed=this.resetRequestFailed.bind(this),this.handleEditorTabNavigation=this.handleEditorTabNavigation.bind(this),this.state={inputs:[],isCustomColumnApplying:!1,errorMessage:null,hasRequestFailed:!1,isSuccessShowing:!1},this.container=null,this.successButtonTimer=null}componentDidMount(){var{customColumns:e}=this.props;this.parseCustomColumns(e),this.startListening()}componentWillUnmount(){this.stopListening(),this.successButtonTimer&&clearTimeout(this.successButtonTimer)}resetErrorMessage(){this.setState({errorMessage:null})}startListening(){var{model:e}=this.props;e.addEventListener(fe.EVENT.COLUMNS_CHANGED,this.handleCustomColumnUpdated),e.addEventListener(fe.EVENT.UPDATED,this.handleCustomColumnUpdated),e.addEventListener(fe.EVENT.REQUEST_FAILED,this.handleRequestFailed)}stopListening(){var{model:e}=this.props;e.removeEventListener(fe.EVENT.COLUMNS_CHANGED,this.handleCustomColumnUpdated),e.removeEventListener(fe.EVENT.UPDATED,this.handleCustomColumnUpdated),e.removeEventListener(fe.EVENT.REQUEST_FAILED,this.handleRequestFailed)}parseCustomColumns(e){if(e.length>0){var r=e.map(n=>{var a=n.split(/=(.+)/,2);return{eventKey:de.makeCustomColumnInputEventKey(),name:a[0],formula:a[1]}});this.setState({inputs:r})}else this.setState({inputs:[de.createCustomColumnInput()]})}handleAddColumnClick(){var{inputs:e}=this.state,r=[...e];r.push(de.createCustomColumnInput()),this.setState({inputs:r})}handleDeleteColumn(e){var{inputs:r}=this.state,n=this.getInputIndex(r,e),a=[...r];a.splice(n,1),a.length===0&&a.push(de.createCustomColumnInput()),this.setState({inputs:a})}handleInputChange(e,r,n){var{inputs:a}=this.state,i=this.getInputIndex(a,e),o=this.getInput(a,e),l=Fe({},o);l[r]=n;var d=[...a];d.splice(i,1,l),this.setState({inputs:d})}handleCustomColumnUpdated(){var{isCustomColumnApplying:e}=this.state;e&&this.setState({isCustomColumnApplying:!1,isSuccessShowing:!0},()=>{this.successButtonTimer=setTimeout(()=>this.setState({isSuccessShowing:!1}),de.SUCCESS_SHOW_DURATION)})}handleRequestFailed(e){var r=e,{isCustomColumnApplying:n}=this.state;n&&this.setState({isCustomColumnApplying:!1,errorMessage:s.jsxs(s.Fragment,{children:[s.jsxs("p",{children:[s.jsx(W,{icon:Ne})," Failed to apply custom columns."]}),s.jsxs("div",{className:"error-box",children:[r.detail.errorMessage,s.jsx("br",{}),"Table configuration:"," ",JSON.stringify(r.detail.configuration)]})]}),hasRequestFailed:!0})}handleDragEnd(e){if(ae.stopDragging(),!!e.destination){var{inputs:r}=this.state,n=e.source.index,a=e.destination.index,i=[...r],o=r[n];i.splice(n,1),i.splice(a,0,o),this.setState({inputs:i})}}handleEditorTabNavigation(e,r){var{inputs:n}=this.state;if(r){var a;((a=this.container)===null||a===void 0?void 0:a.querySelectorAll(".btn-drag-handle")[e]).focus();return}if(e===n.length-1){var i,o;(i=this.container)===null||i===void 0||(o=i.querySelector(".btn-add-column"))===null||o===void 0||o.focus()}else{var l,d=e+1;((l=this.container)===null||l===void 0?void 0:l.querySelectorAll(".custom-column-input")[d]).focus()}}handleSaveClick(){var{onSave:e,customColumns:r}=this.props,{inputs:n,isCustomColumnApplying:a}=this.state;if(!a){var i=[];n.forEach(o=>{var{name:l,formula:d}=o;l&&d&&i.push("".concat(l,"=").concat(d))}),this.resetErrorMessage(),this.setState({isCustomColumnApplying:i.length>0||r.length>0}),e(i)}}resetRequestFailed(){this.setState(e=>{var{hasRequestFailed:r}=e;return r?{hasRequestFailed:!1}:null})}renderInputs(){var{inputs:e,hasRequestFailed:r}=this.state,n=new Map;return e.forEach(a=>{var i,{name:o}=a;return n.set(o,((i=n.get(o))!==null&&i!==void 0?i:0)+1)}),e.map((a,i)=>{var o,{eventKey:l,name:d,formula:u}=a,c=((o=n.get(d))!==null&&o!==void 0?o:0)>1;return s.jsx(Aa,{inputIndex:i,eventKey:l,name:d,formula:u,onChange:this.handleInputChange,onDeleteColumn:this.handleDeleteColumn,onTabInEditor:this.handleEditorTabNavigation,invalid:r,isDuplicate:c},l)})}renderSaveButton(){var{inputs:e,isCustomColumnApplying:r,isSuccessShowing:n}=this.state,a=e.length>1?"Save Columns":"Save Column",i=e.every(d=>{var{name:u}=d;return u===""||Ze.isValidColumnName(u)}),o=e.filter(d=>{var{name:u}=d;return u!==""}).map(d=>{var{name:u}=d;return u}),l=new Set(o).size===o.length;return s.jsxs(E,{kind:n?"success":"primary",className:U("btn-apply",{"btn-spinner":r}),disabled:n||r||!i||!l,onClick:this.handleSaveClick,icon:n?Jt:void 0,children:[r&&s.jsxs("span",{children:[s.jsx(ct,{className:"mr-2 loading-spinner-vertical-align"}),s.jsx("span",{className:"btn-normal-content",children:"Applying"})]}),!n&&!r&&a,n&&"Success"]})}render(){var{onCancel:e}=this.props,{errorMessage:r}=this.state;return s.jsxs("div",{role:"presentation",className:"custom-column-builder-container",ref:n=>{this.container=n},onClick:this.resetRequestFailed,onFocus:this.resetRequestFailed,children:[s.jsx("hr",{}),s.jsx(Ke,{onDragStart:ae.startDragging,onDragEnd:this.handleDragEnd,children:s.jsx(ot,{droppableId:"droppable-custom-columns",children:(n,a)=>s.jsxs("div",Fe(Fe({ref:n.innerRef},n.droppableProps),{},{className:U("droppable-container",{dragging:a.draggingFromThisWith}),children:[this.renderInputs(),n.placeholder]}))})}),s.jsx("div",{className:"pt-1 px-3",children:s.jsx(E,{kind:"ghost",className:"btn-add-column",onClick:this.handleAddColumnClick,icon:qe,children:"Add Another Column"})}),s.jsxs("div",{className:"custom-column-builder-footer",children:[r&&s.jsx("div",{className:"error-message",children:r}),s.jsxs("div",{className:"d-flex justify-content-end",children:[s.jsx(E,{kind:"secondary",className:"mr-2",onClick:e,children:"Cancel"}),this.renderSaveButton()]})]})]})}}be(de,"SUCCESS_SHOW_DURATION",750);const Ko=de;var Ue;(function(t){t.ADVANCED_SETTINGS="ADVANCED_SETTINGS",t.AGGREGATIONS="AGGREGATIONS",t.AGGREGATION_EDIT="AGGREGATIONS_EDIT",t.CHART_BUILDER="CHART_BUILDER",t.CUSTOM_COLUMN_BUILDER="CUSTOM_COLUMN_BUILDER",t.QUICK_FILTERS="QUICK_FILTERS",t.ROLLUP_ROWS="ROLLUP_ROWS",t.SEARCH_BAR="SEARCH_BAR",t.SELECT_DISTINCT="SELECT_DISTINCT",t.TABLE_EXPORTER="TABLE_EXPORTER",t.VISIBILITY_ORDERING_BUILDER="VISIBILITY_ORDERING_BUILDER",t.CONDITIONAL_FORMATTING="CONDITIONAL_FORMATTING",t.CONDITIONAL_FORMATTING_EDIT="CONDITIONAL_FORMATTING_EDIT",t.GOTO="GOTO"})(Ue||(Ue={}));const qo=Ue;function Er(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Rr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Er(Object(r),!0).forEach(function(n){ue(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Er(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ue(t,e,r){return e=Fa(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Fa(t){var e=_a(t,"string");return typeof e=="symbol"?e:String(e)}function _a(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Ce=te.module("RollupRows"),La=150,xe="grouped-rollup-rows",Ie="ungrouped-rollup-rows";class V extends p.Component{static renderColumn(e){var{item:r,isClone:n,selectedCount:a}=e,i=r?.name,o=n!==void 0&&n?"".concat(a):void 0,l=n!==void 0&&n?"item-list-item-clone":"";return ee.renderTextItem({text:i,badgeText:o,className:l})}static addGroupings(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length;if(r==null||r.length===0)return e;var a=n,i=e.filter((o,l)=>r.includes(o)?(l<a&&(a-=1),!1):!0);return i.splice(a,0,...r),i}static isGroupable(e){return!z.isDecimalType(e.type)}constructor(e){super(e),ue(this,"ungroupedList",void 0),ue(this,"groupedList",void 0),ue(this,"search",lt(o=>{for(var l=this.getSortedUngroupedColumns(),d=[],u=null,c=0;c<l.length;c+=1){var h=l[c];h.name.toLowerCase().includes(o.toLowerCase())&&(u==null&&(u=c),d.push([c,c]))}k(u),this.setState({ungroupedSelectedRanges:d}),d.length>0&&this.ungroupedList.current&&this.ungroupedList.current.scrollToItem(u)},La)),ue(this,"getCachedUngroupedColumns",le((o,l)=>o.filter(d=>V.isGroupable(d)&&l.find(u=>u===d.name)==null))),ue(this,"getCachedSortedColumns",le((o,l)=>l==null?[...o]:z.sortColumns(o,l===V.SORT.ASCENDING))),this.handleDeleteClicked=this.handleDeleteClicked.bind(this),this.handleSearchChange=this.handleSearchChange.bind(this),this.handleUngroupedSelect=this.handleUngroupedSelect.bind(this),this.handleUngroupedSelectionChange=this.handleUngroupedSelectionChange.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleGroupedSelectionChange=this.handleGroupedSelectionChange.bind(this),this.handleShowConstituentsChange=this.handleShowConstituentsChange.bind(this),this.handleShowNonAggregatedColumnsChange=this.handleShowNonAggregatedColumnsChange.bind(this),this.handleSortAscending=this.handleSortAscending.bind(this),this.handleSortDescending=this.handleSortDescending.bind(this),this.renderGroupedItem=this.renderGroupedItem.bind(this),this.ungroupedList=rr.createRef(),this.groupedList=rr.createRef();var{config:r}=e,{columns:n=[],showConstituents:a=!0,showNonAggregatedColumns:i=!0}=r??{};this.state={ungroupedSelectedRanges:[],columns:n,groupedSelectedRanges:[],searchFilter:"",showConstituents:a,showNonAggregatedColumns:i,dragSource:null,sort:null}}componentDidUpdate(e,r){var{config:n}=this.props,{columns:a,showConstituents:i,showNonAggregatedColumns:o}=this.state;n!==e.config?this.updateFromConfig():(a!==r.columns||i!==r.showConstituents||o!==r.showNonAggregatedColumns)&&(n==null||a!==n.columns||i!==n.showConstituents||o!==n.showNonAggregatedColumns)&&this.sendChange()}componentWillUnmount(){this.search.cancel()}handleSearchChange(e){var r=e.target.value;if(this.setState({searchFilter:r}),!r){this.search.cancel(),this.resetSelection();return}this.search(r)}handleSortAscending(){this.setState(e=>{var{sort:r}=e;return{sort:r===V.SORT.ASCENDING?null:V.SORT.ASCENDING}})}handleSortDescending(){this.setState(e=>{var{sort:r}=e;return{sort:r===V.SORT.DESCENDING?null:V.SORT.DESCENDING}})}resetSelection(){this.setState({ungroupedSelectedRanges:[],groupedSelectedRanges:[]})}handleDragStart(e){Ce.debug("handleDragStart",e),document.documentElement.classList.add("drag-pointer-events-none"),this.setState({dragSource:e.source})}handleDragEnd(e){Ce.debug("handleDragEnd",e),document.documentElement.classList.remove("drag-pointer-events-none"),this.setState({dragSource:null});var{destination:r,source:n}=e;if(!(r==null||n==null)){if(r.droppableId===Ie){this.setState(o=>{var{groupedSelectedRanges:l,columns:d}=o,u=[...d];return ae.reorder(u,l,[],0),{columns:u,ungroupedSelectedRanges:[],groupedSelectedRanges:[]}});return}var a=n.droppableId===xe,i=r.index;a&&n.index<r.index&&(i+=1),this.setState(o=>{var{columns:l,ungroupedSelectedRanges:d,groupedSelectedRanges:u}=o,c=[...l],h=a?c:this.getSortedUngroupedColumns().map(C=>C.name),m=a?u:d,f=ae.reorder(h,m,c,i),v=a?ae.adjustDestinationIndex(i,u):i,g=[[v,v+f.length-1]];return{columns:c,ungroupedSelectedRanges:[],groupedSelectedRanges:g}}),this.resetSelection()}}handleUngroupedSelect(e){Ce.debug("handleUngroupedSelect"),this.setState(r=>{var{columns:n}=r;return{columns:V.addGroupings(n,[this.getSortedUngroupedColumns()[e].name]),ungroupedSelectedRanges:[],groupedSelectedRanges:[]}})}handleUngroupedSelectionChange(e){Ce.debug2("handleUngroupedSelectionChange",e),this.setState(r=>{var{ungroupedSelectedRanges:n}=r;return e===n?null:{ungroupedSelectedRanges:e,groupedSelectedRanges:[]}})}handleGroupedSelectionChange(e){Ce.debug2("handleGroupedSelectedRanges",e),this.setState(r=>{var{groupedSelectedRanges:n}=r;return e===n?null:{groupedSelectedRanges:e,ungroupedSelectedRanges:[]}})}handleDeleteClicked(e){this.setState(r=>{var{columns:n}=r,a=n.slice();return a.splice(e,1),{columns:a}})}handleShowConstituentsChange(){this.setState(e=>{var{showConstituents:r}=e;return{showConstituents:!r}})}handleShowNonAggregatedColumnsChange(){this.setState(e=>{var{showNonAggregatedColumns:r}=e;return{showNonAggregatedColumns:!r}})}updateFromConfig(){var{config:e}=this.props,{columns:r=[],showConstituents:n=!0,showNonAggregatedColumns:a=!0}=e??{};this.setState({columns:r,showConstituents:n,showNonAggregatedColumns:a})}sendChange(){var{onChange:e}=this.props,{columns:r,showConstituents:n,showNonAggregatedColumns:a}=this.state;e({columns:r,showConstituents:n,showNonAggregatedColumns:a})}getUngroupedColumns(){var{model:e}=this.props,{columns:r}=this.state,{originalColumns:n}=e;return this.getCachedUngroupedColumns(n,r)}getSortedUngroupedColumns(){var{sort:e}=this.state,r=this.getUngroupedColumns();return this.getCachedSortedColumns(r,e)}renderGroupedItem(e){var{item:r,itemIndex:n,isClone:a,selectedCount:i}=e,o=a!==void 0&&a?"":" ".repeat(n),l="".concat(o).concat(r),d=a!==void 0&&a?"".concat(i):void 0,u=a!==void 0&&a?"item-list-item-clone":"";return s.jsxs(s.Fragment,{children:[ee.renderTextItem({text:l,badgeText:d,className:u}),(a===void 0||!a)&&s.jsx(E,{kind:"ghost",className:"btn btn-link btn-link-icon btn-delete-grouping float-right",onClick:()=>this.handleDeleteClicked(n),children:s.jsx(W,{icon:Oe})})]})}render(){var{columns:e,dragSource:r,searchFilter:n,groupedSelectedRanges:a,ungroupedSelectedRanges:i,showConstituents:o,showNonAggregatedColumns:l,sort:d}=this.state,u=this.getSortedUngroupedColumns(),c=e.length*ee.DEFAULT_ROW_HEIGHT;r?.droppableId===Ie&&(c+=ee.DEFAULT_ROW_HEIGHT);var h=u.length*ee.DEFAULT_ROW_HEIGHT+10,m=Math.min(3*ee.DEFAULT_ROW_HEIGHT,h);return s.jsx("div",{role:"menu",className:U("rollup-rows",{"is-dragging":r!=null}),tabIndex:0,children:s.jsxs(Ke,{onDragEnd:this.handleDragEnd,onDragStart:this.handleDragStart,children:[s.jsxs("div",{className:"rollup-rows-group-by",children:[s.jsx("div",{className:"section-title",children:"Group By"}),e.length===0&&s.jsx(ot,{droppableId:"placeholder",children:(f,v)=>s.jsx("div",Rr(Rr({className:U("placeholder","text-muted",{"is-dragging-from-this":v.draggingFromThisWith,"is-dragging-over":v.isDraggingOver,"is-dropping":v.draggingOverWith}),ref:f.innerRef},f.droppableProps),{},{children:"To create a rollup, drag columns from the list below and drop them into this area."}))}),e.length>0&&s.jsx(ee,{draggingItemClassName:"rollup-rows-dragging-grouped-item",draggablePrefix:xe,droppableId:xe,itemCount:e.length,items:e,offset:0,onSelectionChange:this.handleGroupedSelectionChange,ref:this.groupedList,renderItem:this.renderGroupedItem,selectedRanges:a,style:{height:c},isMultiSelect:!0})]}),s.jsxs("div",{className:"rollup-rows-available-columns",children:[s.jsx("div",{className:"section-title",children:"Available Grouping Columns"}),s.jsxs("div",{className:"top-menu",children:[s.jsx(pt,{className:"w-100",value:n,matchCount:n?i.length:void 0,placeholder:"Find column...",onChange:this.handleSearchChange}),s.jsxs(E,{kind:"ghost",className:U("btn-link btn-link-icon",{active:d===V.SORT.ASCENDING}),onClick:this.handleSortAscending,children:[s.jsx(W,{icon:Xe}),s.jsx(Ge,{children:"Sort ascending"})]}),s.jsxs(E,{kind:"ghost",className:U("btn-link btn-link-icon",{active:d===V.SORT.DESCENDING}),onClick:this.handleSortDescending,children:[s.jsx(W,{icon:Ye}),s.jsx(Ge,{children:"Sort descending"})]})]}),s.jsx(ee,{className:"rollup-available-grouping-columns",draggablePrefix:Ie,droppableId:Ie,itemCount:u.length,items:u,renderItem:V.renderColumn,offset:0,onSelect:this.handleUngroupedSelect,onSelectionChange:this.handleUngroupedSelectionChange,ref:this.ungroupedList,selectedRanges:i,style:{maxHeight:h,minHeight:m},isDropDisabled:r?.droppableId!==xe,isMultiSelect:!0}),s.jsxs("div",{className:"bottom-menu",children:[s.jsx("div",{className:"label",children:"Show:"}),s.jsx(ve,{checked:o,onChange:this.handleShowConstituentsChange,children:"Constituents"}),s.jsx(ve,{checked:l,onChange:this.handleShowNonAggregatedColumnsChange,children:"Non-Aggregated Columns"})]})]})]})})}}ue(V,"SORT",Object.freeze({ASCENDING:"ASC",DESCENDING:"DESC"}));ue(V,"defaultProps",{config:null,onChange:()=>{}});const Xo=V;function Ar(t,e,r,n,a,i,o){try{var l=t[i](o),d=l.value}catch(u){r(u);return}l.done?e(d):Promise.resolve(d).then(n,a)}function Ha(t){return function(){var e=this,r=arguments;return new Promise(function(n,a){var i=t.apply(e,r);function o(d){Ar(i,n,a,o,l,"next",d)}function l(d){Ar(i,n,a,o,l,"throw",d)}o(void 0)})}}function Mr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function kr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Mr(Object(r),!0).forEach(function(n){me(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Mr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function me(t,e,r){return e=$a(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function $a(t){var e=Ga(t,"string");return typeof e=="symbol"?e:String(e)}function Ga(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Ua=te.module("TableCsvExporter");class N extends p.Component{static getDateString(e){return e.i18n.DateTimeFormat.format(N.FILENAME_DATE_FORMAT,new Date)}constructor(e){super(e),this.handleDownloadClick=this.handleDownloadClick.bind(this),this.handleDownloadRowOptionChanged=this.handleDownloadRowOptionChanged.bind(this),this.handleCustomizedDownloadRowOptionChanged=this.handleCustomizedDownloadRowOptionChanged.bind(this),this.handleCustomizedDownloadRowsChanged=this.handleCustomizedDownloadRowsChanged.bind(this),this.handleIncludeColumnHeadersChanged=this.handleIncludeColumnHeadersChanged.bind(this),this.handleIncludeHiddenColumnsChanged=this.handleIncludeHiddenColumnsChanged.bind(this),this.handleUseUnformattedValuesChanged=this.handleUseUnformattedValuesChanged.bind(this);var{model:r,name:n}=e;this.state={fileName:"".concat(n,"-").concat(N.getDateString(r.dh),".csv"),downloadRowOption:N.DOWNLOAD_ROW_OPTIONS.ALL_ROWS,customizedDownloadRowOption:N.CUSTOMIZED_ROWS_OPTIONS.FIRST,customizedDownloadRows:N.DEFAULT_DOWNLOAD_ROWS,includeColumnHeaders:!0,includeHiddenColumns:!1,useUnformattedValues:!1,errorMessage:null,id:we()}}getSnapshotRanges(){var{model:e,selectedRanges:r}=this.props,{downloadRowOption:n,customizedDownloadRowOption:a,customizedDownloadRows:i}=this.state,{rowCount:o,columnCount:l}=e,d=[];switch(n){case N.DOWNLOAD_ROW_OPTIONS.ALL_ROWS:d.push(new ge(0,0,l-1,o-1));break;case N.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS:d=r.map(u=>kr(kr({},u),{},{startColumn:0,endColumn:l-1})).sort((u,c)=>u.startRow!=null&&c.startRow!=null?u.startRow-c.startRow:0);break;case N.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS:switch(a){case N.CUSTOMIZED_ROWS_OPTIONS.FIRST:d.push(new ge(0,0,l-1,Math.min(i-1,o-1)));break;case N.CUSTOMIZED_ROWS_OPTIONS.LAST:d.push(new ge(0,Math.max(0,o-i),l-1,o-1));break}break}return d}getModelRanges(e){var{userColumnWidths:r,movedColumns:n}=this.props,{includeHiddenColumns:a}=this.state,i=mt.getHiddenColumns(r),o=M.getModelRanges(e,n);if(!a&&i.length>0){var l=i.map(ge.makeColumn);o=ge.subtractRangesFromRanges(o,l)}return o}resetDownloadState(){this.setState({errorMessage:null})}handleDownloadClick(){var e=this;return Ha(function*(){var{model:r,isDownloading:n,onDownloadStart:a,onDownload:i,onCancel:o}=e.props,{fileName:l,includeColumnHeaders:d,useUnformattedValues:u}=e.state;if(n){o();return}e.resetDownloadState();var c=e.getSnapshotRanges(),h=e.getModelRanges(c);if(e.validateOptionInput()){a();try{var m=yield r.export(),f=m.setViewport(0,0);yield f.getViewportData(),i(l,m,f,c,h,d,u)}catch(v){Ua.error("CSV download failed",v),e.setState({errorMessage:s.jsxs("p",{children:[s.jsx(W,{icon:Ne})," ","".concat(v)]})}),o()}}})()}handleDownloadRowOptionChanged(e){this.setState({downloadRowOption:e})}handleCustomizedDownloadRowOptionChanged(e){this.setState({customizedDownloadRowOption:e})}handleCustomizedDownloadRowsChanged(e){this.setState({customizedDownloadRows:parseInt(e.target.value,10)})}handleIncludeColumnHeadersChanged(){this.setState(e=>{var{includeColumnHeaders:r}=e;return{includeColumnHeaders:!r}})}handleIncludeHiddenColumnsChanged(){this.setState(e=>{var{includeHiddenColumns:r}=e;return{includeHiddenColumns:!r}})}handleUseUnformattedValuesChanged(){this.setState(e=>{var{useUnformattedValues:r}=e;return{useUnformattedValues:!r}})}validateOptionInput(){var{selectedRanges:e}=this.props,{downloadRowOption:r,customizedDownloadRows:n}=this.state;return r===N.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS&&e.length===0?(this.setState({errorMessage:s.jsxs("p",{children:[s.jsx(W,{icon:Ne})," No rows selected. Please select some rows in the table."]})}),!1):r===N.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS&&n<=0?(this.setState({errorMessage:s.jsxs("p",{children:[s.jsx(W,{icon:Ne})," Number of rows to output must be greater than 0"]})}),!1):!0}render(){var{model:e,isDownloading:r,tableDownloadProgress:n,tableDownloadEstimatedTime:a,selectedRanges:i,tableDownloadStatus:o}=this.props,{fileName:l,downloadRowOption:d,customizedDownloadRowOption:u,customizedDownloadRows:c,includeColumnHeaders:h,includeHiddenColumns:m,useUnformattedValues:f,errorMessage:v,id:g}=this.state,{rowCount:C}=e;return s.jsxs("div",{className:"table-csv-exporter",children:[s.jsx("div",{id:"download-rows-label",className:"section-title",children:"Download Rows"}),s.jsx("div",{className:"form-group",children:s.jsxs(Ve,{"aria-labelledby":"download-rows-label",onChange:this.handleDownloadRowOptionChanged,value:d,isDisabled:r,children:[s.jsxs(he,{value:N.DOWNLOAD_ROW_OPTIONS.ALL_ROWS,"data-testid":"radio-csv-exporter-download-all",children:["All Rows",s.jsx("span",{className:"text-muted ml-2",children:"(".concat(C.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")," rows)")})]}),s.jsxs(he,{value:N.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS,"data-testid":"radio-csv-exporter-only-selected",children:["Only Selected Rows",s.jsx("span",{className:"text-muted ml-2",children:i.length>0?"(".concat(ge.rowCount(i).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")," rows)"):null})]}),s.jsx(he,{value:N.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS,"data-testid":"radio-csv-exporter-customized-rows",children:s.jsxs("div",{className:"radio-input-row",role:"presentation",onClick:()=>{this.setState({downloadRowOption:N.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS})},children:[s.jsxs(Ee,{value:u,"data-testid":"select-csv-exporter-customized-rows",className:"custom-select",disabled:r,onChange:this.handleCustomizedDownloadRowOptionChanged,children:[s.jsx("option",{value:"FIRST",children:"First"}),s.jsx("option",{value:"LAST",children:"Last"})]}),s.jsx("input",{type:"number",className:"form-control",id:"customizedRows-".concat(g),"data-testid":"input-csv-exporter-customized-rows",name:"customizedRows-".concat(g),placeholder:"100",value:c,disabled:r,onChange:this.handleCustomizedDownloadRowsChanged}),s.jsx("div",{children:"Rows"})]})})]})}),s.jsxs("div",{className:"form-group",children:[s.jsx("label",{htmlFor:"customizedRows-".concat(g),children:"File Name"}),s.jsx("input",{type:"text",className:"form-control",id:"filename-".concat(g),"data-testid":"input-csv-exporter-file-name",name:"filename-".concat(g),value:l,onChange:b=>{this.setState({fileName:b.target.value})},disabled:r})]}),s.jsxs("div",{className:"checkbox-options",children:[s.jsx(ve,{checked:h,onChange:this.handleIncludeColumnHeadersChanged,children:"Include column headers"}),s.jsx(ve,{checked:m,onChange:this.handleIncludeHiddenColumnsChanged,children:"Include hidden columns"}),s.jsx(ve,{checked:f,onChange:this.handleUseUnformattedValuesChanged,children:"Use unformatted values"})]}),s.jsxs("div",{className:"section-footer flex-column",children:[v!=null&&s.jsx("div",{className:"error-message",children:v}),o&&s.jsxs("div",{className:"download-status",children:[(o===N.DOWNLOAD_STATUS.DOWNLOADING||o===N.DOWNLOAD_STATUS.INITIATING)&&s.jsxs(s.Fragment,{children:[o===N.DOWNLOAD_STATUS.INITIATING&&s.jsx("div",{className:"text-muted",children:"Starting Download..."}),o===N.DOWNLOAD_STATUS.DOWNLOADING&&s.jsxs("div",{className:"text-muted d-flex justify-content-between",children:[s.jsx("span",{children:a||a===0?"Estimated time: ".concat(En.formatElapsedTime(a)):null}),s.jsx("span",{children:"".concat(n,"%")})]})]}),o===N.DOWNLOAD_STATUS.FINISHED&&s.jsx("div",{className:"text-muted text-right",children:"Download Completed"}),o===N.DOWNLOAD_STATUS.CANCELED&&s.jsx("div",{className:"text-muted",children:"Download Canceled"}),(o===N.DOWNLOAD_STATUS.DOWNLOADING||o===N.DOWNLOAD_STATUS.INITIATING)&&s.jsx("div",{className:"progress",children:s.jsx("div",{className:"progress-bar progress-bar-striped progress-bar-animated",style:{width:"".concat(n,"%")}})}),o===N.DOWNLOAD_STATUS.FINISHED&&s.jsx("div",{className:"progress",children:s.jsx("div",{className:"progress-bar bg-success",style:{width:"".concat(n,"%")}})})]}),s.jsxs(E,{kind:"primary","data-testid":"btn-csv-exporter-download",className:U("btn-downloading",{"btn-spinner btn-cancelable":r}),onClick:this.handleDownloadClick,children:[r&&s.jsxs("span",{children:[s.jsx(ct,{className:"mr-2 loading-spinner-vertical-align"}),s.jsx("span",{className:"btn-normal-content",children:"Downloading"}),s.jsx("span",{className:"btn-hover-content",children:"Cancel"})]}),!r&&"Download"]})]})]})}}me(N,"FILENAME_DATE_FORMAT","yyyy-MM-dd-HHmmss");me(N,"DOWNLOAD_STATUS",{INITIATING:"INITIATING",DOWNLOADING:"DOWNLOADING",FINISHED:"FINISHED",CANCELED:"CANCELED"});me(N,"DOWNLOAD_ROW_OPTIONS",{ALL_ROWS:"ALL_ROWS",SELECTED_ROWS:"SELECTED_ROWS",CUSTOMIZED_ROWS:"CUSTOMIZED_ROWS"});me(N,"CUSTOMIZED_ROWS_OPTIONS",{FIRST:"FIRST",LAST:"LAST"});me(N,"DEFAULT_DOWNLOAD_ROWS",100);me(N,"defaultProps",{onDownloadStart:()=>{},isDownloading:!1,tableDownloadStatus:"",tableDownloadProgress:0,tableDownloadEstimatedTime:null,selectedRanges:[]});const Yo=N;function A(t,e,r){return e=Ba(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ba(t){var e=Wa(t,"string");return typeof e=="symbol"?e:String(e)}function Wa(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ne=te.module("TableSaver"),za="yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS z";function Va(t){return t.added!==void 0}function Ka(t){if(!Va(t))throw new Error("event is not UpdateEventData")}class X extends p.PureComponent{static csvEscapeString(e){return'"'.concat(e.replace(/"/g,'""'),'"')}constructor(e){super(e),A(this,"sw",void 0),A(this,"port",void 0),A(this,"fileWriter",void 0),A(this,"table",void 0),A(this,"tableSubscription",void 0),A(this,"columns",void 0),A(this,"fileName",void 0),A(this,"includeColumnHeaders",void 0),A(this,"useUnformattedValues",void 0),A(this,"chunkRows",void 0),A(this,"gridRanges",void 0),A(this,"gridRangeCounter",void 0),A(this,"rangedSnapshotsTotal",void 0),A(this,"rangedSnapshotCounter",void 0),A(this,"snapshotsTotal",void 0),A(this,"snapshotCounter",void 0),A(this,"snapshotsBuffer",void 0),A(this,"currentSnapshotIndex",void 0),A(this,"snapshotPending",void 0),A(this,"cancelableSnapshots",void 0),A(this,"streamTimeout",void 0),A(this,"snapshotHandlerTimeout",void 0),A(this,"downloadStartTime",void 0),A(this,"iframe",void 0),A(this,"useBlobFallback",void 0),A(this,"getCachedCustomColumnFormatFlag",Ct(Un.isCustomColumnFormatDefined,{max:1e4})),this.handlePortMessage=this.handlePortMessage.bind(this),this.handleSnapshotResolved=this.handleSnapshotResolved.bind(this),this.handleDownloadTimeout=this.handleDownloadTimeout.bind(this),this.state={},this.gridRanges=[],this.gridRangeCounter=0,this.rangedSnapshotsTotal=[],this.rangedSnapshotCounter=0,this.includeColumnHeaders=!0,this.useUnformattedValues=!1,this.snapshotsTotal=0,this.snapshotCounter=0,this.snapshotsBuffer=new Map,this.currentSnapshotIndex=0,this.snapshotPending=0,this.cancelableSnapshots=[],this.useBlobFallback=!1}componentDidMount(){var{getDownloadWorker:e}=this.props;e().then(r=>{ne.info("found active service worker"),this.sw=r,this.sw.postMessage("ping")}).catch(r=>{ne.warn("Download csv is not optimized.",r),this.useBlobFallback=!0})}componentWillUnmount(){this.removeIframe(),this.streamTimeout&&clearTimeout(this.streamTimeout),this.snapshotHandlerTimeout&&clearTimeout(this.snapshotHandlerTimeout)}createWriterStream(e){var r=this.useBlobFallback,n=[],a=null;r&&(a=TextEncoder.prototype.encode.bind(new TextEncoder));var{fileName:i}=this,o={};return r?(o.write=l=>{k(a),l.header!==void 0&&n.push(a(l.header)),l.rows!==void 0&&n.push(a(l.rows))},o.close=()=>{k(i);var l=new Blob(n,{type:"application/octet-stream; charset=utf-8"}),d=document.createElement("a");d.href=URL.createObjectURL(l),d.download=i,d.click()},o.abort=()=>{e.postMessage({cancel:!0}),e.close()}):(o.write=l=>{e.postMessage(l)},o.close=()=>{e.postMessage({end:!0}),e.close()},o.abort=()=>{e.postMessage({cancel:!0}),e.close()}),new WritableStream(o)}startDownload(e,r,n,a,i,o,l){var{isDownloading:d}=this.props;if(!d){this.downloadStartTime=Date.now(),ne.info("start downloading ".concat(e)),this.table=r,this.columns=mt.columnsFromRanges(i,r.columns),this.tableSubscription=n,this.gridRanges=a,this.includeColumnHeaders=o,this.useUnformattedValues=l;var u=encodeURIComponent(e.replace(/\//g,":")).replace(/['()]/g,escape).replace(/\*/g,"%2A"),c=new MessageChannel;if(this.port=c.port1,this.fileName=e,this.fileWriter=this.createWriterStream(this.port).getWriter(),this.useBlobFallback){this.writeCsvTable(o);return}this.sw&&this.sw.postMessage({encodedFileName:u},[c.port2]),this.port.onmessage=this.handlePortMessage}}finishDownload(){this.table&&this.table.close(),this.tableSubscription&&this.tableSubscription.close(),this.fileWriter&&this.fileWriter.close();var{onDownloadCompleted:e}=this.props;e(),this.resetTableSaver(),this.downloadStartTime!==void 0&&ne.info("download finished, total elapsed time ".concat((Date.now()-this.downloadStartTime)/1e3," seconds"))}cancelDownload(){var e,r,n;(e=this.table)===null||e===void 0||e.close(),(r=this.tableSubscription)===null||r===void 0||r.close(),(n=this.fileWriter)===null||n===void 0||n.abort(),this.cancelableSnapshots.forEach(i=>{i&&(i.catch(()=>null),i.cancel())});var{onDownloadCanceled:a}=this.props;a(),this.resetTableSaver()}resetTableSaver(){this.table=void 0,this.tableSubscription=void 0,this.columns=void 0,this.chunkRows=void 0,this.removeIframe(),this.gridRanges=[],this.gridRangeCounter=0,this.rangedSnapshotsTotal=[],this.rangedSnapshotCounter=0,this.includeColumnHeaders=!0,this.useUnformattedValues=!1,this.snapshotsTotal=0,this.snapshotCounter=0,this.snapshotsBuffer=new Map,this.currentSnapshotIndex=0,this.snapshotPending=0,this.cancelableSnapshots=[],this.streamTimeout!=null&&clearTimeout(this.streamTimeout),this.snapshotHandlerTimeout!=null&&clearTimeout(this.snapshotHandlerTimeout),this.streamTimeout=void 0,this.snapshotHandlerTimeout=void 0}handleDownloadTimeout(){ne.info("download canceled"),this.cancelDownload()}writeTableHeader(){var e,r="";if(this.columns)for(var n=0;n<this.columns.length;n+=1)r+=this.columns[n].name,r+=n===this.columns.length-1?`
|
|
2
2
|
`:",";(e=this.fileWriter)===null||e===void 0||e.write({header:r}).then(()=>null)}startWriteTableBody(){this.columns&&this.gridRanges!=null&&(this.chunkRows=Math.floor(X.DOWNLOAD_CELL_CHUNK/this.columns.length),this.rangedSnapshotsTotal=this.gridRanges.map(e=>(k(e.endRow),k(e.startRow),k(this.chunkRows),Math.ceil((e.endRow-e.startRow+1)/this.chunkRows))),this.snapshotsTotal=this.rangedSnapshotsTotal.reduce((e,r)=>e+r),ne.info("start writing table, total snapshots: ",this.snapshotsTotal),this.makeSnapshot(Math.min(X.SNAPSHOT_BUFFER_SIZE,this.snapshotsTotal)))}writeCsvTable(e){e&&this.writeTableHeader(),this.startWriteTableBody()}writeSnapshot(e,r,n){if(this.currentSnapshotIndex===e&&this.fileWriter){for(;this.snapshotsBuffer.has(this.currentSnapshotIndex);){var a=this.snapshotsBuffer.get(this.currentSnapshotIndex);k(a),this.fileWriter.write({rows:this.convertSnapshotIntoCsv(a)}),this.snapshotsBuffer.delete(this.currentSnapshotIndex),this.currentSnapshotIndex+=1,this.updateDownloadProgress(e)}if(this.snapshotsTotal&&this.currentSnapshotIndex>=this.snapshotsTotal){this.finishDownload();return}}this.snapshotCounter&&this.snapshotsTotal&&this.snapshotCounter<this.snapshotsTotal&&(ne.debug2(`
|
|
3
3
|
current range index: `.concat(this.gridRangeCounter,`,
|
|
4
4
|
snapshotIndexCounter: `).concat(this.snapshotCounter,`,
|
|
@@ -8,4 +8,4 @@ import{r as p,I as s,K as U,L as W,aL as Ve,aK as he,bb as Ke,Z as we,ba as Rt,b
|
|
|
8
8
|
making `).concat(Math.min(X.SNAPSHOT_BUFFER_SIZE-this.snapshotsBuffer.size-this.snapshotPending,this.snapshotsTotal-this.snapshotCounter),` more snapshots
|
|
9
9
|
`)),this.makeSnapshot(Math.min(X.SNAPSHOT_BUFFER_SIZE-this.snapshotsBuffer.size-this.snapshotPending,this.snapshotsTotal-this.snapshotCounter)))}updateDownloadProgress(e){if(e!=null&&this.snapshotsTotal!=null&&this.downloadStartTime!=null){var{onDownloadProgressUpdate:r}=this.props,n=Math.floor(e*100/this.snapshotsTotal),a=e>1?Math.floor((Date.now()-this.downloadStartTime)*(this.snapshotsTotal-e)/e/1e3):null;r(n,a)}}convertSnapshotIntoCsv(e){for(var r="",n=e.added.iterator(),{dh:a,formatter:i}=this.props,o=[];n.hasNext();)o.push(n.next().value);k(this.columns);for(var{useUnformattedValues:l}=this,d=0;d<o.length;d+=1)for(var u=o[d],c=0;c<this.columns.length;c+=1){var{type:h,name:m}=this.columns[c],f=null;if(l){var v,g=(v=e.getData(u,this.columns[c]))!==null&&v!==void 0?v:"";g!==""&&z.isDateType(h)&&(g=a.i18n.DateTimeFormat.format(za,g,a.i18n.TimeZone.getTimeZone(i.timeZone))),f=g.toString()}else{var C=this.getCachedCustomColumnFormatFlag(i,m,h),b=null;if(!C){var w=e.getFormat(u,this.columns[c]);b=w?.formatString!=null?w:null}b?f=i.getFormattedString(e.getData(u,this.columns[c]),h,m,b):f=i.getFormattedString(e.getData(u,this.columns[c]),h,m)}r+=X.csvEscapeString(f),r+=c===this.columns.length-1?`
|
|
10
10
|
`:","}return r}makeSnapshot(e){var r=this;if(!(e<=0)){var{dh:n}=this.props;k(this.gridRangeCounter);var a=0,i=this.gridRanges[this.gridRangeCounter];k(this.tableSubscription),k(this.columns);for(var o=function(){k(i),k(i.startRow),k(i.endRow),k(r.rangedSnapshotCounter),k(r.chunkRows);var d=i.startRow+r.rangedSnapshotCounter*r.chunkRows,u=Math.min(d+r.chunkRows-1,i.endRow),c=r.snapshotCounter;r.cancelableSnapshots.push(Rn.makeCancelable(r.tableSubscription.snapshot(n.RangeSet.ofRange(d,u),r.columns).then(h=>(Ka(h),r.handleSnapshotResolved(h,c,d,u),c)).catch(h=>{ne.error(h)}),h=>{ne.info("snapshot ".concat(h," has been canceled"))})),r.rangedSnapshotCounter+=1,r.snapshotCounter+=1,r.snapshotPending+=1,r.rangedSnapshotCounter>=r.rangedSnapshotsTotal[r.gridRangeCounter]&&(r.gridRangeCounter+=1,r.rangedSnapshotCounter=0,i=r.gridRanges[r.gridRangeCounter]),a+=1};a<e;)o()}}handlePortMessage(e){var{data:r}=e,{download:n,readableStreamPulling:a}=r;if(!this.useBlobFallback){if(n!=null){var{includeColumnHeaders:i}=this;this.makeIframe("".concat(n)),this.writeCsvTable(i)}a!=null&&(this.useBlobFallback||(this.streamTimeout!=null&&clearTimeout(this.streamTimeout),this.streamTimeout=setTimeout(this.handleDownloadTimeout,X.STREAM_TIMEOUT)))}}handleSnapshotResolved(e,r,n,a){this.snapshotHandlerTimeout=setTimeout(()=>{this.snapshotsBuffer.set(r,e),this.snapshotPending-=1,this.writeSnapshot(r,n,a),this.cancelableSnapshots[r]=null},X.SNAPSHOT_HANDLER_TIMEOUT)}makeIframe(e){var r=document.createElement("iframe");r.hidden=!0,r.src=e,r.name="iframe",document.body.appendChild(r),this.iframe=r}removeIframe(){var e;(e=this.iframe)===null||e===void 0||e.remove(),this.iframe=void 0}render(){return null}}A(X,"DOWNLOAD_CELL_CHUNK",6e3);A(X,"SNAPSHOT_BUFFER_SIZE",5);A(X,"STREAM_TIMEOUT",8e3);A(X,"SNAPSHOT_HANDLER_TIMEOUT",5);A(X,"defaultProps",{isDownloading:!1,onDownloadCompleted:()=>{},onDownloadCanceled:()=>{},onDownloadProgressUpdate:()=>{}});function qa(t){var e,{group:r,onDelete:n,onColorChange:a,onNameChange:i,validateName:o}=t,{isNew:l}=r,d=p.useRef(r),u=p.useRef(null),c=p.useRef(null),[h,m]=p.useState(!1),[f,v]=p.useState(l?"":r.name),[g,C]=p.useState(l),[b,w]=p.useState(!1),S=f!==r.name?o(f):"",j=l&&!b||S==="",y=p.useCallback(()=>{m(!1)},[]);p.useEffect(function(){g&&u.current&&(u.current.focus(),u.current.select())},[g]),p.useEffect(function(){return()=>{d.current.isNew&&n(d.current)}},[n]),p.useEffect(function(){if(h){var O,P;(O=c.current)===null||O===void 0||O.click(),(P=c.current)===null||P===void 0||P.focus(),window.addEventListener("click",y,!0)}return()=>window.removeEventListener("click",y,!0)},[h,y]);var I=()=>{j&&(i(r,f),C(!1))},T=()=>{if(l){n(r);return}v(r.name),C(!1)},D=x=>{w(!0),x.key==="Enter"&&(x.stopPropagation(),I()),x.key===" "&&x.stopPropagation(),x.key==="Escape"&&T()};return g?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"editing-container",children:[s.jsx("input",{ref:u,className:U("form-control",{"is-invalid":!j}),value:f,placeholder:"Group Name",onChange:x=>v(x.target.value),onKeyDown:D,onBlur:()=>w(!0)}),s.jsx(E,{kind:"ghost",icon:en,tooltip:"Confirm",onClick:I}),s.jsx(E,{kind:"ghost",icon:rn,tooltip:"Cancel",onClick:T})]}),!j&&s.jsx("p",{className:"mb-0 validate-label-error text-danger",children:S})]}):s.jsxs("div",{className:"group-name-wrapper",children:[s.jsx("span",{className:"column-name",children:f}),s.jsx(E,{className:"p-1 mx-1",kind:"ghost",icon:st,tooltip:"Edit",onClick:()=>{C(!0)}}),s.jsxs("span",{className:"right-buttons",children:[s.jsx(E,{kind:"ghost",icon:Oe,tooltip:"Delete group",onClick:()=>n(r)}),s.jsx(E,{kind:"ghost",className:"color-swatch mr-1",icon:r.color!==void 0?s.jsxs("span",{className:"fa-layers",children:[s.jsx(W,{className:"color-swatch",icon:ar,color:K.white,transform:"down-1"}),s.jsx(W,{className:"color-swatch",icon:ar,color:r.color,transform:"shrink-2 down-1"})]}):tn,tooltip:"Set color",onClick:()=>m(x=>!x)}),h&&s.jsxs(s.Fragment,{children:[s.jsx("input",{"aria-label":"Color input",ref:c,type:"color",list:"presetColors",value:(e=r.color)!==null&&e!==void 0?e:K["content-bg"],style:{visibility:"hidden",width:0,height:0,padding:0,border:0},onChange:x=>{r.color=x.target.value,a(r,x.target.value)}}),s.jsxs("datalist",{id:"presetColors",children:[s.jsx("option",{children:K["content-bg"]}),s.jsx("option",{children:K.primary}),s.jsx("option",{children:K.foreground}),s.jsx("option",{children:K.green}),s.jsx("option",{children:K.yellow}),s.jsx("option",{children:K.orange}),s.jsx("option",{children:K.red}),s.jsx("option",{children:K.purple}),s.jsx("option",{children:K.blue}),s.jsx("option",{children:K["gray-400"]})]})]})]})]})}function Fr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function _r(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Fr(Object(r),!0).forEach(function(n){Xa(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Fr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Xa(t,e,r){return e=Ya(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ya(t){var e=Za(t,"string");return typeof e=="symbol"?e:String(e)}function Za(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Qa(){}var Ja=p.forwardRef(function(e,r){var{value:n,clone:a,childCount:i,item:o,onVisibilityChange:l,onClick:d,onGroupDelete:u,onGroupColorChange:c,onGroupNameChange:h,validateGroupName:m,handleProps:f}=e,{group:v,modelIndex:g,isVisible:C}=o.data,b=p.useRef(null),w=p.useCallback(j=>{if(j.buttons===1){var y;l([g].flat(),!C),(y=b.current)===null||y===void 0||y.focus()}},[l,g,C]),S=p.useCallback(j=>{d(n,j)},[d,n]);return s.jsxs("div",_r(_r({ref:r,className:U("tree-item",{isSelected:o.selected,"two-dragged":i===2,"multiple-dragged":i>2}),onClick:S},f),{},{children:[s.jsx(E,{ref:b,kind:"ghost",className:"px-1",onClick:Qa,onMouseDown:w,onMouseEnter:w,icon:C?ht:vt,tooltip:"Toggle visibility"}),s.jsx("span",{className:U("column-name",v&&"column-group"),children:v&&!a?s.jsx(qa,{group:v,onDelete:u,onColorChange:c,onNameChange:h,validateName:m}):n}),s.jsxs("div",{children:[a&&i>1&&s.jsx("span",{className:"item-count",children:i}),s.jsx(Ge,{children:"Drag to re-order"}),s.jsx(W,{icon:ut})]})]}))});const ei=Ja;function ri(t){return t.parentId!==void 0}function Lr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Hr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Lr(Object(r),!0).forEach(function(n){ti(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Lr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ti(t,e,r){return e=ni(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ni(t){var e=ai(t,"string");return typeof e=="symbol"?e:String(e)}function ai(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ii(t,e){return Math.round(t/e)}function wt(t,e,r,n,a,i){var o=t.findIndex(u=>u.name===n);if(o===-1){var l=r.get(n);if(l==null)throw new Error("Column or header group not found: ".concat(n));var d=l.childIndexes.flat();return{id:n,selected:i.has(n),children:l.children.map(u=>wt(t,e,r,u,a,i)).sort((u,c)=>{var h=Array.isArray(u.data.visibleIndex)?u.data.visibleIndex[0]:u.data.visibleIndex,m=Array.isArray(c.data.visibleIndex)?c.data.visibleIndex[0]:c.data.visibleIndex;return h-m}),data:{modelIndex:d,visibleIndex:l.getVisibleRange(e),group:l,isVisible:d.some(u=>!a.has(u))}}}return{id:n,children:[],selected:i.has(n),data:{modelIndex:o,visibleIndex:M.getVisibleIndex(o,e),isVisible:!a.has(o)}}}function oi(t,e,r,n,a){for(var i=[],o=new Set(a),l=new Map(r.map(h=>[h.name,h])),d=new Set(n),u=0,c=function(){for(var m=M.getModelIndex(u,e),f=t[m].name,v=r.find(C=>{var{children:b}=C;return b.includes(f)});v!==void 0&&v.parent!==void 0;)v=l.get(v.parent);var g=wt(t,e,l,v?v.name:f,d,o);i.push(g),Array.isArray(g.data.visibleIndex)?u+=g.data.visibleIndex[1]-g.data.visibleIndex[0]+1:u+=1};u<t.length;)c();return i}function Ae(t,e,r,n,a){var i=t.findIndex(b=>{var{id:w}=b;return w===r}),o=t.findIndex(b=>{var{id:w}=b;return w===e}),l=t[o],d=At(t,o,i),u=d[i-1],c=d[i+1],h=ii(n,a),m=l.depth+h,f=li({previousItem:u,nextItem:c}),v=si({nextItem:c}),g=m;return m>=f?g=f:m<v&&(g=v),{depth:g,maxDepth:f,minDepth:v,parentId:C()};function C(){var b;if(g===0||!u)return null;if(g===u.depth)return u.parentId;if(g>u.depth)return u.id;var w=(b=d.slice(0,i).reverse().find(S=>S.depth===g))===null||b===void 0?void 0:b.parentId;return w??null}}function li(t){var e,r,{previousItem:n,nextItem:a}=t;return Math.max((e=n?.depth)!==null&&e!==void 0?e:0,(r=a?.depth)!==null&&r!==void 0?r:0)}function si(t){var{nextItem:e}=t;return e?e.depth:0}function Ot(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return t.reduce((n,a,i)=>[...n,Hr(Hr({},a),{},{parentId:e,depth:r,index:i}),...Ot(a.children,a.id,r+1)],[])}function q(t){return t.every(ri)?[...t]:Ot(t)}function yt(t,e){for(var r=0;r<t.length;r+=1){var n=t[r],{id:a,children:i}=n;if(a===e)return n;if(i.length){var o=yt(i,e);if(o)return o}}}function xt(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return t.reduce((r,n)=>{var{children:a}=n;return a.length?xt(a,r+1):r+1},e)}function di(t,e){var r=yt(t,e);return r?xt(r.children):0}function $r(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function je(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?$r(Object(r),!0).forEach(function(n){ui(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):$r(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ui(t,e,r){return e=ci(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ci(t){var e=hi(t,"string");return typeof e=="symbol"?e:String(e)}function hi(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var vi=[re.Down,re.Right,re.Up,re.Left],mi=[re.Left,re.Right];function fi(t,e,r){return(n,a)=>{var{currentCoordinates:i,context:{active:o,over:l,collisionRect:d,droppableRects:u,droppableContainers:c}}=a;if(vi.includes(n.code)){if(!o||!d)return;n.preventDefault();var{current:{items:h,offset:m}}=t;if(mi.includes(n.code)&&l?.id!=null){var{depth:f,maxDepth:v,minDepth:g}=Ae(h,o.id,l.id,m,r);switch(n.code){case re.Left:if(f>g)return je(je({},i),{},{x:i.x-r});break;case re.Right:if(f<v)return je(je({},i),{},{x:i.x+r});break}return}var C=[];c.forEach(F=>{if(!(F!=null&&F.disabled||F.id===l?.id)){var G=u.get(F.id);if(G)switch(n.code){case re.Down:d.top<G.top&&C.push(F);break;case re.Up:d.top>G.top&&C.push(F);break}}});var b=Mt({active:o,collisionRect:d,pointerCoordinates:null,droppableRects:u,droppableContainers:C}),w=kt(b,"id");if(w===l?.id&&b.length>1&&(w=b[1].id),w!=null&&l?.id!=null){var S=u.get(o.id),j=u.get(w),y=c.get(w);if(S&&j&&y){var I=h.findIndex(F=>{var{id:G}=F;return G===w}),T=h[I],D=h.findIndex(F=>{var{id:G}=F;return G===o.id}),x=h[D];if(T!=null&&x!=null){var{depth:O}=Ae(h,o.id,w,(T.depth-x.depth)*r,r),P=I>D,R=P?1:-1,L=e?(d.height-S.height)/2:0,_={x:j.left+O*r,y:j.top+R*L};return _}}}}}}function gi(t,e,r){return e=pi(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function pi(t){var e=bi(t,"string");return typeof e=="symbol"?e:String(e)}function bi(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class It extends Ft{}gi(It,"activators",[{eventName:"onPointerDown",handler:t=>{var{nativeEvent:e}=t;return!(!e.isPrimary||e.button!==0||Si(e.target))}}]);var Ci=["button","input","textarea","select","option"];function Si(t){return!!(t?.tagName!=null&&Ci.includes(t.tagName.toLowerCase()))}function jt(t){var{clone:e=!1,depth:r,disableInteraction:n=!1,ghost:a=!1,handleProps:i,value:o,dragRef:l=null,wrapperRef:d=null,renderItem:u,item:c,childCount:h}=t,m=p.useMemo(()=>Array(r).fill(0).map((v,g)=>s.jsx("span",{className:"depth-line"},"depth-line-".concat(g))),[r]),f=p.useMemo(()=>({ref:l,clone:e,value:o,item:c,childCount:h,handleProps:i}),[l,e,o,c,h,i]);return s.jsxs("li",{className:U("item-wrapper",{clone:e,ghost:a,disableInteraction:n}),ref:d,children:[!e&&m,u(f)]},o)}jt.displayName="TreeItem";var wi=["id","depth"];function Gr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Pe(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Gr(Object(r),!0).forEach(function(n){Oi(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Gr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Oi(t,e,r){return e=yi(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function yi(t){var e=xi(t,"string");return typeof e=="symbol"?e:String(e)}function xi(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ii(t,e){if(t==null)return{};var r=ji(t,e),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a<i.length;a++)n=i[a],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function ji(t,e){if(t==null)return{};var r={},n=Object.keys(t),a,i;for(i=0;i<n.length;i++)a=n[i],!(e.indexOf(a)>=0)&&(r[a]=t[a]);return r}var Pi=t=>{var{isSorting:e,wasDragging:r}=t;return!(e||r)};function Ur(t){var{id:e,depth:r}=t,n=Ii(t,wi),{attributes:a,isDragging:i,isSorting:o,listeners:l,setDraggableNodeRef:d,setDroppableNodeRef:u,transform:c,transition:h}=_t({id:e,animateLayoutChanges:Pi}),m=He.Translate.toString(c),f=p.useMemo(()=>({transform:m,transition:h}),[m,h]),v=p.useMemo(()=>Pe(Pe(Pe({},a),l),{},{style:f}),[a,l,f]);return s.jsx(jt,Pe({dragRef:d,wrapperRef:u,depth:r,ghost:i,disableInteraction:o,handleProps:v},n))}function Br(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Me(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Br(Object(r),!0).forEach(function(n){Di(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Br(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Di(t,e,r){return e=Ti(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ti(t){var e=Ni(t,"string");return typeof e=="symbol"?e:String(e)}function Ni(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Ei={keyframes(t){var{transform:e}=t;return[{opacity:1,transform:He.Transform.toString(e.initial)},{opacity:0,transform:He.Transform.toString(Me(Me({},e.final),{},{x:e.final.x+5,y:e.final.y+5}))}]},easing:"ease-out",sideEffects(t){var{active:e}=t;e.node.animate([{opacity:0},{opacity:1}],{duration:tr.duration,easing:tr.easing})}},De=null;function Ri(t){var e;return De==null&&t.activeNodeRect&&t.activatorEvent instanceof PointerEvent&&(De=Math.floor((t.activatorEvent.clientY-t.activeNodeRect.top)/t.activeNodeRect.height)*t.activeNodeRect.height),t.activeNodeRect||(De=null),Me(Me({},t.transform),{},{y:t.transform.y+((e=De)!==null&&e!==void 0?e:0)})}function Ai(t){var{items:e,renderItem:r,indentationWidth:n=30,indicator:a=!1,activeId:i,overId:o,offsetLeft:l}=t,d=Lt(),u=p.useRef(d);p.useEffect(function(){u.current=d},[d]),p.useEffect(function(){u.current.measureDroppableContainers(e.map(v=>{var{id:g}=v;return g}))},[e]);var c=i!=null&&o!=null?Ae(e,i,o,l,n):null,h=p.useRef({items:e,offset:l}),m=i!=null?e.find(f=>{var{id:v}=f;return v===i}):null;return p.useEffect(()=>{h.current={items:e,offset:l}},[e,l]),s.jsxs(s.Fragment,{children:[s.jsx("div",{className:U("tree-container",i!=null&&"marching-ants"),children:e.map(f=>{var{id:v,depth:g}=f;return s.jsx(Ur,{id:v,value:v,depth:v===i&&c?c.depth:g,item:f,renderItem:r},v)})}),Ht.createPortal(s.jsx($t,{dropAnimation:Ei,modifiers:[Ri],className:"visibility-ordering-list",children:i!=null&&m?s.jsx(Ur,{id:i,depth:m.depth,clone:!0,childCount:di(e,i)+1,value:i.toString(),renderItem:r,item:m}):null}),document.body)]})}function Wr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Te(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Wr(Object(r),!0).forEach(function(n){Mi(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Wr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Mi(t,e,r){return e=ki(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ki(t){var e=Fi(t,"string");return typeof e=="symbol"?e:String(e)}function Fi(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var _i={droppable:{strategy:Vt.Always}},Li={activationConstraint:{distance:5}};function Hi(t){var{items:e,indicator:r=!1,indentationWidth:n=30,onDragStart:a,onDragEnd:i,renderItem:o}=t,[l,d]=p.useState(null),[u,c]=p.useState(null),[h,m]=p.useState(0),f=p.useMemo(()=>{var x=q(e);return l!=null?x.filter(O=>{var{id:P,selected:R}=O;return P===l||!R}):x},[l,e]),v=l!=null&&u!=null?Ae(f,l,u,h,n):null,g=p.useRef({items:f,offset:h}),C=p.useMemo(()=>({coordinateGetter:fi(g,r,n)}),[n,r]),b=Gt(nr(It,Li),nr(Kt,C)),w=p.useMemo(()=>f.map(x=>{var{id:O}=x;return O}),[f]);p.useEffect(()=>{g.current={items:f,offset:h}},[f,h]);var S=p.useCallback(x=>{var{active:{id:O}}=x;d(O),c(O),a?.(O),document.body.style.setProperty("cursor","grabbing")},[a]),j=p.useCallback(x=>{var{delta:O}=x;m(O.x)},[]),y=p.useCallback(x=>{var O,{over:P}=x;c((O=P?.id)!==null&&O!==void 0?O:null)},[]),I=p.useCallback(()=>{c(null),d(null),m(0),document.body.style.setProperty("cursor","")},[]),T=p.useCallback(x=>{var{active:O,over:P}=x;if(I(),v&&P){var{depth:R,parentId:L}=v,_=JSON.parse(JSON.stringify(q(e))),F=_.findIndex(B=>{var{id:ie}=B;return ie===P.id}),G=_.findIndex(B=>{var{id:ie}=B;return ie===O.id}),$=_[G];_[G]=Te(Te({},$),{},{depth:R,parentId:L}),i?.($,Te(Te({},_[F]),{},{parentId:v.parentId}))}},[e,i,v,I]),D=p.useCallback(()=>{I()},[I]);return s.jsx(Ut,{sensors:b,collisionDetection:Bt,measuring:_i,onDragStart:S,onDragMove:j,onDragOver:y,onDragEnd:T,onDragCancel:D,children:s.jsx(Wt,{items:w,strategy:zt,children:s.jsx(Ai,{items:f,renderItem:o,indicator:r,indentationWidth:n,activeId:l,overId:u,offsetLeft:h})})})}function zr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Vr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?zr(Object(r),!0).forEach(function(n){$i(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):zr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function $i(t,e,r){return e=Gi(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Gi(t){var e=Ui(t,"string");return typeof e=="symbol"?e:String(e)}function Ui(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Bi(t,e,r,n,a,i,o,l){var d=a.map((j,y)=>Vr(Vr({},j),{},{index:y})),u=[],c=n,h=i[0].data.visibleIndex,m=d.findIndex(j=>{var{id:y}=j;return y===t.id}),f=d.findIndex(j=>{var{id:y}=j;return y===e.id}),v=Array.isArray(h)?h[1]+1:h+1;c=se(i[0],e.parentId,c);for(var g=1;g<i.length;g+=1){var{data:{visibleIndex:C}}=i[g];u=M.moveItemOrRange(C,v,u,!0),v+=Array.isArray(C)?C[1]-C[0]+1:1,c=se(i[g],e.parentId,c)}var b=[Array.isArray(h)?h[0]:h,v-1],w=Array.isArray(e.data.visibleIndex)?e.data.visibleIndex[0]:e.data.visibleIndex,S=M.getVisibleIndex(w,u);return m>f&&S>w&&(S-=1),e.children.length>0&&(Array.isArray(h)?h[0]:h)<S&&(S-=1),b[0]<S&&(S-=b[1]-b[0]),u=M.moveItemOrRange(b,$e(S,o,l),u),{groups:c,movedColumns:r.concat(u)}}function se(t,e,r){if(t.parentId===e)return[...r];var n=r.map(C=>new ce(C)),a=new Map(n.map(C=>[C.name,C])),i=n.find(C=>C.name===t.parentId),o=n.find(C=>C.name===e),l=n.find(C=>C.name===t.id);if(i!=null&&(i.children=i.children.filter(C=>C!==t.id),i.children.length===0)){var d,u=new Set([i.name]),{parent:c=""}=i,h=a.get(c);for((d=h)===null||d===void 0||d.removeChildren([i.name]);h&&h.children.length===0;){var m,f;u.add(h.name);var v=(m=(f=h)===null||f===void 0?void 0:f.parent)!==null&&m!==void 0?m:"",g=a.get(v);g?.removeChildren([h.name]),h=g}n=n.filter(C=>{var{name:b}=C;return!u.has(b)})}return o?.addChildren([t.id]),l?.setParent(e??void 0),n}function Kr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function pe(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Kr(Object(r),!0).forEach(function(n){Y(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Kr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Y(t,e,r){return e=Wi(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Wi(t){var e=zi(t,"string");return typeof e=="symbol"?e:String(e)}function zi(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Vi=150;class H extends p.PureComponent{static shouldRenderColumn(e){return e.isProxy!==!0}constructor(e){super(e),Y(this,"list",void 0),Y(this,"debouncedSearchColumns",lt(this.searchColumns,Vi)),Y(this,"handleGroupColorChange",qt((r,n)=>{var{columnHeaderGroups:a,onColumnHeaderGroupChanged:i}=this.props,o=[...a],l=new ce(pe(pe({},r),{},{color:n}));o.splice(o.findIndex(d=>{var{name:u}=d;return u===r.name}),1,l),i(o)},250)),Y(this,"renderItem",le(r=>{var{value:n,clone:a,item:i,ref:o,handleProps:l}=r,{onColumnVisibilityChanged:d}=this.props,{selectedColumns:u}=this.state,c=n;if(a){var h=this.getSelectedParentItems().map(m=>{var{id:f}=m;return f});c=h.join(", ")}return s.jsx(ei,{ref:o,value:c,clone:a,item:i,childCount:u.size,onVisibilityChange:d,onClick:this.handleItemClick,onGroupDelete:this.handleGroupDelete,onGroupColorChange:this.handleGroupColorChange,onGroupNameChange:this.handleGroupNameChange,validateGroupName:this.validateGroupName,handleProps:l})})),Y(this,"getMemoizedFirstMovableIndex",le((r,n,a)=>{for(var i=0;i<n.length;i+=1){var o=M.getModelIndex(i,a);if(r.isColumnMovable(o))return i}return null})),Y(this,"getMemoizedLastMovableIndex",le((r,n,a)=>{for(var i=n.length-1;i>=0;i-=1){var o=M.getModelIndex(i,a);if(r.isColumnMovable(o))return i}return null})),Y(this,"memoizedGetTreeItems",le((r,n,a,i,o)=>oi(r,n,a,i,[...o.values()]))),Y(this,"makeVisibilityOrderingList",le((r,n)=>{var{movedColumns:a}=this.props,i=[],o=this.getFirstMovableIndex(),l=this.getLastMovableIndex(),d=n.findIndex(j=>{var{data:y}=j;return Array.isArray(y.visibleIndex)?y.visibleIndex[0]===o:y.visibleIndex===o}),u=n.findIndex(j=>{var{data:y}=j;return Array.isArray(y.visibleIndex)?y.visibleIndex[1]===l:y.visibleIndex===l}),c=n.slice(d,u+1);if(o==null||l===null){for(var h=0;h<r.length;h+=1){var m=M.getModelIndex(h,a),f=r[m];H.shouldRenderColumn(f)&&i.push(this.renderImmovableItem(f.name))}return i}for(var v=0;v<o;v+=1){var g=M.getModelIndex(v,a),C=r[g];H.shouldRenderColumn(C)&&i.push(this.renderImmovableItem(C.name))}o!==null&&o>0&&i.push(s.jsx("hr",{},"top-horizontal-divider")),i.push(s.jsx(Hi,{items:c,renderItem:this.renderItem,onDragStart:this.handleDragStart,onDragEnd:this.handleDragEnd},"movable-items")),l!=null&&l<r.length-1&&i.push(s.jsx("hr",{},"bottom-horizontal-divider"));for(var b=l+1;b<r.length;b+=1){var w=M.getModelIndex(b,a),S=r[w];H.shouldRenderColumn(S)&&i.push(this.renderImmovableItem(S.name))}return i})),Y(this,"renderImmovableItem",le(r=>s.jsx("div",{className:"visibility-ordering-list-item immovable",children:s.jsx("div",{className:"column-item",children:s.jsx("span",{className:"column-name",children:r})})},r))),this.handleSearchInputChange=this.handleSearchInputChange.bind(this),this.searchColumns=this.searchColumns.bind(this),this.handleItemClick=this.handleItemClick.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleGroupDelete=this.handleGroupDelete.bind(this),this.handleGroupNameChange=this.handleGroupNameChange.bind(this),this.handleGroupCreate=this.handleGroupCreate.bind(this),this.validateGroupName=this.validateGroupName.bind(this),this.addColumnToSelected=this.addColumnToSelected.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.state={selectedColumns:new Set,queriedColumnIndex:void 0,queriedColumnRange:void 0,prevQueriedColumns:void 0,lastSelectedColumn:"",searchFilter:""},this.list=null}componentDidUpdate(e){var{movedColumns:r}=this.props;if(r!==e.movedColumns){var{searchFilter:n}=this.state;this.searchColumns(n,!1)}}componentWillUnmount(){this.debouncedSearchColumns.cancel()}resetVisibilityOrdering(){var{model:e,onReset:r,onMovedColumnsChanged:n,onColumnHeaderGroupChanged:a}=this.props;this.setState({selectedColumns:new Set,queriedColumnIndex:void 0,queriedColumnRange:void 0,prevQueriedColumns:void 0,lastSelectedColumn:"",searchFilter:""}),r(),a(e.initialColumnHeaderGroups),n(e.initialMovedColumns)}resetSelection(){this.setState({selectedColumns:new Set,lastSelectedColumn:""})}handleSearchInputChange(e){var r=e.target.value;if(this.setState({searchFilter:r}),!r){this.debouncedSearchColumns.cancel(),this.resetSelection();return}this.debouncedSearchColumns(r)}searchColumns(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=q(this.getTreeItems()),a=n.filter(c=>{var h,m,{id:f,data:v}=c;return!((h=(m=v.group)===null||m===void 0?void 0:m.isNew)!==null&&h!==void 0&&h)&&f.toLowerCase().includes(e.toLowerCase())}),i=a.reduce((c,h)=>{var{id:m}=h,f=n.findIndex(v=>v.id===m);return pe(pe({},c),{},{[f]:m})},{});if(!r){this.setState({prevQueriedColumns:i});return}var o=a.map(c=>{var{id:h}=c;return h});if(this.addColumnToSelected(o,!1),o.length>0){var l,d=n.findIndex(c=>{var{id:h}=c;return h.toLowerCase().includes(e.toLowerCase())}),u=(l=this.list)===null||l===void 0?void 0:l.querySelectorAll(".item-wrapper")[d];u?.scrollIntoView({block:"center"})}this.setState({prevQueriedColumns:i,queriedColumnIndex:void 0})}changeSelectedColumn(e){var r,{queriedColumnIndex:n,queriedColumnRange:a,prevQueriedColumns:i}=this.state,o=n;if(i!==void 0){var l=Object.keys(i).length;e==="forward"?a!==void 0?o=a.nextIndex:o===void 0||o>=l-1?o=0:o+=1:e==="back"&&(a!==void 0?o=a.prevIndex:o===void 0||o<=0?o=l-1:o-=1),this.addColumnToSelected([Object.values(i)[o]],!1);var d=parseInt(Object.keys(i)[o],10),u=(r=this.list)===null||r===void 0?void 0:r.querySelectorAll(".item-wrapper")[d];u?.scrollIntoView({block:"center"}),this.setState({queriedColumnIndex:o,queriedColumnRange:void 0})}}adjustQueriedIndex(e){var{prevQueriedColumns:r}=this.state;if(r!==void 0){if(e in Object.values(r)){var n=Object.values(r).indexOf(e);this.setState({queriedColumnIndex:n,queriedColumnRange:void 0});return}for(var a=q(this.getTreeItems()),i=a.findIndex(h=>h.id===e),o=Object.keys(r).map(h=>parseInt(h,10)),l=o.length-1,d=0,u=0;u<o.length;u+=1){var c=o[u];if(c<i)l=u;else if(c>i){d=u;break}}this.setState({queriedColumnRange:{prevIndex:l,nextIndex:d}})}}moveSelectedColumns(e){var{columnHeaderGroups:r}=this.props,{selectedColumns:n}=this.state,a=q(this.getTreeItems()),i=this.getFirstMovableIndex(),o=this.getLastMovableIndex();k(i),k(o);var l=this.getSelectedParentItems(),d=e===H.MOVE_OPTIONS.UP||e===H.MOVE_OPTIONS.TOP;d||l.reverse();for(var u=[],c=r,h=function(){var{id:v,parentId:g,depth:C,data:{visibleIndex:b}}=l[m];switch(e){case H.MOVE_OPTIONS.TOP:{u=M.moveItemOrRange(b,i,u,!0);var w=Array.isArray(b)?b[1]-b[0]+1:1;i+=w,c=se(l[m],null,c);break}case H.MOVE_OPTIONS.BOTTOM:{u=M.moveItemOrRange(b,o,u,!0);var S=Array.isArray(b)?b[1]-b[0]+1:1;o-=S,c=se(l[m],null,c);break}case H.MOVE_OPTIONS.UP:{var j=a.findIndex($=>$.id===v),y=a.map(($,B)=>B<j&&!n.has($.id)).lastIndexOf(!0),I=a[y];if(I!=null&&I.parentId!==g)if(Math.abs(I.depth-C)>1){var T=a.map(($,B)=>B<y&&$.depth===C).lastIndexOf(!0),D=a[T];c=se(l[m],D.id,c)}else c=se(l[m],I.parentId,c);else{var x=$e(Array.isArray(b)?b[0]-1:b-1,i,o);u=M.moveItemOrRange(b,x,u,!1);var O=Array.isArray(b)?b[1]-b[0]+1:1;i+=O}break}case H.MOVE_OPTIONS.DOWN:{var P=a.findIndex($=>$.id===v),R=a.find(($,B)=>B>P&&!n.has($.id));if(R?.parentId!==g){var L,_=a.find($=>$.id===g);c=se(l[m],(L=_?.parentId)!==null&&L!==void 0?L:null,c);break}else if(R?.children.length>0){c=se(l[m],R.id,c);break}var F=$e(Array.isArray(b)?b[0]+1:b+1,i,o);u=M.moveItemOrRange(b,F,u,!1);var G=Array.isArray(b)?b[1]-b[0]+1:1;o-=G;break}}},m=0;m<l.length;m+=1)h();return{newMoves:u,groups:c}}handleMoveColumns(e){var{onMovedColumnsChanged:r,movedColumns:n,onColumnHeaderGroupChanged:a}=this.props,{newMoves:i,groups:o}=this.moveSelectedColumns(e),l;e===H.MOVE_OPTIONS.TOP&&(l=()=>{var d,u;(d=this.list)===null||d===void 0||(u=d.parentElement)===null||u===void 0||u.scroll({top:0})}),e===H.MOVE_OPTIONS.BOTTOM&&(l=()=>{var d,u;(d=this.list)===null||d===void 0||(u=d.parentElement)===null||u===void 0||u.scroll({top:this.list.parentElement.scrollHeight})}),a(o),i.length>0&&r(n.concat(i),l)}getSortMoves(e,r,n){var a=[...e],i=r===H.SORTING_OPTIONS.ASC;a.sort((m,f)=>{var v=m.id.toUpperCase(),g=f.id.toUpperCase();return An.sort(v,g,i)});for(var o=[...n],l=Math.min(...a.flatMap(m=>{var{modelIndex:f}=m.data;return Array.isArray(f)?M.getVisibleIndexes(f,o):M.getVisibleIndex(f,o)})),d=0;d<a.length;d+=1){var u=a[d],{modelIndex:c}=u.data,h=Array.isArray(c)?M.getVisibleIndexes(c,o):M.getVisibleIndex(c,o);o=Array.isArray(h)?M.moveRange([Math.min(...h),Math.max(...h)],l,o,!0):M.moveItem(h,l,o),Array.isArray(h)&&(o=this.getSortMoves(u.children,r,o)),l+=Array.isArray(c)?c.length:1}return o}handleSortColumns(e){for(var r,n,{model:a,onMovedColumnsChanged:i}=this.props,o=this.getTreeItems(),l=(r=this.getFirstMovableIndex())!==null&&r!==void 0?r:0,d=(n=this.getLastMovableIndex())!==null&&n!==void 0?n:o.length-1,u=o.slice(l,d+1),c=[...a.initialMovedColumns],h=0;h<a.frozenColumns.length;h+=1){var m,f=a.frozenColumns[h],v=M.getVisibleIndex((m=a.getColumnIndexByName(f))!==null&&m!==void 0?m:0,c);v!==h&&c.push({from:v,to:h})}var g=this.getSortMoves(u,e,c);i(g)}handleItemClick(e,r){if(r.stopPropagation(),!(r.target instanceof HTMLElement&&(r.target.tagName==="BUTTON"||r.target.tagName==="INPUT"))){r.currentTarget.focus();var{selectedColumns:n,lastSelectedColumn:a}=this.state,i=M.isModifierKeyDown(r),o=r.shiftKey,l=n.has(e),d=[e];if(l&&i){this.removeColumnFromSelected(e);return}var u=q(this.getTreeItems());if(l&&!o&&a===e){var c=u.find(v=>{var{id:g}=v;return g===e});k(c);var h=q(c.children).length;if(h+1===n.size){this.resetSelection();return}}if(o){var m=u.findIndex(v=>v.id===e),f=u.findIndex(v=>v.id===a);d.push(...u.slice(Math.min(f,m),Math.max(f,m)+1).map(v=>v.id))}this.addColumnToSelected(d,i||o),this.adjustQueriedIndex(e),this.setState({lastSelectedColumn:e})}}addColumnToSelected(e,r){var{selectedColumns:n}=this.state,a=new Set(r?[...n.values()].concat(e):e),i=q(this.getTreeItems());i.forEach(o=>{var{id:l,children:d}=o;a.has(l)&&d.forEach(u=>a.add(u.id))}),this.setState({selectedColumns:a})}removeColumnFromSelected(e){var{selectedColumns:r}=this.state,n=q(this.getTreeItems()),a=n.find(l=>{var{id:d}=l;return d===e});k(a);var i=n.find(l=>{var{id:d}=l;return d===a.parentId});q(a?.children).forEach(l=>r.delete(l.id));for(var o=function(){r.delete(i.id);var d=i.parentId;i=n.find(u=>{var{id:c}=u;return c===d})};i!=null;)o();r.delete(e),this.setState({selectedColumns:new Set(r)})}handleDragStart(e){var{selectedColumns:r}=this.state;r.has(e)||this.addColumnToSelected([e],!1)}handleDragEnd(e,r){var{movedColumns:n,onMovedColumnsChanged:a,columnHeaderGroups:i,onColumnHeaderGroupChanged:o}=this.props,l=this.getSelectedParentItems(),d=q(this.getTreeItems()).map((f,v)=>pe(pe({},f),{},{index:v})),u=this.getFirstMovableIndex(),c=this.getLastMovableIndex();k(u),k(c);var{groups:h,movedColumns:m}=Bi(e,r,n,i,d,l,u,c);o(h),a(m)}handleGroupNameChange(e,r){var{columnHeaderGroups:n,onColumnHeaderGroupChanged:a}=this.props,i=[...n],o=e.name,l=i.findIndex(m=>{var{name:f}=m;return f===o}),d=i[l];k(d);var u=new ce(d);u.name=r,i.splice(l,1,u);var c=i.findIndex(m=>{var{name:f}=m;return f===u.parent});if(c>=0){var h=new ce(i[c]);h.removeChildren([o]),h.addChildren([r]),i.splice(c,1,h)}a(i)}handleGroupDelete(e){var{columnHeaderGroups:r,onColumnHeaderGroupChanged:n}=this.props,a=r.filter(l=>l.name!==e.name),i=a.findIndex(l=>l.name===e.parent);if(i>=0){var o=new ce(a[i]);o.addChildren(e.children),o.removeChildren([e.name]),a.splice(i,1,o)}n(a)}handleGroupCreate(){var{movedColumns:e,onMovedColumnsChanged:r,onColumnHeaderGroupChanged:n}=this.props,{newMoves:a,groups:i}=this.moveSelectedColumns(H.MOVE_OPTIONS.TOP),o=i.filter(h=>!h.isNew),l=this.getSelectedParentItems(),d=l.map(h=>h.data.modelIndex).flat().filter(h=>h>=0),u="".concat(ce.NEW_GROUP_PREFIX,"-").concat(Date.now()),c=new ce({name:u,children:l.map(h=>{var{id:m}=h;return m}),depth:0,childIndexes:[...new Set(d)]});r(e.concat(a),()=>{var h,m;(h=this.list)===null||h===void 0||(m=h.parentElement)===null||m===void 0||m.scroll({top:0})}),n(o.concat([c])),this.resetSelection()}validateGroupName(e){var{model:r,columnHeaderGroups:n}=this.props,{columns:a}=r;return Ze.isValidColumnName(e)?a.some(i=>{var{name:o}=i;return o===e})||n.some(i=>{var{name:o}=i;return o===e})?"Duplicate name":"":"Invalid name"}getFirstMovableIndex(){var{model:e,movedColumns:r}=this.props;return this.getMemoizedFirstMovableIndex(e,e.columns,r)}getLastMovableIndex(){var{model:e,movedColumns:r}=this.props;return this.getMemoizedLastMovableIndex(e,e.columns,r)}getTreeItems(){var{model:e,movedColumns:r,hiddenColumns:n,columnHeaderGroups:a}=this.props,{selectedColumns:i}=this.state;return this.memoizedGetTreeItems(e.columns,r,a,n,i)}getSelectedParentItems(){var{selectedColumns:e}=this.state,r=q(this.getTreeItems());return r.filter(n=>{var{id:a,parentId:i}=n;return e.has(a)&&!e.has(i??"")})}render(){var{model:e,hiddenColumns:r,onColumnVisibilityChanged:n}=this.props,{selectedColumns:a,searchFilter:i,prevQueriedColumns:o,queriedColumnIndex:l}=this.state,d=a.size>0,u=this.getTreeItems(),c=new Map(q(u).map(S=>[S.id,S.data.modelIndex])),h=new Set(r),m=[...new Set(d?[...a.values()].map(S=>c.get(S)).filter(S=>S!=null).flat():u.map(S=>S.data.modelIndex).flat())],f=m.some(S=>!h.has(S)),v=f?"Hide All":"Show All",g=f?"Hide Selected":"Show Selected",C=this.makeVisibilityOrderingList(e.columns,u),b={index:l,next:S=>this.changeSelectedColumn(S)},w=Object.keys(o??{}).length;return s.jsxs("div",{role:"menu",className:"visibility-ordering-builder",tabIndex:0,children:[s.jsxs("div",{className:"top-menu",children:[s.jsx(E,{kind:"ghost",className:"toggle-visibility-btn",onClick:()=>{n(m,!f)},icon:f?ht:vt,tooltip:"Toggle column visibility",children:d?g:v}),s.jsx(pt,{className:"visibility-search",value:i,matchCount:i?w:void 0,onChange:this.handleSearchInputChange,cursor:b})]}),s.jsxs("div",{className:"top-menu",children:[s.jsx(E,{kind:"ghost",icon:nn,className:"px-1",tooltip:"Reset to default",onClick:()=>{this.resetVisibilityOrdering()},children:"Reset"}),s.jsx("span",{className:"vertical-divider"}),s.jsx(E,{kind:"ghost",icon:Xe,className:"px-1",tooltip:"Sort ascending",onClick:()=>{this.handleSortColumns(H.SORTING_OPTIONS.ASC)}}),s.jsx(E,{kind:"ghost",icon:Ye,className:"px-1",tooltip:"Sort descending",onClick:()=>{this.handleSortColumns(H.SORTING_OPTIONS.DSC)}}),s.jsx("span",{className:"vertical-divider"}),s.jsxs(E,{kind:"ghost",className:"px-1",tooltip:"Create group from selection",disabled:!d,onClick:this.handleGroupCreate,children:[s.jsxs("span",{className:"fa-layers",children:[s.jsx(W,{mask:an,icon:dt,transform:"right-7 down-5 shrink-6"}),s.jsx(W,{icon:on,transform:"right-8 down-6 shrink-8"})]}),"Group"]}),s.jsx("span",{className:"vertical-divider"}),s.jsx(E,{kind:"ghost",icon:ln,className:"px-1",tooltip:"Move selection up",onClick:()=>{this.handleMoveColumns(H.MOVE_OPTIONS.UP)},disabled:!d}),s.jsx(E,{kind:"ghost",icon:sn,className:"px-1",tooltip:"Move selection down",onClick:()=>{this.handleMoveColumns(H.MOVE_OPTIONS.DOWN)},disabled:!d}),s.jsx(E,{kind:"ghost",icon:dn,className:"px-1",tooltip:"Move selection to top",onClick:()=>{this.handleMoveColumns(H.MOVE_OPTIONS.TOP)},disabled:!d}),s.jsx(E,{kind:"ghost",icon:un,className:"px-1",tooltip:"Move selection to bottom",onClick:()=>{this.handleMoveColumns(H.MOVE_OPTIONS.BOTTOM)},disabled:!d})]}),s.jsx("div",{role:"menu",className:U("visibility-ordering-list"),children:s.jsx("div",{className:"column-list",ref:S=>{this.list=S},children:C})})]})}}Y(H,"SORTING_OPTIONS",{DSC:"DSC",ASC:"ASC"});Y(H,"MOVE_OPTIONS",{TOP:"TOP",BOTTOM:"BOTTOM",UP:"UP",DOWN:"DOWN"});const Zo=H;class Qo extends On{getGridY(e){var r=super.getGridY(e),{isFilterBarShown:n,theme:a,advancedFilters:i,quickFilters:o,sorts:l,reverseType:d}=e;return n?r+=a.filterBarHeight:(o!=null&&o.size>0||i!=null&&i.size>0)&&(r+=a.filterBarCollapsedHeight),d!==z.REVERSE_TYPE.NONE&&l!=null&&l.length>0&&(r+=a.reverseHeaderBarHeight),r}getUserColumnWidths(){return this.userColumnWidths}}var Be=16,Ki=new Map([["sortUp",cn],["sortDown",hn],["caretDown",vn],["caretRight",mn],["cellOverflow",fn]]),qi=Ct(t=>{var e=Ki.get(t);if(e===void 0)throw new Error("Icon is undefined");var r=Array.isArray(e.icon[4])?e.icon[4][0]:e.icon[4],n=new Path2D(r),a=new Path2D,i={a:Be/e.icon[0],d:Be/e.icon[1]};return a.addPath(n,i),a},{max:1e3});function Se(t){return qi(t)}class Xi{static drawTreeMarker(e,r,n,a,i,o,l){e.save();var{x1:d,y1:u}=i,c=Se(l?"caretDown":"caretRight"),h=n+d-2,m=a+u+2.5;e.fillStyle=o,e.textAlign="center",e.translate(h,m),e.fill(c),e.restore()}}const Pt=Xi;class Yi extends yn{drawCellContent(e,r,n,a){var i,{metrics:o,model:l}=r,{modelColumns:d,modelRows:u}=o,c=Z(u,a),h=d.get(n);if(h!==void 0){var m=l.valueForCell(h,c);if(z.isTextType((i=l.columns[h])===null||i===void 0?void 0:i.type)&&(m===null||m==="")){var f=e.font;e.font="italic ".concat(f),super.drawCellContent(e,r,n,a),e.font=f;return}super.drawCellContent(e,r,n,a)}}getTextRenderMetrics(e,r,n){var a=M.getTextRenderMetrics(e,r,n),{mouseX:i,mouseY:o,metrics:l,theme:d}=e;if(i==null||o==null)return a;var{column:u,row:c}=M.getGridPointFromXY(i,o,l);if(r===u&&n===c){var{left:h}=this.getCellOverflowButtonPosition(i,o,l,d);this.shouldRenderOverflowButton(e)&&h!=null&&(a.width=h-l.gridX-a.x)}return a}getCellOverflowButtonPosition(e,r,n,a){var i={left:null,top:null,width:null,height:null};if(e==null||r==null||n==null)return i;var{rowHeight:o,columnWidth:l,left:d,top:u}=M.getCellInfoFromXY(e,r,n);if(d==null||l==null||u==null)return i;var{width:c,verticalBarWidth:h}=n,{cellHorizontalPadding:m}=a,f=Be+2*m,v=o,g=Math.min(n.gridX+d+l,c-h),C=g-f,b=n.gridY+u;return{left:C,top:b,width:f,height:v}}shouldRenderOverflowButton(e){var r,n,{context:a,mouseX:i,mouseY:o,metrics:l,model:d,theme:u}=e;if(i==null||o==null)return!1;var{row:c,column:h,modelRow:m,modelColumn:f}=M.getCellInfoFromXY(i,o,l);if(c==null||h==null||m==null||f==null||!z.isStringType(d.columns[f].type))return!1;var v=(r=d.textForCell(f,m))!==null&&r!==void 0?r:"",{width:g}=M.getTextRenderMetrics(e,h,c),C=(n=l.fontWidths.get(u.font))!==null&&n!==void 0?n:ft;a.save(),a.font=u.font;var b=this.getCachedTruncatedString(a,v,g,C,d.truncationCharForCell(f,m));return a.restore(),v!==""&&b!==v}drawTreeMarker(e,r,n,a,i,o,l){Pt.drawTreeMarker(e,r,n,a,i,o,l)}}const Zi=Yi;class Qi extends xn{drawTreeMarker(e,r,n,a,i,o,l){Pt.drawTreeMarker(e,r,n,a,i,o,l)}}const Ji=Qi;function qr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Xr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?qr(Object(r),!0).forEach(function(n){We(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):qr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function We(t,e,r){return e=eo(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function eo(t){var e=ro(t,"string");return typeof e=="symbol"?e:String(e)}function ro(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var _e=Object.freeze({SORT_UP:"sortUp",SORT_DOWN:"sortDown",CARET_DOWN:"caretDown",CARET_RIGHT:"caretRight",CELL_OVERFLOW:"cellOverflow"}),Yr=10;class ze extends In{constructor(){super(...arguments),We(this,"textCellRenderer",new Zi),We(this,"dataBarCellRenderer",new Ji)}static isFilterValid(e,r){var n=e==null||e.filter!=null,a=r==null||r.filter!=null;return n&&a}getSortIcon(e){return e?e.direction===z.sortDirection.ascending?Se(_e.SORT_UP):e.direction===z.sortDirection.descending?Se(_e.SORT_DOWN):null:null}drawCanvas(e){super.drawCanvas(e),this.drawScrim(e)}drawGrid(e,r){super.drawGrid(e,r),this.drawCellOverflowButton(r)}drawGridLines(e,r){super.drawGridLines(e,r),this.drawGroupedColumnLine(e,r),this.drawPendingRowLine(e,r)}drawCellContent(e,r,n,a){var{metrics:i,model:o}=r,{modelColumns:l,modelRows:d}=i,u=l.get(n),c=Z(d,a);if(u!==void 0){var h=o.renderTypeForCell(u,c),m=this.getCellRenderer(h);m.drawCellContent(e,r,n,a)}}getCellOverflowButtonPosition(e){var{mouseX:r,mouseY:n,metrics:a,theme:i}=e;return this.textCellRenderer.getCellOverflowButtonPosition(r,n,a,i)}shouldRenderOverflowButton(e){return this.textCellRenderer.shouldRenderOverflowButton(e)}drawCellOverflowButton(e){var{context:r,mouseX:n,mouseY:a,theme:i}=e;if(!(n==null||a==null)&&this.shouldRenderOverflowButton(e)){var{left:o,top:l,width:d,height:u}=this.getCellOverflowButtonPosition(e),{cellHorizontalPadding:c,overflowButtonColor:h,overflowButtonHoverColor:m}=i;r.save(),m!=null&&o!=null&&d!=null&&l!=null&&u!=null&&n>=o&&n<=o+d&&a>=l&&a<=l+u?r.fillStyle=m:h!=null&&(r.fillStyle=h);var f=Se(_e.CELL_OVERFLOW);o!=null&&l!=null&&r.translate(o+c,l+2),r.fill(f),r.restore()}}drawGroupedColumnLine(e,r){var{metrics:n,model:a,theme:i}=r,{groupedColumns:o}=a,{maxY:l,allColumnWidths:d,allColumnXs:u}=n;if(!(o.length===0||i.groupedColumnDividerColor==null)){var c=o.length-1,h=u.get(c),m=d.get(c);if(!(h==null||m==null)){var f=h+m+.5;e.strokeStyle=i.groupedColumnDividerColor,e.lineWidth=1,e.beginPath(),e.moveTo(f,0),e.lineTo(f,l),e.stroke()}}}drawPendingRowLine(e,r){var{metrics:n,model:a,theme:i}=r,{allRowYs:o,maxX:l}=n,{pendingRowCount:d}=a;if(!(d<=0)){var u=a.rowCount-a.pendingRowCount-a.floatingBottomRowCount,c=o.get(u);c!=null&&(c-=.5,e.save(),e.setLineDash([4,2]),e.strokeStyle=i.pendingTextColor,e.lineWidth=1,e.beginPath(),e.moveTo(0,c),e.lineTo(l,c),e.stroke(),e.restore())}}drawMouseColumnHover(e,r){var{theme:n,metrics:a,hoverSelectColumn:i}=r;if(!(i==null||n.linkerColumnHoverBackgroundColor==null)){var{allColumnWidths:o,allColumnXs:l,maxY:d}=a,u=Z(l,i),c=Z(o,i);e.fillStyle=n.linkerColumnHoverBackgroundColor,e.fillRect(u,0,c,d)}}drawMouseRowHover(e,r){var{isSelectingColumn:n}=r;n||super.drawMouseRowHover(e,r)}drawScrim(e){var{context:r,loadingScrimProgress:n,metrics:a,theme:i}=e;if(n!=null){var{width:o,height:l,gridY:d}=a,{scrimBlurSize:u,scrimColor:c}=i;r.save(),r.globalCompositeOperation="color",r.filter="blur(".concat(u,"px)"),c!=null&&(r.fillStyle=c),r.beginPath(),r.rect(0,d,o,l-d),r.clip(),r.fillRect(-u,-u+d,u*2+o,(u*2+(l-d))*n),r.globalCompositeOperation="source-over",r.filter="blur(".concat(u,"px) opacity(15%)"),r.fillRect(-u,-u+d,u*2+o,(u*2+(l-d))*n),r.restore()}}drawColumnHeaders(e,r){super.drawColumnHeaders(e,r);var{theme:n,metrics:a,model:i,reverseType:o}=r,{columnHeaderHeight:l}=a;if(this.drawFilterHeaders(e,r),!(l<=0)){var{sort:d}=i;if(d.length===1){var u=o!==z.REVERSE_TYPE.NONE,c;u?c=n.headerReverseBarColor:c=n.headerSortBarColor,this.drawHeaderBar(e,r,c,u?n.reverseHeaderBarHeight:n.sortHeaderBarHeight)}else d.length>1&&(o!==z.REVERSE_TYPE.NONE&&this.drawHeaderBar(e,r,n.headerReverseBarColor,n.reverseHeaderBarHeight,!1),this.drawHeaderBar(e,r,n.headerSortBarColor,n.sortHeaderBarHeight))}}drawHeaderBar(e,r,n,a){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,{theme:o,metrics:l,model:d}=r,{columnHeaderHeight:u,width:c}=l,h=0;i||(h=a),e.fillStyle=o.headerBarCasingColor,e.fillRect(0,d.columnHeaderMaxDepth*u-a-2+h,c,a+2),e.fillStyle=n,e.fillRect(0,d.columnHeaderMaxDepth*u-a-1+h,c,a)}drawColumnHeadersAtDepth(e,r,n,a,i){var{metrics:o,model:l,isMenuShown:d}=r,{columnHeaderMaxDepth:u}=l,{width:c}=o,h=Xr(Xr({},a),{},{maxX:i===u-1&&a.maxX===c?c-(d?0:30):a.maxX});super.drawColumnHeadersAtDepth(e,r,n,h,i)}drawColumnHeaderAtIndex(e,r,n,a){var i,o;super.drawColumnHeaderAtIndex(e,r,n,a);var{metrics:l,model:d,theme:u}=r,{modelColumns:c,allColumnWidths:h,allColumnXs:m,gridX:f,columnHeaderHeight:v,fontWidths:g}=l,{headerHorizontalPadding:C}=u,b=Z(h,n,0),w=Z(m,n)+f,S=c.get(n);if(S!=null){var j=(i=d.columns[S])===null||i===void 0?void 0:i.name;if(j!=null){var y=z.getSortForColumn(d.sort,j);if(y){var I=this.getSortIcon(y);if(I){var T=d.textForColumnHeader(S);if(T!==void 0){var D=(o=g.get(e.font))!==null&&o!==void 0?o:ft;k(D);var x=T.length*D,O=f+w+x+C,{maxX:P}=a;P-=C;var R=f+w+b-C-1,L=O>P?O+1:Math.min(P,R),_=y.direction===z.sortDirection.ascending?-6:-12,F=v*.5+_;e.save(),e.beginPath(),e.rect(w,0,b,v),e.clip(),e.fillStyle=u.headerSortBarColor,e.translate(L,F),e.fill(I),e.restore()}}}}}}drawFilterHeaders(e,r){var{isFilterBarShown:n,quickFilters:a,advancedFilters:i}=r;n?this.drawExpandedFilterHeaders(e,r):(a!=null&&a.size>0||i!=null&&i.size>0)&&this.drawCollapsedFilterHeaders(e,r)}drawExpandedFilterHeaders(e,r){var{metrics:n,model:a,theme:i,quickFilters:o,advancedFilters:l}=r,{filterBarHeight:d}=i;if(!(d<=0)){var{gridX:u,gridY:c,maxX:h,modelColumns:m,visibleColumns:f,allColumnWidths:v,allColumnXs:g}=n,C=c-d;e.save(),e.font=i.font,e.textAlign="left",o!=null&&o.size>0||l!=null&&l.size>0?e.fillStyle=i.filterBarExpandedActiveBackgroundColor:e.fillStyle=i.filterBarExpandedBackgroundColor,e.fillRect(u,C,h,d-1),e.fillStyle=i.headerBarCasingColor,e.fillRect(u,C+d-1,h,1);var b=C;e.strokeStyle=i.filterBarSeparatorColor,e.beginPath();for(var w=0;w<f.length;w+=1){var S=f[w],j=Z(m,S),y=Z(g,S),I=Z(v,S);if(a.isFilterable(j)&&I>0){var T=u+(y??0);e.rect(T+.5,b+.5,I,d-2)}}e.stroke();for(var D=0;D<f.length;D+=1){var x=f[D],O=Z(v,x),P=Z(g,x),R=P+u;this.drawExpandedFilterHeader(e,r,x,R,O)}e.restore()}}drawExpandedFilterHeader(e,r,n,a,i){if(!(i<=0)){var{metrics:o,theme:l,quickFilters:d,advancedFilters:u}=r,{modelColumns:c,gridY:h}=o,{filterBarHeight:m,filterBarExpandedActiveCellBackgroundColor:f,filterBarErrorColor:v,filterBarHorizontalPadding:g,headerColor:C}=l,b=h-m,w=c.get(n);if(w!==void 0){var S=d.get(w),j=u.get(w);if(!(S==null&&j==null)){var y=null;if(S!=null){var{text:I}=S;if(y=I,y||(y=z.getFilterText(S.filter)),y!=null){var{fontWidths:T}=o,D=T.get(e.font);(D==null||D===0)&&(D=e.measureText("8").width,D||(D=10));var x=(i-g*2)/D;x<=0?y="":y.length>x&&(y="".concat(y.substring(0,x-1),"…"))}}e.save();var O=ze.isFilterValid(j,S);if(O&&f!=null)e.fillStyle=f,e.fillRect(a+1,b+1,i-1,m-3);else if(v!=null){e.fillStyle=v,e.lineWidth=2,e.strokeStyle=v;var P=a+2,R=b+2,L=i-3,_=m-5;e.strokeRect(P,R,L,_)}if(y!=null&&y!==""){var F=a+g,G=b+m*.5+1;e.fillStyle=C,e.fillText(y,F,G)}e.restore()}}}}drawCollapsedFilterHeaders(e,r){var{metrics:n,theme:a}=r,{headerSeparatorColor:i,filterBarCollapsedHeight:o}=a;if(!(o<=0)){var{gridX:l,gridY:d,maxX:u,visibleColumns:c,allColumnWidths:h,allColumnXs:m}=n,f=d-o;e.save(),e.fillStyle=i,e.fillRect(l,f,u,o);for(var v=0;v<c.length;v+=1){var g=c[v],C=h.get(g),b=m.get(g);if(b!=null&&C!=null){var w=b+l;this.drawCollapsedFilterHeader(e,r,g,w,C)}}e.restore()}}drawCollapsedFilterHeader(e,r,n,a,i){if(!(i<=0)){var{metrics:o,theme:l,quickFilters:d,advancedFilters:u}=r,{modelColumns:c,gridY:h}=o,m=c.get(n);if(m!==void 0){var f=d.get(m),v=u.get(m),{filterBarCollapsedHeight:g,filterBarActiveColor:C,filterBarActiveBackgroundColor:b,filterBarErrorColor:w}=l;e.save();var S=ze.isFilterValid(v,f);b!=null&&f==null&&v==null?e.fillStyle=b:C!=null&&S?e.fillStyle=C:w!=null&&(e.fillStyle=w);var j=a+1,y=h-g,I=i-1,T=g-1;e.fillRect(j,y,I,T),e.restore()}}}drawRowFooters(e,r){var{metrics:n,model:a,mouseX:i,mouseY:o,theme:l}=r,{gridY:d,gridX:u,maxX:c,modelRows:h,floatingTopHeight:m,floatingBottomHeight:f,floatingRows:v,rowFooterWidth:g,height:C,horizontalBarHeight:b,verticalBarWidth:w,allRowHeights:S,allRowYs:j,width:y}=n;if(!(g<=0||v.length===0)){var{cellHorizontalPadding:I,floatingGridRowColor:T,floatingRowBackgroundColors:D,headerColor:x,rowHoverBackgroundColor:O}=l;e.translate(u,d),e.beginPath();var P=Math.min(c,y-g-w-u);e.fillStyle=D,m>0&&e.rect(P,0,g,m),f>0&&e.rect(P,C-d-b-f,g,f),e.fill();var R=i!=null&&o!=null&&i>=u&&i<=c+g?M.getRowAtY(o,n):null;if(O!=null&&R!==null&&v.includes(R)){e.fillStyle=O;var L=j.get(R),_=S.get(R);k(L),k(_),e.fillRect(P,L,g,_)}if(e.beginPath(),T!=null&&(e.strokeStyle=T),m>0&&(e.moveTo(P+.5,.5),e.lineTo(P+.5,m-.5)),f>0){var F=C-d-b-f;e.moveTo(P-.5,F+.5),e.lineTo(P-.5,F+f-.5)}e.stroke(),e.fillStyle=x,e.textAlign="left";for(var G=P+I,$=0;$<v.length;$+=1){var B=v[$],ie=S.get(B),Qe=j.get(B),Je=h.get(B);if(Qe!=null&&ie!=null&&Je!=null){var Et=Qe+ie*.5;e.fillText(a.textForRowFooter(Je),G,Et)}}e.translate(-u,-d)}}getExpandButtonPosition(e,r){var{mouseX:n,mouseY:a,metrics:i,theme:o}=e,l={left:null,top:null,width:null,height:null};if(n==null||a==null||r==null||!i)return l;var{rowHeight:d,left:u,top:c}=M.getCellInfoFromXY(n,a,i);k(u),k(d),k(c);var{cellHorizontalPadding:h}=o,m=Yr+2*h,f=Math.max(u+Yr*r,i.gridX),v=i.gridY+c;return{left:f,top:v,width:m,height:d}}}const to="12px Fira Sans, sans-serif",no="var(--dh-color-white)",ao="var(--dh-color-black)",Zr={"grid-bg":"var(--dh-color-grid-bg)",font:to,white:no,black:ao,"header-bg":"var(--dh-color-grid-header-bg)","header-color":"var(--dh-color-grid-header-text)","header-height":"30px","header-separator-color":"var(--dh-color-grid-header-separator)","header-separator-hover-color":"var(--dh-color-grid-header-separator-hover)","header-hidden-separator-hover-color":"var(--dh-color-grid-header-separator-hidden-hover)","header-sort-bar-color":"var(--dh-color-grid-header-sort-bar)","header-reverse-bar-color":"var(--dh-color-grid-header-reverse-bar)","header-bar-casing-color":"var(--dh-color-grid-header-bar-casing)","header-font":"600 12px Fira Sans, sans-serif","row-height":"19px","row-background-colors":"var(--dh-color-grid-row-0-bg) var(--dh-color-grid-row-1-bg)","active-cell-selection-border-width":"2px","selection-color":"var(--dh-color-grid-selection)","selection-outline-color":"var(--dh-color-grid-selection-outline)","selection-outline-casing-color":"var(--dh-color-grid-selection-outline-casing)","row-hover-bg":"var(--dh-color-grid-row-hover-bg)","row-shadow-alpha":"var(--dh-color-grid-row-shadow-alpha)","selected-row-hover-bg":"var(--dh-color-grid-row-hover-bg-selected)","scroll-bar-active-selection-tick-color":"var(--dh-color-grid-scroll-bar-active-selection-tick)","scroll-bar-bg":"var(--dh-color-grid-scroll-bar-bg)","scroll-bar-hover-bg":"var(--dh-color-grid-scroll-bar-hover-bg)","scroll-bar-casing-color":"var(--dh-color-grid-scroll-bar-casing)","scroll-bar-corner-color":"var(--dh-color-grid-scroll-bar-corner)","scroll-bar-color":"var(--dh-color-grid-scroll-bar)","scroll-bar-hover-color":"var(--dh-color-grid-scroll-bar-hover)","scroll-bar-active-color":"var(--dh-color-grid-scroll-bar-active)","text-color":"var(--dh-color-grid-text)","hyperlink-color":"var(--dh-color-grid-text-hyperlink)","positive-number-color":"var(--dh-color-grid-number-positive)","negative-number-color":"var(--dh-color-grid-number-negative)","zero-number-color":"var(--dh-color-grid-number-zero)","date-color":"var(--dh-color-grid-date)","pending-text-color":"var(--dh-color-grid-text-pending)","error-text-color":"var(--dh-color-grid-text-error)","null-string-color":"var(--dh-color-grid-string-null)","filter-bar-active-bg":"var(--dh-color-grid-filter-bar-active-bg)","filter-bar-active-color":"var(--dh-color-grid-filter-bar-active)","filter-bar-expanded-bg":"var(--dh-color-grid-filter-bar-expanded-bg)","filter-bar-expanded-active-bg":"var(--dh-color-grid-filter-bar-expanded-active-bg)","filter-bar-expanded-active-cell-bg":"var(--dh-color-grid-filter-bar-expanded-active-cell-bg)","filter-bar-separator-color":"var(--dh-color-grid-filter-bar-separator)","filter-bar-error-color":"var(--dh-color-grid-filter-bar-error)","filter-icon-color":"var(--dh-color-grid-filter-icon)","scrim-color":"var(--dh-color-grid-scrim)","context-menu-sort-icon-color":"var(--dh-color-grid-context-menu-sort-icon)","context-menu-reverse-icon-color":"var(--dh-color-grid-context-menu-reverse-icon)","linker-column-hover-bg":"var(--dh-color-grid-column-linker-hover-bg)","tree-line-color":"var(--dh-color-grid-tree-line)","tree-marker-color":"var(--dh-color-grid-tree-marker)","tree-marker-hover-color":"var(--dh-color-grid-tree-marker-hover)","grouped-column-divider-color":"var(--dh-color-grid-column-grouped-divider)","floating-grid-row-color":"var(--dh-color-grid-floating-row)","floating-row-background-colors":"var(--dh-color-grid-floating-row-bg)","floating-divider-inner-color":"var(--dh-color-grid-floating-divider-inner)","floating-divider-outer-color":"var(--dh-color-grid-floating-divider-outer)","overflow-button-color":"var(--dh-color-grid-overflow-button)","overflow-button-hover-color":"var(--dh-color-grid-overflow-button-hover)","zero-line-color":"var(--dh-color-grid-data-bar-zero-line)","positive-bar-color":"var(--dh-color-grid-data-bar-positive)","negative-bar-color":"var(--dh-color-grid-data-bar-negative)","marker-bar-color":"var(--dh-color-grid-data-bar-marker)"};function Qr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Jr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Qr(Object(r),!0).forEach(function(n){io(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Qr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function io(t,e,r){return e=oo(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function oo(t){var e=lo(t,"string");return typeof e=="symbol"?e:String(e)}function lo(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var et=te.module("IrisGridTheme");function so(){var t,e=gn(Zr);return e["row-background-colors"]=pn((t=e["row-background-colors"])!==null&&t!==void 0?t:"").map(r=>{var[n,a]=r;return bn.normalizeCssColor(e["row-background-colors"].substring(n,a+1))}).join(" "),et.debug2("Iris grid theme:",Zr),et.debug2("Iris grid theme derived:",e),Object.freeze(Jr(Jr({},jn),{},{backgroundColor:e["grid-bg"],white:e.white,black:e.black,font:e.font,headerBackgroundColor:e["header-bg"],headerColor:e["header-color"],headerSeparatorColor:e["header-separator-color"],headerSeparatorHoverColor:e["header-separator-hover-color"],headerHiddenSeparatorHoverColor:e["header-hidden-separator-hover-color"],headerSortBarColor:e["header-sort-bar-color"],headerReverseBarColor:e["header-reverse-bar-color"],headerBarCasingColor:e["header-bar-casing-color"],headerFont:e["header-font"],rowBackgroundColors:e["row-background-colors"],rowHoverBackgroundColor:e["row-hover-bg"],selectionColor:e["selection-color"],selectionOutlineColor:e["selection-outline-color"],selectionOutlineCasingColor:e["selection-outline-casing-color"],selectedRowHoverBackgroundColor:e["selected-row-hover-bg"],scrollBarBackgroundColor:e["scroll-bar-bg"],scrollBarHoverBackgroundColor:e["scroll-bar-hover-bg"],scrollBarCasingColor:e["scroll-bar-casing-color"],scrollBarCornerColor:e["scroll-bar-corner-color"],scrollBarColor:e["scroll-bar-color"],scrollBarHoverColor:e["scroll-bar-hover-color"],scrollBarActiveColor:e["scroll-bar-active-color"],scrollBarSelectionTickColor:e["selected-row-hover-bg"],scrollBarActiveSelectionTickColor:e["scroll-bar-active-selection-tick-color"],textColor:e["text-color"],hyperlinkColor:e["hyperlink-color"],positiveNumberColor:e["positive-number-color"],negativeNumberColor:e["negative-number-color"],zeroNumberColor:e["zero-number-color"],dateColor:e["date-color"],pendingTextColor:e["pending-text-color"],errorTextColor:e["error-text-color"],nullStringColor:e["null-string-color"],filterBarActiveBackgroundColor:e["filter-bar-active-bg"],filterBarExpandedBackgroundColor:e["filter-bar-expanded-bg"],filterBarExpandedActiveBackgroundColor:e["filter-bar-expanded-active-bg"],filterBarExpandedActiveCellBackgroundColor:e["filter-bar-expanded-active-cell-bg"],filterBarSeparatorColor:e["filter-bar-separator-color"],filterBarActiveColor:e["filter-bar-active-color"],filterBarErrorColor:e["filter-bar-error-color"],filterIconColor:e["filter-icon-color"],scrimColor:e["scrim-color"],contextMenuSortIconColor:e["context-menu-sort-icon-color"],contextMenuReverseIconColor:e["context-menu-reverse-icon-color"],allowRowResize:!1,autoSelectRow:!0,gridColumnColor:null,gridRowColor:null,groupedColumnDividerColor:e["grouped-column-divider-color"],columnHoverBackgroundColor:null,headerHorizontalPadding:12,scrollBarSize:13,scrollBarHoverSize:16,minScrollHandleSize:24,rowHeight:parseInt(e["row-height"],10)||19,columnWidth:100,rowHeaderWidth:0,rowFooterWidth:60,columnHeaderHeight:parseInt(e["header-height"],10)||30,filterBarHeight:30,filterBarCollapsedHeight:5,sortHeaderBarHeight:2,reverseHeaderBarHeight:4,filterBarHorizontalPadding:4,activeCellSelectionBorderWidth:parseInt(e["active-cell-selection-border-width"],10)||2,shadowAlpha:parseFloat(e["row-shadow-alpha"])||.15,scrimBlurSize:25,minScrimTransitionTime:150,maxScrimTransitionTime:350,scrollSnapToRow:!0,linkerColumnHoverBackgroundColor:e["linker-column-hover-bg"],treeLineColor:e["tree-line-color"],treeMarkerColor:e["tree-marker-color"],treeMarkerHoverColor:e["tree-marker-hover-color"],floatingGridColumnColor:null,floatingGridRowColor:e["floating-grid-row-color"],floatingRowBackgroundColors:e["floating-row-background-colors"],floatingDividerInnerColor:e["floating-divider-inner-color"],floatingDividerOuterColor:e["floating-divider-outer-color"],overflowButtonColor:e["overflow-button-color"],overflowButtonHoverColor:e["overflow-button-hover-color"],zeroLineColor:e["zero-line-color"],positiveBarColor:e["positive-bar-color"],negativeBarColor:e["negative-bar-color"],markerBarColor:e["marker-bar-color"]}))}var rt=te.module("useTableListener"),uo=(t,e,r)=>p.useEffect(function(){if(t==null){rt.debug2("Emitter undefined, skipping addEventListener",e);return}return rt.debug2("Adding listener",e),t.addEventListener(e,r)},[t,e,r]);const Dt=uo;function co(t){var e=ke(),r=p.useMemo(()=>{var l=Bn(e,t);return gt(l),l},[e,t]),{getColumnFormat:n,getColumnFormatMapForType:a,getColumnTypeFormatter:i,getFormattedString:o}=r;return{getColumnFormat:n,getColumnFormatMapForType:a,getColumnTypeFormatter:i,getFormattedString:o,timeZone:r.timeZone}}function Tt(t){var[,e]=p.useState(0),r=ke(),n=p.useCallback(()=>{e(a=>a+1)},[]);return Dt(t,r.Table.EVENT_SIZECHANGED,n),bt(t)}var ho=te.module("useInitializeViewportData");function vo(t){var{items:e,targetSize:r,reuseExistingItems:n}=t,a=e.length;return a===r?e:(ho.debug("size changed:",{currentSize:a,targetSize:r}),n?a>r?e.slice(0,r):[...e,...or(a,r-1)]:Array.from(or(0,r-1)))}function mo(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=zn({}),n=Math.max(0,Tt(t));return p.useEffect(()=>{r.setItems(vo({items:r.items,targetSize:n,reuseExistingItems:e}))},[n,t]),r}function fo(t,e,r){return p.useCallback(function(a){var[i,o]=Mn(a,e,r,bt(t));t?.setViewport(i,o)},[t,r,e])}var Le=te.module("useViewportData");function go(t){var{table:e,itemHeight:r=1,scrollDebounce:n=Fn,viewportSize:a=10,viewportPadding:i=50,deserializeRow:o=_n,reuseItemsOnTableResize:l=!1}=t,d=p.useRef(0),u=mo(e,l),c=fo(e,a,i),h=p.useCallback(w=>{d.current=w,e&&!lr(e)?c(w):Le.debug("setViewport called on closed table.",e)},[e,c]),m=p.useCallback(w=>{e&&!lr(e)?(e.applyFilter(w),h(0)):Le.debug("applyFiltersAndRefresh called on closed table.",e)},[h,e]),f=ke(),v=p.useRef();v.current=p.useMemo(()=>kn(u,o),[o,u]);var g=p.useCallback(w=>{var S;(S=v.current)===null||S===void 0||S.call(v,w)},[]);Dt(e,f.Table.EVENT_UPDATED,g);var C=Tt(e);p.useEffect(()=>{Le.debug("Initializing viewport"),h(0)},[e,h]),p.useEffect(()=>{h(d.current)},[h,C]);var b=Wn(r,h,n);return p.useMemo(()=>({viewportData:u,size:C,table:e,applyFiltersAndRefresh:m,setViewport:h,onScroll:b}),[m,b,h,C,e,u])}function Nt(t,e){return e==null?t.columns[0]:t.findColumn(e)}function po(t,e,r){return r==null?e:t.findColumn(r)}function bo(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"?t:String(t)}function Co(t,e){return String(t)}function So(t){var{table:e,descriptionColumnName:r,iconColumnName:n,keyColumnName:a,labelColumnName:i,formatValue:o=Co}=t,l=p.useMemo(()=>Nt(e,a),[a,e]),d=p.useMemo(()=>po(e,l,i),[l,i,e]),u=p.useMemo(()=>r==null?null:e.findColumn(r),[r,e]),c=p.useMemo(()=>n==null?null:e.findColumn(n),[n,e]),h=p.useCallback(m=>{var f=bo(m.get(l)),v=o(m.get(d),d.type),g=u==null?void 0:o(m.get(u),u.type),C=c==null?void 0:m.get(c);return{key:f,content:v,textValue:v,description:g,icon:C}},[u,o,c,l,d]);return h}function wo(){var t=ke();return p.useMemo(()=>new z(t),[t])}function tt(t,e,r,n,a,i,o){try{var l=t[i](o),d=l.value}catch(u){r(u);return}l.done?e(d):Promise.resolve(d).then(n,a)}function Oo(t){return function(){var e=this,r=arguments;return new Promise(function(n,a){var i=t.apply(e,r);function o(d){tt(i,n,a,o,l,"next",d)}function l(d){tt(i,n,a,o,l,"throw",d)}o(void 0)})}}function yo(t){var{columnName:e,value:r,table:n}=t,a=wo();return p.useCallback(Oo(function*(){if(n==null||r==null)return null;var i=n.findColumn(e),o=a.getValueType(i.type),l=yield n.seekRow(0,i,o,r);return l===-1?null:l}),[e,n,a,r])}var xo=["table","keyColumn","labelColumn","iconColumn","settings","onChange","onSelectionChange"];function nt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function at(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?nt(Object(r),!0).forEach(function(n){Io(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):nt(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Io(t,e,r){return e=jo(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function jo(t){var e=Po(t,"string");return typeof e=="symbol"?e:String(e)}function Po(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function it(t,e,r,n,a,i,o){try{var l=t[i](o),d=l.value}catch(u){r(u);return}l.done?e(d):Promise.resolve(d).then(n,a)}function Do(t){return function(){var e=this,r=arguments;return new Promise(function(n,a){var i=t.apply(e,r);function o(d){it(i,n,a,o,l,"next",d)}function l(d){it(i,n,a,o,l,"throw",d)}o(void 0)})}}function To(t,e){if(t==null)return{};var r=No(t,e),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a<i.length;a++)n=i[a],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function No(t,e){if(t==null)return{};var r={},n=Object.keys(t),a,i;for(i=0;i<n.length;i++)a=n[i],!(e.indexOf(a)>=0)&&(r[a]=t[a]);return r}var Eo=te.module("jsapi-components.Picker");function Jo(t){var{table:e,keyColumn:r,labelColumn:n,iconColumn:a,settings:i,onChange:o,onSelectionChange:l}=t,d=To(t,xo),{scale:u}=Pn(),c=Ln[u],{getFormattedString:h}=co(i),m=d.selectedKey===void 0,[f,v]=p.useState(d.defaultSelectedKey),g=p.useMemo(()=>Nt(e,r),[r,e]),C=So({table:e,iconColumnName:a,keyColumnName:r,labelColumnName:n,formatValue:h}),b=yo({table:e,columnName:g.name,value:m?f:d.selectedKey}),w=p.useCallback(Do(function*(){var D=yield b();return D==null?null:D*c+Hn}),[b,c]),{viewportData:S,onScroll:j,setViewport:y}=go({reuseItemsOnTableResize:!0,table:e,itemHeight:c,deserializeRow:C}),I=S.items;p.useEffect(function(){var x=!1;return b().then(O=>{O==null||x||y(O)}).catch(O=>{Eo.error("Error setting viewport from selected key",O)}),()=>{x=!0}},[b,i,y]);var T=p.useCallback(D=>{var x;m&&v(D),(x=o??l)===null||x===void 0||x(D)},[m,o,l]);return s.jsx(Dn,at(at({},d),{},{normalizedItems:I,showItemIcons:a!=null,getInitialScrollPosition:w,onChange:T,onScroll:j}))}var Ro=p.createContext(null);function el(t){var{children:e}=t,{activeThemes:r}=$n(),n=p.useMemo(so,[r]);return s.jsx(Ro.Provider,{value:n,children:e})}export{Bo as A,Vo as C,Wo as F,St as I,qo as O,Jo as P,Xo as R,na as S,Yo as T,Zo as V,zn as a,Dt as b,co as c,Vn as d,So as e,go as f,wo as g,yo as h,mo as i,fo as j,Tt as k,Uo as l,Ko as m,zo as n,la as o,Qo as p,ze as q,Ro as r,el as s,ca as t,Wn as u,fa as v,Ca as w,X as x,so as y};
|
|
11
|
-
//# sourceMappingURL=IrisGridThemeProvider-
|
|
11
|
+
//# sourceMappingURL=IrisGridThemeProvider-98bbe2be.js.map
|