@aquera/data-visualizer-sdk 0.0.35 → 0.0.36

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.
@@ -40490,7 +40490,7 @@ ${t.error.stack}</pre
40490
40490
  class="mf-viz mf-viz--heat"
40491
40491
  style=${`background:${svt[s]};color:${Ist[s]}`}
40492
40492
  >${YB(r,t,o)}</span
40493
- >`}let a=`mf-viz__num${uvt(t)}`;return j`<span class=${a}>${YB(r,t,o)}</span>`}})})}var _m=null;function ZB(i){let e=i.shadowRoot;e&&(_m||(_m=new CSSStyleSheet,_m.replaceSync(lvt)),!e.adoptedStyleSheets.includes(_m)&&(e.adoptedStyleSheets=[...e.adoptedStyleSheets,_m]))}function T3(i){if(Array.isArray(i))return i.map(e=>{let t=e;return Array.isArray(t.columns)?U(x({},t),{columns:T3(t.columns)}):t.cell||!t.accessorKey||t.type==="checkbox"||t.type==="select"?t:U(x({},t),{cell:M=>{if(M.value===void 0||M.value===null||M.value==="")return"";let n=String(M.value);return j`<span class="mf-text" title=${n}>${M.value}</span>`}})})}var _B=kG??bG;_B.addBinaryOp?.("~=",6);var h3=_B,cvt=new Set(["==","!=","<","<=",">",">=","~="]);function A3(i){return!!i&&i.type==="Identifier"}function Dvt(i){return!!i&&i.type==="CallExpression"}function Ivt(i){return Dvt(i)&&A3(i.callee)&&i.callee.name==="in"}function z3(i,e){if(!(!i||typeof i!="object")){if(i.type==="BinaryExpression"){let t=i;cvt.has(t.operator)&&(A3(t.left)&&e(t.left.name),z3(t.left,e),z3(t.right,e));return}if(i.type==="Compound"){dst(i.body,e);return}}}function dst(i,e){let t=0;for(;t<i.length;){let M=i[t];if(A3(M)){let n=t+1;if(A3(i[n])&&i[n].name==="not"&&(n+=1),Ivt(i[n])){e(M.name),t=n+1;continue}t+=1;continue}z3(M,e),t+=1}}function dvt(i,e){let t;try{t=_B(i)}catch{return}t.type==="Compound"?dst(t.body,e):z3(t,e)}function x3(i,e){let t=new Set,M=[],n=r=>{!r||t.has(r)||(t.add(r),M.push(r))};for(let r of Object.values(i||{}))typeof r!="string"||r.trim()===""||dvt(r,n);return M.map(r=>({field:r,label:e(r)||r}))}var Pm=["==","!=","<","<=",">",">=","~="],e0={"==":"is","!=":"is not","~=":"contains","<":"less than","<=":"at most",">":"greater than",">=":"at least",in:"is any of","not in":"is none of",between:"between"},jvt=/int|decimal|numeric|float|double|real|number|long|money/,yvt=/^(boolean|bool|bit)$/,Tvt=/^(date|datetime2?|datetimeoffset|smalldatetime|timestamptz|timestamp)\b/;function LA(i){return!!i&&jvt.test(i.toLowerCase())}function Avt(i){return!!i&&yvt.test(i.toLowerCase())}function Rm(i){return!!i&&Tvt.test(i.trim().toLowerCase())}var zvt=["==","!=","in","not in"],hvt=["~=","==","!=","in"],xvt=["==","!=",">","<",">=","<=","between"],pvt=["==","<",">","between"],Lvt=["=="];function Tst(i,e){switch(i){case"number":return[...xvt];case"date":return[...pvt];case"boolean":return[...Lvt];case"string":return e==="list"?[...zvt]:[...hvt];default:return[...Pm]}}var Ovt=new Set(["==","!=","<","<=",">",">=","~=","in","not in","between"]);function L3(i){let e=(i.operators??[]).filter(t=>Ovt.has(t));return e.length?e:Tst(i.fieldType,Vm(i))}function RB(i){let e=L3(i);return e.find(t=>t!=="between")??e[0]??"=="}function Vm(i){return i.valueMode?i.valueMode:i.fieldType==="boolean"||i.enumerable||i.sampleValues?.length?"list":"free"}var mvt=1e4,Evt=/(password|passwd|secret|credential|api[_-]?key|access[_-]?key|private[_-]?key|token|_enc$|_encrypted$|magic[_-]?link|magic[_-]?token|ssn|social[_-]?security)/i;function O3(i){return i.suggestible===!1||i.piiExcluded===!0?!1:i.suggestible===!0?!0:![i.id,i.name,i.label].some(e=>typeof e=="string"&&Evt.test(e))}function jst(i){return[i.id,i.name,i.label].filter(e=>!!e)}function fvt(i){return!(Vm(i)==="free"||typeof i.cardinality=="number"&&i.cardinality>mvt)}function Ast(i,e){let t=(e??"").trim().toLowerCase();return t?[i.label,i.name,i.id,i.semanticType].some(M=>typeof M=="string"&&M.toLowerCase().includes(t)):!0}function m3(i,e={}){let t=new Set(e.onDashboard??[]),M=e.recentlyUsed??[],n=l=>{let N=1/0;for(let c of jst(l)){let D=M.indexOf(c);D!==-1&&D<N&&(N=D)}return N},r=l=>jst(l).some(N=>t.has(N)),o=l=>r(l)?0:n(l)!==1/0?1:fvt(l)?2:3,a=i.map((l,N)=>({a:l,i:N,tier:o(l),rec:n(l)}));if(!a.some(l=>l.tier<=1))return i.slice();let s=l=>(l.label??"").toLowerCase();return a.sort((l,N)=>{if(l.tier!==N.tier)return l.tier-N.tier;if(l.tier===1&&l.rec!==N.rec)return l.rec-N.rec;let c=s(l.a).localeCompare(s(N.a));return c!==0?c:l.i-N.i}).map(l=>l.a)}function Svt(i){return i.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function p3(i){return typeof i=="number"||typeof i=="boolean"?String(i):`"${Svt(i)}"`}function wvt(i){let e=String(i);return/^[\w.]+$/.test(e)?e:`'${e.replace(/'/g,"\\'")}'`}function zst(i){let e=String(i).trim();return e.length>=2&&e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1).replace(/\\'/g,"'"):e}function PB(i){let{op:e,value:t}=i,M=wvt(i.field);return e==="between"&&Array.isArray(t)&&t.length===2?`${M} >= ${p3(t[0])} and ${M} <= ${p3(t[1])}`:(e==="in"||e==="not in")&&Array.isArray(t)?`${M} ${e} (${t.map(p3).join(", ")})`:`${M} ${e} ${p3(t)}`}function YI(i){if(!i.length)return"";let e=PB(i[0]);for(let t=1;t<i.length;t++)e+=` ${i[t].connector??"and"} ${PB(i[t])}`;return e}var Cvt={"==":"==","=":"==",eq:"==",equals:"==","!=":"!=","<>":"!=",ne:"!=",neq:"!=",">":">",gt:">",">=":">=",gte:">=","<":"<",lt:"<","<=":"<=",lte:"<=","~=":"~=",contains:"~=",like:"~=",in:"in","not in":"not in",notin:"not in",between:"between"};function kvt(i){if(typeof i=="string"||typeof i=="number"||typeof i=="boolean")return i;if(Array.isArray(i)){let e=i.filter(t=>typeof t=="string"||typeof t=="number");return e.length?e:void 0}}function Bm(i){let e=[];for(let t of i){let M=t.operation?Cvt[t.operation.trim().toLowerCase()]:void 0,n=kvt(t.value);if(!t.field||!M||n===void 0)continue;let r=Array.isArray(n);M==="between"&&!(r&&n.length===2)||(M==="in"||M==="not in")&&!r||M!=="between"&&M!=="in"&&M!=="not in"&&r||e.push({field:t.field,op:M,value:n})}return e}function VB(i){return i.op==="between"&&Array.isArray(i.value)?`${i.value[0]} \u2013 ${i.value[1]}`:Array.isArray(i.value)?i.value.join(", "):String(i.value)}function BB(i,e){let t=r=>`${r.field}\0${r.op}\0${JSON.stringify(r.value)}`,M=new Set(i.map(t)),n=[...i];for(let r of e){let o=t(r);M.has(o)||(M.add(o),n.push(r))}return n}var FB=[{id:"today",label:"Today"},{id:"yesterday",label:"Yesterday"},{id:"last_7_days",label:"Last 7 days"},{id:"last_30_days",label:"Last 30 days"},{id:"last_90_days",label:"Last 90 days"},{id:"wtd",label:"Week to date"},{id:"mtd",label:"Month to date"},{id:"qtd",label:"Quarter to date"},{id:"ytd",label:"Year to date"},{id:"this_week",label:"This week"},{id:"last_week",label:"Last week"},{id:"this_month",label:"This month"},{id:"last_month",label:"Last month"},{id:"this_quarter",label:"This quarter"},{id:"last_quarter",label:"Last quarter"},{id:"this_year",label:"This year"},{id:"last_year",label:"Last year"}];function xM(i){let e=i.getFullYear(),t=String(i.getMonth()+1).padStart(2,"0"),M=String(i.getDate()).padStart(2,"0");return`${e}-${t}-${M}`}function kj(i,e){let t=new Date(i);return t.setDate(t.getDate()+e),t}function WB(i){let e=new Date(i.getFullYear(),i.getMonth(),i.getDate()),t=(e.getDay()+6)%7;return kj(e,-t)}function E3(i,e=new Date){let t=new Date(e.getFullYear(),e.getMonth(),e.getDate()),M=t.getFullYear(),n=t.getMonth(),r=Math.floor(n/3);switch(i){case"today":return{min:xM(t),max:xM(t)};case"yesterday":{let o=kj(t,-1);return{min:xM(o),max:xM(o)}}case"last_7_days":return{min:xM(kj(t,-6)),max:xM(t)};case"last_30_days":return{min:xM(kj(t,-29)),max:xM(t)};case"last_90_days":return{min:xM(kj(t,-89)),max:xM(t)};case"wtd":return{min:xM(WB(t)),max:xM(t)};case"this_week":{let o=WB(t);return{min:xM(o),max:xM(kj(o,6))}}case"last_week":{let o=kj(WB(t),-7);return{min:xM(o),max:xM(kj(o,6))}}case"mtd":return{min:xM(new Date(M,n,1)),max:xM(t)};case"this_month":return{min:xM(new Date(M,n,1)),max:xM(new Date(M,n+1,0))};case"last_month":return{min:xM(new Date(M,n-1,1)),max:xM(new Date(M,n,0))};case"qtd":return{min:xM(new Date(M,r*3,1)),max:xM(t)};case"this_quarter":return{min:xM(new Date(M,r*3,1)),max:xM(new Date(M,r*3+3,0))};case"last_quarter":{let o=r===0?{yr:M-1,qi:3}:{yr:M,qi:r-1};return{min:xM(new Date(o.yr,o.qi*3,1)),max:xM(new Date(o.yr,o.qi*3+3,0))}}case"ytd":return{min:xM(new Date(M,0,1)),max:xM(t)};case"this_year":return{min:xM(new Date(M,0,1)),max:xM(new Date(M,11,31))};case"last_year":return{min:xM(new Date(M-1,0,1)),max:xM(new Date(M-1,11,31))};default:return null}}function HB(i){return i==="custom_range"||E3(i)!=null}function hst(i){return!!i&&i.type==="Identifier"}function bvt(i){if(hst(i))return i.name;if(i?.type==="Literal"){let e=i.value;if(typeof e=="string"&&e)return e}return null}function Qvt(i){if(!i||i.type!=="BinaryExpression")return null;let e=i,t=bvt(e.left);if(!Pm.includes(e.operator)||t==null)return null;let M=e.right,n=!1;if(M?.type==="UnaryExpression"){let o=M;if(o.operator!=="-")return null;n=!0,M=o.argument}if(M?.type!=="Literal")return null;let r=M.value;return typeof r!="string"&&typeof r!="number"||n&&typeof r!="number"?null:{field:t,op:e.operator,value:n?-r:r}}function JB(i){let e=i.trim();if(!e)return[];let t;try{t=h3(e)}catch{return null}let M=t.type==="Compound"?t.body:[t];if(M.length%2===0)return null;let n=[],r="and";for(let o=0;o<M.length;o++){if(o%2===1){if(!hst(M[o]))return null;let s=M[o].name;if(s!=="and"&&s!=="or")return null;r=s;continue}let a=Qvt(M[o]);if(!a)return null;n.push(n.length===0||r==="and"?a:U(x({},a),{connector:r})),r="and"}return n}function Fm(i){let e=String(i??"").trim();if(!e)return!0;let t=e.replace(/"[^"]*"|'[^']*'/g,"");if(/\bor\b/i.test(t)||/\bnot\b/i.test(t.replace(/\bnot\s+in\b/gi," ")))return!1;let M=/\b(?:contains|startsWith|between|isEmpty|isNotEmpty|in)\s*\([^()]*\)/gi,n;do n=t,t=t.replace(M," ");while(t!==n);return!/[()]/.test(t)}function yst(i){return i.toLowerCase().replace(/[^a-z0-9]/g,"")}var Uvt=new Set(["terms","multi_terms","date_histogram","histogram","range","date_range","significant_terms"]);function vvt(i){return i.endsWith(".keyword")?i.slice(0,-8):i}function Yvt(i){let e=new Map,t=M=>{if(!(!M||typeof M!="object"))for(let[n,r]of Object.entries(M)){if(!r||typeof r!="object")continue;let o=r;for(let[a,s]of Object.entries(o))if(Uvt.has(a)&&s&&typeof s=="object"&&typeof s.field=="string"){e.set(n,vvt(s.field));break}t(o.aggs)}};return t(i?.aggs),e}function GB(i,e){let t=(e?.columns??[]).filter(c=>typeof c.column=="string"&&!!c.column);if(!t.length||!i.pointName)return[];let M=e?.adapterType==="opensearch",n=M&&e?.dsl?Yvt(e.dsl):null,r=i.seriesName?yst(i.seriesName):"",o=r?t.find(c=>yst(c.column)===r):void 0,a=t.filter(c=>c!==o),s=a.find(c=>!LA(c.dataType)&&!Avt(c.dataType))??a[0],l=[];if(s){let c=n?.get(s.column)??s.column,D=LA(s.dataType)&&Number.isFinite(Number(i.pointName));l.push({field:c,op:"==",value:D?Number(i.pointName):i.pointName})}let N=o??t.find(c=>c!==s&&LA(c.dataType));return!M&&N&&typeof i.pointY=="number"&&Number.isFinite(i.pointY)&&l.push({field:N.column,op:"==",value:i.pointY}),l}function xst(i){return i.toLowerCase().replace(/[^a-z0-9]/g,"")}function Zvt(i){return!!i&&/^(boolean|bool|bit)$/.test(i.toLowerCase())}function pst(i,e,t){i.set(e,[...i.get(e)??[],...t])}function Lst(i){let e=(i??[]).filter(M=>typeof M.column=="string"&&!!M.column);return e.length?(e.find(M=>!LA(M.dataType)&&!Zvt(M.dataType))??e[0])?.column??null:null}function Ost(i){if(i?.adapterType==="opensearch")return null;let e=(i?.columns??[]).filter(o=>typeof o.column=="string"&&!!o.column);if(!e.length)return null;let t=o=>o.sourceColumn??o.column;if(Rm(e[0].dataType))return t(e[0]);let M=e.filter(o=>Rm(o.dataType));if(M.length===1)return t(M[0]);let n=Lst(e),r=n?e.find(o=>o.column===n):void 0;return r&&Rm(r.dataType)?t(r):null}function mst(i){let e=new Map;for(let t of i??[]){let M=t?.queryMeta,n=Lst(M?.columns);if(!n)continue;let o=(t?.config?.chart?.data??[]).map(a=>a?.name).filter(a=>typeof a=="string"&&a!==""||typeof a=="number"&&!Number.isNaN(a));o.length&&pst(e,n,o)}return e}function f3(i,e){let t=(e?.columns??[]).filter(r=>typeof r.column=="string"&&!!r.column),M=new Map(t.map(r=>[xst(r.column),r.column])),n=new Map;for(let r of i??[])if(!(!r||typeof r!="object"))for(let[o,a]of Object.entries(r)){let s=M.get(xst(o));s&&(typeof a=="string"&&a!==""||typeof a=="number"&&!Number.isNaN(a))&&pst(n,s,[a])}return n}function _vt(i){return!/[\p{L}\p{N}]/u.test(i)}function Est(i){let e=i.suffix;if(typeof e!="string")return;let t=e.replace(/^\s+/u,"");t!==""&&(i.suffix=_vt(t)?t:`\xA0${t}`)}var OA="#155EEF",Wvt="--ng-viz-1";function Pvt(i){let e=i.endsWith("%")?Number(i.slice(0,-1))*255/100:Number(i);return Number.isFinite(e)?Math.min(255,Math.max(0,Math.round(e))):null}function Rvt(i){return i.toString(16).toUpperCase().padStart(2,"0")}function Vvt(i){let e=(i??"").trim();if(!e)return null;if(e.startsWith("#")){let r=e.slice(1);return/^[0-9a-f]+$/i.test(r)?r.length===3||r.length===4?`#${[...r.slice(0,3)].map(o=>o+o).join("").toUpperCase()}`:r.length===6||r.length===8?`#${r.slice(0,6).toUpperCase()}`:null:null}let t=/^rgba?\(([^)]*)\)$/i.exec(e);if(!t)return null;let M=t[1].split(/[\s,/]+/).filter(Boolean);if(M.length<3)return null;let n=M.slice(0,3).map(Pvt);return n.some(r=>r===null)?null:`#${n.map(Rvt).join("")}`}function mA(i){let e=i??(typeof document<"u"?document.documentElement:null);if(!e||typeof getComputedStyle!="function")return OA;try{return Vvt(getComputedStyle(e).getPropertyValue(Wvt))??OA}catch{return OA}}function S3(i,e){let t=i.sparklineColor;typeof t=="string"&&t.trim()!==""||(i.sparklineColor=mA(e))}function w3(i,e,t,M){i.noHeader=!0;let n=i.label??e.chartTitle??i.chartTitle??t;n&&(i.label=n);let r=i.description??e.chartSubtitle??i.chartSubtitle;r&&(i.description=r),delete i.chartTitle,delete i.chartSubtitle,delete e.chartTitle,delete e.chartSubtitle,Est(i),S3(i,M)}function $B(i){return i?.type==="kpi"}var Bvt=["data-theme","data-dvz-theme"],C3=new Set,Hm=null;function EA(i){return typeof document>"u"||typeof MutationObserver>"u"?()=>{}:(C3.add(i),Hm||(Hm=new MutationObserver(()=>{for(let e of[...C3])e()}),Hm.observe(document.documentElement,{attributes:!0,attributeFilter:Bvt,subtree:!0})),()=>{C3.delete(i),C3.size===0&&(Hm?.disconnect(),Hm=null)})}var bj=class i{byField=new Map;publish(e){for(let[t,M]of e){let n=this.byField.get(t);n||(n=new Set,this.byField.set(t,n));for(let r of M)n.add(r)}}getObserved(e){return[...this.byField.get(e)??[]]}fields(){return[...this.byField.keys()]}match(e,t){let M=this.getObserved(e),n=(t??"").trim().toLowerCase();return n?M.filter(r=>String(r).toLowerCase().includes(n)):M}has(e,t){let M=this.byField.get(e);return!!M&&[...M].some(n=>String(n)===String(t))}clear(){this.byField.clear()}static \u0275fac=function(t){return new(t||i)};static \u0275prov=Ct({token:i,factory:i.\u0275fac})};var Fvt=["nileChart"],Hvt=[[["","header-lead",""]],"*"],Jvt=["[header-lead]","*"],Gvt=(i,e)=>e.label;function $vt(i,e){i&1&&Zt(0,"nile-glyph",10)}function Xvt(i,e){if(i&1){let t=Le();C(0,"nile-menu-item",8),Ae("click",function(){let n=R(t).$index,r=p(3);return V(r.selectMasterDetailVariant(n))}),he(1,$vt,1,0,"nile-glyph",10),Y(2),b()}if(i&2){let t=e.$implicit,M=e.$index,n=p(3);L(),xe(M===n.masterDetailVariantIndex?1:-1),L(),yi(" ",t.label," ")}}function qvt(i,e){if(i&1){let t=Le();C(0,"nile-dropdown",3)(1,"button",4),Zt(2,"nile-glyph",5),b(),C(3,"nile-menu",6),xt(4,Xvt,3,2,"nile-menu-item",null,Gvt),Zt(6,"div",7),C(7,"nile-menu-item",8),Ae("click",function(){R(t);let n=p(2);return V(n.resetMasterDetailView())}),Zt(8,"nile-glyph",9),Y(9," Reset view "),b()()()}if(i&2){let t=p(2);L(4),pt(t.masterDetailVariants)}}function Kvt(i,e){if(i&1&&(C(0,"nile-chart",1,0)(2,"div",2),ll(3),he(4,qvt,10,0,"nile-dropdown",3),ll(5,1),b()()),i&2){let t=p();It("no-header",t.isKpiWidget?"":null),L(2),Pt("kpi-overlay",t.isKpiWidget)("kpi-overlay--pinned",t.isKpiWidget&&t.chromePinned),It("slot",t.isKpiWidget?"footer":"header-actions"),L(2),xe(t.isMasterDetailChart?4:-1)}}var ZI=class i{constructor(e,t,M=null,n=null){this.zone=e;this.cd=t;this.gridPageFetcher=M;this.observed=n}zone;cd;gridPageFetcher;observed;config;widgetId=null;widgetTitle=null;chromePinned=!1;loading=!1;drilldownBy;menu=null;dashboardFilters=null;resolvedFilters=null;dashboardId=null;conversationId=null;cellFilterEnabled=gt(!1);_filterMode="prompt";_filterSeed=null;aiSend=new Mi;sortChange=new Mi;filterSubmit=new Mi;filterChange=new Mi;chartClick=new Mi;chartSelection=new Mi;chartSelectionReset=new Mi;gridFilterVerdict=new Mi;menuAction=new Mi;cellFilter=Xi();dataViewFilterChange=new Mi;chartRef;static MASTER_DETAIL_VARIANTS=[{label:"Default view",overrides:null},{label:"Collapsible overview",overrides:{detailType:"spline",masterType:"column",masterCollapsible:!0}},{label:"Styled navigator",overrides:{detailType:"areaspline",masterType:"area",maskFill:"rgba(37,99,235,0.12)",detailTitle:"Detail view",masterTitle:"Overview (drag to select)"}},{label:"Master only (zoomable)",overrides:{masterOnly:!0,masterType:"column"}}];static DEFAULT_VARIANT_INDEX=3;masterDetailVariantIndex=i.DEFAULT_VARIANT_INDEX;mounted=!0;viewReady=!1;sessionId=globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random()}`;aiSendHandler=e=>this.handleAiSend(e);sortChangeHandler=e=>this.handleSortChange(e);nileChangeHandler=e=>this.handleNileChange(e);filterKeydownHandler=e=>this.handleFilterKeydown(e);filterFocusHandler=()=>this.handleFilterFocus();filterClearHandler=()=>this.handleFilterClear();chartClickHandler=e=>this.handleChartClick(e);chartSelectionHandler=e=>this.handleChartSelection(e);resetZoomClickHandler=e=>this.handleResetZoomClick(e);lastForwardedSelection=null;static SELECTION_DEDUP_MS=1e3;static GRID_FULL_FETCH_ROWS=500;masterDetailZoomWindow=null;menuChangeHandler=e=>this.handleMenuChange(e);paginationChangeHandler=e=>this.handleGridPaginationChange(e);filterChangeHandler=e=>this.handleGridFilterChange(e);cellFilterHandler=(e,t)=>this.zone.run(()=>this.cellFilter.emit({widgetId:this.widgetId,field:e,value:t}));filterDebounce=null;noopFilterFn=()=>!0;gridState=ke(null);_pendingDashboardFilterRefresh=!1;_dashboardFilterRefetching=!1;_dashboardFilterSeq=0;injector=Fe(rl);hostEl=Fe(ir);themeUnwatch;lastClickCoords={x:0,y:0};mouseDownHandler=e=>{this.lastClickCoords={x:e.clientX,y:e.clientY}};latestFilterPayload=null;suppressPaginationEvents=!1;staticGridPageIndex=0;staticGridPageSize=10;staticGridRowCount=0;ngAfterViewInit(){this.viewReady=!0,this.attachAiListener(),this.applyLoading(),this.applyMenu(),this.config&&this.applyConfig(),this.themeUnwatch=EA(()=>{this.viewReady&&this.isKpiWidget&&this.config&&this.applyConfig()})}ngOnChanges(e){if(!this.viewReady)return;e.loading&&this.applyLoading(),e.menu&&this.applyMenu();let t=e.dashboardFilters&&!e.dashboardFilters.firstChange,M=e.resolvedFilters&&!e.resolvedFilters.firstChange;if((t||M)&&this.handleDashboardFilterChange(),!e.config&&!e.drilldownBy)return;let n=e.config?.previousValue,r=e.config?.currentValue;e.config&&this.needsRemount(n,r)?this.remount():this.applyConfig()}ngOnDestroy(){this.detachAiListener(),this.themeUnwatch?.()}pushAiResponse(e){this.chartRef?.nativeElement?.addAiResponse?.(e)}get isMasterDetailChart(){return this.config?.chart?.type==="master-detail"}get masterDetailVariants(){return i.MASTER_DETAIL_VARIANTS}selectMasterDetailVariant(e){if(!this.isMasterDetailChart)return;let t=i.MASTER_DETAIL_VARIANTS.length;e<0||e>=t||e===this.masterDetailVariantIndex||(this.masterDetailVariantIndex=e,this.remount())}resetMasterDetailView(){this.isMasterDetailChart&&(this.masterDetailVariantIndex=i.DEFAULT_VARIANT_INDEX,this.masterDetailZoomWindow=null,this.remount())}patchControlSuggestions(e,t){let M=this.chartRef?.nativeElement;if(!M)return;let n=M.shadowRoot?.querySelector("nile-filter-chart"),r=n?.selectedValues?.get(e),o=M.config?.chart?.controls;if(!o)return;let a=o.find(s=>s.id===e);a&&(a.suggestions=[...t],typeof r=="string"&&(a.value=r),n?.requestUpdate?.())}getLiveExpression(){let e=this.getPromptControlId(this.config);return e?{controlId:e,value:this.readLiveFilterValue(e)}:null}setFilterExpression(e){let t=this.chartRef?.nativeElement,M=this.getPromptControlId(this.config);if(!t||!M)return;let r=t.config?.chart?.controls?.find(a=>a.id===M);r&&(r.value=e);let o=t.shadowRoot?.querySelector("nile-filter-chart");o?.setValue?.(M,e),o?.requestUpdate?.()}getPromptControlId(e){let t=e?.chart?.controls;for(let M of t??[])if((M.variant==="prompt"||M.variant==="expression"||M.variant==="hybrid")&&M.id)return M.id;return null}setFilterMode(e,t){this._filterMode=e,this._filterSeed=t??null,this.applyConfig()}openAiChat(){let e=this.chartRef?.nativeElement;e&&ld(()=>{e.chatOpen=!0},{injector:this.injector})}handleChartClick(e){let t=e.detail??{},M=String(t.name??t.point?.name??t.category??t.point?.category??""),n=typeof t.value=="number"?t.value:typeof t.point?.y=="number"?t.point.y:null,r=t.seriesName??t.point?.series?.name??null;this.zone.run(()=>this.chartClick.emit({widgetId:this.widgetId,point:t.point??null,pointName:M,pointY:n,seriesName:r,x:this.lastClickCoords.x,y:this.lastClickCoords.y}))}handleChartSelection(e){let{min:t,max:M}=e.detail??{};if(typeof t!="number"||typeof M!="number")return;if(M<=t){let s=this.chartPointStep();if(!s)return;t-=s/2,M+=s/2}let n=this.chartXExtent();if(n&&t<=n.min&&M>=n.max){this.masterDetailZoomWindow=null;return}this.masterDetailZoomWindow={min:t,max:M};let r=`${t}:${M}`,o=Date.now(),a=this.lastForwardedSelection;a?.key===r&&o-a.at<i.SELECTION_DEDUP_MS||(this.lastForwardedSelection={key:r,at:o},this.zone.run(()=>this.chartSelection.emit({widgetId:this.widgetId,min:t,max:M})))}handleResetZoomClick(e){e.composedPath().some(M=>M instanceof Element&&(M.classList.contains("nile-chart-reset-zoom")||M.getAttribute("part")==="reset-zoom"))&&(this.masterDetailZoomWindow=null,this.lastForwardedSelection=null,this.zone.run(()=>this.chartSelectionReset.emit({widgetId:this.widgetId})))}chartPointStep(){let e=this.chartRef?.nativeElement,t=e?this.findHighchartsInstance(e):null,M=[],n=t?.series??[];for(let a of n)for(let s of a.points??[])typeof s.x=="number"&&M.push(s.x);if(M.length<2){let a=this.config?.chart?.data;for(let s of Array.isArray(a)?a:[])s&&typeof s=="object"&&typeof s.x=="number"&&M.push(s.x)}if(M.length<2)return 0;let r=[...new Set(M)].sort((a,s)=>a-s),o=1/0;for(let a=1;a<r.length;a++)o=Math.min(o,r[a]-r[a-1]);return Number.isFinite(o)&&o>0?o:0}chartXExtent(){let e=this.chartRef?.nativeElement,M=(e?this.findHighchartsInstance(e):null)?.xAxis?.[0];if(M&&typeof M.dataMin=="number"&&typeof M.dataMax=="number")return{min:M.dataMin,max:M.dataMax};let n=[],r=this.config?.chart?.data;for(let o of Array.isArray(r)?r:[]){o&&typeof o=="object"&&typeof o.x=="number"&&n.push(o.x);let a=o?.data;if(Array.isArray(a))for(let s of a)Array.isArray(s)&&typeof s[0]=="number"?n.push(s[0]):s&&typeof s=="object"&&typeof s.x=="number"&&n.push(s.x)}return n.length?{min:Math.min(...n),max:Math.max(...n)}:null}drillIntoSeries(e,t){let M=this.chartRef?.nativeElement?this.findHighchartsInstance(this.chartRef.nativeElement):null;M&&(M.addSingleSeriesAsDrilldown(e,{id:t.id,name:t.name,type:t.type==="donut"?"pie":t.type??"pie",data:t.data}),M.applyDrilldown())}findHighchartsInstance(e){let t=e.shadowRoot;if(!t)return null;for(let M of Array.from(t.querySelectorAll("*"))){let n=M.chart;if(n&&typeof n.addSingleSeriesAsDrilldown=="function"&&typeof n.applyDrilldown=="function")return n}return null}needsRemount(e,t){return this.sparklineVisibilityChanged(e,t)||this.kpiVariantChangedWithSparkline(e,t)||this.semiCircleChanged(e,t)||this.widgetFamilyChanged(e,t)||this.seriesColorChanged(e,t)||this.plotShapeChanged(e,t)}plotShapeChanged(e,t){let M=e?.chart,n=t?.chart;if(!M||!n)return!1;let r=N=>Array.isArray(N)?N.length:-1;if(r(M.categories)!==r(n.categories))return!0;let o=Array.isArray(M.data)?M.data:null,a=Array.isArray(n.data)?n.data:null;if(o&&a&&o.length===a.length)for(let N=0;N<o.length;N++){let c=o[N],D=a[N];if(r(c?.data)!==r(D?.data))return!0}let s=M.options?.series,l=n.options?.series;if(r(s)!==r(l))return!0;if(Array.isArray(s)&&Array.isArray(l))for(let N=0;N<s.length;N++){let c=s[N],D=l[N];if(r(c?.data)!==r(D?.data))return!0}for(let N of["lineSeries","columnSeries"]){let c=M[N],D=n[N];if(r(c?.data)!==r(D?.data))return!0}return!1}seriesColorChanged(e,t){let M=e?.chart?.data,n=t?.chart?.data;return!Array.isArray(M)||!Array.isArray(n)?!1:M.length!==n.length?!0:M.some((r,o)=>{let a=r,s=n[o];return(a?.color??null)!==(s?.color??null)})}widgetFamilyChanged(e,t){return this.chartFamily(e)!==this.chartFamily(t)}get isKpiWidget(){return this.chartFamily(this.config)==="kpi"}chartFamily(e){let t=e?.chart?.type;return t==="kpi"?"kpi":t==="grid"?"grid":t==="filter"?"filter":"chart"}sparklineVisibilityChanged(e,t){return this.hasSparkline(e)!==this.hasSparkline(t)}kpiVariantChangedWithSparkline(e,t){let M=e?.chart?.variant,n=t?.chart?.variant;return M!==n&&this.hasSparkline(t)}semiCircleChanged(e,t){let M=e?.chart?.type;if(t?.chart?.type!=="donut"&&M!=="donut")return!1;let r=!!e?.chart?.semiCircle,o=!!t?.chart?.semiCircle;return r!==o}hasSparkline(e){let t=e?.chart?.sparkline;return Array.isArray(t)&&t.length>0}remount(){this.detachAiListener(),this.mounted=!1,this.cd.detectChanges(),this.mounted=!0,this.cd.detectChanges(),this.attachAiListener(),this.applyConfig()}applyConfig(){let e=this.chartRef?.nativeElement;if(!this.config||!e)return;let t=this.isGridConfig(this.config);if(t&&this.isServerGrid(this.config)){this.applyServerGrid(e);return}e.config=this.buildChartConfig(t),this.afterChildRendered(e,t,()=>{this.applyCardStyle(e),t&&(this.fixGridDisplay(e),this.reassertStaticGridPage(e))})}reassertStaticGridPage(e){if(this.staticGridPageIndex===0||this.isServerGrid(this.config))return;let t=e.shadowRoot?.querySelector("nile-data-grid");if(!t)return;this.suppressPaginationEvents=!0;let M=this.staticGridPageIndex,n=this.staticGridPageSize;(t.updateComplete??Promise.resolve()).then(()=>{t.pagination={pageIndex:M,pageSize:n},(t.updateComplete??Promise.resolve()).then(()=>{this.suppressPaginationEvents=!1})})}isGridConfig(e){return e?.chart?.type==="grid"}buildChartConfig(e){let t=Kh(this.config,this.drilldownBy);gst(t)&&console.warn(Nst(t,this.widgetTitle));let _=t.chart??{},{height:M}=_,n=$e(_,["height"]),r=n.type==="bar";r&&(n.type="column");let o=n.type==="stacked",a=n.type==="cluster";(o||a)&&(n.type="column");let s=e&&n.stickyHeader===void 0?{stickyHeader:!0}:{},l=e?{height:"100%"}:{},N=e?this.normalizeGridColumns(n.columns):void 0,c=e?y3(N)??N:N,D=e?Wm(c)??c:c,I=e?T3(D)??D:D,d=e&&this.cellFilterEnabled()?j3(I,this.cellFilterHandler)??I:I,y={};if(e){let ne=Array.isArray(n.data)?n.data:[];ne.length!==this.staticGridRowCount&&(this.staticGridRowCount=ne.length,this.staticGridPageIndex=0),y={paginationEnabled:!0,pagination:{pageIndex:this.staticGridPageIndex,pageSize:this.staticGridPageSize}}}let A=n.type==="kpi",X=t.aq??{},{ai:z,switchable:E}=X,S=$e(X,["ai","switchable"]),O=A?S:x(x({},S),z!==void 0?{ai:z}:{});if(!A&&!O.chartTitle&&!n.chartTitle&&this.widgetTitle&&(O.chartTitle=this.widgetTitle),A&&w3(n,O,this.widgetTitle,this.hostEl.nativeElement),n.type==="filter"){n.chartTitle=Ym,delete n.chartSubtitle,delete n.summary,O.chartTitle=Ym,delete O.chartSubtitle,delete O.summary;let ne=n.controls;if(Array.isArray(ne)){let ae=this.chartRef?.nativeElement?.config?.chart?.controls,pe=this.getPromptControlId(this.config),Me=this._filterSeed;this._filterSeed=null,n.controls=ne.map(De=>{let Ie=De.id,me=Ie?this.readLiveFilterValue(Ie):"",Qe=Ie?ae?.find(le=>le.id===Ie):void 0,Ye=Array.isArray(Qe?.suggestions)&&Qe.suggestions.length?{suggestions:Qe.suggestions}:{},F=x(x(U(x({},De),{showClearIcon:!0}),Ye),me?{value:me}:{});if(Ie&&Ie===pe){let le=Me!=null?{value:Me}:{};return this._filterMode==="expression"?x(U(x({},F),{variant:"expression",queryLanguage:U(x({engine:"filtrex",mode:"strict",validateOn:"change"},De.queryLanguage??{}),{enabled:!0}),placeholders:[kB],expressionPlaceholders:[kB]}),le):x(U(x({},F),{placeholders:[bB],promptPlaceholders:[bB]}),le)}return F})}}let v=n.type??"",Z=n.categories,B=Array.isArray(Z)&&Z.length>0&&v!=="invertedarea"&&!r,q=n.options??{},W=Object.keys(q).length?{options:q}:{};if(B){let ne=q.xAxis??{},ae=ne.labels??{},pe=Z.length,Me=pe>8?Math.ceil(pe/8):void 0,De=Z.reduce((Ye,F)=>Math.max(Ye,String(F??"").length),0),me=(Me?Math.ceil(pe/Me):pe)*(De*7+12),Qe={chart:{spacingLeft:48},xAxis:{labels:{rotation:-45,align:"right",y:12}}};W={options:U(x({},q),{xAxis:U(x({},ne),{labels:x(x({autoRotation:[-45,-90],style:{textOverflow:"none",whiteSpace:"nowrap"}},Me?{step:Me}:{}),ae)}),responsive:{rules:[{condition:{maxWidth:me},chartOptions:Qe},...q.responsive?.rules??[]]}})}}if(o){let ne=W.options??q,ae=ne.plotOptions??{},pe=ae.series??{};W={options:U(x({},ne),{plotOptions:U(x({},ae),{series:U(x({},pe),{stacking:n.stackMode||"normal"})})})}}if(r){let ne=W.options??q,ae=ne.chart??{};W={options:U(x({},ne),{chart:U(x({},ae),{inverted:!0})})}}let Ne=v==="master-detail"?x(x({},this.masterDetailVariantIndex>0?i.MASTER_DETAIL_VARIANTS[this.masterDetailVariantIndex].overrides??{}:{}),this.masterDetailZoomWindow?{selectionMin:this.masterDetailZoomWindow.min,selectionMax:this.masterDetailZoomWindow.max}:{}):{};return U(x({},t),{chart:x(x(x(x(x(x(x(x({},s),n),e?{variant:"sleek-condensed",columnResizingEnabled:!0,columnResizeMode:"onChange",columnReorderingEnabled:!0}:{}),d?{columns:d}:{}),W),Ne),l),y),aq:O})}isServerGrid(e){let t=e?.chart;return t?.serverPagination===!0&&typeof t?.gridId=="string"}applyServerGrid(e){let t=this.config.chart??{},M=t.gridId,n=Number(t.pagination?.pageSize)||10,r=this.gridState();if(r?.gridId===M&&r.loaded){this._dashboardFilterRefetching||this.renderServerGrid(e);return}this.gridState.set({gridId:M,total:0,pageIndex:0,pageSize:n,columns:[],aq:{},chartConfig:{},rows:[],loadedPages:[],loaded:!1,fullyLoaded:!1,filters:[]}),e.loading=!0,this.fetchGridPage(M,0,i.GRID_FULL_FETCH_ROWS).then(o=>{if(!o||this.gridState()?.gridId!==M){this._pendingDashboardFilterRefresh=!1;return}this.emitGridFilterVerdict(o);let a=o.config?.chart??{},s=Array.isArray(a.data)?a.data:[],l=Math.min(Number(o.total)||s.length,i.GRID_FULL_FETCH_ROWS);if(this.observed?.publish(f3(s,o.queryMeta)),this.gridState.set({gridId:M,total:l,pageIndex:0,pageSize:n,columns:Array.isArray(a.columns)?a.columns:[],aq:o.config?.aq??{},chartConfig:a,rows:s,loadedPages:[0],loaded:!0,fullyLoaded:!0,filters:Array.isArray(a.filters)?a.filters:[]}),e.loading=!1,this.renderServerGrid(e),this._pendingDashboardFilterRefresh){this._pendingDashboardFilterRefresh=!1;let N=this.gridState();N&&N.gridId===M&&this.applyServerFilters(M,N.filters)}}).catch(o=>{console.error("[nile-chart-widget] initial grid page fetch failed",o),e.loading=!1,this._pendingDashboardFilterRefresh=!1})}emitGridFilterVerdict(e){let t=e?.dashboardFilter;t&&this.gridFilterVerdict.emit({widgetId:this.widgetId,applied:t.applied===!0,reason:t.reason})}renderServerGrid(e){let t=this.gridState();if(!t)return;let M=x({},t.aq);!M.chartTitle&&!t.chartConfig.chartTitle&&this.widgetTitle&&(M.chartTitle=this.widgetTitle);let n=(this.normalizeGridColumns(t.columns)??t.columns).map(s=>U(x({},s),{filterFn:this.noopFilterFn})),r=y3(n)??n,o=Wm(r)??r,a=T3(o)??o;e.config={chart:U(x({stickyHeader:!0},t.chartConfig),{variant:"sleek-condensed",columnResizingEnabled:!0,columnResizeMode:"onChange",columnReorderingEnabled:!0,type:"grid",columns:this.cellFilterEnabled()?j3(a,this.cellFilterHandler)??a:a,data:[...t.rows],paginationEnabled:!0,pagination:{pageIndex:t.pageIndex,pageSize:t.pageSize},height:"100%"}),aq:M},this.afterChildRendered(e,!0,()=>{this.applyCardStyle(e),this.fixGridDisplay(e)})}normalizeGridColumns(e){if(Array.isArray(e))return e.map(t=>{let M=t,n=M.header??M.headerName;if(Array.isArray(M.columns)){let c=M,{field:I,headerName:d,columns:y}=c,A=$e(c,["field","headerName","columns"]);return U(x(x({},A),n!==void 0?{header:n}:{}),{columns:this.normalizeGridColumns(M.columns)})}let r=M.accessorKey??M.field,o=M.enableFiltering??!0,a=typeof M.cell=="function"?M.cell:null,D=M,{field:s,headerName:l}=D,N=$e(D,["field","headerName"]);return U(x(x(x({},N),r!==void 0?{accessorKey:r}:{}),n!==void 0?{header:n}:{}),{enableFiltering:o,cell:I=>{let d=a?a(I):I.value;return d==null||d===""?"-":d}})})}afterChildRendered(e,t,M){let n=()=>{if(!t){M();return}let r=0,o=()=>{e.shadowRoot?.querySelector("nile-data-grid")||++r>30?M():requestAnimationFrame(o)};o()};e.updateComplete?e.updateComplete.then(n):customElements.whenDefined("nile-chart").then(()=>{let r=e.updateComplete;r?r.then(n):requestAnimationFrame(n)})}applyCardStyle(e){let t=e.shadowRoot?.querySelector(".nile-chart-card");if(!t)return;let M=this.config?.chart??{},n=(r,o)=>{o?t.style.setProperty(r,o):t.style.removeProperty(r)};n("background",M.chartBg),n("border",M.chartBorder),n("border-radius",M.chartBorderRadius),n("box-shadow",M.chartShadow),n("padding",M.chartPadding),n("min-height",M.chartMinHeight)}fixGridDisplay(e){let t=e.shadowRoot?.querySelector("nile-data-grid");if(!t)return;t.style.display="flex",t.style.flexDirection="column";let M=this.config?.chart?.chartBg;M?t.style.setProperty("--nile-data-grid-surface",M):t.style.removeProperty("--nile-data-grid-surface"),vB(t),ZB(t),this.injectCellFilterStyle(t)}gridStyleSheet=null;injectCellFilterStyle(e){if(!this.cellFilterEnabled())return;let t=e.shadowRoot;t&&(this.gridStyleSheet||(this.gridStyleSheet=new CSSStyleSheet,this.gridStyleSheet.replaceSync(ust)),!t.adoptedStyleSheets.includes(this.gridStyleSheet)&&(t.adoptedStyleSheets=[...t.adoptedStyleSheets,this.gridStyleSheet]))}applyLoading(){let e=this.chartRef?.nativeElement;e&&(e.loading=this.loading)}applyMenu(){let e=this.chartRef?.nativeElement;e&&(e.menu=this.menu)}attachAiListener(){let e=this.chartRef?.nativeElement;e?.addEventListener("nile-chart-ai-send",this.aiSendHandler),e?.addEventListener("nile-sort-change",this.sortChangeHandler),e?.addEventListener("nile-chart-click",this.chartClickHandler),e?.addEventListener("nile-chart-selection",this.chartSelectionHandler),e?.addEventListener("click",this.resetZoomClickHandler,!0),e?.addEventListener("nile-menu-change",this.menuChangeHandler),e?.addEventListener("nile-pagination-change",this.paginationChangeHandler),e?.addEventListener("nile-filter-change",this.filterChangeHandler),e?.addEventListener("mousedown",this.mouseDownHandler,!0),this.isFilterConfig(this.config)&&(e?.addEventListener("nile-change",this.nileChangeHandler),e?.addEventListener("keydown",this.filterKeydownHandler,!0),e?.addEventListener("focusin",this.filterFocusHandler),e?.addEventListener("click",this.filterFocusHandler,!0),e?.addEventListener("nile-clear",this.filterClearHandler))}detachAiListener(){let e=this.chartRef?.nativeElement;e?.removeEventListener("nile-chart-ai-send",this.aiSendHandler),e?.removeEventListener("nile-sort-change",this.sortChangeHandler),e?.removeEventListener("nile-chart-click",this.chartClickHandler),e?.removeEventListener("nile-chart-selection",this.chartSelectionHandler),e?.removeEventListener("click",this.resetZoomClickHandler,!0),e?.removeEventListener("nile-menu-change",this.menuChangeHandler),e?.removeEventListener("nile-pagination-change",this.paginationChangeHandler),e?.removeEventListener("nile-filter-change",this.filterChangeHandler),e?.removeEventListener("mousedown",this.mouseDownHandler,!0),e?.removeEventListener("nile-change",this.nileChangeHandler),e?.removeEventListener("keydown",this.filterKeydownHandler,!0),e?.removeEventListener("focusin",this.filterFocusHandler),e?.removeEventListener("click",this.filterFocusHandler,!0),e?.removeEventListener("nile-clear",this.filterClearHandler)}handleMenuChange(e){let t=e.detail?.id;t&&this.zone.run(()=>this.menuAction.emit(t))}handleGridPaginationChange(e){let t=e.detail;if(this.suppressPaginationEvents)return;let M=this.gridState();if(!M?.loaded){if(this.isGridConfig(this.config)&&!this.isServerGrid(this.config)){let N=t?.pagination;this.staticGridPageIndex=Number(N?.pageIndex)||0,this.staticGridPageSize=Number(N?.pageSize)||this.staticGridPageSize}return}let n=t?.pagination,r=Number(n?.pageIndex)||0,o=Number(n?.pageSize)||M.pageSize;if(M.fullyLoaded){(r!==M.pageIndex||o!==M.pageSize)&&this.gridState.set(U(x({},M),{pageIndex:r,pageSize:o}));return}let a=r*o,s=o!==M.pageSize;if(!(s||!M.loadedPages.includes(r))){r!==M.pageIndex&&this.gridState.set(U(x({},M),{pageIndex:r}));return}this.suppressPaginationEvents=!0,this.fetchGridPage(M.gridId,r,o).then(N=>{let c=this.gridState();if(c?.gridId!==M.gridId){this.suppressPaginationEvents=!1;return}let D=N?.config?.chart??{},I=Array.isArray(D.data)?D.data:[],d=s?Array.from({length:c.total},()=>({})):c.rows.slice();I.forEach((z,E)=>{d[a+E]=z});let y=s?[r]:[...c.loadedPages,r];this.gridState.set(U(x({},c),{rows:d,loadedPages:y,pageIndex:r,pageSize:o})),this.observed?.publish(f3(I,N?.queryMeta)),this.pushGridData();let A=this.chartRef?.nativeElement?.shadowRoot?.querySelector("nile-data-grid");(A?.updateComplete??Promise.resolve()).then(()=>{A&&(A.pagination={pageIndex:r,pageSize:o}),(A?.updateComplete??Promise.resolve()).then(()=>{this.suppressPaginationEvents=!1})})}).catch(N=>{this.suppressPaginationEvents=!1,console.error("[nile-chart-widget] page fetch failed",N)})}handleGridFilterChange(e){let t=this.gridState(),M=e.detail?.filters??[];if(this.isServerGrid(this.config)&&t?.loaded&&this.config.chart.gridId===t.gridId){this.filterDebounce&&clearTimeout(this.filterDebounce),this.filterDebounce=setTimeout(()=>this.applyServerFilters(t.gridId,M),300);return}this.dataViewFilterChange.emit(M)}applyServerFilters(e,t){let M=this.gridState();if(!M||M.gridId!==e)return;let n=++this._dashboardFilterSeq,r=this._dashboardFilterRefetching;this.fetchGridPage(e,0,i.GRID_FULL_FETCH_ROWS,t).then(o=>{if(n!==this._dashboardFilterSeq)return;let a=this.gridState();if(!o||a?.gridId!==e)return;this.emitGridFilterVerdict(o);let s=o.config?.chart??{},l=Array.isArray(s.data)?s.data:[],N=Math.min(Number(o.total)||l.length,i.GRID_FULL_FETCH_ROWS);this.observed?.publish(f3(l,o.queryMeta)),this.gridState.set(U(x({},a),{filters:t,total:N,rows:l,pageIndex:0,loadedPages:[0],loaded:!0,fullyLoaded:!0}));let c=this.chartRef?.nativeElement;r&&c?(c.loading=!1,this.renderServerGrid(c)):this.pushGridData(l)}).catch(o=>{console.error("[nile-chart-widget] filter fetch failed",o)}).finally(()=>{if(n===this._dashboardFilterSeq&&(this._dashboardFilterRefetching=!1,r)){let o=this.chartRef?.nativeElement;o&&(o.loading=!1)}})}fetchGridPage(e,t,M,n){if(!this.gridPageFetcher)return Promise.resolve(null);let r=this.dashboardFilters&&Object.keys(this.dashboardFilters).length?this.dashboardFilters:void 0,o=this.resolvedFilters&&this.resolvedFilters.length?this.resolvedFilters:void 0;return Promise.resolve(this.gridPageFetcher(e,t,M,n,r,this.dashboardId,o,this.conversationId))}handleDashboardFilterChange(){let e=this.gridState();if(!e||!this.isServerGrid(this.config)||this.config.chart?.gridId!==e.gridId)return;if(!e.loaded){this._pendingDashboardFilterRefresh=!0;return}this._dashboardFilterRefetching=!0;let t=this.chartRef?.nativeElement;t&&(t.loading=!0),this.applyServerFilters(e.gridId,e.filters)}pushGridData(e){let t=this.chartRef?.nativeElement?.shadowRoot?.querySelector("nile-data-grid");if(!t)return;if(e)t.data=e;else{let n=this.gridState();n&&(t.data=[...n.rows])}let M=()=>{vB(t),ZB(t),this.injectCellFilterStyle(t)};t.updateComplete?t.updateComplete.then(M):M()}isFilterConfig(e){return e?.chart?.type==="filter"}getExpressionControl(e){let t=e?.chart?.controls;if(!t)return null;for(let M of t)if((M.variant==="expression"||M.variant==="hybrid")&&M.id)return{id:M.id,variant:M.variant};return null}handleAiSend(e){let t=e.detail,M=t?.message??t?.text??"",n=this.widgetId;if(!M||!n)return;let r=e.composedPath()[0];this.zone.run(()=>{this.aiSend.emit({widgetId:n,message:M,sessionId:this.sessionId,chartEl:r})})}handleSortChange(e){let t=e.detail?.sorting??[];this.zone.run(()=>{this.sortChange.emit({widgetId:this.widgetId,sorting:t})})}handleNileChange(e){let t=e.detail??{},M=t.filters??{},n=t.errors??{};this.latestFilterPayload={filters:M,errors:n};let r=this.getExpressionControl(this.config);if(!r)return;let o=M[r.id];if(r.variant==="hybrid"){let s=typeof o=="object"&&o!==null,l=n[r.id]!==void 0;if(!s&&!l)return}let a=typeof o=="string"?o:o?.source??"";this.zone.run(()=>{this.filterChange.emit({widgetId:this.widgetId,controlId:r.id,query:a})})}readLiveFilterValue(e){let t=this.chartRef?.nativeElement?.shadowRoot?.querySelector("nile-filter-chart"),M=t?.shadowRoot?.querySelector(`#fc-prompt-${CSS.escape(e)}`);if(M&&typeof M.value=="string")return M.value;let n=t?.selectedValues?.get(e);return typeof n=="string"?n:n&&typeof n=="object"?String(n.source??""):""}lastFilterFocusTs=0;handleFilterFocus(){let e=Date.now();if(e-this.lastFilterFocusTs<120)return;this.lastFilterFocusTs=e;let t=this.getExpressionControl(this.config);if(!t)return;let M=this.readLiveFilterValue(t.id);this.zone.run(()=>{this.filterChange.emit({widgetId:this.widgetId,controlId:t.id,query:M})})}handleFilterKeydown(e){let t=e;if(t.key!=="Enter"||t.shiftKey||t.isComposing)return;let M=this.getPromptControlId(this.config);if(!M)return;let n=this.readLiveFilterValue(M),r=this._filterMode;this.zone.run(()=>{this.filterSubmit.emit(x({widgetId:this.widgetId,filters:{[M]:n},errors:{},mode:r},r==="prompt"?{prompt:n}:{}))})}handleFilterClear(){this.zone.run(()=>{this.filterSubmit.emit({widgetId:this.widgetId,filters:{},errors:{}})})}static \u0275fac=function(t){return new(t||i)(oi(al),oi(Il),oi(q2,8),oi(bj,8))};static \u0275cmp=rM({type:i,selectors:[["shared-nile-chart-widget"]],viewQuery:function(t,M){if(t&1&&eN(Fvt,5),t&2){let n;gl(n=Nl())&&(M.chartRef=n.first)}},inputs:{config:"config",widgetId:"widgetId",widgetTitle:"widgetTitle",chromePinned:"chromePinned",loading:"loading",drilldownBy:"drilldownBy",menu:"menu",dashboardFilters:"dashboardFilters",resolvedFilters:"resolvedFilters",dashboardId:"dashboardId",conversationId:"conversationId",cellFilterEnabled:[1,"cellFilterEnabled"]},outputs:{aiSend:"aiSend",sortChange:"sortChange",filterSubmit:"filterSubmit",filterChange:"filterChange",chartClick:"chartClick",chartSelection:"chartSelection",chartSelectionReset:"chartSelectionReset",gridFilterVerdict:"gridFilterVerdict",menuAction:"menuAction",cellFilter:"cellFilter",dataViewFilterChange:"dataViewFilterChange"},features:[Fo],ngContentSelectors:Jvt,decls:1,vars:1,consts:[["nileChart",""],["fit",""],[1,"projected-actions"],["hoist","","placement","bottom-end"],["slot","trigger","type","button","aria-label","Switch chart view",1,"md-variant-toggle"],["name","ng-switch-horizontal-01","method","stroke","size","16"],[1,"md-variant-menu"],[1,"md-variant-divider"],[3,"click"],["slot","prefix","name","ng-refresh-ccw","method","stroke","size","14"],["slot","prefix","name","ng-check","method","stroke","size","14"]],template:function(t,M){t&1&&(tu(Hvt),he(0,Kvt,6,7,"nile-chart",1)),t&2&&xe(M.mounted?0:-1)},dependencies:[Jo],styles:['@charset "UTF-8";[_nghost-%COMP%]{display:block;width:100%;height:100%;overflow:hidden}nile-chart[_ngcontent-%COMP%]{display:block;width:100%;height:100%}nile-chart[_ngcontent-%COMP%]::part(ai-trigger){display:none}nile-chart[_ngcontent-%COMP%]::part(header){border-bottom:none}nile-chart[_ngcontent-%COMP%]::part(chart-card){border:unset;border-radius:unset;box-shadow:none}nile-chart[data-active-type=kpi][_ngcontent-%COMP%]::part(chart-card){position:relative}.projected-actions.kpi-overlay[_ngcontent-%COMP%]{position:absolute;top:var(--ng-spacing-xl, 16px);right:calc(var(--ng-spacing-3xl, 24px) - var(--ng-spacing-1, 4px));z-index:2;padding:0;border-top:none;opacity:0;pointer-events:none;transition:opacity .12s ease-in-out}[_nghost-%COMP%]:hover .projected-actions.kpi-overlay[_ngcontent-%COMP%], [_nghost-%COMP%]:focus-within .projected-actions.kpi-overlay[_ngcontent-%COMP%], .projected-actions.kpi-overlay--pinned[_ngcontent-%COMP%]{opacity:1;pointer-events:auto}@media(prefers-reduced-motion:reduce){.projected-actions.kpi-overlay[_ngcontent-%COMP%]{transition:none}}nile-chart[_ngcontent-%COMP%]::part(header-actions){margin-right:calc(-1 * var(--ng-spacing-1, 4px))}.projected-actions[_ngcontent-%COMP%]{display:flex;gap:var(--ng-spacing-xs, 4px);align-items:center}.md-variant-toggle[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;padding:var(--ng-spacing-1);border:none;border-radius:var(--ng-radius-md);background:transparent;color:var(--ng-colors-fg-quaternary-400);cursor:pointer}.md-variant-toggle[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-secondary);color:var(--ng-colors-text-primary-900)}.md-variant-divider[_ngcontent-%COMP%]{height:1px;margin:4px 8px;background:var(--ng-colors-border-secondary, #e9eaeb)}']})};function Jm(i){switch(i?.reason){case"no_applicable_field":return"Filter not applicable to this widget";case"execution_error":case"execution_error_fallback":return"Couldn't apply filter here";case"not_filterable_in_memory":return"Filtered on loaded data only";case"or_unsupported_for_widget":return"This widget can't combine those filters with OR";case"kpi_value_ambiguous":return"Couldn't identify this KPI's value under the filter";default:return"Filter not applied"}}var eYt=["bar"],XB=(i,e)=>e.id??e.label,Sst=(i,e)=>e.id;function tYt(i,e){if(i&1){let t=Le();C(0,"nile-menu-item",10),Ae("click",function(){let n=R(t).$implicit,r=p();return V(r.addRow(n.id??n.name??n.label))}),Y(1),b()}if(i&2){let t=e.$implicit;L(),yi(" ",t.label," ")}}function iYt(i,e){i&1&&Zt(0,"nile-skeleton-loader",8)}function MYt(i,e){if(i&1){let t=Le();C(0,"button",28),Ae("click",function(){R(t);let n=p().$implicit,r=p();return V(r.toggleConnector(n))}),Y(1),b()}if(i&2){let t=p().$implicit,M=p();Pt("mf-conn--disabled",M.disabled()),Ue("title",t.connector==="or"?"Matches EITHER side \u2014 click for AND":"Matches BOTH sides \u2014 click for OR"),It("aria-label","Change join to previous filter (currently "+(t.connector==="or"?"OR":"AND")+")"),L(),it(t.connector==="or"?"OR":"AND")}}function nYt(i,e){if(i&1){let t=Le();C(0,"nile-menu-item",10),Ae("click",function(){let n=R(t).$implicit,r=p().$implicit,o=p();return V(o.changeOp(r,n))}),Y(1),b()}if(i&2){let t=e.$implicit,M=p(2);L(),it(M.operatorLabels[t])}}function rYt(i,e){if(i&1){let t=Le();C(0,"nile-select",29),Ae("nile-change",function(n){R(t);let r=p().$implicit,o=p();return V(o.setScalar(r,n.target.value))}),C(1,"nile-option",30),Y(2,"true"),b(),C(3,"nile-option",31),Y(4,"false"),b()()}if(i&2){let t=p().$implicit;Ue("value",t.value)}}function oYt(i,e){if(i&1){let t=Le();C(0,"nile-date-picker",34),Ae("nile-change",function(n){R(t);let r=p(2).$implicit,o=p();return V(o.setRangeDate(r,n.detail))}),Zt(1,"nile-input",35),b()}if(i&2){let t=p(2).$implicit,M=p();Ue("dateFormat",M.dateFormatFor(t)),L(),Ue("value",M.rangeTriggerText(t))}}function aYt(i,e){if(i&1){let t=Le();C(0,"nile-date-picker",36),Ae("nile-change",function(n){R(t);let r=p(2).$implicit,o=p();return V(o.setSingleDate(r,n.detail))}),Zt(1,"nile-input",37),b()}if(i&2){let t=p(2).$implicit,M=p();Ue("dateFormat",M.dateFormatFor(t)),L(),Ue("value",M.singleTriggerText(t))}}function sYt(i,e){if(i&1&&he(0,oYt,2,2,"nile-date-picker",32)(1,aYt,2,2,"nile-date-picker",33),i&2){let t=p().$implicit,M=p();xe(M.isBetween(t)?0:1)}}function lYt(i,e){if(i&1){let t=Le();C(0,"div",19)(1,"nile-input",38),Ae("nile-change",function(n){R(t);let r=p().$implicit,o=p();return V(o.setRangeMin(r,n.detail.value))}),b(),C(2,"span",39),Y(3,"\u2013"),b(),C(4,"nile-input",40),Ae("nile-change",function(n){R(t);let r=p().$implicit,o=p();return V(o.setRangeMax(r,n.detail.value))}),b()()}if(i&2){let t=p().$implicit;L(),Ue("value",t.rangeMin),L(3),Ue("value",t.rangeMax)}}function gYt(i,e){if(i&1){let t=Le();C(0,"nile-input",41),Ae("nile-change",function(n){R(t);let r=p().$implicit,o=p();return V(o.setScalar(r,n.detail==null?null:n.detail.value))}),b()}if(i&2){let t=p().$implicit;Ue("value",t.value)}}function NYt(i,e){if(i&1){let t=Le();C(0,"nile-combobox",42),Ae("nile-focus",function(){R(t);let n=p().$implicit,r=p();return V(r.listUsesFetcher(n)&&r.onTypeaheadSearch(n,""))})("nile-change",function(n){R(t);let r=p().$implicit,o=p();return V(o.isMulti(r)?o.setMulti(r,n.detail==null?null:n.detail.value):o.setScalar(r,n.detail==null?null:n.detail.value))}),b()}if(i&2){let t=p().$implicit,M=p();Ue("multiple",M.isMulti(t))("value",M.valueForControl(t))("autoCompleteOptions",M.listComboOptionsFor(t))("renderItemConfig",M.typeaheadRenderConfig)}}function uYt(i,e){if(i&1){let t=Le();C(0,"nile-combobox",43),Ae("nile-focus",function(){R(t);let n=p().$implicit,r=p();return V(r.onTypeaheadSearch(n,""))})("nile-search",function(n){R(t);let r=p().$implicit,o=p();return V(o.onTypeaheadSearchDebounced(r,(n.detail==null?null:n.detail.query)??""))})("nile-change",function(n){R(t);let r=p().$implicit,o=p();return V(o.isMulti(r)?o.setMulti(r,n.detail==null?null:n.detail.value):o.setScalar(r,n.detail==null?null:n.detail.value))}),b()}if(i&2){let t=p().$implicit,M=p();Ue("multiple",M.isMulti(t))("value",M.valueForControl(t))("autoCompleteOptions",M.typeaheadOptionsFor(t))("renderItemConfig",M.typeaheadRenderConfig)}}function cYt(i,e){if(i&1){let t=Le();C(0,"nile-combobox",44),Ae("nile-change",function(n){R(t);let r=p().$implicit,o=p();return V(o.setMulti(r,n.detail==null?null:n.detail.value))}),b()}if(i&2){let t=p().$implicit;Ue("value",t.values)}}function DYt(i,e){if(i&1){let t=Le();C(0,"nile-combobox",45),Ae("nile-change",function(n){R(t);let r=p().$implicit,o=p();return V(o.setScalar(r,n.detail==null?null:n.detail.value))}),b()}if(i&2){let t=p().$implicit,M=p();Ue("value",t.value)("autoCompleteOptions",M.listOptionsFor(t))}}function IYt(i,e){if(i&1){let t=Le();C(0,"nile-menu-item",10),Ae("click",function(){let n=R(t).$implicit,r=p(2).$implicit,o=p();return V(o.applyPreset(r,n.id))}),Y(1),b()}if(i&2){let t=e.$implicit;L(),it(t.label)}}function dYt(i,e){if(i&1&&(C(0,"nile-dropdown",25)(1,"button",46),Zt(2,"nile-glyph",47),b(),C(3,"nile-menu"),xt(4,IYt,2,1,"nile-menu-item",null,Sst),b()()),i&2){let t=p().$implicit,M=p();L(4),pt(M.relativePresetsFor(t))}}function jYt(i,e){if(i&1){let t=Le();he(0,MYt,2,5,"button",11),C(1,"div",12)(2,"span",13),Y(3),b(),C(4,"nile-dropdown",14)(5,"button",15)(6,"span"),Y(7),b(),Zt(8,"nile-glyph",16),b(),C(9,"nile-menu"),xt(10,nYt,2,1,"nile-menu-item",null,Ta),b()(),C(12,"div",17),he(13,rYt,5,1,"nile-select",18)(14,sYt,2,1)(15,lYt,5,2,"div",19)(16,gYt,1,1,"nile-input",20)(17,NYt,1,4,"nile-combobox",21)(18,uYt,1,4,"nile-combobox",22)(19,cYt,1,1,"nile-combobox",23)(20,DYt,1,2,"nile-combobox",24),b(),he(21,dYt,6,0,"nile-dropdown",25),C(22,"button",26),Ae("click",function(){let n=R(t).$implicit,r=p();return V(r.removeRow(n))}),Zt(23,"nile-glyph",27),b()()}if(i&2){let t=e.$implicit,M=e.$index,n=p();xe(M>0?0:-1),L(3),it(n.labelFor(t.field)),L(4),it(n.operatorLabels[t.op]),L(3),pt(n.operatorsFor(t.field)),L(3),xe(n.isBoolean(t)?13:n.isDate(t)?14:n.isBetween(t)?15:n.fieldTypeFor(t.field)==="number"&&!n.isMulti(t)?16:n.valueModeOf(t)==="list"?17:n.usesTypeahead(t)?18:n.isMulti(t)?19:20),L(8),xe(n.relativePresetsFor(t).length?21:-1)}}function yYt(i,e){if(i&1){let t=Le();C(0,"nile-menu-item",10),Ae("click",function(){let n=R(t).$implicit,r=p(2);return V(r.addRow(n.id??n.name??n.label,"or"))}),Y(1),b()}if(i&2){let t=e.$implicit;L(),it(t.label)}}function TYt(i,e){if(i&1){let t=Le();C(0,"nile-menu-item",10),Ae("click",function(){let n=R(t).$implicit,r=p(2);return V(r.addRow(n.id??n.name??n.label,"and"))}),Y(1),b()}if(i&2){let t=e.$implicit;L(),it(t.label)}}function AYt(i,e){if(i&1){let t=Le();C(0,"div",9)(1,"nile-dropdown",48)(2,"span",49)(3,"span",50),Zt(4,"nile-glyph",51),b(),Y(5," OR "),b(),C(6,"nile-menu",7),Ae("nile-search-value",function(n){R(t);let r=p();return V(r.attrSearch.set((n.detail==null?null:n.detail.value)??""))}),xt(7,yYt,2,1,"nile-menu-item",null,XB),b()(),C(9,"nile-dropdown",48)(10,"span",49)(11,"span",50),Zt(12,"nile-glyph",51),b(),Y(13," AND "),b(),C(14,"nile-menu",7),Ae("nile-search-value",function(n){R(t);let r=p();return V(r.attrSearch.set((n.detail==null?null:n.detail.value)??""))}),xt(15,TYt,2,1,"nile-menu-item",null,XB),b()(),C(17,"button",52),Ae("click",function(){R(t);let n=p();return V(n.clearAll())}),Zt(18,"nile-glyph",27),Y(19," Clear "),b()()}if(i&2){let t=p();L(2),Pt("mf-conn-add__btn--disabled",t.disabled()),L(5),pt(t.menuAttributes()),L(3),Pt("mf-conn-add__btn--disabled",t.disabled()),L(5),pt(t.menuAttributes())}}var zYt=/^-?\d+(\.\d+)?$/,hYt=0,xYt=()=>`mf-row-${++hYt}`,k3=class i{catalog=gt([]);conditions=gt([]);catalogLoading=gt(!1);disabled=gt(!1);valueFetcher=gt(null);onDashboardFields=gt([]);recentlyUsedFields=gt([]);attrSearch=ke("");conditionsChange=Xi();operatorLabels=e0;expanded=gt(!1);contentHeight=Xi();overflowCountChange=Xi();overflowCount=-1;lastContentHeight=0;barRef=Ef("bar");resizeObs;rows=ke([]);typeaheadRowId=ke(null);typeaheadOptions=ke([]);typeaheadLoading=ke(!1);static LOADING_VALUE="\0__loading__";static LOADING_ROW={value:"\0__loading__",label:"Loading\u2026"};typeaheadSeq=0;static TYPEAHEAD_DEBOUNCE_MS=250;typeaheadDebounce=null;inFlightFetchKey=null;lastEmittedKey="";constructor(){eo(()=>{let e=this.conditions(),t=YI(e);t!==this.lastEmittedKey&&(this.lastEmittedKey=t,this.rows.set(e.map(M=>this.conditionToRow(M))))},{allowSignalWrites:!0}),ld(()=>{let e=this.barRef()?.nativeElement;!e||typeof ResizeObserver>"u"||(this.resizeObs=new ResizeObserver(()=>this.measureOverflow()),this.resizeObs.observe(e),this.measureOverflow())})}ngOnDestroy(){this.resizeObs?.disconnect(),this.typeaheadDebounce&&clearTimeout(this.typeaheadDebounce)}measureOverflow(){let e=this.barRef()?.nativeElement;if(!e)return;let t=Array.from(e.querySelectorAll(".mf-pill")),n=[...new Set(t.map(a=>Math.round(a.offsetTop)))].sort((a,s)=>a-s)[1],r=n===void 0?0:t.filter(a=>Math.round(a.offsetTop)>n).length;r!==this.overflowCount&&(this.overflowCount=r,this.overflowCountChange.emit(r));let o=e.scrollHeight;o!==this.lastContentHeight&&(this.lastContentHeight=o,this.contentHeight.emit(o))}attributes=zt(()=>m3(this.catalog().filter(e=>e.type==="attribute").filter(e=>O3(e)),{onDashboard:this.onDashboardFields(),recentlyUsed:this.recentlyUsedFields()}));menuAttributes=zt(()=>{let e=this.attrSearch(),t=this.attributes();return e?t.filter(M=>Ast(M,e)):t});onDashboardSet=zt(()=>new Set(this.onDashboardFields()));isOnDashboard(e){let t=this.onDashboardSet();return[e.id,e.name,e.label].some(M=>!!M&&t.has(M))}attrFor(e){return this.attributes().find(t=>t.id===e||t.name===e||t.label===e)}labelFor(e){return this.attrFor(e)?.label??e}fieldTypeFor(e){return this.attrFor(e)?.fieldType}operatorsFor(e){return L3(this.attrFor(e)??{})}defaultOperatorFor(e){return RB(this.attrFor(e)??{})}valueModeFor(e){let t=this.attrFor(e);return t?Vm(t):"free"}isBetween(e){return e.op==="between"}isMulti(e){return e.op==="in"||e.op==="not in"}isDate(e){return this.fieldTypeFor(e.field)==="date"||/(^|[_\s])(date|time|timestamp|datetime)|_(at|on)$/i.test(e.field)?!0:(e.op==="between"?[e.rangeMin,e.rangeMax]:[e.value]).some(M=>typeof M=="string"&&/^\d{4}-\d{2}-\d{2}[T ]/.test(M.trim()))}isBoolean(e){return this.fieldTypeFor(e.field)==="boolean"}valueModeOf(e){return this.valueModeFor(e.field)}usesTypeahead(e){return this.valueModeOf(e)==="search"&&!!this.valueFetcher()}listOptionsFor(e){let M=this.attrFor(e.field)?.sampleValues;return M?.length?M.map(n=>({value:n,label:n})):this.catalog().filter(n=>n.type==="value"&&(!n.id||n.id===e.field)).map(n=>({value:n.label,label:n.label}))}listComboOptionsFor(e){let t=this.typeaheadOptionsFor(e);return t.length?t:this.listOptionsFor(e)}listUsesFetcher(e){return this.valueModeOf(e)==="list"&&!!this.valueFetcher()}relativePresetsFor(e){if(this.fieldTypeFor(e.field)!=="date")return[];let t=this.attrFor(e.field)?.relativePresets;return(t?.length?t:FB).filter(n=>HB(n.id))}dateFormatFor(e){return this.attrFor(e.field)?.format??"YYYY-MM-DD"}fmtDateHour(e){let t=String(e??"").trim();if(!t)return"";let M=new Date(t);return Number.isNaN(M.getTime())?t:M.toISOString().slice(0,16).replace("T"," ")}rangeTriggerText(e){let t=this.fmtDateHour(e.rangeMin),M=this.fmtDateHour(e.rangeMax);return t&&M?`${t} \u2013 ${M}`:t||M}singleTriggerText(e){return this.fmtDateHour(e.value)}typeaheadOptionsFor(e){if(this.typeaheadRowId()!==e.id)return[];let t=this.typeaheadOptions();return t.length===0&&this.typeaheadLoading()?[i.LOADING_ROW]:t}typeaheadRenderConfig={getDisplayText:e=>e.label,getSuffix:()=>""};addRow(e,t="and"){if(this.disabled())return;let M=this.blankRow(e,t);this.rows.update(n=>[...n,M]),this.commit()}toggleConnector(e){this.disabled()||this.patch(e,{connector:e.connector==="or"?"and":"or"})}changeOp(e,t){this.rows.update(M=>M.map(n=>{if(n.id!==e.id)return n;let r=U(x({},n),{op:t}),o=!this.opIsMulti(n.op)&&!this.opIsBetween(n.op),a=!this.opIsMulti(t)&&!this.opIsBetween(t);return o&&a||(r.value=this.fieldTypeFor(n.field)==="boolean"?"true":"",r.values=[],r.rangeMin="",r.rangeMax=""),r})),this.commit()}setScalar(e,t){let M=Array.isArray(t)?t[0]??"":t??"";M!==i.LOADING_VALUE&&this.patch(e,{value:M})}setMulti(e,t){let n=(Array.isArray(t)?t:t?[t]:[]).filter(r=>r!=null&&r!==""&&r!==i.LOADING_VALUE);this.patch(e,{values:n})}setRangeMin(e,t){this.patch(e,{rangeMin:t})}setRangeMax(e,t){this.patch(e,{rangeMax:t})}setSingleDate(e,t){this.patch(e,{value:this.toDateString(t?.value??t?.startDate)})}setRangeDate(e,t){this.patch(e,{rangeMin:this.toDateString(t?.startDate),rangeMax:this.toDateString(t?.endDate??t?.startDate)})}applyPreset(e,t){let M=E3(t);M&&this.patch(e,{op:"between",rangeMin:M.min,rangeMax:M.max})}removeRow(e){this.rows.update(t=>t.filter(M=>M.id!==e.id)),this.commit()}clearAll(){this.disabled()||(this.rows.set([]),this.commit())}onTypeaheadSearchDebounced(e,t){this.typeaheadDebounce&&clearTimeout(this.typeaheadDebounce),this.typeaheadDebounce=setTimeout(()=>{this.typeaheadDebounce=null,this.onTypeaheadSearch(e,t)},i.TYPEAHEAD_DEBOUNCE_MS)}async onTypeaheadSearch(e,t){this.typeaheadDebounce&&(clearTimeout(this.typeaheadDebounce),this.typeaheadDebounce=null);let M=this.valueFetcher();if(!M||!e.field)return;let n=`${e.id}\0${(t??"").trim()}`;if(n===this.inFlightFetchKey)return;this.inFlightFetchKey=n,this.typeaheadRowId()!==e.id&&this.typeaheadOptions.set([]),this.typeaheadRowId.set(e.id);let r=++this.typeaheadSeq;this.typeaheadLoading.set(!0);try{let o=await M(e.field,t??"");if(r!==this.typeaheadSeq)return;this.typeaheadOptions.set(o.map(a=>({value:String(a.value),label:a.label??String(a.value),observed:a.observed})))}catch{r===this.typeaheadSeq&&this.typeaheadOptions.set([])}finally{this.inFlightFetchKey===n&&(this.inFlightFetchKey=null),r===this.typeaheadSeq&&this.typeaheadLoading.set(!1)}}patch(e,t){this.rows.update(M=>M.map(n=>n.id===e.id?x(x({},n),t):n)),this.commit()}blankRow(e,t="and",M=xYt()){let n=zst(e),r=this.defaultOperatorFor(n),o=this.fieldTypeFor(n)==="boolean"?"true":"";return{id:M,field:n,op:r,value:o,values:[],rangeMin:"",rangeMax:"",connector:t}}opIsMulti(e){return e==="in"||e==="not in"}opIsBetween(e){return e==="between"}rowValid(e){if(!e.field)return!1;if(this.opIsBetween(e.op)){let t=e.rangeMin.trim(),M=e.rangeMax.trim();if(t===""||M==="")return!1;if(this.fieldTypeFor(e.field)==="number"){let n=Number(t),r=Number(M);if(Number.isFinite(n)&&Number.isFinite(r)&&n>r)return!1}else if(this.fieldTypeFor(e.field)==="date"&&t>M)return!1;return!0}return this.opIsMulti(e.op)?e.values.length>0:e.value.trim()!==""}rowToCondition(e){let t=this.fieldTypeFor(e.field),M={field:e.field,connector:e.connector};return this.opIsBetween(e.op)?U(x({},M),{op:"between",value:[this.coerce(e.rangeMin,t),this.coerce(e.rangeMax,t)]}):this.opIsMulti(e.op)?U(x({},M),{op:e.op,value:e.values.map(n=>this.coerce(n,t))}):t==="boolean"?U(x({},M),{op:"==",value:e.value==="true"}):U(x({},M),{op:e.op,value:this.coerce(e.value,t)})}conditionToRow(e){let t=this.blankRow(e.field,e.connector??"and");return t.op=e.op,e.op==="between"&&Array.isArray(e.value)?(t.rangeMin=String(e.value[0]??""),t.rangeMax=String(e.value[1]??"")):(e.op==="in"||e.op==="not in")&&Array.isArray(e.value)?t.values=e.value.map(M=>String(M)):t.value=String(e.value),t}commit(){let e=this.rows().filter(M=>this.rowValid(M)).map(M=>this.rowToCondition(M)),t=YI(e);t!==this.lastEmittedKey&&(this.lastEmittedKey=t,this.conditionsChange.emit(e))}coerce(e,t){return t==="date"?e:(t==="number"||t===void 0)&&zYt.test(e)?Number(e):e}toDateString(e){if(!e)return"";if(typeof e=="string"){let o=e.match(/^(\d{4})-(\d{2})-(\d{2})/);if(o)return`${o[1]}-${o[2]}-${o[3]}`}let t=new Date(e);if(isNaN(t.getTime()))return typeof e=="string"?e:"";let M=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${M}-${n}-${r}`}valueForControl(e){return this.isMulti(e)?e.values:e.value}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=rM({type:i,selectors:[["shared-manual-filter-panel"]],viewQuery:function(t,M){t&1&&Of(M.barRef,eYt,5),t&2&&mf()},inputs:{catalog:[1,"catalog"],conditions:[1,"conditions"],catalogLoading:[1,"catalogLoading"],disabled:[1,"disabled"],valueFetcher:[1,"valueFetcher"],onDashboardFields:[1,"onDashboardFields"],recentlyUsedFields:[1,"recentlyUsedFields"],expanded:[1,"expanded"]},outputs:{conditionsChange:"conditionsChange",contentHeight:"contentHeight",overflowCountChange:"overflowCountChange"},decls:15,vars:6,consts:[["bar",""],[1,"mf-panel"],[1,"mf-panel__clip"],[1,"mf-panel__bar"],["hoist","","placement","bottom-start",1,"mf-add"],["slot","trigger",1,"mf-add__btn"],["name","ng-list-filter","method","stroke","size","14","color","var(--ng-colors-bg-brand-solid)"],["searchEnabled","","customSearch","",3,"nile-search-value"],["variant","rounded","width","200","height","34"],[1,"mf-actions"],[3,"click"],["type","button",1,"mf-conn","mf-conn--toggle",3,"mf-conn--disabled","title"],[1,"mf-pill"],[1,"mf-seg","mf-seg--field"],["hoist","","placement","bottom-start",1,"mf-pill__menu"],["slot","trigger","type","button",1,"mf-seg","mf-seg--op"],["name","ng-chevron-down","method","stroke","size","12"],[1,"mf-seg","mf-seg--value"],["size","small","hoist","",3,"value"],[1,"mf-range"],["size","small","type","number","placeholder","Value",3,"value"],["size","small","hoist","","portal","","clearable","","allowCustomValue","","placeholder","Value",3,"multiple","value","autoCompleteOptions","renderItemConfig"],["size","small","hoist","","portal","","clearable","","allowCustomValue","","disableLocalSearch","","placeholder","Search\u2026",3,"multiple","value","autoCompleteOptions","renderItemConfig"],["size","small","hoist","","portal","","clearable","","allowCustomValue","","multiple","","placeholder","Add values",3,"value"],["size","small","hoist","","portal","","clearable","","allowCustomValue","","placeholder","Value","noDataMessage","Type a value",3,"value","autoCompleteOptions"],["hoist","","placement","bottom-start",1,"mf-pill__menu","borders"],["type","button","aria-label","Remove filter",1,"mf-pill__x",3,"click"],["name","ng-x-close","method","stroke","size","12"],["type","button",1,"mf-conn","mf-conn--toggle",3,"click","title"],["size","small","hoist","",3,"nile-change","value"],["value","true"],["value","false"],["range","","allowClear","",3,"dateFormat"],["allowClear","",3,"dateFormat"],["range","","allowClear","",3,"nile-change","dateFormat"],["slot","trigger","size","small","placeholder","Date range",3,"value"],["allowClear","",3,"nile-change","dateFormat"],["slot","trigger","size","small","placeholder","Pick a date",3,"value"],["size","small","type","number","placeholder","Min",3,"nile-change","value"],[1,"mf-range__sep"],["size","small","type","number","placeholder","Max",3,"nile-change","value"],["size","small","type","number","placeholder","Value",3,"nile-change","value"],["size","small","hoist","","portal","","clearable","","allowCustomValue","","placeholder","Value",3,"nile-focus","nile-change","multiple","value","autoCompleteOptions","renderItemConfig"],["size","small","hoist","","portal","","clearable","","allowCustomValue","","disableLocalSearch","","placeholder","Search\u2026",3,"nile-focus","nile-search","nile-change","multiple","value","autoCompleteOptions","renderItemConfig"],["size","small","hoist","","portal","","clearable","","allowCustomValue","","multiple","","placeholder","Add values",3,"nile-change","value"],["size","small","hoist","","portal","","clearable","","allowCustomValue","","placeholder","Value","noDataMessage","Type a value",3,"nile-change","value","autoCompleteOptions"],["slot","trigger","type","button","title","Relative date",1,"mf-seg","mf-seg--preset"],["name","ng-calendar","method","stroke","size","12"],["hoist","","placement","bottom-end",1,"mf-conn-add"],["slot","trigger",1,"mf-conn-add__btn"],[1,"mf-conn-add__ring"],["name","ng-plus","method","stroke","size","10"],["type","button",1,"mf-clear",3,"click"]],template:function(t,M){t&1&&(C(0,"div",1)(1,"div",2)(2,"div",3,0)(4,"nile-dropdown",4)(5,"span",5),Zt(6,"nile-glyph",6),Y(7," Add filter "),b(),C(8,"nile-menu",7),Ae("nile-search-value",function(r){return M.attrSearch.set((r.detail==null?null:r.detail.value)??"")}),xt(9,tYt,2,1,"nile-menu-item",null,XB),b()(),he(11,iYt,1,0,"nile-skeleton-loader",8),xt(12,jYt,24,5,null,null,Sst),he(14,AYt,20,4,"div",9),b()()()),t&2&&(L(),Pt("mf-panel__clip--collapsed",!M.expanded()),L(4),Pt("mf-add__btn--disabled",M.disabled()),L(4),pt(M.menuAttributes()),L(2),xe(M.catalogLoading()&&!M.rows().length?11:-1),L(),pt(M.rows()),L(2),xe(M.rows().length?14:-1))},dependencies:[Jo],styles:["[_nghost-%COMP%]{display:flex;width:100%;height:100%;overflow:visible}.mf-panel[_ngcontent-%COMP%]{position:relative;display:flex;flex-direction:column;width:100%;height:100%;padding:var(--ng-spacing-4) var(--ng-spacing-5) 0 var(--ng-spacing-5)}.mf-panel__bar[_ngcontent-%COMP%]{position:relative;display:flex;flex-wrap:wrap;align-items:center;gap:var(--ng-spacing-2);min-width:0;padding-right:200px}.mf-pill[_ngcontent-%COMP%]{display:inline-flex;align-items:stretch;height:34px;border:1px solid var(--ng-colors-border-secondary);border-radius:var(--ng-radius-md);background:var(--ng-colors-bg-primary);overflow:hidden}.mf-pill__menu[_ngcontent-%COMP%]{display:inline-flex}.borders[_ngcontent-%COMP%]{border-right:1px solid var(--ng-colors-border-secondary)}.mf-seg[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:var(--ng-spacing-1);height:100%;padding:0 var(--ng-spacing-2);border:none;background:transparent;font:inherit;font-size:13px;color:var(--ng-colors-text-primary-900);white-space:nowrap;cursor:pointer}.mf-seg--field[_ngcontent-%COMP%]{font-weight:500;border-right:1px solid var(--ng-colors-border-primary);cursor:default}.mf-seg--op[_ngcontent-%COMP%]:hover, .mf-seg--preset[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-secondary)}.mf-seg[_ngcontent-%COMP%] nile-glyph[_ngcontent-%COMP%]{color:var(--ng-colors-fg-quaternary-400)}.mf-seg--value[_ngcontent-%COMP%]{padding:0;cursor:default}.mf-seg--value[_ngcontent-%COMP%] nile-input[_ngcontent-%COMP%], .mf-seg--value[_ngcontent-%COMP%] nile-combobox[_ngcontent-%COMP%], .mf-seg--value[_ngcontent-%COMP%] nile-select[_ngcontent-%COMP%], .mf-seg--value[_ngcontent-%COMP%] nile-date-picker[_ngcontent-%COMP%]{--nile-input-border-color: transparent;min-width:120px}.mf-seg--value[_ngcontent-%COMP%] nile-date-picker[_ngcontent-%COMP%]{--nile-input-standard-border-color: transparent;--nile-input-standard-background-color: transparent}.mf-seg--value[_ngcontent-%COMP%] nile-date-picker[_ngcontent-%COMP%] nile-input[_ngcontent-%COMP%]{min-width:280px}.mf-range[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:var(--ng-spacing-1)}.mf-range[_ngcontent-%COMP%] nile-input[_ngcontent-%COMP%]{min-width:72px}.mf-range__sep[_ngcontent-%COMP%]{color:var(--ng-colors-text-secondary-700)}.mf-pill__x[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;padding:0 var(--ng-spacing-2);border:none;background:transparent;color:var(--ng-colors-fg-quaternary-400);cursor:pointer}.mf-pill__x[_ngcontent-%COMP%]:hover{color:var(--ng-colors-fg-error-primary);background:var(--ng-colors-bg-error-primary)}.mf-add[_ngcontent-%COMP%]{display:inline-flex}.mf-add__btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:var(--ng-spacing-1);height:34px;font:inherit;font-size:14px;font-weight:500;color:var(--ng-colors-fg-brand-primary-600);cursor:pointer}.mf-add__btn[_ngcontent-%COMP%] nile-glyph[_ngcontent-%COMP%]{color:var(--ng-colors-fg-quaternary-400)}.mf-add__btn--disabled[_ngcontent-%COMP%]{pointer-events:none;opacity:.5}.mf-clear[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:var(--ng-spacing-1);height:34px;padding:0 var(--ng-spacing-3);border:1px solid var(--ng-colors-border-secondary);border-radius:var(--ng-radius-md);background:var(--ng-colors-bg-primary);font:inherit;font-size:13px;font-weight:500;color:var(--ng-colors-text-secondary-700);cursor:pointer}.mf-clear[_ngcontent-%COMP%]:hover{color:var(--ng-colors-fg-error-primary)}.mf-panel__clip--collapsed[_ngcontent-%COMP%]{max-height:calc(68px + var(--ng-spacing-2));overflow:hidden}.mf-actions[_ngcontent-%COMP%]{position:absolute;top:0;right:0;display:inline-flex;align-items:center;gap:var(--ng-spacing-2)}.mf-conn-add__btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:var(--ng-spacing-1);height:34px;font-size:14px;font-weight:500;color:var(--ng-colors-fg-brand-primary-600);cursor:pointer}.mf-conn-add__btn[_ngcontent-%COMP%] nile-glyph[_ngcontent-%COMP%]{color:var(--ng-colors-fg-brand-primary-600)}.mf-conn-add__ring[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;border:1px solid currentColor;border-radius:50%}.mf-conn-add__btn--disabled[_ngcontent-%COMP%]{pointer-events:none;opacity:.5}.mf-conn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;font-size:11px;font-weight:600;color:var(--ng-colors-text-tertiary-600)}.mf-conn--toggle[_ngcontent-%COMP%]{padding:2px var(--ng-spacing-1);border:1px solid transparent;border-radius:var(--ng-radius-xs, 4px);background:none;font:inherit;font-size:11px;font-weight:600;line-height:1;color:var(--ng-colors-text-tertiary-600);cursor:pointer}.mf-conn--toggle[_ngcontent-%COMP%]:hover, .mf-conn--toggle[_ngcontent-%COMP%]:focus-visible{border-color:var(--ng-colors-border-brand);color:var(--ng-colors-fg-brand-primary-600)}.mf-conn--toggle[_ngcontent-%COMP%]:focus-visible{outline:none}.mf-conn--disabled[_ngcontent-%COMP%]{pointer-events:none;opacity:.5}"]})};var pYt=`
40493
+ >`}let a=`mf-viz__num${uvt(t)}`;return j`<span class=${a}>${YB(r,t,o)}</span>`}})})}var _m=null;function ZB(i){let e=i.shadowRoot;e&&(_m||(_m=new CSSStyleSheet,_m.replaceSync(lvt)),!e.adoptedStyleSheets.includes(_m)&&(e.adoptedStyleSheets=[...e.adoptedStyleSheets,_m]))}function T3(i){if(Array.isArray(i))return i.map(e=>{let t=e;return Array.isArray(t.columns)?U(x({},t),{columns:T3(t.columns)}):t.cell||!t.accessorKey||t.type==="checkbox"||t.type==="select"?t:U(x({},t),{cell:M=>{if(M.value===void 0||M.value===null||M.value==="")return"";let n=String(M.value);return j`<span class="mf-text" title=${n}>${M.value}</span>`}})})}var _B=kG??bG;_B.addBinaryOp?.("~=",6);var h3=_B,cvt=new Set(["==","!=","<","<=",">",">=","~="]);function A3(i){return!!i&&i.type==="Identifier"}function Dvt(i){return!!i&&i.type==="CallExpression"}function Ivt(i){return Dvt(i)&&A3(i.callee)&&i.callee.name==="in"}function z3(i,e){if(!(!i||typeof i!="object")){if(i.type==="BinaryExpression"){let t=i;cvt.has(t.operator)&&(A3(t.left)&&e(t.left.name),z3(t.left,e),z3(t.right,e));return}if(i.type==="Compound"){dst(i.body,e);return}}}function dst(i,e){let t=0;for(;t<i.length;){let M=i[t];if(A3(M)){let n=t+1;if(A3(i[n])&&i[n].name==="not"&&(n+=1),Ivt(i[n])){e(M.name),t=n+1;continue}t+=1;continue}z3(M,e),t+=1}}function dvt(i,e){let t;try{t=_B(i)}catch{return}t.type==="Compound"?dst(t.body,e):z3(t,e)}function x3(i,e){let t=new Set,M=[],n=r=>{!r||t.has(r)||(t.add(r),M.push(r))};for(let r of Object.values(i||{}))typeof r!="string"||r.trim()===""||dvt(r,n);return M.map(r=>({field:r,label:e(r)||r}))}var Pm=["==","!=","<","<=",">",">=","~="],e0={"==":"is","!=":"is not","~=":"contains","<":"less than","<=":"at most",">":"greater than",">=":"at least",in:"is any of","not in":"is none of",between:"between"},jvt=/int|decimal|numeric|float|double|real|number|long|money/,yvt=/^(boolean|bool|bit)$/,Tvt=/^(date|datetime2?|datetimeoffset|smalldatetime|timestamptz|timestamp)\b/;function LA(i){return!!i&&jvt.test(i.toLowerCase())}function Avt(i){return!!i&&yvt.test(i.toLowerCase())}function Rm(i){return!!i&&Tvt.test(i.trim().toLowerCase())}var zvt=["==","!=","in","not in"],hvt=["~=","==","!=","in"],xvt=["==","!=",">","<",">=","<=","between"],pvt=["==","<",">","between"],Lvt=["=="];function Tst(i,e){switch(i){case"number":return[...xvt];case"date":return[...pvt];case"boolean":return[...Lvt];case"string":return e==="list"?[...zvt]:[...hvt];default:return[...Pm]}}var Ovt=new Set(["==","!=","<","<=",">",">=","~=","in","not in","between"]);function L3(i){let e=(i.operators??[]).filter(t=>Ovt.has(t));return e.length?e:Tst(i.fieldType,Vm(i))}function RB(i){let e=L3(i);return e.find(t=>t!=="between")??e[0]??"=="}function Vm(i){return i.valueMode?i.valueMode:i.fieldType==="boolean"||i.enumerable||i.sampleValues?.length?"list":"free"}var mvt=1e4,Evt=/(password|passwd|secret|credential|api[_-]?key|access[_-]?key|private[_-]?key|token|_enc$|_encrypted$|magic[_-]?link|magic[_-]?token|ssn|social[_-]?security)/i;function O3(i){return i.suggestible===!1||i.piiExcluded===!0?!1:i.suggestible===!0?!0:![i.id,i.name,i.label].some(e=>typeof e=="string"&&Evt.test(e))}function jst(i){return[i.id,i.name,i.label].filter(e=>!!e)}function fvt(i){return!(Vm(i)==="free"||typeof i.cardinality=="number"&&i.cardinality>mvt)}function Ast(i,e){let t=(e??"").trim().toLowerCase();return t?[i.label,i.name,i.id,i.semanticType].some(M=>typeof M=="string"&&M.toLowerCase().includes(t)):!0}function m3(i,e={}){let t=new Set(e.onDashboard??[]),M=e.recentlyUsed??[],n=l=>{let N=1/0;for(let c of jst(l)){let D=M.indexOf(c);D!==-1&&D<N&&(N=D)}return N},r=l=>jst(l).some(N=>t.has(N)),o=l=>r(l)?0:n(l)!==1/0?1:fvt(l)?2:3,a=i.map((l,N)=>({a:l,i:N,tier:o(l),rec:n(l)}));if(!a.some(l=>l.tier<=1))return i.slice();let s=l=>(l.label??"").toLowerCase();return a.sort((l,N)=>{if(l.tier!==N.tier)return l.tier-N.tier;if(l.tier===1&&l.rec!==N.rec)return l.rec-N.rec;let c=s(l.a).localeCompare(s(N.a));return c!==0?c:l.i-N.i}).map(l=>l.a)}function Svt(i){return i.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function p3(i){return typeof i=="number"||typeof i=="boolean"?String(i):`"${Svt(i)}"`}function wvt(i){let e=String(i);return/^[\w.]+$/.test(e)?e:`'${e.replace(/'/g,"\\'")}'`}function zst(i){let e=String(i).trim();return e.length>=2&&e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1).replace(/\\'/g,"'"):e}function PB(i){let{op:e,value:t}=i,M=wvt(i.field);return e==="between"&&Array.isArray(t)&&t.length===2?`${M} >= ${p3(t[0])} and ${M} <= ${p3(t[1])}`:(e==="in"||e==="not in")&&Array.isArray(t)?`${M} ${e} (${t.map(p3).join(", ")})`:`${M} ${e} ${p3(t)}`}function YI(i){if(!i.length)return"";let e=PB(i[0]);for(let t=1;t<i.length;t++)e+=` ${i[t].connector??"and"} ${PB(i[t])}`;return e}var Cvt={"==":"==","=":"==",eq:"==",equals:"==","!=":"!=","<>":"!=",ne:"!=",neq:"!=",">":">",gt:">",">=":">=",gte:">=","<":"<",lt:"<","<=":"<=",lte:"<=","~=":"~=",contains:"~=",like:"~=",in:"in","not in":"not in",notin:"not in",between:"between"};function kvt(i){if(typeof i=="string"||typeof i=="number"||typeof i=="boolean")return i;if(Array.isArray(i)){let e=i.filter(t=>typeof t=="string"||typeof t=="number");return e.length?e:void 0}}function Bm(i){let e=[];for(let t of i){let M=t.operation?Cvt[t.operation.trim().toLowerCase()]:void 0,n=kvt(t.value);if(!t.field||!M||n===void 0)continue;let r=Array.isArray(n);M==="between"&&!(r&&n.length===2)||(M==="in"||M==="not in")&&!r||M!=="between"&&M!=="in"&&M!=="not in"&&r||e.push({field:t.field,op:M,value:n})}return e}function VB(i){return i.op==="between"&&Array.isArray(i.value)?`${i.value[0]} \u2013 ${i.value[1]}`:Array.isArray(i.value)?i.value.join(", "):String(i.value)}function BB(i,e){let t=r=>`${r.field}\0${r.op}\0${JSON.stringify(r.value)}`,M=new Set(i.map(t)),n=[...i];for(let r of e){let o=t(r);M.has(o)||(M.add(o),n.push(r))}return n}var FB=[{id:"today",label:"Today"},{id:"yesterday",label:"Yesterday"},{id:"last_7_days",label:"Last 7 days"},{id:"last_30_days",label:"Last 30 days"},{id:"last_90_days",label:"Last 90 days"},{id:"wtd",label:"Week to date"},{id:"mtd",label:"Month to date"},{id:"qtd",label:"Quarter to date"},{id:"ytd",label:"Year to date"},{id:"this_week",label:"This week"},{id:"last_week",label:"Last week"},{id:"this_month",label:"This month"},{id:"last_month",label:"Last month"},{id:"this_quarter",label:"This quarter"},{id:"last_quarter",label:"Last quarter"},{id:"this_year",label:"This year"},{id:"last_year",label:"Last year"}];function xM(i){let e=i.getFullYear(),t=String(i.getMonth()+1).padStart(2,"0"),M=String(i.getDate()).padStart(2,"0");return`${e}-${t}-${M}`}function kj(i,e){let t=new Date(i);return t.setDate(t.getDate()+e),t}function WB(i){let e=new Date(i.getFullYear(),i.getMonth(),i.getDate()),t=(e.getDay()+6)%7;return kj(e,-t)}function E3(i,e=new Date){let t=new Date(e.getFullYear(),e.getMonth(),e.getDate()),M=t.getFullYear(),n=t.getMonth(),r=Math.floor(n/3);switch(i){case"today":return{min:xM(t),max:xM(t)};case"yesterday":{let o=kj(t,-1);return{min:xM(o),max:xM(o)}}case"last_7_days":return{min:xM(kj(t,-6)),max:xM(t)};case"last_30_days":return{min:xM(kj(t,-29)),max:xM(t)};case"last_90_days":return{min:xM(kj(t,-89)),max:xM(t)};case"wtd":return{min:xM(WB(t)),max:xM(t)};case"this_week":{let o=WB(t);return{min:xM(o),max:xM(kj(o,6))}}case"last_week":{let o=kj(WB(t),-7);return{min:xM(o),max:xM(kj(o,6))}}case"mtd":return{min:xM(new Date(M,n,1)),max:xM(t)};case"this_month":return{min:xM(new Date(M,n,1)),max:xM(new Date(M,n+1,0))};case"last_month":return{min:xM(new Date(M,n-1,1)),max:xM(new Date(M,n,0))};case"qtd":return{min:xM(new Date(M,r*3,1)),max:xM(t)};case"this_quarter":return{min:xM(new Date(M,r*3,1)),max:xM(new Date(M,r*3+3,0))};case"last_quarter":{let o=r===0?{yr:M-1,qi:3}:{yr:M,qi:r-1};return{min:xM(new Date(o.yr,o.qi*3,1)),max:xM(new Date(o.yr,o.qi*3+3,0))}}case"ytd":return{min:xM(new Date(M,0,1)),max:xM(t)};case"this_year":return{min:xM(new Date(M,0,1)),max:xM(new Date(M,11,31))};case"last_year":return{min:xM(new Date(M-1,0,1)),max:xM(new Date(M-1,11,31))};default:return null}}function HB(i){return i==="custom_range"||E3(i)!=null}function hst(i){return!!i&&i.type==="Identifier"}function bvt(i){if(hst(i))return i.name;if(i?.type==="Literal"){let e=i.value;if(typeof e=="string"&&e)return e}return null}function Qvt(i){if(!i||i.type!=="BinaryExpression")return null;let e=i,t=bvt(e.left);if(!Pm.includes(e.operator)||t==null)return null;let M=e.right,n=!1;if(M?.type==="UnaryExpression"){let o=M;if(o.operator!=="-")return null;n=!0,M=o.argument}if(M?.type!=="Literal")return null;let r=M.value;return typeof r!="string"&&typeof r!="number"||n&&typeof r!="number"?null:{field:t,op:e.operator,value:n?-r:r}}function JB(i){let e=i.trim();if(!e)return[];let t;try{t=h3(e)}catch{return null}let M=t.type==="Compound"?t.body:[t];if(M.length%2===0)return null;let n=[],r="and";for(let o=0;o<M.length;o++){if(o%2===1){if(!hst(M[o]))return null;let s=M[o].name;if(s!=="and"&&s!=="or")return null;r=s;continue}let a=Qvt(M[o]);if(!a)return null;n.push(n.length===0||r==="and"?a:U(x({},a),{connector:r})),r="and"}return n}function Fm(i){let e=String(i??"").trim();if(!e)return!0;let t=e.replace(/"[^"]*"|'[^']*'/g,"");if(/\bor\b/i.test(t)||/\bnot\b/i.test(t.replace(/\bnot\s+in\b/gi," ")))return!1;let M=/\b(?:contains|startsWith|between|isEmpty|isNotEmpty|in)\s*\([^()]*\)/gi,n;do n=t,t=t.replace(M," ");while(t!==n);return!/[()]/.test(t)}function yst(i){return i.toLowerCase().replace(/[^a-z0-9]/g,"")}var Uvt=new Set(["terms","multi_terms","date_histogram","histogram","range","date_range","significant_terms"]);function vvt(i){return i.endsWith(".keyword")?i.slice(0,-8):i}function Yvt(i){let e=new Map,t=M=>{if(!(!M||typeof M!="object"))for(let[n,r]of Object.entries(M)){if(!r||typeof r!="object")continue;let o=r;for(let[a,s]of Object.entries(o))if(Uvt.has(a)&&s&&typeof s=="object"&&typeof s.field=="string"){e.set(n,vvt(s.field));break}t(o.aggs)}};return t(i?.aggs),e}function GB(i,e){let t=(e?.columns??[]).filter(c=>typeof c.column=="string"&&!!c.column);if(!t.length||!i.pointName)return[];let M=e?.adapterType==="opensearch",n=M&&e?.dsl?Yvt(e.dsl):null,r=i.seriesName?yst(i.seriesName):"",o=r?t.find(c=>yst(c.column)===r):void 0,a=t.filter(c=>c!==o),s=a.find(c=>!LA(c.dataType)&&!Avt(c.dataType))??a[0],l=[];if(s){let c=n?.get(s.column)??s.column,D=LA(s.dataType)&&Number.isFinite(Number(i.pointName));l.push({field:c,op:"==",value:D?Number(i.pointName):i.pointName})}let N=o??t.find(c=>c!==s&&LA(c.dataType));return!M&&N&&typeof i.pointY=="number"&&Number.isFinite(i.pointY)&&l.push({field:N.column,op:"==",value:i.pointY}),l}function xst(i){return i.toLowerCase().replace(/[^a-z0-9]/g,"")}function Zvt(i){return!!i&&/^(boolean|bool|bit)$/.test(i.toLowerCase())}function pst(i,e,t){i.set(e,[...i.get(e)??[],...t])}function Lst(i){let e=(i??[]).filter(M=>typeof M.column=="string"&&!!M.column);return e.length?(e.find(M=>!LA(M.dataType)&&!Zvt(M.dataType))??e[0])?.column??null:null}function Ost(i){if(i?.adapterType==="opensearch")return null;let e=(i?.columns??[]).filter(o=>typeof o.column=="string"&&!!o.column);if(!e.length)return null;let t=o=>o.sourceColumn??o.column;if(Rm(e[0].dataType))return t(e[0]);let M=e.filter(o=>Rm(o.dataType));if(M.length===1)return t(M[0]);let n=Lst(e),r=n?e.find(o=>o.column===n):void 0;return r&&Rm(r.dataType)?t(r):null}function mst(i){let e=new Map;for(let t of i??[]){let M=t?.queryMeta,n=Lst(M?.columns);if(!n)continue;let o=(t?.config?.chart?.data??[]).map(a=>a?.name).filter(a=>typeof a=="string"&&a!==""||typeof a=="number"&&!Number.isNaN(a));o.length&&pst(e,n,o)}return e}function f3(i,e){let t=(e?.columns??[]).filter(r=>typeof r.column=="string"&&!!r.column),M=new Map(t.map(r=>[xst(r.column),r.column])),n=new Map;for(let r of i??[])if(!(!r||typeof r!="object"))for(let[o,a]of Object.entries(r)){let s=M.get(xst(o));s&&(typeof a=="string"&&a!==""||typeof a=="number"&&!Number.isNaN(a))&&pst(n,s,[a])}return n}function _vt(i){return!/[\p{L}\p{N}]/u.test(i)}function Est(i){let e=i.suffix;if(typeof e!="string")return;let t=e.replace(/^\s+/u,"");t!==""&&(i.suffix=_vt(t)?t:`\xA0${t}`)}var OA="#155EEF",Wvt="--ng-colors-fg-brand-primary-600";function Pvt(i){let e=i.endsWith("%")?Number(i.slice(0,-1))*255/100:Number(i);return Number.isFinite(e)?Math.min(255,Math.max(0,Math.round(e))):null}function Rvt(i){return i.toString(16).toUpperCase().padStart(2,"0")}function Vvt(i){let e=(i??"").trim();if(!e)return null;if(e.startsWith("#")){let r=e.slice(1);return/^[0-9a-f]+$/i.test(r)?r.length===3||r.length===4?`#${[...r.slice(0,3)].map(o=>o+o).join("").toUpperCase()}`:r.length===6||r.length===8?`#${r.slice(0,6).toUpperCase()}`:null:null}let t=/^rgba?\(([^)]*)\)$/i.exec(e);if(!t)return null;let M=t[1].split(/[\s,/]+/).filter(Boolean);if(M.length<3)return null;let n=M.slice(0,3).map(Pvt);return n.some(r=>r===null)?null:`#${n.map(Rvt).join("")}`}function mA(i){let e=i??(typeof document<"u"?document.documentElement:null);if(!e||typeof getComputedStyle!="function")return OA;try{return Vvt(getComputedStyle(e).getPropertyValue(Wvt))??OA}catch{return OA}}function S3(i,e){let t=i.sparklineColor;typeof t=="string"&&t.trim()!==""||(i.sparklineColor=mA(e))}function w3(i,e,t,M){i.noHeader=!0;let n=i.label??e.chartTitle??i.chartTitle??t;n&&(i.label=n);let r=i.description??e.chartSubtitle??i.chartSubtitle;r&&(i.description=r),delete i.chartTitle,delete i.chartSubtitle,delete e.chartTitle,delete e.chartSubtitle,Est(i),S3(i,M)}function $B(i){return i?.type==="kpi"}var Bvt=["data-theme","data-dvz-theme"],C3=new Set,Hm=null;function EA(i){return typeof document>"u"||typeof MutationObserver>"u"?()=>{}:(C3.add(i),Hm||(Hm=new MutationObserver(()=>{for(let e of[...C3])e()}),Hm.observe(document.documentElement,{attributes:!0,attributeFilter:Bvt,subtree:!0})),()=>{C3.delete(i),C3.size===0&&(Hm?.disconnect(),Hm=null)})}var bj=class i{byField=new Map;publish(e){for(let[t,M]of e){let n=this.byField.get(t);n||(n=new Set,this.byField.set(t,n));for(let r of M)n.add(r)}}getObserved(e){return[...this.byField.get(e)??[]]}fields(){return[...this.byField.keys()]}match(e,t){let M=this.getObserved(e),n=(t??"").trim().toLowerCase();return n?M.filter(r=>String(r).toLowerCase().includes(n)):M}has(e,t){let M=this.byField.get(e);return!!M&&[...M].some(n=>String(n)===String(t))}clear(){this.byField.clear()}static \u0275fac=function(t){return new(t||i)};static \u0275prov=Ct({token:i,factory:i.\u0275fac})};var Fvt=["nileChart"],Hvt=[[["","header-lead",""]],"*"],Jvt=["[header-lead]","*"],Gvt=(i,e)=>e.label;function $vt(i,e){i&1&&Zt(0,"nile-glyph",10)}function Xvt(i,e){if(i&1){let t=Le();C(0,"nile-menu-item",8),Ae("click",function(){let n=R(t).$index,r=p(3);return V(r.selectMasterDetailVariant(n))}),he(1,$vt,1,0,"nile-glyph",10),Y(2),b()}if(i&2){let t=e.$implicit,M=e.$index,n=p(3);L(),xe(M===n.masterDetailVariantIndex?1:-1),L(),yi(" ",t.label," ")}}function qvt(i,e){if(i&1){let t=Le();C(0,"nile-dropdown",3)(1,"button",4),Zt(2,"nile-glyph",5),b(),C(3,"nile-menu",6),xt(4,Xvt,3,2,"nile-menu-item",null,Gvt),Zt(6,"div",7),C(7,"nile-menu-item",8),Ae("click",function(){R(t);let n=p(2);return V(n.resetMasterDetailView())}),Zt(8,"nile-glyph",9),Y(9," Reset view "),b()()()}if(i&2){let t=p(2);L(4),pt(t.masterDetailVariants)}}function Kvt(i,e){if(i&1&&(C(0,"nile-chart",1,0)(2,"div",2),ll(3),he(4,qvt,10,0,"nile-dropdown",3),ll(5,1),b()()),i&2){let t=p();It("no-header",t.isKpiWidget?"":null),L(2),Pt("kpi-overlay",t.isKpiWidget)("kpi-overlay--pinned",t.isKpiWidget&&t.chromePinned),It("slot",t.isKpiWidget?"footer":"header-actions"),L(2),xe(t.isMasterDetailChart?4:-1)}}var ZI=class i{constructor(e,t,M=null,n=null){this.zone=e;this.cd=t;this.gridPageFetcher=M;this.observed=n}zone;cd;gridPageFetcher;observed;config;widgetId=null;widgetTitle=null;chromePinned=!1;loading=!1;drilldownBy;menu=null;dashboardFilters=null;resolvedFilters=null;dashboardId=null;conversationId=null;cellFilterEnabled=gt(!1);_filterMode="prompt";_filterSeed=null;aiSend=new Mi;sortChange=new Mi;filterSubmit=new Mi;filterChange=new Mi;chartClick=new Mi;chartSelection=new Mi;chartSelectionReset=new Mi;gridFilterVerdict=new Mi;menuAction=new Mi;cellFilter=Xi();dataViewFilterChange=new Mi;chartRef;static MASTER_DETAIL_VARIANTS=[{label:"Default view",overrides:null},{label:"Collapsible overview",overrides:{detailType:"spline",masterType:"column",masterCollapsible:!0}},{label:"Styled navigator",overrides:{detailType:"areaspline",masterType:"area",maskFill:"rgba(37,99,235,0.12)",detailTitle:"Detail view",masterTitle:"Overview (drag to select)"}},{label:"Master only (zoomable)",overrides:{masterOnly:!0,masterType:"column"}}];static DEFAULT_VARIANT_INDEX=3;masterDetailVariantIndex=i.DEFAULT_VARIANT_INDEX;mounted=!0;viewReady=!1;sessionId=globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random()}`;aiSendHandler=e=>this.handleAiSend(e);sortChangeHandler=e=>this.handleSortChange(e);nileChangeHandler=e=>this.handleNileChange(e);filterKeydownHandler=e=>this.handleFilterKeydown(e);filterFocusHandler=()=>this.handleFilterFocus();filterClearHandler=()=>this.handleFilterClear();chartClickHandler=e=>this.handleChartClick(e);chartSelectionHandler=e=>this.handleChartSelection(e);resetZoomClickHandler=e=>this.handleResetZoomClick(e);lastForwardedSelection=null;static SELECTION_DEDUP_MS=1e3;static GRID_FULL_FETCH_ROWS=500;masterDetailZoomWindow=null;menuChangeHandler=e=>this.handleMenuChange(e);paginationChangeHandler=e=>this.handleGridPaginationChange(e);filterChangeHandler=e=>this.handleGridFilterChange(e);cellFilterHandler=(e,t)=>this.zone.run(()=>this.cellFilter.emit({widgetId:this.widgetId,field:e,value:t}));filterDebounce=null;noopFilterFn=()=>!0;gridState=ke(null);_pendingDashboardFilterRefresh=!1;_dashboardFilterRefetching=!1;_dashboardFilterSeq=0;injector=Fe(rl);hostEl=Fe(ir);themeUnwatch;lastClickCoords={x:0,y:0};mouseDownHandler=e=>{this.lastClickCoords={x:e.clientX,y:e.clientY}};latestFilterPayload=null;suppressPaginationEvents=!1;staticGridPageIndex=0;staticGridPageSize=10;staticGridRowCount=0;ngAfterViewInit(){this.viewReady=!0,this.attachAiListener(),this.applyLoading(),this.applyMenu(),this.config&&this.applyConfig(),this.themeUnwatch=EA(()=>{this.viewReady&&this.isKpiWidget&&this.config&&this.applyConfig()})}ngOnChanges(e){if(!this.viewReady)return;e.loading&&this.applyLoading(),e.menu&&this.applyMenu();let t=e.dashboardFilters&&!e.dashboardFilters.firstChange,M=e.resolvedFilters&&!e.resolvedFilters.firstChange;if((t||M)&&this.handleDashboardFilterChange(),!e.config&&!e.drilldownBy)return;let n=e.config?.previousValue,r=e.config?.currentValue;e.config&&this.needsRemount(n,r)?this.remount():this.applyConfig()}ngOnDestroy(){this.detachAiListener(),this.themeUnwatch?.()}pushAiResponse(e){this.chartRef?.nativeElement?.addAiResponse?.(e)}get isMasterDetailChart(){return this.config?.chart?.type==="master-detail"}get masterDetailVariants(){return i.MASTER_DETAIL_VARIANTS}selectMasterDetailVariant(e){if(!this.isMasterDetailChart)return;let t=i.MASTER_DETAIL_VARIANTS.length;e<0||e>=t||e===this.masterDetailVariantIndex||(this.masterDetailVariantIndex=e,this.remount())}resetMasterDetailView(){this.isMasterDetailChart&&(this.masterDetailVariantIndex=i.DEFAULT_VARIANT_INDEX,this.masterDetailZoomWindow=null,this.remount())}patchControlSuggestions(e,t){let M=this.chartRef?.nativeElement;if(!M)return;let n=M.shadowRoot?.querySelector("nile-filter-chart"),r=n?.selectedValues?.get(e),o=M.config?.chart?.controls;if(!o)return;let a=o.find(s=>s.id===e);a&&(a.suggestions=[...t],typeof r=="string"&&(a.value=r),n?.requestUpdate?.())}getLiveExpression(){let e=this.getPromptControlId(this.config);return e?{controlId:e,value:this.readLiveFilterValue(e)}:null}setFilterExpression(e){let t=this.chartRef?.nativeElement,M=this.getPromptControlId(this.config);if(!t||!M)return;let r=t.config?.chart?.controls?.find(a=>a.id===M);r&&(r.value=e);let o=t.shadowRoot?.querySelector("nile-filter-chart");o?.setValue?.(M,e),o?.requestUpdate?.()}getPromptControlId(e){let t=e?.chart?.controls;for(let M of t??[])if((M.variant==="prompt"||M.variant==="expression"||M.variant==="hybrid")&&M.id)return M.id;return null}setFilterMode(e,t){this._filterMode=e,this._filterSeed=t??null,this.applyConfig()}openAiChat(){let e=this.chartRef?.nativeElement;e&&ld(()=>{e.chatOpen=!0},{injector:this.injector})}handleChartClick(e){let t=e.detail??{},M=String(t.name??t.point?.name??t.category??t.point?.category??""),n=typeof t.value=="number"?t.value:typeof t.point?.y=="number"?t.point.y:null,r=t.seriesName??t.point?.series?.name??null;this.zone.run(()=>this.chartClick.emit({widgetId:this.widgetId,point:t.point??null,pointName:M,pointY:n,seriesName:r,x:this.lastClickCoords.x,y:this.lastClickCoords.y}))}handleChartSelection(e){let{min:t,max:M}=e.detail??{};if(typeof t!="number"||typeof M!="number")return;if(M<=t){let s=this.chartPointStep();if(!s)return;t-=s/2,M+=s/2}let n=this.chartXExtent();if(n&&t<=n.min&&M>=n.max){this.masterDetailZoomWindow=null;return}this.masterDetailZoomWindow={min:t,max:M};let r=`${t}:${M}`,o=Date.now(),a=this.lastForwardedSelection;a?.key===r&&o-a.at<i.SELECTION_DEDUP_MS||(this.lastForwardedSelection={key:r,at:o},this.zone.run(()=>this.chartSelection.emit({widgetId:this.widgetId,min:t,max:M})))}handleResetZoomClick(e){e.composedPath().some(M=>M instanceof Element&&(M.classList.contains("nile-chart-reset-zoom")||M.getAttribute("part")==="reset-zoom"))&&(this.masterDetailZoomWindow=null,this.lastForwardedSelection=null,this.zone.run(()=>this.chartSelectionReset.emit({widgetId:this.widgetId})))}chartPointStep(){let e=this.chartRef?.nativeElement,t=e?this.findHighchartsInstance(e):null,M=[],n=t?.series??[];for(let a of n)for(let s of a.points??[])typeof s.x=="number"&&M.push(s.x);if(M.length<2){let a=this.config?.chart?.data;for(let s of Array.isArray(a)?a:[])s&&typeof s=="object"&&typeof s.x=="number"&&M.push(s.x)}if(M.length<2)return 0;let r=[...new Set(M)].sort((a,s)=>a-s),o=1/0;for(let a=1;a<r.length;a++)o=Math.min(o,r[a]-r[a-1]);return Number.isFinite(o)&&o>0?o:0}chartXExtent(){let e=this.chartRef?.nativeElement,M=(e?this.findHighchartsInstance(e):null)?.xAxis?.[0];if(M&&typeof M.dataMin=="number"&&typeof M.dataMax=="number")return{min:M.dataMin,max:M.dataMax};let n=[],r=this.config?.chart?.data;for(let o of Array.isArray(r)?r:[]){o&&typeof o=="object"&&typeof o.x=="number"&&n.push(o.x);let a=o?.data;if(Array.isArray(a))for(let s of a)Array.isArray(s)&&typeof s[0]=="number"?n.push(s[0]):s&&typeof s=="object"&&typeof s.x=="number"&&n.push(s.x)}return n.length?{min:Math.min(...n),max:Math.max(...n)}:null}drillIntoSeries(e,t){let M=this.chartRef?.nativeElement?this.findHighchartsInstance(this.chartRef.nativeElement):null;M&&(M.addSingleSeriesAsDrilldown(e,{id:t.id,name:t.name,type:t.type==="donut"?"pie":t.type??"pie",data:t.data}),M.applyDrilldown())}findHighchartsInstance(e){let t=e.shadowRoot;if(!t)return null;for(let M of Array.from(t.querySelectorAll("*"))){let n=M.chart;if(n&&typeof n.addSingleSeriesAsDrilldown=="function"&&typeof n.applyDrilldown=="function")return n}return null}needsRemount(e,t){return this.sparklineVisibilityChanged(e,t)||this.kpiVariantChangedWithSparkline(e,t)||this.semiCircleChanged(e,t)||this.widgetFamilyChanged(e,t)||this.seriesColorChanged(e,t)||this.plotShapeChanged(e,t)}plotShapeChanged(e,t){let M=e?.chart,n=t?.chart;if(!M||!n)return!1;let r=N=>Array.isArray(N)?N.length:-1;if(r(M.categories)!==r(n.categories))return!0;let o=Array.isArray(M.data)?M.data:null,a=Array.isArray(n.data)?n.data:null;if(o&&a&&o.length===a.length)for(let N=0;N<o.length;N++){let c=o[N],D=a[N];if(r(c?.data)!==r(D?.data))return!0}let s=M.options?.series,l=n.options?.series;if(r(s)!==r(l))return!0;if(Array.isArray(s)&&Array.isArray(l))for(let N=0;N<s.length;N++){let c=s[N],D=l[N];if(r(c?.data)!==r(D?.data))return!0}for(let N of["lineSeries","columnSeries"]){let c=M[N],D=n[N];if(r(c?.data)!==r(D?.data))return!0}return!1}seriesColorChanged(e,t){let M=e?.chart?.data,n=t?.chart?.data;return!Array.isArray(M)||!Array.isArray(n)?!1:M.length!==n.length?!0:M.some((r,o)=>{let a=r,s=n[o];return(a?.color??null)!==(s?.color??null)})}widgetFamilyChanged(e,t){return this.chartFamily(e)!==this.chartFamily(t)}get isKpiWidget(){return this.chartFamily(this.config)==="kpi"}chartFamily(e){let t=e?.chart?.type;return t==="kpi"?"kpi":t==="grid"?"grid":t==="filter"?"filter":"chart"}sparklineVisibilityChanged(e,t){return this.hasSparkline(e)!==this.hasSparkline(t)}kpiVariantChangedWithSparkline(e,t){let M=e?.chart?.variant,n=t?.chart?.variant;return M!==n&&this.hasSparkline(t)}semiCircleChanged(e,t){let M=e?.chart?.type;if(t?.chart?.type!=="donut"&&M!=="donut")return!1;let r=!!e?.chart?.semiCircle,o=!!t?.chart?.semiCircle;return r!==o}hasSparkline(e){let t=e?.chart?.sparkline;return Array.isArray(t)&&t.length>0}remount(){this.detachAiListener(),this.mounted=!1,this.cd.detectChanges(),this.mounted=!0,this.cd.detectChanges(),this.attachAiListener(),this.applyConfig()}applyConfig(){let e=this.chartRef?.nativeElement;if(!this.config||!e)return;let t=this.isGridConfig(this.config);if(t&&this.isServerGrid(this.config)){this.applyServerGrid(e);return}e.config=this.buildChartConfig(t),this.afterChildRendered(e,t,()=>{this.applyCardStyle(e),t&&(this.fixGridDisplay(e),this.reassertStaticGridPage(e))})}reassertStaticGridPage(e){if(this.staticGridPageIndex===0||this.isServerGrid(this.config))return;let t=e.shadowRoot?.querySelector("nile-data-grid");if(!t)return;this.suppressPaginationEvents=!0;let M=this.staticGridPageIndex,n=this.staticGridPageSize;(t.updateComplete??Promise.resolve()).then(()=>{t.pagination={pageIndex:M,pageSize:n},(t.updateComplete??Promise.resolve()).then(()=>{this.suppressPaginationEvents=!1})})}isGridConfig(e){return e?.chart?.type==="grid"}buildChartConfig(e){let t=Kh(this.config,this.drilldownBy);gst(t)&&console.warn(Nst(t,this.widgetTitle));let _=t.chart??{},{height:M}=_,n=$e(_,["height"]),r=n.type==="bar";r&&(n.type="column");let o=n.type==="stacked",a=n.type==="cluster";(o||a)&&(n.type="column");let s=e&&n.stickyHeader===void 0?{stickyHeader:!0}:{},l=e?{height:"100%"}:{},N=e?this.normalizeGridColumns(n.columns):void 0,c=e?y3(N)??N:N,D=e?Wm(c)??c:c,I=e?T3(D)??D:D,d=e&&this.cellFilterEnabled()?j3(I,this.cellFilterHandler)??I:I,y={};if(e){let ne=Array.isArray(n.data)?n.data:[];ne.length!==this.staticGridRowCount&&(this.staticGridRowCount=ne.length,this.staticGridPageIndex=0),y={paginationEnabled:!0,pagination:{pageIndex:this.staticGridPageIndex,pageSize:this.staticGridPageSize}}}let A=n.type==="kpi",X=t.aq??{},{ai:z,switchable:E}=X,S=$e(X,["ai","switchable"]),O=A?S:x(x({},S),z!==void 0?{ai:z}:{});if(!A&&!O.chartTitle&&!n.chartTitle&&this.widgetTitle&&(O.chartTitle=this.widgetTitle),A&&w3(n,O,this.widgetTitle,this.hostEl.nativeElement),n.type==="filter"){n.chartTitle=Ym,delete n.chartSubtitle,delete n.summary,O.chartTitle=Ym,delete O.chartSubtitle,delete O.summary;let ne=n.controls;if(Array.isArray(ne)){let ae=this.chartRef?.nativeElement?.config?.chart?.controls,pe=this.getPromptControlId(this.config),Me=this._filterSeed;this._filterSeed=null,n.controls=ne.map(De=>{let Ie=De.id,me=Ie?this.readLiveFilterValue(Ie):"",Qe=Ie?ae?.find(le=>le.id===Ie):void 0,Ye=Array.isArray(Qe?.suggestions)&&Qe.suggestions.length?{suggestions:Qe.suggestions}:{},F=x(x(U(x({},De),{showClearIcon:!0}),Ye),me?{value:me}:{});if(Ie&&Ie===pe){let le=Me!=null?{value:Me}:{};return this._filterMode==="expression"?x(U(x({},F),{variant:"expression",queryLanguage:U(x({engine:"filtrex",mode:"strict",validateOn:"change"},De.queryLanguage??{}),{enabled:!0}),placeholders:[kB],expressionPlaceholders:[kB]}),le):x(U(x({},F),{placeholders:[bB],promptPlaceholders:[bB]}),le)}return F})}}let v=n.type??"",Z=n.categories,B=Array.isArray(Z)&&Z.length>0&&v!=="invertedarea"&&!r,q=n.options??{},W=Object.keys(q).length?{options:q}:{};if(B){let ne=q.xAxis??{},ae=ne.labels??{},pe=Z.length,Me=pe>8?Math.ceil(pe/8):void 0,De=Z.reduce((Ye,F)=>Math.max(Ye,String(F??"").length),0),me=(Me?Math.ceil(pe/Me):pe)*(De*7+12),Qe={chart:{spacingLeft:48},xAxis:{labels:{rotation:-45,align:"right",y:12}}};W={options:U(x({},q),{xAxis:U(x({},ne),{labels:x(x({autoRotation:[-45,-90],style:{textOverflow:"none",whiteSpace:"nowrap"}},Me?{step:Me}:{}),ae)}),responsive:{rules:[{condition:{maxWidth:me},chartOptions:Qe},...q.responsive?.rules??[]]}})}}if(o){let ne=W.options??q,ae=ne.plotOptions??{},pe=ae.series??{};W={options:U(x({},ne),{plotOptions:U(x({},ae),{series:U(x({},pe),{stacking:n.stackMode||"normal"})})})}}if(r){let ne=W.options??q,ae=ne.chart??{};W={options:U(x({},ne),{chart:U(x({},ae),{inverted:!0})})}}let Ne=v==="master-detail"?x(x({},this.masterDetailVariantIndex>0?i.MASTER_DETAIL_VARIANTS[this.masterDetailVariantIndex].overrides??{}:{}),this.masterDetailZoomWindow?{selectionMin:this.masterDetailZoomWindow.min,selectionMax:this.masterDetailZoomWindow.max}:{}):{};return U(x({},t),{chart:x(x(x(x(x(x(x(x({},s),n),e?{variant:"sleek-condensed",columnResizingEnabled:!0,columnResizeMode:"onChange",columnReorderingEnabled:!0}:{}),d?{columns:d}:{}),W),Ne),l),y),aq:O})}isServerGrid(e){let t=e?.chart;return t?.serverPagination===!0&&typeof t?.gridId=="string"}applyServerGrid(e){let t=this.config.chart??{},M=t.gridId,n=Number(t.pagination?.pageSize)||10,r=this.gridState();if(r?.gridId===M&&r.loaded){this._dashboardFilterRefetching||this.renderServerGrid(e);return}this.gridState.set({gridId:M,total:0,pageIndex:0,pageSize:n,columns:[],aq:{},chartConfig:{},rows:[],loadedPages:[],loaded:!1,fullyLoaded:!1,filters:[]}),e.loading=!0,this.fetchGridPage(M,0,i.GRID_FULL_FETCH_ROWS).then(o=>{if(!o||this.gridState()?.gridId!==M){this._pendingDashboardFilterRefresh=!1;return}this.emitGridFilterVerdict(o);let a=o.config?.chart??{},s=Array.isArray(a.data)?a.data:[],l=Math.min(Number(o.total)||s.length,i.GRID_FULL_FETCH_ROWS);if(this.observed?.publish(f3(s,o.queryMeta)),this.gridState.set({gridId:M,total:l,pageIndex:0,pageSize:n,columns:Array.isArray(a.columns)?a.columns:[],aq:o.config?.aq??{},chartConfig:a,rows:s,loadedPages:[0],loaded:!0,fullyLoaded:!0,filters:Array.isArray(a.filters)?a.filters:[]}),e.loading=!1,this.renderServerGrid(e),this._pendingDashboardFilterRefresh){this._pendingDashboardFilterRefresh=!1;let N=this.gridState();N&&N.gridId===M&&this.applyServerFilters(M,N.filters)}}).catch(o=>{console.error("[nile-chart-widget] initial grid page fetch failed",o),e.loading=!1,this._pendingDashboardFilterRefresh=!1})}emitGridFilterVerdict(e){let t=e?.dashboardFilter;t&&this.gridFilterVerdict.emit({widgetId:this.widgetId,applied:t.applied===!0,reason:t.reason})}renderServerGrid(e){let t=this.gridState();if(!t)return;let M=x({},t.aq);!M.chartTitle&&!t.chartConfig.chartTitle&&this.widgetTitle&&(M.chartTitle=this.widgetTitle);let n=(this.normalizeGridColumns(t.columns)??t.columns).map(s=>U(x({},s),{filterFn:this.noopFilterFn})),r=y3(n)??n,o=Wm(r)??r,a=T3(o)??o;e.config={chart:U(x({stickyHeader:!0},t.chartConfig),{variant:"sleek-condensed",columnResizingEnabled:!0,columnResizeMode:"onChange",columnReorderingEnabled:!0,type:"grid",columns:this.cellFilterEnabled()?j3(a,this.cellFilterHandler)??a:a,data:[...t.rows],paginationEnabled:!0,pagination:{pageIndex:t.pageIndex,pageSize:t.pageSize},height:"100%"}),aq:M},this.afterChildRendered(e,!0,()=>{this.applyCardStyle(e),this.fixGridDisplay(e)})}normalizeGridColumns(e){if(Array.isArray(e))return e.map(t=>{let M=t,n=M.header??M.headerName;if(Array.isArray(M.columns)){let c=M,{field:I,headerName:d,columns:y}=c,A=$e(c,["field","headerName","columns"]);return U(x(x({},A),n!==void 0?{header:n}:{}),{columns:this.normalizeGridColumns(M.columns)})}let r=M.accessorKey??M.field,o=M.enableFiltering??!0,a=typeof M.cell=="function"?M.cell:null,D=M,{field:s,headerName:l}=D,N=$e(D,["field","headerName"]);return U(x(x(x({},N),r!==void 0?{accessorKey:r}:{}),n!==void 0?{header:n}:{}),{enableFiltering:o,cell:I=>{let d=a?a(I):I.value;return d==null||d===""?"-":d}})})}afterChildRendered(e,t,M){let n=()=>{if(!t){M();return}let r=0,o=()=>{e.shadowRoot?.querySelector("nile-data-grid")||++r>30?M():requestAnimationFrame(o)};o()};e.updateComplete?e.updateComplete.then(n):customElements.whenDefined("nile-chart").then(()=>{let r=e.updateComplete;r?r.then(n):requestAnimationFrame(n)})}applyCardStyle(e){let t=e.shadowRoot?.querySelector(".nile-chart-card");if(!t)return;let M=this.config?.chart??{},n=(r,o)=>{o?t.style.setProperty(r,o):t.style.removeProperty(r)};n("background",M.chartBg),n("border",M.chartBorder),n("border-radius",M.chartBorderRadius),n("box-shadow",M.chartShadow),n("padding",M.chartPadding),n("min-height",M.chartMinHeight)}fixGridDisplay(e){let t=e.shadowRoot?.querySelector("nile-data-grid");if(!t)return;t.style.display="flex",t.style.flexDirection="column";let M=this.config?.chart?.chartBg;M?t.style.setProperty("--nile-data-grid-surface",M):t.style.removeProperty("--nile-data-grid-surface"),vB(t),ZB(t),this.injectCellFilterStyle(t)}gridStyleSheet=null;injectCellFilterStyle(e){if(!this.cellFilterEnabled())return;let t=e.shadowRoot;t&&(this.gridStyleSheet||(this.gridStyleSheet=new CSSStyleSheet,this.gridStyleSheet.replaceSync(ust)),!t.adoptedStyleSheets.includes(this.gridStyleSheet)&&(t.adoptedStyleSheets=[...t.adoptedStyleSheets,this.gridStyleSheet]))}applyLoading(){let e=this.chartRef?.nativeElement;e&&(e.loading=this.loading)}applyMenu(){let e=this.chartRef?.nativeElement;e&&(e.menu=this.menu)}attachAiListener(){let e=this.chartRef?.nativeElement;e?.addEventListener("nile-chart-ai-send",this.aiSendHandler),e?.addEventListener("nile-sort-change",this.sortChangeHandler),e?.addEventListener("nile-chart-click",this.chartClickHandler),e?.addEventListener("nile-chart-selection",this.chartSelectionHandler),e?.addEventListener("click",this.resetZoomClickHandler,!0),e?.addEventListener("nile-menu-change",this.menuChangeHandler),e?.addEventListener("nile-pagination-change",this.paginationChangeHandler),e?.addEventListener("nile-filter-change",this.filterChangeHandler),e?.addEventListener("mousedown",this.mouseDownHandler,!0),this.isFilterConfig(this.config)&&(e?.addEventListener("nile-change",this.nileChangeHandler),e?.addEventListener("keydown",this.filterKeydownHandler,!0),e?.addEventListener("focusin",this.filterFocusHandler),e?.addEventListener("click",this.filterFocusHandler,!0),e?.addEventListener("nile-clear",this.filterClearHandler))}detachAiListener(){let e=this.chartRef?.nativeElement;e?.removeEventListener("nile-chart-ai-send",this.aiSendHandler),e?.removeEventListener("nile-sort-change",this.sortChangeHandler),e?.removeEventListener("nile-chart-click",this.chartClickHandler),e?.removeEventListener("nile-chart-selection",this.chartSelectionHandler),e?.removeEventListener("click",this.resetZoomClickHandler,!0),e?.removeEventListener("nile-menu-change",this.menuChangeHandler),e?.removeEventListener("nile-pagination-change",this.paginationChangeHandler),e?.removeEventListener("nile-filter-change",this.filterChangeHandler),e?.removeEventListener("mousedown",this.mouseDownHandler,!0),e?.removeEventListener("nile-change",this.nileChangeHandler),e?.removeEventListener("keydown",this.filterKeydownHandler,!0),e?.removeEventListener("focusin",this.filterFocusHandler),e?.removeEventListener("click",this.filterFocusHandler,!0),e?.removeEventListener("nile-clear",this.filterClearHandler)}handleMenuChange(e){let t=e.detail?.id;t&&this.zone.run(()=>this.menuAction.emit(t))}handleGridPaginationChange(e){let t=e.detail;if(this.suppressPaginationEvents)return;let M=this.gridState();if(!M?.loaded){if(this.isGridConfig(this.config)&&!this.isServerGrid(this.config)){let N=t?.pagination;this.staticGridPageIndex=Number(N?.pageIndex)||0,this.staticGridPageSize=Number(N?.pageSize)||this.staticGridPageSize}return}let n=t?.pagination,r=Number(n?.pageIndex)||0,o=Number(n?.pageSize)||M.pageSize;if(M.fullyLoaded){(r!==M.pageIndex||o!==M.pageSize)&&this.gridState.set(U(x({},M),{pageIndex:r,pageSize:o}));return}let a=r*o,s=o!==M.pageSize;if(!(s||!M.loadedPages.includes(r))){r!==M.pageIndex&&this.gridState.set(U(x({},M),{pageIndex:r}));return}this.suppressPaginationEvents=!0,this.fetchGridPage(M.gridId,r,o).then(N=>{let c=this.gridState();if(c?.gridId!==M.gridId){this.suppressPaginationEvents=!1;return}let D=N?.config?.chart??{},I=Array.isArray(D.data)?D.data:[],d=s?Array.from({length:c.total},()=>({})):c.rows.slice();I.forEach((z,E)=>{d[a+E]=z});let y=s?[r]:[...c.loadedPages,r];this.gridState.set(U(x({},c),{rows:d,loadedPages:y,pageIndex:r,pageSize:o})),this.observed?.publish(f3(I,N?.queryMeta)),this.pushGridData();let A=this.chartRef?.nativeElement?.shadowRoot?.querySelector("nile-data-grid");(A?.updateComplete??Promise.resolve()).then(()=>{A&&(A.pagination={pageIndex:r,pageSize:o}),(A?.updateComplete??Promise.resolve()).then(()=>{this.suppressPaginationEvents=!1})})}).catch(N=>{this.suppressPaginationEvents=!1,console.error("[nile-chart-widget] page fetch failed",N)})}handleGridFilterChange(e){let t=this.gridState(),M=e.detail?.filters??[];if(this.isServerGrid(this.config)&&t?.loaded&&this.config.chart.gridId===t.gridId){this.filterDebounce&&clearTimeout(this.filterDebounce),this.filterDebounce=setTimeout(()=>this.applyServerFilters(t.gridId,M),300);return}this.dataViewFilterChange.emit(M)}applyServerFilters(e,t){let M=this.gridState();if(!M||M.gridId!==e)return;let n=++this._dashboardFilterSeq,r=this._dashboardFilterRefetching;this.fetchGridPage(e,0,i.GRID_FULL_FETCH_ROWS,t).then(o=>{if(n!==this._dashboardFilterSeq)return;let a=this.gridState();if(!o||a?.gridId!==e)return;this.emitGridFilterVerdict(o);let s=o.config?.chart??{},l=Array.isArray(s.data)?s.data:[],N=Math.min(Number(o.total)||l.length,i.GRID_FULL_FETCH_ROWS);this.observed?.publish(f3(l,o.queryMeta)),this.gridState.set(U(x({},a),{filters:t,total:N,rows:l,pageIndex:0,loadedPages:[0],loaded:!0,fullyLoaded:!0}));let c=this.chartRef?.nativeElement;r&&c?(c.loading=!1,this.renderServerGrid(c)):this.pushGridData(l)}).catch(o=>{console.error("[nile-chart-widget] filter fetch failed",o)}).finally(()=>{if(n===this._dashboardFilterSeq&&(this._dashboardFilterRefetching=!1,r)){let o=this.chartRef?.nativeElement;o&&(o.loading=!1)}})}fetchGridPage(e,t,M,n){if(!this.gridPageFetcher)return Promise.resolve(null);let r=this.dashboardFilters&&Object.keys(this.dashboardFilters).length?this.dashboardFilters:void 0,o=this.resolvedFilters&&this.resolvedFilters.length?this.resolvedFilters:void 0;return Promise.resolve(this.gridPageFetcher(e,t,M,n,r,this.dashboardId,o,this.conversationId))}handleDashboardFilterChange(){let e=this.gridState();if(!e||!this.isServerGrid(this.config)||this.config.chart?.gridId!==e.gridId)return;if(!e.loaded){this._pendingDashboardFilterRefresh=!0;return}this._dashboardFilterRefetching=!0;let t=this.chartRef?.nativeElement;t&&(t.loading=!0),this.applyServerFilters(e.gridId,e.filters)}pushGridData(e){let t=this.chartRef?.nativeElement?.shadowRoot?.querySelector("nile-data-grid");if(!t)return;if(e)t.data=e;else{let n=this.gridState();n&&(t.data=[...n.rows])}let M=()=>{vB(t),ZB(t),this.injectCellFilterStyle(t)};t.updateComplete?t.updateComplete.then(M):M()}isFilterConfig(e){return e?.chart?.type==="filter"}getExpressionControl(e){let t=e?.chart?.controls;if(!t)return null;for(let M of t)if((M.variant==="expression"||M.variant==="hybrid")&&M.id)return{id:M.id,variant:M.variant};return null}handleAiSend(e){let t=e.detail,M=t?.message??t?.text??"",n=this.widgetId;if(!M||!n)return;let r=e.composedPath()[0];this.zone.run(()=>{this.aiSend.emit({widgetId:n,message:M,sessionId:this.sessionId,chartEl:r})})}handleSortChange(e){let t=e.detail?.sorting??[];this.zone.run(()=>{this.sortChange.emit({widgetId:this.widgetId,sorting:t})})}handleNileChange(e){let t=e.detail??{},M=t.filters??{},n=t.errors??{};this.latestFilterPayload={filters:M,errors:n};let r=this.getExpressionControl(this.config);if(!r)return;let o=M[r.id];if(r.variant==="hybrid"){let s=typeof o=="object"&&o!==null,l=n[r.id]!==void 0;if(!s&&!l)return}let a=typeof o=="string"?o:o?.source??"";this.zone.run(()=>{this.filterChange.emit({widgetId:this.widgetId,controlId:r.id,query:a})})}readLiveFilterValue(e){let t=this.chartRef?.nativeElement?.shadowRoot?.querySelector("nile-filter-chart"),M=t?.shadowRoot?.querySelector(`#fc-prompt-${CSS.escape(e)}`);if(M&&typeof M.value=="string")return M.value;let n=t?.selectedValues?.get(e);return typeof n=="string"?n:n&&typeof n=="object"?String(n.source??""):""}lastFilterFocusTs=0;handleFilterFocus(){let e=Date.now();if(e-this.lastFilterFocusTs<120)return;this.lastFilterFocusTs=e;let t=this.getExpressionControl(this.config);if(!t)return;let M=this.readLiveFilterValue(t.id);this.zone.run(()=>{this.filterChange.emit({widgetId:this.widgetId,controlId:t.id,query:M})})}handleFilterKeydown(e){let t=e;if(t.key!=="Enter"||t.shiftKey||t.isComposing)return;let M=this.getPromptControlId(this.config);if(!M)return;let n=this.readLiveFilterValue(M),r=this._filterMode;this.zone.run(()=>{this.filterSubmit.emit(x({widgetId:this.widgetId,filters:{[M]:n},errors:{},mode:r},r==="prompt"?{prompt:n}:{}))})}handleFilterClear(){this.zone.run(()=>{this.filterSubmit.emit({widgetId:this.widgetId,filters:{},errors:{}})})}static \u0275fac=function(t){return new(t||i)(oi(al),oi(Il),oi(q2,8),oi(bj,8))};static \u0275cmp=rM({type:i,selectors:[["shared-nile-chart-widget"]],viewQuery:function(t,M){if(t&1&&eN(Fvt,5),t&2){let n;gl(n=Nl())&&(M.chartRef=n.first)}},inputs:{config:"config",widgetId:"widgetId",widgetTitle:"widgetTitle",chromePinned:"chromePinned",loading:"loading",drilldownBy:"drilldownBy",menu:"menu",dashboardFilters:"dashboardFilters",resolvedFilters:"resolvedFilters",dashboardId:"dashboardId",conversationId:"conversationId",cellFilterEnabled:[1,"cellFilterEnabled"]},outputs:{aiSend:"aiSend",sortChange:"sortChange",filterSubmit:"filterSubmit",filterChange:"filterChange",chartClick:"chartClick",chartSelection:"chartSelection",chartSelectionReset:"chartSelectionReset",gridFilterVerdict:"gridFilterVerdict",menuAction:"menuAction",cellFilter:"cellFilter",dataViewFilterChange:"dataViewFilterChange"},features:[Fo],ngContentSelectors:Jvt,decls:1,vars:1,consts:[["nileChart",""],["fit",""],[1,"projected-actions"],["hoist","","placement","bottom-end"],["slot","trigger","type","button","aria-label","Switch chart view",1,"md-variant-toggle"],["name","ng-switch-horizontal-01","method","stroke","size","16"],[1,"md-variant-menu"],[1,"md-variant-divider"],[3,"click"],["slot","prefix","name","ng-refresh-ccw","method","stroke","size","14"],["slot","prefix","name","ng-check","method","stroke","size","14"]],template:function(t,M){t&1&&(tu(Hvt),he(0,Kvt,6,7,"nile-chart",1)),t&2&&xe(M.mounted?0:-1)},dependencies:[Jo],styles:['@charset "UTF-8";[_nghost-%COMP%]{display:block;width:100%;height:100%;overflow:hidden}nile-chart[_ngcontent-%COMP%]{display:block;width:100%;height:100%}nile-chart[_ngcontent-%COMP%]::part(ai-trigger){display:none}nile-chart[_ngcontent-%COMP%]::part(header){border-bottom:none}nile-chart[_ngcontent-%COMP%]::part(chart-card){border:unset;border-radius:unset;box-shadow:none}nile-chart[data-active-type=kpi][_ngcontent-%COMP%]::part(chart-card){position:relative}.projected-actions.kpi-overlay[_ngcontent-%COMP%]{position:absolute;top:var(--ng-spacing-xl, 16px);right:calc(var(--ng-spacing-3xl, 24px) - var(--ng-spacing-1, 4px));z-index:2;padding:0;border-top:none;opacity:0;pointer-events:none;transition:opacity .12s ease-in-out}[_nghost-%COMP%]:hover .projected-actions.kpi-overlay[_ngcontent-%COMP%], [_nghost-%COMP%]:focus-within .projected-actions.kpi-overlay[_ngcontent-%COMP%], .projected-actions.kpi-overlay--pinned[_ngcontent-%COMP%]{opacity:1;pointer-events:auto}@media(prefers-reduced-motion:reduce){.projected-actions.kpi-overlay[_ngcontent-%COMP%]{transition:none}}nile-chart[_ngcontent-%COMP%]::part(header-actions){margin-right:calc(-1 * var(--ng-spacing-1, 4px))}.projected-actions[_ngcontent-%COMP%]{display:flex;gap:var(--ng-spacing-xs, 4px);align-items:center}.md-variant-toggle[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;padding:var(--ng-spacing-1);border:none;border-radius:var(--ng-radius-md);background:transparent;color:var(--ng-colors-fg-quaternary-400);cursor:pointer}.md-variant-toggle[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-secondary);color:var(--ng-colors-text-primary-900)}.md-variant-divider[_ngcontent-%COMP%]{height:1px;margin:4px 8px;background:var(--ng-colors-border-secondary, #e9eaeb)}']})};function Jm(i){switch(i?.reason){case"no_applicable_field":return"Filter not applicable to this widget";case"execution_error":case"execution_error_fallback":return"Couldn't apply filter here";case"not_filterable_in_memory":return"Filtered on loaded data only";case"or_unsupported_for_widget":return"This widget can't combine those filters with OR";case"kpi_value_ambiguous":return"Couldn't identify this KPI's value under the filter";default:return"Filter not applied"}}var eYt=["bar"],XB=(i,e)=>e.id??e.label,Sst=(i,e)=>e.id;function tYt(i,e){if(i&1){let t=Le();C(0,"nile-menu-item",10),Ae("click",function(){let n=R(t).$implicit,r=p();return V(r.addRow(n.id??n.name??n.label))}),Y(1),b()}if(i&2){let t=e.$implicit;L(),yi(" ",t.label," ")}}function iYt(i,e){i&1&&Zt(0,"nile-skeleton-loader",8)}function MYt(i,e){if(i&1){let t=Le();C(0,"button",28),Ae("click",function(){R(t);let n=p().$implicit,r=p();return V(r.toggleConnector(n))}),Y(1),b()}if(i&2){let t=p().$implicit,M=p();Pt("mf-conn--disabled",M.disabled()),Ue("title",t.connector==="or"?"Matches EITHER side \u2014 click for AND":"Matches BOTH sides \u2014 click for OR"),It("aria-label","Change join to previous filter (currently "+(t.connector==="or"?"OR":"AND")+")"),L(),it(t.connector==="or"?"OR":"AND")}}function nYt(i,e){if(i&1){let t=Le();C(0,"nile-menu-item",10),Ae("click",function(){let n=R(t).$implicit,r=p().$implicit,o=p();return V(o.changeOp(r,n))}),Y(1),b()}if(i&2){let t=e.$implicit,M=p(2);L(),it(M.operatorLabels[t])}}function rYt(i,e){if(i&1){let t=Le();C(0,"nile-select",29),Ae("nile-change",function(n){R(t);let r=p().$implicit,o=p();return V(o.setScalar(r,n.target.value))}),C(1,"nile-option",30),Y(2,"true"),b(),C(3,"nile-option",31),Y(4,"false"),b()()}if(i&2){let t=p().$implicit;Ue("value",t.value)}}function oYt(i,e){if(i&1){let t=Le();C(0,"nile-date-picker",34),Ae("nile-change",function(n){R(t);let r=p(2).$implicit,o=p();return V(o.setRangeDate(r,n.detail))}),Zt(1,"nile-input",35),b()}if(i&2){let t=p(2).$implicit,M=p();Ue("dateFormat",M.dateFormatFor(t)),L(),Ue("value",M.rangeTriggerText(t))}}function aYt(i,e){if(i&1){let t=Le();C(0,"nile-date-picker",36),Ae("nile-change",function(n){R(t);let r=p(2).$implicit,o=p();return V(o.setSingleDate(r,n.detail))}),Zt(1,"nile-input",37),b()}if(i&2){let t=p(2).$implicit,M=p();Ue("dateFormat",M.dateFormatFor(t)),L(),Ue("value",M.singleTriggerText(t))}}function sYt(i,e){if(i&1&&he(0,oYt,2,2,"nile-date-picker",32)(1,aYt,2,2,"nile-date-picker",33),i&2){let t=p().$implicit,M=p();xe(M.isBetween(t)?0:1)}}function lYt(i,e){if(i&1){let t=Le();C(0,"div",19)(1,"nile-input",38),Ae("nile-change",function(n){R(t);let r=p().$implicit,o=p();return V(o.setRangeMin(r,n.detail.value))}),b(),C(2,"span",39),Y(3,"\u2013"),b(),C(4,"nile-input",40),Ae("nile-change",function(n){R(t);let r=p().$implicit,o=p();return V(o.setRangeMax(r,n.detail.value))}),b()()}if(i&2){let t=p().$implicit;L(),Ue("value",t.rangeMin),L(3),Ue("value",t.rangeMax)}}function gYt(i,e){if(i&1){let t=Le();C(0,"nile-input",41),Ae("nile-change",function(n){R(t);let r=p().$implicit,o=p();return V(o.setScalar(r,n.detail==null?null:n.detail.value))}),b()}if(i&2){let t=p().$implicit;Ue("value",t.value)}}function NYt(i,e){if(i&1){let t=Le();C(0,"nile-combobox",42),Ae("nile-focus",function(){R(t);let n=p().$implicit,r=p();return V(r.listUsesFetcher(n)&&r.onTypeaheadSearch(n,""))})("nile-change",function(n){R(t);let r=p().$implicit,o=p();return V(o.isMulti(r)?o.setMulti(r,n.detail==null?null:n.detail.value):o.setScalar(r,n.detail==null?null:n.detail.value))}),b()}if(i&2){let t=p().$implicit,M=p();Ue("multiple",M.isMulti(t))("value",M.valueForControl(t))("autoCompleteOptions",M.listComboOptionsFor(t))("renderItemConfig",M.typeaheadRenderConfig)}}function uYt(i,e){if(i&1){let t=Le();C(0,"nile-combobox",43),Ae("nile-focus",function(){R(t);let n=p().$implicit,r=p();return V(r.onTypeaheadSearch(n,""))})("nile-search",function(n){R(t);let r=p().$implicit,o=p();return V(o.onTypeaheadSearchDebounced(r,(n.detail==null?null:n.detail.query)??""))})("nile-change",function(n){R(t);let r=p().$implicit,o=p();return V(o.isMulti(r)?o.setMulti(r,n.detail==null?null:n.detail.value):o.setScalar(r,n.detail==null?null:n.detail.value))}),b()}if(i&2){let t=p().$implicit,M=p();Ue("multiple",M.isMulti(t))("value",M.valueForControl(t))("autoCompleteOptions",M.typeaheadOptionsFor(t))("renderItemConfig",M.typeaheadRenderConfig)}}function cYt(i,e){if(i&1){let t=Le();C(0,"nile-combobox",44),Ae("nile-change",function(n){R(t);let r=p().$implicit,o=p();return V(o.setMulti(r,n.detail==null?null:n.detail.value))}),b()}if(i&2){let t=p().$implicit;Ue("value",t.values)}}function DYt(i,e){if(i&1){let t=Le();C(0,"nile-combobox",45),Ae("nile-change",function(n){R(t);let r=p().$implicit,o=p();return V(o.setScalar(r,n.detail==null?null:n.detail.value))}),b()}if(i&2){let t=p().$implicit,M=p();Ue("value",t.value)("autoCompleteOptions",M.listOptionsFor(t))}}function IYt(i,e){if(i&1){let t=Le();C(0,"nile-menu-item",10),Ae("click",function(){let n=R(t).$implicit,r=p(2).$implicit,o=p();return V(o.applyPreset(r,n.id))}),Y(1),b()}if(i&2){let t=e.$implicit;L(),it(t.label)}}function dYt(i,e){if(i&1&&(C(0,"nile-dropdown",25)(1,"button",46),Zt(2,"nile-glyph",47),b(),C(3,"nile-menu"),xt(4,IYt,2,1,"nile-menu-item",null,Sst),b()()),i&2){let t=p().$implicit,M=p();L(4),pt(M.relativePresetsFor(t))}}function jYt(i,e){if(i&1){let t=Le();he(0,MYt,2,5,"button",11),C(1,"div",12)(2,"span",13),Y(3),b(),C(4,"nile-dropdown",14)(5,"button",15)(6,"span"),Y(7),b(),Zt(8,"nile-glyph",16),b(),C(9,"nile-menu"),xt(10,nYt,2,1,"nile-menu-item",null,Ta),b()(),C(12,"div",17),he(13,rYt,5,1,"nile-select",18)(14,sYt,2,1)(15,lYt,5,2,"div",19)(16,gYt,1,1,"nile-input",20)(17,NYt,1,4,"nile-combobox",21)(18,uYt,1,4,"nile-combobox",22)(19,cYt,1,1,"nile-combobox",23)(20,DYt,1,2,"nile-combobox",24),b(),he(21,dYt,6,0,"nile-dropdown",25),C(22,"button",26),Ae("click",function(){let n=R(t).$implicit,r=p();return V(r.removeRow(n))}),Zt(23,"nile-glyph",27),b()()}if(i&2){let t=e.$implicit,M=e.$index,n=p();xe(M>0?0:-1),L(3),it(n.labelFor(t.field)),L(4),it(n.operatorLabels[t.op]),L(3),pt(n.operatorsFor(t.field)),L(3),xe(n.isBoolean(t)?13:n.isDate(t)?14:n.isBetween(t)?15:n.fieldTypeFor(t.field)==="number"&&!n.isMulti(t)?16:n.valueModeOf(t)==="list"?17:n.usesTypeahead(t)?18:n.isMulti(t)?19:20),L(8),xe(n.relativePresetsFor(t).length?21:-1)}}function yYt(i,e){if(i&1){let t=Le();C(0,"nile-menu-item",10),Ae("click",function(){let n=R(t).$implicit,r=p(2);return V(r.addRow(n.id??n.name??n.label,"or"))}),Y(1),b()}if(i&2){let t=e.$implicit;L(),it(t.label)}}function TYt(i,e){if(i&1){let t=Le();C(0,"nile-menu-item",10),Ae("click",function(){let n=R(t).$implicit,r=p(2);return V(r.addRow(n.id??n.name??n.label,"and"))}),Y(1),b()}if(i&2){let t=e.$implicit;L(),it(t.label)}}function AYt(i,e){if(i&1){let t=Le();C(0,"div",9)(1,"nile-dropdown",48)(2,"span",49)(3,"span",50),Zt(4,"nile-glyph",51),b(),Y(5," OR "),b(),C(6,"nile-menu",7),Ae("nile-search-value",function(n){R(t);let r=p();return V(r.attrSearch.set((n.detail==null?null:n.detail.value)??""))}),xt(7,yYt,2,1,"nile-menu-item",null,XB),b()(),C(9,"nile-dropdown",48)(10,"span",49)(11,"span",50),Zt(12,"nile-glyph",51),b(),Y(13," AND "),b(),C(14,"nile-menu",7),Ae("nile-search-value",function(n){R(t);let r=p();return V(r.attrSearch.set((n.detail==null?null:n.detail.value)??""))}),xt(15,TYt,2,1,"nile-menu-item",null,XB),b()(),C(17,"button",52),Ae("click",function(){R(t);let n=p();return V(n.clearAll())}),Zt(18,"nile-glyph",27),Y(19," Clear "),b()()}if(i&2){let t=p();L(2),Pt("mf-conn-add__btn--disabled",t.disabled()),L(5),pt(t.menuAttributes()),L(3),Pt("mf-conn-add__btn--disabled",t.disabled()),L(5),pt(t.menuAttributes())}}var zYt=/^-?\d+(\.\d+)?$/,hYt=0,xYt=()=>`mf-row-${++hYt}`,k3=class i{catalog=gt([]);conditions=gt([]);catalogLoading=gt(!1);disabled=gt(!1);valueFetcher=gt(null);onDashboardFields=gt([]);recentlyUsedFields=gt([]);attrSearch=ke("");conditionsChange=Xi();operatorLabels=e0;expanded=gt(!1);contentHeight=Xi();overflowCountChange=Xi();overflowCount=-1;lastContentHeight=0;barRef=Ef("bar");resizeObs;rows=ke([]);typeaheadRowId=ke(null);typeaheadOptions=ke([]);typeaheadLoading=ke(!1);static LOADING_VALUE="\0__loading__";static LOADING_ROW={value:"\0__loading__",label:"Loading\u2026"};typeaheadSeq=0;static TYPEAHEAD_DEBOUNCE_MS=250;typeaheadDebounce=null;inFlightFetchKey=null;lastEmittedKey="";constructor(){eo(()=>{let e=this.conditions(),t=YI(e);t!==this.lastEmittedKey&&(this.lastEmittedKey=t,this.rows.set(e.map(M=>this.conditionToRow(M))))},{allowSignalWrites:!0}),ld(()=>{let e=this.barRef()?.nativeElement;!e||typeof ResizeObserver>"u"||(this.resizeObs=new ResizeObserver(()=>this.measureOverflow()),this.resizeObs.observe(e),this.measureOverflow())})}ngOnDestroy(){this.resizeObs?.disconnect(),this.typeaheadDebounce&&clearTimeout(this.typeaheadDebounce)}measureOverflow(){let e=this.barRef()?.nativeElement;if(!e)return;let t=Array.from(e.querySelectorAll(".mf-pill")),n=[...new Set(t.map(a=>Math.round(a.offsetTop)))].sort((a,s)=>a-s)[1],r=n===void 0?0:t.filter(a=>Math.round(a.offsetTop)>n).length;r!==this.overflowCount&&(this.overflowCount=r,this.overflowCountChange.emit(r));let o=e.scrollHeight;o!==this.lastContentHeight&&(this.lastContentHeight=o,this.contentHeight.emit(o))}attributes=zt(()=>m3(this.catalog().filter(e=>e.type==="attribute").filter(e=>O3(e)),{onDashboard:this.onDashboardFields(),recentlyUsed:this.recentlyUsedFields()}));menuAttributes=zt(()=>{let e=this.attrSearch(),t=this.attributes();return e?t.filter(M=>Ast(M,e)):t});onDashboardSet=zt(()=>new Set(this.onDashboardFields()));isOnDashboard(e){let t=this.onDashboardSet();return[e.id,e.name,e.label].some(M=>!!M&&t.has(M))}attrFor(e){return this.attributes().find(t=>t.id===e||t.name===e||t.label===e)}labelFor(e){return this.attrFor(e)?.label??e}fieldTypeFor(e){return this.attrFor(e)?.fieldType}operatorsFor(e){return L3(this.attrFor(e)??{})}defaultOperatorFor(e){return RB(this.attrFor(e)??{})}valueModeFor(e){let t=this.attrFor(e);return t?Vm(t):"free"}isBetween(e){return e.op==="between"}isMulti(e){return e.op==="in"||e.op==="not in"}isDate(e){return this.fieldTypeFor(e.field)==="date"||/(^|[_\s])(date|time|timestamp|datetime)|_(at|on)$/i.test(e.field)?!0:(e.op==="between"?[e.rangeMin,e.rangeMax]:[e.value]).some(M=>typeof M=="string"&&/^\d{4}-\d{2}-\d{2}[T ]/.test(M.trim()))}isBoolean(e){return this.fieldTypeFor(e.field)==="boolean"}valueModeOf(e){return this.valueModeFor(e.field)}usesTypeahead(e){return this.valueModeOf(e)==="search"&&!!this.valueFetcher()}listOptionsFor(e){let M=this.attrFor(e.field)?.sampleValues;return M?.length?M.map(n=>({value:n,label:n})):this.catalog().filter(n=>n.type==="value"&&(!n.id||n.id===e.field)).map(n=>({value:n.label,label:n.label}))}listComboOptionsFor(e){let t=this.typeaheadOptionsFor(e);return t.length?t:this.listOptionsFor(e)}listUsesFetcher(e){return this.valueModeOf(e)==="list"&&!!this.valueFetcher()}relativePresetsFor(e){if(this.fieldTypeFor(e.field)!=="date")return[];let t=this.attrFor(e.field)?.relativePresets;return(t?.length?t:FB).filter(n=>HB(n.id))}dateFormatFor(e){return this.attrFor(e.field)?.format??"YYYY-MM-DD"}fmtDateHour(e){let t=String(e??"").trim();if(!t)return"";let M=new Date(t);return Number.isNaN(M.getTime())?t:M.toISOString().slice(0,16).replace("T"," ")}rangeTriggerText(e){let t=this.fmtDateHour(e.rangeMin),M=this.fmtDateHour(e.rangeMax);return t&&M?`${t} \u2013 ${M}`:t||M}singleTriggerText(e){return this.fmtDateHour(e.value)}typeaheadOptionsFor(e){if(this.typeaheadRowId()!==e.id)return[];let t=this.typeaheadOptions();return t.length===0&&this.typeaheadLoading()?[i.LOADING_ROW]:t}typeaheadRenderConfig={getDisplayText:e=>e.label,getSuffix:()=>""};addRow(e,t="and"){if(this.disabled())return;let M=this.blankRow(e,t);this.rows.update(n=>[...n,M]),this.commit()}toggleConnector(e){this.disabled()||this.patch(e,{connector:e.connector==="or"?"and":"or"})}changeOp(e,t){this.rows.update(M=>M.map(n=>{if(n.id!==e.id)return n;let r=U(x({},n),{op:t}),o=!this.opIsMulti(n.op)&&!this.opIsBetween(n.op),a=!this.opIsMulti(t)&&!this.opIsBetween(t);return o&&a||(r.value=this.fieldTypeFor(n.field)==="boolean"?"true":"",r.values=[],r.rangeMin="",r.rangeMax=""),r})),this.commit()}setScalar(e,t){let M=Array.isArray(t)?t[0]??"":t??"";M!==i.LOADING_VALUE&&this.patch(e,{value:M})}setMulti(e,t){let n=(Array.isArray(t)?t:t?[t]:[]).filter(r=>r!=null&&r!==""&&r!==i.LOADING_VALUE);this.patch(e,{values:n})}setRangeMin(e,t){this.patch(e,{rangeMin:t})}setRangeMax(e,t){this.patch(e,{rangeMax:t})}setSingleDate(e,t){this.patch(e,{value:this.toDateString(t?.value??t?.startDate)})}setRangeDate(e,t){this.patch(e,{rangeMin:this.toDateString(t?.startDate),rangeMax:this.toDateString(t?.endDate??t?.startDate)})}applyPreset(e,t){let M=E3(t);M&&this.patch(e,{op:"between",rangeMin:M.min,rangeMax:M.max})}removeRow(e){this.rows.update(t=>t.filter(M=>M.id!==e.id)),this.commit()}clearAll(){this.disabled()||(this.rows.set([]),this.commit())}onTypeaheadSearchDebounced(e,t){this.typeaheadDebounce&&clearTimeout(this.typeaheadDebounce),this.typeaheadDebounce=setTimeout(()=>{this.typeaheadDebounce=null,this.onTypeaheadSearch(e,t)},i.TYPEAHEAD_DEBOUNCE_MS)}async onTypeaheadSearch(e,t){this.typeaheadDebounce&&(clearTimeout(this.typeaheadDebounce),this.typeaheadDebounce=null);let M=this.valueFetcher();if(!M||!e.field)return;let n=`${e.id}\0${(t??"").trim()}`;if(n===this.inFlightFetchKey)return;this.inFlightFetchKey=n,this.typeaheadRowId()!==e.id&&this.typeaheadOptions.set([]),this.typeaheadRowId.set(e.id);let r=++this.typeaheadSeq;this.typeaheadLoading.set(!0);try{let o=await M(e.field,t??"");if(r!==this.typeaheadSeq)return;this.typeaheadOptions.set(o.map(a=>({value:String(a.value),label:a.label??String(a.value),observed:a.observed})))}catch{r===this.typeaheadSeq&&this.typeaheadOptions.set([])}finally{this.inFlightFetchKey===n&&(this.inFlightFetchKey=null),r===this.typeaheadSeq&&this.typeaheadLoading.set(!1)}}patch(e,t){this.rows.update(M=>M.map(n=>n.id===e.id?x(x({},n),t):n)),this.commit()}blankRow(e,t="and",M=xYt()){let n=zst(e),r=this.defaultOperatorFor(n),o=this.fieldTypeFor(n)==="boolean"?"true":"";return{id:M,field:n,op:r,value:o,values:[],rangeMin:"",rangeMax:"",connector:t}}opIsMulti(e){return e==="in"||e==="not in"}opIsBetween(e){return e==="between"}rowValid(e){if(!e.field)return!1;if(this.opIsBetween(e.op)){let t=e.rangeMin.trim(),M=e.rangeMax.trim();if(t===""||M==="")return!1;if(this.fieldTypeFor(e.field)==="number"){let n=Number(t),r=Number(M);if(Number.isFinite(n)&&Number.isFinite(r)&&n>r)return!1}else if(this.fieldTypeFor(e.field)==="date"&&t>M)return!1;return!0}return this.opIsMulti(e.op)?e.values.length>0:e.value.trim()!==""}rowToCondition(e){let t=this.fieldTypeFor(e.field),M={field:e.field,connector:e.connector};return this.opIsBetween(e.op)?U(x({},M),{op:"between",value:[this.coerce(e.rangeMin,t),this.coerce(e.rangeMax,t)]}):this.opIsMulti(e.op)?U(x({},M),{op:e.op,value:e.values.map(n=>this.coerce(n,t))}):t==="boolean"?U(x({},M),{op:"==",value:e.value==="true"}):U(x({},M),{op:e.op,value:this.coerce(e.value,t)})}conditionToRow(e){let t=this.blankRow(e.field,e.connector??"and");return t.op=e.op,e.op==="between"&&Array.isArray(e.value)?(t.rangeMin=String(e.value[0]??""),t.rangeMax=String(e.value[1]??"")):(e.op==="in"||e.op==="not in")&&Array.isArray(e.value)?t.values=e.value.map(M=>String(M)):t.value=String(e.value),t}commit(){let e=this.rows().filter(M=>this.rowValid(M)).map(M=>this.rowToCondition(M)),t=YI(e);t!==this.lastEmittedKey&&(this.lastEmittedKey=t,this.conditionsChange.emit(e))}coerce(e,t){return t==="date"?e:(t==="number"||t===void 0)&&zYt.test(e)?Number(e):e}toDateString(e){if(!e)return"";if(typeof e=="string"){let o=e.match(/^(\d{4})-(\d{2})-(\d{2})/);if(o)return`${o[1]}-${o[2]}-${o[3]}`}let t=new Date(e);if(isNaN(t.getTime()))return typeof e=="string"?e:"";let M=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${M}-${n}-${r}`}valueForControl(e){return this.isMulti(e)?e.values:e.value}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=rM({type:i,selectors:[["shared-manual-filter-panel"]],viewQuery:function(t,M){t&1&&Of(M.barRef,eYt,5),t&2&&mf()},inputs:{catalog:[1,"catalog"],conditions:[1,"conditions"],catalogLoading:[1,"catalogLoading"],disabled:[1,"disabled"],valueFetcher:[1,"valueFetcher"],onDashboardFields:[1,"onDashboardFields"],recentlyUsedFields:[1,"recentlyUsedFields"],expanded:[1,"expanded"]},outputs:{conditionsChange:"conditionsChange",contentHeight:"contentHeight",overflowCountChange:"overflowCountChange"},decls:15,vars:6,consts:[["bar",""],[1,"mf-panel"],[1,"mf-panel__clip"],[1,"mf-panel__bar"],["hoist","","placement","bottom-start",1,"mf-add"],["slot","trigger",1,"mf-add__btn"],["name","ng-list-filter","method","stroke","size","14","color","var(--ng-colors-bg-brand-solid)"],["searchEnabled","","customSearch","",3,"nile-search-value"],["variant","rounded","width","200","height","34"],[1,"mf-actions"],[3,"click"],["type","button",1,"mf-conn","mf-conn--toggle",3,"mf-conn--disabled","title"],[1,"mf-pill"],[1,"mf-seg","mf-seg--field"],["hoist","","placement","bottom-start",1,"mf-pill__menu"],["slot","trigger","type","button",1,"mf-seg","mf-seg--op"],["name","ng-chevron-down","method","stroke","size","12"],[1,"mf-seg","mf-seg--value"],["size","small","hoist","",3,"value"],[1,"mf-range"],["size","small","type","number","placeholder","Value",3,"value"],["size","small","hoist","","portal","","clearable","","allowCustomValue","","placeholder","Value",3,"multiple","value","autoCompleteOptions","renderItemConfig"],["size","small","hoist","","portal","","clearable","","allowCustomValue","","disableLocalSearch","","placeholder","Search\u2026",3,"multiple","value","autoCompleteOptions","renderItemConfig"],["size","small","hoist","","portal","","clearable","","allowCustomValue","","multiple","","placeholder","Add values",3,"value"],["size","small","hoist","","portal","","clearable","","allowCustomValue","","placeholder","Value","noDataMessage","Type a value",3,"value","autoCompleteOptions"],["hoist","","placement","bottom-start",1,"mf-pill__menu","borders"],["type","button","aria-label","Remove filter",1,"mf-pill__x",3,"click"],["name","ng-x-close","method","stroke","size","12"],["type","button",1,"mf-conn","mf-conn--toggle",3,"click","title"],["size","small","hoist","",3,"nile-change","value"],["value","true"],["value","false"],["range","","allowClear","",3,"dateFormat"],["allowClear","",3,"dateFormat"],["range","","allowClear","",3,"nile-change","dateFormat"],["slot","trigger","size","small","placeholder","Date range",3,"value"],["allowClear","",3,"nile-change","dateFormat"],["slot","trigger","size","small","placeholder","Pick a date",3,"value"],["size","small","type","number","placeholder","Min",3,"nile-change","value"],[1,"mf-range__sep"],["size","small","type","number","placeholder","Max",3,"nile-change","value"],["size","small","type","number","placeholder","Value",3,"nile-change","value"],["size","small","hoist","","portal","","clearable","","allowCustomValue","","placeholder","Value",3,"nile-focus","nile-change","multiple","value","autoCompleteOptions","renderItemConfig"],["size","small","hoist","","portal","","clearable","","allowCustomValue","","disableLocalSearch","","placeholder","Search\u2026",3,"nile-focus","nile-search","nile-change","multiple","value","autoCompleteOptions","renderItemConfig"],["size","small","hoist","","portal","","clearable","","allowCustomValue","","multiple","","placeholder","Add values",3,"nile-change","value"],["size","small","hoist","","portal","","clearable","","allowCustomValue","","placeholder","Value","noDataMessage","Type a value",3,"nile-change","value","autoCompleteOptions"],["slot","trigger","type","button","title","Relative date",1,"mf-seg","mf-seg--preset"],["name","ng-calendar","method","stroke","size","12"],["hoist","","placement","bottom-end",1,"mf-conn-add"],["slot","trigger",1,"mf-conn-add__btn"],[1,"mf-conn-add__ring"],["name","ng-plus","method","stroke","size","10"],["type","button",1,"mf-clear",3,"click"]],template:function(t,M){t&1&&(C(0,"div",1)(1,"div",2)(2,"div",3,0)(4,"nile-dropdown",4)(5,"span",5),Zt(6,"nile-glyph",6),Y(7," Add filter "),b(),C(8,"nile-menu",7),Ae("nile-search-value",function(r){return M.attrSearch.set((r.detail==null?null:r.detail.value)??"")}),xt(9,tYt,2,1,"nile-menu-item",null,XB),b()(),he(11,iYt,1,0,"nile-skeleton-loader",8),xt(12,jYt,24,5,null,null,Sst),he(14,AYt,20,4,"div",9),b()()()),t&2&&(L(),Pt("mf-panel__clip--collapsed",!M.expanded()),L(4),Pt("mf-add__btn--disabled",M.disabled()),L(4),pt(M.menuAttributes()),L(2),xe(M.catalogLoading()&&!M.rows().length?11:-1),L(),pt(M.rows()),L(2),xe(M.rows().length?14:-1))},dependencies:[Jo],styles:["[_nghost-%COMP%]{display:flex;width:100%;height:100%;overflow:visible}.mf-panel[_ngcontent-%COMP%]{position:relative;display:flex;flex-direction:column;width:100%;height:100%;padding:var(--ng-spacing-4) var(--ng-spacing-5) 0 var(--ng-spacing-5)}.mf-panel__bar[_ngcontent-%COMP%]{position:relative;display:flex;flex-wrap:wrap;align-items:center;gap:var(--ng-spacing-2);min-width:0;padding-right:200px}.mf-pill[_ngcontent-%COMP%]{display:inline-flex;align-items:stretch;height:34px;border:1px solid var(--ng-colors-border-secondary);border-radius:var(--ng-radius-md);background:var(--ng-colors-bg-primary);overflow:hidden}.mf-pill__menu[_ngcontent-%COMP%]{display:inline-flex}.borders[_ngcontent-%COMP%]{border-right:1px solid var(--ng-colors-border-secondary)}.mf-seg[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:var(--ng-spacing-1);height:100%;padding:0 var(--ng-spacing-2);border:none;background:transparent;font:inherit;font-size:13px;color:var(--ng-colors-text-primary-900);white-space:nowrap;cursor:pointer}.mf-seg--field[_ngcontent-%COMP%]{font-weight:500;border-right:1px solid var(--ng-colors-border-primary);cursor:default}.mf-seg--op[_ngcontent-%COMP%]:hover, .mf-seg--preset[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-secondary)}.mf-seg[_ngcontent-%COMP%] nile-glyph[_ngcontent-%COMP%]{color:var(--ng-colors-fg-quaternary-400)}.mf-seg--value[_ngcontent-%COMP%]{padding:0;cursor:default}.mf-seg--value[_ngcontent-%COMP%] nile-input[_ngcontent-%COMP%], .mf-seg--value[_ngcontent-%COMP%] nile-combobox[_ngcontent-%COMP%], .mf-seg--value[_ngcontent-%COMP%] nile-select[_ngcontent-%COMP%], .mf-seg--value[_ngcontent-%COMP%] nile-date-picker[_ngcontent-%COMP%]{--nile-input-border-color: transparent;min-width:120px}.mf-seg--value[_ngcontent-%COMP%] nile-date-picker[_ngcontent-%COMP%]{--nile-input-standard-border-color: transparent;--nile-input-standard-background-color: transparent}.mf-seg--value[_ngcontent-%COMP%] nile-date-picker[_ngcontent-%COMP%] nile-input[_ngcontent-%COMP%]{min-width:280px}.mf-range[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:var(--ng-spacing-1)}.mf-range[_ngcontent-%COMP%] nile-input[_ngcontent-%COMP%]{min-width:72px}.mf-range__sep[_ngcontent-%COMP%]{color:var(--ng-colors-text-secondary-700)}.mf-pill__x[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;padding:0 var(--ng-spacing-2);border:none;background:transparent;color:var(--ng-colors-fg-quaternary-400);cursor:pointer}.mf-pill__x[_ngcontent-%COMP%]:hover{color:var(--ng-colors-fg-error-primary);background:var(--ng-colors-bg-error-primary)}.mf-add[_ngcontent-%COMP%]{display:inline-flex}.mf-add__btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:var(--ng-spacing-1);height:34px;font:inherit;font-size:14px;font-weight:500;color:var(--ng-colors-fg-brand-primary-600);cursor:pointer}.mf-add__btn[_ngcontent-%COMP%] nile-glyph[_ngcontent-%COMP%]{color:var(--ng-colors-fg-quaternary-400)}.mf-add__btn--disabled[_ngcontent-%COMP%]{pointer-events:none;opacity:.5}.mf-clear[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:var(--ng-spacing-1);height:34px;padding:0 var(--ng-spacing-3);border:1px solid var(--ng-colors-border-secondary);border-radius:var(--ng-radius-md);background:var(--ng-colors-bg-primary);font:inherit;font-size:13px;font-weight:500;color:var(--ng-colors-text-secondary-700);cursor:pointer}.mf-clear[_ngcontent-%COMP%]:hover{color:var(--ng-colors-fg-error-primary)}.mf-panel__clip--collapsed[_ngcontent-%COMP%]{max-height:calc(68px + var(--ng-spacing-2));overflow:hidden}.mf-actions[_ngcontent-%COMP%]{position:absolute;top:0;right:0;display:inline-flex;align-items:center;gap:var(--ng-spacing-2)}.mf-conn-add__btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:var(--ng-spacing-1);height:34px;font-size:14px;font-weight:500;color:var(--ng-colors-fg-brand-primary-600);cursor:pointer}.mf-conn-add__btn[_ngcontent-%COMP%] nile-glyph[_ngcontent-%COMP%]{color:var(--ng-colors-fg-brand-primary-600)}.mf-conn-add__ring[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;border:1px solid currentColor;border-radius:50%}.mf-conn-add__btn--disabled[_ngcontent-%COMP%]{pointer-events:none;opacity:.5}.mf-conn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;font-size:11px;font-weight:600;color:var(--ng-colors-text-tertiary-600)}.mf-conn--toggle[_ngcontent-%COMP%]{padding:2px var(--ng-spacing-1);border:1px solid transparent;border-radius:var(--ng-radius-xs, 4px);background:none;font:inherit;font-size:11px;font-weight:600;line-height:1;color:var(--ng-colors-text-tertiary-600);cursor:pointer}.mf-conn--toggle[_ngcontent-%COMP%]:hover, .mf-conn--toggle[_ngcontent-%COMP%]:focus-visible{border-color:var(--ng-colors-border-brand);color:var(--ng-colors-fg-brand-primary-600)}.mf-conn--toggle[_ngcontent-%COMP%]:focus-visible{outline:none}.mf-conn--disabled[_ngcontent-%COMP%]{pointer-events:none;opacity:.5}"]})};var pYt=`
40494
40494
  .calendar-container {
40495
40495
  background: var(--nile-colors-white-base, var(--ng-colors-bg-primary));
40496
40496
  }
@@ -1 +1 @@
1
- import{a,b}from"./chunk-JKTRQDUP.js";import"./chunk-GTSOWPIG.js";import"./chunk-ZRJYRUTX.js";import"./chunk-T4WJW6GR.js";import"./chunk-JP5QY5S6.js";import"./chunk-FLBVD7RK.js";import"./chunk-FK6H3RFT.js";import"./chunk-SYVY7IJY.js";import"./chunk-DPY4ZJSO.js";import"./chunk-T3NXAI3H.js";import"./chunk-JWVGGQEQ.js";import"./chunk-QXVITQOV.js";import"./chunk-I4TM4AGJ.js";import"./chunk-F6YL5NFN.js";import"./chunk-ATUZQYGW.js";import"./chunk-XCT4UKLK.js";import"./chunk-4XZ7RFFX.js";import"./chunk-YHTLTPEH.js";import"./chunk-LFSX3TZJ.js";import"./chunk-BTDKTIE6.js";import"./chunk-5CTM6JVQ.js";import"./chunk-W2HKCDVZ.js";import"./chunk-MPGDQZRI.js";import"./chunk-HOS2FAXH.js";import"./chunk-INJSG5RK.js";import"./chunk-RCWO45CI.js";import"./chunk-ZW5NV4UO.js";export{a as DVZ_DASHBOARDS_TAG,b as defineDvzDashboards};
1
+ import{a,b}from"./chunk-WUPJLTCM.js";import"./chunk-WXE5PNFK.js";import"./chunk-ZRJYRUTX.js";import"./chunk-T4WJW6GR.js";import"./chunk-JP5QY5S6.js";import"./chunk-FLBVD7RK.js";import"./chunk-FK6H3RFT.js";import"./chunk-SYVY7IJY.js";import"./chunk-DPY4ZJSO.js";import"./chunk-T3NXAI3H.js";import"./chunk-JWVGGQEQ.js";import"./chunk-QXVITQOV.js";import"./chunk-I4TM4AGJ.js";import"./chunk-F6YL5NFN.js";import"./chunk-ATUZQYGW.js";import"./chunk-XCT4UKLK.js";import"./chunk-4XZ7RFFX.js";import"./chunk-YHTLTPEH.js";import"./chunk-LFSX3TZJ.js";import"./chunk-BTDKTIE6.js";import"./chunk-5CTM6JVQ.js";import"./chunk-W2HKCDVZ.js";import"./chunk-MPGDQZRI.js";import"./chunk-HOS2FAXH.js";import"./chunk-INJSG5RK.js";import"./chunk-RCWO45CI.js";import"./chunk-ZW5NV4UO.js";export{a as DVZ_DASHBOARDS_TAG,b as defineDvzDashboards};
package/main.js CHANGED
@@ -1 +1 @@
1
- import{a as i,b as n}from"./chunk-WJ4NXG4M.js";import{a as t,b as D}from"./chunk-JKTRQDUP.js";import{a as d,b as f}from"./chunk-UWKQWEH4.js";import{w as s}from"./chunk-GTSOWPIG.js";import"./chunk-ZRJYRUTX.js";import"./chunk-T4WJW6GR.js";import"./chunk-JP5QY5S6.js";import"./chunk-XUJBDACP.js";import"./chunk-FLBVD7RK.js";import"./chunk-FK6H3RFT.js";import"./chunk-SYVY7IJY.js";import"./chunk-DPY4ZJSO.js";import"./chunk-T3NXAI3H.js";import"./chunk-JWVGGQEQ.js";import"./chunk-QXVITQOV.js";import"./chunk-I4TM4AGJ.js";import"./chunk-F6YL5NFN.js";import"./chunk-ATUZQYGW.js";import"./chunk-XCT4UKLK.js";import"./chunk-4XZ7RFFX.js";import"./chunk-YHTLTPEH.js";import"./chunk-LFSX3TZJ.js";import"./chunk-BTDKTIE6.js";import"./chunk-5CTM6JVQ.js";import"./chunk-W2HKCDVZ.js";import"./chunk-MPGDQZRI.js";import"./chunk-HOS2FAXH.js";import"./chunk-INJSG5RK.js";import"./chunk-RCWO45CI.js";import"./chunk-ZW5NV4UO.js";var p="0.0.35",a=p;function g(){typeof window>"u"||(window.dataViz={packageName:"@aquera/data-visualizer-sdk",version:a,getVersion:()=>a})}g();async function A(){let[{defineDvzAsk:e},{defineDvzDashboards:o},{defineDvzManageDashboards:r}]=await Promise.all([import("./chunk-6PV5LZQK.js"),import("./chunk-XDD4QBC3.js"),import("./chunk-WCYACDCD.js")]);await Promise.all([e(),o(),r()])}export{a as DATA_VISUALIZER_SDK_VERSION,i as DVZ_ASK_TAG,t as DVZ_DASHBOARDS_TAG,d as DVZ_MANAGE_DASHBOARDS_TAG,A as defineDvzAll,n as defineDvzAsk,D as defineDvzDashboards,f as defineDvzManageDashboards,s as setDvzEnv};
1
+ import{a as i,b as n}from"./chunk-R7GPYNMF.js";import{a as t,b as D}from"./chunk-WUPJLTCM.js";import{a as d,b as f}from"./chunk-ULLXYTBX.js";import{w as s}from"./chunk-WXE5PNFK.js";import"./chunk-ZRJYRUTX.js";import"./chunk-T4WJW6GR.js";import"./chunk-JP5QY5S6.js";import"./chunk-XUJBDACP.js";import"./chunk-FLBVD7RK.js";import"./chunk-FK6H3RFT.js";import"./chunk-SYVY7IJY.js";import"./chunk-DPY4ZJSO.js";import"./chunk-T3NXAI3H.js";import"./chunk-JWVGGQEQ.js";import"./chunk-QXVITQOV.js";import"./chunk-I4TM4AGJ.js";import"./chunk-F6YL5NFN.js";import"./chunk-ATUZQYGW.js";import"./chunk-XCT4UKLK.js";import"./chunk-4XZ7RFFX.js";import"./chunk-YHTLTPEH.js";import"./chunk-LFSX3TZJ.js";import"./chunk-BTDKTIE6.js";import"./chunk-5CTM6JVQ.js";import"./chunk-W2HKCDVZ.js";import"./chunk-MPGDQZRI.js";import"./chunk-HOS2FAXH.js";import"./chunk-INJSG5RK.js";import"./chunk-RCWO45CI.js";import"./chunk-ZW5NV4UO.js";var p="0.0.36",a=p;function g(){typeof window>"u"||(window.dataViz={packageName:"@aquera/data-visualizer-sdk",version:a,getVersion:()=>a})}g();async function A(){let[{defineDvzAsk:e},{defineDvzDashboards:o},{defineDvzManageDashboards:r}]=await Promise.all([import("./chunk-FIATL7JI.js"),import("./chunk-YGW6VQQS.js"),import("./chunk-T6I74VS3.js")]);await Promise.all([e(),o(),r()])}export{a as DATA_VISUALIZER_SDK_VERSION,i as DVZ_ASK_TAG,t as DVZ_DASHBOARDS_TAG,d as DVZ_MANAGE_DASHBOARDS_TAG,A as defineDvzAll,n as defineDvzAsk,D as defineDvzDashboards,f as defineDvzManageDashboards,s as setDvzEnv};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aquera/data-visualizer-sdk",
3
- "version": "0.0.35",
3
+ "version": "0.0.36",
4
4
  "description": "Every Aquera data-visualizer element — <dvz-ask>, <dvz-dashboards> and <dvz-manage-dashboards> — in one bundle that loads their shared Nile and Highcharts dependencies once. Use this when a page mounts more than one; use the individual @aquera/dvz-* packages when it mounts only one.",
5
5
  "type": "module",
6
6
  "sideEffects": [