@e-llm-studio/federated-dashboard-components 2.2.9-rca-test-3 → 2.2.9-rca-test-4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/ExecutiveDashboard/ExecutiveDashboardWrapper.js +1 -1
  2. package/dist/ExecutiveDashboard/api/insightsApi.js +1 -1
  3. package/dist/ExecutiveDashboard/components/ExecutiveDashboard.js +1 -1
  4. package/dist/ExecutiveDashboard/components/Graph/LineChart.js +1 -1
  5. package/dist/ExecutiveDashboard/components/Insights/AgReport.js +1 -1
  6. package/dist/ExecutiveDashboard/components/Insights/DrillTable.js +2 -0
  7. package/dist/ExecutiveDashboard/components/Insights/DrillTable.js.map +1 -0
  8. package/dist/ExecutiveDashboard/components/Insights/InsightTabs.js +1 -1
  9. package/dist/ExecutiveDashboard/components/Insights/InsightsContext.js +1 -1
  10. package/dist/ExecutiveDashboard/components/Insights/L1Report.js +1 -1
  11. package/dist/ExecutiveDashboard/components/Insights/RowDetail.js +1 -1
  12. package/dist/cjs/ExecutiveDashboard/ExecutiveDashboardWrapper.js +1 -1
  13. package/dist/cjs/ExecutiveDashboard/api/insightsApi.js +1 -1
  14. package/dist/cjs/ExecutiveDashboard/components/ExecutiveDashboard.js +1 -1
  15. package/dist/cjs/ExecutiveDashboard/components/Graph/LineChart.js +1 -1
  16. package/dist/cjs/ExecutiveDashboard/components/Insights/AgReport.js +1 -1
  17. package/dist/cjs/ExecutiveDashboard/components/Insights/DrillTable.js +2 -0
  18. package/dist/cjs/ExecutiveDashboard/components/Insights/DrillTable.js.map +1 -0
  19. package/dist/cjs/ExecutiveDashboard/components/Insights/InsightTabs.js +1 -1
  20. package/dist/cjs/ExecutiveDashboard/components/Insights/InsightsContext.js +1 -1
  21. package/dist/cjs/ExecutiveDashboard/components/Insights/L1Report.js +1 -1
  22. package/dist/cjs/ExecutiveDashboard/components/Insights/RowDetail.js +1 -1
  23. package/dist/cjs/index.js +1 -1
  24. package/dist/cjs/styles.css +1 -1
  25. package/dist/index.js +1 -1
  26. package/dist/styles.css +1 -1
  27. package/dist/types/ExecutiveDashboard/ExecutiveDashboardWrapper.d.ts +1 -1
  28. package/dist/types/ExecutiveDashboard/ExecutiveDashboardWrapper.d.ts.map +1 -1
  29. package/dist/types/ExecutiveDashboard/TestExecutiveDashboard.d.ts.map +1 -1
  30. package/dist/types/ExecutiveDashboard/api/insightsApi.d.ts.map +1 -1
  31. package/dist/types/ExecutiveDashboard/components/ExecutiveDashboard.d.ts +10 -1
  32. package/dist/types/ExecutiveDashboard/components/ExecutiveDashboard.d.ts.map +1 -1
  33. package/dist/types/ExecutiveDashboard/components/Graph/LineChart.d.ts.map +1 -1
  34. package/dist/types/ExecutiveDashboard/components/Insights/AgReport.d.ts +14 -7
  35. package/dist/types/ExecutiveDashboard/components/Insights/AgReport.d.ts.map +1 -1
  36. package/dist/types/ExecutiveDashboard/components/Insights/DrillTable.d.ts +21 -0
  37. package/dist/types/ExecutiveDashboard/components/Insights/DrillTable.d.ts.map +1 -0
  38. package/dist/types/ExecutiveDashboard/components/Insights/InsightTabs.d.ts.map +1 -1
  39. package/dist/types/ExecutiveDashboard/components/Insights/InsightsContext.d.ts +10 -2
  40. package/dist/types/ExecutiveDashboard/components/Insights/InsightsContext.d.ts.map +1 -1
  41. package/dist/types/ExecutiveDashboard/components/Insights/L1Report.d.ts.map +1 -1
  42. package/dist/types/ExecutiveDashboard/components/Insights/RowDetail.d.ts +3 -1
  43. package/dist/types/ExecutiveDashboard/components/Insights/RowDetail.d.ts.map +1 -1
  44. package/dist/types/ExecutiveDashboard/components/Insights/insightsContextCore.d.ts +12 -2
  45. package/dist/types/ExecutiveDashboard/components/Insights/insightsContextCore.d.ts.map +1 -1
  46. package/dist/types/ExecutiveDashboard/types/index.d.ts +11 -1
  47. package/dist/types/ExecutiveDashboard/types/index.d.ts.map +1 -1
  48. package/dist/types/ExecutiveDashboard/types/insights.d.ts +39 -0
  49. package/dist/types/ExecutiveDashboard/types/insights.d.ts.map +1 -1
  50. package/dist/types/index.d.ts +3 -1
  51. package/dist/types/index.d.ts.map +1 -1
  52. package/package.json +3 -3
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),n=require("react/jsx-runtime"),i=require("react"),a=require("lucide-react"),t=require("../RcaDecisionComponent/RcaDecisionComponent.js"),r=require("../Graph/LineChart.js"),s=require("../../api/insightsApi.js"),o=require("./insightsContextCore.js"),l=require("./insightsUtils.js"),d=require("./agPrimitives.js"),c=require("./NeedsAttention.js");function u(a){var t,r=this,d=a.entityKey,c=o.useInsights(),u=i.useState(null),g=u[0],v=u[1],h=i.useState(null),p=h[0],_=h[1];if(l.useJob(g,null!==(t=null==c?void 0:c.api)&&void 0!==t?t:null,function(){v(null),null==c||c.refresh()}),!(null==c?void 0:c.viewer.isAdmin))return null;return n.jsxs("span",{children:[n.jsx("button",e.__assign({type:"button",className:"ins-link",disabled:Boolean(g),onClick:function(){return e.__awaiter(r,void 0,void 0,function(){var n,i,a,t;return e.__generator(this,function(e){switch(e.label){case 0:_(null),e.label=1;case 1:return e.trys.push([1,6,,7]),n={dataDay:s.toIsoDay(c.range.endDate),window:"both"},d?[4,s.generateLevelSummary(c.api,d,n)]:[3,3];case 2:return a=e.sent(),[3,5];case 3:return[4,s.generateInsightsSummary(c.api,n)];case 4:a=e.sent(),e.label=5;case 5:return(i=a).jobId?v(i.jobId):c.refresh(),[3,7];case 6:return t=e.sent(),_(t.message||"The summary couldn't be regenerated."),[3,7];case 7:return[2]}})})}},{children:g?"Regenerating…":"Regenerate summary"})),p?n.jsx("span",e.__assign({className:"ins-error"},{children:p})):null]})}var g=function(e){var n=e.trim().toLowerCase();return n?/(s|x|ch|sh)$/.test(n)?"".concat(n,"es"):/[^aeiou]y$/.test(n)?"".concat(n.slice(0,-1),"ies"):"".concat(n,"s"):"rows"},v=function(e){return e.replace(/\b\w/g,function(e){return e.toUpperCase()})};function h(e,n){return n?"Decision Advantage is unavailable right now: ".concat(n.message):e?"waiting"===e.status?"The first morning run hasn't finished yet. This fills in after it.":"running"===e.status?"The AI is writing this report. It usually takes a minute or two.":"generated"!==e.status?"No AI report generated yet for this day.":null:null}function p(a){var r,s,o=a.report,c=a.movementType,u=a.direction,g=a.good,v=a.loading,p=a.error,_=i.useState(!1),m=_[0],f=_[1],y=i.useMemo(function(){return l.reportDecisioning(o)},[o]);if(i.useEffect(function(){return f(!1)},[null==o?void 0:o.reportId]),v)return n.jsx("div",e.__assign({className:"ag-summary"},{children:n.jsx(d.SkeletonLines,{widths:[28,96,72],label:"Loading summary"})}));var x=null==o?void 0:o.summary,b=null!==(r=null==x?void 0:x.headline)&&void 0!==r?r:"",j=Boolean(b),w=d.splitVerdict(b).prefix,k=Boolean(null==x?void 0:x.eyebrow)&&"Movement unavailable"!==(null==x?void 0:x.eyebrow),N=void 0!==c,D=k?x.eyebrow:N?d.movementVerdictLabel(c,u):w||"Summary",I=k?"good"===x.tone||"bad"===x.tone?d.verdictToneHex(x.tone):d.movementColorHex(x.movementType,x.movementDirection,g):N?d.movementColorHex(c,u,g):"Good news"===w?"#15803D":"Bad news"===w?"#E11D48":"#5928ED";return n.jsxs("div",e.__assign({className:"ag-summary"},{children:[n.jsx("p",e.__assign({className:"ag-summary__title",style:{color:j?I:"#64748b"}},{children:j?D:"No summary yet"})),n.jsxs("div",e.__assign({className:"ag-summary__text"},{children:[j?n.jsx(d.VerdictSentence,{text:b,good:g}):null!==(s=h(o,p))&&void 0!==s?s:"Reports are written after each morning run.",j&&y?n.jsx("span",e.__assign({className:"ag-summary__brain"},{children:n.jsx(t.ReasoningTrigger,{open:m,onToggle:function(){return f(function(e){return!e})},label:"how the AI reached this summary"})})):null]})),m&&y?n.jsx("div",e.__assign({className:"ag-summary__reasoning"},{children:n.jsx(t.ReasoningPanel,{decisioning:y})})):null]}))}function _(e){var a=e.report,r=e.error,s=e.loading,o=!s&&"generated"===(null==a?void 0:a.status),c=i.useMemo(function(){return o?l.reportDecisioning(a,null==a?void 0:a.footer):null},[o,a]),u=l.useOpenRow();return n.jsx(t.RcaDecisionComponent,{className:"ag-decision",title:"Decision Advantage",score:o?null==a?void 0:a.score:null,decisioning:c,notice:s?null:h(a,r),afterSections:s?n.jsx(d.SkeletonLines,{widths:[22,92,84,66,22,88,74],label:"Loading Decision Advantage"}):null,rootCause:o?l.toRcaItems(null==a?void 0:a.rootCause,u):[],nextSteps:o?l.toRcaItems(null==a?void 0:a.nextSteps,u):[],width:"100%",maxWidth:"none"})}var m=[{key:"drivers",label:"Top Drivers",info:"What moved the day's number the same way."},{key:"headwinds",label:"Headwinds",info:"What moved against the day's number."},{key:"attention",label:"Needs attention",info:"The number moved, but activity doesn't explain it."}],f={drivers:"Nothing moved the day's way.",headwinds:"Nothing ran against the day.",attention:"No drivers for this day."},y={high:"High correlation",medium:"Medium correlation",low:"Low correlation",none:"No correlation"};function x(i){var t=i.on,r=i.onClick;return n.jsxs("button",e.__assign({type:"button",className:"ag-graph-pill".concat(t?" is-on":""),onClick:function(e){e.stopPropagation(),r()}},{children:[n.jsx(a.TrendingUp,{"aria-hidden":"true"}),t?"In graph":"Add to graph"]}))}function b(i){var t=i.rank,r=i.category,s=i.name,o=i.chips,l=i.action,d=i.lines,c=i.cell,u=i.onOpen;return n.jsx("li",{children:n.jsxs("div",e.__assign({className:"ag-driver".concat(u?" is-clickable":""),role:u?"button":void 0,tabIndex:u?0:void 0,onClick:u,onKeyDown:u?function(e){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),u())}:void 0},{children:[n.jsxs("div",e.__assign({className:"ag-driver__main"},{children:[n.jsxs("span",e.__assign({className:"ag-driver__rank"},{children:[t,"."]})),n.jsxs("div",e.__assign({className:"ag-driver__body"},{children:[r?n.jsxs("span",e.__assign({className:"ag-driver__category"},{children:[r," >"]})):null,n.jsx("span",e.__assign({className:"ag-driver__name"},{children:s})),n.jsxs("div",e.__assign({className:"ag-driver__chips"},{children:[o,l]})),d]}))]})),n.jsxs("div",e.__assign({className:"ag-driver__cell"},{children:[c,u?n.jsx("span",e.__assign({className:"ag-driver__open","aria-hidden":"true"},{children:n.jsx(a.ArrowUpRight,{})})):null]}))]}))})}function j(i){var a=i.label,t=i.rightLabel,r=void 0===t?"User Activity":t,s=i.children;return n.jsxs("div",e.__assign({className:"ag-drivers"},{children:[n.jsxs("div",e.__assign({className:"ag-drivers__head"},{children:[n.jsx("span",{children:a}),n.jsx("span",{children:r})]})),n.jsx("ol",{children:s})]}))}var w=["#4F46E5","#64748B","#0F766E","#7C3AED","#475569","#818CF8","#94A3B8"],k=function(e,n){void 0===n&&(n="en-GB");var i=e.slice(0,10).split("-").map(Number),a=i[0],t=i[1],r=i[2];return Number.isFinite(a)&&Number.isFinite(t)&&Number.isFinite(r)?new Intl.DateTimeFormat(n,{day:"numeric",month:"short"}).format(new Date(a,t-1,r)):e};function N(t){var c,u,g,v,h,p,_,m,f=this,x=t.dataDay,b=t.nodeKey,j=void 0===b?"root":b,N=t.kpiId,D=t.dayGroup,I=o.useInsights(),C=null!==(c=null!=N?N:null==I?void 0:I.headlineKpi)&&void 0!==c?c:void 0,S=i.useState(""),K=S[0],A=S[1],T=i.useState([]),L=T[0],R=T[1],M=i.useState({}),F=M[0],P=M[1],B=i.useState(""),E=B[0],O=B[1],V=i.useState(null),q=V[0],G=V[1],H=i.useState(null),U=H[0],W=H[1],z=i.useState(!1),Z=z[0],J=z[1],$=i.useState(!1),X=$[0],Q=$[1],Y=i.useRef(null),ee=l.useInsightsFetch(I&&C&&x?function(n){return s.fetchInsightsCorrelation(I.api,j,e.__assign({kpiId:C,dataDay:x,startDate:s.toIsoDay(I.range.startDate),endDate:s.toIsoDay(I.range.endDate)},F),n)}:null,[null==I?void 0:I.api.configId,null==I?void 0:I.rangeKey,x,C,j,F.disregardBefore,null===(u=F.disregardDates)||void 0===u?void 0:u.join(","),null==I?void 0:I.revision]),ne=ee.data,ie=ee.error,ae=ee.loading,te=l.useInsightsFetch(I&&C&&x?function(n){return s.fetchInsightsCorrelationTrend(I.api,j,e.__assign({kpiId:C,startDate:s.toIsoDay(I.range.startDate),endDate:s.toIsoDay(I.range.endDate)},F),n)}:null,[null==I?void 0:I.api.configId,null==I?void 0:I.rangeKey,x,C,j,F.disregardBefore,null===(g=F.disregardDates)||void 0===g?void 0:g.join(","),null==I?void 0:I.revision]);l.useJob(U,null!==(v=null==I?void 0:I.api)&&void 0!==v?v:null,function(){W(null),O(""),null==I||I.refresh()}),i.useEffect(function(){if(Z){var e=function(e){Y.current&&!Y.current.contains(e.target)&&J(!1)};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}}},[Z]);var re=i.useState(new Set),se=re[0],oe=re[1],le=i.useMemo(function(){if(!ne)return[];return ne.series.filter(function(e){return!(null==D?void 0:D.length)||D.map(Number).includes((n=e.x,new Date("".concat(n.slice(0,10),"T00:00:00")).getDay()||7));var n})},[ne,D]),de=i.useMemo(function(){return ne&&I?e.__spreadArray([ne.kpiId],ne.drivers.map(function(e){return e.kpiId}).filter(function(e){return e!==ne.kpiId}),!0).map(function(e,n){return{key:"corr_".concat(e.replace(/[^a-zA-Z0-9_]/g,"_")),label:I.kpiLabel(e),color:w[n%w.length],curve:"smooth",strokeWidth:2,pointRadius:2,data:le.map(function(n){var i,a;return{x:n.x,y:n.disregarded?null:null!==(a=null===(i=n.values)||void 0===i?void 0:i[e])&&void 0!==a?a:null}}),valueFormatter:function(e){return"".concat(e,"%")}}}):[]},[ne,I,le]);i.useEffect(function(){return oe(new Set(de.slice(2).map(function(e){return e.key})))},[de]);if(!I||!x||"no_drivers"===(null==ne?void 0:ne.state)||ne&&!ne.verdictText)return null;if(ie)return n.jsxs("div",e.__assign({className:"ag-empty"},{children:["Correlation is unavailable right now: ",ie.message]}));if(ae&&!ne)return n.jsx(d.ChartSkeleton,{height:220,label:"Loading correlation"});if(!ne)return null;var ce=null!==(h=ne.strength)&&void 0!==h?h:"none",ue=I.kpiLabel(ne.kpiId);return n.jsx(d.CollapsibleVisualSection,e.__assign({title:"Correlation",meta:"Usage vs. ".concat(ue),className:"ag-visual--card",action:I.viewer.isAdmin?n.jsxs("div",e.__assign({ref:Y,className:"ag-corr__settings"},{children:[n.jsx("button",e.__assign({type:"button",className:"ag-icon-button","aria-label":"Correlation settings","aria-expanded":Z,onClick:function(){return J(function(e){return!e})}},{children:n.jsx(a.Settings2,{"aria-hidden":"true"})})),Z?n.jsx("div",e.__assign({className:"ag-corr__settings-menu",role:"menu"},{children:n.jsxs("label",{children:[n.jsx("input",{type:"checkbox",checked:X,onChange:function(e){return Q(e.target.checked)}}),"Show date controls"]})})):null]})):null},{children:n.jsxs("div",e.__assign({className:"ag-corr"},{children:[n.jsx("p",e.__assign({className:"ag-corr__banner ag-corr__banner--".concat(ce)},{children:ne.verdictText})),n.jsx("span",e.__assign({className:"ag-driver__badge ag-driver__badge--".concat(ce)},{children:y[ce]})),n.jsxs("p",e.__assign({className:"ag-corr__caption"},{children:[ue," vs. usage - % change from the first day shown"]})),(null===(p=ne.window)||void 0===p?void 0:p.source)?n.jsx("p",e.__assign({className:"ag-muted"},{children:"default"===ne.window.source?ne.window.startDate?"Using all days since ".concat(k(ne.window.startDate,"en-US")):"Using all available days":"row"===ne.window.source?"Saved window".concat(ne.window.startDate?" since ".concat(k(ne.window.startDate,"en-US")):"").concat((null===(_=ne.window.excludedDates)||void 0===_?void 0:_.length)?" · ".concat(ne.window.excludedDates.length," left out"):""):"Preview window".concat((null===(m=ne.window.excludedDates)||void 0===m?void 0:m.length)?" · ".concat(ne.window.excludedDates.length," left out"):"")})):null,n.jsx("div",e.__assign({className:"ag-chart"},{children:n.jsx("div",e.__assign({className:"ellm-graph"},{children:n.jsx(r.default,{tier:"decision-advantage-correlation",series:de,hiddenKeys:se,onToggleSeries:function(e){return oe(function(n){var i=new Set(n);return i.has(e)?i.delete(e):i.add(e),i})},onPointClick:function(){},xAxis:{label:"Date",categories:le.map(function(e){return e.x}),formatTick:function(e){return l.shortDay(e)}},yAxis:{label:"% change",beginAtZero:!1,formatTick:function(e){return"".concat(Math.round(Number(e)),"%")}},tooltip:{render:function(i){var a,t=i.x,r=i.points,s=String(t),o=null===(a=te.data)||void 0===a?void 0:a.series.find(function(e){return e.x===s});return n.jsxs("div",e.__assign({className:"ag-tip ag-tip--wide"},{children:[n.jsx("div",e.__assign({className:"ag-tip__head"},{children:k(s)})),r.filter(function(e){return null!=e.value}).map(function(i){return n.jsxs("div",e.__assign({className:"ag-tip__line"},{children:[n.jsxs("span",{children:[n.jsx("i",{style:{background:i.color}}),i.series.label]}),n.jsxs("strong",{children:[i.value,"%"]})]}),i.series.key)}),o?Object.keys(o.r).map(function(i){var a,t;return n.jsxs("div",e.__assign({className:"ag-tip__sub"},{children:[n.jsx("span",{children:I.kpiLabel(i)}),n.jsx("span",{children:null==o.r[i]?"No correlation":"r ".concat(o.r[i]," · ").concat(null!==(a=o.strength[i])&&void 0!==a?a:"none"," · ").concat(null!==(t=o.nObs[i])&&void 0!==t?t:0," days")})]}),i)}):null]}))}},legend:{position:"bottom",toggle:!0},style:{chartHeight:220,yAxisWidth:60,gridColor:"#e2e8f0",axisColor:"#cbd5e1",axisLabelColor:"#64748b",tickColor:"#64748b"}})}))})),n.jsx("div",e.__assign({className:"ag-corr__metrics"},{children:ne.drivers.map(function(i){var a,t=null!==(a=i.strength)&&void 0!==a?a:"none";return n.jsxs("div",e.__assign({className:"ag-corr__metric"},{children:[n.jsx("span",e.__assign({className:"ag-corr__name"},{children:i.label||I.kpiLabel(i.kpiId)})),i.kpiId!==ne.kpiId?n.jsx("span",e.__assign({className:"ag-driver__badge ag-driver__badge--".concat(t)},{children:y[t]})):null,n.jsx("strong",{children:l.formatValue(i.value)}),n.jsx("span",e.__assign({className:"ag-corr__delta"},{children:null!=i.deltaPct?n.jsxs(n.Fragment,{children:[n.jsxs("span",e.__assign({className:"ag-dod__value ag-dod__value--".concat(i.tone||"flat")},{children:["up"===i.direction?"↑":"down"===i.direction?"↓":"→"," ",Math.abs(i.deltaPct),"%"]}))," vs. ",l.formatValue(i.previous)]}):"—"})),i.kpiId!==ne.kpiId?n.jsxs("span",e.__assign({className:"ag-corr__r"},{children:[i.nObs," days used",i.lowHistory?" · Low history":"",n.jsx("br",{}),null==i.movedWithToday?"No comparison for today":i.movedWithToday?"Moved together with the headline today":"Moved opposite the headline today"]})):null]}),i.kpiId)})})),I.viewer.isAdmin&&X?n.jsxs("div",e.__assign({className:"ag-corr__window"},{children:[n.jsxs("label",e.__assign({className:"ag-corr__start"},{children:["Ignore data before ",n.jsx("input",{type:"date",value:K,onChange:function(e){return A(e.target.value)}})]})),n.jsxs("div",e.__assign({className:"ag-corr__days-label"},{children:["Or leave out individual dates (",L.length," selected)"]})),n.jsx("div",e.__assign({className:"ag-corr__days","aria-label":"Days to leave out"},{children:ne.series.map(function(i){return n.jsx("button",e.__assign({type:"button","aria-pressed":L.includes(i.x),className:L.includes(i.x)?"is-selected":void 0,onClick:function(){return n=i.x,R(function(i){return i.includes(n)?i.filter(function(e){return e!==n}):e.__spreadArray(e.__spreadArray([],i,!0),[n],!1)});var n}},{children:k(i.x)}),i.x)})})),n.jsx("input",{className:"ag-corr__reason",value:E,onChange:function(e){return O(e.target.value)},placeholder:"Reason required to apply"}),q?n.jsx("p",e.__assign({className:"ins-error"},{children:q})):null,n.jsxs("div",e.__assign({className:"ag-corr__actions"},{children:[n.jsx("button",e.__assign({type:"button",className:"ins-link",onClick:function(){return P({disregardBefore:K||void 0,disregardDates:L})}},{children:"Preview"})),n.jsx("button",e.__assign({type:"button",className:"ins-button",disabled:Boolean(U),onClick:function(){return e.__awaiter(f,void 0,void 0,function(){var n,i;return e.__generator(this,function(e){switch(e.label){case 0:if(!I||!C||!E.trim())return G("A reason is required."),[2];G(null),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,s.saveCorrelationWindow(I.api,j,{kpiId:C,startDate:K||null,excludedDates:L,dataDay:x,changeReason:E.trim(),regenerate:!0})];case 2:return n=e.sent(),W(n.jobId),[3,4];case 3:return i=e.sent(),G(i.message||"The correlation window couldn't be saved."),[3,4];case 4:return[2]}})})}},{children:"Apply"})),n.jsx("button",e.__assign({type:"button",className:"ins-link",onClick:function(){A(""),R([]),P({})}},{children:"Clear"}))]}))]})):null]}))}))}var D=function(e){var n;return(null===(n=null==e?void 0:e.period)||void 0===n?void 0:n.end)||null};function I(a){var t,c,u,g,v,h,p,_,m=a.entityKey,f=a.kpis,y=a.nodeKeys,x=a.workingDays,b=a.showMetrics,j=a.group,w=a.onOpenPoint,k=o.useInsights(),N=i.useState(null!==(t=f[0])&&void 0!==t?t:""),D=N[0],I=N[1];i.useEffect(function(){var e;f.includes(D)||I(null!==(e=f[0])&&void 0!==e?e:"")},[f,D]);var C=l.useInsightsFetch(k&&D&&null!==j?function(n){return s.fetchInsightsSeries(k.api,e.__assign(e.__assign({},k.range),{workingDaysOnly:x,group:j||void 0}),y.length?{kpiIds:[D],nodeKeys:y.slice(0,10)}:{kpiIds:[D],entityKey:m,topN:3},n)}:null,[null==k?void 0:k.api.configId,null==k?void 0:k.rangeKey,m,D,y.join(","),x,j,null==k?void 0:k.revision]),S=C.data,K=C.loading,A=C.error,T=i.useMemo(function(){var e;return null!==(e=null==S?void 0:S.series)&&void 0!==e?e:[]},[S]),L=i.useState(null),R=L[0],M=L[1];i.useEffect(function(){return M(null)},[T]);var F=i.useState(new Set),P=F[0],B=F[1];i.useEffect(function(){return B(new Set)},[T]);var E=i.useMemo(function(){return Array.from(new Set(T.flatMap(function(e){return e.points.map(function(e){return e.x})}))).sort()},[T]),O=i.useMemo(function(){return T.map(function(e,n){var i,a=new Map(e.points.map(function(e){return[e.x,e.y]})),t=null!==(i=null==k?void 0:k.goodDirection(e.kpiId))&&void 0!==i?i:"up";return{key:"row_".concat(n,"_").concat(e.nodeKey.replace(/[^a-zA-Z0-9_]/g,"_")),label:e.label||e.nodeKey,color:["#06B6D4","#10A66A","#8650FF","#F59E0B","#E94BBD","#4285FF","#64748B","#F04444","#14B8A6","#84CC16"][n%10],curve:"smooth",pointRadius:3,activePointRadius:3,fillPointsOnHover:!0,data:E.map(function(e){var n;return{x:e,y:null!==(n=a.get(e))&&void 0!==n?n:null}}),valueFormatter:function(e){return l.formatValue(e)},markers:e.points.filter(function(e){var n;return null===(n=e.meta)||void 0===n?void 0:n.marker}).map(function(n){return{x:n.x,color:d.movementColorHex(n.meta.marker.movementType,n.meta.marker.direction,t),label:[n.meta.marker.criticality,n.meta.marker.headline].filter(Boolean).join(" · "),radius:3,haloRadius:3,onClick:function(){var i,a=null!==(i=e.label)&&void 0!==i?i:e.nodeKey;w?w({nodeKey:e.nodeKey,label:a,kpiId:e.kpiId,dataDay:n.x,reportId:n.meta.marker.reportId}):null==k||k.openReport(n.meta.marker.reportId?{reportId:n.meta.marker.reportId,title:"".concat(a," · ").concat(l.shortDay(n.x))}:{nodeKey:e.nodeKey,kpiId:e.kpiId,dataDay:n.x,title:"".concat(a," · ").concat(l.shortDay(n.x))})}}})}})},[T,E,k,w]);if(!k)return null;var V=k.kpiLabel(D),q=k.goodDirection(D),G=null!==(c=T.find(function(e){return e.nodeKey===R}))&&void 0!==c?c:T[0],H=G?e.__spreadArray([],G.points,!0).reverse().find(function(e){return null!=e.y}):void 0;return n.jsxs("div",e.__assign({className:"ag-row-trend"},{children:[f.length>1?n.jsx("div",e.__assign({className:"ag-chart__switch",role:"group","aria-label":"Number"},{children:f.map(function(i){return n.jsx("button",e.__assign({type:"button","aria-pressed":i===D,className:i===D?"is-active":void 0,onClick:function(){return I(i)}},{children:k.kpiLabel(i)}),i)})})):null,b&&K?n.jsx(d.MetricsSkeleton,{}):b&&H?n.jsxs(n.Fragment,{children:[T.length>1?n.jsxs("label",e.__assign({className:"ag-row-trend__for"},{children:["Averages for",n.jsx("select",e.__assign({value:G.nodeKey,onChange:function(e){return M(e.target.value)}},{children:T.map(function(i){return n.jsx("option",e.__assign({value:i.nodeKey},{children:i.label||i.nodeKey}),i.nodeKey)})}))]})):null,n.jsx(d.TrendMetricsSection,{dailyLabel:"Daily ".concat(V),daily:H.y,fast:null!==(g=null===(u=H.meta)||void 0===u?void 0:u.fastMa)&&void 0!==g?g:null,slow:null!==(h=null===(v=H.meta)||void 0===v?void 0:v.slowMa)&&void 0!==h?h:null,long:null!==(_=null===(p=H.meta)||void 0===p?void 0:p.longMa)&&void 0!==_?_:null,windows:k.windows,good:q,format:l.formatValue})]}):null,A?n.jsx("div",e.__assign({className:"ag-empty"},{children:"This chart is unavailable right now."})):K?n.jsx(d.ChartSkeleton,{height:240,label:"Loading trend"}):E.length?n.jsx("div",e.__assign({className:"ag-chart"},{children:n.jsxs("div",e.__assign({className:"ellm-graph"},{children:[n.jsx(r.default,{tier:"decision-advantage-".concat(m),series:O,hiddenKeys:P,onToggleSeries:function(e){return B(function(n){var i=new Set(n);return i.has(e)?i.delete(e):i.size<O.length-1&&i.add(e),i})},onPointClick:function(e){var n,i,a,t,r,s,o=e.series,d=e.point,c=e.index,u=O.findIndex(function(e){return e.key===o.key}),g=T[u],v=null!==(n=d.x)&&void 0!==n?n:null===(i=o.data[c])||void 0===i?void 0:i.x,h=null==g?void 0:g.points.find(function(e){return e.x===String(v)});if(g&&h){var p=null!==(a=g.label)&&void 0!==a?a:g.nodeKey,_=null!==(s=null===(r=null===(t=h.meta)||void 0===t?void 0:t.marker)||void 0===r?void 0:r.reportId)&&void 0!==s?s:null;w?w({nodeKey:g.nodeKey,label:p,kpiId:g.kpiId,dataDay:h.x,reportId:_}):k.openReport(_?{reportId:_,title:"".concat(p," · ").concat(l.shortDay(h.x))}:{nodeKey:g.nodeKey,kpiId:g.kpiId,dataDay:h.x,title:"".concat(p," · ").concat(l.shortDay(h.x))})}},xAxis:{label:"Date",categories:E,tickCount:8,minTickGap:24,formatTick:function(e){return l.shortDay(e)}},yAxis:{label:V,beginAtZero:!0,formatTick:function(e){return l.formatValue(Number(e))}},tooltip:{formatHeading:function(e){return String(e)}},legend:{show:!1},style:{chartHeight:240,yAxisWidth:70,gridColor:"#e2e8f0",axisColor:"#cbd5e1",axisLabelColor:"#64748b",tickColor:"#64748b"}}),n.jsx("div",e.__assign({className:"ellm-graph__legend ellm-chart__legend--bottom ellm-chart__legend--center"},{children:O.map(function(i){var a=P.has(i.key);return n.jsxs("label",e.__assign({title:i.label,className:"ellm-graph__legend-item ag-legend-item".concat(a?" ellm-graph__legend-item--off":""),style:{cursor:"pointer","--checkbox-color":i.color,color:i.color}},{children:[n.jsx("input",{type:"checkbox",className:"ellm-graph__legend-checkbox",checked:!a,onChange:function(){return B(function(e){var n=new Set(e);return n.has(i.key)?n.delete(i.key):n.size<O.length-1&&n.add(i.key),n})},style:{borderColor:i.color,accentColor:i.color}}),n.jsx("span",{children:i.label})]}),i.key)})}))]}))})):n.jsx("div",e.__assign({className:"ag-empty"},{children:"Not enough history yet for a trend chart."}))]}))}function C(a){var t,r=this,c=a.tab,u=a.partName,h=a.kpiIds,p=a.rankBy,_=a.search,m=a.graphed,f=a.onToggleGraph,y=a.onOpenRow,w=a.onFirstRow,k=o.useInsights(),N=Math.min(200,Math.max(1,Number(c.pageSize)||5)),D=i.useState([]),I=D[0],C=D[1],S=i.useState(null),K=S[0],A=S[1],T=i.useState(!1),L=T[0],R=T[1],M=i.useState({loading:!0,error:null}),F=M[0],P=M[1],B=function(n,i){return e.__awaiter(r,void 0,void 0,function(){var a,t;return e.__generator(this,function(r){switch(r.label){case 0:if(!k)return[2];P({loading:!0,error:null}),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,s.fetchLevelRows(k.api,c.entityKey,k.range,{sort:p,order:"desc",search:_||void 0,pageSize:N,cursor:null!=n?n:void 0,includeChildren:3},i)];case 2:return a=r.sent(),(null==i?void 0:i.aborted)?[2]:(C(function(i){return n?e.__spreadArray(e.__spreadArray([],i,!0),a.rows,!0):a.rows}),A(a.nextCursor),R(a.hasNext),P({loading:!1,error:null}),[3,4]);case 3:return t=r.sent(),(null==i?void 0:i.aborted)||"AbortError"===(null==t?void 0:t.name)?[2]:(P({loading:!1,error:t.message||"Couldn't load the rows."}),[3,4]);case 4:return[2]}})})},E=null===(t=I[0])||void 0===t?void 0:t.nodeKey;if(i.useEffect(function(){return null==w?void 0:w(E)},[E]),i.useEffect(function(){var e=new AbortController;return B(null,e.signal),function(){return e.abort()}},[null==k?void 0:k.api.configId,null==k?void 0:k.rangeKey,c.entityKey,p,_,N,null==k?void 0:k.revision]),!k)return null;var O=k.goodDirection(p),V=h.filter(function(e){return e!==p}).slice(0,2),q=g(u);return n.jsx(d.ReportAccordion,e.__assign({title:"Top Drivers for ".concat(v(q))},{children:F.error?n.jsx("p",e.__assign({className:"ag-muted"},{children:"Top drivers are unavailable right now."})):F.loading&&!I.length?n.jsx(d.SkeletonLines,{widths:[80,60,85,55,75],label:"Loading drivers"}):I.length?n.jsxs(n.Fragment,{children:[n.jsx(j,e.__assign({label:v(u),rightLabel:"User Activity · selected dates"},{children:I.map(function(i){var a,t,r,o,c=null===(a=i.metrics)||void 0===a?void 0:a[p],u=i.label||i.nodeKey;return n.jsx(b,{rank:i.rank,name:u,chips:n.jsxs(n.Fragment,{children:[n.jsx(d.CriticalityChip,{criticality:null===(t=i.chip)||void 0===t?void 0:t.criticality}),n.jsx(d.MovementChip,{movementType:null===(r=i.chip)||void 0===r?void 0:r.movementType,direction:null===(o=i.chip)||void 0===o?void 0:o.direction})]}),action:n.jsx(x,{on:m.includes(i.nodeKey),onClick:function(){return f(i.nodeKey)}}),lines:n.jsxs("span",e.__assign({className:"ag-driver__cost"},{children:[n.jsxs("span",e.__assign({className:"ag-driver__total"},{children:[l.formatValue(null==c?void 0:c.value)," ",k.kpiLabel(p).toLowerCase()]})),null!=(null==c?void 0:c.deltaPct)?n.jsx("span",e.__assign({className:"ag-driver__sep"},{children:"|"})):null,n.jsx(d.DayOverDayChange,{deltaPct:null==c?void 0:c.deltaPct,good:O,direction:null==c?void 0:c.direction,tone:null==c?void 0:c.tone,suffix:"vs previous period"})]})),cell:V.map(function(a){var t,r,s=null===(t=i.metrics)||void 0===t?void 0:t[a],o=null!==(r=null==s?void 0:s.tone)&&void 0!==r?r:d.toneOf(null==s?void 0:s.deltaPct,k.goodDirection(a)),c="up"===(null==s?void 0:s.direction)?"↑":"down"===(null==s?void 0:s.direction)?"↓":"flat"===(null==s?void 0:s.direction)?"→":null!=(null==s?void 0:s.deltaPct)&&s.deltaPct>0?"↑":null!=(null==s?void 0:s.deltaPct)&&s.deltaPct<0?"↓":"→";return n.jsxs("span",e.__assign({className:"ag-driver__activity"},{children:[n.jsx("strong",e.__assign({className:"good"===o?"ag-text--good":"bad"===o?"ag-text--bad":void 0},{children:null==(null==s?void 0:s.deltaPct)?l.formatValue(null==s?void 0:s.value):"".concat(c).concat(Math.abs(s.deltaPct),"%")})),n.jsx("span",{children:k.kpiLabel(a)})]}),a)}),onOpen:function(){var e;return y(i,p,(null===(e=i.chip)||void 0===e?void 0:e.dataDay)||s.toIsoDay(k.range.endDate))}},i.nodeKey)})})),L?n.jsx("div",e.__assign({className:"ag-more"},{children:n.jsx("button",e.__assign({type:"button",disabled:F.loading,onClick:function(){return B(K)}},{children:F.loading?"Loading...":"Show more"}))})):null]}):n.jsx("p",e.__assign({className:"ag-muted"},{children:_?"No ".concat(q," match “").concat(_,"”."):"No ".concat(q," for this period yet.")}))}))}exports.AddToGraph=x,exports.CorrelationSection=N,exports.DecisionCard=_,exports.DriverList=j,exports.DriverRow=b,exports.L2Report=function(t){var r,c,v,h,m,f,y,x,b,j,w=t.tab,k=t.title,S=t.partName,K=t.partKpis,A=t.search,T=t.onOpenRow,L=o.useInsights(),R=i.useState(Boolean(null==L?void 0:L.defaultWorkingDays)),M=R[0],F=R[1],P=l.useInsightsFetch(L?function(e){return s.fetchGraphGroups(L.api,e)}:null,[null==L?void 0:L.api.configId,null==L?void 0:L.revision]),B=i.useState(null),E=B[0],O=B[1];i.useEffect(function(){var e,n;null===E&&((null===(e=P.data)||void 0===e?void 0:e.groups.length)?O((null!==(n=P.data.groups.find(function(e){return e.isDefault}))&&void 0!==n?n:P.data.groups[0]).groupKey):P.loading||O(""))},[E,P.data,P.loading]);var V=i.useState([]),q=V[0],G=V[1],H=i.useState(),U=H[0],W=H[1],z=!1!==w.showSummary,Z=l.useInsightsFetch(L&&z?function(e){return s.fetchLevelSummary(L.api,w.entityKey,L.range,e)}:null,[null==L?void 0:L.api.configId,null==L?void 0:L.rangeKey,w.entityKey,z,null==L?void 0:L.revision]);if(!L)return null;var J=(null===(r=w.listKpis)||void 0===r?void 0:r.length)?w.listKpis:K,$=w.rankBy&&J.includes(w.rankBy)?w.rankBy:null!==(c=J[0])&&void 0!==c?c:"",X=null===(v=Z.data)||void 0===v?void 0:v.report,Q=D(null===(h=Z.data)||void 0===h?void 0:h.context),Y=L.goodDirection($),ee=null!==(m=w.tier1Kpis)&&void 0!==m?m:L.tierKpis[1],ne=null!==(f=w.tier2Kpis)&&void 0!==f?f:L.tierKpis[2],ie=L.headlineKpi||$||ee[0]||"",ae=function(e){var n=e.nodeKey,i=e.label,a=e.dataDay;return T({rank:0,nodeKey:n,label:i,parent:null,metrics:{},barPct:null,chip:null,report:{reportId:null,status:"none",kpiId:ie},action:null,children:[]},ie,a)};return n.jsxs("section",e.__assign({className:"ag-report","aria-label":"L2 Report · ".concat(k)},{children:[n.jsxs("div",e.__assign({className:"ag-report__header"},{children:[n.jsxs("h2",e.__assign({className:"ag-report__title"},{children:[n.jsx(a.Sparkles,{"aria-hidden":"true"}),"L2 Report"]})),n.jsx("span",e.__assign({className:"ag-report__scope"},{children:k})),Q?n.jsx("span",e.__assign({className:"ag-report__date"},{children:d.formatHeaderDate(Q)})):null]})),n.jsxs("div",e.__assign({className:"ag-report__grid ag-report__grid--l2"},{children:[n.jsxs("div",e.__assign({className:"ag-stack"},{children:[z?n.jsxs(n.Fragment,{children:[n.jsxs("div",{children:[n.jsx(d.SectionHeader,{title:"Summary",action:n.jsx(u,{entityKey:w.entityKey})}),n.jsx(p,{report:X,loading:Z.loading,error:Z.error,good:Y})]}),n.jsx(_,{report:X,error:Z.error,loading:Z.loading})]}):null,J.length?n.jsx(C,{tab:w,partName:S,kpiIds:J,rankBy:$,search:A,graphed:q,onToggleGraph:function(n){return G(function(i){return i.includes(n)?i.filter(function(e){return e!==n}):e.__spreadArray(e.__spreadArray([],i,!0),[n],!1).slice(-3)})},onOpenRow:T,onFirstRow:W}):null]})),n.jsxs("div",e.__assign({className:"ag-stack"},{children:[ee.length?n.jsx(d.CollapsibleVisualSection,e.__assign({title:"Trend",action:n.jsx(d.DaysDropdown,{value:M,onChange:F,groups:P.error||null===(y=P.data)||void 0===y?void 0:y.groups,group:E,onGroupChange:O})},{children:n.jsx(I,{entityKey:w.entityKey,kpis:ee,nodeKeys:q,workingDays:M,showMetrics:!0,group:E,onOpenPoint:ae})})):null,ne.length?n.jsx(d.CollapsibleVisualSection,e.__assign({title:"User Activity",meta:q.length?"Rows you added":"Top ".concat(3," ").concat(g(S))},{children:n.jsx(I,{entityKey:w.entityKey,kpis:ne,nodeKeys:q,workingDays:M,showMetrics:!1,group:E,onOpenPoint:ae})})):null,n.jsx(N,{dataDay:Q,nodeKey:null!==(x=q[0])&&void 0!==x?x:U,dayGroup:null===(j=null===(b=P.data)||void 0===b?void 0:b.groups.find(function(e){return e.groupKey===E}))||void 0===j?void 0:j.days})]}))]}))]}))},exports.MAX_SERIES=10,exports.RegenerateSummary=u,exports.RowDrivers=C,exports.RowTrend=I,exports.SummaryCard=p,exports.TopDriversSection=function(t){var r,u,g,v,h,p,_,w,k,N=t.dataDay,D=t.entityKey,I=t.parentNodeKey,C=t.kpiId,S=t.title,K=t.graphed,A=t.onToggleGraph,T=t.onOpenDriver,L=t.onDecisionSettled,R=t.initialTab,M=void 0===R?"drivers":R,F=o.useInsights(),P=i.useState(M),B=P[0],E=P[1],O=i.useState({drivers:1,headwinds:1,attention:1}),V=O[0],q=O[1],G=null!==(r=null!=C?C:null==F?void 0:F.headlineKpi)&&void 0!==r?r:void 0,H=function(e){return F&&G&&e===B?function(n){return s.fetchInsightsDrivers(F.api,{dataDay:N,kpiId:G,entityKey:D,parentNodeKey:I,tab:e,limit:3*V[e],offset:0},n)}:null},U=function(e){return[null==F?void 0:F.api.configId,N,G,D,I,e,B,V[e],null==F?void 0:F.revision]},W={drivers:l.useInsightsFetch(H("drivers"),U("drivers")),headwinds:l.useInsightsFetch(H("headwinds"),U("headwinds")),attention:l.useInsightsFetch(H("attention"),U("attention"))},z=W[B],Z=z.data,J=z.error,$=z.loading,X=null!==(h=null!==(g=null===(u=W.drivers.data)||void 0===u?void 0:u.tabs)&&void 0!==g?g:null===(v=W.headwinds.data)||void 0===v?void 0:v.tabs)&&void 0!==h?h:null===(p=W.attention.data)||void 0===p?void 0:p.tabs,Q=c.useNeedsAttention(N,I,G),Y=null!==(w=null===(_=Q.data)||void 0===_?void 0:_.counts.pending)&&void 0!==w?w:0;if(i.useEffect(function(){return q({drivers:1,headwinds:1,attention:1})},[N]),i.useEffect(function(){return E(M)},[M]),!F)return null;var ee=F.goodDirection(null!=G?G:""),ne=null!==(k=null==Z?void 0:Z.rows)&&void 0!==k?k:[];return n.jsxs(d.ReportAccordion,e.__assign({title:S},{children:[n.jsx("div",e.__assign({className:"ag-driver-tabs",role:"tablist","aria-label":"Driver views"},{children:m.map(function(i){return n.jsxs("button",e.__assign({type:"button",role:"tab","aria-selected":B===i.key,className:B===i.key?"is-active":void 0,onClick:function(){return E(i.key)},title:i.info},{children:[i.label,(null==X?void 0:X[i.key])?" (".concat(X[i.key].total,")"):"","attention"===i.key&&Y?n.jsxs("span",e.__assign({className:"ag-na__tab-badge",title:"".concat(Y," data points need a decision")},{children:[Y,n.jsx("span",e.__assign({className:"ins-visually-hidden"},{children:" data points need a decision"}))]})):null,n.jsx(a.Info,{"aria-hidden":"true"})]}),i.key)})})),"attention"===B?n.jsx(c.default,{dataDay:N,nodeKey:I,kpiId:G,attention:Q,onDecisionSettled:L}):null,"attention"===B&&ne.length?n.jsx("h4",e.__assign({className:"ag-na__subhead"},{children:"Rows that moved without a clear cause"})):null,J?n.jsxs("p",e.__assign({className:"ag-muted"},{children:["Top drivers are unavailable right now: ",J.message]})):$&&!Z?n.jsx("p",e.__assign({className:"ag-muted"},{children:"Loading drivers..."})):ne.length?n.jsxs(n.Fragment,{children:[n.jsx(j,e.__assign({label:"Driver"},{children:ne.map(function(i){var a,t,r,s,o,c,u,g,v,h,p,_=i.deltaContributionPct,m=(null===(a=i.decisionAdvantage)||void 0===a?void 0:a.correlationSentence)||(null===(t=i.decisionAdvantage)||void 0===t?void 0:t.firstCause)||(null===(r=i.decisionAdvantage)||void 0===r?void 0:r.headline);return n.jsx(b,{rank:i.rank,category:null===(s=i.path)||void 0===s?void 0:s.slice(0,-1).join(" › "),name:i.label,chips:n.jsxs(n.Fragment,{children:[n.jsx(d.CriticalityChip,{criticality:i.criticality}),n.jsx(d.MovementChip,{movementType:i.movementType,direction:i.changeDirection}),(null===(o=i.correlation)||void 0===o?void 0:o.strength)?n.jsx("span",e.__assign({className:"ag-driver__badge ag-driver__badge--".concat(i.correlation.strength)},{children:y[i.correlation.strength]})):null]}),action:A?n.jsx(x,{on:K.includes(i.nodeKey),onClick:function(){return A(i)}}):void 0,lines:n.jsxs(n.Fragment,{children:[null!=_?n.jsxs("span",e.__assign({className:"ag-driver__share"},{children:[Math.abs(_),"% of today's movement ·"," ","opposite"===i.direction?"in the opposite direction":"driving the ".concat(null!==(c=null==Z?void 0:Z.headlineDirection)&&void 0!==c?c:"change")]})):null,n.jsxs("span",e.__assign({className:"ag-driver__cost"},{children:[n.jsx("span",e.__assign({className:"ag-driver__total"},{children:l.formatValue(i.value)})),null!=i.deltaPct?n.jsx("span",e.__assign({className:"ag-driver__sep"},{children:"|"})):null,n.jsx(d.DayOverDayChange,{deltaPct:i.deltaPct,good:ee,direction:i.changeDirection,tone:i.tone,suffix:l.previousDayLabel(N)})]})),m?n.jsx("p",e.__assign({className:"ag-driver__brief"},{children:n.jsx(d.VerdictSentence,{text:m,good:ee,arrowsFollowVerdict:!0})})):null,(null===(u=i.decisionAdvantage)||void 0===u?void 0:u.nextStep)?n.jsxs("p",e.__assign({className:"ag-driver__brief"},{children:[n.jsx("strong",{children:"Next:"})," ",i.decisionAdvantage.nextStep]})):null]}),cell:n.jsxs("span",e.__assign({className:"ag-driver__activity"},{children:[n.jsx("strong",{children:l.formatValue(null!==(v=null===(g=i.drivingMetric)||void 0===g?void 0:g.value)&&void 0!==v?v:i.previous)}),n.jsx("span",{children:(null===(h=i.drivingMetric)||void 0===h?void 0:h.label)||((null===(p=i.drivingMetric)||void 0===p?void 0:p.kpiId)?F.kpiLabel(i.drivingMetric.kpiId):"opposite"===i.direction?"Moved opposite":"with"===i.direction?"Moved with":"Previous")})]})),onOpen:function(){var e;return T?T(i):F.openReport({reportId:null===(e=i.report)||void 0===e?void 0:e.reportId,nodeKey:i.nodeKey,kpiId:G,dataDay:N,title:i.label})}},i.nodeKey)})})),(null==Z?void 0:Z.hasMore)?n.jsx("div",e.__assign({className:"ag-more"},{children:n.jsx("button",e.__assign({type:"button",disabled:$,onClick:function(){return q(function(n){var i;return e.__assign(e.__assign({},n),((i={})[B]=n[B]+1,i))})}},{children:$?"Loading...":"Show more"}))})):null]}):n.jsx("p",e.__assign({className:"ag-muted"},{children:f[B]}))]}))},exports.reportDayOf=D,exports.titleCase=v;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),n=require("react/jsx-runtime"),i=require("react"),a=require("lucide-react"),t=require("../RcaDecisionComponent/RcaDecisionComponent.js"),r=require("../Graph/LineChart.js"),s=require("../../api/insightsApi.js"),o=require("./insightsContextCore.js"),l=require("./insightsUtils.js"),d=require("./DrillTable.js"),c=require("./agPrimitives.js"),u=require("./NeedsAttention.js"),g=10;function v(a){var t,r=this,d=a.entityKey,c=a.dataDay,u=o.useInsights(),g=i.useState(null),v=g[0],h=g[1],p=i.useState(null),_=p[0],m=p[1];if(l.useJob(v,null!==(t=null==u?void 0:u.api)&&void 0!==t?t:null,function(){h(null),null==u||u.refresh()}),!(null==u?void 0:u.viewer.isAdmin))return null;return n.jsxs("span",{children:[n.jsx("button",e.__assign({type:"button",className:"ins-link",disabled:Boolean(v),onClick:function(){return e.__awaiter(r,void 0,void 0,function(){var n,i,a,t;return e.__generator(this,function(e){switch(e.label){case 0:m(null),e.label=1;case 1:return e.trys.push([1,6,,7]),n={dataDay:c||s.toIsoDay(u.range.endDate),window:"both"},d?[4,s.generateLevelSummary(u.api,d,n)]:[3,3];case 2:return a=e.sent(),[3,5];case 3:return[4,s.generateInsightsSummary(u.api,n)];case 4:a=e.sent(),e.label=5;case 5:return(i=a).jobId?h(i.jobId):u.refresh(),[3,7];case 6:return t=e.sent(),m(t.message||"The summary couldn't be regenerated."),[3,7];case 7:return[2]}})})}},{children:v?"Regenerating…":"Regenerate summary"})),_?n.jsx("span",e.__assign({className:"ins-error"},{children:_})):null]})}var h=function(e){var n=e.trim().toLowerCase();return n?/(s|x|ch|sh)$/.test(n)?"".concat(n,"es"):/[^aeiou]y$/.test(n)?"".concat(n.slice(0,-1),"ies"):"".concat(n,"s"):"rows"},p=function(e){return e.replace(/\b\w/g,function(e){return e.toUpperCase()})};function _(e,n){return n?"Decision Advantage is unavailable right now: ".concat(n.message):e?"waiting"===e.status?"The first morning run hasn't finished yet. This fills in after it.":"running"===e.status?"The AI is writing this report. It usually takes a minute or two.":"generated"!==e.status?"No AI report generated yet for this day.":null:null}function m(a){var r,s,o=a.report,d=a.movementType,u=a.direction,g=a.good,v=a.loading,h=a.error,p=i.useState(!1),m=p[0],f=p[1],y=i.useMemo(function(){return l.reportDecisioning(o)},[o]);if(i.useEffect(function(){return f(!1)},[null==o?void 0:o.reportId]),v)return n.jsx("div",e.__assign({className:"ag-summary"},{children:n.jsx(c.SkeletonLines,{widths:[28,96,72],label:"Loading summary"})}));var x=null==o?void 0:o.summary,b=null!==(r=null==x?void 0:x.headline)&&void 0!==r?r:"",j=Boolean(b),k=c.splitVerdict(b).prefix,w=Boolean(null==x?void 0:x.eyebrow)&&"Movement unavailable"!==(null==x?void 0:x.eyebrow),N=void 0!==d,D=w?x.eyebrow:N?c.movementVerdictLabel(d,u):k||"Summary",I=w?"good"===x.tone||"bad"===x.tone?c.verdictToneHex(x.tone):c.movementColorHex(x.movementType,x.movementDirection,g):N?c.movementColorHex(d,u,g):"Good news"===k?"#15803D":"Bad news"===k?"#E11D48":"#5928ED";return n.jsxs("div",e.__assign({className:"ag-summary"},{children:[n.jsx("p",e.__assign({className:"ag-summary__title",style:{color:j?I:"#64748b"}},{children:j?D:"No summary yet"})),n.jsxs("div",e.__assign({className:"ag-summary__text"},{children:[j?n.jsx(c.VerdictSentence,{text:b,good:g}):null!==(s=_(o,h))&&void 0!==s?s:"Reports are written after each morning run.",j&&y?n.jsx("span",e.__assign({className:"ag-summary__brain"},{children:n.jsx(t.ReasoningTrigger,{open:m,onToggle:function(){return f(function(e){return!e})},label:"how the AI reached this summary"})})):null]})),m&&y?n.jsx("div",e.__assign({className:"ag-summary__reasoning"},{children:n.jsx(t.ReasoningPanel,{decisioning:y})})):null]}))}function f(e){var a=e.report,r=e.error,s=e.loading,o=!s&&"generated"===(null==a?void 0:a.status),d=i.useMemo(function(){return o?l.reportDecisioning(a,null==a?void 0:a.footer):null},[o,a]),u=l.useOpenRow();return n.jsx(t.RcaDecisionComponent,{className:"ag-decision",title:"Decision Advantage",score:o?null==a?void 0:a.score:null,decisioning:d,notice:s?null:_(a,r),afterSections:s?n.jsx(c.SkeletonLines,{widths:[22,92,84,66,22,88,74],label:"Loading Decision Advantage"}):null,rootCause:o?l.toRcaItems(null==a?void 0:a.rootCause,u):[],nextSteps:o?l.toRcaItems(null==a?void 0:a.nextSteps,u):[],width:"100%",maxWidth:"none"})}var y=[{key:"drivers",label:"Top Drivers",info:"What moved the day's number the same way."},{key:"headwinds",label:"Headwinds",info:"What moved against the day's number."},{key:"attention",label:"Needs attention",info:"The number moved, but activity doesn't explain it."}],x={drivers:"Nothing moved the day's way.",headwinds:"Nothing ran against the day.",attention:"No drivers for this day."},b={high:"High correlation",medium:"Medium correlation",low:"Low correlation",none:"No correlation"};function j(i){var t=i.on,r=i.onClick,s=i.disabled,o=void 0!==s&&s;return n.jsxs("button",e.__assign({type:"button",className:"ag-graph-pill".concat(t?" is-on":""),disabled:o,title:o?"A graph can show up to ".concat(g," rows"):void 0,onClick:function(e){e.stopPropagation(),r()}},{children:[n.jsx(a.TrendingUp,{"aria-hidden":"true"}),t?"In graph":o?"Graph full":"Add to graph"]}))}function k(i){var t=i.rank,r=i.category,s=i.name,o=i.chips,l=i.action,d=i.lines,c=i.cell,u=i.onOpen;return n.jsx("li",{children:n.jsxs("div",e.__assign({className:"ag-driver".concat(u?" is-clickable":""),role:u?"button":void 0,tabIndex:u?0:void 0,onClick:u,onKeyDown:u?function(e){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),u())}:void 0},{children:[n.jsxs("div",e.__assign({className:"ag-driver__main"},{children:[n.jsxs("span",e.__assign({className:"ag-driver__rank"},{children:[t,"."]})),n.jsxs("div",e.__assign({className:"ag-driver__body"},{children:[r?n.jsxs("span",e.__assign({className:"ag-driver__category"},{children:[r," >"]})):null,n.jsx("span",e.__assign({className:"ag-driver__name"},{children:s})),n.jsxs("div",e.__assign({className:"ag-driver__chips"},{children:[o,l]})),d]}))]})),n.jsxs("div",e.__assign({className:"ag-driver__cell"},{children:[c,u?n.jsx("span",e.__assign({className:"ag-driver__open","aria-hidden":"true"},{children:n.jsx(a.ArrowUpRight,{})})):null]}))]}))})}function w(i){var a=i.label,t=i.rightLabel,r=void 0===t?"User Activity":t,s=i.children;return n.jsxs("div",e.__assign({className:"ag-drivers"},{children:[n.jsxs("div",e.__assign({className:"ag-drivers__head"},{children:[n.jsx("span",{children:a}),n.jsx("span",{children:r})]})),n.jsx("ol",{children:s})]}))}var N=["#4F46E5","#64748B","#0F766E","#7C3AED","#475569","#818CF8","#94A3B8"],D=function(e,n){void 0===n&&(n="en-GB");var i=e.slice(0,10).split("-").map(Number),a=i[0],t=i[1],r=i[2];return Number.isFinite(a)&&Number.isFinite(t)&&Number.isFinite(r)?new Intl.DateTimeFormat(n,{day:"numeric",month:"short"}).format(new Date(a,t-1,r)):e};function I(t){var d,u,g,v,h,p,_,m,f=this,y=t.dataDay,x=t.nodeKey,j=void 0===x?"root":x,k=t.kpiId,w=t.dayGroup,I=o.useInsights(),S=null!==(d=null!=k?k:null==I?void 0:I.headlineKpi)&&void 0!==d?d:void 0,C=i.useState(""),K=C[0],A=C[1],T=i.useState([]),R=T[0],L=T[1],F=i.useState({}),M=F[0],P=F[1],E=i.useState(""),B=E[0],O=E[1],G=i.useState(null),V=G[0],q=G[1],H=i.useState(null),U=H[0],W=H[1],z=i.useState(!1),Z=z[0],X=z[1],J=i.useState(!1),$=J[0],Q=J[1],Y=i.useRef(null),ee=l.useInsightsFetch(I&&S&&y?function(n){return s.fetchInsightsCorrelation(I.api,j,e.__assign({kpiId:S,dataDay:y,startDate:s.toIsoDay(I.range.startDate),endDate:s.toIsoDay(I.range.endDate)},M),n)}:null,[null==I?void 0:I.api.configId,null==I?void 0:I.rangeKey,y,S,j,M.disregardBefore,null===(u=M.disregardDates)||void 0===u?void 0:u.join(","),null==I?void 0:I.revision]),ne=ee.data,ie=ee.error,ae=ee.loading,te=l.useInsightsFetch(I&&S&&y?function(n){return s.fetchInsightsCorrelationTrend(I.api,j,e.__assign({kpiId:S,startDate:s.toIsoDay(I.range.startDate),endDate:s.toIsoDay(I.range.endDate)},M),n)}:null,[null==I?void 0:I.api.configId,null==I?void 0:I.rangeKey,y,S,j,M.disregardBefore,null===(g=M.disregardDates)||void 0===g?void 0:g.join(","),null==I?void 0:I.revision]);l.useJob(U,null!==(v=null==I?void 0:I.api)&&void 0!==v?v:null,function(){W(null),O(""),null==I||I.refresh()}),i.useEffect(function(){if(Z){var e=function(e){Y.current&&!Y.current.contains(e.target)&&X(!1)};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}}},[Z]);var re=i.useState(new Set),se=re[0],oe=re[1],le=i.useMemo(function(){if(!ne)return[];return ne.series.filter(function(e){return!(null==w?void 0:w.length)||w.map(Number).includes((n=e.x,new Date("".concat(n.slice(0,10),"T00:00:00")).getDay()||7));var n})},[ne,w]),de=i.useMemo(function(){return ne&&I?e.__spreadArray([ne.kpiId],ne.drivers.map(function(e){return e.kpiId}).filter(function(e){return e!==ne.kpiId}),!0).map(function(e,n){return{key:"corr_".concat(e.replace(/[^a-zA-Z0-9_]/g,"_")),label:I.kpiLabel(e),color:N[n%N.length],curve:"smooth",strokeWidth:2,pointRadius:2,data:le.map(function(n){var i,a;return{x:n.x,y:n.disregarded?null:null!==(a=null===(i=n.values)||void 0===i?void 0:i[e])&&void 0!==a?a:null}}),valueFormatter:function(e){return"".concat(e,"%")}}}):[]},[ne,I,le]);i.useEffect(function(){return oe(new Set(de.slice(2).map(function(e){return e.key})))},[de]);if(!I||!y||"no_drivers"===(null==ne?void 0:ne.state)||ne&&!ne.verdictText)return null;if(ie)return n.jsxs("div",e.__assign({className:"ag-empty"},{children:["Correlation is unavailable right now: ",ie.message]}));if(ae&&!ne)return n.jsx(c.ChartSkeleton,{height:220,label:"Loading correlation"});if(!ne)return null;var ce=null!==(h=ne.strength)&&void 0!==h?h:"none",ue=I.kpiLabel(ne.kpiId);return n.jsx(c.CollapsibleVisualSection,e.__assign({title:"Correlation",meta:"Usage vs. ".concat(ue),className:"ag-visual--card",action:I.viewer.isAdmin?n.jsxs("div",e.__assign({ref:Y,className:"ag-corr__settings"},{children:[n.jsx("button",e.__assign({type:"button",className:"ag-icon-button","aria-label":"Correlation settings","aria-expanded":Z,onClick:function(){return X(function(e){return!e})}},{children:n.jsx(a.Settings2,{"aria-hidden":"true"})})),Z?n.jsx("div",e.__assign({className:"ag-corr__settings-menu",role:"menu"},{children:n.jsxs("label",{children:[n.jsx("input",{type:"checkbox",checked:$,onChange:function(e){return Q(e.target.checked)}}),"Show date controls"]})})):null]})):null},{children:n.jsxs("div",e.__assign({className:"ag-corr"},{children:[n.jsx("p",e.__assign({className:"ag-corr__banner ag-corr__banner--".concat(ce)},{children:ne.verdictText})),n.jsx("span",e.__assign({className:"ag-driver__badge ag-driver__badge--".concat(ce)},{children:b[ce]})),n.jsxs("p",e.__assign({className:"ag-corr__caption"},{children:[ue," vs. usage - % change from the first day shown"]})),(null===(p=ne.window)||void 0===p?void 0:p.source)?n.jsx("p",e.__assign({className:"ag-muted"},{children:"default"===ne.window.source?ne.window.startDate?"Using all days since ".concat(D(ne.window.startDate,"en-US")):"Using all available days":"row"===ne.window.source?"Saved window".concat(ne.window.startDate?" since ".concat(D(ne.window.startDate,"en-US")):"").concat((null===(_=ne.window.excludedDates)||void 0===_?void 0:_.length)?" · ".concat(ne.window.excludedDates.length," left out"):""):"Preview window".concat((null===(m=ne.window.excludedDates)||void 0===m?void 0:m.length)?" · ".concat(ne.window.excludedDates.length," left out"):"")})):null,n.jsx("div",e.__assign({className:"ag-chart"},{children:n.jsx("div",e.__assign({className:"ellm-graph"},{children:n.jsx(r.default,{tier:"decision-advantage-correlation",series:de,hiddenKeys:se,onToggleSeries:function(e){return oe(function(n){var i=new Set(n);return i.has(e)?i.delete(e):i.add(e),i})},onPointClick:function(){},xAxis:{label:"Date",categories:le.map(function(e){return e.x}),formatTick:function(e){return l.shortDay(e)}},yAxis:{label:"% change",beginAtZero:!1,formatTick:function(e){return"".concat(Math.round(Number(e)),"%")}},tooltip:{render:function(i){var a,t=i.x,r=i.points,s=String(t),o=null===(a=te.data)||void 0===a?void 0:a.series.find(function(e){return e.x===s});return n.jsxs("div",e.__assign({className:"ag-tip ag-tip--wide"},{children:[n.jsx("div",e.__assign({className:"ag-tip__head"},{children:D(s)})),r.filter(function(e){return null!=e.value}).map(function(i){return n.jsxs("div",e.__assign({className:"ag-tip__line"},{children:[n.jsxs("span",{children:[n.jsx("i",{style:{background:i.color}}),i.series.label]}),n.jsxs("strong",{children:[i.value,"%"]})]}),i.series.key)}),o?Object.keys(o.r).map(function(i){var a,t;return n.jsxs("div",e.__assign({className:"ag-tip__sub"},{children:[n.jsx("span",{children:I.kpiLabel(i)}),n.jsx("span",{children:null==o.r[i]?"No correlation":"r ".concat(o.r[i]," · ").concat(null!==(a=o.strength[i])&&void 0!==a?a:"none"," · ").concat(null!==(t=o.nObs[i])&&void 0!==t?t:0," days")})]}),i)}):null]}))}},legend:{position:"bottom",toggle:!0},style:{chartHeight:220,yAxisWidth:60,gridColor:"#e2e8f0",axisColor:"#cbd5e1",axisLabelColor:"#64748b",tickColor:"#64748b"}})}))})),n.jsx("div",e.__assign({className:"ag-corr__metrics"},{children:ne.drivers.map(function(i){var a,t=null!==(a=i.strength)&&void 0!==a?a:"none";return n.jsxs("div",e.__assign({className:"ag-corr__metric"},{children:[n.jsx("span",e.__assign({className:"ag-corr__name"},{children:i.label||I.kpiLabel(i.kpiId)})),i.kpiId!==ne.kpiId?n.jsx("span",e.__assign({className:"ag-driver__badge ag-driver__badge--".concat(t)},{children:b[t]})):null,n.jsx("strong",{children:l.formatValue(i.value)}),n.jsx("span",e.__assign({className:"ag-corr__delta"},{children:null!=i.deltaPct?n.jsxs(n.Fragment,{children:[n.jsxs("span",e.__assign({className:"ag-dod__value ag-dod__value--".concat(i.tone||"flat")},{children:["up"===i.direction?"↑":"down"===i.direction?"↓":"→"," ",Math.abs(i.deltaPct),"%"]}))," vs. ",l.formatValue(i.previous)]}):"—"})),i.kpiId!==ne.kpiId?n.jsxs("span",e.__assign({className:"ag-corr__r"},{children:[i.nObs," days used",i.lowHistory?" · Low history":"",n.jsx("br",{}),null==i.movedWithToday?"No comparison for today":i.movedWithToday?"Moved together with the headline today":"Moved opposite the headline today"]})):null]}),i.kpiId)})})),I.viewer.isAdmin&&$?n.jsxs("div",e.__assign({className:"ag-corr__window"},{children:[n.jsxs("label",e.__assign({className:"ag-corr__start"},{children:["Ignore data before ",n.jsx("input",{type:"date",value:K,onChange:function(e){return A(e.target.value)}})]})),n.jsxs("div",e.__assign({className:"ag-corr__days-label"},{children:["Or leave out individual dates (",R.length," selected)"]})),n.jsx("div",e.__assign({className:"ag-corr__days","aria-label":"Days to leave out"},{children:ne.series.map(function(i){return n.jsx("button",e.__assign({type:"button","aria-pressed":R.includes(i.x),className:R.includes(i.x)?"is-selected":void 0,onClick:function(){return n=i.x,L(function(i){return i.includes(n)?i.filter(function(e){return e!==n}):e.__spreadArray(e.__spreadArray([],i,!0),[n],!1)});var n}},{children:D(i.x)}),i.x)})})),n.jsx("input",{className:"ag-corr__reason",value:B,onChange:function(e){return O(e.target.value)},placeholder:"Reason required to apply"}),V?n.jsx("p",e.__assign({className:"ins-error"},{children:V})):null,n.jsxs("div",e.__assign({className:"ag-corr__actions"},{children:[n.jsx("button",e.__assign({type:"button",className:"ins-link",onClick:function(){return P({disregardBefore:K||void 0,disregardDates:R})}},{children:"Preview"})),n.jsx("button",e.__assign({type:"button",className:"ins-button",disabled:Boolean(U),onClick:function(){return e.__awaiter(f,void 0,void 0,function(){var n,i;return e.__generator(this,function(e){switch(e.label){case 0:if(!I||!S||!B.trim())return q("A reason is required."),[2];q(null),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,s.saveCorrelationWindow(I.api,j,{kpiId:S,startDate:K||null,excludedDates:R,dataDay:y,changeReason:B.trim(),regenerate:!0})];case 2:return n=e.sent(),W(n.jobId),[3,4];case 3:return i=e.sent(),q(i.message||"The correlation window couldn't be saved."),[3,4];case 4:return[2]}})})}},{children:"Apply"})),n.jsx("button",e.__assign({type:"button",className:"ins-link",onClick:function(){A(""),L([]),P({})}},{children:"Clear"}))]}))]})):null]}))}))}var S=function(e){var n;return(null===(n=null==e?void 0:e.period)||void 0===n?void 0:n.end)||null};function C(a){var t,d=a.entityKey,u=a.kpis,v=a.nodeKeys,h=a.workingDays,p=a.group,_=a.onOpenPoint,m=o.useInsights(),f=i.useState(null!==(t=u[0])&&void 0!==t?t:""),y=f[0],x=f[1];i.useEffect(function(){var e;u.includes(y)||x(null!==(e=u[0])&&void 0!==e?e:"")},[u,y]);var b=l.useInsightsFetch(m&&y&&null!==p&&0!==(null==v?void 0:v.length)?function(n){return s.fetchInsightsSeries(m.api,e.__assign(e.__assign({},m.range),{workingDaysOnly:h,group:p||void 0}),v?{kpiIds:[y],nodeKeys:v.slice(0,g)}:{kpiIds:[y],entityKey:d,topN:3},n)}:null,[null==m?void 0:m.api.configId,null==m?void 0:m.rangeKey,d,y,null==v?void 0:v.join(","),h,p,null==m?void 0:m.revision]),j=b.data,k=b.loading,w=b.error,N=i.useMemo(function(){var e;return 0===(null==v?void 0:v.length)?[]:(null!==(e=null==j?void 0:j.series)&&void 0!==e?e:[]).filter(function(e){return e.kpiId===y&&e.points.some(function(e){return Number.isFinite(e.y)})})},[j,v,y]),D=i.useState(new Set),I=D[0],S=D[1];i.useEffect(function(){return S(new Set)},[N]);var C=i.useMemo(function(){return Array.from(new Set(N.flatMap(function(e){return e.points.map(function(e){return e.x})}))).sort()},[N]),K=i.useMemo(function(){return N.map(function(e,n){var i,a=new Map(e.points.map(function(e){return[e.x,e.y]})),t=null!==(i=null==m?void 0:m.goodDirection(e.kpiId))&&void 0!==i?i:"up";return{key:"row_".concat(n,"_").concat(e.nodeKey.replace(/[^a-zA-Z0-9_]/g,"_")),label:e.label||e.nodeKey,color:["#06B6D4","#10A66A","#8650FF","#F59E0B","#E94BBD","#4285FF","#64748B","#F04444","#14B8A6","#84CC16"][n%10],curve:"smooth",pointRadius:3,activePointRadius:3,fillPointsOnHover:!0,data:C.map(function(e){var n;return{x:e,y:null!==(n=a.get(e))&&void 0!==n?n:null}}),valueFormatter:function(e){return l.formatValue(e)},markers:e.points.filter(function(e){var n;return null===(n=e.meta)||void 0===n?void 0:n.marker}).map(function(n){return{x:n.x,color:c.movementColorHex(n.meta.marker.movementType,n.meta.marker.direction,t),label:[n.meta.marker.criticality,n.meta.marker.headline].filter(Boolean).join(" · "),radius:3,haloRadius:3,onClick:function(){var i,a=null!==(i=e.label)&&void 0!==i?i:e.nodeKey;_?_({nodeKey:e.nodeKey,label:a,kpiId:e.kpiId,dataDay:n.x,reportId:n.meta.marker.reportId}):null==m||m.openReport(n.meta.marker.reportId?{reportId:n.meta.marker.reportId,title:"".concat(a," · ").concat(l.shortDay(n.x))}:{nodeKey:e.nodeKey,kpiId:e.kpiId,dataDay:n.x,title:"".concat(a," · ").concat(l.shortDay(n.x))})}}})}})},[N,C,m,_]);if(!m)return null;var A=m.kpiLabel(y);return n.jsxs("div",e.__assign({className:"ag-row-trend"},{children:[u.length>1?n.jsx("div",e.__assign({className:"ag-chart__switch",role:"group","aria-label":"Number"},{children:u.map(function(i){return n.jsx("button",e.__assign({type:"button","aria-pressed":i===y,className:i===y?"is-active":void 0,onClick:function(){return x(i)}},{children:m.kpiLabel(i)}),i)})})):null,w?n.jsx("div",e.__assign({className:"ag-empty"},{children:"This chart is unavailable right now."})):k?n.jsx(c.ChartSkeleton,{height:240,label:"Loading trend"}):C.length?n.jsx("div",e.__assign({className:"ag-chart"},{children:n.jsxs("div",e.__assign({className:"ellm-graph"},{children:[n.jsx(r.default,{tier:"decision-advantage-".concat(d),series:K,hiddenKeys:I,onToggleSeries:function(e){return S(function(n){var i=new Set(n);return i.has(e)?i.delete(e):i.size<K.length-1&&i.add(e),i})},onPointClick:function(e){var n,i,a,t,r,s,o=e.series,d=e.point,c=e.index,u=K.findIndex(function(e){return e.key===o.key}),g=N[u],v=null!==(n=d.x)&&void 0!==n?n:null===(i=o.data[c])||void 0===i?void 0:i.x,h=null==g?void 0:g.points.find(function(e){return e.x===String(v)});if(g&&h){var p=null!==(a=g.label)&&void 0!==a?a:g.nodeKey,f=null!==(s=null===(r=null===(t=h.meta)||void 0===t?void 0:t.marker)||void 0===r?void 0:r.reportId)&&void 0!==s?s:null;_?_({nodeKey:g.nodeKey,label:p,kpiId:g.kpiId,dataDay:h.x,reportId:f}):m.openReport(f?{reportId:f,title:"".concat(p," · ").concat(l.shortDay(h.x))}:{nodeKey:g.nodeKey,kpiId:g.kpiId,dataDay:h.x,title:"".concat(p," · ").concat(l.shortDay(h.x))})}},xAxis:{label:"Date",categories:C,tickCount:8,minTickGap:24,formatTick:function(e){return l.shortDay(e)}},yAxis:{label:A,beginAtZero:!0,formatTick:function(e){return l.formatValue(Number(e))}},tooltip:{formatHeading:function(e){return String(e)}},legend:{show:!1},style:{chartHeight:240,yAxisWidth:70,gridColor:"#e2e8f0",axisColor:"#cbd5e1",axisLabelColor:"#64748b",tickColor:"#64748b"}}),n.jsx("div",e.__assign({className:"ellm-graph__legend ellm-chart__legend--bottom ellm-chart__legend--center"},{children:K.map(function(i){var a=I.has(i.key);return n.jsxs("label",e.__assign({title:i.label,className:"ellm-graph__legend-item ag-legend-item".concat(a?" ellm-graph__legend-item--off":""),style:{cursor:"pointer","--checkbox-color":i.color,color:i.color}},{children:[n.jsx("input",{type:"checkbox",className:"ellm-graph__legend-checkbox",checked:!a,onChange:function(){return S(function(e){var n=new Set(e);return n.has(i.key)?n.delete(i.key):n.size<K.length-1&&n.add(i.key),n})},style:{borderColor:i.color,accentColor:i.color}}),n.jsx("span",{children:i.label})]}),i.key)})}))]}))})):n.jsx("div",e.__assign({className:"ag-empty"},{children:"Not enough history yet for a trend chart."}))]}))}function K(a){var t,r=this,d=a.tab,u=a.partName,v=a.kpiIds,_=a.rankBy,m=a.search,f=a.graphed,y=a.onToggleGraph,x=a.onOpenRow,b=a.onFirstRow,N=a.onInitialGraph,D=a.fallbackDay,I=o.useInsights(),S=Math.min(200,Math.max(1,Number(d.pageSize)||5)),C=i.useState([]),K=C[0],A=C[1],T=i.useState(null),R=T[0],L=T[1],F=i.useState(!1),M=F[0],P=F[1],E=i.useState({loading:!0,error:null}),B=E[0],O=E[1],G=function(n,i){return e.__awaiter(r,void 0,void 0,function(){var a,t;return e.__generator(this,function(r){switch(r.label){case 0:if(!I)return[2];O({loading:!0,error:null}),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,s.fetchLevelRows(I.api,d.entityKey,I.range,{sort:_,order:"desc",search:m||void 0,pageSize:S,cursor:null!=n?n:void 0,includeChildren:3},i)];case 2:return a=r.sent(),(null==i?void 0:i.aborted)?[2]:(A(function(i){return n?e.__spreadArray(e.__spreadArray([],i,!0),a.rows,!0):a.rows}),L(a.nextCursor),P(a.hasNext),O({loading:!1,error:null}),[3,4]);case 3:return t=r.sent(),(null==i?void 0:i.aborted)||"AbortError"===(null==t?void 0:t.name)?[2]:(O({loading:!1,error:t.message||"Couldn't load the rows."}),[3,4]);case 4:return[2]}})})},V=null===(t=K[0])||void 0===t?void 0:t.nodeKey;i.useEffect(function(){return null==b?void 0:b(V)},[V]);var q=K.slice(0,3).map(function(e){return e.nodeKey}),H=q.join("\0");if(i.useEffect(function(){B.loading||null==N||N(q)},[B.loading,H]),i.useEffect(function(){var e=new AbortController;return G(null,e.signal),function(){return e.abort()}},[null==I?void 0:I.api.configId,null==I?void 0:I.rangeKey,d.entityKey,_,m,S,null==I?void 0:I.revision]),!I)return null;var U=I.goodDirection(_),W=v.filter(function(e){return e!==_}).slice(0,2),z=h(u);return n.jsx(c.ReportAccordion,e.__assign({title:"Top Drivers for ".concat(p(z))},{children:B.error?n.jsx("p",e.__assign({className:"ag-muted"},{children:"Top drivers are unavailable right now."})):B.loading&&!K.length?n.jsx(c.SkeletonLines,{widths:[80,60,85,55,75],label:"Loading drivers"}):K.length?n.jsxs(n.Fragment,{children:[n.jsx(w,e.__assign({label:p(u),rightLabel:"User Activity · selected dates"},{children:K.map(function(i){var a,t,r,o,d=null===(a=i.metrics)||void 0===a?void 0:a[_],u=i.label||i.nodeKey,v=f.includes(i.nodeKey);return n.jsx(k,{rank:i.rank,name:u,chips:n.jsxs(n.Fragment,{children:[n.jsx(c.CriticalityChip,{criticality:null===(t=i.chip)||void 0===t?void 0:t.criticality}),n.jsx(c.MovementChip,{movementType:null===(r=i.chip)||void 0===r?void 0:r.movementType,direction:null===(o=i.chip)||void 0===o?void 0:o.direction})]}),action:n.jsx(j,{on:v,disabled:!v&&f.length>=g,onClick:function(){return y(i.nodeKey)}}),lines:n.jsxs("span",e.__assign({className:"ag-driver__cost"},{children:[n.jsxs("span",e.__assign({className:"ag-driver__total"},{children:[l.formatValue(null==d?void 0:d.value)," ",I.kpiLabel(_).toLowerCase()]})),null!=(null==d?void 0:d.deltaPct)?n.jsx("span",e.__assign({className:"ag-driver__sep"},{children:"|"})):null,n.jsx(c.DayOverDayChange,{deltaPct:null==d?void 0:d.deltaPct,good:U,direction:null==d?void 0:d.direction,tone:null==d?void 0:d.tone,suffix:"vs previous period"})]})),cell:W.map(function(a){var t,r,s=null===(t=i.metrics)||void 0===t?void 0:t[a],o=null!==(r=null==s?void 0:s.tone)&&void 0!==r?r:c.toneOf(null==s?void 0:s.deltaPct,I.goodDirection(a)),d="up"===(null==s?void 0:s.direction)?"↑":"down"===(null==s?void 0:s.direction)?"↓":"flat"===(null==s?void 0:s.direction)?"→":null!=(null==s?void 0:s.deltaPct)&&s.deltaPct>0?"↑":null!=(null==s?void 0:s.deltaPct)&&s.deltaPct<0?"↓":"→";return n.jsxs("span",e.__assign({className:"ag-driver__activity"},{children:[n.jsx("strong",e.__assign({className:"good"===o?"ag-text--good":"bad"===o?"ag-text--bad":void 0},{children:null==(null==s?void 0:s.deltaPct)?l.formatValue(null==s?void 0:s.value):"".concat(d).concat(Math.abs(s.deltaPct),"%")})),n.jsx("span",{children:I.kpiLabel(a)})]}),a)}),onOpen:function(){var e;return x(i,_,D||(null===(e=i.chip)||void 0===e?void 0:e.dataDay)||s.toIsoDay(I.range.endDate))}},i.nodeKey)})})),M?n.jsx("div",e.__assign({className:"ag-more"},{children:n.jsx("button",e.__assign({type:"button",disabled:B.loading,onClick:function(){return G(R)}},{children:B.loading?"Loading...":"Show more"}))})):null]}):n.jsx("p",e.__assign({className:"ag-muted"},{children:m?"No ".concat(z," match “").concat(m,"”."):"No ".concat(z," for this period yet.")}))}))}exports.AddToGraph=j,exports.CorrelationSection=I,exports.DecisionCard=f,exports.DriverList=w,exports.DriverRow=k,exports.L2Report=function(t){var r,u,p,_,y,x,b,j,k,w,N,D,A,T,R=t.tab,L=t.title,F=t.partName,M=t.partKpis,P=t.search,E=t.onOpenRow,B=o.useInsights(),O=i.useState(Boolean(null==B?void 0:B.defaultWorkingDays)),G=O[0],V=O[1],q=l.useInsightsFetch(B?function(e){return s.fetchGraphGroups(B.api,e)}:null,[null==B?void 0:B.api.configId,null==B?void 0:B.revision]),H=i.useState(null),U=H[0],W=H[1];i.useEffect(function(){var e,n;null===U&&((null===(e=q.data)||void 0===e?void 0:e.groups.length)?W((null!==(n=q.data.groups.find(function(e){return e.isDefault}))&&void 0!==n?n:q.data.groups[0]).groupKey):q.loading||W(""))},[U,q.data,q.loading]);var z=i.useState(null),Z=z[0],X=z[1],J=i.useState(),$=J[0],Q=J[1],Y=!1!==R.showSummary,ee=l.useInsightsFetch(B&&Y?function(e){return s.fetchLevelSummary(B.api,R.entityKey,B.range,e)}:null,[null==B?void 0:B.api.configId,null==B?void 0:B.rangeKey,R.entityKey,Y,null==B?void 0:B.revision]);if(!B)return null;var ne=(null===(r=R.listKpis)||void 0===r?void 0:r.length)?R.listKpis:M,ie=R.rankBy&&ne.includes(R.rankBy)?R.rankBy:null!==(u=ne[0])&&void 0!==u?u:"",ae=null===(p=ee.data)||void 0===p?void 0:p.report,te=S(null===(_=ee.data)||void 0===_?void 0:_.context),re=B.goodDirection(ie),se=null!==(y=R.tier1Kpis)&&void 0!==y?y:B.tierKpis[1],oe=null!==(x=R.tier2Kpis)&&void 0!==x?x:B.tierKpis[2],le=B.headlineKpi||ie||se[0]||"",de=function(e){var n=e.nodeKey,i=e.label,a=e.dataDay;return E({rank:0,nodeKey:n,label:i,parent:null,metrics:{},barPct:null,chip:null,report:{reportId:null,status:"none",kpiId:le},action:null,children:[]},le,a)};return n.jsxs("section",e.__assign({className:"ag-report","aria-label":"L2 Report · ".concat(L)},{children:[n.jsxs("div",e.__assign({className:"ag-report__header"},{children:[n.jsxs("h2",e.__assign({className:"ag-report__title"},{children:[n.jsx(a.Sparkles,{"aria-hidden":"true"}),"L2 Report"]})),n.jsx("span",e.__assign({className:"ag-report__scope"},{children:L})),te?n.jsx("span",e.__assign({className:"ag-report__date"},{children:c.formatHeaderDate(te)})):null]})),n.jsxs("div",e.__assign({className:"ag-report__grid ag-report__grid--l2"},{children:[n.jsxs("div",e.__assign({className:"ag-stack"},{children:[Y?n.jsxs(n.Fragment,{children:[n.jsxs("div",{children:[n.jsx(c.SectionHeader,{title:"Summary",action:n.jsx(v,{entityKey:R.entityKey,dataDay:te})}),n.jsx(m,{report:ae,loading:ee.loading,error:ee.error,good:re})]}),n.jsx(f,{report:ae,error:ee.error,loading:ee.loading})]}):null,ne.length?n.jsx(K,{tab:R,partName:F,kpiIds:ne,rankBy:ie,search:P,graphed:null!=Z?Z:[],onToggleGraph:function(n){return X(function(i){var a=null!=i?i:[];return a.includes(n)?a.filter(function(e){return e!==n}):a.length<g?e.__spreadArray(e.__spreadArray([],a,!0),[n],!1):a})},onOpenRow:E,onFirstRow:Q,onInitialGraph:function(e){return X(function(n){return null!=n?n:e})},fallbackDay:te}):null]})),n.jsxs("div",e.__assign({className:"ag-stack"},{children:[se.length?n.jsx(c.CollapsibleVisualSection,e.__assign({title:"Trend",action:n.jsx(c.DaysDropdown,{value:G,onChange:V,groups:q.error||null===(b=q.data)||void 0===b?void 0:b.groups,group:U,onGroupChange:W})},{children:n.jsx(C,{entityKey:R.entityKey,kpis:se,nodeKeys:Z,workingDays:G,group:U,onOpenPoint:de})})):null,oe.length?n.jsx(c.CollapsibleVisualSection,e.__assign({title:"User Activity",meta:Z?"Selected rows":"Top ".concat(3," ").concat(h(F))},{children:n.jsx(C,{entityKey:R.entityKey,kpis:oe,nodeKeys:Z,workingDays:G,group:U,onOpenPoint:de})})):null,n.jsx(I,{dataDay:te,nodeKey:null!==(j=null==Z?void 0:Z[0])&&void 0!==j?j:$,dayGroup:null===(w=null===(k=q.data)||void 0===k?void 0:k.groups.find(function(e){return e.groupKey===U}))||void 0===w?void 0:w.days}),(null===(N=B.insightsColumns)||void 0===N?void 0:N[R.entityKey])||!1!==(null===(D=R.drillTable)||void 0===D?void 0:D.enabled)?n.jsx(d.default,{entityKey:R.entityKey,dataDay:null!=te?te:void 0,pageSize:null!==(A=R.pageSize)&&void 0!==A?A:void 0,defaultSort:null===(T=R.drillTable)||void 0===T?void 0:T.defaultSort,onOpenRow:function(e){var n;return E(e,ie,te||(null===(n=e.chip)||void 0===n?void 0:n.dataDay)||s.toIsoDay(B.range.endDate))}}):null]}))]}))]}))},exports.MAX_SERIES=g,exports.RegenerateSummary=v,exports.RowDrivers=K,exports.RowTrend=C,exports.SummaryCard=m,exports.TopDriversSection=function(t){var r,d,v,_,m,f,N,D,I,S,C=t.dataDay,K=t.entityKey,A=t.parentNodeKey,T=t.kpiId,R=t.title,L=t.graphed,F=t.onToggleGraph,M=t.onOpenDriver,P=t.onDecisionSettled,E=t.initialTab,B=void 0===E?"drivers":E,O=o.useInsights(),G=i.useState(B),V=G[0],q=G[1],H=i.useState({drivers:1,headwinds:1,attention:1}),U=H[0],W=H[1],z=null!==(r=null!=T?T:null==O?void 0:O.headlineKpi)&&void 0!==r?r:void 0,Z=function(e){return O&&z&&e===V?function(n){return s.fetchInsightsDrivers(O.api,{dataDay:C,kpiId:z,entityKey:K,parentNodeKey:A,tab:e,limit:Math.min(10,(A?10:3)*U[e]),offset:0},n)}:null},X=function(e){return[null==O?void 0:O.api.configId,C,z,K,A,e,V,U[e],null==O?void 0:O.revision]},J={drivers:l.useInsightsFetch(Z("drivers"),X("drivers")),headwinds:l.useInsightsFetch(Z("headwinds"),X("headwinds")),attention:l.useInsightsFetch(Z("attention"),X("attention"))},$=J[V],Q=$.data,Y=$.error,ee=$.loading,ne=null!==(m=null!==(v=null===(d=J.drivers.data)||void 0===d?void 0:d.tabs)&&void 0!==v?v:null===(_=J.headwinds.data)||void 0===_?void 0:_.tabs)&&void 0!==m?m:null===(f=J.attention.data)||void 0===f?void 0:f.tabs,ie=null!==(N=null==O?void 0:O.entityOrder)&&void 0!==N?N:[],ae=u.useNeedsAttention(C,A,z),te=null!==(I=null===(D=ae.data)||void 0===D?void 0:D.counts.pending)&&void 0!==I?I:0;if(i.useEffect(function(){return W({drivers:1,headwinds:1,attention:1})},[C]),i.useEffect(function(){return q(B)},[B]),!O)return null;var re=O.goodDirection(null!=z?z:""),se=null!==(S=null==Q?void 0:Q.rows)&&void 0!==S?S:[],oe=Array.from(new Set(se.map(function(e){return e.entityKey}).filter(function(e){return Boolean(e)}))),le=Boolean(A)&&oe.length>1,de=e.__spreadArray([],oe,!0).sort(function(e,n){var i=Math.min.apply(Math,se.filter(function(n){return n.entityKey===e}).map(function(e){var n;return null!==(n=e.level)&&void 0!==n?n:99})),a=Math.min.apply(Math,se.filter(function(e){return e.entityKey===n}).map(function(e){var n;return null!==(n=e.level)&&void 0!==n?n:99})),t=ie.indexOf(e),r=ie.indexOf(n);return i-a||(t<0?Number.MAX_SAFE_INTEGER:t)-(r<0?Number.MAX_SAFE_INTEGER:r)});return n.jsxs(c.ReportAccordion,e.__assign({title:R},{children:[n.jsx("div",e.__assign({className:"ag-driver-tabs",role:"tablist","aria-label":"Driver views"},{children:y.map(function(i){return n.jsxs("button",e.__assign({type:"button",role:"tab","aria-selected":V===i.key,className:V===i.key?"is-active":void 0,onClick:function(){return q(i.key)},title:i.info},{children:[i.label,(null==ne?void 0:ne[i.key])?" (".concat(ne[i.key].total,")"):"","attention"===i.key&&te?n.jsxs("span",e.__assign({className:"ag-na__tab-badge",title:"".concat(te," data points need a decision")},{children:[te,n.jsx("span",e.__assign({className:"ins-visually-hidden"},{children:" data points need a decision"}))]})):null,n.jsx(a.Info,{"aria-hidden":"true"})]}),i.key)})})),"attention"===V?n.jsx(u.default,{dataDay:C,nodeKey:A,kpiId:z,attention:ae,onDecisionSettled:P}):null,"attention"===V&&se.length?n.jsx("h4",e.__assign({className:"ag-na__subhead"},{children:"Rows that moved without a clear cause"})):null,Y?n.jsxs("p",e.__assign({className:"ag-muted"},{children:["Top drivers are unavailable right now: ",Y.message]})):ee&&!Q?n.jsx("p",e.__assign({className:"ag-muted"},{children:"Loading drivers..."})):se.length?n.jsxs(n.Fragment,{children:[(le?de:[null]).map(function(a){return n.jsxs(i.Fragment,{children:[a?n.jsx("h4",e.__assign({className:"ag-driver-group"},{children:p(h(O.entityName(a)))})):null,n.jsx(w,e.__assign({label:a?p(O.entityName(a)):"Driver"},{children:(a?se.filter(function(e){return e.entityKey===a}):se).map(function(i,t){var r,s,o,d,u,v,h,p,_,m,f,y=i.deltaContributionPct,x=L.includes(i.nodeKey),w=(null===(r=i.decisionAdvantage)||void 0===r?void 0:r.correlationSentence)||(null===(s=i.decisionAdvantage)||void 0===s?void 0:s.firstCause)||(null===(o=i.decisionAdvantage)||void 0===o?void 0:o.headline);return n.jsx(k,{rank:a?t+1:i.rank,category:null===(d=i.path)||void 0===d?void 0:d.slice(0,-1).join(" › "),name:i.label,chips:n.jsxs(n.Fragment,{children:[n.jsx(c.CriticalityChip,{criticality:i.criticality}),n.jsx(c.MovementChip,{movementType:i.movementType,direction:i.changeDirection}),(null===(u=i.correlation)||void 0===u?void 0:u.strength)?n.jsx("span",e.__assign({className:"ag-driver__badge ag-driver__badge--".concat(i.correlation.strength)},{children:b[i.correlation.strength]})):null]}),action:F?n.jsx(j,{on:x,disabled:!x&&L.length>=g,onClick:function(){return F(i)}}):void 0,lines:n.jsxs(n.Fragment,{children:[null!=y?n.jsxs("span",e.__assign({className:"ag-driver__share"},{children:[Math.abs(y),"% of today's movement ·"," ","opposite"===i.direction?"in the opposite direction":"driving the ".concat(null!==(v=null==Q?void 0:Q.headlineDirection)&&void 0!==v?v:"change")]})):null,n.jsxs("span",e.__assign({className:"ag-driver__cost"},{children:[n.jsx("span",e.__assign({className:"ag-driver__total"},{children:l.formatValue(i.value)})),null!=i.deltaPct?n.jsx("span",e.__assign({className:"ag-driver__sep"},{children:"|"})):null,n.jsx(c.DayOverDayChange,{deltaPct:i.deltaPct,good:re,direction:i.changeDirection,tone:i.tone,suffix:l.previousDayLabel(C)})]})),w?n.jsx("p",e.__assign({className:"ag-driver__brief"},{children:n.jsx(c.VerdictSentence,{text:w,good:re,arrowsFollowVerdict:!0})})):null,(null===(h=i.decisionAdvantage)||void 0===h?void 0:h.nextStep)?n.jsxs("p",e.__assign({className:"ag-driver__brief"},{children:[n.jsx("strong",{children:"Next:"})," ",i.decisionAdvantage.nextStep]})):null]}),cell:n.jsxs("span",e.__assign({className:"ag-driver__activity"},{children:[n.jsx("strong",{children:l.formatValue(null!==(_=null===(p=i.drivingMetric)||void 0===p?void 0:p.value)&&void 0!==_?_:i.previous)}),n.jsx("span",{children:(null===(m=i.drivingMetric)||void 0===m?void 0:m.label)||((null===(f=i.drivingMetric)||void 0===f?void 0:f.kpiId)?O.kpiLabel(i.drivingMetric.kpiId):"opposite"===i.direction?"Moved opposite":"with"===i.direction?"Moved with":"Previous")})]})),onOpen:function(){var e;return M?M(i):O.openReport({reportId:null===(e=i.report)||void 0===e?void 0:e.reportId,nodeKey:i.nodeKey,kpiId:z,dataDay:C,title:i.label})}},i.nodeKey)})}))]},null!=a?a:"all")}),(null==Q?void 0:Q.hasMore)?n.jsx("div",e.__assign({className:"ag-more"},{children:n.jsx("button",e.__assign({type:"button",disabled:ee,onClick:function(){return W(function(n){var i;return e.__assign(e.__assign({},n),((i={})[V]=n[V]+1,i))})}},{children:ee?"Loading...":"Show more"}))})):null]}):n.jsx("p",e.__assign({className:"ag-muted"},{children:x[V]}))]}))},exports.reportDayOf=S,exports.titleCase=p;
2
2
  //# sourceMappingURL=AgReport.js.map
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),n=require("react/jsx-runtime"),t=require("lucide-react"),i=require("react"),l=require("../../api/insightsApi.js"),r=require("./insightsContextCore.js"),a=function(e,n){return e instanceof Date?e:e?new Date("".concat(e.slice(0,10),"T00:00:00")):n},o=function(e){return e.replace(/[_-]+/g," ").replace(/\b\w/g,function(e){return e.toUpperCase()})},s=function(e,n){var t,i,l,r;return{rank:e.rank,nodeKey:e.nodeKey,entityKey:e.entityKey,label:e.label,value:e.value,parent:null,metrics:n?(t={},t[n]={value:e.value,previous:e.previous,deltaPct:e.deltaPct,isRangeExact:!0,direction:e.changeDirection,tone:e.tone},t):{},barPct:null,chip:{criticality:e.criticality,movementType:e.movementType,direction:e.changeDirection,label:null},report:{reportId:null!==(l=null===(i=e.report)||void 0===i?void 0:i.reportId)&&void 0!==l?l:null,status:(null===(r=e.report)||void 0===r?void 0:r.reportId)?"generated":"none"},action:null,children:[]}};function c(e,n){if(null==e||""===e)return"—";if("date"===n&&"string"==typeof e){var t=new Date("".concat(e.slice(0,10),"T00:00:00"));return Number.isNaN(t.getTime())?e:t.toLocaleDateString()}return"number"==typeof e?"percent"===n?"".concat(new Intl.NumberFormat(void 0,{maximumFractionDigits:1}).format(e),"%"):new Intl.NumberFormat(void 0,{maximumFractionDigits:"rating"===n?2:1}).format(e):String(e).replace(/_/g," ")}exports.default=function(u){var d,v,h,_,g,f,p,y,m,b,x=this,w=u.entityKey,j=u.parentNodeKey,k=u.parts,N=u.columns,D=u.dataDay,K=u.startDate,S=u.endDate,C=u.pageSize,I=void 0===C?20:C,T=u.defaultSort,M=u.onOpenRow,L=r.useInsights(),E=null!==(d=null==k?void 0:k.filter(Boolean))&&void 0!==d?d:[],O=i.useState(null!==(v=E[0])&&void 0!==v?v:w),A=O[0],P=O[1],q=i.useState(""),B=q[0],R=q[1],F=i.useState(""),z=F[0],U=F[1],G=i.useState(T),H=G[0],J=G[1],Q=i.useState([]),V=Q[0],W=Q[1],X=i.useState(null),Y=X[0],Z=X[1],$=i.useState(0),ee=$[0],ne=$[1],te=i.useState(!1),ie=te[0],le=te[1],re=i.useState(0),ae=re[0],oe=re[1],se=i.useState(!1),ce=se[0],ue=se[1],de=i.useState(null),ve=de[0],he=de[1];i.useEffect(function(){var e;return P(null!==(e=E[0])&&void 0!==e?e:w)},[w,E.join("|")]),i.useEffect(function(){var e=setTimeout(function(){return U(B.trim())},300);return function(){return clearTimeout(e)}},[B]);var _e=null===(g=null===(_=null===(h=null==L?void 0:L.decisionAdvantage)||void 0===h?void 0:h.tabs)||void 0===_?void 0:_.items)||void 0===g?void 0:g.find(function(e){return e.entityKey===A}),ge=i.useMemo(function(){var e,n,t,i,l,r=null!==(n=null!=N?N:null===(e=null==L?void 0:L.insightsColumns)||void 0===e?void 0:e[A])&&void 0!==n?n:null===(t=null==_e?void 0:_e.drillTable)||void 0===t?void 0:t.columns;return(null==r?void 0:r.length)?r:((null===(i=null==_e?void 0:_e.listKpis)||void 0===i?void 0:i.length)?_e.listKpis:null!==(l=null==L?void 0:L.entityKpis(A))&&void 0!==l?l:[]).map(function(e){return{key:e,source:"kpi",show:"both",sortable:!0}})},[N,L,A,_e]),fe=null!=H?H:null===(f=null==_e?void 0:_e.drillTable)||void 0===f?void 0:f.defaultSort,pe=Boolean(j&&E.length&&A!==w&&!(null==L?void 0:L.isChildOf(A,w))),ye=null===(p=null==L?void 0:L.drillTable.clickableEntityKeys.includes(A))||void 0===p||p,me=null!==(b=null!==(m=null===(y=ge.find(function(e){return"kpi"===e.source}))||void 0===y?void 0:y.key)&&void 0!==m?m:null==L?void 0:L.headlineKpi)&&void 0!==b?b:"",be=ge.some(function(e){return"row"===e.source&&"children"===e.key})?20:void 0,xe=L?a(K,L.range.startDate):new Date,we=L?a(S,L.range.endDate):new Date,je="".concat(l.toIsoDay(xe),":").concat(l.toIsoDay(we));if(i.useEffect(function(){if(L){var n=new AbortController;ue(!0),he(null),W([]),Z(null),ne(0);var t=pe?l.fetchInsightsDrivers(L.api,{dataDay:null!=D?D:l.toIsoDay(we),kpiId:me,entityKey:A,parentNodeKey:j,tab:"drivers",limit:Math.min(10,I),offset:0},n.signal).then(function(e){var n,t,i,l;return{rows:e.rows.map(function(e){return s(e,me)}).filter(function(e){var n;return!z||(null!==(n=e.label)&&void 0!==n?n:"").toLowerCase().includes(z.toLowerCase())}),count:null!==(i=null===(t=null===(n=e.tabs)||void 0===n?void 0:n.drivers)||void 0===t?void 0:t.total)&&void 0!==i?i:e.rows.length,hasMore:e.hasMore,cursor:null,nextOffset:null!==(l=e.nextOffset)&&void 0!==l?l:e.rows.length}}):l.fetchLevelRows(L.api,A,e.__assign(e.__assign({},L.range),{startDate:xe,endDate:we}),{sort:null==fe?void 0:fe.key,order:null==fe?void 0:fe.order,search:z||void 0,parentNodeKey:j,pageSize:I,includeChildren:be},n.signal).then(function(e){return{rows:e.rows,count:e.count,hasMore:e.hasNext,cursor:e.nextCursor,nextOffset:0}});return t.then(function(e){var n;W(e.rows),oe(e.count),le(e.hasMore),Z(null!==(n=e.cursor)&&void 0!==n?n:null),ne(e.nextOffset)}).catch(function(e){"AbortError"!==(null==e?void 0:e.name)&&he(e instanceof Error?e.message:"The rows couldn't be loaded.")}).finally(function(){n.signal.aborted||ue(!1)}),function(){return n.abort()}}},[null==L?void 0:L.api,null==L?void 0:L.revision,A,j,pe,D,me,be,je,z,null==fe?void 0:fe.key,null==fe?void 0:fe.order,I]),!L)return null;var ke=function(t,i){var l,r=null===(l=L.renderInsightsCell)||void 0===l?void 0:l.call(L,{column:i,row:t,entityKey:A});if(void 0!==r)return r;if("custom"===i.source)return"—";if("kpi"===i.source){var a=t.metrics[i.key],o=c(null==a?void 0:a.value,i.format),s=null==(null==a?void 0:a.deltaPct)?"—":"".concat(a.deltaPct>0?"↑":a.deltaPct<0?"↓":""," ").concat(Math.abs(a.deltaPct),"%");return"delta"===i.show?n.jsx("span",e.__assign({className:(null==a?void 0:a.tone)?"ag-drill__change--".concat(a.tone):void 0},{children:s})):"both"!==i.show&&i.show?o:n.jsxs("span",e.__assign({className:"ag-drill__metric"},{children:[n.jsx("strong",{children:o}),n.jsx("small",e.__assign({className:(null==a?void 0:a.tone)?"ag-drill__change--".concat(a.tone):void 0},{children:s}))]}))}var u=c(function(e,n){var t,i;return"criticality"===n?null===(t=e.chip)||void 0===t?void 0:t.criticality:"movementType"===n||"change"===n?null===(i=e.chip)||void 0===i?void 0:i.movementType:"children"===n?e.children.reduce(function(e,n){return n.label&&!e.includes(n.label)&&e.push(n.label),e},[]).join(", "):e[n]}(t,i.key),i.format);return"children"===i.key?n.jsx("span",e.__assign({className:"ag-drill__contributors",title:"—"===u?void 0:u},{children:u})):"chip"===i.format?n.jsx("span",e.__assign({className:"ag-drill__chip"},{children:u})):u};return n.jsxs("section",e.__assign({className:"ag-drill","aria-labelledby":"ag-drill-title"},{children:[n.jsxs("header",e.__assign({className:"ag-drill__header"},{children:[n.jsxs("div",{children:[n.jsx("h3",e.__assign({id:"ag-drill-title"},{children:E.length?"Drill down in ".concat(L.entityName(w)):L.entityName(A)})),pe?n.jsx("span",{children:"Rows that moved"}):null]}),n.jsxs("label",e.__assign({className:"ag-drill__search"},{children:[n.jsx(t.Search,{"aria-hidden":"true"}),n.jsx("input",{type:"search",value:B,onChange:function(e){return R(e.target.value)},placeholder:"Search ".concat(L.entityName(A).toLowerCase(),"…"),"aria-label":"Search ".concat(L.entityName(A))})]}))]})),E.length?n.jsx("div",e.__assign({className:"ag-drill__tabs",role:"tablist","aria-label":"Drill-down parts"},{children:E.map(function(t){return n.jsx("button",e.__assign({type:"button",role:"tab","aria-selected":A===t,className:A===t?"is-active":void 0,onClick:function(){P(t),R(""),U(""),J(void 0)}},{children:L.entityName(t)}),t)})})):null,n.jsxs("div",e.__assign({className:"ag-drill__table-wrap","aria-live":"polite"},{children:[n.jsxs("table",e.__assign({className:"ag-drill__table"},{children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:L.entityName(A)}),ge.map(function(t){var i,l,r,a,s=!pe&&(null!==(i=t.sortable)&&void 0!==i?i:"kpi"===t.source||["criticality","change"].includes(t.key));return n.jsx("th",e.__assign({className:"ag-drill__col--".concat(null!==(l=t.align)&&void 0!==l?l:"kpi"===t.source?"right":"left"," ").concat(t.hideBelow?"ag-drill__hide--".concat(t.hideBelow):""),style:{width:t.width}},{children:s?n.jsxs("button",e.__assign({type:"button",onClick:function(){return function(e){var n;(null!==(n=e.sortable)&&void 0!==n?n:"kpi"===e.source||["criticality","change"].includes(e.key))&&!pe&&J(function(n){return{key:e.key,order:(null==n?void 0:n.key)===e.key&&"desc"===n.order?"asc":"desc"}})}(t)}},{children:[null!==(r=t.label)&&void 0!==r?r:"kpi"===t.source?L.kpiLabel(t.key):o(t.key),(null==fe?void 0:fe.key)===t.key?n.jsxs("span",e.__assign({"aria-hidden":"true"},{children:[" ","asc"===fe.order?"↑":"↓"]})):null]})):null!==(a=t.label)&&void 0!==a?a:"kpi"===t.source?L.kpiLabel(t.key):o(t.key)}),"".concat(t.source,":").concat(t.key))}),ye?n.jsx("th",{children:n.jsx("span",e.__assign({className:"ins-visually-hidden"},{children:"Open"}))}):null]})}),n.jsx("tbody",{children:V.map(function(i){return n.jsxs("tr",e.__assign({className:ye?void 0:"is-static",tabIndex:ye?0:void 0,onClick:ye?function(n){var t;n.target.closest("a,button,input,select,textarea")||M(e.__assign(e.__assign({},i),{entityKey:null!==(t=i.entityKey)&&void 0!==t?t:A}))}:void 0,onKeyDown:ye?function(n){return function(n,t){var i;ye&&("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),M(e.__assign(e.__assign({},t),{entityKey:null!==(i=t.entityKey)&&void 0!==i?i:A}))))}(n,i)}:void 0},{children:[n.jsx("th",e.__assign({scope:"row"},{children:i.label||i.nodeKey})),ge.map(function(t){var l;return n.jsx("td",e.__assign({className:"ag-drill__col--".concat(null!==(l=t.align)&&void 0!==l?l:"kpi"===t.source?"right":"left"," ").concat(t.hideBelow?"ag-drill__hide--".concat(t.hideBelow):"")},{children:ke(i,t)}),"".concat(t.source,":").concat(t.key))}),ye?n.jsx("td",{children:n.jsx(t.ChevronRight,{className:"ag-drill__open","aria-hidden":"true"})}):null]}),i.nodeKey)})})]})),ce&&!V.length?n.jsx("p",e.__assign({className:"ag-drill__state"},{children:"Loading rows…"})):null,ce||V.length||ve?null:n.jsx("p",e.__assign({className:"ag-drill__state"},{children:"No rows found."})),ve?n.jsx("p",e.__assign({className:"ag-drill__state ag-drill__state--error"},{children:ve})):null]})),n.jsxs("footer",e.__assign({className:"ag-drill__footer"},{children:[n.jsx("span",{children:ae?"".concat(V.length," of ").concat(ae):""}),ie?n.jsx("button",e.__assign({type:"button",onClick:function(){return e.__awaiter(x,void 0,void 0,function(){var n,t,i,r;return e.__generator(this,function(a){switch(a.label){case 0:if(ce||!ie)return[2];ue(!0),he(null),a.label=1;case 1:return a.trys.push([1,6,7,8]),pe?[4,l.fetchInsightsDrivers(L.api,{dataDay:null!=D?D:l.toIsoDay(we),kpiId:me,entityKey:A,parentNodeKey:j,tab:"drivers",limit:Math.min(10,I),offset:ee})]:[3,3];case 2:return n=a.sent(),W(function(t){return e.__spreadArray(e.__spreadArray([],t,!0),n.rows.map(function(e){return s(e,me)}),!0)}),le(n.hasMore),ne(null!==(r=n.nextOffset)&&void 0!==r?r:ee+n.rows.length),[3,5];case 3:return[4,l.fetchLevelRows(L.api,A,e.__assign(e.__assign({},L.range),{startDate:xe,endDate:we}),{sort:null==fe?void 0:fe.key,order:null==fe?void 0:fe.order,search:z||void 0,parentNodeKey:j,pageSize:I,includeChildren:be,cursor:null!=Y?Y:void 0})];case 4:t=a.sent(),W(function(n){return e.__spreadArray(e.__spreadArray([],n,!0),t.rows,!0)}),le(t.hasNext),Z(t.nextCursor),a.label=5;case 5:return[3,8];case 6:return i=a.sent(),he(i instanceof Error?i.message:"More rows couldn't be loaded."),[3,8];case 7:return ue(!1),[7];case 8:return[2]}})})},disabled:ce},{children:ce?"Loading…":"Show more"})):null]}))]}))};
2
+ //# sourceMappingURL=DrillTable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DrillTable.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),a=require("react/jsx-runtime"),n=require("react"),t=require("lucide-react"),i=require("./AgReport.js"),s=require("./L1Report.js"),r=require("./RowDetail.js"),l=require("./agPrimitives.js"),o=require("./insightsContextCore.js"),d=require("./insightsUtils.js");function u(i){var o=i.target,d=i.onClose,u=i.onOpenL1,c=i.onOpenL2,p=n.useRef(null),g=o.kpiId,y=o.row.report.kpiId===g?o.row.report.reportId:null,v=n.useState(y?null:o.dataDay),m=v[0],h=v[1];n.useEffect(function(){return h(y?null:o.dataDay)},[y,o.dataDay]),n.useEffect(function(){var e,a=document.activeElement,n=document.body.style.overflow;document.body.style.overflow="hidden",null===(e=p.current)||void 0===e||e.focus();var t=function(e){return"Escape"===e.key&&d()};return document.addEventListener("keydown",t),function(){var e;document.removeEventListener("keydown",t),document.body.style.overflow=n,null===(e=null==a?void 0:a.focus)||void 0===e||e.call(a)}},[d]);var f=o.row.label||o.row.nodeKey;return a.jsx("div",e.__assign({className:"ag-modal",role:"presentation",onMouseDown:function(e){return e.target===e.currentTarget&&d()}},{children:a.jsxs("div",e.__assign({className:"ag-modal__dialog",role:"dialog","aria-modal":"true","aria-labelledby":"ag-l2-row-modal-title"},{children:[a.jsxs("header",e.__assign({className:"ag-modal__head"},{children:[a.jsxs("div",e.__assign({className:"ag-modal__detail-title"},{children:[a.jsxs("div",e.__assign({className:"ag-modal__breadcrumb"},{children:[a.jsx("button",e.__assign({type:"button",onClick:u},{children:"L1"})),a.jsx(t.ChevronRight,{"aria-hidden":"true"}),a.jsxs("button",e.__assign({type:"button",onClick:c},{children:["Top ",_(o.partName)]})),a.jsx(t.ChevronRight,{"aria-hidden":"true"}),a.jsx("strong",e.__assign({id:"ag-l2-row-modal-title"},{children:f}))]})),a.jsx("span",e.__assign({className:"ag-modal__date"},{children:l.formatHeaderDate(m||o.dataDay)}))]})),a.jsx("button",e.__assign({ref:p,type:"button",className:"ag-modal__close","aria-label":"Close",onClick:d},{children:a.jsx(t.X,{"aria-hidden":"true"})}))]})),a.jsx("div",e.__assign({className:"ag-modal__body"},{children:a.jsxs("div",e.__assign({className:"ag-popup"},{children:[a.jsxs("section",e.__assign({className:"ag-popup__section"},{children:[a.jsxs("div",e.__assign({className:"ag-popup__head"},{children:[a.jsx("p",e.__assign({className:"ag-popup__eyebrow"},{children:"Analysis"})),a.jsx("h3",e.__assign({className:"ag-popup__title"},{children:"Summary, Drivers & RCA"}))]})),a.jsx(r.default,{embedded:!0,nodeKey:o.row.nodeKey,kpiId:g,dataDay:o.dataDay,reportId:y,onReportDay:h})]})),a.jsxs("section",e.__assign({className:"ag-popup__section"},{children:[a.jsxs("div",e.__assign({className:"ag-popup__head"},{children:[a.jsx("p",e.__assign({className:"ag-popup__eyebrow"},{children:"Visuals"})),a.jsx("h3",e.__assign({className:"ag-popup__title"},{children:"Trend & Usage Signals"}))]})),m?a.jsx(s.EntityDetailVisuals,{nodeKey:o.row.nodeKey,label:f,kpiId:g,dataDay:m,tier2Kpis:o.tier2Kpis}):a.jsx("p",e.__assign({className:"ag-muted"},{children:"Loading report…"}))]}))]}))}))]}))}))}function c(s){var r=s.target,d=s.onClose,u=s.onOpenL1,c=s.onOpenRow,p=n.useRef(null),g=o.useInsights();return n.useEffect(function(){var e,a=document.activeElement,n=document.body.style.overflow;document.body.style.overflow="hidden",null===(e=p.current)||void 0===e||e.focus();var t=function(e){return"Escape"===e.key&&d()};return document.addEventListener("keydown",t),function(){var e;document.removeEventListener("keydown",t),document.body.style.overflow=n,null===(e=null==a?void 0:a.focus)||void 0===e||e.call(a)}},[d]),g?a.jsx("div",e.__assign({className:"ag-modal",role:"presentation",onMouseDown:function(e){return e.target===e.currentTarget&&d()}},{children:a.jsxs("div",e.__assign({className:"ag-modal__dialog",role:"dialog","aria-modal":"true","aria-labelledby":"ag-l2-overview-modal-title"},{children:[a.jsxs("header",e.__assign({className:"ag-modal__head"},{children:[a.jsxs("div",e.__assign({className:"ag-modal__detail-title"},{children:[a.jsxs("div",e.__assign({className:"ag-modal__breadcrumb"},{children:[a.jsx("button",e.__assign({type:"button",onClick:u},{children:"L1"})),a.jsx(t.ChevronRight,{"aria-hidden":"true"}),a.jsxs("strong",e.__assign({id:"ag-l2-overview-modal-title"},{children:["Top ",_(r.partName)]}))]})),a.jsx("span",e.__assign({className:"ag-modal__date"},{children:l.formatHeaderDate(r.dataDay)}))]})),a.jsx("button",e.__assign({ref:p,type:"button",className:"ag-modal__close","aria-label":"Close",onClick:d},{children:a.jsx(t.X,{"aria-hidden":"true"})}))]})),a.jsx("div",e.__assign({className:"ag-modal__body"},{children:a.jsx(i.L2Report,{tab:r.tab,title:r.title,partName:r.partName,partKpis:r.partKpis,search:"",onOpenRow:function(e,a,n){var t;return c({row:e,partName:r.partName,kpiId:g.headlineKpi||a,dataDay:n,tier2Kpis:null!==(t=r.tab.tier2Kpis)&&void 0!==t?t:g.tierKpis[2],l2:r})}})}))]}))})):null}var _=function(e){var a=e.trim().toLowerCase();return a?/(s|x|ch|sh)$/.test(a)?"".concat(a,"es"):/[^aeiou]y$/.test(a)?"".concat(a.slice(0,-1),"ies"):"".concat(a,"s"):"rows"};exports.default=function(r){var l,p,g,y,v,m=r.tabs,h=r.insightsConfig,f=o.useInsights(),b=n.useState(0),x=b[0],j=b[1],N=n.useState(!1),K=N[0],w=N[1],E=n.useState(""),k=E[0],D=E[1],C=n.useState(""),I=C[0],O=C[1],R=n.useState(null),L=R[0],S=R[1],T=n.useState(null),A=T[0],q=T[1],M=n.useState(null),P=M[0],G=M[1];n.useEffect(function(){var e=setTimeout(function(){return O(k.trim())},300);return function(){return clearTimeout(e)}},[k]),n.useEffect(function(){D(""),O("")},[x]);var X=n.useMemo(function(){var e,a={};return(null!==(e=null==h?void 0:h.hierarchy)&&void 0!==e?e:[]).forEach(function(e){var n;return(null!==(n=e.entities)&&void 0!==n?n:[]).forEach(function(e){var n,t;(null==e?void 0:e.entityKey)&&(a[e.entityKey]={name:null!==(n=e.name)&&void 0!==n?n:"",kpis:null!==(t=e.kpis)&&void 0!==t?t:[]})})}),a},[h]);if(n.useEffect(function(){if(f){var a=f.entityOrder.length?e.__spreadArray([],m,!0).sort(function(e,a){var n=f.entityOrder.indexOf(e.entityKey),t=f.entityOrder.indexOf(a.entityKey);return(n<0?Number.MAX_SAFE_INTEGER:n)-(t<0?Number.MAX_SAFE_INTEGER:t)}):m,n=function(e){var n,t,i,s,r,l,o=e,d=o.detail,u=(null==d?void 0:d.entityKey)?a.findIndex(function(e){return e.entityKey===d.entityKey}):-1;if(d&&!(u<0)){var c=a[u],_=(null===(n=X[c.entityKey])||void 0===n?void 0:n.name)||c.title||f.entityName(c.entityKey)||c.entityKey,p=f.headlineKpi||c.rankBy||(null===(t=c.listKpis)||void 0===t?void 0:t[0])||(null===(i=X[c.entityKey])||void 0===i?void 0:i.kpis[0])||"",g=d.dataDay||f.range.endDate.toISOString().slice(0,10),y={tab:c,title:c.title||_,partName:_,partKpis:null!==(r=null===(s=X[c.entityKey])||void 0===s?void 0:s.kpis)&&void 0!==r?r:[],dataDay:g};o.preventDefault(),G(null),q(null),j(u),S({row:{rank:0,nodeKey:d.nodeKey,label:d.label,parent:null,metrics:{},barPct:null,chip:null,report:{reportId:null,status:"none",kpiId:p},action:null,children:[]},partName:_,kpiId:p,dataDay:g,tier2Kpis:null!==(l=c.tier2Kpis)&&void 0!==l?l:f.tierKpis[2],l2:y})}};return window.addEventListener(d.OPEN_INSIGHTS_ENTITY_REPORT,n),function(){return window.removeEventListener(d.OPEN_INSIGHTS_ENTITY_REPORT,n)}}},[f,m,X]),!f||!m.length)return null;var F=f.entityOrder.length?e.__spreadArray([],m,!0).sort(function(e,a){var n=f.entityOrder.indexOf(e.entityKey),t=f.entityOrder.indexOf(a.entityKey);return(n<0?Number.MAX_SAFE_INTEGER:n)-(t<0?Number.MAX_SAFE_INTEGER:t)}):m,H=Math.min(x,F.length-1),B=F[H],U=function(e){var a;return e.title||f.entityName(e.entityKey)||(null===(a=X[e.entityKey])||void 0===a?void 0:a.name)||e.entityKey},V=(null===(l=X[B.entityKey])||void 0===l?void 0:l.name)||U(B),Y=B.rankBy||(null===(p=B.listKpis)||void 0===p?void 0:p[0])||(null===(g=X[B.entityKey])||void 0===g?void 0:g.kpis[0])||"",$=Y?f.kpiLabel(Y).toLowerCase():"activity";return a.jsxs("div",e.__assign({className:"ag-tabs"},{children:[a.jsxs("div",e.__assign({className:"ag-tabs__head"},{children:[a.jsxs("div",e.__assign({className:"ag-tabs__bar"},{children:[a.jsx("div",e.__assign({className:"ag-tabs__list",role:"tablist","aria-label":"Insights"},{children:F.map(function(n,t){return a.jsx("button",e.__assign({id:"ag-tab-".concat(t),type:"button",role:"tab","aria-selected":t===H,"aria-controls":"ag-tabpanel",className:t===H?"is-active":void 0,onClick:function(){S(null),j(t)}},{children:U(n)}),"".concat(n.entityKey,"-").concat(t))})})),a.jsx("button",e.__assign({type:"button",className:"ag-icon-button","aria-label":K?"Expand insights":"Collapse insights","aria-expanded":!K,onClick:function(){return w(function(e){return!e})}},{children:a.jsx(t.ChevronDown,{"aria-hidden":"true",className:K?"is-closed":"is-open"})}))]})),K?null:a.jsxs(a.Fragment,{children:[a.jsx("p",e.__assign({className:"ag-tabs__desc"},{children:V?"".concat(_(V).replace(/^\w/,function(e){return e.toUpperCase()})," with the highest ").concat($,"."):null})),a.jsx("div",e.__assign({className:"ag-tabs__tools"},{children:a.jsxs("label",e.__assign({className:"ag-search"},{children:[a.jsx(t.Search,{"aria-hidden":"true"}),a.jsx("input",{type:"search",value:k,onChange:function(e){return D(e.target.value)},placeholder:"Search ".concat(V.toLowerCase(),"..."),"aria-label":"Search ".concat(_(V))})]}))}))]})]})),K?null:a.jsxs("div",e.__assign({className:"ag-tabs__body",role:"tabpanel",id:"ag-tabpanel","aria-labelledby":"ag-tab-".concat(H)},{children:[a.jsx(i.L2Report,{tab:B,title:U(B),partName:V,partKpis:null!==(v=null===(y=X[B.entityKey])||void 0===y?void 0:y.kpis)&&void 0!==v?v:[],search:I,onOpenRow:function(e,a,n){var t,i,s;return S({row:e,partName:V,kpiId:f.headlineKpi||a,dataDay:n,tier2Kpis:null!==(t=B.tier2Kpis)&&void 0!==t?t:f.tierKpis[2],l2:{tab:B,title:U(B),partName:V,partKpis:null!==(s=null===(i=X[B.entityKey])||void 0===i?void 0:i.kpis)&&void 0!==s?s:[],dataDay:n}})}},H),L?a.jsx(u,{target:L,onClose:function(){return S(null)},onOpenL1:function(){G(L.dataDay),S(null)},onOpenL2:function(){q(L.l2),S(null)}}):null,A?a.jsx(c,{target:A,onClose:function(){return q(null)},onOpenL1:function(){G(A.dataDay),q(null)},onOpenRow:function(e){S(e),q(null)}}):null,P?a.jsx(s.L1ReportModal,{day:P,workingDays:Boolean(f.defaultWorkingDays),onClose:function(){return G(null)}}):null]}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),n=require("react/jsx-runtime"),t=require("react"),a=require("lucide-react"),i=require("./AgReport.js"),r=require("./L1Report.js"),l=require("./RowDetail.js"),s=require("./DrillTable.js"),o=require("./agPrimitives.js"),d=require("./insightsContextCore.js"),u=require("./insightsUtils.js");function c(i){var u,c=i.target,_=i.onClose,y=i.onOpenL1,g=i.onOpenL2,v=t.useRef(null),m=d.useInsights(),h=c.kpiId,f=t.useState([]),b=f[0],N=f[1];t.useEffect(function(){return N([])},[c.row.nodeKey]);var x=b.length?b[b.length-1]:null,j=x?x.nodeKey:c.row.nodeKey,K=x?x.entityKey:c.l2.tab.entityKey,w=x?x.reportId:c.row.report.kpiId===h?c.row.report.reportId:null,E=t.useState(w?null:c.dataDay),k=E[0],D=E[1];t.useEffect(function(){return D(w?null:c.dataDay)},[w,c.dataDay,j]);t.useEffect(function(){var e,n=document.activeElement,t=document.body.style.overflow;document.body.style.overflow="hidden",null===(e=v.current)||void 0===e||e.focus();var a=function(e){return"Escape"===e.key&&_()};return document.addEventListener("keydown",a),function(){var e;document.removeEventListener("keydown",a),document.body.style.overflow=t,null===(e=null==n?void 0:n.focus)||void 0===e||e.call(n)}},[_]);var I=c.row.label||c.row.nodeKey,C=x?x.label:I;return n.jsx("div",e.__assign({className:"ag-modal",role:"presentation",onMouseDown:function(e){return e.target===e.currentTarget&&_()}},{children:n.jsxs("div",e.__assign({className:"ag-modal__dialog",role:"dialog","aria-modal":"true","aria-labelledby":"ag-l2-row-modal-title"},{children:[n.jsxs("header",e.__assign({className:"ag-modal__head"},{children:[n.jsxs("div",e.__assign({className:"ag-modal__detail-title"},{children:[n.jsxs("div",e.__assign({className:"ag-modal__breadcrumb"},{children:[n.jsx("button",e.__assign({type:"button",onClick:y},{children:"L1"})),n.jsx(a.ChevronRight,{"aria-hidden":"true"}),n.jsxs("button",e.__assign({type:"button",onClick:g},{children:["Top ",p(c.partName)]})),n.jsx(a.ChevronRight,{"aria-hidden":"true"}),b.length?n.jsx("button",e.__assign({type:"button",onClick:function(){return N([])}},{children:I})):n.jsx("strong",e.__assign({id:"ag-l2-row-modal-title"},{children:I})),b.map(function(t,i){return n.jsxs("span",e.__assign({className:"ag-modal__crumb"},{children:[n.jsx(a.ChevronRight,{"aria-hidden":"true"}),i===b.length-1?n.jsxs("strong",e.__assign({id:"ag-l2-row-modal-title",title:t.partName},{children:[t.partName?"".concat(t.partName,": "):"",t.label]})):n.jsxs("button",e.__assign({type:"button",title:t.partName,onClick:function(){return N(function(e){return e.slice(0,i+1)})}},{children:[t.partName?"".concat(t.partName,": "):"",t.label]}))]}),"".concat(t.nodeKey,"-").concat(i))})]})),n.jsx("span",e.__assign({className:"ag-modal__date"},{children:o.formatHeaderDate(k||c.dataDay)}))]})),n.jsx("button",e.__assign({ref:v,type:"button",className:"ag-modal__close","aria-label":"Close",onClick:_},{children:n.jsx(a.X,{"aria-hidden":"true"})}))]})),n.jsx("div",e.__assign({className:"ag-modal__body"},{children:n.jsxs("div",e.__assign({className:"ag-popup"},{children:[n.jsxs("section",e.__assign({className:"ag-popup__section"},{children:[n.jsxs("div",e.__assign({className:"ag-popup__head"},{children:[n.jsx("p",e.__assign({className:"ag-popup__eyebrow"},{children:"Analysis"})),n.jsx("h3",e.__assign({className:"ag-popup__title"},{children:"Summary, Drivers & RCA"}))]})),n.jsx(l.default,{embedded:!0,nodeKey:j,kpiId:h,dataDay:c.dataDay,reportId:w,onReportDay:D,onOpenDriver:function(n){return N(function(t){var a,i,r,l;return e.__spreadArray(e.__spreadArray([],t,!0),[{nodeKey:n.nodeKey,label:n.label,partName:(null==m?void 0:m.entityName(null!==(a=n.entityKey)&&void 0!==a?a:""))||n.entityKey||"",entityKey:null!==(i=n.entityKey)&&void 0!==i?i:"",reportId:null!==(l=null===(r=n.report)||void 0===r?void 0:r.reportId)&&void 0!==l?l:null}],!1)})}},j)]})),n.jsxs("section",e.__assign({className:"ag-popup__section"},{children:[n.jsxs("div",e.__assign({className:"ag-popup__head"},{children:[n.jsx("p",e.__assign({className:"ag-popup__eyebrow"},{children:"Visuals"})),n.jsx("h3",e.__assign({className:"ag-popup__title"},{children:"Trend & Usage Signals"}))]})),k?n.jsx(r.EntityDetailVisuals,{nodeKey:j,label:C,kpiId:h,dataDay:k,tier2Kpis:c.tier2Kpis},j):n.jsx("p",e.__assign({className:"ag-muted"},{children:"Loading report…"})),(null==m?void 0:m.drillTable.popupEntityKeys.includes(K))&&(null===(u=m.drillTable.parts[K])||void 0===u?void 0:u.length)?n.jsx(s.default,{entityKey:K,parentNodeKey:j,parts:m.drillTable.parts[K],dataDay:k||c.dataDay,onOpenRow:function(n){return N(function(t){var a,i;return e.__spreadArray(e.__spreadArray([],t,!0),[{nodeKey:n.nodeKey,label:n.label||n.nodeKey,entityKey:n.entityKey||"",partName:(null==m?void 0:m.entityName(n.entityKey||""))||n.entityKey||"",reportId:null!==(i=null===(a=n.report)||void 0===a?void 0:a.reportId)&&void 0!==i?i:null}],!1)})}}):null]}))]}))}))]}))}))}function _(r){var l=r.target,s=r.onClose,u=r.onOpenL1,c=r.onOpenRow,_=t.useRef(null),y=d.useInsights();return t.useEffect(function(){var e,n=document.activeElement,t=document.body.style.overflow;document.body.style.overflow="hidden",null===(e=_.current)||void 0===e||e.focus();var a=function(e){return"Escape"===e.key&&s()};return document.addEventListener("keydown",a),function(){var e;document.removeEventListener("keydown",a),document.body.style.overflow=t,null===(e=null==n?void 0:n.focus)||void 0===e||e.call(n)}},[s]),y?n.jsx("div",e.__assign({className:"ag-modal",role:"presentation",onMouseDown:function(e){return e.target===e.currentTarget&&s()}},{children:n.jsxs("div",e.__assign({className:"ag-modal__dialog",role:"dialog","aria-modal":"true","aria-labelledby":"ag-l2-overview-modal-title"},{children:[n.jsxs("header",e.__assign({className:"ag-modal__head"},{children:[n.jsxs("div",e.__assign({className:"ag-modal__detail-title"},{children:[n.jsxs("div",e.__assign({className:"ag-modal__breadcrumb"},{children:[n.jsx("button",e.__assign({type:"button",onClick:u},{children:"L1"})),n.jsx(a.ChevronRight,{"aria-hidden":"true"}),n.jsxs("strong",e.__assign({id:"ag-l2-overview-modal-title"},{children:["Top ",p(l.partName)]}))]})),n.jsx("span",e.__assign({className:"ag-modal__date"},{children:o.formatHeaderDate(l.dataDay)}))]})),n.jsx("button",e.__assign({ref:_,type:"button",className:"ag-modal__close","aria-label":"Close",onClick:s},{children:n.jsx(a.X,{"aria-hidden":"true"})}))]})),n.jsx("div",e.__assign({className:"ag-modal__body"},{children:n.jsx(i.L2Report,{tab:l.tab,title:l.title,partName:l.partName,partKpis:l.partKpis,search:"",onOpenRow:function(e,n,t){var a;return c({row:e,partName:l.partName,kpiId:y.headlineKpi||n,dataDay:t,tier2Kpis:null!==(a=l.tab.tier2Kpis)&&void 0!==a?a:y.tierKpis[2],l2:l})}})}))]}))})):null}var p=function(e){var n=e.trim().toLowerCase();return n?/(s|x|ch|sh)$/.test(n)?"".concat(n,"es"):/[^aeiou]y$/.test(n)?"".concat(n.slice(0,-1),"ies"):"".concat(n,"s"):"rows"};exports.default=function(l){var s,o,y,g,v,m=l.tabs,h=l.insightsConfig,f=d.useInsights(),b=t.useState(0),N=b[0],x=b[1],j=t.useState(!1),K=j[0],w=j[1],E=t.useState(""),k=E[0],D=E[1],I=t.useState(""),C=I[0],O=I[1],R=t.useState(null),S=R[0],L=R[1],T=t.useState(null),A=T[0],q=T[1],M=t.useState(null),P=M[0],G=M[1];t.useEffect(function(){var e=setTimeout(function(){return O(k.trim())},300);return function(){return clearTimeout(e)}},[k]),t.useEffect(function(){D(""),O("")},[N]);var X=t.useMemo(function(){var e,n={};return(null!==(e=null==h?void 0:h.hierarchy)&&void 0!==e?e:[]).forEach(function(e){var t;return(null!==(t=e.entities)&&void 0!==t?t:[]).forEach(function(e){var t,a;(null==e?void 0:e.entityKey)&&(n[e.entityKey]={name:null!==(t=e.name)&&void 0!==t?t:"",kpis:null!==(a=e.kpis)&&void 0!==a?a:[]})})}),n},[h]);if(t.useEffect(function(){if(f){var n=f.entityOrder.length?e.__spreadArray([],m,!0).sort(function(e,n){var t=f.entityOrder.indexOf(e.entityKey),a=f.entityOrder.indexOf(n.entityKey);return(t<0?Number.MAX_SAFE_INTEGER:t)-(a<0?Number.MAX_SAFE_INTEGER:a)}):m,t=function(e){var t,a,i,r,l,s,o=e,d=o.detail,u=(null==d?void 0:d.entityKey)?n.findIndex(function(e){return e.entityKey===d.entityKey}):-1;if(d&&!(u<0)){var c=n[u],_=(null===(t=X[c.entityKey])||void 0===t?void 0:t.name)||c.title||f.entityName(c.entityKey)||c.entityKey,p=f.headlineKpi||c.rankBy||(null===(a=c.listKpis)||void 0===a?void 0:a[0])||(null===(i=X[c.entityKey])||void 0===i?void 0:i.kpis[0])||"",y=d.dataDay||f.range.endDate.toISOString().slice(0,10),g={tab:c,title:c.title||_,partName:_,partKpis:null!==(l=null===(r=X[c.entityKey])||void 0===r?void 0:r.kpis)&&void 0!==l?l:[],dataDay:y};o.preventDefault(),G(null),q(null),x(u),L({row:{rank:0,nodeKey:d.nodeKey,label:d.label,parent:null,metrics:{},barPct:null,chip:null,report:{reportId:null,status:"none",kpiId:p},action:null,children:[]},partName:_,kpiId:p,dataDay:y,tier2Kpis:null!==(s=c.tier2Kpis)&&void 0!==s?s:f.tierKpis[2],l2:g})}};return window.addEventListener(u.OPEN_INSIGHTS_ENTITY_REPORT,t),function(){return window.removeEventListener(u.OPEN_INSIGHTS_ENTITY_REPORT,t)}}},[f,m,X]),!f||!m.length)return null;var F=f.entityOrder.length?e.__spreadArray([],m,!0).sort(function(e,n){var t=f.entityOrder.indexOf(e.entityKey),a=f.entityOrder.indexOf(n.entityKey);return(t<0?Number.MAX_SAFE_INTEGER:t)-(a<0?Number.MAX_SAFE_INTEGER:a)}):m,H=Math.min(N,F.length-1),B=F[H],U=function(e){var n;return e.title||f.entityName(e.entityKey)||(null===(n=X[e.entityKey])||void 0===n?void 0:n.name)||e.entityKey},V=(null===(s=X[B.entityKey])||void 0===s?void 0:s.name)||U(B),Y=B.rankBy||(null===(o=B.listKpis)||void 0===o?void 0:o[0])||(null===(y=X[B.entityKey])||void 0===y?void 0:y.kpis[0])||"",$=Y?f.kpiLabel(Y).toLowerCase():"activity";return n.jsxs("div",e.__assign({className:"ag-tabs"},{children:[n.jsxs("div",e.__assign({className:"ag-tabs__head"},{children:[n.jsxs("div",e.__assign({className:"ag-tabs__bar"},{children:[n.jsx("div",e.__assign({className:"ag-tabs__list",role:"tablist","aria-label":"Insights"},{children:F.map(function(t,a){return n.jsx("button",e.__assign({id:"ag-tab-".concat(a),type:"button",role:"tab","aria-selected":a===H,"aria-controls":"ag-tabpanel",className:a===H?"is-active":void 0,onClick:function(){L(null),x(a)}},{children:U(t)}),"".concat(t.entityKey,"-").concat(a))})})),n.jsx("button",e.__assign({type:"button",className:"ag-icon-button","aria-label":K?"Expand insights":"Collapse insights","aria-expanded":!K,onClick:function(){return w(function(e){return!e})}},{children:n.jsx(a.ChevronDown,{"aria-hidden":"true",className:K?"is-closed":"is-open"})}))]})),K?null:n.jsxs(n.Fragment,{children:[n.jsx("p",e.__assign({className:"ag-tabs__desc"},{children:V?"".concat(p(V).replace(/^\w/,function(e){return e.toUpperCase()})," with the highest ").concat($,"."):null})),n.jsx("div",e.__assign({className:"ag-tabs__tools"},{children:n.jsxs("label",e.__assign({className:"ag-search"},{children:[n.jsx(a.Search,{"aria-hidden":"true"}),n.jsx("input",{type:"search",value:k,onChange:function(e){return D(e.target.value)},placeholder:"Search ".concat(V.toLowerCase(),"..."),"aria-label":"Search ".concat(p(V))})]}))}))]})]})),K?null:n.jsxs("div",e.__assign({className:"ag-tabs__body",role:"tabpanel",id:"ag-tabpanel","aria-labelledby":"ag-tab-".concat(H)},{children:[n.jsx(i.L2Report,{tab:B,title:U(B),partName:V,partKpis:null!==(v=null===(g=X[B.entityKey])||void 0===g?void 0:g.kpis)&&void 0!==v?v:[],search:C,onOpenRow:function(e,n,t){var a,i,r;return L({row:e,partName:V,kpiId:f.headlineKpi||n,dataDay:t,tier2Kpis:null!==(a=B.tier2Kpis)&&void 0!==a?a:f.tierKpis[2],l2:{tab:B,title:U(B),partName:V,partKpis:null!==(r=null===(i=X[B.entityKey])||void 0===i?void 0:i.kpis)&&void 0!==r?r:[],dataDay:t}})}},H),S?n.jsx(c,{target:S,onClose:function(){return L(null)},onOpenL1:function(){G(S.dataDay),L(null)},onOpenL2:function(){q(S.l2),L(null)}}):null,A?n.jsx(_,{target:A,onClose:function(){return q(null)},onOpenL1:function(){G(A.dataDay),q(null)},onOpenRow:function(e){L(e),q(null)}}):null,P?n.jsx(r.L1ReportModal,{day:P,workingDays:Boolean(f.defaultWorkingDays),onClose:function(){return G(null)}}):null]}))]}))};
2
2
  //# sourceMappingURL=InsightTabs.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),n=require("react/jsx-runtime"),i=require("react"),t=require("./ReportDrawer.js"),r=require("./insightsUtils.js"),o=require("./insightsContextCore.js"),l=require("../../api/insightsApi.js");function u(e){var n,i,t=null!==(i=null===(n=null==e?void 0:e.analysis)||void 0===n?void 0:n.movingAverageDays)&&void 0!==i?i:{},r=function(e,n){return Number.isFinite(Number(e))&&Number(e)>0?Number(e):n};return{fast:r(t.fast,3),slow:r(t.slow,7),long:r(t.long,30)}}exports.useInsights=o.useInsights,exports.InsightsProvider=function(a){var s=a.baseUrl,d=a.configId,v=a.accessToken,c=a.startDate,f=a.endDate,h=a.workingDaysOnly,g=a.filtersActive,p=a.insights,y=a.headlineKpiId,m=a.defaultWorkingDays,D=void 0!==m&&m,k=a.reportTarget,I=a.onReportTargetChange,b=a.refreshRevision,w=void 0===b?0:b,j=a.children,x=i.useState(0),K=x[0],N=x[1],q=i.useMemo(function(){return{baseUrl:s,configId:null!=d?d:"",accessToken:v}},[s,d,v]),T=r.useInsightsFetch(d?function(e){return l.fetchHierarchy(q,e)}:null,[q,K,w]),E=l.toIsoDay(c),R=l.toIsoDay(f),_=i.useMemo(function(){var e,n,i,t,o,l,a,s,d,c,f,m={},k={};(null!==(e=null==p?void 0:p.hierarchy)&&void 0!==e?e:[]).forEach(function(e,n){var i;return(null!==(i=e.entities)&&void 0!==i?i:[]).forEach(function(i){(null==i?void 0:i.entityKey)&&(m[i.entityKey]=Number(e.level)||n+1)})}),null===(n=T.data)||void 0===n||n.levels.forEach(function(e,n){e.entities.forEach(function(i){m[i.entityKey]=Number(e.level)||n+1,k[i.entityKey]=i.name})});var b={};(null!==(i=null==p?void 0:p.kpis)&&void 0!==i?i:[]).forEach(function(e){(null==e?void 0:e.kpiId)&&(b[e.kpiId]=e)});var j={1:[],2:[]};(null!==(t=null==p?void 0:p.kpis)&&void 0!==t?t:[]).forEach(function(e){!(null==e?void 0:e.kpiId)||1!==e.tier&&2!==e.tier||j[e.tier].push(e.kpiId)});var x=null!==(a=null!==(l=null!==(o=y&&b[y]?y:null)&&void 0!==o?o:j[1][0])&&void 0!==l?l:j[2][0])&&void 0!==a?a:null;return{api:q,headlineKpi:x,tierKpis:j,defaultWorkingDays:D,range:{startDate:new Date("".concat(E,"T00:00:00")),endDate:new Date("".concat(R,"T00:00:00")),workingDaysOnly:h},rangeKey:"".concat(E,":").concat(R,":").concat(h?1:0),filtersActive:Boolean(g),kpis:b,kpiLabel:function(e){var n;return(null===(n=b[e])||void 0===n?void 0:n.label)||e},goodDirection:function(e){var n;return"down"===(null===(n=b[e])||void 0===n?void 0:n.goodDirection)?"down":"up"},levelOf:function(e){return e&&m[e]||1},entityName:function(e){return k[e]||e},entityOrder:null!==(d=null===(s=T.data)||void 0===s?void 0:s.levels.flatMap(function(e){return e.entities.map(function(e){return e.entityKey})}))&&void 0!==d?d:[],windows:u(p),openReport:I,viewer:r.viewerFromToken(v),minReasonLength:Math.max(1,Number(null===(f=null===(c=null==p?void 0:p.analysis)||void 0===c?void 0:c.outliers)||void 0===f?void 0:f.minReasonLength)||10),revision:K+w,refresh:function(){return N(function(e){return e+1})}}},[q,E,R,h,g,p,y,D,I,K,w,T.data]);return n.jsxs(o.InsightsContext.Provider,e.__assign({value:_},{children:[j,k?n.jsx(t.default,{target:k,onClose:function(){return I(null)}}):null]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("../../../_virtual/_tslib.js"),i=require("react/jsx-runtime"),e=require("react"),t=require("./ReportDrawer.js"),l=require("./insightsUtils.js"),r=require("./insightsContextCore.js"),o=require("../../api/insightsApi.js");function u(n){var i,e,t=null!==(e=null===(i=null==n?void 0:n.analysis)||void 0===i?void 0:i.movingAverageDays)&&void 0!==e?e:{},l=function(n,i){return Number.isFinite(Number(n))&&Number(n)>0?Number(n):i};return{fast:l(t.fast,3),slow:l(t.slow,7),long:l(t.long,30)}}exports.useInsights=r.useInsights,exports.InsightsProvider=function(s){var a=s.baseUrl,d=s.configId,v=s.accessToken,c=s.startDate,y=s.endDate,f=s.workingDaysOnly,p=s.filtersActive,g=s.insights,h=s.decisionAdvantage,K=s.insightsColumns,m=s.insightsDrillTable,b=s.renderInsightsCell,k=s.headlineKpiId,D=s.defaultWorkingDays,E=void 0!==D&&D,I=s.reportTarget,_=s.onReportTargetChange,w=s.refreshRevision,T=void 0===w?0:w,j=s.children,C=e.useState(0),x=C[0],A=C[1],N=e.useMemo(function(){return{baseUrl:a,configId:null!=d?d:"",accessToken:v}},[a,d,v]),q=l.useInsightsFetch(d?function(n){return o.fetchHierarchy(N,n)}:null,[N,x,T]),O=o.toIsoDay(c),M=o.toIsoDay(y),R=e.useMemo(function(){var i,e,t,r,o,s,a,d,c,y,D,I,w,j,C,R,F,L,P,U,W,B={},H={},S={},z={};(null!==(i=null==g?void 0:g.hierarchy)&&void 0!==i?i:[]).forEach(function(n,i){var e;return(null!==(e=n.entities)&&void 0!==e?e:[]).forEach(function(e){var t,l;(null==e?void 0:e.entityKey)&&(B[e.entityKey]=Number(n.level)||i+1,S[e.entityKey]=null!==(t=e.parentEntityKeys)&&void 0!==t?t:[],z[e.entityKey]=null!==(l=e.kpis)&&void 0!==l?l:[])})}),null===(e=q.data)||void 0===e||e.levels.forEach(function(n,i){n.entities.forEach(function(e){B[e.entityKey]=Number(n.level)||i+1,H[e.entityKey]=e.name,e.parentEntityKeys&&(S[e.entityKey]=e.parentEntityKeys),e.kpis&&(z[e.entityKey]=e.kpis)})});var G={};(null!==(t=null==g?void 0:g.kpis)&&void 0!==t?t:[]).forEach(function(n){(null==n?void 0:n.kpiId)&&(G[n.kpiId]=n)});var J={1:[],2:[]};(null!==(r=null==g?void 0:g.kpis)&&void 0!==r?r:[]).forEach(function(n){!(null==n?void 0:n.kpiId)||1!==n.tier&&2!==n.tier||J[n.tier].push(n.kpiId)});var Q=null!==(a=null!==(s=null!==(o=k&&G[k]?k:null)&&void 0!==o?o:J[1][0])&&void 0!==s?s:J[2][0])&&void 0!==a?a:null,V=null!==(c=null===(d=q.data)||void 0===d?void 0:d.levels.flatMap(function(n){return n.entities.map(function(n){return n.entityKey})}))&&void 0!==c?c:(null!==(y=null==g?void 0:g.hierarchy)&&void 0!==y?y:[]).flatMap(function(n){var i;return(null!==(i=n.entities)&&void 0!==i?i:[]).map(function(n){return n.entityKey})}),X=null!==(w=null!==(D=null==m?void 0:m.popupEntityKeys)&&void 0!==D?D:null===(I=null==h?void 0:h.drillTable)||void 0===I?void 0:I.popupEntityKeys)&&void 0!==w?w:["application"],Y=Object.fromEntries(X.map(function(i){var e=V.filter(function(n){var e;return(null!==(e=S[n])&&void 0!==e?e:[]).includes(i)}),t=V.filter(function(n){return n!==i&&B[n]===B[i]&&B[n]>1});return[i,n.__spreadArray(n.__spreadArray([],e,!0),t,!0)]}));return{api:N,headlineKpi:Q,tierKpis:J,defaultWorkingDays:E,range:{startDate:new Date("".concat(O,"T00:00:00")),endDate:new Date("".concat(M,"T00:00:00")),workingDaysOnly:f},rangeKey:"".concat(O,":").concat(M,":").concat(f?1:0),filtersActive:Boolean(p),kpis:G,kpiLabel:function(n){var i;return(null===(i=G[n])||void 0===i?void 0:i.label)||n},goodDirection:function(n){var i;return"down"===(null===(i=G[n])||void 0===i?void 0:i.goodDirection)?"down":"up"},levelOf:function(n){return n&&B[n]||1},entityName:function(n){return H[n]||n},entityKpis:function(n){var i;return null!==(i=z[n])&&void 0!==i?i:[]},entityOrder:V,isChildOf:function(n,i){var e;return(null!==(e=S[n])&&void 0!==e?e:[]).includes(i)},decisionAdvantage:h,insightsColumns:K,drillTable:{popupEntityKeys:X,parts:n.__assign(n.__assign(n.__assign({},Y),null!==(C=null===(j=null==h?void 0:h.drillTable)||void 0===j?void 0:j.parts)&&void 0!==C?C:{}),null!==(R=null==m?void 0:m.parts)&&void 0!==R?R:{}),clickableEntityKeys:null!==(P=null!==(F=null==m?void 0:m.clickableEntityKeys)&&void 0!==F?F:null===(L=null==h?void 0:h.drillTable)||void 0===L?void 0:L.clickableEntityKeys)&&void 0!==P?P:V},renderInsightsCell:b,windows:u(g),openReport:_,viewer:l.viewerFromToken(v),minReasonLength:Math.max(1,Number(null===(W=null===(U=null==g?void 0:g.analysis)||void 0===U?void 0:U.outliers)||void 0===W?void 0:W.minReasonLength)||10),revision:x+T,refresh:function(){return A(function(n){return n+1})}}},[N,O,M,f,p,g,h,K,m,b,k,E,_,x,T,q.data]);return i.jsxs(r.InsightsContext.Provider,n.__assign({value:R},{children:[j,I?i.jsx(t.default,{target:I,onClose:function(){return _(null)}}):null]}))};
2
2
  //# sourceMappingURL=InsightsContext.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),n=require("react/jsx-runtime"),a=require("react"),i=require("lucide-react"),t=require("../../api/insightsApi.js"),r=require("./insightsContextCore.js"),s=require("./insightsUtils.js"),l=require("./AgCharts.js"),o=require("./AgReport.js"),d=require("./CommentsThread.js"),u=require("./RowDetail.js"),c=require("./agPrimitives.js"),g=["#4F46E5","#64748B","#0F766E","#7C3AED","#475569"],v="decision-advantage-l1",p=function(e,n,a){return void 0===a&&(a="root"),null==e?void 0:e.find(function(e){return e.kpiId===n&&e.nodeKey===a})},h=function(e){var n=e.split("-").map(Number),a=n[0],i=n[1],t=n[2];return new Date(a,i-1,t)};function _(e){var n,a;if(!e)return null;var i=e,t="string"==typeof i.summary?i.summary:(null===(n=i.summary)||void 0===n?void 0:n.headline)||(null===(a=i.summary)||void 0===a?void 0:a.body)||i.executiveSummary||i.executive_summary||i.summaryText||i.summary_text;return(null==t?void 0:t.trim())||null}function m(e){var n,i,r=s.useInsightsFetch(e?function(n){return t.fetchGraphGroups(e.api,n)}:null,[null==e?void 0:e.api.configId,null==e?void 0:e.revision]),l=a.useState(null),o=l[0],d=l[1];a.useEffect(function(){var e,n;null===o&&((null===(e=r.data)||void 0===e?void 0:e.groups.length)?d((null!==(n=r.data.groups.find(function(e){return e.isDefault}))&&void 0!==n?n:r.data.groups[0]).groupKey):r.loading||d(""))},[o,r.data,r.loading]);var u=r.error||null===(n=r.data)||void 0===n?void 0:n.groups;return{groups:u,group:o,setGroup:d,days:null===(i=null==u?void 0:u.find(function(e){return e.groupKey===o}))||void 0===i?void 0:i.days}}function y(n,a,i,r,l){return void 0===r&&(r=[]),s.useInsightsFetch(n&&a.length&&null!==l?function(s){var d=e.__assign(e.__assign({},n.range),{workingDaysOnly:i,group:l||void 0}),u=a.slice(0,o.MAX_SERIES);return t.fetchInsightsSeries(n.api,d,r.length?{kpiIds:u,nodeKeys:r}:{kpiIds:u},s)}:null,[null==n?void 0:n.api.configId,null==n?void 0:n.rangeKey,a.join(","),r.join(","),i,l,null==n?void 0:n.revision])}function f(n,i,d){var u,c,v,m,f,x,j,b,D=this,w=r.useInsights(),C=a.useState([]),N=C[0],I=C[1],k=null!==(u=null==w?void 0:w.headlineKpi)&&void 0!==u?u:null,S=a.useMemo(function(){var n,a=null!==(n=null==w?void 0:w.tierKpis[1])&&void 0!==n?n:[];return k?e.__spreadArray([k],a.filter(function(e){return e!==k}),!0):a},[w,k]),A=a.useMemo(function(){var e;return null!==(e=null==w?void 0:w.tierKpis[2].filter(function(e){return e!==k}))&&void 0!==e?e:[]},[w,k]),K=y(w,S,i,[],d),T=y(w,A,i,[],d),O=y(w,k&&N.length?[k]:[],i,N.map(function(e){return e.nodeKey}),d),L=null!=n?n:w?t.toIsoDay(w.range.endDate):null,M=s.useInsightsFetch(w&&L?function(n){return function(n,a,i){return e.__awaiter(this,void 0,void 0,function(){var r,s,l,o;return e.__generator(this,function(e){switch(e.label){case 0:return r=h(a),[4,t.fetchInsightsSummary(n,{startDate:r,endDate:r},i)];case 1:return"generated"===(s=e.sent()).report.status?[2,s]:((l=new Date(r)).setDate(l.getDate()-6),[4,t.fetchInsightsSummary(n,{startDate:l,endDate:r},i)]);case 2:return[2,"generated"===(o=e.sent()).report.status?o:s]}})})}(w.api,L,n)}:null,[null==w?void 0:w.api.configId,L,null==w?void 0:w.revision]),R=s.useInsightsFetch(w&&k?function(e){return t.fetchInsightsReports(w.api,{nodeKey:"root",kpiId:k,startDate:t.toIsoDay(w.range.startDate),endDate:t.toIsoDay(w.range.endDate)},e)}:null,[null==w?void 0:w.api.configId,null==w?void 0:w.rangeKey,k,null==w?void 0:w.revision]),E=a.useMemo(function(){var e;return l.toTrendPoints(p(null===(e=K.data)||void 0===e?void 0:e.series,k))},[K.data,k]),G=a.useMemo(function(){return E.filter(function(e){return Boolean(e.reportId||e.criticality||e.movementType&&"stable"!==e.movementType)}).map(function(e){return e.day})},[E]),q=s.useInsightsFetch(w&&G.length?function(n){return e.__awaiter(D,void 0,void 0,function(){var a,i=this;return e.__generator(this,function(r){switch(r.label){case 0:return[4,Promise.all(G.map(function(a){return e.__awaiter(i,void 0,void 0,function(){var i,r;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,t.fetchInsightsSummary(w.api,{startDate:h(a),endDate:h(a)},n)];case 1:return[2,"generated"===(i=e.sent()).report.status&&i.context.period.end.slice(0,10)===a?[a,i.report]:null];case 2:if(r=e.sent(),n.aborted)throw r;return[2,null];case 3:return[2]}})})}))];case 1:return a=r.sent(),[2,Object.fromEntries(a.filter(function(e){return Boolean(e)}))]}})})}:null,[null==w?void 0:w.api.configId,G.join(","),null==w?void 0:w.revision]),P=a.useMemo(function(){var n,a,i,t,r=null!==(t=null!==(a=null===(n=R.data)||void 0===n?void 0:n.reportsByDay)&&void 0!==a?a:null===(i=R.data)||void 0===i?void 0:i.reports_by_day)&&void 0!==t?t:{},s=new Map(Object.entries(r).map(function(e){var n=e[0],a=e[1];return[n.slice(0,10),a]}));return E.map(function(n){var a,i,t,r=null!==(i=null===(a=q.data)||void 0===a?void 0:a[n.day])&&void 0!==i?i:s.get(n.day),l="object"==typeof(null==r?void 0:r.summary)?r.summary:null;return r?e.__assign(e.__assign({},n),{headline:_(r)||n.headline,reportId:r.reportId||n.reportId,criticality:(null==l?void 0:l.criticality)||n.criticality,commentCount:null!==(t=r.commentCount)&&void 0!==t?t:n.commentCount}):n})},[E,R.data,q.data]),V=a.useMemo(function(){var n,a,i=S.slice(1).map(function(e,n){var a,i,t=p(null===(a=K.data)||void 0===a?void 0:a.series,e);return t?{key:e,label:null!==(i=null==w?void 0:w.kpiLabel(e))&&void 0!==i?i:e,color:g[n%g.length],data:t.points.map(function(e){return{x:e.x,y:e.y}})}:null}),t=(null!==(a=null===(n=O.data)||void 0===n?void 0:n.series)&&void 0!==a?a:[]).map(function(e,n){var a;return{key:"row_".concat(e.nodeKey),label:null!==(a=e.label)&&void 0!==a?a:e.nodeKey,color:g[(n+2)%g.length],data:e.points.map(function(e){return{x:e.x,y:e.y}})}});return e.__spreadArray(e.__spreadArray([],i.filter(Boolean),!0),t,!0)},[S,K.data,O.data,w]),F=null===(c=M.data)||void 0===c?void 0:c.report,B="generated"===(null==F?void 0:F.status),H=null!==(j=null!==(f=null!==(m=B?o.reportDayOf(null===(v=M.data)||void 0===v?void 0:v.context):null)&&void 0!==m?m:n)&&void 0!==f?f:null===(x=e.__spreadArray([],P,!0).reverse().find(function(e){return null!=e.value}))||void 0===x?void 0:x.day)&&void 0!==j?j:null,U=null!==(b=P.find(function(e){return e.day===(null!=n?n:H)}))&&void 0!==b?b:n?void 0:e.__spreadArray([],P,!0).reverse().find(function(e){return null!=e.value});return{insights:w,headline:k,tier2:A,trend:K,activity:T,summary:M,report:F,generated:B,reportDay:H,points:P,dayPoint:U,extraLines:V,graphed:N,toggleGraphed:function(n){return I(function(a){return a.some(function(e){return e.nodeKey===n.nodeKey})?a.filter(function(e){return e.nodeKey!==n.nodeKey}):e.__spreadArray(e.__spreadArray([],a,!0),[n],!1).slice(-5)})}}}function x(i){var l,o=this,d=i.kpiId,u=i.dataDay,c=r.useInsights(),g=a.useState(null),v=g[0],p=g[1],h=a.useState(null),_=h[0],m=h[1];if(s.useJob(v,null!==(l=null==c?void 0:c.api)&&void 0!==l?l:null,function(){p(null),null==c||c.refresh()}),!c)return null;return n.jsxs("span",{children:[n.jsxs("button",e.__assign({type:"button",className:"ins-link",disabled:Boolean(v),onClick:function(){return e.__awaiter(o,void 0,void 0,function(){var n,a;return e.__generator(this,function(e){switch(e.label){case 0:m(null),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,t.generateInsightsReport(c.api,{nodeKey:"root",kpiId:d,dataDay:u,force:!0})];case 2:return"job"===(n=e.sent()).kind?p(n.jobId):c.refresh(),[3,4];case 3:return a=e.sent(),m(a.message||"The report couldn't be rerun."),[3,4];case 4:return[2]}})})}},{children:[n.jsx("span",e.__assign({"aria-hidden":"true"},{children:"↻"})),v?"Rerunning…":"Rerun RCA"]})),_?n.jsx("span",e.__assign({className:"ins-error"},{children:_})):null]})}function j(a){var i=a.l1,t=a.children,r=a.onOpenDriver,s=a.attention,l=void 0!==s&&s,d=i.insights,u=i.headline,g=i.summary,v=i.report,p=i.reportDay,h=i.dayPoint;if(!d)return null;var _=d.goodDirection(null!=u?u:""),m=g.loading&&!g.data;return n.jsxs("div",e.__assign({className:"ag-stack"},{children:[n.jsxs("div",{children:[n.jsx(c.SectionHeader,{title:"Summary",action:n.jsx(o.RegenerateSummary,{})}),n.jsx(o.SummaryCard,{report:v,loading:m,error:g.error,movementType:h?h.movementType:void 0,direction:null==h?void 0:h.direction,good:_})]}),n.jsx(o.DecisionCard,{report:v,error:g.error,loading:m}),p&&!m?n.jsx(o.TopDriversSection,{dataDay:p,title:"Top Drivers",graphed:i.graphed.map(function(e){return e.nodeKey}),onToggleGraph:i.toggleGraphed,onOpenDriver:r,onDecisionSettled:g.reload,initialTab:l?"attention":"drivers"}):null,t]}))}function b(e){var a=e.l1,i=a.insights,t=a.headline,r=a.trend,l=a.dayPoint;if(!i)return null;if(r.loading)return n.jsx(c.MetricsSkeleton,{});if(!l)return null;var o=t?i.kpiLabel(t):"Value";return n.jsx(c.TrendMetricsSection,{dailyLabel:"Daily ".concat(o),daily:l.value,fast:l.fast,slow:l.slow,long:l.long,windows:i.windows,good:i.goodDirection(null!=t?t:""),format:s.formatValue})}function D(a){var i=a.l1,t=a.highlightDay,r=a.onOpenDay,s=a.onOpenAttention,o=i.insights,d=i.headline,u=i.trend,g=i.points,p=i.extraLines;if(!o)return null;if(u.loading)return n.jsx(c.ChartSkeleton,{height:300,label:"Loading trend"});if(u.error)return n.jsx("div",e.__assign({className:"ag-empty"},{children:"The trend is unavailable right now."}));var h=d?o.kpiLabel(d):"Value";return n.jsx(l.TrendChart,{points:g,label:h,good:o.goodDirection(null!=d?d:""),windows:o.windows,extraLines:p,highlightDay:t,syncId:v,onOpenDay:d?r:void 0,onOpenAttention:s})}function w(a){var i,t,r=a.l1,s=r.insights,o=r.tier2,d=r.activity;return s&&o.length?d.loading?n.jsx(c.ChartSkeleton,{height:220,label:"Loading user activity"}):d.error?n.jsx("div",e.__assign({className:"ag-empty"},{children:"User activity is unavailable right now."})):n.jsx(l.ActivityChart,{items:(null!==(t=null===(i=d.data)||void 0===i?void 0:i.series)&&void 0!==t?t:[]).filter(function(e){return"root"===e.nodeKey}),labelOf:s.kpiLabel,goodOf:s.goodDirection,syncId:v},o.join(",")):null}function C(i){var t,d,u,g,v,h=i.nodeKey,_=i.label,f=i.kpiId,x=i.dataDay,j=i.tier2Kpis,b=r.useInsights(),D=a.useState(Boolean(null==b?void 0:b.defaultWorkingDays)),w=D[0],C=D[1],N=m(b),I=y(b,[f],w,[h],N.group),k=null!==(t=null!=j?j:null==b?void 0:b.tierKpis[2])&&void 0!==t?t:[],S=y(b,k,w,[h],N.group),A=p(null===(d=I.data)||void 0===d?void 0:d.series,f,h),K=a.useMemo(function(){return l.toTrendPoints(A)},[A]),T=null!==(u=K.find(function(e){return e.day===x}))&&void 0!==u?u:e.__spreadArray([],K,!0).reverse().find(function(e){return null!=e.value});if(!b)return null;var O=b.goodDirection(f),L=null!=(null==T?void 0:T.fast)&&null!=T.slow&&0!==T.slow?(T.fast-T.slow)/Math.abs(T.slow)*100:null,M=null!=(null==T?void 0:T.slow)&&null!=T.long&&0!==T.long?(T.slow-T.long)/Math.abs(T.long)*100:null,R=c.toneOf(L,O),E=c.toneOf(M,O);return n.jsxs("div",e.__assign({className:"ag-stack"},{children:[n.jsxs("section",{children:[n.jsx(c.SectionHeader,{title:"Averages"}),I.loading?n.jsx(c.MetricsSkeleton,{}):T?n.jsx(c.TrendMetricsSection,{fast:T.fast,slow:T.slow,long:T.long,windows:b.windows,good:O,format:s.formatValue}):n.jsx("div",e.__assign({className:"ag-empty"},{children:"No averages are available for this selection."})),T?n.jsxs("div",e.__assign({className:"ag-average-details"},{children:[n.jsxs("span",{children:[n.jsx("i",e.__assign({className:"good"===R?"ag-text--good":"bad"===R?"ag-text--bad":void 0},{children:null==L?"—":L<0?"↓":"↑"}))," ",b.windows.fast,"d vs ",b.windows.slow,"d avg: ",n.jsx("b",{children:null==L?"—":"".concat(L>0?"+":"").concat(L.toFixed(1),"%")})]}),n.jsxs("span",{children:[n.jsx("i",e.__assign({className:"good"===E?"ag-text--good":"bad"===E?"ag-text--bad":void 0},{children:null==M?"—":M<0?"↓":"↑"}))," ",b.windows.slow,"d vs ",b.windows.long,"d avg: ",n.jsx("b",{children:null==M?"—":"".concat(M>0?"+":"").concat(M.toFixed(1),"%")})]})]})):null]}),n.jsx(c.CollapsibleVisualSection,e.__assign({title:"Trend",action:n.jsx(c.DaysDropdown,{value:w,onChange:C,groups:N.groups,group:N.group,onGroupChange:N.setGroup})},{children:I.error?n.jsx("div",e.__assign({className:"ag-empty"},{children:"The trend is unavailable right now."})):I.loading?n.jsx(c.ChartSkeleton,{height:300,label:"Loading trend"}):n.jsx(l.TrendChart,{points:K,label:b.kpiLabel(f),good:O,windows:b.windows,highlightDay:x})})),k.length?n.jsx(c.CollapsibleVisualSection,e.__assign({title:"User Activity",meta:_},{children:S.error?n.jsx("div",e.__assign({className:"ag-empty"},{children:"User activity is unavailable right now."})):S.loading?n.jsx(c.ChartSkeleton,{height:220,label:"Loading user activity"}):n.jsx(l.ActivityChart,{items:(null!==(v=null===(g=S.data)||void 0===g?void 0:g.series)&&void 0!==v?v:[]).filter(function(e){return e.nodeKey===h}),labelOf:b.kpiLabel,goodOf:b.goodDirection})})):null,n.jsx(o.CorrelationSection,{dataDay:x,nodeKey:h,kpiId:f,dayGroup:N.days})]}))}function N(a){var i=a.eyebrow,t=a.title,r=a.children;return n.jsxs("section",e.__assign({className:"ag-popup__section"},{children:[n.jsxs("div",e.__assign({className:"ag-popup__head"},{children:[n.jsx("p",e.__assign({className:"ag-popup__eyebrow"},{children:i})),n.jsx("h3",e.__assign({className:"ag-popup__title"},{children:t}))]})),r]}))}function I(t){var s,l,g,v,p,h,_=t.day,y=t.workingDays,I=t.initialAttention,k=void 0!==I&&I,S=t.initialDriver,A=void 0===S?null:S,K=t.onClose,T=a.useState(_),O=T[0],L=T[1],M=a.useState(y),R=M[0],E=M[1],G=a.useState(A),q=G[0],P=G[1],V=a.useState(k),F=V[0],B=V[1],H=m(r.useInsights()),U=f(O,R,H.group),W=a.useRef(null),X=a.useRef(K);X.current=K,a.useEffect(function(){L(_),P(A),B(k)},[_,k,A]),a.useEffect(function(){var e,n=document.activeElement,a=document.body.style.overflow;document.body.style.overflow="hidden",null===(e=W.current)||void 0===e||e.focus();var i=function(e){"Escape"===e.key&&X.current()};return document.addEventListener("keydown",i),function(){var e;document.removeEventListener("keydown",i),document.body.style.overflow=a,null===(e=null==n?void 0:n.focus)||void 0===e||e.call(n)}},[]);var J=U.insights,z=U.headline,Q=U.report,Y=U.generated,Z=U.summary,$=U.reportDay,ee=U.dayPoint;if(!J)return null;var ne=Y?null==Q?void 0:Q.summary:null,ae=null!==(s=null==ne?void 0:ne.criticality)&&void 0!==s?s:null,ie=null!==(g=null!==(l=null==ne?void 0:ne.movementType)&&void 0!==l?l:null==ee?void 0:ee.movementType)&&void 0!==g?g:null,te=null!==(p=null!==(v=null==ne?void 0:ne.movementDirection)&&void 0!==v?v:null==ee?void 0:ee.direction)&&void 0!==p?p:null,re=Y&&$&&$!==O;return n.jsx("div",e.__assign({className:"ag-modal",role:"presentation",onMouseDown:function(e){return e.target===e.currentTarget&&K()}},{children:n.jsxs("div",e.__assign({className:"ag-modal__dialog",role:"dialog","aria-modal":"true","aria-labelledby":"ag-l1-modal-title"},{children:[n.jsxs("header",e.__assign({className:"ag-modal__head"},{children:[q?n.jsxs("div",e.__assign({className:"ag-modal__detail-title"},{children:[n.jsxs("div",e.__assign({className:"ag-modal__breadcrumb"},{children:[n.jsx("button",e.__assign({type:"button",onClick:function(){return P(null)}},{children:"Top drivers"})),n.jsx(i.ChevronRight,{"aria-hidden":"true"}),n.jsx("strong",e.__assign({id:"ag-l1-modal-title"},{children:q.label}))]})),n.jsx("span",e.__assign({className:"ag-modal__date"},{children:c.formatHeaderDate(O)}))]})):n.jsxs("div",e.__assign({className:"ag-modal__titles"},{children:[n.jsxs("h2",e.__assign({id:"ag-l1-modal-title",className:"ag-modal__title"},{children:[n.jsx(i.Sparkles,{"aria-hidden":"true"}),"L1 Report"]})),n.jsx("span",e.__assign({className:"ag-modal__date"},{children:c.formatHeaderDate(null!=$?$:O)})),!Z.loading||Z.data?n.jsxs(n.Fragment,{children:[n.jsx(c.CriticalityChip,{criticality:ae,compact:!1}),n.jsx(c.MovementChip,{movementType:ie,direction:te})]}):null,z?n.jsx(x,{kpiId:z,dataDay:null!=$?$:O}):null]})),n.jsx("button",e.__assign({ref:W,type:"button",className:"ag-modal__close","aria-label":"Close",onClick:K},{children:n.jsx(i.X,{"aria-hidden":"true"})}))]})),n.jsxs("div",e.__assign({className:"ag-modal__body"},{children:[re?n.jsxs("p",e.__assign({className:"ag-modal__notice"},{children:["No report was written for ",c.formatHeaderDate(O),". Showing the latest one before it, from ",c.formatHeaderDate($),"."]})):null,n.jsxs("div",e.__assign({className:"ag-popup"},{children:[n.jsx(N,e.__assign({eyebrow:"Analysis",title:q?"Summary, Drivers & RCA":"Summary, Categories & RCA"},{children:q&&z?n.jsx(u.default,{embedded:!0,nodeKey:q.nodeKey,kpiId:z,dataDay:O,reportId:null===(h=q.report)||void 0===h?void 0:h.reportId,onReportDay:L}):n.jsx(j,e.__assign({l1:U,onOpenDriver:P,attention:F},{children:Y&&(null==Q?void 0:Q.reportId)?n.jsx(c.ReportAccordion,e.__assign({title:"Comments".concat(Q.commentCount?" (".concat(Q.commentCount,")"):""),defaultExpanded:!1},{children:n.jsx(d.default,{reportId:Q.reportId})})):null}))})),n.jsx(N,e.__assign({eyebrow:"Visuals",title:q?"Trend & Usage Signals":"L1 Trend"},{children:q&&z?n.jsx(C,{nodeKey:q.nodeKey,label:q.label,kpiId:z,dataDay:O}):n.jsxs("div",e.__assign({className:"ag-stack"},{children:[n.jsx(b,{l1:U}),n.jsx(c.CollapsibleVisualSection,e.__assign({title:"Trend",action:n.jsx(c.DaysDropdown,{value:R,onChange:E,groups:H.groups,group:H.group,onGroupChange:H.setGroup})},{children:n.jsx(D,{l1:U,highlightDay:O,onOpenDay:function(e){L(e.day),P(null),B(!1)},onOpenAttention:function(e){L(e.day),P(null),B(!0)}})})),U.tier2.length?n.jsx(c.CollapsibleVisualSection,e.__assign({title:"User Activity",meta:"Platform-wide"},{children:n.jsx(w,{l1:U})})):null,n.jsx(o.CorrelationSection,{dataDay:O,dayGroup:H.days})]}))}))]}))]}))]}))}))}exports.EntityDetailVisuals=C,exports.L1ReportModal=I,exports.default=function(){var t=r.useInsights(),s=a.useState(Boolean(null==t?void 0:t.defaultWorkingDays)),l=s[0],d=s[1],u=m(t),g=a.useState(!1),v=g[0],p=g[1],h=a.useState(null),_=h[0],y=h[1],x=f(null,l,u.group);if(!t)return null;var C=x.headline,N=x.reportDay,k=x.summary,S=C?t.kpiLabel(C):"Value";return n.jsxs("section",e.__assign({className:"ag-report","aria-labelledby":"ag-l1-title"},{children:[n.jsxs("div",e.__assign({className:"ag-report__header"},{children:[n.jsxs("h2",e.__assign({id:"ag-l1-title",className:"ag-report__title"},{children:[n.jsx(i.Sparkles,{"aria-hidden":"true"}),"L1 Report"]})),k.loading&&!k.data?n.jsx("span",{className:"ag-skel__line ag-report__date-skel","aria-hidden":"true"}):N?n.jsx("span",e.__assign({className:"ag-report__date"},{children:c.formatHeaderDate(N)})):null]})),n.jsxs("div",e.__assign({className:"ag-report__grid"},{children:[n.jsx("div",e.__assign({className:"ag-report__analysis-scroll",role:"region","aria-label":"L1 report analysis",tabIndex:0},{children:n.jsx(j,{l1:x,onOpenDriver:function(e){return N&&y({day:N,attention:!1,driver:e})}})})),n.jsxs("div",e.__assign({className:"ag-stack"},{children:[n.jsxs("section",e.__assign({className:"ag-trend-card"},{children:[n.jsxs("header",e.__assign({className:"ag-trend-card__head"},{children:[n.jsx("span",e.__assign({className:"ag-trend-card__icon"},{children:n.jsx(i.TrendingUp,{"aria-hidden":"true"})})),n.jsxs("div",e.__assign({className:"ag-trend-card__titles"},{children:[n.jsxs("h3",{children:[o.titleCase(S)," trend"]}),n.jsxs("p",{children:[S," movement across the selected date range."]})]})),n.jsx("button",e.__assign({type:"button",className:"ag-icon-button","aria-label":v?"Expand trend":"Collapse trend","aria-expanded":!v,onClick:function(){return p(function(e){return!e})}},{children:n.jsx(i.ChevronDown,{"aria-hidden":"true",className:v?"is-closed":"is-open"})}))]})),v?null:n.jsxs("div",e.__assign({className:"ag-trend-card__body"},{children:[n.jsx("div",e.__assign({className:"ag-trend-card__tools"},{children:n.jsx(c.DaysDropdown,{value:l,onChange:d,groups:u.groups,group:u.group,onGroupChange:u.setGroup})})),n.jsx(b,{l1:x}),n.jsx(D,{l1:x,highlightDay:N,onOpenDay:function(e){return y({day:e.day,attention:!1})},onOpenAttention:function(e){return y({day:e.day,attention:!0})}}),x.tier2.length?n.jsxs("div",e.__assign({className:"ag-trend-card__activity"},{children:[n.jsx(c.SectionHeader,{title:"User Activity",meta:"Platform-wide"}),n.jsx(w,{l1:x})]})):null]}))]})),n.jsx(o.CorrelationSection,{dataDay:N,dayGroup:u.days})]}))]})),_?n.jsx(I,{day:_.day,workingDays:l,initialAttention:_.attention,initialDriver:_.driver,onClose:function(){return y(null)}}):null]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),n=require("react/jsx-runtime"),t=require("react"),a=require("lucide-react"),i=require("../../api/insightsApi.js"),r=require("./insightsContextCore.js"),s=require("./insightsUtils.js"),l=require("./AgCharts.js"),o=require("./AgReport.js"),d=require("./CommentsThread.js"),u=require("./RowDetail.js"),c=require("./agPrimitives.js"),g=["#4F46E5","#64748B","#0F766E","#7C3AED","#475569"],v="decision-advantage-l1",p=function(e,n,t){return void 0===t&&(t="root"),null==e?void 0:e.find(function(e){return e.kpiId===n&&e.nodeKey===t})},h=function(e){var n=e.split("-").map(Number),t=n[0],a=n[1],i=n[2];return new Date(t,a-1,i)};function _(e){var n,t;if(!e)return null;var a=e,i="string"==typeof a.summary?a.summary:(null===(n=a.summary)||void 0===n?void 0:n.headline)||(null===(t=a.summary)||void 0===t?void 0:t.body)||a.executiveSummary||a.executive_summary||a.summaryText||a.summary_text;return(null==i?void 0:i.trim())||null}function y(e){var n,a,r=s.useInsightsFetch(e?function(n){return i.fetchGraphGroups(e.api,n)}:null,[null==e?void 0:e.api.configId,null==e?void 0:e.revision]),l=t.useState(null),o=l[0],d=l[1];t.useEffect(function(){var e,n;null===o&&((null===(e=r.data)||void 0===e?void 0:e.groups.length)?d((null!==(n=r.data.groups.find(function(e){return e.isDefault}))&&void 0!==n?n:r.data.groups[0]).groupKey):r.loading||d(""))},[o,r.data,r.loading]);var u=r.error||null===(n=r.data)||void 0===n?void 0:n.groups;return{groups:u,group:o,setGroup:d,days:null===(a=null==u?void 0:u.find(function(e){return e.groupKey===o}))||void 0===a?void 0:a.days}}function m(n,t,a,r,l){return void 0===r&&(r=[]),s.useInsightsFetch(n&&t.length&&null!==l?function(s){var d=e.__assign(e.__assign({},n.range),{workingDaysOnly:a,group:l||void 0}),u=t.slice(0,o.MAX_SERIES);return i.fetchInsightsSeries(n.api,d,r.length?{kpiIds:u,nodeKeys:r}:{kpiIds:u},s)}:null,[null==n?void 0:n.api.configId,null==n?void 0:n.rangeKey,t.join(","),r.join(","),a,l,null==n?void 0:n.revision])}function f(n,a,d){var u,c,v,y,f,x,j,b,D=this,w=r.useInsights(),C=t.useState([]),S=C[0],I=C[1],N=null!==(u=null==w?void 0:w.headlineKpi)&&void 0!==u?u:null,k=t.useMemo(function(){var n,t=null!==(n=null==w?void 0:w.tierKpis[1])&&void 0!==n?n:[];return N?e.__spreadArray([N],t.filter(function(e){return e!==N}),!0):t},[w,N]),A=t.useMemo(function(){var e;return null!==(e=null==w?void 0:w.tierKpis[2].filter(function(e){return e!==N}))&&void 0!==e?e:[]},[w,N]),K=m(w,k,a,[],d),T=m(w,A,a,[],d),O=m(w,N&&S.length?[N]:[],a,S.map(function(e){return e.nodeKey}),d),L=null!=n?n:w?i.toIsoDay(w.range.endDate):null,M=s.useInsightsFetch(w&&L?function(n){return function(n,t,a){return e.__awaiter(this,void 0,void 0,function(){var r,s,l,o;return e.__generator(this,function(e){switch(e.label){case 0:return r=h(t),[4,i.fetchInsightsSummary(n,{startDate:r,endDate:r},a)];case 1:return"generated"===(s=e.sent()).report.status?[2,s]:((l=new Date(r)).setDate(l.getDate()-6),[4,i.fetchInsightsSummary(n,{startDate:l,endDate:r},a)]);case 2:return[2,"generated"===(o=e.sent()).report.status?o:s]}})})}(w.api,L,n)}:null,[null==w?void 0:w.api.configId,L,null==w?void 0:w.revision]),R=s.useInsightsFetch(w&&N?function(e){return i.fetchInsightsReports(w.api,{nodeKey:"root",kpiId:N,startDate:i.toIsoDay(w.range.startDate),endDate:i.toIsoDay(w.range.endDate)},e)}:null,[null==w?void 0:w.api.configId,null==w?void 0:w.rangeKey,N,null==w?void 0:w.revision]),E=t.useMemo(function(){var e;return l.toTrendPoints(p(null===(e=K.data)||void 0===e?void 0:e.series,N))},[K.data,N]),G=t.useMemo(function(){return E.filter(function(e){return Boolean(e.reportId||e.criticality||e.movementType&&"stable"!==e.movementType)}).map(function(e){return e.day})},[E]),q=s.useInsightsFetch(w&&G.length?function(n){return e.__awaiter(D,void 0,void 0,function(){var t,a=this;return e.__generator(this,function(r){switch(r.label){case 0:return[4,Promise.all(G.map(function(t){return e.__awaiter(a,void 0,void 0,function(){var a,r;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,i.fetchInsightsSummary(w.api,{startDate:h(t),endDate:h(t)},n)];case 1:return[2,"generated"===(a=e.sent()).report.status&&a.context.period.end.slice(0,10)===t?[t,a.report]:null];case 2:if(r=e.sent(),n.aborted)throw r;return[2,null];case 3:return[2]}})})}))];case 1:return t=r.sent(),[2,Object.fromEntries(t.filter(function(e){return Boolean(e)}))]}})})}:null,[null==w?void 0:w.api.configId,G.join(","),null==w?void 0:w.revision]),F=t.useMemo(function(){var n,t,a,i,r=null!==(i=null!==(t=null===(n=R.data)||void 0===n?void 0:n.reportsByDay)&&void 0!==t?t:null===(a=R.data)||void 0===a?void 0:a.reports_by_day)&&void 0!==i?i:{},s=new Map(Object.entries(r).map(function(e){var n=e[0],t=e[1];return[n.slice(0,10),t]}));return E.map(function(n){var t,a,i,r=null!==(a=null===(t=q.data)||void 0===t?void 0:t[n.day])&&void 0!==a?a:s.get(n.day),l="object"==typeof(null==r?void 0:r.summary)?r.summary:null;return r?e.__assign(e.__assign({},n),{headline:_(r)||n.headline,reportId:r.reportId||n.reportId,criticality:(null==l?void 0:l.criticality)||n.criticality,commentCount:null!==(i=r.commentCount)&&void 0!==i?i:n.commentCount}):n})},[E,R.data,q.data]),P=t.useMemo(function(){var n,t,a=k.slice(1).map(function(e,n){var t,a,i=p(null===(t=K.data)||void 0===t?void 0:t.series,e);return i?{key:e,label:null!==(a=null==w?void 0:w.kpiLabel(e))&&void 0!==a?a:e,color:g[n%g.length],data:i.points.map(function(e){return{x:e.x,y:e.y}})}:null}),i=new Set(S.map(function(e){return e.nodeKey})),r=(null!==(t=null===(n=O.data)||void 0===n?void 0:n.series)&&void 0!==t?t:[]).filter(function(e){return i.has(e.nodeKey)}).map(function(e,n){var t;return{key:"row_".concat(e.nodeKey),label:null!==(t=e.label)&&void 0!==t?t:e.nodeKey,color:g[(n+2)%g.length],data:e.points.map(function(e){return{x:e.x,y:e.y}})}});return e.__spreadArray(e.__spreadArray([],a.filter(Boolean),!0),r,!0)},[k,K.data,O.data,S,w]),V=null===(c=M.data)||void 0===c?void 0:c.report,B="generated"===(null==V?void 0:V.status),H=null!==(j=null!==(f=null!==(y=B?o.reportDayOf(null===(v=M.data)||void 0===v?void 0:v.context):null)&&void 0!==y?y:n)&&void 0!==f?f:null===(x=e.__spreadArray([],F,!0).reverse().find(function(e){return null!=e.value}))||void 0===x?void 0:x.day)&&void 0!==j?j:null,U=null!==(b=F.find(function(e){return e.day===(null!=n?n:H)}))&&void 0!==b?b:n?void 0:e.__spreadArray([],F,!0).reverse().find(function(e){return null!=e.value});return{insights:w,headline:N,tier2:A,trend:K,activity:T,summary:M,report:V,generated:B,reportDay:H,points:F,dayPoint:U,extraLines:P,graphed:S,toggleGraphed:function(n){return I(function(t){return t.some(function(e){return e.nodeKey===n.nodeKey})?t.filter(function(e){return e.nodeKey!==n.nodeKey}):t.length<o.MAX_SERIES?e.__spreadArray(e.__spreadArray([],t,!0),[n],!1):t})}}}function x(a){var l,o=this,d=a.kpiId,u=a.dataDay,c=r.useInsights(),g=t.useState(null),v=g[0],p=g[1],h=t.useState(null),_=h[0],y=h[1];if(s.useJob(v,null!==(l=null==c?void 0:c.api)&&void 0!==l?l:null,function(){p(null),null==c||c.refresh()}),!c)return null;return n.jsxs("span",{children:[n.jsxs("button",e.__assign({type:"button",className:"ins-link",disabled:Boolean(v),onClick:function(){return e.__awaiter(o,void 0,void 0,function(){var n,t;return e.__generator(this,function(e){switch(e.label){case 0:y(null),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,i.generateInsightsReport(c.api,{nodeKey:"root",kpiId:d,dataDay:u,force:!0})];case 2:return"job"===(n=e.sent()).kind?p(n.jobId):c.refresh(),[3,4];case 3:return t=e.sent(),y(t.message||"The report couldn't be rerun."),[3,4];case 4:return[2]}})})}},{children:[n.jsx("span",e.__assign({"aria-hidden":"true"},{children:"↻"})),v?"Rerunning…":"Rerun RCA"]})),_?n.jsx("span",e.__assign({className:"ins-error"},{children:_})):null]})}function j(t){var a=t.l1,i=t.children,r=t.onOpenDriver,s=t.attention,l=void 0!==s&&s,d=a.insights,u=a.headline,g=a.summary,v=a.report,p=a.reportDay,h=a.dayPoint;if(!d)return null;var _=d.goodDirection(null!=u?u:""),y=g.loading&&!g.data;return n.jsxs("div",e.__assign({className:"ag-stack"},{children:[n.jsxs("div",{children:[n.jsx(c.SectionHeader,{title:"Summary",action:n.jsx(o.RegenerateSummary,{dataDay:p})}),n.jsx(o.SummaryCard,{report:v,loading:y,error:g.error,movementType:h?h.movementType:void 0,direction:null==h?void 0:h.direction,good:_})]}),n.jsx(o.DecisionCard,{report:v,error:g.error,loading:y}),p&&!y?n.jsx(o.TopDriversSection,{dataDay:p,title:"Top Drivers",graphed:a.graphed.map(function(e){return e.nodeKey}),onToggleGraph:a.toggleGraphed,onOpenDriver:r,onDecisionSettled:g.reload,initialTab:l?"attention":"drivers"}):null,i]}))}function b(e){var t=e.l1,a=t.insights,i=t.headline,r=t.trend,l=t.dayPoint;if(!a)return null;if(r.loading)return n.jsx(c.MetricsSkeleton,{});if(!l)return null;var o=i?a.kpiLabel(i):"Value";return n.jsx(c.TrendMetricsSection,{dailyLabel:"Daily ".concat(o),daily:l.value,fast:l.fast,slow:l.slow,long:l.long,windows:a.windows,good:a.goodDirection(null!=i?i:""),format:s.formatValue})}function D(t){var a=t.l1,i=t.highlightDay,r=t.onOpenDay,s=t.onOpenAttention,o=a.insights,d=a.headline,u=a.trend,g=a.points,p=a.extraLines;if(!o)return null;if(u.loading)return n.jsx(c.ChartSkeleton,{height:300,label:"Loading trend"});if(u.error)return n.jsx("div",e.__assign({className:"ag-empty"},{children:"The trend is unavailable right now."}));var h=d?o.kpiLabel(d):"Value";return n.jsx(l.TrendChart,{points:g,label:h,good:o.goodDirection(null!=d?d:""),windows:o.windows,extraLines:p,highlightDay:i,syncId:v,onOpenDay:d?r:void 0,onOpenAttention:s})}function w(t){var a,i,r=t.l1,s=r.insights,o=r.tier2,d=r.activity;return s&&o.length?d.loading?n.jsx(c.ChartSkeleton,{height:220,label:"Loading user activity"}):d.error?n.jsx("div",e.__assign({className:"ag-empty"},{children:"User activity is unavailable right now."})):n.jsx(l.ActivityChart,{items:(null!==(i=null===(a=d.data)||void 0===a?void 0:a.series)&&void 0!==i?i:[]).filter(function(e){return"root"===e.nodeKey}),labelOf:s.kpiLabel,goodOf:s.goodDirection,syncId:v},o.join(",")):null}function C(a){var i,d,u,g,v,h=a.nodeKey,_=a.label,f=a.kpiId,x=a.dataDay,j=a.tier2Kpis,b=r.useInsights(),D=t.useState(Boolean(null==b?void 0:b.defaultWorkingDays)),w=D[0],C=D[1],S=y(b),I=m(b,[f],w,[h],S.group),N=null!==(i=null!=j?j:null==b?void 0:b.tierKpis[2])&&void 0!==i?i:[],k=m(b,N,w,[h],S.group),A=p(null===(d=I.data)||void 0===d?void 0:d.series,f,h),K=t.useMemo(function(){return l.toTrendPoints(A)},[A]),T=null!==(u=K.find(function(e){return e.day===x}))&&void 0!==u?u:e.__spreadArray([],K,!0).reverse().find(function(e){return null!=e.value});if(!b)return null;var O=b.goodDirection(f),L=null!=(null==T?void 0:T.fast)&&null!=T.slow&&0!==T.slow?(T.fast-T.slow)/Math.abs(T.slow)*100:null,M=null!=(null==T?void 0:T.slow)&&null!=T.long&&0!==T.long?(T.slow-T.long)/Math.abs(T.long)*100:null,R=c.toneOf(L,O),E=c.toneOf(M,O);return n.jsxs("div",e.__assign({className:"ag-stack"},{children:[n.jsxs("section",{children:[n.jsx(c.SectionHeader,{title:"Averages"}),I.loading?n.jsx(c.MetricsSkeleton,{}):T?n.jsx(c.TrendMetricsSection,{fast:T.fast,slow:T.slow,long:T.long,windows:b.windows,good:O,format:s.formatValue}):n.jsx("div",e.__assign({className:"ag-empty"},{children:"No averages are available for this selection."})),T?n.jsxs("div",e.__assign({className:"ag-average-details"},{children:[n.jsxs("span",{children:[n.jsx("i",e.__assign({className:"good"===R?"ag-text--good":"bad"===R?"ag-text--bad":void 0},{children:null==L?"—":L<0?"↓":"↑"}))," ",b.windows.fast,"d vs ",b.windows.slow,"d avg: ",n.jsx("b",{children:null==L?"—":"".concat(L>0?"+":"").concat(L.toFixed(1),"%")})]}),n.jsxs("span",{children:[n.jsx("i",e.__assign({className:"good"===E?"ag-text--good":"bad"===E?"ag-text--bad":void 0},{children:null==M?"—":M<0?"↓":"↑"}))," ",b.windows.slow,"d vs ",b.windows.long,"d avg: ",n.jsx("b",{children:null==M?"—":"".concat(M>0?"+":"").concat(M.toFixed(1),"%")})]})]})):null]}),n.jsx(c.CollapsibleVisualSection,e.__assign({title:"Trend",action:n.jsx(c.DaysDropdown,{value:w,onChange:C,groups:S.groups,group:S.group,onGroupChange:S.setGroup})},{children:I.error?n.jsx("div",e.__assign({className:"ag-empty"},{children:"The trend is unavailable right now."})):I.loading?n.jsx(c.ChartSkeleton,{height:300,label:"Loading trend"}):n.jsx(l.TrendChart,{points:K,label:b.kpiLabel(f),good:O,windows:b.windows,highlightDay:x})})),N.length?n.jsx(c.CollapsibleVisualSection,e.__assign({title:"User Activity",meta:_},{children:k.error?n.jsx("div",e.__assign({className:"ag-empty"},{children:"User activity is unavailable right now."})):k.loading?n.jsx(c.ChartSkeleton,{height:220,label:"Loading user activity"}):n.jsx(l.ActivityChart,{items:(null!==(v=null===(g=k.data)||void 0===g?void 0:g.series)&&void 0!==v?v:[]).filter(function(e){return e.nodeKey===h}),labelOf:b.kpiLabel,goodOf:b.goodDirection})})):null,n.jsx(o.CorrelationSection,{dataDay:x,nodeKey:h,kpiId:f,dayGroup:S.days})]}))}function S(t){var a=t.eyebrow,i=t.title,r=t.children;return n.jsxs("section",e.__assign({className:"ag-popup__section"},{children:[n.jsxs("div",e.__assign({className:"ag-popup__head"},{children:[n.jsx("p",e.__assign({className:"ag-popup__eyebrow"},{children:a})),n.jsx("h3",e.__assign({className:"ag-popup__title"},{children:i}))]})),r]}))}function I(i){var s,l,g,v,p,h,_=i.day,m=i.workingDays,I=i.initialAttention,N=void 0!==I&&I,k=i.initialDriver,A=void 0===k?null:k,K=i.onClose,T=t.useState(_),O=T[0],L=T[1],M=t.useState(m),R=M[0],E=M[1],G=t.useState(A),q=G[0],F=G[1],P=t.useState([]),V=P[0],B=P[1],H=function(e){F(e),B([])},U=V.length?V[V.length-1]:q,X=t.useState(N),W=X[0],J=X[1],z=y(r.useInsights()),Q=f(O,R,z.group),Y=t.useRef(null),Z=t.useRef(K);Z.current=K,t.useEffect(function(){L(_),F(A),J(N)},[_,N,A]),t.useEffect(function(){var e,n=document.activeElement,t=document.body.style.overflow;document.body.style.overflow="hidden",null===(e=Y.current)||void 0===e||e.focus();var a=function(e){"Escape"===e.key&&Z.current()};return document.addEventListener("keydown",a),function(){var e;document.removeEventListener("keydown",a),document.body.style.overflow=t,null===(e=null==n?void 0:n.focus)||void 0===e||e.call(n)}},[]);var $=Q.insights,ee=Q.headline,ne=Q.report,te=Q.generated,ae=Q.summary,ie=Q.reportDay,re=Q.dayPoint;if(!$)return null;var se=te?null==ne?void 0:ne.summary:null,le=null!==(s=null==se?void 0:se.criticality)&&void 0!==s?s:null,oe=null!==(g=null!==(l=null==se?void 0:se.movementType)&&void 0!==l?l:null==re?void 0:re.movementType)&&void 0!==g?g:null,de=null!==(p=null!==(v=null==se?void 0:se.movementDirection)&&void 0!==v?v:null==re?void 0:re.direction)&&void 0!==p?p:null,ue=te&&ie&&ie!==O;return n.jsx("div",e.__assign({className:"ag-modal",role:"presentation",onMouseDown:function(e){return e.target===e.currentTarget&&K()}},{children:n.jsxs("div",e.__assign({className:"ag-modal__dialog",role:"dialog","aria-modal":"true","aria-labelledby":"ag-l1-modal-title"},{children:[n.jsxs("header",e.__assign({className:"ag-modal__head"},{children:[q?n.jsxs("div",e.__assign({className:"ag-modal__detail-title"},{children:[n.jsxs("div",e.__assign({className:"ag-modal__breadcrumb"},{children:[n.jsx("button",e.__assign({type:"button",onClick:function(){return H(null)}},{children:"Top drivers"})),e.__spreadArray([q],V,!0).map(function(i,r,s){return n.jsxs(t.Fragment,{children:[n.jsx(a.ChevronRight,{"aria-hidden":"true"}),r===s.length-1?n.jsx("strong",e.__assign({id:"ag-l1-modal-title"},{children:i.label})):n.jsx("button",e.__assign({type:"button",onClick:function(){return B(V.slice(0,r))}},{children:i.label}))]},"".concat(i.nodeKey,"-").concat(r))})]})),n.jsx("span",e.__assign({className:"ag-modal__date"},{children:c.formatHeaderDate(O)}))]})):n.jsxs("div",e.__assign({className:"ag-modal__titles"},{children:[n.jsxs("h2",e.__assign({id:"ag-l1-modal-title",className:"ag-modal__title"},{children:[n.jsx(a.Sparkles,{"aria-hidden":"true"}),"L1 Report"]})),n.jsx("span",e.__assign({className:"ag-modal__date"},{children:c.formatHeaderDate(null!=ie?ie:O)})),!ae.loading||ae.data?n.jsxs(n.Fragment,{children:[n.jsx(c.CriticalityChip,{criticality:le,compact:!1}),n.jsx(c.MovementChip,{movementType:oe,direction:de})]}):null,ee?n.jsx(x,{kpiId:ee,dataDay:null!=ie?ie:O}):null]})),n.jsx("button",e.__assign({ref:Y,type:"button",className:"ag-modal__close","aria-label":"Close",onClick:K},{children:n.jsx(a.X,{"aria-hidden":"true"})}))]})),n.jsxs("div",e.__assign({className:"ag-modal__body"},{children:[ue?n.jsxs("p",e.__assign({className:"ag-modal__notice"},{children:["No report was written for ",c.formatHeaderDate(O),". Showing the latest one before it, from ",c.formatHeaderDate(ie),"."]})):null,n.jsxs("div",e.__assign({className:"ag-popup"},{children:[n.jsx(S,e.__assign({eyebrow:"Analysis",title:q?"Summary, Drivers & RCA":"Summary, Categories & RCA"},{children:q&&U&&ee?n.jsx(u.default,{embedded:!0,nodeKey:U.nodeKey,kpiId:ee,dataDay:O,reportId:null===(h=U.report)||void 0===h?void 0:h.reportId,onReportDay:L,onOpenDriver:function(n){return B(e.__spreadArray(e.__spreadArray([],V,!0),[n],!1))}},U.nodeKey):n.jsx(j,e.__assign({l1:Q,onOpenDriver:H,attention:W},{children:te&&(null==ne?void 0:ne.reportId)?n.jsx(c.ReportAccordion,e.__assign({title:"Comments".concat(ne.commentCount?" (".concat(ne.commentCount,")"):""),defaultExpanded:!1},{children:n.jsx(d.default,{reportId:ne.reportId})})):null}))})),n.jsx(S,e.__assign({eyebrow:"Visuals",title:q?"Trend & Usage Signals":"L1 Trend"},{children:q&&U&&ee?n.jsx(C,{nodeKey:U.nodeKey,label:U.label,kpiId:ee,dataDay:O},U.nodeKey):n.jsxs("div",e.__assign({className:"ag-stack"},{children:[n.jsx(b,{l1:Q}),n.jsx(c.CollapsibleVisualSection,e.__assign({title:"Trend",action:n.jsx(c.DaysDropdown,{value:R,onChange:E,groups:z.groups,group:z.group,onGroupChange:z.setGroup})},{children:n.jsx(D,{l1:Q,highlightDay:O,onOpenDay:function(e){L(e.day),F(null),J(!1)},onOpenAttention:function(e){L(e.day),F(null),J(!0)}})})),Q.tier2.length?n.jsx(c.CollapsibleVisualSection,e.__assign({title:"User Activity",meta:"Platform-wide"},{children:n.jsx(w,{l1:Q})})):null,n.jsx(o.CorrelationSection,{dataDay:O,dayGroup:z.days})]}))}))]}))]}))]}))}))}exports.EntityDetailVisuals=C,exports.L1ReportModal=I,exports.default=function(){var i=r.useInsights(),s=t.useState(Boolean(null==i?void 0:i.defaultWorkingDays)),l=s[0],d=s[1],u=y(i),g=t.useState(!1),v=g[0],p=g[1],h=t.useState(null),_=h[0],m=h[1],x=f(null,l,u.group);if(!i)return null;var C=x.headline,S=x.reportDay,N=x.summary,k=C?i.kpiLabel(C):"Value";return n.jsxs("section",e.__assign({className:"ag-report","aria-labelledby":"ag-l1-title"},{children:[n.jsxs("div",e.__assign({className:"ag-report__header"},{children:[n.jsxs("h2",e.__assign({id:"ag-l1-title",className:"ag-report__title"},{children:[n.jsx(a.Sparkles,{"aria-hidden":"true"}),"L1 Report"]})),N.loading&&!N.data?n.jsx("span",{className:"ag-skel__line ag-report__date-skel","aria-hidden":"true"}):S?n.jsx("span",e.__assign({className:"ag-report__date"},{children:c.formatHeaderDate(S)})):null]})),n.jsxs("div",e.__assign({className:"ag-report__grid"},{children:[n.jsx("div",e.__assign({className:"ag-report__analysis-scroll",role:"region","aria-label":"L1 report analysis",tabIndex:0},{children:n.jsx(j,{l1:x,onOpenDriver:function(e){return S&&m({day:S,attention:!1,driver:e})}})})),n.jsxs("div",e.__assign({className:"ag-stack"},{children:[n.jsxs("section",e.__assign({className:"ag-trend-card"},{children:[n.jsxs("header",e.__assign({className:"ag-trend-card__head"},{children:[n.jsx("span",e.__assign({className:"ag-trend-card__icon"},{children:n.jsx(a.TrendingUp,{"aria-hidden":"true"})})),n.jsxs("div",e.__assign({className:"ag-trend-card__titles"},{children:[n.jsxs("h3",{children:[o.titleCase(k)," trend"]}),n.jsxs("p",{children:[k," movement across the selected date range."]})]})),n.jsx("button",e.__assign({type:"button",className:"ag-icon-button","aria-label":v?"Expand trend":"Collapse trend","aria-expanded":!v,onClick:function(){return p(function(e){return!e})}},{children:n.jsx(a.ChevronDown,{"aria-hidden":"true",className:v?"is-closed":"is-open"})}))]})),v?null:n.jsxs("div",e.__assign({className:"ag-trend-card__body"},{children:[n.jsx("div",e.__assign({className:"ag-trend-card__tools"},{children:n.jsx(c.DaysDropdown,{value:l,onChange:d,groups:u.groups,group:u.group,onGroupChange:u.setGroup})})),n.jsx(b,{l1:x}),n.jsx(D,{l1:x,highlightDay:S,onOpenDay:function(e){return m({day:e.day,attention:!1})},onOpenAttention:function(e){return m({day:e.day,attention:!0})}}),x.tier2.length?n.jsxs("div",e.__assign({className:"ag-trend-card__activity"},{children:[n.jsx(c.SectionHeader,{title:"User Activity",meta:"Platform-wide"}),n.jsx(w,{l1:x})]})):null]}))]})),n.jsx(o.CorrelationSection,{dataDay:S,dayGroup:u.days})]}))]})),_?n.jsx(I,{day:_.day,workingDays:l,initialAttention:_.attention,initialDriver:_.driver,onClose:function(){return m(null)}}):null]}))};
2
2
  //# sourceMappingURL=L1Report.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),i=require("react/jsx-runtime"),r=require("react"),n=require("lucide-react"),t=require("../../api/insightsApi.js"),o=require("./insightsContextCore.js"),l=require("./insightsUtils.js"),a=require("./agPrimitives.js"),d=require("./AgReport.js"),s=require("./CommentsThread.js");exports.default=function(u){var c,v,p,h,g,m,j,x,_=u.nodeKey,f=u.kpiId,y=u.dataDay,I=u.reportId,C=u.embedded,D=void 0!==C&&C,b=u.onReportDay,k=u.onBack,q=u.backLabel,N=void 0===q?"L1 Report › Top drivers":q,R=o.useInsights(),P=l.useInsightsFetch(R&&I?function(e){return t.fetchInsightsReport(R.api,I,e)}:null,[null==R?void 0:R.api.configId,I,null==R?void 0:R.revision]),w=(null===(v=null===(c=P.data)||void 0===c?void 0:c.period)||void 0===v?void 0:v.end)||y;r.useEffect(function(){var e,i;(null===(i=null===(e=P.data)||void 0===e?void 0:e.period)||void 0===i?void 0:i.end)?null==b||b(P.data.period.end):P.error&&(null==b||b(y))},[y,b,null===(h=null===(p=P.data)||void 0===p?void 0:p.period)||void 0===h?void 0:h.end,P.error]);var T=l.useInsightsFetch(!R||D||I&&!P.data?null:function(e){return t.fetchRowDetail(R.api,_,{kpiId:f,dataDay:w},e)},[null==R?void 0:R.api.configId,_,f,w,D,null==R?void 0:R.revision]),L=l.useInsightsFetch(R&&!I?function(e){return t.fetchRowReport(R.api,_,{kpiId:f,dataDay:w},e)}:null,[null==R?void 0:R.api.configId,_,f,w,I,null==R?void 0:R.revision]);if(!R)return null;var O=T.data,F=null==O?void 0:O.movement,S=null!==(m=null===(g=P.data)||void 0===g?void 0:g.report)&&void 0!==m?m:null===(j=L.data)||void 0===j?void 0:j.report,A=I?P.loading:L.loading,K=I?P.error:L.error;return i.jsxs("div",e.__assign({className:"ag-row-detail"},{children:[!D&&k?i.jsxs("button",e.__assign({type:"button",className:"ins-link",onClick:k},{children:[i.jsx(n.ChevronLeft,{"aria-hidden":"true"})," ",N]})):null,D?null:i.jsx("h3",{children:(null==O?void 0:O.label)||"Row details"}),!D&&(null===(x=null==O?void 0:O.path)||void 0===x?void 0:x.length)?i.jsx("p",e.__assign({className:"ag-muted"},{children:O.path.join(" › ")})):null,D||!T.loading||O?null:i.jsx("p",e.__assign({className:"ag-muted"},{children:"Loading row…"})),T.error&&!P.data?i.jsx("p",e.__assign({className:"ins-error"},{children:T.error.message})):null,!D&&O?i.jsxs(i.Fragment,{children:[i.jsxs("div",e.__assign({className:"ag-driver__chips"},{children:[i.jsx(a.CriticalityChip,{criticality:null==F?void 0:F.criticality}),i.jsx(a.MovementChip,{movementType:null==F?void 0:F.movementType,direction:null==F?void 0:F.direction})]})),null!=O.shareOfParentPct?i.jsxs("p",{children:[O.shareOfParentPct,"% of parent"]}):null,i.jsx("dl",e.__assign({className:"ag-row-detail__metrics"},{children:Object.entries(O.metrics).map(function(e){var r=e[0],n=e[1];return i.jsxs("div",{children:[i.jsx("dt",{children:R.kpiLabel(r)}),i.jsxs("dd",{children:[l.formatValue(n.value)," ",i.jsx(a.DayOverDayChange,{deltaPct:n.deltaPct,direction:n.direction,tone:n.tone,good:R.goodDirection(r)})]})]},r)})}))]}):null,i.jsxs("div",e.__assign({className:"ag-stack"},{children:[i.jsxs("div",{children:[i.jsx(a.SectionHeader,{title:"Summary"}),i.jsx(d.SummaryCard,{report:S,loading:A,error:K,good:R.goodDirection(f)})]}),i.jsx(d.DecisionCard,{report:S,loading:A,error:K}),i.jsx(d.TopDriversSection,{dataDay:w,parentNodeKey:_,kpiId:f,title:"Top Drivers",graphed:[]}),(null==S?void 0:S.reportId)?i.jsx(a.ReportAccordion,e.__assign({title:"Comments".concat(S.commentCount?" (".concat(S.commentCount,")"):"")},{children:i.jsx(s.default,{reportId:S.reportId})})):null]}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),i=require("react/jsx-runtime"),r=require("react"),n=require("lucide-react"),o=require("../../api/insightsApi.js"),t=require("./insightsContextCore.js"),l=require("./insightsUtils.js"),a=require("./agPrimitives.js"),d=require("./AgReport.js"),s=require("./CommentsThread.js");exports.default=function(u){var c,v,p,h,g,m,j,x,_=u.nodeKey,f=u.kpiId,y=u.dataDay,I=u.reportId,D=u.embedded,C=void 0!==D&&D,b=u.onReportDay,k=u.onBack,q=u.onOpenDriver,N=u.backLabel,R=void 0===N?"L1 Report › Top drivers":N,P=t.useInsights(),O=l.useInsightsFetch(P&&I?function(e){return o.fetchInsightsReport(P.api,I,e)}:null,[null==P?void 0:P.api.configId,I,null==P?void 0:P.revision]),w=(null===(v=null===(c=O.data)||void 0===c?void 0:c.period)||void 0===v?void 0:v.end)||y;r.useEffect(function(){var e,i;(null===(i=null===(e=O.data)||void 0===e?void 0:e.period)||void 0===i?void 0:i.end)?null==b||b(O.data.period.end):O.error&&(null==b||b(y))},[y,b,null===(h=null===(p=O.data)||void 0===p?void 0:p.period)||void 0===h?void 0:h.end,O.error]);var T=l.useInsightsFetch(!P||C||I&&!O.data?null:function(e){return o.fetchRowDetail(P.api,_,{kpiId:f,dataDay:w},e)},[null==P?void 0:P.api.configId,_,f,w,C,null==P?void 0:P.revision]),L=l.useInsightsFetch(P&&!I?function(e){return o.fetchRowReport(P.api,_,{kpiId:f,dataDay:w},e)}:null,[null==P?void 0:P.api.configId,_,f,w,I,null==P?void 0:P.revision]);if(!P)return null;var F=T.data,S=null==F?void 0:F.movement,A=null!==(m=null===(g=O.data)||void 0===g?void 0:g.report)&&void 0!==m?m:null===(j=L.data)||void 0===j?void 0:j.report,K=I?O.loading:L.loading,M=I?O.error:L.error;return i.jsxs("div",e.__assign({className:"ag-row-detail"},{children:[!C&&k?i.jsxs("button",e.__assign({type:"button",className:"ins-link",onClick:k},{children:[i.jsx(n.ChevronLeft,{"aria-hidden":"true"})," ",R]})):null,C?null:i.jsx("h3",{children:(null==F?void 0:F.label)||"Row details"}),!C&&(null===(x=null==F?void 0:F.path)||void 0===x?void 0:x.length)?i.jsx("p",e.__assign({className:"ag-muted"},{children:F.path.join(" › ")})):null,C||!T.loading||F?null:i.jsx("p",e.__assign({className:"ag-muted"},{children:"Loading row…"})),T.error&&!O.data?i.jsx("p",e.__assign({className:"ins-error"},{children:T.error.message})):null,!C&&F?i.jsxs(i.Fragment,{children:[i.jsxs("div",e.__assign({className:"ag-driver__chips"},{children:[i.jsx(a.CriticalityChip,{criticality:null==S?void 0:S.criticality}),i.jsx(a.MovementChip,{movementType:null==S?void 0:S.movementType,direction:null==S?void 0:S.direction})]})),null!=F.shareOfParentPct?i.jsxs("p",{children:[F.shareOfParentPct,"% of parent"]}):null,i.jsx("dl",e.__assign({className:"ag-row-detail__metrics"},{children:Object.entries(F.metrics).map(function(e){var r=e[0],n=e[1];return i.jsxs("div",{children:[i.jsx("dt",{children:P.kpiLabel(r)}),i.jsxs("dd",{children:[l.formatValue(n.value)," ",i.jsx(a.DayOverDayChange,{deltaPct:n.deltaPct,direction:n.direction,tone:n.tone,good:P.goodDirection(r)})]})]},r)})}))]}):null,i.jsxs("div",e.__assign({className:"ag-stack"},{children:[i.jsxs("div",{children:[i.jsx(a.SectionHeader,{title:"Summary"}),i.jsx(d.SummaryCard,{report:A,loading:K,error:M,good:P.goodDirection(f)})]}),i.jsx(d.DecisionCard,{report:A,loading:K,error:M}),i.jsx(d.TopDriversSection,{dataDay:w,parentNodeKey:_,kpiId:f,title:"Top Drivers",graphed:[],onOpenDriver:q}),(null==A?void 0:A.reportId)?i.jsx(a.ReportAccordion,e.__assign({title:"Comments".concat(A.commentCount?" (".concat(A.commentCount,")"):"")},{children:i.jsx(s.default,{reportId:A.reportId})})):null]}))]}))};
2
2
  //# sourceMappingURL=RowDetail.js.map
package/dist/cjs/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./ExecutiveDashboard/ExecutiveDashboardWrapper.js"),r=require("./ExecutiveDashboard/components/ExecutiveDashboard.js"),o=require("./ExecutiveDashboard/api/dashboardApi.js"),t=require("./ExecutiveDashboard/utils/sectionOrder.js"),a=require("./ExecutiveDashboard/components/DashboardGrid/DashboardGrid.js"),s=require("./ExecutiveDashboard/components/DashboardGrid/layout.js"),i=require("./ExecutiveDashboard/components/DashboardGrid/buildDashboardWidgets.js"),n=require("./ExecutiveDashboard/components/Graph/Graph.js"),d=require("./ExecutiveDashboard/components/Graph/LineChart.js"),p=require("./ExecutiveDashboard/components/Graph/PlotBySelector.js"),c=require("./ExecutiveDashboard/components/Graph/types.js"),l=require("./ExecutiveDashboard/components/ui/chart.js"),u=require("./ExecutiveDashboard/components/BarChart/BarChart.js"),h=require("./ExecutiveDashboard/components/BarChart/BarChartSkeleton.js"),C=require("./ExecutiveDashboard/components/BarChart/BarChartEmptyState.js"),D=require("./ExecutiveDashboard/components/BarChart/BarChartTooltip.js"),x=require("./ExecutiveDashboard/components/BarChart/utils.js"),R=require("./ExecutiveDashboard/components/BarChart/types.js"),b=require("./ExecutiveDashboard/components/PieChart/PieChart.js"),E=require("./ExecutiveDashboard/components/PieChart/PieChartSkeleton.js"),m=require("./ExecutiveDashboard/components/PieChart/PieChartEmptyState.js"),T=require("./ExecutiveDashboard/components/PieChart/PieChartTooltip.js"),S=require("./ExecutiveDashboard/components/PieChart/utils.js"),g=require("./ExecutiveDashboard/components/PieChart/types.js"),_=require("./ExecutiveDashboard/components/DashboardDateFilter/DashboardDateFilter.js"),O=require("./ExecutiveDashboard/components/RcaDecisionComponent/RcaDecisionComponent.js"),I=require("./ExecutiveDashboard/components/TopDriver/TopDriver.js"),v=require("./ExecutiveDashboard/components/Insights/InsightsContext.js"),j=require("./ExecutiveDashboard/components/Insights/DecisionAdvantageCard.js"),q=require("./ExecutiveDashboard/components/Insights/InsightTabs.js"),A=require("./ExecutiveDashboard/components/Insights/L1Report.js"),f=require("./ExecutiveDashboard/api/insightsApi.js"),L=require("./ExecutiveDashboard/components/MetricCard/MetricCard.js"),P=require("./ExecutiveDashboard/components/FiltersSidebar/FiltersSidebar.js"),F=require("./ExecutiveDashboard/components/Table/FTable.js"),G=require("./ExecutiveDashboard/components/Table/TableCard.js"),H=require("./ExecutiveDashboard/components/Table/TableGrid/TableGrid.js"),y=require("./ExecutiveDashboard/components/Table/TableGrid/TableLayoutToggle.js"),K=require("./ExecutiveDashboard/components/Table/TableGrid/useResponsiveColumns.js"),N=require("./ExecutiveDashboard/utils/chartCards.js"),M=require("./ExecutiveDashboard/utils/index.js"),U=require("./ExecutiveDashboard/components/DashboardDateFilter/datePreset.js"),B=require("./ExecutiveDashboard/components/DashboardCard/DashboardCard.js"),W=require("./ExecutiveDashboard/components/DashboardDateFilter/SubscriptionFeature/ReportSidebar.js"),V=require("./ExecutiveDashboard/components/common/ConfirmationModal.js"),Y=require("./ExecutiveDashboard/components/DashboardDateFilter/SubscriptionFeature/CreateSubscriptionModal.js"),w=require("./ExecutiveDashboard/components/TablePage/TablePage.js"),k=require("./HumanIntelligence/components/HumanChangesSummary/HumanChangesSummary.js"),X=require("./HumanIntelligence/components/HumanIntelligenceCard/HumanIntelligenceCard.js"),J=require("./HumanIntelligence/components/CognitiveDecisioning/CognitiveDecisioning.js"),z=require("./HumanIntelligence/components/PatternDetails/PatternDetails.js"),Q=require("./HumanIntelligence/components/CitationContent/CitationContent.js"),Z=require("./HumanIntelligence/components/Shared/ReusableTable.js"),$=require("./HumanIntelligence/components/LogFilters/LogFilters.js"),ee=require("./HumanIntelligence/components/LogFilters/LogFilterDropdown.js"),re=require("./HumanIntelligence/components/LogTable/LogTable.js"),oe=require("./HumanIntelligence/HumanChangesTableWrapper.js");require("./_virtual/_tslib.js"),require("react");var te=require("./RecordDashboard/RecordDashboardWrapper.js"),ae=require("./RecordDashboard/RecordComponents/RecordDashboard.js"),se=require("./RecordDashboard/RecordApi/RecordDashboardApi.js"),ie=require("./RecordDashboard/RecordUtils/RecordSectionOrder.js"),ne=require("./RecordDashboard/RecordComponents/Graph/RecordGraph.js"),de=require("./RecordDashboard/RecordComponents/Graph/RecordLineChart.js"),pe=require("./RecordDashboard/RecordComponents/Graph/RecordPlotBySelector.js"),ce=require("./RecordDashboard/RecordComponents/Graph/types.js"),le=require("./RecordDashboard/RecordComponents/ui/RecordChart.js"),ue=require("./RecordDashboard/RecordComponents/DashboardDateFilter/RecordDashboardDateFilter.js"),he=require("./RecordDashboard/RecordComponents/MetricCard/RecordMetricCard.js"),Ce=require("./RecordDashboard/RecordComponents/FiltersSidebar/RecordFiltersSidebar.js"),De=require("./RecordDashboard/RecordComponents/Table/RecordFTable.js"),xe=require("./RecordDashboard/RecordComponents/Table/RecordTableActionContext.js"),Re=require("./RecordDashboard/RecordComponents/Table/RecordTableCard.js"),be=require("./RecordDashboard/RecordComponents/Table/TableGrid/RecordTableGrid.js"),Ee=require("./RecordDashboard/RecordComponents/Table/TableGrid/RecordTableLayoutToggle.js"),me=require("./RecordDashboard/RecordComponents/Table/TableGrid/useRecordResponsiveColumns.js"),Te=require("./RecordDashboard/RecordComponents/AnalyticsChart/AnalyticsChart.js"),Se=require("./RecordDashboard/RecordComponents/TableHeader/TableHeader.js"),ge=require("./RecordDashboard/RecordComponents/Table/Pagination/TablePagination.js"),_e=require("./RecordDashboard/RecordComponents/StatsCard/RecordDashboardStats.js"),Oe=require("./RecordDashboard/RecordUtils/RecordTableColumns.js"),Ie=require("./RecordDashboard/RecordUtils/index.js"),ve=require("./RecordDashboard/RecordComponents/DashboardDateFilter/RecordDatePreset.js"),je=require("./RecordDashboard/RecordComponents/DashboardCard/RecordDashboardCard.js"),qe=require("./ExecutiveDashboard/components/Insights/insightsContextCore.js");exports.ExecutiveDashboardWrapper=e.ExecutiveDashboardWrapper,exports.ExecutiveDashboard_Container=e.ExecutiveDashboardWrapper,exports.ExecutiveDashboard=r.ExecutiveDashboard,exports.DashboardApiError=o.DashboardApiError,exports.fetchDashboardData=o.fetchDashboardData,exports.fetchTableData=o.fetchTableData,exports.fetchUIConfig=o.fetchUIConfig,exports.DASHBOARD_SECTION_KEYS=t.DASHBOARD_SECTION_KEYS,exports.PINNED_SECTION_KEYS=t.PINNED_SECTION_KEYS,exports.isSectionHidden=t.isSectionHidden,exports.resolveSectionOrder=t.resolveSectionOrder,exports.DashboardGrid=a.default,exports.DEFAULT_COLUMNS=s.DEFAULT_COLUMNS,exports.DEFAULT_GAP=s.DEFAULT_GAP,exports.DEFAULT_MIN_WIDTH=s.DEFAULT_MIN_WIDTH,exports.DEFAULT_ROW_HEIGHT=s.DEFAULT_ROW_HEIGHT,exports.MAX_COLUMNS=s.MAX_COLUMNS,exports.MAX_ROW_SPAN=s.MAX_ROW_SPAN,exports.buildWidgetIndex=s.buildWidgetIndex,exports.cellHeight=s.cellHeight,exports.packLayout=s.packLayout,exports.placeItems=s.placeItems,exports.resolveLayout=s.resolveLayout,exports.DECISION_WIDGET_KEY=i.DECISION_WIDGET_KEY,exports.GRAPH_WIDGET_KEY=i.GRAPH_WIDGET_KEY,exports.INSIGHT_TABS_WIDGET_KEY=i.INSIGHT_TABS_WIDGET_KEY,exports.buildDashboardWidgets=i.buildDashboardWidgets,exports.Graph=n.default,exports.LineChart=d.default,exports.PlotBySelector=p.default,exports.DEFAULT_COLORS=c.DEFAULT_COLORS,exports.colorForIndex=c.colorForIndex,exports.ChartContainer=l.ChartContainer,exports.ChartLegend=l.ChartLegend,exports.ChartLegendContent=l.ChartLegendContent,exports.ChartTooltip=l.ChartTooltip,exports.ChartTooltipContent=l.ChartTooltipContent,exports.useChart=l.useChart,exports.BarChart=u.default,exports.BarChartSkeleton=h.default,exports.BarChartEmptyState=C.default,exports.BarChartTooltip=D.default,exports.darken=x.darken,exports.parseColor=x.parseColor,exports.resolveBarColors=x.resolveBarColors,exports.sumValues=x.sumValues,exports.toBarChartData=x.toBarChartData,exports.withAlpha=x.withAlpha,exports.withIntensity=x.withIntensity,exports.wrapLabel=x.wrapLabel,exports.DEFAULT_BAR_COLOR=R.DEFAULT_BAR_COLOR,exports.PieChart=b.default,exports.PieChartSkeleton=E.default,exports.PieChartEmptyState=m.default,exports.PieChartTooltip=T.default,exports.groupTopSlices=S.groupTopSlices,exports.isPlottableSlice=S.isPlottableSlice,exports.percentOf=S.percentOf,exports.resolveSliceColors=S.resolveSliceColors,exports.sumSlices=S.sumSlices,exports.toPieChartData=S.toPieChartData,exports.DEFAULT_PIE_COLOR=g.DEFAULT_PIE_COLOR,exports.DashboardDateFilter=_.default,exports.RcaDecisionComponent=O.RcaDecisionComponent,exports.TopDriver=I.TopDriver,exports.InsightsProvider=v.InsightsProvider,exports.DecisionAdvantageCard=j.default,exports.InsightTabs=q.default,exports.L1Report=A.default,exports.L1ReportModal=A.L1ReportModal,exports.InsightsApiError=f.InsightsApiError,exports.deleteReportComment=f.deleteReportComment,exports.fetchInsightsJob=f.fetchInsightsJob,exports.fetchInsightsReport=f.fetchInsightsReport,exports.fetchInsightsSeries=f.fetchInsightsSeries,exports.fetchInsightsSummary=f.fetchInsightsSummary,exports.fetchLevelRows=f.fetchLevelRows,exports.fetchLevelSummary=f.fetchLevelSummary,exports.fetchReportComments=f.fetchReportComments,exports.generateInsightsReport=f.generateInsightsReport,exports.postReportComment=f.postReportComment,exports.saveInsightsAction=f.saveInsightsAction,exports.MetricCard=L.default,exports.FiltersSidebar=P.default,exports.FTable=F.default,exports.TableCard=G.default,exports.TableGrid=H.default,exports.TableLayoutToggle=y.default,exports.useResponsiveColumns=K.useResponsiveColumns,exports.formatChartValue=N.formatChartValue,exports.limitChartData=N.limitChartData,exports.toChartData=N.toChartData,exports.KPI_SENTIMENT_COLORS=M.KPI_SENTIMENT_COLORS,exports.formatKpiValue=M.formatKpiValue,exports.getKpiDelta=M.getKpiDelta,exports.getKpiSentiment=M.getKpiSentiment,exports.getKpiValueColor=M.getKpiValueColor,exports.isKpiValueObject=M.isKpiValueObject,exports.DATE_PRESETS=U.DATE_PRESETS,exports.DATE_PRESET_MAP=U.DATE_PRESET_MAP,exports.DEFAULT_DATE_PRESETS=U.DEFAULT_DATE_PRESETS,exports.DashboardCard=B.DashboardCard,exports.ReportSidebar=W.default,exports.ConfirmationModal=V.default,exports.CreateSubscriptionModal=Y.default,exports.TablePage=w.default,exports.HumanChangesSummary=k.HumanChangesSummary,exports.HumanIntelligenceCard=X.HumanIntelligenceCard,exports.CognitiveDecisioning=J.CognitiveDecisioning,exports.PatternDetails=z.PatternDetails,exports.CitationContent=Q.CitationContent,exports.ReusableTable=Z.ReusableTable,exports.LogFilters=$.default,exports.LogFilterDropdown=ee.default,exports.LogTable=re.default,exports.HumanChangesTableWrapper=oe.default,exports.RecordDashboardWrapper=te.RecordDashboardWrapper,exports.RecordDashboard_Container=te.RecordDashboardWrapper,exports.RecordDashboard=ae.RecordDashboard,exports.RECODashboardApiError=se.RECODashboardApiError,exports.RecordFetchDashboardData=se.RecordFetchDashboardData,exports.RecordFetchTableData=se.RecordFetchTableData,exports.RecordFetchUIConfig=se.RecordFetchUIConfig,exports.RECOIsSectionHidden=ie.RECOIsSectionHidden,exports.RECORD_DASHBOARD_SECTION_KEYS=ie.RECORD_DASHBOARD_SECTION_KEYS,exports.RECORD_PINNED_SECTION_KEYS=ie.RECORD_PINNED_SECTION_KEYS,exports.RECOResolveSectionOrder=ie.RECOResolveSectionOrder,exports.RecordGraph=ne.default,exports.RecordLineChart=de.default,exports.RecordPlotBySelector=pe.default,exports.RECOColorForIndex=ce.RECOColorForIndex,exports.RECODEFAULT_COLORS=ce.RECODEFAULT_COLORS,exports.RECOChartLegend=le.RECOChartLegend,exports.RECOChartLegendContent=le.RECOChartLegendContent,exports.RECOChartTooltip=le.RECOChartTooltip,exports.RECOChartTooltipContent=le.RECOChartTooltipContent,exports.RecordChartContainer=le.RecordChartContainer,exports.useRecordChart=le.useRecordChart,exports.RecordDashboardDateFilter=ue.default,exports.RecordMetricCard=he.default,exports.RecordFiltersSidebar=Ce.default,exports.RecordSidebarFilter=Ce.default,exports.RecordFTable=De.default,exports.useRecordTableActions=xe.useRecordTableActions,exports.RecordTableCard=Re.default,exports.RecordTableGrid=be.default,exports.RecordTableLayoutToggle=Ee.default,exports.useResponsiveRecordColumns=me.useRecordResponsiveColumns,exports.RecordAnalyticsChart=Te.default,exports.RecordTableHeader=Se.default,exports.RecordTablePagination=ge.default,exports.RecordDashboardStats=_e.default,exports.RECORenderDynamicCell=Oe.RECORenderDynamicCell,exports.RECOFormatKpiValue=Ie.RECOFormatKpiValue,exports.RECOGetKpiDelta=Ie.RECOGetKpiDelta,exports.RECOGetKpiSentiment=Ie.RECOGetKpiSentiment,exports.RECOGetKpiValueColor=Ie.RECOGetKpiValueColor,exports.RECOIsKpiValueObject=Ie.RECOIsKpiValueObject,exports.RECO_SENTIMENT_COLORS=Ie.RECO_SENTIMENT_COLORS,exports.RECO_DATE_PRESETS=ve.RECO_DATE_PRESETS,exports.RECO_DATE_PRESET_MAP=ve.RECO_DATE_PRESET_MAP,exports.RECO_DEFAULT_DATE_PRESETS=ve.RECO_DEFAULT_DATE_PRESETS,exports.RecordDashboardCard=je.RecordDashboardCard,exports.useInsights=qe.useInsights;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./ExecutiveDashboard/ExecutiveDashboardWrapper.js"),r=require("./ExecutiveDashboard/components/ExecutiveDashboard.js"),o=require("./ExecutiveDashboard/api/dashboardApi.js"),t=require("./ExecutiveDashboard/utils/sectionOrder.js"),a=require("./ExecutiveDashboard/components/DashboardGrid/DashboardGrid.js"),s=require("./ExecutiveDashboard/components/DashboardGrid/layout.js"),i=require("./ExecutiveDashboard/components/DashboardGrid/buildDashboardWidgets.js"),n=require("./ExecutiveDashboard/components/Graph/Graph.js"),d=require("./ExecutiveDashboard/components/Graph/LineChart.js"),p=require("./ExecutiveDashboard/components/Graph/PlotBySelector.js"),c=require("./ExecutiveDashboard/components/Graph/types.js"),l=require("./ExecutiveDashboard/components/ui/chart.js"),u=require("./ExecutiveDashboard/components/BarChart/BarChart.js"),h=require("./ExecutiveDashboard/components/BarChart/BarChartSkeleton.js"),C=require("./ExecutiveDashboard/components/BarChart/BarChartEmptyState.js"),D=require("./ExecutiveDashboard/components/BarChart/BarChartTooltip.js"),x=require("./ExecutiveDashboard/components/BarChart/utils.js"),R=require("./ExecutiveDashboard/components/BarChart/types.js"),b=require("./ExecutiveDashboard/components/PieChart/PieChart.js"),E=require("./ExecutiveDashboard/components/PieChart/PieChartSkeleton.js"),m=require("./ExecutiveDashboard/components/PieChart/PieChartEmptyState.js"),T=require("./ExecutiveDashboard/components/PieChart/PieChartTooltip.js"),S=require("./ExecutiveDashboard/components/PieChart/utils.js"),g=require("./ExecutiveDashboard/components/PieChart/types.js"),_=require("./ExecutiveDashboard/components/DashboardDateFilter/DashboardDateFilter.js"),O=require("./ExecutiveDashboard/components/RcaDecisionComponent/RcaDecisionComponent.js"),I=require("./ExecutiveDashboard/components/TopDriver/TopDriver.js"),v=require("./ExecutiveDashboard/components/Insights/InsightsContext.js"),j=require("./ExecutiveDashboard/components/Insights/DecisionAdvantageCard.js"),q=require("./ExecutiveDashboard/components/Insights/InsightTabs.js"),A=require("./ExecutiveDashboard/components/Insights/L1Report.js"),f=require("./ExecutiveDashboard/components/Insights/DrillTable.js"),L=require("./ExecutiveDashboard/api/insightsApi.js"),P=require("./ExecutiveDashboard/components/MetricCard/MetricCard.js"),F=require("./ExecutiveDashboard/components/FiltersSidebar/FiltersSidebar.js"),G=require("./ExecutiveDashboard/components/Table/FTable.js"),H=require("./ExecutiveDashboard/components/Table/TableCard.js"),y=require("./ExecutiveDashboard/components/Table/TableGrid/TableGrid.js"),K=require("./ExecutiveDashboard/components/Table/TableGrid/TableLayoutToggle.js"),N=require("./ExecutiveDashboard/components/Table/TableGrid/useResponsiveColumns.js"),M=require("./ExecutiveDashboard/utils/chartCards.js"),U=require("./ExecutiveDashboard/utils/index.js"),B=require("./ExecutiveDashboard/components/DashboardDateFilter/datePreset.js"),W=require("./ExecutiveDashboard/components/DashboardCard/DashboardCard.js"),V=require("./ExecutiveDashboard/components/DashboardDateFilter/SubscriptionFeature/ReportSidebar.js"),Y=require("./ExecutiveDashboard/components/common/ConfirmationModal.js"),w=require("./ExecutiveDashboard/components/DashboardDateFilter/SubscriptionFeature/CreateSubscriptionModal.js"),k=require("./ExecutiveDashboard/components/TablePage/TablePage.js"),X=require("./HumanIntelligence/components/HumanChangesSummary/HumanChangesSummary.js"),J=require("./HumanIntelligence/components/HumanIntelligenceCard/HumanIntelligenceCard.js"),z=require("./HumanIntelligence/components/CognitiveDecisioning/CognitiveDecisioning.js"),Q=require("./HumanIntelligence/components/PatternDetails/PatternDetails.js"),Z=require("./HumanIntelligence/components/CitationContent/CitationContent.js"),$=require("./HumanIntelligence/components/Shared/ReusableTable.js"),ee=require("./HumanIntelligence/components/LogFilters/LogFilters.js"),re=require("./HumanIntelligence/components/LogFilters/LogFilterDropdown.js"),oe=require("./HumanIntelligence/components/LogTable/LogTable.js"),te=require("./HumanIntelligence/HumanChangesTableWrapper.js");require("./_virtual/_tslib.js"),require("react");var ae=require("./RecordDashboard/RecordDashboardWrapper.js"),se=require("./RecordDashboard/RecordComponents/RecordDashboard.js"),ie=require("./RecordDashboard/RecordApi/RecordDashboardApi.js"),ne=require("./RecordDashboard/RecordUtils/RecordSectionOrder.js"),de=require("./RecordDashboard/RecordComponents/Graph/RecordGraph.js"),pe=require("./RecordDashboard/RecordComponents/Graph/RecordLineChart.js"),ce=require("./RecordDashboard/RecordComponents/Graph/RecordPlotBySelector.js"),le=require("./RecordDashboard/RecordComponents/Graph/types.js"),ue=require("./RecordDashboard/RecordComponents/ui/RecordChart.js"),he=require("./RecordDashboard/RecordComponents/DashboardDateFilter/RecordDashboardDateFilter.js"),Ce=require("./RecordDashboard/RecordComponents/MetricCard/RecordMetricCard.js"),De=require("./RecordDashboard/RecordComponents/FiltersSidebar/RecordFiltersSidebar.js"),xe=require("./RecordDashboard/RecordComponents/Table/RecordFTable.js"),Re=require("./RecordDashboard/RecordComponents/Table/RecordTableActionContext.js"),be=require("./RecordDashboard/RecordComponents/Table/RecordTableCard.js"),Ee=require("./RecordDashboard/RecordComponents/Table/TableGrid/RecordTableGrid.js"),me=require("./RecordDashboard/RecordComponents/Table/TableGrid/RecordTableLayoutToggle.js"),Te=require("./RecordDashboard/RecordComponents/Table/TableGrid/useRecordResponsiveColumns.js"),Se=require("./RecordDashboard/RecordComponents/AnalyticsChart/AnalyticsChart.js"),ge=require("./RecordDashboard/RecordComponents/TableHeader/TableHeader.js"),_e=require("./RecordDashboard/RecordComponents/Table/Pagination/TablePagination.js"),Oe=require("./RecordDashboard/RecordComponents/StatsCard/RecordDashboardStats.js"),Ie=require("./RecordDashboard/RecordUtils/RecordTableColumns.js"),ve=require("./RecordDashboard/RecordUtils/index.js"),je=require("./RecordDashboard/RecordComponents/DashboardDateFilter/RecordDatePreset.js"),qe=require("./RecordDashboard/RecordComponents/DashboardCard/RecordDashboardCard.js"),Ae=require("./ExecutiveDashboard/components/Insights/insightsContextCore.js");exports.ExecutiveDashboardWrapper=e.ExecutiveDashboardWrapper,exports.ExecutiveDashboard_Container=e.ExecutiveDashboardWrapper,exports.ExecutiveDashboard=r.ExecutiveDashboard,exports.DashboardApiError=o.DashboardApiError,exports.fetchDashboardData=o.fetchDashboardData,exports.fetchTableData=o.fetchTableData,exports.fetchUIConfig=o.fetchUIConfig,exports.DASHBOARD_SECTION_KEYS=t.DASHBOARD_SECTION_KEYS,exports.PINNED_SECTION_KEYS=t.PINNED_SECTION_KEYS,exports.isSectionHidden=t.isSectionHidden,exports.resolveSectionOrder=t.resolveSectionOrder,exports.DashboardGrid=a.default,exports.DEFAULT_COLUMNS=s.DEFAULT_COLUMNS,exports.DEFAULT_GAP=s.DEFAULT_GAP,exports.DEFAULT_MIN_WIDTH=s.DEFAULT_MIN_WIDTH,exports.DEFAULT_ROW_HEIGHT=s.DEFAULT_ROW_HEIGHT,exports.MAX_COLUMNS=s.MAX_COLUMNS,exports.MAX_ROW_SPAN=s.MAX_ROW_SPAN,exports.buildWidgetIndex=s.buildWidgetIndex,exports.cellHeight=s.cellHeight,exports.packLayout=s.packLayout,exports.placeItems=s.placeItems,exports.resolveLayout=s.resolveLayout,exports.DECISION_WIDGET_KEY=i.DECISION_WIDGET_KEY,exports.GRAPH_WIDGET_KEY=i.GRAPH_WIDGET_KEY,exports.INSIGHT_TABS_WIDGET_KEY=i.INSIGHT_TABS_WIDGET_KEY,exports.buildDashboardWidgets=i.buildDashboardWidgets,exports.Graph=n.default,exports.LineChart=d.default,exports.PlotBySelector=p.default,exports.DEFAULT_COLORS=c.DEFAULT_COLORS,exports.colorForIndex=c.colorForIndex,exports.ChartContainer=l.ChartContainer,exports.ChartLegend=l.ChartLegend,exports.ChartLegendContent=l.ChartLegendContent,exports.ChartTooltip=l.ChartTooltip,exports.ChartTooltipContent=l.ChartTooltipContent,exports.useChart=l.useChart,exports.BarChart=u.default,exports.BarChartSkeleton=h.default,exports.BarChartEmptyState=C.default,exports.BarChartTooltip=D.default,exports.darken=x.darken,exports.parseColor=x.parseColor,exports.resolveBarColors=x.resolveBarColors,exports.sumValues=x.sumValues,exports.toBarChartData=x.toBarChartData,exports.withAlpha=x.withAlpha,exports.withIntensity=x.withIntensity,exports.wrapLabel=x.wrapLabel,exports.DEFAULT_BAR_COLOR=R.DEFAULT_BAR_COLOR,exports.PieChart=b.default,exports.PieChartSkeleton=E.default,exports.PieChartEmptyState=m.default,exports.PieChartTooltip=T.default,exports.groupTopSlices=S.groupTopSlices,exports.isPlottableSlice=S.isPlottableSlice,exports.percentOf=S.percentOf,exports.resolveSliceColors=S.resolveSliceColors,exports.sumSlices=S.sumSlices,exports.toPieChartData=S.toPieChartData,exports.DEFAULT_PIE_COLOR=g.DEFAULT_PIE_COLOR,exports.DashboardDateFilter=_.default,exports.RcaDecisionComponent=O.RcaDecisionComponent,exports.TopDriver=I.TopDriver,exports.InsightsProvider=v.InsightsProvider,exports.DecisionAdvantageCard=j.default,exports.InsightTabs=q.default,exports.L1Report=A.default,exports.L1ReportModal=A.L1ReportModal,exports.DrillTable=f.default,exports.InsightsApiError=L.InsightsApiError,exports.deleteReportComment=L.deleteReportComment,exports.fetchInsightsJob=L.fetchInsightsJob,exports.fetchInsightsReport=L.fetchInsightsReport,exports.fetchInsightsSeries=L.fetchInsightsSeries,exports.fetchInsightsSummary=L.fetchInsightsSummary,exports.fetchLevelRows=L.fetchLevelRows,exports.fetchLevelSummary=L.fetchLevelSummary,exports.fetchReportComments=L.fetchReportComments,exports.generateInsightsReport=L.generateInsightsReport,exports.postReportComment=L.postReportComment,exports.saveInsightsAction=L.saveInsightsAction,exports.MetricCard=P.default,exports.FiltersSidebar=F.default,exports.FTable=G.default,exports.TableCard=H.default,exports.TableGrid=y.default,exports.TableLayoutToggle=K.default,exports.useResponsiveColumns=N.useResponsiveColumns,exports.formatChartValue=M.formatChartValue,exports.limitChartData=M.limitChartData,exports.toChartData=M.toChartData,exports.KPI_SENTIMENT_COLORS=U.KPI_SENTIMENT_COLORS,exports.formatKpiValue=U.formatKpiValue,exports.getKpiDelta=U.getKpiDelta,exports.getKpiSentiment=U.getKpiSentiment,exports.getKpiValueColor=U.getKpiValueColor,exports.isKpiValueObject=U.isKpiValueObject,exports.DATE_PRESETS=B.DATE_PRESETS,exports.DATE_PRESET_MAP=B.DATE_PRESET_MAP,exports.DEFAULT_DATE_PRESETS=B.DEFAULT_DATE_PRESETS,exports.DashboardCard=W.DashboardCard,exports.ReportSidebar=V.default,exports.ConfirmationModal=Y.default,exports.CreateSubscriptionModal=w.default,exports.TablePage=k.default,exports.HumanChangesSummary=X.HumanChangesSummary,exports.HumanIntelligenceCard=J.HumanIntelligenceCard,exports.CognitiveDecisioning=z.CognitiveDecisioning,exports.PatternDetails=Q.PatternDetails,exports.CitationContent=Z.CitationContent,exports.ReusableTable=$.ReusableTable,exports.LogFilters=ee.default,exports.LogFilterDropdown=re.default,exports.LogTable=oe.default,exports.HumanChangesTableWrapper=te.default,exports.RecordDashboardWrapper=ae.RecordDashboardWrapper,exports.RecordDashboard_Container=ae.RecordDashboardWrapper,exports.RecordDashboard=se.RecordDashboard,exports.RECODashboardApiError=ie.RECODashboardApiError,exports.RecordFetchDashboardData=ie.RecordFetchDashboardData,exports.RecordFetchTableData=ie.RecordFetchTableData,exports.RecordFetchUIConfig=ie.RecordFetchUIConfig,exports.RECOIsSectionHidden=ne.RECOIsSectionHidden,exports.RECORD_DASHBOARD_SECTION_KEYS=ne.RECORD_DASHBOARD_SECTION_KEYS,exports.RECORD_PINNED_SECTION_KEYS=ne.RECORD_PINNED_SECTION_KEYS,exports.RECOResolveSectionOrder=ne.RECOResolveSectionOrder,exports.RecordGraph=de.default,exports.RecordLineChart=pe.default,exports.RecordPlotBySelector=ce.default,exports.RECOColorForIndex=le.RECOColorForIndex,exports.RECODEFAULT_COLORS=le.RECODEFAULT_COLORS,exports.RECOChartLegend=ue.RECOChartLegend,exports.RECOChartLegendContent=ue.RECOChartLegendContent,exports.RECOChartTooltip=ue.RECOChartTooltip,exports.RECOChartTooltipContent=ue.RECOChartTooltipContent,exports.RecordChartContainer=ue.RecordChartContainer,exports.useRecordChart=ue.useRecordChart,exports.RecordDashboardDateFilter=he.default,exports.RecordMetricCard=Ce.default,exports.RecordFiltersSidebar=De.default,exports.RecordSidebarFilter=De.default,exports.RecordFTable=xe.default,exports.useRecordTableActions=Re.useRecordTableActions,exports.RecordTableCard=be.default,exports.RecordTableGrid=Ee.default,exports.RecordTableLayoutToggle=me.default,exports.useResponsiveRecordColumns=Te.useRecordResponsiveColumns,exports.RecordAnalyticsChart=Se.default,exports.RecordTableHeader=ge.default,exports.RecordTablePagination=_e.default,exports.RecordDashboardStats=Oe.default,exports.RECORenderDynamicCell=Ie.RECORenderDynamicCell,exports.RECOFormatKpiValue=ve.RECOFormatKpiValue,exports.RECOGetKpiDelta=ve.RECOGetKpiDelta,exports.RECOGetKpiSentiment=ve.RECOGetKpiSentiment,exports.RECOGetKpiValueColor=ve.RECOGetKpiValueColor,exports.RECOIsKpiValueObject=ve.RECOIsKpiValueObject,exports.RECO_SENTIMENT_COLORS=ve.RECO_SENTIMENT_COLORS,exports.RECO_DATE_PRESETS=je.RECO_DATE_PRESETS,exports.RECO_DATE_PRESET_MAP=je.RECO_DATE_PRESET_MAP,exports.RECO_DEFAULT_DATE_PRESETS=je.RECO_DEFAULT_DATE_PRESETS,exports.RecordDashboardCard=qe.RecordDashboardCard,exports.useInsights=Ae.useInsights;
2
2
  //# sourceMappingURL=index.js.map