@finos/legend-application-repl-deployment 13.30.0 → 13.31.0

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.
@@ -41,5 +41,5 @@
41
41
  .${pd.BLUR}:hover {
42
42
  filter: none;
43
43
  }
44
- `})})),Xd=(0,bt.PA)((e=>{const{view:t}=e,n=t.grid.scrollHintText,o=document.querySelector(".data-cube-grid .ag-side-bar"),r=document.querySelector(".data-cube-grid .ag-body-vertical-scroll");return(0,E.jsxs)("div",{className:"absolute -top-10 flex items-center rounded-sm border border-neutral-300 bg-neutral-100 p-1 pr-2 text-neutral-500 shadow-sm",style:{right:(null!==o?o.getBoundingClientRect().width+6:10)+(null!==r?r.getBoundingClientRect().width:0)},children:[(0,E.jsx)(dr.TableScroll,{className:"text-lg"}),(0,E.jsx)("div",{className:"ml-1 font-mono text-sm",children:n??""})]})})),Kd=(0,bt.PA)((e=>{const{view:t}=e,n=$c(),o=t.grid;return(0,E.jsxs)("div",{className:"relative flex h-5 w-full select-none justify-between border-b border-neutral-200 bg-neutral-100",children:[Boolean(o.scrollHintText)&&(0,E.jsx)(Xd,{view:t}),(0,E.jsx)("div",{}),(0,E.jsxs)("div",{className:"flex h-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full items-center px-2 font-mono text-sm text-neutral-500",children:o.clientDataSource.rowCount?`Rows: ${o.clientDataSource.rowCount}`:""}),void 0!==o.rowLimit&&o.queryConfiguration.showWarningForTruncatedResult&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{className:"h-3 w-[1px] bg-neutral-200"}),(0,E.jsxs)("div",{className:"flex h-full items-center px-2 text-orange-500",children:[(0,E.jsx)(dr.Warning,{className:"stroke-[3px]"}),(0,E.jsx)("div",{className:"ml-1 text-sm font-semibold",children:`Results truncated to fit within row limit (${o.rowLimit})`})]})]}),(0,E.jsx)("div",{className:"h-3 w-[1px] bg-neutral-200"}),(0,E.jsxs)("button",{className:"flex h-full items-center p-2",onClick:()=>{o.setPaginationEnabled(!o.isPaginationEnabled)},children:[(0,E.jsx)(wr.A,{checked:o.isPaginationEnabled,classes:{root:"p-0 w-6 h-5 flex items-center",input:"w-2",checked:"!translate-x-2 ease-in-out duration-100 transition",thumb:jn("w-2 h-2",{"bg-sky-600":o.isPaginationEnabled,"bg-neutral-500":!o.isPaginationEnabled}),switchBase:"p-0.5 mt-1 translate-x-0 ease-in-out duration-100 transition",track:jn("h-3 w-5 border",{"!bg-sky-100 border-sky-600":o.isPaginationEnabled,"!bg-neutral-100 border-neutral-500":!o.isPaginationEnabled})},disableRipple:!0,disableFocusRipple:!0}),(0,E.jsx)("div",{className:jn("text-sm",{"text-sky-600":o.isPaginationEnabled,"text-neutral-500":!o.isPaginationEnabled}),children:"Pagination"})]}),t.dataCube.options?.enableCache&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{className:"h-3 w-[1px] bg-neutral-200"}),(0,E.jsxs)("button",{className:"flex h-full items-center p-2",onClick:()=>{o.setCachingEnabled(!o.isCachingEnabled).catch((e=>n.alertService.alertUnhandledError(e)))},children:[(0,E.jsx)(wr.A,{checked:o.isCachingEnabled,classes:{root:"p-0 w-6 h-5 flex items-center",input:"w-2",checked:"!translate-x-2 ease-in-out duration-100 transition",thumb:jn("w-2 h-2",{"bg-sky-600":o.isCachingEnabled,"bg-neutral-500":!o.isCachingEnabled}),switchBase:"p-0.5 mt-1 translate-x-0 ease-in-out duration-100 transition",track:jn("h-3 w-5 border",{"!bg-sky-100 border-sky-600":o.isCachingEnabled,"!bg-neutral-100 border-neutral-500":!o.isCachingEnabled})},disableRipple:!0,disableFocusRipple:!0,disabled:t.processCacheState.isInProgress,title:t.processCacheState.isInProgress?"Processing cache...":""}),(0,E.jsxs)("div",{className:jn("flex items-center text-sm",{"text-sky-600":o.isCachingEnabled,"text-neutral-500":!o.isCachingEnabled}),children:["Cache ",(0,E.jsx)(zc,{})]})]})]})]})]})})),qd=(0,bt.PA)((e=>{const{view:t}=e,n=t.grid;return(0,E.jsx)("div",{className:"relative h-[calc(100%_-_20px)] w-full",children:(0,E.jsx)(xr.W6,{theme:"legacy",className:"data-cube-grid ag-theme-quartz",rowModelType:"serverSide",serverSideDatasource:n.clientDataSource,context:{view:t},onGridReady:e=>{n.configureClient(e.api)},modules:[Ar.JKr,yr.fKx],...Gd(t)})})})),Jd=(0,bt.PA)((e=>{const{view:t}=e;return(0,E.jsxs)("div",{className:"h-[calc(100%_-_48px)] w-full",children:[(0,E.jsx)(Yd,{view:t}),(0,E.jsx)(qd,{view:t}),(0,E.jsx)(Kd,{view:t})]})}));var Qd=n(16481);const Zd=(0,bt.PA)((e=>{const{view:t,taskManager:n}=e,o=t?.taskService.tasks??n?.tasks;return(0,E.jsxs)("div",{className:"flex h-5 w-full justify-between bg-neutral-100",children:[(0,E.jsxs)("div",{className:"flex",children:[(0,E.jsxs)("button",{className:"flex items-center px-2 text-sky-600 hover:text-sky-700 disabled:text-neutral-400",onClick:()=>t?.editor.display.open(),disabled:!t,children:[(0,E.jsx)(dr.Settings,{className:"text-xl"}),(0,E.jsx)("div",{className:"pl-0.5 underline",children:"Properties"})]}),(0,E.jsx)("div",{className:"flex",children:(0,E.jsxs)("button",{className:"flex items-center text-sky-600 hover:text-sky-700 disabled:text-neutral-400",onClick:()=>{t?.filter.display.open()},disabled:!t,children:[(0,E.jsx)(dr.TableFilter,{className:"text-lg"}),(0,E.jsx)("div",{className:"pl-0.5 underline",children:"Filter"})]})})]}),(0,E.jsx)("div",{className:"flex items-center px-2",children:(0,E.jsx)("div",{className:"flex h-3.5 w-48 border-[0.5px] border-neutral-300",title:void 0!==o&&o.length>0?o.length>1?o.map(((e,t)=>`Task ${t+1}/${o.length}: ${e.description}`)).join("\n"):N(o,0).description:void 0,children:void 0!==o&&o.length>0&&(0,E.jsx)(Qd.A,{classes:{root:"h-3.5 w-full bg-transparent",bar1Indeterminate:"bg-green-500",bar2Indeterminate:"bg-green-500"},variant:"indeterminate"})})})]})}));var ep;!function(e){e.SEPARATOR="separator"}(ep||(ep={}));const tp=(0,bt.PA)((e=>{const{children:t,title:n,menuItems:o,getMenuItems:r}=e,[i,a,s]=jc(),[l,c]=(0,Lt.useState)([...o??[]]);return(0,E.jsxs)("div",{className:"flex h-7 justify-between bg-neutral-100",children:[(0,E.jsxs)("div",{className:"flex items-center overflow-hidden pl-1 pr-2 text-lg font-medium",children:[(0,E.jsx)(dr.Cube,{className:"mr-1 h-4 w-4 flex-shrink-0"}),(0,E.jsx)("div",{className:"text-ellipsis whitespace-nowrap",children:n})]}),(0,E.jsxs)("div",{className:"flex",children:[t,(0,E.jsx)("button",{className:"flex aspect-square h-full flex-shrink-0 items-center justify-center text-lg disabled:text-neutral-400",onClick:e=>{const t=r?.()??[];t.length&&t.unshift(ep.SEPARATOR),c([...o??[],...t]),i(e)},disabled:!o?.length,children:(0,E.jsx)(dr.Menu,{})}),(0,E.jsx)(Mc,{...s,menuProps:{anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"},classes:{paper:"rounded-none mt-[1px]",list:"w-40 p-0 rounded-none border border-neutral-400 bg-white overflow-y-auto py-0.5"}},children:l.map(((e,t)=>H(e)?(0,E.jsx)(Uc,{className:"flex h-[22px] w-full items-center px-2.5 text-base hover:bg-neutral-100 focus:bg-neutral-100",onClick:()=>{e.action(),a()},disabled:Boolean(e.disabled),children:e.label},t):e===ep.SEPARATOR?(0,E.jsx)("div",{className:"my-1 h-[1px] w-full bg-neutral-200"},t):null))})]})]})})),np=e=>{const{message:t,prompt:n}=e;return(0,E.jsxs)("div",{className:"flex h-full w-full overflow-auto p-5",children:[(0,E.jsx)("div",{className:"mr-3",children:(0,E.jsx)(dr.AlertError,{className:"flex-shrink-0 stroke-[0.5px] text-[40px] text-red-500"})}),(0,E.jsxs)("div",{children:[(0,E.jsx)("div",{className:"whitespace-break-spaces text-lg",children:t}),(0,E.jsx)("div",{className:"mt-1 whitespace-break-spaces text-neutral-500",children:n})]})]})},op=(0,bt.PA)((e=>{const{children:t,taskManager:n}=e;return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{className:"h-[calc(100%_-_48px)] w-full border border-x-0 border-neutral-200 bg-neutral-50",children:t??null}),(0,E.jsx)(Zd,{taskManager:n})]})})),rp=(0,bt.PA)((e=>{const{children:t,title:n,menuItems:o,headerContent:r,layoutManager:i,taskManager:a}=e;return(0,E.jsxs)("div",{className:"data-cube relative flex h-full w-full flex-col bg-white",children:[(0,E.jsx)(tp,{title:n,menuItems:o,children:r??null}),(0,E.jsx)(op,{taskManager:a,children:t}),i?(0,E.jsx)(_r,{layout:i}):null]})})),ip=(0,bt.PA)((e=>{const{view:t}=e;return(0,Lt.useEffect)((()=>()=>t.dispose()),[t]),t.initializeState.hasFailed?(0,E.jsx)(op,{children:(0,E.jsx)(np,{message:"Initialization Failure",prompt:"Resolve the issue and reload."})}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(Jd,{view:t}),(0,E.jsx)(Zd,{view:t})]})}));var ap=n(61005);class sp{_engine;_settingService;_snapshotService;_latestSnapshot;constructor(e,t,n){this._engine=e,this._settingService=t,this._snapshotService=n}getLatestSnapshot(){return this._latestSnapshot}async receiveSnapshot(e){const t=this._latestSnapshot;this._latestSnapshot=e,await this.applySnapshot(e.INTERNAL__fullClone(),t)}publishSnapshot(e){const t=this._latestSnapshot;this._latestSnapshot=e,this._settingService.getBooleanValue(du.DEBUGGER__ENABLE_DEBUG_MODE)&&this._engine.debugProcess("New Snapshot",["Publisher",this.getSnapshotSubscriberName()],["Snapshot",e.serialize()],["Previous Snapshot",t?.serialize()],["Diff",(0,ap.A)(t??{},e)]),this._snapshotService.broadcastSnapshot(e)}}class lp{_logService;_settingService;_subscribers=[];_snapshots=[];_pointer=-1;_historySize;constructor(e,t){(0,xe.Gn)(this,{_snapshots:xe.sH.struct,_pointer:xe.sH,canUndo:xe.EW,canRedo:xe.EW,undo:xe.XI,redo:xe.XI,adjustHistorySize:xe.XI,broadcastSnapshot:xe.XI}),this._logService=e,this._settingService=t,this._historySize=Math.max(this._settingService.getNumericValue(du.EDITOR__MAX_HISTORY_STACK_SIZE),10)}registerSubscriber(e){if(this._subscribers.find((t=>t.getSnapshotSubscriberName()===e.getSnapshotSubscriberName())))throw new x(`Subscriber with name '${e.getSnapshotSubscriberName()}' already exists`);this._subscribers.push(e)}propagateSnapshot(e){this._subscribers.forEach((t=>{const n=t.getLatestSnapshot();n?.uuid!==e.uuid&&t.receiveSnapshot(e).catch((e=>{w(e),this._logService.logIllegalStateError("Error occured while subscribers receiving and applying new snapshot should be handled gracefully",e)}))}))}getCurrentSnapshot(){return N(this._snapshots,this._pointer)}getHistory(e){return e?.full?[...this._snapshots]:this._snapshots.slice(0,this._pointer+1)}get canUndo(){return this._pointer>0}get canRedo(){return this._pointer<this._snapshots.length-1}undo(){this._pointer=Math.max(this._pointer-1,0),this.propagateSnapshot(this.getCurrentSnapshot())}redo(){this._pointer=Math.min(this._pointer+1,this._snapshots.length-1),this.propagateSnapshot(this.getCurrentSnapshot())}adjustHistorySize(e){let t=e;e<=10&&(this._logService.logIllegalStateError(`Can't adjust history size to ${e}: value must be greator than 10`),t=Math.max(e,10));const n=this.getHistory();n.length>t?(this._snapshots=n.slice(-t),this._pointer=Math.min(Math.max(this._pointer-(n.length-t),0),n.length-1)):(this._snapshots=n,this._pointer=n.length-1),this._historySize=t}broadcastSnapshot(e){e.isFinalized()?(this._snapshots=[...this._snapshots.slice(0,this._pointer+1),e],this._pointer+=1,this.adjustHistorySize(this._historySize),this.propagateSnapshot(e)):this._logService.logIllegalStateError("Snapshot must be finalized before broadcasting")}}function cp({name:e,subMenu:t,checked:n}){return(0,xr.sd)({configureDefaults:()=>!0}),(0,E.jsxs)("div",{children:[(0,E.jsx)("span",{className:"ag-menu-option-part ag-menu-option-icon"}),(0,E.jsxs)("span",{className:"ag-menu-option-part ag-menu-option-text !inline-flex items-center",children:[(0,E.jsx)("span",{className:"opacity-50",children:e}),(0,E.jsx)(zc,{})]}),(0,E.jsx)("span",{className:"ag-menu-option-part ag-menu-option-shortcut"}),(0,E.jsx)("span",{className:"ag-menu-option-part ag-menu-option-popup-pointer select-none",children:t&&(0,E.jsx)("span",{className:"ag-icon ag-icon-small-right"})})]})}var up=n(43322);class dp{uuid=(0,i.A)();parent;not=!1;constructor(e,t){(0,xe.Gn)(this,{parent:xe.sH,setParent:xe.XI,not:xe.sH,setNot:xe.XI}),this.parent=e,this.not=Boolean(t)}setNot(e){this.not=e}setParent(e){this.parent=e}}class pp extends dp{column;operation;value;constructor(e,t,n,o,r){super(e,r),(0,xe.Gn)(this,{column:xe.sH,setColumn:xe.XI,operation:xe.sH,setOperation:xe.XI,value:xe.sH.ref,setValue:xe.XI,updateValue:xe.XI}),this.column=t,this.operation=n,this.setValue(o)}setColumn(e){this.column=e}setOperation(e){this.operation=e}setValue(e){this.value=(0,xe.AT)(e)?e:(0,xe.Gn)(e,{value:xe.sH})}updateValue(e){this.value.value=e}}class gp extends dp{children=[];operation=ui.AND;constructor(e,t,n){super(e,n),(0,xe.Gn)(this,{children:xe.sH,removeChild:xe.XI,addChild:xe.XI,operation:xe.sH,setOperation:xe.XI}),this.operation=t}setOperation(e){this.operation=e}removeChild(e){S(this.children,e)&&e.setParent(void 0)}addChild(e,t){this.children.includes(e)||(void 0!==t?(t=Math.max(0,Math.min(t,this.children.length)),this.children.splice(t,0,e)):this.children.push(e),e.setParent(this))}}function mp(e){return{groupOperator:e.operation,not:e.not,conditions:e.children.map((e=>{if(e instanceof pp)return{name:e.column.name,type:e.column.type,operator:e.operation.operator,value:(0,up.A)(e.value),not:e.not};if(e instanceof gp)return mp(e);throw new x("Unknown filter node")}))}}function hp(e,t,n,o){const r=new gp(t,e.groupOperator===ui.AND?ui.AND:ui.OR,e.not);return e.conditions.forEach((e=>{let t;t="groupOperator"in e?hp(e,r,n,o):new pp(r,{name:e.name,type:e.type},o(e.operator),e.value,e.not),r.addChild(t),n.set(t.uuid,t)})),n.set(r.uuid,r),r}class fp{name;type;constructor(e,t){this.name=e,this.type=t}}class Ep{_editor;selectedColumns=[];availableColumnsSearchText="";selectedColumnsSearchText="";onChange;constructor(e,t){(0,xe.Gn)(this,{availableColumns:xe.EW,availableColumnsForDisplay:xe.EW,selectedColumnsForDisplay:xe.EW,selectedColumns:xe.sH,setSelectedColumns:xe.XI,availableColumnsSearchText:xe.sH,setAvailableColumnsSearchText:xe.XI,selectedColumnsSearchText:xe.sH,setSelectedColumnsSearchText:xe.XI}),this._editor=e,this.onChange=t?.onChange}get availableColumnsForDisplay(){return this.availableColumns.filter((e=>!Hi(this.selectedColumns,e.name))).sort($i)}get selectedColumnsForDisplay(){return this.selectedColumns}setSelectedColumns(e){this.selectedColumns=e.map((e=>this.cloneColumn(e))),this.onChange?.(this)}setAvailableColumnsSearchText(e){this.availableColumnsSearchText=e}setSelectedColumnsSearchText(e){this.selectedColumnsSearchText=e}getColumn(e){return P(Hi(this.availableColumns,e),`Can't find column '${e}'`)}}class Cp extends fp{onChange;direction;constructor(e,t,n,o){super(e,t),(0,xe.Gn)(this,{direction:xe.sH,setDirection:xe.XI}),this.direction=n,this.onChange=o}setDirection(e){this.direction=e,this.onChange?.()}}class bp extends Ep{cloneColumn(e){return new Cp(e.name,e.type,e.direction)}get availableColumns(){return(0,tt.A)([...this._editor.horizontalPivots.selector.selectedColumns.length?[...this._editor.horizontalPivots.pivotResultColumns,...[...this._editor.columns.selector.selectedColumns,...this._editor.verticalPivots.selector.selectedColumns].filter((e=>this._editor.columnProperties.getColumnConfiguration(e.name).kind===ii.DIMENSION&&!Hi(this._editor.horizontalPivots.selector.selectedColumns,e.name)))]:[...this._editor.columns.selector.selectedColumns,...this._editor.verticalPivots.selector.selectedColumns],...this._editor.groupExtendColumns],(e=>e.name)).map((e=>new Cp(e.name,e.type,di.ASCENDING)))}}class vp{selector;constructor(e){this.selector=new bp(e)}adaptPropagatedChanges(){this.selector.setSelectedColumns(this.selector.selectedColumns.filter((e=>Hi(this.selector.availableColumns,e.name))))}applySnaphot(e,t){this.selector.setSelectedColumns(e.data.sortColumns.map((e=>{const t=this.selector.getColumn(e.name);return new Cp(t.name,t.type,e.direction)})))}buildSnapshot(e,t){e.data.sortColumns=this.selector.selectedColumns.map((e=>({...Wi(e),direction:e.direction})))}}class _p extends zi{dataType;aggregateOperation;static create(e,t,n){const o=Object.assign(new _p("",""),zi.serialization.fromJson(e));return o.dataType=ji(o.type),o.aggregateOperation=Di(o.aggregateOperator,n),(0,xe.Gn)(o,{kind:xe.sH,setKind:xe.XI,displayName:xe.sH,setDisplayName:xe.XI,decimals:xe.sH,setDecimals:xe.XI,displayCommas:xe.sH,setDisplayCommas:xe.XI,negativeNumberInParens:xe.sH,setNegativeNumberInParens:xe.XI,numberScale:xe.sH,setNumberScale:xe.XI,missingValueDisplayText:xe.sH,setMissingValueDisplayText:xe.XI,unit:xe.sH,setUnit:xe.XI,fontFamily:xe.sH,setFontFamily:xe.XI,fontSize:xe.sH,setFontSize:xe.XI,fontBold:xe.sH,setFontBold:xe.XI,fontItalic:xe.sH,setFontItalic:xe.XI,fontUnderline:xe.sH,setFontUnderline:xe.XI,fontStrikethrough:xe.sH,setFontStrikethrough:xe.XI,fontCase:xe.sH,setFontCase:xe.XI,textAlign:xe.sH,setTextAlign:xe.XI,normalForegroundColor:xe.sH,setNormalForegroundColor:xe.XI,negativeForegroundColor:xe.sH,setNegativeForegroundColor:xe.XI,zeroForegroundColor:xe.sH,setZeroForegroundColor:xe.XI,errorForegroundColor:xe.sH,setErrorForegroundColor:xe.XI,normalBackgroundColor:xe.sH,setNormalBackgroundColor:xe.XI,negativeBackgroundColor:xe.sH,setNegativeBackgroundColor:xe.XI,zeroBackgroundColor:xe.sH,setZeroBackgroundColor:xe.XI,errorBackgroundColor:xe.sH,setErrorBackgroundColor:xe.XI,isSelected:xe.sH,setIsSelected:xe.XI,hideFromView:xe.sH,setHideFromView:xe.XI,blur:xe.sH,setBlur:xe.XI,fixedWidth:xe.sH,setFixedWidth:xe.XI,minWidth:xe.sH,setMinWidth:xe.XI,maxWidth:xe.sH,setMaxWidth:xe.XI,pinned:xe.sH,setPinned:xe.XI,displayAsLink:xe.sH,setDisplayAsLink:xe.XI,linkLabelParameter:xe.sH,setLinkLabelParameter:xe.XI,isUsingDefaultStyling:xe.EW,useDefaultStyling:xe.XI,aggregateOperator:xe.sH,aggregateOperation:xe.sH,setAggregateOperation:xe.XI,aggregationParameters:xe.sH,setAggregationParameters:xe.XI,excludedFromPivot:xe.sH,setExcludedFromPivot:xe.XI,pivotSortDirection:xe.sH,setPivotSortDirection:xe.XI,pivotStatisticColumnFunction:xe.sH,setPivotStatisticColumnFunction:xe.XI}),o}get isUsingDefaultStyling(){return void 0===this.fontFamily&&void 0===this.fontSize&&void 0===this.fontBold&&void 0===this.fontItalic&&void 0===this.fontUnderline&&void 0===this.fontStrikethrough&&void 0===this.textAlign&&void 0===this.normalForegroundColor&&void 0===this.negativeForegroundColor&&void 0===this.zeroForegroundColor&&void 0===this.errorForegroundColor&&void 0===this.normalBackgroundColor&&void 0===this.negativeBackgroundColor&&void 0===this.zeroBackgroundColor&&void 0===this.errorBackgroundColor}useDefaultStyling(){this.fontFamily=void 0,this.fontSize=void 0,this.fontBold=void 0,this.fontItalic=void 0,this.fontUnderline=void 0,this.fontStrikethrough=void 0,this.textAlign=void 0,this.normalForegroundColor=void 0,this.negativeForegroundColor=void 0,this.zeroForegroundColor=void 0,this.errorForegroundColor=void 0,this.normalBackgroundColor=void 0,this.negativeBackgroundColor=void 0,this.zeroBackgroundColor=void 0,this.errorBackgroundColor=void 0}setKind(e){this.kind=e}setDisplayName(e){this.displayName=e}setDecimals(e){this.decimals=e}setDisplayCommas(e){this.displayCommas=e}setNegativeNumberInParens(e){this.negativeNumberInParens=e}setNumberScale(e){this.numberScale=e}setMissingValueDisplayText(e){this.missingValueDisplayText=e}setUnit(e){this.unit=e}setFontFamily(e){this.fontFamily=e}setFontSize(e){this.fontSize=e}setFontBold(e){this.fontBold=e}setFontItalic(e){this.fontItalic=e}setFontUnderline(e){this.fontUnderline=e}setFontStrikethrough(e){this.fontStrikethrough=e}setFontCase(e){this.fontCase=e}setTextAlign(e){this.textAlign=e}setNormalForegroundColor(e){this.normalForegroundColor=e}setNegativeForegroundColor(e){this.negativeForegroundColor=e}setZeroForegroundColor(e){this.zeroForegroundColor=e}setErrorForegroundColor(e){this.errorForegroundColor=e}setNormalBackgroundColor(e){this.normalBackgroundColor=e}setNegativeBackgroundColor(e){this.negativeBackgroundColor=e}setZeroBackgroundColor(e){this.zeroBackgroundColor=e}setErrorBackgroundColor(e){this.errorBackgroundColor=e}setIsSelected(e){this.isSelected=e}setHideFromView(e){this.hideFromView=e}setBlur(e){this.blur=e}setFixedWidth(e){this.fixedWidth=e}setMinWidth(e){this.minWidth=e}setMaxWidth(e){this.maxWidth=e}setPinned(e){this.pinned=e}setDisplayAsLink(e){this.displayAsLink=e}setLinkLabelParameter(e){this.linkLabelParameter=e}setAggregateOperation(e){this.aggregateOperation=e,this.aggregateOperator=e.operator}setAggregationParameters(e){this.aggregationParameters=e}setExcludedFromPivot(e){this.excludedFromPivot=e}setPivotSortDirection(e){this.pivotSortDirection=e}setPivotStatisticColumnFunction(e){this.pivotStatisticColumnFunction=e}}class Tp extends Yi{static create(e){const t=Object.assign(new Tp,Yi.serialization.fromJson(e));return(0,xe.Gn)(t,{expandedPaths:xe.sH,setExpandedPaths:xe.XI}),t}setExpandedPaths(e){this.expandedPaths=e}}class Np extends Xi{static create(e){const t=Object.assign(new Np,Xi.serialization.fromJson(e));return t.columns=[],(0,xe.Gn)(t,{name:xe.sH,setName:xe.XI,description:xe.sH,setDescription:xe.XI,showHorizontalGridLines:xe.sH,setShowHorizontalGridLines:xe.XI,showVerticalGridLines:xe.sH,setShowVerticalGridLines:xe.XI,gridLineColor:xe.sH,setGridLineColor:xe.XI,fontFamily:xe.sH,setFontFamily:xe.XI,fontSize:xe.sH,setFontSize:xe.XI,fontBold:xe.sH,setFontBold:xe.XI,fontItalic:xe.sH,setFontItalic:xe.XI,fontUnderline:xe.sH,setFontUnderline:xe.XI,fontStrikethrough:xe.sH,setFontStrikethrough:xe.XI,fontCase:xe.sH,setFontCase:xe.XI,textAlign:xe.sH,setTextAlign:xe.XI,normalForegroundColor:xe.sH,setNormalForegroundColor:xe.XI,negativeForegroundColor:xe.sH,setNegativeForegroundColor:xe.XI,zeroForegroundColor:xe.sH,setZeroForegroundColor:xe.XI,errorForegroundColor:xe.sH,setErrorForegroundColor:xe.XI,normalBackgroundColor:xe.sH,setNormalBackgroundColor:xe.XI,negativeBackgroundColor:xe.sH,setNegativeBackgroundColor:xe.XI,zeroBackgroundColor:xe.sH,setZeroBackgroundColor:xe.XI,errorBackgroundColor:xe.sH,setErrorBackgroundColor:xe.XI,alternateRows:xe.sH,setAlternateRows:xe.XI,alternateRowsColor:xe.sH,setAlternateRowsColor:xe.XI,alternateRowsCount:xe.sH,setAlternateRowsCount:xe.XI,alternateRowsStandardMode:xe.sH,setAlternateRowsStandardMode:xe.XI,showSelectionStats:xe.sH,setShowSelectionStats:xe.XI,showWarningForTruncatedResult:xe.sH,setShowWarningForTruncatedResult:xe.XI,initialExpandLevel:xe.sH,setInitialExpandLevel:xe.XI,showRootAggregation:xe.sH,setShowRootAggregation:xe.XI,showLeafCount:xe.sH,setShowLeafCount:xe.XI,treeColumnSortDirection:xe.sH,setTreeColumnSortDirection:xe.XI,pivotStatisticColumnName:xe.sH,setPivotStatisticColumnName:xe.XI,pivotStatisticColumnPlacement:xe.sH,setPivotStatisticColumnPlacement:xe.XI,isUsingDefaultStyling:xe.EW,useDefaultStyling:xe.XI}),t}get isUsingDefaultStyling(){return this.fontFamily===Ni&&11===this.fontSize&&this.fontBold===Si&&this.fontItalic===Ai&&this.fontUnderline===yi&&this.fontStrikethrough===xi&&this.textAlign===Ii&&this.normalForegroundColor===wi&&this.negativeForegroundColor===Oi&&this.zeroForegroundColor===Li&&this.errorForegroundColor===Fi&&this.normalBackgroundColor===ki&&this.negativeBackgroundColor===ki&&this.zeroBackgroundColor===ki&&this.errorBackgroundColor===ki}useDefaultStyling(){this.fontFamily=Ni,this.fontSize=11,this.fontBold=Si,this.fontItalic=Ai,this.fontUnderline=yi,this.fontStrikethrough=xi,this.textAlign=Ii,this.normalForegroundColor=wi,this.negativeForegroundColor=Oi,this.zeroForegroundColor=Li,this.errorForegroundColor=Fi,this.normalBackgroundColor=ki,this.negativeBackgroundColor=ki,this.zeroBackgroundColor=ki,this.errorBackgroundColor=ki}setName(e){this.name=e}setDescription(e){this.description=e}setShowHorizontalGridLines(e){this.showHorizontalGridLines=e}setShowVerticalGridLines(e){this.showVerticalGridLines=e}setGridLineColor(e){this.gridLineColor=e}setFontFamily(e){this.fontFamily=e}setFontSize(e){this.fontSize=e}setFontBold(e){this.fontBold=e}setFontItalic(e){this.fontItalic=e}setFontUnderline(e){this.fontUnderline=e}setFontStrikethrough(e){this.fontStrikethrough=e}setFontCase(e){this.fontCase=e}setTextAlign(e){this.textAlign=e}setNormalForegroundColor(e){this.normalForegroundColor=e}setNegativeForegroundColor(e){this.negativeForegroundColor=e}setZeroForegroundColor(e){this.zeroForegroundColor=e}setErrorForegroundColor(e){this.errorForegroundColor=e}setNormalBackgroundColor(e){this.normalBackgroundColor=e}setNegativeBackgroundColor(e){this.negativeBackgroundColor=e}setZeroBackgroundColor(e){this.zeroBackgroundColor=e}setErrorBackgroundColor(e){this.errorBackgroundColor=e}setAlternateRows(e){this.alternateRows=e}setAlternateRowsColor(e){this.alternateRowsColor=e}setAlternateRowsCount(e){this.alternateRowsCount=e}setAlternateRowsStandardMode(e){this.alternateRowsStandardMode=e}setShowSelectionStats(e){this.showSelectionStats=e}setShowWarningForTruncatedResult(e){this.showWarningForTruncatedResult=e}setInitialExpandLevel(e){this.initialExpandLevel=e}setShowRootAggregation(e){this.showRootAggregation=e}setShowLeafCount(e){this.showLeafCount=e}setTreeColumnSortDirection(e){this.treeColumnSortDirection=e}setPivotStatisticColumnPlacement(e){this.pivotStatisticColumnPlacement=e}setPivotStatisticColumnName(e){this.pivotStatisticColumnName=e}setExpandedPaths(e){this.pivotLayout.expandedPaths=e}}class Sp{limit=void 0;configuration=new Np;constructor(e){(0,xe.Gn)(this,{configuration:xe.sH,limit:xe.sH,setLimit:xe.XI,applySnaphot:xe.XI})}setLimit(e){this.limit=e}applySnaphot(e,t){this.setLimit(void 0!==e.data.limit&&e.data.limit>=0?e.data.limit:void 0),this.configuration=Np.create(e.data.configuration)}buildSnapshot(e,t){const n=e.data;n.limit=void 0===this.limit||this.limit<0?void 0:this.limit,n.configuration=this.configuration.serialize()}}class Ap{_view;columns=[];selectedColumnName;showAdvancedSettings=!1;constructor(e){(0,xe.Gn)(this,{columns:xe.sH,setColumns:xe.XI,selectedColumnName:xe.sH,setSelectedColumnName:xe.XI,selectedColumn:xe.EW,showAdvancedSettings:xe.sH,setShowAdvancedSettings:xe.XI,applySnaphot:xe.XI}),this._view=e.view}getColumnConfiguration(e){return P(Hi(this.columns,e),`Can't find configuration for column '${e}'`)}setColumns(e){this.columns=e}setSelectedColumnName(e){this.selectedColumnName=e}get selectedColumn(){return Hi(this.columns,this.selectedColumnName)}setShowAdvancedSettings(e){this.showAdvancedSettings=e}applySnaphot(e,t){this.setColumns(e.data.configuration.columns.map((t=>_p.create(t,e,this._view.engine.aggregateOperations)))),!this.selectedColumn&&this.columns.length&&this.setSelectedColumnName(N(this.columns,0).name)}buildSnapshot(e,t){e.data.configuration={...e.data.configuration,columns:this.columns.map((e=>e.serialize()))}}}class yp extends Ep{showHiddenColumns=!1;constructor(e,t){super(e,t),(0,xe.Gn)(this,{availableColumnsForDisplay:xe.$Z,selectedColumnsForDisplay:xe.$Z,showHiddenColumns:xe.sH,setShowHiddenColumns:xe.XI})}cloneColumn(e){return new fp(e.name,e.type)}get availableColumns(){return[...this._editor.sourceColumns,...this._editor.leafExtendColumns,...this._editor.groupExtendColumns].map((e=>new fp(e.name,e.type)))}get availableColumnsForDisplay(){return super.availableColumnsForDisplay.filter((e=>this.showHiddenColumns||!this._editor.columnProperties.getColumnConfiguration(e.name).hideFromView))}get selectedColumnsForDisplay(){return super.selectedColumnsForDisplay.filter((e=>this.showHiddenColumns||!this._editor.columnProperties.getColumnConfiguration(e.name).hideFromView))}setShowHiddenColumns(e){this.showHiddenColumns=e}}class xp{_editor;selector;constructor(e){(0,xe.Gn)(this,{applySnaphot:xe.XI}),this._editor=e,this.selector=new yp(e,{onChange:e=>{const t=e.selectedColumns.map((e=>this._editor.columnProperties.getColumnConfiguration(e.name))),n=this._editor.columnProperties.columns.filter((e=>!t.includes(e)));t.forEach((e=>e.setIsSelected(!0))),n.forEach((e=>e.setIsSelected(!1))),this._editor.columnProperties.setColumns([...t,...n])}})}propagateChanges(){this._editor.sorts.adaptPropagatedChanges()}applySnaphot(e,t){this.selector.setSelectedColumns(this._editor.columnProperties.columns.filter((e=>e.isSelected)).map((e=>{const t=this.selector.getColumn(e.name);return new fp(t.name,t.type)})))}buildSnapshot(e,t){this.propagateChanges(),e.data.selectColumns=this.selector.selectedColumns.filter((e=>!Hi(this._editor.groupExtendColumns,e.name))).map(Wi)}}class Ip extends Ep{cloneColumn(e){return new fp(e.name,e.type)}get availableColumns(){return this._editor.columnProperties.columns.filter((e=>e.kind===ii.DIMENSION&&!Hi(this._editor.groupExtendColumns,e.name)&&!Hi(this._editor.horizontalPivots.selector.selectedColumns,e.name))).map((e=>new fp(e.name,e.type)))}}class wp{selector;constructor(e){this.selector=new Ip(e)}adaptPropagatedChanges(){this.selector.setSelectedColumns(this.selector.selectedColumns.filter((e=>Hi(this.selector.availableColumns,e.name))))}applySnaphot(e,t){this.selector.setSelectedColumns((e.data.groupBy?.columns??[]).map((e=>new fp(e.name,e.type))))}buildSnapshot(e,t){e.data.groupBy=this.selector.selectedColumns.length?{columns:this.selector.selectedColumns.map(Wi)}:void 0,e.data.selectColumns=(0,tt.A)([...e.data.selectColumns,...this.selector.selectedColumns],(e=>e.name)).map(Wi)}}function kp(){return{modules:[Ar.JKr],className:"ag-theme-quartz",animateRows:!1,getRowId:e=>e.data.name,editType:"fullRow",rowDragMultiRow:!0,rowDragEntireRow:!0,rowSelection:{mode:"multiRow",checkboxes:!0,headerCheckbox:!0,enableClickSelection:!0},selectionColumnDef:{width:40,headerClass:"!pl-[23px]",cellClass:"!pl-1.5",rowDrag:!0,rowDragText:(e,t)=>t>1?`${t} columns`:(e.rowNode?.data).name,sortable:!1,resizable:!1,suppressHeaderMenuButton:!0},suppressMoveWhenRowDragging:!0,rowHeight:20,headerHeight:20,suppressRowHoverHighlight:!1,noRowsOverlayComponent:e=>e.api.getQuickFilter()?(0,E.jsxs)("div",{className:"flex items-center border-[1.5px] border-neutral-300 p-2 font-semibold text-neutral-400",children:[(0,E.jsx)("div",{children:(0,E.jsx)(dr.WarningCircle,{className:"mr-1 text-lg"})}),"No match found"]}):e.noColumnsSelectedRenderer?e.noColumnsSelectedRenderer():(0,E.jsx)("div",{}),onModelUpdated:e=>{0===e.api.getDisplayedRowCount()?e.api.showNoRowsOverlay():e.api.hideOverlay()}}}const Rp=(0,bt.PA)((function(e){const{selector:t,gridApi:n,scope:o}=e;return(0,E.jsxs)("div",{className:"flex items-center justify-center rounded-lg bg-neutral-500 px-1 py-0.5 font-mono text-xs font-bold text-white",children:[`${kd(n).length}/${"available"===o?t.availableColumnsForDisplay.length:t.selectedColumnsForDisplay.length}`,(0,E.jsx)("span",{className:"hidden",children:"available"===o?t.availableColumnsSearchText:t.selectedColumnsSearchText})]})})),Op=(0,bt.PA)((function(e){const{selector:t,columnLabelRenderer:n,columnActionRenderer:o,noColumnsSelectedRenderer:r}=e,[i,a]=(0,Lt.useState)([]),[s,l]=(0,Lt.useState)([]),[c,u]=(0,Lt.useState)(null),[d,p]=(0,Lt.useState)(null),g=(0,Lt.useRef)(null),m=(0,Lt.useRef)(null),h=(0,Lt.useCallback)((e=>{t.setSelectedColumns(wd(e.api))}),[t]),f=(0,Lt.useCallback)((e=>{const n=e.nodes.map((e=>e.data)).filter(L);t.setSelectedColumns(t.selectedColumns.filter((e=>!n.includes(e))))}),[t]),C=(0,Lt.useCallback)((e=>{-1!==e.overIndex&&t.setSelectedColumns(wd(e.api))}),[t]);return(0,Lt.useEffect)((()=>{if(!c||!d)return;const e=d.getRowDropZoneParams({onDragStop:e=>{h(e),c.clearFocusedCell()}});e&&(c.removeRowDropZone(e),c.addRowDropZone(e));const t=c.getRowDropZoneParams({onDragStop:e=>{f(e),d.clearFocusedCell()}});t&&(d.removeRowDropZone(t),d.addRowDropZone(t))}),[c,d,h,f]),(0,E.jsxs)("div",{className:"data-cube-column-selector flex h-full w-full",children:[(0,E.jsxs)("div",{className:"h-full w-[calc(50%_-_20px)]",children:[(0,E.jsx)("div",{className:"flex h-5 items-center text-sm",children:"Available columns:"}),(0,E.jsxs)("div",{className:"h-[calc(100%_-_20px)] rounded-sm border border-neutral-200",children:[(0,E.jsxs)("div",{className:"relative h-6 border-b border-neutral-200",children:[(0,E.jsx)("input",{className:"h-full w-full pl-10 pr-6 placeholder-neutral-400",ref:g,placeholder:"Click here to search...",value:t.availableColumnsSearchText,onChange:e=>t.setAvailableColumnsSearchText(e.target.value),onKeyDown:e=>{"Escape"===e.code&&(e.stopPropagation(),g.current?.select(),t.setAvailableColumnsSearchText(""))}}),(0,E.jsx)("div",{className:"absolute left-0 top-0 flex h-6 w-10 items-center justify-center",children:(0,E.jsx)(dr.Search,{className:"stroke-[3px] text-lg text-neutral-500"})}),(0,E.jsx)("button",{className:"absolute right-0 top-0 flex h-6 w-6 items-center justify-center text-neutral-500 disabled:text-neutral-300",disabled:!t.availableColumnsSearchText,title:"Clear search [Esc]",onClick:()=>{t.setAvailableColumnsSearchText(""),g.current?.focus()},children:(0,E.jsx)(dr.X,{className:"text-lg"})})]}),(0,E.jsx)("div",{className:"h-[calc(100%_-_24px)]",children:(0,E.jsx)(xr.W6,{theme:"legacy",...kp(),rowDragManaged:!1,onGridReady:e=>u(e.api),onSelectionChanged:e=>{a(e.api.getSelectedNodes().map((e=>e.data)).filter(L))},quickFilterText:t.availableColumnsSearchText,rowData:t.availableColumnsForDisplay,columnDefs:[{field:"name",colId:"name",flex:1,minWidth:100,filter:!0,sortable:!1,resizable:!1,suppressHeaderMenuButton:!0,getQuickFilterText:e=>e.value,headerComponent:e=>(0,E.jsxs)("button",{title:"Double-click to add all columns",className:"flex h-full w-full items-center justify-between pl-0.5",onDoubleClick:()=>{const n=kd(e.api);t.setSelectedColumns([...t.selectedColumns,...n]),e.api.clearFocusedCell()},children:[(0,E.jsx)("div",{children:"[All Columns]"}),(0,E.jsx)(Rp,{selector:t,gridApi:e.api,scope:"available"})]}),cellRenderer:e=>{const r=e.data;return r?(0,E.jsxs)("div",{className:"flex h-full w-full cursor-pointer items-center",title:`[${r.name}]\nDouble-click to add column`,onDoubleClick:()=>{t.setSelectedColumns([...t.selectedColumns,r]),e.api.clearFocusedCell()},children:[n?.({selector:t,column:r})??(0,E.jsx)("div",{className:"h-full flex-1 items-center overflow-hidden overflow-ellipsis whitespace-nowrap pl-2",children:r.name}),(0,E.jsx)("div",{className:"flex h-full",children:o?.({selector:t,column:r})??null})]}):null}}]})})]})]}),(0,E.jsx)("div",{className:"flex h-full w-10 items-center justify-center",children:(0,E.jsxs)("div",{className:"flex flex-col",children:[(0,E.jsx)("button",{className:"flex items-center justify-center rounded-sm border border-neutral-300 bg-neutral-100 text-neutral-500 hover:bg-neutral-200 disabled:bg-neutral-200 disabled:text-neutral-400",title:"Add selected columns",onClick:()=>{if(!c)return;const e=kd(c),n=i.filter((t=>e.includes(t)));t.setSelectedColumns([...t.selectedColumns,...n]),c.clearFocusedCell()},disabled:0===i.length,children:(0,E.jsx)(dr.ChevronRight,{className:"text-2xl"})}),(0,E.jsx)("button",{className:"mt-2 flex items-center justify-center rounded-sm border border-neutral-300 bg-neutral-100 text-neutral-500 hover:bg-neutral-200 disabled:bg-neutral-200 disabled:text-neutral-400",title:"Remove selected columns",onClick:()=>{if(!d)return;const e=kd(d),n=s.filter((t=>e.includes(t)));t.setSelectedColumns(t.selectedColumns.filter((e=>!n.includes(e)))),d.clearFocusedCell()},disabled:0===s.length,children:(0,E.jsx)(dr.ChevronLeft,{className:"text-2xl"})})]})}),(0,E.jsxs)("div",{className:"h-full w-[calc(50%_-_20px)]",children:[(0,E.jsx)("div",{className:"flex h-5 items-center text-sm",children:"Selected columns:"}),(0,E.jsxs)("div",{className:"h-[calc(100%_-_20px)] rounded-sm border border-neutral-200",children:[(0,E.jsxs)("div",{className:"relative h-6 border-b border-neutral-200",children:[(0,E.jsx)("input",{className:"h-full w-full pl-10 placeholder-neutral-400",ref:m,placeholder:"Click here to search...",value:t.selectedColumnsSearchText,onChange:e=>t.setSelectedColumnsSearchText(e.target.value),onKeyDown:e=>{"Escape"===e.code&&(e.stopPropagation(),t.setSelectedColumnsSearchText(""))}}),(0,E.jsx)("div",{className:"absolute left-0 top-0 flex h-6 w-10 items-center justify-center",children:(0,E.jsx)(dr.Search,{className:"stroke-[3px] text-lg text-neutral-500"})}),(0,E.jsx)("button",{className:"absolute right-0 top-0 flex h-6 w-6 items-center justify-center text-neutral-500 disabled:text-neutral-300",disabled:!t.selectedColumnsSearchText,title:"Clear search [Esc]",onClick:()=>{t.setSelectedColumnsSearchText(""),m.current?.focus()},children:(0,E.jsx)(dr.X,{className:"text-lg"})})]}),(0,E.jsx)("div",{className:"h-[calc(100%_-_24px)]",children:(0,E.jsx)(xr.W6,{theme:"legacy",...kp(),rowDragManaged:!0,onRowDragEnd:C,onGridReady:e=>p(e.api),onSelectionChanged:e=>{l(e.api.getSelectedNodes().map((e=>e.data)).filter(L))},quickFilterText:t.selectedColumnsSearchText,noRowsOverlayComponentParams:{noColumnsSelectedRenderer:r},rowData:t.selectedColumnsForDisplay,columnDefs:[{field:"name",colId:"name",flex:1,minWidth:100,filter:!0,sortable:!1,resizable:!1,suppressHeaderMenuButton:!0,getQuickFilterText:e=>e.value,headerComponent:e=>(0,E.jsxs)("button",{title:"Double-click to remove all columns",className:"flex h-full w-full items-center justify-between pl-0.5",onDoubleClick:()=>{const n=kd(e.api);t.setSelectedColumns(t.selectedColumns.filter((e=>!n.includes(e)))),e.api.clearFocusedCell()},children:[(0,E.jsx)("div",{children:"[All Columns]"}),(0,E.jsx)(Rp,{selector:t,gridApi:e.api,scope:"selected"})]}),cellRenderer:e=>{const r=e.data;return r?(0,E.jsxs)("div",{className:"flex h-full w-full cursor-pointer items-center",title:`[${r.name}]\nDouble-click to add column`,onDoubleClick:()=>{t.setSelectedColumns(t.selectedColumns.filter((e=>e!==r))),e.api.clearFocusedCell()},children:[n?.({selector:t,column:r})??(0,E.jsx)("div",{className:"h-full flex-1 items-center overflow-hidden overflow-ellipsis whitespace-nowrap pl-2",children:r.name}),(0,E.jsx)("div",{className:"flex h-full",children:o?.({selector:t,column:r})??null})]}):null}}]})})]})]})]})})),Lp=(0,bt.PA)((e=>{const{column:t}=e,[n,o,r,i]=jc();return(0,E.jsxs)("div",{className:"group relative flex h-full items-center",children:[!i&&(0,E.jsx)("div",{className:"flex h-[18px] w-32 items-center border border-transparent px-2 text-sm text-neutral-400 group-hover:invisible",children:t.direction}),i&&(0,E.jsxs)("div",{className:"flex h-[18px] w-32 items-center justify-between border border-sky-600 bg-sky-50 pl-2 pr-0.5 text-sm",children:[(0,E.jsx)("div",{children:t.direction}),(0,E.jsx)("div",{children:(0,E.jsx)(dr.CaretDown,{})})]}),(0,E.jsxs)("button",{className:"invisible absolute right-0 z-10 flex h-[18px] w-32 items-center justify-between border border-neutral-400 pl-2 pr-0.5 text-sm text-neutral-700 group-hover:visible",onClickCapture:e=>{e.stopPropagation(),n(e)},onClick:e=>e.stopPropagation(),children:[(0,E.jsx)("div",{children:t.direction}),(0,E.jsx)("div",{children:(0,E.jsx)(dr.CaretDown,{})})]}),(0,E.jsx)(Zc,{className:"w-32",...r,children:[di.ASCENDING,di.DESCENDING].map((e=>(0,E.jsx)(eu,{onClick:()=>{t.setDirection(e),o()},autoFocus:t.direction===e,children:e},e)))})]})})),Fp=(0,bt.PA)((e=>{const{column:t}=e;return(0,E.jsx)("div",{className:"h-full flex-1 items-center overflow-hidden overflow-ellipsis whitespace-nowrap pl-2",children:t.name.split(mi).join(" / ")})})),Pp=(0,bt.PA)((e=>{const{view:t}=e,n=t.editor.sorts;return(0,E.jsxs)("div",{className:"h-full w-full select-none p-2",children:[(0,E.jsxs)("div",{className:"flex h-6",children:[(0,E.jsx)("div",{className:"flex h-6 items-center text-xl font-medium",children:(0,E.jsx)(dr.TableSort,{})}),(0,E.jsx)("div",{className:"ml-1 flex h-6 items-center text-xl font-medium",children:"Sorts"})]}),(0,E.jsx)("div",{className:"flex h-[calc(100%_-_24px)] w-full",children:(0,E.jsx)(Op,{selector:n.selector,columnLabelRenderer:e=>(0,E.jsx)(Fp,{...e}),columnActionRenderer:e=>(0,E.jsx)(Lp,{...e})})})]})}));var Bp;!function(e){e.EXTENDED_COLUMN_LEVELS="data-cube.extended-column.levels",e.GRID_CONFIGURATION_ROW_LIMIT="data-cube.grid-configuration.row-limit",e.COLUMN_CONFIGURATION_KIND="data-cube.column-configuration.kind",e.COLUMN_CONFIGURATION_UNIT="data-cube.column-configuration.unit",e.COLUMN_CONFIGURATION_DISPLAY_AS_LINK="data-cube.column-configuration.display-value-as-link",e.COLUMN_CONFIGURATION_MISSING_VALUE_FORMAT="data-cube.column-configuration.missing-value-format"}(Bp||(Bp={}));const Dp=(0,bt.PA)((e=>{const{view:t}=e,n=t.editor.generalProperties,o=n.configuration,[r,i,a,s]=jc(),[l,c,u,d]=jc(),[p,g,m,h]=jc(),[f,C,b,v]=jc(),[_,T,N]=jc(),[S,A,y]=jc();return(0,E.jsxs)("div",{className:"h-full w-full select-none p-2",children:[(0,E.jsxs)("div",{className:"flex h-6",children:[(0,E.jsx)("div",{className:"flex h-6 items-center text-xl font-medium",children:(0,E.jsx)(dr.TableOptions,{})}),(0,E.jsx)("div",{className:"ml-1 flex h-6 items-center text-xl font-medium",children:"General Properties"})]}),(0,E.jsx)("div",{className:"flex h-[calc(100%_-_24px)] w-full",children:(0,E.jsxs)("div",{className:"h-full w-full py-2",children:[(0,E.jsxs)("div",{className:"flex h-6 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:"Report Title:"}),(0,E.jsx)(qc,{className:"h-6 w-96 text-lg font-semibold",value:o.name,onChange:e=>{o.setName(e.target.value)}})]}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:"Tree Column:"}),(0,E.jsx)(Jc,{label:"Show root aggregation",checked:o.showRootAggregation,onChange:()=>o.setShowRootAggregation(!o.showRootAggregation)}),(0,E.jsx)(Jc,{className:"ml-3",label:"Show leaf count",checked:o.showLeafCount,onChange:()=>o.setShowLeafCount(!o.showLeafCount)})]}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm"}),(0,E.jsx)("div",{className:"mr-1 flex h-full flex-shrink-0 items-center text-sm",children:"Sort:"}),(0,E.jsx)(Qc,{className:"w-20",onClick:r,open:s,children:o.treeColumnSortDirection}),(0,E.jsx)(Zc,{className:"w-20",...a,children:[di.ASCENDING,di.DESCENDING].map((e=>(0,E.jsx)(eu,{onClick:()=>{o.setTreeColumnSortDirection(e),i()},autoFocus:e===o.treeColumnSortDirection,children:e},e)))}),(0,E.jsx)("div",{className:"ml-3 mr-1 flex h-full flex-shrink-0 items-center text-sm",children:"Initially expand to level:"}),(0,E.jsx)(Qc,{className:"w-16",onClick:l,open:d,showAsPlaceholder:void 0===o.initialExpandLevel,children:o.initialExpandLevel??Pi}),(0,E.jsx)(Zc,{className:"w-16",...u,children:[void 0,1,2,3,4,5,6,7,8].map((e=>(0,E.jsx)(eu,{onClick:()=>{o.setInitialExpandLevel(e),c()},autoFocus:e===o.initialExpandLevel,children:e??Pi},e??"")))})]}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsxs)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:["Row Limit:",(0,E.jsx)(ru,{className:"ml-1",documentationKey:Bp.GRID_CONFIGURATION_ROW_LIMIT})]}),(0,E.jsx)(Kc,{className:"w-16 text-sm",value:n.limit,min:0,step:1,defaultValue:void 0,placeholder:Pi,setValue:e=>n.setLimit(e)})]}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm"}),(0,E.jsx)(Jc,{label:"Display warning when truncated",checked:o.showWarningForTruncatedResult,onChange:()=>o.setShowWarningForTruncatedResult(!o.showWarningForTruncatedResult)})]}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:"Show Selection Stats?"}),(0,E.jsx)(Jc,{checked:o.showSelectionStats,onChange:()=>o.setShowSelectionStats(!o.showSelectionStats),disabled:!0}),(0,E.jsx)(zc,{})]}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:"Show Lines?"}),(0,E.jsx)(Jc,{label:"Horizontal",checked:o.showHorizontalGridLines,onChange:()=>o.setShowHorizontalGridLines(!o.showHorizontalGridLines)}),(0,E.jsx)(Jc,{className:"ml-3",label:"Vertical",checked:o.showVerticalGridLines,onChange:()=>o.setShowVerticalGridLines(!o.showVerticalGridLines)}),(0,E.jsx)("div",{className:"ml-3 mr-1 flex h-full flex-shrink-0 items-center text-sm",children:"Color:"}),(0,E.jsx)(ou,{color:o.gridLineColor,defaultColor:_i,onChange:e=>o.setGridLineColor(e)})]}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:"Hightlight Rows:"}),(0,E.jsx)(Jc,{label:"Standard mode",checked:o.alternateRowsStandardMode,onChange:()=>{o.alternateRowsStandardMode?o.setAlternateRowsStandardMode(!1):(o.setAlternateRowsStandardMode(!0),o.setAlternateRows(!1))}}),(0,E.jsx)(Jc,{className:"ml-3",checked:o.alternateRows,onChange:()=>{o.alternateRows?o.setAlternateRows(!1):(o.setAlternateRows(!0),o.setAlternateRowsStandardMode(!1))}}),(0,E.jsx)("div",{className:"ml-1 mr-1 flex h-full flex-shrink-0 items-center text-sm",children:"Custom: Alternate color:"}),(0,E.jsx)(ou,{disabled:!o.alternateRows,color:o.alternateRowsColor,defaultColor:Ti,onChange:e=>o.setAlternateRowsColor(e)}),(0,E.jsx)("div",{className:"ml-1 flex h-full flex-shrink-0 items-center text-sm",children:"every:"}),(0,E.jsx)(Kc,{className:"ml-1 w-16 text-sm",disabled:!o.alternateRows,min:1,step:1,defaultValue:1,isValid:e=>void 0!==e&&e>0,value:o.alternateRowsCount,setValue:e=>o.setAlternateRowsCount(e??1)}),(0,E.jsx)("div",{className:"ml-1 flex-shrink-0 text-sm",children:"rows"})]}),(0,E.jsx)("div",{className:"my-2 h-[1px] w-full bg-neutral-200"}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:"Default Font:"}),(0,E.jsx)(Qc,{className:"w-28",onClick:p,open:h,children:o.fontFamily}),(0,E.jsxs)(Zc,{className:"w-28",...m,children:[[ti.ARIAL,ti.ROBOTO,ti.ROBOTO_CONDENSED].map((e=>(0,E.jsx)(eu,{onClick:()=>{o.setFontFamily(e),g()},autoFocus:e===o.fontFamily,children:e},e))),(0,E.jsx)(tu,{}),[ti.GEORGIA,ti.ROBOTO_SERIF,ti.TIMES_NEW_ROMAN].map((e=>(0,E.jsx)(eu,{onClick:()=>{o.setFontFamily(e),g()},autoFocus:e===o.fontFamily,children:e},e))),(0,E.jsx)(tu,{}),[ti.JERBRAINS_MONO,ti.ROBOTO_MONO,ti.UBUNTU_MONO].map((e=>(0,E.jsx)(eu,{onClick:()=>{o.setFontFamily(e),g()},autoFocus:e===o.fontFamily,children:e},e)))]}),(0,E.jsx)(Qc,{className:"ml-1 w-10",onClick:f,open:v,children:o.fontSize}),(0,E.jsx)(Zc,{className:"w-10",...b,children:[4,5,6,7,8,9,10,11,12,14,16,18,20,22,24,26,28,32,36,48,72].map((e=>(0,E.jsx)(eu,{onClick:()=>{o.setFontSize(e),C()},autoFocus:e===o.fontSize,children:e},e)))}),(0,E.jsxs)("div",{className:"relative ml-2 flex h-5",children:[(0,E.jsx)("button",{title:"Bold",className:jn("relative flex h-5 w-5 items-center justify-center rounded-bl-sm rounded-tl-sm border border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":o.fontBold}),onClick:()=>o.setFontBold(!o.fontBold),children:(0,E.jsx)(dr.FontBold,{})}),(0,E.jsx)("button",{title:"Italic",className:jn("relative -ml-[1px] flex h-5 w-5 items-center justify-center border border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":o.fontItalic}),onClick:()=>o.setFontItalic(!o.fontItalic),children:(0,E.jsx)(dr.FontItalic,{})}),(0,E.jsx)("button",{title:"Underline"+(o.fontUnderline?` (${o.fontUnderline})`:""),className:jn("relative -ml-[1px] flex h-5 w-5 items-center justify-center border border-r-0 border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":void 0!==o.fontUnderline}),onClick:()=>{void 0===o.fontUnderline?(o.setFontUnderline(ri.SOLID),o.setFontStrikethrough(!1)):o.setFontUnderline(void 0)},children:(0,E.jsx)(dr.FontUnderline,{})}),(0,E.jsxs)("button",{className:"text-2xs relative -ml-[1px] flex h-5 w-2.5 items-center justify-center border border-l-0 border-neutral-400 bg-neutral-50 p-0 text-neutral-600 focus:z-[1]",onClick:_,children:[(0,E.jsx)("div",{className:jn("h-4 w-[0.5px] bg-neutral-200",{"opacity-0":void 0!==o.fontUnderline})}),(0,E.jsx)(dr.CaretDown,{})]}),(0,E.jsx)(Zc,{className:"w-14",...N,children:[ri.SOLID,ri.DASHED,ri.DOTTED,ri.DOUBLE,ri.WAVY].map((e=>(0,E.jsx)(eu,{className:"relative",onClick:()=>{o.setFontUnderline(e),o.setFontStrikethrough(!1),T()},autoFocus:e===o.fontUnderline,children:(0,E.jsx)("div",{className:jn("!hover:underline absolute top-0 !underline",{"!hover:decoration-solid !decoration-solid":e===ri.SOLID,"!hover:decoration-dashed !decoration-dashed":e===ri.DASHED,"!hover:decoration-dotted !decoration-dotted":e===ri.DOTTED,"!hover:decoration-double !decoration-double":e===ri.DOUBLE,"!hover:decoration-wavy !decoration-wavy":e===ri.WAVY}),children:"                "})},e)))}),(0,E.jsx)("button",{title:"Strikethrough",className:jn("relative -ml-[1px] flex h-5 w-5 items-center justify-center border border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":o.fontStrikethrough}),onClick:()=>{o.fontStrikethrough?o.setFontStrikethrough(!1):(o.setFontStrikethrough(!0),o.setFontUnderline(void 0))},children:(0,E.jsx)(dr.FontStrikethrough,{})}),(0,E.jsx)("button",{title:"Case"+(o.fontCase?` (${o.fontCase})`:""),className:jn("relative -ml-[1px] flex h-5 w-5 items-center justify-center border border-r-0 border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":void 0!==o.fontCase}),onClick:()=>{o.setFontCase(void 0===o.fontCase?oi.UPPERCASE:void 0)},children:(0,E.jsx)(dr.FontCase,{className:"stroke-[0.5px]"})}),(0,E.jsxs)("button",{className:"text-2xs relative -ml-[1px] flex h-5 w-2.5 items-center justify-center rounded-br-sm rounded-tr-sm border border-l-0 border-neutral-400 bg-neutral-50 p-0 text-neutral-600 focus:z-[1]",onClick:S,children:[(0,E.jsx)("div",{className:jn("h-4 w-[0.5px] bg-neutral-200",{"opacity-0":void 0!==o.fontCase})}),(0,E.jsx)(dr.CaretDown,{})]}),(0,E.jsx)(Zc,{className:"w-20",...y,children:[oi.LOWERCASE,oi.UPPERCASE,oi.CAPITALIZE].map((e=>(0,E.jsx)(eu,{onClick:()=>{o.setFontCase(e),A()},autoFocus:e===o.fontCase,children:(0,E.jsx)("div",{className:jn({lowercase:e===oi.LOWERCASE,uppercase:e===oi.UPPERCASE,capitalize:e===oi.CAPITALIZE}),children:e})},e)))})]}),(0,E.jsxs)("div",{className:"relative ml-2 flex h-5",children:[(0,E.jsx)("button",{title:"Align Left",className:jn("relative flex h-5 w-5 items-center justify-center rounded-bl-sm rounded-tl-sm border border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":o.textAlign===ni.LEFT}),onClick:()=>o.setTextAlign(ni.LEFT),children:(0,E.jsx)(dr.TextAlignLeft,{})}),(0,E.jsx)("button",{title:"Align Center",className:jn("relative -ml-[1px] flex h-5 w-5 items-center justify-center border border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":o.textAlign===ni.CENTER}),onClick:()=>o.setTextAlign(ni.CENTER),children:(0,E.jsx)(dr.TextAlignCenter,{})}),(0,E.jsx)("button",{title:"Align Right",className:jn("relative -ml-[1px] flex h-5 w-5 items-center justify-center rounded-br-sm rounded-tr-sm border border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":o.textAlign===ni.RIGHT}),onClick:()=>o.setTextAlign(ni.RIGHT),children:(0,E.jsx)(dr.TextAlignRight,{})})]})]}),(0,E.jsxs)("div",{className:"mt-2 flex w-full",children:[(0,E.jsx)("div",{className:"flex h-6 w-32 flex-shrink-0 items-center text-sm",children:"Default Colors:"}),(0,E.jsxs)("div",{className:"h-18",children:[(0,E.jsxs)("div",{className:"flex h-6",children:[(0,E.jsx)("div",{className:"w-16 flex-shrink-0"}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center text-sm",children:"Normal"}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center text-sm",children:"Negative"}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center text-sm",children:"Zero"}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center text-sm",children:"Error"})]}),(0,E.jsxs)("div",{className:"flex h-6",children:[(0,E.jsx)("div",{className:"flex h-full w-16 flex-shrink-0 items-center text-sm",children:"Foreground:"}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:o.normalForegroundColor,defaultColor:wi,onChange:e=>o.setNormalForegroundColor(e)})}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:o.negativeForegroundColor,defaultColor:Oi,onChange:e=>o.setNegativeForegroundColor(e)})}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:o.zeroForegroundColor,defaultColor:Li,onChange:e=>o.setZeroForegroundColor(e)})}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:o.errorForegroundColor,defaultColor:Fi,onChange:e=>o.setErrorForegroundColor(e)})})]}),(0,E.jsxs)("div",{className:"flex h-6",children:[(0,E.jsx)("div",{className:"flex h-full w-16 flex-shrink-0 items-center text-sm",children:"Background:"}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:o.normalBackgroundColor,defaultColor:ki,onChange:e=>o.setNormalBackgroundColor(e)})}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:o.negativeBackgroundColor,defaultColor:ki,onChange:e=>o.setNegativeBackgroundColor(e)})}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:o.zeroBackgroundColor,defaultColor:ki,onChange:e=>o.setZeroBackgroundColor(e)})}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:o.errorBackgroundColor,defaultColor:ki,onChange:e=>o.setErrorBackgroundColor(e)})})]})]})]}),(0,E.jsxs)("div",{className:"mt-2 flex w-full",children:[(0,E.jsx)("div",{className:"flex h-6 w-32 flex-shrink-0 items-center text-sm"}),(0,E.jsxs)("div",{className:"w-80",children:[(0,E.jsx)("div",{className:"mb-2 h-[1px] w-full bg-neutral-200"}),(0,E.jsx)(Xc,{compact:!0,disabled:o.isUsingDefaultStyling,onClick:()=>o.useDefaultStyling(),children:"Use Default Styling"})]})]})]})})]})})),jp=(0,bt.PA)((e=>{const{column:t,editor:n}=e,o=n.columnProperties.getColumnConfiguration(t.name).hideFromView;return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{className:jn("items-center overflow-hidden overflow-ellipsis whitespace-nowrap pl-2",{"text-neutral-400":o}),children:t.name}),Boolean(Hi(n.leafExtendColumns,t.name))&&(0,E.jsx)("div",{className:"ml-1.5 mr-0.5 flex h-3.5 flex-shrink-0 items-center rounded-sm border border-neutral-300 bg-neutral-100 px-1 text-xs font-medium uppercase text-neutral-600",children:"Extended (Leaf Level)"}),Boolean(Hi(n.groupExtendColumns,t.name))&&(0,E.jsx)("div",{className:"ml-1.5 mr-0.5 flex h-3.5 flex-shrink-0 items-center rounded-sm border border-neutral-300 bg-neutral-100 px-1 text-xs font-medium uppercase text-neutral-600",children:"Extended (Group Level)"})]})})),Mp=(0,bt.PA)((e=>{const{view:t}=e,n=t.editor,o=n.columns;return(0,Lt.useEffect)((()=>()=>o.propagateChanges()),[o]),(0,E.jsxs)("div",{className:"h-full w-full select-none p-2",children:[(0,E.jsxs)("div",{className:"flex h-6 justify-between",children:[(0,E.jsxs)("div",{className:"flex h-full",children:[(0,E.jsx)("div",{className:"flex h-6 items-center text-xl font-medium",children:(0,E.jsx)(dr.TableColumns,{})}),(0,E.jsx)("div",{className:"ml-1 flex h-6 items-center text-xl font-medium",children:"Columns"})]}),(0,E.jsx)("div",{className:"flex h-full items-center pr-2",children:(0,E.jsx)(Jc,{label:"Show hidden columns?",checked:o.selector.showHiddenColumns,onChange:()=>o.selector.setShowHiddenColumns(!o.selector.showHiddenColumns)})})]}),(0,E.jsx)("div",{className:"flex h-[calc(100%_-_24px)] w-full",children:(0,E.jsx)(Op,{selector:o.selector,noColumnsSelectedRenderer:()=>(0,E.jsxs)("div",{className:"flex items-center border-[1.5px] border-neutral-200 p-2 font-semibold text-neutral-400",children:[(0,E.jsx)("div",{children:(0,E.jsx)(dr.Warning,{className:"mr-1 text-lg"})}),"No columns selected"]}),columnLabelRenderer:e=>(0,E.jsx)(jp,{...e,editor:n})})})]})})),Up=(0,bt.PA)((e=>{const{view:t}=e,n=t.editor.verticalPivots;return(0,E.jsxs)("div",{className:"h-full w-full select-none p-2",children:[(0,E.jsxs)("div",{className:"flex h-6",children:[(0,E.jsx)("div",{className:"flex h-6 items-center text-xl font-medium",children:(0,E.jsx)(dr.TableGroupBy,{})}),(0,E.jsx)("div",{className:"ml-1 flex h-6 items-center text-xl font-medium",children:"Vertical Pivots"})]}),(0,E.jsx)("div",{className:"flex h-[calc(100%_-_24px)] w-full",children:(0,E.jsx)(Op,{selector:n.selector})})]})})),Gp=(0,bt.PA)((e=>{const{view:t}=e,n=t.editor.horizontalPivots;return(0,Lt.useEffect)((()=>()=>n.propagateChanges()),[n]),(0,E.jsxs)("div",{className:"h-full w-full select-none p-2",children:[(0,E.jsxs)("div",{className:"flex h-6",children:[(0,E.jsx)("div",{className:"flex h-6 items-center text-xl font-medium",children:(0,E.jsx)(dr.TablePivot,{})}),(0,E.jsx)("div",{className:"ml-1 flex h-6 items-center text-xl font-medium",children:"Horizontal Pivots"})]}),(0,E.jsx)("div",{className:"flex h-[calc(100%_-_24px)] w-full",children:(0,E.jsx)(Op,{selector:n.selector,columnActionRenderer:e=>(0,E.jsx)(Lp,{...e})})})]})})),Vp=(0,bt.PA)((e=>{const{view:t}=e,n=t.editor,o=n.columnProperties,r=t.editor.generalProperties.configuration,i=o.selectedColumn,[a,s,l,c]=jc(),[u,d,p,g]=jc(),[m,h,f,C]=jc(),[b,v,_,T]=jc(),[N,S,A,y]=jc(),[x,I,w,k]=jc(),[R,O,L,F]=jc(),[P,B,D]=jc(),[j,M,U]=jc();return(0,E.jsxs)("div",{className:"h-full w-full select-none p-2",children:[(0,E.jsxs)("div",{className:"flex h-6 justify-between",children:[(0,E.jsxs)("div",{className:"flex h-full",children:[(0,E.jsxs)("div",{className:"relative flex h-6 items-center text-xl font-medium",children:[(0,E.jsx)(dr.TableColumn,{}),(0,E.jsx)(dr.TableColumnOptions__Settings,{className:"absolute bottom-1 right-0 bg-white text-xs"})]}),(0,E.jsx)("div",{className:"ml-1 flex h-6 items-center text-xl font-medium",children:"Column Properties"})]}),(0,E.jsxs)("div",{className:"flex h-full items-center pr-2",children:[(0,E.jsx)(Jc,{label:"Show advanced settings?",checked:o.showAdvancedSettings,onChange:()=>o.setShowAdvancedSettings(!o.showAdvancedSettings)}),(0,E.jsx)(Yc,{})]})]}),(0,E.jsx)("div",{className:"flex h-[calc(100%_-_24px)] w-full",children:(0,E.jsxs)("div",{className:"h-full w-full py-2",children:[(0,E.jsxs)("div",{className:"flex h-6 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:"Choose Column:"}),(0,E.jsx)(Qc,{className:"w-80",onClick:a,open:c,children:(0,E.jsxs)("div",{className:"flex h-full w-full items-center",children:[(0,E.jsx)("div",{className:"overflow-hidden overflow-ellipsis whitespace-nowrap",children:i?.name??Pi}),i&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{className:"ml-1.5 mr-0.5 flex h-3.5 w-12 flex-shrink-0 items-center justify-center rounded-sm border border-neutral-300 bg-neutral-100 text-xs font-medium uppercase text-neutral-600",children:i.dataType}),Boolean(Hi(n.leafExtendColumns,i.name))&&(0,E.jsx)("div",{className:"mr-0.5 flex h-3.5 flex-shrink-0 items-center rounded-sm border border-neutral-300 bg-neutral-100 px-1 text-xs font-medium uppercase text-neutral-600",children:"Extended (Leaf Level)"}),Boolean(Hi(n.groupExtendColumns,i.name))&&(0,E.jsx)("div",{className:"mr-0.5 flex h-3.5 flex-shrink-0 items-center rounded-sm border border-neutral-300 bg-neutral-100 px-1 text-xs font-medium uppercase text-neutral-600",children:"Extended (Group Level)"})]})]})}),(0,E.jsx)(Zc,{className:"w-80",...l,children:o.columns.toSorted($i).map((e=>(0,E.jsxs)(eu,{onClick:()=>{o.setSelectedColumnName(e.name),s()},autoFocus:e.name===i?.name,children:[(0,E.jsx)("div",{className:"overflow-hidden overflow-ellipsis whitespace-nowrap",children:e.name}),(0,E.jsx)("div",{className:"ml-1.5 mr-0.5 flex h-3.5 w-12 flex-shrink-0 items-center justify-center rounded-sm border border-neutral-300 bg-neutral-100 text-xs font-medium uppercase text-neutral-600",children:e.dataType}),Boolean(Hi(n.leafExtendColumns,e.name))&&(0,E.jsx)("div",{className:"mr-0.5 flex h-3.5 flex-shrink-0 items-center rounded-sm border border-neutral-300 bg-neutral-100 px-1 text-xs font-medium uppercase text-neutral-600",children:"Extended (Leaf Level)"}),Boolean(Hi(n.groupExtendColumns,e.name))&&(0,E.jsx)("div",{className:"mr-0.5 flex h-3.5 flex-shrink-0 items-center rounded-sm border border-neutral-300 bg-neutral-100 px-1 text-xs font-medium uppercase text-neutral-600",children:"Extended (Group Level)"})]},e.name)))}),o.showAdvancedSettings&&i&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{className:"mx-2 h-[1px] w-4 flex-shrink-0 bg-neutral-400"}),(0,E.jsxs)("div",{className:"flex h-6 items-center",children:[(0,E.jsxs)("div",{className:"flex h-full flex-shrink-0 items-center text-sm",children:["Column Kind:",(0,E.jsx)(ru,{className:"ml-1",documentationKey:Bp.COLUMN_CONFIGURATION_KIND})]}),(0,E.jsx)(Qc,{className:"ml-1.5 w-20",onClick:u,open:g,disabled:Boolean(Hi(n.verticalPivots.selector.selectedColumns,i.name)??Hi(n.horizontalPivots.selector.selectedColumns,i.name)),title:Boolean(Hi(n.verticalPivots.selector.selectedColumns,i.name)??Hi(n.horizontalPivots.selector.selectedColumns,i.name))?"Column kind cannot be changed while the column is used in pivot":void 0,children:i.kind}),(0,E.jsx)(Zc,{className:"w-20",...p,children:[ii.DIMENSION,ii.MEASURE].map((e=>(0,E.jsx)(eu,{onClick:()=>{e!==i.kind&&(i.setKind(e),i.setExcludedFromPivot(e===ii.DIMENSION),i.setPivotStatisticColumnFunction(e===ii.DIMENSION?void 0:li.SUM)),d()},autoFocus:e===i.kind,children:e},e)))}),(0,E.jsx)(Yc,{})]})]})]}),(0,E.jsx)("div",{className:"mb-2 ml-2 mt-3 h-[1px] w-[calc(100%_-_16px)] bg-neutral-200"}),i&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:"Display Name:"}),(0,E.jsx)(qc,{className:"w-80",value:i.displayName??"",onChange:e=>{const t=e.target.value;i.setDisplayName(""!==t?t:void 0)}})]}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:"Aggregation:"}),(0,E.jsx)(Qc,{className:"w-32",onClick:m,disabled:i.kind===ii.DIMENSION,open:C,children:i.aggregateOperation.operator}),(0,E.jsx)(Zc,{className:"w-32",...f,children:t.engine.aggregateOperations.filter((e=>e.isCompatibleWithColumn(i))).map((e=>(0,E.jsx)(eu,{onClick:()=>{e!==i.aggregateOperation&&(i.setAggregateOperation(e),i.setAggregationParameters(e.generateDefaultParameterValues(i))),h()},autoFocus:e===i.aggregateOperation,children:e.label},e.operator)))}),(0,E.jsx)(Jc,{className:"ml-3",label:"Exclude from horizontal pivot",checked:i.excludedFromPivot,onChange:()=>i.setExcludedFromPivot(!i.excludedFromPivot),disabled:i.kind===ii.DIMENSION})]}),i.dataType===gi.NUMBER&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:"Number Format:"}),(0,E.jsx)(Kc,{className:"w-16 text-sm",min:0,step:1,value:i.decimals??0,setValue:e=>{i.setDecimals(e)}}),(0,E.jsx)("div",{className:"ml-1 flex-shrink-0 text-sm",children:"decimal places"}),(0,E.jsx)(Jc,{className:"ml-3",label:"Display commas",checked:i.displayCommas,onChange:()=>i.setDisplayCommas(!i.displayCommas)}),(0,E.jsx)(Jc,{className:"ml-3",label:"Negative number in parens",checked:i.negativeNumberInParens,onChange:()=>i.setNegativeNumberInParens(!i.negativeNumberInParens)})]}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm"}),(0,E.jsx)("div",{className:"mr-1 flex h-full flex-shrink-0 items-center text-sm",children:"Scale:"}),(0,E.jsx)(Qc,{className:"w-32",onClick:b,open:T,showAsPlaceholder:void 0===i.numberScale,children:i.numberScale??Pi}),(0,E.jsx)(Zc,{className:"w-32",..._,children:[void 0,ei.PERCENT,ei.BASIS_POINT,ei.THOUSANDS,ei.MILLIONS,ei.BILLIONS,ei.TRILLIONS,ei.AUTO].map((e=>(0,E.jsx)(eu,{onClick:()=>{i.setNumberScale(e),v()},autoFocus:e===i.numberScale,children:e??Pi},e??"")))}),(0,E.jsxs)("div",{className:"ml-3 mr-1 flex h-full flex-shrink-0 items-center text-sm",children:["Unit:",(0,E.jsx)(ru,{className:"ml-1",documentationKey:Bp.COLUMN_CONFIGURATION_UNIT})]}),(0,E.jsx)(qc,{className:"w-16",value:i.unit??"",onChange:e=>{const t=e.target.value.trim();i.setUnit(""!==t.trim()?t:void 0)},placeholder:Pi})]})]}),i.dataType===gi.TEXT&&(0,E.jsx)(E.Fragment,{children:(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsxs)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:["Dislay as Link?",(0,E.jsx)(ru,{className:"ml-1",documentationKey:Bp.COLUMN_CONFIGURATION_DISPLAY_AS_LINK})]}),(0,E.jsx)(Jc,{checked:i.displayAsLink,onChange:()=>i.setDisplayAsLink(!i.displayAsLink)}),(0,E.jsx)("div",{className:"ml-1 h-[1px] w-2 flex-shrink-0 bg-neutral-400"}),(0,E.jsx)("div",{className:"ml-2 mr-1.5 flex h-full flex-shrink-0 items-center text-sm",children:"Use parameter in link as label:"}),(0,E.jsx)(qc,{className:"w-48",placeholder:vi,value:i.linkLabelParameter??"",onChange:e=>{const t=e.target.value.trim();i.setLinkLabelParameter(""!==t?t:void 0)}})]})}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsxs)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:["Missing Value Format:",(0,E.jsx)(ru,{className:"ml-1",documentationKey:Bp.COLUMN_CONFIGURATION_MISSING_VALUE_FORMAT})]}),(0,E.jsx)(qc,{className:"w-16",value:i.missingValueDisplayText??"",onChange:e=>{const t=e.target.value;i.setMissingValueDisplayText(""!==t?t:void 0)},placeholder:Pi})]}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:"Visibility:"}),(0,E.jsx)(Jc,{label:"Blur content",checked:i.blur,onChange:()=>i.setBlur(!i.blur),disabled:i.hideFromView}),(0,E.jsx)(Jc,{className:"ml-3",label:"Hide from view",checked:i.hideFromView,onChange:()=>i.setHideFromView(!i.hideFromView)})]}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:"Pin:"}),(0,E.jsx)(Qc,{className:"w-16",onClick:N,open:y,showAsPlaceholder:void 0===i.pinned,children:i.pinned??Pi}),(0,E.jsx)(Zc,{className:"w-16",...A,children:[void 0,pi.LEFT,pi.RIGHT].map((e=>(0,E.jsx)(eu,{onClick:()=>{i.setPinned(e),S()},autoFocus:e===i.pinned,children:e??Pi},e??"")))})]}),(0,E.jsxs)("div",{className:"mt-1.5 flex h-6 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:"Width:"}),(0,E.jsx)(Jc,{label:"(Any)",checked:void 0===i.fixedWidth&&void 0===i.minWidth&&void 0===i.maxWidth,onChange:()=>{void 0===i.fixedWidth&&void 0===i.minWidth&&void 0===i.maxWidth?(i.setFixedWidth(300),i.setMinWidth(void 0),i.setMaxWidth(void 0)):(i.setFixedWidth(void 0),i.setMinWidth(void 0),i.setMaxWidth(void 0))}}),(0,E.jsx)(Jc,{className:"ml-3",label:"Fixed",checked:void 0!==i.fixedWidth,onChange:()=>{i.setFixedWidth(void 0!==i.fixedWidth?void 0:300),i.setMinWidth(void 0),i.setMaxWidth(void 0)}}),(0,E.jsx)("div",{className:"ml-1 h-[1px] w-2 flex-shrink-0 bg-neutral-400"}),(0,E.jsx)(Kc,{className:"ml-1 w-16 text-sm",min:0,step:50,defaultValue:void 0,isValid:e=>void 0!==e&&e>0,value:i.fixedWidth,setValue:e=>{i.setFixedWidth(e)},disabled:void 0!==i.minWidth||void 0!==i.maxWidth}),(0,E.jsx)(Jc,{className:"ml-3",label:"In range",checked:void 0!==i.minWidth||void 0!==i.maxWidth,onChange:()=>{void 0===i.minWidth&&void 0===i.maxWidth?(i.setMinWidth(50),i.setMaxWidth(void 0),i.setFixedWidth(void 0)):(i.setMinWidth(void 0),i.setMaxWidth(void 0),i.setFixedWidth(void 0))}}),(0,E.jsx)("div",{className:"ml-1 h-[1px] w-2 flex-shrink-0 bg-neutral-400"}),(0,E.jsx)(Kc,{className:"ml-1 w-16 text-sm",min:0,step:50,defaultValue:void 0,isValid:e=>void 0!==e&&e>0,value:i.minWidth,setValue:e=>{i.setMinWidth(e)},disabled:void 0!==i.fixedWidth}),(0,E.jsx)("div",{className:"ml-1 h-[1px] w-1 flex-shrink-0 bg-neutral-400"}),(0,E.jsx)(Kc,{className:"ml-1 w-16 text-sm",min:i.minWidth??0,step:50,defaultValue:void 0,isValid:e=>void 0!==e&&e>=(i.minWidth??0),value:i.maxWidth,setValue:e=>{i.setMaxWidth(e)},disabled:void 0!==i.fixedWidth})]}),(0,E.jsx)("div",{className:"my-2 h-[1px] w-full bg-neutral-200"}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:"Font:"}),(0,E.jsx)(Qc,{className:"w-28",onClick:x,open:k,children:i.fontFamily??r.fontFamily}),(0,E.jsxs)(Zc,{className:"w-28",...w,children:[[ti.ARIAL,ti.ROBOTO,ti.ROBOTO_CONDENSED].map((e=>(0,E.jsx)(eu,{onClick:()=>{i.setFontFamily(e),I()},autoFocus:e===(i.fontFamily??r.fontFamily),children:e},e))),(0,E.jsx)(tu,{}),[ti.GEORGIA,ti.ROBOTO_SERIF,ti.TIMES_NEW_ROMAN].map((e=>(0,E.jsx)(eu,{onClick:()=>{i.setFontFamily(e),I()},autoFocus:e===(i.fontFamily??r.fontFamily),children:e},e))),(0,E.jsx)(tu,{}),[ti.JERBRAINS_MONO,ti.ROBOTO_MONO,ti.UBUNTU_MONO].map((e=>(0,E.jsx)(eu,{onClick:()=>{i.setFontFamily(e),I()},autoFocus:e===(i.fontFamily??r.fontFamily),children:e},e)))]}),(0,E.jsx)(Qc,{className:"ml-1 w-10",onClick:R,open:F,children:i.fontSize??r.fontSize}),(0,E.jsx)(Zc,{className:"w-10",...L,children:[4,5,6,7,8,9,10,11,12,14,16,18,20,22,24,26,28,32,36,48,72].map((e=>(0,E.jsx)(eu,{onClick:()=>{i.setFontSize(e),O()},autoFocus:e===(i.fontSize??r.fontSize),children:e},e)))}),(0,E.jsxs)("div",{className:"relative ml-2 flex h-5",children:[(0,E.jsx)("button",{title:"Bold",className:jn("relative flex h-5 w-5 items-center justify-center rounded-bl-sm rounded-tl-sm border border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":i.fontBold??r.fontBold}),onClick:()=>i.setFontBold(!(i.fontBold??r.fontBold)),children:(0,E.jsx)(dr.FontBold,{})}),(0,E.jsx)("button",{title:"Italic",className:jn("relative -ml-[1px] flex h-5 w-5 items-center justify-center border border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":i.fontItalic??r.fontItalic}),onClick:()=>i.setFontItalic(!(i.fontItalic??r.fontItalic)),children:(0,E.jsx)(dr.FontItalic,{})}),(0,E.jsx)("button",{title:"Underline"+(i.fontUnderline??r.fontUnderline?` (${i.fontUnderline??r.fontUnderline})`:""),className:jn("relative -ml-[1px] flex h-5 w-5 items-center justify-center border border-r-0 border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":void 0!==(i.fontUnderline??r.fontUnderline)}),onClick:()=>{void 0===(i.fontUnderline??r.fontUnderline)?(i.setFontUnderline(ri.SOLID),i.setFontStrikethrough(!1)):i.setFontUnderline(void 0)},children:(0,E.jsx)(dr.FontUnderline,{})}),(0,E.jsxs)("button",{className:"text-2xs relative -ml-[1px] flex h-5 w-2.5 items-center justify-center border border-l-0 border-neutral-400 bg-neutral-50 p-0 text-neutral-600 focus:z-[1]",onClick:P,children:[(0,E.jsx)("div",{className:jn("h-4 w-[0.5px] bg-neutral-200",{"opacity-0":void 0!==(i.fontUnderline??r.fontUnderline)})}),(0,E.jsx)(dr.CaretDown,{})]}),(0,E.jsx)(Zc,{className:"w-14",...D,children:[ri.SOLID,ri.DASHED,ri.DOTTED,ri.DOUBLE,ri.WAVY].map((e=>(0,E.jsx)(eu,{className:"relative",onClick:()=>{i.setFontUnderline(e),i.setFontStrikethrough(!1),B()},autoFocus:e===(i.fontUnderline??r.fontUnderline),children:(0,E.jsx)("div",{className:jn("!hover:underline absolute top-0 !underline",{"!hover:decoration-solid !decoration-solid":e===ri.SOLID,"!hover:decoration-dashed !decoration-dashed":e===ri.DASHED,"!hover:decoration-dotted !decoration-dotted":e===ri.DOTTED,"!hover:decoration-double !decoration-double":e===ri.DOUBLE,"!hover:decoration-wavy !decoration-wavy":e===ri.WAVY}),children:"                "})},e)))}),(0,E.jsx)("button",{title:"Strikethrough",className:jn("relative -ml-[1px] flex h-5 w-5 items-center justify-center border border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":i.fontStrikethrough??r.fontStrikethrough}),onClick:()=>{i.fontStrikethrough??r.fontStrikethrough?i.setFontStrikethrough(!1):(i.setFontStrikethrough(!0),i.setFontUnderline(void 0))},children:(0,E.jsx)(dr.FontStrikethrough,{})}),(0,E.jsx)("button",{title:"Case"+(i.fontCase??r.fontCase?` (${i.fontCase??r.fontCase})`:""),className:jn("relative -ml-[1px] flex h-5 w-5 items-center justify-center border border-r-0 border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":void 0!==(i.fontCase??r.fontCase)}),onClick:()=>{void 0===(i.fontCase??r.fontCase)?i.setFontCase(oi.UPPERCASE):i.setFontCase(void 0)},children:(0,E.jsx)(dr.FontCase,{className:"stroke-[0.5px]"})}),(0,E.jsxs)("button",{className:"text-2xs relative -ml-[1px] flex h-5 w-2.5 items-center justify-center rounded-br-sm rounded-tr-sm border border-l-0 border-neutral-400 bg-neutral-50 p-0 text-neutral-600 focus:z-[1]",onClick:j,children:[(0,E.jsx)("div",{className:jn("h-4 w-[0.5px] bg-neutral-200",{"opacity-0":void 0!==(i.fontCase??r.fontCase)})}),(0,E.jsx)(dr.CaretDown,{})]}),(0,E.jsx)(Zc,{className:"w-20",...U,children:[oi.LOWERCASE,oi.UPPERCASE,oi.CAPITALIZE].map((e=>(0,E.jsx)(eu,{onClick:()=>{i.setFontCase(e),M()},autoFocus:e===(i.fontCase??r.fontCase),children:(0,E.jsx)("div",{className:jn({lowercase:e===oi.LOWERCASE,uppercase:e===oi.UPPERCASE,capitalize:e===oi.CAPITALIZE}),children:e})},e)))})]}),(0,E.jsxs)("div",{className:"relative ml-2 flex h-5",children:[(0,E.jsx)("button",{title:"Align Left",className:jn("relative flex h-5 w-5 items-center justify-center rounded-bl-sm rounded-tl-sm border border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":(i.textAlign??r.textAlign)===ni.LEFT}),onClick:()=>i.setTextAlign(ni.LEFT),children:(0,E.jsx)(dr.TextAlignLeft,{})}),(0,E.jsx)("button",{title:"Align Center",className:jn("relative -ml-[1px] flex h-5 w-5 items-center justify-center border border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":(i.textAlign??r.textAlign)===ni.CENTER}),onClick:()=>i.setTextAlign(ni.CENTER),children:(0,E.jsx)(dr.TextAlignCenter,{})}),(0,E.jsx)("button",{title:"Align Right",className:jn("relative -ml-[1px] flex h-5 w-5 items-center justify-center rounded-br-sm rounded-tr-sm border border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":(i.textAlign??r.textAlign)===ni.RIGHT}),onClick:()=>i.setTextAlign(ni.RIGHT),children:(0,E.jsx)(dr.TextAlignRight,{})})]})]}),(0,E.jsxs)("div",{className:"mt-2 flex w-full",children:[(0,E.jsx)("div",{className:"flex h-6 w-32 flex-shrink-0 items-center text-sm",children:"Colors:"}),(0,E.jsxs)("div",{className:"h-18",children:[(0,E.jsxs)("div",{className:"flex h-6",children:[(0,E.jsx)("div",{className:"w-16 flex-shrink-0"}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center text-sm",children:"Normal"}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center text-sm",children:"Negative"}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center text-sm",children:"Zero"}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center text-sm",children:"Error"})]}),(0,E.jsxs)("div",{className:"flex h-6",children:[(0,E.jsx)("div",{className:"flex h-full w-16 flex-shrink-0 items-center text-sm",children:"Foreground:"}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:i.normalForegroundColor??r.normalForegroundColor,defaultColor:r.normalForegroundColor,onChange:e=>i.setNormalForegroundColor(e)})}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:i.negativeForegroundColor??r.negativeForegroundColor,defaultColor:r.negativeForegroundColor,onChange:e=>i.setNegativeForegroundColor(e)})}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:i.zeroForegroundColor??r.zeroForegroundColor,defaultColor:r.zeroForegroundColor,onChange:e=>i.setZeroForegroundColor(e)})}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:i.errorForegroundColor??r.errorForegroundColor,defaultColor:r.errorForegroundColor,onChange:e=>i.setErrorForegroundColor(e)})})]}),(0,E.jsxs)("div",{className:"flex h-6",children:[(0,E.jsx)("div",{className:"flex h-full w-16 flex-shrink-0 items-center text-sm",children:"Background:"}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:i.normalBackgroundColor??r.normalBackgroundColor,defaultColor:r.normalBackgroundColor,onChange:e=>i.setNormalBackgroundColor(e)})}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:i.negativeBackgroundColor??r.negativeBackgroundColor,defaultColor:r.negativeBackgroundColor,onChange:e=>i.setNegativeBackgroundColor(e)})}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:i.zeroBackgroundColor??r.zeroBackgroundColor,defaultColor:r.zeroBackgroundColor,onChange:e=>i.setZeroBackgroundColor(e)})}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:i.errorBackgroundColor??r.errorBackgroundColor,defaultColor:r.errorBackgroundColor,onChange:e=>i.setErrorBackgroundColor(e)})})]})]})]}),(0,E.jsxs)("div",{className:"mt-2 flex w-full",children:[(0,E.jsx)("div",{className:"flex h-6 w-32 flex-shrink-0 items-center text-sm"}),(0,E.jsxs)("div",{className:"w-80",children:[(0,E.jsx)("div",{className:"mb-2 h-[1px] w-full bg-neutral-200"}),(0,E.jsx)(Xc,{compact:!0,disabled:i.isUsingDefaultStyling,onClick:()=>i.useDefaultStyling(),children:"Use Default Styling"})]})]})]})]})})]})})),Hp=(0,bt.PA)((e=>{const t=$c().alertService,{view:n}=e,o=n.editor,r=o.currentTab,i=[Xp.COLUMNS,Xp.VERTICAL_PIVOTS,Xp.HORIZONTAL_PIVOTS,Xp.SORTS,Xp.GENERAL_PROPERTIES,Xp.COLUMN_PROPERTIES];return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("div",{className:"relative h-[calc(100%_-_40px)] w-full px-2 pt-8",children:[(0,E.jsx)("div",{className:"absolute top-0 flex h-9 w-[calc(100%_-_16px)] overflow-y-hidden pt-2",children:i.map((e=>(0,E.jsx)("button",{onClick:()=>o.setCurrentTab(e),className:jn("relative flex h-6 items-center justify-center whitespace-nowrap border border-b-0 border-l-0 border-neutral-300 px-2 first:border-l focus:z-10",{"-top-0.5 h-[27px] border-b-0 bg-white":e===r}),children:e},e)))}),(0,E.jsxs)("div",{className:"h-full w-full overflow-auto border border-neutral-300 bg-white",children:[r===Xp.COLUMNS&&(0,E.jsx)(Mp,{view:n}),r===Xp.VERTICAL_PIVOTS&&(0,E.jsx)(Up,{view:n}),r===Xp.HORIZONTAL_PIVOTS&&(0,E.jsx)(Gp,{view:n}),r===Xp.SORTS&&(0,E.jsx)(Pp,{view:n}),r===Xp.GENERAL_PROPERTIES&&(0,E.jsx)(Dp,{view:n}),r===Xp.COLUMN_PROPERTIES&&(0,E.jsx)(Vp,{view:n})]})]}),(0,E.jsxs)("div",{className:"flex h-10 items-center justify-end px-2",children:[(0,E.jsx)(Xc,{onClick:()=>o.display.close(),children:"Cancel"}),(0,E.jsx)(Xc,{className:"ml-2",disabled:o.finalizationState.isInProgress,onClick:()=>{o.applyChanges().catch((e=>t.alertUnhandledError(e)))},children:"Apply"}),(0,E.jsx)(Xc,{className:"ml-2",disabled:o.finalizationState.isInProgress,onClick:()=>{o.applyChanges({closeAfterApply:!0}).catch((e=>t.alertUnhandledError(e)))},children:"OK"})]})]})}));class Wp extends Ep{cloneColumn(e){return new Cp(e.name,e.type,e.direction,e.onChange)}get availableColumns(){return this._editor.columnProperties.columns.filter((e=>e.kind===ii.DIMENSION&&!Hi(this._editor.groupExtendColumns,e.name))).map((e=>new Cp(e.name,e.type,di.ASCENDING,(()=>this.onChange?.(this)))))}}class $p{_editor;selector;castColumns=[];constructor(e){(0,xe.Gn)(this,{castColumns:xe.sH.ref,pivotResultColumns:xe.EW,setCastColumns:xe.XI,applySnaphot:xe.XI}),this._editor=e,this.selector=new Wp(e,{onChange:e=>{this._editor.columnProperties.columns.forEach((t=>t.setPivotSortDirection(Hi(e.selectedColumns,t.name)?.direction)))}})}get pivotResultColumns(){return this.castColumns.filter((e=>Gi(e.name))).map(Wi)}setCastColumns(e){this.castColumns=e}propagateChanges(){this._editor.verticalPivots.adaptPropagatedChanges(),this._editor.sorts.adaptPropagatedChanges()}applySnaphot(e,t){this.selector.setSelectedColumns((e.data.pivot?.columns??[]).map((e=>new Cp(e.name,e.type,Hi(t.columns,e.name)?.pivotSortDirection??di.ASCENDING,(()=>this.selector.onChange?.(this.selector)))))),this.setCastColumns(e.data.pivot?.castColumns??[])}buildSnapshot(e,t){e.data.pivot=this.selector.selectedColumns.length?{columns:this.selector.selectedColumns.map(Wi),castColumns:this.castColumns.map(Wi)}:void 0,e.data.selectColumns=(0,tt.A)([...e.data.selectColumns,...this.selector.selectedColumns],(e=>e.name)).map(Wi)}}class zp{_editor;pivotLayout=new Tp;constructor(e){(0,xe.Gn)(this,{pivotLayout:xe.sH,applySnaphot:xe.XI}),this._editor=e}applySnaphot(e,t){this.pivotLayout=Tp.create(e.data.configuration.pivotLayout)}buildSnapshot(e,t){this.pivotLayout.setExpandedPaths(Zl(t.data.groupBy?.columns??[],this._editor.verticalPivots.selector.selectedColumns,this.pivotLayout.expandedPaths)),e.data.configuration={...e.data.configuration,pivotLayout:this.pivotLayout.serialize()}}}class Yp extends A{sourceInformation}var Xp;!function(e){e.GENERAL_PROPERTIES="General Properties",e.COLUMN_PROPERTIES="Column Properties",e.COLUMNS="Columns",e.VERTICAL_PIVOTS="Vertical Pivots",e.HORIZONTAL_PIVOTS="Horizontal Pivots",e.SORTS="Sorts"}(Xp||(Xp={}));class Kp extends sp{view;display;finalizationState=Ie.create();generalProperties;pivotLayout;columnProperties;columns;horizontalPivots;verticalPivots;sorts;currentTab=Xp.GENERAL_PROPERTIES;sourceColumns=[];leafExtendColumns=[];groupExtendColumns=[];constructor(e){super(e.engine,e.settingService,e.snapshotService),(0,xe.Gn)(this,{currentTab:xe.sH,setCurrentTab:xe.XI,sourceColumns:xe.sH.ref,leafExtendColumns:xe.sH.ref,groupExtendColumns:xe.sH.ref,applySnapshot:xe.XI,applyChanges:xe.XI}),this.view=e,this.display=this.view.dataCube.layoutService.newDisplay("Properties",(()=>(0,E.jsx)(Hp,{view:this.view}))),this.generalProperties=new Sp(this),this.pivotLayout=new zp(this),this.columnProperties=new Ap(this),this.columns=new xp(this),this.horizontalPivots=new $p(this),this.verticalPivots=new wp(this),this.sorts=new vp(this)}setCurrentTab(e){this.currentTab=e}async applySnapshot(e,t){this.sourceColumns=e.data.sourceColumns,this.leafExtendColumns=e.data.leafExtendedColumns,this.groupExtendColumns=e.data.groupExtendedColumns;const n=Xi.serialization.fromJson(e.data.configuration);this.generalProperties.applySnaphot(e,n),this.pivotLayout.applySnaphot(e,n),this.columnProperties.applySnaphot(e,n),this.columns.applySnaphot(e,n),this.horizontalPivots.applySnaphot(e,n),this.verticalPivots.applySnaphot(e,n),this.sorts.applySnaphot(e,n)}getSnapshotSubscriberName(){return"editor"}async applyChanges(e){this.finalizationState.inProgress();const t=P(this.getLatestSnapshot()),n=t.clone();if(this.generalProperties.buildSnapshot(n,t),this.pivotLayout.buildSnapshot(n,t),this.columnProperties.buildSnapshot(n,t),this.columns.buildSnapshot(n,t),this.horizontalPivots.buildSnapshot(n,t),this.verticalPivots.buildSnapshot(n,t),this.sorts.buildSnapshot(n,t),n.finalize(),n.hashCode!==t.hashCode){const e=this.view.taskService.newTask("Validating query..."),t=n.clone();t.data.pivot&&(t.data.pivot.castColumns=this.sorts.selector.availableColumns.filter((e=>!Hi(t.data.groupExtendedColumns,e.name))).map(Wi));const o="->",r=await this.view.engine.getPartialQueryCode(t,!0);try{await this.view.engine.getQueryCodeRelationReturnType(o+r,vl([],[this.view.source.query]),this.view.source)}catch(e){return w(e),void(e instanceof Yp?this.view.dataCube.alertService.alertCodeCheckError(e,r,o,{message:"Query Validation Failure: Can't safely apply changes. Check the query code below for more details.",text:`Error: ${e.message}`}):this.view.dataCube.alertService.alertError(e,{message:"Query Validation Failure: Can't safely apply changes.",text:`Error: ${e.message}`}))}finally{this.view.taskService.endTask(e),this.finalizationState.complete()}this.publishSnapshot(n)}else this.finalizationState.complete();e?.closeAfterApply&&this.display.close()}}function qp(e,t,n,o){const r=o.view.engine.getFilterOperation(t);return{name:`Add Filter: ${e.name} ${r.textLabel}${n.label?` ${n.label}`:""}`,action:()=>{o.addNewFilterCondition(new pp(o.filterTree.root,{name:e.name,type:e.type},r,n.value,void 0))}}}class Jp extends sp{view;constructor(e){super(e.engine,e.settingService,e.snapshotService),this.view=e}configuration=new Xi;menuBuilder;getColumnConfiguration(e){return Hi(this.configuration.columns,e)}filterTree={nodes:new Map};addNewFilterCondition(e){if(this.filterTree.root)if(this.filterTree.root.operation===ui.AND)this.filterTree.root.addChild(e),this.filterTree.nodes.set(e.uuid,e);else{const t=this.filterTree.root;if(1===t.children.length)t.operation=ui.AND,t.addChild(e),this.filterTree.nodes.set(e.uuid,e);else{const n=new gp(void 0,ui.AND,void 0);this.filterTree.nodes.set(n.uuid,n),this.filterTree.root=n,n.addChild(t),n.addChild(e),this.filterTree.nodes.set(e.uuid,e)}}else{const t=new gp(void 0,ui.AND,void 0);this.filterTree.nodes.set(t.uuid,t),this.filterTree.root=t,t.addChild(e),this.filterTree.nodes.set(e.uuid,e)}this.applyChanges()}clearFilters(){this.filterTree.root=void 0,this.filterTree.nodes=new Map,this.applyChanges()}selectColumns=[];leafExtendedColumns=[];groupExtendedColumns=[];pinColumn(e,t){const n=this.getColumnConfiguration(e);n&&(n.pinned=t,this.applyChanges())}rearrangeColumns(e){const t=e.map((e=>this.getColumnConfiguration(e))).filter(L);this.configuration.columns=[...t,...this.configuration.columns.filter((e=>!t.includes(e)))];const n=e.map((e=>Hi(this.selectColumns,e))).filter(L);this.selectColumns=[...n,...n.filter((e=>!n.includes(e)))],this.applyChanges()}removeAllPins(){this.configuration.columns.forEach((e=>e.pinned=void 0)),this.applyChanges()}showColumn(e,t){const n=this.getColumnConfiguration(e);n&&(n.hideFromView=!t,this.applyChanges())}horizontalPivotColumns=[];horizontalPivotCastColumns=[];get horizontalPivotResultColumns(){return this.horizontalPivotCastColumns.filter((e=>Gi(e.name))).map(Wi)}getHorizontalPivotableColumn(e){return Hi(this.configuration.columns.filter((e=>e.kind===ii.DIMENSION&&!Hi(this.groupExtendedColumns,e.name))),e)}setHorizontalPivotOnColumn(e){const t=this.getHorizontalPivotableColumn(e);t&&(this.horizontalPivotColumns=[t],this.applyChanges())}addHorizontalPivotOnColumn(e){const t=this.getHorizontalPivotableColumn(e);t&&(this.horizontalPivotColumns=[...this.horizontalPivotColumns,t],this.applyChanges())}clearAllHorizontalPivots(){this.horizontalPivotColumns=[],this.horizontalPivotCastColumns=[],this.applyChanges()}excludeColumnFromHorizontalPivot(e){if(Gi(e)){const t=Vi(e),n=this.getColumnConfiguration(t);n&&!n.excludedFromPivot&&(n.excludedFromPivot=!0,this.applyChanges())}}includeColumnInHorizontalPivot(e){const t=this.getColumnConfiguration(e);t?.excludedFromPivot&&(t.excludedFromPivot=!1,this.applyChanges())}verticalPivotColumns=[];getVerticalPivotableColumn(e){return Hi(this.configuration.columns.filter((e=>e.kind===ii.DIMENSION&&!Hi(this.groupExtendedColumns,e.name)&&!Hi(this.horizontalPivotColumns,e.name))),e)}setVerticalPivotOnColumn(e){const t=this.getVerticalPivotableColumn(e);t&&(this.verticalPivotColumns=[t],this.applyChanges())}addVerticalPivotOnColumn(e){const t=this.getVerticalPivotableColumn(e);t&&(this.verticalPivotColumns=[...this.verticalPivotColumns,t],this.applyChanges())}removeVerticalPivotOnColumn(e){this.verticalPivotColumns=this.verticalPivotColumns.filter((t=>t.name!==e)),this.applyChanges()}clearAllVerticalPivots(){this.verticalPivotColumns=[],this.applyChanges()}collapseAllPaths(){this.view.grid.client.collapseAll(),this.configuration.pivotLayout.expandedPaths=[],this.applyChanges()}expandPath(e){this.configuration.pivotLayout.expandedPaths=(0,Te.A)([...this.configuration.pivotLayout.expandedPaths,e]).sort(),this.applyChanges()}collapsePath(e){this.configuration.pivotLayout.expandedPaths=this.configuration.pivotLayout.expandedPaths.filter((t=>t!==e)),this.applyChanges()}sortColumns=[];getSortableColumn(e){if(e)return Hi([...this.horizontalPivotCastColumns.length?this.horizontalPivotCastColumns:this.selectColumns,...this.groupExtendedColumns],e)}setSortByColumn(e,t){const n=this.getSortableColumn(e);n&&(this.sortColumns=[{...n,direction:t}],this.applyChanges())}addSortByColumn(e,t){const n=this.getSortableColumn(e);n&&(this.sortColumns=[...this.sortColumns,{...n,direction:t}],this.applyChanges())}clearSortByColumn(e){this.sortColumns=this.sortColumns.filter((t=>t.name!==e)),this.applyChanges()}clearAllSorts(){this.sortColumns=[],this.applyChanges()}getSnapshotSubscriberName(){return"grid-controller"}async applySnapshot(e,t){this.configuration=Xi.serialization.fromJson(e.data.configuration),this.filterTree.nodes=new Map,this.filterTree.root=e.data.filter?hp(e.data.filter,void 0,this.filterTree.nodes,(e=>this.view.engine.getFilterOperation(e))):void 0,this.selectColumns=e.data.selectColumns,this.leafExtendedColumns=e.data.leafExtendedColumns,this.groupExtendedColumns=e.data.groupExtendedColumns,this.horizontalPivotColumns=e.data.pivot?.columns??[],this.horizontalPivotCastColumns=e.data.pivot?.castColumns??[],this.verticalPivotColumns=e.data.groupBy?.columns??[],this.sortColumns=e.data.sortColumns,this.menuBuilder=function(e){const t=e.view,n=t.dataCube,o=t.filter,r=t.editor,i=t.extend;return(a,s)=>{const l=a.column??void 0,c=l?.getColId(),u=e.getColumnConfiguration(c),d=c&&Gi(c)?e.getColumnConfiguration(Vi(c)):void 0,p=c&&Hi([...e.leafExtendedColumns,...e.groupExtendedColumns],c),g="value"in a?a.value:void 0,m=[{name:"Sort",subMenu:[...l&&c&&e.getSortableColumn(c)?[{name:"Ascending",action:()=>e.setSortByColumn(c,di.ASCENDING)},{name:"Descending",action:()=>e.setSortByColumn(c,di.DESCENDING)},{name:"Clear Sort",disabled:!Hi(e.sortColumns,c),action:()=>e.clearSortByColumn(c)},"separator",{name:"Add Ascending",disabled:Boolean(e.sortColumns.find((e=>e.name===c&&e.direction===di.ASCENDING))),action:()=>e.addSortByColumn(c,di.ASCENDING)},{name:"Add Descending",disabled:Boolean(e.sortColumns.find((e=>e.name===c&&e.direction===di.DESCENDING))),action:()=>e.addSortByColumn(c,di.DESCENDING)},"separator"]:[],{name:"Clear All Sorts",disabled:0===e.sortColumns.length,action:()=>e.clearAllSorts()}]}];let h=[];if(l&&void 0!==g){let t=u;if(l.getColId()===Nd&&e.verticalPivotColumns.length&&"node"in a&&a.node){const n=e.verticalPivotColumns[a.node.level];t=e.getColumnConfiguration(n?.name)}if(t)if(g!==Td){const n=function(e,t){const n=`${t.type===Hr.STRING?`'${e}'`:e}`;let o;switch(t.type){case Hr.STRING:o=e;break;case Hr.NUMBER:case Hr.DECIMAL:case Hr.FLOAT:case Hr.INTEGER:o=$(Number(e));break;case Hr.DATE:case Hr.STRICTDATE:case Hr.DATETIME:o=e;break;default:throw new I(`Can't filter on column with unsupported type '${t.type}'`)}return{label:n,value:{type:t.type,value:o}}}(g,t),o=function(e){switch(e.type){case Hr.STRING:return[ci.EQUAL,ci.NOT_EQUAL,ci.LESS_THAN,ci.LESS_THAN_OR_EQUAL,ci.GREATER_THAN,ci.GREATER_THAN_OR_EQUAL,ci.CONTAIN,ci.NOT_CONTAIN,ci.START_WITH,ci.NOT_START_WITH,ci.END_WITH,ci.NOT_END_WITH];case Hr.NUMBER:case Hr.DECIMAL:case Hr.FLOAT:case Hr.INTEGER:case Hr.DATE:case Hr.STRICTDATE:case Hr.DATETIME:return[ci.EQUAL,ci.NOT_EQUAL,ci.LESS_THAN,ci.LESS_THAN_OR_EQUAL,ci.GREATER_THAN,ci.GREATER_THAN_OR_EQUAL];default:return[]}}(t);if(o.length&&o.includes(ci.EQUAL)){const r=o.filter((e=>e!==ci.EQUAL));h=[qp(t,ci.EQUAL,n,e),r.length?{name:`More Filters on ${c}...`,subMenu:r.map((o=>qp(t,o,n,e)))}:void 0].filter(L)}}else h=[qp(t,ci.IS_NULL,{value:{type:ai.VOID}},e),qp(t,ci.IS_NOT_NULL,{value:{type:ai.VOID}},e)]}return[{name:"Export",subMenu:[{name:"HTML",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0},{name:"Plain Text",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0},{name:"PDF",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0},{name:"Excel",action:()=>t.grid.exportEngine.exportFile(dd.EXCEL)},{name:"CSV",action:()=>t.grid.exportEngine.exportFile(dd.CSV)},"separator",{name:"DataCube Specification",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0}]},{name:"Email",subMenu:[{name:"HTML",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0},{name:"Plain Text",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0},"separator",{name:"HTML Attachment",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0},{name:"Plain Text Attachment",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0},{name:"PDF Attachment",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0},{name:"Excel Attachment",action:()=>{t.grid.exportEngine.exportEmail(dd.EXCEL).catch((e=>n.alertService.alertUnhandledError(e)))}},{name:"CSV Attachment",action:()=>{t.grid.exportEngine.exportEmail(dd.CSV).catch((e=>n.alertService.alertUnhandledError(e)))}},{name:"DataCube Specification Attachment",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0}]},{name:"Copy",menuItem:cp,cssClasses:["!opacity-100"],subMenu:[{name:"Plain Text",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0},{name:"Selected Rows as Plain Text",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0},{name:"Selected Column as Plain Text",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0}]},"separator",...m,{name:"Filter",subMenu:[...h,h.length?"separator":void 0,{name:"Filters...",action:()=>{o.display.open()}},{name:"Clear All Filters",action:()=>e.clearFilters()}].filter(L)},{name:"Pivot",subMenu:[...l&&c&&u?.kind===ii.DIMENSION&&e.getVerticalPivotableColumn(c)?[{name:`Vertical Pivot on ${c}`,action:()=>e.setVerticalPivotOnColumn(c)},{name:`Add Vertical Pivot on ${c}`,disabled:Boolean(Hi(e.verticalPivotColumns,c)),action:()=>e.addVerticalPivotOnColumn(c)},{name:`Remove Vertical Pivot on ${c}`,disabled:!Hi(e.verticalPivotColumns,c),action:()=>e.removeVerticalPivotOnColumn(c)},"separator"]:[],...l&&c&&u?.kind===ii.DIMENSION&&e.getHorizontalPivotableColumn(c)?[{name:`Horizontal Pivot on ${c}`,action:()=>e.setHorizontalPivotOnColumn(c)},{name:`Add Horizontal Pivot on ${c}`,disabled:Boolean(Hi(e.horizontalPivotColumns,c)),action:()=>e.addHorizontalPivotOnColumn(c)},"separator"]:[],...l&&c&&d?.kind===ii.MEASURE&&!d.excludedFromPivot&&0!==e.horizontalPivotColumns.length?[{name:`Exclude Column ${d.name} from Horizontal Pivot`,action:()=>e.excludeColumnFromHorizontalPivot(c)},"separator"]:[],...l&&c&&u?.kind===ii.MEASURE&&u.excludedFromPivot&&0!==e.horizontalPivotColumns.length?[{name:`Include Column ${c} in Horizontal Pivot`,action:()=>e.includeColumnInHorizontalPivot(c)},"separator"]:[],{name:"Clear All Vertical Pivots",disabled:0===e.verticalPivotColumns.length,action:()=>e.clearAllVerticalPivots()},{name:"Clear All Horizontal Pivots",disabled:0===e.horizontalPivotColumns.length,action:()=>e.clearAllHorizontalPivots()}]},{name:"Extended Columns",subMenu:[{name:"Add New Column...",action:()=>{i.openNewColumnEditor().catch((e=>n.alertService.alertUnhandledError(e)))}},...u&&c?[{name:`Extend Column ${c}...`,action:()=>{i.openNewColumnEditor(u).catch((e=>n.alertService.alertUnhandledError(e)))}}]:[],...p?["separator",{name:`Edit Column ${c}...`,action:()=>{i.openExistingColumnEditor(c).catch((e=>n.alertService.alertUnhandledError(e)))}},{name:`Delete Column ${c}`,action:()=>{i.deleteColumn(c).catch((e=>n.alertService.alertUnhandledError(e)))}}]:[]]},"separator",{name:"Resize",subMenu:[{name:"Auto-size to Fit Content",disabled:!l||!u||void 0!==u.fixedWidth,action:()=>a.api.autoSizeColumns([l?.getColId()].filter(L))},{name:"Minimize Column",disabled:!l||!u||void 0!==u.fixedWidth,action:()=>{l&&u&&a.api.setColumnWidths([{key:u.name,newWidth:u.minWidth??50}])}},"separator",{name:"Auto-size All Columns",action:()=>a.api.autoSizeColumns([...e.configuration.columns.filter((e=>void 0===e.fixedWidth&&e.isSelected&&!e.hideFromView)).map((e=>e.name)),...e.horizontalPivotCastColumns.map((t=>{if(Gi(t.name)){const n=Hi(e.configuration.columns,Vi(t.name));if(n&&void 0===n.fixedWidth&&n.isSelected&&!n.hideFromView)return t.name}})).filter(L)])},{name:"Minimize All Columns",action:()=>{a.api.setColumnWidths([...e.configuration.columns.filter((e=>void 0===e.fixedWidth)).map((e=>({key:e.name,newWidth:u?.minWidth??50}))),...e.horizontalPivotCastColumns.map((t=>{if(Gi(t.name)){const n=Hi(e.configuration.columns,Vi(t.name));if(n&&void 0===n.fixedWidth&&n.isSelected&&!n.hideFromView)return{key:t.name,newWidth:n.minWidth??50}}})).filter(L)])}},{name:"Size Grid to Fit Screen",action:()=>a.api.sizeColumnsToFit()}]},{name:"Pin",subMenu:[...u?[{name:"Pin Left",disabled:!l||l.isPinnedLeft(),checked:Boolean(l?.isPinnedLeft()),action:()=>e.pinColumn(c,pi.LEFT)},{name:"Pin Right",disabled:!l||l.isPinnedRight(),checked:Boolean(l?.isPinnedRight()),action:()=>e.pinColumn(c,pi.RIGHT)},{name:"Unpin",disabled:!l?.isPinned(),action:()=>e.pinColumn(c,void 0)},"separator"]:[],{name:"Remove All Pinnings",disabled:e.configuration.columns.every((e=>void 0===e.pinned)),action:()=>e.removeAllPins()}]},{name:"Hide",disabled:!u,action:()=>e.showColumn(c,!1)},...c===Nd?["separator",{name:"Collapse All",action:()=>{e.collapseAllPaths()}}]:[],"separator",{name:"Heatmap",menuItem:cp,cssClasses:["!opacity-100"],disabled:!l,subMenu:l?[{name:`Add to ${l.getColId()}`,menuItem:cp,cssClasses:["!opacity-100"],disabled:!0},{name:`Remove from ${l.getColId()}`,menuItem:cp,cssClasses:["!opacity-100"],disabled:!0}]:[]},{name:"Show Plot...",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0},{name:"Show TreeMap...",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0},"separator",{name:"Properties...",disabled:r.display.isOpen,action:()=>{l&&s&&(r.setCurrentTab(Xp.COLUMN_PROPERTIES),r.columnProperties.setSelectedColumnName(d?.name??u?.name??c)),r.display.open()}}]}}(this)}propagateChanges(e){this.verticalPivotColumns=this.verticalPivotColumns.filter((e=>!Hi(this.horizontalPivotColumns,e.name))),this.configuration.pivotLayout.expandedPaths=Zl(e.data.groupBy?.columns??[],this.verticalPivotColumns,this.configuration.pivotLayout.expandedPaths),this.configuration.columns.forEach((e=>{e.pivotSortDirection=Hi(this.horizontalPivotColumns,e.name)?e.pivotSortDirection??di.ASCENDING:void 0})),this.selectColumns=(0,tt.A)([...this.configuration.columns.filter((e=>e.isSelected&&!Hi(this.groupExtendedColumns,e.name))),...this.horizontalPivotColumns,...this.verticalPivotColumns],(e=>e.name)).map(Wi);const t=(0,tt.A)([...this.horizontalPivotColumns.length?[...this.horizontalPivotResultColumns,...[...this.configuration.columns.filter((e=>e.isSelected)),...this.verticalPivotColumns].filter((e=>this.getColumnConfiguration(e.name)?.kind===ii.DIMENSION&&!Hi(this.horizontalPivotColumns,e.name)))]:[...this.configuration.columns.filter((e=>e.isSelected)),...this.verticalPivotColumns],...this.groupExtendedColumns],(e=>e.name));this.sortColumns=this.sortColumns.filter((e=>Hi(t,e.name)))}applyChanges(){const e=P(this.getLatestSnapshot()),t=e.clone();this.propagateChanges(e),t.data.configuration=this.configuration.serialize(),t.data.filter=this.filterTree.root?mp(this.filterTree.root):void 0,t.data.selectColumns=this.selectColumns,t.data.pivot=this.horizontalPivotColumns.length?{columns:this.horizontalPivotColumns,castColumns:this.horizontalPivotCastColumns}:void 0,t.data.groupBy=this.verticalPivotColumns.length?{columns:this.verticalPivotColumns}:void 0,t.data.sortColumns=this.sortColumns,t.finalize(),t.hashCode!==e.hashCode&&this.publishSnapshot(t)}}function Qp(e){return new Promise(((t,n)=>{const o=new FileReader;o.onloadend=()=>{const e=o.result;if(U(e)){const n=e.split(",")[1];if(n)return void t(n)}n(new Error("Can't base64 encode blob data"))},o.onerror=e=>n(e),o.readAsDataURL(e)}))}const Zp="mixed_boundary",eg="alternative_boundary",tg=`\nFrom:\nTo:\nSubject:\nX-Unsent: 1\nContent-Type: multipart/mixed; boundary="${Zp}"\n\n--${Zp}\nContent-Type: multipart/alternative; boundary="${eg}"\n\n--${eg}\nContent-Type: text/plain; charset="UTF-8"\nContent-Transfer-Encoding: 7bit\n\n\n\n--${eg}\nContent-Type: text/html; charset="UTF-8"\nContent-Transfer-Encoding: 7bit\n\n<html><body><p></p><body></html>\n\n--${eg}--\n\n`;class ng{_grid;constructor(e){this._grid=e}generateFileName(){return`${this._grid.queryConfiguration.name} - ${(0,Xn.GP)(new Date,"EEE MMM dd yyyy HH_mm_ss")}`}exportFile(e){const t=this.generateFileName();switch(e){case dd.CSV:return void this._grid.client.exportDataAsCsv({fileName:`${t}.csv`});case dd.EXCEL:return void this._grid.client.exportDataAsExcel({fileName:`${t}.xlsx`})}}async exportEmail(e){const t=this.generateFileName();let n,o,r=t;switch(e){case dd.CSV:r=`${t}.csv`,o=ee.TEXT_CSV,n=await Qp(new Blob([this._grid.client.getDataAsCsv()??""],{type:ee.TEXT_CSV}));break;case dd.EXCEL:{r+=`${t}.xlsx`,o=ee.APPLICATION_XLSX;const e=this._grid.client.getDataAsExcel();let i;if(e instanceof Blob)i=e;else{if("string"!=typeof e)throw new x("Can't export Excel content");i=new Blob([e],{type:ee.APPLICATION_XLSX})}n=await Qp(i);break}default:throw new I(`Can't export email in format '${e}'`)}le(`${t}.eml`,`${tg.trimStart()}--${Zp}\nContent-Type: ${o}; name="${r}"\nContent-Transfer-Encoding: base64\nContent-Disposition: attachment; filename="${r}"\n\n${n}\n\n--${Zp}--`,ee.MESSAGE_RFC822)}}class og extends sp{_view;controller;exportEngine;_client;clientDataSource;queryConfiguration;rowLimit;isPaginationEnabled=!0;isCachingEnabled=!1;scrollHintText;debouncedAutoResizeColumns;constructor(e){super(e.engine,e.settingService,e.snapshotService),(0,xe.Gn)(this,{clientDataSource:xe.sH,queryConfiguration:xe.sH,rowLimit:xe.sH,isPaginationEnabled:xe.sH,setPaginationEnabled:xe.XI,isCachingEnabled:xe.sH,setCachingEnabled:xe.XI,scrollHintText:xe.sH,setScrollHintText:xe.XI,applySnapshot:xe.XI}),this._view=e,this.controller=new Jp(this._view),this.exportEngine=new ng(this),this.queryConfiguration=new Xi,this.clientDataSource=new Od(this,this._view)}setPaginationEnabled(e){this.isPaginationEnabled=e,this.clientDataSource=new Od(this,this._view),this.client.updateGridOptions({cacheBlockSize:e?500:_d})}async setCachingEnabled(e,t){if(e===this.isCachingEnabled)return;if(!1===e)return await this._view.disposeCache(),void(0,xe.h5)((()=>{this.isCachingEnabled=e,this.clientDataSource=new Od(this,this._view)}));const n=async()=>{await this._view.initializeCache(),this._view.processCacheState.hasSucceeded&&(0,xe.h5)((()=>{this.isCachingEnabled=e,this.clientDataSource=new Od(this,this._view)}))};this._settingService.getBooleanValue(du.GRID_CLIENT__SHOW_CACHE_PERFORMANCE_WARNING)&&!t?.suppressWarning?this._view.alertService.alert({message:"Confirm you want to proceed with caching",text:"When enabled, the source dataset will be cached locally in order to boost query performance. But depending on computational resource available to your environment, sometimes, caching can negatively impact the overall performance, and can even lead to crashes.\n\nOverall, caching is still an experimental feature where we only support queries with simple execution plans, certain queries might not work, in which case, you can abort by turning off caching.\n\nDo you still want to proceed?",type:uu.WARNING,actions:[{label:"Abort",handler:()=>{}},{label:"Proceed",handler:()=>{n().catch((e=>this._view.alertService.alertUnhandledError(e)))}},{label:"Dismiss Warning and Proceed",handler:()=>{this._view.settingService.updateValue(this._view.dataCube.api,du.GRID_CLIENT__SHOW_CACHE_PERFORMANCE_WARNING,!1),n().catch((e=>this._view.alertService.alertUnhandledError(e)))}}],windowConfig:{...fr,width:600,height:300,minWidth:300,minHeight:150}}):await n()}setScrollHintText(e){this.scrollHintText=e}get isClientConfigured(){return Boolean(this._client)}get client(){return P(this._client,"Grid client is not configured")}configureClient(e){this._client=e,this.debouncedAutoResizeColumns=(0,Bn.A)((()=>e?.autoSizeAllColumns()),100)}getSnapshotSubscriberName(){return"grid"}async applySnapshot(e,t){const n=Xi.serialization.fromJson(e.data.configuration);this.queryConfiguration=n,this.rowLimit=e.data.limit;const o=function(e,t,n){return{isServerSideGroupOpenByDefault:e=>{if(void 0!==t.initialExpandLevel&&t.initialExpandLevel>0&&e.rowNode.level<=(t.showRootAggregation?t.initialExpandLevel+1:t.initialExpandLevel)-1)return!0;const n=e.rowNode.getRoute()??[];if(!n.length)return!1;if(t.showRootAggregation&&1===n.length&&n[0]===bi)return!0;t.showRootAggregation&&n.shift();const o=n.join(hi);return!!t.pivotLayout.expandedPaths.includes(o)},rowClassRules:t.alternateRows?{[pd.HIGHLIGHT_ROW]:e=>e.rowIndex%(2*t.alternateRowsCount)>=t.alternateRowsCount}:{},onColumnPinned:e=>{if("api"!==e.source&&e.column){const t=e.column,o=t.getPinned();n.grid.controller.pinColumn(t.getColId(),null===o?void 0:o===xd.LEFT?pi.LEFT:pi.RIGHT)}},onColumnMoved:e=>{"api"!==e.source&&e.column&&e.finished&&n.grid.controller.rearrangeColumns((e.api.getColumnDefs()??[]).filter((e=>!("children"in e))).map((e=>e.colId??"")))},onColumnVisible:e=>{if("api"!==e.source&&e.column){const t=e.column,o=t.isVisible();n.grid.controller.showColumn(t.getColId(),o)}},onRowGroupOpened:e=>{if(e.event){const o=e.node.getRoute()??[];o.length&&t.showRootAggregation&&o.shift();const r=o.join(hi);if(!r)return;e.expanded?n.grid.controller.expandPath(r):n.grid.controller.collapsePath(r)}},onVirtualColumnsChanged:()=>{n.grid.debouncedAutoResizeColumns?.cancel(),n.grid.debouncedAutoResizeColumns?.()},columnDefs:Wd(e,t),autoGroupColumnDef:{colId:Nd,headerName:"",cellRendererParams:{suppressCount:!t.showLeafCount},...Dd(e,t),minWidth:200,sortable:!0,showRowGroup:!0,suppressSpanHeaderHeight:!0}}}(e,n,this._view);this._settingService.getBooleanValue(du.DEBUGGER__ENABLE_DEBUG_MODE)&&this._engine.debugProcess("New Grid Options",["Grid Options",o]),this.client.updateGridOptions({...o,rowBuffer:this._settingService.getNumericValue(du.GRID_CLIENT__ROW_BUFFER),purgeClosedRowNodes:this._settingService.getBooleanValue(du.GRID_CLIENT__PURGE_CLOSED_ROW_NODES),cacheBlockSize:this.isPaginationEnabled?500:_d}),this.client.setFilterModel({[Ad]:{type:"equals",filter:Rd(e,n)}})}}class rg extends sp{_view;name="";constructor(e){super(e.engine,e.settingService,e.snapshotService),(0,xe.Gn)(this,{name:xe.sH,applySnapshot:xe.XI}),this._view=e}getSnapshotSubscriberName(){return"info"}async applySnapshot(e,t){const n=e.data,o=Xi.serialization.fromJson(n.configuration);o.name!==this.name&&(this.name=o.name,this._view.dataCube.options?.onNameChanged?.({api:this._view.dataCube.api,name:this.name,source:this._view.source}))}}const ig=[{func:Zr.EXTEND,parameters:1,stopCondition:e=>ea(e.function,Zr.EXTEND)&&e.parameters[0]instanceof ta&&ea(e.parameters[0].function,Zr.OVER)},{func:Zr.FILTER,parameters:1},{func:Zr.SELECT,parameters:1},{func:Zr.GROUP_BY,parameters:2},{func:Zr.PIVOT,parameters:2},{func:Zr.CAST,parameters:1},{func:Zr.SORT,parameters:1},{func:Zr.LIMIT,parameters:1}];var ag;!function(e){e.LEAF_EXTEND="leaf_extend",e.FILTER="filter",e.SELECT="select",e.PIVOT__GROUP="pivot__group",e.PIVOT_SORT="pivot_sort",e.PIVOT="pivot",e.PIVOT_CAST="pivot_cast",e.GROUP_BY__GROUP="group_by__group",e.GROUP_BY="group_by",e.GROUP_BY_SORT="group_by_sort",e.GROUP_EXTEND="group_extend",e.SORT="sort",e.LIMIT="limit"}(ag||(ag={}));const sg=[{name:ag.LEAF_EXTEND,func:Zr.EXTEND,repeat:!0},{name:ag.FILTER,func:Zr.FILTER},{name:ag.SELECT,func:Zr.SELECT},{name:ag.PIVOT__GROUP,funcs:[{name:ag.PIVOT_SORT,func:Zr.SORT,required:!0},{name:ag.PIVOT,func:Zr.PIVOT,required:!0},{name:ag.PIVOT_CAST,func:Zr.CAST,required:!0}]},{name:ag.GROUP_BY__GROUP,funcs:[{name:ag.GROUP_BY,func:Zr.GROUP_BY,required:!0},{name:ag.GROUP_BY_SORT,func:Zr.SORT,required:!0}]},{name:ag.GROUP_EXTEND,func:Zr.EXTEND,repeat:!0},{name:ag.SORT,func:Zr.SORT},{name:ag.LIMIT,func:Zr.LIMIT}],lg=new RegExp(`^${sg.map((e=>"funcs"in e?`(${e.funcs.map((e=>`(?<${e.name}>${e.repeat?`(?:<${Zi(e.func)}>____\\d+)*`:`<${Zi(e.func)}>____\\d+`})${e.repeat||e.required?"":"?"}`)).join("")})${e.repeat?"*":e.required?"":"?"}`:`(?<${e.name}>${e.repeat?`(?:<${Zi(e.func)}>____\\d+)*`:`<${Zi(e.func)}>____\\d+`})${e.repeat||e.required?"":"?"}`)).join("")}$`);async function cg(e,t,n,o){const r=function(e){if(!(e instanceof ta))throw new Error("Can't process expression: expected a function expression");const t=[];let n=e;for(;n instanceof ta;){const e=ig.find((e=>ea(n.function,e.func)));if(!e)throw new Error(`Can't process expression: found unsupported function ${n.function}()`);if(!(n.parameters.length>e.parameters)){t.unshift(n);break}{if(e.stopCondition?.(n)){t.unshift(n);break}M(n.parameters.length===e.parameters+1,`Can't process ${Zi(n.function)}() expression: expected at most ${e.parameters+1} parameters provided, got ${n.parameters.length}`);const o=zl(n,0,ta,"Can't process expression: expected a sequence of function calls (e.g. x()->y()->z())");n.parameters=n.parameters.slice(1),t.unshift(n),n=o}}const o=t.map(((e,t)=>`<${Zi(e.function)}>____${t}`)).join("").match(lg);if(!o)throw new Error(`Can't process expression: unsupported function composition ${t.map((e=>`${Zi(e.function)}()`)).join("->")} (supported composition: ${sg.map((e=>"funcs"in e?`[${e.funcs.map((e=>`${Zi(e.func)}()`)).join("->")}]`:`${Zi(e.func)}()`)).join("->")})`);const r=e=>{const n=o.groups?.[e];if(!n)return;const r=n.match(/\<.*?\>____\d+/g);return r?.length?r.map((e=>{const n=Number(e.split("____")[1]);if(!(isNaN(n)||n>=t.length))return N(t,n)})).filter(L):void 0};return{leafExtend:r(ag.LEAF_EXTEND),select:r(ag.SELECT)?.[0],filter:r(ag.FILTER)?.[0],pivotSort:r(ag.PIVOT_SORT)?.[0],pivot:r(ag.PIVOT)?.[0],pivotCast:r(ag.PIVOT_CAST)?.[0],groupBy:r(ag.GROUP_BY)?.[0],groupBySort:r(ag.GROUP_BY_SORT)?.[0],groupExtend:r(ag.GROUP_EXTEND),sort:r(ag.SORT)?.[0],limit:r(ag.LIMIT)?.[0]}}(o.deserializeValueSpecification(o.serializeValueSpecification(e))),i=rd.create({}),a=i.data,s=new Map,l=(e,t)=>{if(s.has(e.name))throw new Error(t);s.set(e.name,e)},c=new Map,u=e=>Wi(P(c.get(e),`Can't find column '${e}'`)),d=e=>c.set(e.name,e);if(a.sourceColumns=t.columns,Ql(a.sourceColumns,(e=>`Can't process source: found duplicate source columns '${e}'`)),a.sourceColumns.forEach((e=>l(e,`Can't process source: another column with name '${e.name}' is already registered`))),a.sourceColumns.forEach((e=>d(e))),r.leafExtend?.length&&(a.leafExtendedColumns=await ec(r.leafExtend,Array.from(c.values()),o),Ql(a.leafExtendedColumns,(e=>`Can't process extend() expression: found duplicate extended columns '${e}'`)),a.leafExtendedColumns.forEach((e=>l(e,`Can't process extend() expression: another column with name '${e.name}' is already registered`))),a.leafExtendedColumns.forEach((e=>d(e)))),r.filter){const e=zl(r.filter,0,Ur,"Can't process filter() expression: expected parameter at index 0 to be a lambda expression");a.filter=tc(Kl(e,"Can't process filter() expression"),u,o.filterOperations)}r.select?(a.selectColumns=Xl(r.select,0).colSpecs.map((e=>u(e.name))),Ql(a.selectColumns,(e=>`Can't process select() expression: found duplicate select columns '${e}'`)),c.clear(),a.selectColumns.forEach((e=>d(e)))):c.clear();let p=[],g=[];if(r.pivot&&r.pivotCast&&r.pivotSort){const e=Xl(r.pivot,0).colSpecs.map((e=>u(e.name))),t=(m=(h=r.pivotCast,zl(h,0,Qa,`Can't process ${Zi(h.function)}: expected parameter at index 0 to be a generic type instance`)).genericType,D(m.typeArguments[0]?.rawType,ns,"Can't process generic type: failed to extract relation type")).columns.map((e=>({name:e.name,type:ql(e.genericType).fullPath})));a.pivot={columns:e,castColumns:t},p=Xl(r.pivot,1).colSpecs.map((e=>ac(e,u,o.aggregateOperations))),g=function(e,t,n){const o=lc(e,n),r=new Set(t.map((e=>e.name))),i=new Set(t.map((e=>e.name)));if(o.forEach((e=>{if(!r.has(e.name))throw new Error(`Can't process pivot() expression: sort column '${e.name}' must be a pivot column`);i.delete(e.name)})),0!==i.size)throw new Error(`Can't process pivot() expression: found unsorted pivot column(s) (${Array.from(i.values()).sort().map((e=>`'${e}'`)).join(", ")})`);return Ql(o,(e=>`Can't process pivot() expression: found duplicate sort columns '${e}'`)),o}(r.pivotSort,e,u),function(e,t,n){const o=e.columns,r=e.castColumns;Ql(o,(e=>`Can't process pivot() expression: found duplicate pivot columns '${e}'`)),Ql(t,(e=>`Can't process pivot() expression: found duplicate aggregate columns '${e}'`)),Ql(r,(e=>`Can't process pivot() expression: found duplicate cast columns '${e}'`)),t.forEach((e=>{if(Hi(o,e.name))throw new Error(`Can't process pivot() expression: pivot column '${e.name}' must not be aggregated on`)})),n.filter((e=>!(Hi(o,e.name)??Hi(t,e.name)))).forEach((e=>{if(!Hi(r,e.name))throw new Error(`Can't process pivot() expression: expected pivot group column '${e.name}' in cast columns`)})),o.forEach((e=>{if(Hi(r,e.name))throw new Error(`Can't process pivot() expression: expected pivot column '${e.name}' to not present in cast columns`)})),t.forEach((e=>{if(Hi(r,e.name))throw new Error(`Can't process pivot() expression: expected pivot aggregate column '${e.name}' to not present in cast columns`)})),r.filter((e=>Gi(e.name))).forEach((e=>{const n=Vi(e.name);if(!Hi(t,n))throw new Error(`Can't process pivot() expression: fail to match cast column '${e.name}' to a specified aggregate column`)}))}(a.pivot,p,Array.from(c.values())),c.clear(),t.forEach((e=>d(e)))}var m,h;let f=[],E=[];if(r.groupBy&&r.groupBySort){const e=Xl(r.groupBy,0).colSpecs.map((e=>u(e.name)));a.groupBy={columns:e},f=Xl(r.groupBy,1).colSpecs.map((e=>ac(e,u,o.aggregateOperations))),E=function(e,t,n){const o=lc(e,n),r=new Set(t.map((e=>e.name))),i=new Set(t.map((e=>e.name)));let a;if(o.forEach((e=>{if(!r.has(e.name))throw new Error(`Can't process groupBy() expression: sort column '${e.name}' must be a group column`);if(i.delete(e.name),a){if(e.direction!==a)throw new Error("Can't process groupBy() expression: all group columns must be sorted in the same direction")}else a=e.direction})),0!==i.size)throw new Error(`Can't process groupBy() expression: found unsorted group column(s) (${Array.from(i.values()).sort().map((e=>`'${e}'`)).join(", ")})`);return Ql(o,(e=>`Can't process groupBy() expression: found duplicate sort columns '${e}'`)),o}(r.groupBySort,e,u),function(e,t,n,o,r){const i=e.columns;if(Ql(i,(e=>`Can't process groupBy() expression: found duplicate group columns '${e}'`)),Ql(t,(e=>`Can't process groupBy() expression: found duplicate aggregate columns '${e}'`)),t.forEach((e=>{if(Hi(i,e.name))throw new Error(`Can't process groupBy() expression: group column '${e.name}' must not be aggregated on`)})),r.forEach((e=>{if(!(Hi(i,e.name)??Hi(t,e.name)))throw new Error(`Can't process groupBy() expression: column '${e.name}' is neither grouped nor aggregated on`)})),n){const e=new Map;t.filter((e=>Gi(e.name))).forEach((t=>{const n=Vi(t.name),o={...t,name:n},r=e.get(n);if(r){if(!(0,Ro.A)({...r,type:void 0},{...o,type:void 0}))throw new Error(`Can't process groupBy() expression: found conflicting aggregation specification for column '${n}'`)}else e.set(n,o)})),o.forEach((t=>{const n=e.get(t.name);if(!n)throw new Error(`Can't process groupBy() expression: column '${t.name}' is aggregated in pivot() expression but not in groupBy() expression`);if(!(0,Ro.A)({...n,type:void 0},{...t,type:void 0}))throw new Error(`Can't process groupBy() expression: found conflicting aggregation specification for column '${t.name}'`)}))}}(a.groupBy,f,a.pivot,p,Array.from(c.values()))}if(r.groupExtend?.length&&(a.groupExtendedColumns=await ec(r.groupExtend,Array.from(c.values()),o),Ql(a.groupExtendedColumns,(e=>`Can't process extend() expression: found duplicate extended columns '${e}'`)),a.groupExtendedColumns.forEach((e=>l(e,`Can't process extend() expression: another column with name '${e.name}' is already registered`))),a.groupExtendedColumns.forEach((e=>d(e)))),r.sort&&(a.sortColumns=lc(r.sort,u),Ql(a.sortColumns,(e=>`Can't process sort() expression: found duplicate sort columns '${e}'`))),r.limit){const e=zl(r.limit,0,la,"Can't process limit() expression: expected limit to be a non-negative integer value");a.limit=e.value}const C=function(e,t,n){const o=e.snapshot.data,r=t.configuration,i=ld(e);if(!r)return i;o.groupBy&&M(r.treeColumnSortDirection===i.treeColumnSortDirection,`Can't process configuration: tree column sort direction mismatch (expected: '${i.treeColumnSortDirection.toLowerCase()}', found: '${r.treeColumnSortDirection.toLowerCase()}')`);const a=r.columns,s=i.columns,l=new Set;a.forEach((e=>{if(l.has(e.name))throw new Error(`Can't process configuration: found duplicate columns '${e.name}'`);l.add(e.name)})),a.forEach((e=>{if(!Hi(s,e.name))throw new Error(`Can't process configuration: found extra column '${e.name}'`)})),s.forEach((e=>{if(!Hi(a,e.name))throw new Error(`Can't process configuration: missing column '${e.name}'`)}));const c=[...o.selectColumns,...o.groupExtendedColumns,...[...o.sourceColumns,...o.leafExtendedColumns].filter((e=>!Hi(o.selectColumns,e.name)))];return c.forEach(((e,t)=>{const n=N(a,t);M(e.name===n.name,`Can't process configuration: column ordering mismatch at index ${t} (expected: '${e.name}', found: '${n.name})', expected ordering: ${c.map((e=>e.name)).join(", ")}`)})),a.forEach((e=>{const t=P(Hi(s,e.name));if(M(e.type===t.type,`Can't process configuration: type mismatch for column '${e.name}' (expected: '${t.type}', found: '${e.type}')`),M(e.isSelected===t.isSelected,`Can't process configuration: selection mismatch for column '${e.name}' (expected: '${t.isSelected}', found: '${e.isSelected}')`),(Hi(o.pivot?.columns??[],e.name)??Hi(o.groupBy?.columns??[],e.name))&&M(e.kind===t.kind,`Can't process configuration: kind mismatch for column '${e.name}' (expected: '${t.kind.toLowerCase()}', found: '${e.kind.toLowerCase()}')`),(o.pivot??o.groupBy)&&(M(e.aggregateOperator===t.aggregateOperator,`Can't process configuration: aggregation operator mismatch for column '${e.name}' (expected: '${t.aggregateOperator}', found: '${e.aggregateOperator}')`),M(n.getAggregateOperation(e.aggregateOperator).isCompatibleWithParameterValues(e.aggregationParameters),`Can't process configuration: incompatible aggregation parameter values for column '${e.name}' (operator: '${e.aggregateOperator}')`)),o.pivot&&(M(e.excludedFromPivot===t.excludedFromPivot,`Can't process configuration: pivot exclusion mismatch for column '${e.name}' (expected: '${t.excludedFromPivot}', found: '${e.excludedFromPivot}')`),M(e.pivotSortDirection===t.pivotSortDirection,`Can't process configuration: pivot sort direction mismatch for column '${e.name}' (expected: '${t.pivotSortDirection?.toLowerCase()??"none"}', found: '${e.pivotSortDirection?.toLowerCase()??"none"}')`)),e.kind===ii.DIMENSION&&!e.excludedFromPivot)throw new Error(`Can't process configuration: column '${e.name}' is a dimension but not excluded from pivot`)})),r}({snapshot:i,groupByAggColumns:f,groupBySortColumns:E,pivotAggColumns:p,pivotSortColumns:g},n,o);return a.configuration=C.serialize(),i.finalize()}var ug=n(60720),dg=n(56148),pg=n(36868);const gg=(0,Lt.forwardRef)((function(e,t){return(0,E.jsx)(ug.x,{ref:t,...e})})),mg=(0,Lt.forwardRef)((function(e,t){return(0,E.jsx)(dg.l,{ref:t,...e})})),hg=(0,Lt.forwardRef)((function(e,t){const{inputRef:n,className:o,disabled:r,InputProps:{ref:i,endAdornment:a}={},ownerState:s,enableAccessibleFieldDOMStructure:l,clearable:c,onClear:u,error:d,focused:p,...g}=e,m=(0,Pc.A)(i,t);return(0,E.jsxs)("div",{style:{display:"flex",alignItems:"center",position:"relative"},ref:m,children:[(0,E.jsx)("input",{className:o,disabled:r,ref:n,...g}),a]})})),fg=(0,Lt.forwardRef)((function(e,t){const{slots:n,slotProps:o,onClear:r,...i}=e,a=(0,pg.c)({...i});return(0,E.jsx)(hg,{...a,ref:t})}));var Eg=n(15179),Cg=n(15891);const bg=(0,bt.PA)((0,Lt.forwardRef)((function(e,t){const{value:n,updateValue:o}=e,r=(0,Lt.useRef)(null),i=(0,Pc.A)(r,t);return(0,E.jsx)("input",{ref:i,className:"h-5 w-full flex-shrink-0 border border-neutral-400 px-1 text-sm disabled:border-neutral-300 disabled:bg-neutral-50 disabled:text-neutral-300",value:n,onKeyDown:e=>{"Escape"===e.code&&r.current?.select()},onChange:e=>{o(e.target.value)}})}))),vg="#ERR",_g=(0,bt.PA)((0,Lt.forwardRef)((function(e,t){const{value:n,updateValue:o,defaultValue:r=0,step:i=1}=e,[a,s]=(0,Lt.useState)(n.toString()),l=(0,Lt.useRef)(null),c=(0,Pc.A)(l,t),u=()=>{const e=Number(a);if(""===a)s(r.toString()),o(r);else if(isNaN(e)){if(a===vg)return void s(n.toString());try{const e=$((0,Cg._3)(a));s(e.toString()),o(e)}catch{s(vg),o(r)}}};return(0,Lt.useEffect)((()=>{s(n.toString())}),[n]),(0,E.jsxs)("div",{className:"relative h-5 w-full flex-shrink-0",children:[(0,E.jsx)("input",{ref:c,inputMode:"numeric",spellCheck:!1,type:"text",className:"h-full w-full border border-neutral-400 px-1 pr-5 text-sm disabled:border-neutral-300 disabled:bg-neutral-50 disabled:text-neutral-300",value:a,onKeyDown:e=>{if("Enter"===e.code)u(),l.current?.focus();else if("Escape"===e.code)l.current?.select();else if("ArrowUp"===e.code){e.preventDefault();const t=n+i;s(t.toString()),o(t)}else if("ArrowDown"===e.code){e.preventDefault();const t=n-i;s(t.toString()),o(t)}},onChange:e=>{const t=e.target.value;s(t);const n=Number(t);!isNaN(n)&&t&&o(n)},onBlur:()=>u()}),(0,E.jsx)("div",{className:"absolute right-0 top-0 flex h-5 w-5 items-center justify-center",children:(0,E.jsx)("button",{className:"text-lg text-neutral-500 hover:text-neutral-600",title:"Evaluate Expression (Enter)",onClick:u,tabIndex:-1,children:(0,E.jsx)(dr.Calculate,{})})})]})}))),Tg=(0,Lt.forwardRef)((function(e,t){return(0,E.jsx)(fg,{...e,ref:t,className:"h-5 w-full flex-shrink-0 border border-neutral-400 px-1 pr-5 text-sm disabled:border-neutral-300 disabled:bg-neutral-50 disabled:text-neutral-300"})})),Ng=(0,bt.PA)((e=>{const{value:t,updateValue:n}=e,[o,r]=(0,Lt.useState)(null);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("button",{className:"absolute right-0 top-0 flex h-5 w-5 items-center justify-center",title:"Open Date Picker...",onClick:e=>{r(e.currentTarget)},tabIndex:-1,children:(0,E.jsx)(dr.Calendar,{className:"text-lg text-neutral-500 hover:text-neutral-600"})}),(0,E.jsx)(zn,{open:Boolean(o),anchorEl:o,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},onClose:()=>r(null),classes:{root:"data-cube-editor-date-calendar mt-0.5",paper:"shadow-md rounded-none border border-neutral-300"},children:(0,E.jsx)(gg,{autoFocus:!0,value:(0,Eg.H)(t),onChange:e=>{n((0,Xn.GP)(e,Jr)),r(null)}})})]})})),Sg=(0,bt.PA)((0,Lt.forwardRef)((function(e,t){const{value:n,updateValue:o}=e;return(0,E.jsx)(mg,{ref:t,value:(0,Eg.H)(n),format:Jr,slots:{field:Tg,openPickerButton:()=>(0,E.jsx)(Ng,{value:n,updateValue:o})},onChange:e=>{e&&o((0,Xn.GP)(e,Jr))}})}))),Ag=(0,bt.PA)((0,Lt.forwardRef)((function(e,t){const{value:n,updateValue:o,view:r}=e,i=r.filter,a=Hi(i.columns,n),[s,l,c,u]=jc();return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(Qc,{ref:t,className:"relative mr-1 w-32",onClick:s,open:u,children:n}),(0,E.jsx)(Zc,{className:"w-32",...c,children:i.columns.filter((e=>a&&ji(a.type)===ji(e.type))).map((e=>(0,E.jsx)(eu,{onClick:()=>{o(e.name),l()},autoFocus:n===e.name,children:e.name},e.name)))})]})}))),yg=(0,bt.PA)((0,Lt.forwardRef)((function(e,t){const{value:n,updateValue:o,view:r}=e;switch(n.type){case Hr.STRING:return(0,E.jsx)(bg,{ref:t,value:n.value,updateValue:e=>o(e)});case Hr.NUMBER:case Hr.DECIMAL:case Hr.FLOAT:case Hr.INTEGER:return(0,E.jsx)(_g,{ref:t,value:n.value,updateValue:e=>o(e)});case Hr.DATE:case Hr.STRICTDATE:case Hr.DATETIME:return(0,E.jsx)(Sg,{ref:t,value:n.value,updateValue:e=>o(e)});case ai.COLUMN:return(0,E.jsx)(Ag,{ref:t,value:n.value,updateValue:e=>o(e),view:r});default:return null}})));function xg(){return(0,E.jsxs)("div",{className:"relative flex pl-2.5",children:[(0,E.jsx)("div",{className:"pointer-events-none absolute -left-2 h-0 w-0 border-[9px] border-neutral-600 border-b-transparent border-l-transparent border-t-transparent"}),(0,E.jsx)("div",{className:"mr-1 flex h-[18px] w-10 flex-shrink-0 items-center bg-neutral-600 pl-2 text-sm font-medium text-white",title:"Filter is inverted: select all but what matches.",children:"NOT"})]})}const Ig=(0,bt.PA)((e=>{const{className:t,node:n,view:o}=e,r=o.filter;return(0,E.jsxs)("div",{className:jn("flex h-3.5 w-14 flex-shrink-0 bg-neutral-100",t),children:[(0,E.jsx)("button",{className:"flex h-3.5 w-3.5 items-center justify-center rounded-bl-sm rounded-tl-sm border border-neutral-400 hover:bg-neutral-200",onClick:()=>r.addFilterNode(n),title:"Insert a new column filter, just after this filter.",children:(0,E.jsx)(dr.FilterAddOperator,{className:"stroke-[2.5] text-sm"})}),(0,E.jsx)("button",{className:"flex h-3.5 w-3.5 items-center justify-center border border-l-0 border-neutral-400 hover:bg-neutral-200",onClick:()=>r.removeFilterNode(n),title:"Remove this filter",children:(0,E.jsx)(dr.FilterRemoveOperator,{className:"stroke-[2.5] text-sm"})}),(0,E.jsx)("button",{className:"flex h-3.5 w-3.5 items-center justify-center border border-l-0 border-neutral-400 hover:bg-neutral-200",onClick:()=>r.layerFilterNode(n),title:"Put this filter in its own sub-group (and combine it with other filters).",children:(0,E.jsx)(dr.FilterGroupOperator,{className:"stroke-[2.5] text-sm"})}),(0,E.jsx)("button",{className:jn("flex h-3.5 w-3.5 items-center justify-center rounded-br-sm rounded-tr-sm border border-l-0 border-neutral-400 hover:bg-neutral-200",{"bg-neutral-600":n.not,"border-neutral-600":n.not,"text-white":n.not,"hover:bg-neutral-600":n.not}),onClick:()=>n.setNot(!n.not),title:n.not?"Turn off the NOT operator on this filter to select only what matches.":"Turn on the NOT operator on this filter to select all but what matches.",children:(0,E.jsx)(dr.FilterNotOperator,{className:"stroke-[3] text-xs"})})]})})),wg=(0,bt.PA)((e=>{const{node:t,level:n,view:o}=e,r=$c(),i=o.filter,a=t.parent,s=a?a.children.indexOf(t):void 0,l=(0,Lt.useRef)(null),[c,u,d,p]=jc(),[g,m,h,f]=jc(),C=(0,Lt.useCallback)((()=>l.current?.focus()),[]);return(0,E.jsxs)("div",{className:"group flex h-6 items-center",children:[(0,E.jsx)("div",{className:jn("z-1 absolute h-6 w-full bg-opacity-50 group-hover:bg-sky-100 group-hover:bg-opacity-50",{"bg-sky-50":t===i.selectedNode,"border-[0.5px] border-l-2 border-sky-200 border-l-sky-600":t===i.selectedNode}),onClick:()=>i.setSelectedNode(t)}),(0,E.jsx)("div",{style:{paddingLeft:36*n+10+60*(n-1)+"px"},className:"relative h-6 flex-shrink-0",onClick:()=>i.setSelectedNode(t),children:a&&(0,E.jsxs)("div",{className:"absolute top-0 flex h-6 items-center justify-end",style:{width:"22px",right:"8px"},children:[(0,E.jsx)("div",{className:jn("h-[1px] w-full flex-1 bg-neutral-200",{"bg-sky-600":a===i.selectedGroupNode})}),void 0!==s&&s>0&&(0,E.jsx)("div",{className:jn("flex h-6 items-center justify-center pl-1 text-xs text-neutral-600",{"text-sky-600":a===i.selectedGroupNode}),children:a.operation===ui.AND?"and":"or"})]})}),(0,E.jsx)(Ig,{className:"relative mr-1",node:t,view:o}),t.not&&(0,E.jsx)(xg,{}),(0,E.jsx)(Qc,{className:"relative mr-1 w-32",onClick:c,open:p,children:t.column.name}),(0,E.jsx)(Zc,{className:"w-32",...d,onClosed:C,children:i.columns.map((e=>(0,E.jsx)(eu,{onClick:()=>{if(e!==t.column){const n=t.operation.isCompatibleWithColumn(e)?t.operation:r.engine.filterOperations.filter((t=>t.isCompatibleWithColumn(e)))[0];n&&(t.setColumn(e),t.setOperation(n),t.setValue(n.generateDefaultValue(e)))}u()},autoFocus:t.column.name===e.name,children:e.name},e.name)))}),(0,E.jsx)(Qc,{className:"relative mr-1 w-24",onClick:g,open:f,children:t.operation.label}),(0,E.jsx)(Zc,{className:"w-24",...h,onClosed:C,children:r.engine.filterOperations.filter((e=>e.isCompatibleWithColumn(t.column))).map((e=>(0,E.jsx)(eu,{onClick:()=>{e!==t.operation&&e.isCompatibleWithColumn(t.column)&&(t.setOperation(e),t.setValue(e.generateDefaultValue(t.column))),m()},autoFocus:t.operation.operator===e.operator,children:e.label},e.operator)))}),(0,E.jsx)("div",{className:"relative w-32 flex-shrink-0",children:(0,E.jsx)(yg,{ref:l,value:t.value,updateValue:e=>t.updateValue(e),view:o})})]})})),kg=(0,bt.PA)((e=>{const{node:t,level:n,view:o}=e,r=o.filter,i=t.parent,a=i?i.children.indexOf(t):void 0,[s,l,c,u]=jc();return(0,E.jsxs)("div",{className:"group flex h-6 items-center",children:[(0,E.jsx)("div",{className:jn("z-1 absolute h-6 w-full bg-opacity-50 group-hover:bg-sky-100 group-hover:bg-opacity-50",{"bg-sky-50":t===r.selectedNode,"border-[0.5px] border-l-2 border-sky-200 border-l-sky-600":t===r.selectedNode}),onClick:()=>r.setSelectedNode(t)}),(0,E.jsx)("div",{style:{paddingLeft:36*n+10+(0!==n?60*(n-1):0)+"px"},className:"relative h-6 flex-shrink-0",onClick:()=>r.setSelectedNode(t),children:0!==n&&i&&(0,E.jsxs)("div",{className:"absolute top-0 flex h-6 items-center justify-end",style:{width:"22px",right:"8px"},children:[(0,E.jsx)("div",{className:jn("h-[1px] w-full flex-1 bg-neutral-200",{"bg-sky-600":i===r.selectedGroupNode})}),void 0!==a&&a>0&&(0,E.jsx)("div",{className:jn("flex h-6 items-center justify-center pl-1 text-xs text-neutral-600",{"text-sky-600":i===r.selectedGroupNode}),children:i.operation===ui.AND?"and":"or"})]})}),0!==n&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(Ig,{className:"relative mr-1",node:t,view:o}),t.not&&(0,E.jsx)(xg,{})]}),(0,E.jsx)(Qc,{className:"relative w-14",onClick:s,open:u,children:t.operation===ui.AND?"All of":"Any of"}),(0,E.jsxs)(Zc,{className:"w-14",...c,children:[(0,E.jsx)(eu,{onClick:()=>{t.setOperation(ui.AND),l()},autoFocus:t.operation===ui.AND,children:"All of"}),(0,E.jsx)(eu,{onClick:()=>{t.setOperation(ui.OR),l()},autoFocus:t.operation===ui.OR,children:"Any of"})]})]})})),Rg=(0,bt.PA)((e=>{const{node:t,level:n,view:o}=e,r=o.filter;return(0,E.jsxs)("div",{className:"relative w-full",children:[(0,E.jsx)("div",{className:jn("pointer-events-none absolute h-full",{"border-[0.5px] border-sky-200 bg-sky-50":t===r.selectedGroupNode}),style:{marginLeft:36*n+10+60*n-2+"px",width:`calc(100% - ${36*n+10+60*n-4}px)`}}),(0,E.jsx)(kg,{node:t,level:n,view:o}),(0,E.jsxs)("div",{className:"relative",children:[(0,E.jsx)("div",{className:jn("pointer-events-none absolute z-10 h-[calc(100%_-_12px)] w-0 border-l border-neutral-200",{"border-sky-600":t===r.selectedGroupNode}),style:{marginLeft:36*n+10+6+60*n+"px"}}),t.children.map((e=>e instanceof pp?(0,E.jsx)(wg,{level:n+1,node:e,view:o},e.uuid):e instanceof gp?(0,E.jsx)(Rg,{level:n+1,node:e,view:o},e.uuid):null))]})]})})),Og=(0,bt.PA)((e=>{const{view:t}=e,n=t.filter;return(0,Lt.useEffect)((()=>{n.setSelectedNode(void 0)}),[n]),(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{className:"relative h-[calc(100%_-_40px)] w-full px-2 pt-2",children:(0,E.jsx)("div",{className:"h-full w-full overflow-auto border border-neutral-300 bg-white",children:(0,E.jsx)("div",{className:"h-full w-full select-none p-2",children:(0,E.jsx)("div",{className:"flex h-full w-full",children:(0,E.jsxs)("div",{className:"relative flex h-full w-full overflow-auto rounded-sm border border-neutral-200",onClick:()=>n.setSelectedNode(void 0),children:[!n.tree.root&&(0,E.jsxs)("div",{className:"h-full w-full p-3",children:[(0,E.jsx)("div",{children:"No filter is specified. Click the button below to start."}),(0,E.jsx)(Xc,{onClick:()=>{n.initializeTree()},children:"Create New Filter"})]}),n.tree.root&&(0,E.jsxs)("div",{className:"flex flex-col py-1",onClick:e=>e.stopPropagation(),children:[(0,E.jsx)(Rg,{node:n.tree.root,level:0,view:t}),(0,E.jsx)("div",{className:"min-h-6 w-full flex-1",onClick:()=>n.setSelectedNode(void 0)})]})]})})})})}),(0,E.jsxs)("div",{className:"flex h-10 items-center justify-end px-2",children:[(0,E.jsx)(Xc,{onClick:()=>n.display.close(),children:"Cancel"}),(0,E.jsx)(Xc,{className:"ml-2",onClick:()=>n.applyChanges(),children:"Apply"}),(0,E.jsx)(Xc,{className:"ml-2",onClick:()=>{n.applyChanges(),n.display.close()},children:"OK"})]})]})}));class Lg extends sp{_view;display;tree;selectedNode;columns=[];constructor(e){super(e.engine,e.settingService,e.snapshotService),(0,xe.Gn)(this,{tree:xe.sH.ref,initializeTree:xe.XI,refreshTree:xe.XI,columns:xe.sH.struct,applySnapshot:xe.XI,selectedNode:xe.sH,selectedGroupNode:xe.EW,setSelectedNode:xe.XI,addFilterNode:xe.XI,removeFilterNode:xe.XI,layerFilterNode:xe.XI}),this._view=e,this.display=this._view.dataCube.layoutService.newDisplay("Filter",(()=>(0,E.jsx)(Og,{view:this._view})),{x:-50,y:50,width:600,height:400,minWidth:300,minHeight:200,center:!1}),this.tree={nodes:new Map}}initializeTree(){if(void 0===this.tree.root&&0===this.tree.nodes.size){const e=new gp(void 0,ui.AND,void 0);this.tree.nodes.set(e.uuid,e),this.tree.root=e;const t=this.generateNewFilterNode(e);t&&(e.addChild(t),this.tree.nodes.set(t.uuid,t)),this.refreshTree()}}refreshTree(){this.tree={...this.tree}}get selectedGroupNode(){return this.selectedNode instanceof gp?this.selectedNode:this.selectedNode?.parent}setSelectedNode(e){this.selectedNode=e}generateNewFilterNode(e){if(e instanceof pp)return new pp(void 0,e.column,e.operation,(0,up.A)(e.value),e.not);if(e instanceof gp&&0!==this.columns.length){const e=N(this.columns,0),t={name:e.name,type:e.type},n=this._engine.getFilterOperation(ci.EQUAL);return new pp(void 0,t,n,n.generateDefaultValue(t),void 0)}}addFilterNode(e){if(this.tree.root){const t=this.generateNewFilterNode(e),n=e.parent;n&&t&&(n.addChild(t,e instanceof pp?n.children.indexOf(e)+1:void 0),this.tree.nodes.set(t.uuid,t),this.refreshTree())}}removeFilterNode(e){if(this.tree.root){const t=e.parent;if(e!==this.tree.root&&t){let n=[e];for(;n.length;)n.forEach((e=>{e instanceof gp&&e.children.forEach((e=>{e.setParent(void 0)})),this.tree.nodes.delete(e.uuid)})),n=Array.from(this.tree.nodes.values()).filter((e=>e!==this.tree.root&&!e.parent));if(t.removeChild(e),this.tree.nodes.delete(e.uuid),1===t.children.length){if(t!==this.tree.root){const e=N(t.children,0),n=P(t.parent);t.removeChild(e);const o=n.children.indexOf(t);n.removeChild(t),this.tree.nodes.delete(t.uuid),n.addChild(e,o)}}else 0===t.children.length&&t===this.tree.root&&(this.tree.root=void 0,this.tree.nodes.delete(t.uuid));this.refreshTree(),this.selectedNode===e&&this.setSelectedNode(void 0)}}}layerFilterNode(e){if(this.tree.root){const t=this.generateNewFilterNode(e),n=e.parent;if(n&&t){const o=n.children.indexOf(e);n.removeChild(e);const r=new gp(void 0,ui.OR,void 0);r.addChild(e),r.addChild(t),n.addChild(r,o),this.tree.nodes.set(r.uuid,r),this.tree.nodes.set(t.uuid,t),this.refreshTree(),this.selectedNode===e&&this.setSelectedNode(r)}}}getSnapshotSubscriberName(){return"filter-editor"}async applySnapshot(e,t){const n=Xi.serialization.fromJson(e.data.configuration);this.columns=n.columns.filter((t=>!Hi(e.data.groupExtendedColumns,t.name))),this.tree.nodes=new Map,this.tree.root=e.data.filter?hp(e.data.filter,void 0,this.tree.nodes,(e=>this._engine.getFilterOperation(e))):void 0,this.setSelectedNode(void 0),this.refreshTree()}applyChanges(){const e=P(this.getLatestSnapshot()),t=e.clone();t.data.filter=this.tree.root?mp(this.tree.root):void 0,t.finalize(),t.hashCode!==e.hashCode&&this.publishSnapshot(t)}}var Fg;!function(e){e.LEAF_LEVEL_MEASURE="Leaf Level Measure",e.LEAF_LEVEL_DIMENSION="Leaf Level Dimension",e.GROUP_LEVEL="Group Level"}(Fg||(Fg={}));const Pg=(0,bt.PA)((e=>{const{state:t}=e,n=$c(),o=t.view,r=o.extend,i=(0,Lt.useRef)(null),a=t.isGroupLevel?Fg.GROUP_LEVEL:t.columnKind===ii.MEASURE?Fg.LEAF_LEVEL_MEASURE:Fg.LEAF_LEVEL_DIMENSION,[s,l,c,u]=jc(),[d,p,g,m]=jc(),h=(0,Lt.useRef)(void 0),f=(0,Lt.useRef)(null),[C,b]=(0,Lt.useState)(),v=(0,Lt.useMemo)((()=>(0,Bn.A)((()=>{t.getReturnType().catch((e=>n.alertService.alertUnhandledError(e)))}),500)),[t,n]);return(0,Lt.useEffect)((()=>{if(!C&&f.current){const e=f.current,n=document.getElementById(Nr),r=Tr.editor.create(e,{contextmenu:!1,copyWithSyntaxHighlighting:!1,fontSize:14,fontFamily:"Roboto Mono",fontLigatures:!0,fixedOverflowWidgets:!0,detectIndentation:!1,tabSize:2,"bracketPairColorization.enabled":!1,automaticLayout:!0,fontSize:12,language:Fc.PURE,theme:vc.GITHUB_LIGHT,wordSeparators:su,fixedOverflowWidgets:!0,...L(n)?{overflowWidgetsDomNode:n}:{}});h.current?.dispose(),h.current=Tr.languages.registerCompletionItemProvider(Fc.PURE,{triggerCharacters:[...su,"$"],provideCompletionItems:async(e,n,r)=>{let i=[];return e.uri===t.editorModelUri&&(i=i.concat(await async function(e,n,o,r,i){const a=n.getValueInRange({startLineNumber:1,startColumn:1,endLineNumber:e.lineNumber,endColumn:e.column}),s=n.getWordAtPosition(e);let l=[];try{l=await r.getQueryTypeahead((o??"")+a,t.buildExtendBaseQuery(),i)}catch{}return l.map((t=>({label:t.display,kind:Tr.languages.CompletionItemKind.Text,filterText:t.display,insertTextRules:Tr.languages.CompletionItemInsertTextRule.InsertAsSnippet,insertText:t.completion,range:{startLineNumber:e.lineNumber,startColumn:s?.startColumn??e.column,endLineNumber:e.lineNumber,endColumn:s?.endColumn??e.column}})))}(n,e,t.codePrefix,o.engine,o.source))),{suggestions:i}}}),r.setModel(t.editorModel),r.onDidChangeModelContent((()=>{const e=r.getValue();e!==t.code&&(t.code=e,t.clearError(),t.setReturnType(void 0),v.cancel(),v())})),r.focus(),r.setPosition({lineNumber:1,column:t.code.length+1}),t.setEditor(r),b(r)}}),[t,C,v,o]),(0,Lt.useEffect)((()=>()=>{C&&(C.dispose(),h.current?.dispose())}),[C]),(0,Lt.useEffect)((()=>{t.editor?.updateOptions({readOnly:t.finalizationState.isInProgress})}),[t,t.finalizationState.isInProgress]),(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{className:"h-[calc(100%_-_40px)] w-full px-2 pt-2",children:(0,E.jsx)("div",{className:"h-full w-full overflow-auto border border-neutral-300 bg-white",children:(0,E.jsxs)("div",{className:"h-full w-full select-none p-0",children:[(0,E.jsxs)("div",{className:"h-24 w-full p-2",children:[(0,E.jsxs)("div",{className:"mt-1 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-24 flex-shrink-0 items-center text-sm",children:"Column Name:"}),(0,E.jsx)(qc,{className:"w-32",ref:i,disabled:t.finalizationState.isInProgress,value:t.name,onChange:e=>{t.setName(e.target.value)}}),(0,E.jsx)("div",{className:"ml-0.5 flex h-5 w-5 flex-shrink-0 items-center justify-center text-lg",children:t.isNameValid?(0,E.jsx)(dr.CircleChecked,{className:"text-green-500"}):(0,E.jsx)(dr.CircledFailed,{className:"text-red-500"})})]}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsxs)("div",{className:"flex h-full w-24 flex-shrink-0 items-center text-sm",children:["Column Kind:",(0,E.jsx)(ru,{className:"ml-1",documentationKey:Bp.EXTENDED_COLUMN_LEVELS})]}),(0,E.jsx)(Qc,{className:"w-32",onClick:s,open:u,disabled:t.finalizationState.isInProgress,children:a}),(0,E.jsx)(Zc,{className:"w-32",...c,children:[Fg.LEAF_LEVEL_MEASURE,Fg.LEAF_LEVEL_DIMENSION,Fg.GROUP_LEVEL].map((e=>(0,E.jsx)(eu,{onClick:()=>{switch(e){case Fg.LEAF_LEVEL_MEASURE:t.setColumnKind(!1,ii.MEASURE);break;case Fg.LEAF_LEVEL_DIMENSION:t.setColumnKind(!1,ii.DIMENSION);break;case Fg.GROUP_LEVEL:t.setColumnKind(!0,void 0);break;default:return}t.clearError(),t.setReturnType(void 0),v.cancel(),v(),l()},autoFocus:e===a,children:e},e)))})]}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-24 flex-shrink-0 items-center text-sm",children:"Value Type:"}),(0,E.jsx)(Qc,{className:"w-32",onClick:d,open:m,disabled:t.finalizationState.isInProgress,children:t.expectedType}),(0,E.jsx)("div",{className:"ml-0.5 flex h-5 w-5 flex-shrink-0 items-center justify-center text-lg",children:t.validationState.isInProgress?(0,E.jsx)(dr.Loader,{className:"animate-spin stroke-2 text-neutral-400"}):t.returnType?t.isTypeValid?(0,E.jsx)(dr.CircleChecked,{className:"text-green-500"}):(0,E.jsx)(dr.CircledFailed,{className:"text-red-500"}):null}),(0,E.jsx)(Zc,{className:"w-32",...g,children:[gi.TEXT,gi.NUMBER,gi.DATE].map((e=>(0,E.jsx)(eu,{onClick:()=>{t.setExpectedType(e),p()},autoFocus:e===t.expectedType,children:e},e)))})]})]}),(0,E.jsx)("div",{className:"h-[calc(100%_-_96px)] w-full p-2 pt-1",children:(0,E.jsx)("div",{className:jn("relative h-full w-full border border-neutral-200",{"border-red-500":Boolean(t.codeError)}),children:(0,E.jsx)("div",{className:"absolute left-0 top-0 h-full w-full overflow-hidden",ref:f})})})]})})}),(0,E.jsxs)("div",{className:"flex h-10 items-center justify-end px-2",children:[(0,E.jsx)(Xc,{onClick:()=>t.close(),children:"Cancel"}),t instanceof jg&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(Xc,{className:"ml-2",onClick:()=>{r.deleteColumn(t.initialData.name).catch((e=>n.alertService.alertUnhandledError(e)))},children:"Delete"}),(0,E.jsx)(Xc,{className:"ml-2",onClick:()=>{t.reset().catch((e=>n.alertService.alertUnhandledError(e)))},children:"Reset"})]}),(0,E.jsx)(Xc,{className:"ml-2",disabled:!t.isNameValid||!t.isTypeValid||t.validationState.isInProgress||t.finalizationState.isInProgress,onClick:()=>{t.applyChanges().catch((e=>n.alertService.alertUnhandledError(e)))},children:"OK"})]})]})}));class Bg{uuid=(0,i.A)();_manager;view;_name=`col_${this.uuid.replaceAll("-","_")}`;display;validationState=Ie.create();finalizationState=Ie.create();name;expectedType;isGroupLevel;columnKind;code="";codePrefix;codeSuffix;editor;editorModel;editorModelUri;codeError;returnType;constructor(e,t,n,o,r){(0,xe.Gn)(this,{name:xe.sH,setName:xe.XI,isNameValid:xe.EW,expectedType:xe.sH,setExpectedType:xe.XI,isTypeValid:xe.EW,isGroupLevel:xe.sH,columnKind:xe.sH,setColumnKind:xe.XI,editor:xe.sH.ref,setEditor:xe.XI,codeError:xe.sH.ref,showError:xe.XI,clearError:xe.XI,returnType:xe.sH,setReturnType:xe.XI}),this._manager=e,this.view=e.view,this.display=this.newDisplay(this),this.name=t,this.expectedType=n,this.isGroupLevel=o,this.columnKind=r,this.codePrefix=`->extend(~${this._name}:`,this.codeSuffix=")",this.editorModelUri=Tr.Uri.file(`/${this.uuid}.pure`),this.editorModel=Tr.editor.createModel("",Fc.PURE,this.editorModelUri)}async initialize(){this.code=await this.getInitialCode(),this.editorModel.setValue(this.code)}setName(e){this.name=e}get isNameValid(){return!this._manager.allColumnNames.includes(this.name)}setExpectedType(e){this.expectedType=e}get isTypeValid(){return void 0!==this.returnType&&this.expectedType===ji(this.returnType)}setColumnKind(e,t){this.isGroupLevel=e,this.columnKind=t}setEditor(e){this.editor=e}setReturnType(e){this.returnType=e}showError(e){this.codeError=e,e.sourceInformation&&Oc(this.editorModel,[{message:e.message,startLineNumber:e.sourceInformation.startLine,startColumn:e.sourceInformation.startColumn,endLineNumber:e.sourceInformation.endLine,endColumn:e.sourceInformation.endColumn}],this.uuid)}clearError(){this.codeError=void 0,Lc(this.uuid)}buildExtendBaseQuery(){const e=P(this._manager.getLatestSnapshot()).clone();return this.isGroupLevel||(e.data.leafExtendedColumns=[],e.data.selectColumns=[],e.data.filter=void 0,e.data.groupBy=void 0,e.data.pivot=void 0),e.data.groupExtendedColumns=[],e.data.sortColumns=[],e.data.limit=void 0,vl([],[Ml(e,this.view.source,this.view.engine,{skipExecutionContext:!0})])}async getReturnType(){this.validationState.inProgress(),this.clearError(),this.setReturnType(void 0);try{const e=await this.view.engine.getQueryCodeRelationReturnType(this.codePrefix+this.code+this.codeSuffix,this.buildExtendBaseQuery(),this.view.source);let t=Hi(e.columns,this._name)?.type;return t=t&&Ui(t)?t:void 0,this.setReturnType(t),t}catch(e){if(w(e),e instanceof Yp){if(this.validationState.fail(),e.sourceInformation){e.sourceInformation.startColumn-=1===e.sourceInformation.startLine?this.codePrefix.length:0,e.sourceInformation.endColumn-=1===e.sourceInformation.endLine?this.codePrefix.length:0;const t=this.editorModel.getFullModelRange();(e.sourceInformation.startLine<1||1===e.sourceInformation.startLine&&e.sourceInformation.startColumn<1||e.sourceInformation.endLine>t.endLineNumber||e.sourceInformation.endLine===t.endLineNumber&&e.sourceInformation.endColumn>t.endColumn)&&(e.sourceInformation.startColumn=t.startColumn,e.sourceInformation.startLine=t.startLineNumber,e.sourceInformation.endColumn=t.endColumn,e.sourceInformation.endLine=t.endLineNumber)}return void this.showError(e)}this.view.dataCube.alertService.alertError(e,{message:`Expression Validation Failure: ${e.message}`})}finally{this.validationState.complete()}}close(){this.editorModel.dispose(),this.editor?.dispose(),this.display.close()}}class Dg extends Bg{initialCode;constructor(e,t){super(e,`col_${e.allColumnNames.length+1}`,t?ji(t.type):gi.NUMBER,!1,t?t.kind:ii.MEASURE),this.initialCode=t?`${fi}|$${fi}.${t.name}`:`${fi}|`}async getInitialCode(){return this.initialCode}newDisplay(e){return this.view.dataCube.layoutService.newDisplay("Add New Column",(()=>(0,E.jsx)(Pg,{state:this})),{x:50,y:50,width:500,height:300,minWidth:300,minHeight:200,center:!1})}async applyChanges(){if(!this.validationState.hasCompleted||!this.isNameValid||!this.isTypeValid)return;let e,t;this.finalizationState.inProgress();try{[e,t]=await Promise.all([this.view.engine.parseValueSpecification(this.code,!1),this.getReturnType()])}catch(e){return w(e),void this.view.dataCube.alertService.alertError(e,{message:`Expression Validation Failure: ${e.message}`})}finally{this.finalizationState.complete()}e instanceof Ur?t?(this._manager.addNewColumn({name:this.name,type:t,mapFn:this.view.engine.serializeValueSpecification(e)},this.isGroupLevel,this.columnKind,this),this.close()):this.view.dataCube.alertService.alertError(new Error,{message:"Expression Validation Failure: Can't compute expression return type."}):this.view.dataCube.alertService.alertError(new Error,{message:"Expression Validation Failure: Expression must be a lambda."})}}class jg extends Bg{initialData;constructor(e,t,n,o){super(e,t.name,ji(t.type),o,n),(0,xe.Gn)(this,{initialData:xe.sH.ref,isNameValid:xe.$Z}),this.initialData={name:t.name,type:t.type,kind:n,isGroupLevel:o,mapFn:t.mapFn}}get isNameValid(){return!this._manager.allColumnNames.filter((e=>e!==this.initialData.name)).includes(this.name)}async getInitialCode(){return this.view.engine.getValueSpecificationCode(this.view.engine.deserializeValueSpecification(this.initialData.mapFn),!0)}newDisplay(e){return this.view.dataCube.layoutService.newDisplay("Edit Column",(()=>(0,E.jsx)(Pg,{state:this})),{x:50,y:50,width:500,height:300,minWidth:300,minHeight:200,center:!1})}async reset(){this.setName(this.initialData.name),this.setExpectedType(ji(this.initialData.type)),this.setColumnKind(this.initialData.isGroupLevel,this.initialData.kind),await this.initialize(),await this.getReturnType()}async applyChanges(){if(!this.validationState.hasCompleted||!this.isNameValid||!this.isTypeValid)return;let e,t;this.finalizationState.inProgress();try{[e,t]=await Promise.all([this.view.engine.parseValueSpecification(this.code,!1),this.getReturnType()])}catch(e){return w(e),void this.view.dataCube.alertService.alertError(e,{message:`Expression Validation Failure: ${e.message}`})}finally{this.finalizationState.complete()}e instanceof Ur?t?await this._manager.updateColumn(this.initialData.name,{name:this.name,type:t,mapFn:this.view.engine.serializeValueSpecification(e)},this.isGroupLevel,this.columnKind):this.view.dataCube.alertService.alertError(new Error,{message:"Expression Validation Failure: Can't compute expression return type."}):this.view.dataCube.alertService.alertError(new Error,{message:"Expression Validation Failure: Expression must be a lambda."})}}class Mg{name;type;data;constructor(e){this.name=e.name,this.type=e.type,this.data=e}}class Ug extends sp{view;columnConfigurations=[];selectColumns=[];sourceColumns=[];horizontalPivotCastColumns=[];leafExtendedColumns=[];groupExtendedColumns=[];newColumnEditors=[];existingColumnEditors=[];constructor(e){super(e.engine,e.settingService,e.snapshotService),(0,xe.Gn)(this,{sourceColumns:xe.sH.ref,horizontalPivotCastColumns:xe.sH.ref,leafExtendedColumns:xe.sH,setLeafExtendedColumns:xe.XI,groupExtendedColumns:xe.sH,setGroupExtendedColumns:xe.XI,allColumnNames:xe.EW,addNewColumn:xe.XI,updateColumn:xe.XI,deleteColumn:xe.XI,applySnapshot:xe.XI}),this.view=e}setLeafExtendedColumns(e){this.leafExtendedColumns=e}setGroupExtendedColumns(e){this.groupExtendedColumns=e}get allColumnNames(){return(0,tt.A)([...this.sourceColumns,...this.leafExtendedColumns,...this.groupExtendedColumns,...this.horizontalPivotCastColumns],(e=>e.name)).map((e=>e.name))}async openNewColumnEditor(e){const t=new Dg(this,e);await t.initialize(),this.newColumnEditors.push(t),t.display.open()}async openExistingColumnEditor(e){const t=this.existingColumnEditors.find((t=>t.initialData.name===e));if(t)return void t.display.open();if(!Hi(this.leafExtendedColumns,e)&&!Hi(this.groupExtendedColumns,e))return;const n=new jg(this,P(Hi(this.leafExtendedColumns,e)??Hi(this.groupExtendedColumns,e)).data,P(Hi(this.columnConfigurations,e)).kind,Boolean(Hi(this.groupExtendedColumns,e)));await n.initialize(),this.existingColumnEditors.push(n),n.display.open()}addNewColumn(e,t,n,o){const r=sd(e);n&&(r.kind=n,r.excludedFromPivot=n===ii.DIMENSION),this.columnConfigurations.push(r),S(this.newColumnEditors,o),t?this.groupExtendedColumns.push(new Mg(e)):(this.leafExtendedColumns.push(new Mg(e)),this.selectColumns.push(Wi(e))),this.applyChanges()}async updateColumn(e,t,n,o){if(!Hi(this.leafExtendedColumns,e)&&!Hi(this.groupExtendedColumns,e))return;const r=P(Hi(this.columnConfigurations,e)),i=this.view.taskService.newTask("Checking column update..."),a=P(this.getLatestSnapshot()).clone();a.data.leafExtendedColumns=a.data.leafExtendedColumns.filter((t=>t.name!==e)),a.data.groupExtendedColumns=a.data.groupExtendedColumns.filter((t=>t.name!==e)),a.data.selectColumns=a.data.selectColumns.filter((t=>t.name!==e)),n?a.data.groupExtendedColumns.push(t):(a.data.leafExtendedColumns.push(t),r.isSelected&&a.data.selectColumns.push(Wi(t))),a.data.configuration={...a.data.configuration,columns:this.columnConfigurations.map((n=>n.name===e?{...n.serialize(),...Wi(t),kind:o}:n.serialize()))};const s=await this._engine.getPartialQueryCode(a,!0);try{await this._engine.getQueryCodeRelationReturnType("->"+s,vl([],[this.view.source.query]),this.view.source)}catch(t){return w(t),void(t instanceof Yp?this.view.dataCube.alertService.alertCodeCheckError(t,s,"->",{message:`Column Update Check Failure: Can't safely update column '${e}'. Check the query code below for more details.`,text:`Error: ${t.message}`}):this.view.dataCube.alertService.alertError(t,{message:`Column Update Check Failure: Can't safely update column '${e}'.`,text:`Error: ${t.message}`}))}finally{this.view.taskService.endTask(i)}this.setLeafExtendedColumns(this.leafExtendedColumns.filter((t=>t.name!==e))),this.setGroupExtendedColumns(this.groupExtendedColumns.filter((t=>t.name!==e))),this.selectColumns=this.selectColumns.filter((t=>t.name!==e)),n?this.setGroupExtendedColumns([...this.groupExtendedColumns,new Mg(t)]):(this.setLeafExtendedColumns([...this.leafExtendedColumns,new Mg(t)]),r.isSelected&&this.selectColumns.push(Wi(t))),this.columnConfigurations=this.columnConfigurations.map((n=>(n.name===e&&(n.kind=o??ji(t.type)===gi.NUMBER?ii.MEASURE:ii.DIMENSION,n.name=t.name,n.type=t.type,n.excludedFromPivot=n.kind===ii.DIMENSION),n))),this.existingColumnEditors.filter((t=>t.initialData.name===e)).forEach((e=>e.display.close())),this.existingColumnEditors=this.existingColumnEditors.filter((t=>t.initialData.name!==e)),this.applyChanges()}async deleteColumn(e){if(!Hi(this.leafExtendedColumns,e)&&!Hi(this.groupExtendedColumns,e))return;const t=this.view.taskService.newTask("Checking column deletion..."),n=P(this.getLatestSnapshot()).clone();n.data.leafExtendedColumns=n.data.leafExtendedColumns.filter((t=>t.name!==e)),n.data.groupExtendedColumns=n.data.groupExtendedColumns.filter((t=>t.name!==e)),n.data.selectColumns=n.data.selectColumns.filter((t=>t.name!==e)),n.data.configuration={...n.data.configuration,columns:this.columnConfigurations.filter((t=>t.name!==e)).map((e=>e.serialize()))};const o=await this._engine.getPartialQueryCode(n,!0);try{await this._engine.getQueryCodeRelationReturnType("->"+o,vl([],[this.view.source.query]),this.view.source)}catch(t){return w(t),void(t instanceof Yp?this.view.dataCube.alertService.alertCodeCheckError(t,o,"->",{message:`Column Delete Check Failure: Can't safely delete column '${e}'. Check the query code below for more details.`,text:`Error: ${t.message}`}):this.view.dataCube.alertService.alertError(t,{message:`Column Delete Check Failure: Can't safely delete column '${e}'.`,text:`Error: ${t.message}`}))}finally{this.view.taskService.endTask(t)}this.setLeafExtendedColumns(this.leafExtendedColumns.filter((t=>t.name!==e))),this.setGroupExtendedColumns(this.groupExtendedColumns.filter((t=>t.name!==e))),this.columnConfigurations=this.columnConfigurations.filter((t=>t.name!==e)),this.selectColumns=this.selectColumns.filter((t=>t.name!==e)),this.existingColumnEditors.filter((t=>t.initialData.name===e)).forEach((e=>e.display.close())),this.existingColumnEditors=this.existingColumnEditors.filter((t=>t.initialData.name!==e)),this.applyChanges()}getSnapshotSubscriberName(){return"extend-manager"}async applySnapshot(e,t){const n=Xi.serialization.fromJson(e.data.configuration);this.columnConfigurations=n.columns,this.sourceColumns=e.data.sourceColumns,this.leafExtendedColumns=e.data.leafExtendedColumns.map((e=>new Mg(e))),this.groupExtendedColumns=e.data.groupExtendedColumns.map((e=>new Mg(e))),this.horizontalPivotCastColumns=e.data.pivot?.castColumns??[],this.selectColumns=e.data.selectColumns.map(Wi),[...this.newColumnEditors,...this.existingColumnEditors].forEach((e=>{e.getReturnType().catch((()=>{}))}))}applyChanges(){const e=P(this.getLatestSnapshot()),t=e.clone();t.data.configuration={...e.data.configuration,columns:this.columnConfigurations.map((e=>e.serialize()))},t.data.leafExtendedColumns=this.leafExtendedColumns.map((e=>e.data)),t.data.groupExtendedColumns=this.groupExtendedColumns.map((e=>e.data)),t.data.selectColumns=[...this.selectColumns],t.finalize(),t.hashCode!==e.hashCode&&this.publishSnapshot(t)}}class Gg{uuid=(0,i.A)();description;startTime=Date.now();ownerId;endTime;constructor(e,t){this.description=e,this.ownerId=t}end(){this.endTime=Date.now()}}class Vg{tasks=[];constructor(){(0,xe.Gn)(this,{tasks:xe.sH,newTask:xe.XI,endTask:xe.XI,endTasks:xe.XI})}newTask(e,t){const n=new Gg(e,t);return this.tasks.push(n),n}endTask(e){return this.tasks.find((t=>t.uuid===e.uuid))&&(this.tasks=this.tasks.filter((t=>t.uuid!==e.uuid)),e.end()),e}endTasks(e){this.tasks=this.tasks.filter((t=>!e.find((e=>e.uuid===t.uuid)))),e.forEach((e=>e.end()))}}class Hg{uuid=(0,i.A)();manager;constructor(e){(0,xe.Gn)(this,{tasks:xe.EW}),this.manager=e??new Vg}get tasks(){return this.manager.tasks.filter((e=>e.ownerId===this.uuid))}newTask(e){return this.manager.newTask(e,this.uuid)}endTask(e){return this.manager.endTask(e)}dispose(){this.manager.endTasks(this.tasks)}}class Wg extends Vl{model;runtime;db;schema;table;count}class $g{dataCube;engine;logService;taskService;layoutService;alertService;settingService;snapshotService;info;editor;grid;filter;extend;initializeState=Ie.create();processCacheState=Ie.create();_source;_initialSource;_initialSpecification;constructor(e){this.dataCube=e,this.engine=e.engine,this.logService=e.logService,this.taskService=new Hg(e.taskService.manager),this.layoutService=e.layoutService,this.alertService=e.alertService,this.settingService=e.settingService,this.snapshotService=new lp(this.logService,this.settingService),this.info=new rg(this),this.editor=new Kp(this),this.grid=new og(this),this.filter=new Lg(this),this.extend=new Ug(this)}getInitialSource(){return this._initialSource}async generateSpecification(){const e=this.snapshotService.getCurrentSnapshot(),t=new ad;return t.source=this.dataCube.specification.source,t.configuration=Xi.serialization.fromJson(e.data.configuration),t.query=await this.engine.getPartialQueryCode(e),t}get source(){if(!this._source)throw new x("Source is not initialized");return this._source}updateName(e){const t=this.snapshotService.getCurrentSnapshot(),n=t.clone(),o=Xi.serialization.fromJson(t.data.configuration);o.name!==e&&(o.name=e,n.data.configuration=o.serialize(),n.finalize(),n.hashCode!==t.hashCode&&this.snapshotService.broadcastSnapshot(n))}async applySpecification(e){const t=this.taskService.newTask("Applying specification...");try{if(!this._initialSource||!this._initialSpecification)throw new Error("DataCube is not initialized");if(!(0,Ro.A)(e.source,this._initialSpecification.source))throw new Error("Can't apply specification with different source");const t=await this.engine.parseValueSpecification(e.query),n=await cg(t,this._initialSource,e,this.engine);n.finalize(),n.hashCode!==this.snapshotService.getCurrentSnapshot().hashCode&&this.snapshotService.broadcastSnapshot(n)}catch(e){w(e),this.alertService.alertError(e,{message:`Specification Application Failure: ${e.message}`}),this.initializeState.fail()}finally{this.taskService.endTask(t)}}async initializeCache(){this.processCacheState.inProgress();const e=this.taskService.newTask("Initializing cache...");try{const e=await this.engine.initializeCache(this.source,{debug:this.settingService.getBooleanValue(du.DEBUGGER__ENABLE_DEBUG_MODE),clientVersion:this.settingService.getBooleanValue(du.DEBUGGER__USE_DEV_CLIENT_PROTOCOL_VERSION)?Ul.VX_X_X:void 0});e&&(this._source=e),this.processCacheState.pass()}catch(e){w(e),this.alertService.alertError(e,{message:`Cache Processing Failure: ${e.message}`}),this._source=this._initialSource,this.processCacheState.fail()}finally{this.taskService.endTask(e)}}async disposeCache(){if(!(this._source instanceof Wg))return;const e=this._source;this._source=this._initialSource,this.processCacheState.inProgress();const t=this.taskService.newTask("Disposing cache...");try{await this.engine.disposeCache(e)}catch(e){w(e),this.alertService.alertError(e,{message:`Cache Processing Failure: ${e.message}`})}finally{this.processCacheState.complete(),this.taskService.endTask(t)}}async initialize(e){this.initializeState.inProgress();const t=this.taskService.newTask("Initializing...");try{await Promise.all([this.info,this.editor,this.grid,this.grid.controller,this.filter,this.extend].map((async e=>{this.snapshotService.registerSubscriber(e)})));const t=await this.engine.processSource(e.source);this._source=t,this._initialSource=t,this._initialSpecification=e;const n=await this.engine.parseValueSpecification(e.query),o=await cg(n,t,e,this.engine);e.options?.autoEnableCache&&(await this.grid.setCachingEnabled(!0,{suppressWarning:!0}),this.grid.isCachingEnabled&&this.settingService.getBooleanValue(du.GRID_CLIENT__SHOW_AUTO_ENABLE_CACHE_PERFORMANCE_WARNING)&&this.alertService.alert({message:"Caching is auto-enabled for this DataCube",text:"When enabled, the source dataset will be cached locally in order to boost query performance. But depending on computational resource available to your environment, sometimes, caching can negatively impact the overall performance, and can even lead to crashes.\n\nOverall, caching is still an experimental feature where we only support queries with simple execution plans, certain queries might not work.\n\nYou can disable caching if needed, otherwise, please proceed with caution.",type:uu.WARNING,actions:[{label:"OK",handler:()=>{}},{label:"Disable Caching",handler:()=>{this.grid.setCachingEnabled(!1,{suppressWarning:!0}).catch((e=>this.alertService.alertUnhandledError(e)))}},{label:"Dismiss Warning",handler:()=>{this.settingService.updateValue(this.dataCube.api,du.GRID_CLIENT__SHOW_AUTO_ENABLE_CACHE_PERFORMANCE_WARNING,!1)}}],windowConfig:{...fr,width:600,height:300,minWidth:300,minHeight:150}})),this.snapshotService.broadcastSnapshot(o),this.dataCube.options?.onViewInitialized?.({api:this.dataCube.api,source:t}),this.initializeState.pass()}catch(e){w(e),this.alertService.alertError(e,{message:`Initialization Failure: ${e.message}`,text:"Resolve the issue and reload the engine."}),this.initializeState.fail()}finally{this.taskService.endTask(t)}}dispose(){this.taskService.dispose()}}var zg;!function(e){e.SETTINGS__FAILURE__FOUND_UNREGISTERED_SETTING="data-cube.settings.failure.found-unregistered-setting",e.SETTINGS__FAILURE__ASSIGN_INCOMPATIBLE_VALUE="data-cube.settings.failure.assign-incompatible-value",e.SETTINGS__FAILURE__RETRIEVE_INCOMPATIBLE_VALUE="data-cube.settings.failure.retrieve-incompatible-value"}(zg||(zg={}));const Yg=(0,bt.PA)((e=>{const{configuration:t}=e,n=$c(),o=n.settingService;switch(t.type){case qg.BOOLEAN:{const e=z(o.currentValues.get(t.key));return(0,E.jsxs)("div",{className:"my-2",children:[(0,E.jsx)("div",{className:"font-medium",children:t.title}),(0,E.jsx)("div",{className:"flex pr-2",children:(0,E.jsx)(Jc,{label:t.description,checked:e,onChange:()=>{(0,xe.h5)((()=>{o.currentValues.set(t.key,!e)}))}})})]})}case qg.NUMERIC:{const e=$(o.currentValues.get(t.key)),n=t.defaultValue;return(0,E.jsxs)("div",{className:"my-2",children:[(0,E.jsx)("div",{className:"font-medium",children:t.title}),(0,E.jsx)("div",{className:"mb-1.5 text-sm text-neutral-700",children:t.description}),(0,E.jsx)(Kc,{className:"w-20 text-sm",min:t.numericValueMin,step:t.numericValueStep,max:t.numericValueMax,defaultValue:n,value:e,setValue:e=>{(0,xe.h5)((()=>{o.currentValues.set(t.key,e??n)}))}})]})}case qg.STRING:{const e=W(o.currentValues.get(t.key));return(0,E.jsxs)("div",{className:"my-2",children:[(0,E.jsx)("div",{className:"font-medium",children:t.title}),(0,E.jsx)("div",{className:"mb-1.5 text-sm text-neutral-700",children:t.description}),(0,E.jsx)(qc,{className:"w-80 text-sm",value:e,onChange:e=>{(0,xe.h5)((()=>{o.currentValues.set(t.key,e.target.value)}))}})]})}case qg.ACTION:return(0,E.jsxs)("div",{className:"my-2",children:[(0,E.jsx)("div",{className:"font-medium",children:t.title}),(0,E.jsx)("div",{className:"mb-1.5 text-sm text-neutral-700",children:t.description}),(0,E.jsx)("div",{className:"flex pr-2",children:(0,E.jsx)(Xc,{compact:!0,onClick:()=>t.action?.(n.api,void 0),children:"Run Action"})})]});default:return null}})),Xg=(0,bt.PA)((()=>{const e=$c(),t=e.settingService,n=Array.from(t.configurations.values()).toSorted(((e,t)=>e.title.localeCompare(t.title)));return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{className:"h-[calc(100%_-_40px)] w-full p-2 pb-0",children:(0,E.jsxs)("div",{className:"h-full w-full select-none overflow-auto border border-neutral-300 bg-white p-2",children:[(0,E.jsx)("div",{className:"mt-1 flex h-5",children:(0,E.jsxs)("div",{className:"flex h-full",children:[(0,E.jsx)("div",{className:"flex h-5 items-center text-xl font-medium",children:(0,E.jsx)(dr.Table,{})}),(0,E.jsx)("div",{className:"ml-1 flex h-5 items-center text-xl font-medium",children:"Grid"})]})}),n.filter((e=>e.group===Kg.GRID)).map((e=>(0,E.jsx)(Yg,{configuration:e},e.key))),(0,E.jsx)("div",{className:"my-2 h-[1px] w-full bg-neutral-200"}),(0,E.jsx)("div",{className:"mt-1 flex h-5",children:(0,E.jsxs)("div",{className:"flex h-full",children:[(0,E.jsx)("div",{className:"flex h-5 items-center text-xl font-medium",children:(0,E.jsx)(dr.Debug,{})}),(0,E.jsx)("div",{className:"ml-1 flex h-5 items-center text-xl font-medium",children:"Debug"})]})}),n.filter((e=>e.group===Kg.DEBUG)).map((e=>(0,E.jsx)(Yg,{configuration:e},e.key)))]})}),(0,E.jsxs)("div",{className:"flex h-10 items-center justify-end px-2",children:[(0,E.jsx)(Xc,{onClick:()=>t.restoreDefaultValues(),disabled:!t.allowRestoreDefaultValues,children:"Restore Default Settings"}),(0,E.jsx)(Xc,{className:"ml-2",onClick:()=>{t.display.close()},children:"Cancel"}),(0,E.jsx)(Xc,{className:"ml-2",onClick:()=>t.save(e.api),children:"Apply"}),(0,E.jsx)(Xc,{className:"ml-2",onClick:()=>{t.save(e.api),t.display.close()},children:"OK"})]})]})}));var Kg,qg,Jg,Qg,Zg,em;!function(e){e.DEBUG="Debug",e.EDITOR="Editor",e.GRID="Grid"}(Kg||(Kg={})),function(e){e.BOOLEAN="boolean",e.NUMERIC="numeric",e.STRING="string",e.ACTION="action"}(qg||(qg={}));class tm{_engine;_logService;_layoutService;_options;display;configurations=new Map;defaultValues=new Map;_defaultValuesHashCode;values=new Map;currentValues=new Map;constructor(e,t,n,o){(0,xe.Gn)(this,{values:xe.sH,save:xe.XI,valuesHashCode:xe.EW,currentValues:xe.sH,restoreDefaultValues:xe.XI,currentValuesHashCode:xe.EW,allowRestoreDefaultValues:xe.EW}),this._engine=e,this._logService=t,this._layoutService=n,this._options=o,this.display=this._layoutService.newDisplay("Settings",(()=>(0,E.jsx)(Xg,{})),{x:-50,y:50,width:600,height:400,minWidth:300,minHeight:200,center:!1});const r=[{key:du.DEBUGGER__ENABLE_DEBUG_MODE,title:"Debug Mode: Enabled",description:"Enables debug logging when running data queries, updating snapshots, etc.",group:Kg.DEBUG,type:qg.BOOLEAN,defaultValue:!1},{key:du.DEBUGGER__USE_DEV_CLIENT_PROTOCOL_VERSION,title:"Use development client protocol version: Enabled",description:"Specifies if development client protocol version (vX_X_X) should be used for execution",group:Kg.DEBUG,type:qg.BOOLEAN,defaultValue:!1},{key:du.DEBUGGER__ACTION__RELOAD,title:"Reload",description:"Manually reload DataCube (keeping all states). This is needed when making changes to settings that require reloading to take effect.",group:Kg.DEBUG,type:qg.ACTION,action:e=>e.reload(),defaultValue:void 0},{key:du.GRID_CLIENT__SHOW_CACHE_PERFORMANCE_WARNING,title:"Caching Performance Warning: Enabled",description:"Alerts user of potential performance and resource-related issues that caching can cause when enabled.",group:Kg.GRID,type:qg.BOOLEAN,defaultValue:!0},{key:du.GRID_CLIENT__SHOW_AUTO_ENABLE_CACHE_PERFORMANCE_WARNING,title:"Caching (Auto-Enabled) Performance Warning: Enabled",description:"Alerts user that caching is auto-enabled for the DataCube and of potential performance and resource-related issues that caching can cause when enabled.",group:Kg.GRID,type:qg.BOOLEAN,defaultValue:!0},{key:du.EDITOR__MAX_HISTORY_STACK_SIZE,title:"Max History Stack Size",description:"Sets the number of maximum snapshots to store in edit history.",group:Kg.EDITOR,type:qg.NUMERIC,defaultValue:100,numericValueMin:10,numericValueStep:10,action:(e,t)=>e._runTaskForEachView((e=>{e.snapshotService.adjustHistorySize(t)}))},{key:du.GRID_CLIENT__SUPPRESS_LARGE_DATASET_WARNING,title:"Large Dataset Warning: Disabled",description:"Suggests user to enable pagination when handling large datasets to improve performance.",group:Kg.GRID,type:qg.BOOLEAN,defaultValue:!1},{key:du.GRID_CLIENT__ROW_BUFFER,title:"Row Buffer",description:"Sets the number of rows the grid renders outside of the viewable area. e.g. if the buffer is 10 and your grid is showing 50 rows (as that's all that fits on your screen without scrolling), then the grid will actually render 70 in total (10 extra above and 10 extra below). Then when you scroll, the grid will already have 10 rows ready and waiting to show, no redraw is needed. A low small buffer will make initial draws of the grid faster; whereas a big one will reduce the redraw visible vertically scrolling.",group:Kg.GRID,type:qg.NUMERIC,defaultValue:50,numericValueMin:10,numericValueStep:10,action:(e,t)=>e._runTaskForEachView((e=>{e.grid.client.updateGridOptions({rowBuffer:t})}))},{key:du.GRID_CLIENT__PURGE_CLOSED_ROW_NODES,title:"Refresh Group Node Data: Enabled",description:"Forces refresh data when group node is opened.",group:Kg.GRID,type:qg.BOOLEAN,defaultValue:!1,action:(e,t)=>e._runTaskForEachView((e=>{e.grid.client.updateGridOptions({purgeClosedRowNodes:t})}))},{key:du.GRID_CLIENT__ACTION__RETRY_FAILED_DATA_FETCHES,title:"Retry Failed Data Fetches: Action",description:"Manually re-runs all failed data fetches in the grid.",group:Kg.GRID,type:qg.ACTION,action:e=>e.retryFailedDataFetches(),defaultValue:void 0}],{configurations:i,values:a}=o?.settingsData??{};[...r,...i??[]].forEach((e=>{this.configurations.set(e.key,e),this.setValue(e.key,e.defaultValue,[this.defaultValues,this.values,this.currentValues])}));const s=a??{};Object.keys(s).forEach((e=>{const t=s[e];this.configurations.get(e)&&this.setValue(e,t,[this.values,this.currentValues])})),this._defaultValuesHashCode=this.computeValuesHashCode(this.defaultValues)}setValue(e,t,n){const o=this.configurations.get(e);if(!o)return this._logService.logWarning(c.create(zg.SETTINGS__FAILURE__FOUND_UNREGISTERED_SETTING),`Can't set value for unregistered setting '${e}'`),!1;switch(o.type){case qg.BOOLEAN:if(!(V(t)||void 0===t&&o.valueOptional))return this._logService.logWarning(c.create(zg.SETTINGS__FAILURE__FOUND_UNREGISTERED_SETTING),`Can't set value for setting '${e}': boolean value expected`),!1;break;case qg.NUMERIC:if(!(G(t)||void 0===t&&o.valueOptional))return this._logService.logWarning(c.create(zg.SETTINGS__FAILURE__FOUND_UNREGISTERED_SETTING),`Can't set value for setting '${e}': numeric value expected`),!1;break;case qg.STRING:if(!(U(t)||void 0===t&&o.valueOptional))return this._logService.logWarning(c.create(zg.SETTINGS__FAILURE__FOUND_UNREGISTERED_SETTING),`Can't set value for setting '${e}': string value expected`),!1;break;case qg.ACTION:return!1;default:throw new I(`Can't set value for unsupported setting type '${o.type}'`)}return n.forEach((n=>{(0,xe.h5)((()=>n.set(e,t)))})),!0}getConfiguration(e){const t=this.configurations.get(e);if(!t)throw this._logService.logWarning(c.create(zg.SETTINGS__FAILURE__FOUND_UNREGISTERED_SETTING),`Can't retrieve value for unregistered setting '${e}'`),new x(`Can't retrieve value for unregistered setting '${e}'`);return t}getBooleanValue(e){const t=this.values.get(e);if(this.getConfiguration(e).type!==qg.BOOLEAN||!V(t))throw this._logService.logWarning(c.create(zg.SETTINGS__FAILURE__RETRIEVE_INCOMPATIBLE_VALUE),`Can't retrieve boolean value for setting '${e}'`),new x(`Can't retrieve boolean value for setting '${e}'`);return t}getNumericValue(e){const t=this.values.get(e);if(this.getConfiguration(e).type!==qg.NUMERIC||!G(t))throw this._logService.logWarning(c.create(zg.SETTINGS__FAILURE__RETRIEVE_INCOMPATIBLE_VALUE),`Can't retrieve numeric value for setting '${e}'`),new x(`Can't retrieve numeric value for setting '${e}'`);return t}getStringValue(e){const t=this.values.get(e);if(this.getConfiguration(e).type!==qg.STRING||!U(t))throw this._logService.logWarning(c.create(zg.SETTINGS__FAILURE__RETRIEVE_INCOMPATIBLE_VALUE),`Can't retrieve string value for setting '${e}'`),new x(`Can't retrieve string value for setting '${e}'`);return t}computeValuesHashCode(e){return Lr(Array.from(e.entries()).toSorted(((e,t)=>e[0].localeCompare(t[0]))).map((([e,t])=>`${e}:${t}`)))}get valuesHashCode(){return this.computeValuesHashCode(this.values)}get currentValuesHashCode(){return this.computeValuesHashCode(this.currentValues)}get allowRestoreDefaultValues(){return this._defaultValuesHashCode!==this.currentValuesHashCode}restoreDefaultValues(){this.currentValues.clear(),this.defaultValues.forEach(((e,t)=>this.currentValues.set(t,e)))}getCurrentSettingValues(){const e={};return this.values.forEach(((t,n)=>{const o=this.configurations.get(n);o&&t!==o.defaultValue&&(e[n]=t)})),e}updateValue(e,t,n){const o=this.configurations.get(t);o?this.setValue(t,n,[this.values,this.currentValues])&&(this._options?.onSettingsChanged?.({api:e,values:this.getCurrentSettingValues()}),o.action?.(e,n)):this._logService.logWarning(c.create(zg.SETTINGS__FAILURE__FOUND_UNREGISTERED_SETTING),`Can't set value for unregistered setting '${t}'`)}save(e){const t=new Set;this.values.forEach(((e,n)=>{e!==this.currentValues.get(n)&&t.add(n)})),this.values.clear(),this.currentValues.forEach(((e,t)=>this.values.set(t,e))),this._options?.onSettingsChanged?.({api:e,values:this.getCurrentSettingValues()});let n=!1;for(const o of t){const t=this.configurations.get(o);t?.requiresReload&&(n=!0),t?.action&&t.action(e,this.values.get(o))}n&&e.reload()}}class nm{_dataCube;constructor(e){this._dataCube=e}_runTaskForEachView(e){e(this._dataCube.view)}getProcessedSource(){return this._dataCube.view.getInitialSource()}generateSpecification(){return this._dataCube.view.generateSpecification()}updateName(e){this._dataCube.view.updateName(e)}async applySpecification(e){await this._dataCube.view.applySpecification(e)}retryFailedDataFetches(){this._runTaskForEachView((e=>{e.grid.client.retryServerSideLoads()}))}reload(){this._dataCube.reload()}}!function(e){e.PROFILE="Profile",e.CLASS="Class",e.ENUMERATION="Enum",e.MEASURE="Measure",e.ASSOCIATION="Association",e.FUNCTION="function",e.MAPPING="Mapping",e.FLAT_DATA="FlatData",e.DATABASE="Database",e.SERVICE="Service",e.RUNTIME="Runtime",e.CONNECTION="Connection",e.FILE_GENERATION="FileGeneration",e.GENERATION_SPECIFICATION="GenerationSpecification",e.DATA_ELEMENT="Data",e.EXECUTION_ENVIRONMENT="ExecutionEnvironment"}(Jg||(Jg={})),function(e){e.JSON_MODEL_CONNECTION="JsonModelConnection",e.XML_MODEL_CONNECTION="XmlModelConnection",e.MODEL_CHAIN_CONNECTION="ModelChainConnection",e.RELATIONAL_DATABASE_CONNECTION="RelationalDatabaseConnection",e.FLAT_DATA_CONNECTION="FlatDataConnection"}(Qg||(Qg={})),(em=Zg||(Zg={})).PURE="Pure",em.CONNECTION="Connection",em.RUNTIME="Runtime",em.MAPPING="Mapping",em.SERVICE="Service",em.FLATDATA="FlatData",em.RELATIONAL="Relational",em.GENERATION_SPECIFICATION="GenerationSpecification",em.FILE_GENERATION_SPECIFICATION="FileGeneration",em.DATA="Data";const om={wordPattern:/(-?\d*\.\d\w*)|([^`~!@#%^$&*()\-=+[{\]}\\|;:'",.<>/?\s][^`~!@#%^&*()\-=+[{\]}\\|;:'",.<>/?\s]*)/,comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"<",close:">"},{open:"<<",close:">>"}],folding:{markers:{start:new RegExp("^\\s*//\\s*(?:(?:#?region\\b)|(?:<editor-fold\\b))"),end:new RegExp("^\\s*//\\s*(?:(?:#?endregion\\b)|(?:</editor-fold>))")}}};const rm=(0,bt.PA)((()=>{const e=$c().documentationService.currentEntry;if(!e)return null;const t=e.markdownText??e.text;return(0,E.jsxs)("div",{className:"h-full w-full overflow-auto bg-white p-4",children:[(0,E.jsx)("div",{className:"mb-3 text-2xl font-bold",children:e.title}),t&&(U(t)?(0,E.jsx)("div",{children:t}):(0,E.jsx)(On,{value:t}))]})}));class im{_engine;_layoutService;display;currentEntry;constructor(e,t){(0,xe.Gn)(this,{currentEntry:xe.sH,setCurrentEntry:xe.XI}),this._engine=e,this._layoutService=t,this.display=this._layoutService.newDisplay("Documentation",(()=>(0,E.jsx)(rm,{})),{x:-50,y:-50,width:400,height:400,minWidth:300,minHeight:200,center:!1})}getEntry(e){return this._engine.getDocumentationEntry(e)}setCurrentEntry(e){this.currentEntry=e}shouldDisplayDocumentationEntry(e){return Boolean(e.title&&(e.text??e.markdownText))}}class am{_engine;constructor(e){this._engine=e}sendTelemetry(e,t){this._engine.sendTelemetry(e,t)}}class sm{_engine;constructor(e){this._engine=e}openLink(e){this._engine.openLink(e)}}class lm{_engine;constructor(e){this._engine=e}logDebug(e,...t){this._engine.logDebug(e,...t)}debugProcess(e,...t){this._engine.debugProcess(e,...t)}logInfo(e,...t){this._engine.logInfo(e,...t)}logWarning(e,...t){this._engine.logWarning(e,...t)}logError(e,...t){this._engine.logError(e,...t)}logUnhandledError(e){this._engine.logUnhandledError(e)}logIllegalStateError(e,t){this._engine.logIllegalStateError(e,t)}}class cm{engine;logService;taskService;layoutService;settingService;documentationService;alertService;navigationService;telemetryService;specification;options;initializeState=Ie.create();api;uuid=(0,i.A)();view;constructor(e,t,n){(0,xe.Gn)(this,{uuid:xe.sH,reload:xe.XI}),this.engine=t,this.logService=new lm(this.engine),this.taskService=new Hg(n?.taskManager),this.layoutService=new br(n?.layoutManager),this.settingService=new tm(this.engine,this.logService,this.layoutService,n),this.documentationService=new im(this.engine,this.layoutService),this.alertService=new gu(this.logService,this.layoutService),this.navigationService=new sm(this.engine),this.telemetryService=new am(this.engine),this.api=new nm(this),this.specification=e,this.options=n,this.view=new $g(this)}async initialize(){if(this.initializeState.isInInitialState){this.initializeState.inProgress();try{this.options?.gridClientLicense&&yr.hFV.setLicenseKey(this.options.gridClientLicense),await(async(e,t)=>{Tr.editor.defineTheme(vc.DEFAULT_DARK,_c),Tr.editor.defineTheme(vc.SOLARIZED_DARK,Tc),Tr.editor.defineTheme(vc.GITHUB_DARK,Nc),Tr.editor.defineTheme(vc.GITHUB_DARK_DIMMED,Ac),Tr.editor.defineTheme(vc.GITHUB_LIGHT,Sc),Tr.editor.defineTheme(vc.MATERIAL_DEFAULT,yc),Tr.editor.defineTheme(vc.MATERIAL_DARKER,xc),Tr.editor.defineTheme(vc.ONE_DARK_PRO,Ic),Tr.editor.defineTheme(vc.ONE_DARK_PRO_DARKER,wc);const n=`Monospaced font '${e}' has not been loaded properly, code editor might not display properly`;await Promise.all([400,700].map((t=>document.fonts.load(`${t} 1em ${e}`)))).then((()=>{document.fonts.check(`1em ${e}`)?Tr.editor.remeasureFonts():t(new Error(n))})).catch((()=>t(new Error(n))))})(ti.ROBOTO_MONO,(e=>{throw e})),function(e){var t;Tr.languages.register({id:Fc.PURE}),Tr.languages.setLanguageConfiguration(Fc.PURE,om),Tr.languages.setMonarchTokensProvider(Fc.PURE,(t=e?.extraKeywords??[],{defaultToken:"invalid",tokenPostfix:".pure",keywords:[...t,"Schema","Table","Join","View","primaryKey","groupBy","mainTable","let","extends","true","false","projects",Jg.CLASS,Jg.ASSOCIATION,Jg.ENUMERATION,Jg.MEASURE,Jg.PROFILE,Jg.FUNCTION,Jg.MAPPING,Jg.RUNTIME,Jg.CONNECTION,Jg.FILE_GENERATION,Jg.GENERATION_SPECIFICATION,Jg.DATA_ELEMENT,Qg.JSON_MODEL_CONNECTION,Qg.MODEL_CHAIN_CONNECTION,Qg.XML_MODEL_CONNECTION,"include","EnumerationMapping","Pure","AssociationMapping","XStore","AggregationAware",Jg.SERVICE,Jg.FLAT_DATA,Jg.DATABASE,Qg.FLAT_DATA_CONNECTION,Qg.RELATIONAL_DATABASE_CONNECTION,"Relational"],operators:["=",">","<","!","~","?",":","==","<=",">=","&&","||","++","--","+","-","*","/","&","|","^","%","->","#{","}#","@","<<",">>"],languageStructs:["import","native"],identifier:/[a-zA-Z_$][\w$]*/,symbols:/[=><!~?:&|+\-*/^%#@]+/,escapes:/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,digits:/\d+(_+\d+)*/,octaldigits:/[0-7]+(_+[0-7]+)*/,binarydigits:/[0-1]+(_+[0-1]+)*/,hexdigits:/[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,multiplicity:/\[(?:[a-zA-Z0-9]+(?:\.\.(?:[a-zA-Z0-9]+|\*|))?|\*)\]/,package:/(?:[\w_]+::)+/,generics:/(?:(?:<\w+>)|(?:<[^:.@^()]+[^-]>))/,date:/%-?\d+(?:-\d+(?:-\d+(?:T(?:\d+(?::\d+(?::\d+(?:.\d+)?)?)?)(?:[+-][0-9]{4})?)))/,time:/%\d+(?::\d+(?::\d+(?:.\d+)?)?)?/,tokenizer:{root:[{include:"@pure"},{include:"@date"},{include:"@color"},[/^\s*###[\w]+/,Gl.PARSER],[/(@identifier)/,{cases:{"@languageStructs":Gl.LANGUAGE_STRUCT,"@keywords":`${Gl.KEYWORD}.$0`,"([a-zA-Z_$][\\w$]*)_((\\w+_(([a-zA-Z0-9]+)|(\\$[a-zA-Z0-9]+_[a-zA-Z0-9]+\\$)))__)*(\\w+_(([a-zA-Z0-9]+)|(\\$[a-zA-Z0-9]+_[a-zA-Z0-9]+\\$)))_":Gl.TYPE,"@default":Gl.IDENTIFIER}}],{include:"@whitespace"},[/[{}()[\]]/,"@brackets"],[/[<>](?!@symbols)/,"@brackets"],[/@symbols/,{cases:{"@operators":Gl.OPERATOR,"@default":Gl.IDENTIFIER}}],{include:"@number"},[/[;,.]/,Gl.DELIMITER],[/'([^'\\]|\\.)*$/,`${Gl.STRING}.invalid`],[/'/,Gl.STRING,"@string"],{include:"@characters"}],pure:[[/(@package\*)/,[Gl.PACKAGE]],[/(@package?)(@identifier)(@generics?)(\s*)(@multiplicity)/,[Gl.PACKAGE,Gl.TYPE,Gl.GENERICS,Gl.WHITESPACE,Gl.MULTIPLICITY]],[/(@package)(@identifier)(@generics?)/,[Gl.PACKAGE,Gl.TYPE,Gl.GENERICS]],[/([@^])(\s*)(@package?)(@identifier)(@generics?)(@multiplicity?)/,[`${Gl.TYPE}.operator`,Gl.WHITESPACE,Gl.PACKAGE,Gl.TYPE,Gl.GENERICS,Gl.MULTIPLICITY]],[/(\.\s*)(@identifier)/,[Gl.DELIMITER,Gl.PROPERTY]],[/(@identifier)(\s*=)/,[Gl.PROPERTY,Gl.OPERATOR]],[/(@identifier)(\.)(@identifier)/,[Gl.TYPE,Gl.OPERATOR,Gl.PROPERTY]],[/(@identifier)(\s*:)/,[Gl.PARAMETER,Gl.OPERATOR]],[/(let)(\s+)(@identifier)(\s*=)/,[Gl.KEYWORD,Gl.WHITESPACE,Gl.VARIABLE,Gl.OPERATOR]],[/(\$@identifier)/,[`${Gl.VARIABLE}.reference`]]],date:[[/(%latest)/,[`${Gl.DATE}.latest`]],[/(@date)/,[Gl.DATE]],[/(@time)/,[`${Gl.DATE}.time`]]],color:[[/(#[0-9a-fA-F]{6})/,[Gl.COLOR]]],number:[[/(@digits)[eE]([-+]?(@digits))?[fFdD]?/,`${Gl.NUMBER}.float`],[/(@digits)\.(@digits)([eE][-+]?(@digits))?[fFdD]?/,`${Gl.NUMBER}.float`],[/0[xX](@hexdigits)[Ll]?/,`${Gl.NUMBER}.hex`],[/0(@octaldigits)[Ll]?/,`${Gl.NUMBER}.octal`],[/0[bB](@binarydigits)[Ll]?/,`${Gl.NUMBER}.binary`],[/(@digits)[fFdD]/,`${Gl.NUMBER}.float`],[/(@digits)[lL]?/,Gl.NUMBER]],whitespace:[[/[ \t\r\n]+/,Gl.WHITESPACE],[/\/\*\*(?!\/)/,`${Gl.COMMENT}.doc`,"@doc"],[/\/\*/,Gl.COMMENT,"@comment"],[/\/\/.*$/,Gl.COMMENT]],comment:[[/[^/*]+/,Gl.COMMENT],[/\*\//,Gl.COMMENT,"@pop"],[/[/*]/,Gl.COMMENT]],doc:[[/[^/*]+/,`${Gl.COMMENT}.doc`],[/\/\*/,`${Gl.COMMENT}.doc.invalid`],[/\*\//,`${Gl.COMMENT}.doc`,"@pop"],[/[/*]/,`${Gl.COMMENT}.doc`]],string:[[/[^\\']+/,Gl.STRING],[/@escapes/,`${Gl.STRING}.escape`],[/\\./,`${Gl.STRING}.escape.invalid`],[/'/,Gl.STRING,"@pop"]],characters:[[/'[^\\']'/,Gl.STRING],[/(')(@escapes)(')/,[Gl.STRING,`${Gl.STRING}.escape`,Gl.STRING]],[/'/,`${Gl.STRING}.invalid`]]}}))}({}),this.options?.onInitialized?.(this),this.initializeState.pass()}catch(e){w(e),this.alertService.alertError(e,{message:`Initialization Failure: ${e.message}`,text:"Resolve the issue and reload the engine."}),this.initializeState.fail()}}else this.logService.logDebug("DataCube state is re-initialized")}dispose(){this.view.dispose(),this.layoutService.dispose(),this.taskService.dispose()}reload(){this.view=new $g(this),this.uuid=(0,i.A)()}}const um=(0,bt.PA)((()=>{const e=$c(),t=e.view;return(0,Lt.useEffect)((()=>{e.view.initialize(e.specification).catch((t=>e.logService.logUnhandledError(t)))}),[e]),(0,E.jsxs)("div",{className:"data-cube relative flex h-full w-full flex-col bg-white",children:[(0,E.jsx)(tp,{title:t.info.name,menuItems:[{label:"Undo",action:()=>e.view.snapshotService.undo(),disabled:!e.view.snapshotService.canUndo},{label:"Redo",action:()=>e.view.snapshotService.redo(),disabled:!e.view.snapshotService.canRedo},{label:"Settings...",action:()=>e.settingService.display.open()}],getMenuItems:e.options?.getHeaderMenuItems,children:e.options?.innerHeaderRenderer?.({api:e.api})??null}),(0,E.jsx)(ip,{view:t}),(0,E.jsx)(_r,{layout:e.layoutService.manager}),(0,E.jsx)(Sr,{})]})})),dm=(0,bt.PA)((e=>{const{specification:t,engine:n,options:o}=e,r=(0,bt.iz)((()=>new cm(t,n,o)));return(0,Lt.useEffect)((()=>(r.initialize().catch((e=>r.logService.logUnhandledError(e))),()=>r.dispose())),[r]),r.initializeState.hasSucceeded?(0,E.jsx)(Wc,{value:r,children:(0,E.jsx)(um,{},r.uuid)}):(0,E.jsx)(rp,{title:Ei,headerContent:r.options?.innerHeaderRenderer?.({api:r.api})??null,layoutManager:r.layoutService.manager,taskManager:r.taskService.manager,children:r.initializeState.hasFailed&&(0,E.jsx)(np,{message:"Initialization Failure",prompt:"Resolve the issue and reload."})})}));class pm extends Vl{runtime;mapping;timestamp;model;isLocal;isPersistenceSupported}const gm="repl";class mm{query;runtime;model;mapping;timestamp;isLocal;isPersistenceSupported;columns=[];static serialization=new ge((0,pe.PL)(mm,{_type:he(gm),columns:(0,pe.p_)((0,pe.lS)()),isLocal:(0,pe.MY)(),isPersistenceSupported:(0,pe.MY)(),mapping:(0,pe.lq)((0,pe.MY)()),model:(0,pe.lq)((0,pe.lS)()),query:(0,pe.MY)(),runtime:(0,pe.MY)(),timestamp:(0,pe.MY)()}))}class hm{networkClient;constructor(e){this.networkClient=e}get baseUrl(){return P(this.networkClient.baseUrl,"REPL server client has not been configured properly")}get dataCube(){return`${this.baseUrl}/api/dataCube`}async getInfrastructureInfo(){return this.networkClient.get(`${this.dataCube}/infrastructureInfo`)}async getQueryTypeahead(e){return this.networkClient.post(`${this.dataCube}/typeahead`,e)}async parseValueSpecification(e){return this.networkClient.post(`${this.dataCube}/parseValueSpecification`,e)}async getValueSpecificationCode(e){return this.networkClient.post(`${this.dataCube}/getValueSpecificationCode`,e,{},{[Z.ACCEPT]:ee.TEXT_PLAIN})}async getBaseSpecification(){return this.networkClient.get(`${this.dataCube}/getBaseQuery`)}async getQueryRelationReturnType(e){return this.networkClient.post(`${this.dataCube}/getRelationReturnType`,e)}async getQueryCodeRelationReturnType(e){return this.networkClient.post(`${this.dataCube}/getRelationReturnType/code`,e)}async executeQuery(e){return this.networkClient.post(`${this.dataCube}/executeQuery`,e)}async publishQuery(e,t){return this.networkClient.post(`${t}`,e)}}class fm{query;runtime;model;static serialization=new ge((0,pe.PL)(fm,{_type:he("adhocQuery"),model:(0,pe.lS)(),query:(0,pe.MY)(),runtime:(0,pe.MY)()}))}class Em{id;name;description;content;owner;lastUpdatedAt;createdAt;lastOpenAt;static serialization=new ge((0,pe.PL)(Em,{id:(0,pe.MY)(),lastUpdatedAt:(0,pe.lq)((0,pe.MY)()),createdAt:(0,pe.lq)((0,pe.MY)()),lastOpenAt:(0,pe.lq)((0,pe.MY)()),name:(0,pe.MY)(),description:(0,pe.lq)((0,pe.MY)()),content:(0,pe.lS)(),owner:(0,pe.lq)((0,pe.MY)())}));clone(){return Em.serialization.fromJson(Em.serialization.toJson(this))}}class Cm{id;name;description;owner;lastUpdatedAt;createdAt;lastOpenAt;static serialization=new ge((0,pe.PL)(Cm,{id:(0,pe.MY)(),lastUpdatedAt:(0,pe.lq)((0,pe.MY)()),createdAt:(0,pe.lq)((0,pe.MY)()),lastOpenAt:(0,pe.lq)((0,pe.MY)()),name:(0,pe.MY)(),description:(0,pe.lq)((0,pe.MY)()),owner:(0,pe.lq)((0,pe.MY)())}))}const bm=e=>{const{persistentDataCube:t}=e,n=dh(),o=n.hostedApplicationBaseUrl?`${n.hostedApplicationBaseUrl}/${t.id}`:void 0;return(0,E.jsxs)("div",{className:"h-full w-full p-6",children:[(0,E.jsxs)("div",{className:"flex w-full overflow-auto",children:[(0,E.jsx)("div",{className:"mr-3",children:(0,E.jsx)(dr.AlertSuccess,{className:"flex-shrink-0 stroke-[0.5px] text-[40px] text-green-500"})}),(0,E.jsxs)("div",{children:[(0,E.jsx)("div",{className:"whitespace-break-spaces text-lg",children:"Published DataCube successfully!"}),o&&(0,E.jsx)("div",{className:"mt-1 whitespace-break-spaces text-neutral-500",children:"To view or share the published DataCube, use the link below."}),!o&&(0,E.jsx)("div",{className:"mt-1 whitespace-break-spaces text-neutral-500",children:"See the published DataCube ID below."})]})]}),o&&(0,E.jsxs)("div",{className:"mt-3 flex h-6 w-full",children:[(0,E.jsx)("div",{className:"flex h-full w-[calc(100%_-_20px)] items-center border border-r-0 border-neutral-400 px-1.5 font-bold text-sky-500 underline",children:(0,E.jsx)("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"overflow-hidden overflow-ellipsis whitespace-nowrap",children:o})}),(0,E.jsx)("button",{className:"flex aspect-square h-full w-6 items-center justify-center border border-neutral-400 bg-neutral-300 hover:brightness-95",onClick:()=>{n.application.clipboardService.copyTextToClipboard(o).catch(n.application.alertUnhandledError)},title:"Copy Link",children:(0,E.jsx)(dr.Clipboard,{})})]}),!o&&(0,E.jsxs)("div",{className:"mt-3 flex h-6 w-full",children:[(0,E.jsx)("div",{className:"flex h-full w-[calc(100%_-_20px)] items-center border border-r-0 border-neutral-400 bg-neutral-200 px-1.5",children:(0,E.jsx)("div",{className:"overflow-hidden overflow-ellipsis whitespace-nowrap",children:t.id})}),(0,E.jsx)("button",{className:"flex aspect-square h-full w-6 items-center justify-center border border-neutral-400 bg-neutral-300 hover:brightness-95",onClick:()=>{n.application.clipboardService.copyTextToClipboard(t.id).catch(n.application.alertUnhandledError)},title:"Copy ID",children:(0,E.jsx)(dr.Clipboard,{})})]})]})};class vm{sourceId;startLine;startColumn;endLine;endColumn;constructor(e,t,n,o,r){this.sourceId=e,this.startLine=t,this.startColumn=n,this.endLine=o,this.endColumn=r}}var _m,Tm,Nm,Sm;!function(e){e.COMPILATION="COMPILATION",e.PARSER="PARSER"}(_m||(_m={}));class Am{message="";errorType;sourceInformation;static serialization=new ge((0,pe.PL)(Am,{errorType:(0,pe.lq)((0,pe.MY)()),message:(0,pe.MY)(),sourceInformation:me(Da.schema)}))}!function(e){e.CLASS_BUILDER="classBuilder",e.TDS_BUILDER="tdsBuilder",e.JSON_BUILDER="json"}(Tm||(Tm={})),function(e){e.RELATIONAL="relational",e.RELATIONAL_EXECUTION_ACTIVITY="RelationalExecutionActivity",e.AGGREGATION_AWARE_ACTIVITY="aggregationAware"}(Nm||(Nm={})),function(e){e.CSV="CSV"}(Sm||(Sm={}));class ym{_type;constructor(e){this._type=e}}class xm{}class Im extends xm{sql;comment;constructor(e){super(),this.sql=e}}class wm extends xm{rewrittenQuery}class km extends xm{values;constructor(e){super(),this.values=e}}class Rm{builder;activities}class Om extends Rm{values}class Lm extends Rm{value;constructor(e){super(),this.value=e}}class Fm{name;type;relationalType;doc}class Pm extends ym{columns=[];constructor(){super(Tm.TDS_BUILDER)}}class Bm{values=[]}class Dm{columns=[];rows=[]}class jm extends Rm{_UUID=(0,i.A)();builder=new Pm;result=new Dm}class Mm extends ym{_type=Tm.CLASS_BUILDER}class Um extends Rm{builder=new Mm(Tm.CLASS_BUILDER);objects}class Gm{static builderSerialization=new ge((0,pe.PL)(Gm,{_type:(0,pe.MY)()}))}class Vm{}class Hm extends Vm{sql;comment;static serialization=new ge((0,pe.PL)(Hm,{sql:(0,pe.MY)(),comment:(0,pe.lq)((0,pe.MY)())}))}class Wm extends Vm{rewrittenQuery;static serialization=new ge((0,pe.PL)(Wm,{rewrittenQuery:(0,pe.MY)()}))}class $m{builder;activities}class zm extends Vm{content;constructor(e){super(),this.content=e}}class Ym extends $m{values;static serialization=new ge((0,pe.PL)(Ym,{_type:(0,pe.MY)(),builder:me(Gm.builderSerialization.schema),values:(0,pe.lS)()}))}class Xm{name;doc;type;relationalType;static serialization=new ge((0,pe.PL)(Xm,{name:(0,pe.MY)(),doc:(0,pe.lq)((0,pe.MY)()),type:(0,pe.lq)((0,pe.MY)()),relationalType:(0,pe.lq)((0,pe.MY)())}))}class Km extends Gm{columns=[];static serialization=new ge((0,pe.PL)(Km,{_type:(0,pe.MY)(),columns:(0,pe.p_)(me(Xm.serialization.schema))}))}function qm(e){switch(e._type){case Nm.RELATIONAL:case Nm.RELATIONAL_EXECUTION_ACTIVITY:return Hm.serialization.fromJson(e);case Nm.AGGREGATION_AWARE_ACTIVITY:return Wm.serialization.fromJson(e);default:return new zm(e)}}class Jm extends $m{result;static serialization=new ge((0,pe.PL)(Jm,{builder:me(Km.serialization.schema),activities:(0,pe.p_)((0,pe.Ie)((()=>pe._Z),qm)),result:(0,pe.lS)()}))}class Qm extends $m{objects;static serialization=new ge((0,pe.PL)(Qm,{builder:me(Gm.builderSerialization.schema),activities:(0,pe.p_)((0,pe.Ie)((()=>pe._Z),qm)),objects:(0,pe.lS)()}))}class Zm extends $m{value;constructor(e){super(),this.value=e}}class eh extends $m{content}class th extends Rm{content}const nh=e=>{if(e instanceof Hm){const t=new Im(e.sql);return t.comment=e.comment,t}if(e instanceof Wm){const t=new wm;return t.rewrittenQuery=P(e.rewrittenQuery,"Aggregation aware execution activities 'rewritenQuery' field is missing"),t}if(e instanceof zm)return new km(e);throw new I("Can't build execution activities",e)},oh=e=>{const t=new Fm;return t.name=P(e.name,"TDS column 'name' field is missing"),t.type=e.type,t.doc=e.doc,t.relationalType=e.relationalType,t},rh=e=>{if(e instanceof eh){const t=new th;return t.content=e.content,t}if(e instanceof Qm)return(e=>{const t=new Um;return t.objects=P(e.objects,"Class execution result 'objects' field is missing"),t.activities=e.activities?.map(nh),t})(e);if(e instanceof Jm)return(e=>{const t=new jm;return t.builder=(e=>{const t=new Pm;return t.columns=e.columns.map(oh),t})(P(e.builder,"TDS execution result 'builder' field is missing")),t.activities=e.activities?.map(nh),t.result.columns=e.result.columns,t.result.rows=e.result.rows.map((e=>{const t=new Bm;return t.values=e.values,t})),t})(e);if(e instanceof Ym)return(e=>{const t=new Om;return t.values=P(e.values,"JSON execution result 'values' field is missing"),t})(e);if(e instanceof Zm)return new Lm(e.value);throw new I("Can't build execution result",e)},ih=e=>{if(null===e||U(e)||G(e)||V(e))return new Zm(e);switch(e.builder?._type){case Tm.CLASS_BUILDER:return Qm.serialization.fromJson(e);case Tm.TDS_BUILDER:return Jm.serialization.fromJson(e);case Tm.JSON_BUILDER:return Ym.serialization.fromJson(e);default:{const t=new eh;return t.content=e,t}}};class ah extends ud{_application;_client;constructor(e,t){super(),this._application=e,this._client=t}async processSource(e){if(e._type===gm){const t=mm.serialization.fromJson(e),n=new pm;n.query=await this.parseValueSpecification(t.query,!1);try{n.columns=(await this._getQueryRelationType(vl([],[n.query]))).columns}catch(e){throw w(e),new Error(`Can't get query result columns. Make sure the source query return a relation (i.e. typed TDS). Error: ${e.message}`)}return n.runtime=t.runtime,n.mapping=t.mapping,n.timestamp=t.timestamp,n.model=t.model,n.isLocal=t.isLocal,n.isPersistenceSupported=t.isPersistenceSupported,n}throw new I(`Can't process query source of type '${e._type}'.`)}async parseValueSpecification(e,t){return this.deserializeValueSpecification(await this._client.parseValueSpecification({code:e,returnSourceInformation:t}))}async getValueSpecificationCode(e,t){return this._client.getValueSpecificationCode({value:this.serializeValueSpecification(e),pretty:t})}async getQueryTypeahead(e,t,n){return this._client.getQueryTypeahead({code:e,baseQuery:this.serializeValueSpecification(t)})}async getQueryRelationReturnType(e,t){return this._getQueryRelationType(e)}async getQueryCodeRelationReturnType(e,t,n){try{return{columns:(0,pe.iu)(ps,await this._client.getQueryCodeRelationReturnType({code:e,baseQuery:this.serializeValueSpecification(t)})).columns.map((e=>({name:e.name,type:os(e.genericType)})))}}catch(e){if(w(e),e instanceof re&&e.response.status===J.BAD_REQUEST)throw(e=>{const t=new Yp(e.message);return t.sourceInformation=e.sourceInformation?(n=e.sourceInformation,new vm(P(n.sourceId,"Source information 'sourceId' field is missing"),P(n.startLine,"Source information 'startLine' field is missing"),P(n.startColumn,"Source information 'startColumn' field is missing"),P(n.endLine,"Source information 'endLine' field is missing"),P(n.endColumn,"Source information 'endColumn' field is missing"))):void 0,t;var n})(Am.serialization.fromJson(e.payload));throw e}}async executeQuery(e,t,n){const o=performance.now(),r=await this._client.executeQuery({query:this.serializeValueSpecification(e),debug:n?.debug}),i=performance.now();return{result:D(rh(ih(JSON.parse(r.result))),jm),executedQuery:r.executedQuery,executedSQL:r.executedSQL,executionTime:i-o}}buildExecutionContext(e){if(e instanceof pm)return Nl(Zr.FROM,[e.mapping?yl(e.mapping):void 0,yl(e.runtime)].filter(L))}async _getQueryRelationType(e){return{columns:(0,pe.iu)(ps,await this._client.getQueryRelationReturnType({query:this.serializeValueSpecification(e)})).columns.map((e=>({name:e.name,type:os(e.genericType)})))}}logDebug(e,...t){this._application.logService.debug(c.create(de.DEBUG),e,...t)}debugProcess(e,...t){this._application.logService.debug(c.create(de.DEBUG),`\n------ START DEBUG PROCESS: ${e} ------`,...t.flatMap((([e,t])=>[`\n[${e.toUpperCase()}]:`,t])),`\n------- END DEBUG PROCESS: ${e} -------\n\n`)}logInfo(e,...t){this._application.logService.info(e,...t)}logWarning(e,...t){this._application.logService.warn(e,...t)}logError(e,...t){this._application.logService.error(e,...t)}logUnhandledError(e){this._application.logUnhandledError(e)}logIllegalStateError(e,t){this.logError(c.create(de.ILLEGAL_APPLICATION_STATE_OCCURRED),e,t)}getDocumentationEntry(e){return this._application.documentationService.getDocEntry(e)}openLink(e){this._application.navigationService.navigator.visitAddress(e)}sendTelemetry(e,t){this._application.telemetryService.logEvent(e,t)}}class sh{_client;application;engine;taskService;layoutService;alertService;initializeState=Ie.create();publishState=Ie.create();source;gridClientLicense;queryServerBaseUrl;hostedApplicationBaseUrl;specification;constructor(e){(0,xe.Gn)(this,{specification:xe.sH,setSpecification:xe.XI,source:xe.sH,setSource:xe.XI}),this.application=e,this._client=new hm(new se({baseUrl:e.config.useDynamicREPLServer?window.location.origin+P(e.config.baseAddress).replace("/repl/",""):e.config.replUrl})),this.engine=new ah(this.application,this._client),this.taskService=new Hg,this.layoutService=new br,this.alertService=new gu(new lm(this.engine),this.layoutService)}setSpecification(e){this.specification=e}setSource(e){this.source=e}async initialize(){const e=this.taskService.newTask("Initialize REPL");this.initializeState.inProgress();try{const e=await this._client.getInfrastructureInfo();e.currentUser&&this.application.identityService.setCurrentUser(e.currentUser),this.application.telemetryService.setup(),this.queryServerBaseUrl=e.queryServerBaseUrl,this.hostedApplicationBaseUrl=e.hostedApplicationBaseUrl,this.gridClientLicense=e.gridClientLicense,this.setSpecification(ad.serialization.fromJson(await this._client.getBaseSpecification())),this.initializeState.pass()}catch(e){w(e),this.application.logService.error(c.create(de.APPLICATION_LOAD__FAILURE),"Can't initialize REPL",e),this.alertService.alertError(e,{message:`Initialization Failure: ${e.message}`,text:"Resolve the issue and reload the engine."}),this.initializeState.fail()}finally{this.taskService.endTask(e)}}async publishDataCube(e){if(!this.queryServerBaseUrl||!(this.source instanceof pm)||!this.source.isPersistenceSupported||!this.source.model||this.source.isLocal)return;this.publishState.inProgress();const t=this.taskService.newTask("Publish query");try{const t=await e.generateSpecification(),n=new fm;n.query=mm.serialization.fromJson(t.source).query,n.runtime=this.source.runtime,n.model=this.source.model,t.source=fm.serialization.toJson(n);const o=new Em;o.id=(0,i.A)(),o.name=t.configuration?.name??Ei,o.content=ad.serialization.toJson(t),o.owner=this.application.identityService.currentUser;const r=Em.serialization.fromJson(await this._client.publishQuery(Em.serialization.toJson(o),this.queryServerBaseUrl)),a=new gr(new pr("Publish Query",(()=>(0,E.jsx)(bm,{persistentDataCube:r}))));a.configuration.window={width:420,height:150,minWidth:300,minHeight:100,center:!0},this.layoutService.newWindow(a)}catch(e){w(e),this.alertService.alertError(e,{message:"Persistence Failure: Can't publish query.",text:`Error: ${e.message}`})}finally{this.taskService.endTask(t),this.publishState.complete()}}}const lh=(0,bt.PA)((e=>{const{children:t,simple:n}=e,o=P((0,Lt.useContext)(or),"Can't find application platform in context"),r=Pt();return(0,Lt.useEffect)((()=>{r.initialize(o).catch(r.alertUnhandledError)}),[r,o]),r.initState.hasSucceeded?n?(0,E.jsx)(io,{children:t}):(0,E.jsx)(ro,{children:t}):(0,E.jsx)(E.Fragment,{})})),ch=(0,Lt.createContext)(void 0),uh=({children:e})=>{const t=Pt(),n=(0,bt.iz)((()=>new sh(t)));return(0,E.jsx)(ch.Provider,{value:n,children:e})},dh=()=>P((0,Lt.useContext)(ch),"Can't find Legend REPL base store in context"),ph=({children:e})=>(0,E.jsx)(lh,{simple:!0,children:(0,E.jsx)(uh,{children:e})}),gh=(0,bt.PA)((e=>{const{api:t}=e,n=dh();if(!n.source||!n.queryServerBaseUrl)return null;const o=n.source instanceof pm&&n.source.isPersistenceSupported&&!n.source.isLocal;return(0,E.jsx)("div",{className:"flex h-full items-center",children:(0,E.jsx)(Xc,{compact:!0,disabled:!o||n.publishState.isInProgress,onClick:()=>{n.publishDataCube(t).catch((e=>n.alertService.alertUnhandledError(e)))},children:"Publish"})})}));var mh;!function(e){e.DATA_CUBE="data-cube"}(mh||(mh={}));const hh=(0,bt.PA)((e=>{const{specification:t}=e,n=dh(),o=n.application;return(0,Lt.useEffect)((()=>(o.navigationService.navigator.blockNavigation([()=>!0],void 0,(()=>{o.logService.warn(c.create(de.NAVIGATION_BLOCKED),"Navigation from the application is blocked")})),()=>{o.navigationService.navigator.unblockNavigation()})),[o]),(0,E.jsx)(dm,{specification:t,engine:n.engine,options:{gridClientLicense:n.gridClientLicense,layoutManager:n.layoutService.manager,taskManager:n.taskService.manager,onNameChanged(e){const t=e.source instanceof pm?e.source.timestamp:void 0;o.layoutService.setWindowTitle(`⊞ ${name}${t?` - ${(0,Xn.GP)(new Date(t),"HH:mm:ss EEE MMM dd yyyy")}`:""}`)},onViewInitialized(e){n.setSource(e.source)},innerHeaderRenderer:e=>(0,E.jsx)(gh,{api:e.api}),getHeaderMenuItems:()=>[{label:"See Documentation",action:()=>{o.documentationService.url&&o.navigationService.navigator.visitAddress(o.documentationService.url)},disabled:!o.documentationService.url}],settingsData:{values:o.settingService.getObjectValue(mh.DATA_CUBE)},onSettingsChanged(e){o.settingService.persistValue(mh.DATA_CUBE,e.values)}}})})),fh=Object.freeze({DATA_CUBE:"/dataCube"}),Eh=(0,bt.PA)((()=>{const e=dh();return(0,Lt.useEffect)((()=>{e.initialize().catch((t=>e.application.alertUnhandledError(t)))}),[e]),e.initializeState.hasSucceeded?(0,E.jsx)("div",{className:"h-full",children:e.specification&&(0,E.jsx)(Qo.BV,{children:(0,E.jsx)(Qo.qh,{path:fh.DATA_CUBE,element:(0,E.jsx)(hh,{specification:e.specification})})})}):(0,E.jsxs)(rp,{title:Ei,layoutManager:e.layoutService.manager,taskManager:e.taskService.manager,children:[e.initializeState.isInProgress&&(0,E.jsx)("div",{className:"h-full w-full p-2",children:(0,E.jsx)("div",{children:"Initializing..."})}),e.initializeState.hasFailed&&(0,E.jsx)(np,{message:"Initialization Failure",prompt:"Resolve the issue and reload."})]})})),Ch=e=>{const{baseUrl:t}=e;return(0,E.jsx)(ir,{baseUrl:t,children:(0,E.jsx)(ph,{children:(0,E.jsx)(Eh,{})})})};class bh extends Ho{static create(){const e=new bh(new $o);return e.withBasePlugins([new Xo]),e}async configureApplication(e){return new qo(e)}async loadApplication(e){(0,C.createRoot)((()=>{let e=document.getElementsByTagName(Wo).length?document.getElementsByTagName(Wo)[0]:void 0;return e||(e=document.createElement(Wo),document.body.appendChild(e)),e.setAttribute("style","height: 100%; width: 100%; display: block"),e})()).render((0,E.jsx)(Bt,{store:e,children:(0,E.jsx)(Ch,{baseUrl:this.baseAddress})}))}}class vh{static getPresetCollection(){return[]}static getPluginCollection(){return[new f]}static run(e){bh.create().setup({baseAddress:e}).withPresets(vh.getPresetCollection()).withPlugins(vh.getPluginCollection()).start().catch((e=>{throw e}))}}const _h=new URL("./",window.location.href).pathname;vh.run(_h)},59135:(e,t,n)=>{var o={"./editorBaseApi":[37970],"./editorBaseApi.js":[37970],"./editorSimpleWorker":[41122],"./editorSimpleWorker.js":[41122],"./editorWorker":[22143],"./editorWorker.js":[22143],"./editorWorkerHost":[70869],"./editorWorkerHost.js":[70869],"./findSectionHeaders":[97716],"./findSectionHeaders.js":[97716],"./getIconClasses":[45555],"./getIconClasses.js":[45555],"./languageFeatureDebounce":[26973],"./languageFeatureDebounce.js":[26973],"./languageFeatures":[33653],"./languageFeatures.js":[33653],"./languageFeaturesService":[78330],"./languageFeaturesService.js":[78330],"./languageService":[22155],"./languageService.js":[22155],"./languagesAssociations":[25709],"./languagesAssociations.js":[25709],"./languagesRegistry":[35074],"./languagesRegistry.js":[35074],"./markerDecorations":[86259],"./markerDecorations.js":[86259],"./markerDecorationsService":[72524],"./markerDecorationsService.js":[72524],"./model":[16911],"./model.js":[16911],"./modelService":[91320],"./modelService.js":[91320],"./resolverService":[55387],"./resolverService.js":[55387],"./semanticTokensDto":[7029,121],"./semanticTokensDto.js":[7029,121],"./semanticTokensProviderStyling":[4399],"./semanticTokensProviderStyling.js":[4399],"./semanticTokensStyling":[74566],"./semanticTokensStyling.js":[74566],"./semanticTokensStylingService":[28843],"./semanticTokensStylingService.js":[28843],"./textModelSync/textModelSync.impl":[43481],"./textModelSync/textModelSync.impl.js":[43481],"./textModelSync/textModelSync.protocol":[37619,121],"./textModelSync/textModelSync.protocol.js":[37619,121],"./textResourceConfiguration":[93533],"./textResourceConfiguration.js":[93533],"./treeSitterParserService":[47105],"./treeSitterParserService.js":[47105],"./treeViewsDnd":[29740,121],"./treeViewsDnd.js":[29740,121],"./treeViewsDndService":[95621,121],"./treeViewsDndService.js":[95621,121],"./unicodeTextModelHighlighter":[14818],"./unicodeTextModelHighlighter.js":[14818]};function r(e){if(!n.o(o,e))return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=o[e],r=t[0];return Promise.all(t.slice(1).map(n.e)).then((()=>n(r)))}r.keys=()=>Object.keys(o),r.id=59135,e.exports=r},98933:(e,t,n)=>{var o={"./simpleWorker":99246,"./simpleWorker.js":99246};function r(e){return Promise.resolve().then((()=>{if(!n.o(o,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return n(o[e])}))}r.keys=()=>Object.keys(o),r.id=98933,e.exports=r}},a={};function s(e){var t=a[e];if(void 0!==t)return t.exports;var n=a[e]={id:e,loaded:!1,exports:{}};return i[e].call(n.exports,n,n.exports,s),n.loaded=!0,n.exports}s.m=i,s.amdD=function(){throw new Error("define cannot be used indirect")},s.amdO={},e=[],s.O=(t,n,o,r)=>{if(!n){var i=1/0;for(u=0;u<e.length;u++){for(var[n,o,r]=e[u],a=!0,l=0;l<n.length;l++)(!1&r||i>=r)&&Object.keys(s.O).every((e=>s.O[e](n[l])))?n.splice(l--,1):(a=!1,r<i&&(i=r));if(a){e.splice(u--,1);var c=o();void 0!==c&&(t=c)}}return t}r=r||0;for(var u=e.length;u>0&&e[u-1][2]>r;u--)e[u]=e[u-1];e[u]=[n,o,r]},s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},n=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,s.t=function(e,o){if(1&o&&(e=this(e)),8&o)return e;if("object"==typeof e&&e){if(4&o&&e.__esModule)return e;if(16&o&&"function"==typeof e.then)return e}var r=Object.create(null);s.r(r);var i={};t=t||[null,n({}),n([]),n(n)];for(var a=2&o&&e;"object"==typeof a&&!~t.indexOf(a);a=n(a))Object.getOwnPropertyNames(a).forEach((t=>i[t]=()=>e[t]));return i.default=()=>e,s.d(r,i),r},s.d=(e,t)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.f={},s.e=e=>Promise.all(Object.keys(s.f).reduce(((t,n)=>(s.f[n](e,t),t)),[])),s.u=e=>"static/"+e+".a0ce728d.js",s.miniCssF=e=>{},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o={},r="@finos/legend-application-repl-deployment:",s.l=(e,t,n,i)=>{if(o[e])o[e].push(t);else{var a,l;if(void 0!==n)for(var c=document.getElementsByTagName("script"),u=0;u<c.length;u++){var d=c[u];if(d.getAttribute("src")==e||d.getAttribute("data-webpack")==r+n){a=d;break}}a||(l=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,s.nc&&a.setAttribute("nonce",s.nc),a.setAttribute("data-webpack",r+n),a.src=e),o[e]=[t];var p=(t,n)=>{a.onerror=a.onload=null,clearTimeout(g);var r=o[e];if(delete o[e],a.parentNode&&a.parentNode.removeChild(a),r&&r.forEach((e=>e(n))),t)return t(n)},g=setTimeout(p.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=p.bind(null,a.onerror),a.onload=p.bind(null,a.onload),l&&document.head.appendChild(a)}},s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),s.p="./",(()=>{var e={57:0};s.f.j=(t,n)=>{var o=s.o(e,t)?e[t]:void 0;if(0!==o)if(o)n.push(o[2]);else{var r=new Promise(((n,r)=>o=e[t]=[n,r]));n.push(o[2]=r);var i=s.p+s.u(t),a=new Error;s.l(i,(n=>{if(s.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var r=n&&("load"===n.type?"missing":n.type),i=n&&n.target&&n.target.src;a.message="Loading chunk "+t+" failed.\n("+r+": "+i+")",a.name="ChunkLoadError",a.type=r,a.request=i,o[1](a)}}),"chunk-"+t,t)}},s.O.j=t=>0===e[t];var t=(t,n)=>{var o,r,[i,a,l]=n,c=0;if(i.some((t=>0!==e[t]))){for(o in a)s.o(a,o)&&(s.m[o]=a[o]);if(l)var u=l(s)}for(t&&t(n);c<i.length;c++)r=i[c],s.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return s.O(u)},n=globalThis.webpackChunk_finos_legend_application_repl_deployment=globalThis.webpackChunk_finos_legend_application_repl_deployment||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),s.nc=void 0;var l=s.O(void 0,[121],(()=>s(50368)));l=s.O(l)})();
45
- //# sourceMappingURL=index.3fe9178a.js.map
44
+ `})})),Xd=(0,bt.PA)((e=>{const{view:t}=e,n=t.grid.scrollHintText,o=document.querySelector(".data-cube-grid .ag-side-bar"),r=document.querySelector(".data-cube-grid .ag-body-vertical-scroll");return(0,E.jsxs)("div",{className:"absolute -top-10 flex items-center rounded-sm border border-neutral-300 bg-neutral-100 p-1 pr-2 text-neutral-500 shadow-sm",style:{right:(null!==o?o.getBoundingClientRect().width+6:10)+(null!==r?r.getBoundingClientRect().width:0)},children:[(0,E.jsx)(dr.TableScroll,{className:"text-lg"}),(0,E.jsx)("div",{className:"ml-1 font-mono text-sm",children:n??""})]})})),Kd=(0,bt.PA)((e=>{const{view:t}=e,n=$c(),o=t.grid;return(0,E.jsxs)("div",{className:"relative flex h-5 w-full select-none justify-between border-b border-neutral-200 bg-neutral-100",children:[Boolean(o.scrollHintText)&&(0,E.jsx)(Xd,{view:t}),(0,E.jsx)("div",{}),(0,E.jsxs)("div",{className:"flex h-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full items-center px-2 font-mono text-sm text-neutral-500",children:o.clientDataSource.rowCount?`Rows: ${o.clientDataSource.rowCount}`:""}),void 0!==o.rowLimit&&o.queryConfiguration.showWarningForTruncatedResult&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{className:"h-3 w-[1px] bg-neutral-200"}),(0,E.jsxs)("div",{className:"flex h-full items-center px-2 text-orange-500",children:[(0,E.jsx)(dr.Warning,{className:"stroke-[3px]"}),(0,E.jsx)("div",{className:"ml-1 text-sm font-semibold",children:`Results truncated to fit within row limit (${o.rowLimit})`})]})]}),(0,E.jsx)("div",{className:"h-3 w-[1px] bg-neutral-200"}),(0,E.jsxs)("button",{className:"flex h-full items-center p-2",onClick:()=>{o.setPaginationEnabled(!o.isPaginationEnabled)},children:[(0,E.jsx)(wr.A,{checked:o.isPaginationEnabled,classes:{root:"p-0 w-6 h-5 flex items-center",input:"w-2",checked:"!translate-x-2 ease-in-out duration-100 transition",thumb:jn("w-2 h-2",{"bg-sky-600":o.isPaginationEnabled,"bg-neutral-500":!o.isPaginationEnabled}),switchBase:"p-0.5 mt-1 translate-x-0 ease-in-out duration-100 transition",track:jn("h-3 w-5 border",{"!bg-sky-100 border-sky-600":o.isPaginationEnabled,"!bg-neutral-100 border-neutral-500":!o.isPaginationEnabled})},disableRipple:!0,disableFocusRipple:!0}),(0,E.jsx)("div",{className:jn("text-sm",{"text-sky-600":o.isPaginationEnabled,"text-neutral-500":!o.isPaginationEnabled}),children:"Pagination"})]}),t.dataCube.options?.enableCache&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{className:"h-3 w-[1px] bg-neutral-200"}),(0,E.jsxs)("button",{className:"flex h-full items-center p-2",onClick:()=>{o.setCachingEnabled(!o.isCachingEnabled).catch((e=>n.alertService.alertUnhandledError(e)))},children:[(0,E.jsx)(wr.A,{checked:o.isCachingEnabled,classes:{root:"p-0 w-6 h-5 flex items-center",input:"w-2",checked:"!translate-x-2 ease-in-out duration-100 transition",thumb:jn("w-2 h-2",{"bg-sky-600":o.isCachingEnabled,"bg-neutral-500":!o.isCachingEnabled}),switchBase:"p-0.5 mt-1 translate-x-0 ease-in-out duration-100 transition",track:jn("h-3 w-5 border",{"!bg-sky-100 border-sky-600":o.isCachingEnabled,"!bg-neutral-100 border-neutral-500":!o.isCachingEnabled})},disableRipple:!0,disableFocusRipple:!0,disabled:t.processCacheState.isInProgress,title:t.processCacheState.isInProgress?"Processing cache...":""}),(0,E.jsxs)("div",{className:jn("flex items-center text-sm",{"text-sky-600":o.isCachingEnabled,"text-neutral-500":!o.isCachingEnabled}),children:["Cache ",(0,E.jsx)(zc,{})]})]})]})]})]})})),qd=(0,bt.PA)((e=>{const{view:t}=e,n=t.grid;return(0,E.jsx)("div",{className:"relative h-[calc(100%_-_20px)] w-full",children:(0,E.jsx)(xr.W6,{theme:"legacy",className:"data-cube-grid ag-theme-quartz",rowModelType:"serverSide",serverSideDatasource:n.clientDataSource,context:{view:t},onGridReady:e=>{n.configureClient(e.api)},modules:[Ar.JKr,yr.fKx],...Gd(t)})})})),Jd=(0,bt.PA)((e=>{const{view:t}=e;return(0,E.jsxs)("div",{className:"h-[calc(100%_-_48px)] w-full",children:[(0,E.jsx)(Yd,{view:t}),(0,E.jsx)(qd,{view:t}),(0,E.jsx)(Kd,{view:t})]})}));var Qd=n(16481);const Zd=(0,bt.PA)((e=>{const{view:t,taskManager:n}=e,o=t?.taskService.tasks??n?.tasks;return(0,E.jsxs)("div",{className:"flex h-5 w-full justify-between bg-neutral-100",children:[(0,E.jsxs)("div",{className:"flex",children:[(0,E.jsxs)("button",{className:"flex items-center px-2 text-sky-600 hover:text-sky-700 disabled:text-neutral-400",onClick:()=>t?.editor.display.open(),disabled:!t,children:[(0,E.jsx)(dr.Settings,{className:"text-xl"}),(0,E.jsx)("div",{className:"pl-0.5 underline",children:"Properties"})]}),(0,E.jsx)("div",{className:"flex",children:(0,E.jsxs)("button",{className:"flex items-center text-sky-600 hover:text-sky-700 disabled:text-neutral-400",onClick:()=>{t?.filter.display.open()},disabled:!t,children:[(0,E.jsx)(dr.TableFilter,{className:"text-lg"}),(0,E.jsx)("div",{className:"pl-0.5 underline",children:"Filter"})]})})]}),(0,E.jsx)("div",{className:"flex items-center px-2",children:(0,E.jsx)("div",{className:"flex h-3.5 w-48 border-[0.5px] border-neutral-300",title:void 0!==o&&o.length>0?o.length>1?o.map(((e,t)=>`Task ${t+1}/${o.length}: ${e.description}`)).join("\n"):N(o,0).description:void 0,children:void 0!==o&&o.length>0&&(0,E.jsx)(Qd.A,{classes:{root:"h-3.5 w-full bg-transparent",bar1Indeterminate:"bg-green-500",bar2Indeterminate:"bg-green-500"},variant:"indeterminate"})})})]})}));var ep;!function(e){e.SEPARATOR="separator"}(ep||(ep={}));const tp=(0,bt.PA)((e=>{const{children:t,title:n,menuItems:o,getMenuItems:r}=e,[i,a,s]=jc(),[l,c]=(0,Lt.useState)([...o??[]]);return(0,E.jsxs)("div",{className:"flex h-7 justify-between bg-neutral-100",children:[(0,E.jsxs)("div",{className:"flex items-center overflow-hidden pl-1 pr-2 text-lg font-medium",children:[(0,E.jsx)(dr.Cube,{className:"mr-1 h-4 w-4 flex-shrink-0"}),(0,E.jsx)("div",{className:"text-ellipsis whitespace-nowrap",children:n})]}),(0,E.jsxs)("div",{className:"flex",children:[t,(0,E.jsx)("button",{className:"flex aspect-square h-full flex-shrink-0 items-center justify-center text-lg disabled:text-neutral-400",onClick:e=>{const t=r?.()??[];t.length&&t.unshift(ep.SEPARATOR),c([...o??[],...t]),i(e)},disabled:!o?.length,children:(0,E.jsx)(dr.Menu,{})}),(0,E.jsx)(Mc,{...s,menuProps:{anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"},classes:{paper:"rounded-none mt-[1px]",list:"w-40 p-0 rounded-none border border-neutral-400 bg-white overflow-y-auto py-0.5"}},children:l.map(((e,t)=>H(e)?(0,E.jsx)(Uc,{className:"flex h-[22px] w-full items-center px-2.5 text-base hover:bg-neutral-100 focus:bg-neutral-100",onClick:()=>{e.action(),a()},disabled:Boolean(e.disabled),children:e.label},t):e===ep.SEPARATOR?(0,E.jsx)("div",{className:"my-1 h-[1px] w-full bg-neutral-200"},t):null))})]})]})})),np=e=>{const{message:t,prompt:n}=e;return(0,E.jsxs)("div",{className:"flex h-full w-full overflow-auto p-5",children:[(0,E.jsx)("div",{className:"mr-3",children:(0,E.jsx)(dr.AlertError,{className:"flex-shrink-0 stroke-[0.5px] text-[40px] text-red-500"})}),(0,E.jsxs)("div",{children:[(0,E.jsx)("div",{className:"whitespace-break-spaces text-lg",children:t}),(0,E.jsx)("div",{className:"mt-1 whitespace-break-spaces text-neutral-500",children:n})]})]})},op=(0,bt.PA)((e=>{const{children:t,taskManager:n}=e;return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{className:"h-[calc(100%_-_48px)] w-full border border-x-0 border-neutral-200 bg-neutral-50",children:t??null}),(0,E.jsx)(Zd,{taskManager:n})]})})),rp=(0,bt.PA)((e=>{const{children:t,title:n,menuItems:o,headerContent:r,layoutManager:i,taskManager:a}=e;return(0,E.jsxs)("div",{className:"data-cube relative flex h-full w-full flex-col bg-white",children:[(0,E.jsx)(tp,{title:n,menuItems:o,children:r??null}),(0,E.jsx)(op,{taskManager:a,children:t}),i?(0,E.jsx)(_r,{layout:i}):null]})})),ip=(0,bt.PA)((e=>{const{view:t}=e;return(0,Lt.useEffect)((()=>()=>t.dispose()),[t]),t.initializeState.hasFailed?(0,E.jsx)(op,{children:(0,E.jsx)(np,{message:"Initialization Failure",prompt:"Resolve the issue and reload."})}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(Jd,{view:t}),(0,E.jsx)(Zd,{view:t})]})}));var ap=n(61005);class sp{_engine;_settingService;_snapshotService;_latestSnapshot;constructor(e,t,n){this._engine=e,this._settingService=t,this._snapshotService=n}getLatestSnapshot(){return this._latestSnapshot}async receiveSnapshot(e){const t=this._latestSnapshot;this._latestSnapshot=e,await this.applySnapshot(e.INTERNAL__fullClone(),t)}publishSnapshot(e){const t=this._latestSnapshot;this._latestSnapshot=e,this._settingService.getBooleanValue(du.DEBUGGER__ENABLE_DEBUG_MODE)&&this._engine.debugProcess("New Snapshot",["Publisher",this.getSnapshotSubscriberName()],["Snapshot",e.serialize()],["Previous Snapshot",t?.serialize()],["Diff",(0,ap.A)(t??{},e)]),this._snapshotService.broadcastSnapshot(e)}}class lp{_logService;_settingService;_subscribers=[];_snapshots=[];_pointer=-1;_historySize;constructor(e,t){(0,xe.Gn)(this,{_snapshots:xe.sH.struct,_pointer:xe.sH,canUndo:xe.EW,canRedo:xe.EW,undo:xe.XI,redo:xe.XI,adjustHistorySize:xe.XI,broadcastSnapshot:xe.XI}),this._logService=e,this._settingService=t,this._historySize=Math.max(this._settingService.getNumericValue(du.EDITOR__MAX_HISTORY_STACK_SIZE),10)}registerSubscriber(e){if(this._subscribers.find((t=>t.getSnapshotSubscriberName()===e.getSnapshotSubscriberName())))throw new x(`Subscriber with name '${e.getSnapshotSubscriberName()}' already exists`);this._subscribers.push(e)}propagateSnapshot(e){this._subscribers.forEach((t=>{const n=t.getLatestSnapshot();n?.uuid!==e.uuid&&t.receiveSnapshot(e).catch((e=>{w(e),this._logService.logIllegalStateError("Error occured while subscribers receiving and applying new snapshot should be handled gracefully",e)}))}))}getCurrentSnapshot(){return N(this._snapshots,this._pointer)}getHistory(e){return e?.full?[...this._snapshots]:this._snapshots.slice(0,this._pointer+1)}get canUndo(){return this._pointer>0}get canRedo(){return this._pointer<this._snapshots.length-1}undo(){this._pointer=Math.max(this._pointer-1,0),this.propagateSnapshot(this.getCurrentSnapshot())}redo(){this._pointer=Math.min(this._pointer+1,this._snapshots.length-1),this.propagateSnapshot(this.getCurrentSnapshot())}adjustHistorySize(e){let t=e;e<=10&&(this._logService.logIllegalStateError(`Can't adjust history size to ${e}: value must be greator than 10`),t=Math.max(e,10));const n=this.getHistory();n.length>t?(this._snapshots=n.slice(-t),this._pointer=Math.min(Math.max(this._pointer-(n.length-t),0),n.length-1)):(this._snapshots=n,this._pointer=n.length-1),this._historySize=t}broadcastSnapshot(e){e.isFinalized()?(this._snapshots=[...this._snapshots.slice(0,this._pointer+1),e],this._pointer+=1,this.adjustHistorySize(this._historySize),this.propagateSnapshot(e)):this._logService.logIllegalStateError("Snapshot must be finalized before broadcasting")}}function cp({name:e,subMenu:t,checked:n}){return(0,xr.sd)({configureDefaults:()=>!0}),(0,E.jsxs)("div",{children:[(0,E.jsx)("span",{className:"ag-menu-option-part ag-menu-option-icon"}),(0,E.jsxs)("span",{className:"ag-menu-option-part ag-menu-option-text !inline-flex items-center",children:[(0,E.jsx)("span",{className:"opacity-50",children:e}),(0,E.jsx)(zc,{})]}),(0,E.jsx)("span",{className:"ag-menu-option-part ag-menu-option-shortcut"}),(0,E.jsx)("span",{className:"ag-menu-option-part ag-menu-option-popup-pointer select-none",children:t&&(0,E.jsx)("span",{className:"ag-icon ag-icon-small-right"})})]})}var up=n(43322);class dp{uuid=(0,i.A)();parent;not=!1;constructor(e,t){(0,xe.Gn)(this,{parent:xe.sH,setParent:xe.XI,not:xe.sH,setNot:xe.XI}),this.parent=e,this.not=Boolean(t)}setNot(e){this.not=e}setParent(e){this.parent=e}}class pp extends dp{column;operation;value;constructor(e,t,n,o,r){super(e,r),(0,xe.Gn)(this,{column:xe.sH,setColumn:xe.XI,operation:xe.sH,setOperation:xe.XI,value:xe.sH.ref,setValue:xe.XI,updateValue:xe.XI}),this.column=t,this.operation=n,this.setValue(o)}setColumn(e){this.column=e}setOperation(e){this.operation=e}setValue(e){this.value=(0,xe.AT)(e)?e:(0,xe.Gn)(e,{value:xe.sH})}updateValue(e){this.value.value=e}}class gp extends dp{children=[];operation=ui.AND;constructor(e,t,n){super(e,n),(0,xe.Gn)(this,{children:xe.sH,removeChild:xe.XI,addChild:xe.XI,operation:xe.sH,setOperation:xe.XI}),this.operation=t}setOperation(e){this.operation=e}removeChild(e){S(this.children,e)&&e.setParent(void 0)}addChild(e,t){this.children.includes(e)||(void 0!==t?(t=Math.max(0,Math.min(t,this.children.length)),this.children.splice(t,0,e)):this.children.push(e),e.setParent(this))}}function mp(e){return{groupOperator:e.operation,not:e.not,conditions:e.children.map((e=>{if(e instanceof pp)return{name:e.column.name,type:e.column.type,operator:e.operation.operator,value:(0,up.A)(e.value),not:e.not};if(e instanceof gp)return mp(e);throw new x("Unknown filter node")}))}}function hp(e,t,n,o){const r=new gp(t,e.groupOperator===ui.AND?ui.AND:ui.OR,e.not);return e.conditions.forEach((e=>{let t;t="groupOperator"in e?hp(e,r,n,o):new pp(r,{name:e.name,type:e.type},o(e.operator),e.value,e.not),r.addChild(t),n.set(t.uuid,t)})),n.set(r.uuid,r),r}class fp{name;type;constructor(e,t){this.name=e,this.type=t}}class Ep{_editor;selectedColumns=[];availableColumnsSearchText="";selectedColumnsSearchText="";onChange;constructor(e,t){(0,xe.Gn)(this,{availableColumns:xe.EW,availableColumnsForDisplay:xe.EW,selectedColumnsForDisplay:xe.EW,selectedColumns:xe.sH,setSelectedColumns:xe.XI,availableColumnsSearchText:xe.sH,setAvailableColumnsSearchText:xe.XI,selectedColumnsSearchText:xe.sH,setSelectedColumnsSearchText:xe.XI}),this._editor=e,this.onChange=t?.onChange}get availableColumnsForDisplay(){return this.availableColumns.filter((e=>!Hi(this.selectedColumns,e.name))).sort($i)}get selectedColumnsForDisplay(){return this.selectedColumns}setSelectedColumns(e){this.selectedColumns=e.map((e=>this.cloneColumn(e))),this.onChange?.(this)}setAvailableColumnsSearchText(e){this.availableColumnsSearchText=e}setSelectedColumnsSearchText(e){this.selectedColumnsSearchText=e}getColumn(e){return P(Hi(this.availableColumns,e),`Can't find column '${e}'`)}}class Cp extends fp{onChange;direction;constructor(e,t,n,o){super(e,t),(0,xe.Gn)(this,{direction:xe.sH,setDirection:xe.XI}),this.direction=n,this.onChange=o}setDirection(e){this.direction=e,this.onChange?.()}}class bp extends Ep{cloneColumn(e){return new Cp(e.name,e.type,e.direction)}get availableColumns(){return(0,tt.A)([...this._editor.horizontalPivots.selector.selectedColumns.length?[...this._editor.horizontalPivots.pivotResultColumns,...[...this._editor.columns.selector.selectedColumns,...this._editor.verticalPivots.selector.selectedColumns].filter((e=>this._editor.columnProperties.getColumnConfiguration(e.name).kind===ii.DIMENSION&&!Hi(this._editor.horizontalPivots.selector.selectedColumns,e.name)))]:[...this._editor.columns.selector.selectedColumns,...this._editor.verticalPivots.selector.selectedColumns],...this._editor.groupExtendColumns],(e=>e.name)).map((e=>new Cp(e.name,e.type,di.ASCENDING)))}}class vp{selector;constructor(e){this.selector=new bp(e)}adaptPropagatedChanges(){this.selector.setSelectedColumns(this.selector.selectedColumns.filter((e=>Hi(this.selector.availableColumns,e.name))))}applySnaphot(e,t){this.selector.setSelectedColumns(e.data.sortColumns.map((e=>{const t=this.selector.getColumn(e.name);return new Cp(t.name,t.type,e.direction)})))}buildSnapshot(e,t){e.data.sortColumns=this.selector.selectedColumns.map((e=>({...Wi(e),direction:e.direction})))}}class _p extends zi{dataType;aggregateOperation;static create(e,t,n){const o=Object.assign(new _p("",""),zi.serialization.fromJson(e));return o.dataType=ji(o.type),o.aggregateOperation=Di(o.aggregateOperator,n),(0,xe.Gn)(o,{kind:xe.sH,setKind:xe.XI,displayName:xe.sH,setDisplayName:xe.XI,decimals:xe.sH,setDecimals:xe.XI,displayCommas:xe.sH,setDisplayCommas:xe.XI,negativeNumberInParens:xe.sH,setNegativeNumberInParens:xe.XI,numberScale:xe.sH,setNumberScale:xe.XI,missingValueDisplayText:xe.sH,setMissingValueDisplayText:xe.XI,unit:xe.sH,setUnit:xe.XI,fontFamily:xe.sH,setFontFamily:xe.XI,fontSize:xe.sH,setFontSize:xe.XI,fontBold:xe.sH,setFontBold:xe.XI,fontItalic:xe.sH,setFontItalic:xe.XI,fontUnderline:xe.sH,setFontUnderline:xe.XI,fontStrikethrough:xe.sH,setFontStrikethrough:xe.XI,fontCase:xe.sH,setFontCase:xe.XI,textAlign:xe.sH,setTextAlign:xe.XI,normalForegroundColor:xe.sH,setNormalForegroundColor:xe.XI,negativeForegroundColor:xe.sH,setNegativeForegroundColor:xe.XI,zeroForegroundColor:xe.sH,setZeroForegroundColor:xe.XI,errorForegroundColor:xe.sH,setErrorForegroundColor:xe.XI,normalBackgroundColor:xe.sH,setNormalBackgroundColor:xe.XI,negativeBackgroundColor:xe.sH,setNegativeBackgroundColor:xe.XI,zeroBackgroundColor:xe.sH,setZeroBackgroundColor:xe.XI,errorBackgroundColor:xe.sH,setErrorBackgroundColor:xe.XI,isSelected:xe.sH,setIsSelected:xe.XI,hideFromView:xe.sH,setHideFromView:xe.XI,blur:xe.sH,setBlur:xe.XI,fixedWidth:xe.sH,setFixedWidth:xe.XI,minWidth:xe.sH,setMinWidth:xe.XI,maxWidth:xe.sH,setMaxWidth:xe.XI,pinned:xe.sH,setPinned:xe.XI,displayAsLink:xe.sH,setDisplayAsLink:xe.XI,linkLabelParameter:xe.sH,setLinkLabelParameter:xe.XI,isUsingDefaultStyling:xe.EW,useDefaultStyling:xe.XI,aggregateOperator:xe.sH,aggregateOperation:xe.sH,setAggregateOperation:xe.XI,aggregationParameters:xe.sH,setAggregationParameters:xe.XI,excludedFromPivot:xe.sH,setExcludedFromPivot:xe.XI,pivotSortDirection:xe.sH,setPivotSortDirection:xe.XI,pivotStatisticColumnFunction:xe.sH,setPivotStatisticColumnFunction:xe.XI}),o}get isUsingDefaultStyling(){return void 0===this.fontFamily&&void 0===this.fontSize&&void 0===this.fontBold&&void 0===this.fontItalic&&void 0===this.fontUnderline&&void 0===this.fontStrikethrough&&void 0===this.textAlign&&void 0===this.normalForegroundColor&&void 0===this.negativeForegroundColor&&void 0===this.zeroForegroundColor&&void 0===this.errorForegroundColor&&void 0===this.normalBackgroundColor&&void 0===this.negativeBackgroundColor&&void 0===this.zeroBackgroundColor&&void 0===this.errorBackgroundColor}useDefaultStyling(){this.fontFamily=void 0,this.fontSize=void 0,this.fontBold=void 0,this.fontItalic=void 0,this.fontUnderline=void 0,this.fontStrikethrough=void 0,this.textAlign=void 0,this.normalForegroundColor=void 0,this.negativeForegroundColor=void 0,this.zeroForegroundColor=void 0,this.errorForegroundColor=void 0,this.normalBackgroundColor=void 0,this.negativeBackgroundColor=void 0,this.zeroBackgroundColor=void 0,this.errorBackgroundColor=void 0}setKind(e){this.kind=e}setDisplayName(e){this.displayName=e}setDecimals(e){this.decimals=e}setDisplayCommas(e){this.displayCommas=e}setNegativeNumberInParens(e){this.negativeNumberInParens=e}setNumberScale(e){this.numberScale=e}setMissingValueDisplayText(e){this.missingValueDisplayText=e}setUnit(e){this.unit=e}setFontFamily(e){this.fontFamily=e}setFontSize(e){this.fontSize=e}setFontBold(e){this.fontBold=e}setFontItalic(e){this.fontItalic=e}setFontUnderline(e){this.fontUnderline=e}setFontStrikethrough(e){this.fontStrikethrough=e}setFontCase(e){this.fontCase=e}setTextAlign(e){this.textAlign=e}setNormalForegroundColor(e){this.normalForegroundColor=e}setNegativeForegroundColor(e){this.negativeForegroundColor=e}setZeroForegroundColor(e){this.zeroForegroundColor=e}setErrorForegroundColor(e){this.errorForegroundColor=e}setNormalBackgroundColor(e){this.normalBackgroundColor=e}setNegativeBackgroundColor(e){this.negativeBackgroundColor=e}setZeroBackgroundColor(e){this.zeroBackgroundColor=e}setErrorBackgroundColor(e){this.errorBackgroundColor=e}setIsSelected(e){this.isSelected=e}setHideFromView(e){this.hideFromView=e}setBlur(e){this.blur=e}setFixedWidth(e){this.fixedWidth=e}setMinWidth(e){this.minWidth=e}setMaxWidth(e){this.maxWidth=e}setPinned(e){this.pinned=e}setDisplayAsLink(e){this.displayAsLink=e}setLinkLabelParameter(e){this.linkLabelParameter=e}setAggregateOperation(e){this.aggregateOperation=e,this.aggregateOperator=e.operator}setAggregationParameters(e){this.aggregationParameters=e}setExcludedFromPivot(e){this.excludedFromPivot=e}setPivotSortDirection(e){this.pivotSortDirection=e}setPivotStatisticColumnFunction(e){this.pivotStatisticColumnFunction=e}}class Tp extends Yi{static create(e){const t=Object.assign(new Tp,Yi.serialization.fromJson(e));return(0,xe.Gn)(t,{expandedPaths:xe.sH,setExpandedPaths:xe.XI}),t}setExpandedPaths(e){this.expandedPaths=e}}class Np extends Xi{static create(e){const t=Object.assign(new Np,Xi.serialization.fromJson(e));return t.columns=[],(0,xe.Gn)(t,{name:xe.sH,setName:xe.XI,description:xe.sH,setDescription:xe.XI,showHorizontalGridLines:xe.sH,setShowHorizontalGridLines:xe.XI,showVerticalGridLines:xe.sH,setShowVerticalGridLines:xe.XI,gridLineColor:xe.sH,setGridLineColor:xe.XI,fontFamily:xe.sH,setFontFamily:xe.XI,fontSize:xe.sH,setFontSize:xe.XI,fontBold:xe.sH,setFontBold:xe.XI,fontItalic:xe.sH,setFontItalic:xe.XI,fontUnderline:xe.sH,setFontUnderline:xe.XI,fontStrikethrough:xe.sH,setFontStrikethrough:xe.XI,fontCase:xe.sH,setFontCase:xe.XI,textAlign:xe.sH,setTextAlign:xe.XI,normalForegroundColor:xe.sH,setNormalForegroundColor:xe.XI,negativeForegroundColor:xe.sH,setNegativeForegroundColor:xe.XI,zeroForegroundColor:xe.sH,setZeroForegroundColor:xe.XI,errorForegroundColor:xe.sH,setErrorForegroundColor:xe.XI,normalBackgroundColor:xe.sH,setNormalBackgroundColor:xe.XI,negativeBackgroundColor:xe.sH,setNegativeBackgroundColor:xe.XI,zeroBackgroundColor:xe.sH,setZeroBackgroundColor:xe.XI,errorBackgroundColor:xe.sH,setErrorBackgroundColor:xe.XI,alternateRows:xe.sH,setAlternateRows:xe.XI,alternateRowsColor:xe.sH,setAlternateRowsColor:xe.XI,alternateRowsCount:xe.sH,setAlternateRowsCount:xe.XI,alternateRowsStandardMode:xe.sH,setAlternateRowsStandardMode:xe.XI,showSelectionStats:xe.sH,setShowSelectionStats:xe.XI,showWarningForTruncatedResult:xe.sH,setShowWarningForTruncatedResult:xe.XI,initialExpandLevel:xe.sH,setInitialExpandLevel:xe.XI,showRootAggregation:xe.sH,setShowRootAggregation:xe.XI,showLeafCount:xe.sH,setShowLeafCount:xe.XI,treeColumnSortDirection:xe.sH,setTreeColumnSortDirection:xe.XI,pivotStatisticColumnName:xe.sH,setPivotStatisticColumnName:xe.XI,pivotStatisticColumnPlacement:xe.sH,setPivotStatisticColumnPlacement:xe.XI,isUsingDefaultStyling:xe.EW,useDefaultStyling:xe.XI}),t}get isUsingDefaultStyling(){return this.fontFamily===Ni&&11===this.fontSize&&this.fontBold===Si&&this.fontItalic===Ai&&this.fontUnderline===yi&&this.fontStrikethrough===xi&&this.textAlign===Ii&&this.normalForegroundColor===wi&&this.negativeForegroundColor===Oi&&this.zeroForegroundColor===Li&&this.errorForegroundColor===Fi&&this.normalBackgroundColor===ki&&this.negativeBackgroundColor===ki&&this.zeroBackgroundColor===ki&&this.errorBackgroundColor===ki}useDefaultStyling(){this.fontFamily=Ni,this.fontSize=11,this.fontBold=Si,this.fontItalic=Ai,this.fontUnderline=yi,this.fontStrikethrough=xi,this.textAlign=Ii,this.normalForegroundColor=wi,this.negativeForegroundColor=Oi,this.zeroForegroundColor=Li,this.errorForegroundColor=Fi,this.normalBackgroundColor=ki,this.negativeBackgroundColor=ki,this.zeroBackgroundColor=ki,this.errorBackgroundColor=ki}setName(e){this.name=e}setDescription(e){this.description=e}setShowHorizontalGridLines(e){this.showHorizontalGridLines=e}setShowVerticalGridLines(e){this.showVerticalGridLines=e}setGridLineColor(e){this.gridLineColor=e}setFontFamily(e){this.fontFamily=e}setFontSize(e){this.fontSize=e}setFontBold(e){this.fontBold=e}setFontItalic(e){this.fontItalic=e}setFontUnderline(e){this.fontUnderline=e}setFontStrikethrough(e){this.fontStrikethrough=e}setFontCase(e){this.fontCase=e}setTextAlign(e){this.textAlign=e}setNormalForegroundColor(e){this.normalForegroundColor=e}setNegativeForegroundColor(e){this.negativeForegroundColor=e}setZeroForegroundColor(e){this.zeroForegroundColor=e}setErrorForegroundColor(e){this.errorForegroundColor=e}setNormalBackgroundColor(e){this.normalBackgroundColor=e}setNegativeBackgroundColor(e){this.negativeBackgroundColor=e}setZeroBackgroundColor(e){this.zeroBackgroundColor=e}setErrorBackgroundColor(e){this.errorBackgroundColor=e}setAlternateRows(e){this.alternateRows=e}setAlternateRowsColor(e){this.alternateRowsColor=e}setAlternateRowsCount(e){this.alternateRowsCount=e}setAlternateRowsStandardMode(e){this.alternateRowsStandardMode=e}setShowSelectionStats(e){this.showSelectionStats=e}setShowWarningForTruncatedResult(e){this.showWarningForTruncatedResult=e}setInitialExpandLevel(e){this.initialExpandLevel=e}setShowRootAggregation(e){this.showRootAggregation=e}setShowLeafCount(e){this.showLeafCount=e}setTreeColumnSortDirection(e){this.treeColumnSortDirection=e}setPivotStatisticColumnPlacement(e){this.pivotStatisticColumnPlacement=e}setPivotStatisticColumnName(e){this.pivotStatisticColumnName=e}setExpandedPaths(e){this.pivotLayout.expandedPaths=e}}class Sp{limit=void 0;configuration=new Np;constructor(e){(0,xe.Gn)(this,{configuration:xe.sH,limit:xe.sH,setLimit:xe.XI,applySnaphot:xe.XI})}setLimit(e){this.limit=e}applySnaphot(e,t){this.setLimit(void 0!==e.data.limit&&e.data.limit>=0?e.data.limit:void 0),this.configuration=Np.create(e.data.configuration)}buildSnapshot(e,t){const n=e.data;n.limit=void 0===this.limit||this.limit<0?void 0:this.limit,n.configuration=this.configuration.serialize()}}class Ap{_view;columns=[];selectedColumnName;showAdvancedSettings=!1;constructor(e){(0,xe.Gn)(this,{columns:xe.sH,setColumns:xe.XI,selectedColumnName:xe.sH,setSelectedColumnName:xe.XI,selectedColumn:xe.EW,showAdvancedSettings:xe.sH,setShowAdvancedSettings:xe.XI,applySnaphot:xe.XI}),this._view=e.view}getColumnConfiguration(e){return P(Hi(this.columns,e),`Can't find configuration for column '${e}'`)}setColumns(e){this.columns=e}setSelectedColumnName(e){this.selectedColumnName=e}get selectedColumn(){return Hi(this.columns,this.selectedColumnName)}setShowAdvancedSettings(e){this.showAdvancedSettings=e}applySnaphot(e,t){this.setColumns(e.data.configuration.columns.map((t=>_p.create(t,e,this._view.engine.aggregateOperations)))),!this.selectedColumn&&this.columns.length&&this.setSelectedColumnName(N(this.columns,0).name)}buildSnapshot(e,t){e.data.configuration={...e.data.configuration,columns:this.columns.map((e=>e.serialize()))}}}class yp extends Ep{showHiddenColumns=!1;constructor(e,t){super(e,t),(0,xe.Gn)(this,{availableColumnsForDisplay:xe.$Z,selectedColumnsForDisplay:xe.$Z,showHiddenColumns:xe.sH,setShowHiddenColumns:xe.XI})}cloneColumn(e){return new fp(e.name,e.type)}get availableColumns(){return[...this._editor.sourceColumns,...this._editor.leafExtendColumns,...this._editor.groupExtendColumns].map((e=>new fp(e.name,e.type)))}get availableColumnsForDisplay(){return super.availableColumnsForDisplay.filter((e=>this.showHiddenColumns||!this._editor.columnProperties.getColumnConfiguration(e.name).hideFromView))}get selectedColumnsForDisplay(){return super.selectedColumnsForDisplay.filter((e=>this.showHiddenColumns||!this._editor.columnProperties.getColumnConfiguration(e.name).hideFromView))}setShowHiddenColumns(e){this.showHiddenColumns=e}}class xp{_editor;selector;constructor(e){(0,xe.Gn)(this,{applySnaphot:xe.XI}),this._editor=e,this.selector=new yp(e,{onChange:e=>{const t=e.selectedColumns.map((e=>this._editor.columnProperties.getColumnConfiguration(e.name))),n=this._editor.columnProperties.columns.filter((e=>!t.includes(e)));t.forEach((e=>e.setIsSelected(!0))),n.forEach((e=>e.setIsSelected(!1))),this._editor.columnProperties.setColumns([...t,...n])}})}propagateChanges(){this._editor.sorts.adaptPropagatedChanges()}applySnaphot(e,t){this.selector.setSelectedColumns(this._editor.columnProperties.columns.filter((e=>e.isSelected)).map((e=>{const t=this.selector.getColumn(e.name);return new fp(t.name,t.type)})))}buildSnapshot(e,t){this.propagateChanges(),e.data.selectColumns=this.selector.selectedColumns.filter((e=>!Hi(this._editor.groupExtendColumns,e.name))).map(Wi)}}class Ip extends Ep{cloneColumn(e){return new fp(e.name,e.type)}get availableColumns(){return this._editor.columnProperties.columns.filter((e=>e.kind===ii.DIMENSION&&!Hi(this._editor.groupExtendColumns,e.name)&&!Hi(this._editor.horizontalPivots.selector.selectedColumns,e.name))).map((e=>new fp(e.name,e.type)))}}class wp{selector;constructor(e){this.selector=new Ip(e)}adaptPropagatedChanges(){this.selector.setSelectedColumns(this.selector.selectedColumns.filter((e=>Hi(this.selector.availableColumns,e.name))))}applySnaphot(e,t){this.selector.setSelectedColumns((e.data.groupBy?.columns??[]).map((e=>new fp(e.name,e.type))))}buildSnapshot(e,t){e.data.groupBy=this.selector.selectedColumns.length?{columns:this.selector.selectedColumns.map(Wi)}:void 0,e.data.selectColumns=(0,tt.A)([...e.data.selectColumns,...this.selector.selectedColumns],(e=>e.name)).map(Wi)}}function kp(){return{modules:[Ar.JKr],className:"ag-theme-quartz",animateRows:!1,getRowId:e=>e.data.name,editType:"fullRow",rowDragMultiRow:!0,rowDragEntireRow:!0,rowSelection:{mode:"multiRow",checkboxes:!0,headerCheckbox:!0,enableClickSelection:!0},selectionColumnDef:{width:40,headerClass:"!pl-[23px]",cellClass:"!pl-1.5",rowDrag:!0,rowDragText:(e,t)=>t>1?`${t} columns`:(e.rowNode?.data).name,sortable:!1,resizable:!1,suppressHeaderMenuButton:!0},suppressMoveWhenRowDragging:!0,rowHeight:20,headerHeight:20,suppressRowHoverHighlight:!1,noRowsOverlayComponent:e=>e.api.getQuickFilter()?(0,E.jsxs)("div",{className:"flex items-center border-[1.5px] border-neutral-300 p-2 font-semibold text-neutral-400",children:[(0,E.jsx)("div",{children:(0,E.jsx)(dr.WarningCircle,{className:"mr-1 text-lg"})}),"No match found"]}):e.noColumnsSelectedRenderer?e.noColumnsSelectedRenderer():(0,E.jsx)("div",{}),onModelUpdated:e=>{0===e.api.getDisplayedRowCount()?e.api.showNoRowsOverlay():e.api.hideOverlay()}}}const Rp=(0,bt.PA)((function(e){const{selector:t,gridApi:n,scope:o}=e;return(0,E.jsxs)("div",{className:"flex items-center justify-center rounded-lg bg-neutral-500 px-1 py-0.5 font-mono text-xs font-bold text-white",children:[`${kd(n).length}/${"available"===o?t.availableColumnsForDisplay.length:t.selectedColumnsForDisplay.length}`,(0,E.jsx)("span",{className:"hidden",children:"available"===o?t.availableColumnsSearchText:t.selectedColumnsSearchText})]})})),Op=(0,bt.PA)((function(e){const{selector:t,columnLabelRenderer:n,columnActionRenderer:o,noColumnsSelectedRenderer:r}=e,[i,a]=(0,Lt.useState)([]),[s,l]=(0,Lt.useState)([]),[c,u]=(0,Lt.useState)(null),[d,p]=(0,Lt.useState)(null),g=(0,Lt.useRef)(null),m=(0,Lt.useRef)(null),h=(0,Lt.useCallback)((e=>{t.setSelectedColumns(wd(e.api))}),[t]),f=(0,Lt.useCallback)((e=>{const n=e.nodes.map((e=>e.data)).filter(L);t.setSelectedColumns(t.selectedColumns.filter((e=>!n.includes(e))))}),[t]),C=(0,Lt.useCallback)((e=>{-1!==e.overIndex&&t.setSelectedColumns(wd(e.api))}),[t]);return(0,Lt.useEffect)((()=>{if(!c||!d)return;const e=d.getRowDropZoneParams({onDragStop:e=>{h(e),c.clearFocusedCell()}});e&&(c.removeRowDropZone(e),c.addRowDropZone(e));const t=c.getRowDropZoneParams({onDragStop:e=>{f(e),d.clearFocusedCell()}});t&&(d.removeRowDropZone(t),d.addRowDropZone(t))}),[c,d,h,f]),(0,E.jsxs)("div",{className:"data-cube-column-selector flex h-full w-full",children:[(0,E.jsxs)("div",{className:"h-full w-[calc(50%_-_20px)]",children:[(0,E.jsx)("div",{className:"flex h-5 items-center text-sm",children:"Available columns:"}),(0,E.jsxs)("div",{className:"h-[calc(100%_-_20px)] rounded-sm border border-neutral-200",children:[(0,E.jsxs)("div",{className:"relative h-6 border-b border-neutral-200",children:[(0,E.jsx)("input",{className:"h-full w-full pl-10 pr-6 placeholder-neutral-400",ref:g,placeholder:"Click here to search...",value:t.availableColumnsSearchText,onChange:e=>t.setAvailableColumnsSearchText(e.target.value),onKeyDown:e=>{"Escape"===e.code&&(e.stopPropagation(),g.current?.select(),t.setAvailableColumnsSearchText(""))}}),(0,E.jsx)("div",{className:"absolute left-0 top-0 flex h-6 w-10 items-center justify-center",children:(0,E.jsx)(dr.Search,{className:"stroke-[3px] text-lg text-neutral-500"})}),(0,E.jsx)("button",{className:"absolute right-0 top-0 flex h-6 w-6 items-center justify-center text-neutral-500 disabled:text-neutral-300",disabled:!t.availableColumnsSearchText,title:"Clear search [Esc]",onClick:()=>{t.setAvailableColumnsSearchText(""),g.current?.focus()},children:(0,E.jsx)(dr.X,{className:"text-lg"})})]}),(0,E.jsx)("div",{className:"h-[calc(100%_-_24px)]",children:(0,E.jsx)(xr.W6,{theme:"legacy",...kp(),rowDragManaged:!1,onGridReady:e=>u(e.api),onSelectionChanged:e=>{a(e.api.getSelectedNodes().map((e=>e.data)).filter(L))},quickFilterText:t.availableColumnsSearchText,rowData:t.availableColumnsForDisplay,columnDefs:[{field:"name",colId:"name",flex:1,minWidth:100,filter:!0,sortable:!1,resizable:!1,suppressHeaderMenuButton:!0,getQuickFilterText:e=>e.value,headerComponent:e=>(0,E.jsxs)("button",{title:"Double-click to add all columns",className:"flex h-full w-full items-center justify-between pl-0.5",onDoubleClick:()=>{const n=kd(e.api);t.setSelectedColumns([...t.selectedColumns,...n]),e.api.clearFocusedCell()},children:[(0,E.jsx)("div",{children:"[All Columns]"}),(0,E.jsx)(Rp,{selector:t,gridApi:e.api,scope:"available"})]}),cellRenderer:e=>{const r=e.data;return r?(0,E.jsxs)("div",{className:"flex h-full w-full cursor-pointer items-center",title:`[${r.name}]\nDouble-click to add column`,onDoubleClick:()=>{t.setSelectedColumns([...t.selectedColumns,r]),e.api.clearFocusedCell()},children:[n?.({selector:t,column:r})??(0,E.jsx)("div",{className:"h-full flex-1 items-center overflow-hidden overflow-ellipsis whitespace-nowrap pl-2",children:r.name}),(0,E.jsx)("div",{className:"flex h-full",children:o?.({selector:t,column:r})??null})]}):null}}]})})]})]}),(0,E.jsx)("div",{className:"flex h-full w-10 items-center justify-center",children:(0,E.jsxs)("div",{className:"flex flex-col",children:[(0,E.jsx)("button",{className:"flex items-center justify-center rounded-sm border border-neutral-300 bg-neutral-100 text-neutral-500 hover:bg-neutral-200 disabled:bg-neutral-200 disabled:text-neutral-400",title:"Add selected columns",onClick:()=>{if(!c)return;const e=kd(c),n=i.filter((t=>e.includes(t)));t.setSelectedColumns([...t.selectedColumns,...n]),c.clearFocusedCell()},disabled:0===i.length,children:(0,E.jsx)(dr.ChevronRight,{className:"text-2xl"})}),(0,E.jsx)("button",{className:"mt-2 flex items-center justify-center rounded-sm border border-neutral-300 bg-neutral-100 text-neutral-500 hover:bg-neutral-200 disabled:bg-neutral-200 disabled:text-neutral-400",title:"Remove selected columns",onClick:()=>{if(!d)return;const e=kd(d),n=s.filter((t=>e.includes(t)));t.setSelectedColumns(t.selectedColumns.filter((e=>!n.includes(e)))),d.clearFocusedCell()},disabled:0===s.length,children:(0,E.jsx)(dr.ChevronLeft,{className:"text-2xl"})})]})}),(0,E.jsxs)("div",{className:"h-full w-[calc(50%_-_20px)]",children:[(0,E.jsx)("div",{className:"flex h-5 items-center text-sm",children:"Selected columns:"}),(0,E.jsxs)("div",{className:"h-[calc(100%_-_20px)] rounded-sm border border-neutral-200",children:[(0,E.jsxs)("div",{className:"relative h-6 border-b border-neutral-200",children:[(0,E.jsx)("input",{className:"h-full w-full pl-10 placeholder-neutral-400",ref:m,placeholder:"Click here to search...",value:t.selectedColumnsSearchText,onChange:e=>t.setSelectedColumnsSearchText(e.target.value),onKeyDown:e=>{"Escape"===e.code&&(e.stopPropagation(),t.setSelectedColumnsSearchText(""))}}),(0,E.jsx)("div",{className:"absolute left-0 top-0 flex h-6 w-10 items-center justify-center",children:(0,E.jsx)(dr.Search,{className:"stroke-[3px] text-lg text-neutral-500"})}),(0,E.jsx)("button",{className:"absolute right-0 top-0 flex h-6 w-6 items-center justify-center text-neutral-500 disabled:text-neutral-300",disabled:!t.selectedColumnsSearchText,title:"Clear search [Esc]",onClick:()=>{t.setSelectedColumnsSearchText(""),m.current?.focus()},children:(0,E.jsx)(dr.X,{className:"text-lg"})})]}),(0,E.jsx)("div",{className:"h-[calc(100%_-_24px)]",children:(0,E.jsx)(xr.W6,{theme:"legacy",...kp(),rowDragManaged:!0,onRowDragEnd:C,onGridReady:e=>p(e.api),onSelectionChanged:e=>{l(e.api.getSelectedNodes().map((e=>e.data)).filter(L))},quickFilterText:t.selectedColumnsSearchText,noRowsOverlayComponentParams:{noColumnsSelectedRenderer:r},rowData:t.selectedColumnsForDisplay,columnDefs:[{field:"name",colId:"name",flex:1,minWidth:100,filter:!0,sortable:!1,resizable:!1,suppressHeaderMenuButton:!0,getQuickFilterText:e=>e.value,headerComponent:e=>(0,E.jsxs)("button",{title:"Double-click to remove all columns",className:"flex h-full w-full items-center justify-between pl-0.5",onDoubleClick:()=>{const n=kd(e.api);t.setSelectedColumns(t.selectedColumns.filter((e=>!n.includes(e)))),e.api.clearFocusedCell()},children:[(0,E.jsx)("div",{children:"[All Columns]"}),(0,E.jsx)(Rp,{selector:t,gridApi:e.api,scope:"selected"})]}),cellRenderer:e=>{const r=e.data;return r?(0,E.jsxs)("div",{className:"flex h-full w-full cursor-pointer items-center",title:`[${r.name}]\nDouble-click to add column`,onDoubleClick:()=>{t.setSelectedColumns(t.selectedColumns.filter((e=>e!==r))),e.api.clearFocusedCell()},children:[n?.({selector:t,column:r})??(0,E.jsx)("div",{className:"h-full flex-1 items-center overflow-hidden overflow-ellipsis whitespace-nowrap pl-2",children:r.name}),(0,E.jsx)("div",{className:"flex h-full",children:o?.({selector:t,column:r})??null})]}):null}}]})})]})]})]})})),Lp=(0,bt.PA)((e=>{const{column:t}=e,[n,o,r,i]=jc();return(0,E.jsxs)("div",{className:"group relative flex h-full items-center",children:[!i&&(0,E.jsx)("div",{className:"flex h-[18px] w-32 items-center border border-transparent px-2 text-sm text-neutral-400 group-hover:invisible",children:t.direction}),i&&(0,E.jsxs)("div",{className:"flex h-[18px] w-32 items-center justify-between border border-sky-600 bg-sky-50 pl-2 pr-0.5 text-sm",children:[(0,E.jsx)("div",{children:t.direction}),(0,E.jsx)("div",{children:(0,E.jsx)(dr.CaretDown,{})})]}),(0,E.jsxs)("button",{className:"invisible absolute right-0 z-10 flex h-[18px] w-32 items-center justify-between border border-neutral-400 pl-2 pr-0.5 text-sm text-neutral-700 group-hover:visible",onClickCapture:e=>{e.stopPropagation(),n(e)},onClick:e=>e.stopPropagation(),children:[(0,E.jsx)("div",{children:t.direction}),(0,E.jsx)("div",{children:(0,E.jsx)(dr.CaretDown,{})})]}),(0,E.jsx)(Zc,{className:"w-32",...r,children:[di.ASCENDING,di.DESCENDING].map((e=>(0,E.jsx)(eu,{onClick:()=>{t.setDirection(e),o()},autoFocus:t.direction===e,children:e},e)))})]})})),Fp=(0,bt.PA)((e=>{const{column:t}=e;return(0,E.jsx)("div",{className:"h-full flex-1 items-center overflow-hidden overflow-ellipsis whitespace-nowrap pl-2",children:t.name.split(mi).join(" / ")})})),Pp=(0,bt.PA)((e=>{const{view:t}=e,n=t.editor.sorts;return(0,E.jsxs)("div",{className:"h-full w-full select-none p-2",children:[(0,E.jsxs)("div",{className:"flex h-6",children:[(0,E.jsx)("div",{className:"flex h-6 items-center text-xl font-medium",children:(0,E.jsx)(dr.TableSort,{})}),(0,E.jsx)("div",{className:"ml-1 flex h-6 items-center text-xl font-medium",children:"Sorts"})]}),(0,E.jsx)("div",{className:"flex h-[calc(100%_-_24px)] w-full",children:(0,E.jsx)(Op,{selector:n.selector,columnLabelRenderer:e=>(0,E.jsx)(Fp,{...e}),columnActionRenderer:e=>(0,E.jsx)(Lp,{...e})})})]})}));var Bp;!function(e){e.EXTENDED_COLUMN_LEVELS="data-cube.extended-column.levels",e.GRID_CONFIGURATION_ROW_LIMIT="data-cube.grid-configuration.row-limit",e.COLUMN_CONFIGURATION_KIND="data-cube.column-configuration.kind",e.COLUMN_CONFIGURATION_UNIT="data-cube.column-configuration.unit",e.COLUMN_CONFIGURATION_DISPLAY_AS_LINK="data-cube.column-configuration.display-value-as-link",e.COLUMN_CONFIGURATION_MISSING_VALUE_FORMAT="data-cube.column-configuration.missing-value-format"}(Bp||(Bp={}));const Dp=(0,bt.PA)((e=>{const{view:t}=e,n=t.editor.generalProperties,o=n.configuration,[r,i,a,s]=jc(),[l,c,u,d]=jc(),[p,g,m,h]=jc(),[f,C,b,v]=jc(),[_,T,N]=jc(),[S,A,y]=jc();return(0,E.jsxs)("div",{className:"h-full w-full select-none p-2",children:[(0,E.jsxs)("div",{className:"flex h-6",children:[(0,E.jsx)("div",{className:"flex h-6 items-center text-xl font-medium",children:(0,E.jsx)(dr.TableOptions,{})}),(0,E.jsx)("div",{className:"ml-1 flex h-6 items-center text-xl font-medium",children:"General Properties"})]}),(0,E.jsx)("div",{className:"flex h-[calc(100%_-_24px)] w-full",children:(0,E.jsxs)("div",{className:"h-full w-full py-2",children:[(0,E.jsxs)("div",{className:"flex h-6 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:"Report Title:"}),(0,E.jsx)(qc,{className:"h-6 w-96 text-lg font-semibold",value:o.name,onChange:e=>{o.setName(e.target.value)}})]}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:"Tree Column:"}),(0,E.jsx)(Jc,{label:"Show root aggregation",checked:o.showRootAggregation,onChange:()=>o.setShowRootAggregation(!o.showRootAggregation)}),(0,E.jsx)(Jc,{className:"ml-3",label:"Show leaf count",checked:o.showLeafCount,onChange:()=>o.setShowLeafCount(!o.showLeafCount)})]}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm"}),(0,E.jsx)("div",{className:"mr-1 flex h-full flex-shrink-0 items-center text-sm",children:"Sort:"}),(0,E.jsx)(Qc,{className:"w-20",onClick:r,open:s,children:o.treeColumnSortDirection}),(0,E.jsx)(Zc,{className:"w-20",...a,children:[di.ASCENDING,di.DESCENDING].map((e=>(0,E.jsx)(eu,{onClick:()=>{o.setTreeColumnSortDirection(e),i()},autoFocus:e===o.treeColumnSortDirection,children:e},e)))}),(0,E.jsx)("div",{className:"ml-3 mr-1 flex h-full flex-shrink-0 items-center text-sm",children:"Initially expand to level:"}),(0,E.jsx)(Qc,{className:"w-16",onClick:l,open:d,showAsPlaceholder:void 0===o.initialExpandLevel,children:o.initialExpandLevel??Pi}),(0,E.jsx)(Zc,{className:"w-16",...u,children:[void 0,1,2,3,4,5,6,7,8].map((e=>(0,E.jsx)(eu,{onClick:()=>{o.setInitialExpandLevel(e),c()},autoFocus:e===o.initialExpandLevel,children:e??Pi},e??"")))})]}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsxs)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:["Row Limit:",(0,E.jsx)(ru,{className:"ml-1",documentationKey:Bp.GRID_CONFIGURATION_ROW_LIMIT})]}),(0,E.jsx)(Kc,{className:"w-16 text-sm",value:n.limit,min:0,step:1,defaultValue:void 0,placeholder:Pi,setValue:e=>n.setLimit(e)})]}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm"}),(0,E.jsx)(Jc,{label:"Display warning when truncated",checked:o.showWarningForTruncatedResult,onChange:()=>o.setShowWarningForTruncatedResult(!o.showWarningForTruncatedResult)})]}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:"Show Selection Stats?"}),(0,E.jsx)(Jc,{checked:o.showSelectionStats,onChange:()=>o.setShowSelectionStats(!o.showSelectionStats),disabled:!0}),(0,E.jsx)(zc,{})]}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:"Show Lines?"}),(0,E.jsx)(Jc,{label:"Horizontal",checked:o.showHorizontalGridLines,onChange:()=>o.setShowHorizontalGridLines(!o.showHorizontalGridLines)}),(0,E.jsx)(Jc,{className:"ml-3",label:"Vertical",checked:o.showVerticalGridLines,onChange:()=>o.setShowVerticalGridLines(!o.showVerticalGridLines)}),(0,E.jsx)("div",{className:"ml-3 mr-1 flex h-full flex-shrink-0 items-center text-sm",children:"Color:"}),(0,E.jsx)(ou,{color:o.gridLineColor,defaultColor:_i,onChange:e=>o.setGridLineColor(e)})]}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:"Hightlight Rows:"}),(0,E.jsx)(Jc,{label:"Standard mode",checked:o.alternateRowsStandardMode,onChange:()=>{o.alternateRowsStandardMode?o.setAlternateRowsStandardMode(!1):(o.setAlternateRowsStandardMode(!0),o.setAlternateRows(!1))}}),(0,E.jsx)(Jc,{className:"ml-3",checked:o.alternateRows,onChange:()=>{o.alternateRows?o.setAlternateRows(!1):(o.setAlternateRows(!0),o.setAlternateRowsStandardMode(!1))}}),(0,E.jsx)("div",{className:"ml-1 mr-1 flex h-full flex-shrink-0 items-center text-sm",children:"Custom: Alternate color:"}),(0,E.jsx)(ou,{disabled:!o.alternateRows,color:o.alternateRowsColor,defaultColor:Ti,onChange:e=>o.setAlternateRowsColor(e)}),(0,E.jsx)("div",{className:"ml-1 flex h-full flex-shrink-0 items-center text-sm",children:"every:"}),(0,E.jsx)(Kc,{className:"ml-1 w-16 text-sm",disabled:!o.alternateRows,min:1,step:1,defaultValue:1,isValid:e=>void 0!==e&&e>0,value:o.alternateRowsCount,setValue:e=>o.setAlternateRowsCount(e??1)}),(0,E.jsx)("div",{className:"ml-1 flex-shrink-0 text-sm",children:"rows"})]}),(0,E.jsx)("div",{className:"my-2 h-[1px] w-full bg-neutral-200"}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:"Default Font:"}),(0,E.jsx)(Qc,{className:"w-28",onClick:p,open:h,children:o.fontFamily}),(0,E.jsxs)(Zc,{className:"w-28",...m,children:[[ti.ARIAL,ti.ROBOTO,ti.ROBOTO_CONDENSED].map((e=>(0,E.jsx)(eu,{onClick:()=>{o.setFontFamily(e),g()},autoFocus:e===o.fontFamily,children:e},e))),(0,E.jsx)(tu,{}),[ti.GEORGIA,ti.ROBOTO_SERIF,ti.TIMES_NEW_ROMAN].map((e=>(0,E.jsx)(eu,{onClick:()=>{o.setFontFamily(e),g()},autoFocus:e===o.fontFamily,children:e},e))),(0,E.jsx)(tu,{}),[ti.JERBRAINS_MONO,ti.ROBOTO_MONO,ti.UBUNTU_MONO].map((e=>(0,E.jsx)(eu,{onClick:()=>{o.setFontFamily(e),g()},autoFocus:e===o.fontFamily,children:e},e)))]}),(0,E.jsx)(Qc,{className:"ml-1 w-10",onClick:f,open:v,children:o.fontSize}),(0,E.jsx)(Zc,{className:"w-10",...b,children:[4,5,6,7,8,9,10,11,12,14,16,18,20,22,24,26,28,32,36,48,72].map((e=>(0,E.jsx)(eu,{onClick:()=>{o.setFontSize(e),C()},autoFocus:e===o.fontSize,children:e},e)))}),(0,E.jsxs)("div",{className:"relative ml-2 flex h-5",children:[(0,E.jsx)("button",{title:"Bold",className:jn("relative flex h-5 w-5 items-center justify-center rounded-bl-sm rounded-tl-sm border border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":o.fontBold}),onClick:()=>o.setFontBold(!o.fontBold),children:(0,E.jsx)(dr.FontBold,{})}),(0,E.jsx)("button",{title:"Italic",className:jn("relative -ml-[1px] flex h-5 w-5 items-center justify-center border border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":o.fontItalic}),onClick:()=>o.setFontItalic(!o.fontItalic),children:(0,E.jsx)(dr.FontItalic,{})}),(0,E.jsx)("button",{title:"Underline"+(o.fontUnderline?` (${o.fontUnderline})`:""),className:jn("relative -ml-[1px] flex h-5 w-5 items-center justify-center border border-r-0 border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":void 0!==o.fontUnderline}),onClick:()=>{void 0===o.fontUnderline?(o.setFontUnderline(ri.SOLID),o.setFontStrikethrough(!1)):o.setFontUnderline(void 0)},children:(0,E.jsx)(dr.FontUnderline,{})}),(0,E.jsxs)("button",{className:"text-2xs relative -ml-[1px] flex h-5 w-2.5 items-center justify-center border border-l-0 border-neutral-400 bg-neutral-50 p-0 text-neutral-600 focus:z-[1]",onClick:_,children:[(0,E.jsx)("div",{className:jn("h-4 w-[0.5px] bg-neutral-200",{"opacity-0":void 0!==o.fontUnderline})}),(0,E.jsx)(dr.CaretDown,{})]}),(0,E.jsx)(Zc,{className:"w-14",...N,children:[ri.SOLID,ri.DASHED,ri.DOTTED,ri.DOUBLE,ri.WAVY].map((e=>(0,E.jsx)(eu,{className:"relative",onClick:()=>{o.setFontUnderline(e),o.setFontStrikethrough(!1),T()},autoFocus:e===o.fontUnderline,children:(0,E.jsx)("div",{className:jn("!hover:underline absolute top-0 !underline",{"!hover:decoration-solid !decoration-solid":e===ri.SOLID,"!hover:decoration-dashed !decoration-dashed":e===ri.DASHED,"!hover:decoration-dotted !decoration-dotted":e===ri.DOTTED,"!hover:decoration-double !decoration-double":e===ri.DOUBLE,"!hover:decoration-wavy !decoration-wavy":e===ri.WAVY}),children:"                "})},e)))}),(0,E.jsx)("button",{title:"Strikethrough",className:jn("relative -ml-[1px] flex h-5 w-5 items-center justify-center border border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":o.fontStrikethrough}),onClick:()=>{o.fontStrikethrough?o.setFontStrikethrough(!1):(o.setFontStrikethrough(!0),o.setFontUnderline(void 0))},children:(0,E.jsx)(dr.FontStrikethrough,{})}),(0,E.jsx)("button",{title:"Case"+(o.fontCase?` (${o.fontCase})`:""),className:jn("relative -ml-[1px] flex h-5 w-5 items-center justify-center border border-r-0 border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":void 0!==o.fontCase}),onClick:()=>{o.setFontCase(void 0===o.fontCase?oi.UPPERCASE:void 0)},children:(0,E.jsx)(dr.FontCase,{className:"stroke-[0.5px]"})}),(0,E.jsxs)("button",{className:"text-2xs relative -ml-[1px] flex h-5 w-2.5 items-center justify-center rounded-br-sm rounded-tr-sm border border-l-0 border-neutral-400 bg-neutral-50 p-0 text-neutral-600 focus:z-[1]",onClick:S,children:[(0,E.jsx)("div",{className:jn("h-4 w-[0.5px] bg-neutral-200",{"opacity-0":void 0!==o.fontCase})}),(0,E.jsx)(dr.CaretDown,{})]}),(0,E.jsx)(Zc,{className:"w-20",...y,children:[oi.LOWERCASE,oi.UPPERCASE,oi.CAPITALIZE].map((e=>(0,E.jsx)(eu,{onClick:()=>{o.setFontCase(e),A()},autoFocus:e===o.fontCase,children:(0,E.jsx)("div",{className:jn({lowercase:e===oi.LOWERCASE,uppercase:e===oi.UPPERCASE,capitalize:e===oi.CAPITALIZE}),children:e})},e)))})]}),(0,E.jsxs)("div",{className:"relative ml-2 flex h-5",children:[(0,E.jsx)("button",{title:"Align Left",className:jn("relative flex h-5 w-5 items-center justify-center rounded-bl-sm rounded-tl-sm border border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":o.textAlign===ni.LEFT}),onClick:()=>o.setTextAlign(ni.LEFT),children:(0,E.jsx)(dr.TextAlignLeft,{})}),(0,E.jsx)("button",{title:"Align Center",className:jn("relative -ml-[1px] flex h-5 w-5 items-center justify-center border border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":o.textAlign===ni.CENTER}),onClick:()=>o.setTextAlign(ni.CENTER),children:(0,E.jsx)(dr.TextAlignCenter,{})}),(0,E.jsx)("button",{title:"Align Right",className:jn("relative -ml-[1px] flex h-5 w-5 items-center justify-center rounded-br-sm rounded-tr-sm border border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":o.textAlign===ni.RIGHT}),onClick:()=>o.setTextAlign(ni.RIGHT),children:(0,E.jsx)(dr.TextAlignRight,{})})]})]}),(0,E.jsxs)("div",{className:"mt-2 flex w-full",children:[(0,E.jsx)("div",{className:"flex h-6 w-32 flex-shrink-0 items-center text-sm",children:"Default Colors:"}),(0,E.jsxs)("div",{className:"h-18",children:[(0,E.jsxs)("div",{className:"flex h-6",children:[(0,E.jsx)("div",{className:"w-16 flex-shrink-0"}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center text-sm",children:"Normal"}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center text-sm",children:"Negative"}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center text-sm",children:"Zero"}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center text-sm",children:"Error"})]}),(0,E.jsxs)("div",{className:"flex h-6",children:[(0,E.jsx)("div",{className:"flex h-full w-16 flex-shrink-0 items-center text-sm",children:"Foreground:"}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:o.normalForegroundColor,defaultColor:wi,onChange:e=>o.setNormalForegroundColor(e)})}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:o.negativeForegroundColor,defaultColor:Oi,onChange:e=>o.setNegativeForegroundColor(e)})}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:o.zeroForegroundColor,defaultColor:Li,onChange:e=>o.setZeroForegroundColor(e)})}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:o.errorForegroundColor,defaultColor:Fi,onChange:e=>o.setErrorForegroundColor(e)})})]}),(0,E.jsxs)("div",{className:"flex h-6",children:[(0,E.jsx)("div",{className:"flex h-full w-16 flex-shrink-0 items-center text-sm",children:"Background:"}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:o.normalBackgroundColor,defaultColor:ki,onChange:e=>o.setNormalBackgroundColor(e)})}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:o.negativeBackgroundColor,defaultColor:ki,onChange:e=>o.setNegativeBackgroundColor(e)})}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:o.zeroBackgroundColor,defaultColor:ki,onChange:e=>o.setZeroBackgroundColor(e)})}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:o.errorBackgroundColor,defaultColor:ki,onChange:e=>o.setErrorBackgroundColor(e)})})]})]})]}),(0,E.jsxs)("div",{className:"mt-2 flex w-full",children:[(0,E.jsx)("div",{className:"flex h-6 w-32 flex-shrink-0 items-center text-sm"}),(0,E.jsxs)("div",{className:"w-80",children:[(0,E.jsx)("div",{className:"mb-2 h-[1px] w-full bg-neutral-200"}),(0,E.jsx)(Xc,{compact:!0,disabled:o.isUsingDefaultStyling,onClick:()=>o.useDefaultStyling(),children:"Use Default Styling"})]})]})]})})]})})),jp=(0,bt.PA)((e=>{const{column:t,editor:n}=e,o=n.columnProperties.getColumnConfiguration(t.name).hideFromView;return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{className:jn("items-center overflow-hidden overflow-ellipsis whitespace-nowrap pl-2",{"text-neutral-400":o}),children:t.name}),Boolean(Hi(n.leafExtendColumns,t.name))&&(0,E.jsx)("div",{className:"ml-1.5 mr-0.5 flex h-3.5 flex-shrink-0 items-center rounded-sm border border-neutral-300 bg-neutral-100 px-1 text-xs font-medium uppercase text-neutral-600",children:"Extended (Leaf Level)"}),Boolean(Hi(n.groupExtendColumns,t.name))&&(0,E.jsx)("div",{className:"ml-1.5 mr-0.5 flex h-3.5 flex-shrink-0 items-center rounded-sm border border-neutral-300 bg-neutral-100 px-1 text-xs font-medium uppercase text-neutral-600",children:"Extended (Group Level)"})]})})),Mp=(0,bt.PA)((e=>{const{view:t}=e,n=t.editor,o=n.columns;return(0,Lt.useEffect)((()=>()=>o.propagateChanges()),[o]),(0,E.jsxs)("div",{className:"h-full w-full select-none p-2",children:[(0,E.jsxs)("div",{className:"flex h-6 justify-between",children:[(0,E.jsxs)("div",{className:"flex h-full",children:[(0,E.jsx)("div",{className:"flex h-6 items-center text-xl font-medium",children:(0,E.jsx)(dr.TableColumns,{})}),(0,E.jsx)("div",{className:"ml-1 flex h-6 items-center text-xl font-medium",children:"Columns"})]}),(0,E.jsx)("div",{className:"flex h-full items-center pr-2",children:(0,E.jsx)(Jc,{label:"Show hidden columns?",checked:o.selector.showHiddenColumns,onChange:()=>o.selector.setShowHiddenColumns(!o.selector.showHiddenColumns)})})]}),(0,E.jsx)("div",{className:"flex h-[calc(100%_-_24px)] w-full",children:(0,E.jsx)(Op,{selector:o.selector,noColumnsSelectedRenderer:()=>(0,E.jsxs)("div",{className:"flex items-center border-[1.5px] border-neutral-200 p-2 font-semibold text-neutral-400",children:[(0,E.jsx)("div",{children:(0,E.jsx)(dr.Warning,{className:"mr-1 text-lg"})}),"No columns selected"]}),columnLabelRenderer:e=>(0,E.jsx)(jp,{...e,editor:n})})})]})})),Up=(0,bt.PA)((e=>{const{view:t}=e,n=t.editor.verticalPivots;return(0,E.jsxs)("div",{className:"h-full w-full select-none p-2",children:[(0,E.jsxs)("div",{className:"flex h-6",children:[(0,E.jsx)("div",{className:"flex h-6 items-center text-xl font-medium",children:(0,E.jsx)(dr.TableGroupBy,{})}),(0,E.jsx)("div",{className:"ml-1 flex h-6 items-center text-xl font-medium",children:"Vertical Pivots"})]}),(0,E.jsx)("div",{className:"flex h-[calc(100%_-_24px)] w-full",children:(0,E.jsx)(Op,{selector:n.selector})})]})})),Gp=(0,bt.PA)((e=>{const{view:t}=e,n=t.editor.horizontalPivots;return(0,Lt.useEffect)((()=>()=>n.propagateChanges()),[n]),(0,E.jsxs)("div",{className:"h-full w-full select-none p-2",children:[(0,E.jsxs)("div",{className:"flex h-6",children:[(0,E.jsx)("div",{className:"flex h-6 items-center text-xl font-medium",children:(0,E.jsx)(dr.TablePivot,{})}),(0,E.jsx)("div",{className:"ml-1 flex h-6 items-center text-xl font-medium",children:"Horizontal Pivots"})]}),(0,E.jsx)("div",{className:"flex h-[calc(100%_-_24px)] w-full",children:(0,E.jsx)(Op,{selector:n.selector,columnActionRenderer:e=>(0,E.jsx)(Lp,{...e})})})]})})),Vp=(0,bt.PA)((e=>{const{view:t}=e,n=t.editor,o=n.columnProperties,r=t.editor.generalProperties.configuration,i=o.selectedColumn,[a,s,l,c]=jc(),[u,d,p,g]=jc(),[m,h,f,C]=jc(),[b,v,_,T]=jc(),[N,S,A,y]=jc(),[x,I,w,k]=jc(),[R,O,L,F]=jc(),[P,B,D]=jc(),[j,M,U]=jc();return(0,E.jsxs)("div",{className:"h-full w-full select-none p-2",children:[(0,E.jsxs)("div",{className:"flex h-6 justify-between",children:[(0,E.jsxs)("div",{className:"flex h-full",children:[(0,E.jsxs)("div",{className:"relative flex h-6 items-center text-xl font-medium",children:[(0,E.jsx)(dr.TableColumn,{}),(0,E.jsx)(dr.TableColumnOptions__Settings,{className:"absolute bottom-1 right-0 bg-white text-xs"})]}),(0,E.jsx)("div",{className:"ml-1 flex h-6 items-center text-xl font-medium",children:"Column Properties"})]}),(0,E.jsxs)("div",{className:"flex h-full items-center pr-2",children:[(0,E.jsx)(Jc,{label:"Show advanced settings?",checked:o.showAdvancedSettings,onChange:()=>o.setShowAdvancedSettings(!o.showAdvancedSettings)}),(0,E.jsx)(Yc,{})]})]}),(0,E.jsx)("div",{className:"flex h-[calc(100%_-_24px)] w-full",children:(0,E.jsxs)("div",{className:"h-full w-full py-2",children:[(0,E.jsxs)("div",{className:"flex h-6 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:"Choose Column:"}),(0,E.jsx)(Qc,{className:"w-80",onClick:a,open:c,children:(0,E.jsxs)("div",{className:"flex h-full w-full items-center",children:[(0,E.jsx)("div",{className:"overflow-hidden overflow-ellipsis whitespace-nowrap",children:i?.name??Pi}),i&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{className:"ml-1.5 mr-0.5 flex h-3.5 w-12 flex-shrink-0 items-center justify-center rounded-sm border border-neutral-300 bg-neutral-100 text-xs font-medium uppercase text-neutral-600",children:i.dataType}),Boolean(Hi(n.leafExtendColumns,i.name))&&(0,E.jsx)("div",{className:"mr-0.5 flex h-3.5 flex-shrink-0 items-center rounded-sm border border-neutral-300 bg-neutral-100 px-1 text-xs font-medium uppercase text-neutral-600",children:"Extended (Leaf Level)"}),Boolean(Hi(n.groupExtendColumns,i.name))&&(0,E.jsx)("div",{className:"mr-0.5 flex h-3.5 flex-shrink-0 items-center rounded-sm border border-neutral-300 bg-neutral-100 px-1 text-xs font-medium uppercase text-neutral-600",children:"Extended (Group Level)"})]})]})}),(0,E.jsx)(Zc,{className:"w-80",...l,children:o.columns.toSorted($i).map((e=>(0,E.jsxs)(eu,{onClick:()=>{o.setSelectedColumnName(e.name),s()},autoFocus:e.name===i?.name,children:[(0,E.jsx)("div",{className:"overflow-hidden overflow-ellipsis whitespace-nowrap",children:e.name}),(0,E.jsx)("div",{className:"ml-1.5 mr-0.5 flex h-3.5 w-12 flex-shrink-0 items-center justify-center rounded-sm border border-neutral-300 bg-neutral-100 text-xs font-medium uppercase text-neutral-600",children:e.dataType}),Boolean(Hi(n.leafExtendColumns,e.name))&&(0,E.jsx)("div",{className:"mr-0.5 flex h-3.5 flex-shrink-0 items-center rounded-sm border border-neutral-300 bg-neutral-100 px-1 text-xs font-medium uppercase text-neutral-600",children:"Extended (Leaf Level)"}),Boolean(Hi(n.groupExtendColumns,e.name))&&(0,E.jsx)("div",{className:"mr-0.5 flex h-3.5 flex-shrink-0 items-center rounded-sm border border-neutral-300 bg-neutral-100 px-1 text-xs font-medium uppercase text-neutral-600",children:"Extended (Group Level)"})]},e.name)))}),o.showAdvancedSettings&&i&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{className:"mx-2 h-[1px] w-4 flex-shrink-0 bg-neutral-400"}),(0,E.jsxs)("div",{className:"flex h-6 items-center",children:[(0,E.jsxs)("div",{className:"flex h-full flex-shrink-0 items-center text-sm",children:["Column Kind:",(0,E.jsx)(ru,{className:"ml-1",documentationKey:Bp.COLUMN_CONFIGURATION_KIND})]}),(0,E.jsx)(Qc,{className:"ml-1.5 w-20",onClick:u,open:g,disabled:Boolean(Hi(n.verticalPivots.selector.selectedColumns,i.name)??Hi(n.horizontalPivots.selector.selectedColumns,i.name)),title:Boolean(Hi(n.verticalPivots.selector.selectedColumns,i.name)??Hi(n.horizontalPivots.selector.selectedColumns,i.name))?"Column kind cannot be changed while the column is used in pivot":void 0,children:i.kind}),(0,E.jsx)(Zc,{className:"w-20",...p,children:[ii.DIMENSION,ii.MEASURE].map((e=>(0,E.jsx)(eu,{onClick:()=>{e!==i.kind&&(i.setKind(e),i.setExcludedFromPivot(e===ii.DIMENSION),i.setPivotStatisticColumnFunction(e===ii.DIMENSION?void 0:li.SUM)),d()},autoFocus:e===i.kind,children:e},e)))}),(0,E.jsx)(Yc,{})]})]})]}),(0,E.jsx)("div",{className:"mb-2 ml-2 mt-3 h-[1px] w-[calc(100%_-_16px)] bg-neutral-200"}),i&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:"Display Name:"}),(0,E.jsx)(qc,{className:"w-80",value:i.displayName??"",onChange:e=>{const t=e.target.value;i.setDisplayName(""!==t?t:void 0)}})]}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:"Aggregation:"}),(0,E.jsx)(Qc,{className:"w-32",onClick:m,disabled:i.kind===ii.DIMENSION,open:C,children:i.aggregateOperation.operator}),(0,E.jsx)(Zc,{className:"w-32",...f,children:t.engine.aggregateOperations.filter((e=>e.isCompatibleWithColumn(i))).map((e=>(0,E.jsx)(eu,{onClick:()=>{e!==i.aggregateOperation&&(i.setAggregateOperation(e),i.setAggregationParameters(e.generateDefaultParameterValues(i))),h()},autoFocus:e===i.aggregateOperation,children:e.label},e.operator)))}),(0,E.jsx)(Jc,{className:"ml-3",label:"Exclude from horizontal pivot",checked:i.excludedFromPivot,onChange:()=>i.setExcludedFromPivot(!i.excludedFromPivot),disabled:i.kind===ii.DIMENSION})]}),i.dataType===gi.NUMBER&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:"Number Format:"}),(0,E.jsx)(Kc,{className:"w-16 text-sm",min:0,step:1,value:i.decimals??0,setValue:e=>{i.setDecimals(e)}}),(0,E.jsx)("div",{className:"ml-1 flex-shrink-0 text-sm",children:"decimal places"}),(0,E.jsx)(Jc,{className:"ml-3",label:"Display commas",checked:i.displayCommas,onChange:()=>i.setDisplayCommas(!i.displayCommas)}),(0,E.jsx)(Jc,{className:"ml-3",label:"Negative number in parens",checked:i.negativeNumberInParens,onChange:()=>i.setNegativeNumberInParens(!i.negativeNumberInParens)})]}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm"}),(0,E.jsx)("div",{className:"mr-1 flex h-full flex-shrink-0 items-center text-sm",children:"Scale:"}),(0,E.jsx)(Qc,{className:"w-32",onClick:b,open:T,showAsPlaceholder:void 0===i.numberScale,children:i.numberScale??Pi}),(0,E.jsx)(Zc,{className:"w-32",..._,children:[void 0,ei.PERCENT,ei.BASIS_POINT,ei.THOUSANDS,ei.MILLIONS,ei.BILLIONS,ei.TRILLIONS,ei.AUTO].map((e=>(0,E.jsx)(eu,{onClick:()=>{i.setNumberScale(e),v()},autoFocus:e===i.numberScale,children:e??Pi},e??"")))}),(0,E.jsxs)("div",{className:"ml-3 mr-1 flex h-full flex-shrink-0 items-center text-sm",children:["Unit:",(0,E.jsx)(ru,{className:"ml-1",documentationKey:Bp.COLUMN_CONFIGURATION_UNIT})]}),(0,E.jsx)(qc,{className:"w-16",value:i.unit??"",onChange:e=>{const t=e.target.value.trim();i.setUnit(""!==t.trim()?t:void 0)},placeholder:Pi})]})]}),i.dataType===gi.TEXT&&(0,E.jsx)(E.Fragment,{children:(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsxs)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:["Dislay as Link?",(0,E.jsx)(ru,{className:"ml-1",documentationKey:Bp.COLUMN_CONFIGURATION_DISPLAY_AS_LINK})]}),(0,E.jsx)(Jc,{checked:i.displayAsLink,onChange:()=>i.setDisplayAsLink(!i.displayAsLink)}),(0,E.jsx)("div",{className:"ml-1 h-[1px] w-2 flex-shrink-0 bg-neutral-400"}),(0,E.jsx)("div",{className:"ml-2 mr-1.5 flex h-full flex-shrink-0 items-center text-sm",children:"Use parameter in link as label:"}),(0,E.jsx)(qc,{className:"w-48",placeholder:vi,value:i.linkLabelParameter??"",onChange:e=>{const t=e.target.value.trim();i.setLinkLabelParameter(""!==t?t:void 0)}})]})}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsxs)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:["Missing Value Format:",(0,E.jsx)(ru,{className:"ml-1",documentationKey:Bp.COLUMN_CONFIGURATION_MISSING_VALUE_FORMAT})]}),(0,E.jsx)(qc,{className:"w-16",value:i.missingValueDisplayText??"",onChange:e=>{const t=e.target.value;i.setMissingValueDisplayText(""!==t?t:void 0)},placeholder:Pi})]}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:"Visibility:"}),(0,E.jsx)(Jc,{label:"Blur content",checked:i.blur,onChange:()=>i.setBlur(!i.blur),disabled:i.hideFromView}),(0,E.jsx)(Jc,{className:"ml-3",label:"Hide from view",checked:i.hideFromView,onChange:()=>i.setHideFromView(!i.hideFromView)})]}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:"Pin:"}),(0,E.jsx)(Qc,{className:"w-16",onClick:N,open:y,showAsPlaceholder:void 0===i.pinned,children:i.pinned??Pi}),(0,E.jsx)(Zc,{className:"w-16",...A,children:[void 0,pi.LEFT,pi.RIGHT].map((e=>(0,E.jsx)(eu,{onClick:()=>{i.setPinned(e),S()},autoFocus:e===i.pinned,children:e??Pi},e??"")))})]}),(0,E.jsxs)("div",{className:"mt-1.5 flex h-6 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:"Width:"}),(0,E.jsx)(Jc,{label:"(Any)",checked:void 0===i.fixedWidth&&void 0===i.minWidth&&void 0===i.maxWidth,onChange:()=>{void 0===i.fixedWidth&&void 0===i.minWidth&&void 0===i.maxWidth?(i.setFixedWidth(300),i.setMinWidth(void 0),i.setMaxWidth(void 0)):(i.setFixedWidth(void 0),i.setMinWidth(void 0),i.setMaxWidth(void 0))}}),(0,E.jsx)(Jc,{className:"ml-3",label:"Fixed",checked:void 0!==i.fixedWidth,onChange:()=>{i.setFixedWidth(void 0!==i.fixedWidth?void 0:300),i.setMinWidth(void 0),i.setMaxWidth(void 0)}}),(0,E.jsx)("div",{className:"ml-1 h-[1px] w-2 flex-shrink-0 bg-neutral-400"}),(0,E.jsx)(Kc,{className:"ml-1 w-16 text-sm",min:0,step:50,defaultValue:void 0,isValid:e=>void 0!==e&&e>0,value:i.fixedWidth,setValue:e=>{i.setFixedWidth(e)},disabled:void 0!==i.minWidth||void 0!==i.maxWidth}),(0,E.jsx)(Jc,{className:"ml-3",label:"In range",checked:void 0!==i.minWidth||void 0!==i.maxWidth,onChange:()=>{void 0===i.minWidth&&void 0===i.maxWidth?(i.setMinWidth(50),i.setMaxWidth(void 0),i.setFixedWidth(void 0)):(i.setMinWidth(void 0),i.setMaxWidth(void 0),i.setFixedWidth(void 0))}}),(0,E.jsx)("div",{className:"ml-1 h-[1px] w-2 flex-shrink-0 bg-neutral-400"}),(0,E.jsx)(Kc,{className:"ml-1 w-16 text-sm",min:0,step:50,defaultValue:void 0,isValid:e=>void 0!==e&&e>0,value:i.minWidth,setValue:e=>{i.setMinWidth(e)},disabled:void 0!==i.fixedWidth}),(0,E.jsx)("div",{className:"ml-1 h-[1px] w-1 flex-shrink-0 bg-neutral-400"}),(0,E.jsx)(Kc,{className:"ml-1 w-16 text-sm",min:i.minWidth??0,step:50,defaultValue:void 0,isValid:e=>void 0!==e&&e>=(i.minWidth??0),value:i.maxWidth,setValue:e=>{i.setMaxWidth(e)},disabled:void 0!==i.fixedWidth})]}),(0,E.jsx)("div",{className:"my-2 h-[1px] w-full bg-neutral-200"}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-32 flex-shrink-0 items-center text-sm",children:"Font:"}),(0,E.jsx)(Qc,{className:"w-28",onClick:x,open:k,children:i.fontFamily??r.fontFamily}),(0,E.jsxs)(Zc,{className:"w-28",...w,children:[[ti.ARIAL,ti.ROBOTO,ti.ROBOTO_CONDENSED].map((e=>(0,E.jsx)(eu,{onClick:()=>{i.setFontFamily(e),I()},autoFocus:e===(i.fontFamily??r.fontFamily),children:e},e))),(0,E.jsx)(tu,{}),[ti.GEORGIA,ti.ROBOTO_SERIF,ti.TIMES_NEW_ROMAN].map((e=>(0,E.jsx)(eu,{onClick:()=>{i.setFontFamily(e),I()},autoFocus:e===(i.fontFamily??r.fontFamily),children:e},e))),(0,E.jsx)(tu,{}),[ti.JERBRAINS_MONO,ti.ROBOTO_MONO,ti.UBUNTU_MONO].map((e=>(0,E.jsx)(eu,{onClick:()=>{i.setFontFamily(e),I()},autoFocus:e===(i.fontFamily??r.fontFamily),children:e},e)))]}),(0,E.jsx)(Qc,{className:"ml-1 w-10",onClick:R,open:F,children:i.fontSize??r.fontSize}),(0,E.jsx)(Zc,{className:"w-10",...L,children:[4,5,6,7,8,9,10,11,12,14,16,18,20,22,24,26,28,32,36,48,72].map((e=>(0,E.jsx)(eu,{onClick:()=>{i.setFontSize(e),O()},autoFocus:e===(i.fontSize??r.fontSize),children:e},e)))}),(0,E.jsxs)("div",{className:"relative ml-2 flex h-5",children:[(0,E.jsx)("button",{title:"Bold",className:jn("relative flex h-5 w-5 items-center justify-center rounded-bl-sm rounded-tl-sm border border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":i.fontBold??r.fontBold}),onClick:()=>i.setFontBold(!(i.fontBold??r.fontBold)),children:(0,E.jsx)(dr.FontBold,{})}),(0,E.jsx)("button",{title:"Italic",className:jn("relative -ml-[1px] flex h-5 w-5 items-center justify-center border border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":i.fontItalic??r.fontItalic}),onClick:()=>i.setFontItalic(!(i.fontItalic??r.fontItalic)),children:(0,E.jsx)(dr.FontItalic,{})}),(0,E.jsx)("button",{title:"Underline"+(i.fontUnderline??r.fontUnderline?` (${i.fontUnderline??r.fontUnderline})`:""),className:jn("relative -ml-[1px] flex h-5 w-5 items-center justify-center border border-r-0 border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":void 0!==(i.fontUnderline??r.fontUnderline)}),onClick:()=>{void 0===(i.fontUnderline??r.fontUnderline)?(i.setFontUnderline(ri.SOLID),i.setFontStrikethrough(!1)):i.setFontUnderline(void 0)},children:(0,E.jsx)(dr.FontUnderline,{})}),(0,E.jsxs)("button",{className:"text-2xs relative -ml-[1px] flex h-5 w-2.5 items-center justify-center border border-l-0 border-neutral-400 bg-neutral-50 p-0 text-neutral-600 focus:z-[1]",onClick:P,children:[(0,E.jsx)("div",{className:jn("h-4 w-[0.5px] bg-neutral-200",{"opacity-0":void 0!==(i.fontUnderline??r.fontUnderline)})}),(0,E.jsx)(dr.CaretDown,{})]}),(0,E.jsx)(Zc,{className:"w-14",...D,children:[ri.SOLID,ri.DASHED,ri.DOTTED,ri.DOUBLE,ri.WAVY].map((e=>(0,E.jsx)(eu,{className:"relative",onClick:()=>{i.setFontUnderline(e),i.setFontStrikethrough(!1),B()},autoFocus:e===(i.fontUnderline??r.fontUnderline),children:(0,E.jsx)("div",{className:jn("!hover:underline absolute top-0 !underline",{"!hover:decoration-solid !decoration-solid":e===ri.SOLID,"!hover:decoration-dashed !decoration-dashed":e===ri.DASHED,"!hover:decoration-dotted !decoration-dotted":e===ri.DOTTED,"!hover:decoration-double !decoration-double":e===ri.DOUBLE,"!hover:decoration-wavy !decoration-wavy":e===ri.WAVY}),children:"                "})},e)))}),(0,E.jsx)("button",{title:"Strikethrough",className:jn("relative -ml-[1px] flex h-5 w-5 items-center justify-center border border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":i.fontStrikethrough??r.fontStrikethrough}),onClick:()=>{i.fontStrikethrough??r.fontStrikethrough?i.setFontStrikethrough(!1):(i.setFontStrikethrough(!0),i.setFontUnderline(void 0))},children:(0,E.jsx)(dr.FontStrikethrough,{})}),(0,E.jsx)("button",{title:"Case"+(i.fontCase??r.fontCase?` (${i.fontCase??r.fontCase})`:""),className:jn("relative -ml-[1px] flex h-5 w-5 items-center justify-center border border-r-0 border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":void 0!==(i.fontCase??r.fontCase)}),onClick:()=>{void 0===(i.fontCase??r.fontCase)?i.setFontCase(oi.UPPERCASE):i.setFontCase(void 0)},children:(0,E.jsx)(dr.FontCase,{className:"stroke-[0.5px]"})}),(0,E.jsxs)("button",{className:"text-2xs relative -ml-[1px] flex h-5 w-2.5 items-center justify-center rounded-br-sm rounded-tr-sm border border-l-0 border-neutral-400 bg-neutral-50 p-0 text-neutral-600 focus:z-[1]",onClick:j,children:[(0,E.jsx)("div",{className:jn("h-4 w-[0.5px] bg-neutral-200",{"opacity-0":void 0!==(i.fontCase??r.fontCase)})}),(0,E.jsx)(dr.CaretDown,{})]}),(0,E.jsx)(Zc,{className:"w-20",...U,children:[oi.LOWERCASE,oi.UPPERCASE,oi.CAPITALIZE].map((e=>(0,E.jsx)(eu,{onClick:()=>{i.setFontCase(e),M()},autoFocus:e===(i.fontCase??r.fontCase),children:(0,E.jsx)("div",{className:jn({lowercase:e===oi.LOWERCASE,uppercase:e===oi.UPPERCASE,capitalize:e===oi.CAPITALIZE}),children:e})},e)))})]}),(0,E.jsxs)("div",{className:"relative ml-2 flex h-5",children:[(0,E.jsx)("button",{title:"Align Left",className:jn("relative flex h-5 w-5 items-center justify-center rounded-bl-sm rounded-tl-sm border border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":(i.textAlign??r.textAlign)===ni.LEFT}),onClick:()=>i.setTextAlign(ni.LEFT),children:(0,E.jsx)(dr.TextAlignLeft,{})}),(0,E.jsx)("button",{title:"Align Center",className:jn("relative -ml-[1px] flex h-5 w-5 items-center justify-center border border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":(i.textAlign??r.textAlign)===ni.CENTER}),onClick:()=>i.setTextAlign(ni.CENTER),children:(0,E.jsx)(dr.TextAlignCenter,{})}),(0,E.jsx)("button",{title:"Align Right",className:jn("relative -ml-[1px] flex h-5 w-5 items-center justify-center rounded-br-sm rounded-tr-sm border border-neutral-400 bg-neutral-50 p-0 text-neutral-700 focus:z-[1]",{"bg-neutral-200":(i.textAlign??r.textAlign)===ni.RIGHT}),onClick:()=>i.setTextAlign(ni.RIGHT),children:(0,E.jsx)(dr.TextAlignRight,{})})]})]}),(0,E.jsxs)("div",{className:"mt-2 flex w-full",children:[(0,E.jsx)("div",{className:"flex h-6 w-32 flex-shrink-0 items-center text-sm",children:"Colors:"}),(0,E.jsxs)("div",{className:"h-18",children:[(0,E.jsxs)("div",{className:"flex h-6",children:[(0,E.jsx)("div",{className:"w-16 flex-shrink-0"}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center text-sm",children:"Normal"}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center text-sm",children:"Negative"}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center text-sm",children:"Zero"}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center text-sm",children:"Error"})]}),(0,E.jsxs)("div",{className:"flex h-6",children:[(0,E.jsx)("div",{className:"flex h-full w-16 flex-shrink-0 items-center text-sm",children:"Foreground:"}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:i.normalForegroundColor??r.normalForegroundColor,defaultColor:r.normalForegroundColor,onChange:e=>i.setNormalForegroundColor(e)})}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:i.negativeForegroundColor??r.negativeForegroundColor,defaultColor:r.negativeForegroundColor,onChange:e=>i.setNegativeForegroundColor(e)})}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:i.zeroForegroundColor??r.zeroForegroundColor,defaultColor:r.zeroForegroundColor,onChange:e=>i.setZeroForegroundColor(e)})}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:i.errorForegroundColor??r.errorForegroundColor,defaultColor:r.errorForegroundColor,onChange:e=>i.setErrorForegroundColor(e)})})]}),(0,E.jsxs)("div",{className:"flex h-6",children:[(0,E.jsx)("div",{className:"flex h-full w-16 flex-shrink-0 items-center text-sm",children:"Background:"}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:i.normalBackgroundColor??r.normalBackgroundColor,defaultColor:r.normalBackgroundColor,onChange:e=>i.setNormalBackgroundColor(e)})}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:i.negativeBackgroundColor??r.negativeBackgroundColor,defaultColor:r.negativeBackgroundColor,onChange:e=>i.setNegativeBackgroundColor(e)})}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:i.zeroBackgroundColor??r.zeroBackgroundColor,defaultColor:r.zeroBackgroundColor,onChange:e=>i.setZeroBackgroundColor(e)})}),(0,E.jsx)("div",{className:"flex h-full w-12 flex-shrink-0 items-center justify-center",children:(0,E.jsx)(ou,{color:i.errorBackgroundColor??r.errorBackgroundColor,defaultColor:r.errorBackgroundColor,onChange:e=>i.setErrorBackgroundColor(e)})})]})]})]}),(0,E.jsxs)("div",{className:"mt-2 flex w-full",children:[(0,E.jsx)("div",{className:"flex h-6 w-32 flex-shrink-0 items-center text-sm"}),(0,E.jsxs)("div",{className:"w-80",children:[(0,E.jsx)("div",{className:"mb-2 h-[1px] w-full bg-neutral-200"}),(0,E.jsx)(Xc,{compact:!0,disabled:i.isUsingDefaultStyling,onClick:()=>i.useDefaultStyling(),children:"Use Default Styling"})]})]})]})]})})]})})),Hp=(0,bt.PA)((e=>{const t=$c().alertService,{view:n}=e,o=n.editor,r=o.currentTab,i=[Xp.COLUMNS,Xp.VERTICAL_PIVOTS,Xp.HORIZONTAL_PIVOTS,Xp.SORTS,Xp.GENERAL_PROPERTIES,Xp.COLUMN_PROPERTIES];return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)("div",{className:"relative h-[calc(100%_-_40px)] w-full px-2 pt-8",children:[(0,E.jsx)("div",{className:"absolute top-0 flex h-9 w-[calc(100%_-_16px)] overflow-y-hidden pt-2",children:i.map((e=>(0,E.jsx)("button",{onClick:()=>o.setCurrentTab(e),className:jn("relative flex h-6 items-center justify-center whitespace-nowrap border border-b-0 border-l-0 border-neutral-300 px-2 first:border-l focus:z-10",{"-top-0.5 h-[27px] border-b-0 bg-white":e===r}),children:e},e)))}),(0,E.jsxs)("div",{className:"h-full w-full overflow-auto border border-neutral-300 bg-white",children:[r===Xp.COLUMNS&&(0,E.jsx)(Mp,{view:n}),r===Xp.VERTICAL_PIVOTS&&(0,E.jsx)(Up,{view:n}),r===Xp.HORIZONTAL_PIVOTS&&(0,E.jsx)(Gp,{view:n}),r===Xp.SORTS&&(0,E.jsx)(Pp,{view:n}),r===Xp.GENERAL_PROPERTIES&&(0,E.jsx)(Dp,{view:n}),r===Xp.COLUMN_PROPERTIES&&(0,E.jsx)(Vp,{view:n})]})]}),(0,E.jsxs)("div",{className:"flex h-10 items-center justify-end px-2",children:[(0,E.jsx)(Xc,{onClick:()=>o.display.close(),children:"Cancel"}),(0,E.jsx)(Xc,{className:"ml-2",disabled:o.finalizationState.isInProgress,onClick:()=>{o.applyChanges().catch((e=>t.alertUnhandledError(e)))},children:"Apply"}),(0,E.jsx)(Xc,{className:"ml-2",disabled:o.finalizationState.isInProgress,onClick:()=>{o.applyChanges({closeAfterApply:!0}).catch((e=>t.alertUnhandledError(e)))},children:"OK"})]})]})}));class Wp extends Ep{cloneColumn(e){return new Cp(e.name,e.type,e.direction,e.onChange)}get availableColumns(){return this._editor.columnProperties.columns.filter((e=>e.kind===ii.DIMENSION&&!Hi(this._editor.groupExtendColumns,e.name))).map((e=>new Cp(e.name,e.type,di.ASCENDING,(()=>this.onChange?.(this)))))}}class $p{_editor;selector;castColumns=[];constructor(e){(0,xe.Gn)(this,{castColumns:xe.sH.ref,pivotResultColumns:xe.EW,setCastColumns:xe.XI,applySnaphot:xe.XI}),this._editor=e,this.selector=new Wp(e,{onChange:e=>{this._editor.columnProperties.columns.forEach((t=>t.setPivotSortDirection(Hi(e.selectedColumns,t.name)?.direction)))}})}get pivotResultColumns(){return this.castColumns.filter((e=>Gi(e.name))).map(Wi)}setCastColumns(e){this.castColumns=e}propagateChanges(){this._editor.verticalPivots.adaptPropagatedChanges(),this._editor.sorts.adaptPropagatedChanges()}applySnaphot(e,t){this.selector.setSelectedColumns((e.data.pivot?.columns??[]).map((e=>new Cp(e.name,e.type,Hi(t.columns,e.name)?.pivotSortDirection??di.ASCENDING,(()=>this.selector.onChange?.(this.selector)))))),this.setCastColumns(e.data.pivot?.castColumns??[])}buildSnapshot(e,t){e.data.pivot=this.selector.selectedColumns.length?{columns:this.selector.selectedColumns.map(Wi),castColumns:this.castColumns.map(Wi)}:void 0,e.data.selectColumns=(0,tt.A)([...e.data.selectColumns,...this.selector.selectedColumns],(e=>e.name)).map(Wi)}}class zp{_editor;pivotLayout=new Tp;constructor(e){(0,xe.Gn)(this,{pivotLayout:xe.sH,applySnaphot:xe.XI}),this._editor=e}applySnaphot(e,t){this.pivotLayout=Tp.create(e.data.configuration.pivotLayout)}buildSnapshot(e,t){this.pivotLayout.setExpandedPaths(Zl(t.data.groupBy?.columns??[],this._editor.verticalPivots.selector.selectedColumns,this.pivotLayout.expandedPaths)),e.data.configuration={...e.data.configuration,pivotLayout:this.pivotLayout.serialize()}}}class Yp extends A{sourceInformation}var Xp;!function(e){e.GENERAL_PROPERTIES="General Properties",e.COLUMN_PROPERTIES="Column Properties",e.COLUMNS="Columns",e.VERTICAL_PIVOTS="Vertical Pivots",e.HORIZONTAL_PIVOTS="Horizontal Pivots",e.SORTS="Sorts"}(Xp||(Xp={}));class Kp extends sp{view;display;finalizationState=Ie.create();generalProperties;pivotLayout;columnProperties;columns;horizontalPivots;verticalPivots;sorts;currentTab=Xp.GENERAL_PROPERTIES;sourceColumns=[];leafExtendColumns=[];groupExtendColumns=[];constructor(e){super(e.engine,e.settingService,e.snapshotService),(0,xe.Gn)(this,{currentTab:xe.sH,setCurrentTab:xe.XI,sourceColumns:xe.sH.ref,leafExtendColumns:xe.sH.ref,groupExtendColumns:xe.sH.ref,applySnapshot:xe.XI,applyChanges:xe.XI}),this.view=e,this.display=this.view.dataCube.layoutService.newDisplay("Properties",(()=>(0,E.jsx)(Hp,{view:this.view}))),this.generalProperties=new Sp(this),this.pivotLayout=new zp(this),this.columnProperties=new Ap(this),this.columns=new xp(this),this.horizontalPivots=new $p(this),this.verticalPivots=new wp(this),this.sorts=new vp(this)}setCurrentTab(e){this.currentTab=e}async applySnapshot(e,t){this.sourceColumns=e.data.sourceColumns,this.leafExtendColumns=e.data.leafExtendedColumns,this.groupExtendColumns=e.data.groupExtendedColumns;const n=Xi.serialization.fromJson(e.data.configuration);this.generalProperties.applySnaphot(e,n),this.pivotLayout.applySnaphot(e,n),this.columnProperties.applySnaphot(e,n),this.columns.applySnaphot(e,n),this.horizontalPivots.applySnaphot(e,n),this.verticalPivots.applySnaphot(e,n),this.sorts.applySnaphot(e,n)}getSnapshotSubscriberName(){return"editor"}async applyChanges(e){this.finalizationState.inProgress();const t=P(this.getLatestSnapshot()),n=t.clone();if(this.generalProperties.buildSnapshot(n,t),this.pivotLayout.buildSnapshot(n,t),this.columnProperties.buildSnapshot(n,t),this.columns.buildSnapshot(n,t),this.horizontalPivots.buildSnapshot(n,t),this.verticalPivots.buildSnapshot(n,t),this.sorts.buildSnapshot(n,t),n.finalize(),n.hashCode!==t.hashCode){const e=this.view.taskService.newTask("Validating query..."),t=n.clone();t.data.pivot&&(t.data.pivot.castColumns=this.sorts.selector.availableColumns.filter((e=>!Hi(t.data.groupExtendedColumns,e.name))).map(Wi));const o="->",r=await this.view.engine.getPartialQueryCode(t,!0);try{await this.view.engine.getQueryCodeRelationReturnType(o+r,vl([],[this.view.source.query]),this.view.source)}catch(e){return w(e),void(e instanceof Yp?this.view.dataCube.alertService.alertCodeCheckError(e,r,o,{message:"Query Validation Failure: Can't safely apply changes. Check the query code below for more details.",text:`Error: ${e.message}`}):this.view.dataCube.alertService.alertError(e,{message:"Query Validation Failure: Can't safely apply changes.",text:`Error: ${e.message}`}))}finally{this.view.taskService.endTask(e),this.finalizationState.complete()}this.publishSnapshot(n)}else this.finalizationState.complete();e?.closeAfterApply&&this.display.close()}}function qp(e,t,n,o){const r=o.view.engine.getFilterOperation(t);return{name:`Add Filter: ${e.name} ${r.textLabel}${n.label?` ${n.label}`:""}`,action:()=>{o.addNewFilterCondition(new pp(o.filterTree.root,{name:e.name,type:e.type},r,n.value,void 0))}}}class Jp extends sp{view;constructor(e){super(e.engine,e.settingService,e.snapshotService),this.view=e}configuration=new Xi;menuBuilder;getColumnConfiguration(e){return Hi(this.configuration.columns,e)}filterTree={nodes:new Map};addNewFilterCondition(e){if(this.filterTree.root)if(this.filterTree.root.operation===ui.AND)this.filterTree.root.addChild(e),this.filterTree.nodes.set(e.uuid,e);else{const t=this.filterTree.root;if(1===t.children.length)t.operation=ui.AND,t.addChild(e),this.filterTree.nodes.set(e.uuid,e);else{const n=new gp(void 0,ui.AND,void 0);this.filterTree.nodes.set(n.uuid,n),this.filterTree.root=n,n.addChild(t),n.addChild(e),this.filterTree.nodes.set(e.uuid,e)}}else{const t=new gp(void 0,ui.AND,void 0);this.filterTree.nodes.set(t.uuid,t),this.filterTree.root=t,t.addChild(e),this.filterTree.nodes.set(e.uuid,e)}this.applyChanges()}clearFilters(){this.filterTree.root=void 0,this.filterTree.nodes=new Map,this.applyChanges()}selectColumns=[];leafExtendedColumns=[];groupExtendedColumns=[];pinColumn(e,t){const n=this.getColumnConfiguration(e);n&&(n.pinned=t,this.applyChanges())}rearrangeColumns(e){const t=e.map((e=>this.getColumnConfiguration(e))).filter(L);this.configuration.columns=[...t,...this.configuration.columns.filter((e=>!t.includes(e)))];const n=e.map((e=>Hi(this.selectColumns,e))).filter(L);this.selectColumns=[...n,...n.filter((e=>!n.includes(e)))],this.applyChanges()}removeAllPins(){this.configuration.columns.forEach((e=>e.pinned=void 0)),this.applyChanges()}showColumn(e,t){const n=this.getColumnConfiguration(e);n&&(n.hideFromView=!t,this.applyChanges())}horizontalPivotColumns=[];horizontalPivotCastColumns=[];get horizontalPivotResultColumns(){return this.horizontalPivotCastColumns.filter((e=>Gi(e.name))).map(Wi)}getHorizontalPivotableColumn(e){return Hi(this.configuration.columns.filter((e=>e.kind===ii.DIMENSION&&!Hi(this.groupExtendedColumns,e.name))),e)}setHorizontalPivotOnColumn(e){const t=this.getHorizontalPivotableColumn(e);t&&(this.horizontalPivotColumns=[t],this.applyChanges())}addHorizontalPivotOnColumn(e){const t=this.getHorizontalPivotableColumn(e);t&&(this.horizontalPivotColumns=[...this.horizontalPivotColumns,t],this.applyChanges())}clearAllHorizontalPivots(){this.horizontalPivotColumns=[],this.horizontalPivotCastColumns=[],this.applyChanges()}excludeColumnFromHorizontalPivot(e){if(Gi(e)){const t=Vi(e),n=this.getColumnConfiguration(t);n&&!n.excludedFromPivot&&(n.excludedFromPivot=!0,this.applyChanges())}}includeColumnInHorizontalPivot(e){const t=this.getColumnConfiguration(e);t?.excludedFromPivot&&(t.excludedFromPivot=!1,this.applyChanges())}verticalPivotColumns=[];getVerticalPivotableColumn(e){return Hi(this.configuration.columns.filter((e=>e.kind===ii.DIMENSION&&!Hi(this.groupExtendedColumns,e.name)&&!Hi(this.horizontalPivotColumns,e.name))),e)}setVerticalPivotOnColumn(e){const t=this.getVerticalPivotableColumn(e);t&&(this.verticalPivotColumns=[t],this.applyChanges())}addVerticalPivotOnColumn(e){const t=this.getVerticalPivotableColumn(e);t&&(this.verticalPivotColumns=[...this.verticalPivotColumns,t],this.applyChanges())}removeVerticalPivotOnColumn(e){this.verticalPivotColumns=this.verticalPivotColumns.filter((t=>t.name!==e)),this.applyChanges()}clearAllVerticalPivots(){this.verticalPivotColumns=[],this.applyChanges()}collapseAllPaths(){this.view.grid.client.collapseAll(),this.configuration.pivotLayout.expandedPaths=[],this.applyChanges()}expandPath(e){this.configuration.pivotLayout.expandedPaths=(0,Te.A)([...this.configuration.pivotLayout.expandedPaths,e]).sort(),this.applyChanges()}collapsePath(e){this.configuration.pivotLayout.expandedPaths=this.configuration.pivotLayout.expandedPaths.filter((t=>t!==e)),this.applyChanges()}sortColumns=[];getSortableColumn(e){if(e)return Hi([...this.horizontalPivotCastColumns.length?this.horizontalPivotCastColumns:this.selectColumns,...this.groupExtendedColumns],e)}setSortByColumn(e,t){const n=this.getSortableColumn(e);n&&(this.sortColumns=[{...n,direction:t}],this.applyChanges())}addSortByColumn(e,t){const n=this.getSortableColumn(e);n&&(this.sortColumns=[...this.sortColumns,{...n,direction:t}],this.applyChanges())}clearSortByColumn(e){this.sortColumns=this.sortColumns.filter((t=>t.name!==e)),this.applyChanges()}clearAllSorts(){this.sortColumns=[],this.applyChanges()}getSnapshotSubscriberName(){return"grid-controller"}async applySnapshot(e,t){this.configuration=Xi.serialization.fromJson(e.data.configuration),this.filterTree.nodes=new Map,this.filterTree.root=e.data.filter?hp(e.data.filter,void 0,this.filterTree.nodes,(e=>this.view.engine.getFilterOperation(e))):void 0,this.selectColumns=e.data.selectColumns,this.leafExtendedColumns=e.data.leafExtendedColumns,this.groupExtendedColumns=e.data.groupExtendedColumns,this.horizontalPivotColumns=e.data.pivot?.columns??[],this.horizontalPivotCastColumns=e.data.pivot?.castColumns??[],this.verticalPivotColumns=e.data.groupBy?.columns??[],this.sortColumns=e.data.sortColumns,this.menuBuilder=function(e){const t=e.view,n=t.dataCube,o=t.filter,r=t.editor,i=t.extend;return(a,s)=>{const l=a.column??void 0,c=l?.getColId(),u=e.getColumnConfiguration(c),d=c&&Gi(c)?e.getColumnConfiguration(Vi(c)):void 0,p=c&&Hi([...e.leafExtendedColumns,...e.groupExtendedColumns],c),g="value"in a?a.value:void 0,m=[{name:"Sort",subMenu:[...l&&c&&e.getSortableColumn(c)?[{name:"Ascending",action:()=>e.setSortByColumn(c,di.ASCENDING)},{name:"Descending",action:()=>e.setSortByColumn(c,di.DESCENDING)},{name:"Clear Sort",disabled:!Hi(e.sortColumns,c),action:()=>e.clearSortByColumn(c)},"separator",{name:"Add Ascending",disabled:Boolean(e.sortColumns.find((e=>e.name===c&&e.direction===di.ASCENDING))),action:()=>e.addSortByColumn(c,di.ASCENDING)},{name:"Add Descending",disabled:Boolean(e.sortColumns.find((e=>e.name===c&&e.direction===di.DESCENDING))),action:()=>e.addSortByColumn(c,di.DESCENDING)},"separator"]:[],{name:"Clear All Sorts",disabled:0===e.sortColumns.length,action:()=>e.clearAllSorts()}]}];let h=[];if(l&&void 0!==g){let t=u;if(l.getColId()===Nd&&e.verticalPivotColumns.length&&"node"in a&&a.node){const n=e.verticalPivotColumns[a.node.level];t=e.getColumnConfiguration(n?.name)}if(t)if(g!==Td){const n=function(e,t){const n=`${t.type===Hr.STRING?`'${e}'`:e}`;let o;switch(t.type){case Hr.STRING:o=e;break;case Hr.NUMBER:case Hr.DECIMAL:case Hr.FLOAT:case Hr.INTEGER:o=$(Number(e));break;case Hr.DATE:case Hr.STRICTDATE:case Hr.DATETIME:o=e;break;default:throw new I(`Can't filter on column with unsupported type '${t.type}'`)}return{label:n,value:{type:t.type,value:o}}}(g,t),o=function(e){switch(e.type){case Hr.STRING:return[ci.EQUAL,ci.NOT_EQUAL,ci.LESS_THAN,ci.LESS_THAN_OR_EQUAL,ci.GREATER_THAN,ci.GREATER_THAN_OR_EQUAL,ci.CONTAIN,ci.NOT_CONTAIN,ci.START_WITH,ci.NOT_START_WITH,ci.END_WITH,ci.NOT_END_WITH];case Hr.NUMBER:case Hr.DECIMAL:case Hr.FLOAT:case Hr.INTEGER:case Hr.DATE:case Hr.STRICTDATE:case Hr.DATETIME:return[ci.EQUAL,ci.NOT_EQUAL,ci.LESS_THAN,ci.LESS_THAN_OR_EQUAL,ci.GREATER_THAN,ci.GREATER_THAN_OR_EQUAL];default:return[]}}(t);if(o.length&&o.includes(ci.EQUAL)){const r=o.filter((e=>e!==ci.EQUAL));h=[qp(t,ci.EQUAL,n,e),r.length?{name:`More Filters on ${c}...`,subMenu:r.map((o=>qp(t,o,n,e)))}:void 0].filter(L)}}else h=[qp(t,ci.IS_NULL,{value:{type:ai.VOID}},e),qp(t,ci.IS_NOT_NULL,{value:{type:ai.VOID}},e)]}return[{name:"Export",subMenu:[{name:"HTML",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0},{name:"Plain Text",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0},{name:"PDF",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0},{name:"Excel",action:()=>t.grid.exportEngine.exportFile(dd.EXCEL)},{name:"CSV",action:()=>t.grid.exportEngine.exportFile(dd.CSV)},"separator",{name:"DataCube Specification",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0}]},{name:"Email",subMenu:[{name:"HTML",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0},{name:"Plain Text",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0},"separator",{name:"HTML Attachment",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0},{name:"Plain Text Attachment",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0},{name:"PDF Attachment",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0},{name:"Excel Attachment",action:()=>{t.grid.exportEngine.exportEmail(dd.EXCEL).catch((e=>n.alertService.alertUnhandledError(e)))}},{name:"CSV Attachment",action:()=>{t.grid.exportEngine.exportEmail(dd.CSV).catch((e=>n.alertService.alertUnhandledError(e)))}},{name:"DataCube Specification Attachment",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0}]},{name:"Copy",menuItem:cp,cssClasses:["!opacity-100"],subMenu:[{name:"Plain Text",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0},{name:"Selected Rows as Plain Text",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0},{name:"Selected Column as Plain Text",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0}]},"separator",...m,{name:"Filter",subMenu:[...h,h.length?"separator":void 0,{name:"Filters...",action:()=>{o.display.open()}},{name:"Clear All Filters",action:()=>e.clearFilters()}].filter(L)},{name:"Pivot",subMenu:[...l&&c&&u?.kind===ii.DIMENSION&&e.getVerticalPivotableColumn(c)?[{name:`Vertical Pivot on ${c}`,action:()=>e.setVerticalPivotOnColumn(c)},{name:`Add Vertical Pivot on ${c}`,disabled:Boolean(Hi(e.verticalPivotColumns,c)),action:()=>e.addVerticalPivotOnColumn(c)},{name:`Remove Vertical Pivot on ${c}`,disabled:!Hi(e.verticalPivotColumns,c),action:()=>e.removeVerticalPivotOnColumn(c)},"separator"]:[],...l&&c&&u?.kind===ii.DIMENSION&&e.getHorizontalPivotableColumn(c)?[{name:`Horizontal Pivot on ${c}`,action:()=>e.setHorizontalPivotOnColumn(c)},{name:`Add Horizontal Pivot on ${c}`,disabled:Boolean(Hi(e.horizontalPivotColumns,c)),action:()=>e.addHorizontalPivotOnColumn(c)},"separator"]:[],...l&&c&&d?.kind===ii.MEASURE&&!d.excludedFromPivot&&0!==e.horizontalPivotColumns.length?[{name:`Exclude Column ${d.name} from Horizontal Pivot`,action:()=>e.excludeColumnFromHorizontalPivot(c)},"separator"]:[],...l&&c&&u?.kind===ii.MEASURE&&u.excludedFromPivot&&0!==e.horizontalPivotColumns.length?[{name:`Include Column ${c} in Horizontal Pivot`,action:()=>e.includeColumnInHorizontalPivot(c)},"separator"]:[],{name:"Clear All Vertical Pivots",disabled:0===e.verticalPivotColumns.length,action:()=>e.clearAllVerticalPivots()},{name:"Clear All Horizontal Pivots",disabled:0===e.horizontalPivotColumns.length,action:()=>e.clearAllHorizontalPivots()}]},{name:"Extended Columns",subMenu:[{name:"Add New Column...",action:()=>{i.openNewColumnEditor().catch((e=>n.alertService.alertUnhandledError(e)))}},...u&&c?[{name:`Extend Column ${c}...`,action:()=>{i.openNewColumnEditor(u).catch((e=>n.alertService.alertUnhandledError(e)))}}]:[],...p?["separator",{name:`Edit Column ${c}...`,action:()=>{i.openExistingColumnEditor(c).catch((e=>n.alertService.alertUnhandledError(e)))}},{name:`Delete Column ${c}`,action:()=>{i.deleteColumn(c).catch((e=>n.alertService.alertUnhandledError(e)))}}]:[]]},"separator",{name:"Resize",subMenu:[{name:"Auto-size to Fit Content",disabled:!l||!u||void 0!==u.fixedWidth,action:()=>a.api.autoSizeColumns([l?.getColId()].filter(L))},{name:"Minimize Column",disabled:!l||!u||void 0!==u.fixedWidth,action:()=>{l&&u&&a.api.setColumnWidths([{key:u.name,newWidth:u.minWidth??50}])}},"separator",{name:"Auto-size All Columns",action:()=>a.api.autoSizeColumns([...e.configuration.columns.filter((e=>void 0===e.fixedWidth&&e.isSelected&&!e.hideFromView)).map((e=>e.name)),...e.horizontalPivotCastColumns.map((t=>{if(Gi(t.name)){const n=Hi(e.configuration.columns,Vi(t.name));if(n&&void 0===n.fixedWidth&&n.isSelected&&!n.hideFromView)return t.name}})).filter(L)])},{name:"Minimize All Columns",action:()=>{a.api.setColumnWidths([...e.configuration.columns.filter((e=>void 0===e.fixedWidth)).map((e=>({key:e.name,newWidth:u?.minWidth??50}))),...e.horizontalPivotCastColumns.map((t=>{if(Gi(t.name)){const n=Hi(e.configuration.columns,Vi(t.name));if(n&&void 0===n.fixedWidth&&n.isSelected&&!n.hideFromView)return{key:t.name,newWidth:n.minWidth??50}}})).filter(L)])}},{name:"Size Grid to Fit Screen",action:()=>a.api.sizeColumnsToFit()}]},{name:"Pin",subMenu:[...u?[{name:"Pin Left",disabled:!l||l.isPinnedLeft(),checked:Boolean(l?.isPinnedLeft()),action:()=>e.pinColumn(c,pi.LEFT)},{name:"Pin Right",disabled:!l||l.isPinnedRight(),checked:Boolean(l?.isPinnedRight()),action:()=>e.pinColumn(c,pi.RIGHT)},{name:"Unpin",disabled:!l?.isPinned(),action:()=>e.pinColumn(c,void 0)},"separator"]:[],{name:"Remove All Pinnings",disabled:e.configuration.columns.every((e=>void 0===e.pinned)),action:()=>e.removeAllPins()}]},{name:"Hide",disabled:!u,action:()=>e.showColumn(c,!1)},...c===Nd?["separator",{name:"Collapse All",action:()=>{e.collapseAllPaths()}}]:[],"separator",{name:"Heatmap",menuItem:cp,cssClasses:["!opacity-100"],disabled:!l,subMenu:l?[{name:`Add to ${l.getColId()}`,menuItem:cp,cssClasses:["!opacity-100"],disabled:!0},{name:`Remove from ${l.getColId()}`,menuItem:cp,cssClasses:["!opacity-100"],disabled:!0}]:[]},{name:"Show Plot...",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0},{name:"Show TreeMap...",menuItem:cp,cssClasses:["!opacity-100"],disabled:!0},"separator",{name:"Properties...",disabled:r.display.isOpen,action:()=>{l&&s&&(r.setCurrentTab(Xp.COLUMN_PROPERTIES),r.columnProperties.setSelectedColumnName(d?.name??u?.name??c)),r.display.open()}}]}}(this)}propagateChanges(e){this.verticalPivotColumns=this.verticalPivotColumns.filter((e=>!Hi(this.horizontalPivotColumns,e.name))),this.configuration.pivotLayout.expandedPaths=Zl(e.data.groupBy?.columns??[],this.verticalPivotColumns,this.configuration.pivotLayout.expandedPaths),this.configuration.columns.forEach((e=>{e.pivotSortDirection=Hi(this.horizontalPivotColumns,e.name)?e.pivotSortDirection??di.ASCENDING:void 0})),this.selectColumns=(0,tt.A)([...this.configuration.columns.filter((e=>e.isSelected&&!Hi(this.groupExtendedColumns,e.name))),...this.horizontalPivotColumns,...this.verticalPivotColumns],(e=>e.name)).map(Wi);const t=(0,tt.A)([...this.horizontalPivotColumns.length?[...this.horizontalPivotResultColumns,...[...this.configuration.columns.filter((e=>e.isSelected)),...this.verticalPivotColumns].filter((e=>this.getColumnConfiguration(e.name)?.kind===ii.DIMENSION&&!Hi(this.horizontalPivotColumns,e.name)))]:[...this.configuration.columns.filter((e=>e.isSelected)),...this.verticalPivotColumns],...this.groupExtendedColumns],(e=>e.name));this.sortColumns=this.sortColumns.filter((e=>Hi(t,e.name)))}applyChanges(){const e=P(this.getLatestSnapshot()),t=e.clone();this.propagateChanges(e),t.data.configuration=this.configuration.serialize(),t.data.filter=this.filterTree.root?mp(this.filterTree.root):void 0,t.data.selectColumns=this.selectColumns,t.data.pivot=this.horizontalPivotColumns.length?{columns:this.horizontalPivotColumns,castColumns:this.horizontalPivotCastColumns}:void 0,t.data.groupBy=this.verticalPivotColumns.length?{columns:this.verticalPivotColumns}:void 0,t.data.sortColumns=this.sortColumns,t.finalize(),t.hashCode!==e.hashCode&&this.publishSnapshot(t)}}function Qp(e){return new Promise(((t,n)=>{const o=new FileReader;o.onloadend=()=>{const e=o.result;if(U(e)){const n=e.split(",")[1];if(n)return void t(n)}n(new Error("Can't base64 encode blob data"))},o.onerror=e=>n(e),o.readAsDataURL(e)}))}const Zp="mixed_boundary",eg="alternative_boundary",tg=`\nFrom:\nTo:\nSubject:\nX-Unsent: 1\nContent-Type: multipart/mixed; boundary="${Zp}"\n\n--${Zp}\nContent-Type: multipart/alternative; boundary="${eg}"\n\n--${eg}\nContent-Type: text/plain; charset="UTF-8"\nContent-Transfer-Encoding: 7bit\n\n\n\n--${eg}\nContent-Type: text/html; charset="UTF-8"\nContent-Transfer-Encoding: 7bit\n\n<html><body><p></p><body></html>\n\n--${eg}--\n\n`;class ng{_grid;constructor(e){this._grid=e}generateFileName(){return`${this._grid.queryConfiguration.name} - ${(0,Xn.GP)(new Date,"EEE MMM dd yyyy HH_mm_ss")}`}exportFile(e){const t=this.generateFileName();switch(e){case dd.CSV:return void this._grid.client.exportDataAsCsv({fileName:`${t}.csv`});case dd.EXCEL:return void this._grid.client.exportDataAsExcel({fileName:`${t}.xlsx`})}}async exportEmail(e){const t=this.generateFileName();let n,o,r=t;switch(e){case dd.CSV:r=`${t}.csv`,o=ee.TEXT_CSV,n=await Qp(new Blob([this._grid.client.getDataAsCsv()??""],{type:ee.TEXT_CSV}));break;case dd.EXCEL:{r+=`${t}.xlsx`,o=ee.APPLICATION_XLSX;const e=this._grid.client.getDataAsExcel();let i;if(e instanceof Blob)i=e;else{if("string"!=typeof e)throw new x("Can't export Excel content");i=new Blob([e],{type:ee.APPLICATION_XLSX})}n=await Qp(i);break}default:throw new I(`Can't export email in format '${e}'`)}le(`${t}.eml`,`${tg.trimStart()}--${Zp}\nContent-Type: ${o}; name="${r}"\nContent-Transfer-Encoding: base64\nContent-Disposition: attachment; filename="${r}"\n\n${n}\n\n--${Zp}--`,ee.MESSAGE_RFC822)}}class og extends sp{_view;controller;exportEngine;_client;clientDataSource;queryConfiguration;rowLimit;isPaginationEnabled=!0;isCachingEnabled=!1;scrollHintText;debouncedAutoResizeColumns;constructor(e){super(e.engine,e.settingService,e.snapshotService),(0,xe.Gn)(this,{clientDataSource:xe.sH,queryConfiguration:xe.sH,rowLimit:xe.sH,isPaginationEnabled:xe.sH,setPaginationEnabled:xe.XI,isCachingEnabled:xe.sH,setCachingEnabled:xe.XI,scrollHintText:xe.sH,setScrollHintText:xe.XI,applySnapshot:xe.XI}),this._view=e,this.controller=new Jp(this._view),this.exportEngine=new ng(this),this.queryConfiguration=new Xi,this.clientDataSource=new Od(this,this._view)}setPaginationEnabled(e){this.isPaginationEnabled=e,this.clientDataSource=new Od(this,this._view),this.client.updateGridOptions({cacheBlockSize:e?500:_d})}async setCachingEnabled(e,t){if(e===this.isCachingEnabled)return;if(!1===e)return await this._view.disposeCache(),void(0,xe.h5)((()=>{this.isCachingEnabled=e,this.clientDataSource=new Od(this,this._view)}));const n=async()=>{await this._view.initializeCache(),this._view.processCacheState.hasSucceeded&&(0,xe.h5)((()=>{this.isCachingEnabled=e,this.clientDataSource=new Od(this,this._view)}))};this._settingService.getBooleanValue(du.GRID_CLIENT__SHOW_CACHE_PERFORMANCE_WARNING)&&!t?.suppressWarning?this._view.alertService.alert({message:"Confirm you want to proceed with caching",text:"When enabled, the source dataset will be cached locally in order to boost query performance. But depending on computational resource available to your environment, sometimes, caching can negatively impact the overall performance, and can even lead to crashes.\n\nOverall, caching is still an experimental feature where we only support queries with simple execution plans, certain queries might not work, in which case, you can abort by turning off caching.\n\nDo you still want to proceed?",type:uu.WARNING,actions:[{label:"Abort",handler:()=>{}},{label:"Proceed",handler:()=>{n().catch((e=>this._view.alertService.alertUnhandledError(e)))}},{label:"Dismiss Warning and Proceed",handler:()=>{this._view.settingService.updateValue(this._view.dataCube.api,du.GRID_CLIENT__SHOW_CACHE_PERFORMANCE_WARNING,!1),n().catch((e=>this._view.alertService.alertUnhandledError(e)))}}],windowConfig:{...fr,width:600,height:300,minWidth:300,minHeight:150}}):await n()}setScrollHintText(e){this.scrollHintText=e}get isClientConfigured(){return Boolean(this._client)}get client(){return P(this._client,"Grid client is not configured")}configureClient(e){this._client=e,this.debouncedAutoResizeColumns=(0,Bn.A)((()=>e?.autoSizeAllColumns()),100)}getSnapshotSubscriberName(){return"grid"}async applySnapshot(e,t){const n=Xi.serialization.fromJson(e.data.configuration);this.queryConfiguration=n,this.rowLimit=e.data.limit;const o=function(e,t,n){return{isServerSideGroupOpenByDefault:e=>{if(void 0!==t.initialExpandLevel&&t.initialExpandLevel>0&&e.rowNode.level<=(t.showRootAggregation?t.initialExpandLevel+1:t.initialExpandLevel)-1)return!0;const n=e.rowNode.getRoute()??[];if(!n.length)return!1;if(t.showRootAggregation&&1===n.length&&n[0]===bi)return!0;t.showRootAggregation&&n.shift();const o=n.join(hi);return!!t.pivotLayout.expandedPaths.includes(o)},rowClassRules:t.alternateRows?{[pd.HIGHLIGHT_ROW]:e=>e.rowIndex%(2*t.alternateRowsCount)>=t.alternateRowsCount}:{},onColumnPinned:e=>{if("api"!==e.source&&e.column){const t=e.column,o=t.getPinned();n.grid.controller.pinColumn(t.getColId(),null===o?void 0:o===xd.LEFT?pi.LEFT:pi.RIGHT)}},onColumnMoved:e=>{"api"!==e.source&&e.column&&e.finished&&n.grid.controller.rearrangeColumns((e.api.getColumnDefs()??[]).filter((e=>!("children"in e))).map((e=>e.colId??"")))},onColumnVisible:e=>{if("api"!==e.source&&e.column){const t=e.column,o=t.isVisible();n.grid.controller.showColumn(t.getColId(),o)}},onRowGroupOpened:e=>{if(e.event){const o=e.node.getRoute()??[];o.length&&t.showRootAggregation&&o.shift();const r=o.join(hi);if(!r)return;e.expanded?n.grid.controller.expandPath(r):n.grid.controller.collapsePath(r)}},onVirtualColumnsChanged:()=>{n.grid.debouncedAutoResizeColumns?.cancel(),n.grid.debouncedAutoResizeColumns?.()},columnDefs:Wd(e,t),autoGroupColumnDef:{colId:Nd,headerName:"",cellRendererParams:{suppressCount:!t.showLeafCount},...Dd(e,t),minWidth:200,sortable:!0,showRowGroup:!0,suppressSpanHeaderHeight:!0}}}(e,n,this._view);this._settingService.getBooleanValue(du.DEBUGGER__ENABLE_DEBUG_MODE)&&this._engine.debugProcess("New Grid Options",["Grid Options",o]),this.client.updateGridOptions({...o,rowBuffer:this._settingService.getNumericValue(du.GRID_CLIENT__ROW_BUFFER),purgeClosedRowNodes:this._settingService.getBooleanValue(du.GRID_CLIENT__PURGE_CLOSED_ROW_NODES),cacheBlockSize:this.isPaginationEnabled?500:_d}),this.client.setFilterModel({[Ad]:{type:"equals",filter:Rd(e,n)}})}}class rg extends sp{_view;name="";constructor(e){super(e.engine,e.settingService,e.snapshotService),(0,xe.Gn)(this,{name:xe.sH,applySnapshot:xe.XI}),this._view=e}getSnapshotSubscriberName(){return"info"}async applySnapshot(e,t){const n=e.data,o=Xi.serialization.fromJson(n.configuration);o.name!==this.name&&(this.name=o.name,this._view.dataCube.options?.onNameChanged?.({api:this._view.dataCube.api,name:this.name,source:this._view.source}))}}const ig=[{func:Zr.EXTEND,parameters:1,stopCondition:e=>ea(e.function,Zr.EXTEND)&&e.parameters[0]instanceof ta&&ea(e.parameters[0].function,Zr.OVER)},{func:Zr.FILTER,parameters:1},{func:Zr.SELECT,parameters:1},{func:Zr.GROUP_BY,parameters:2},{func:Zr.PIVOT,parameters:2},{func:Zr.CAST,parameters:1},{func:Zr.SORT,parameters:1},{func:Zr.LIMIT,parameters:1}];var ag;!function(e){e.LEAF_EXTEND="leaf_extend",e.FILTER="filter",e.SELECT="select",e.PIVOT__GROUP="pivot__group",e.PIVOT_SORT="pivot_sort",e.PIVOT="pivot",e.PIVOT_CAST="pivot_cast",e.GROUP_BY__GROUP="group_by__group",e.GROUP_BY="group_by",e.GROUP_BY_SORT="group_by_sort",e.GROUP_EXTEND="group_extend",e.SORT="sort",e.LIMIT="limit"}(ag||(ag={}));const sg=[{name:ag.LEAF_EXTEND,func:Zr.EXTEND,repeat:!0},{name:ag.FILTER,func:Zr.FILTER},{name:ag.SELECT,func:Zr.SELECT},{name:ag.PIVOT__GROUP,funcs:[{name:ag.PIVOT_SORT,func:Zr.SORT,required:!0},{name:ag.PIVOT,func:Zr.PIVOT,required:!0},{name:ag.PIVOT_CAST,func:Zr.CAST,required:!0}]},{name:ag.GROUP_BY__GROUP,funcs:[{name:ag.GROUP_BY,func:Zr.GROUP_BY,required:!0},{name:ag.GROUP_BY_SORT,func:Zr.SORT,required:!0}]},{name:ag.GROUP_EXTEND,func:Zr.EXTEND,repeat:!0},{name:ag.SORT,func:Zr.SORT},{name:ag.LIMIT,func:Zr.LIMIT}],lg=new RegExp(`^${sg.map((e=>"funcs"in e?`(${e.funcs.map((e=>`(?<${e.name}>${e.repeat?`(?:<${Zi(e.func)}>____\\d+)*`:`<${Zi(e.func)}>____\\d+`})${e.repeat||e.required?"":"?"}`)).join("")})${e.repeat?"*":e.required?"":"?"}`:`(?<${e.name}>${e.repeat?`(?:<${Zi(e.func)}>____\\d+)*`:`<${Zi(e.func)}>____\\d+`})${e.repeat||e.required?"":"?"}`)).join("")}$`);async function cg(e,t,n,o){const r=function(e){if(!(e instanceof ta))throw new Error("Can't process expression: expected a function expression");const t=[];let n=e;for(;n instanceof ta;){const e=ig.find((e=>ea(n.function,e.func)));if(!e)throw new Error(`Can't process expression: found unsupported function ${n.function}()`);if(!(n.parameters.length>e.parameters)){t.unshift(n);break}{if(e.stopCondition?.(n)){t.unshift(n);break}M(n.parameters.length===e.parameters+1,`Can't process ${Zi(n.function)}() expression: expected at most ${e.parameters+1} parameters provided, got ${n.parameters.length}`);const o=zl(n,0,ta,"Can't process expression: expected a sequence of function calls (e.g. x()->y()->z())");n.parameters=n.parameters.slice(1),t.unshift(n),n=o}}const o=t.map(((e,t)=>`<${Zi(e.function)}>____${t}`)).join("").match(lg);if(!o)throw new Error(`Can't process expression: unsupported function composition ${t.map((e=>`${Zi(e.function)}()`)).join("->")} (supported composition: ${sg.map((e=>"funcs"in e?`[${e.funcs.map((e=>`${Zi(e.func)}()`)).join("->")}]`:`${Zi(e.func)}()`)).join("->")})`);const r=e=>{const n=o.groups?.[e];if(!n)return;const r=n.match(/\<.*?\>____\d+/g);return r?.length?r.map((e=>{const n=Number(e.split("____")[1]);if(!(isNaN(n)||n>=t.length))return N(t,n)})).filter(L):void 0};return{leafExtend:r(ag.LEAF_EXTEND),select:r(ag.SELECT)?.[0],filter:r(ag.FILTER)?.[0],pivotSort:r(ag.PIVOT_SORT)?.[0],pivot:r(ag.PIVOT)?.[0],pivotCast:r(ag.PIVOT_CAST)?.[0],groupBy:r(ag.GROUP_BY)?.[0],groupBySort:r(ag.GROUP_BY_SORT)?.[0],groupExtend:r(ag.GROUP_EXTEND),sort:r(ag.SORT)?.[0],limit:r(ag.LIMIT)?.[0]}}(o.deserializeValueSpecification(o.serializeValueSpecification(e))),i=rd.create({}),a=i.data,s=new Map,l=(e,t)=>{if(s.has(e.name))throw new Error(t);s.set(e.name,e)},c=new Map,u=e=>Wi(P(c.get(e),`Can't find column '${e}'`)),d=e=>c.set(e.name,e);if(a.sourceColumns=t.columns,Ql(a.sourceColumns,(e=>`Can't process source: found duplicate source columns '${e}'`)),a.sourceColumns.forEach((e=>l(e,`Can't process source: another column with name '${e.name}' is already registered`))),a.sourceColumns.forEach((e=>d(e))),r.leafExtend?.length&&(a.leafExtendedColumns=await ec(r.leafExtend,Array.from(c.values()),o),Ql(a.leafExtendedColumns,(e=>`Can't process extend() expression: found duplicate extended columns '${e}'`)),a.leafExtendedColumns.forEach((e=>l(e,`Can't process extend() expression: another column with name '${e.name}' is already registered`))),a.leafExtendedColumns.forEach((e=>d(e)))),r.filter){const e=zl(r.filter,0,Ur,"Can't process filter() expression: expected parameter at index 0 to be a lambda expression");a.filter=tc(Kl(e,"Can't process filter() expression"),u,o.filterOperations)}r.select?(a.selectColumns=Xl(r.select,0).colSpecs.map((e=>u(e.name))),Ql(a.selectColumns,(e=>`Can't process select() expression: found duplicate select columns '${e}'`)),c.clear(),a.selectColumns.forEach((e=>d(e)))):c.clear();let p=[],g=[];if(r.pivot&&r.pivotCast&&r.pivotSort){const e=Xl(r.pivot,0).colSpecs.map((e=>u(e.name))),t=(m=(h=r.pivotCast,zl(h,0,Qa,`Can't process ${Zi(h.function)}: expected parameter at index 0 to be a generic type instance`)).genericType,D(m.typeArguments[0]?.rawType,ns,"Can't process generic type: failed to extract relation type")).columns.map((e=>({name:e.name,type:ql(e.genericType).fullPath})));a.pivot={columns:e,castColumns:t},p=Xl(r.pivot,1).colSpecs.map((e=>ac(e,u,o.aggregateOperations))),g=function(e,t,n){const o=lc(e,n),r=new Set(t.map((e=>e.name))),i=new Set(t.map((e=>e.name)));if(o.forEach((e=>{if(!r.has(e.name))throw new Error(`Can't process pivot() expression: sort column '${e.name}' must be a pivot column`);i.delete(e.name)})),0!==i.size)throw new Error(`Can't process pivot() expression: found unsorted pivot column(s) (${Array.from(i.values()).sort().map((e=>`'${e}'`)).join(", ")})`);return Ql(o,(e=>`Can't process pivot() expression: found duplicate sort columns '${e}'`)),o}(r.pivotSort,e,u),function(e,t,n){const o=e.columns,r=e.castColumns;Ql(o,(e=>`Can't process pivot() expression: found duplicate pivot columns '${e}'`)),Ql(t,(e=>`Can't process pivot() expression: found duplicate aggregate columns '${e}'`)),Ql(r,(e=>`Can't process pivot() expression: found duplicate cast columns '${e}'`)),t.forEach((e=>{if(Hi(o,e.name))throw new Error(`Can't process pivot() expression: pivot column '${e.name}' must not be aggregated on`)})),n.filter((e=>!(Hi(o,e.name)??Hi(t,e.name)))).forEach((e=>{if(!Hi(r,e.name))throw new Error(`Can't process pivot() expression: expected pivot group column '${e.name}' in cast columns`)})),o.forEach((e=>{if(Hi(r,e.name))throw new Error(`Can't process pivot() expression: expected pivot column '${e.name}' to not present in cast columns`)})),t.forEach((e=>{if(Hi(r,e.name))throw new Error(`Can't process pivot() expression: expected pivot aggregate column '${e.name}' to not present in cast columns`)})),r.filter((e=>Gi(e.name))).forEach((e=>{const n=Vi(e.name);if(!Hi(t,n))throw new Error(`Can't process pivot() expression: fail to match cast column '${e.name}' to a specified aggregate column`)}))}(a.pivot,p,Array.from(c.values())),c.clear(),t.forEach((e=>d(e)))}var m,h;let f=[],E=[];if(r.groupBy&&r.groupBySort){const e=Xl(r.groupBy,0).colSpecs.map((e=>u(e.name)));a.groupBy={columns:e},f=Xl(r.groupBy,1).colSpecs.map((e=>ac(e,u,o.aggregateOperations))),E=function(e,t,n){const o=lc(e,n),r=new Set(t.map((e=>e.name))),i=new Set(t.map((e=>e.name)));let a;if(o.forEach((e=>{if(!r.has(e.name))throw new Error(`Can't process groupBy() expression: sort column '${e.name}' must be a group column`);if(i.delete(e.name),a){if(e.direction!==a)throw new Error("Can't process groupBy() expression: all group columns must be sorted in the same direction")}else a=e.direction})),0!==i.size)throw new Error(`Can't process groupBy() expression: found unsorted group column(s) (${Array.from(i.values()).sort().map((e=>`'${e}'`)).join(", ")})`);return Ql(o,(e=>`Can't process groupBy() expression: found duplicate sort columns '${e}'`)),o}(r.groupBySort,e,u),function(e,t,n,o,r){const i=e.columns;if(Ql(i,(e=>`Can't process groupBy() expression: found duplicate group columns '${e}'`)),Ql(t,(e=>`Can't process groupBy() expression: found duplicate aggregate columns '${e}'`)),t.forEach((e=>{if(Hi(i,e.name))throw new Error(`Can't process groupBy() expression: group column '${e.name}' must not be aggregated on`)})),r.forEach((e=>{if(!(Hi(i,e.name)??Hi(t,e.name)))throw new Error(`Can't process groupBy() expression: column '${e.name}' is neither grouped nor aggregated on`)})),n){const e=new Map;t.filter((e=>Gi(e.name))).forEach((t=>{const n=Vi(t.name),o={...t,name:n},r=e.get(n);if(r){if(!(0,Ro.A)({...r,type:void 0},{...o,type:void 0}))throw new Error(`Can't process groupBy() expression: found conflicting aggregation specification for column '${n}'`)}else e.set(n,o)})),o.forEach((t=>{const n=e.get(t.name);if(!n)throw new Error(`Can't process groupBy() expression: column '${t.name}' is aggregated in pivot() expression but not in groupBy() expression`);if(!(0,Ro.A)({...n,type:void 0},{...t,type:void 0}))throw new Error(`Can't process groupBy() expression: found conflicting aggregation specification for column '${t.name}'`)}))}}(a.groupBy,f,a.pivot,p,Array.from(c.values()))}if(r.groupExtend?.length&&(a.groupExtendedColumns=await ec(r.groupExtend,Array.from(c.values()),o),Ql(a.groupExtendedColumns,(e=>`Can't process extend() expression: found duplicate extended columns '${e}'`)),a.groupExtendedColumns.forEach((e=>l(e,`Can't process extend() expression: another column with name '${e.name}' is already registered`))),a.groupExtendedColumns.forEach((e=>d(e)))),r.sort&&(a.sortColumns=lc(r.sort,u),Ql(a.sortColumns,(e=>`Can't process sort() expression: found duplicate sort columns '${e}'`))),r.limit){const e=zl(r.limit,0,la,"Can't process limit() expression: expected limit to be a non-negative integer value");a.limit=e.value}const C=function(e,t,n){const o=e.snapshot.data,r=t.configuration,i=ld(e);if(!r)return i;o.groupBy&&M(r.treeColumnSortDirection===i.treeColumnSortDirection,`Can't process configuration: tree column sort direction mismatch (expected: '${i.treeColumnSortDirection.toLowerCase()}', found: '${r.treeColumnSortDirection.toLowerCase()}')`);const a=r.columns,s=i.columns,l=new Set;a.forEach((e=>{if(l.has(e.name))throw new Error(`Can't process configuration: found duplicate columns '${e.name}'`);l.add(e.name)})),a.forEach((e=>{if(!Hi(s,e.name))throw new Error(`Can't process configuration: found extra column '${e.name}'`)})),s.forEach((e=>{if(!Hi(a,e.name))throw new Error(`Can't process configuration: missing column '${e.name}'`)}));const c=[...o.selectColumns,...o.groupExtendedColumns,...[...o.sourceColumns,...o.leafExtendedColumns].filter((e=>!Hi(o.selectColumns,e.name)))];return c.forEach(((e,t)=>{const n=N(a,t);M(e.name===n.name,`Can't process configuration: column ordering mismatch at index ${t} (expected: '${e.name}', found: '${n.name})', expected ordering: ${c.map((e=>e.name)).join(", ")}`)})),a.forEach((e=>{const t=P(Hi(s,e.name));if(M(e.type===t.type,`Can't process configuration: type mismatch for column '${e.name}' (expected: '${t.type}', found: '${e.type}')`),M(e.isSelected===t.isSelected,`Can't process configuration: selection mismatch for column '${e.name}' (expected: '${t.isSelected}', found: '${e.isSelected}')`),(Hi(o.pivot?.columns??[],e.name)??Hi(o.groupBy?.columns??[],e.name))&&M(e.kind===t.kind,`Can't process configuration: kind mismatch for column '${e.name}' (expected: '${t.kind.toLowerCase()}', found: '${e.kind.toLowerCase()}')`),(o.pivot??o.groupBy)&&(M(e.aggregateOperator===t.aggregateOperator,`Can't process configuration: aggregation operator mismatch for column '${e.name}' (expected: '${t.aggregateOperator}', found: '${e.aggregateOperator}')`),M(n.getAggregateOperation(e.aggregateOperator).isCompatibleWithParameterValues(e.aggregationParameters),`Can't process configuration: incompatible aggregation parameter values for column '${e.name}' (operator: '${e.aggregateOperator}')`)),o.pivot&&(M(e.excludedFromPivot===t.excludedFromPivot,`Can't process configuration: pivot exclusion mismatch for column '${e.name}' (expected: '${t.excludedFromPivot}', found: '${e.excludedFromPivot}')`),M(e.pivotSortDirection===t.pivotSortDirection,`Can't process configuration: pivot sort direction mismatch for column '${e.name}' (expected: '${t.pivotSortDirection?.toLowerCase()??"none"}', found: '${e.pivotSortDirection?.toLowerCase()??"none"}')`)),e.kind===ii.DIMENSION&&!e.excludedFromPivot)throw new Error(`Can't process configuration: column '${e.name}' is a dimension but not excluded from pivot`)})),r}({snapshot:i,groupByAggColumns:f,groupBySortColumns:E,pivotAggColumns:p,pivotSortColumns:g},n,o);return a.configuration=C.serialize(),i.finalize()}var ug=n(60720),dg=n(56148),pg=n(36868);const gg=(0,Lt.forwardRef)((function(e,t){return(0,E.jsx)(ug.x,{ref:t,...e})})),mg=(0,Lt.forwardRef)((function(e,t){return(0,E.jsx)(dg.l,{ref:t,...e})})),hg=(0,Lt.forwardRef)((function(e,t){const{inputRef:n,className:o,disabled:r,InputProps:{ref:i,endAdornment:a}={},ownerState:s,enableAccessibleFieldDOMStructure:l,clearable:c,onClear:u,error:d,focused:p,...g}=e,m=(0,Pc.A)(i,t);return(0,E.jsxs)("div",{style:{display:"flex",alignItems:"center",position:"relative"},ref:m,children:[(0,E.jsx)("input",{className:o,disabled:r,ref:n,...g}),a]})})),fg=(0,Lt.forwardRef)((function(e,t){const{slots:n,slotProps:o,onClear:r,...i}=e,a=(0,pg.c)({...i});return(0,E.jsx)(hg,{...a,ref:t})}));var Eg=n(15179),Cg=n(15891);const bg=(0,bt.PA)((0,Lt.forwardRef)((function(e,t){const{value:n,updateValue:o}=e,r=(0,Lt.useRef)(null),i=(0,Pc.A)(r,t);return(0,E.jsx)("input",{ref:i,className:"h-5 w-full flex-shrink-0 border border-neutral-400 px-1 text-sm disabled:border-neutral-300 disabled:bg-neutral-50 disabled:text-neutral-300",value:n,onKeyDown:e=>{"Escape"===e.code&&r.current?.select()},onChange:e=>{o(e.target.value)}})}))),vg="#ERR",_g=(0,bt.PA)((0,Lt.forwardRef)((function(e,t){const{value:n,updateValue:o,defaultValue:r=0,step:i=1}=e,[a,s]=(0,Lt.useState)(n.toString()),l=(0,Lt.useRef)(null),c=(0,Pc.A)(l,t),u=()=>{const e=Number(a);if(""===a)s(r.toString()),o(r);else if(isNaN(e)){if(a===vg)return void s(n.toString());try{const e=$((0,Cg._3)(a));s(e.toString()),o(e)}catch{s(vg),o(r)}}};return(0,Lt.useEffect)((()=>{s(n.toString())}),[n]),(0,E.jsxs)("div",{className:"relative h-5 w-full flex-shrink-0",children:[(0,E.jsx)("input",{ref:c,inputMode:"numeric",spellCheck:!1,type:"text",className:"h-full w-full border border-neutral-400 px-1 pr-5 text-sm disabled:border-neutral-300 disabled:bg-neutral-50 disabled:text-neutral-300",value:a,onKeyDown:e=>{if("Enter"===e.code)u(),l.current?.focus();else if("Escape"===e.code)l.current?.select();else if("ArrowUp"===e.code){e.preventDefault();const t=n+i;s(t.toString()),o(t)}else if("ArrowDown"===e.code){e.preventDefault();const t=n-i;s(t.toString()),o(t)}},onChange:e=>{const t=e.target.value;s(t);const n=Number(t);!isNaN(n)&&t&&o(n)},onBlur:()=>u()}),(0,E.jsx)("div",{className:"absolute right-0 top-0 flex h-5 w-5 items-center justify-center",children:(0,E.jsx)("button",{className:"text-lg text-neutral-500 hover:text-neutral-600",title:"Evaluate Expression (Enter)",onClick:u,tabIndex:-1,children:(0,E.jsx)(dr.Calculate,{})})})]})}))),Tg=(0,Lt.forwardRef)((function(e,t){return(0,E.jsx)(fg,{...e,ref:t,className:"h-5 w-full flex-shrink-0 border border-neutral-400 px-1 pr-5 text-sm disabled:border-neutral-300 disabled:bg-neutral-50 disabled:text-neutral-300"})})),Ng=(0,bt.PA)((e=>{const{value:t,updateValue:n}=e,[o,r]=(0,Lt.useState)(null);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("button",{className:"absolute right-0 top-0 flex h-5 w-5 items-center justify-center",title:"Open Date Picker...",onClick:e=>{r(e.currentTarget)},tabIndex:-1,children:(0,E.jsx)(dr.Calendar,{className:"text-lg text-neutral-500 hover:text-neutral-600"})}),(0,E.jsx)(zn,{open:Boolean(o),anchorEl:o,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},onClose:()=>r(null),classes:{root:"data-cube-editor-date-calendar mt-0.5",paper:"shadow-md rounded-none border border-neutral-300"},children:(0,E.jsx)(gg,{autoFocus:!0,value:(0,Eg.H)(t),onChange:e=>{n((0,Xn.GP)(e,Jr)),r(null)}})})]})})),Sg=(0,bt.PA)((0,Lt.forwardRef)((function(e,t){const{value:n,updateValue:o}=e;return(0,E.jsx)(mg,{ref:t,value:(0,Eg.H)(n),format:Jr,slots:{field:Tg,openPickerButton:()=>(0,E.jsx)(Ng,{value:n,updateValue:o})},onChange:e=>{e&&o((0,Xn.GP)(e,Jr))}})}))),Ag=(0,bt.PA)((0,Lt.forwardRef)((function(e,t){const{value:n,updateValue:o,view:r}=e,i=r.filter,a=Hi(i.columns,n),[s,l,c,u]=jc();return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(Qc,{ref:t,className:"relative mr-1 w-32",onClick:s,open:u,children:n}),(0,E.jsx)(Zc,{className:"w-32",...c,children:i.columns.filter((e=>a&&ji(a.type)===ji(e.type))).map((e=>(0,E.jsx)(eu,{onClick:()=>{o(e.name),l()},autoFocus:n===e.name,children:e.name},e.name)))})]})}))),yg=(0,bt.PA)((0,Lt.forwardRef)((function(e,t){const{value:n,updateValue:o,view:r}=e;switch(n.type){case Hr.STRING:return(0,E.jsx)(bg,{ref:t,value:n.value,updateValue:e=>o(e)});case Hr.NUMBER:case Hr.DECIMAL:case Hr.FLOAT:case Hr.INTEGER:return(0,E.jsx)(_g,{ref:t,value:n.value,updateValue:e=>o(e)});case Hr.DATE:case Hr.STRICTDATE:case Hr.DATETIME:return(0,E.jsx)(Sg,{ref:t,value:n.value,updateValue:e=>o(e)});case ai.COLUMN:return(0,E.jsx)(Ag,{ref:t,value:n.value,updateValue:e=>o(e),view:r});default:return null}})));function xg(){return(0,E.jsxs)("div",{className:"relative flex pl-2.5",children:[(0,E.jsx)("div",{className:"pointer-events-none absolute -left-2 h-0 w-0 border-[9px] border-neutral-600 border-b-transparent border-l-transparent border-t-transparent"}),(0,E.jsx)("div",{className:"mr-1 flex h-[18px] w-10 flex-shrink-0 items-center bg-neutral-600 pl-2 text-sm font-medium text-white",title:"Filter is inverted: select all but what matches.",children:"NOT"})]})}const Ig=(0,bt.PA)((e=>{const{className:t,node:n,view:o}=e,r=o.filter;return(0,E.jsxs)("div",{className:jn("flex h-3.5 w-14 flex-shrink-0 bg-neutral-100",t),children:[(0,E.jsx)("button",{className:"flex h-3.5 w-3.5 items-center justify-center rounded-bl-sm rounded-tl-sm border border-neutral-400 hover:bg-neutral-200",onClick:()=>r.addFilterNode(n),title:"Insert a new column filter, just after this filter.",children:(0,E.jsx)(dr.FilterAddOperator,{className:"stroke-[2.5] text-sm"})}),(0,E.jsx)("button",{className:"flex h-3.5 w-3.5 items-center justify-center border border-l-0 border-neutral-400 hover:bg-neutral-200",onClick:()=>r.removeFilterNode(n),title:"Remove this filter",children:(0,E.jsx)(dr.FilterRemoveOperator,{className:"stroke-[2.5] text-sm"})}),(0,E.jsx)("button",{className:"flex h-3.5 w-3.5 items-center justify-center border border-l-0 border-neutral-400 hover:bg-neutral-200",onClick:()=>r.layerFilterNode(n),title:"Put this filter in its own sub-group (and combine it with other filters).",children:(0,E.jsx)(dr.FilterGroupOperator,{className:"stroke-[2.5] text-sm"})}),(0,E.jsx)("button",{className:jn("flex h-3.5 w-3.5 items-center justify-center rounded-br-sm rounded-tr-sm border border-l-0 border-neutral-400 hover:bg-neutral-200",{"bg-neutral-600":n.not,"border-neutral-600":n.not,"text-white":n.not,"hover:bg-neutral-600":n.not}),onClick:()=>n.setNot(!n.not),title:n.not?"Turn off the NOT operator on this filter to select only what matches.":"Turn on the NOT operator on this filter to select all but what matches.",children:(0,E.jsx)(dr.FilterNotOperator,{className:"stroke-[3] text-xs"})})]})})),wg=(0,bt.PA)((e=>{const{node:t,level:n,view:o}=e,r=$c(),i=o.filter,a=t.parent,s=a?a.children.indexOf(t):void 0,l=(0,Lt.useRef)(null),[c,u,d,p]=jc(),[g,m,h,f]=jc(),C=(0,Lt.useCallback)((()=>l.current?.focus()),[]);return(0,E.jsxs)("div",{className:"group flex h-6 items-center",children:[(0,E.jsx)("div",{className:jn("z-1 absolute h-6 w-full bg-opacity-50 group-hover:bg-sky-100 group-hover:bg-opacity-50",{"bg-sky-50":t===i.selectedNode,"border-[0.5px] border-l-2 border-sky-200 border-l-sky-600":t===i.selectedNode}),onClick:()=>i.setSelectedNode(t)}),(0,E.jsx)("div",{style:{paddingLeft:36*n+10+60*(n-1)+"px"},className:"relative h-6 flex-shrink-0",onClick:()=>i.setSelectedNode(t),children:a&&(0,E.jsxs)("div",{className:"absolute top-0 flex h-6 items-center justify-end",style:{width:"22px",right:"8px"},children:[(0,E.jsx)("div",{className:jn("h-[1px] w-full flex-1 bg-neutral-200",{"bg-sky-600":a===i.selectedGroupNode})}),void 0!==s&&s>0&&(0,E.jsx)("div",{className:jn("flex h-6 items-center justify-center pl-1 text-xs text-neutral-600",{"text-sky-600":a===i.selectedGroupNode}),children:a.operation===ui.AND?"and":"or"})]})}),(0,E.jsx)(Ig,{className:"relative mr-1",node:t,view:o}),t.not&&(0,E.jsx)(xg,{}),(0,E.jsx)(Qc,{className:"relative mr-1 w-32",onClick:c,open:p,children:t.column.name}),(0,E.jsx)(Zc,{className:"w-32",...d,onClosed:C,children:i.columns.map((e=>(0,E.jsx)(eu,{onClick:()=>{if(e!==t.column){const n=t.operation.isCompatibleWithColumn(e)?t.operation:r.engine.filterOperations.filter((t=>t.isCompatibleWithColumn(e)))[0];n&&(t.setColumn(e),t.setOperation(n),t.setValue(n.generateDefaultValue(e)))}u()},autoFocus:t.column.name===e.name,children:e.name},e.name)))}),(0,E.jsx)(Qc,{className:"relative mr-1 w-24",onClick:g,open:f,children:t.operation.label}),(0,E.jsx)(Zc,{className:"w-24",...h,onClosed:C,children:r.engine.filterOperations.filter((e=>e.isCompatibleWithColumn(t.column))).map((e=>(0,E.jsx)(eu,{onClick:()=>{e!==t.operation&&e.isCompatibleWithColumn(t.column)&&(t.setOperation(e),t.setValue(e.generateDefaultValue(t.column))),m()},autoFocus:t.operation.operator===e.operator,children:e.label},e.operator)))}),(0,E.jsx)("div",{className:"relative w-32 flex-shrink-0",children:(0,E.jsx)(yg,{ref:l,value:t.value,updateValue:e=>t.updateValue(e),view:o})})]})})),kg=(0,bt.PA)((e=>{const{node:t,level:n,view:o}=e,r=o.filter,i=t.parent,a=i?i.children.indexOf(t):void 0,[s,l,c,u]=jc();return(0,E.jsxs)("div",{className:"group flex h-6 items-center",children:[(0,E.jsx)("div",{className:jn("z-1 absolute h-6 w-full bg-opacity-50 group-hover:bg-sky-100 group-hover:bg-opacity-50",{"bg-sky-50":t===r.selectedNode,"border-[0.5px] border-l-2 border-sky-200 border-l-sky-600":t===r.selectedNode}),onClick:()=>r.setSelectedNode(t)}),(0,E.jsx)("div",{style:{paddingLeft:36*n+10+(0!==n?60*(n-1):0)+"px"},className:"relative h-6 flex-shrink-0",onClick:()=>r.setSelectedNode(t),children:0!==n&&i&&(0,E.jsxs)("div",{className:"absolute top-0 flex h-6 items-center justify-end",style:{width:"22px",right:"8px"},children:[(0,E.jsx)("div",{className:jn("h-[1px] w-full flex-1 bg-neutral-200",{"bg-sky-600":i===r.selectedGroupNode})}),void 0!==a&&a>0&&(0,E.jsx)("div",{className:jn("flex h-6 items-center justify-center pl-1 text-xs text-neutral-600",{"text-sky-600":i===r.selectedGroupNode}),children:i.operation===ui.AND?"and":"or"})]})}),0!==n&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(Ig,{className:"relative mr-1",node:t,view:o}),t.not&&(0,E.jsx)(xg,{})]}),(0,E.jsx)(Qc,{className:"relative w-14",onClick:s,open:u,children:t.operation===ui.AND?"All of":"Any of"}),(0,E.jsxs)(Zc,{className:"w-14",...c,children:[(0,E.jsx)(eu,{onClick:()=>{t.setOperation(ui.AND),l()},autoFocus:t.operation===ui.AND,children:"All of"}),(0,E.jsx)(eu,{onClick:()=>{t.setOperation(ui.OR),l()},autoFocus:t.operation===ui.OR,children:"Any of"})]})]})})),Rg=(0,bt.PA)((e=>{const{node:t,level:n,view:o}=e,r=o.filter;return(0,E.jsxs)("div",{className:"relative w-full",children:[(0,E.jsx)("div",{className:jn("pointer-events-none absolute h-full",{"border-[0.5px] border-sky-200 bg-sky-50":t===r.selectedGroupNode}),style:{marginLeft:36*n+10+60*n-2+"px",width:`calc(100% - ${36*n+10+60*n-4}px)`}}),(0,E.jsx)(kg,{node:t,level:n,view:o}),(0,E.jsxs)("div",{className:"relative",children:[(0,E.jsx)("div",{className:jn("pointer-events-none absolute z-10 h-[calc(100%_-_12px)] w-0 border-l border-neutral-200",{"border-sky-600":t===r.selectedGroupNode}),style:{marginLeft:36*n+10+6+60*n+"px"}}),t.children.map((e=>e instanceof pp?(0,E.jsx)(wg,{level:n+1,node:e,view:o},e.uuid):e instanceof gp?(0,E.jsx)(Rg,{level:n+1,node:e,view:o},e.uuid):null))]})]})})),Og=(0,bt.PA)((e=>{const{view:t}=e,n=t.filter;return(0,Lt.useEffect)((()=>{n.setSelectedNode(void 0)}),[n]),(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{className:"relative h-[calc(100%_-_40px)] w-full px-2 pt-2",children:(0,E.jsx)("div",{className:"h-full w-full overflow-auto border border-neutral-300 bg-white",children:(0,E.jsx)("div",{className:"h-full w-full select-none p-2",children:(0,E.jsx)("div",{className:"flex h-full w-full",children:(0,E.jsxs)("div",{className:"relative flex h-full w-full overflow-auto rounded-sm border border-neutral-200",onClick:()=>n.setSelectedNode(void 0),children:[!n.tree.root&&(0,E.jsxs)("div",{className:"h-full w-full p-3",children:[(0,E.jsx)("div",{children:"No filter is specified. Click the button below to start."}),(0,E.jsx)(Xc,{onClick:()=>{n.initializeTree()},children:"Create New Filter"})]}),n.tree.root&&(0,E.jsxs)("div",{className:"flex flex-col py-1",onClick:e=>e.stopPropagation(),children:[(0,E.jsx)(Rg,{node:n.tree.root,level:0,view:t}),(0,E.jsx)("div",{className:"min-h-6 w-full flex-1",onClick:()=>n.setSelectedNode(void 0)})]})]})})})})}),(0,E.jsxs)("div",{className:"flex h-10 items-center justify-end px-2",children:[(0,E.jsx)(Xc,{onClick:()=>n.display.close(),children:"Cancel"}),(0,E.jsx)(Xc,{className:"ml-2",onClick:()=>n.applyChanges(),children:"Apply"}),(0,E.jsx)(Xc,{className:"ml-2",onClick:()=>{n.applyChanges(),n.display.close()},children:"OK"})]})]})}));class Lg extends sp{_view;display;tree;selectedNode;columns=[];constructor(e){super(e.engine,e.settingService,e.snapshotService),(0,xe.Gn)(this,{tree:xe.sH.ref,initializeTree:xe.XI,refreshTree:xe.XI,columns:xe.sH.struct,applySnapshot:xe.XI,selectedNode:xe.sH,selectedGroupNode:xe.EW,setSelectedNode:xe.XI,addFilterNode:xe.XI,removeFilterNode:xe.XI,layerFilterNode:xe.XI}),this._view=e,this.display=this._view.dataCube.layoutService.newDisplay("Filter",(()=>(0,E.jsx)(Og,{view:this._view})),{x:-50,y:50,width:600,height:400,minWidth:300,minHeight:200,center:!1}),this.tree={nodes:new Map}}initializeTree(){if(void 0===this.tree.root&&0===this.tree.nodes.size){const e=new gp(void 0,ui.AND,void 0);this.tree.nodes.set(e.uuid,e),this.tree.root=e;const t=this.generateNewFilterNode(e);t&&(e.addChild(t),this.tree.nodes.set(t.uuid,t)),this.refreshTree()}}refreshTree(){this.tree={...this.tree}}get selectedGroupNode(){return this.selectedNode instanceof gp?this.selectedNode:this.selectedNode?.parent}setSelectedNode(e){this.selectedNode=e}generateNewFilterNode(e){if(e instanceof pp)return new pp(void 0,e.column,e.operation,(0,up.A)(e.value),e.not);if(e instanceof gp&&0!==this.columns.length){const e=N(this.columns,0),t={name:e.name,type:e.type},n=this._engine.getFilterOperation(ci.EQUAL);return new pp(void 0,t,n,n.generateDefaultValue(t),void 0)}}addFilterNode(e){if(this.tree.root){const t=this.generateNewFilterNode(e),n=e.parent;n&&t&&(n.addChild(t,e instanceof pp?n.children.indexOf(e)+1:void 0),this.tree.nodes.set(t.uuid,t),this.refreshTree())}}removeFilterNode(e){if(this.tree.root){const t=e.parent;if(e!==this.tree.root&&t){let n=[e];for(;n.length;)n.forEach((e=>{e instanceof gp&&e.children.forEach((e=>{e.setParent(void 0)})),this.tree.nodes.delete(e.uuid)})),n=Array.from(this.tree.nodes.values()).filter((e=>e!==this.tree.root&&!e.parent));if(t.removeChild(e),this.tree.nodes.delete(e.uuid),1===t.children.length){if(t!==this.tree.root){const e=N(t.children,0),n=P(t.parent);t.removeChild(e);const o=n.children.indexOf(t);n.removeChild(t),this.tree.nodes.delete(t.uuid),n.addChild(e,o)}}else 0===t.children.length&&t===this.tree.root&&(this.tree.root=void 0,this.tree.nodes.delete(t.uuid));this.refreshTree(),this.selectedNode===e&&this.setSelectedNode(void 0)}}}layerFilterNode(e){if(this.tree.root){const t=this.generateNewFilterNode(e),n=e.parent;if(n&&t){const o=n.children.indexOf(e);n.removeChild(e);const r=new gp(void 0,ui.OR,void 0);r.addChild(e),r.addChild(t),n.addChild(r,o),this.tree.nodes.set(r.uuid,r),this.tree.nodes.set(t.uuid,t),this.refreshTree(),this.selectedNode===e&&this.setSelectedNode(r)}}}getSnapshotSubscriberName(){return"filter-editor"}async applySnapshot(e,t){const n=Xi.serialization.fromJson(e.data.configuration);this.columns=n.columns.filter((t=>!Hi(e.data.groupExtendedColumns,t.name))),this.tree.nodes=new Map,this.tree.root=e.data.filter?hp(e.data.filter,void 0,this.tree.nodes,(e=>this._engine.getFilterOperation(e))):void 0,this.setSelectedNode(void 0),this.refreshTree()}applyChanges(){const e=P(this.getLatestSnapshot()),t=e.clone();t.data.filter=this.tree.root?mp(this.tree.root):void 0,t.finalize(),t.hashCode!==e.hashCode&&this.publishSnapshot(t)}}var Fg;!function(e){e.LEAF_LEVEL_MEASURE="Leaf Level Measure",e.LEAF_LEVEL_DIMENSION="Leaf Level Dimension",e.GROUP_LEVEL="Group Level"}(Fg||(Fg={}));const Pg=(0,bt.PA)((e=>{const{state:t}=e,n=$c(),o=t.view,r=o.extend,i=(0,Lt.useRef)(null),a=t.isGroupLevel?Fg.GROUP_LEVEL:t.columnKind===ii.MEASURE?Fg.LEAF_LEVEL_MEASURE:Fg.LEAF_LEVEL_DIMENSION,[s,l,c,u]=jc(),[d,p,g,m]=jc(),h=(0,Lt.useRef)(void 0),f=(0,Lt.useRef)(null),[C,b]=(0,Lt.useState)(),v=(0,Lt.useMemo)((()=>(0,Bn.A)((()=>{t.getReturnType().catch((e=>n.alertService.alertUnhandledError(e)))}),500)),[t,n]);return(0,Lt.useEffect)((()=>{if(!C&&f.current){const e=f.current,n=document.getElementById(Nr),r=Tr.editor.create(e,{contextmenu:!1,copyWithSyntaxHighlighting:!1,fontSize:14,fontFamily:"Roboto Mono",fontLigatures:!0,fixedOverflowWidgets:!0,detectIndentation:!1,tabSize:2,"bracketPairColorization.enabled":!1,automaticLayout:!0,fontSize:12,language:Fc.PURE,theme:vc.GITHUB_LIGHT,wordSeparators:su,fixedOverflowWidgets:!0,...L(n)?{overflowWidgetsDomNode:n}:{}});h.current?.dispose(),h.current=Tr.languages.registerCompletionItemProvider(Fc.PURE,{triggerCharacters:[...su,"$"],provideCompletionItems:async(e,n,r)=>{let i=[];return e.uri===t.editorModelUri&&(i=i.concat(await async function(e,n,o,r,i){const a=n.getValueInRange({startLineNumber:1,startColumn:1,endLineNumber:e.lineNumber,endColumn:e.column}),s=n.getWordAtPosition(e);let l=[];try{l=await r.getQueryTypeahead((o??"")+a,t.buildExtendBaseQuery(),i)}catch{}return l.map((t=>({label:t.display,kind:Tr.languages.CompletionItemKind.Text,filterText:t.display,insertTextRules:Tr.languages.CompletionItemInsertTextRule.InsertAsSnippet,insertText:t.completion,range:{startLineNumber:e.lineNumber,startColumn:s?.startColumn??e.column,endLineNumber:e.lineNumber,endColumn:s?.endColumn??e.column}})))}(n,e,t.codePrefix,o.engine,o.source))),{suggestions:i}}}),r.setModel(t.editorModel),r.onDidChangeModelContent((()=>{const e=r.getValue();e!==t.code&&(t.code=e,t.clearError(),t.setReturnType(void 0),v.cancel(),v())})),r.focus(),r.setPosition({lineNumber:1,column:t.code.length+1}),t.setEditor(r),b(r)}}),[t,C,v,o]),(0,Lt.useEffect)((()=>()=>{C&&(C.dispose(),h.current?.dispose())}),[C]),(0,Lt.useEffect)((()=>{t.editor?.updateOptions({readOnly:t.finalizationState.isInProgress})}),[t,t.finalizationState.isInProgress]),(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{className:"h-[calc(100%_-_40px)] w-full px-2 pt-2",children:(0,E.jsx)("div",{className:"h-full w-full overflow-auto border border-neutral-300 bg-white",children:(0,E.jsxs)("div",{className:"h-full w-full select-none p-0",children:[(0,E.jsxs)("div",{className:"h-24 w-full p-2",children:[(0,E.jsxs)("div",{className:"mt-1 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-24 flex-shrink-0 items-center text-sm",children:"Column Name:"}),(0,E.jsx)(qc,{className:"w-32",ref:i,disabled:t.finalizationState.isInProgress,value:t.name,onChange:e=>{t.setName(e.target.value)}}),(0,E.jsx)("div",{className:"ml-0.5 flex h-5 w-5 flex-shrink-0 items-center justify-center text-lg",children:t.isNameValid?(0,E.jsx)(dr.CircleChecked,{className:"text-green-500"}):(0,E.jsx)(dr.CircledFailed,{className:"text-red-500"})})]}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsxs)("div",{className:"flex h-full w-24 flex-shrink-0 items-center text-sm",children:["Column Kind:",(0,E.jsx)(ru,{className:"ml-1",documentationKey:Bp.EXTENDED_COLUMN_LEVELS})]}),(0,E.jsx)(Qc,{className:"w-32",onClick:s,open:u,disabled:t.finalizationState.isInProgress,children:a}),(0,E.jsx)(Zc,{className:"w-32",...c,children:[Fg.LEAF_LEVEL_MEASURE,Fg.LEAF_LEVEL_DIMENSION,Fg.GROUP_LEVEL].map((e=>(0,E.jsx)(eu,{onClick:()=>{switch(e){case Fg.LEAF_LEVEL_MEASURE:t.setColumnKind(!1,ii.MEASURE);break;case Fg.LEAF_LEVEL_DIMENSION:t.setColumnKind(!1,ii.DIMENSION);break;case Fg.GROUP_LEVEL:t.setColumnKind(!0,void 0);break;default:return}t.clearError(),t.setReturnType(void 0),v.cancel(),v(),l()},autoFocus:e===a,children:e},e)))})]}),(0,E.jsxs)("div",{className:"mt-2 flex h-5 w-full items-center",children:[(0,E.jsx)("div",{className:"flex h-full w-24 flex-shrink-0 items-center text-sm",children:"Value Type:"}),(0,E.jsx)(Qc,{className:"w-32",onClick:d,open:m,disabled:t.finalizationState.isInProgress,children:t.expectedType}),(0,E.jsx)("div",{className:"ml-0.5 flex h-5 w-5 flex-shrink-0 items-center justify-center text-lg",children:t.validationState.isInProgress?(0,E.jsx)(dr.Loader,{className:"animate-spin stroke-2 text-neutral-400"}):t.returnType?t.isTypeValid?(0,E.jsx)(dr.CircleChecked,{className:"text-green-500"}):(0,E.jsx)(dr.CircledFailed,{className:"text-red-500"}):null}),(0,E.jsx)(Zc,{className:"w-32",...g,children:[gi.TEXT,gi.NUMBER,gi.DATE].map((e=>(0,E.jsx)(eu,{onClick:()=>{t.setExpectedType(e),p()},autoFocus:e===t.expectedType,children:e},e)))})]})]}),(0,E.jsx)("div",{className:"h-[calc(100%_-_96px)] w-full p-2 pt-1",children:(0,E.jsx)("div",{className:jn("relative h-full w-full border border-neutral-200",{"border-red-500":Boolean(t.codeError)}),children:(0,E.jsx)("div",{className:"absolute left-0 top-0 h-full w-full overflow-hidden",ref:f})})})]})})}),(0,E.jsxs)("div",{className:"flex h-10 items-center justify-end px-2",children:[(0,E.jsx)(Xc,{onClick:()=>t.close(),children:"Cancel"}),t instanceof jg&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(Xc,{className:"ml-2",onClick:()=>{r.deleteColumn(t.initialData.name).catch((e=>n.alertService.alertUnhandledError(e)))},children:"Delete"}),(0,E.jsx)(Xc,{className:"ml-2",onClick:()=>{t.reset().catch((e=>n.alertService.alertUnhandledError(e)))},children:"Reset"})]}),(0,E.jsx)(Xc,{className:"ml-2",disabled:!t.isNameValid||!t.isTypeValid||t.validationState.isInProgress||t.finalizationState.isInProgress,onClick:()=>{t.applyChanges().catch((e=>n.alertService.alertUnhandledError(e)))},children:"OK"})]})]})}));class Bg{uuid=(0,i.A)();_manager;view;_name=`col_${this.uuid.replaceAll("-","_")}`;display;validationState=Ie.create();finalizationState=Ie.create();name;expectedType;isGroupLevel;columnKind;code="";codePrefix;codeSuffix;editor;editorModel;editorModelUri;codeError;returnType;constructor(e,t,n,o,r){(0,xe.Gn)(this,{name:xe.sH,setName:xe.XI,isNameValid:xe.EW,expectedType:xe.sH,setExpectedType:xe.XI,isTypeValid:xe.EW,isGroupLevel:xe.sH,columnKind:xe.sH,setColumnKind:xe.XI,editor:xe.sH.ref,setEditor:xe.XI,codeError:xe.sH.ref,showError:xe.XI,clearError:xe.XI,returnType:xe.sH,setReturnType:xe.XI}),this._manager=e,this.view=e.view,this.display=this.newDisplay(this),this.name=t,this.expectedType=n,this.isGroupLevel=o,this.columnKind=r,this.codePrefix=`->extend(~${this._name}:`,this.codeSuffix=")",this.editorModelUri=Tr.Uri.file(`/${this.uuid}.pure`),this.editorModel=Tr.editor.createModel("",Fc.PURE,this.editorModelUri)}async initialize(){this.code=await this.getInitialCode(),this.editorModel.setValue(this.code)}setName(e){this.name=e}get isNameValid(){return!this._manager.allColumnNames.includes(this.name)}setExpectedType(e){this.expectedType=e}get isTypeValid(){return void 0!==this.returnType&&this.expectedType===ji(this.returnType)}setColumnKind(e,t){this.isGroupLevel=e,this.columnKind=t}setEditor(e){this.editor=e}setReturnType(e){this.returnType=e}showError(e){this.codeError=e,e.sourceInformation&&Oc(this.editorModel,[{message:e.message,startLineNumber:e.sourceInformation.startLine,startColumn:e.sourceInformation.startColumn,endLineNumber:e.sourceInformation.endLine,endColumn:e.sourceInformation.endColumn}],this.uuid)}clearError(){this.codeError=void 0,Lc(this.uuid)}buildExtendBaseQuery(){const e=P(this._manager.getLatestSnapshot()).clone();return this.isGroupLevel||(e.data.leafExtendedColumns=[],e.data.selectColumns=[],e.data.filter=void 0,e.data.groupBy=void 0,e.data.pivot=void 0),e.data.groupExtendedColumns=[],e.data.sortColumns=[],e.data.limit=void 0,vl([],[Ml(e,this.view.source,this.view.engine,{skipExecutionContext:!0})])}async getReturnType(){this.validationState.inProgress(),this.clearError(),this.setReturnType(void 0);try{const e=await this.view.engine.getQueryCodeRelationReturnType(this.codePrefix+this.code+this.codeSuffix,this.buildExtendBaseQuery(),this.view.source);let t=Hi(e.columns,this._name)?.type;return t=t&&Ui(t)?t:void 0,this.setReturnType(t),t}catch(e){if(w(e),e instanceof Yp){if(this.validationState.fail(),e.sourceInformation){e.sourceInformation.startColumn-=1===e.sourceInformation.startLine?this.codePrefix.length:0,e.sourceInformation.endColumn-=1===e.sourceInformation.endLine?this.codePrefix.length:0;const t=this.editorModel.getFullModelRange();(e.sourceInformation.startLine<1||1===e.sourceInformation.startLine&&e.sourceInformation.startColumn<1||e.sourceInformation.endLine>t.endLineNumber||e.sourceInformation.endLine===t.endLineNumber&&e.sourceInformation.endColumn>t.endColumn)&&(e.sourceInformation.startColumn=t.startColumn,e.sourceInformation.startLine=t.startLineNumber,e.sourceInformation.endColumn=t.endColumn,e.sourceInformation.endLine=t.endLineNumber)}return void this.showError(e)}this.view.dataCube.alertService.alertError(e,{message:`Expression Validation Failure: ${e.message}`})}finally{this.validationState.complete()}}close(){this.editorModel.dispose(),this.editor?.dispose(),this.display.close()}}class Dg extends Bg{initialCode;constructor(e,t){super(e,`col_${e.allColumnNames.length+1}`,t?ji(t.type):gi.NUMBER,!1,t?t.kind:ii.MEASURE),this.initialCode=t?`${fi}|$${fi}.${t.name}`:`${fi}|`}async getInitialCode(){return this.initialCode}newDisplay(e){return this.view.dataCube.layoutService.newDisplay("Add New Column",(()=>(0,E.jsx)(Pg,{state:this})),{x:50,y:50,width:500,height:300,minWidth:300,minHeight:200,center:!1})}async applyChanges(){if(!this.validationState.hasCompleted||!this.isNameValid||!this.isTypeValid)return;let e,t;this.finalizationState.inProgress();try{[e,t]=await Promise.all([this.view.engine.parseValueSpecification(this.code,!1),this.getReturnType()])}catch(e){return w(e),void this.view.dataCube.alertService.alertError(e,{message:`Expression Validation Failure: ${e.message}`})}finally{this.finalizationState.complete()}e instanceof Ur?t?(this._manager.addNewColumn({name:this.name,type:t,mapFn:this.view.engine.serializeValueSpecification(e)},this.isGroupLevel,this.columnKind,this),this.close()):this.view.dataCube.alertService.alertError(new Error,{message:"Expression Validation Failure: Can't compute expression return type."}):this.view.dataCube.alertService.alertError(new Error,{message:"Expression Validation Failure: Expression must be a lambda."})}}class jg extends Bg{initialData;constructor(e,t,n,o){super(e,t.name,ji(t.type),o,n),(0,xe.Gn)(this,{initialData:xe.sH.ref,isNameValid:xe.$Z}),this.initialData={name:t.name,type:t.type,kind:n,isGroupLevel:o,mapFn:t.mapFn}}get isNameValid(){return!this._manager.allColumnNames.filter((e=>e!==this.initialData.name)).includes(this.name)}async getInitialCode(){return this.view.engine.getValueSpecificationCode(this.view.engine.deserializeValueSpecification(this.initialData.mapFn),!0)}newDisplay(e){return this.view.dataCube.layoutService.newDisplay("Edit Column",(()=>(0,E.jsx)(Pg,{state:this})),{x:50,y:50,width:500,height:300,minWidth:300,minHeight:200,center:!1})}async reset(){this.setName(this.initialData.name),this.setExpectedType(ji(this.initialData.type)),this.setColumnKind(this.initialData.isGroupLevel,this.initialData.kind),await this.initialize(),await this.getReturnType()}async applyChanges(){if(!this.validationState.hasCompleted||!this.isNameValid||!this.isTypeValid)return;let e,t;this.finalizationState.inProgress();try{[e,t]=await Promise.all([this.view.engine.parseValueSpecification(this.code,!1),this.getReturnType()])}catch(e){return w(e),void this.view.dataCube.alertService.alertError(e,{message:`Expression Validation Failure: ${e.message}`})}finally{this.finalizationState.complete()}e instanceof Ur?t?await this._manager.updateColumn(this.initialData.name,{name:this.name,type:t,mapFn:this.view.engine.serializeValueSpecification(e)},this.isGroupLevel,this.columnKind):this.view.dataCube.alertService.alertError(new Error,{message:"Expression Validation Failure: Can't compute expression return type."}):this.view.dataCube.alertService.alertError(new Error,{message:"Expression Validation Failure: Expression must be a lambda."})}}class Mg{name;type;data;constructor(e){this.name=e.name,this.type=e.type,this.data=e}}class Ug extends sp{view;columnConfigurations=[];selectColumns=[];sourceColumns=[];horizontalPivotCastColumns=[];leafExtendedColumns=[];groupExtendedColumns=[];newColumnEditors=[];existingColumnEditors=[];constructor(e){super(e.engine,e.settingService,e.snapshotService),(0,xe.Gn)(this,{sourceColumns:xe.sH.ref,horizontalPivotCastColumns:xe.sH.ref,leafExtendedColumns:xe.sH,setLeafExtendedColumns:xe.XI,groupExtendedColumns:xe.sH,setGroupExtendedColumns:xe.XI,allColumnNames:xe.EW,addNewColumn:xe.XI,updateColumn:xe.XI,deleteColumn:xe.XI,applySnapshot:xe.XI}),this.view=e}setLeafExtendedColumns(e){this.leafExtendedColumns=e}setGroupExtendedColumns(e){this.groupExtendedColumns=e}get allColumnNames(){return(0,tt.A)([...this.sourceColumns,...this.leafExtendedColumns,...this.groupExtendedColumns,...this.horizontalPivotCastColumns],(e=>e.name)).map((e=>e.name))}async openNewColumnEditor(e){const t=new Dg(this,e);await t.initialize(),this.newColumnEditors.push(t),t.display.open()}async openExistingColumnEditor(e){const t=this.existingColumnEditors.find((t=>t.initialData.name===e));if(t)return void t.display.open();if(!Hi(this.leafExtendedColumns,e)&&!Hi(this.groupExtendedColumns,e))return;const n=new jg(this,P(Hi(this.leafExtendedColumns,e)??Hi(this.groupExtendedColumns,e)).data,P(Hi(this.columnConfigurations,e)).kind,Boolean(Hi(this.groupExtendedColumns,e)));await n.initialize(),this.existingColumnEditors.push(n),n.display.open()}addNewColumn(e,t,n,o){const r=sd(e);n&&(r.kind=n,r.excludedFromPivot=n===ii.DIMENSION),this.columnConfigurations.push(r),S(this.newColumnEditors,o),t?this.groupExtendedColumns.push(new Mg(e)):(this.leafExtendedColumns.push(new Mg(e)),this.selectColumns.push(Wi(e))),this.applyChanges()}async updateColumn(e,t,n,o){if(!Hi(this.leafExtendedColumns,e)&&!Hi(this.groupExtendedColumns,e))return;const r=P(Hi(this.columnConfigurations,e)),i=this.view.taskService.newTask("Checking column update..."),a=P(this.getLatestSnapshot()).clone();a.data.leafExtendedColumns=a.data.leafExtendedColumns.filter((t=>t.name!==e)),a.data.groupExtendedColumns=a.data.groupExtendedColumns.filter((t=>t.name!==e)),a.data.selectColumns=a.data.selectColumns.filter((t=>t.name!==e)),n?a.data.groupExtendedColumns.push(t):(a.data.leafExtendedColumns.push(t),r.isSelected&&a.data.selectColumns.push(Wi(t))),a.data.configuration={...a.data.configuration,columns:this.columnConfigurations.map((n=>n.name===e?{...n.serialize(),...Wi(t),kind:o}:n.serialize()))};const s=await this._engine.getPartialQueryCode(a,!0);try{await this._engine.getQueryCodeRelationReturnType("->"+s,vl([],[this.view.source.query]),this.view.source)}catch(t){return w(t),void(t instanceof Yp?this.view.dataCube.alertService.alertCodeCheckError(t,s,"->",{message:`Column Update Check Failure: Can't safely update column '${e}'. Check the query code below for more details.`,text:`Error: ${t.message}`}):this.view.dataCube.alertService.alertError(t,{message:`Column Update Check Failure: Can't safely update column '${e}'.`,text:`Error: ${t.message}`}))}finally{this.view.taskService.endTask(i)}this.setLeafExtendedColumns(this.leafExtendedColumns.filter((t=>t.name!==e))),this.setGroupExtendedColumns(this.groupExtendedColumns.filter((t=>t.name!==e))),this.selectColumns=this.selectColumns.filter((t=>t.name!==e)),n?this.setGroupExtendedColumns([...this.groupExtendedColumns,new Mg(t)]):(this.setLeafExtendedColumns([...this.leafExtendedColumns,new Mg(t)]),r.isSelected&&this.selectColumns.push(Wi(t))),this.columnConfigurations=this.columnConfigurations.map((n=>(n.name===e&&(n.kind=o??ji(t.type)===gi.NUMBER?ii.MEASURE:ii.DIMENSION,n.name=t.name,n.type=t.type,n.excludedFromPivot=n.kind===ii.DIMENSION),n))),this.existingColumnEditors.filter((t=>t.initialData.name===e)).forEach((e=>e.display.close())),this.existingColumnEditors=this.existingColumnEditors.filter((t=>t.initialData.name!==e)),this.applyChanges()}async deleteColumn(e){if(!Hi(this.leafExtendedColumns,e)&&!Hi(this.groupExtendedColumns,e))return;const t=this.view.taskService.newTask("Checking column deletion..."),n=P(this.getLatestSnapshot()).clone();n.data.leafExtendedColumns=n.data.leafExtendedColumns.filter((t=>t.name!==e)),n.data.groupExtendedColumns=n.data.groupExtendedColumns.filter((t=>t.name!==e)),n.data.selectColumns=n.data.selectColumns.filter((t=>t.name!==e)),n.data.configuration={...n.data.configuration,columns:this.columnConfigurations.filter((t=>t.name!==e)).map((e=>e.serialize()))};const o=await this._engine.getPartialQueryCode(n,!0);try{await this._engine.getQueryCodeRelationReturnType("->"+o,vl([],[this.view.source.query]),this.view.source)}catch(t){return w(t),void(t instanceof Yp?this.view.dataCube.alertService.alertCodeCheckError(t,o,"->",{message:`Column Delete Check Failure: Can't safely delete column '${e}'. Check the query code below for more details.`,text:`Error: ${t.message}`}):this.view.dataCube.alertService.alertError(t,{message:`Column Delete Check Failure: Can't safely delete column '${e}'.`,text:`Error: ${t.message}`}))}finally{this.view.taskService.endTask(t)}this.setLeafExtendedColumns(this.leafExtendedColumns.filter((t=>t.name!==e))),this.setGroupExtendedColumns(this.groupExtendedColumns.filter((t=>t.name!==e))),this.columnConfigurations=this.columnConfigurations.filter((t=>t.name!==e)),this.selectColumns=this.selectColumns.filter((t=>t.name!==e)),this.existingColumnEditors.filter((t=>t.initialData.name===e)).forEach((e=>e.display.close())),this.existingColumnEditors=this.existingColumnEditors.filter((t=>t.initialData.name!==e)),this.applyChanges()}getSnapshotSubscriberName(){return"extend-manager"}async applySnapshot(e,t){const n=Xi.serialization.fromJson(e.data.configuration);this.columnConfigurations=n.columns,this.sourceColumns=e.data.sourceColumns,this.leafExtendedColumns=e.data.leafExtendedColumns.map((e=>new Mg(e))),this.groupExtendedColumns=e.data.groupExtendedColumns.map((e=>new Mg(e))),this.horizontalPivotCastColumns=e.data.pivot?.castColumns??[],this.selectColumns=e.data.selectColumns.map(Wi),[...this.newColumnEditors,...this.existingColumnEditors].forEach((e=>{e.getReturnType().catch((()=>{}))}))}applyChanges(){const e=P(this.getLatestSnapshot()),t=e.clone();t.data.configuration={...e.data.configuration,columns:this.columnConfigurations.map((e=>e.serialize()))},t.data.leafExtendedColumns=this.leafExtendedColumns.map((e=>e.data)),t.data.groupExtendedColumns=this.groupExtendedColumns.map((e=>e.data)),t.data.selectColumns=[...this.selectColumns],t.finalize(),t.hashCode!==e.hashCode&&this.publishSnapshot(t)}}class Gg{uuid=(0,i.A)();description;startTime=Date.now();ownerId;endTime;constructor(e,t){this.description=e,this.ownerId=t}end(){this.endTime=Date.now()}}class Vg{tasks=[];constructor(){(0,xe.Gn)(this,{tasks:xe.sH,newTask:xe.XI,endTask:xe.XI,endTasks:xe.XI})}newTask(e,t){const n=new Gg(e,t);return this.tasks.push(n),n}endTask(e){return this.tasks.find((t=>t.uuid===e.uuid))&&(this.tasks=this.tasks.filter((t=>t.uuid!==e.uuid)),e.end()),e}endTasks(e){this.tasks=this.tasks.filter((t=>!e.find((e=>e.uuid===t.uuid)))),e.forEach((e=>e.end()))}}class Hg{uuid=(0,i.A)();manager;constructor(e){(0,xe.Gn)(this,{tasks:xe.EW}),this.manager=e??new Vg}get tasks(){return this.manager.tasks.filter((e=>e.ownerId===this.uuid))}newTask(e){return this.manager.newTask(e,this.uuid)}endTask(e){return this.manager.endTask(e)}dispose(){this.manager.endTasks(this.tasks)}}class Wg extends Vl{model;runtime;db;schema;table;count}class $g{dataCube;engine;logService;taskService;layoutService;alertService;settingService;snapshotService;info;editor;grid;filter;extend;initializeState=Ie.create();processCacheState=Ie.create();_source;_initialSource;_initialSpecification;constructor(e){this.dataCube=e,this.engine=e.engine,this.logService=e.logService,this.taskService=new Hg(e.taskService.manager),this.layoutService=e.layoutService,this.alertService=e.alertService,this.settingService=e.settingService,this.snapshotService=new lp(this.logService,this.settingService),this.info=new rg(this),this.editor=new Kp(this),this.grid=new og(this),this.filter=new Lg(this),this.extend=new Ug(this)}getInitialSource(){return this._initialSource}async generateSpecification(){const e=this.snapshotService.getCurrentSnapshot(),t=new ad;return t.source=this.dataCube.specification.source,t.configuration=Xi.serialization.fromJson(e.data.configuration),t.query=await this.engine.getPartialQueryCode(e),t}get source(){if(!this._source)throw new x("Source is not initialized");return this._source}updateName(e){const t=this.snapshotService.getCurrentSnapshot(),n=t.clone(),o=Xi.serialization.fromJson(t.data.configuration);o.name!==e&&(o.name=e,n.data.configuration=o.serialize(),n.finalize(),n.hashCode!==t.hashCode&&this.snapshotService.broadcastSnapshot(n))}async applySpecification(e){const t=this.taskService.newTask("Applying specification...");try{if(!this._initialSource||!this._initialSpecification)throw new Error("DataCube is not initialized");if(!(0,Ro.A)(e.source,this._initialSpecification.source))throw new Error("Can't apply specification with different source");const t=await this.engine.parseValueSpecification(e.query),n=await cg(t,this._initialSource,e,this.engine);n.finalize(),n.hashCode!==this.snapshotService.getCurrentSnapshot().hashCode&&this.snapshotService.broadcastSnapshot(n)}catch(e){w(e),this.alertService.alertError(e,{message:`Specification Application Failure: ${e.message}`}),this.initializeState.fail()}finally{this.taskService.endTask(t)}}async initializeCache(){this.processCacheState.inProgress();const e=this.taskService.newTask("Initializing cache...");try{const e=await this.engine.initializeCache(this.source,{debug:this.settingService.getBooleanValue(du.DEBUGGER__ENABLE_DEBUG_MODE),clientVersion:this.settingService.getBooleanValue(du.DEBUGGER__USE_DEV_CLIENT_PROTOCOL_VERSION)?Ul.VX_X_X:void 0});e&&(this._source=e),this.processCacheState.pass()}catch(e){w(e),this.alertService.alertError(e,{message:`Cache Processing Failure: ${e.message}`}),this._source=this._initialSource,this.processCacheState.fail()}finally{this.taskService.endTask(e)}}async disposeCache(){if(!(this._source instanceof Wg))return;const e=this._source;this._source=this._initialSource,this.processCacheState.inProgress();const t=this.taskService.newTask("Disposing cache...");try{await this.engine.disposeCache(e)}catch(e){w(e),this.alertService.alertError(e,{message:`Cache Processing Failure: ${e.message}`})}finally{this.processCacheState.complete(),this.taskService.endTask(t)}}async initialize(e){this.initializeState.inProgress();const t=this.taskService.newTask("Initializing...");try{await Promise.all([this.info,this.editor,this.grid,this.grid.controller,this.filter,this.extend].map((async e=>{this.snapshotService.registerSubscriber(e)})));const t=await this.engine.processSource(e.source);this._source=t,this._initialSource=t,this._initialSpecification=e;const n=await this.engine.parseValueSpecification(e.query),o=await cg(n,t,e,this.engine);e.options?.autoEnableCache&&(await this.grid.setCachingEnabled(!0,{suppressWarning:!0}),this.grid.isCachingEnabled&&this.settingService.getBooleanValue(du.GRID_CLIENT__SHOW_AUTO_ENABLE_CACHE_PERFORMANCE_WARNING)&&this.alertService.alert({message:"Caching is auto-enabled for this DataCube",text:"When enabled, the source dataset will be cached locally in order to boost query performance. But depending on computational resource available to your environment, sometimes, caching can negatively impact the overall performance, and can even lead to crashes.\n\nOverall, caching is still an experimental feature where we only support queries with simple execution plans, certain queries might not work.\n\nYou can disable caching if needed, otherwise, please proceed with caution.",type:uu.WARNING,actions:[{label:"OK",handler:()=>{}},{label:"Disable Caching",handler:()=>{this.grid.setCachingEnabled(!1,{suppressWarning:!0}).catch((e=>this.alertService.alertUnhandledError(e)))}},{label:"Dismiss Warning",handler:()=>{this.settingService.updateValue(this.dataCube.api,du.GRID_CLIENT__SHOW_AUTO_ENABLE_CACHE_PERFORMANCE_WARNING,!1)}}],windowConfig:{...fr,width:600,height:300,minWidth:300,minHeight:150}})),this.snapshotService.broadcastSnapshot(o),this.dataCube.options?.onViewInitialized?.({api:this.dataCube.api,source:t}),this.initializeState.pass()}catch(e){w(e),this.alertService.alertError(e,{message:`Initialization Failure: ${e.message}`,text:"Resolve the issue and reload the engine."}),this.initializeState.fail()}finally{this.taskService.endTask(t)}}dispose(){this.taskService.dispose()}}var zg;!function(e){e.SETTINGS__FAILURE__FOUND_UNREGISTERED_SETTING="data-cube.settings.failure.found-unregistered-setting",e.SETTINGS__FAILURE__ASSIGN_INCOMPATIBLE_VALUE="data-cube.settings.failure.assign-incompatible-value",e.SETTINGS__FAILURE__RETRIEVE_INCOMPATIBLE_VALUE="data-cube.settings.failure.retrieve-incompatible-value"}(zg||(zg={}));const Yg=(0,bt.PA)((e=>{const{configuration:t}=e,n=$c(),o=n.settingService;switch(t.type){case qg.BOOLEAN:{const e=z(o.currentValues.get(t.key));return(0,E.jsxs)("div",{className:"my-2",children:[(0,E.jsx)("div",{className:"font-medium",children:t.title}),(0,E.jsx)("div",{className:"flex pr-2",children:(0,E.jsx)(Jc,{label:t.description,checked:e,onChange:()=>{(0,xe.h5)((()=>{o.currentValues.set(t.key,!e)}))}})})]})}case qg.NUMERIC:{const e=$(o.currentValues.get(t.key)),n=t.defaultValue;return(0,E.jsxs)("div",{className:"my-2",children:[(0,E.jsx)("div",{className:"font-medium",children:t.title}),(0,E.jsx)("div",{className:"mb-1.5 text-sm text-neutral-700",children:t.description}),(0,E.jsx)(Kc,{className:"w-20 text-sm",min:t.numericValueMin,step:t.numericValueStep,max:t.numericValueMax,defaultValue:n,value:e,setValue:e=>{(0,xe.h5)((()=>{o.currentValues.set(t.key,e??n)}))}})]})}case qg.STRING:{const e=W(o.currentValues.get(t.key));return(0,E.jsxs)("div",{className:"my-2",children:[(0,E.jsx)("div",{className:"font-medium",children:t.title}),(0,E.jsx)("div",{className:"mb-1.5 text-sm text-neutral-700",children:t.description}),(0,E.jsx)(qc,{className:"w-80 text-sm",value:e,onChange:e=>{(0,xe.h5)((()=>{o.currentValues.set(t.key,e.target.value)}))}})]})}case qg.ACTION:return(0,E.jsxs)("div",{className:"my-2",children:[(0,E.jsx)("div",{className:"font-medium",children:t.title}),(0,E.jsx)("div",{className:"mb-1.5 text-sm text-neutral-700",children:t.description}),(0,E.jsx)("div",{className:"flex pr-2",children:(0,E.jsx)(Xc,{compact:!0,onClick:()=>t.action?.(n.api,void 0),children:"Run Action"})})]});default:return null}})),Xg=(0,bt.PA)((()=>{const e=$c(),t=e.settingService,n=Array.from(t.configurations.values()).toSorted(((e,t)=>e.title.localeCompare(t.title)));return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{className:"h-[calc(100%_-_40px)] w-full p-2 pb-0",children:(0,E.jsxs)("div",{className:"h-full w-full select-none overflow-auto border border-neutral-300 bg-white p-2",children:[(0,E.jsx)("div",{className:"mt-1 flex h-5",children:(0,E.jsxs)("div",{className:"flex h-full",children:[(0,E.jsx)("div",{className:"flex h-5 items-center text-xl font-medium",children:(0,E.jsx)(dr.Table,{})}),(0,E.jsx)("div",{className:"ml-1 flex h-5 items-center text-xl font-medium",children:"Grid"})]})}),n.filter((e=>e.group===Kg.GRID)).map((e=>(0,E.jsx)(Yg,{configuration:e},e.key))),(0,E.jsx)("div",{className:"my-2 h-[1px] w-full bg-neutral-200"}),(0,E.jsx)("div",{className:"mt-1 flex h-5",children:(0,E.jsxs)("div",{className:"flex h-full",children:[(0,E.jsx)("div",{className:"flex h-5 items-center text-xl font-medium",children:(0,E.jsx)(dr.Debug,{})}),(0,E.jsx)("div",{className:"ml-1 flex h-5 items-center text-xl font-medium",children:"Debug"})]})}),n.filter((e=>e.group===Kg.DEBUG)).map((e=>(0,E.jsx)(Yg,{configuration:e},e.key)))]})}),(0,E.jsxs)("div",{className:"flex h-10 items-center justify-end px-2",children:[(0,E.jsx)(Xc,{onClick:()=>t.restoreDefaultValues(),disabled:!t.allowRestoreDefaultValues,children:"Restore Default Settings"}),(0,E.jsx)(Xc,{className:"ml-2",onClick:()=>{t.display.close()},children:"Cancel"}),(0,E.jsx)(Xc,{className:"ml-2",onClick:()=>t.save(e.api),children:"Apply"}),(0,E.jsx)(Xc,{className:"ml-2",onClick:()=>{t.save(e.api),t.display.close()},children:"OK"})]})]})}));var Kg,qg,Jg,Qg,Zg,em;!function(e){e.DEBUG="Debug",e.EDITOR="Editor",e.GRID="Grid"}(Kg||(Kg={})),function(e){e.BOOLEAN="boolean",e.NUMERIC="numeric",e.STRING="string",e.ACTION="action"}(qg||(qg={}));class tm{_engine;_logService;_layoutService;_options;display;configurations=new Map;defaultValues=new Map;_defaultValuesHashCode;values=new Map;currentValues=new Map;constructor(e,t,n,o){(0,xe.Gn)(this,{values:xe.sH,save:xe.XI,valuesHashCode:xe.EW,currentValues:xe.sH,restoreDefaultValues:xe.XI,currentValuesHashCode:xe.EW,allowRestoreDefaultValues:xe.EW}),this._engine=e,this._logService=t,this._layoutService=n,this._options=o,this.display=this._layoutService.newDisplay("Settings",(()=>(0,E.jsx)(Xg,{})),{x:-50,y:50,width:600,height:400,minWidth:300,minHeight:200,center:!1});const r=[{key:du.DEBUGGER__ENABLE_DEBUG_MODE,title:"Debug Mode: Enabled",description:"Enables debug logging when running data queries, updating snapshots, etc.",group:Kg.DEBUG,type:qg.BOOLEAN,defaultValue:!1},{key:du.DEBUGGER__USE_DEV_CLIENT_PROTOCOL_VERSION,title:"Use development client protocol version: Enabled",description:"Specifies if development client protocol version (vX_X_X) should be used for execution",group:Kg.DEBUG,type:qg.BOOLEAN,defaultValue:!1},{key:du.DEBUGGER__ACTION__RELOAD,title:"Reload",description:"Manually reload DataCube (keeping all states). This is needed when making changes to settings that require reloading to take effect.",group:Kg.DEBUG,type:qg.ACTION,action:e=>e.reload(),defaultValue:void 0},{key:du.GRID_CLIENT__SHOW_CACHE_PERFORMANCE_WARNING,title:"Caching Performance Warning: Enabled",description:"Alerts user of potential performance and resource-related issues that caching can cause when enabled.",group:Kg.GRID,type:qg.BOOLEAN,defaultValue:!0},{key:du.GRID_CLIENT__SHOW_AUTO_ENABLE_CACHE_PERFORMANCE_WARNING,title:"Caching (Auto-Enabled) Performance Warning: Enabled",description:"Alerts user that caching is auto-enabled for the DataCube and of potential performance and resource-related issues that caching can cause when enabled.",group:Kg.GRID,type:qg.BOOLEAN,defaultValue:!0},{key:du.EDITOR__MAX_HISTORY_STACK_SIZE,title:"Max History Stack Size",description:"Sets the number of maximum snapshots to store in edit history.",group:Kg.EDITOR,type:qg.NUMERIC,defaultValue:100,numericValueMin:10,numericValueStep:10,action:(e,t)=>e._runTaskForEachView((e=>{e.snapshotService.adjustHistorySize(t)}))},{key:du.GRID_CLIENT__SUPPRESS_LARGE_DATASET_WARNING,title:"Large Dataset Warning: Disabled",description:"Suggests user to enable pagination when handling large datasets to improve performance.",group:Kg.GRID,type:qg.BOOLEAN,defaultValue:!1},{key:du.GRID_CLIENT__ROW_BUFFER,title:"Row Buffer",description:"Sets the number of rows the grid renders outside of the viewable area. e.g. if the buffer is 10 and your grid is showing 50 rows (as that's all that fits on your screen without scrolling), then the grid will actually render 70 in total (10 extra above and 10 extra below). Then when you scroll, the grid will already have 10 rows ready and waiting to show, no redraw is needed. A low small buffer will make initial draws of the grid faster; whereas a big one will reduce the redraw visible vertically scrolling.",group:Kg.GRID,type:qg.NUMERIC,defaultValue:50,numericValueMin:10,numericValueStep:10,action:(e,t)=>e._runTaskForEachView((e=>{e.grid.client.updateGridOptions({rowBuffer:t})}))},{key:du.GRID_CLIENT__PURGE_CLOSED_ROW_NODES,title:"Refresh Group Node Data: Enabled",description:"Forces refresh data when group node is opened.",group:Kg.GRID,type:qg.BOOLEAN,defaultValue:!1,action:(e,t)=>e._runTaskForEachView((e=>{e.grid.client.updateGridOptions({purgeClosedRowNodes:t})}))},{key:du.GRID_CLIENT__ACTION__RETRY_FAILED_DATA_FETCHES,title:"Retry Failed Data Fetches: Action",description:"Manually re-runs all failed data fetches in the grid.",group:Kg.GRID,type:qg.ACTION,action:e=>e.retryFailedDataFetches(),defaultValue:void 0}],{configurations:i,values:a}=o?.settingsData??{};[...r,...i??[]].forEach((e=>{this.configurations.set(e.key,e),this.setValue(e.key,e.defaultValue,[this.defaultValues,this.values,this.currentValues])}));const s=a??{};Object.keys(s).forEach((e=>{const t=s[e];this.configurations.get(e)&&this.setValue(e,t,[this.values,this.currentValues])})),this._defaultValuesHashCode=this.computeValuesHashCode(this.defaultValues)}setValue(e,t,n){const o=this.configurations.get(e);if(!o)return this._logService.logWarning(c.create(zg.SETTINGS__FAILURE__FOUND_UNREGISTERED_SETTING),`Can't set value for unregistered setting '${e}'`),!1;switch(o.type){case qg.BOOLEAN:if(!(V(t)||void 0===t&&o.valueOptional))return this._logService.logWarning(c.create(zg.SETTINGS__FAILURE__FOUND_UNREGISTERED_SETTING),`Can't set value for setting '${e}': boolean value expected`),!1;break;case qg.NUMERIC:if(!(G(t)||void 0===t&&o.valueOptional))return this._logService.logWarning(c.create(zg.SETTINGS__FAILURE__FOUND_UNREGISTERED_SETTING),`Can't set value for setting '${e}': numeric value expected`),!1;break;case qg.STRING:if(!(U(t)||void 0===t&&o.valueOptional))return this._logService.logWarning(c.create(zg.SETTINGS__FAILURE__FOUND_UNREGISTERED_SETTING),`Can't set value for setting '${e}': string value expected`),!1;break;case qg.ACTION:return!1;default:throw new I(`Can't set value for unsupported setting type '${o.type}'`)}return n.forEach((n=>{(0,xe.h5)((()=>n.set(e,t)))})),!0}getConfiguration(e){const t=this.configurations.get(e);if(!t)throw this._logService.logWarning(c.create(zg.SETTINGS__FAILURE__FOUND_UNREGISTERED_SETTING),`Can't retrieve value for unregistered setting '${e}'`),new x(`Can't retrieve value for unregistered setting '${e}'`);return t}getBooleanValue(e){const t=this.values.get(e);if(this.getConfiguration(e).type!==qg.BOOLEAN||!V(t))throw this._logService.logWarning(c.create(zg.SETTINGS__FAILURE__RETRIEVE_INCOMPATIBLE_VALUE),`Can't retrieve boolean value for setting '${e}'`),new x(`Can't retrieve boolean value for setting '${e}'`);return t}getNumericValue(e){const t=this.values.get(e);if(this.getConfiguration(e).type!==qg.NUMERIC||!G(t))throw this._logService.logWarning(c.create(zg.SETTINGS__FAILURE__RETRIEVE_INCOMPATIBLE_VALUE),`Can't retrieve numeric value for setting '${e}'`),new x(`Can't retrieve numeric value for setting '${e}'`);return t}getStringValue(e){const t=this.values.get(e);if(this.getConfiguration(e).type!==qg.STRING||!U(t))throw this._logService.logWarning(c.create(zg.SETTINGS__FAILURE__RETRIEVE_INCOMPATIBLE_VALUE),`Can't retrieve string value for setting '${e}'`),new x(`Can't retrieve string value for setting '${e}'`);return t}computeValuesHashCode(e){return Lr(Array.from(e.entries()).toSorted(((e,t)=>e[0].localeCompare(t[0]))).map((([e,t])=>`${e}:${t}`)))}get valuesHashCode(){return this.computeValuesHashCode(this.values)}get currentValuesHashCode(){return this.computeValuesHashCode(this.currentValues)}get allowRestoreDefaultValues(){return this._defaultValuesHashCode!==this.currentValuesHashCode}restoreDefaultValues(){this.currentValues.clear(),this.defaultValues.forEach(((e,t)=>this.currentValues.set(t,e)))}getCurrentSettingValues(){const e={};return this.values.forEach(((t,n)=>{const o=this.configurations.get(n);o&&t!==o.defaultValue&&(e[n]=t)})),e}updateValue(e,t,n){const o=this.configurations.get(t);o?this.setValue(t,n,[this.values,this.currentValues])&&(this._options?.onSettingsChanged?.({api:e,values:this.getCurrentSettingValues()}),o.action?.(e,n)):this._logService.logWarning(c.create(zg.SETTINGS__FAILURE__FOUND_UNREGISTERED_SETTING),`Can't set value for unregistered setting '${t}'`)}save(e){const t=new Set;this.values.forEach(((e,n)=>{e!==this.currentValues.get(n)&&t.add(n)})),this.values.clear(),this.currentValues.forEach(((e,t)=>this.values.set(t,e))),this._options?.onSettingsChanged?.({api:e,values:this.getCurrentSettingValues()});let n=!1;for(const o of t){const t=this.configurations.get(o);t?.requiresReload&&(n=!0),t?.action&&t.action(e,this.values.get(o))}n&&e.reload()}}class nm{_dataCube;constructor(e){this._dataCube=e}_runTaskForEachView(e){e(this._dataCube.view)}getProcessedSource(){return this._dataCube.view.getInitialSource()}generateSpecification(){return this._dataCube.view.generateSpecification()}updateName(e){this._dataCube.view.updateName(e)}async applySpecification(e){await this._dataCube.view.applySpecification(e)}retryFailedDataFetches(){this._runTaskForEachView((e=>{e.grid.client.retryServerSideLoads()}))}reload(){this._dataCube.reload()}}!function(e){e.PROFILE="Profile",e.CLASS="Class",e.ENUMERATION="Enum",e.MEASURE="Measure",e.ASSOCIATION="Association",e.FUNCTION="function",e.MAPPING="Mapping",e.FLAT_DATA="FlatData",e.DATABASE="Database",e.SERVICE="Service",e.RUNTIME="Runtime",e.CONNECTION="Connection",e.FILE_GENERATION="FileGeneration",e.GENERATION_SPECIFICATION="GenerationSpecification",e.DATA_ELEMENT="Data",e.EXECUTION_ENVIRONMENT="ExecutionEnvironment"}(Jg||(Jg={})),function(e){e.JSON_MODEL_CONNECTION="JsonModelConnection",e.XML_MODEL_CONNECTION="XmlModelConnection",e.MODEL_CHAIN_CONNECTION="ModelChainConnection",e.RELATIONAL_DATABASE_CONNECTION="RelationalDatabaseConnection",e.FLAT_DATA_CONNECTION="FlatDataConnection"}(Qg||(Qg={})),(em=Zg||(Zg={})).PURE="Pure",em.CONNECTION="Connection",em.RUNTIME="Runtime",em.MAPPING="Mapping",em.SERVICE="Service",em.FLATDATA="FlatData",em.RELATIONAL="Relational",em.GENERATION_SPECIFICATION="GenerationSpecification",em.FILE_GENERATION_SPECIFICATION="FileGeneration",em.DATA="Data";const om={wordPattern:/(-?\d*\.\d\w*)|([^`~!@#%^$&*()\-=+[{\]}\\|;:'",.<>/?\s][^`~!@#%^&*()\-=+[{\]}\\|;:'",.<>/?\s]*)/,comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"<",close:">"},{open:"<<",close:">>"}],folding:{markers:{start:new RegExp("^\\s*//\\s*(?:(?:#?region\\b)|(?:<editor-fold\\b))"),end:new RegExp("^\\s*//\\s*(?:(?:#?endregion\\b)|(?:</editor-fold>))")}}};const rm=(0,bt.PA)((()=>{const e=$c().documentationService.currentEntry;if(!e)return null;const t=e.markdownText??e.text;return(0,E.jsxs)("div",{className:"h-full w-full overflow-auto bg-white p-4",children:[(0,E.jsx)("div",{className:"mb-3 text-2xl font-bold",children:e.title}),t&&(U(t)?(0,E.jsx)("div",{children:t}):(0,E.jsx)(On,{value:t}))]})}));class im{_engine;_layoutService;display;currentEntry;constructor(e,t){(0,xe.Gn)(this,{currentEntry:xe.sH,setCurrentEntry:xe.XI}),this._engine=e,this._layoutService=t,this.display=this._layoutService.newDisplay("Documentation",(()=>(0,E.jsx)(rm,{})),{x:-50,y:-50,width:400,height:400,minWidth:300,minHeight:200,center:!1})}getEntry(e){return this._engine.getDocumentationEntry(e)}setCurrentEntry(e){this.currentEntry=e}shouldDisplayDocumentationEntry(e){return Boolean(e.title&&(e.text??e.markdownText))}}class am{_engine;constructor(e){this._engine=e}sendTelemetry(e,t){this._engine.sendTelemetry(e,t)}}class sm{_engine;constructor(e){this._engine=e}openLink(e){this._engine.openLink(e)}}class lm{_engine;constructor(e){this._engine=e}logDebug(e,...t){this._engine.logDebug(e,...t)}debugProcess(e,...t){this._engine.debugProcess(e,...t)}logInfo(e,...t){this._engine.logInfo(e,...t)}logWarning(e,...t){this._engine.logWarning(e,...t)}logError(e,...t){this._engine.logError(e,...t)}logUnhandledError(e){this._engine.logUnhandledError(e)}logIllegalStateError(e,t){this._engine.logIllegalStateError(e,t)}}class cm{engine;logService;taskService;layoutService;settingService;documentationService;alertService;navigationService;telemetryService;specification;options;initializeState=Ie.create();api;uuid=(0,i.A)();view;constructor(e,t,n){(0,xe.Gn)(this,{uuid:xe.sH,reload:xe.XI}),this.engine=t,this.logService=new lm(this.engine),this.taskService=new Hg(n?.taskManager),this.layoutService=new br(n?.layoutManager),this.settingService=new tm(this.engine,this.logService,this.layoutService,n),this.documentationService=new im(this.engine,this.layoutService),this.alertService=new gu(this.logService,this.layoutService),this.navigationService=new sm(this.engine),this.telemetryService=new am(this.engine),this.api=new nm(this),this.specification=e,this.options=n,this.view=new $g(this)}async initialize(){if(this.initializeState.isInInitialState){this.initializeState.inProgress();try{this.options?.gridClientLicense&&yr.hFV.setLicenseKey(this.options.gridClientLicense),await(async(e,t)=>{Tr.editor.defineTheme(vc.DEFAULT_DARK,_c),Tr.editor.defineTheme(vc.SOLARIZED_DARK,Tc),Tr.editor.defineTheme(vc.GITHUB_DARK,Nc),Tr.editor.defineTheme(vc.GITHUB_DARK_DIMMED,Ac),Tr.editor.defineTheme(vc.GITHUB_LIGHT,Sc),Tr.editor.defineTheme(vc.MATERIAL_DEFAULT,yc),Tr.editor.defineTheme(vc.MATERIAL_DARKER,xc),Tr.editor.defineTheme(vc.ONE_DARK_PRO,Ic),Tr.editor.defineTheme(vc.ONE_DARK_PRO_DARKER,wc);const n=`Monospaced font '${e}' has not been loaded properly, code editor might not display properly`;await Promise.all([400,700].map((t=>document.fonts.load(`${t} 1em ${e}`)))).then((()=>{document.fonts.check(`1em ${e}`)?Tr.editor.remeasureFonts():t(new Error(n))})).catch((()=>t(new Error(n))))})(ti.ROBOTO_MONO,(e=>{throw e})),function(e){var t;Tr.languages.register({id:Fc.PURE}),Tr.languages.setLanguageConfiguration(Fc.PURE,om),Tr.languages.setMonarchTokensProvider(Fc.PURE,(t=e?.extraKeywords??[],{defaultToken:"invalid",tokenPostfix:".pure",keywords:[...t,"Schema","Table","Join","View","primaryKey","groupBy","mainTable","let","extends","true","false","projects",Jg.CLASS,Jg.ASSOCIATION,Jg.ENUMERATION,Jg.MEASURE,Jg.PROFILE,Jg.FUNCTION,Jg.MAPPING,Jg.RUNTIME,Jg.CONNECTION,Jg.FILE_GENERATION,Jg.GENERATION_SPECIFICATION,Jg.DATA_ELEMENT,Qg.JSON_MODEL_CONNECTION,Qg.MODEL_CHAIN_CONNECTION,Qg.XML_MODEL_CONNECTION,"include","EnumerationMapping","Pure","AssociationMapping","XStore","AggregationAware",Jg.SERVICE,Jg.FLAT_DATA,Jg.DATABASE,Qg.FLAT_DATA_CONNECTION,Qg.RELATIONAL_DATABASE_CONNECTION,"Relational"],operators:["=",">","<","!","~","?",":","==","<=",">=","&&","||","++","--","+","-","*","/","&","|","^","%","->","#{","}#","@","<<",">>"],languageStructs:["import","native"],identifier:/[a-zA-Z_$][\w$]*/,symbols:/[=><!~?:&|+\-*/^%#@]+/,escapes:/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,digits:/\d+(_+\d+)*/,octaldigits:/[0-7]+(_+[0-7]+)*/,binarydigits:/[0-1]+(_+[0-1]+)*/,hexdigits:/[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,multiplicity:/\[(?:[a-zA-Z0-9]+(?:\.\.(?:[a-zA-Z0-9]+|\*|))?|\*)\]/,package:/(?:[\w_]+::)+/,generics:/(?:(?:<\w+>)|(?:<[^:.@^()]+[^-]>))/,date:/%-?\d+(?:-\d+(?:-\d+(?:T(?:\d+(?::\d+(?::\d+(?:.\d+)?)?)?)(?:[+-][0-9]{4})?)))/,time:/%\d+(?::\d+(?::\d+(?:.\d+)?)?)?/,tokenizer:{root:[{include:"@pure"},{include:"@date"},{include:"@color"},[/^\s*###[\w]+/,Gl.PARSER],[/(@identifier)/,{cases:{"@languageStructs":Gl.LANGUAGE_STRUCT,"@keywords":`${Gl.KEYWORD}.$0`,"([a-zA-Z_$][\\w$]*)_((\\w+_(([a-zA-Z0-9]+)|(\\$[a-zA-Z0-9]+_[a-zA-Z0-9]+\\$)))__)*(\\w+_(([a-zA-Z0-9]+)|(\\$[a-zA-Z0-9]+_[a-zA-Z0-9]+\\$)))_":Gl.TYPE,"@default":Gl.IDENTIFIER}}],{include:"@whitespace"},[/[{}()[\]]/,"@brackets"],[/[<>](?!@symbols)/,"@brackets"],[/@symbols/,{cases:{"@operators":Gl.OPERATOR,"@default":Gl.IDENTIFIER}}],{include:"@number"},[/[;,.]/,Gl.DELIMITER],[/'([^'\\]|\\.)*$/,`${Gl.STRING}.invalid`],[/'/,Gl.STRING,"@string"],{include:"@characters"}],pure:[[/(@package\*)/,[Gl.PACKAGE]],[/(@package?)(@identifier)(@generics?)(\s*)(@multiplicity)/,[Gl.PACKAGE,Gl.TYPE,Gl.GENERICS,Gl.WHITESPACE,Gl.MULTIPLICITY]],[/(@package)(@identifier)(@generics?)/,[Gl.PACKAGE,Gl.TYPE,Gl.GENERICS]],[/([@^])(\s*)(@package?)(@identifier)(@generics?)(@multiplicity?)/,[`${Gl.TYPE}.operator`,Gl.WHITESPACE,Gl.PACKAGE,Gl.TYPE,Gl.GENERICS,Gl.MULTIPLICITY]],[/(\.\s*)(@identifier)/,[Gl.DELIMITER,Gl.PROPERTY]],[/(@identifier)(\s*=)/,[Gl.PROPERTY,Gl.OPERATOR]],[/(@identifier)(\.)(@identifier)/,[Gl.TYPE,Gl.OPERATOR,Gl.PROPERTY]],[/(@identifier)(\s*:)/,[Gl.PARAMETER,Gl.OPERATOR]],[/(let)(\s+)(@identifier)(\s*=)/,[Gl.KEYWORD,Gl.WHITESPACE,Gl.VARIABLE,Gl.OPERATOR]],[/(\$@identifier)/,[`${Gl.VARIABLE}.reference`]]],date:[[/(%latest)/,[`${Gl.DATE}.latest`]],[/(@date)/,[Gl.DATE]],[/(@time)/,[`${Gl.DATE}.time`]]],color:[[/(#[0-9a-fA-F]{6})/,[Gl.COLOR]]],number:[[/(@digits)[eE]([-+]?(@digits))?[fFdD]?/,`${Gl.NUMBER}.float`],[/(@digits)\.(@digits)([eE][-+]?(@digits))?[fFdD]?/,`${Gl.NUMBER}.float`],[/0[xX](@hexdigits)[Ll]?/,`${Gl.NUMBER}.hex`],[/0(@octaldigits)[Ll]?/,`${Gl.NUMBER}.octal`],[/0[bB](@binarydigits)[Ll]?/,`${Gl.NUMBER}.binary`],[/(@digits)[fFdD]/,`${Gl.NUMBER}.float`],[/(@digits)[lL]?/,Gl.NUMBER]],whitespace:[[/[ \t\r\n]+/,Gl.WHITESPACE],[/\/\*\*(?!\/)/,`${Gl.COMMENT}.doc`,"@doc"],[/\/\*/,Gl.COMMENT,"@comment"],[/\/\/.*$/,Gl.COMMENT]],comment:[[/[^/*]+/,Gl.COMMENT],[/\*\//,Gl.COMMENT,"@pop"],[/[/*]/,Gl.COMMENT]],doc:[[/[^/*]+/,`${Gl.COMMENT}.doc`],[/\/\*/,`${Gl.COMMENT}.doc.invalid`],[/\*\//,`${Gl.COMMENT}.doc`,"@pop"],[/[/*]/,`${Gl.COMMENT}.doc`]],string:[[/[^\\']+/,Gl.STRING],[/@escapes/,`${Gl.STRING}.escape`],[/\\./,`${Gl.STRING}.escape.invalid`],[/'/,Gl.STRING,"@pop"]],characters:[[/'[^\\']'/,Gl.STRING],[/(')(@escapes)(')/,[Gl.STRING,`${Gl.STRING}.escape`,Gl.STRING]],[/'/,`${Gl.STRING}.invalid`]]}}))}({}),this.options?.onInitialized?.(this),this.initializeState.pass()}catch(e){w(e),this.alertService.alertError(e,{message:`Initialization Failure: ${e.message}`,text:"Resolve the issue and reload the engine."}),this.initializeState.fail()}}else this.logService.logDebug("DataCube state is re-initialized")}dispose(){this.view.dispose(),this.layoutService.dispose(),this.taskService.dispose()}reload(){this.view=new $g(this),this.uuid=(0,i.A)()}}const um=(0,bt.PA)((()=>{const e=$c(),t=e.view;return(0,Lt.useEffect)((()=>{e.view.initialize(e.specification).catch((t=>e.logService.logUnhandledError(t)))}),[e]),(0,E.jsxs)("div",{className:"data-cube relative flex h-full w-full flex-col bg-white",children:[(0,E.jsx)(tp,{title:t.info.name,menuItems:[{label:"Undo",action:()=>e.view.snapshotService.undo(),disabled:!e.view.snapshotService.canUndo},{label:"Redo",action:()=>e.view.snapshotService.redo(),disabled:!e.view.snapshotService.canRedo},{label:"Settings...",action:()=>e.settingService.display.open()}],getMenuItems:e.options?.getHeaderMenuItems,children:e.options?.innerHeaderRenderer?.({api:e.api})??null}),(0,E.jsx)(ip,{view:t}),(0,E.jsx)(_r,{layout:e.layoutService.manager}),(0,E.jsx)(Sr,{})]})})),dm=(0,bt.PA)((e=>{const{specification:t,engine:n,options:o}=e,r=(0,bt.iz)((()=>new cm(t,n,o)));return(0,Lt.useEffect)((()=>(r.initialize().catch((e=>r.logService.logUnhandledError(e))),()=>r.dispose())),[r]),r.initializeState.hasSucceeded?(0,E.jsx)(Wc,{value:r,children:(0,E.jsx)(um,{},r.uuid)}):(0,E.jsx)(rp,{title:Ei,headerContent:r.options?.innerHeaderRenderer?.({api:r.api})??null,layoutManager:r.layoutService.manager,taskManager:r.taskService.manager,children:r.initializeState.hasFailed&&(0,E.jsx)(np,{message:"Initialization Failure",prompt:"Resolve the issue and reload."})})}));class pm extends Vl{runtime;mapping;timestamp;model;isLocal;isPersistenceSupported}const gm="repl";class mm{query;runtime;model;mapping;timestamp;isLocal;isPersistenceSupported;columns=[];static serialization=new ge((0,pe.PL)(mm,{_type:he(gm),columns:(0,pe.p_)((0,pe.lS)()),isLocal:(0,pe.MY)(),isPersistenceSupported:(0,pe.MY)(),mapping:(0,pe.lq)((0,pe.MY)()),model:(0,pe.lq)((0,pe.lS)()),query:(0,pe.MY)(),runtime:(0,pe.MY)(),timestamp:(0,pe.MY)()}))}class hm{networkClient;constructor(e){this.networkClient=e}get baseUrl(){return P(this.networkClient.baseUrl,"REPL server client has not been configured properly")}get dataCube(){return`${this.baseUrl}/api/dataCube`}async getInfrastructureInfo(){return this.networkClient.get(`${this.dataCube}/infrastructureInfo`)}async getQueryTypeahead(e){return this.networkClient.post(`${this.dataCube}/typeahead`,e)}async parseValueSpecification(e){return this.networkClient.post(`${this.dataCube}/parseValueSpecification`,e)}async getValueSpecificationCode(e){return this.networkClient.post(`${this.dataCube}/getValueSpecificationCode`,e,{},{[Z.ACCEPT]:ee.TEXT_PLAIN})}async getBaseSpecification(){return this.networkClient.get(`${this.dataCube}/getBaseQuery`)}async getQueryRelationReturnType(e){return this.networkClient.post(`${this.dataCube}/getRelationReturnType`,e)}async getQueryCodeRelationReturnType(e){return this.networkClient.post(`${this.dataCube}/getRelationReturnType/code`,e)}async executeQuery(e){return this.networkClient.post(`${this.dataCube}/executeQuery`,e)}async publishQuery(e,t){return this.networkClient.post(`${t}`,e)}}class fm{query;runtime;model;static serialization=new ge((0,pe.PL)(fm,{_type:he("adhocQuery"),model:(0,pe.lS)(),query:(0,pe.MY)(),runtime:(0,pe.MY)()}))}class Em{runtime;model;functionPath;static serialization=new ge((0,pe.PL)(Em,{_type:he("userDefinedFunction"),model:(0,pe.lS)(),runtime:(0,pe.lq)((0,pe.MY)()),functionPath:(0,pe.MY)()}))}class Cm{id;name;description;content;owner;lastUpdatedAt;createdAt;lastOpenAt;static serialization=new ge((0,pe.PL)(Cm,{id:(0,pe.MY)(),lastUpdatedAt:(0,pe.lq)((0,pe.MY)()),createdAt:(0,pe.lq)((0,pe.MY)()),lastOpenAt:(0,pe.lq)((0,pe.MY)()),name:(0,pe.MY)(),description:(0,pe.lq)((0,pe.MY)()),content:(0,pe.lS)(),owner:(0,pe.lq)((0,pe.MY)())}));clone(){return Cm.serialization.fromJson(Cm.serialization.toJson(this))}}class bm{id;name;description;owner;lastUpdatedAt;createdAt;lastOpenAt;static serialization=new ge((0,pe.PL)(bm,{id:(0,pe.MY)(),lastUpdatedAt:(0,pe.lq)((0,pe.MY)()),createdAt:(0,pe.lq)((0,pe.MY)()),lastOpenAt:(0,pe.lq)((0,pe.MY)()),name:(0,pe.MY)(),description:(0,pe.lq)((0,pe.MY)()),owner:(0,pe.lq)((0,pe.MY)())}))}const vm=e=>{const{persistentDataCube:t}=e,n=ph(),o=n.hostedApplicationBaseUrl?`${n.hostedApplicationBaseUrl}/${t.id}`:void 0;return(0,E.jsxs)("div",{className:"h-full w-full p-6",children:[(0,E.jsxs)("div",{className:"flex w-full overflow-auto",children:[(0,E.jsx)("div",{className:"mr-3",children:(0,E.jsx)(dr.AlertSuccess,{className:"flex-shrink-0 stroke-[0.5px] text-[40px] text-green-500"})}),(0,E.jsxs)("div",{children:[(0,E.jsx)("div",{className:"whitespace-break-spaces text-lg",children:"Published DataCube successfully!"}),o&&(0,E.jsx)("div",{className:"mt-1 whitespace-break-spaces text-neutral-500",children:"To view or share the published DataCube, use the link below."}),!o&&(0,E.jsx)("div",{className:"mt-1 whitespace-break-spaces text-neutral-500",children:"See the published DataCube ID below."})]})]}),o&&(0,E.jsxs)("div",{className:"mt-3 flex h-6 w-full",children:[(0,E.jsx)("div",{className:"flex h-full w-[calc(100%_-_20px)] items-center border border-r-0 border-neutral-400 px-1.5 font-bold text-sky-500 underline",children:(0,E.jsx)("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"overflow-hidden overflow-ellipsis whitespace-nowrap",children:o})}),(0,E.jsx)("button",{className:"flex aspect-square h-full w-6 items-center justify-center border border-neutral-400 bg-neutral-300 hover:brightness-95",onClick:()=>{n.application.clipboardService.copyTextToClipboard(o).catch(n.application.alertUnhandledError)},title:"Copy Link",children:(0,E.jsx)(dr.Clipboard,{})})]}),!o&&(0,E.jsxs)("div",{className:"mt-3 flex h-6 w-full",children:[(0,E.jsx)("div",{className:"flex h-full w-[calc(100%_-_20px)] items-center border border-r-0 border-neutral-400 bg-neutral-200 px-1.5",children:(0,E.jsx)("div",{className:"overflow-hidden overflow-ellipsis whitespace-nowrap",children:t.id})}),(0,E.jsx)("button",{className:"flex aspect-square h-full w-6 items-center justify-center border border-neutral-400 bg-neutral-300 hover:brightness-95",onClick:()=>{n.application.clipboardService.copyTextToClipboard(t.id).catch(n.application.alertUnhandledError)},title:"Copy ID",children:(0,E.jsx)(dr.Clipboard,{})})]})]})};class _m{sourceId;startLine;startColumn;endLine;endColumn;constructor(e,t,n,o,r){this.sourceId=e,this.startLine=t,this.startColumn=n,this.endLine=o,this.endColumn=r}}var Tm,Nm,Sm,Am;!function(e){e.COMPILATION="COMPILATION",e.PARSER="PARSER"}(Tm||(Tm={}));class ym{message="";errorType;sourceInformation;static serialization=new ge((0,pe.PL)(ym,{errorType:(0,pe.lq)((0,pe.MY)()),message:(0,pe.MY)(),sourceInformation:me(Da.schema)}))}!function(e){e.CLASS_BUILDER="classBuilder",e.TDS_BUILDER="tdsBuilder",e.JSON_BUILDER="json"}(Nm||(Nm={})),function(e){e.RELATIONAL="relational",e.RELATIONAL_EXECUTION_ACTIVITY="RelationalExecutionActivity",e.AGGREGATION_AWARE_ACTIVITY="aggregationAware"}(Sm||(Sm={})),function(e){e.CSV="CSV"}(Am||(Am={}));class xm{_type;constructor(e){this._type=e}}class Im{}class wm extends Im{sql;comment;constructor(e){super(),this.sql=e}}class km extends Im{rewrittenQuery}class Rm extends Im{values;constructor(e){super(),this.values=e}}class Om{builder;activities}class Lm extends Om{values}class Fm extends Om{value;constructor(e){super(),this.value=e}}class Pm{name;type;relationalType;doc}class Bm extends xm{columns=[];constructor(){super(Nm.TDS_BUILDER)}}class Dm{values=[]}class jm{columns=[];rows=[]}class Mm extends Om{_UUID=(0,i.A)();builder=new Bm;result=new jm}class Um extends xm{_type=Nm.CLASS_BUILDER}class Gm extends Om{builder=new Um(Nm.CLASS_BUILDER);objects}class Vm{static builderSerialization=new ge((0,pe.PL)(Vm,{_type:(0,pe.MY)()}))}class Hm{}class Wm extends Hm{sql;comment;static serialization=new ge((0,pe.PL)(Wm,{sql:(0,pe.MY)(),comment:(0,pe.lq)((0,pe.MY)())}))}class $m extends Hm{rewrittenQuery;static serialization=new ge((0,pe.PL)($m,{rewrittenQuery:(0,pe.MY)()}))}class zm{builder;activities}class Ym extends Hm{content;constructor(e){super(),this.content=e}}class Xm extends zm{values;static serialization=new ge((0,pe.PL)(Xm,{_type:(0,pe.MY)(),builder:me(Vm.builderSerialization.schema),values:(0,pe.lS)()}))}class Km{name;doc;type;relationalType;static serialization=new ge((0,pe.PL)(Km,{name:(0,pe.MY)(),doc:(0,pe.lq)((0,pe.MY)()),type:(0,pe.lq)((0,pe.MY)()),relationalType:(0,pe.lq)((0,pe.MY)())}))}class qm extends Vm{columns=[];static serialization=new ge((0,pe.PL)(qm,{_type:(0,pe.MY)(),columns:(0,pe.p_)(me(Km.serialization.schema))}))}function Jm(e){switch(e._type){case Sm.RELATIONAL:case Sm.RELATIONAL_EXECUTION_ACTIVITY:return Wm.serialization.fromJson(e);case Sm.AGGREGATION_AWARE_ACTIVITY:return $m.serialization.fromJson(e);default:return new Ym(e)}}class Qm extends zm{result;static serialization=new ge((0,pe.PL)(Qm,{builder:me(qm.serialization.schema),activities:(0,pe.p_)((0,pe.Ie)((()=>pe._Z),Jm)),result:(0,pe.lS)()}))}class Zm extends zm{objects;static serialization=new ge((0,pe.PL)(Zm,{builder:me(Vm.builderSerialization.schema),activities:(0,pe.p_)((0,pe.Ie)((()=>pe._Z),Jm)),objects:(0,pe.lS)()}))}class eh extends zm{value;constructor(e){super(),this.value=e}}class th extends zm{content}class nh extends Om{content}const oh=e=>{if(e instanceof Wm){const t=new wm(e.sql);return t.comment=e.comment,t}if(e instanceof $m){const t=new km;return t.rewrittenQuery=P(e.rewrittenQuery,"Aggregation aware execution activities 'rewritenQuery' field is missing"),t}if(e instanceof Ym)return new Rm(e);throw new I("Can't build execution activities",e)},rh=e=>{const t=new Pm;return t.name=P(e.name,"TDS column 'name' field is missing"),t.type=e.type,t.doc=e.doc,t.relationalType=e.relationalType,t},ih=e=>{if(e instanceof th){const t=new nh;return t.content=e.content,t}if(e instanceof Zm)return(e=>{const t=new Gm;return t.objects=P(e.objects,"Class execution result 'objects' field is missing"),t.activities=e.activities?.map(oh),t})(e);if(e instanceof Qm)return(e=>{const t=new Mm;return t.builder=(e=>{const t=new Bm;return t.columns=e.columns.map(rh),t})(P(e.builder,"TDS execution result 'builder' field is missing")),t.activities=e.activities?.map(oh),t.result.columns=e.result.columns,t.result.rows=e.result.rows.map((e=>{const t=new Dm;return t.values=e.values,t})),t})(e);if(e instanceof Xm)return(e=>{const t=new Lm;return t.values=P(e.values,"JSON execution result 'values' field is missing"),t})(e);if(e instanceof eh)return new Fm(e.value);throw new I("Can't build execution result",e)},ah=e=>{if(null===e||U(e)||G(e)||V(e))return new eh(e);switch(e.builder?._type){case Nm.CLASS_BUILDER:return Zm.serialization.fromJson(e);case Nm.TDS_BUILDER:return Qm.serialization.fromJson(e);case Nm.JSON_BUILDER:return Xm.serialization.fromJson(e);default:{const t=new th;return t.content=e,t}}};class sh extends ud{_application;_client;constructor(e,t){super(),this._application=e,this._client=t}async processSource(e){if(e._type===gm){const t=mm.serialization.fromJson(e),n=new pm;n.query=await this.parseValueSpecification(t.query,!1);try{n.columns=(await this._getQueryRelationType(vl([],[n.query]))).columns}catch(e){throw w(e),new Error(`Can't get query result columns. Make sure the source query return a relation (i.e. typed TDS). Error: ${e.message}`)}return n.runtime=t.runtime,n.mapping=t.mapping,n.timestamp=t.timestamp,n.model=t.model,n.isLocal=t.isLocal,n.isPersistenceSupported=t.isPersistenceSupported,n}throw new I(`Can't process query source of type '${e._type}'.`)}async parseValueSpecification(e,t){return this.deserializeValueSpecification(await this._client.parseValueSpecification({code:e,returnSourceInformation:t}))}async getValueSpecificationCode(e,t){return this._client.getValueSpecificationCode({value:this.serializeValueSpecification(e),pretty:t})}async getQueryTypeahead(e,t,n){return this._client.getQueryTypeahead({code:e,baseQuery:this.serializeValueSpecification(t)})}async getQueryRelationReturnType(e,t){return this._getQueryRelationType(e)}async getQueryCodeRelationReturnType(e,t,n){try{return{columns:(0,pe.iu)(ps,await this._client.getQueryCodeRelationReturnType({code:e,baseQuery:this.serializeValueSpecification(t)})).columns.map((e=>({name:e.name,type:os(e.genericType)})))}}catch(e){if(w(e),e instanceof re&&e.response.status===J.BAD_REQUEST)throw(e=>{const t=new Yp(e.message);return t.sourceInformation=e.sourceInformation?(n=e.sourceInformation,new _m(P(n.sourceId,"Source information 'sourceId' field is missing"),P(n.startLine,"Source information 'startLine' field is missing"),P(n.startColumn,"Source information 'startColumn' field is missing"),P(n.endLine,"Source information 'endLine' field is missing"),P(n.endColumn,"Source information 'endColumn' field is missing"))):void 0,t;var n})(ym.serialization.fromJson(e.payload));throw e}}async executeQuery(e,t,n){const o=performance.now(),r=await this._client.executeQuery({query:this.serializeValueSpecification(e),debug:n?.debug}),i=performance.now();return{result:D(ih(ah(JSON.parse(r.result))),Mm),executedQuery:r.executedQuery,executedSQL:r.executedSQL,executionTime:i-o}}buildExecutionContext(e){if(e instanceof pm)return Nl(Zr.FROM,[e.mapping?yl(e.mapping):void 0,yl(e.runtime)].filter(L))}async _getQueryRelationType(e){return{columns:(0,pe.iu)(ps,await this._client.getQueryRelationReturnType({query:this.serializeValueSpecification(e)})).columns.map((e=>({name:e.name,type:os(e.genericType)})))}}logDebug(e,...t){this._application.logService.debug(c.create(de.DEBUG),e,...t)}debugProcess(e,...t){this._application.logService.debug(c.create(de.DEBUG),`\n------ START DEBUG PROCESS: ${e} ------`,...t.flatMap((([e,t])=>[`\n[${e.toUpperCase()}]:`,t])),`\n------- END DEBUG PROCESS: ${e} -------\n\n`)}logInfo(e,...t){this._application.logService.info(e,...t)}logWarning(e,...t){this._application.logService.warn(e,...t)}logError(e,...t){this._application.logService.error(e,...t)}logUnhandledError(e){this._application.logUnhandledError(e)}logIllegalStateError(e,t){this.logError(c.create(de.ILLEGAL_APPLICATION_STATE_OCCURRED),e,t)}getDocumentationEntry(e){return this._application.documentationService.getDocEntry(e)}openLink(e){this._application.navigationService.navigator.visitAddress(e)}sendTelemetry(e,t){this._application.telemetryService.logEvent(e,t)}}class lh{_client;application;engine;taskService;layoutService;alertService;initializeState=Ie.create();publishState=Ie.create();source;gridClientLicense;queryServerBaseUrl;hostedApplicationBaseUrl;specification;constructor(e){(0,xe.Gn)(this,{specification:xe.sH,setSpecification:xe.XI,source:xe.sH,setSource:xe.XI}),this.application=e,this._client=new hm(new se({baseUrl:e.config.useDynamicREPLServer?window.location.origin+P(e.config.baseAddress).replace("/repl/",""):e.config.replUrl})),this.engine=new sh(this.application,this._client),this.taskService=new Hg,this.layoutService=new br,this.alertService=new gu(new lm(this.engine),this.layoutService)}setSpecification(e){this.specification=e}setSource(e){this.source=e}async initialize(){const e=this.taskService.newTask("Initialize REPL");this.initializeState.inProgress();try{const e=await this._client.getInfrastructureInfo();e.currentUser&&this.application.identityService.setCurrentUser(e.currentUser),this.application.telemetryService.setup(),this.queryServerBaseUrl=e.queryServerBaseUrl,this.hostedApplicationBaseUrl=e.hostedApplicationBaseUrl,this.gridClientLicense=e.gridClientLicense,this.setSpecification(ad.serialization.fromJson(await this._client.getBaseSpecification())),this.initializeState.pass()}catch(e){w(e),this.application.logService.error(c.create(de.APPLICATION_LOAD__FAILURE),"Can't initialize REPL",e),this.alertService.alertError(e,{message:`Initialization Failure: ${e.message}`,text:"Resolve the issue and reload the engine."}),this.initializeState.fail()}finally{this.taskService.endTask(e)}}async publishDataCube(e){if(!this.queryServerBaseUrl||!(this.source instanceof pm)||!this.source.isPersistenceSupported||!this.source.model||this.source.isLocal)return;this.publishState.inProgress();const t=this.taskService.newTask("Publish query");try{const t=await e.generateSpecification(),n=new fm;n.query=mm.serialization.fromJson(t.source).query,n.runtime=this.source.runtime,n.model=this.source.model,t.source=fm.serialization.toJson(n);const o=new Cm;o.id=(0,i.A)(),o.name=t.configuration?.name??Ei,o.content=ad.serialization.toJson(t),o.owner=this.application.identityService.currentUser;const r=Cm.serialization.fromJson(await this._client.publishQuery(Cm.serialization.toJson(o),this.queryServerBaseUrl)),a=new gr(new pr("Publish Query",(()=>(0,E.jsx)(vm,{persistentDataCube:r}))));a.configuration.window={width:420,height:150,minWidth:300,minHeight:100,center:!0},this.layoutService.newWindow(a)}catch(e){w(e),this.alertService.alertError(e,{message:"Persistence Failure: Can't publish query.",text:`Error: ${e.message}`})}finally{this.taskService.endTask(t),this.publishState.complete()}}}const ch=(0,bt.PA)((e=>{const{children:t,simple:n}=e,o=P((0,Lt.useContext)(or),"Can't find application platform in context"),r=Pt();return(0,Lt.useEffect)((()=>{r.initialize(o).catch(r.alertUnhandledError)}),[r,o]),r.initState.hasSucceeded?n?(0,E.jsx)(io,{children:t}):(0,E.jsx)(ro,{children:t}):(0,E.jsx)(E.Fragment,{})})),uh=(0,Lt.createContext)(void 0),dh=({children:e})=>{const t=Pt(),n=(0,bt.iz)((()=>new lh(t)));return(0,E.jsx)(uh.Provider,{value:n,children:e})},ph=()=>P((0,Lt.useContext)(uh),"Can't find Legend REPL base store in context"),gh=({children:e})=>(0,E.jsx)(ch,{simple:!0,children:(0,E.jsx)(dh,{children:e})}),mh=(0,bt.PA)((e=>{const{api:t}=e,n=ph();if(!n.source||!n.queryServerBaseUrl)return null;const o=n.source instanceof pm&&n.source.isPersistenceSupported&&!n.source.isLocal;return(0,E.jsx)("div",{className:"flex h-full items-center",children:(0,E.jsx)(Xc,{compact:!0,disabled:!o||n.publishState.isInProgress,onClick:()=>{n.publishDataCube(t).catch((e=>n.alertService.alertUnhandledError(e)))},children:"Publish"})})}));var hh;!function(e){e.DATA_CUBE="data-cube"}(hh||(hh={}));const fh=(0,bt.PA)((e=>{const{specification:t}=e,n=ph(),o=n.application;return(0,Lt.useEffect)((()=>(o.navigationService.navigator.blockNavigation([()=>!0],void 0,(()=>{o.logService.warn(c.create(de.NAVIGATION_BLOCKED),"Navigation from the application is blocked")})),()=>{o.navigationService.navigator.unblockNavigation()})),[o]),(0,E.jsx)(dm,{specification:t,engine:n.engine,options:{gridClientLicense:n.gridClientLicense,layoutManager:n.layoutService.manager,taskManager:n.taskService.manager,onNameChanged(e){const t=e.source instanceof pm?e.source.timestamp:void 0;o.layoutService.setWindowTitle(`⊞ ${name}${t?` - ${(0,Xn.GP)(new Date(t),"HH:mm:ss EEE MMM dd yyyy")}`:""}`)},onViewInitialized(e){n.setSource(e.source)},innerHeaderRenderer:e=>(0,E.jsx)(mh,{api:e.api}),getHeaderMenuItems:()=>[{label:"See Documentation",action:()=>{o.documentationService.url&&o.navigationService.navigator.visitAddress(o.documentationService.url)},disabled:!o.documentationService.url}],settingsData:{values:o.settingService.getObjectValue(hh.DATA_CUBE)},onSettingsChanged(e){o.settingService.persistValue(hh.DATA_CUBE,e.values)}}})})),Eh=Object.freeze({DATA_CUBE:"/dataCube"}),Ch=(0,bt.PA)((()=>{const e=ph();return(0,Lt.useEffect)((()=>{e.initialize().catch((t=>e.application.alertUnhandledError(t)))}),[e]),e.initializeState.hasSucceeded?(0,E.jsx)("div",{className:"h-full",children:e.specification&&(0,E.jsx)(Qo.BV,{children:(0,E.jsx)(Qo.qh,{path:Eh.DATA_CUBE,element:(0,E.jsx)(fh,{specification:e.specification})})})}):(0,E.jsxs)(rp,{title:Ei,layoutManager:e.layoutService.manager,taskManager:e.taskService.manager,children:[e.initializeState.isInProgress&&(0,E.jsx)("div",{className:"h-full w-full p-2",children:(0,E.jsx)("div",{children:"Initializing..."})}),e.initializeState.hasFailed&&(0,E.jsx)(np,{message:"Initialization Failure",prompt:"Resolve the issue and reload."})]})})),bh=e=>{const{baseUrl:t}=e;return(0,E.jsx)(ir,{baseUrl:t,children:(0,E.jsx)(gh,{children:(0,E.jsx)(Ch,{})})})};class vh extends Ho{static create(){const e=new vh(new $o);return e.withBasePlugins([new Xo]),e}async configureApplication(e){return new qo(e)}async loadApplication(e){(0,C.createRoot)((()=>{let e=document.getElementsByTagName(Wo).length?document.getElementsByTagName(Wo)[0]:void 0;return e||(e=document.createElement(Wo),document.body.appendChild(e)),e.setAttribute("style","height: 100%; width: 100%; display: block"),e})()).render((0,E.jsx)(Bt,{store:e,children:(0,E.jsx)(bh,{baseUrl:this.baseAddress})}))}}class _h{static getPresetCollection(){return[]}static getPluginCollection(){return[new f]}static run(e){vh.create().setup({baseAddress:e}).withPresets(_h.getPresetCollection()).withPlugins(_h.getPluginCollection()).start().catch((e=>{throw e}))}}const Th=new URL("./",window.location.href).pathname;_h.run(Th)},59135:(e,t,n)=>{var o={"./editorBaseApi":[37970],"./editorBaseApi.js":[37970],"./editorSimpleWorker":[41122],"./editorSimpleWorker.js":[41122],"./editorWorker":[22143],"./editorWorker.js":[22143],"./editorWorkerHost":[70869],"./editorWorkerHost.js":[70869],"./findSectionHeaders":[97716],"./findSectionHeaders.js":[97716],"./getIconClasses":[45555],"./getIconClasses.js":[45555],"./languageFeatureDebounce":[26973],"./languageFeatureDebounce.js":[26973],"./languageFeatures":[33653],"./languageFeatures.js":[33653],"./languageFeaturesService":[78330],"./languageFeaturesService.js":[78330],"./languageService":[22155],"./languageService.js":[22155],"./languagesAssociations":[25709],"./languagesAssociations.js":[25709],"./languagesRegistry":[35074],"./languagesRegistry.js":[35074],"./markerDecorations":[86259],"./markerDecorations.js":[86259],"./markerDecorationsService":[72524],"./markerDecorationsService.js":[72524],"./model":[16911],"./model.js":[16911],"./modelService":[91320],"./modelService.js":[91320],"./resolverService":[55387],"./resolverService.js":[55387],"./semanticTokensDto":[7029,121],"./semanticTokensDto.js":[7029,121],"./semanticTokensProviderStyling":[4399],"./semanticTokensProviderStyling.js":[4399],"./semanticTokensStyling":[74566],"./semanticTokensStyling.js":[74566],"./semanticTokensStylingService":[28843],"./semanticTokensStylingService.js":[28843],"./textModelSync/textModelSync.impl":[43481],"./textModelSync/textModelSync.impl.js":[43481],"./textModelSync/textModelSync.protocol":[37619,121],"./textModelSync/textModelSync.protocol.js":[37619,121],"./textResourceConfiguration":[93533],"./textResourceConfiguration.js":[93533],"./treeSitterParserService":[47105],"./treeSitterParserService.js":[47105],"./treeViewsDnd":[29740,121],"./treeViewsDnd.js":[29740,121],"./treeViewsDndService":[95621,121],"./treeViewsDndService.js":[95621,121],"./unicodeTextModelHighlighter":[14818],"./unicodeTextModelHighlighter.js":[14818]};function r(e){if(!n.o(o,e))return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=o[e],r=t[0];return Promise.all(t.slice(1).map(n.e)).then((()=>n(r)))}r.keys=()=>Object.keys(o),r.id=59135,e.exports=r},98933:(e,t,n)=>{var o={"./simpleWorker":99246,"./simpleWorker.js":99246};function r(e){return Promise.resolve().then((()=>{if(!n.o(o,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return n(o[e])}))}r.keys=()=>Object.keys(o),r.id=98933,e.exports=r}},a={};function s(e){var t=a[e];if(void 0!==t)return t.exports;var n=a[e]={id:e,loaded:!1,exports:{}};return i[e].call(n.exports,n,n.exports,s),n.loaded=!0,n.exports}s.m=i,s.amdD=function(){throw new Error("define cannot be used indirect")},s.amdO={},e=[],s.O=(t,n,o,r)=>{if(!n){var i=1/0;for(u=0;u<e.length;u++){for(var[n,o,r]=e[u],a=!0,l=0;l<n.length;l++)(!1&r||i>=r)&&Object.keys(s.O).every((e=>s.O[e](n[l])))?n.splice(l--,1):(a=!1,r<i&&(i=r));if(a){e.splice(u--,1);var c=o();void 0!==c&&(t=c)}}return t}r=r||0;for(var u=e.length;u>0&&e[u-1][2]>r;u--)e[u]=e[u-1];e[u]=[n,o,r]},s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},n=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,s.t=function(e,o){if(1&o&&(e=this(e)),8&o)return e;if("object"==typeof e&&e){if(4&o&&e.__esModule)return e;if(16&o&&"function"==typeof e.then)return e}var r=Object.create(null);s.r(r);var i={};t=t||[null,n({}),n([]),n(n)];for(var a=2&o&&e;"object"==typeof a&&!~t.indexOf(a);a=n(a))Object.getOwnPropertyNames(a).forEach((t=>i[t]=()=>e[t]));return i.default=()=>e,s.d(r,i),r},s.d=(e,t)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.f={},s.e=e=>Promise.all(Object.keys(s.f).reduce(((t,n)=>(s.f[n](e,t),t)),[])),s.u=e=>"static/"+e+".a0ce728d.js",s.miniCssF=e=>{},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o={},r="@finos/legend-application-repl-deployment:",s.l=(e,t,n,i)=>{if(o[e])o[e].push(t);else{var a,l;if(void 0!==n)for(var c=document.getElementsByTagName("script"),u=0;u<c.length;u++){var d=c[u];if(d.getAttribute("src")==e||d.getAttribute("data-webpack")==r+n){a=d;break}}a||(l=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,s.nc&&a.setAttribute("nonce",s.nc),a.setAttribute("data-webpack",r+n),a.src=e),o[e]=[t];var p=(t,n)=>{a.onerror=a.onload=null,clearTimeout(g);var r=o[e];if(delete o[e],a.parentNode&&a.parentNode.removeChild(a),r&&r.forEach((e=>e(n))),t)return t(n)},g=setTimeout(p.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=p.bind(null,a.onerror),a.onload=p.bind(null,a.onload),l&&document.head.appendChild(a)}},s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),s.p="./",(()=>{var e={57:0};s.f.j=(t,n)=>{var o=s.o(e,t)?e[t]:void 0;if(0!==o)if(o)n.push(o[2]);else{var r=new Promise(((n,r)=>o=e[t]=[n,r]));n.push(o[2]=r);var i=s.p+s.u(t),a=new Error;s.l(i,(n=>{if(s.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var r=n&&("load"===n.type?"missing":n.type),i=n&&n.target&&n.target.src;a.message="Loading chunk "+t+" failed.\n("+r+": "+i+")",a.name="ChunkLoadError",a.type=r,a.request=i,o[1](a)}}),"chunk-"+t,t)}},s.O.j=t=>0===e[t];var t=(t,n)=>{var o,r,[i,a,l]=n,c=0;if(i.some((t=>0!==e[t]))){for(o in a)s.o(a,o)&&(s.m[o]=a[o]);if(l)var u=l(s)}for(t&&t(n);c<i.length;c++)r=i[c],s.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return s.O(u)},n=globalThis.webpackChunk_finos_legend_application_repl_deployment=globalThis.webpackChunk_finos_legend_application_repl_deployment||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),s.nc=void 0;var l=s.O(void 0,[121],(()=>s(50368)));l=s.O(l)})();
45
+ //# sourceMappingURL=index.ee94a382.js.map