@firestitch/report 18.6.1 → 18.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/app/reports/components/component-chart/component-chart.component.d.ts +6 -7
  2. package/app/reports/components/component-kpi/component-kpi.component.d.ts +17 -9
  3. package/app/reports/components/component-kpi/components/sparkline/sparkline.component.d.ts +8 -0
  4. package/app/reports/components/component-list/component-list.component.d.ts +39 -10
  5. package/app/reports/components/component-note/component-note.component.d.ts +12 -0
  6. package/app/reports/components/report-canvas/report-canvas.component.d.ts +0 -10
  7. package/app/reports/components/report-component/report-component.component.d.ts +5 -12
  8. package/app/reports/data/report.data.d.ts +2 -3
  9. package/app/reports/dialogs/component-settings/component-settings.component.d.ts +34 -2
  10. package/app/reports/dialogs/list-columns/list-columns.component.d.ts +23 -0
  11. package/app/reports/dialogs/report-settings/report-locale-patch.d.ts +5 -0
  12. package/app/reports/dialogs/report-settings/report-settings.component.d.ts +20 -2
  13. package/app/reports/enums/report-change-polarity.enum.d.ts +5 -0
  14. package/app/reports/enums/report-chart-color.enum.d.ts +12 -0
  15. package/app/reports/enums/report-chart-data-labels.enum.d.ts +6 -0
  16. package/app/reports/enums/report-chart-date-label.enum.d.ts +5 -0
  17. package/app/reports/enums/report-chart-line-style.enum.d.ts +5 -0
  18. package/app/reports/enums/report-chart-mark-stat.enum.d.ts +6 -0
  19. package/app/reports/enums/report-kpi-trend.enum.d.ts +5 -0
  20. package/app/reports/enums/report-list-column-format.enum.d.ts +6 -0
  21. package/app/reports/enums/report-number-units.enum.d.ts +6 -0
  22. package/app/reports/enums/report-value-format.enum.d.ts +5 -0
  23. package/app/reports/export/offscreen-chart.d.ts +2 -2
  24. package/app/reports/export/report-export-collector.service.d.ts +37 -8
  25. package/app/reports/export/report-pdf.service.d.ts +6 -0
  26. package/app/reports/export/report-pptx.service.d.ts +24 -0
  27. package/app/reports/format.d.ts +64 -3
  28. package/app/reports/interfaces/report-chat-viewer-filter.interface.d.ts +2 -0
  29. package/app/reports/interfaces/report.interface.d.ts +205 -14
  30. package/app/reports/kpi-card.d.ts +48 -0
  31. package/app/reports/layout.d.ts +0 -9
  32. package/app/reports/list-config.d.ts +16 -0
  33. package/app/reports/option-builder.d.ts +76 -9
  34. package/app/reports/output-notes.d.ts +14 -0
  35. package/app/reports/pipes/report-date.pipe.d.ts +2 -1
  36. package/app/reports/pipes/report-number.pipe.d.ts +8 -0
  37. package/app/reports/pipes/report-output.pipe.d.ts +10 -0
  38. package/app/reports/report-filter-items.d.ts +5 -2
  39. package/app/reports/report-url-state.d.ts +4 -0
  40. package/app/reports/services/report-filter-state.service.d.ts +27 -2
  41. package/app/reports/theme/palette.d.ts +6 -0
  42. package/app/reports/theme/typography.d.ts +2 -0
  43. package/esm2022/app/reports/components/component-chart/component-chart.component.mjs +23 -20
  44. package/esm2022/app/reports/components/component-kpi/component-kpi.component.mjs +56 -29
  45. package/esm2022/app/reports/components/component-kpi/components/sparkline/sparkline.component.mjs +19 -0
  46. package/esm2022/app/reports/components/component-list/component-list.component.mjs +218 -32
  47. package/esm2022/app/reports/components/component-note/component-note.component.mjs +30 -0
  48. package/esm2022/app/reports/components/report-canvas/report-canvas.component.mjs +7 -61
  49. package/esm2022/app/reports/components/report-component/report-component.component.mjs +99 -100
  50. package/esm2022/app/reports/data/report.data.mjs +20 -7
  51. package/esm2022/app/reports/dialogs/component-settings/component-settings.component.mjs +133 -13
  52. package/esm2022/app/reports/dialogs/list-columns/list-columns.component.mjs +56 -0
  53. package/esm2022/app/reports/dialogs/report-settings/report-locale-patch.mjs +13 -0
  54. package/esm2022/app/reports/dialogs/report-settings/report-settings.component.mjs +138 -20
  55. package/esm2022/app/reports/enums/report-change-polarity.enum.mjs +11 -0
  56. package/esm2022/app/reports/enums/report-chart-color.enum.mjs +19 -0
  57. package/esm2022/app/reports/enums/report-chart-data-labels.enum.mjs +13 -0
  58. package/esm2022/app/reports/enums/report-chart-date-label.enum.mjs +13 -0
  59. package/esm2022/app/reports/enums/report-chart-line-style.enum.mjs +12 -0
  60. package/esm2022/app/reports/enums/report-chart-mark-stat.enum.mjs +12 -0
  61. package/esm2022/app/reports/enums/report-kpi-trend.enum.mjs +10 -0
  62. package/esm2022/app/reports/enums/report-list-column-format.enum.mjs +14 -0
  63. package/esm2022/app/reports/enums/report-number-units.enum.mjs +14 -0
  64. package/esm2022/app/reports/enums/report-value-format.enum.mjs +13 -0
  65. package/esm2022/app/reports/export/offscreen-chart.mjs +5 -4
  66. package/esm2022/app/reports/export/report-export-collector.service.mjs +186 -40
  67. package/esm2022/app/reports/export/report-pdf.service.mjs +332 -67
  68. package/esm2022/app/reports/export/report-pptx.service.mjs +765 -106
  69. package/esm2022/app/reports/format.mjs +917 -57
  70. package/esm2022/app/reports/interfaces/report-chat-viewer-filter.interface.mjs +1 -1
  71. package/esm2022/app/reports/interfaces/report.interface.mjs +1 -1
  72. package/esm2022/app/reports/kpi-card.mjs +174 -0
  73. package/esm2022/app/reports/layout.mjs +1 -46
  74. package/esm2022/app/reports/list-config.mjs +106 -0
  75. package/esm2022/app/reports/option-builder.mjs +1457 -117
  76. package/esm2022/app/reports/output-notes.mjs +158 -0
  77. package/esm2022/app/reports/pipes/report-date.pipe.mjs +7 -6
  78. package/esm2022/app/reports/pipes/report-number.pipe.mjs +25 -0
  79. package/esm2022/app/reports/pipes/report-output.pipe.mjs +28 -0
  80. package/esm2022/app/reports/report-filter-items.mjs +28 -3
  81. package/esm2022/app/reports/report-url-state.mjs +56 -15
  82. package/esm2022/app/reports/services/report-filter-state.service.mjs +274 -22
  83. package/esm2022/app/reports/theme/echarts.mjs +8 -2
  84. package/esm2022/app/reports/theme/palette.mjs +35 -1
  85. package/esm2022/app/reports/theme/typography.mjs +8 -1
  86. package/esm2022/app/reports/views/report/fs-ai-report.component.mjs +2 -2
  87. package/esm2022/app/reports/views/report/report.component.mjs +3 -4
  88. package/esm2022/public_api.mjs +10 -1
  89. package/fesm2022/{firestitch-report-echarts-Djtmaxj1.mjs → firestitch-report-echarts-qCBE3LqM.mjs} +9 -3
  90. package/fesm2022/firestitch-report-echarts-qCBE3LqM.mjs.map +1 -0
  91. package/fesm2022/{firestitch-report-firestitch-report-D3zseBZc.mjs → firestitch-report-firestitch-report-DbsWbE-j.mjs} +5523 -875
  92. package/fesm2022/firestitch-report-firestitch-report-DbsWbE-j.mjs.map +1 -0
  93. package/fesm2022/firestitch-report.mjs +1 -1
  94. package/package.json +1 -1
  95. package/public_api.d.ts +9 -0
  96. package/fesm2022/firestitch-report-echarts-Djtmaxj1.mjs.map +0 -1
  97. package/fesm2022/firestitch-report-firestitch-report-D3zseBZc.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"firestitch-report-firestitch-report-D3zseBZc.mjs","sources":["../../src/app/reports/data/report.data.ts","../../src/app/reports/layout.ts","../../src/app/reports/interfaces/report.interface.ts","../../src/app/reports/report-filter-items.ts","../../src/app/reports/consts/report-week.const.ts","../../src/app/reports/format.ts","../../src/app/reports/report-url-state.ts","../../src/app/reports/services/report-filter-state.service.ts","../../src/app/reports/text.ts","../../src/app/reports/theme/palette.ts","../../src/app/reports/theme/typography.ts","../../src/app/reports/option-builder.ts","../../src/app/reports/components/component-chart/component-chart.component.ts","../../src/app/reports/components/component-chart/component-chart.component.html","../../src/app/reports/components/component-kpi/component-kpi.component.ts","../../src/app/reports/components/component-kpi/component-kpi.component.html","../../src/app/reports/pipes/report-date.pipe.ts","../../src/app/reports/components/component-list/component-list.component.ts","../../src/app/reports/components/component-list/component-list.component.html","../../src/app/reports/components/component-text/component-text.component.ts","../../src/app/reports/components/component-text/component-text.component.html","../../src/app/reports/components/report-component/report-component.component.ts","../../src/app/reports/components/report-component/report-component.component.html","../../src/app/reports/components/report-canvas/report-canvas.component.ts","../../src/app/reports/components/report-canvas/report-canvas.component.html","../../src/app/reports/dialogs/component-settings/component-settings.component.ts","../../src/app/reports/dialogs/component-settings/component-settings.component.html","../../src/app/reports/components/timezone-select/timezone-select.component.ts","../../src/app/reports/components/timezone-select/timezone-select.component.html","../../src/app/reports/dialogs/report-settings/report-settings.component.ts","../../src/app/reports/dialogs/report-settings/report-settings.component.html","../../src/app/reports/export/report-export-collector.service.ts","../../src/app/reports/export/offscreen-chart.ts","../../src/app/reports/export/report-pdf.service.ts","../../src/app/reports/export/report-pptx.service.ts","../../src/app/reports/export/report-export.service.ts","../../src/app/reports/services/report.service.ts","../../src/app/reports/views/report/report.component.ts","../../src/app/reports/views/report/report.component.html","../../src/app/reports/dialogs/instruction-history/instruction-history.component.ts","../../src/app/reports/dialogs/instruction-history/instruction-history.component.html","../../src/app/reports/dialogs/global-settings/components/ai-knowledge/ai-knowledge.component.ts","../../src/app/reports/dialogs/global-settings/components/ai-knowledge/ai-knowledge.component.html","../../src/app/reports/dialogs/global-settings/components/general/general.component.ts","../../src/app/reports/dialogs/global-settings/components/general/general.component.html","../../src/app/reports/dialogs/entity-functions/entity-functions.component.ts","../../src/app/reports/dialogs/entity-functions/entity-functions.component.html","../../src/app/reports/dialogs/global-settings/components/semantic-database/semantic-database.component.ts","../../src/app/reports/dialogs/global-settings/components/semantic-database/semantic-database.component.html","../../src/app/reports/dialogs/global-settings/global-settings.component.ts","../../src/app/reports/dialogs/global-settings/global-settings.component.html","../../src/app/reports/views/reports/fs-ai-reports.component.ts","../../src/app/reports/views/reports/fs-ai-reports.component.html","../../src/app/reports/data/report-ai-chat.data.ts","../../src/app/reports/views/report/fs-ai-report.component.ts","../../src/app/reports/views/report/fs-ai-report.component.html","../../src/public_api.ts","../../src/firestitch-report.ts"],"sourcesContent":["import { Injectable, inject } from '@angular/core';\n\nimport { FsApi, RequestConfig } from '@firestitch/api';\n\nimport { Observable } from 'rxjs';\n\nimport {\n ChartGranularity,\n ComponentDataState,\n ComponentExportResponse,\n FilterGroupDefault,\n ReportComponentSql,\n ReportFilterLevel,\n ReportTree,\n ResolvedFilterValue,\n} from '../interfaces/report.interface';\n\n\n// API gateway for the Reports module. Every endpoint hangs off [basePath],\n// which defaults to \"reports\" (the framework reports backend at /api/reports)\n// and can be repointed by the host so the package stays self-contained and portable.\n@Injectable({\n providedIn: 'root',\n})\nexport class ReportData<T = any> {\n private _api = inject(FsApi);\n\n // The API root for every reports endpoint. Defaults to the framework reports\n // context; set it once (e.g. from the host's report page) to mount elsewhere.\n public basePath = 'reports';\n\n // Build an endpoint path under the configured base, e.g. _path() => \"ai/reports\",\n // _path(`${id}/pages`) => \"ai/reports/123/pages\".\n private _path(suffix = ''): string {\n return suffix ? `${this.basePath}/${suffix}` : this.basePath;\n }\n\n public reports(query: any = {}, config: RequestConfig = {}): Observable<T> {\n return this._api.get(\n this._path(),\n query,\n {\n key: 'reports',\n ...config,\n },\n );\n }\n\n // Both halves of the listing — reports AND the folders they are filed into —\n // from the one GET. No `key`, because the whole payload is the answer here;\n // reports() keeps its 'reports' key for callers that only want the flat list.\n public tree(query: any = {}, config: RequestConfig = {}): Observable<ReportTree> {\n return this._api.get(\n this._path(),\n query,\n config,\n );\n }\n\n public create(name: string, reportFolderId: number = null, config: RequestConfig = {}): Observable<T> {\n return this._api.post(\n this._path(),\n { name, reportFolderId },\n {\n key: 'report',\n ...config,\n },\n );\n }\n\n // File a report under a folder, or pass null to move it to the root. Sent\n // explicitly (never omitted) so the backend can tell \"move to root\" from\n // \"leave the folder alone\".\n public moveReport(reportId: number, reportFolderId: number | null, config: RequestConfig = {}): Observable<T> {\n return this._api.put(\n this._path(`${reportId}`),\n { reportFolderId },\n {\n key: 'report',\n ...config,\n },\n );\n }\n\n public createFolder(\n name: string,\n parentReportFolderId: number = null,\n config: RequestConfig = {},\n ): Observable<T> {\n return this._api.post(\n this._path('folders'),\n { name, parentReportFolderId },\n {\n key: 'folder',\n ...config,\n },\n );\n }\n\n // Rename and/or move a folder. Only the keys passed are acted on server-side,\n // so a rename never disturbs the parent and a drag never disturbs the name.\n public updateFolder(\n reportFolderId: number,\n folder: Record<string, unknown>,\n config: RequestConfig = {},\n ): Observable<T> {\n return this._api.put(\n this._path(`folders/${reportFolderId}`),\n folder,\n {\n key: 'folder',\n ...config,\n },\n );\n }\n\n // Soft-delete, whatever the folder holds: its contents leave the listing with\n // it, and undeleteFolder() brings the lot back.\n public deleteFolder(reportFolderId: number, config: RequestConfig = {}): Observable<T> {\n return this._api.delete(\n this._path(`folders/${reportFolderId}`),\n {},\n {\n key: 'folder',\n ...config,\n },\n );\n }\n\n // Restore a soft-deleted folder through its own action endpoint — the folder\n // PUT does not accept `state`. Any deleted folder above it is restored too, so\n // it lands back where it was.\n public undeleteFolder(reportFolderId: number, config: RequestConfig = {}): Observable<T> {\n return this._api.post(\n this._path(`folders/${reportFolderId}/undelete`),\n {},\n {\n key: 'folder',\n ...config,\n },\n );\n }\n\n public rename(reportId: number, name: string, config: RequestConfig = {}): Observable<T> {\n return this._api.put(\n this._path(`${reportId}`),\n { name },\n {\n key: 'report',\n ...config,\n },\n );\n }\n\n // Report settings: any subset of { name, pageWidth, pageHeight, layout,\n // styles, headerFooter } — styles carry the report's typographic config (e.g.\n // heading size), headerFooter the header/footer band depths in inches. The\n // page size is in inches and width/height go together.\n public update(reportId: number, settings: Record<string, unknown>, config: RequestConfig = {}): Observable<T> {\n return this._api.put(\n this._path(`${reportId}`),\n settings,\n {\n key: 'report',\n ...config,\n },\n );\n }\n\n // Append a blank page to the report; resolves to the new page.\n public addPage(reportId: number, config: RequestConfig = {}): Observable<T> {\n return this._api.post(\n this._path(`${reportId}/pages`),\n {},\n {\n key: 'page',\n ...config,\n },\n );\n }\n\n // Any subset of { name, masterHidden }. An empty name is stored as null\n // server-side, which puts the tab back on its positional \"Page N\" label;\n // masterHidden hides the report's header and footer on this page.\n public updatePage(\n reportId: number,\n pageId: number,\n page: { name?: string; masterHidden?: boolean },\n config: RequestConfig = {},\n ): Observable<T> {\n return this._api.put(\n this._path(`${reportId}/pages/${pageId}`),\n page,\n {\n key: 'page',\n ...config,\n },\n );\n }\n\n // Delete a page and everything on it. Refused server-side for the last\n // remaining page — a report with no canvas is a deleted report, not a page\n // operation.\n public deletePage(reportId: number, pageId: number, config: RequestConfig = {}): Observable<T> {\n return this._api.delete(\n this._path(`${reportId}/pages/${pageId}`),\n {},\n {\n key: 'page',\n ...config,\n },\n );\n }\n\n // Persist the tab order after a drag — the whole list, in its new order, so\n // the sequence stays gapless without the server inferring the move.\n public savePagePositions(\n reportId: number,\n positions: { pageId: number; order: number }[],\n config: RequestConfig = {},\n ): Observable<T> {\n return this._api.put(\n this._path(`${reportId}/pages/positions`),\n { positions },\n {\n key: null,\n ...config,\n },\n );\n }\n\n // Component settings: any subset of { title, padding } — the human-facing\n // dialog edits — or a text block's { html } from its inline editor; geometry\n // (x/y/w/h/flowWidth) is persisted via savePositions from the canvas instead.\n public updateComponent(\n reportId: number,\n componentId: number,\n settings: Record<string, unknown>,\n config: RequestConfig = {},\n ): Observable<T> {\n return this._api.put(\n this._path(`${reportId}/components/${componentId}/settings`),\n settings,\n {\n key: 'component',\n ...config,\n },\n );\n }\n\n // Place a text block — on a page, or in the header/footer when pageId is\n // omitted. The only component the UI creates itself: charts, lists and KPIs\n // need a query and come from the chat. Resolves to { id }.\n public addText(\n reportId: number,\n text: { pageId?: number; html?: string; x: number; y: number; w: number; h: number },\n config: RequestConfig = {},\n ): Observable<T> {\n return this._api.post(\n this._path(`${reportId}/components`),\n text,\n {\n key: 'component',\n ...config,\n },\n );\n }\n\n // Delete one component from the canvas, together with its filters and any\n // filter group they leave empty. Soft server-side, but there is no restore\n // anywhere in the UI, so the dialog's confirm presents it as permanent.\n public deleteComponent(\n reportId: number,\n componentId: number,\n config: RequestConfig = {},\n ): Observable<T> {\n return this._api.delete(\n this._path(`${reportId}/components/${componentId}`),\n {},\n {\n key: 'component',\n ...config,\n },\n );\n }\n\n // Soft-delete: the report leaves the listing but keeps its pages and\n // components, so undelete() brings back the same document.\n public delete(reportId: number, config: RequestConfig = {}): Observable<T> {\n return this._api.delete(\n this._path(`${reportId}`),\n {},\n {\n key: 'report',\n ...config,\n },\n );\n }\n\n // Restore a soft-deleted report through its own action endpoint — the report\n // PUT does not accept `state`. Its folder is restored too when it is deleted,\n // or inside one that is, so the report lands back where it was.\n public undelete(reportId: number, config: RequestConfig = {}): Observable<T> {\n return this._api.post(\n this._path(`${reportId}/undelete`),\n {},\n {\n key: 'report',\n ...config,\n },\n );\n }\n\n // The assembled structure: pages → components (+ their filters) and the\n // report's filter groups.\n public get(reportId: number, config: RequestConfig = {}): Observable<T> {\n return this._api.get(\n this._path(`${reportId}`),\n {},\n {\n key: 'report',\n ...config,\n },\n );\n }\n\n // Persist geometry for the moved components only — any subset of\n // { x, y, w, h } (inches), flowWidth (percent) and order (flow position).\n public savePositions(\n reportId: number,\n positions: ({ componentId: number } & Partial<{ x: number; y: number; w: number; h: number; flowWidth: number; order: number }>)[],\n config: RequestConfig = {},\n ): Observable<T> {\n return this._api.put(\n this._path(`${reportId}/components/positions`),\n { positions },\n {\n key: null,\n ...config,\n },\n );\n }\n\n // One component's data. The body carries everything session-scoped: the\n // resolved filter values and the component's own interaction state.\n //\n // `isExport` marks the read as part of a PDF/PowerPoint render. The server\n // gives those a longer per-statement ceiling than an on-screen tile, because\n // a reader watching an export progress bar can wait for a query nobody would\n // tolerate waiting for on a dashboard.\n public componentData(\n reportId: number,\n componentId: number,\n filters: ResolvedFilterValue[] = [],\n state: ComponentDataState = {},\n isExport = false,\n config: RequestConfig = {},\n ): Observable<T> {\n return this._api.post(\n this._path(`${reportId}/components/${componentId}/data`),\n { filters, state, export: isExport },\n {\n key: 'data',\n ...config,\n },\n );\n }\n\n // Exports one component to CSV server-side: the file is what the screen\n // shows (a chart or KPI as rendered, a list in full in the screen's order).\n // The backend streams percentage progress while it writes.\n //\n // key: null on purpose, unlike the key: 'url' presigned-export pattern: the\n // response also carries `notes`, the sentences saying how the file falls\n // short of the full result, and the caller has to show them before it hands\n // the url to FsProcess.download.\n public exportComponent(\n reportId: number,\n componentId: number,\n filters: ResolvedFilterValue[] = [],\n state: ComponentDataState = {},\n config: RequestConfig = {},\n ): Observable<ComponentExportResponse> {\n return this._api.post(\n this._path(`${reportId}/components/${componentId}/export`),\n { filters, state },\n {\n key: null,\n ...config,\n },\n );\n }\n\n // Exports EVERY component on the report — or on one page — server-side and\n // resolves to a presigned URL for a zip of one CSV per component, foldered by\n // page, plus an 'Export Notes.txt'. `filters` carries the resolved values for\n // every component together; each one picks out its own. `frequency` is the\n // report's group-by grain (the server re-buckets only time-series charts to\n // it), and `filterSummary` is the filter bar as the viewer reads it, written\n // verbatim into the notes file. Same keep-alive contract as exportComponent,\n // over a longer run; consume through FsProcess.download.\n public exportReport(\n reportId: number,\n filters: ResolvedFilterValue[] = [],\n pageId: number | null = null,\n frequency: ChartGranularity | null = null,\n filterSummary: string[] = [],\n config: RequestConfig = {},\n ): Observable<T> {\n return this._api.post(\n this._path(`${reportId}/export`),\n {\n filters,\n ...(pageId ? { pageId } : {}),\n ...(frequency ? { frequency } : {}),\n filterSummary,\n },\n {\n key: 'url',\n ...config,\n },\n );\n }\n\n // Distinct options for a select filter (drives multiselect controls).\n public filterOptions(reportId: number, filterId: number, config: RequestConfig = {}): Observable<T> {\n return this._api.get(\n this._path(`${reportId}/filters/${filterId}/options`),\n {},\n {\n key: 'options',\n ...config,\n },\n );\n }\n\n // The statement a component runs, for the SQL tab.\n //\n // Fetched rather than read off the component, because a DERIVED component has\n // no stored SQL — it stores a document, and its statement only exists once\n // the backend compiles that document. Compiled per request, for the one\n // component being looked at, so opening a report never pays for it.\n //\n // `key: null` because the whole envelope is the answer here: a stale document\n // comes back as { sql: null, error, errorType } and unwrapping one field\n // would throw the diagnosis away.\n public componentSql(\n reportId: number,\n componentId: number,\n config: RequestConfig = {},\n ): Observable<ReportComponentSql> {\n return this._api.get(\n this._path(`${reportId}/components/${componentId}/sql`),\n {},\n {\n key: null,\n ...config,\n },\n );\n }\n\n // The component SQL's filterable output columns — drives the column picker\n // in the filter UI so a column name is never typed by hand.\n public componentColumns(reportId: number, componentId: number, config: RequestConfig = {}): Observable<T> {\n return this._api.get(\n this._path(`${reportId}/components/${componentId}/columns`),\n {},\n {\n key: 'columns',\n ...config,\n },\n );\n }\n\n // Make one column filterable. `level` (component | report) places a new\n // group; `groupId` instead links into an existing group. A select filter's\n // options are derived from the component SQL when optionsSql is omitted.\n public addFilter(\n reportId: number,\n componentId: number,\n filter: { filterColumn: string; type?: string; label?: string; level?: string; optionsSql?: string; groupId?: number },\n config: RequestConfig = {},\n ): Observable<T> {\n return this._api.post(\n this._path(`${reportId}/components/${componentId}/filters`),\n filter,\n {\n key: 'filter',\n ...config,\n },\n );\n }\n\n // Update a filter — any subset of { label, optionsSql, enabled }.\n public updateFilter(\n reportId: number,\n filterId: number,\n changes: { label?: string; optionsSql?: string; enabled?: boolean },\n config: RequestConfig = {},\n ): Observable<T> {\n return this._api.put(\n this._path(`${reportId}/filters/${filterId}`),\n changes,\n {\n key: 'filter',\n ...config,\n },\n );\n }\n\n // Remove a filter (its group goes too when nothing else uses it).\n public deleteFilter(reportId: number, filterId: number, config: RequestConfig = {}): Observable<T> {\n return this._api.delete(\n this._path(`${reportId}/filters/${filterId}`),\n {},\n {\n key: 'filter',\n ...config,\n },\n );\n }\n\n // The global AI knowledge document (operator-authored agent instructions)\n // and its full version history: { instructions, versions }.\n public instructions(config: RequestConfig = {}): Observable<T> {\n return this._api.get(\n this._path('instructions'),\n {},\n {\n key: null,\n ...config,\n },\n );\n }\n\n // Save a new version of the document (append-only; an unchanged save is a\n // no-op server-side). Resolves to the same { instructions, versions } shape.\n public saveInstructions(content: string, config: RequestConfig = {}): Observable<T> {\n return this._api.put(\n this._path('instructions'),\n { content },\n {\n key: null,\n ...config,\n },\n );\n }\n\n // Make an earlier version of the document current (no new row is created).\n public restoreInstruction(instructionId: number, config: RequestConfig = {}): Observable<T> {\n return this._api.post(\n this._path(`instructions/${instructionId}/restore`),\n {},\n {\n key: null,\n ...config,\n },\n );\n }\n\n // Run a semantic-database build, streamed: emits an event per NDJSON frame\n // ({ kind: 'log', line, percent } feed lines and { kind: 'section' } phase\n // markers) and completes when the build ends. Feed the lines into FsProcess.\n public semanticBuild(config: RequestConfig = {}): Observable<any> {\n return this._api.stream(\n 'POST',\n this._path('semantic/build'),\n { stream: true },\n config,\n );\n }\n\n // Latest build status + entity scoreboard: { build, detail }.\n public semanticBuildStatus(config: RequestConfig = {}): Observable<T> {\n return this._api.get(\n this._path('semantic/build'),\n {},\n {\n key: null,\n ...config,\n },\n );\n }\n\n // Stop the running build (the current semantic database stays in place).\n public semanticBuildStop(config: RequestConfig = {}): Observable<T> {\n return this._api.post(\n this._path('semantic/build/stop'),\n {},\n {\n key: 'build',\n ...config,\n },\n );\n }\n\n // One entity's cached AI-classified code functions — loaded on expand, one\n // entity at a time, because the full set across all entities is far too big\n // to ship inside the scoreboard call.\n public semanticEntityFunctions(entity: string, config: RequestConfig = {}): Observable<T> {\n return this._api.get(\n this._path(`semantic/entities/${entity}/functions`),\n {},\n {\n key: 'entityFunctions',\n ...config,\n },\n );\n }\n\n // The report module's General settings (semantic-build concurrency + its bounds).\n public settings(config: RequestConfig = {}): Observable<T> {\n return this._api.get(\n this._path('settings'),\n {},\n {\n key: 'settings',\n ...config,\n },\n );\n }\n\n // Save the General settings; resolves to the same { settings } shape.\n public saveSettings(settings: { semanticBuildConcurrency: number }, config: RequestConfig = {}): Observable<T> {\n return this._api.put(\n this._path('settings'),\n settings,\n {\n key: 'settings',\n ...config,\n },\n );\n }\n\n // Update a filter group — its exposure level ('component' | 'report' | 'both')\n // and/or its default value (the value seeding the report bar on open). Send\n // `default: null` (or an empty default) to clear it. Only the keys provided\n // are changed.\n public updateFilterGroup(\n reportId: number,\n groupId: number,\n changes: { level?: ReportFilterLevel; default?: FilterGroupDefault | null },\n config: RequestConfig = {},\n ): Observable<T> {\n return this._api.put(\n this._path(`${reportId}/filtergroups/${groupId}`),\n changes,\n {\n key: 'filterGroup',\n ...config,\n },\n );\n }\n}\n","import { Report, ReportComponent, ReportPage } from './interfaces/report.interface';\n\n\n// Page padding for flow layout, inches — mirrored by the canvas CSS.\nexport const FLOW_PADDING = 0.25;\n\n// Default content padding around a component's body, inches (1/8\").\nexport const DEFAULT_COMPONENT_PADDING = 0.125;\n\n// Default report heading size, points (1/72\"). Applies to component titles.\nexport const DEFAULT_HEADING_SIZE = 16;\n\nexport interface ComponentGeometry {\n x: number;\n y: number;\n w: number;\n h: number;\n}\n\n// Resolved geometry (inches) for every component on a page, in BOTH layout\n// modes — the single definition the PPT and PDF exports lay out from:\n//\n// Freeform: the stored x/y/w/h verbatim.\n// Flow: components in `order`, each flowWidth% of the content width,\n// wrapping into rows (a row breaks when the next component would\n// exceed 100%); row height = the tallest component in the row.\n// Matches the canvas's flex-wrap rendering.\nexport function pageGeometry(report: Report, page: ReportPage): Map<number, ComponentGeometry> {\n const geometry = new Map<number, ComponentGeometry>();\n\n if (report.layout !== 'flow') {\n for (const component of page.components) {\n geometry.set(component.id, {\n x: component.x, y: component.y, w: component.w, h: component.h,\n });\n }\n\n return geometry;\n }\n\n const contentW = report.pageWidth - FLOW_PADDING * 2;\n const sorted = [...page.components].sort((a, b) => (a.order - b.order) || (a.y - b.y) || (a.x - b.x));\n\n let cursorX = 0; // fraction of contentW consumed in the current row\n let rowTop = FLOW_PADDING;\n let rowHeight = 0;\n\n for (const component of sorted) {\n const fraction = Math.min(100, Math.max(10, component.flowWidth ?? 50)) / 100;\n\n // Wrap when this component doesn't fit the remainder (small tolerance for\n // 33.33+33.33+33.33 style splits).\n if (cursorX + fraction > 1.001) {\n rowTop += rowHeight;\n cursorX = 0;\n rowHeight = 0;\n }\n\n geometry.set(component.id, {\n x: FLOW_PADDING + cursorX * contentW,\n y: rowTop,\n w: fraction * contentW,\n h: component.h,\n });\n\n cursorX += fraction;\n rowHeight = Math.max(rowHeight, component.h);\n }\n\n return geometry;\n}\n\n// Bounds for a page dimension, in inches. Mirrors ReportModel::PAGE_DIMENSION_MIN\n// / MAX on the server, which is the enforcing side — these drive the field-level\n// message so the operator sees the limit before submitting. The ceiling is set by\n// PowerPoint, not by the canvas: ECMA-376 caps a slide at 56 inches, and a .pptx\n// over that is refused on open, so a page is not allowed to be sized past what it\n// can be exported as.\nexport const PAGE_DIMENSION_MIN = 1;\nexport const PAGE_DIMENSION_MAX = 50;\n\n// The deepest a header or footer band may be, in inches. Mirrors\n// ReportHeaderFooter::MAX_HEIGHT on the server, which clamps.\nexport const HEADER_FOOTER_MAX = 3;\n","// The assembled report structure returned by GET /api/reports/:id — composed\n// server-side from the normalized tables (reports → report_pages →\n// report_components + report_filters, plus report_filter_groups). All keys are\n// camelCase; component `config` is the standard format the renderer maps to\n// ECharts options / FsList config.\n\n// Layout modes: Freeform = absolutely positioned components (drag anywhere);\n// Flow = components flow like rows, each taking flowWidth % of the page width.\nexport type ReportLayout = 'freeform' | 'flow';\n\nexport interface Report {\n id: number;\n name: string;\n layout: ReportLayout;\n // The report's own stored IANA zone (e.g. America/New_York). null = the\n // report follows the application's default reporting zone.\n timezone: string | null;\n // The zone every date filter, time bucket and date cell of this report uses.\n // Resolved server-side; the same for every viewer, export and the assistant.\n // Optional only because older servers omit it; resolveReportTimezone() then\n // falls back to the report's own `timezone`, then the browser's zone. Resolve\n // the zone for rendering through resolveReportTimezone() (format.ts); read the\n // field directly only to check whether the server sent it.\n effectiveTimezone?: string;\n // How the server sends a percent measure: 'ratio' = a 0-1 ratio (0.385 reads\n // 38.5%). Absent on older servers, whose percent values are already x100\n // (38.5 reads 38.5%).\n percentFormat?: 'ratio';\n // Report-level config: typographic styles, etc. (camelCase JSON column).\n config: ReportConfig;\n // The page in INCHES (the report's native unit — PDFs and PowerPoint are\n // inch-based, so exports are dimensionally exact). Orientation is not a field\n // of its own: a page wider than it is tall IS landscape.\n pageWidth: number;\n pageHeight: number;\n pages: ReportPage[];\n // The header and footer: the report's master page, whose components draw\n // under every page that does not hide them (PowerPoint's slide master). Null\n // until anything has been placed in them.\n master: ReportMaster | null;\n filterGroups: ReportFilterGroup[];\n}\n\nexport interface ReportMaster {\n id: number;\n components: ReportComponent[];\n}\n\n// The depth of the header band (top of every page) and the footer band (bottom\n// of every page), in INCHES. The bands hold no content of their own — the\n// master's components sit in them — they are the reserved margins the editor\n// draws as guides and snaps to. Always arrives resolved (0 = no band).\nexport interface ReportHeaderFooter {\n headerHeight: number;\n footerHeight: number;\n}\n\n// Report-level styling. Sizes are in POINTS (1/72\") — the report's typography\n// maps 1:1 to PDF (72pt/in) and PowerPoint (point font sizes), so a point\n// value is dimensionally exact on screen and in every export.\nexport interface ReportConfig {\n styles?: ReportStyles;\n // The report's group-by control. Optional on the type because a ReportConfig\n // literal need not carry it; the API always sends it, resolved.\n groupBy?: ReportGroupBy;\n // Resolved by the API like groupBy.\n headerFooter?: ReportHeaderFooter;\n}\n\n// The report's group-by control — the one switch that re-buckets every\n// time-series chart on the report between day, week, month, quarter and year.\n//\n// It is NOT a filter: a filter narrows which rows are counted, this changes how\n// the surviving rows are bucketed. It shares the report's filter bar because\n// that is the one row of controls a viewer reads a report through — the\n// separation that matters is in the model, not in where the control is painted.\n//\n// Always arrives RESOLVED (the backend fills an absent or partial stored block\n// in from its own defaults), so there is nothing to default here — render what\n// you are given.\nexport interface ReportGroupBy {\n enabled: boolean;\n label: string;\n granularities: ChartGranularity[];\n}\n\nexport interface ReportStyles {\n heading?: { size?: number };\n}\n\n// Content padding around a component's body, in INCHES (the geometry unit).\nexport interface ComponentPadding {\n top?: number;\n right?: number;\n bottom?: number;\n left?: number;\n}\n\nexport interface ReportPage {\n id: number;\n name: string | null;\n order: number;\n // The page opts out of the report's header and footer (a title page).\n masterHidden: boolean;\n components: ReportComponent[];\n}\n\n// 'text' is authored rich text with no query behind it — it never fetches data.\nexport type ReportComponentType = 'chart' | 'list' | 'kpi' | 'text';\n\nexport interface ReportComponent {\n id: number;\n type: ReportComponentType;\n title: string | null;\n // Geometry in INCHES. Freeform: absolute position on the page canvas.\n // Flow: only flowWidth/order apply; x/y are remembered for a switch back to\n // freeform.\n x: number;\n y: number;\n w: number;\n h: number;\n // Height mode, DERIVED from type server-side (not stored, read-only): lists\n // and KPI tiles are auto (the box sizes to its content, `h` ignored); charts\n // are always fixed (use `h`) so they fit the box and never overflow.\n autoHeight: boolean;\n // Flow layout: % of the page content width this component takes.\n flowWidth: number;\n // Flow layout ordering.\n order: number;\n // The stored SQL of a legacy sql-mode component. NULL for a derived one,\n // whose statement does not exist until its document is compiled — the SQL tab\n // fetches that separately (see ReportComponentSql).\n sql: string | null;\n config: ChartConfig & ListConfig & KpiConfig & TextConfig & ComponentLayoutConfig & Record<string, unknown>;\n filters: ReportFilter[];\n}\n\n// What the SQL tab fetches: the statement a component runs.\n//\n// For a derived component `baseline` is true and `sql` is what its document\n// compiles to with NO viewer state — no filters, the authored grain. The\n// numbers on screen come from that statement plus whatever the viewer picked,\n// so the two can legitimately differ and the tab says so rather than implying\n// they match.\n//\n// `timezone` is the IANA zone the statement was compiled in: the report's\n// effective zone. Optional because older servers omit it; they compiled in UTC.\n//\n// `error` is not a failure of the request: a document that no longer compiles\n// is precisely what someone opens this tab to discover, so it arrives as a\n// message to render with `errorType` naming which kind ('stale-query' or\n// 'sensitive-column'), and `sql` null.\nexport interface ReportComponentSql {\n sql: string | null;\n origin: 'sql' | 'dbq' | 'derived';\n baseline: boolean;\n timezone?: string;\n error: string | null;\n errorType: string | null;\n}\n\n// A text block's content: an html fragment the server has already rebuilt from\n// an allowlist, which may carry {{page.number}}, {{page.name}} and\n// {{report.name}} tokens (see text.ts).\nexport interface TextConfig {\n html?: string;\n}\n\n// Cross-type layout/style keys carried in a component's config (alongside the\n// type-specific chart/list/kpi keys).\nexport interface ComponentLayoutConfig {\n padding?: ComponentPadding;\n}\n\n// The presentation settings a component's settings dialog edits. Neither field\n// is part of what the component queries, so a change to them repaints without\n// re-running anything.\nexport interface ComponentSettings {\n title: string;\n padding: ComponentPadding;\n}\n\n// Where a chart's legend sits relative to the plot, or 'hidden' to drop it.\nexport type LegendPosition = 'top' | 'bottom' | 'left' | 'right' | 'hidden';\n\nexport type ChartGranularity = 'day' | 'week' | 'month' | 'quarter' | 'year';\n\n// How each granularity reads in the group-by control and on an export cover\n// sheet. WHICH of them a given report offers comes from its ReportGroupBy;\n// this is only the naming. 'year' reads as \"Annually\".\nexport const GRANULARITY_OPTIONS: { value: ChartGranularity; name: string }[] = [\n { value: 'day', name: 'Day' },\n { value: 'week', name: 'Week' },\n { value: 'month', name: 'Month' },\n { value: 'quarter', name: 'Quarter' },\n { value: 'year', name: 'Annually' },\n];\n\n// The chart types that plot series against a category and a value axis, and so\n// the types a measure's own series can be drawn as. A waterfall has the same\n// axes but is not one of them: it draws its one measure as floating steps.\nexport type AxisChartType = 'bar' | 'line' | 'area';\n\n// What one bar of a waterfall does to the running total — each is drawn in its\n// own color. The closing total is the last bar, standing on zero.\nexport type WaterfallStepKind = 'rise' | 'fall' | 'total';\n\nexport interface ChartConfig {\n // A waterfall takes ONE measure whose value per category is how far the\n // running total moves there: each bar starts where the one before it ended,\n // and a closing Total bar shows the sum.\n chartType?: AxisChartType | 'waterfall' | 'pie' | 'donut';\n // For kind 'time', the server buckets the raw datetime column to `granularity`\n // in the report's timezone (the SQL exposes the raw column, unbucketed).\n xAxis?: { column: string; kind?: 'category' | 'time'; granularity?: ChartGranularity; label?: string };\n measures?: ChartMeasure[];\n // Each value of this column becomes its own series. It carries no label: the\n // legend names the values themselves.\n splitBy?: { column: string };\n // Single-dimension bar charts only: color each bar by its own category and\n // show a legend, WITHOUT splitting into multiple series (which slivers the\n // bars). v1 expects colorBy.column === xAxis.column. Ignored when splitBy is\n // set or the chart isn't a bar chart.\n colorBy?: { column: string; label?: string };\n orientation?: 'vertical' | 'horizontal';\n stacked?: boolean;\n legend?: LegendPosition;\n sort?: ReportSort;\n limit?: number;\n}\n\nexport interface ChartMeasure {\n column: string;\n aggregation?: 'sum' | 'count' | 'avg' | 'min' | 'max';\n label?: string;\n // Draws this measure's series as a different type from the chart's own\n // chartType — counts as bars with a rate as a line over them is a combo\n // chart. Omitted, the series takes the chart's type. Axis charts only (a pie\n // ignores it), and every series shares the chart's one value axis.\n type?: AxisChartType;\n // Applied to a KPI's single value only — it is aggregated server-side after\n // the SQL runs, so the SQL cannot format it. Chart measures stay numeric.\n // percent expects a 0-1 ratio (0.3 renders as 30%) when the report's\n // percentFormat is 'ratio'; an older server leaves it out and sends x100.\n format?: 'number' | 'percent' | 'currency';\n // How many decimal places the value is shown to. Fixed rather than maximum:\n // a column of rates is unreadable when each one shows a different number of\n // decimals. For percent it counts the decimals of the percentage (precision\n // 1 shows 0.3 as 30.0%). Omitted leaves the format's own default: at most\n // one decimal for percent, the locale's default otherwise.\n //\n // It cannot be applied in the SQL: the value is aggregated after the report's\n // filters run, so pre-rounding would break live re-filtering by date range or\n // partner.\n precision?: number;\n}\n\nexport interface ListConfig {\n // A list cell renders the value verbatim: percent signs, currency symbols,\n // thousands separators and decimal places are produced by the component's\n // SQL (the backend rejects any other `format` here). `date` is the exception\n // — a date column stays a RAW timestamp so the report timezone and its\n // dateRange filters keep working, and the viewer localises it at render.\n // A SQL-formatted column is text, so it names `sortColumn`: the raw numeric\n // alias the query also outputs, which the server orders by instead.\n columns?: { column: string; label?: string; format?: 'date'; sortColumn?: string }[];\n // A cross-tab: `rowBy` stays down the side and every value of `pivotBy`\n // becomes a column. The two are set together, `columns` is omitted (the\n // backend rejects authoring both), and the column set arrives with the rows\n // in ComponentData.columns because only the result knows the pivot values.\n // rowBy.label heads the side column on screen and in every export, and\n // defaults to the column name. pivotBy carries no label: its values are the\n // headings.\n rowBy?: { column: string; label?: string };\n pivotBy?: { column: string };\n sort?: ReportSort;\n pageSize?: number;\n}\n\nexport interface KpiConfig {\n measure?: ChartMeasure;\n}\n\nexport interface ReportSort {\n column: string;\n direction?: 'asc' | 'desc';\n}\n\nexport type ReportFilterType = 'dateRange' | 'select' | 'keyword';\n\n// Where a filter group's control is exposed. A group can be shown on its\n// components, in the report bar, or BOTH at once (the two are independent\n// toggles in the UI); a column with neither exposed simply has no filter.\nexport type ReportFilterLevel = 'component' | 'report' | 'both';\n\n// One filterable output column of a component's SQL, with the filter interface\n// INFERRED from its data (the human never picks the interface — it follows the\n// column's type). Drives the Filters tab listing.\nexport interface ReportFilterableColumn {\n column: string;\n type: ReportFilterType;\n}\n\n// Ground truth: one filterable output column ON one component's SQL. Always a\n// member of a filter group — the unit that links equivalent filters across\n// components and decides where the control renders (component vs report bar).\nexport interface ReportFilter {\n id: number;\n componentId: number;\n filterGroupId: number;\n filterColumn: string;\n label: string | null;\n enabled: boolean;\n hasOptions: boolean;\n config: Record<string, unknown>;\n}\n\n// One choice in a select filter's option list. The value is what the filter\n// matches on and gets stored in a saved default — for an entity that is its\n// stable id, never its name, so renaming the entity moves the label without\n// breaking the default. The label is only ever what the viewer reads.\nexport interface ReportFilterOption {\n value: unknown;\n label: string;\n}\n\nexport interface ReportFilterGroup {\n id: number;\n label: string | null;\n type: ReportFilterType;\n level: ReportFilterLevel;\n order: number;\n config: { default?: FilterGroupDefault } & Record<string, unknown>;\n filters: ReportFilter[];\n}\n\n// A filter group's authored default — the value that seeds the report bar on\n// every open. Shape follows the group's type: dateRange uses start/end (a fixed\n// calendar-day range) or a relative preset; select uses values; keyword uses\n// value.\nexport interface FilterGroupDefault {\n // dateRange relative preset, resolved on every open against today in the\n // report's effective zone (Report.effectiveTimezone). One of: thisWeek,\n // lastWeek, last7Days, last30Days, last3Months, last6Months, last12Months,\n // thisMonth, thisQuarter, thisYear/yearToDate. Weeks run Monday to Sunday,\n // the same weeks the server's weekly time buckets use.\n relative?: string;\n start?: string; // dateRange fixed start (yyyy-MM-dd)\n end?: string; // dateRange fixed end (yyyy-MM-dd)\n values?: unknown[]; // select default picked values\n value?: string; // keyword default text\n}\n\n// The session value of a filter group: shape depends on the group's type. Not\n// stored on the server; the viewer's URL carries the values that differ from\n// the defaults (report-url-state.ts).\nexport interface FilterGroupValue {\n start?: Date | string | null; // dateRange\n end?: Date | string | null; // dateRange\n values?: unknown[]; // select\n value?: string; // keyword\n // dateRange only: the relative preset name these dates were resolved from\n // (a FilterGroupDefault.relative name). Set only when the value was seeded\n // from the group's relative default or read from a preset name in the URL,\n // so the URL keeps the range rolling ('last30Days') instead of freezing two\n // dates. Any date picked by the viewer, a picker shortcut included, is\n // stored without it.\n preset?: string;\n}\n\n// The viewer-state query params of a report URL, as raw strings, before they\n// are checked against the report (report-url-state.ts readReportUrlParams).\nexport interface ReportUrlParams {\n // g<groupId> -> the encoded group value ('' = the viewer cleared it).\n groups: Map<number, string>;\n // s<componentId> -> the encoded list sort ('-column' = descending).\n listSorts: Map<number, string>;\n // The group-by grain, or null when the URL has none.\n groupBy: string | null;\n}\n\n// The viewer state the URL should carry: only what differs from the report's\n// authored defaults (ReportFilterStateService.urlSnapshot).\nexport interface ReportUrlSnapshot {\n // A group's value, or null when the viewer cleared a group that has a default.\n groups: Map<number, FilterGroupValue | null>;\n // A list's sort, by component id, when it differs from the authored sort.\n listSorts: Map<number, ReportSort>;\n frequency: ChartGranularity | null;\n}\n\n// One resolved filter sent with a component's data request.\nexport interface ResolvedFilterValue {\n filterId: number;\n start?: string;\n end?: string;\n values?: unknown[];\n value?: string;\n}\n\n// Per-component interaction state sent with the data request: lists send\n// sort/paging; time-series charts send the grain picked on the report's group-by\n// control, which overrides the authored granularity for that request only. The\n// wire key stays `frequency` — it is the bucketing frequency the server applies.\nexport interface ComponentDataState {\n sort?: ReportSort;\n page?: number;\n pageSize?: number;\n frequency?: ChartGranularity;\n}\n\nexport interface ComponentData {\n columns: string[];\n rows: Record<string, unknown>[];\n paging?: { total: number; page: number; pageSize: number };\n truncated: boolean;\n // The effective time bucket the rows were grouped into (after any group-by\n // override), or null for a non-time axis. Drives the compact x-axis labels.\n granularity?: ChartGranularity | null;\n}\n\n// A component's CSV export: the presigned download URL, plus one sentence per\n// way the file falls short of the full result (cut at the export ceiling, or\n// cut as the chart itself is). Empty when the file is complete. Optional\n// because a server on an older framework answers with the url alone.\nexport interface ComponentExportResponse {\n url: string;\n notes?: string[];\n}\n\nexport interface ReportListItem {\n id: number;\n name: string;\n modifyDate: string;\n state?: ReportState;\n // The folder the report is filed under. null is a real, common value — the\n // report sits at the root of the listing tree alongside the folders.\n //\n // Optional like `state` beside it: the backend always sends it, but making it\n // required is a breaking type change for every consumer holding a\n // ReportListItem literal (fixtures, mocks) and buys nothing — the listing\n // reads it as `?? null` either way.\n reportFolderId?: number | null;\n}\n\n// One folder in the listing tree — an audience bucket (\"Management\",\n// \"Operations\") reports are filed into. Folders nest via parentReportFolderId;\n// reports never do, so the tree's only branch nodes are folders.\n//\n// `state` is the folder's OWN state. Deleting a folder writes only that, and\n// everything below it counts as deleted by position — see ReportNode.deleted.\nexport interface ReportFolder {\n id: number;\n name: string;\n parentReportFolderId: number | null;\n state?: ReportState;\n}\n\n// GET /api/reports returns both halves flat; the listing nests them itself.\nexport interface ReportTree {\n reports: ReportListItem[];\n folders: ReportFolder[];\n}\n\nexport enum ReportNodeType {\n Folder = 'folder',\n Report = 'report',\n}\n\n// One node as fs-tree sees it. Folders and reports share one id space in the\n// view, so the ids are prefixed ('f:12' / 'r:34') — `id` is the original,\n// per-table id that the API endpoints take.\nexport interface ReportNode {\n key: string;\n id: number;\n name: string;\n type: ReportNodeType;\n // Only ever populated on a folder; a report is always a leaf.\n children: ReportNode[];\n // Present on report nodes only.\n report?: ReportListItem;\n // The node's own row is deleted. What earns the \"Deleted\" chip — this is\n // what somebody actually deleted.\n stateDeleted: boolean;\n // Deleted itself OR anywhere below a deleted folder. Only ever true in Show\n // Deleted mode (the default listing never returns such a node), and it is what\n // swaps the row's actions for Restore.\n deleted: boolean;\n}\n\n// Reports and folders are both soft-deletable. A deleted report keeps its pages\n// and components; a deleted folder keeps everything filed under it, which leaves\n// the listing with it and comes back with it. \"Show Deleted\" shows the whole\n// tree, live and deleted together, so any of it can be restored in place.\nexport enum ReportState {\n Active = 'active',\n Deleted = 'deleted',\n}\n\n// The chat turn flags this context's backend adds (Reports\\AiView).\nexport interface ReportChatResponse {\n reportChanged?: boolean;\n reportRenamed?: boolean;\n}\n\n// One version of the global AI knowledge document — the operator-authored\n// markdown appended to the report agent's system instructions on every turn.\nexport interface ReportInstruction {\n id: number;\n content: string;\n current: boolean;\n createDate: Date;\n modifyDate: Date;\n accountId: number | null;\n accountName: string | null;\n}\n\n// GET/PUT instructions payload: the current version (null until one is\n// authored) plus the full history, newest first.\nexport interface ReportInstructions {\n instructions: ReportInstruction | null;\n versions: ReportInstruction[];\n}\n\n// The latest semantic-database build (an ff_processes row) — enough for the\n// settings dialog to say what state the build is in and when it last ran.\nexport interface SemanticBuild {\n id: number;\n state: string;\n percent: number | string;\n message: string;\n duration: number;\n createDate: Date;\n startDate: Date;\n endDate: Date;\n}\n\n// A build stage's state on the entity scoreboard: 'done' = built, 'missing' =\n// still needs building (a missing stage is unbuilt content, never an error).\nexport type SemanticBuildStage = 'done' | 'missing';\n\n// One enum column of an entity, with the allowed values the build inlined.\nexport interface SemanticBuildEnum {\n column: string;\n values: string[];\n}\n\n// One entity row of the scoreboard (an entity = a table + a model + a\n// handler): its table/shape counts, inlined enum values, computed fields, how\n// many code functions were cached (split model vs handler), and the per-stage\n// built/missing state.\n//\n// `model`/`handler` are the classes the functions were read from — what a\n// reader recognizes the row by, where `key` is what the report AI addresses it\n// by in describe_entity / compile_query.\nexport interface SemanticBuildEntity {\n key: string;\n table: string;\n model: string | null;\n handler: string | null;\n columns: number;\n relationships: number;\n enums: SemanticBuildEnum[];\n computedFields: string[];\n functionCount: number;\n modelFunctionCount: number;\n handlerFunctionCount: number;\n stages: Record<string, SemanticBuildStage>;\n}\n\n// One standalone code class the build read: domain logic with no table of its\n// own (a summary model, a calculation service). The report AI reads its code\n// exactly like an entity's, but it can never be queried — there is nothing to\n// select from — so it carries no table, columns or relationships.\nexport interface SemanticBuildClass {\n key: string;\n model: string | null;\n functionCount: number;\n}\n\n// What the build decided a physical table is. Entity and junction are both\n// reachable by the report AI — an entity directly, a junction through the\n// many-to-many it bridges. Excluded is not reachable at all.\nexport type SemanticTableClassification = 'entity' | 'junction' | 'excluded';\n\n// One physical table as the build classified it. `reason` answers a single\n// question — why can't the report AI see this table? — and is null when it can.\n// A junction with a reason bridged nothing, so it is just as invisible as an\n// excluded table.\nexport interface SemanticBuildTable {\n table: string;\n classification: SemanticTableClassification;\n model: string | null;\n reason: string | null;\n}\n\n// The build scoreboard shipped alongside the build status: the summary counts,\n// the full breakdown the settings dialog drills into — BOTH kinds of unit the\n// build caches, table-backed entities and standalone code classes — and the\n// catalog of every table the build saw, so the tab can show what the report AI\n// can't see, not just what it can.\n//\n// `functionCount` spans entities and classes alike: it is the same total the\n// build itself reports when it finishes.\n//\n// `tables` is empty for an artifact built before the catalog existed. Read that\n// as \"no catalog\", never as \"nothing was excluded\".\nexport interface SemanticBuildDetail {\n // Whether the artifact was produced by a build that ran to the end. Read it\n // beside `generatedAt`, never instead of it: the structural artifact is\n // published BEFORE the AI function pass, so a build whose AI pass failed still\n // carries a date and a full set of counts. The date says something was\n // written; only this says the build finished writing it.\n complete: boolean;\n generatedAt: Date | null;\n entityCount: number;\n classCount: number;\n functionCount: number;\n entities: SemanticBuildEntity[];\n classes: SemanticBuildClass[];\n tableCount: number;\n junctionCount: number;\n unlinkedJunctionCount: number;\n excludedCount: number;\n tables: SemanticBuildTable[];\n}\n\n// Which class a cached function was read from. An entity's cache splits into\n// 'model' and 'handler'; a standalone code class has one group, 'class'.\nexport type SemanticFunctionSource = 'model' | 'handler' | 'class';\n\n// One AI-classified code function from a model, handler or standalone class:\n// what kind of logic it is, what it does, and what it produces — the build's\n// cached \"what the code does\" knowledge shown in the functions dialog.\nexport interface SemanticEntityFunction {\n class: string;\n method: string;\n signature: string;\n kind: string;\n summary: string;\n produces: string;\n source: SemanticFunctionSource;\n}\n\n// One entity's cached code-function knowledge, fetched when a functions dialog\n// opens (the full set across all entities is too big to ship with the\n// scoreboard). One payload serves both dialogs — consumers filter by source.\nexport interface SemanticEntityFunctions {\n entity: string;\n generatedAt: Date | null;\n modelClass: string | null;\n handlerClass: string | null;\n functions: SemanticEntityFunction[];\n}\n\nexport interface SemanticBuildStatus {\n build: SemanticBuild | null;\n detail: SemanticBuildDetail;\n}\n\n// The report module's General settings (a small global key/value store, the\n// reporting counterpart of the app-wide settings). Each value ships with the\n// safe band its editor field is bounded to.\nexport interface ReportSettings {\n // How many summary calls the semantic build runs at once.\n semanticBuildConcurrency: number;\n semanticBuildConcurrencyMin: number;\n semanticBuildConcurrencyMax: number;\n}\n","import { IFilterConfigItem, ItemType } from '@firestitch/filter';\n\nimport { format, parseISO } from 'date-fns';\n\nimport { Observable, of } from 'rxjs';\nimport { map, shareReplay } from 'rxjs/operators';\n\nimport { ReportData } from './data/report.data';\nimport {\n ChartGranularity, FilterGroupValue, GRANULARITY_OPTIONS, Report, ReportFilterGroup, ReportFilterOption,\n} from './interfaces/report.interface';\n\n\n// A date-range boundary as the picked LOCAL calendar day (no time, no tz).\n// Date-range filters are calendar-day semantics, so the boundary must carry\n// only Y-M-D — never a timezone-bearing instant the backend would shift.\nexport function dateBoundString(value: Date | string | null | undefined): string | undefined {\n if (value instanceof Date) {\n return format(value, 'yyyy-MM-dd');\n }\n\n // Authored/relative defaults arrive as strings already in Y-M-D form;\n // keep just the date portion.\n return value ? String(value).slice(0, 10) : undefined;\n}\n\n\n// A date-range boundary as it should READ on a cover page — the same calendar\n// day dateBoundString() hands the server, so a printed period can never name a\n// different day than the numbers under it were filtered by. Returns null when\n// there is no boundary; the caller supplies its own placeholder.\n//\n// The parse has to be parseISO, not `new Date`: `new Date('2026-05-01')` is UTC\n// midnight, so formatting it anywhere west of UTC prints Apr 30. parseISO reads\n// a bare Y-M-D as LOCAL midnight, which no offset can shift.\nexport function dateBoundLabel(value: Date | string | null | undefined): string | null {\n const bound = dateBoundString(value);\n\n if (!bound) {\n return null;\n }\n\n const date = parseISO(bound);\n\n return Number.isNaN(date.getTime()) ? String(value) : format(date, 'MMM d, yyyy');\n}\n\n\n// A stored yyyy-MM-dd boundary as a local Date for a date picker, or null.\n// parseISO reads a bare Y-M-D as LOCAL midnight, so the picker shows the day\n// that was stored, whatever the browser's zone.\nexport function dateFromBound(value: string | null | undefined): Date | null {\n if (!value) {\n return null;\n }\n\n const date = parseISO(value.slice(0, 10));\n\n return Number.isNaN(date.getTime()) ? null : date;\n}\n\n\n// A picked Date as a yyyy-MM-dd boundary for storage, or null. Uses the local\n// calendar day (format, not toISOString) so the boundary is the day that was\n// picked, regardless of the browser's zone.\nexport function dateToBound(value: Date | null | undefined): string | null {\n return value instanceof Date && !Number.isNaN(value.getTime())\n ? format(value, 'yyyy-MM-dd')\n : null;\n}\n\n\n// A relative date-range preset key as a sentence-case label, derived from the\n// camelCase key itself ('last12Months' reads 'Last 12 months', 'thisWeek'\n// reads 'This week'), so no list of presets is mirrored here and a key the\n// server adds later still reads sensibly.\nexport function relativeLabel(relative: string): string {\n const words = relative\n .replace(/([a-z])([A-Z0-9])/g, '$1 $2')\n .replace(/(\\d)([A-Z])/g, '$1 $2')\n .toLowerCase();\n\n return words.charAt(0).toUpperCase() + words.slice(1);\n}\n\n\n// Maps a report filter GROUP to an fs-filter config item, and reads fs-filter\n// query values back into per-group FilterGroupValues. Shared by the report-bar\n// fs-filter and the per-component fs-filter so both render through the same\n// library and write into ReportFilterStateService identically. Items are named\n// `g<groupId>` so the query keys map straight back to the group.\n\n// The prefix of a group's item name, and of its key in the report URL.\nexport const GROUP_PARAM_PREFIX = 'g';\n\n// The query key fs-filter uses for a group's item(s), and the report URL's key\n// for the group's value (report-url-state.ts). One naming for both.\nexport function groupItemName(group: Pick<ReportFilterGroup, 'id'>): string {\n return `${GROUP_PARAM_PREFIX}${group.id}`;\n}\n\n// The query key for the report's group-by control. Fixed rather than derived\n// from an id because a report has exactly one — and it is NOT a filter group,\n// so it is read straight off the change query instead of through\n// groupValuesFromQuery. It is also the report URL's key for the grain\n// (report-url-state.ts). The grain travels to the server as the data\n// request's `state.frequency`.\nexport const GROUP_BY_ITEM = 'groupBy';\n\n// A select group's distinct options, as { name, value } pairs. The server sends\n// { value, label }: the value is what the filter matches on (an entity's stable\n// id) and the label is what the viewer reads — so a renamed entity keeps its id\n// and simply shows its new name here. Options come from the first member filter\n// that declares them — members are the same data point, so any member's list\n// serves the group. The list is fetched once (the server caps it) and replayed\n// (shareReplay), so repeated reads never refetch. Shared by the report-bar\n// select control and the report-settings default picker so the two never drift.\n// Returns an empty list when no member provides options.\nexport function loadGroupOptions(\n group: ReportFilterGroup,\n reportData: ReportData,\n reportId: number,\n): Observable<{ name: string; value: unknown }[]> {\n const optionFilter = (group.filters ?? []).find((member) => member.hasOptions);\n if (!optionFilter) {\n return of([]);\n }\n\n return reportData.filterOptions(reportId, optionFilter.id)\n .pipe(\n map((options: ReportFilterOption[]) => (options ?? [])\n .map((option) => ({ name: option.label, value: option.value }))),\n shareReplay({ bufferSize: 1, refCount: false }),\n );\n}\n\n// Stored filter values (ids) paired back with the labels to show for them.\n// A saved default holds only values, so the names have to be read back off the\n// option list — that indirection is exactly what survives a rename. A value with\n// no matching option (its entity was deleted, so it is no longer listed) falls\n// back to showing the raw value rather than dropping the chip, which would\n// silently widen the filter.\nexport function resolveOptionValues(\n options$: Observable<{ name: string; value: unknown }[]>,\n values: unknown[],\n): Observable<{ name: string; value: unknown }[]> {\n return options$.pipe(map((options) => values.map((value) => {\n const option = options.find((candidate) => String(candidate.value) === String(value));\n\n return { name: option?.name ?? String(value), value };\n })));\n}\n\n// Case-insensitive name filter applied to a loaded option list — the typed\n// keyword has to be matched here because fs-autocomplete renders what we return\n// verbatim.\nexport function matchOptions(\n options$: Observable<{ name: string; value: unknown }[]>,\n keyword?: string,\n): Observable<{ name: string; value: unknown }[]> {\n const term = (keyword ?? '').trim().toLowerCase();\n\n return options$.pipe(map((options) => term\n ? options.filter((option) => option.name.toLowerCase().includes(term))\n : options));\n}\n\n// Build the fs-filter config item for a group, seeding its default from the\n// current session value so authored/relative defaults show selected on open.\nexport function filterItemForGroup(\n group: ReportFilterGroup,\n reportData: ReportData,\n reportId: number,\n initial?: FilterGroupValue,\n): IFilterConfigItem {\n const name = groupItemName(group);\n const label = group.label || group.filters?.[0]?.filterColumn || '';\n\n switch (group.type) {\n case 'dateRange':\n return {\n name,\n type: ItemType.DateRange,\n label: { from: `${label} From`, to: `${label} To` },\n default: (initial?.start || initial?.end)\n ? { from: initial.start ?? undefined, to: initial.end ?? undefined }\n : undefined,\n };\n\n case 'select': {\n // One shared, replayed option stream so typing never refetches.\n const options$ = loadGroupOptions(group, reportData, reportId);\n const values = initial?.values;\n\n return {\n name,\n type: ItemType.AutoCompleteChips,\n label,\n fetchOnFocus: true,\n values: (keyword?: string) => matchOptions(options$, keyword),\n // Stored values are ids, so the chips can only be named once the option\n // list has loaded — hence the observable form of `default`.\n default: values?.length\n ? () => resolveOptionValues(options$, values)\n : undefined,\n };\n }\n\n case 'keyword':\n default:\n return {\n name,\n type: ItemType.Keyword,\n label,\n default: initial?.value,\n };\n }\n}\n\n// Whether the report has a chart the group-by control can re-bucket. A time\n// x-axis is the whole qualification: the control changes the grain of that\n// axis, and a category axis has no grain to change.\nexport function hasTimeSeriesChart(report: Report | null): boolean {\n return (report?.pages ?? []).some((page) => (page.components ?? []).some((component) =>\n component.type === 'chart' && component.config?.xAxis?.kind === 'time'));\n}\n\n// The grains the report's group-by control offers, named for the viewer. WHICH\n// of them comes from the report; how they read comes from GRANULARITY_OPTIONS.\n// An empty stored list means every grain — the same rule the backend applies.\nfunction groupByOptions(report: Report): { value: ChartGranularity; name: string }[] {\n const granularities = report.config?.groupBy?.granularities ?? [];\n\n return granularities.length\n ? GRANULARITY_OPTIONS.filter((option) => granularities.includes(option.value))\n : GRANULARITY_OPTIONS;\n}\n\n// Whether a grain is one the report's control still offers. A grain it doesn't\n// cannot stay in effect: the agent can narrow the list at any time, and a chart\n// left bucketing at a dropped grain is one the viewer can neither see nor change.\nexport function isGranularityOffered(report: Report, granularity: ChartGranularity | null): boolean {\n return !granularity || groupByOptions(report).some((option) => option.value === granularity);\n}\n\n// The fs-filter config item for the report's group-by control, or null when the\n// report has none to show.\n//\n// It leads the same bar the filters render in, but it is NOT one: a filter\n// narrows WHICH rows are counted, this changes how the surviving rows are\n// BUCKETED — and it comes first because the grain is what a viewer settles\n// before deciding which rows they want.\n// Picking a grain sets a session-wide override that rides along in each chart's\n// data request, so the charts themselves are never rewritten.\nexport function groupByFilterItem(\n report: Report,\n initial?: ChartGranularity | null,\n): IFilterConfigItem | null {\n const groupBy = report.config?.groupBy;\n\n // Only an EXPLICIT false hides the control. An absent block means a report\n // served by a build that predates the control being stored, and every one of\n // those had one — the backend resolves it the same way (ReportGroupBy).\n if (groupBy?.enabled === false || !hasTimeSeriesChart(report)) {\n return null;\n }\n\n const values = groupByOptions(report);\n\n return {\n name: GROUP_BY_ITEM,\n type: ItemType.Select,\n label: groupBy?.label || 'Group By',\n multiple: false,\n values: () => values,\n default: isGranularityOffered(report, initial ?? null) ? (initial ?? undefined) : undefined,\n };\n}\n\n// The group-by control's contribution to the toolbar's fs-filter key. fs-filter\n// reads its config once at init, and the agent can change the control's label\n// or the grains it offers — without those in the key the bar keeps rendering\n// the control it was created with until a full page reload.\nexport function groupBySignature(report: Report | null): string {\n if (!report || !groupByFilterItem(report)) {\n return '';\n }\n\n const groupBy = report.config?.groupBy;\n\n return ['groupBy', groupBy?.label ?? '', (groupBy?.granularities ?? []).join(',')].join(':');\n}\n\n// Read an fs-filter change query into per-group values. Returns one entry per\n// group with the value to store (or null to clear) — callers feed these to\n// ReportFilterStateService.setValue.\nexport function groupValuesFromQuery(\n query: Record<string, any>,\n groups: ReportFilterGroup[],\n): { groupId: number; value: FilterGroupValue | null }[] {\n return groups.map((group) => {\n const name = groupItemName(group);\n\n if (group.type === 'dateRange') {\n const start = query[`${name}From`];\n const end = query[`${name}To`];\n\n return {\n groupId: group.id,\n value: (start || end) ? { start: start || null, end: end || null } : null,\n };\n }\n\n if (group.type === 'select') {\n const values = selectQueryValues(query[name]);\n\n return { groupId: group.id, value: values.length ? { values } : null };\n }\n\n const keyword = String(query[name] ?? '').trim();\n\n return { groupId: group.id, value: keyword ? { value: keyword } : null };\n });\n}\n\n// fs-filter's AutoCompleteChips serialises a multi-select into ONE query value:\n// the selected values joined by \",\" (its `query` getter does `.map(value).join(',')`).\n// So a 2+ selection arrives as the string \"a,b\", not an array — splitting on \",\"\n// reverses that faithfully. Without this, a multi-select was sent as the single\n// value [\"a,b\"], producing `col IN ('a,b')` server-side, which matches nothing.\nfunction selectQueryValues(raw: unknown): unknown[] {\n if (Array.isArray(raw)) {\n return raw;\n }\n\n if (raw === null || raw === undefined || raw === '') {\n return [];\n }\n\n return String(raw).split(',');\n}\n","import { Day } from 'date-fns';\n\n\n// Report weeks start on Monday. This is a rule, not a setting: the server's\n// weekly time buckets (ReportTimeBucket::getPeriodStart() at the Week grain)\n// and its relative date presets (ReportRelativeRangeEnum) both start the week\n// on Monday, so the viewer's thisWeek/lastWeek presets must too, or a weekly\n// chart's buckets would straddle the range its own filter names.\nexport const REPORT_WEEK_STARTS_ON: Day = 1;\n","import { format, isValid, parseISO } from 'date-fns';\nimport { formatInTimeZone, toZonedTime } from 'date-fns-tz';\n\nimport { Report } from './interfaces/report.interface';\n\n\n// Measure-value formatting shared by the KPI renderer and the exports — the\n// config's `format` (number | percent | currency) and `precision` mean the same\n// thing on screen, in PowerPoint and in PDF.\n\n// percent takes a 0-1 ratio and shows it as a percentage: 0.3 reads 30%. With\n// no precision it shows at most one decimal (0.037 reads 3.7%); a named\n// precision counts the decimals of the percentage, not of the ratio, so\n// precision 1 shows 0.3 as 30.0%. An older server sends percent values already\n// x100 (38.5 for 38.5%); its reports carry no `percentFormat`, and the caller\n// passes ratioPercent false so the value is printed as it came, with a % sign.\n//\n// When the measure names a precision it is pinned as BOTH the minimum and the\n// maximum, so a column of rates lines up instead of each value showing however\n// many decimals it happens to need. Undefined leaves each format's own default\n// alone.\nfunction getFractionDigits(precision?: number): Intl.NumberFormatOptions {\n return Number.isFinite(precision)\n ? { minimumFractionDigits: precision, maximumFractionDigits: precision }\n : {};\n}\n\nexport function formatMeasureValue(\n value: unknown,\n format?: string,\n precision?: number,\n ratioPercent = true,\n): string {\n if (value === null || value === undefined || value === '') {\n return '—';\n }\n\n const numeric = Number(value);\n if (!Number.isFinite(numeric)) {\n return String(value);\n }\n\n const fractionDigits = getFractionDigits(precision);\n\n switch (format) {\n case 'percent':\n if (!ratioPercent) {\n return `${new Intl.NumberFormat(undefined, { maximumFractionDigits: 1, ...fractionDigits }).format(numeric)}%`;\n }\n\n return new Intl.NumberFormat(undefined, {\n style: 'percent',\n maximumFractionDigits: 1,\n ...fractionDigits,\n }).format(numeric);\n case 'currency':\n return new Intl.NumberFormat(undefined, {\n style: 'currency',\n currency: 'USD',\n // Whole dollars unless the measure asks for decimals — cents were\n // unrepresentable before, because this was hardcoded to 0.\n maximumFractionDigits: 0,\n ...fractionDigits,\n }).format(numeric);\n default:\n return new Intl.NumberFormat(undefined, fractionDigits).format(numeric);\n }\n}\n\n\n// The axis peak at which a native chart's value axis gains thousands\n// separators. From here up the ticks are whole numbers in practice; below it\n// neither the screen nor PowerPoint's 'General' shows a separator.\nexport const AXIS_SEPARATOR_THRESHOLD = 1000;\n\n// PowerPoint's number format for a native chart's value axis, matching what the\n// on-screen axis prints by default: thousands separators with each tick's own\n// decimals. Excel has no \"General with separators\", so an axis reaching 1,000\n// (where ticks are whole numbers) gets '#,##0', and a smaller range keeps\n// 'General' so fractional ticks (0.25, 0.5) are not rounded away.\n//\n// The peak counts a missing value as 0. A stacked chart's peak is its tallest\n// stack: the largest sum, per category, of every series' absolute value.\nexport function chartAxisFormatCode(series: (number | null)[][], stacked: boolean): string {\n const magnitudes = series.map((values) => values.map((value) => Math.abs(value ?? 0)));\n\n const peak = stacked\n ? Math.max(0, ...(magnitudes[0] ?? []).map((_, index) => magnitudes\n .reduce((sum, values) => sum + (values[index] ?? 0), 0)))\n : Math.max(0, ...magnitudes.flat());\n\n return peak >= AXIS_SEPARATOR_THRESHOLD ? '#,##0' : 'General';\n}\n\n\n// The zone every date in a report is read in. The server resolves it (the\n// report's own zone, else the application's default reporting zone) and sends\n// it as `effectiveTimezone`. A server too old to send the field still used a\n// report's pinned `timezone`, so that comes next; the browser's zone is the last\n// fallback. This is the one place that chain lives, so every date the viewer\n// renders or resolves agrees with every other.\nexport function resolveReportTimezone(report: Pick<Report, 'effectiveTimezone' | 'timezone'>): string {\n return report.effectiveTimezone ?? report.timezone ?? Intl.DateTimeFormat().resolvedOptions().timeZone;\n}\n\n\nconst DATE_ONLY_PATTERN = /^\\d{4}-\\d{2}-\\d{2}$/;\nconst DATE_TIME_PATTERN = /^(\\d{4}-\\d{2}-\\d{2})[ T](\\d{2}:\\d{2}:\\d{2})(\\.\\d+)?$/;\n\n// A report row's date cell as a calendar day in the report's zone.\n//\n// Report rows are raw database strings, not serialized models, so their shape\n// is the wire contract: a DATE column arrives as 'YYYY-MM-DD' and a\n// date-and-time column as 'YYYY-MM-DD HH:MM:SS' in UTC. Reading that shape\n// here does not re-derive a server rule; it only stops the browser guessing.\n// - A calendar day is never shifted: parseISO reads it as local midnight, so\n// the day printed is the day stored, whatever the zone.\n// - An instant is pinned to UTC with an explicit 'Z', then shown as the day it\n// fell on in the report's zone, the same day the filters and time buckets use.\n// - Anything else is shown as it came, and so is a value that has the shape\n// but names no real day (a zero date '0000-00-00', or '2026-02-30'): one\n// bad cell must not throw out of a pipe or abort an export.\nexport function formatReportDate(value: unknown, timezone: string): string {\n if (value === null || value === undefined || value === '') {\n return '';\n }\n\n const text = String(value);\n\n if (DATE_ONLY_PATTERN.test(text)) {\n const day = parseISO(text);\n\n return isValid(day) ? format(day, 'MMM d, yyyy') : text;\n }\n\n const dateTime = DATE_TIME_PATTERN.exec(text);\n if (!dateTime) {\n return text;\n }\n\n const instant = parseISO(`${dateTime[1]}T${dateTime[2]}Z`);\n if (!isValid(instant)) {\n return text;\n }\n\n // An unknown zone makes date-fns-tz throw; UTC still names a real day.\n try {\n return formatInTimeZone(instant, timezone, 'MMM d, yyyy');\n } catch {\n return formatInTimeZone(instant, 'UTC', 'MMM d, yyyy');\n }\n}\n\n\n// A short, human label for a zone: its city plus the current abbreviation,\n// e.g. 'America/New_York' reads 'New York (EDT)'. UTC stays 'UTC', and an\n// unknown zone is shown as its id. An 'Etc/' zone names no city, and its POSIX\n// sign is the reverse of the offset ('Etc/GMT+5' is GMT-5), so it reads as the\n// abbreviation alone: 'Etc/UTC' is 'UTC', 'Etc/GMT+5' is 'GMT-5'.\nexport function getTimezoneLabel(timezone: string): string {\n if (timezone === 'UTC') {\n return timezone;\n }\n\n const segments = timezone.split('/');\n\n try {\n const abbreviation = formatInTimeZone(new Date(), timezone, 'zzz');\n\n return segments[0] === 'Etc'\n ? abbreviation\n : `${segments[segments.length - 1].replace(/_/g, ' ')} (${abbreviation})`;\n } catch {\n return timezone;\n }\n}\n\n\n// \"Now\" as a Date whose local fields read the wall clock in the given zone, so\n// date-fns calendar arithmetic (startOfWeek, startOfMonth, ...) and\n// dateBoundString() land on the zone's calendar day rather than the browser's.\n// An unknown zone falls back to the browser's clock.\nexport function getZonedNow(timezone: string): Date {\n const now = new Date();\n\n try {\n const zoned = toZonedTime(now, timezone);\n\n return Number.isNaN(zoned.getTime()) ? now : zoned;\n } catch {\n return now;\n }\n}\n","import { ParamMap, Params } from '@angular/router';\n\nimport {\n FilterGroupValue, ReportFilterType, ReportSort, ReportUrlParams, ReportUrlSnapshot,\n} from './interfaces/report.interface';\nimport {\n GROUP_BY_ITEM, GROUP_PARAM_PREFIX, dateBoundString, dateFromBound, groupItemName,\n} from './report-filter-items';\n\n\n// The report viewer's state in its URL: a pure codec, with no knowledge of a\n// loaded report. ReportFilterStateService decides WHAT is carried (only values\n// that differ from the authored defaults) and checks what is read back against\n// the report; this file only turns values into query params and back.\n//\n// ?page=7&groupBy=week&g12=last30Days&g15=3,5&g16=2026-01-01..&s31=-create_date\n//\n// - g<groupId>: one key per filter group. A dateRange is its relative preset\n// name when it carries one, else 'YYYY-MM-DD..YYYY-MM-DD' (either side may be\n// empty); a select is its values joined by ','; a keyword is its text. An\n// empty value is an explicit clear of a group that has a default.\n// - s<componentId>: a list's sort column, '-' prefixed when descending.\n// - groupBy: the group-by grain (GROUP_BY_ITEM).\n// The page key is the host's (FsAiReportComponent.pageQueryParam) and is\n// written beside these, never by this codec.\n\n// The prefix of a group's value key. Declared beside the filter items, which\n// read it too (declaring it here would make the two files import each other);\n// re-exported so every codec constant can be imported from the codec.\nexport { GROUP_PARAM_PREFIX } from './report-filter-items';\n\n// The prefix of a list's sort key.\nexport const LIST_SORT_PARAM_PREFIX = 's';\n\n// Between the two days of an encoded fixed date range.\nexport const DATE_RANGE_SEPARATOR = '..';\n\n// A key this codec owns: a group value or a list sort. Any such key the\n// snapshot no longer carries is removed from the URL.\nexport const OWNED_PARAM = new RegExp(`^[${GROUP_PARAM_PREFIX}${LIST_SORT_PARAM_PREFIX}]\\\\d+$`);\n\nconst DAY_PATTERN = /^\\d{4}-\\d{2}-\\d{2}$/;\n\n// The viewer-state params of a URL as raw strings. Keys this codec does not\n// own are ignored.\nexport function readReportUrlParams(params: ParamMap): ReportUrlParams {\n const groups = new Map<number, string>();\n const listSorts = new Map<number, string>();\n\n for (const key of params.keys) {\n if (!OWNED_PARAM.test(key)) {\n continue;\n }\n\n const id = Number(key.slice(1));\n const raw = params.get(key) ?? '';\n\n if (key.startsWith(GROUP_PARAM_PREFIX)) {\n groups.set(id, raw);\n } else {\n listSorts.set(id, raw);\n }\n }\n\n return { groups, listSorts, groupBy: params.get(GROUP_BY_ITEM) };\n}\n\n// A group value read back from its URL param. null is an explicit clear (an\n// empty param). undefined means the param is unusable for a group of this type\n// (an unknown preset name, a malformed day, a wrong shape) and is ignored.\n// `resolveRelative` turns a preset name into today's range for it, or null for\n// a name it does not know.\nexport function decodeFilterValue(\n type: ReportFilterType,\n raw: string,\n resolveRelative: (name: string) => { start: Date; end: Date } | null,\n): FilterGroupValue | null | undefined {\n if (raw === '') {\n return null;\n }\n\n switch (type) {\n case 'dateRange':\n return raw.includes(DATE_RANGE_SEPARATOR)\n ? decodeFixedRange(raw)\n : decodePreset(raw, resolveRelative);\n\n case 'select': {\n const values = raw.split(',').filter((value) => value !== '');\n\n return values.length ? { values } : undefined;\n }\n\n case 'keyword':\n return raw.trim() ? { value: raw } : undefined;\n\n default:\n return undefined;\n }\n}\n\n// A group value as its URL param. The shape says how: a preset name, then a\n// date range, then select values, then keyword text. null (a cleared group)\n// is the empty param.\nexport function encodeFilterValue(value: FilterGroupValue | null): string {\n if (!value) {\n return '';\n }\n\n if (value.preset) {\n return value.preset;\n }\n\n if (value.start || value.end) {\n return [dateBoundString(value.start) ?? '', dateBoundString(value.end) ?? '']\n .join(DATE_RANGE_SEPARATOR);\n }\n\n if (value.values) {\n return value.values.map((item) => String(item)).join(',');\n }\n\n return value.value ?? '';\n}\n\nexport function encodeSort(sort: ReportSort): string {\n return `${sort.direction === 'desc' ? '-' : ''}${sort.column}`;\n}\n\n// A list sort read back from its URL param, or null when it names no column.\n// Whether the column is one the list can sort by is the caller's check.\nexport function decodeSort(raw: string): ReportSort | null {\n const descending = raw.startsWith('-');\n const column = descending ? raw.slice(1) : raw;\n\n return column\n ? { column, direction: descending ? 'desc' : 'asc' }\n : null;\n}\n\n// The query params that make the URL carry `snapshot`: every snapshot key is\n// set, and each owned key (or the grain) that `current` carries but the\n// snapshot does not is set to null, which removes it under the router's\n// 'merge' handling. Keys this codec does not own are left alone.\nexport function buildReportUrlParams(snapshot: ReportUrlSnapshot, current: ParamMap): Params {\n const params: Params = {};\n\n for (const key of current.keys) {\n if (OWNED_PARAM.test(key) || key === GROUP_BY_ITEM) {\n params[key] = null;\n }\n }\n\n snapshot.groups.forEach((value, groupId) => {\n params[groupItemName({ id: groupId })] = encodeFilterValue(value);\n });\n\n snapshot.listSorts.forEach((sort, componentId) => {\n params[`${LIST_SORT_PARAM_PREFIX}${componentId}`] = encodeSort(sort);\n });\n\n if (snapshot.frequency) {\n params[GROUP_BY_ITEM] = snapshot.frequency;\n }\n\n return params;\n}\n\n// 'YYYY-MM-DD..YYYY-MM-DD', either side optional but not both. Each side must\n// be a real calendar day.\nfunction decodeFixedRange(raw: string): FilterGroupValue | undefined {\n const sides = raw.split(DATE_RANGE_SEPARATOR);\n if (sides.length !== 2 || (!sides[0] && !sides[1])) {\n return undefined;\n }\n\n const [start, end] = sides.map((side) => side ? decodeDay(side) : null);\n if (start === undefined || end === undefined) {\n return undefined;\n }\n\n return { start, end };\n}\n\n// One side of a fixed range as a local Date, or undefined when it is not a\n// real Y-M-D day.\nfunction decodeDay(side: string): Date | undefined {\n return DAY_PATTERN.test(side) ? (dateFromBound(side) ?? undefined) : undefined;\n}\n\nfunction decodePreset(\n name: string,\n resolveRelative: (name: string) => { start: Date; end: Date } | null,\n): FilterGroupValue | undefined {\n const range = resolveRelative(name);\n\n return range ? { start: range.start, end: range.end, preset: name } : undefined;\n}\n","import { Injectable, signal } from '@angular/core';\n\nimport { Observable, Subject } from 'rxjs';\nimport { filter as rxFilter } from 'rxjs/operators';\n\nimport {\n endOfWeek, startOfMonth, startOfQuarter, startOfWeek, startOfYear,\n subDays, subMonths, subWeeks,\n} from 'date-fns';\n\nimport { REPORT_WEEK_STARTS_ON } from '../consts/report-week.const';\nimport { getZonedNow, resolveReportTimezone } from '../format';\nimport { ReportChatViewerFilter } from '../interfaces/report-chat-viewer-filter.interface';\nimport {\n ChartGranularity,\n FilterGroupDefault,\n FilterGroupValue,\n GRANULARITY_OPTIONS,\n Report,\n ReportComponent,\n ReportFilterGroup,\n ReportSort,\n ReportUrlParams,\n ReportUrlSnapshot,\n ResolvedFilterValue,\n} from '../interfaces/report.interface';\nimport { dateBoundString } from '../report-filter-items';\nimport { decodeFilterValue, decodeSort } from '../report-url-state';\n\n\n// Whether two stored filter-group defaults are the same. Compared on the fields a\n// default can actually carry, so key order in the payload can't read as a change.\nexport function sameDefault(\n a: FilterGroupDefault | null,\n b: FilterGroupDefault | null,\n): boolean {\n if (!a || !b) {\n return !a && !b;\n }\n\n return a.start === b.start\n && a.end === b.end\n && a.value === b.value\n && a.relative === b.relative\n && (a.values ?? []).length === (b.values ?? []).length\n && (a.values ?? []).every((value, index) => value === (b.values ?? [])[index]);\n}\n\n\n// Whether two list sorts order the rows the same way. No direction reads as\n// ascending, the way the list applies it.\nfunction sameSort(a: ReportSort, b: ReportSort | null): boolean {\n return !!b\n && a.column === b.column\n && (a.direction ?? 'asc') === (b.direction ?? 'asc');\n}\n\n\n// Whether two date-range values cover the same calendar days.\nfunction sameDays(a: FilterGroupValue, b: FilterGroupValue): boolean {\n return dateBoundString(a.start) === dateBoundString(b.start)\n && dateBoundString(a.end) === dateBoundString(b.end);\n}\n\n\n// A stable signature for a group's stored default. The report toolbar keys its\n// fs-filter on this, because fs-filter reads its config once at init — without a\n// key change it keeps rendering the values it was created with even after the\n// config behind it has been rebuilt.\nexport function defaultSignature(group: ReportFilterGroup): string {\n const groupDefault = group.config?.default;\n\n if (!groupDefault) {\n return '';\n }\n\n return [\n groupDefault.start ?? '',\n groupDefault.end ?? '',\n groupDefault.value ?? '',\n groupDefault.relative ?? '',\n (groupDefault.values ?? []).join(','),\n ].join('~');\n}\n\n\n// Viewer filter state for the open report. Filter VALUES are never saved to\n// the report — this service holds them per filter GROUP (the propagation unit),\n// resolves them into per-component member-filter values for each data request,\n// and notifies the components whose groups changed so only they refetch.\n//\n// It is also the one source of the viewer state the report URL carries (group\n// values, the group-by grain, list sorts): urlSnapshot() says what differs from\n// the authored defaults, init() restores it, and urlChanges() tells the host's\n// single URL writer when to write.\n//\n// Session-only, never in the URL: per-filter enable/disable toggles from a\n// component's filter menu (the `enabled` column is the authored default; a\n// viewer's toggle shouldn't write to the report).\n@Injectable()\nexport class ReportFilterStateService {\n\n // The open report's effective zone (resolveReportTimezone). Relative presets\n // resolve against today in it, and date cells render in it.\n public readonly timezone = signal<string>('UTC');\n\n private _values = new Map<number, FilterGroupValue>();\n private _groups = new Map<number, ReportFilterGroup>();\n private _sessionDisabled = new Set<number>();\n\n // Groups that have a default the viewer cleared. Without this a reload of the\n // report (a chat edit, a dialog) would find no value for the group and seed\n // its default straight back. A change to the stored default releases it.\n private _cleared = new Set<number>();\n\n // The report's group-by control: a single report-wide bucket override for all\n // time-series charts. Unset = each chart uses its authored granularity. Never\n // saved to the report (the URL carries it), and carried in the data request's\n // `state`, so it propagates through to the PDF/PowerPoint exports too. Named\n // for the `frequency` wire key it travels under, not for the control's label.\n private _frequency: ChartGranularity | null = null;\n private _frequencyChanged$ = new Subject<void>();\n\n // Each list's viewer-chosen sort, by component id. Held here rather than only\n // in the list's FsList so it survives the list being recreated (a page switch,\n // a reload after an edit) and so every consumer of viewer state reads one place.\n private _listSorts = new Map<number, ReportSort>();\n\n // Emits the group id that changed; components listen filtered to their own\n // group ids. null = everything changed (re-init).\n private _changed$ = new Subject<number | null>();\n\n // Fires whenever anything the URL carries may have changed.\n private _urlChanged$ = new Subject<void>();\n\n // Seed groups + their defaults when a report loads. Existing session values\n // for still-existing groups survive a structure re-fetch (a chat edit\n // shouldn't reset the viewer's filters), and so does a group the viewer\n // cleared — UNLESS the group's stored default itself changed, which only\n // happens when an operator saved a new default in report settings or the\n // agent set one. That is an explicit instruction to re-seed, so it wins over\n // the surviving session value; without it the bar keeps showing whatever it\n // was first seeded with until a full page reload.\n //\n // A change of the report's zone moves \"today\", so a value still carrying its\n // group default's preset name is resolved again in the new zone. A value the\n // viewer picked, or one carrying another preset name, is kept as it is.\n //\n // `restore` is the viewer state read from the URL. The host passes it only on\n // the first load of a report; a reload after a chat or dialog edit passes\n // null, so the in-memory state wins. Params that name a group, list or column\n // the report no longer has, or that do not decode, are ignored.\n public init(report: Report, restore: ReportUrlParams | null = null): void {\n const previousTimezone = this.timezone();\n\n // Set first: the defaults seeded below resolve their relative presets in it.\n this.timezone.set(resolveReportTimezone(report));\n\n const timezoneChanged = previousTimezone !== this.timezone();\n const previousGroups = this._groups;\n this._groups = new Map<number, ReportFilterGroup>();\n\n for (const group of report.filterGroups ?? []) {\n this._groups.set(group.id, group);\n this._seed(group, previousGroups.get(group.id) ?? null, timezoneChanged);\n }\n\n if (restore) {\n this._restore(report, restore);\n }\n\n this._prune(report);\n\n this._changed$.next(null);\n this._urlChanged$.next();\n }\n\n public value(groupId: number): FilterGroupValue | undefined {\n return this._values.get(groupId);\n }\n\n // A bar's value for a group. A date range keeps the stored preset name only\n // while its days are still the stored days: the bars re-set every group they\n // show whenever any one of them changes, and an untouched rolling range must\n // keep its name rather than turn into two fixed dates. Any other range, a\n // picker shortcut included, is stored as the fixed dates it shows.\n public setValue(groupId: number, value: FilterGroupValue | null): void {\n if (value === null) {\n this._values.delete(groupId);\n\n if (this._groups.get(groupId)?.config?.default) {\n this._cleared.add(groupId);\n }\n } else {\n this._values.set(groupId, this._withPreset(this._values.get(groupId), value));\n this._cleared.delete(groupId);\n }\n\n this._changed$.next(groupId);\n this._urlChanged$.next();\n }\n\n // A relative preset name as today's range in the report's zone, or null for\n // a name it does not know. The URL codec decodes preset names through this.\n public resolveRelative(name: string): { start: Date; end: Date } | null {\n return this._relativeRange(name);\n }\n\n // The active group-by grain, or null when the viewer hasn't chosen one.\n public frequency(): ChartGranularity | null {\n return this._frequency;\n }\n\n public setFrequency(frequency: ChartGranularity | null): void {\n this._frequency = frequency;\n this._frequencyChanged$.next();\n this._urlChanged$.next();\n }\n\n // Fires whenever the group-by grain changes — every time-series chart listens\n // so it refetches and re-buckets (the override isn't scoped to any filter\n // group, so changesFor() can't carry it).\n public frequencyChanges(): Observable<void> {\n return this._frequencyChanged$.asObservable();\n }\n\n // The sort the viewer last fetched a list with, or null when it hasn't sorted\n // (the list then falls back to its authored sort).\n public listSort(componentId: number): ReportSort | null {\n return this._listSorts.get(componentId) ?? null;\n }\n\n // Records a list's sort. Deliberately emits no change: the list sets this from\n // the fetch that already ran with that sort, so a notification would only make\n // it refetch the same rows. Only the URL hears about it.\n public setListSort(componentId: number, sort: ReportSort | null): void {\n if (sort) {\n this._listSorts.set(componentId, sort);\n } else {\n this._listSorts.delete(componentId);\n }\n\n this._urlChanged$.next();\n }\n\n // Fires whenever the viewer state the URL carries may have changed: a group\n // value, the grain, a list sort, or a (re)load of the report.\n public urlChanges(): Observable<void> {\n return this._urlChanged$.asObservable();\n }\n\n // The viewer state the URL should carry for `report`: only what differs from\n // the authored defaults, so an untouched report has a bare URL and keeps\n // following its defaults when they change. A group the viewer cleared is\n // null. A date range is compared on its days against its default resolved\n // today, so a value that is the default under another preset name (thisYear\n // against a yearToDate default) is still the default.\n public urlSnapshot(report: Report): ReportUrlSnapshot {\n const groups = new Map<number, FilterGroupValue | null>();\n\n for (const group of this._groups.values()) {\n const value = this._values.get(group.id);\n\n if (this._cleared.has(group.id)) {\n groups.set(group.id, null);\n } else if (value && !this._isDefault(group, value)) {\n groups.set(group.id, value);\n }\n }\n\n const listSorts = new Map<number, ReportSort>();\n\n for (const component of this._listComponents(report)) {\n const sort = this._listSorts.get(component.id);\n\n if (sort && !sameSort(sort, component.config?.sort ?? null)) {\n listSorts.set(component.id, sort);\n }\n }\n\n return { groups, listSorts, frequency: this._frequency };\n }\n\n public isFilterDisabled(filterId: number): boolean {\n return this._sessionDisabled.has(filterId);\n }\n\n public toggleFilter(filterId: number, groupId: number): void {\n if (this._sessionDisabled.has(filterId)) {\n this._sessionDisabled.delete(filterId);\n } else {\n this._sessionDisabled.add(filterId);\n }\n\n this._changed$.next(groupId);\n }\n\n // Notifications relevant to ONE component: any change to a group one of its\n // filters belongs to (or a full re-init).\n public changesFor(component: ReportComponent): Observable<number | null> {\n const groupIds = new Set((component.filters ?? []).map((filter) => filter.filterGroupId));\n\n return this._changed$.asObservable()\n .pipe(\n rxFilter((groupId) => groupId === null || groupIds.has(groupId)),\n );\n }\n\n // The group values resolved into this component's member-filter values —\n // what the data request carries. Disabled filters (authored or session) are\n // skipped entirely.\n public resolveForComponent(component: ReportComponent): ResolvedFilterValue[] {\n const resolved: ResolvedFilterValue[] = [];\n\n for (const filter of component.filters ?? []) {\n if (!filter.enabled || this._sessionDisabled.has(filter.id)) {\n continue;\n }\n\n const value = this._values.get(filter.filterGroupId);\n const fields = value ? this._resolvedFields(value) : null;\n\n if (fields) {\n resolved.push({ filterId: filter.id, ...fields });\n }\n }\n\n return resolved;\n }\n\n // What the viewer has set, one entry per filter group, for the report chat:\n // the agent reads it to know what is on screen. Group order, not the order\n // the values were set in, so the same state always reads the same. A group\n // with nothing in it is left out, and a saved default counts until the\n // viewer changes it. Per-filter toggles are a component's own business, so\n // they are not part of it.\n public viewerFilters(): ReportChatViewerFilter[] {\n return [...this._values.entries()]\n .sort(([a], [b]) => a - b)\n .map(([groupId, value]) => {\n const fields = this._resolvedFields(value);\n\n return fields ? { groupId, ...fields } : null;\n })\n .filter((entry): entry is ReportChatViewerFilter => entry !== null);\n }\n\n // Every component's resolved values in one array — what a report-level export\n // carries so each file in the archive is filtered exactly as the screen is.\n // Filter ids are unique per component, so the backend picks each component's\n // own out of the pile. A page id narrows it to that page.\n public resolveForReport(report: Report, pageId: number | null = null): ResolvedFilterValue[] {\n const pages = (report.pages ?? [])\n .filter((page) => !pageId || page.id === pageId);\n\n return pages\n .flatMap((page) => (page.components ?? [])\n .flatMap((component) => this.resolveForComponent(component)));\n }\n\n // A group value as the fields a request carries: date bounds as calendar\n // days, select values when any are picked, keyword text trimmed. Null when\n // all of them are empty. The preset name is URL state only, so it is left\n // behind.\n private _resolvedFields(value: FilterGroupValue): Omit<ResolvedFilterValue, 'filterId'> | null {\n const fields: Omit<ResolvedFilterValue, 'filterId'> = {};\n\n if (value.start) {\n fields.start = dateBoundString(value.start);\n }\n if (value.end) {\n fields.end = dateBoundString(value.end);\n }\n if (value.values?.length) {\n fields.values = value.values;\n }\n if (value.value?.trim()) {\n fields.value = value.value.trim();\n }\n\n return fields.start || fields.end || fields.values || fields.value\n ? fields\n : null;\n }\n\n // Seeds one group on (re)load; see init(). `previous` is the group as the\n // last load had it, or null when it is new.\n private _seed(\n group: ReportFilterGroup,\n previous: ReportFilterGroup | null,\n timezoneChanged: boolean,\n ): void {\n const defaultChanged = !sameDefault(previous?.config?.default ?? null, group.config?.default ?? null);\n\n if (defaultChanged) {\n this._cleared.delete(group.id);\n }\n\n if (this._cleared.has(group.id)) {\n return;\n }\n\n const value = this._values.get(group.id);\n const presetToResolve = timezoneChanged\n && !!value?.preset\n && value.preset === group.config?.default?.relative;\n\n if (value && !defaultChanged && !presetToResolve) {\n return;\n }\n\n const defaultValue = this._defaultValue(group);\n\n if (defaultValue) {\n this._values.set(group.id, defaultValue);\n } else if (defaultChanged) {\n // The default was cleared, so the value it seeded goes with it.\n this._values.delete(group.id);\n }\n }\n\n // Applies the viewer state read from the URL on top of the seeded defaults.\n private _restore(report: Report, restore: ReportUrlParams): void {\n this._restoreGroups(restore);\n this._restoreListSorts(report, restore);\n\n // The URL is the whole truth on a first load: no grain in it means the\n // authored ones. The host still drops a grain the report does not offer.\n this._frequency = GRANULARITY_OPTIONS\n .find((option) => option.value === restore.groupBy)?.value ?? null;\n }\n\n // The URL's group values. An empty one is an explicit clear of the group.\n private _restoreGroups(restore: ReportUrlParams): void {\n restore.groups.forEach((raw, groupId) => {\n const group = this._groups.get(groupId);\n const value = group\n ? decodeFilterValue(group.type, raw, (name) => this.resolveRelative(name))\n : undefined;\n\n if (value === null) {\n this._values.delete(groupId);\n\n if (group?.config?.default) {\n this._cleared.add(groupId);\n }\n } else if (value) {\n this._values.set(groupId, value);\n this._cleared.delete(groupId);\n }\n });\n }\n\n // The URL's list sorts, each kept only for a list the report has and a\n // column that list can be sorted by.\n private _restoreListSorts(report: Report, restore: ReportUrlParams): void {\n const lists = new Map(this._listComponents(report).map((component) => [component.id, component]));\n\n restore.listSorts.forEach((raw, componentId) => {\n const component = lists.get(componentId);\n const sort = decodeSort(raw);\n\n if (component && sort && this._sortableColumns(component).includes(sort.column)) {\n this._listSorts.set(componentId, sort);\n }\n });\n }\n\n // Drops state kept for groups, lists and filters the report no longer has.\n // A list sort also goes when its column does: the agent can remove or rename\n // it, and the recreated list would send a column the query does not know.\n private _prune(report: Report): void {\n for (const groupId of [...this._values.keys(), ...this._cleared]) {\n if (!this._groups.has(groupId)) {\n this._values.delete(groupId);\n this._cleared.delete(groupId);\n }\n }\n\n const lists = new Map(this._listComponents(report).map((component) => [component.id, component]));\n\n this._listSorts.forEach((sort, componentId) => {\n const component = lists.get(componentId);\n\n if (!component || !this._sortableColumns(component).includes(sort.column)) {\n this._listSorts.delete(componentId);\n }\n });\n\n const filterIds = new Set(this._components(report)\n .flatMap((component) => (component.filters ?? []).map((filter) => filter.id)));\n\n this._sessionDisabled.forEach((filterId) => {\n if (!filterIds.has(filterId)) {\n this._sessionDisabled.delete(filterId);\n }\n });\n }\n\n // The value a bar sets, keeping the stored preset name while the days are\n // still the stored days (see setValue).\n private _withPreset(stored: FilterGroupValue | undefined, value: FilterGroupValue): FilterGroupValue {\n const fixed: FilterGroupValue = { ...value };\n delete fixed.preset;\n\n return stored?.preset && sameDays(stored, fixed)\n ? { ...fixed, preset: stored.preset }\n : fixed;\n }\n\n // Whether a value is the group's authored default, by type: a date range on\n // its days (the default resolved today), a select on its values in any\n // order, a keyword on its text.\n private _isDefault(group: ReportFilterGroup, value: FilterGroupValue): boolean {\n const defaultValue = this._defaultValue(group);\n if (!defaultValue) {\n return false;\n }\n\n switch (group.type) {\n case 'dateRange':\n // An untouched rolling default still carries its preset name. Its days\n // were resolved when it was seeded, and after midnight they no longer\n // match today's, but it is still the default and stays out of the URL.\n if (value.preset && value.preset === group.config?.default?.relative) {\n return true;\n }\n\n return sameDays(value, defaultValue);\n\n case 'select': {\n const values = (value.values ?? []).map(String).sort();\n const defaults = (defaultValue.values ?? []).map(String).sort();\n\n return values.length === defaults.length\n && values.every((item, index) => item === defaults[index]);\n }\n\n default:\n return (value.value ?? '').trim() === (defaultValue.value ?? '').trim();\n }\n }\n\n // Every component of the report: its pages' and its header and footer's.\n private _components(report: Report): ReportComponent[] {\n return [\n ...(report.pages ?? []).flatMap((page) => page.components ?? []),\n ...(report.master?.components ?? []),\n ];\n }\n\n private _listComponents(report: Report): ReportComponent[] {\n return this._components(report)\n .filter((component) => component.type === 'list');\n }\n\n // The columns a list can be sorted by: every authored column, or a\n // cross-tab's row column only (its pivot columns come and go with the data).\n private _sortableColumns(component: ReportComponent): string[] {\n const config = component.config;\n\n if (config?.pivotBy?.column) {\n return config.rowBy?.column ? [config.rowBy.column] : [];\n }\n\n return (config?.columns ?? []).map((column) => column.column);\n }\n\n // A group's authored default, mapped to a session value by type. Relative\n // date presets resolve against \"now\" each time the report opens, so a saved\n // \"last 12 months\" stays relative and carries its preset name; a fixed\n // range, select values and keyword text seed verbatim.\n private _defaultValue(group: ReportFilterGroup): FilterGroupValue | null {\n const groupDefault = group.config?.default;\n if (!groupDefault) {\n return null;\n }\n\n if (groupDefault.relative) {\n const range = this._relativeRange(groupDefault.relative);\n\n return range ? { start: range.start, end: range.end, preset: groupDefault.relative } : null;\n }\n\n if (groupDefault.start || groupDefault.end) {\n return {\n start: groupDefault.start ?? null,\n end: groupDefault.end ?? null,\n };\n }\n\n if (groupDefault.values?.length) {\n return { values: groupDefault.values };\n }\n\n if (groupDefault.value) {\n return { value: groupDefault.value };\n }\n\n return null;\n }\n\n // A relative preset as a calendar-day range. \"Today\" is the day in the\n // report's effective zone, not the browser's, so every viewer seeds the same\n // range. The server twin is ReportRelativeRangeEnum (framework/Report/Enum),\n // and ReportRelativeRangeEnumTest pins the table both sides must produce.\n private _relativeRange(relative: string): { start: Date; end: Date } | null {\n const now = getZonedNow(this.timezone());\n\n switch (relative) {\n // A calendar week, Monday to Sunday (REPORT_WEEK_STARTS_ON, the same week\n // the server's weekly buckets use), in whole days — not the rolling\n // seven days `last7Days` gives, which never lines up with the week a\n // partner has already been sent. `lastWeek` is the one a weekly report\n // wants: it ends on the previous week's Sunday rather than at `now`,\n // because the week it names has closed. `thisWeek` follows every other\n // preset here and runs up to now, so it is deliberately a part-finished\n // week (on a Sunday it is the whole Monday-to-Sunday week).\n case 'thisWeek':\n return { start: startOfWeek(now, { weekStartsOn: REPORT_WEEK_STARTS_ON }), end: now };\n case 'lastWeek': {\n const previous = subWeeks(now, 1);\n\n return {\n start: startOfWeek(previous, { weekStartsOn: REPORT_WEEK_STARTS_ON }),\n end: endOfWeek(previous, { weekStartsOn: REPORT_WEEK_STARTS_ON }),\n };\n }\n case 'last7Days':\n return { start: subDays(now, 7), end: now };\n case 'last30Days':\n return { start: subDays(now, 30), end: now };\n case 'last3Months':\n return { start: subMonths(now, 3), end: now };\n case 'last6Months':\n return { start: subMonths(now, 6), end: now };\n case 'last12Months':\n return { start: subMonths(now, 12), end: now };\n case 'thisMonth':\n return { start: startOfMonth(now), end: now };\n case 'thisQuarter':\n return { start: startOfQuarter(now), end: now };\n case 'thisYear':\n case 'yearToDate':\n return { start: startOfYear(now), end: now };\n default:\n return null;\n }\n }\n}\n","// Text blocks — shared by the canvas and both exports, so a block reads the\n// same on screen, in the deck and in the PDF.\n//\n// A block's html arrives already rebuilt server-side from a small allowlist\n// (ReportTextHtml): p, h1-h3, strong, em, u, s, ul/ol/li, br, a, and span with\n// color / background-color / font-size / font-weight / font-family, plus\n// text-align on a block. Everything here only has to understand that set.\n\n\n// Body text size, points, and the heading sizes — the same numbers the canvas\n// stylesheet uses, so an unstyled paragraph is one size everywhere.\nexport const DEFAULT_TEXT_SIZE = 12;\nexport const HEADING_TEXT_SIZES: Record<number, number> = { 1: 24, 2: 18, 3: 14 };\nexport const DEFAULT_TEXT_COLOR = '#1f2933';\n\n// What the tokens in a block's html are filled with, per page.\nexport interface TextTokenContext {\n pageNumber: number;\n pageName: string;\n reportName: string;\n}\n\n// One styled stretch of text.\nexport interface TextRun {\n text: string;\n bold?: boolean;\n italic?: boolean;\n underline?: boolean;\n strike?: boolean;\n // #rrggbb\n color?: string;\n highlight?: string;\n // points\n fontSize?: number;\n fontFace?: string;\n link?: string;\n}\n\n// One line-starting block: a paragraph, a heading or a list item.\nexport interface TextParagraph {\n runs: TextRun[];\n align?: 'left' | 'center' | 'right' | 'justify';\n bullet?: 'bullet' | 'number';\n heading?: number;\n}\n\n// The tokens a block may carry, with what fills each. {{page.number}} is the\n// page's position among the report's pages (1-based), which is what makes a\n// shared footer number every page correctly.\nconst TOKENS: Record<string, (context: TextTokenContext) => string> = {\n 'page.number': (context) => String(context.pageNumber),\n 'page.name': (context) => context.pageName,\n 'report.name': (context) => context.reportName,\n};\n\n// Replace every {{token}} in the html. Values are html-escaped: a page named\n// \"R&D <draft>\" must read as that, not as markup.\nexport function fillTextTokens(html: string, context: TextTokenContext): string {\n return html.replace(/\\{\\{\\s*([a-z.]+)\\s*\\}\\}/gi, (match, token: string) => {\n const fill = TOKENS[token.toLowerCase()];\n\n return fill ? escapeHtml(fill(context)) : match;\n });\n}\n\n// Walk a block's html into paragraphs of styled runs — the shape both exports\n// draw from. Tokens are filled first so a page number is just text by then.\nexport function textParagraphs(html: string, context: TextTokenContext): TextParagraph[] {\n const document = new DOMParser().parseFromString(`<body>${fillTextTokens(html, context)}</body>`, 'text/html');\n const paragraphs: TextParagraph[] = [];\n\n walkBlocks(document.body, paragraphs, null);\n\n return paragraphs.filter((paragraph, index) =>\n // Keep an empty paragraph between two others (a deliberate blank line), but\n // not one left dangling at either end.\n paragraph.runs.length || (index > 0 && index < paragraphs.length - 1));\n}\n\n// The html as plain text — what a block says, for anything that cannot style it.\nexport function textPlain(html: string, context: TextTokenContext): string {\n return textParagraphs(html, context)\n .map((paragraph) => paragraph.runs.map((run) => run.text).join(''))\n .join('\\n');\n}\n\nfunction walkBlocks(\n parent: Node,\n paragraphs: TextParagraph[],\n list: 'bullet' | 'number' | null,\n): void {\n // Loose inline content between blocks (text straight under <body> or <li>)\n // is gathered into a paragraph of its own.\n let loose: TextParagraph | null = null;\n const flush = () => {\n if (loose) {\n paragraphs.push(loose);\n loose = null;\n }\n };\n\n parent.childNodes.forEach((node) => {\n const name = node.nodeName.toLowerCase();\n\n if (name === 'ul' || name === 'ol') {\n flush();\n walkBlocks(node, paragraphs, name === 'ul' ? 'bullet' : 'number');\n\n return;\n }\n\n if (name === 'li') {\n flush();\n const item: TextParagraph = { runs: [], bullet: list ?? 'bullet' };\n const nested: TextParagraph[] = [];\n // A list item's first paragraph IS the item; anything after it is its own\n // line under the same bullet.\n walkBlocks(node, nested, list);\n const [first, ...rest] = nested.length ? nested : [item];\n paragraphs.push({ ...first, bullet: list ?? 'bullet' }, ...rest);\n\n return;\n }\n\n if (name === 'p' || /^h[1-3]$/.test(name)) {\n flush();\n const element = node as HTMLElement;\n const heading = name.startsWith('h') ? Number(name[1]) : undefined;\n const paragraph: TextParagraph = {\n runs: [],\n align: blockAlign(element),\n bullet: undefined,\n heading,\n };\n const base: Partial<TextRun> = heading\n ? { bold: true, fontSize: HEADING_TEXT_SIZES[heading] }\n : {};\n\n walkInline(node, base, paragraph, paragraphs);\n paragraphs.push(paragraph);\n\n return;\n }\n\n loose = loose ?? { runs: [] };\n walkInline(node, {}, loose, paragraphs, true);\n });\n\n flush();\n}\n\n// Accumulate inline styles down the tree. A <br> ends the current line: the\n// runs after it start a new paragraph with the same alignment and bullet.\nfunction walkInline(\n node: Node,\n style: Partial<TextRun>,\n paragraph: TextParagraph,\n paragraphs: TextParagraph[],\n isSelf = false,\n): void {\n const visit = (child: Node) => {\n if (child.nodeType === Node.TEXT_NODE) {\n const text = child.textContent ?? '';\n if (text) {\n paragraph.runs.push({ ...style, text });\n }\n\n return;\n }\n\n if (child.nodeType !== Node.ELEMENT_NODE) {\n return;\n }\n\n const element = child as HTMLElement;\n const name = element.nodeName.toLowerCase();\n\n if (name === 'br') {\n paragraphs.push({ ...paragraph, runs: [...paragraph.runs] });\n paragraph.runs.length = 0;\n\n return;\n }\n\n walkInline(element, { ...style, ...inlineStyle(element) }, paragraph, paragraphs);\n };\n\n if (isSelf) {\n visit(node);\n } else {\n node.childNodes.forEach(visit);\n }\n}\n\nfunction inlineStyle(element: HTMLElement): Partial<TextRun> {\n const name = element.nodeName.toLowerCase();\n const style: Partial<TextRun> = {};\n\n if (name === 'strong') {\n style.bold = true;\n }\n if (name === 'em') {\n style.italic = true;\n }\n if (name === 'u') {\n style.underline = true;\n }\n if (name === 's') {\n style.strike = true;\n }\n if (name === 'a') {\n style.link = element.getAttribute('href') ?? undefined;\n style.underline = true;\n }\n\n const css = element.style;\n if (css.color) {\n style.color = hexColor(css.color);\n }\n if (css.backgroundColor) {\n style.highlight = hexColor(css.backgroundColor);\n }\n if (css.fontSize) {\n style.fontSize = points(css.fontSize);\n }\n if (css.fontWeight) {\n style.bold = css.fontWeight === 'bold' || Number(css.fontWeight) >= 600;\n }\n if (css.fontStyle) {\n style.italic = css.fontStyle === 'italic';\n }\n if (css.textDecoration) {\n style.underline = css.textDecoration.includes('underline');\n style.strike = css.textDecoration.includes('line-through');\n }\n if (css.fontFamily) {\n style.fontFace = css.fontFamily.split(',')[0].replace(/[\"']/g, '').trim();\n }\n\n return style;\n}\n\nfunction blockAlign(element: HTMLElement): TextParagraph['align'] {\n const align = element.style.textAlign;\n\n return align === 'center' || align === 'right' || align === 'justify' ? align : undefined;\n}\n\n// A CSS font-size in points. The canvas renders at 96px per inch, so 1px is\n// exactly 0.75pt; em/rem/% are relative to the body size.\nfunction points(value: string): number | undefined {\n const match = /^([\\d.]+)(pt|px|em|rem|%)$/.exec(value.trim());\n if (!match) {\n return undefined;\n }\n\n const size = Number(match[1]);\n switch (match[2]) {\n case 'pt':\n return size;\n case 'px':\n return size * 0.75;\n case '%':\n return (size / 100) * DEFAULT_TEXT_SIZE;\n default:\n return size * DEFAULT_TEXT_SIZE;\n }\n}\n\n// Any CSS color the allowlist lets through (hex, rgb(), a name) as #rrggbb —\n// the one form both exports accept. The browser resolves it, so a named color\n// comes out exactly as the canvas painted it.\nlet colorContext: CanvasRenderingContext2D | null = null;\n\nfunction hexColor(value: string): string | undefined {\n colorContext = colorContext ?? document.createElement('canvas').getContext('2d');\n if (!colorContext) {\n return undefined;\n }\n\n colorContext.fillStyle = '#000000';\n colorContext.fillStyle = value;\n const resolved = String(colorContext.fillStyle);\n\n if (resolved.startsWith('#')) {\n return resolved;\n }\n\n // rgba(...) for a translucent color — drop the alpha, keep the hue.\n const channels = resolved.match(/[\\d.]+/g)?.slice(0, 3).map(Number) ?? [];\n\n return channels.length === 3\n ? `#${channels.map((channel) => Math.round(channel).toString(16).padStart(2, '0')).join('')}`\n : undefined;\n}\n\nexport function escapeHtml(value: string): string {\n return value\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;');\n}\n","import { WaterfallStepKind } from '../interfaces/report.interface';\n\n\n// The report chart palette — one definition shared by the ECharts theme (on\n// screen), the PowerPoint export's native chart colors, and the PDF export,\n// so a series keeps its color across every medium.\nexport const REPORT_CHART_COLORS = [\n '4e79a7', 'f28e2b', 'e15759', '76b7b2', '59a14f',\n 'edc948', 'b07aa1', 'ff9da7', '9c755f', 'bab0ac',\n];\n\n// CSS-hex form for ECharts.\nexport const REPORT_CHART_COLORS_CSS = REPORT_CHART_COLORS.map((color) => `#${color}`);\n\n// A waterfall colors each bar by what it does to the running total, in the\n// order Excel and PowerPoint use by default: a rise takes the first series\n// color, a fall the second, and the closing total a neutral gray.\nexport const REPORT_WATERFALL_COLORS: Record<WaterfallStepKind, string> = {\n rise: REPORT_CHART_COLORS[0],\n fall: REPORT_CHART_COLORS[1],\n total: REPORT_CHART_COLORS[9],\n};\n","// The report charts' typeface and axis-label size. The ECharts theme draws with\n// them, and the option builder measures axis labels with them, so the room it\n// leaves around the labels matches what is drawn.\nexport const REPORT_CHART_FONT_FAMILY = 'Roboto, \"Helvetica Neue\", sans-serif';\nexport const REPORT_AXIS_LABEL_FONT_SIZE = 11;\n","import type { EChartsOption, LegendComponentOption, SeriesOption, TooltipComponentFormatterCallbackParams } from 'echarts';\n\nimport { format, isValid, parseISO } from 'date-fns';\n\nimport { formatMeasureValue } from './format';\nimport {\n AxisChartType,\n ChartConfig,\n ChartGranularity,\n ComponentData,\n GRANULARITY_OPTIONS,\n LegendPosition,\n ListConfig,\n ReportComponent,\n WaterfallStepKind,\n} from './interfaces/report.interface';\nimport { escapeHtml } from './text';\nimport { REPORT_WATERFALL_COLORS } from './theme/palette';\nimport { REPORT_AXIS_LABEL_FONT_SIZE, REPORT_CHART_FONT_FAMILY } from './theme/typography';\n\n\n// Room for the category axis's title. ECharts 5's containLabel keeps the TICK\n// labels inside the grid but not the axis name, so without this a vertical\n// chart's title runs off the bottom edge or under a bottom legend.\nconst AXIS_NAME_ROOM = 20;\n// ECharts' own default gap between the axis line and its tick labels.\nconst AXIS_LABEL_MARGIN = 8;\n// Clearance between the longest tick label and a horizontal chart's rotated\n// title, so the two never touch.\nconst AXIS_NAME_CLEARANCE = 6;\n// A horizontal chart's category labels are cut short with an ellipsis past\n// this width (the tooltip still shows them in full), so one long label cannot\n// squeeze the plot away.\nconst CATEGORY_LABEL_MAX_WIDTH = 160;\nconst LABEL_ELLIPSIS = '…';\n// The font the theme draws axis labels in, as a canvas font string. Labels are\n// measured in it the way ECharts measures them for containLabel, so a\n// horizontal chart's title lands exactly beyond the widest label.\nconst AXIS_LABEL_FONT = `${REPORT_AXIS_LABEL_FONT_SIZE}px ${REPORT_CHART_FONT_FAMILY}`;\n\n// Which edge of the plot the category axis's title sits on: below a vertical\n// chart, to the left of a horizontal one.\ntype AxisTitleSide = 'bottom' | 'left';\n\n// The plot's distance from each edge of the chart, in pixels.\ninterface AxisGridRoom {\n left: number;\n right: number;\n top: number;\n bottom: number;\n containLabel: boolean;\n}\n\n\n// colorBy applies only to single-dimension bar charts, and only when splitBy\n// isn't already driving multiple series: it colors each bar by its category and\n// shows a legend (one series per category, overlapped to full width).\n//\n// It is the DEFAULT for a categorical bar chart rather than something the config\n// has to ask for. A bar chart whose x-axis is a category — regions, statuses,\n// stores — is comparing those categories to each other, and one flat color with\n// no legend is the wrong reading of it in essentially every case. Requiring\n// colorBy to opt in meant every such chart rendered monochrome unless whoever\n// wrote the config remembered an optional property, which is a default set the\n// wrong way round: the common case should not need the flag.\n//\n// A TIME axis is excluded: consecutive periods are one series moving, not\n// categories being compared, and coloring each month differently reads as\n// unrelated groups. Explicitly opting out — colorBy: {column: ''} or a\n// config.legend of 'hidden' — still wins, so a caller that wants one flat color\n// can say so.\n//\n// \"Bar chart\" is the type the lone measure is actually DRAWN as: its own type\n// when it names one, which can turn a line chart's single series into bars or\n// a bar chart's into a line.\nexport function isColorBy(config: ChartConfig): boolean {\n if (config.splitBy?.column || (config.measures?.[0]?.type ?? config.chartType ?? 'bar') !== 'bar') {\n return false;\n }\n\n if (config.colorBy) {\n return !!config.colorBy.column;\n }\n\n return (config.xAxis?.kind ?? 'category') === 'category'\n && !config.xAxis?.granularity\n && (config.measures?.length ?? 1) <= 1;\n}\n\n\n// The column colorBy groups by — its own when the config named one, otherwise\n// the x-axis it defaults to coloring.\nexport function colorByColumn(config: ChartConfig): string | undefined {\n return isColorBy(config)\n ? (config.colorBy?.column || config.xAxis?.column)\n : undefined;\n}\n\n\n// Categories + named series extracted from a chart component's config + rows —\n// the one pivot (splitBy → series, measures → series) shared by the on-screen\n// ECharts option below AND the PowerPoint export's native chart data, so both\n// media plot identical numbers.\n//\n// A series' `type` is the type its measure asks to be drawn as, and is absent\n// when the measure leaves it to the chart's chartType (see seriesTypes).\nexport interface ExtractedChartSeries {\n categories: string[];\n series: { name: string; values: (number | null)[]; type?: AxisChartType }[];\n}\n\nexport function extractChartSeries(component: ReportComponent, data: ComponentData): ExtractedChartSeries {\n const config = component.config as ChartConfig;\n const xColumn = config.xAxis?.column ?? data.columns[0];\n const splitColumn = config.splitBy?.column;\n // colorBy emits one series per category too (so each bar carries its own\n // color + legend entry), but the bars are overlapped to full width in\n // buildAxisOption rather than laid side-by-side. splitBy wins if both are set.\n const groupColumn = splitColumn || colorByColumn(config);\n const measures = config.measures?.length\n ? config.measures\n : [{ column: data.columns[data.columns.length - 1] }];\n\n const rawCategories = uniqueValues(data.rows, xColumn);\n const categories = rawCategories.map((category) => String(category ?? '—'));\n const series: ExtractedChartSeries['series'] = [];\n\n if (groupColumn) {\n // One series per group value (splitBy/colorBy), pivoted over the first measure.\n const measure = measures[0];\n for (const groupValue of uniqueValues(data.rows, groupColumn)) {\n const byCategory = new Map<unknown, unknown>();\n for (const row of data.rows) {\n if (row[groupColumn] === groupValue) {\n byCategory.set(row[xColumn], row[measure.column]);\n }\n }\n\n series.push({\n name: String(groupValue ?? '—'),\n values: rawCategories.map((category) => numeric(byCategory.get(category))),\n type: measure.type,\n });\n }\n } else {\n for (const measure of measures) {\n const byCategory = new Map<unknown, unknown>();\n for (const row of data.rows) {\n byCategory.set(row[xColumn], row[measure.column]);\n }\n\n series.push({\n name: measure.label ?? measure.column,\n values: rawCategories.map((category) => numeric(byCategory.get(category))),\n type: measure.type,\n });\n }\n }\n\n return { categories, series };\n}\n\n// The type each extracted series is drawn as: its measure's own type when it\n// names one, the chart's chartType otherwise. More than one distinct type is a\n// combo chart. Shared with the PowerPoint export so both media draw each series\n// the same way.\nexport function seriesTypes(extracted: ExtractedChartSeries, chartType: AxisChartType): AxisChartType[] {\n return extracted.series.map((series) => series.type ?? chartType);\n}\n\n// One bar of a waterfall. `start` is the running total before it, where the bar\n// starts, and `change` its signed height, so it ends at start + change. The\n// closing total starts at zero and its change is the whole running total.\nexport interface WaterfallStep {\n category: string;\n start: number;\n change: number | null;\n kind: WaterfallStepKind;\n}\n\nexport interface ExtractedWaterfall {\n name: string;\n steps: WaterfallStep[];\n}\n\nexport const WATERFALL_TOTAL_LABEL = 'Total';\n\n// A waterfall's bars from its one measure: each category's value is how far the\n// running total moves there, and a last Total bar shows where it ended. A\n// category with no value moves nothing and draws no bar. Shared with the\n// PowerPoint export so both media draw the same steps.\nexport function extractWaterfall(component: ReportComponent, data: ComponentData): ExtractedWaterfall {\n const extracted = extractChartSeries(component, data);\n const values = extracted.series[0]?.values ?? [];\n const steps: WaterfallStep[] = [];\n let total = 0;\n\n extracted.categories.forEach((category, index) => {\n const change = values[index] ?? null;\n steps.push({ category, start: total, change, kind: (change ?? 0) < 0 ? 'fall' : 'rise' });\n total += change ?? 0;\n });\n\n steps.push({ category: WATERFALL_TOTAL_LABEL, start: 0, change: total, kind: 'total' });\n\n return { name: extracted.series[0]?.name ?? '', steps };\n}\n\n// The one pure mapping from our standard camelCase chart config + the data\n// endpoint's rows to an ECharts option. Everything visual that isn't in the\n// registered 'report' theme is decided here, so report standards have exactly\n// two homes.\nexport function buildChartOption(component: ReportComponent, data: ComponentData): EChartsOption {\n const config = component.config as ChartConfig;\n const chartType = config.chartType ?? 'bar';\n\n if (chartType === 'pie' || chartType === 'donut') {\n return buildPieOption(component, data, chartType === 'donut');\n }\n\n if (chartType === 'waterfall') {\n return buildWaterfallOption(component, data);\n }\n\n return buildAxisOption(component, data, chartType);\n}\n\nfunction buildAxisOption(\n component: ReportComponent,\n data: ComponentData,\n chartType: AxisChartType,\n): EChartsOption {\n const config = component.config as ChartConfig;\n const extracted = extractChartSeries(component, data);\n const horizontal = config.orientation === 'horizontal';\n const colorBy = isColorBy(config);\n const types = seriesTypes(extracted, chartType);\n const combo = new Set(types).size > 1;\n\n // colorBy emits one series per category; overlapping them (barGap -100%) makes\n // each render at the full category-band width — one full-width, distinctly\n // colored bar per category — instead of side-by-side slivers. The layout props\n // are read from the first series of the coordinate system.\n //\n // Stacking sums every series that shares a stack name, whatever its type. In\n // a combo each type stacks only with its own kind, so a line of a rate never\n // sits on top of the bars' total.\n const series: SeriesOption[] = extracted.series.map((extractedSeries, index) => buildSeries(\n extractedSeries.name,\n extractedSeries.values,\n types[index],\n config.stacked ? (combo ? `total-${types[index]}` : 'total') : undefined,\n colorBy && index === 0,\n combo,\n ));\n\n const categoryAxis = categoryAxisOption(config, data, extracted.categories, horizontal);\n const valueAxis = { type: 'value' as const };\n\n const legendPosition = resolveLegendPosition(config, series.length, colorBy);\n\n return {\n grid: axisGrid(legendPosition, categoryTitleSide(config, horizontal)),\n legend: legendOption(legendPosition),\n // colorBy charts overlap N mostly-null series, so an axis tooltip would list\n // every category; an item tooltip shows just the hovered bar.\n tooltip: { trigger: colorBy ? 'item' : 'axis' },\n xAxis: horizontal ? valueAxis : categoryAxis,\n yAxis: horizontal ? categoryAxis : valueAxis,\n series,\n };\n}\n\n// The category axis of an axis chart or a waterfall: the categories in row\n// order, labeled as periods when the rows were bucketed by time.\n//\n// Horizontal bars read top-down: ECharts draws category 0 at the bottom, so the\n// axis is inverted to put the first row (the largest of a top-N, a waterfall's\n// first step) at the top. The rotated title sits just beyond the longest label\n// rather than at a fixed gap that would put it on top of the labels.\nfunction categoryAxisOption(config: ChartConfig, data: ComponentData, categories: string[], horizontal: boolean) {\n const granularity = bucketGranularity(data);\n const periodLabel = periodAxisLabel(granularity, categories);\n const axis = {\n type: 'category' as const,\n data: categories,\n inverse: horizontal,\n name: config.xAxis?.label,\n nameLocation: 'middle' as const,\n };\n\n if (!horizontal) {\n return {\n ...axis,\n nameGap: granularity && spansMultipleYears(categories) ? 40 : 28,\n ...periodLabel,\n };\n }\n\n // A period label ('May', 'Q2') is always short, so only a plain category is\n // cut short. The labels are cut here rather than by ECharts' own truncation,\n // so the title's gap is measured on exactly the text the axis draws.\n const shown = granularity\n ? null\n : new Map(categories.map((category) => [category, truncateAxisLabel(category)]));\n const labels = shown ? [...shown.values()] : displayedCategoryLabels(categories, granularity);\n\n return {\n ...axis,\n nameGap: widestAxisLabel(labels) + AXIS_LABEL_MARGIN + AXIS_NAME_CLEARANCE,\n ...(shown ? { axisLabel: { formatter: (value: string) => shown.get(value) ?? value } } : periodLabel),\n };\n}\n\n// The category axis's title side, or null when the axis has no title to make\n// room for.\nfunction categoryTitleSide(config: ChartConfig, horizontal: boolean): AxisTitleSide | null {\n if (!config.xAxis?.label) {\n return null;\n }\n\n return horizontal ? 'left' : 'bottom';\n}\n\n// The tick labels as the axis shows them: a bucket's primary period label\n// ('May', 'Q2'), otherwise the category itself. The year a multi-year axis\n// prints under a period is left out, as it is never the wider line.\nfunction displayedCategoryLabels(categories: string[], granularity: ChartGranularity | null): string[] {\n return granularity\n ? categories.map((category) => periodLabelParts(category, granularity)?.primary ?? category)\n : categories;\n}\n\n// The pixel width of the widest label. A label that breaks over several lines\n// is as wide as its longest line.\nfunction widestAxisLabel(labels: string[]): number {\n return labels.reduce((widest, label) => label.split('\\n').reduce(\n (lineWidest, line) => Math.max(lineWidest, axisLabelWidth(line)),\n widest,\n ), 0);\n}\n\n// A category label cut to CATEGORY_LABEL_MAX_WIDTH, line by line: the longest\n// start of each line that still fits with the ellipsis after it.\nfunction truncateAxisLabel(label: string): string {\n return label.split('\\n').map((line) => {\n if (axisLabelWidth(line) <= CATEGORY_LABEL_MAX_WIDTH) {\n return line;\n }\n\n // Code points, so an emoji or other surrogate pair is never split.\n const characters = Array.from(line);\n const cut = (length: number) => `${characters.slice(0, length).join('').trimEnd()}${LABEL_ELLIPSIS}`;\n let fits = 0;\n let tooLong = characters.length;\n while (tooLong - fits > 1) {\n const length = Math.floor((fits + tooLong) / 2);\n if (axisLabelWidth(cut(length)) <= CATEGORY_LABEL_MAX_WIDTH) {\n fits = length;\n } else {\n tooLong = length;\n }\n }\n\n return cut(fits);\n }).join('\\n');\n}\n\n// One line's width in the axis-label font, measured on a canvas the way\n// ECharts measures it for containLabel. Outside a browser there is no canvas\n// to measure with, so the line counts as zero width.\nlet axisLabelContext: CanvasRenderingContext2D | null = null;\n\nfunction axisLabelWidth(line: string): number {\n if (!axisLabelContext && typeof document !== 'undefined') {\n axisLabelContext = document.createElement('canvas').getContext('2d');\n }\n\n if (!axisLabelContext) {\n return 0;\n }\n\n axisLabelContext.font = AXIS_LABEL_FONT;\n\n return axisLabelContext.measureText(line).width;\n}\n\nfunction buildWaterfallOption(component: ReportComponent, data: ComponentData): EChartsOption {\n const config = component.config as ChartConfig;\n const waterfall = extractWaterfall(component, data);\n const horizontal = config.orientation === 'horizontal';\n const categoryAxis = categoryAxisOption(config, data, waterfall.steps.map((step) => step.category), horizontal);\n const valueAxis = { type: 'value' as const };\n // One visible series, so the legend is hidden unless the config pins it.\n const legendPosition = resolveLegendPosition(config, 1);\n const granularity = bucketGranularity(data);\n\n return {\n grid: axisGrid(legendPosition, categoryTitleSide(config, horizontal)),\n legend: { ...legendOption(legendPosition), data: [waterfall.name] },\n // Per bar: the invisible base is silent, so only a step answers the hover.\n tooltip: {\n trigger: 'item',\n formatter: (params: TooltipComponentFormatterCallbackParams) => waterfallTooltip(\n waterfall,\n (Array.isArray(params) ? params[0] : params).dataIndex,\n granularity,\n ),\n },\n xAxis: horizontal ? valueAxis : categoryAxis,\n yAxis: horizontal ? categoryAxis : valueAxis,\n series: waterfallSeries(waterfall),\n };\n}\n\n// An invisible base series lifts each visible bar to where its step starts.\n// Both stack with the 'all' strategy, which adds signed values in series order,\n// so a fall draws DOWN from the total before it, even across zero. The default\n// same-sign stacking would hang a negative bar below the axis instead.\nfunction waterfallSeries(waterfall: ExtractedWaterfall): SeriesOption[] {\n return [\n {\n type: 'bar',\n stack: 'waterfall',\n stackStrategy: 'all',\n data: waterfall.steps.map((step) => step.start),\n barMaxWidth: 48,\n itemStyle: { color: 'transparent' },\n silent: true,\n },\n {\n name: waterfall.name,\n type: 'bar',\n stack: 'waterfall',\n stackStrategy: 'all',\n barMaxWidth: 48,\n // The series color is the rise color so a pinned legend shows it; each\n // bar is then colored by what it does to the total.\n itemStyle: { color: `#${REPORT_WATERFALL_COLORS.rise}` },\n data: waterfall.steps.map((step) => ({\n value: step.change,\n itemStyle: { color: `#${REPORT_WATERFALL_COLORS[step.kind]}` },\n })),\n },\n ];\n}\n\n// A step's tooltip: its period, how far it moved the running total and where\n// that left it. The closing Total shows the total alone. The category and the\n// measure name come from the data and the config, and ECharts sets the tooltip\n// as HTML, so both are escaped.\nfunction waterfallTooltip(waterfall: ExtractedWaterfall, index: number, granularity: ChartGranularity | null): string {\n const step = waterfall.steps[index];\n const category = escapeHtml(granularity ? formatPeriodLabel(step.category, granularity, true) : step.category);\n const name = escapeHtml(waterfall.name);\n\n if (step.kind === 'total') {\n return `${category}<br/>${name}: ${formatMeasureValue(step.change)}`;\n }\n\n const sign = (step.change ?? 0) > 0 ? '+' : '';\n\n return `${category}<br/>${name}: ${sign}${formatMeasureValue(step.change)}`\n + `<br/>Running total: ${formatMeasureValue(step.start + (step.change ?? 0))}`;\n}\n\n// Default legend placement when the config doesn't pin one: pie charts read\n// best with the slice key beside them (right); axis charts only need a legend\n// to tell multiple series apart, so a single-series chart hides it. An explicit\n// config.legend (including 'hidden') always wins. Shared with the PowerPoint\n// export so both media place the legend identically.\nexport function resolveLegendPosition(config: ChartConfig, seriesCount: number, colorBy = false): LegendPosition {\n if (config.legend) {\n return config.legend;\n }\n\n const pie = config.chartType === 'pie' || config.chartType === 'donut';\n\n // colorBy maps each bar's color to its category, so it needs a legend even\n // though it's a single measure.\n return pie || colorBy || seriesCount > 1 ? (pie ? 'right' : 'top') : 'hidden';\n}\n\nfunction legendOption(position: LegendPosition): LegendComponentOption {\n if (position === 'hidden') {\n return { show: false };\n }\n\n const base: LegendComponentOption = { type: 'scroll' };\n\n switch (position) {\n case 'bottom':\n return { ...base, bottom: 0 };\n case 'left':\n return { ...base, orient: 'vertical', left: 0, top: 'middle' };\n case 'right':\n return { ...base, orient: 'vertical', right: 0, top: 'middle' };\n default:\n return { ...base, top: 0 };\n }\n}\n\n// The plot's grid: room on the legend's side so it never overlaps the\n// bars/lines, plus room for the category axis's title on its side, which\n// containLabel does not reserve (it covers the tick labels only).\nfunction axisGrid(position: LegendPosition, titleSide: AxisTitleSide | null): EChartsOption['grid'] {\n const grid = legendGrid(position);\n\n switch (titleSide) {\n case 'bottom':\n return { ...grid, bottom: grid.bottom + AXIS_NAME_ROOM };\n case 'left':\n return { ...grid, left: grid.left + AXIS_NAME_ROOM };\n default:\n return grid;\n }\n}\n\n// Plot-edge room on whichever side the legend occupies; containLabel keeps the\n// tick labels inside what is left.\nfunction legendGrid(position: LegendPosition): AxisGridRoom {\n const base: AxisGridRoom = { left: 8, right: 16, top: 8, bottom: 8, containLabel: true };\n\n switch (position) {\n case 'bottom':\n return { ...base, bottom: 32 };\n case 'left':\n return { ...base, left: 96 };\n case 'right':\n return { ...base, right: 96 };\n case 'hidden':\n return base;\n default:\n return { ...base, top: 32 };\n }\n}\n\nfunction buildSeries(\n name: string,\n values: (number | null)[],\n type: AxisChartType,\n stack: string | undefined,\n overlap: boolean,\n combo: boolean,\n): SeriesOption {\n if (type === 'bar') {\n return {\n name,\n type: 'bar',\n data: values,\n stack,\n barMaxWidth: 48,\n // colorBy: overlap the per-category series so each bar renders full-width.\n ...(overlap ? { barGap: '-100%', barCategoryGap: '20%' } : {}),\n };\n }\n\n return {\n name,\n type: 'line',\n data: values,\n stack,\n smooth: true,\n symbolSize: 6,\n areaStyle: type === 'area' ? { opacity: 0.25 } : undefined,\n // In a combo the line is drawn over the bars whatever order the measures\n // come in; at the same z a later bar series would paint across it.\n ...(combo ? { z: 3 } : {}),\n };\n}\n\nfunction buildPieOption(component: ReportComponent, data: ComponentData, donut: boolean): EChartsOption {\n const config = component.config as ChartConfig;\n const extracted = extractChartSeries(component, data);\n const values = extracted.series[0]?.values ?? [];\n const legendPosition = resolveLegendPosition(config, extracted.series.length);\n\n return {\n tooltip: { trigger: 'item' },\n legend: legendOption(legendPosition),\n series: [\n {\n type: 'pie',\n radius: donut ? ['45%', '72%'] : '72%',\n center: pieCenter(legendPosition),\n label: { show: false },\n data: extracted.categories.map((category, index) => ({\n name: category,\n value: values[index] ?? 0,\n })),\n },\n ],\n };\n}\n\n// Nudge the pie off-center toward the opposite edge from its legend so the two\n// don't collide; centered when the legend is hidden.\nfunction pieCenter(position: LegendPosition): [string, string] {\n switch (position) {\n case 'left':\n return ['60%', '50%'];\n case 'right':\n return ['40%', '50%'];\n case 'top':\n return ['50%', '58%'];\n case 'bottom':\n return ['50%', '46%'];\n default:\n return ['50%', '50%'];\n }\n}\n\nfunction uniqueValues(rows: Record<string, unknown>[], column: string): unknown[] {\n const seen = new Set<unknown>();\n const values: unknown[] = [];\n for (const row of rows) {\n const value = row[column];\n if (!seen.has(value)) {\n seen.add(value);\n values.push(value);\n }\n }\n\n return values;\n}\n\nfunction numeric(value: unknown): number | null {\n if (value === null || value === undefined || value === '') {\n return null;\n }\n\n const parsed = Number(value);\n\n return Number.isFinite(parsed) ? parsed : null;\n}\n\n// The effective time bucket the rows were grouped into (from the data endpoint),\n// or null when the x-axis isn't a time axis — gates the compact period labels.\nfunction bucketGranularity(data: ComponentData): ChartGranularity | null {\n return data.granularity && GRANULARITY_OPTIONS.some((option) => option.value === data.granularity)\n ? data.granularity\n : null;\n}\n\n// Whether the period-start categories cross a year boundary. When they don't,\n// the year is pure noise on every label, so it's dropped entirely.\nexport function spansMultipleYears(categories: string[]): boolean {\n const years = new Set<number>();\n for (const category of categories) {\n const date = parseISO(category);\n if (isValid(date)) {\n years.add(date.getFullYear());\n }\n }\n\n return years.size > 1;\n}\n\n// A bucket's period-start split into its primary label and its year. Day/week\n// read as \"May 1\", month as \"May\", quarter as \"Q2\", year as \"2025\". Returns null\n// for a value that isn't a parseable date (left as-is by callers).\nfunction periodLabelParts(value: string, granularity: ChartGranularity): { primary: string; year: string } | null {\n const date = parseISO(value);\n if (!isValid(date)) {\n return null;\n }\n\n const year = String(date.getFullYear());\n switch (granularity) {\n case 'year':\n return { primary: year, year };\n case 'quarter':\n return { primary: `Q${Math.floor(date.getMonth() / 3) + 1}`, year };\n case 'month':\n return { primary: format(date, 'MMMM'), year };\n default: // day, week — the bucket start as a compact \"MMM d\"\n return { primary: format(date, 'MMM d'), year };\n }\n}\n\n// A compact single-line period label (year appended only when the data spans\n// years) — for media that can't do a styled second line, e.g. PowerPoint.\nexport function formatPeriodLabel(value: string, granularity: ChartGranularity, multiYear: boolean): string {\n const parts = periodLabelParts(value, granularity);\n if (!parts) {\n return value;\n }\n\n return multiYear && granularity !== 'year' ? `${parts.primary} ${parts.year}` : parts.primary;\n}\n\n// A cross-tab's column headings, the one rule the grid and the PDF/PowerPoint\n// exports share. The first is the row key and keeps its authored label; the\n// rest are pivot VALUES. When the pivot axis is a time dimension the server\n// sends the grain it bucketed at, so a period-start like \"2026-01-01\" reads\n// \"January 2026\", as the chart's x-axis labels it.\nexport function pivotHeadings(config: ListConfig, data: ComponentData): string[] {\n const columns = data.columns ?? [];\n const multiYear = spansMultipleYears(columns);\n\n return columns.map((column, index) => {\n if (index === 0) {\n return config.rowBy?.label || column;\n }\n\n return data.granularity ? formatPeriodLabel(column, data.granularity, multiYear) : column;\n });\n}\n\n// ECharts category-axis label config for a time bucket: the primary label on\n// line one, and — only when the data spans multiple years — the year on a small\n// gray second line, centered under the tick (year granularity needs no second\n// line, it already is the year). Empty for a non-time axis (labels as-is).\nfunction periodAxisLabel(granularity: ChartGranularity | null, categories: string[]): { axisLabel?: Record<string, unknown> } {\n if (!granularity) {\n return {};\n }\n\n const multiYear = spansMultipleYears(categories);\n\n return {\n axisLabel: {\n formatter: (value: string) => {\n const parts = periodLabelParts(value, granularity);\n if (!parts) {\n return value;\n }\n\n return multiYear && granularity !== 'year'\n ? `${parts.primary}\\n{yr|${parts.year}}`\n : parts.primary;\n },\n rich: { yr: { fontSize: 10, color: '#9aa0a6', lineHeight: 14 } },\n },\n };\n}\n","import { ChangeDetectionStrategy, Component, Input, OnChanges } from '@angular/core';\n\nimport type { EChartsOption, ECharts } from 'echarts';\nimport { NgxEchartsDirective } from 'ngx-echarts';\n\nimport { ComponentData, ReportComponent } from '../../interfaces/report.interface';\nimport { buildChartOption } from '../../option-builder';\n\n\n// ECharts host for a chart component. Pure rendering: the parent owns the\n// data fetch; this maps (component config, rows) → option and exposes the\n// chart instance for resize + the future image exports (getDataURL needs the\n// canvas renderer registered in theme/echarts.ts).\n@Component({\n selector: 'app-report-component-chart',\n templateUrl: './component-chart.component.html',\n styleUrls: ['./component-chart.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n NgxEchartsDirective,\n ],\n})\nexport class ComponentChartComponent implements OnChanges {\n\n @Input() public component: ReportComponent;\n @Input() public data: ComponentData | null = null;\n\n public options: EChartsOption | null = null;\n\n private _chart: ECharts | null = null;\n\n public ngOnChanges(): void {\n this.options = this.component && this.data\n ? buildChartOption(this.component, this.data)\n : null;\n }\n\n public onChartInit(chart: ECharts): void {\n this._chart = chart;\n }\n\n // Called by the canvas when the box is resized in edit mode.\n public resize(): void {\n this._chart?.resize();\n }\n\n // High-res image for the (later-phase) PPT/PDF exports.\n public getDataURL(pixelRatio = 3): string | null {\n return this._chart?.getDataURL({\n type: 'png',\n pixelRatio,\n backgroundColor: '#ffffff',\n }) ?? null;\n }\n}\n","<div\n class=\"chart-host\"\n echarts\n [options]=\"options ?? {}\"\n [theme]=\"'report'\"\n [autoResize]=\"true\"\n (chartInit)=\"onChartInit($event)\">\n</div>\n","import { ChangeDetectionStrategy, Component, Input, OnChanges, input } from '@angular/core';\n\nimport { formatMeasureValue } from '../../format';\nimport { ComponentData, KpiConfig, ReportComponent } from '../../interfaces/report.interface';\n\n\n// A single big number: the component's measure aggregated over all (filtered)\n// rows server-side; this just formats the one cell.\n@Component({\n selector: 'app-report-component-kpi',\n templateUrl: './component-kpi.component.html',\n styleUrls: ['./component-kpi.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n})\nexport class ComponentKpiComponent implements OnChanges {\n\n @Input() public component: ReportComponent;\n @Input() public data: ComponentData | null = null;\n\n // Whether a percent value is a 0-1 ratio (the report's percentFormat). An\n // older server sends it already x100, and it is printed as it came.\n public readonly ratioPercent = input(true);\n\n public value = '—';\n public label = '';\n\n public ngOnChanges(): void {\n const config = (this.component?.config ?? {}) as KpiConfig;\n this.label = config.measure?.label ?? '';\n\n const row = this.data?.rows?.[0];\n if (!row) {\n this.value = '—';\n\n return;\n }\n\n const column = config.measure?.column ?? Object.keys(row)[0];\n this.value = formatMeasureValue(\n row[column],\n config.measure?.format,\n config.measure?.precision,\n this.ratioPercent(),\n );\n }\n}\n","<div class=\"kpi\">\n <div class=\"kpi-value\">{{ value }}</div>\n @if (label) {\n <div class=\"kpi-label\">{{ label }}</div>\n }\n</div>\n","import { Pipe, PipeTransform } from '@angular/core';\n\nimport { formatReportDate } from '../format';\n\n\n// A report row's date cell as the calendar day in the report's zone. Use it in\n// place of Angular's DatePipe, which reads a 'YYYY-MM-DD HH:MM:SS' value as the\n// browser's local wall time instead of the UTC instant it is.\n@Pipe({\n name: 'fsReportDate',\n standalone: true,\n})\nexport class ReportDatePipe implements PipeTransform {\n\n public transform(value: unknown, timezone: string): string {\n return formatReportDate(value, timezone);\n }\n}\n","import { ChangeDetectionStrategy, Component, DestroyRef, Input, OnInit, ViewChild, inject, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nimport { FsListComponent, FsListConfig, FsListModule, PaginationStrategy } from '@firestitch/list';\n\nimport { Observable, map } from 'rxjs';\n\nimport { ReportData } from '../../data/report.data';\nimport {\n ComponentData,\n ComponentDataState,\n ListConfig,\n ReportComponent,\n ReportSort,\n} from '../../interfaces/report.interface';\nimport { pivotHeadings } from '../../option-builder';\nimport { ReportDatePipe } from '../../pipes/report-date.pipe';\nimport { ReportFilterStateService } from '../../services/report-filter-state.service';\n\n\n// A list component: an FsList rendered from the component's config. It has no\n// filter bar of its own: its filters are group-keyed like every other\n// component's, so component-level groups render in the component header strip\n// (ReportComponentComponent) and report-level groups in the report bar, and\n// every request takes its values from the shared filter-state service.\n// Paging and sorting are pushed into the SQL wrap server-side.\n@Component({\n selector: 'app-report-component-list',\n templateUrl: './component-list.component.html',\n styleUrls: ['./component-list.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n FsListModule,\n ReportDatePipe,\n ],\n})\nexport class ComponentListComponent implements OnInit {\n\n @Input() public reportId: number;\n @Input() public component: ReportComponent;\n\n @ViewChild(FsListComponent)\n public listComponent: FsListComponent;\n\n public listConfig: FsListConfig;\n\n // A plain list's columns are authored and fixed at init. A cross-tab's are\n // the pivot dimension's VALUES, so they arrive with the rows and change\n // whenever the filters do — which is why this is a signal rather than the\n // one-shot read it used to be.\n public columns = signal<{ column: string; label?: string; format?: string }[]>([]);\n\n // A cross-tab sorts only by its row-key column: every other header is a\n // pivot value, and the server orders the long rows before pivoting, so a\n // click on \"Mar 2026\" has nothing to order by.\n public pivoted = signal(false);\n\n // A cut result is worse for a grid than for a list: the cut lands on the LONG\n // rows before the reshape, so a pivot value living only in the tail vanishes\n // as a whole COLUMN and straddled cells come back blank, indistinguishable\n // from a real zero. The parent's truncation banner never fires for a list\n // (it only renders what _load() fetched, which lists skip), so the warning\n // belongs here.\n public truncated = signal(false);\n\n // The report's effective zone, which date cells render in. Injected right\n // here rather than read off _filterState, which is declared further down and\n // is still undefined while this initializer runs.\n public readonly timezone = inject(ReportFilterStateService).timezone;\n\n private _reportData = inject(ReportData);\n private _filterState = inject(ReportFilterStateService);\n private _destroyRef = inject(DestroyRef);\n\n public ngOnInit(): void {\n const config = (this.component.config ?? {}) as ListConfig;\n this.pivoted.set(!!config.pivotBy?.column);\n this.columns.set(config.columns ?? []);\n\n this._initListConfig(config);\n\n // A change to any group this list's filters belong to (from the report bar\n // or the component header strip) re-runs the list.\n this._filterState.changesFor(this.component)\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe(() => this.listComponent?.reload());\n }\n\n private _initListConfig(config: ListConfig): void {\n // The viewer's last sort wins over the authored one, so a list recreated\n // in the same session (page switch, reload after an edit) keeps it.\n const sort: ReportSort | undefined = this._filterState.listSort(this.component.id) ?? config.sort;\n\n this.listConfig = {\n // Inside a report component the list is a clean data pane — no status\n // bar, no reload button (filter changes already refetch).\n status: false,\n reload: false,\n // FsList never touches the URL or persists sort/paging state. The sort\n // reaches the URL through ReportFilterStateService (setListSort), and\n // paging stays out of it.\n queryParam: false,\n persist: false,\n sort: sort\n ? { value: sort.column, direction: sort.direction ?? 'asc' }\n : undefined,\n // Load-more: the list keeps a fixed, scrollable height and appends the\n // next page in place instead of swapping pages. The button is pinned to\n // the bottom of the scroll pane (see component SCSS).\n //\n // Uses the Offset strategy (offset + limit) rather than Many: in\n // @firestitch/list the pagination template resolves `hasManyStrategy`\n // BEFORE `loadMoreEnabled`, and Many renders a forward-only page pager —\n // so Many would suppress the load-more button entirely. Offset + loadMore\n // is the combination that actually renders and appends. `_fetch` already\n // derives `page` from `offset`, so the server-side wrap is unaffected.\n paging: {\n limit: config.pageSize ?? 25,\n strategy: PaginationStrategy.Offset,\n },\n loadMore: {\n enabled: true,\n label: 'Load more',\n buttonType: 'stroked',\n },\n fetch: (query: any) => this._fetch(query),\n };\n }\n\n private _fetch(query: any): Observable<{ data: Record<string, unknown>[]; paging: any }> {\n // Many/load-more sends `offset` + `limit` (not `page`); derive the page so\n // the server-side wrap keeps working unchanged. Page strategy still sends\n // `page` directly.\n const pageSize = query.limit ?? 25;\n const page = query.page\n ?? (query.offset != null ? Math.floor(query.offset / pageSize) + 1 : 1);\n\n const state: ComponentDataState = {\n page,\n pageSize,\n };\n\n const order = String(query.order ?? '');\n if (order) {\n const [column, direction] = order.split(',');\n state.sort = { column, direction: direction === 'desc' ? 'desc' : 'asc' };\n }\n\n this._filterState.setListSort(this.component.id, state.sort ?? null);\n\n // One source for filter values, the same one charts, KPIs and the exports\n // read, so the list is filtered exactly as its header strip shows.\n const filters = this._filterState.resolveForComponent(this.component);\n\n return this._reportData\n .componentData(this.reportId, this.component.id, filters, state)\n .pipe(\n map((data: ComponentData) => {\n // A cross-tab's headers come back with the rows: the row-key column\n // first, then one per pivot value. Re-read them on every fetch, since\n // a filter change can add or remove a column.\n if (this.pivoted()) {\n this.columns.set(this._pivotColumns(data));\n this.truncated.set(!!data.truncated);\n }\n\n return {\n data: data.rows ?? [],\n paging: {\n limit: data.paging?.pageSize ?? state.pageSize,\n records: data.paging?.total ?? (data.rows?.length ?? 0),\n page: data.paging?.page ?? state.page,\n },\n };\n }),\n );\n }\n\n // A cross-tab's columns, built from the wire, headed by pivotHeadings(): the\n // same headings the PDF and PowerPoint exports print.\n private _pivotColumns(data: ComponentData): { column: string; label?: string; format?: string }[] {\n const config = (this.component.config ?? {}) as ListConfig;\n const headings = pivotHeadings(config, data);\n\n return (data.columns ?? []).map((column, index) => ({ column, label: headings[index] }));\n }\n}\n","@if (truncated()) {\n <div class=\"pivot-truncated\">\n This grid was built from a partial result, so some columns or values may be missing. Narrow it with a filter.\n </div>\n}\n\n<fs-list [config]=\"listConfig\">\n @for (column of columns(); track column.column) {\n <fs-list-column\n [name]=\"column.column\"\n [title]=\"column.label || column.column\"\n [sortable]=\"!pivoted() || $first\">\n <ng-template\n fs-list-cell\n let-row=\"row\">\n @if (column.format === 'date') {\n {{ row[column.column] | fsReportDate: timezone() }}\n } @else {\n {{ row[column.column] }}\n }\n </ng-template>\n </fs-list-column>\n }\n</fs-list>\n","import {\n ChangeDetectionStrategy, Component, DestroyRef, ElementRef, computed, effect, inject, input, output,\n untracked, viewChild,\n} from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\n\nimport { FsHtmlEditorComponent, FsHtmlEditorConfig } from '@firestitch/html-editor';\n\nimport {\n DEFAULT_TEXT_COLOR, DEFAULT_TEXT_SIZE, HEADING_TEXT_SIZES, TextTokenContext, fillTextTokens,\n} from '../../text';\n\n\n// Point sizes — the report's type unit (1:1 with PowerPoint and PDF).\nconst FONT_SIZES = ['8', '9', '10', '11', '12', '14', '16', '18', '20', '24', '28', '32', '36', '40', '48', '60', '72'];\n\n// The fields a block can carry, filled per page on the canvas and in exports.\nconst TOKENS = {\n '{{page.number}}': 'Page number',\n '{{page.name}}': 'Page name',\n '{{report.name}}': 'Report name',\n};\n\n// What the editor may produce — exactly what the server keeps\n// (ReportTextHtml) and the exports draw. Anything else would edit fine and\n// then vanish on save.\nconst ALLOWED_TAGS = ['p', 'h1', 'h2', 'h3', 'br', 'strong', 'em', 'u', 's', 'span', 'a', 'ul', 'ol', 'li'];\nconst ALLOWED_STYLES = ['color', 'background-color', 'font-size', 'font-weight', 'font-style', 'text-decoration', 'font-family', 'text-align'];\n\n// Froala's own toolbars and popups live on the body, not in the block; a press\n// on any of them is still part of editing the block.\nconst EDITOR_CHROME = '.fr-toolbar, .fr-popup, .fr-dropdown-menu, .fr-modal, .fr-tooltip';\n\n// A text block: authored rich text on the page.\n//\n// Read mode renders the stored html with its tokens ({{page.number}}, …) filled\n// for the page it is drawn on. The html has already been rebuilt server-side\n// from an allowlist (ReportTextHtml), which is what makes binding it as trusted\n// markup safe — Angular's own sanitizer would strip the inline styles that ARE\n// the formatting.\n//\n// Edit mode mounts <fs-html-editor> in its floating mode in place — the words\n// stay where they sit on the slide — with Froala's inline toolbar popping up\n// over them. The editor exists only while editing; the raw html is edited, so a\n// token reads as {{page.number}} while editing and as the number otherwise.\n//\n// The block never saves on its own: it emits the new html when editing ends\n// and the host persists it.\n@Component({\n selector: 'app-report-component-text',\n templateUrl: './component-text.component.html',\n styleUrls: ['./component-text.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n FormsModule,\n FsHtmlEditorComponent,\n ],\n host: {\n '(keydown)': 'onKeydown($event)',\n // The document type scale comes from the same constants the PowerPoint and\n // PDF exports draw with, so a paragraph is one size in all three.\n '[style.--text-size]': 'typeScale.body',\n '[style.--text-h1-size]': 'typeScale.h1',\n '[style.--text-h2-size]': 'typeScale.h2',\n '[style.--text-h3-size]': 'typeScale.h3',\n '[style.--text-color]': 'typeScale.color',\n },\n})\nexport class ComponentTextComponent {\n\n // The block's stored html (config.html). Its own input rather than read off\n // the component, so a saved edit — a new string on the same component — is\n // seen as a change and repaints.\n public readonly html = input('');\n public readonly tokens = input.required<TextTokenContext>();\n public readonly editing = input(false);\n\n // The html after an edit, only when it changed.\n public readonly saved = output<string>();\n\n // A press landed outside the block (or Escape): the host ends edit mode,\n // which saves.\n public readonly editEnded = output<void>();\n\n public readonly typeScale = {\n body: `${DEFAULT_TEXT_SIZE}pt`,\n h1: `${HEADING_TEXT_SIZES[1]}pt`,\n h2: `${HEADING_TEXT_SIZES[2]}pt`,\n h3: `${HEADING_TEXT_SIZES[3]}pt`,\n color: DEFAULT_TEXT_COLOR,\n };\n\n public readonly editorConfig: FsHtmlEditorConfig = {\n floating: true,\n autofocus: true,\n placeholder: 'Type here',\n buttons: [\n {\n name: 'insertField',\n title: 'Insert field',\n svgKey: 'tags',\n options: TOKENS,\n click: (editor, value) => editor.html.insert(value),\n },\n ],\n froalaConfig: {\n toolbarButtons: [\n 'paragraphFormat', 'fontSize', '|',\n 'bold', 'italic', 'underline', 'strikeThrough', 'textColor', '|',\n 'align', 'formatUL', 'formatOL', '|',\n 'insertLink', 'insertField', 'clearFormatting',\n ],\n paragraphFormat: { N: 'Normal', H1: 'Heading 1', H2: 'Heading 2', H3: 'Heading 3' },\n paragraphFormatSelection: true,\n fontSize: FONT_SIZES,\n fontSizeUnit: 'pt',\n fontSizeSelection: true,\n htmlAllowedTags: ALLOWED_TAGS,\n htmlAllowedAttrs: ['style', 'href', 'target', 'rel'],\n htmlAllowedStyleProps: ALLOWED_STYLES,\n htmlRemoveTags: ['script', 'style'],\n // Inline styles rather than Froala's fr-* classes, which neither the\n // server nor the exports know.\n useClasses: false,\n pastePlain: true,\n // Every keystroke reaches the model straight away, so ending the edit an\n // instant after typing never loses the last word.\n typingTimer: 0,\n },\n };\n\n public readonly displayHtml = computed<SafeHtml>(() => this._sanitizer.bypassSecurityTrustHtml(\n fillTextTokens(this.html(), this.tokens()),\n ));\n\n // What the editor holds right now.\n public draft = '';\n\n private readonly _editor = viewChild(FsHtmlEditorComponent);\n private readonly _sanitizer = inject(DomSanitizer);\n private readonly _host: ElementRef<HTMLElement> = inject(ElementRef);\n private readonly _destroyRef = inject(DestroyRef);\n private _isOpen = false;\n\n constructor() {\n // Opening seeds the draft; closing — whoever closed it: a press outside,\n // Escape, the block being deselected or edit mode ending — saves it.\n effect(() => {\n const editing = this.editing();\n\n untracked(() => {\n if (editing && !this._isOpen) {\n this._isOpen = true;\n this.draft = this.html();\n } else if (!editing && this._isOpen) {\n this._finish();\n }\n });\n });\n\n // A press anywhere that is not the block or the editor's own chrome ends\n // the edit. Captured, so it is seen before the canvas or a sibling\n // component acts on the same press.\n const onPress = (event: PointerEvent) => this._onDocumentPress(event);\n document.addEventListener('pointerdown', onPress, true);\n this._destroyRef.onDestroy(() => document.removeEventListener('pointerdown', onPress, true));\n }\n\n public onKeydown(event: KeyboardEvent): void {\n if (this.editing() && event.key === 'Escape') {\n event.preventDefault();\n this._close();\n }\n }\n\n private _onDocumentPress(event: PointerEvent): void {\n if (!this.editing()) {\n return;\n }\n\n const target = event.target as HTMLElement | null;\n if (target && (this._host.nativeElement.contains(target) || target.closest(EDITOR_CHROME))) {\n return;\n }\n\n this._close();\n }\n\n // Save NOW, then ask the host to close. Saving here rather than waiting for\n // the editing input to flip matters: the same press may be on a page tab,\n // and by the time the input changed this block could already be destroyed,\n // with its edit gone.\n private _close(): void {\n this._syncDraft();\n this._finish();\n this.editEnded.emit();\n }\n\n // Read the editor directly rather than trusting the last model update.\n private _syncDraft(): void {\n const html = this._editor()?.editor?.html?.get();\n if (typeof html === 'string') {\n this.draft = html;\n }\n }\n\n private _finish(): void {\n if (!this._isOpen) {\n return;\n }\n\n this._isOpen = false;\n if (this.draft !== this.html()) {\n this.saved.emit(this.draft);\n }\n }\n}\n","@if (editing()) {\n <!-- Floating fs-html-editor: no frame, Froala's inline toolbar pops up over\n the text. pointerdown stays here so a press in the text never starts a\n drag of the block or a pan of the canvas. -->\n <fs-html-editor\n class=\"text-content editing\"\n [config]=\"editorConfig\"\n [(ngModel)]=\"draft\"\n (pointerdown)=\"$event.stopPropagation()\"\n (mousedown)=\"$event.stopPropagation()\">\n </fs-html-editor>\n} @else {\n <div\n class=\"text-content\"\n [innerHTML]=\"displayHtml()\">\n </div>\n}\n","import {\n ChangeDetectionStrategy, Component, DestroyRef, ElementRef,\n EventEmitter, HostBinding, Input, NgZone, OnChanges, OnInit, Output, SimpleChanges, ViewChild, inject,\n input, output, signal,\n} from '@angular/core';\n\n\nimport { MatIconButton } from '@angular/material/button';\nimport { MatIcon } from '@angular/material/icon';\nimport { MatMenuModule } from '@angular/material/menu';\nimport { MatTooltip } from '@angular/material/tooltip';\n\nimport { FilterConfig, FsFilterModule } from '@firestitch/filter';\nimport { FsMessage } from '@firestitch/message';\nimport { FsProcess } from '@firestitch/process';\nimport { FsPrompt } from '@firestitch/prompt';\n\nimport { Subject, debounceTime, map, switchMap, tap } from 'rxjs';\n\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nimport { ReportData } from '../../data/report.data';\nimport {\n ComponentData,\n ComponentDataState,\n ComponentSettings,\n ReportComponent as ReportComponentModel,\n ReportFilterGroup,\n ReportLayout,\n} from '../../interfaces/report.interface';\nimport { DEFAULT_COMPONENT_PADDING } from '../../layout';\nimport { filterItemForGroup, groupValuesFromQuery } from '../../report-filter-items';\nimport { ReportFilterStateService } from '../../services/report-filter-state.service';\nimport { ComponentChartComponent } from '../component-chart/component-chart.component';\nimport { ComponentKpiComponent } from '../component-kpi/component-kpi.component';\nimport { ComponentListComponent } from '../component-list/component-list.component';\nimport { ComponentTextComponent } from '../component-text/component-text.component';\nimport { TextTokenContext } from '../../text';\nimport { CanvasSnapper, PX_PER_INCH } from '../report-canvas/report-canvas.component';\n\n\n// Freeform resize handles, named by compass direction.\nconst HANDLES = ['nw', 'n', 'ne', 'e', 'se', 's', 'sw', 'w'] as const;\ntype Handle = typeof HANDLES[number];\n\n// Flow width snaps to the useful fractions of a page row.\nconst FLOW_WIDTH_STOPS = [25, 33.33, 50, 66.67, 75, 100];\n\nconst MIN_W = 0.6; // inches\nconst MIN_H = 0.4; // inches\n\n// Two presses on a text block this close together open its editor. Detected\n// here rather than with a dblclick listener because the drag loop claims the\n// pointer on every press, and a browser is not obliged to deliver dblclick\n// through a captured, default-prevented pointer.\nconst DOUBLE_PRESS_MS = 400;\n\n// One component on the page: title bar, the type-specific body (chart | list\n// | kpi), a menu (settings, filter toggles, export) — and the editing\n// interactions:\n//\n// Freeform: click selects; the selection frame shows 8 resize handles;\n// dragging the body moves with smart alignment guides (via the canvas\n// snapper); everything works at any zoom (pixel deltas ÷ zoom·96 → inches).\n//\n// Flow: dragging reorders (drop position decided by the canvas); the E\n// handle resizes flowWidth % (snapping to 25/33/50/66/75/100), the S handle\n// resizes height in inches.\n//\n// Charts and KPIs fetch their own data here; lists fetch inside\n// ComponentListComponent through FsList paging.\n@Component({\n selector: 'app-report-component',\n templateUrl: './report-component.component.html',\n styleUrls: ['./report-component.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n MatIcon,\n MatIconButton,\n MatMenuModule,\n MatTooltip,\n FsFilterModule,\n ComponentChartComponent,\n ComponentKpiComponent,\n ComponentListComponent,\n ComponentTextComponent,\n ],\n})\nexport class ReportComponentComponent implements OnInit, OnChanges {\n\n @Input() public reportId: number;\n @Input() public component: ReportComponentModel;\n @Input() public groups: Map<number, ReportFilterGroup>;\n @Input() public editMode = false;\n @Input() public layout: ReportLayout = 'freeform';\n // The canvas zoom — converts on-screen pixel deltas back to inches.\n @Input() public zoom = 1;\n @Input() public snapper: CanvasSnapper | null = null;\n @Input() public selected = false;\n\n @Output() public selectComponent = new EventEmitter<number>();\n @Output() public positionChanged = new EventEmitter<{ componentId: number } & Record<string, number>>();\n @Output() public flowReorder = new EventEmitter<{ componentId: number; clientX: number; clientY: number }>();\n @Output() public openSettings = new EventEmitter<ReportComponentModel>();\n\n // What a text block's {{tokens}} fill with on the page it is drawn on.\n public readonly tokens = input<TextTokenContext>({ pageNumber: 1, pageName: '', reportName: '' });\n\n // Whether a percent KPI value is a 0-1 ratio (the report's percentFormat).\n public readonly ratioPercent = input(true);\n\n // A text block was deleted from its menu — the canvas drops it.\n public readonly removed = output<number>();\n\n // The text block's editor is open (double-press in edit mode). Closed by focus\n // leaving the block, by deselecting it, or by leaving edit mode — each of\n // which saves.\n public readonly textEditing = signal(false);\n\n @ViewChild(ComponentChartComponent)\n public chartComponent: ComponentChartComponent;\n\n // Freeform resize handles by type: a fixed-height component (chart/list)\n // gets all eight (resize width AND height); an auto-height one (kpi) gets\n // only the side handles since its height fits its content and can't be set.\n public get resizeHandles(): readonly Handle[] {\n return this._heightAuto ? ['e', 'w'] : HANDLES;\n }\n\n // The component's header IS an fs-filter: heading template = its title (and\n // the drag handle), actions = the Settings / filter-toggles / Export menu,\n // items = its component-level filter groups, for every component type, lists\n // included. Rebuilt when a filter toggle changes which groups show,\n // and when the settings dialog changes the title or padding: setting it\n // repaints the header and body.\n public readonly filterConfig = signal<FilterConfig | null>(null);\n\n public readonly data = signal<ComponentData | null>(null);\n public readonly loading = signal(false);\n public readonly error = signal<string | null>(null);\n\n private _refresh$ = new Subject<void>();\n private _reportData = inject(ReportData);\n private _filterState = inject(ReportFilterStateService);\n private _process = inject(FsProcess);\n private _message = inject(FsMessage);\n private _prompt = inject(FsPrompt);\n private _lastPress = 0;\n private _destroyRef = inject(DestroyRef);\n private _zone = inject(NgZone);\n private _host: ElementRef<HTMLElement> = inject(ElementRef);\n\n public ngOnInit(): void {\n this._buildFilterConfig();\n\n // Lists fetch through FsList; text has nothing to fetch.\n if (this.component.type !== 'list' && !this.isText) {\n // Debounced so a rapid filter sweep fires one query, not one per change.\n this._refresh$\n .pipe(\n debounceTime(300),\n takeUntilDestroyed(this._destroyRef),\n )\n .subscribe(() => this._load());\n\n this._filterState.changesFor(this.component)\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe(() => this._refresh$.next());\n\n // A group-by change re-buckets every time-series chart; it isn't scoped\n // to a filter group, so it rides its own stream.\n if (this._isTimeSeries) {\n this._filterState.frequencyChanges()\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe(() => this._refresh$.next());\n }\n\n this._load();\n }\n }\n\n // The report reloads (e.g. after the settings dialog adds/moves a filter)\n // hand this instance fresh `component`/`groups` inputs without re-running\n // ngOnInit. Rebuild the header config so the inline component-filter strip\n // reflects the new filters; the template recreates the fs-filter via\n // `filterKey` so it actually re-reads this config.\n public ngOnChanges(changes: SimpleChanges): void {\n // Clicking away (deselect) or leaving edit mode closes an open text editor,\n // which is what saves it.\n if ((changes.selected && !this.selected) || (changes.editMode && !this.editMode)) {\n this.textEditing.set(false);\n }\n\n const filtersChanged = (changes.component && !changes.component.firstChange)\n || (changes.groups && !changes.groups.firstChange);\n\n if (filtersChanged) {\n this._buildFilterConfig();\n }\n }\n\n // fs-filter reads its config only once at init, so the header is keyed on what\n // it renders: the set of component-level filter groups AND the title, which\n // lives in fs-filter's heading template. fs-filter is OnPush and the heading is\n // rendered inside ITS view, so marking this component does not repaint the\n // title — recreating the block does.\n public get filterKey(): string {\n return [\n this.component.title,\n ...this.componentFilterGroups.map((group) => `${group.id}:${group.level}`),\n ].join('|');\n }\n\n public get isText(): boolean {\n return this.component.type === 'text';\n }\n\n // Open the text editor in place.\n public editText(): void {\n if (!this.editMode || !this.isText) {\n return;\n }\n\n this.selectComponent.emit(this.component.id);\n this.textEditing.set(true);\n }\n\n // The editor closed with changed html. Kept locally at once so the block\n // re-renders what was typed; the server rebuilds it from its allowlist, which\n // for anything the editor can produce is the same html.\n public onTextSaved(html: string): void {\n this.component.config = { ...this.component.config, html };\n this._reportData.updateComponent(this.reportId, this.component.id, { html })\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe();\n }\n\n public deleteText(): void {\n this._prompt.confirm({\n title: 'Confirm',\n template: 'Are you sure you would like to delete this text?',\n })\n .pipe(\n switchMap(() => this._reportData.deleteComponent(this.reportId, this.component.id)),\n takeUntilDestroyed(this._destroyRef),\n )\n .subscribe(() => this.removed.emit(this.component.id));\n }\n\n public get truncated(): boolean {\n return !!this.data()?.truncated;\n }\n\n // Content padding (inches → px at 96/in; the canvas zoom scales the page as\n // a whole). Each edge defaults to 1/8\".\n public get bodyPadding(): string {\n const padding = this.component.config?.padding;\n const edge = (value: number | undefined) => `${(value ?? DEFAULT_COMPONENT_PADDING) * PX_PER_INCH}px`;\n\n return `${edge(padding?.top)} ${edge(padding?.right)} ${edge(padding?.bottom)} ${edge(padding?.left)}`;\n }\n\n // The component-level filter groups that should render as an inline control\n // strip on THIS component: a group is included when it's level=component and\n // has an enabled, session-on filter here. Report-level groups live in the\n // top bar instead. Lists use this strip like charts do: a value set here is\n // the group's value, so it reaches every component in the group.\n public get componentFilterGroups(): ReportFilterGroup[] {\n if (!this.groups) {\n return [];\n }\n\n const groupIds = new Set<number>();\n for (const filter of this.component.filters ?? []) {\n if (!filter.enabled || this._filterState.isFilterDisabled(filter.id)) {\n continue;\n }\n const group = this.groups.get(filter.filterGroupId);\n if (group && (group.level === 'component' || group.level === 'both')) {\n groupIds.add(group.id);\n }\n }\n\n return [...groupIds].map((id) => this.groups.get(id)).filter(Boolean);\n }\n\n public settings(): void {\n this.openSettings.emit(this.component);\n }\n\n // Presentation settings saved from the settings dialog. Title and padding are\n // not part of the query, so the data already fetched still stands — this only\n // repaints. The header config is rebuilt because `filterKey` changes with the\n // title and recreates the fs-filter block around it; setting the config signal\n // is also what repaints the new padding. The chart follows its box on its own\n // (ngx-echarts observes the host), so nothing is told to resize.\n public applySettings(settings: ComponentSettings): void {\n this.component.title = settings.title;\n this.component.config = { ...this.component.config, padding: settings.padding };\n\n this._buildFilterConfig();\n }\n\n // The CSV is what the screen shows, so it carries the same interaction state\n // the screen fetched with: the group-by grain for a time-series chart and the\n // viewer's header sort for a list. A note the server returns (the file was\n // cut) is shown before the download starts, so a short file never passes for\n // the whole result.\n public exportCsv(): void {\n const filters = this._filterState.resolveForComponent(this.component);\n const state: ComponentDataState = {};\n\n // A deliberate mirror of the server's ReportQueryRunner::_isTimeSeriesChart,\n // which is canonical and drops the grain for every other component. Kept so\n // a product pinned to an older framework does not re-bucket a non-time chart.\n if (this._isTimeSeries && this._filterState.frequency()) {\n state.frequency = this._filterState.frequency();\n }\n\n const sort = this.component.type === 'list'\n ? this._filterState.listSort(this.component.id)\n : null;\n if (sort) {\n state.sort = sort;\n }\n\n this._process.download(\n `Exporting ${this.component.title ?? 'component'}`,\n this._reportData.exportComponent(this.reportId, this.component.id, filters, state)\n .pipe(\n tap(({ notes }) => notes?.length && this._message.warning(notes.join(' '))),\n map(({ url }) => url),\n ),\n );\n }\n\n // Any interaction inside a component must never start a canvas pan (the\n // zoom-pan host listens for mousedown/touchstart at the container level).\n public stopCanvasPan(event: Event): void {\n event.stopPropagation();\n }\n\n public onComponentPointerDown(event: PointerEvent): void {\n event.stopPropagation();\n if (this.editMode && !this.selected) {\n this.selectComponent.emit(this.component.id);\n }\n }\n\n // ----- edit-mode gestures ---------------------------------------------------\n\n public onDragStart(event: PointerEvent): void {\n if (!this.editMode || this.textEditing()) {\n return;\n }\n\n // A second press on a text block opens its editor instead of dragging.\n if (this.isText) {\n const now = Date.now();\n const isDoublePress = now - this._lastPress < DOUBLE_PRESS_MS;\n this._lastPress = now;\n\n if (isDoublePress) {\n event.preventDefault();\n event.stopPropagation();\n this.editText();\n\n return;\n }\n }\n\n this.selectComponent.emit(this.component.id);\n\n if (this.layout === 'flow') {\n this._flowDrag(event);\n\n return;\n }\n\n this._track(event, (deltaX, deltaY) => {\n let x = Math.max(0, this._origin.x + this._inches(deltaX));\n let y = Math.max(0, this._origin.y + this._inches(deltaY));\n\n if (this.snapper) {\n ({ x, y } = this.snapper.snapMove(this.component, x, y));\n }\n\n this.component.x = x;\n this.component.y = y;\n this._applyGeometry();\n }, () => this._emitGeometry());\n }\n\n public onResizeStart(event: PointerEvent, handle: Handle): void {\n if (!this.editMode) {\n return;\n }\n\n this.selectComponent.emit(this.component.id);\n\n if (this.layout === 'flow') {\n this._flowResize(event, handle);\n\n return;\n }\n\n this._track(event, (deltaX, deltaY) => {\n const dx = this._inches(deltaX);\n const dy = this._inches(deltaY);\n let { x, y, w, h } = this._origin;\n\n if (handle.includes('e')) {\n w = Math.max(MIN_W, this._origin.w + dx);\n }\n if (handle.includes('s')) {\n h = Math.max(MIN_H, this._origin.h + dy);\n }\n if (handle.includes('w')) {\n const clamped = Math.min(dx, this._origin.w - MIN_W);\n x = this._origin.x + clamped;\n w = this._origin.w - clamped;\n }\n if (handle.includes('n')) {\n const clamped = Math.min(dy, this._origin.h - MIN_H);\n y = this._origin.y + clamped;\n h = this._origin.h - clamped;\n }\n\n let geometry = { x, y, w, h };\n if (this.snapper) {\n geometry = this.snapper.snapResize(this.component, geometry, handle);\n }\n\n Object.assign(this.component, geometry);\n this._applyGeometry();\n this.chartComponent?.resize();\n }, () => this._emitGeometry());\n }\n\n // (Re)build the header fs-filter config: heading template renders the title\n // and items are this component's component-level filter groups. The actions\n // menu (Settings / Export CSV) is NOT here — it's a standalone kebab floated\n // top-right in the template, so its button height no longer drives the header\n // row's height (which would otherwise inflate the heading by ~40px).\n private _buildFilterConfig(): void {\n this.filterConfig.set({\n // fs-filter never touches the URL or persists filter state. The values\n // are owned by ReportFilterStateService, which feeds the report view's\n // one URL writer (report-url-state.ts).\n queryParam: false,\n persist: false,\n items: this.componentFilterGroups.map((group) =>\n filterItemForGroup(group, this._reportData, this.reportId, this._filterState.value(group.id))),\n change: (query) => {\n for (const { groupId, value } of groupValuesFromQuery(query ?? {}, this.componentFilterGroups)) {\n this._filterState.setValue(groupId, value);\n }\n },\n });\n }\n\n // Flow: only the east handle resizes (width %). Height is always auto in flow\n // (the box fits its content), so there's no south handle here.\n private _flowResize(event: PointerEvent, handle: Handle): void {\n const pageWidth = this._host.nativeElement.parentElement?.clientWidth || 1;\n\n this._track(event, (deltaX) => {\n if (handle.includes('e')) {\n const deltaPercent = (deltaX / this.zoom / pageWidth) * 100;\n const raw = Math.min(100, Math.max(10, this._origin.flowWidth + deltaPercent));\n this.component.flowWidth = this._snapFlowWidth(raw);\n this._host.nativeElement.style.width = `${this.component.flowWidth}%`;\n }\n }, () => {\n this.positionChanged.emit({\n componentId: this.component.id,\n flowWidth: this.component.flowWidth,\n });\n });\n }\n\n // Flow: drag lifts the component (ghost) and the canvas decides the drop\n // index from the pointer position.\n private _flowDrag(event: PointerEvent): void {\n const host = this._host.nativeElement;\n let lastClientX = event.clientX;\n let lastClientY = event.clientY;\n\n host.classList.add('flow-dragging');\n\n this._track(event, (deltaX, deltaY, e) => {\n lastClientX = e.clientX;\n lastClientY = e.clientY;\n host.style.transform = `translate(${deltaX / this.zoom}px, ${deltaY / this.zoom}px)`;\n }, () => {\n host.classList.remove('flow-dragging');\n host.style.transform = '';\n this.flowReorder.emit({\n componentId: this.component.id,\n clientX: lastClientX,\n clientY: lastClientY,\n });\n });\n }\n\n private _origin = { x: 0, y: 0, w: 0, h: 0, flowWidth: 50 };\n\n // Pointer-capture gesture loop: runs outside Angular, repaints imperatively,\n // and finishes back inside Angular (selection/persistence).\n private _track(\n event: PointerEvent,\n onMove: (deltaX: number, deltaY: number, e: PointerEvent) => void,\n onEnd: () => void,\n ): void {\n event.preventDefault();\n event.stopPropagation();\n\n const handle = event.target as HTMLElement;\n handle.setPointerCapture(event.pointerId);\n\n this._origin = {\n x: this.component.x,\n y: this.component.y,\n w: this.component.w,\n h: this.component.h,\n flowWidth: this.component.flowWidth ?? 50,\n };\n const startX = event.clientX;\n const startY = event.clientY;\n\n this._zone.runOutsideAngular(() => {\n const move = (e: PointerEvent) => onMove(e.clientX - startX, e.clientY - startY, e);\n const end = () => {\n handle.releasePointerCapture(event.pointerId);\n handle.removeEventListener('pointermove', move);\n handle.removeEventListener('pointerup', end);\n handle.removeEventListener('pointercancel', end);\n\n this._zone.run(() => {\n this.snapper?.clear();\n onEnd();\n });\n };\n\n handle.addEventListener('pointermove', move);\n handle.addEventListener('pointerup', end);\n handle.addEventListener('pointercancel', end);\n });\n }\n\n private _emitGeometry(): void {\n this.component.x = this._round(this.component.x);\n this.component.y = this._round(this.component.y);\n this.component.w = this._round(Math.max(MIN_W, this.component.w));\n this.component.h = this._round(Math.max(MIN_H, this.component.h));\n this._applyGeometry();\n this.chartComponent?.resize();\n\n this.positionChanged.emit({\n componentId: this.component.id,\n x: this.component.x,\n y: this.component.y,\n w: this.component.w,\n h: this.component.h,\n });\n }\n\n // A chart on a time x-axis — the only component the report's group-by control\n // applies to. The server owns this rule (ReportQueryRunner::_isTimeSeriesChart);\n // this is its documented browser-side mirror, for products on an older framework.\n private get _isTimeSeries(): boolean {\n return this.component.type === 'chart' && this.component.config?.xAxis?.kind === 'time';\n }\n\n // Auto height (box fits its content) vs fixed (use `h` exactly). Derived from\n // type, server-side: KPI tiles are auto; charts and lists are fixed — charts\n // fit the box and never overflow, lists scroll inside it.\n private get _heightAuto(): boolean {\n return this.component.autoHeight !== false;\n }\n\n // Drives the auto-only CSS default (empty-state baseline) so it never applies\n // to a fixed-height component.\n @HostBinding('class.height-auto')\n public get heightAuto(): boolean {\n return this._heightAuto;\n }\n\n // Screen pixels → inches at the current zoom.\n private _inches(pixels: number): number {\n return pixels / (this.zoom * PX_PER_INCH);\n }\n\n // Clean persisted values: hundredths of an inch.\n private _round(value: number): number {\n return Math.round(value * 100) / 100;\n }\n\n private _snapFlowWidth(value: number): number {\n for (const stop of FLOW_WIDTH_STOPS) {\n if (Math.abs(value - stop) < 3) {\n return stop;\n }\n }\n\n return Math.round(value * 10) / 10;\n }\n\n // The canvas positions the host via [style]; mid-gesture we set it directly\n // so OnPush never re-renders in the move loop.\n private _applyGeometry(): void {\n const style = this._host.nativeElement.style;\n style.left = `${this.component.x * PX_PER_INCH}px`;\n style.top = `${this.component.y * PX_PER_INCH}px`;\n style.width = `${this.component.w * PX_PER_INCH}px`;\n\n // Auto (kpi): no fixed height — the box sizes to its content. Fixed\n // (chart/list): `h` is the exact height. Mirrors the canvas [style] binding\n // so the mid-gesture paint matches the post-gesture re-render.\n if (this._heightAuto) {\n style.height = '';\n } else {\n style.height = `${this.component.h * PX_PER_INCH}px`;\n }\n }\n\n // ----- data ----------------------------------------------------------------\n\n private _load(): void {\n this.loading.set(true);\n this.error.set(null);\n\n const filters = this._filterState.resolveForComponent(this.component);\n // Time-series charts carry the group-by grain (if the viewer picked one) so\n // the backend re-buckets; everything else sends no interaction state here.\n const state = this._isTimeSeries && this._filterState.frequency()\n ? { frequency: this._filterState.frequency() }\n : {};\n\n this._reportData.componentData(this.reportId, this.component.id, filters, state)\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe({\n next: (data: ComponentData) => {\n this.data.set(data);\n this.loading.set(false);\n },\n error: (error) => {\n this.loading.set(false);\n this.error.set(error?.error?.message ?? error?.message ?? 'Failed to load data');\n },\n });\n }\n}\n","<div\n class=\"component-box\"\n [class.editing]=\"editMode\"\n [class.text]=\"isText\"\n [class.selected]=\"selected\"\n [style.padding]=\"bodyPadding\"\n (pointerdown)=\"onComponentPointerDown($event)\"\n (mousedown)=\"stopCanvasPan($event)\"\n (touchstart)=\"stopCanvasPan($event)\">\n <!-- The header is an fs-filter: heading template = title (and the edit-mode\n drag handle), actions = the menu, items = component-level filter groups,\n the same strip for every type (lists included). fs-filter reads its\n config once, so the block is keyed on the component-filter set to be\n recreated when it changes. -->\n <!-- A text block has no title bar — it IS its words, like a text box on a\n slide — so it gets neither the header nor the data actions. -->\n @for (key of isText ? [] : [filterKey]; track key) {\n <fs-filter\n class=\"component-filter\"\n [config]=\"filterConfig()\">\n <ng-template fsFilterHeading>\n <div\n class=\"component-title\"\n (pointerdown)=\"onDragStart($event)\">\n {{ component.title }}\n @if (truncated) {\n <mat-icon\n class=\"truncated-icon\"\n matTooltip=\"Showing a truncated result — refine the filters to see everything.\">\n warning_amber\n </mat-icon>\n }\n </div>\n </ng-template>\n </fs-filter>\n }\n <!-- The actions menu is floated top-right (absolute) rather than living in\n fs-filter's actions slot, so its ~40px button height no longer drives the\n header row's height. It overlays the box corner; the heading reserves\n right padding so a long title ellipsises before it. -->\n @if (!isText || (editMode && !textEditing())) {\n <button\n mat-icon-button\n class=\"component-menu\"\n [matMenuTriggerFor]=\"menu\"\n (pointerdown)=\"$event.stopPropagation()\"\n (mousedown)=\"stopCanvasPan($event)\">\n <mat-icon>more_vert</mat-icon>\n </button>\n }\n <mat-menu #menu=\"matMenu\">\n @if (isText) {\n <button mat-menu-item (click)=\"editText()\">\n <mat-icon>edit</mat-icon>\n <span>Edit text</span>\n </button>\n <button mat-menu-item (click)=\"deleteText()\">\n <mat-icon>delete</mat-icon>\n <span>Delete</span>\n </button>\n } @else {\n <button mat-menu-item (click)=\"settings()\">\n <mat-icon>tune</mat-icon>\n <span>Settings</span>\n </button>\n <button mat-menu-item (click)=\"exportCsv()\">\n <mat-icon>download</mat-icon>\n <span>Export CSV</span>\n </button>\n }\n </mat-menu>\n <div class=\"component-body\">\n @if (isText) {\n <app-report-component-text\n [html]=\"component.config?.html ?? ''\"\n [tokens]=\"tokens()\"\n [editing]=\"textEditing()\"\n (saved)=\"onTextSaved($event)\"\n (editEnded)=\"textEditing.set(false)\">\n </app-report-component-text>\n } @else if (component.type === 'list') {\n <app-report-component-list\n [reportId]=\"reportId\"\n [component]=\"component\">\n </app-report-component-list>\n } @else if (loading()) {\n <div class=\"component-state\">\n <div class=\"loading-shimmer\"></div>\n </div>\n } @else if (error()) {\n <div class=\"component-state error\">\n {{ error() }}\n </div>\n } @else if (!data()?.rows?.length) {\n <div class=\"component-state\">\n No data\n </div>\n } @else if (component.type === 'kpi') {\n <app-report-component-kpi\n [component]=\"component\"\n [data]=\"data()\"\n [ratioPercent]=\"ratioPercent()\">\n </app-report-component-kpi>\n } @else {\n <app-report-component-chart\n [component]=\"component\"\n [data]=\"data()\">\n </app-report-component-chart>\n }\n <!-- In edit mode a transparent veil over the body makes the WHOLE\n component draggable (industry standard: you grab the object, not just\n its title bar) and keeps inner widgets from swallowing the gesture. -->\n @if (editMode && !textEditing()) {\n <div\n class=\"drag-veil\"\n (pointerdown)=\"onDragStart($event)\">\n </div>\n }\n </div>\n</div>\n<!-- Handles live OUTSIDE the clipped box so they straddle its edges. -->\n@if (editMode && selected) {\n @if (layout === 'freeform') {\n @for (handle of resizeHandles; track handle) {\n <div\n class=\"handle handle-{{ handle }}\"\n (mousedown)=\"stopCanvasPan($event)\"\n (pointerdown)=\"onResizeStart($event, handle)\">\n </div>\n }\n } @else {\n <!-- Flow height is always auto (the box fits its content), so only the\n east handle (width %) is offered here. -->\n <div\n class=\"handle handle-e\"\n matTooltip=\"Width (% of page)\"\n (mousedown)=\"stopCanvasPan($event)\"\n (pointerdown)=\"onResizeStart($event, 'e')\">\n </div>\n }\n}","import {\n AfterViewInit, ChangeDetectionStrategy, Component, DestroyRef,\n ElementRef, EventEmitter, Input, OnChanges, Output, QueryList, SimpleChanges, ViewChild, ViewChildren,\n inject, signal,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nimport { CdkDragDrop, DragDropModule, moveItemInArray } from '@angular/cdk/drag-drop';\nimport { MatIcon } from '@angular/material/icon';\nimport { MatTooltip } from '@angular/material/tooltip';\n\nimport { FsMenuModule } from '@firestitch/menu';\nimport { FsMessage } from '@firestitch/message';\nimport { FsPrompt } from '@firestitch/prompt';\nimport { FsZoomPanComponent, FsZoomPanModule } from '@firestitch/zoom-pan';\n\nimport { map, switchMap } from 'rxjs';\n\nimport { ReportData } from '../../data/report.data';\nimport {\n ComponentSettings, Report, ReportComponent, ReportFilterGroup, ReportHeaderFooter, ReportPage,\n} from '../../interfaces/report.interface';\nimport { DEFAULT_HEADING_SIZE, FLOW_PADDING } from '../../layout';\nimport { TextTokenContext } from '../../text';\nimport { ReportComponentComponent } from '../report-component/report-component.component';\n\n\n// Screen density of the canvas: 96 CSS px per inch (the CSS reference pixel),\n// before zoom. All geometry stays in inches; only rendering multiplies by it.\nexport const PX_PER_INCH = 96;\n\n// One smart guide line, in page inches.\nexport interface GuideLine {\n orientation: 'v' | 'h';\n position: number;\n}\n\n// The snapping contract handed to each component's drag loop. Implemented by\n// the canvas because only it sees every component (alignment candidates) and\n// owns the guides overlay.\nexport interface CanvasSnapper {\n snapMove(component: ReportComponent, x: number, y: number): { x: number; y: number };\n snapResize(component: ReportComponent, geometry: { x: number; y: number; w: number; h: number }, handle: string): { x: number; y: number; w: number; h: number };\n clear(): void;\n}\n\n// The fixed-size page canvas — the PowerPoint model. Pages are tabs (only the\n// ACTIVE page's components exist → only they fetch); the page is a\n// pageWidth×pageHeight INCHES sheet rendered at 96px/in inside fs-zoom-pan\n// (Ctrl/Cmd + wheel or pinch to zoom, background drag pan, toolbar buttons; a\n// plain wheel scrolls the list under the pointer).\n//\n// Freeform layout: components are absolutely positioned; dragging gets smart\n// alignment guides (edges + centers of siblings and the page) with snapping.\n// Flow layout: components flow into rows (flowWidth % of the content width),\n// drag reorders, east/south handles resize width%/height.\n//\n// Header and footer: the report's master components (report.master) are drawn\n// on a layer UNDER every page's own components, like a PowerPoint slide master,\n// unless the page hides them. In edit mode the host toolbar's \"Header & footer\"\n// (toggleMasterMode) switches which layer is live: the page's components dim\n// and the master's become the ones that drag, resize and snap. The header/footer bands (config.headerFooter)\n// are drawn as guides while editing and are snap lines for both layers.\n@Component({\n selector: 'app-report-canvas',\n templateUrl: './report-canvas.component.html',\n styleUrls: ['./report-canvas.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n DragDropModule,\n MatIcon,\n MatTooltip,\n FsMenuModule,\n FsZoomPanModule,\n ReportComponentComponent,\n ],\n})\nexport class ReportCanvasComponent implements OnChanges, AfterViewInit {\n\n @Input() public report: Report;\n @Input() public editMode = false;\n\n // The page the host wants on screen, by page id (a deep link). Keyed on id\n // rather than index so a link survives pages being reordered or deleted; an\n // id that no longer resolves falls back to the first page.\n @Input() public pageId: number | null = null;\n\n // A component asked for its settings dialog — the page-level host opens it\n // (it owns MatDialog + the post-save reload).\n @Output() public componentSettings = new EventEmitter<ReportComponent>();\n\n // The report's structure changed here (a page was added) — the host re-fetches\n // it (it owns the assembled report + filter state).\n @Output() public reportChanged = new EventEmitter<void>();\n\n // The page on screen changed — the host reflects it in the URL so a refresh\n // comes back to the same page. Carries the page id, never the index.\n @Output() public pageChanged = new EventEmitter<number | null>();\n\n @ViewChild(FsZoomPanComponent)\n public zoomPan: FsZoomPanComponent;\n\n // The rendered components of the active page — only the canvas can reach the\n // one instance a settings save applies to.\n @ViewChildren(ReportComponentComponent)\n private _renderedComponents: QueryList<ReportComponentComponent>;\n\n @ViewChild('viewport', { static: true })\n private _viewport: ElementRef<HTMLDivElement>;\n\n @ViewChild('guides', { static: false })\n private _guides: ElementRef<HTMLDivElement>;\n\n public readonly PX = PX_PER_INCH;\n public readonly flowPadding = FLOW_PADDING;\n\n // The report's pages as the canvas draws them. This is the host's own\n // `report.pages` array, patched in place (a rename, a delete, a reorder) so\n // the host's exports and page links see the change too. Because the array\n // and its pages keep their identity across a patch, the signal notifies on\n // every set rather than only when the reference changes.\n public readonly pages = signal<ReportPage[]>([], { equal: () => false });\n public readonly activePageIndex = signal(0);\n public readonly zoom = signal(1);\n\n // Editing the header and footer (the master layer) rather than the page.\n public readonly masterMode = signal(false);\n public groups = new Map<number, ReportFilterGroup>();\n public readonly selectedComponentId = signal<number | null>(null);\n\n // The snapper handed to every component (stable identity for OnPush).\n public readonly snapper: CanvasSnapper = {\n snapMove: (component, x, y) => this._snapMove(component, x, y),\n snapResize: (component, geometry, handle) => this._snapResize(component, geometry, handle),\n clear: () => this._clearGuides(),\n };\n\n private _reportData = inject(ReportData);\n private _prompt = inject(FsPrompt);\n private _message = inject(FsMessage);\n private _destroyRef = inject(DestroyRef);\n private _fitted = false;\n private _tokens: TextTokenContext | null = null;\n private _previousPageCount = 0;\n\n // The page id last announced through pageChanged, so a re-render that lands on\n // the same page stays quiet — hosts reload on this and an unchanged page is\n // not news.\n private _emittedPageId: number | null = null;\n\n public ngOnChanges(changes: SimpleChanges): void {\n // Leaving edit mode always returns to the page layer, so the next edit\n // session starts where people expect.\n if (changes.editMode && !this.editMode) {\n this.masterMode.set(false);\n }\n\n this.groups = new Map((this.report?.filterGroups ?? []).map((group) => [group.id, group]));\n this.pages.set(this.report?.pages ?? []);\n\n const pageCount = this.pages().length;\n\n // A page was just added (the host re-fetched the report) — land on it.\n const pageAdded = pageCount > this._previousPageCount && this._previousPageCount > 0;\n if (pageAdded) {\n this.activePageIndex.set(pageCount - 1);\n }\n this._previousPageCount = pageCount;\n\n // Honour an incoming deep link, but never over a just-added page: adding a\n // page is a deliberate act in this tab, while pageId is the stale value the\n // host is still holding from the URL. An id that does not resolve is left\n // alone rather than forced to the first page — the report may still be\n // loading, and the clamp below is the real guard.\n if (!pageAdded && this.pageId != null) {\n const index = this.pages().findIndex((page) => page.id === this.pageId);\n\n if (index > -1) {\n this.activePageIndex.set(index);\n }\n }\n\n if (this.activePageIndex() >= pageCount) {\n this.activePageIndex.set(0);\n }\n\n // Tell the host which page is open whenever that changes — including the\n // FIRST time the report renders, not only when someone clicks a page.\n // Hosts bind things to the open page (the report chat scopes its\n // conversations to it), and without this they would sit on no page at all\n // until the first manual page click.\n const activePageId = this.activePage?.id ?? null;\n if (activePageId !== this._emittedPageId) {\n this._emittedPageId = activePageId;\n this.pageChanged.emit(activePageId);\n }\n }\n\n // Report heading size in px (config is points; the canvas renders at\n // 96px/in, so points × 96/72). Inherited by component titles via a CSS var.\n public get headingSizePx(): number {\n const points = this.report?.config?.styles?.heading?.size ?? DEFAULT_HEADING_SIZE;\n\n return points * (PX_PER_INCH / 72);\n }\n\n public ngAfterViewInit(): void {\n // Fit the page to the viewport once on first render; after that the\n // viewer's zoom choice is respected across re-renders.\n setTimeout(() => this.zoomFit());\n }\n\n public get isFlow(): boolean {\n return this.report?.layout === 'flow';\n }\n\n // Whether the server sends percent measures as 0-1 ratios. An older server\n // sends them already x100, and its KPIs print the value as it came.\n public get ratioPercent(): boolean {\n return this.report?.percentFormat === 'ratio';\n }\n\n public get activePage(): ReportPage | null {\n return this.pages()[this.activePageIndex()] ?? null;\n }\n\n // The header/footer bands, in inches (0 = no band).\n public get bands(): ReportHeaderFooter {\n return this.report?.config?.headerFooter ?? { headerHeight: 0, footerHeight: 0 };\n }\n\n public get masterComponents(): ReportComponent[] {\n return this.report?.master?.components ?? [];\n }\n\n // The master draws unless the page hides it — and always while it is the\n // layer being edited, so a page that hides it can still be used to edit it.\n public get isMasterShown(): boolean {\n return this.masterMode() || !this.activePage?.masterHidden;\n }\n\n // Which layer the edit gestures reach.\n public get isPageEditing(): boolean {\n return this.editMode && !this.masterMode();\n }\n\n public get isMasterEditing(): boolean {\n return this.editMode && this.masterMode();\n }\n\n // What {{page.number}} / {{page.name}} / {{report.name}} fill with on the\n // page on screen — the master's footer numbers each page by its position.\n // The same object is handed back until one of the three changes: every text\n // block takes it as an input, and a fresh object per check would make each\n // of them repaint its html on every change-detection pass.\n public get tokens(): TextTokenContext {\n const page = this.activePage;\n const pageNumber = this.activePageIndex() + 1;\n const pageName = page ? this.pageLabel(page, this.activePageIndex()) : '';\n const reportName = this.report?.name ?? '';\n\n const tokens = this._tokens;\n if (tokens?.pageNumber !== pageNumber || tokens.pageName !== pageName || tokens.reportName !== reportName) {\n this._tokens = { pageNumber, pageName, reportName };\n }\n\n return this._tokens;\n }\n\n public toggleMasterMode(): void {\n this.masterMode.update((value) => !value);\n this.selectedComponentId.set(null);\n }\n\n // Drop a text block where it will be found: into the footer (or header) band\n // while editing the header and footer, below the header band on a page. The\n // host re-fetches the report and it appears; double-press opens its editor.\n public addText(): void {\n if (!this.report) {\n return;\n }\n\n const { headerHeight, footerHeight } = this.bands;\n const pageWidth = this.report.pageWidth;\n const pageHeight = this.report.pageHeight;\n const isMaster = this.masterMode();\n\n let geometry = { x: 0.5, y: headerHeight + 0.5, w: Math.min(5, pageWidth - 1), h: 0.8 };\n if (isMaster) {\n const bandHeight = footerHeight || headerHeight || 0.5;\n const y = footerHeight\n ? pageHeight - footerHeight\n : (headerHeight ? 0 : pageHeight - bandHeight);\n geometry = { x: 0.5, y: y + 0.05, w: Math.min(4, pageWidth - 1), h: Math.max(0.3, bandHeight - 0.1) };\n }\n\n this._reportData.addText(this.report.id, {\n ...geometry,\n pageId: isMaster ? undefined : this.activePage?.id,\n })\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe(() => this.reportChanged.emit());\n }\n\n // A text block deleted itself from its menu: drop it from whichever layer it\n // was on without re-fetching the report (nothing else depends on it).\n public onComponentRemoved(componentId: number): void {\n const layers = [this.activePage?.components, this.report?.master?.components];\n for (const components of layers) {\n const index = components?.findIndex((component) => component.id === componentId) ?? -1;\n if (index > -1) {\n components.splice(index, 1);\n }\n }\n\n this.selectedComponentId.set(null);\n this.pages.set(this.pages());\n this._message.success('Deleted text');\n }\n\n // Show or hide the header and footer on one page, from its tab's kebab.\n public toggleMasterHidden(page: ReportPage): void {\n const masterHidden = !page.masterHidden;\n\n this._reportData.updatePage(this.report.id, page.id, { masterHidden })\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe(() => {\n page.masterHidden = masterHidden;\n this.pages.set(this.pages());\n this._message.success(masterHidden ? 'Header & footer hidden on this page' : 'Header & footer shown on this page');\n });\n }\n\n // Flow render order (the assembler already sorts, but a local reorder\n // mid-session must hold without a re-fetch).\n public get flowComponents(): ReportComponent[] {\n return [...(this.activePage?.components ?? [])].sort((a, b) => a.order - b.order);\n }\n\n public selectPage(index: number): void {\n this.activePageIndex.set(index);\n this.selectedComponentId.set(null);\n\n // Kept in step with the ngOnChanges announcement so the two can't disagree\n // about what the host was last told.\n this._emittedPageId = this.activePage?.id ?? null;\n this.pageChanged.emit(this._emittedPageId);\n }\n\n // Append a blank page; the host re-fetches the report and ngOnChanges lands\n // the view on the new (last) page.\n public addPage(): void {\n if (!this.report) {\n return;\n }\n\n this._reportData.addPage(this.report.id)\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe(() => this.reportChanged.emit());\n }\n\n public pageLabel(page: ReportPage, index: number): string {\n return page.name || `Page ${index + 1}`;\n }\n\n // Rename from the tab's kebab. The page list is patched in place rather than\n // re-fetching the report: nothing else on the canvas depends on a page's\n // name, and a re-fetch would re-run every component's query to repaint a\n // chip's label.\n public renamePage(page: ReportPage): void {\n this._prompt.input({\n title: 'Edit Page Name',\n label: 'Name',\n default: page.name ?? '',\n commitLabel: 'Save',\n required: true,\n })\n .pipe(\n switchMap((name: string) => this._reportData\n .updatePage(this.report.id, page.id, { name })\n .pipe(map(() => name))),\n takeUntilDestroyed(this._destroyRef),\n )\n .subscribe((name: string) => {\n page.name = name;\n this.pages.set(this.pages());\n this._message.success('Saved page name');\n });\n }\n\n // Delete from the tab's kebab. The confirm names the page and says the\n // components go with it — the server refuses the last page, and that refusal\n // surfaces as the API error message rather than being second-guessed here.\n public deletePage(page: ReportPage): void {\n this._prompt.confirm({\n title: 'Confirm',\n template: `Are you sure you would like to delete \"${this.pageLabel(page, this.pages().indexOf(page))}\" and everything on it?`,\n })\n .pipe(\n switchMap(() => this._reportData.deletePage(this.report.id, page.id)),\n takeUntilDestroyed(this._destroyRef),\n )\n .subscribe(() => {\n const pages = this.pages();\n const index = pages.indexOf(page);\n pages.splice(index, 1);\n this.pages.set(pages);\n\n // Land on the neighbour rather than snapping back to the first page —\n // deleting page 4 of 6 should leave you looking at what is now page 4.\n this.activePageIndex.set(Math.min(index, pages.length - 1));\n this._previousPageCount = pages.length;\n this.selectedComponentId.set(null);\n\n // The id in the URL just stopped existing — replace it with the\n // neighbour we landed on, or a refresh would 404 its way to page one.\n this.pageChanged.emit(this.activePage?.id ?? null);\n\n this._message.success('Deleted page');\n });\n }\n\n // A tab was dragged to a new slot: reorder locally so the chips settle\n // immediately, keep the viewer on the page they were looking at, and persist\n // the whole sequence in one PUT.\n public onPageDropped(event: CdkDragDrop<unknown>): void {\n if (event.previousIndex === event.currentIndex) {\n return;\n }\n\n const activePage = this.activePage;\n const pages = this.pages();\n\n moveItemInArray(pages, event.previousIndex, event.currentIndex);\n this.pages.set(pages);\n\n const positions = pages.map((page, order) => {\n page.order = order;\n\n return { pageId: page.id, order };\n });\n\n if (activePage) {\n this.activePageIndex.set(pages.indexOf(activePage));\n }\n\n this._reportData.savePagePositions(this.report.id, positions)\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe();\n }\n\n // Hand presentation settings (title, padding) saved in the settings dialog to\n // the one component they belong to. Nothing here feeds the query, so that\n // component repaints and every other one on the page is left alone.\n public applyComponentSettings(componentId: number, settings: ComponentSettings): void {\n this._renderedComponents\n .find((rendered) => rendered.component.id === componentId)\n ?.applySettings(settings);\n }\n\n public selectComponent(componentId: number | null): void {\n this.selectedComponentId.set(componentId);\n }\n\n public onCanvasPointerDown(): void {\n // Background click (pan start) deselects.\n if (this.selectedComponentId() !== null) {\n this.selectComponent(null);\n }\n }\n\n // ----- zoom toolbar ---------------------------------------------------------\n\n public onZoomed(scale: number): void {\n this.zoom.set(scale);\n }\n\n public zoomIn(): void {\n this.zoomPan?.zoomIn();\n }\n\n public zoomOut(): void {\n this.zoomPan?.zoomOut();\n }\n\n public zoomFit(): void {\n const viewport = this._viewport?.nativeElement;\n if (!viewport || !this.report?.pageWidth || !this.zoomPan) {\n return;\n }\n\n const fit = Math.min(\n (viewport.clientWidth - 32) / (this.report.pageWidth * PX_PER_INCH),\n (viewport.clientHeight - 32) / (this.report.pageHeight * PX_PER_INCH),\n );\n\n this.zoomPan.zoom(Math.min(1.5, Math.max(0.1, fit)));\n this.zoomPan.move(16, 16);\n this._fitted = true;\n }\n\n public zoomActual(): void {\n this.zoomPan?.zoom(1);\n }\n\n // ----- persistence ----------------------------------------------------------\n\n // A freeform drag/resize or a flow width resize landed — one PUT per gesture.\n public onPositionChanged(position: { componentId: number } & Record<string, number>): void {\n this._clearGuides();\n this._reportData.savePositions(this.report.id, [position as any])\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe();\n }\n\n // A flow drag dropped: reorder the page's components around the moved one\n // and persist every order in one PUT.\n public onFlowReorder(event: { componentId: number; clientX: number; clientY: number }): void {\n const page = this.activePage;\n if (!page) {\n return;\n }\n\n const ordered = this.flowComponents.filter((component) => component.id !== event.componentId);\n const moved = page.components.find((component) => component.id === event.componentId);\n if (!moved) {\n return;\n }\n\n const index = this._flowDropIndex(ordered, event.clientX, event.clientY);\n ordered.splice(index, 0, moved);\n\n const positions = ordered.map((component, order) => {\n component.order = order;\n\n return { componentId: component.id, order };\n });\n\n this.pages.set(this.pages());\n this._reportData.savePositions(this.report.id, positions)\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe();\n }\n\n // Where the pointer landed among the flowed components: before the first\n // component whose center the pointer is above/left of.\n private _flowDropIndex(ordered: ReportComponent[], clientX: number, clientY: number): number {\n // Flow items only — the header/footer blocks on the master layer are\n // components too, but they are not in the flow.\n const hosts = Array.from(\n this._viewport.nativeElement.querySelectorAll<HTMLElement>('app-report-component.flow-item'),\n ).filter((host) => !host.classList.contains('flow-dragging'));\n\n for (let index = 0; index < hosts.length && index < ordered.length; index++) {\n const rect = hosts[index].getBoundingClientRect();\n if (clientY < rect.top + rect.height / 2\n || (clientY < rect.bottom && clientX < rect.left + rect.width / 2)) {\n return index;\n }\n }\n\n return ordered.length;\n }\n\n // ----- smart guides ---------------------------------------------------------\n\n // Pixel feel of the snap, converted to inches at the current zoom.\n private get _snapThreshold(): number {\n return 8 / (PX_PER_INCH * Math.max(0.1, this.zoom()));\n }\n\n private _snapMove(component: ReportComponent, x: number, y: number): { x: number; y: number } {\n const { vertical, horizontal } = this._candidates(component);\n const guides: GuideLine[] = [];\n\n const snappedX = this._snapAxis(\n [\n { offset: 0, value: x },\n { offset: component.w / 2, value: x + component.w / 2 },\n { offset: component.w, value: x + component.w },\n ],\n vertical,\n );\n if (snappedX !== null) {\n x = snappedX.base;\n guides.push({ orientation: 'v', position: snappedX.guide });\n }\n\n const snappedY = this._snapAxis(\n [\n { offset: 0, value: y },\n { offset: component.h / 2, value: y + component.h / 2 },\n { offset: component.h, value: y + component.h },\n ],\n horizontal,\n );\n if (snappedY !== null) {\n y = snappedY.base;\n guides.push({ orientation: 'h', position: snappedY.guide });\n }\n\n this._renderGuides(guides);\n\n return { x, y };\n }\n\n private _snapResize(\n component: ReportComponent,\n geometry: { x: number; y: number; w: number; h: number },\n handle: string,\n ): { x: number; y: number; w: number; h: number } {\n const { vertical, horizontal } = this._candidates(component);\n const guides: GuideLine[] = [];\n const result = { ...geometry };\n\n // Only the edges the handle moves participate in snapping.\n if (handle.includes('e')) {\n const snapped = this._nearest(geometry.x + geometry.w, vertical);\n if (snapped !== null) {\n result.w = snapped - geometry.x;\n guides.push({ orientation: 'v', position: snapped });\n }\n }\n if (handle.includes('w')) {\n const snapped = this._nearest(geometry.x, vertical);\n if (snapped !== null) {\n result.w = geometry.x + geometry.w - snapped;\n result.x = snapped;\n guides.push({ orientation: 'v', position: snapped });\n }\n }\n if (handle.includes('s')) {\n const snapped = this._nearest(geometry.y + geometry.h, horizontal);\n if (snapped !== null) {\n result.h = snapped - geometry.y;\n guides.push({ orientation: 'h', position: snapped });\n }\n }\n if (handle.includes('n')) {\n const snapped = this._nearest(geometry.y, horizontal);\n if (snapped !== null) {\n result.h = geometry.y + geometry.h - snapped;\n result.y = snapped;\n guides.push({ orientation: 'h', position: snapped });\n }\n }\n\n this._renderGuides(guides);\n\n return result;\n }\n\n // Alignment candidates: the page's edges + center, the header/footer band\n // lines, and every sibling's edges + centers — siblings on the SAME layer,\n // since a page component aligns with the page and a header block with the\n // header.\n private _candidates(moving: ReportComponent): { vertical: number[]; horizontal: number[] } {\n const vertical = [0, this.report.pageWidth / 2, this.report.pageWidth];\n const horizontal = [0, this.report.pageHeight / 2, this.report.pageHeight];\n\n const { headerHeight, footerHeight } = this.bands;\n if (headerHeight) {\n horizontal.push(headerHeight);\n }\n if (footerHeight) {\n horizontal.push(this.report.pageHeight - footerHeight);\n }\n\n const isMaster = this.masterComponents.some((component) => component.id === moving.id);\n const siblings = isMaster ? this.masterComponents : (this.activePage?.components ?? []);\n\n for (const component of siblings) {\n if (component.id === moving.id) {\n continue;\n }\n\n vertical.push(component.x, component.x + component.w / 2, component.x + component.w);\n horizontal.push(component.y, component.y + component.h / 2, component.y + component.h);\n }\n\n return { vertical, horizontal };\n }\n\n // Snap one axis: of the moving box's three lines (edge/center/edge), find\n // the closest candidate within threshold and return the adjusted base\n // coordinate plus the guide to draw.\n private _snapAxis(\n lines: { offset: number; value: number }[],\n candidates: number[],\n ): { base: number; guide: number } | null {\n let best: { base: number; guide: number; distance: number } | null = null;\n\n for (const line of lines) {\n for (const candidate of candidates) {\n const distance = Math.abs(candidate - line.value);\n if (distance <= this._snapThreshold && (!best || distance < best.distance)) {\n best = { base: candidate - line.offset, guide: candidate, distance };\n }\n }\n }\n\n return best ? { base: best.base, guide: best.guide } : null;\n }\n\n private _nearest(value: number, candidates: number[]): number | null {\n let best: number | null = null;\n let bestDistance = this._snapThreshold;\n\n for (const candidate of candidates) {\n const distance = Math.abs(candidate - value);\n if (distance <= bestDistance) {\n best = candidate;\n bestDistance = distance;\n }\n }\n\n return best;\n }\n\n // The guides overlay is drawn imperatively — the drag loop runs outside\n // Angular and repaints on every pointermove.\n private _renderGuides(guides: GuideLine[]): void {\n const host = this._guides?.nativeElement;\n if (!host) {\n return;\n }\n\n host.replaceChildren(...guides.map((guide) => {\n const line = document.createElement('div');\n line.className = `guide guide-${guide.orientation}`;\n if (guide.orientation === 'v') {\n line.style.left = `${guide.position * PX_PER_INCH}px`;\n } else {\n line.style.top = `${guide.position * PX_PER_INCH}px`;\n }\n\n return line;\n }));\n }\n\n private _clearGuides(): void {\n this._guides?.nativeElement?.replaceChildren();\n }\n}\n","<div class=\"canvas\">\n <div\n #viewport\n class=\"page-viewport\"\n (pointerdown)=\"onCanvasPointerDown()\">\n <fs-zoom-pan\n wheel=\"modifier\"\n [zoomMin]=\"0.1\"\n [zoomMax]=\"3\"\n (zoomed)=\"onZoomed($event)\">\n @if (activePage; as page) {\n <div\n class=\"page\"\n [class.flow]=\"isFlow\"\n [class.editing]=\"editMode\"\n [class.master-editing]=\"isMasterEditing\"\n [style.width.px]=\"report.pageWidth * PX\"\n [style.height.px]=\"report.pageHeight * PX\"\n [style.padding.px]=\"isFlow ? flowPadding * PX : 0\"\n [style.--canvas-zoom]=\"zoom()\"\n [style.--report-heading-size.px]=\"headingSizePx\">\n <!-- The header and footer: the master's components, always freeform,\n drawn under the page's own. Out of the flow (absolute), so a flow\n page's rows are laid out as if it were not there. -->\n @if (isMasterShown && masterComponents.length) {\n <div\n class=\"master-layer\"\n [class.editable]=\"isMasterEditing\">\n @for (component of masterComponents; track component.id) {\n <app-report-component\n [reportId]=\"report.id\"\n [component]=\"component\"\n [groups]=\"groups\"\n [editMode]=\"isMasterEditing\"\n [layout]=\"'freeform'\"\n [zoom]=\"zoom()\"\n [snapper]=\"snapper\"\n [tokens]=\"tokens\"\n [ratioPercent]=\"ratioPercent\"\n [selected]=\"component.id === selectedComponentId()\"\n [style.left.px]=\"component.x * PX\"\n [style.top.px]=\"component.y * PX\"\n [style.width.px]=\"component.w * PX\"\n [style.height.px]=\"component.autoHeight ? null : component.h * PX\"\n (selectComponent)=\"selectComponent($event)\"\n (positionChanged)=\"onPositionChanged($event)\"\n (removed)=\"onComponentRemoved($event)\"\n (openSettings)=\"componentSettings.emit($event)\">\n </app-report-component>\n }\n </div>\n }\n\n <!-- The header and footer bands, as guides while editing. -->\n @if (editMode) {\n @if (bands.headerHeight) {\n <div\n class=\"band band-header\"\n [style.height.px]=\"bands.headerHeight * PX\">\n @if (isMasterEditing) {\n <span class=\"band-label small\">Header</span>\n }\n </div>\n }\n @if (bands.footerHeight) {\n <div\n class=\"band band-footer\"\n [style.height.px]=\"bands.footerHeight * PX\">\n @if (isMasterEditing) {\n <span class=\"band-label small\">Footer</span>\n }\n </div>\n }\n }\n\n @if (isFlow) {\n @for (component of flowComponents; track component.id) {\n <app-report-component\n class=\"flow-item\"\n [reportId]=\"report.id\"\n [component]=\"component\"\n [groups]=\"groups\"\n [editMode]=\"isPageEditing\"\n [layout]=\"'flow'\"\n [zoom]=\"zoom()\"\n [snapper]=\"snapper\"\n [tokens]=\"tokens\"\n [ratioPercent]=\"ratioPercent\"\n [selected]=\"component.id === selectedComponentId()\"\n [style.width.%]=\"component.flowWidth\"\n [style.height.px]=\"component.autoHeight ? null : component.h * PX\"\n (selectComponent)=\"selectComponent($event)\"\n (positionChanged)=\"onPositionChanged($event)\"\n (flowReorder)=\"onFlowReorder($event)\"\n (removed)=\"onComponentRemoved($event)\"\n (openSettings)=\"componentSettings.emit($event)\">\n </app-report-component>\n }\n } @else {\n @for (component of page.components; track component.id) {\n <app-report-component\n [reportId]=\"report.id\"\n [component]=\"component\"\n [groups]=\"groups\"\n [editMode]=\"isPageEditing\"\n [layout]=\"'freeform'\"\n [zoom]=\"zoom()\"\n [snapper]=\"snapper\"\n [tokens]=\"tokens\"\n [ratioPercent]=\"ratioPercent\"\n [selected]=\"component.id === selectedComponentId()\"\n [style.left.px]=\"component.x * PX\"\n [style.top.px]=\"component.y * PX\"\n [style.width.px]=\"component.w * PX\"\n [style.height.px]=\"component.autoHeight ? null : component.h * PX\"\n (selectComponent)=\"selectComponent($event)\"\n (positionChanged)=\"onPositionChanged($event)\"\n (removed)=\"onComponentRemoved($event)\"\n (openSettings)=\"componentSettings.emit($event)\">\n </app-report-component>\n }\n }\n\n <div\n #guides\n class=\"guides\">\n </div>\n\n @if (!page.components.length && !masterMode()) {\n <div class=\"page-empty\">\n Ask the assistant to add a chart, list or KPI to this page.\n </div>\n }\n </div>\n }\n </fs-zoom-pan>\n </div>\n\n <div class=\"canvas-toolbar\">\n <!-- Tabs are one horizontal drop list: dragging a chip reorders the pages.\n The drop INDEX is computed along X (orientation), but the preview is\n deliberately left unbounded on both axes — pinning it to the row with\n cdkDragBoundary means the chip you are dragging covers the chips you\n are dragging it past, and you cannot see where it is going to land.\n Every page gets a chip, including a lone one: the chip is what tells\n you which page you are on, and a report that hid it left you unable to\n tell page 1 of 1 from a page that failed to load. Deleting the last\n page is refused server-side, so the kebab is safe to expose here. -->\n <div\n class=\"page-tabs\"\n cdkDropList\n cdkDropListOrientation=\"horizontal\"\n (cdkDropListDropped)=\"onPageDropped($event)\">\n @for (page of pages(); track page.id; let index = $index) {\n <!-- The chip is the drag handle AND the tab: clicking selects,\n dragging reorders. The kebab lives inside it, so the whole\n control stays one chip instead of growing a second button. -->\n <div\n cdkDrag\n class=\"page-tab\"\n [class.active]=\"index === activePageIndex()\"\n (click)=\"selectPage(index)\">\n <span class=\"page-tab-label\">{{ pageLabel(page, index) }}</span>\n <!-- The kebab opens the menu rather than starting a drag or\n switching pages, so it swallows its own click. -->\n <span\n class=\"page-tab-menu\"\n [fsMenuTriggerFor]=\"pageMenu\"\n (click)=\"$event.stopPropagation()\"\n (mousedown)=\"$event.stopPropagation()\">\n <mat-icon>more_vert</mat-icon>\n </span>\n </div>\n <!-- Outside the chip: cdkDrag clones its host into the drag preview,\n and a menu overlay anchored to a cloned trigger opens detached\n from the real tab. -->\n <fs-menu #pageMenu>\n <ng-template\n fs-menu-item\n (click)=\"renamePage(page)\">\n Edit name\n </ng-template>\n <ng-template\n fs-menu-item\n (click)=\"toggleMasterHidden(page)\">\n {{ page.masterHidden ? 'Show header & footer' : 'Hide header & footer' }}\n </ng-template>\n <ng-template\n fs-menu-item\n (click)=\"deletePage(page)\">\n Delete\n </ng-template>\n </fs-menu>\n }\n <button\n type=\"button\"\n class=\"page-tab add-page\"\n matTooltip=\"Add page\"\n (click)=\"addPage()\">\n <mat-icon>add</mat-icon>\n Page\n </button>\n </div>\n\n <div class=\"zoom-controls\">\n <button\n type=\"button\"\n class=\"zoom-button\"\n matTooltip=\"Zoom out (Ctrl/Cmd + scroll)\"\n (click)=\"zoomOut()\">\n <mat-icon>remove</mat-icon>\n </button>\n <button\n type=\"button\"\n class=\"zoom-label\"\n matTooltip=\"Zoom to 100%\"\n (click)=\"zoomActual()\">\n {{ (zoom() * 100).toFixed(0) }}%\n </button>\n <button\n type=\"button\"\n class=\"zoom-button\"\n matTooltip=\"Zoom in (Ctrl/Cmd + scroll)\"\n (click)=\"zoomIn()\">\n <mat-icon>add</mat-icon>\n </button>\n <button\n type=\"button\"\n class=\"zoom-button\"\n matTooltip=\"Fit page\"\n (click)=\"zoomFit()\">\n <mat-icon>fit_screen</mat-icon>\n </button>\n </div>\n </div>\n</div>\n","import { ChangeDetectionStrategy, Component, DestroyRef, EventEmitter, OnInit, inject, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FormsModule } from '@angular/forms';\n\nimport { MAT_DIALOG_DATA, MatDialogActions, MatDialogClose, MatDialogContent, MatDialogRef, MatDialogTitle } from '@angular/material/dialog';\nimport { MatFormField, MatLabel, MatSuffix } from '@angular/material/form-field';\nimport { MatButton } from '@angular/material/button';\nimport { MatInput } from '@angular/material/input';\nimport { MatSlideToggle } from '@angular/material/slide-toggle';\nimport { MatTabsModule } from '@angular/material/tabs';\nimport { MatTooltip } from '@angular/material/tooltip';\n\nimport { FsDialogModule } from '@firestitch/dialog';\nimport { FsFormModule } from '@firestitch/form';\nimport { FsLabelModule } from '@firestitch/label';\nimport { FsMaskModule } from '@firestitch/mask';\nimport { FsMessage } from '@firestitch/message';\nimport { FsPrompt } from '@firestitch/prompt';\nimport { FsTabsModule } from '@firestitch/tabs';\n\nimport { Observable } from 'rxjs';\nimport { switchMap, tap } from 'rxjs/operators';\n\nimport { ReportData } from '../../data/report.data';\nimport {\n ComponentSettings,\n Report,\n ReportComponent,\n ReportComponentSql,\n ReportFilter,\n ReportFilterGroup,\n ReportFilterLevel,\n ReportFilterType,\n ReportFilterableColumn,\n} from '../../interfaces/report.interface';\nimport { DEFAULT_COMPONENT_PADDING } from '../../layout';\n\n\n// What the dialog hands back. The Settings tab's Save carries the new\n// `settings`; Delete carries `deleted` and no settings, because the component\n// it was opened for no longer exists. Every other exit (Cancel, Done, Escape,\n// backdrop) closes with no result — filter work is announced as it happens\n// instead, through `filtersChanged`.\nexport interface ComponentSettingsResult {\n settings?: ComponentSettings;\n deleted?: boolean;\n}\n\n\n// One row of the Filters tab listing: a filterable column, the interface\n// inferred from its data, and where its filter is exposed (the two toggles).\ninterface FilterRow {\n column: string;\n type: ReportFilterType;\n label: string;\n report: boolean;\n component: boolean;\n}\n\n\n// Component settings, in tabs:\n// Settings — title and content padding. Position/size are tuned by dragging\n// on the canvas; height behaviour follows from the component type.\n// Filters — ONE listing of every filterable column on this component. Each\n// row carries two toggles: show in the report bar and/or show on this\n// component (both, either, or neither). The interface (date range vs value\n// picker) is inferred from the data, never chosen. Each toggle persists\n// immediately and refreshes the in-dialog list.\n// SQL / Config — read-only diagnostics.\n@Component({\n templateUrl: './component-settings.component.html',\n styleUrls: ['./component-settings.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n FormsModule,\n FsFormModule,\n FsMaskModule,\n FsDialogModule,\n FsLabelModule,\n FsTabsModule,\n MatTabsModule,\n MatDialogTitle,\n MatDialogContent,\n MatDialogActions,\n MatDialogClose,\n MatFormField,\n MatLabel,\n MatSuffix,\n MatButton,\n MatInput,\n MatSlideToggle,\n MatTooltip,\n ],\n})\nexport class ComponentSettingsComponent implements OnInit {\n\n // A filter was added, removed or re-levelled, so the report's filter groups\n // changed. Those mutations persist the moment they are clicked and the dialog\n // can then be dismissed by a route that carries no result (Escape, backdrop),\n // so the page is told here rather than through the close result.\n public readonly filtersChanged = new EventEmitter<void>();\n\n public component: ReportComponent;\n public report: Report;\n\n public selectedTab = 'settings';\n\n public title = '';\n\n // Component padding in inches. `number | string` for the same reason as the\n // page dimensions in report-settings: fsMaskNumber seeds from the number but\n // hands back the unmasked string, and save casts it once on the way out.\n public paddingTop: number | string = DEFAULT_COMPONENT_PADDING;\n public paddingRight: number | string = DEFAULT_COMPONENT_PADDING;\n public paddingBottom: number | string = DEFAULT_COMPONENT_PADDING;\n public paddingLeft: number | string = DEFAULT_COMPONENT_PADDING;\n\n public configJson = '';\n\n // ---- SQL tab state ----\n // The statement, once fetched. Null while it is in flight, and null when the\n // component's document could not be compiled (sqlError then says why).\n public readonly sql = signal<string | null>(null);\n // True when the statement is a DERIVED baseline: no filters, the authored\n // grain, times in the report's effective zone. The tab says so, because the\n // numbers on screen come from this statement plus the viewer's own choices\n // and the two can differ.\n public readonly sqlBaseline = signal(false);\n // The zone the statement was compiled in: the report's effective zone, sent\n // with the SQL. A server too old to send it compiled in UTC.\n public readonly sqlTimezone = signal('UTC');\n public readonly sqlError = signal<string | null>(null);\n\n // ---- filter management state ----\n // One row per filterable column. The two booleans drive the toggles; we flip\n // them optimistically on click (so the UI never blinks while the request is\n // in flight) and reconcile from the server on reload.\n public readonly rows = signal<FilterRow[]>([]);\n public readonly columnsError = signal<string | null>(null);\n\n // The raw inputs the rows are built from.\n private _filterableColumns: ReportFilterableColumn[] = [];\n private _filters: ReportFilter[] = [];\n private _groupsById = new Map<number, ReportFilterGroup>();\n\n private readonly _typeLabels: Record<ReportFilterType, string> = {\n select: 'Pick values',\n dateRange: 'Date range',\n keyword: 'Search text',\n };\n\n private readonly _data: { report: Report; component: ReportComponent } = inject(MAT_DIALOG_DATA);\n private readonly _dialogRef = inject<MatDialogRef<ComponentSettingsComponent, ComponentSettingsResult>>(MatDialogRef);\n private readonly _reportData = inject(ReportData);\n private readonly _message = inject(FsMessage);\n private readonly _prompt = inject(FsPrompt);\n private readonly _destroyRef = inject(DestroyRef);\n\n public ngOnInit(): void {\n this.report = this._data.report;\n this.component = this._data.component;\n\n this.title = this.component.title ?? '';\n\n const padding = this.component.config?.padding;\n this.paddingTop = padding?.top ?? DEFAULT_COMPONENT_PADDING;\n this.paddingRight = padding?.right ?? DEFAULT_COMPONENT_PADDING;\n this.paddingBottom = padding?.bottom ?? DEFAULT_COMPONENT_PADDING;\n this.paddingLeft = padding?.left ?? DEFAULT_COMPONENT_PADDING;\n\n this.configJson = JSON.stringify(this.component.config ?? {}, null, 2);\n\n this._seedFilters(this.report, this.component.id);\n this._loadColumns();\n this._loadSql();\n }\n\n // Human-friendly name for the inferred interface shown beside each column.\n public typeLabel(type: ReportFilterType): string {\n return this._typeLabels[type] ?? type;\n }\n\n // Confirm and delete here, while the dialog is still open, then close with a\n // `deleted` result for the page to act on — the same shape the report\n // settings dialog uses for deleting a report.\n //\n // The confirm says it cannot be undone because, from the UI, it cannot: the\n // row is soft-deleted server-side but nothing here restores a component.\n public delete(): void {\n this._prompt.confirm({\n title: 'Delete Component',\n template: `Are you sure you would like to delete \"${this.component.title || 'this component'}\"? This cannot be undone.`,\n })\n .pipe(\n switchMap(() => this._reportData.deleteComponent(this.report.id, this.component.id)),\n takeUntilDestroyed(this._destroyRef),\n )\n .subscribe(() => {\n this._message.success('Component deleted');\n this._dialogRef.close({ deleted: true });\n });\n }\n\n public save = () => {\n const settings: ComponentSettings = {\n title: this.title,\n padding: {\n top: this._padding(this.paddingTop),\n right: this._padding(this.paddingRight),\n bottom: this._padding(this.paddingBottom),\n left: this._padding(this.paddingLeft),\n },\n };\n\n return this._reportData.updateComponent(this.report.id, this.component.id, { ...settings })\n .pipe(\n tap(() => {\n this._message.success('Component saved');\n this._dialogRef.close({ settings });\n }),\n );\n };\n\n // Flip one exposure (report bar or this component) for a row. We update the\n // row's boolean first — so the toggle stays put with no blink — then persist\n // and reconcile on reload. Neither on → no filter (removed); either on → the\n // filter exists at the combined level. The interface type is inferred\n // server-side.\n public setExposure(row: FilterRow, target: 'report' | 'component', on: boolean): void {\n row[target] = on;\n\n const existing = this._filters.find((filter) => filter.filterColumn === row.column);\n\n if (!row.report && !row.component) {\n if (existing) {\n this._run(this._reportData.deleteFilter(this.report.id, existing.id));\n }\n\n return;\n }\n\n const level: ReportFilterLevel = row.report && row.component\n ? 'both'\n : (row.report ? 'report' : 'component');\n\n if (existing) {\n this._run(this._reportData.updateFilterGroup(this.report.id, existing.filterGroupId, { level }));\n } else {\n this._run(this._reportData.addFilter(this.report.id, this.component.id, {\n filterColumn: row.column,\n label: row.label,\n level,\n }));\n }\n }\n\n // The padding as a real number for the wire. fsMaskNumber hands back the\n // unmasked string it built with a fixed '.' radix, so this is a straight\n // parse - the whole reason for the mask is that a native number input would\n // paint (and read back) the viewer's own locale separator instead.\n private _padding(value: number | string): number {\n return typeof value === 'number' ? value : parseFloat(value);\n }\n\n // Run a filter mutation, then reload to reconcile the optimistic state.\n private _run(request: Observable<unknown>): void {\n request.subscribe({\n next: () => this._afterMutation(),\n error: (error) => this._mutationError(error),\n });\n }\n\n // Build the row view-model from the loaded columns + filters/groups. Each\n // row's toggles reflect where its filter group is currently exposed.\n private _rebuildRows(): void {\n this.rows.set(this._filterableColumns.map((column) => {\n const filter = this._filters.find((candidate) => candidate.filterColumn === column.column);\n const level = filter ? this._groupsById.get(filter.filterGroupId)?.level : undefined;\n\n return {\n column: column.column,\n type: column.type,\n label: filter?.label\n || this._groupsById.get(filter?.filterGroupId ?? -1)?.label\n || this._humanize(column.column),\n report: level === 'report' || level === 'both',\n component: level === 'component' || level === 'both',\n };\n }));\n }\n\n // After any filter mutation: re-fetch the report so the dialog's filter list\n // (and the parent canvas, on close) reflect the new groups/levels.\n private _afterMutation(): void {\n this.filtersChanged.emit();\n\n this._reportData.get(this.report.id)\n .subscribe((report: Report) => {\n this.report = report;\n this._seedFilters(report, this.component.id);\n });\n }\n\n private _mutationError(error: any): void {\n this._message.error(error?.error?.message ?? error?.message ?? 'Filter operation failed');\n // Re-seed from the server so the optimistic toggle snaps back to truth.\n this._afterMutation();\n }\n\n private _seedFilters(report: Report, componentId: number): void {\n this._groupsById = new Map((report.filterGroups ?? []).map((group) => [group.id, group]));\n\n const component = report.pages\n .flatMap((page) => page.components)\n .find((candidate) => candidate.id === componentId);\n\n this._filters = component?.filters ?? [];\n this._rebuildRows();\n }\n\n // The statement the SQL tab shows. Fetched rather than read off the\n // component: a derived component stores a document, not SQL, so its\n // statement only exists once the backend compiles it.\n //\n // Loaded in ngOnInit beside the columns, NOT on tab activation. The tabs are\n // not lazy (no matTabContent), and switching the tab-group's `[(selected)]`\n // banana-box to a one-way binding plus (selectedChange) to get a hook would\n // break it: FsTabsHeaderTabGroupDirective self-assigns `this.selected` before\n // it emits, so the event is filtered out and the load would never fire. One\n // small request when a dialog opens is not worth that risk.\n private _loadSql(): void {\n this._reportData.componentSql(this.report.id, this.component.id)\n .subscribe({\n next: (preview: ReportComponentSql) => {\n this.sql.set(preview?.sql ?? null);\n this.sqlBaseline.set(!!preview?.baseline);\n this.sqlTimezone.set(preview?.timezone || 'UTC');\n this.sqlError.set(preview?.error ?? null);\n },\n error: (error) => {\n this.sql.set(null);\n this.sqlError.set(error?.error?.message ?? 'Could not read the component SQL');\n },\n });\n }\n\n private _loadColumns(): void {\n this._reportData.componentColumns(this.report.id, this.component.id)\n .subscribe({\n next: (columns: ReportFilterableColumn[]) => {\n this._filterableColumns = columns ?? [];\n this._rebuildRows();\n },\n error: (error) => {\n this.columnsError.set(error?.error?.message ?? 'Could not read the component columns');\n },\n });\n }\n\n private _humanize(column: string): string {\n return column\n .replace(/[_\\-]+/g, ' ')\n .replace(/\\s+/g, ' ')\n .trim()\n .replace(/\\b\\w/g, (character) => character.toUpperCase());\n }\n}\n","<form\n fsForm\n [submit]=\"save\">\n <fs-dialog>\n <h1 mat-dialog-title>\n {{ component.title || 'Component' }}\n </h1>\n <mat-dialog-content>\n <mat-tab-group [(selected)]=\"selectedTab\">\n <mat-tab\n label=\"Settings\"\n name=\"settings\">\n <div class=\"fs-column tab-body\">\n <mat-form-field>\n <mat-label>\n Title\n </mat-label>\n <input\n matInput\n [(ngModel)]=\"title\"\n name=\"title\">\n </mat-form-field>\n <div class=\"subheading-2\">\n Padding\n </div>\n <div class=\"geometry-row\">\n <mat-form-field>\n <mat-label>\n Top\n </mat-label>\n <input\n matInput\n fsMaskNumber\n [scale]=\"3\"\n [(ngModel)]=\"paddingTop\"\n name=\"paddingTop\"\n [fsFormMin]=\"0\">\n <div matTextSuffix>\n in\n </div>\n </mat-form-field>\n <mat-form-field>\n <mat-label>\n Right\n </mat-label>\n <input\n matInput\n fsMaskNumber\n [scale]=\"3\"\n [(ngModel)]=\"paddingRight\"\n name=\"paddingRight\"\n [fsFormMin]=\"0\">\n <div matTextSuffix>\n in\n </div>\n </mat-form-field>\n <mat-form-field>\n <mat-label>\n Bottom\n </mat-label>\n <input\n matInput\n fsMaskNumber\n [scale]=\"3\"\n [(ngModel)]=\"paddingBottom\"\n name=\"paddingBottom\"\n [fsFormMin]=\"0\">\n <div matTextSuffix>\n in\n </div>\n </mat-form-field>\n <mat-form-field>\n <mat-label>\n Left\n </mat-label>\n <input\n matInput\n fsMaskNumber\n [scale]=\"3\"\n [(ngModel)]=\"paddingLeft\"\n name=\"paddingLeft\"\n [fsFormMin]=\"0\">\n <div matTextSuffix>\n in\n </div>\n </mat-form-field>\n </div>\n </div>\n </mat-tab>\n <mat-tab\n label=\"Filters\"\n name=\"filters\">\n <div class=\"tab-body\">\n @if (columnsError()) {\n <div class=\"filters-empty error\">\n {{ columnsError() }}\n </div>\n } @else if (rows().length) {\n <!-- Every filterable column. Toggle where its control shows: in\n the report bar, on this component, both, or neither. The\n interface (date range vs value picker) follows the data. -->\n <table class=\"filter-table\">\n <thead>\n <tr>\n <th class=\"filter-col-name\">\n Filter\n </th>\n <th class=\"filter-col-type\">\n Type\n </th>\n <th class=\"filter-col-toggle\">\n Report bar\n </th>\n <th class=\"filter-col-toggle\">\n This component\n </th>\n </tr>\n </thead>\n <tbody>\n @for (row of rows(); track row.column) {\n <tr>\n <td class=\"filter-col-name\">\n {{ row.label }}\n </td>\n <td class=\"filter-col-type\">\n {{ typeLabel(row.type) }}\n </td>\n <td class=\"filter-col-toggle\">\n <mat-slide-toggle\n [ngModel]=\"row.report\"\n (ngModelChange)=\"setExposure(row, 'report', $event)\"\n [ngModelOptions]=\"{ standalone: true }\"\n matTooltip=\"Show in the report bar\">\n </mat-slide-toggle>\n </td>\n <td class=\"filter-col-toggle\">\n <mat-slide-toggle\n [ngModel]=\"row.component\"\n (ngModelChange)=\"setExposure(row, 'component', $event)\"\n [ngModelOptions]=\"{ standalone: true }\"\n matTooltip=\"Show on this component\">\n </mat-slide-toggle>\n </td>\n </tr>\n }\n </tbody>\n </table>\n } @else {\n <div class=\"filters-empty\">\n This component has no filterable columns yet — give it some SQL first.\n </div>\n }\n </div>\n </mat-tab>\n <mat-tab\n label=\"SQL\"\n name=\"sql\">\n <div class=\"tab-body\">\n @if (sqlError()) {\n <div class=\"filters-empty error\">\n {{ sqlError() }}\n </div>\n } @else if (sql()) {\n @if (sqlBaseline()) {\n <!-- A derived component's statement is compiled from its\n document with no viewer state, so it is not byte-for-byte\n what produced the numbers on screen. Said here rather than\n left for the reader to discover. -->\n <div class=\"filters-empty\">\n Compiled from this component's query — no filters applied, times in {{ sqlTimezone() }}.\n </div>\n }\n <pre class=\"code-block\">{{ sql() }}</pre>\n } @else {\n <div class=\"filters-empty\">\n This component has no SQL yet.\n </div>\n }\n </div>\n </mat-tab>\n <mat-tab\n label=\"Config\"\n name=\"config\">\n <div class=\"tab-body\">\n <pre class=\"code-block\">\n {{ configJson }}\n </pre>\n </div>\n </mat-tab>\n </mat-tab-group>\n </mat-dialog-content>\n <mat-dialog-actions>\n <!-- Save | Delete | Cancel, the standard order. fs-form-dialog-actions\n renders its own Save/Done BEFORE the projected content, which would\n put Delete after Cancel, so `[save]=\"false\"` foots the row here and\n all three buttons are projected in order. Save submits the Settings\n tab; the other tabs persist as you touch them, so they get Done. -->\n <fs-form-dialog-actions [save]=\"false\">\n @if (selectedTab === 'settings') {\n <button\n mat-button\n type=\"submit\"\n color=\"primary\">\n Save\n </button>\n } @else {\n <button\n mat-button\n type=\"button\"\n color=\"primary\"\n [mat-dialog-close]=\"null\">\n Done\n </button>\n }\n <button\n mat-button\n type=\"button\"\n color=\"warn\"\n (click)=\"delete()\">\n Delete\n </button>\n <button\n mat-button\n type=\"button\"\n class=\"cancel-button\"\n [mat-dialog-close]=\"null\">\n Cancel\n </button>\n </fs-form-dialog-actions>\n </mat-dialog-actions>\n </fs-dialog>\n</form>","import {\n ChangeDetectionStrategy, Component, EventEmitter, Input, Output, computed, signal,\n} from '@angular/core';\nimport { ControlContainer, FormsModule, NgForm } from '@angular/forms';\nimport { MatFormField, MatLabel } from '@angular/material/form-field';\nimport { MatOption } from '@angular/material/core';\nimport { MatSelect } from '@angular/material/select';\n\nimport { guid } from '@firestitch/common';\nimport { FsFormModule } from '@firestitch/form';\n\n\n// Self-contained timezone picker for the report settings dialog. The IANA zone\n// list comes from the browser (Intl.supportedValuesOf), so the package carries no\n// dependency on any app timezone API. It shows the zone it is given and never\n// picks one itself: the dialog always seeds the zone the report uses, and that\n// zone is listed even when the browser's list lacks it (some browsers leave\n// 'UTC' out).\n@Component({\n selector: 'fs-ai-report-timezone-select',\n templateUrl: './timezone-select.component.html',\n styleUrls: ['./timezone-select.component.scss'],\n viewProviders: [{ provide: ControlContainer, useExisting: NgForm }],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n MatFormField,\n MatLabel,\n MatSelect,\n MatOption,\n FormsModule,\n FsFormModule,\n ],\n})\nexport class TimezoneSelectComponent {\n\n @Input() public placeholder = 'Timezone';\n @Input() public required = false;\n @Input() public disabled = false;\n @Output() public timezoneChange = new EventEmitter<string>();\n\n @Input() public set timezone(value: string) {\n if (value && value !== this._timezone()) {\n this._timezone.set(value);\n this.timezoneChange.emit(value);\n }\n }\n\n public get timezone(): string {\n return this._timezone();\n }\n\n public guid: string = guid();\n public readonly timezones = computed(() => this._supportedTimezones(this._timezone()));\n\n private readonly _timezone = signal<string>('');\n\n // The browser's IANA zone list where available, with the current value\n // prepended when the list lacks it, so the select always shows the zone the\n // report uses.\n private _supportedTimezones(current: string): string[] {\n const intl = Intl as unknown as { supportedValuesOf?: (key: string) => string[] };\n const zones = typeof intl.supportedValuesOf === 'function'\n ? intl.supportedValuesOf('timeZone')\n : [];\n\n return current && !zones.includes(current)\n ? [current, ...zones]\n : zones;\n }\n}\n","<mat-form-field class=\"full-width\">\n <mat-label>{{placeholder}}</mat-label>\n <mat-select\n [(ngModel)]=\"timezone\"\n [fsFormRequired]=\"required\"\n [disabled]=\"disabled\"\n name=\"timezone_select_{{ guid }}\">\n @for (item of timezones(); track item) {\n <mat-option [value]=\"item\">{{ item }}</mat-option>\n }\n </mat-select>\n</mat-form-field>\n","import { ChangeDetectionStrategy, Component, DestroyRef, OnInit, inject, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FormsModule } from '@angular/forms';\n\nimport { MatButton } from '@angular/material/button';\nimport { MAT_DIALOG_DATA, MatDialogActions, MatDialogContent, MatDialogRef, MatDialogTitle } from '@angular/material/dialog';\nimport { MatFormField, MatLabel, MatHint, MatSuffix } from '@angular/material/form-field';\nimport { MatInput } from '@angular/material/input';\nimport { MatOption, MatSelect } from '@angular/material/select';\nimport { MatTabsModule } from '@angular/material/tabs';\n\nimport { FsAutocompleteChipsModule } from '@firestitch/autocomplete-chips';\nimport { FsDatePickerModule } from '@firestitch/datepicker';\nimport { FsDialogModule } from '@firestitch/dialog';\nimport { FsFormModule } from '@firestitch/form';\nimport { FsMaskModule } from '@firestitch/mask';\nimport { FsMessage, FsMessageModule } from '@firestitch/message';\nimport { FsPrompt } from '@firestitch/prompt';\nimport { FsTabsModule } from '@firestitch/tabs';\n\nimport { TimezoneSelectComponent } from '../../components/timezone-select/timezone-select.component';\n\nimport { Observable, forkJoin } from 'rxjs';\nimport { switchMap, tap } from 'rxjs/operators';\n\nimport { ReportData } from '../../data/report.data';\nimport {\n FilterGroupDefault,\n Report,\n ReportFilterGroup,\n} from '../../interfaces/report.interface';\nimport { DEFAULT_HEADING_SIZE, HEADER_FOOTER_MAX, PAGE_DIMENSION_MAX, PAGE_DIMENSION_MIN } from '../../layout';\nimport {\n dateFromBound, dateToBound, loadGroupOptions, matchOptions, relativeLabel, resolveOptionValues,\n} from '../../report-filter-items';\n\n\n// What the dialog hands back when it closes, so the page knows what happened\n// without sniffing magic strings. A dismissed dialog closes with `undefined`.\nexport interface ReportSettingsResult {\n action: 'saved' | 'deleted';\n}\n\n\n// One report-level filter in the Filters tab: its group, the inferred interface,\n// and an editable draft default. The draft fields used depend on the type\n// (dateRange → start/end Dates or a stored rolling `relative` preset; select →\n// values; keyword → text). `fetch` loads the select options the same way the\n// report bar does.\ninterface FilterDefaultRow {\n group: ReportFilterGroup;\n label: string;\n start: Date | null;\n end: Date | null;\n // The stored rolling preset (e.g. 'last12Months'). Not authored here: it is\n // carried so an untouched one is sent back as it was, and picked dates or\n // Clear replace it.\n relative: string | null;\n values: { name: string; value: unknown }[];\n value: string;\n fetch: (keyword?: string) => Observable<{ name: string; value: unknown }[]>;\n}\n\n\n// Report settings, in three tabs:\n// Settings — name + page setup (size in inches, header/footer band depths,\n// layout mode).\n// Styles — the report's typographic styles (sizes in POINTS, 1:1 with\n// PDF/PowerPoint); the Heading size to start.\n// Filters — the report-level filters and their DEFAULT values. A default\n// seeds the report bar on every open (for every viewer) but stays\n// user-changeable — it pre-fills the control, it doesn't lock it. This is the\n// fix for heavy reports opening blank and timing out: a default month +\n// organization scopes the landing page from the first load.\n@Component({\n templateUrl: './report-settings.component.html',\n styleUrls: ['./report-settings.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n FormsModule,\n FsFormModule,\n FsMaskModule,\n FsDialogModule,\n FsMessageModule,\n FsTabsModule,\n FsDatePickerModule,\n FsAutocompleteChipsModule,\n MatTabsModule,\n MatButton,\n MatDialogTitle,\n MatDialogContent,\n MatDialogActions,\n MatFormField,\n MatLabel,\n MatHint,\n MatSuffix,\n MatInput,\n MatSelect,\n MatOption,\n TimezoneSelectComponent,\n ],\n})\nexport class ReportSettingsComponent implements OnInit {\n\n public selectedTab = 'settings';\n\n public name = '';\n // The page in inches. No initializer: every report carries a size, and\n // ngOnInit seeds both before the tab renders, so a placeholder here could only\n // ever be a wrong number briefly showing as the operator's own.\n //\n // Typed `number | string` because fsMaskNumber is the control: it is seeded\n // with the report's number but hands back the unmasked STRING the operator\n // typed. Save casts it once, on the way out — see `_pageDimension()`.\n public pageWidth: number | string;\n public pageHeight: number | string;\n public readonly pageDimensionMin = PAGE_DIMENSION_MIN;\n public readonly pageDimensionMax = PAGE_DIMENSION_MAX;\n // The header and footer band depths, inches — typed like the page size\n // because fsMaskNumber hands back a string.\n public headerHeight: number | string = 0;\n public footerHeight: number | string = 0;\n public readonly headerFooterMax = HEADER_FOOTER_MAX;\n public layout: 'freeform' | 'flow' = 'freeform';\n // Seeded with the zone the report actually uses: its own stored zone, else\n // the application default the server resolved (effectiveTimezone). Save sends\n // it only when it differs from that effective zone, so opening and saving a\n // report that follows the default never pins it to a zone.\n public timezone = '';\n public headingSize = DEFAULT_HEADING_SIZE;\n\n // The report-level filters and their editable default values (Filters tab).\n public readonly filterRows = signal<FilterDefaultRow[]>([]);\n public readonly relativeLabel = relativeLabel;\n\n private readonly _data: { report: Report } = inject(MAT_DIALOG_DATA);\n private readonly _dialogRef = inject<MatDialogRef<ReportSettingsComponent, ReportSettingsResult>>(MatDialogRef);\n private readonly _reportData = inject(ReportData);\n private readonly _message = inject(FsMessage);\n private readonly _prompt = inject(FsPrompt);\n private readonly _destroyRef = inject(DestroyRef);\n\n public ngOnInit(): void {\n const report = this._data.report;\n this.name = report.name;\n this.pageWidth = report.pageWidth;\n this.pageHeight = report.pageHeight;\n this.headerHeight = report.config?.headerFooter?.headerHeight ?? 0;\n this.footerHeight = report.config?.headerFooter?.footerHeight ?? 0;\n this.layout = report.layout ?? 'freeform';\n this.timezone = report.timezone ?? report.effectiveTimezone ?? '';\n this.headingSize = report.config?.styles?.heading?.size ?? DEFAULT_HEADING_SIZE;\n\n this._buildFilterRows(report);\n }\n\n // Confirm and delete here, while the dialog is still open, then close with\n // a `deleted` result. The page reacts to the result; it no longer owns the\n // prompt or the API call.\n public delete(): void {\n this._prompt.confirm({\n title: 'Delete Report',\n template: `Delete \"${this._data.report.name}\"? This cannot be undone.`,\n })\n .pipe(\n switchMap(() => this._reportData.delete(this._data.report.id)),\n takeUntilDestroyed(this._destroyRef),\n )\n .subscribe(() => {\n this._message.success('Report deleted');\n this._dialogRef.close({ action: 'deleted' });\n });\n }\n\n public save = () => {\n const reportId = this._data.report.id;\n\n // Persist the report settings and each changed filter default together, so\n // the single Save covers all three tabs. The report reloads on the `saved`\n // result, re-seeding the bar from the new defaults.\n const settings$ = this._reportData.update(reportId, {\n name: this.name,\n pageWidth: this._pageDimension(this.pageWidth),\n pageHeight: this._pageDimension(this.pageHeight),\n layout: this.layout,\n ...this._timezoneSetting(),\n styles: { heading: { size: this.headingSize } },\n headerFooter: {\n headerHeight: this._pageDimension(this.headerHeight) || 0,\n footerHeight: this._pageDimension(this.footerHeight) || 0,\n },\n });\n\n const defaults$ = this.filterRows()\n .filter((row) => this._defaultChanged(row))\n .map((row) => this._reportData.updateFilterGroup(reportId, row.group.id, {\n default: this._rowDefault(row),\n }));\n\n return forkJoin([settings$, ...defaults$])\n .pipe(\n tap(() => {\n this._message.success('Report settings saved');\n this._dialogRef.close({ action: 'saved' });\n }),\n );\n };\n\n // Drop the row's stored rolling preset (Clear). A new row object rather than\n // a mutation, so the signal sees the change; the @for tracks group.id, so\n // the row's bindings survive the swap.\n public clearRelative(row: FilterDefaultRow): void {\n this.filterRows.update((rows) => rows.map((item) => (item === row ? { ...item, relative: null } : item)));\n }\n\n // The page dimension as a real number for the wire. fsMaskNumber hands back\n // the unmasked string it built with a fixed '.' radix (which is the whole\n // point of the mask - a native number input paints the viewer's locale\n // separator instead), so the cast here is a straight parse and never sees a\n // comma. The backend rejects anything non-numeric rather than coercing, so a\n // NaN fails loudly instead of silently storing a wrong page size.\n private _pageDimension(value: number | string): number {\n return typeof value === 'number' ? value : parseFloat(value);\n }\n\n // The zone for the settings PUT, sent only when it moves the report off the\n // zone it already uses, so an untouched dialog never pins a report that\n // follows the application default. A server too old to send\n // effectiveTimezone gets the zone every time, as it always did.\n private _timezoneSetting(): { timezone?: string } {\n const effectiveTimezone = this._data.report.effectiveTimezone;\n\n return effectiveTimezone === undefined || this.timezone !== effectiveTimezone\n ? { timezone: this.timezone }\n : {};\n }\n\n // Build one editable row per report-level filter group (level report or both),\n // in bar order, seeding each draft from the group's stored default.\n private _buildFilterRows(report: Report): void {\n const reportId = report.id;\n\n const built = (report.filterGroups ?? [])\n .filter((group) => group.level === 'report' || group.level === 'both')\n .sort((a, b) => a.order - b.order)\n .map((group) => {\n const groupDefault = group.config?.default;\n // One shared, replayed option stream per group: the chips fetch and the\n // stored default's labels read the same list, so it is fetched once.\n const options$ = loadGroupOptions(group, this._reportData, reportId);\n\n const row: FilterDefaultRow = {\n group,\n label: group.label || group.filters?.[0]?.filterColumn || 'Filter',\n start: dateFromBound(groupDefault?.start),\n end: dateFromBound(groupDefault?.end),\n relative: groupDefault?.relative ?? null,\n // Named below, once the option list carrying their labels is in.\n values: [],\n value: groupDefault?.value ?? '',\n // fs-autocomplete-chips fetch: the group's distinct options, name-filtered.\n // Same loader the report bar uses, so the two never drift.\n fetch: (keyword?: string) => matchOptions(options$, keyword),\n };\n\n return { row, options$, values: groupDefault?.values ?? [] };\n });\n\n const rows = built.map((entry) => entry.row);\n const seeded = built.filter((entry) => entry.values.length);\n\n // Nothing to name — publish immediately rather than waiting on a request\n // no row needs.\n if (!seeded.length) {\n this.filterRows.set(rows);\n\n return;\n }\n\n // A stored select default holds ids, so its chips can only be named once the\n // option list is in. Resolve every seeded row first and publish the rows in\n // one go, so the tab never renders a chip showing a raw id.\n forkJoin(seeded.map((entry) => resolveOptionValues(entry.options$, entry.values)))\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe((resolved) => {\n resolved.forEach((values, index) => seeded[index].row.values = values);\n this.filterRows.set(rows);\n });\n }\n\n // The draft default normalized to the wire shape for this row's type, or null\n // when empty (which clears the stored default). A date range is the picked\n // dates when there are any, else the carried rolling preset, never both: the\n // server refuses a relative preset combined with dates.\n private _rowDefault(row: FilterDefaultRow): FilterGroupDefault | null {\n switch (row.group.type) {\n case 'dateRange': {\n const start = dateToBound(row.start);\n const end = dateToBound(row.end);\n\n if (start || end) {\n return { start: start ?? undefined, end: end ?? undefined };\n }\n\n return row.relative ? { relative: row.relative } : null;\n }\n\n case 'select':\n return row.values.length ? { values: row.values.map((option) => option.value) } : null;\n\n case 'keyword':\n default: {\n const value = row.value.trim();\n\n return value ? { value } : null;\n }\n }\n }\n\n // Whether the row's draft differs from the group's stored default — only\n // changed rows are persisted on Save.\n private _defaultChanged(row: FilterDefaultRow): boolean {\n const before = JSON.stringify(this._normalize(row.group.config?.default ?? null));\n const after = JSON.stringify(this._normalize(this._rowDefault(row)));\n\n return before !== after;\n }\n\n // A stable comparison form: empty and undefined keys are dropped so a no-op\n // edit doesn't read as a change. relative is compared like the rest: the row\n // carries it, so an untouched rolling default reads as unchanged.\n private _normalize(value: FilterGroupDefault | null): FilterGroupDefault | null {\n if (!value) {\n return null;\n }\n\n const normalized: FilterGroupDefault = {};\n if (value.start) {\n normalized.start = value.start;\n }\n if (value.end) {\n normalized.end = value.end;\n }\n if (value.values?.length) {\n normalized.values = value.values;\n }\n if (value.value) {\n normalized.value = value.value;\n }\n if (value.relative) {\n normalized.relative = value.relative;\n }\n\n return Object.keys(normalized).length ? normalized : null;\n }\n}\n","<form\n fsForm\n [submit]=\"save\">\n <fs-dialog>\n <h1 mat-dialog-title>\n Report Settings\n </h1>\n <mat-dialog-content>\n <mat-tab-group [(selected)]=\"selectedTab\">\n <mat-tab\n label=\"Settings\"\n name=\"settings\">\n <div class=\"fs-column tab-body\">\n <mat-form-field>\n <mat-label>\n Name\n </mat-label>\n <input\n matInput\n [(ngModel)]=\"name\"\n name=\"name\"\n [fsFormRequired]=\"true\">\n </mat-form-field>\n <!--\n The page, typed in inches. Orientation is not asked for because it\n is not an independent choice - a page wider than it is tall IS\n landscape - so the two numbers say everything there is to say.\n -->\n <div class=\"fs-row.gap-sm.align-start\">\n <mat-form-field class=\"fs-flex\">\n <mat-label>\n Width\n </mat-label>\n <input\n matInput\n fsMaskNumber\n [scale]=\"1\"\n [(ngModel)]=\"pageWidth\"\n name=\"pageWidth\"\n [fsFormRequired]=\"true\"\n [fsFormMin]=\"pageDimensionMin\"\n [fsFormMax]=\"pageDimensionMax\">\n <div matTextSuffix>\n inches\n </div>\n </mat-form-field>\n <mat-form-field class=\"fs-flex\">\n <mat-label>\n Height\n </mat-label>\n <input\n matInput\n fsMaskNumber\n [scale]=\"1\"\n [(ngModel)]=\"pageHeight\"\n name=\"pageHeight\"\n [fsFormRequired]=\"true\"\n [fsFormMin]=\"pageDimensionMin\"\n [fsFormMax]=\"pageDimensionMax\">\n <div matTextSuffix>\n inches\n </div>\n </mat-form-field>\n </div>\n <!--\n How deep the header and footer bands are. Their content is edited\n on the canvas (Edit layout → Header & footer); these reserve the\n space for it, and 0 means no band.\n -->\n <mat-form-field class=\"full-width\">\n <mat-label>\n Header height\n </mat-label>\n <input\n matInput\n fsMaskNumber\n [scale]=\"2\"\n [(ngModel)]=\"headerHeight\"\n name=\"headerHeight\"\n [fsFormMin]=\"0\"\n [fsFormMax]=\"headerFooterMax\">\n <div matTextSuffix>\n inches\n </div>\n </mat-form-field>\n <mat-form-field class=\"full-width\">\n <mat-label>\n Footer height\n </mat-label>\n <input\n matInput\n fsMaskNumber\n [scale]=\"2\"\n [(ngModel)]=\"footerHeight\"\n name=\"footerHeight\"\n [fsFormMin]=\"0\"\n [fsFormMax]=\"headerFooterMax\">\n <div matTextSuffix>\n inches\n </div>\n </mat-form-field>\n <mat-form-field>\n <mat-label>\n Layout\n </mat-label>\n <mat-select\n [(ngModel)]=\"layout\"\n name=\"layout\">\n <mat-option value=\"freeform\">\n Freeform — position components anywhere on the page\n </mat-option>\n <mat-option value=\"flow\">\n Flow — components flow into rows by width %\n </mat-option>\n </mat-select>\n <mat-hint>\n Freeform is like PowerPoint; Flow is like a responsive dashboard.\n </mat-hint>\n </mat-form-field>\n <fs-ai-report-timezone-select [(timezone)]=\"timezone\"></fs-ai-report-timezone-select>\n </div>\n </mat-tab>\n <mat-tab\n label=\"Styles\"\n name=\"styles\">\n <div class=\"fs-column tab-body\">\n <mat-form-field>\n <mat-label>\n Heading Size\n </mat-label>\n <input\n matInput\n type=\"number\"\n step=\"1\"\n min=\"6\"\n max=\"96\"\n [(ngModel)]=\"headingSize\"\n name=\"headingSize\"\n [fsFormMin]=\"6\"\n [fsFormMax]=\"96\">\n <span matTextSuffix>\n pt\n </span>\n <mat-hint>\n Applies to component titles. Points map 1:1 to PDF and PowerPoint.\n </mat-hint>\n </mat-form-field>\n </div>\n </mat-tab>\n <mat-tab\n label=\"Filters\"\n name=\"filters\">\n <div class=\"fs-column tab-body\">\n @if (filterRows().length) {\n @for (row of filterRows(); track row.group.id) {\n @switch (row.group.type) {\n @case ('dateRange') {\n <div class=\"fs-row.gap-sm.align-center fs-flex\">\n <mat-form-field class=\"fs-flex\">\n <mat-label>\n Default From {{ row.label }}\n </mat-label>\n <input\n matInput\n fsDatePicker\n [(ngModel)]=\"row.start\"\n [name]=\"'start' + row.group.id\">\n </mat-form-field>\n <mat-form-field class=\"fs-flex\">\n <mat-label>\n Default To {{ row.label }}\n </mat-label>\n <input\n matInput\n fsDatePicker\n [(ngModel)]=\"row.end\"\n [name]=\"'end' + row.group.id\">\n </mat-form-field>\n </div>\n <!-- A stored rolling preset cannot be authored here, only\n kept, replaced by picking dates, or cleared. type=\"button\"\n keeps Clear from submitting the form. -->\n @if (row.relative && !row.start && !row.end) {\n <div class=\"fs-row.gap-sm.align-center\">\n <mat-hint class=\"fs-flex\">\n Rolling default: {{ relativeLabel(row.relative) }}. Pick dates to replace it.\n </mat-hint>\n <button\n mat-button\n type=\"button\"\n (click)=\"clearRelative(row)\">\n Clear\n </button>\n </div>\n }\n }\n @case ('select') {\n <fs-autocomplete-chips\n class=\"fs-flex\"\n [label]=\"'Default ' + row.label\"\n [fetch]=\"row.fetch\"\n [(ngModel)]=\"row.values\"\n [name]=\"'values' + row.group.id\"\n [multiple]=\"true\"\n [fetchOnFocus]=\"true\">\n <ng-template\n fsAutocompleteChipsTemplate\n let-object=\"object\">\n {{ object.name }}\n </ng-template>\n </fs-autocomplete-chips>\n }\n @default {\n <mat-form-field class=\"fs-flex\">\n <mat-label>\n Default {{ row.label }}\n </mat-label>\n <input\n matInput\n [(ngModel)]=\"row.value\"\n [name]=\"'value' + row.group.id\">\n </mat-form-field>\n }\n }\n }\n } @else {\n <fs-message-info>\n This report has no report-level filters yet. Add a filter to a\n component (its settings → Filters) and show it in the report bar,\n then set its default here.\n </fs-message-info>\n }\n </div>\n </mat-tab>\n </mat-tab-group>\n </mat-dialog-content>\n <mat-dialog-actions>\n <fs-form-dialog-actions>\n <button\n type=\"button\"\n mat-button\n color=\"warn\"\n (click)=\"delete()\">\n Delete\n </button>\n </fs-form-dialog-actions>\n </mat-dialog-actions>\n </fs-dialog>\n</form>","import { Injectable, inject } from '@angular/core';\n\nimport { format } from 'date-fns';\nimport { Observable, forkJoin, from, map, of } from 'rxjs';\nimport { catchError, mergeMap, toArray } from 'rxjs/operators';\n\nimport { ReportData } from '../data/report.data';\nimport { formatReportDate, getZonedNow, resolveReportTimezone } from '../format';\nimport {\n ComponentData,\n ComponentDataState,\n GRANULARITY_OPTIONS,\n ListConfig,\n Report,\n ReportComponent,\n ReportFilterGroup,\n ReportPage,\n} from '../interfaces/report.interface';\nimport { pivotHeadings } from '../option-builder';\nimport { dateBoundLabel, loadGroupOptions, resolveOptionValues } from '../report-filter-items';\nimport { ReportFilterStateService } from '../services/report-filter-state.service';\n\n\nexport interface CollectedComponent {\n component: ReportComponent;\n // null = its query failed; exports show a note. Always null for a text\n // block, which has no query — see isFailed().\n data: ComponentData | null;\n}\n\nexport interface CollectedPage {\n page: ReportPage;\n components: CollectedComponent[];\n}\n\nexport interface CollectedReport {\n report: Report;\n pages: CollectedPage[];\n // Human-readable lines describing the active filters, for the title slide/page.\n filterSummary: string[];\n // What the numbers are measured in, for the title slide/page: the zone the\n // server resolved for the report. Empty when the server does not send one,\n // rather than a guess that would be wrong whenever the default applies.\n contextLines: string[];\n}\n\n// One exported list column: the cell key and how it is shown.\nexport interface ExportListColumn {\n column: string;\n label?: string;\n format?: string;\n}\n\n// How many tile queries an export runs at once.\n//\n// Not a politeness setting — it is the difference between a deck and a broken\n// one. These queries are heavy and read the same tables, so firing all of them\n// together puts every one in contention for the same database at the same\n// moment and they cross the statement ceiling as a group: measured on report\n// 28, ten tiles that each answer in 9-24s run one after another all failed at\n// ~30s when released together. Concurrency buys wall-clock only up to the point\n// where the queries start taking it back off each other, and past that it buys\n// failures.\nconst EXPORT_CONCURRENCY = 3;\n\n// What a component with nothing to draw prints in the exported file.\n//\n// The two cases must not read alike. A tile that returned no rows is a finding\n// about the period — the report worked and the answer is \"none\". A tile whose\n// query failed is a hole in the file, and calling that \"Data unavailable\" tells\n// the reader the data does not exist when what happened is that nobody managed\n// to ask for it. Shared by both renderers so the PDF and the deck cannot end up\n// describing the same hole two different ways.\nexport function emptyLabel(item: CollectedComponent): string {\n return item.data ? 'No data' : 'Could not be generated';\n}\n\n// Whether a tile's query failed. A text block has no query, so it never did.\nexport function isFailed(item: CollectedComponent): boolean {\n return !item.data && item.component.type !== 'text';\n}\n\n// The lines under the report's name on the PDF title page and the title slide:\n// the export date, the active filters, then what the numbers are measured in.\n// The date is today in the report's zone, the same day its filters resolve\n// \"today\" to.\nexport function coverLines(collected: CollectedReport): string[] {\n return [\n format(getZonedNow(resolveReportTimezone(collected.report)), 'MMMM d, yyyy'),\n ...collected.filterSummary,\n ...collected.contextLines,\n ];\n}\n\n// An exported list cell, reading like the on-screen cell: the SQL already\n// carries the formatting, so the value goes out verbatim. A date column is the\n// one value the browser renders, and it renders through the same function as\n// the screen, in the report's zone.\nexport function exportCell(value: unknown, columnFormat: string | undefined, timezone: string): string {\n if (value === null || value === undefined) {\n return '';\n }\n\n return columnFormat === 'date' ? formatReportDate(value, timezone) : String(value);\n}\n\n// The columns an exported list table draws. A cross-tab's columns arrive with\n// its rows (the row key first, then one per pivot value), since only the\n// result knows the pivot values; a plain list draws its configured columns,\n// else every column the query returned.\nexport function listColumns(component: ReportComponent, data: ComponentData): ExportListColumn[] {\n const config = (component.config ?? {}) as ListConfig;\n\n if (!config.pivotBy?.column && config.columns?.length) {\n return config.columns;\n }\n\n return data.columns.map((column) => ({ column }));\n}\n\n// The heading over each column of listColumns(). A cross-tab is headed as on\n// screen, by pivotHeadings(), so its time-pivot headings are formatted periods\n// rather than raw period-starts; a plain list's columns keep their configured\n// labels.\nexport function listHeadings(component: ReportComponent, data: ComponentData): string[] {\n const config = (component.config ?? {}) as ListConfig;\n\n if (config.pivotBy?.column) {\n return pivotHeadings(config, data);\n }\n\n return listColumns(component, data).map((column) => column.label || column.column);\n}\n\n// The last row of an exported list table that stops short of its result: how\n// many rows the file leaves out and where the whole set can be had. Each\n// format fetches its own number of rows (PDF_LIST_ROWS, PPTX_LIST_ROWS), and\n// both name what is left with this one sentence.\nexport function moreRowsNotice(remaining: number): string {\n return `… ${remaining} more row(s) — use the component's CSV export for the full dataset`;\n}\n\n// The pages of a collected report that have at least one tile whose query\n// failed — what the export gate names to the user, and what makes \"some of this\n// file is missing\" a fact the caller can act on rather than a thing they notice\n// in the PDF afterwards.\nexport function failedPageNames(collected: CollectedReport): string[] {\n // Numbered before the filter — an unnamed page 4 that failed has to read\n // \"Page 4\", not \"Page 1\" because it happened to be the first failure.\n return collected.pages\n .map((page, index) => ({ page, number: index + 1 }))\n .filter(({ page }) => page.components.some(isFailed))\n .map(({ page, number }) => page.page.name || `Page ${number}`);\n}\n\n// Gathers everything an export needs: every component's data across ALL pages\n// (the canvas only renders the active page, so exports can't scrape the\n// screen), fetched fresh with the viewer's current filter state.\n//\n// A failed component resolves to a null `data` rather than failing the whole\n// collection — but that is so the caller can REPORT what failed, not so it can\n// be ignored: see failedPageNames() and the export gate that uses it.\n@Injectable()\nexport class ReportExportCollectorService {\n\n private _reportData = inject(ReportData);\n private _filterState = inject(ReportFilterStateService);\n\n // listRows is how many rows each list fetches: the renderer's own cap, since\n // a PDF table continues onto extra pages and a slide table cannot.\n public collect(report: Report, listRows: number): Observable<CollectedReport> {\n const slots: { pageIndex: number; component: ReportComponent }[] = [];\n\n report.pages.forEach((page, pageIndex) => {\n for (const component of page.components) {\n slots.push({ pageIndex, component });\n }\n });\n\n // Text blocks have nothing to fetch — they ride through with no data. The\n // header/footer (report.master) is read by the renderers straight off the\n // report for the same reason.\n\n // Released a few at a time rather than all at once. mergeMap completes out\n // of order, so each result carries the slot it came from and the rows are\n // filed by index — the deck's page order can't depend on which query\n // happened to finish first.\n const all$ = slots.length\n ? from(slots.map((slot, index) => ({ slot, index })))\n .pipe(\n mergeMap(\n ({ slot, index }) => this._componentData(report, slot.component, listRows)\n .pipe(map((item) => ({ item, index }))),\n EXPORT_CONCURRENCY,\n ),\n toArray(),\n )\n : of([] as { item: CollectedComponent; index: number }[]);\n\n // The summary rides alongside the component data rather than being built at\n // the end, because naming a select filter's values is itself a request.\n return forkJoin({ collected: all$, filterSummary: this.getFilterSummary(report) })\n .pipe(\n map(({ collected, filterSummary }) => {\n const pages: CollectedPage[] = report.pages.map((page) => ({ page, components: [] }));\n\n [...collected]\n .sort((a, b) => a.index - b.index)\n .forEach(({ item, index }) => {\n pages[slots[index].pageIndex].components.push(item);\n });\n\n return {\n report,\n pages,\n filterSummary,\n contextLines: this._contextLines(report),\n };\n }),\n );\n }\n\n // \"Report Period: Jun 12, 2025 – Jun 12, 2026\", \"Region: North, East\" — one\n // line per filter group that has an active session value, then the group-by\n // line. The filter bar as the viewer reads it: the PDF and PowerPoint covers\n // print it, and the report zip export sends it for its notes file.\n //\n // A select group stores ids, so its line has to be named off the option list\n // before it can be printed; a date or keyword group already holds its own\n // display value and resolves synchronously.\n public getFilterSummary(report: Report): Observable<string[]> {\n const lines: Observable<string>[] = [];\n\n for (const group of report.filterGroups ?? []) {\n const value = this._filterState.value(group.id);\n if (!value) {\n continue;\n }\n\n const label = group.label || 'Filter';\n\n if (value.start || value.end) {\n lines.push(of(`${label}: ${this._date(value.start)} – ${this._date(value.end)}`));\n } else if (value.values?.length) {\n lines.push(this._selectLine(label, group, report.id, value.values));\n } else if (value.value?.trim()) {\n lines.push(of(`${label}: \"${value.value.trim()}\"`));\n }\n }\n\n // The group-by grain, under the report's own name for the control — a cover\n // sheet reading \"Frequency\" when the report calls it \"Period\" describes a\n // control the reader cannot find on screen.\n const granularity = this._filterState.frequency();\n if (granularity) {\n const option = GRANULARITY_OPTIONS.find((item) => item.value === granularity);\n const label = report.config?.groupBy?.label || 'Group By';\n lines.push(of(`${label}: ${option?.name ?? granularity}`));\n }\n\n return lines.length ? forkJoin(lines) : of([]);\n }\n\n private _componentData(report: Report, component: ReportComponent, listRows: number): Observable<CollectedComponent> {\n if (component.type === 'text') {\n return of({ component, data: null });\n }\n\n const filters = this._filterState.resolveForComponent(component);\n // A time-series chart carries the viewer's group-by grain so the export\n // re-buckets exactly as the screen does; lists carry their export paging\n // and the viewer's header sort, so the table reads in the screen's order.\n //\n // The time-series check deliberately mirrors the server's canonical\n // ReportQueryRunner::_isTimeSeriesChart, so a product pinned to an older\n // framework does not re-bucket a non-time chart.\n const frequency = this._filterState.frequency();\n const isTimeSeries = component.type === 'chart' && component.config?.xAxis?.kind === 'time';\n const state: ComponentDataState = component.type === 'list'\n ? { page: 1, pageSize: listRows, sort: this._filterState.listSort(component.id) ?? undefined }\n : (isTimeSeries && frequency ? { frequency } : {});\n\n // handlers: false keeps the app's global error dialog out of this. A failed\n // tile is reported once, by the export gate, naming the pages it cost —\n // never as ten stacked modals carrying the database's own wording.\n return this._reportData.componentData(report.id, component.id, filters, state, true, { handlers: false })\n .pipe(\n map((data: ComponentData) => ({ component, data })),\n catchError(() => of({ component, data: null })),\n );\n }\n\n // The zone the server resolved, as its IANA id. Only the server's value is\n // printed: the browser's zone (resolveReportTimezone's fallback for an older\n // server) is not what the numbers were measured in.\n private _contextLines(report: Report): string[] {\n return report.effectiveTimezone ? [`Timezone: ${report.effectiveTimezone}`] : [];\n }\n\n // One select group's line, with its stored ids resolved to the same names the\n // on-screen chips show — a cover reading \"Organization: 8774, 8777\" tells the\n // reader nothing about what the report covers.\n //\n // Uses the report bar's own loader and resolver so the two can't drift, which\n // also means a value whose entity was deleted keeps showing its raw id rather\n // than dropping off the cover and silently understating the filter. A failed\n // option fetch degrades the whole line to ids for the same reason: an export\n // must never fail on a cosmetic lookup.\n private _selectLine(\n label: string,\n group: ReportFilterGroup,\n reportId: number,\n values: unknown[],\n ): Observable<string> {\n return resolveOptionValues(loadGroupOptions(group, this._reportData, reportId), values)\n .pipe(\n map((resolved) => `${label}: ${resolved.map((item) => item.name).join(', ')}`),\n catchError(() => of(`${label}: ${values.map((item) => String(item)).join(', ')}`)),\n );\n }\n\n // Rendered off the same calendar day the filter sends to the server, so the\n // cover's period is the period the numbers behind it were queried for.\n private _date(value: Date | string | null | undefined): string {\n return dateBoundLabel(value) ?? '…';\n }\n}\n","import { ComponentData, ReportComponent } from '../interfaces/report.interface';\nimport { buildChartOption } from '../option-builder';\n\n\n// Renders a chart to a PNG data URL WITHOUT it being on screen — the PDF\n// export needs every page's charts, but the canvas only renders the active\n// page. ECharts happily initializes against a detached element when given\n// explicit pixel dimensions; animations are disabled so getDataURL is\n// complete synchronously after setOption.\nexport async function renderChartImage(\n component: ReportComponent,\n data: ComponentData,\n width: number,\n height: number,\n pixelRatio = 3,\n): Promise<string> {\n // The same tree-shaken echarts build + 'report' theme the live canvas uses.\n const echarts = (await import('../theme/echarts')).default;\n\n const host = document.createElement('div');\n host.style.width = `${width}px`;\n host.style.height = `${height}px`;\n\n const chart = echarts.init(host, 'report', {\n renderer: 'canvas',\n width,\n height,\n });\n\n try {\n chart.setOption({\n ...buildChartOption(component, data),\n animation: false,\n });\n\n return chart.getDataURL({\n type: 'png',\n pixelRatio,\n backgroundColor: '#ffffff',\n });\n } finally {\n chart.dispose();\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport { formatMeasureValue, resolveReportTimezone } from '../format';\nimport {\n ComponentData,\n KpiConfig,\n Report,\n ReportComponent,\n ReportHeaderFooter,\n ReportPage,\n} from '../interfaces/report.interface';\nimport { ComponentGeometry, DEFAULT_COMPONENT_PADDING, pageGeometry } from '../layout';\nimport {\n DEFAULT_TEXT_COLOR, DEFAULT_TEXT_SIZE, TextParagraph, TextRun, TextTokenContext, textParagraphs,\n} from '../text';\nimport { renderChartImage } from './offscreen-chart';\nimport {\n CollectedComponent, CollectedPage, CollectedReport, coverLines, emptyLabel, exportCell, listColumns, listHeadings,\n moreRowsNotice,\n} from './report-export-collector.service';\n\n\n// Inches → points (the PDF unit).\nconst PT = 72;\n\n// Component title strip height, points.\nconst TITLE_H = 18;\n\n// Rows fetched for a list's PDF table. A table that outgrows its box\n// continues onto pages of its own, so this is how far it may run: about 12-15\n// continuation pages on a letter page, and a tenth of the server's 5000-row\n// ceiling. A longer result ends in a moreRowsNotice() row.\nexport const PDF_LIST_ROWS = 500;\n\n// How far a continuation table sits inside the header and footer bands,\n// points. A page with no band (or with the master hidden) keeps\n// NO_BAND_MARGIN from that edge instead.\nconst CONTINUATION_GAP = 0.25 * PT;\nconst NO_BAND_MARGIN = 0.5 * PT;\nconst NO_BANDS: ReportHeaderFooter = { headerHeight: 0, footerHeight: 0 };\n\n// The last row of a list box whose rows carry on past it.\nconst CONTINUED_NOTICE = 'Continued on the following pages';\n\n// A text line's height as a multiple of its largest font size — the canvas\n// stylesheet's line-height, so a block wraps and stacks the same way.\nconst TEXT_LINE_HEIGHT = 1.25;\n\n// How far a list item's text sits from the block's edge, points; the marker\n// hangs in that space.\nconst LIST_INDENT = 16;\n\n// What every drawing step of one export shares, built once in export().\n// Sizes are points.\ninterface PdfExportContext {\n doc: any;\n autoTable: any;\n jsPDF: any;\n report: Report;\n timezone: string;\n pageW: number;\n pageH: number;\n orientation: 'landscape' | 'portrait';\n}\n\n// Fixed column widths, by column index, in points.\ntype PdfColumnStyles = Record<number, { cellWidth: number }>;\n\n// A table body cell: plain text, or a notice row's one cell spanning every\n// column.\ntype PdfTableCell = string | { content: string; colSpan: number; styles: Record<string, unknown> };\n\n// The rows of a list that did not fit its box, carried onto continuation\n// pages after its report page. x and w are the box's, in points, and the\n// column widths are the ones the on-page table was drawn with, so the table\n// reads as one across pages.\ninterface PdfTableOverflow {\n component: ReportComponent;\n head: string[];\n rows: string[][];\n omitted: number;\n x: number;\n w: number;\n columnStyles: PdfColumnStyles;\n}\n\n// Builds the PDF client-side with jspdf. The report's unit is inches and PDFs\n// are points at exactly 72/inch, so each report page becomes one PDF page of\n// the exact physical size and components land at their precise positions.\n// Charts are rendered through an offscreen ECharts instance at 3× pixel\n// ratio — pixel-identical to the screen, crisp at print size — and tables are\n// drawn with jspdf-autotable. Both libraries load lazily into their own chunks.\n//\n// A list table is fitted to its box by laying it out first, never by a\n// row-height estimate, so it cannot spill past the box. The rows that do not\n// fit continue on pages of their own after the report page, under the same\n// header/footer and with the same column widths, up to PDF_LIST_ROWS; a\n// longer result ends in a row pointing to the component's CSV export.\n@Injectable()\nexport class ReportPdfService {\n\n public async export(collected: CollectedReport): Promise<void> {\n const context = await this._context(collected.report);\n\n this._titlePage(context.doc, collected, context.pageW, context.pageH);\n\n // The physical page number {{page.number}} prints: report pages and\n // their continuation pages alike, the title page not counted.\n let pageNumber = 0;\n\n for (const [index, collectedPage] of collected.pages.entries()) {\n const overflows: PdfTableOverflow[] = [];\n pageNumber += 1;\n\n await this._renderPage(context, collectedPage, index, pageNumber, overflows);\n\n // Each continuation appends its pages at the end of the document, so\n // two lists that overflowed on one page follow it back to back.\n for (const overflow of overflows) {\n pageNumber = this._renderContinuation(context, collectedPage.page, index, pageNumber, overflow);\n }\n }\n\n context.doc.save(`${this._slug(collected.report.name)}.pdf`);\n }\n\n private async _context(report: Report): Promise<PdfExportContext> {\n const { jsPDF } = await import('jspdf');\n const autoTable = (await import('jspdf-autotable')).default;\n\n const pageW = report.pageWidth * PT;\n const pageH = report.pageHeight * PT;\n const orientation = pageW >= pageH ? 'landscape' : 'portrait';\n\n return {\n doc: new jsPDF({ orientation, unit: 'pt', format: [pageW, pageH] }),\n autoTable,\n jsPDF,\n report,\n timezone: resolveReportTimezone(report),\n pageW,\n pageH,\n orientation,\n };\n }\n\n // One report page: the header and footer first, under the page's own\n // components. A list that outgrows its box leaves its remaining rows in\n // overflows.\n private async _renderPage(\n context: PdfExportContext,\n collectedPage: CollectedPage,\n index: number,\n pageNumber: number,\n overflows: PdfTableOverflow[],\n ): Promise<void> {\n const { doc, report } = context;\n const geometry = pageGeometry(report, collectedPage.page);\n const tokens = this._tokens(report, collectedPage.page, index, pageNumber);\n\n doc.addPage([context.pageW, context.pageH], context.orientation);\n this._renderMaster(context, collectedPage.page, tokens);\n\n for (const item of collectedPage.components) {\n const box = geometry.get(item.component.id);\n\n if (item.component.type === 'text') {\n this._renderText(doc, item.component, box ?? item.component, tokens);\n } else {\n await this._renderComponent(context, item, overflows, box);\n }\n }\n }\n\n private _renderMaster(context: PdfExportContext, page: ReportPage, tokens: TextTokenContext): void {\n if (page.masterHidden) {\n return;\n }\n\n for (const component of context.report.master?.components ?? []) {\n this._renderText(context.doc, component, component, tokens);\n }\n }\n\n private _titlePage(doc: any, collected: CollectedReport, pageW: number, pageH: number): void {\n doc.setFont('helvetica', 'bold');\n doc.setFontSize(28);\n doc.setTextColor('#1f2933');\n doc.text(collected.report.name, 40, pageH * 0.35);\n\n doc.setFont('helvetica', 'normal');\n doc.setFontSize(11);\n doc.setTextColor('#52606d');\n\n doc.text(coverLines(collected), 40, pageH * 0.35 + 26);\n }\n\n // A text block, laid out by hand: jsPDF draws strings, not rich text, so each\n // paragraph's runs are broken into words, wrapped to the block's width and\n // drawn word by word in their own font, size and color. Lines past the\n // block's height are dropped — the canvas clips the block there too.\n private _renderText(doc: any, component: ReportComponent, box: ComponentGeometry, tokens: TextTokenContext): void {\n const padding = component.config?.padding;\n const inset = (value: number | undefined) => (value ?? DEFAULT_COMPONENT_PADDING) * PT;\n\n const left = box.x * PT + inset(padding?.left);\n const top = box.y * PT + inset(padding?.top);\n const width = box.w * PT - inset(padding?.left) - inset(padding?.right);\n const bottom = (box.y + box.h) * PT - inset(padding?.bottom);\n\n let cursorY = top;\n let listNumber = 0;\n\n for (const paragraph of textParagraphs(component.config?.html ?? '', tokens)) {\n listNumber = paragraph.bullet === 'number' ? listNumber + 1 : 0;\n const indent = paragraph.bullet ? LIST_INDENT : 0;\n const lines = this._wrap(doc, paragraph, width - indent);\n\n lines.forEach((line, lineIndex) => {\n const size = Math.max(...line.map((word) => word.size), paragraph.runs[0]?.fontSize ?? DEFAULT_TEXT_SIZE);\n const lineHeight = size * TEXT_LINE_HEIGHT;\n if (cursorY + lineHeight > bottom + 0.5) {\n cursorY = Infinity;\n\n return;\n }\n\n const baseline = cursorY + size;\n const lineWidth = line.reduce((sum, word) => sum + word.width, 0);\n let x = left + indent + this._alignOffset(paragraph.align, width - indent, lineWidth);\n\n if (lineIndex === 0 && paragraph.bullet) {\n this._font(doc, line[0]?.run ?? { text: '' }, size);\n doc.text(paragraph.bullet === 'number' ? `${listNumber}.` : '•', left, baseline);\n }\n\n for (const word of line) {\n this._drawWord(doc, word, x, baseline);\n x += word.width;\n }\n\n cursorY += lineHeight;\n });\n\n if (cursorY === Infinity) {\n break;\n }\n\n // An empty paragraph is still a line.\n if (!lines.length) {\n cursorY += DEFAULT_TEXT_SIZE * TEXT_LINE_HEIGHT;\n }\n }\n }\n\n // Break a paragraph's runs into lines of measured words that fit the width.\n // A word keeps its trailing space so spacing survives run boundaries.\n private _wrap(doc: any, paragraph: TextParagraph, width: number): { run: TextRun; text: string; size: number; width: number }[][] {\n const lines: { run: TextRun; text: string; size: number; width: number }[][] = [];\n let line: { run: TextRun; text: string; size: number; width: number }[] = [];\n let lineWidth = 0;\n\n for (const run of paragraph.runs) {\n const size = run.fontSize ?? DEFAULT_TEXT_SIZE;\n this._font(doc, run, size);\n\n for (const text of run.text.match(/\\S+\\s*|\\s+/g) ?? []) {\n const wordWidth = doc.getTextWidth(text);\n\n if (line.length && lineWidth + wordWidth - this._trailingSpace(doc, text) > width) {\n lines.push(line);\n line = [];\n lineWidth = 0;\n }\n\n line.push({ run, text, size, width: wordWidth });\n lineWidth += wordWidth;\n }\n }\n\n if (line.length) {\n lines.push(line);\n }\n\n return lines;\n }\n\n private _drawWord(doc: any, word: { run: TextRun; text: string; size: number; width: number }, x: number, baseline: number): void {\n const run = word.run;\n\n if (run.highlight) {\n doc.setFillColor(run.highlight);\n doc.rect(x, baseline - word.size * 0.9, word.width, word.size * 1.15, 'F');\n }\n\n this._font(doc, run, word.size);\n doc.text(word.text, x, baseline);\n\n const color = run.color ?? DEFAULT_TEXT_COLOR;\n const inkWidth = word.width - this._trailingSpace(doc, word.text);\n if (run.underline) {\n doc.setDrawColor(color);\n doc.setLineWidth(word.size / 16);\n doc.line(x, baseline + word.size * 0.12, x + inkWidth, baseline + word.size * 0.12);\n }\n if (run.strike) {\n doc.setDrawColor(color);\n doc.setLineWidth(word.size / 16);\n doc.line(x, baseline - word.size * 0.3, x + inkWidth, baseline - word.size * 0.3);\n }\n\n if (run.link) {\n doc.link(x, baseline - word.size, inkWidth, word.size * 1.2, { url: run.link });\n }\n }\n\n // jsPDF's standard fonts are Helvetica, Times and Courier; a block's face is\n // mapped onto whichever of the three it resembles.\n private _font(doc: any, run: TextRun, size: number): void {\n const face = (run.fontFace ?? '').toLowerCase();\n const family = /courier|mono/.test(face)\n ? 'courier'\n : (/times|georgia|serif/.test(face) && !face.includes('sans') ? 'times' : 'helvetica');\n const style = run.bold && run.italic\n ? 'bolditalic'\n : (run.bold ? 'bold' : (run.italic ? 'italic' : 'normal'));\n\n doc.setFont(family, style);\n doc.setFontSize(size);\n doc.setTextColor(run.color ?? DEFAULT_TEXT_COLOR);\n }\n\n private _trailingSpace(doc: any, text: string): number {\n const trailing = text.length - text.trimEnd().length;\n\n return trailing ? doc.getTextWidth(' ') * trailing : 0;\n }\n\n private _alignOffset(align: TextParagraph['align'], width: number, lineWidth: number): number {\n switch (align) {\n case 'center':\n return Math.max(0, (width - lineWidth) / 2);\n case 'right':\n return Math.max(0, width - lineWidth);\n default:\n return 0;\n }\n }\n\n // What a text block's tokens fill with on this page. The number is the\n // physical page among the report's pages, continuation pages included — the\n // title page is not a report page. The name stays the report page's, so a\n // continuation page is named for the page its table started on.\n private _tokens(report: Report, page: ReportPage, index: number, pageNumber: number): TextTokenContext {\n return {\n pageNumber,\n pageName: page.name || `Page ${index + 1}`,\n reportName: report.name,\n };\n }\n\n private async _renderComponent(\n context: PdfExportContext,\n item: CollectedComponent,\n overflows: PdfTableOverflow[],\n geometry?: ComponentGeometry,\n ): Promise<void> {\n const { doc } = context;\n const component = item.component;\n // Geometry arrives in inches (flow layout pre-resolved); the PDF draws in\n // points.\n const inches = geometry ?? component;\n const x = inches.x * PT;\n const y = inches.y * PT;\n const w = inches.w * PT;\n const h = inches.h * PT;\n\n if (component.title) {\n this._componentTitle(doc, component.title, x, y, w);\n }\n\n const bodyY = y + TITLE_H;\n const bodyH = Math.max(20, h - TITLE_H);\n\n if (!item.data || !item.data.rows?.length) {\n this._boxNote(doc, emptyLabel(item), x, bodyY, w, bodyH);\n\n return;\n }\n\n switch (component.type) {\n case 'chart': {\n const image = await renderChartImage(component, item.data, w, bodyH);\n doc.addImage(image, 'PNG', x, bodyY, w, bodyH);\n break;\n }\n case 'list':\n this._renderTable(context, component, item.data, x, bodyY, w, bodyH, overflows);\n break;\n case 'kpi':\n this._renderKpi(context, component, item.data, x, bodyY, w, bodyH);\n break;\n }\n }\n\n // The bold strip over a component, and over each of its continuation pages.\n private _componentTitle(doc: any, title: string, x: number, y: number, w: number): void {\n doc.setFont('helvetica', 'bold');\n doc.setFontSize(9);\n doc.setTextColor('#1f2933');\n doc.text(title, x, y + 10, { maxWidth: w });\n }\n\n // An italic grey line centered in a component's body, for a body that holds\n // something other than its content.\n private _boxNote(doc: any, text: string, x: number, y: number, w: number, h: number): void {\n doc.setFont('helvetica', 'italic');\n doc.setFontSize(9);\n doc.setTextColor('#7b8794');\n doc.text(text, x + w / 2, y + h / 2, { align: 'center' });\n }\n\n // A list's on-page table. All of its fetched rows are laid out once to learn\n // how many the box holds; when they do not all fit, the box's last row says\n // the table continues and the rest go to overflows for continuation pages.\n // A box too short for even the head carries the notice as a line instead.\n // Points throughout.\n private _renderTable(\n context: PdfExportContext,\n component: ReportComponent,\n data: ComponentData,\n x: number, y: number, w: number, h: number,\n overflows: PdfTableOverflow[],\n ): void {\n const head = listHeadings(component, data);\n const cells = this._tableCells(component, data, context.timezone);\n const omitted = Math.max(0, (data.paging?.total ?? cells.length) - cells.length);\n const bottom = context.pageH - (y + h);\n const { fit, columnStyles } = this._measure(context, head, cells, x, y, w, bottom);\n\n if (fit === cells.length && omitted === 0) {\n this._drawTable(context, this._tableOptions(context, head, cells, x, y, w, bottom, columnStyles));\n\n return;\n }\n\n // The notice takes the place of the last row that fit, so that row moves\n // to the continuation. omitted > 0 means a full PDF_LIST_ROWS fetch, which\n // never fits one box, so the CSV notice always lands on a continuation\n // page.\n const kept = Math.max(0, fit - 1);\n overflows.push({ component, head, rows: cells.slice(kept), omitted, x, w, columnStyles });\n\n if (fit >= 1) {\n const body = [...cells.slice(0, kept), this._noticeRow(CONTINUED_NOTICE, head.length, true)];\n this._drawTable(context, this._tableOptions(context, head, body, x, y, w, bottom, columnStyles));\n } else {\n this._boxNote(context.doc, CONTINUED_NOTICE, x, y, w, h);\n }\n }\n\n // Each fetched row as the strings its table cells print.\n private _tableCells(component: ReportComponent, data: ComponentData, timezone: string): string[][] {\n const columns = listColumns(component, data);\n\n return data.rows.map((row) => columns.map((column) => exportCell(row[column.column], column.format, timezone)));\n }\n\n // The autoTable options every list table shares: the dry run, the on-page\n // draw and the continuation pages, so the three lay a table out alike. The\n // font is named rather than inherited, since the doc carries whatever the\n // last text drawn left set. bottom is the margin under the table, points.\n private _tableOptions(\n context: PdfExportContext,\n head: string[],\n body: PdfTableCell[][],\n x: number, startY: number, w: number, bottom: number,\n columnStyles?: PdfColumnStyles,\n ): Record<string, unknown> {\n return {\n theme: 'grid',\n head: [head],\n body,\n startY,\n margin: { left: x, right: context.pageW - x - w, bottom },\n tableWidth: w,\n rowPageBreak: 'avoid',\n styles: { font: 'helvetica', fontStyle: 'normal', fontSize: 8, cellPadding: 3, textColor: '#1f2933' },\n headStyles: { fillColor: '#4e79a7', textColor: '#ffffff', fontStyle: 'bold' },\n alternateRowStyles: { fillColor: '#f5f7fa' },\n ...(columnStyles ? { columnStyles } : {}),\n };\n }\n\n // A notice as a table row: one italic grey cell spanning every column. A\n // single-line notice is ellipsized at the box's width and keeps the data\n // cells' font size and padding, so it is never taller than the data row\n // whose place it takes.\n private _noticeRow(text: string, span: number, singleLine: boolean): PdfTableCell[] {\n return [{\n content: text,\n colSpan: span,\n styles: { fontStyle: 'italic', textColor: '#7b8794', ...(singleLine ? { overflow: 'ellipsize' } : {}) },\n }];\n }\n\n // Lays every fetched row out once on a scratch document of the same page\n // size, with the options the real draw uses, and reads back how many body\n // rows the box's page holds (fit) and the column widths autoTable chose.\n // fit 0 means not even one body row fits under the head (or the head itself\n // did not fit): autoTable moved to a new page before drawing. The real document is untouched.\n private _measure(\n context: PdfExportContext,\n head: string[],\n cells: string[][],\n x: number, y: number, w: number, bottom: number,\n ): { fit: number; columnStyles: PdfColumnStyles } {\n const scratch = new context.jsPDF({\n unit: 'pt',\n format: [context.pageW, context.pageH],\n orientation: context.orientation,\n });\n let fit = 0;\n\n context.autoTable(scratch, {\n ...this._tableOptions(context, head, cells, x, y, w, bottom),\n didDrawCell: (hook: any) => {\n if (hook.section === 'body' && scratch.getCurrentPageInfo().pageNumber === 1) {\n fit = Math.max(fit, hook.row.index + 1);\n }\n },\n });\n\n const columns: { width: number }[] = scratch.lastAutoTable.columns;\n const columnStyles: PdfColumnStyles = {};\n columns.forEach((column, index) => {\n columnStyles[index] = { cellWidth: column.width };\n });\n\n // A row taller than a whole page is split rather than moved, so a last\n // row that started on the first page can still have run past it.\n if (fit === cells.length && scratch.getNumberOfPages() > 1) {\n fit -= 1;\n }\n\n return { fit, columnStyles };\n }\n\n // Draws an on-page table, then removes any page the draw added. That should\n // never happen: the measured fit, the identical column widths and a\n // single-line notice keep the table inside its box. The check exists so a\n // stray page can never catch the report page's remaining components.\n private _drawTable(context: PdfExportContext, options: Record<string, unknown>): void {\n const { doc } = context;\n const page = doc.getCurrentPageInfo().pageNumber;\n const pages = doc.getNumberOfPages();\n\n context.autoTable(doc, options);\n\n while (doc.getNumberOfPages() > pages) {\n doc.deletePage(doc.getNumberOfPages());\n }\n\n doc.setPage(page);\n }\n\n // The rows of one list that did not fit its box, on pages appended after\n // the report page, each with the page's header and footer, the table's\n // title and its head again. The table sits CONTINUATION_GAP inside the\n // bands. Returns the physical page counter after these pages.\n private _renderContinuation(\n context: PdfExportContext,\n page: ReportPage,\n index: number,\n pageNumber: number,\n overflow: PdfTableOverflow,\n ): number {\n const { doc, report } = context;\n const bands = page.masterHidden ? NO_BANDS : report.config?.headerFooter ?? NO_BANDS;\n const top = this._continuationMargin(bands.headerHeight);\n const bottom = this._continuationMargin(bands.footerHeight);\n const { x, w } = overflow;\n const body: PdfTableCell[][] = overflow.omitted > 0\n ? [...overflow.rows, this._noticeRow(moreRowsNotice(overflow.omitted), overflow.head.length, false)]\n : overflow.rows;\n let counter = pageNumber;\n\n doc.addPage([context.pageW, context.pageH], context.orientation);\n context.autoTable(doc, {\n ...this._tableOptions(context, overflow.head, body, x, top + TITLE_H, w, bottom, overflow.columnStyles),\n margin: { top: top + TITLE_H, bottom, left: x, right: context.pageW - x - w },\n showHead: 'everyPage',\n // Fires on every page the table draws on, the first included.\n willDrawPage: () => {\n counter += 1;\n this._renderMaster(context, page, this._tokens(report, page, index, counter));\n this._componentTitle(doc, this._continuedTitle(overflow.component), x, top, w);\n },\n });\n\n return counter;\n }\n\n // The margin a continuation table keeps from one edge: inside the band when\n // the page has one.\n private _continuationMargin(band: number): number {\n return band ? band * PT + CONTINUATION_GAP : NO_BAND_MARGIN;\n }\n\n private _continuedTitle(component: ReportComponent): string {\n return component.title ? `${component.title} (continued)` : 'Continued';\n }\n\n private _renderKpi(\n context: PdfExportContext,\n component: ReportComponent,\n data: ComponentData,\n x: number, y: number, w: number, h: number,\n ): void {\n const { doc, report } = context;\n const config = component.config as KpiConfig;\n const row = data.rows[0] ?? {};\n const column = config.measure?.column ?? Object.keys(row)[0];\n const value = formatMeasureValue(\n row[column],\n config.measure?.format,\n config.measure?.precision,\n report.percentFormat === 'ratio',\n );\n\n doc.setFont('helvetica', 'bold');\n doc.setFontSize(26);\n doc.setTextColor('#1f2933');\n doc.text(value, x + w / 2, y + h / 2, { align: 'center' });\n\n if (config.measure?.label) {\n doc.setFont('helvetica', 'normal');\n doc.setFontSize(9);\n doc.setTextColor('#7b8794');\n doc.text(config.measure.label, x + w / 2, y + h / 2 + 16, { align: 'center' });\n }\n }\n\n private _slug(name: string): string {\n return name.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '') || 'report';\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport { chartAxisFormatCode, formatMeasureValue, resolveReportTimezone } from '../format';\nimport {\n ChartConfig,\n ChartGranularity,\n ComponentData,\n LegendPosition,\n KpiConfig,\n Report,\n ReportComponent,\n ReportPage,\n WaterfallStepKind,\n} from '../interfaces/report.interface';\nimport { ComponentGeometry, DEFAULT_COMPONENT_PADDING, pageGeometry } from '../layout';\nimport { DEFAULT_TEXT_COLOR, DEFAULT_TEXT_SIZE, TextTokenContext, textParagraphs } from '../text';\nimport {\n extractChartSeries,\n extractWaterfall,\n formatPeriodLabel,\n isColorBy,\n resolveLegendPosition,\n seriesTypes,\n spansMultipleYears,\n WaterfallStep,\n} from '../option-builder';\nimport { REPORT_CHART_COLORS, REPORT_WATERFALL_COLORS } from '../theme/palette';\nimport {\n CollectedComponent, CollectedReport, coverLines, emptyLabel, exportCell, listColumns, listHeadings, moreRowsNotice,\n} from './report-export-collector.service';\n\n\n// Component title strip height on the slide, inches.\nconst TITLE_H = 0.28;\n// Approximate table row height, inches — drives the rows-that-fit cap.\nconst SLIDE_ROW_H = 0.26;\n\n// Rows fetched for a list's slide table. A slide table never continues onto\n// another slide, so this only has to cover the rows a box can show; the\n// moreRowsNotice() row names the rest.\nexport const PPTX_LIST_ROWS = 100;\n\n// Our legend positions mapped to pptxgenjs's single-letter legendPos codes.\n// 'hidden' has no slot — showLegend is turned off instead — so it falls back\n// to top.\nconst PPTX_LEGEND_POS: Record<LegendPosition, 't' | 'b' | 'l' | 'r'> = {\n top: 't',\n bottom: 'b',\n left: 'l',\n right: 'r',\n hidden: 't',\n};\n\n// What a waterfall's series are called in PowerPoint's data sheet and on hover.\n// The legend stays off, as it does on screen.\nconst WATERFALL_SERIES_NAMES: Record<WaterfallStepKind, string> = {\n rise: 'Increase',\n fall: 'Decrease',\n total: 'Total',\n};\n\n// A null is a period with no value. The screen breaks the line there, and\n// pptxgenjs's default ('span') would draw straight across it. The setting is\n// chart-level, so a combo's every type inherits it through the chart options.\nconst BLANKS_AS_GAPS = { displayBlanksAs: 'gap' } as const;\n\n// One native chart series: its name, its fill and its value per category. A\n// null is a blank point: a gap in every axis chart, not only the waterfall,\n// and a zero where bars stack.\ninterface PptxChartSeries {\n name: string;\n color: string;\n values: (number | null)[];\n}\n\n// Builds the PowerPoint deck client-side with pptxgenjs. Charts are NATIVE\n// editable PowerPoint charts (slide.addChart writes real chart XML with an\n// embedded data workbook — \"Edit Data\" works), never images. The page IS the\n// slide: the report's unit is inches — exactly PowerPoint's unit — so the\n// layout and every component position transfer with no conversion at all.\n// pptxgenjs is loaded lazily so it lives in its own webpack chunk.\n@Injectable()\nexport class ReportPptxService {\n\n public async export(collected: CollectedReport): Promise<void> {\n const PptxGenJS = (await import('pptxgenjs')).default;\n\n const report = collected.report;\n const pageW = report.pageWidth;\n const pageH = report.pageHeight;\n\n const pptx = new PptxGenJS();\n pptx.defineLayout({ name: 'REPORT', width: pageW, height: pageH });\n pptx.layout = 'REPORT';\n pptx.title = report.name;\n\n this._titleSlide(pptx, collected, pageW, pageH);\n\n const timezone = resolveReportTimezone(report);\n const ratioPercent = report.percentFormat === 'ratio';\n\n collected.pages.forEach((collectedPage, index) => {\n const slide = pptx.addSlide();\n const geometry = pageGeometry(report, collectedPage.page);\n const tokens = this._tokens(report, collectedPage.page, index);\n\n // The header and footer first, so the page's own components sit on top\n // of them exactly as on the canvas.\n if (!collectedPage.page.masterHidden) {\n for (const component of report.master?.components ?? []) {\n this._renderText(slide, component, component, tokens);\n }\n }\n\n for (const item of collectedPage.components) {\n const box = geometry.get(item.component.id);\n\n if (item.component.type === 'text') {\n this._renderText(slide, item.component, box ?? item.component, tokens);\n } else {\n this._renderComponent(pptx, slide, item, timezone, ratioPercent, box);\n }\n }\n });\n\n await pptx.writeFile({ fileName: `${this._slug(report.name)}.pptx` });\n }\n\n private _titleSlide(pptx: any, collected: CollectedReport, pageW: number, pageH: number): void {\n const slide = pptx.addSlide();\n\n slide.addText(collected.report.name, {\n x: 0.5, y: pageH * 0.3, w: pageW - 1, h: 0.8,\n fontSize: 30, bold: true, color: '1F2933',\n });\n\n const lines = coverLines(collected);\n\n slide.addText(lines.join('\\n'), {\n x: 0.5, y: pageH * 0.3 + 0.9, w: pageW - 1, h: Math.max(0.4, lines.length * 0.25),\n fontSize: 12, color: '52606D',\n });\n }\n\n // A text block as ONE native PowerPoint text box — editable in the deck, with\n // each paragraph's runs carrying their own bold/italic/color/size. The box's\n // inset is the block's padding, so the words land where they sat on screen.\n private _renderText(slide: any, component: ReportComponent, box: ComponentGeometry, tokens: TextTokenContext): void {\n const runs: any[] = [];\n const paragraphs = textParagraphs(component.config?.html ?? '', tokens);\n\n paragraphs.forEach((paragraph, index) => {\n const isLast = index === paragraphs.length - 1;\n const paragraphOptions = {\n align: paragraph.align,\n bullet: paragraph.bullet === 'number'\n ? { type: 'number' }\n : (paragraph.bullet === 'bullet' ? true : undefined),\n };\n const paragraphRuns = paragraph.runs.length ? paragraph.runs : [{ text: '' }];\n\n paragraphRuns.forEach((run, runIndex) => {\n runs.push({\n text: run.text,\n options: {\n ...paragraphOptions,\n bold: run.bold,\n italic: run.italic,\n underline: run.underline ? { style: 'sng' } : undefined,\n strike: run.strike ? 'sngStrike' : undefined,\n color: (run.color ?? DEFAULT_TEXT_COLOR).replace('#', ''),\n highlight: run.highlight?.replace('#', ''),\n fontSize: run.fontSize ?? DEFAULT_TEXT_SIZE,\n fontFace: run.fontFace,\n hyperlink: run.link ? { url: run.link } : undefined,\n breakLine: runIndex === paragraphRuns.length - 1 && !isLast,\n },\n });\n });\n });\n\n if (!runs.length) {\n return;\n }\n\n const padding = component.config?.padding;\n const inset = (value: number | undefined) => (value ?? DEFAULT_COMPONENT_PADDING) * 72;\n\n slide.addText(runs, {\n x: box.x, y: box.y, w: box.w, h: box.h,\n valign: 'top',\n fontFace: 'Arial',\n margin: [inset(padding?.left), inset(padding?.right), inset(padding?.bottom), inset(padding?.top)],\n fit: 'none',\n });\n }\n\n // What a text block's tokens fill with on this slide: the page's position\n // among the report's pages — the title slide is not a report page.\n private _tokens(report: Report, page: ReportPage, index: number): TextTokenContext {\n return {\n pageNumber: index + 1,\n pageName: page.name || `Page ${index + 1}`,\n reportName: report.name,\n };\n }\n\n private _renderComponent(\n pptx: any,\n slide: any,\n item: CollectedComponent,\n timezone: string,\n ratioPercent: boolean,\n geometry?: ComponentGeometry,\n ): void {\n const component = item.component;\n // Geometry is in inches — PowerPoint's native unit (flow layout arrives\n // pre-resolved into rows by pageGeometry).\n const { x, y, w, h } = geometry ?? component;\n\n if (component.title) {\n slide.addText(component.title, {\n x, y, w, h: TITLE_H,\n fontSize: 10, bold: true, color: '1F2933', valign: 'top',\n });\n }\n\n const bodyY = y + TITLE_H;\n const bodyH = Math.max(0.3, h - TITLE_H);\n\n if (!item.data || !item.data.rows?.length) {\n slide.addText(emptyLabel(item), {\n x, y: bodyY, w, h: bodyH,\n fontSize: 10, italic: true, color: '7B8794', align: 'center', valign: 'middle',\n });\n\n return;\n }\n\n switch (component.type) {\n case 'chart':\n this._renderChart(pptx, slide, component, item.data, x, bodyY, w, bodyH);\n break;\n case 'list':\n this._renderTable(slide, component, item.data, timezone, x, bodyY, w, bodyH);\n break;\n case 'kpi':\n this._renderKpi(slide, component, item.data, ratioPercent, x, bodyY, w, bodyH);\n break;\n }\n }\n\n private _renderChart(\n pptx: any,\n slide: any,\n component: ReportComponent,\n data: ComponentData,\n x: number, y: number, w: number, h: number,\n ): void {\n const config = component.config as ChartConfig;\n const chartType = config.chartType ?? 'bar';\n\n if (chartType === 'waterfall') {\n this._renderWaterfall(pptx, slide, component, data, x, y, w, h);\n\n return;\n }\n\n const extracted = extractChartSeries(component, data);\n\n const typeMap: Record<string, any> = {\n bar: pptx.ChartType.bar,\n line: pptx.ChartType.line,\n area: pptx.ChartType.area,\n pie: pptx.ChartType.pie,\n donut: pptx.ChartType.doughnut,\n };\n\n const pie = chartType === 'pie' || chartType === 'donut';\n const colorBy = isColorBy(config);\n const labels = this._categoryLabels(extracted.categories, data.granularity);\n\n // Native chart data: one entry per series (pie charts take exactly one).\n // colorBy emits one series per category for the on-screen overlap; PowerPoint\n // has no equivalent overlap, so collapse them back into a single series (each\n // category's value sits at its own slot) — one full-width bar per category —\n // rather than letting PowerPoint cluster them into slivers.\n const chartData = colorBy\n ? [{\n name: config.measures?.[0]?.label ?? config.colorBy?.label ?? '',\n labels,\n values: extracted.categories.map((_, index) => extracted.series[index]?.values[index] ?? null),\n }]\n : (pie ? extracted.series.slice(0, 1) : extracted.series)\n .map((series) => ({\n name: series.name,\n labels,\n // A pie keeps the 0 the screen's pie uses; an axis chart keeps its\n // null so the point is a gap.\n values: pie ? series.values.map((value) => value ?? 0) : series.values,\n }));\n\n // A single-series colorBy chart can't carry a per-category legend in a native\n // PowerPoint bar chart; the category axis labels identify each bar instead.\n const legendPosition = colorBy\n ? 'hidden'\n : resolveLegendPosition(config, extracted.series.length);\n\n // The type each chartData entry is drawn as. A pie is one entry of its own\n // type; colorBy collapsed its series into one, drawn as the lone measure's.\n const seriesDataTypes: string[] = pie\n ? [chartType]\n : seriesTypes(extracted, chartType).slice(0, colorBy ? 1 : undefined);\n const dataTypes = seriesDataTypes.length ? seriesDataTypes : [chartType];\n\n const options = {\n x, y, w, h,\n chartColors: REPORT_CHART_COLORS,\n showLegend: legendPosition !== 'hidden',\n legendPos: PPTX_LEGEND_POS[legendPosition],\n legendFontSize: 9,\n barDir: config.orientation === 'horizontal' ? 'bar' : 'col',\n barGrouping: config.stacked ? 'stacked' : 'clustered',\n holeSize: chartType === 'donut' ? 55 : undefined,\n ...this._axisTextOptions(config, pie),\n ...BLANKS_AS_GAPS,\n // A pie has no axes. A combo's types inherit these from the chart level.\n ...(pie ? {} : {\n valAxisLabelFormatCode: chartAxisFormatCode(chartData.map((entry) => entry.values), !!config.stacked),\n ...this._categoryOrderOptions(config, dataTypes),\n }),\n dataBorder: { pt: 0, color: 'FFFFFF' },\n };\n\n this._addChart(slide, typeMap, dataTypes, chartData, options);\n }\n\n // A horizontal bar chart reads top-down, first category at the top, as it\n // does on screen. PowerPoint draws category 0 next to the value axis, at the\n // bottom, so the category axis is reversed ('maxMin'); the value axis then\n // crosses at the last category ('max'), which now sits at the bottom, and\n // 'nextTo' keeps its labels on that line (pptxgenjs's default for a bar\n // direction, 'low', would follow the first category to the top). Only an\n // all-bar chart: a line or area is never drawn sideways.\n private _categoryOrderOptions(config: ChartConfig, types: string[]): Record<string, unknown> {\n if (config.orientation !== 'horizontal' || types.some((type) => type !== 'bar')) {\n return {};\n }\n\n return { catAxisOrientation: 'maxMin', catAxisCrossesAt: 'max', valAxisLabelPos: 'nextTo' };\n }\n\n // One native chart when every entry is drawn as the same type. A combo is\n // pptxgenjs's multi-type chart: one entry per type, all on the same category\n // and value axes. It restarts the palette for every type, so each type is\n // handed the colors its series have on screen.\n private _addChart(\n slide: any,\n typeMap: Record<string, any>,\n dataTypes: string[],\n chartData: unknown[],\n options: Record<string, unknown>,\n ): void {\n const distinct = [...new Set(dataTypes)];\n if (distinct.length === 1) {\n slide.addChart(typeMap[distinct[0]], chartData, options);\n\n return;\n }\n\n slide.addChart(distinct.map((type) => {\n const indexes = dataTypes\n .map((dataType, index) => (dataType === type ? index : -1))\n .filter((index) => index >= 0);\n\n return {\n type: typeMap[type],\n data: indexes.map((index) => chartData[index]),\n options: {\n chartColors: indexes.map((index) => REPORT_CHART_COLORS[index % REPORT_CHART_COLORS.length]),\n },\n };\n }), options);\n }\n\n // A waterfall is a stacked bar chart whose first series is invisible: it\n // lifts each bar to where its step starts. The series are cut differently\n // from the screen's; _waterfallSeries says why.\n private _renderWaterfall(\n pptx: any,\n slide: any,\n component: ReportComponent,\n data: ComponentData,\n x: number, y: number, w: number, h: number,\n ): void {\n const config = component.config as ChartConfig;\n const waterfall = extractWaterfall(component, data);\n const labels = this._categoryLabels(waterfall.steps.map((step) => step.category), data.granularity);\n const series = this._waterfallSeries(waterfall.steps);\n\n slide.addChart(pptx.ChartType.bar, series.map((entry) => ({ name: entry.name, labels, values: entry.values })), {\n x, y, w, h,\n chartColors: series.map((entry) => entry.color),\n showLegend: false,\n barDir: config.orientation === 'horizontal' ? 'bar' : 'col',\n barGrouping: 'stacked',\n ...this._axisTextOptions(config, false),\n ...BLANKS_AS_GAPS,\n // The axis spans the running total, so its peak is the furthest a step\n // ends from zero; the pieces it is cut into never stack past that.\n valAxisLabelFormatCode: chartAxisFormatCode(\n [waterfall.steps.map((step) => step.start + (step.change ?? 0))],\n false,\n ),\n ...this._categoryOrderOptions(config, ['bar']),\n // A running total can go below zero, where the category axis crosses;\n // its labels stay at the plot's edge instead of across the bars.\n catAxisLabelPos: 'low',\n });\n }\n\n // PowerPoint stacks positive and negative values apart, each from zero, so a\n // bar cannot simply sit on the total before it the way it does on screen.\n // Each step is cut at zero instead: the invisible base carries it to its end\n // nearer zero, and its kind's series carries the rest — one series above zero\n // and one below, because a step that crosses zero needs both. Every other\n // point is left blank: a zero there would still draw a zero-height bar, which\n // renders as a hairline. A kind's series that stays blank is dropped.\n private _waterfallSeries(steps: WaterfallStep[]): PptxChartSeries[] {\n const base: PptxChartSeries = { name: '', color: 'transparent', values: [] };\n const kinds = Object.keys(WATERFALL_SERIES_NAMES) as WaterfallStepKind[];\n const piece = (kind: WaterfallStepKind) => ({\n kind, name: WATERFALL_SERIES_NAMES[kind], color: REPORT_WATERFALL_COLORS[kind], values: [] as (number | null)[],\n });\n const above = kinds.map(piece);\n const below = kinds.map(piece);\n const blankZero = (value: number) => (value === 0 ? null : value);\n\n for (const step of steps) {\n const end = step.start + (step.change ?? 0);\n const low = Math.min(step.start, end);\n const high = Math.max(step.start, end);\n\n base.values.push(blankZero(low > 0 ? low : (high < 0 ? high : 0)));\n above.forEach((entry) => entry.values.push(\n entry.kind === step.kind ? blankZero(Math.max(high, 0) - Math.max(low, 0)) : null,\n ));\n below.forEach((entry) => entry.values.push(\n entry.kind === step.kind ? blankZero(Math.min(low, 0) - Math.min(high, 0)) : null,\n ));\n }\n\n return [base, ...[...above, ...below].filter((entry) => entry.values.some((value) => value !== null))];\n }\n\n // Compact period labels match the on-screen axis (year only when the data\n // spans years); PowerPoint can't do a styled second line, so it's inline.\n private _categoryLabels(categories: string[], granularity?: ChartGranularity | null): string[] {\n if (!granularity) {\n return categories;\n }\n\n const multiYear = spansMultipleYears(categories);\n\n return categories.map((category) => formatPeriodLabel(category, granularity, multiYear));\n }\n\n // The axis label and title settings every native chart shares. A pie has no\n // value axis to title.\n private _axisTextOptions(config: ChartConfig, pie: boolean): Record<string, unknown> {\n return {\n catAxisLabelFontSize: 9,\n valAxisLabelFontSize: 9,\n showCatAxisTitle: !!config.xAxis?.label,\n catAxisTitle: config.xAxis?.label,\n catAxisTitleFontSize: 10,\n showValAxisTitle: !!config.measures?.[0]?.label && !pie,\n valAxisTitle: config.measures?.[0]?.label,\n valAxisTitleFontSize: 10,\n };\n }\n\n private _renderTable(\n slide: any,\n component: ReportComponent,\n data: ComponentData,\n timezone: string,\n x: number, y: number, w: number, h: number,\n ): void {\n const columns = listColumns(component, data);\n\n const cap = Math.max(2, Math.floor(h / SLIDE_ROW_H) - 1);\n const rows = data.rows.slice(0, cap);\n const remaining = (data.paging?.total ?? data.rows.length) - rows.length;\n\n const header = listHeadings(component, data).map((heading) => ({\n text: heading,\n options: { bold: true, color: 'FFFFFF', fill: { color: '4E79A7' } },\n }));\n\n const body = rows.map((row) => columns.map((column) => ({\n text: exportCell(row[column.column], column.format, timezone),\n options: {},\n })));\n\n if (remaining > 0) {\n body.push([{\n text: moreRowsNotice(remaining),\n options: { colspan: columns.length, italic: true, color: '7B8794' } as any,\n }]);\n }\n\n slide.addTable([header, ...body], {\n x, y, w,\n fontSize: 9,\n color: '1F2933',\n border: { type: 'solid', pt: 0.5, color: 'E4E7EB' },\n autoPage: false,\n rowH: SLIDE_ROW_H,\n valign: 'middle',\n });\n }\n\n private _renderKpi(\n slide: any,\n component: ReportComponent,\n data: ComponentData,\n ratioPercent: boolean,\n x: number, y: number, w: number, h: number,\n ): void {\n const config = component.config as KpiConfig;\n const row = data.rows[0] ?? {};\n const column = config.measure?.column ?? Object.keys(row)[0];\n const value = formatMeasureValue(row[column], config.measure?.format, config.measure?.precision, ratioPercent);\n\n slide.addText([\n { text: value, options: { fontSize: 28, bold: true, color: '1F2933', breakLine: true } },\n { text: config.measure?.label ?? '', options: { fontSize: 10, color: '7B8794' } },\n ], {\n x, y, w, h,\n align: 'center',\n valign: 'middle',\n });\n }\n\n private _slug(name: string): string {\n return name.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '') || 'report';\n }\n}\n","import { Injectable, inject } from '@angular/core';\n\nimport { FsPrompt } from '@firestitch/prompt';\n\nimport { EMPTY, Observable, from, of } from 'rxjs';\nimport { catchError, switchMap } from 'rxjs/operators';\n\nimport { Report } from '../interfaces/report.interface';\nimport { CollectedReport, ReportExportCollectorService, failedPageNames } from './report-export-collector.service';\nimport { PDF_LIST_ROWS, ReportPdfService } from './report-pdf.service';\nimport { PPTX_LIST_ROWS, ReportPptxService } from './report-pptx.service';\n\n\n// What the user chose when told the export is incomplete. Retry re-runs the\n// whole collection — the queries that failed were killed on a clock, not on\n// anything about the data, so a second attempt against a warmed database\n// genuinely often succeeds.\nconst RETRY = 'retry';\nconst DOWNLOAD = 'download';\n\n// Runs a report export end to end: collect every tile, refuse to write a file\n// that is missing any of them without saying so, then render.\n//\n// The gate is the reason this sits between the collector and the renderers\n// rather than in either of them. A deck with five blank pages is worse than no\n// deck: it looks finished, so it gets emailed to a client, and the pages that\n// are missing are exactly the ones nobody thinks to check. The renderers can\n// only describe a hole they are handed; the collector only knows one tile at a\n// time. Whether the FILE should exist is a decision about the whole report, and\n// this is the only place that sees it.\n@Injectable()\nexport class ReportExportService {\n\n private _collector = inject(ReportExportCollectorService);\n private _pdfService = inject(ReportPdfService);\n private _pptxService = inject(ReportPptxService);\n private _prompt = inject(FsPrompt);\n\n public pdf(report: Report): Observable<unknown> {\n return this._run(report, PDF_LIST_ROWS, (collected) => this._pdfService.export(collected));\n }\n\n public powerpoint(report: Report): Observable<unknown> {\n return this._run(report, PPTX_LIST_ROWS, (collected) => this._pptxService.export(collected));\n }\n\n // Retry re-collects the WHOLE report, not just the tiles that failed. Every\n // number in one file has to have been true at one moment: refetching four\n // tiles and keeping nine from three minutes ago produces a deck whose pages\n // disagree with each other, and nothing on it would say so.\n //\n // listRows is the format's own list cap, carried into the retry so a second\n // attempt fetches what the first did.\n private _run(\n report: Report,\n listRows: number,\n render: (collected: CollectedReport) => Promise<void>,\n ): Observable<unknown> {\n return this._collector.collect(report, listRows)\n .pipe(\n switchMap((collected) => this._gate(collected)\n .pipe(\n switchMap((choice) => choice === RETRY\n ? this._run(report, listRows, render)\n : from(render(collected))),\n )),\n );\n }\n\n // Resolves to DOWNLOAD when the export is whole (or the user accepted an\n // incomplete one) and to RETRY when they want another attempt. Cancelling\n // ends the export quietly: EMPTY completes without emitting, so nothing\n // renders and no error surfaces — they know what they just declined.\n private _gate(collected: CollectedReport): Observable<string> {\n const failed = failedPageNames(collected);\n if (!failed.length) {\n return of(DOWNLOAD);\n }\n\n const pages = failed.length === 1\n ? `<strong>${failed[0]}</strong> could not be generated`\n : `${failed.length} pages could not be generated: <strong>${failed.join('</strong>, <strong>')}</strong>`;\n\n return this._prompt.confirm({\n title: 'Export is incomplete',\n template: `${pages}. This usually means those tiles took too long to load. `\n + 'Retry, or download the file with those pages marked as missing.',\n buttons: [\n { label: 'Retry', value: RETRY, color: 'primary' },\n { label: 'Download Anyway', value: DOWNLOAD, color: '' },\n { label: 'Cancel', cancel: true, color: '' },\n ],\n })\n .pipe(catchError(() => EMPTY));\n }\n}\n","import { Injectable, inject } from '@angular/core';\n\nimport { BehaviorSubject, Observable, of } from 'rxjs';\nimport { map, tap } from 'rxjs/operators';\n\nimport { ReportData } from '../data/report.data';\nimport { ReportListItem } from '../interfaces/report.interface';\n\n\n// Holds the report list in memory so the picker doesn't hit the API on every\n// focus. Loaded once when the page opens; create/rename/delete keep the cache\n// in sync.\n@Injectable({\n providedIn: 'root',\n})\nexport class ReportService {\n\n private _reportData = inject(ReportData);\n\n private _reports$ = new BehaviorSubject<ReportListItem[]>([]);\n\n public get reports$(): Observable<ReportListItem[]> {\n return this._reports$.asObservable();\n }\n\n public load(): Observable<ReportListItem[]> {\n return this._reportData.reports()\n .pipe(\n tap((reports: ReportListItem[]) => this._reports$.next(reports ?? [])),\n );\n }\n\n // Filters the cached list locally — what the autocomplete's [fetch] calls.\n public filter(keyword: string): Observable<ReportListItem[]> {\n const term = (keyword ?? '').trim().toLowerCase();\n const reports = this._reports$.getValue();\n\n if (!term) {\n return of(reports);\n }\n\n return of(reports.filter((report) => report.name.toLowerCase().includes(term)));\n }\n\n public create(name: string): Observable<ReportListItem> {\n return this._reportData.create(name)\n .pipe(\n tap((report: ReportListItem) => {\n this._reports$.next([...this._reports$.getValue(), report]);\n }),\n );\n }\n\n public rename(reportId: number, name: string): Observable<ReportListItem> {\n return this._reportData.rename(reportId, name)\n .pipe(\n tap((report: ReportListItem) => {\n this._reports$.next(\n this._reports$.getValue()\n .map((existing) => (existing.id === report.id ? report : existing)),\n );\n }),\n );\n }\n\n public delete(reportId: number): Observable<void> {\n return this._reportData.delete(reportId)\n .pipe(\n tap(() => {\n this._reports$.next(\n this._reports$.getValue().filter((report) => report.id !== reportId),\n );\n }),\n map(() => undefined),\n );\n }\n}\n","import {\n CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, Component,\n DestroyRef, ElementRef, NgZone, ViewChild, inject, signal,\n} from '@angular/core';\nimport { FormsModule } from '@angular/forms';\n\nimport { MatButton } from '@angular/material/button';\nimport { MatDialog } from '@angular/material/dialog';\nimport { MatIcon } from '@angular/material/icon';\nimport { MatTooltip } from '@angular/material/tooltip';\n\nimport { FsAutocompleteChipsModule } from '@firestitch/autocomplete-chips';\nimport { FilterConfig, FsFilterModule, IFilterConfigItem } from '@firestitch/filter';\nimport { FsMenuModule } from '@firestitch/menu';\nimport { FsProcess } from '@firestitch/process';\nimport { FsPrompt } from '@firestitch/prompt';\n\nimport { finalize, switchMap, takeUntil } from 'rxjs/operators';\n\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { provideEchartsCore } from 'ngx-echarts';\n\nimport { FsAiChatComponent, FsAiChatResponse } from '@firestitch/ai';\n\nimport { ReportCanvasComponent } from '../../components/report-canvas/report-canvas.component';\nimport { ReportData } from '../../data/report.data';\nimport { ComponentSettingsComponent, ComponentSettingsResult } from '../../dialogs/component-settings/component-settings.component';\nimport { ReportSettingsComponent, ReportSettingsResult } from '../../dialogs/report-settings/report-settings.component';\nimport { ReportExportCollectorService } from '../../export/report-export-collector.service';\nimport { ReportExportService } from '../../export/report-export.service';\nimport { ReportPdfService } from '../../export/report-pdf.service';\nimport { ReportPptxService } from '../../export/report-pptx.service';\nimport {\n ChartGranularity, Report,\n ReportComponent as ReportComponentModel, ReportFilterGroup, ReportListItem,\n} from '../../interfaces/report.interface';\nimport {\n GROUP_BY_ITEM, filterItemForGroup, groupByFilterItem, groupBySignature, groupValuesFromQuery,\n isGranularityOffered,\n} from '../../report-filter-items';\nimport { ReportFilterStateService, defaultSignature } from '../../services/report-filter-state.service';\nimport { ReportService } from '../../services/report.service';\n\n\n// The Reports page: AI chat on the left, the report canvas on the right —\n// a split-pane layout; the viewer is our own canvas (no iframe, no embed URLs).\n// The chat is always scoped to the selected report; its id rides on every\n// turn via [requestData].\n@Component({\n templateUrl: './report.component.html',\n styleUrls: ['./report.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n schemas: [CUSTOM_ELEMENTS_SCHEMA],\n providers: [\n // Session filter state is per-open-report-page, not app-global; the export\n // services resolve filters through it, so they live at the same level.\n ReportFilterStateService,\n ReportExportCollectorService,\n ReportPptxService,\n ReportPdfService,\n ReportExportService,\n // Tree-shaken ECharts core + the 'report' house theme, loaded lazily with\n // this route's chunk.\n provideEchartsCore({ echarts: () => import('../../theme/echarts').then((module) => module.default) }),\n ],\n imports: [\n FormsModule,\n FsAutocompleteChipsModule,\n FsFilterModule,\n FsMenuModule,\n FsAiChatComponent,\n MatButton,\n MatIcon,\n MatTooltip,\n ReportCanvasComponent,\n ],\n})\nexport class ReportComponent {\n\n // The single report the viewer and chat are focused on.\n public readonly selected = signal<ReportListItem | null>(null);\n public readonly report = signal<Report | null>(null);\n public readonly loadingReports = signal(true);\n public readonly editMode = signal(false);\n\n // The report toolbar IS an fs-filter: the picker rides in its heading\n // template, the menu becomes its actions, and report-level filter groups\n // become its items. Rebuilt whenever the loaded report (and thus its groups)\n // changes; the menu's show-guards keep working while no report is selected.\n public readonly reportFilterConfig = signal<FilterConfig | null>(null);\n\n @ViewChild('split', { static: true })\n private _split!: ElementRef<HTMLDivElement>;\n\n @ViewChild('chatPanel', { static: true, read: ElementRef })\n private _chatPanel!: ElementRef<HTMLElement>;\n\n // Only the canvas knows which page is on screen, and a page-scoped export\n // has to ask it.\n @ViewChild(ReportCanvasComponent)\n private _canvas?: ReportCanvasComponent;\n\n public readonly introMessage = {\n text: '',\n };\n\n private _reportData = inject(ReportData);\n private _reportService = inject(ReportService);\n private _filterState = inject(ReportFilterStateService);\n private _exportService = inject(ReportExportService);\n private _collector = inject(ReportExportCollectorService);\n private _process = inject(FsProcess);\n private _prompt = inject(FsPrompt);\n private _dialog = inject(MatDialog);\n private _destroyRef = inject(DestroyRef);\n private _zone = inject(NgZone);\n\n constructor() {\n this._buildReportConfig();\n\n this._reportService.load()\n .pipe(\n finalize(() => {\n this.loadingReports.set(false);\n }),\n takeUntilDestroyed(this._destroyRef),\n )\n .subscribe({ error: () => undefined });\n }\n\n public fetchReports = (keyword: string) => {\n return this._reportService.filter(keyword);\n };\n\n public reportChange(report: ReportListItem | null): void {\n this.report.set(null);\n this.editMode.set(false);\n this._buildReportConfig();\n\n if (report) {\n this._loadReport(report.id);\n }\n }\n\n public createReport(): void {\n this._prompt.input({\n title: 'Create Report',\n label: 'Name',\n commitLabel: 'Create',\n required: true,\n })\n .pipe(\n switchMap((name: string) => this._reportService.create(name)),\n takeUntilDestroyed(this._destroyRef),\n )\n .subscribe((report: ReportListItem) => {\n this.selected.set(report);\n this._loadReport(report.id);\n });\n }\n\n public toggleEditMode(): void {\n this.editMode.update((editMode) => !editMode);\n }\n\n // The edit tools live in this toolbar, but the canvas owns what they act on\n // (the active page, the header/footer bands, which layer is live).\n public get isMasterMode(): boolean {\n return this._canvas?.masterMode() ?? false;\n }\n\n public addText(): void {\n this._canvas?.addText();\n }\n\n public toggleMasterMode(): void {\n this._canvas?.toggleMasterMode();\n }\n\n // Report settings — name, page size, orientation, layout mode. The picker\n // list and structure both reload on save (a layout switch re-renders the\n // whole canvas).\n public reportSettings(): void {\n if (!this.report()) {\n return;\n }\n\n this._dialog.open<ReportSettingsComponent, unknown, ReportSettingsResult>(ReportSettingsComponent, {\n data: { report: this.report() },\n width: '460px',\n })\n .afterClosed()\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe((result) => {\n // The dialog confirms + performs the delete itself; we just react to\n // what it reports back.\n if (result?.action === 'deleted') {\n this.selected.set(null);\n this.report.set(null);\n this._buildReportConfig();\n\n return;\n }\n\n if (result?.action === 'saved' && this.selected()) {\n this._loadReport(this.selected().id);\n this._refreshReportName(this.selected().id);\n }\n });\n }\n\n // Component settings — title, exact geometry, and the diagnostic views\n // (SQL, config, filter wiring).\n public componentSettings(component: ReportComponentModel): void {\n if (!this.report()) {\n return;\n }\n\n const dialogRef = this._dialog.open<ComponentSettingsComponent, unknown, ComponentSettingsResult>(\n ComponentSettingsComponent,\n {\n data: { report: this.report(), component },\n width: '640px',\n },\n );\n\n // Filter add/remove/level changes persist immediately inside the dialog (no\n // \"save\") and can leave it by an exit that carries no result, so they are\n // announced as they land. The reload waits for the close so the canvas isn't\n // re-rendering underneath an open dialog.\n let filtersChanged = false;\n dialogRef.componentInstance.filtersChanged\n .pipe(takeUntil(dialogRef.afterClosed()))\n .subscribe(() => filtersChanged = true);\n\n dialogRef.afterClosed()\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe((result) => {\n // The dialog confirms + performs the delete itself. The component is\n // gone from the report, so reload rather than patching it out locally —\n // its filters went with it, which the report bar has to be rebuilt for.\n if (result?.deleted) {\n if (this.selected()) {\n this._loadReport(this.selected().id);\n }\n\n return;\n }\n\n // The report's filter groups changed, so the report bar and the\n // on-component strips have to be rebuilt from a fresh report.\n if (filtersChanged) {\n if (this.selected()) {\n this._loadReport(this.selected().id);\n }\n\n return;\n }\n\n // Nothing else in the dialog touches the query — title and padding are\n // presentation. Repaint the one component it was opened for and leave\n // every other component's data, and its query, alone.\n if (result?.settings) {\n this._canvas?.applyComponentSettings(component.id, result.settings);\n }\n });\n }\n\n // The canvas changed the report's structure (added a page) — re-fetch so the\n // new page renders; the canvas lands the view on it.\n public onCanvasReportChanged(): void {\n if (this.selected()) {\n this._loadReport(this.selected().id);\n }\n }\n\n // Export the report to PowerPoint, entirely client-side: every component's\n // data is fetched fresh with the current filter state (all pages, not just\n // the visible one), then pptxgenjs builds a deck of NATIVE editable charts —\n // page = slide, positions 1:1. The dock shows progress until the file saves.\n public exportPowerpoint(): void {\n if (!this.report()) {\n return;\n }\n\n this._process.run(\n 'Exporting PowerPoint',\n this._exportService.powerpoint(this.report()),\n );\n }\n\n // Export to PDF, entirely client-side: same collection pass, charts rendered\n // through an offscreen ECharts instance at 3× pixel ratio (pixel-identical\n // to the screen), tables via jspdf-autotable — page = PDF page.\n public exportPdf(): void {\n if (!this.report()) {\n return;\n }\n\n this._process.run(\n 'Exporting PDF',\n this._exportService.pdf(this.report()),\n );\n }\n\n // The whole report as files in one action: the server writes one CSV per\n // component, each what the screen shows (a chart or KPI as drawn, at the\n // viewer's group-by grain; a list in full), and zips them foldered by page\n // with an Export Notes.txt that records the filters as the bar reads them.\n // Lists use their saved default sort; a header click is carried only by a\n // component's own CSV export. `thisPage` narrows it to the page the canvas is\n // showing. Unlike the PDF/PowerPoint exports the files are written\n // server-side, so they are not capped by what a slide can hold.\n public exportData(thisPage = false): void {\n const report = this.report();\n if (!report) {\n return;\n }\n\n const pageId = thisPage ? this._canvas?.activePage?.id ?? null : null;\n const filters = this._filterState.resolveForReport(report, pageId);\n const frequency = this._filterState.frequency();\n\n this._process.download(\n 'Exporting data',\n this._collector.getFilterSummary(report)\n .pipe(\n switchMap((lines) => this._reportData.exportReport(\n report.id,\n filters,\n pageId,\n frequency,\n lines,\n )),\n ),\n );\n }\n\n // React to each chat turn (fs-chat handles the request + persistence); we\n // only care about the report side effects this context's backend flags.\n public onChatResponse(response: FsAiChatResponse): void {\n // The agent changed the report's structure — re-fetch it. Session filter\n // values survive (the filter-state service keeps values for groups that\n // still exist).\n if (response.reportChanged && this.selected()) {\n this._loadReport(this.selected().id);\n }\n\n // A rename changes nothing structural — refresh the picker chip label.\n if (response.reportRenamed && this.selected()) {\n this._refreshReportName(this.selected().id);\n }\n }\n\n // Drag the divider between the chat and canvas panes (pointer-capture loop\n // outside Angular).\n public onResizeStart(event: PointerEvent): void {\n event.preventDefault();\n\n const handle = event.target as HTMLElement;\n handle.setPointerCapture(event.pointerId);\n this._split.nativeElement.classList.add('resizing');\n\n this._zone.runOutsideAngular(() => {\n const move = (e: PointerEvent) => this._resizeTo(e.clientX);\n const end = () => {\n handle.releasePointerCapture(event.pointerId);\n handle.removeEventListener('pointermove', move);\n handle.removeEventListener('pointerup', end);\n handle.removeEventListener('pointercancel', end);\n this._split.nativeElement.classList.remove('resizing');\n };\n\n handle.addEventListener('pointermove', move);\n handle.addEventListener('pointerup', end);\n handle.addEventListener('pointercancel', end);\n });\n }\n\n private _resizeTo(clientX: number): void {\n const rect = this._split.nativeElement.getBoundingClientRect();\n if (rect.width === 0) {\n return;\n }\n\n const ratio = (clientX - rect.left) / rect.width;\n const clamped = Math.min(0.8, Math.max(0.2, ratio));\n this._chatPanel.nativeElement.style.flexBasis = `${clamped * 100}%`;\n }\n\n private _loadReport(reportId: number): void {\n this._reportData.get(reportId)\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe((report: Report) => {\n this.report.set(report);\n // No URL state in this view: nothing is restored from the URL and\n // nothing listens to urlChanges(), so its filters stay session-only.\n this._filterState.init(report);\n this._buildReportConfig();\n });\n }\n\n // Report-level filter groups in their saved order — the ones that render in\n // the toolbar (component-level groups render on their components).\n private _reportGroups(): ReportFilterGroup[] {\n return (this.report()?.filterGroups ?? [])\n .filter((group) => group.level === 'report' || group.level === 'both')\n .sort((a, b) => a.order - b.order);\n }\n\n // Gates the toolbar fs-filter so it isn't rendered (taking space) when there\n // is nothing to put in it — no report-level filters and no group-by control.\n public get reportHasFilters(): boolean {\n return this._reportGroups().length > 0 || !!this._groupByItem();\n }\n\n // fs-filter reads its config only once (at init) — re-binding does nothing.\n // The template keys the toolbar fs-filter on this signature so it's recreated\n // (and re-reads the rebuilt config) whenever the report-level filter set\n // changes, e.g. after the component settings dialog adds/moves a filter.\n public get reportFilterKey(): string {\n return [\n // The effective zone is part of it too: a zone change re-resolves relative\n // presets, and the bar must be recreated to show the new days.\n this._filterState.timezone(),\n // The stored default is part of the signature: saving a new default in report\n // settings rebuilds the config, but without a key change fs-filter keeps\n // rendering the values it was created with until a full page reload.\n groupBySignature(this.report()),\n ...this._reportGroups().map((group) => `${group.id}:${group.level}:${group.label}:${defaultSignature(group)}`),\n ].join('|');\n }\n\n // (Re)build the toolbar fs-filter config — the report-level filter items and\n // then the group-by control. The report's actions live in the fs-menu beside\n // the picker, not here. Only built/used once a report is loaded (the template\n // gates it on `report`).\n private _buildReportConfig(): void {\n const reportId = this.report()?.id ?? null;\n\n // Drop a grain the control no longer offers — the agent can narrow the list\n // mid-session, and an override the viewer can't see is worse than none.\n if (this.report() && !isGranularityOffered(this.report(), this._filterState.frequency())) {\n this._filterState.setFrequency(null);\n }\n\n const items = reportId\n ? this._reportGroups().map((group) =>\n filterItemForGroup(group, this._reportData, reportId, this._filterState.value(group.id)))\n : [];\n\n // The group-by control leads the bar, ahead of every filter: it sets the\n // grain the whole report is read at, so it is the first thing a viewer\n // decides. It is not a filter group — it re-buckets rows rather than\n // narrowing them — so it is placed here rather than ordered among them.\n const groupByItem = this._groupByItem();\n if (groupByItem) {\n items.unshift(groupByItem);\n }\n\n this.reportFilterConfig.set({\n // Never touch the URL or persist filter state — report filters are\n // session-only, owned by ReportFilterStateService.\n queryParam: false,\n persist: false,\n items,\n change: (query) => {\n for (const { groupId, value } of groupValuesFromQuery(query ?? {}, this._reportGroups())) {\n this._filterState.setValue(groupId, value);\n }\n // Not a filter group — the grain is read straight off the query.\n this._filterState.setFrequency((query?.[GROUP_BY_ITEM] as ChartGranularity) || null);\n },\n });\n }\n\n // The report's group-by control as an fs-filter item, or null when the report\n // has none to show. Seeded from the session state so the grain the viewer\n // picked survives the report being re-fetched after a chat edit.\n private _groupByItem(): IFilterConfigItem | null {\n return this.report()\n ? groupByFilterItem(this.report(), this._filterState.frequency())\n : null;\n }\n\n private _refreshReportName(reportId: number): void {\n this._reportService.load()\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe((reports: ReportListItem[]) => {\n const renamed = reports.find((report) => report.id === reportId);\n if (renamed) {\n this.selected.set(renamed);\n if (this.report()) {\n this.report.set({ ...this.report(), name: renamed.name });\n }\n }\n });\n }\n}\n","<div\n #split\n class=\"report fs-row.align-start\">\n <fs-ai-chat\n #chatPanel\n class=\"chat\"\n style=\"min-height: 500px;\"\n basePath=\"reports\"\n [requestData]=\"{ reportId: selected()?.id ?? null }\"\n [introMessage]=\"introMessage\"\n (response)=\"onChatResponse($event)\">\n </fs-ai-chat>\n <div\n class=\"resizer\"\n (pointerdown)=\"onResizeStart($event)\">\n </div>\n <div class=\"viewer fs-flex fs-column\">\n <div class=\"fs-row.align-center.gap-sm\">\n <fs-autocomplete-chips\n class=\"fs-flex\"\n [fetch]=\"fetchReports\"\n [(ngModel)]=\"selected\"\n [disabled]=\"loadingReports()\"\n [padless]=\"true\"\n [multiple]=\"false\"\n [fetchOnFocus]=\"true\"\n (ngModelChange)=\"reportChange($event)\"\n placeholder=\"Report\"\n name=\"report\">\n <ng-template\n fsAutocompleteChipsTemplate\n let-object=\"object\">\n {{ object.name }}\n </ng-template>\n <ng-template\n fsAutocompleteChipsStatic\n (click)=\"createReport()\">\n Create Report\n </ng-template>\n </fs-autocomplete-chips>\n @if (report() && editMode()) {\n <!-- What layout editing can add or switch to, and the way out of it —\n the same outlined buttons as the fs-ai-report toolbar. -->\n <button\n mat-stroked-button\n type=\"button\"\n matTooltip=\"Add a block of text\"\n (click)=\"addText()\">\n <mat-icon>title</mat-icon>\n Add text\n </button>\n <button\n mat-stroked-button\n type=\"button\"\n class=\"master-toggle\"\n [class.active]=\"isMasterMode\"\n [matTooltip]=\"isMasterMode ? 'Back to editing this page' : 'Edit the header and footer shown on every page'\"\n (click)=\"toggleMasterMode()\">\n <mat-icon>web_asset</mat-icon>\n Header & footer\n </button>\n <button\n mat-stroked-button\n type=\"button\"\n (click)=\"toggleEditMode()\">\n <mat-icon>check</mat-icon>\n Done editing\n </button>\n }\n @if (report()) {\n <fs-menu>\n <ng-template\n fs-menu-item\n (click)=\"reportSettings()\">\n <mat-icon>\n tune\n </mat-icon>\n Report settings\n </ng-template>\n <ng-template\n fs-menu-item\n (click)=\"toggleEditMode()\"\n [disabled]=\"editMode()\">\n <mat-icon>\n dashboard_customize\n </mat-icon>\n {{ editMode() ? 'Done editing layout' : 'Edit layout' }}\n </ng-template>\n <ng-template\n fs-menu-item\n (click)=\"exportPowerpoint()\">\n <mat-icon>\n slideshow\n </mat-icon>\n Export PowerPoint\n </ng-template>\n <ng-template\n fs-menu-item\n (click)=\"exportPdf()\">\n <mat-icon>\n picture_as_pdf\n </mat-icon>\n Export PDF\n </ng-template>\n <ng-template\n fs-menu-item\n (click)=\"exportData()\">\n <mat-icon>\n table_view\n </mat-icon>\n Export Raw Data\n </ng-template>\n @if ((report()?.pages?.length ?? 0) > 1) {\n <ng-template\n fs-menu-item\n (click)=\"exportData(true)\">\n <mat-icon>\n table_view\n </mat-icon>\n Export Raw Data (This Page)\n </ng-template>\n }\n </fs-menu>\n }\n </div>\n @if (report()) {\n <!-- Report-level filters only (the report's actions live in the menu\n above). fs-filter reads its config once at init, so it's keyed on the\n filter signature: when the report-level filter set changes the block\n is recreated and re-reads the rebuilt config. -->\n @if (reportHasFilters) {\n @for (key of [reportFilterKey]; track key) {\n <fs-filter [config]=\"reportFilterConfig()\"></fs-filter>\n }\n }\n <app-report-canvas\n [report]=\"report()\"\n [editMode]=\"editMode()\"\n (componentSettings)=\"componentSettings($event)\"\n (reportChanged)=\"onCanvasReportChanged()\">\n </app-report-canvas>\n }\n </div>\n</div>","import { ChangeDetectionStrategy, Component, DestroyRef, inject, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nimport { MatButton } from '@angular/material/button';\nimport { MAT_DIALOG_DATA, MatDialogActions, MatDialogClose, MatDialogContent } from '@angular/material/dialog';\n\nimport { FsChipModule } from '@firestitch/chip';\nimport { FsDateModule } from '@firestitch/date';\nimport { FsDialogModule } from '@firestitch/dialog';\nimport { FsMarkdownRendererComponent } from '@firestitch/markdown-editor';\nimport { FsMessage, FsMessageModule } from '@firestitch/message';\nimport { FsPrompt } from '@firestitch/prompt';\n\nimport { switchMap } from 'rxjs/operators';\n\nimport { ReportData } from '../../data/report.data';\nimport { ReportInstruction, ReportInstructions } from '../../interfaces/report.interface';\n\n\nexport interface InstructionHistoryDialogData {\n versions: ReportInstruction[];\n}\n\n\n// The AI Knowledge document's version history (append-only), each version\n// previewed and restorable — opened from the Report Settings footer's View\n// History button. Restores happen here (confirm, then flip the current flag —\n// no new version is created); the opener refreshes its instructions after this\n// dialog closes, so a restore made here reseeds the editor there.\n@Component({\n templateUrl: './instruction-history.component.html',\n styleUrls: ['./instruction-history.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n MatButton,\n MatDialogContent,\n MatDialogActions,\n MatDialogClose,\n FsChipModule,\n FsDateModule,\n FsDialogModule,\n FsMarkdownRendererComponent,\n FsMessageModule,\n ],\n})\nexport class InstructionHistoryComponent {\n\n private readonly _data = inject<InstructionHistoryDialogData>(MAT_DIALOG_DATA);\n\n public readonly versions = signal<ReportInstruction[]>(this._data.versions);\n\n private readonly _reportData = inject(ReportData);\n private readonly _prompt = inject(FsPrompt);\n private readonly _message = inject(FsMessage);\n private readonly _destroyRef = inject(DestroyRef);\n\n // Make an earlier version current — flips the flag, creates no new version.\n public restore(version: ReportInstruction): void {\n this._prompt.confirm({\n title: 'Restore version',\n template: 'Make this version the current AI knowledge? The newer versions stay in the history.',\n commitLabel: 'Restore',\n })\n .pipe(\n switchMap(() => this._reportData.restoreInstruction(version.id)),\n takeUntilDestroyed(this._destroyRef),\n )\n .subscribe((instructions: ReportInstructions) => {\n this.versions.set(instructions.versions);\n this._message.success('Version restored');\n });\n }\n}\n","<fs-dialog>\n <fs-dialog-title>\n AI Knowledge History\n </fs-dialog-title>\n <mat-dialog-content>\n @if (versions().length) {\n <div class=\"versions\">\n @for (version of versions(); track version.id) {\n <div class=\"version\">\n <div class=\"version-header\">\n <fs-date\n [date]=\"version.createDate\"\n format=\"date-time\">\n </fs-date>\n @if (version.accountName) {\n <span class=\"author\">{{ version.accountName }}</span>\n }\n <span class=\"spacer\"></span>\n @if (version.current) {\n <fs-chip\n size=\"tiny\"\n [backgroundColor]=\"'#2e7d32'\"\n color=\"#ffffff\">\n Current\n </fs-chip>\n } @else {\n <button\n type=\"button\"\n mat-stroked-button\n (click)=\"restore(version)\">\n Restore\n </button>\n }\n </div>\n <div class=\"version-preview\">\n <fs-markdown-renderer [markdown]=\"version.content\"></fs-markdown-renderer>\n </div>\n </div>\n }\n </div>\n } @else {\n <fs-message-info>\n No versions yet — every save of the AI Knowledge document lands here, and\n any version can be restored.\n </fs-message-info>\n }\n </mat-dialog-content>\n <mat-dialog-actions>\n <button\n type=\"button\"\n mat-button\n color=\"primary\"\n [mat-dialog-close]=\"null\">\n Close\n </button>\n </mat-dialog-actions>\n</fs-dialog>\n","import { ChangeDetectionStrategy, Component, input, model } from '@angular/core';\nimport { ControlContainer, FormsModule, NgForm } from '@angular/forms';\n\nimport { FsFormModule } from '@firestitch/form';\nimport { FsMarkdownEditorComponent, FsMarkdownEditorConfig } from '@firestitch/markdown-editor';\n\n\n// The AI Knowledge tab: the operator-authored markdown document appended to the\n// report agent's system instructions on every chat turn — the lever for\n// terminology, business rules and special cases no code deploy can cover.\n//\n// A field-level child of the settings dialog form: the editor registers with\n// the parent <form fsForm> via the ControlContainer view provider, so the\n// dialog's Save button submits and validates this content. The draft itself\n// lives on the parent (bound through `content`), so switching tabs never loses\n// an edit.\n@Component({\n selector: 'fs-ai-report-global-settings-ai-knowledge',\n templateUrl: './ai-knowledge.component.html',\n styleUrls: ['./ai-knowledge.component.scss'],\n viewProviders: [{ provide: ControlContainer, useExisting: NgForm }],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n FormsModule,\n FsFormModule,\n FsMarkdownEditorComponent,\n ],\n})\nexport class AiKnowledgeComponent {\n\n public readonly content = model<string>('');\n public readonly config = input.required<FsMarkdownEditorConfig>();\n}\n","<div class=\"fs-column tab-body\">\n <p class=\"hint\">\n This document is given to the report AI on every chat message. Use it for\n terminology, business rules and special cases the AI can't work out from the\n data on its own — it takes effect immediately, no deploy needed.\n </p>\n <fs-markdown-editor\n [ngModel]=\"content()\"\n (ngModelChange)=\"content.set($event)\"\n [config]=\"config()\"\n name=\"content\">\n </fs-markdown-editor>\n</div>\n","import { ChangeDetectionStrategy, Component, input, model } from '@angular/core';\nimport { ControlContainer, FormsModule, NgForm } from '@angular/forms';\n\nimport { MatFormField, MatHint, MatLabel } from '@angular/material/form-field';\nimport { MatInput } from '@angular/material/input';\n\nimport { FsFormModule } from '@firestitch/form';\n\n\n// The General tab: report-module settings that aren't the AI knowledge document.\n// Currently just the semantic-build concurrency — how many summary calls the\n// build runs at once. A field-level child of the settings dialog form (its input\n// registers with the parent <form fsForm> via the ControlContainer view\n// provider), so the dialog's Save button submits and validates it. The value\n// itself is held on the shell (bound through `concurrency`), and the safe band\n// (`min`/`max`) comes from the backend so the field can't be set out of range.\n@Component({\n selector: 'fs-ai-report-global-settings-general',\n templateUrl: './general.component.html',\n styleUrls: ['./general.component.scss'],\n viewProviders: [{ provide: ControlContainer, useExisting: NgForm }],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n FormsModule,\n FsFormModule,\n MatFormField,\n MatLabel,\n MatHint,\n MatInput,\n ],\n})\nexport class GeneralComponent {\n\n public readonly concurrency = model<number>(0);\n public readonly min = input.required<number>();\n public readonly max = input.required<number>();\n}\n","<div class=\"fs-column tab-body\">\n <mat-form-field>\n <mat-label>Semantic build concurrency</mat-label>\n <input\n matInput\n type=\"number\"\n [ngModel]=\"concurrency()\"\n (ngModelChange)=\"concurrency.set($event)\"\n name=\"semanticBuildConcurrency\"\n [fsFormRequired]=\"true\"\n [fsFormInteger]=\"true\"\n [fsFormMin]=\"min()\"\n [fsFormMax]=\"max()\">\n <mat-hint>\n How many AI calls the semantic-database build runs at once ({{ min() }}–{{ max() }}).\n Higher is faster but more likely to hit the AI provider's rate limit. Default is 8.\n </mat-hint>\n </mat-form-field>\n</div>\n","import { ChangeDetectionStrategy, Component, computed, inject, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nimport { MatButton } from '@angular/material/button';\nimport { MAT_DIALOG_DATA, MatDialogActions, MatDialogClose, MatDialogContent } from '@angular/material/dialog';\n\nimport { FsChipModule } from '@firestitch/chip';\nimport { FsDateModule } from '@firestitch/date';\nimport { FsDialogModule } from '@firestitch/dialog';\nimport { FsSkeletonModule } from '@firestitch/skeleton';\n\nimport { ReportData } from '../../data/report.data';\nimport {\n SemanticEntityFunction,\n SemanticEntityFunctions,\n SemanticFunctionSource,\n} from '../../interfaces/report.interface';\n\n\nexport interface EntityFunctionsDialogData {\n entityKey: string;\n source: SemanticFunctionSource;\n}\n\n\n// One group of a unit's AI-classified cached code functions — an entity's model\n// or handler class, or the single group of a standalone code class. Fetched on\n// open from the shared per-key endpoint (one payload carries every group, each\n// row tagged with its source) and filtered client-side.\n@Component({\n templateUrl: './entity-functions.component.html',\n styleUrls: ['./entity-functions.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n MatButton,\n MatDialogContent,\n MatDialogActions,\n MatDialogClose,\n FsChipModule,\n FsDateModule,\n FsDialogModule,\n FsSkeletonModule,\n ],\n})\nexport class EntityFunctionsComponent {\n\n // One color per AI classification kind, so a function's nature reads at a glance.\n private static readonly KIND_COLORS: Record<string, string> = {\n 'calculation': '#1565c0',\n 'business-rule': '#6a1b9a',\n 'query': '#00695c',\n 'mutation': '#e65100',\n 'accessor': '#546e7a',\n 'other': '#757575',\n };\n\n // Interesting logic first: derived values and rules, then data access, then the rest.\n private static readonly KIND_ORDER = ['calculation', 'business-rule', 'query', 'mutation', 'accessor', 'other'];\n\n // The dialog title per group. A standalone class has no model/handler split,\n // so its one group is just the code the build read.\n private static readonly SOURCE_LABELS: Record<SemanticFunctionSource, string> = {\n model: 'Model functions',\n handler: 'Handler functions',\n class: 'Code functions',\n };\n\n private readonly _data = inject<EntityFunctionsDialogData>(MAT_DIALOG_DATA);\n\n public readonly entityKey = this._data.entityKey;\n public readonly sourceLabel = EntityFunctionsComponent.SOURCE_LABELS[this._data.source];\n\n // null until loaded — gates the list behind the skeleton.\n public readonly entityFunctions = signal<SemanticEntityFunctions | null>(null);\n\n // The class this group's functions were discovered from. A standalone code\n // class has no handler, so its group reads the model slot like 'model' does.\n public readonly discoveredClass = computed<string | null>(() => {\n const loaded = this.entityFunctions();\n\n return this._data.source === 'handler' ? loaded?.handlerClass : loaded?.modelClass;\n });\n\n // This group's functions, ordered by kind priority then method name.\n public readonly functions = computed<SemanticEntityFunction[]>(() =>\n this._sortFunctions(\n (this.entityFunctions()?.functions ?? [])\n .filter((fn) => fn.source === this._data.source),\n ),\n );\n\n constructor() {\n inject(ReportData).semanticEntityFunctions(this._data.entityKey)\n .pipe(takeUntilDestroyed())\n .subscribe((entityFunctions: SemanticEntityFunctions) => {\n this.entityFunctions.set(entityFunctions);\n });\n }\n\n public kindColor(kind: string): string {\n return EntityFunctionsComponent.KIND_COLORS[kind] ?? EntityFunctionsComponent.KIND_COLORS.other;\n }\n\n private _sortFunctions(functions: SemanticEntityFunction[]): SemanticEntityFunction[] {\n return [...functions]\n .sort((a, b) => {\n const kindDiff = this._kindRank(a.kind) - this._kindRank(b.kind);\n\n return kindDiff !== 0 ? kindDiff : a.method.localeCompare(b.method);\n });\n }\n\n private _kindRank(kind: string): number {\n const rank = EntityFunctionsComponent.KIND_ORDER.indexOf(kind);\n\n return rank === -1 ? EntityFunctionsComponent.KIND_ORDER.length : rank;\n }\n}\n","<fs-dialog>\n <fs-dialog-title>\n {{ entityKey }} — {{ sourceLabel }}\n </fs-dialog-title>\n <mat-dialog-content>\n <div *fsSkeleton=\"entityFunctions()\">\n @if (entityFunctions(); as fns) {\n @if (functions().length) {\n @if (fns.generatedAt) {\n <div class=\"hint functions-generated\">\n Discovered from {{ discoveredClass() }} &middot;\n <fs-date\n [date]=\"fns.generatedAt\"\n format=\"date-time\">\n </fs-date>\n </div>\n }\n <div class=\"functions-list\">\n @for (fn of functions(); track fn.class + '::' + fn.method) {\n <div class=\"function-row\">\n <div class=\"function-head\">\n <fs-chip\n size=\"tiny\"\n [backgroundColor]=\"kindColor(fn.kind)\"\n color=\"#ffffff\">\n {{ fn.kind }}\n </fs-chip>\n <code class=\"function-method\">{{ fn.method }}</code>\n </div>\n <div class=\"function-summary\">{{ fn.summary }}</div>\n @if (fn.produces) {\n <div class=\"function-produces hint\">Produces: {{ fn.produces }}</div>\n }\n </div>\n }\n </div>\n } @else {\n <div class=\"hint\">\n No functions cached for this entity yet — run a build to discover its code.\n </div>\n }\n }\n </div>\n </mat-dialog-content>\n <mat-dialog-actions>\n <button\n type=\"button\"\n mat-button\n color=\"primary\"\n [mat-dialog-close]=\"undefined\">\n Close\n </button>\n </mat-dialog-actions>\n</fs-dialog>\n","import { ChangeDetectionStrategy, Component, DestroyRef, computed, inject, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nimport { MatDialog } from '@angular/material/dialog';\nimport { MatExpansionModule } from '@angular/material/expansion';\nimport { MatTooltipModule } from '@angular/material/tooltip';\n\nimport { StreamEventType } from '@firestitch/api';\nimport { FsChipModule } from '@firestitch/chip';\nimport { FsDateModule } from '@firestitch/date';\nimport { FsMessage, FsMessageModule } from '@firestitch/message';\nimport { FsProcess } from '@firestitch/process';\nimport { FsPrompt } from '@firestitch/prompt';\nimport { FsSkeletonModule } from '@firestitch/skeleton';\n\nimport { EMPTY, Observable } from 'rxjs';\nimport { catchError, filter, map, switchMap, take, tap } from 'rxjs/operators';\n\nimport { ReportData } from '../../../../data/report.data';\nimport {\n SemanticBuildClass,\n SemanticBuildEntity,\n SemanticBuildStatus,\n SemanticBuildTable,\n SemanticFunctionSource,\n} from '../../../../interfaces/report.interface';\nimport { EntityFunctionsComponent } from '../../../entity-functions/entity-functions.component';\n\n\n// One row of the scoreboard. The build caches two kinds of unit and the report\n// AI reads code from both, so they belong in ONE list: an entity (a table plus\n// its model and handler) and a standalone code class (domain logic with no\n// table — a summary model, a calculation service). A class row simply has no\n// table, columns or relationships to show.\ninterface SemanticUnitView {\n key: string;\n name: string;\n hasTable: boolean;\n entity: SemanticBuildEntity | null;\n model: string | null;\n functionCount: number;\n}\n\n\n// The Semantic Database tab: the scoreboard of everything the report AI was\n// built from. Shows the last build's status, runs (or stops) a build — streamed\n// into the FsProcess dock so it survives the dialog closing — and drills into\n// every unit to reveal its shape, inlined enum values, computed fields and its\n// cached function counts, whose links open the functions dialog (the full\n// function set is far too big to ship with the scoreboard).\n//\n// It also reports the other half of the picture: the tables the AI CANNOT see —\n// excluded ones (no model) and junctions that bridged nothing. Those are\n// invisible by omission otherwise: nothing errors, the capability just isn't\n// there, and the first anyone learns is a wrong answer or a refusal.\n@Component({\n selector: 'fs-ai-report-global-settings-semantic-database',\n templateUrl: './semantic-database.component.html',\n styleUrls: ['./semantic-database.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n MatExpansionModule,\n MatTooltipModule,\n FsChipModule,\n FsDateModule,\n FsMessageModule,\n FsSkeletonModule,\n ],\n})\nexport class SemanticDatabaseComponent {\n\n // The build-in-flight states of the ff_processes row (queued/running/stopping).\n private static readonly ACTIVE_STATES = ['Q', 'R', 'X'];\n\n private static readonly STATE_LABELS: Record<string, string> = {\n Q: 'Queued',\n R: 'Running',\n X: 'Stopping',\n C: 'Completed',\n K: 'Stopped',\n F: 'Failed',\n };\n\n // The streamed frames that carry a line for the feed: progress, and the final\n // frame the backend sends when a run ends badly. Without the error kind the\n // feed stops on the last progress line and never says what went wrong.\n private static readonly LOG_KINDS = ['log', 'error'];\n\n // A row that is still owed content says so; a built one says nothing. On a\n // finished build every stage is done on every row, so chipping them all was\n // noise that buried the one row that mattered.\n private static readonly PENDING_COLOR = '#b26500';\n\n // Class-name suffix stripped for display: `BudgetSummaryModel` reads as\n // `BudgetSummary`. Only `Model` — stripping `Handler` too would collide\n // `WorkOrderOneTimeHandler` with `WorkOrderOneTimeModel`, which are two\n // separate units.\n private static readonly NAME_SUFFIX = 'Model';\n\n // null until loaded — gates the tab behind the skeleton.\n public readonly status = signal<SemanticBuildStatus | null>(null);\n\n // The status request failed. Settles the skeleton and shows why; the Build\n // action never depends on the status, so a build can still be started.\n public readonly statusError = signal(false);\n\n // Free-text filter over the unit list — at a few hundred rows the accordion\n // is only usable if you can narrow it.\n public readonly filter = signal<string>('');\n\n // True while a build started from this tab is streaming into the dock.\n public readonly building = signal(false);\n\n public readonly buildActive = computed<boolean>(() =>\n this.building()\n || SemanticDatabaseComponent.ACTIVE_STATES.includes(this.status()?.build?.state),\n );\n\n // A semantic database has been published before, so a build replaces it.\n // False while the status is unloaded or failed to load.\n public readonly rebuild = computed<boolean>(() => !!this.status()?.detail?.generatedAt);\n\n public readonly buildStateLabel = computed<string>(() =>\n SemanticDatabaseComponent.STATE_LABELS[this.status()?.build?.state] ?? '',\n );\n\n // Whether the published semantic database came from a build that finished.\n //\n // A failed or stopped build still leaves a dated, fully counted artifact\n // behind, because the structural half publishes BEFORE the AI function pass\n // and it is the AI pass that fails. So \"Last built\" and Coverage both filled\n // in and read as a clean success, and the only dissenting word on the whole\n // panel was one line of \"Last build run\" text (RE-T1302).\n //\n // Reads as complete while the status is still loading, so the warning cannot\n // flash on open before there is anything to warn about.\n public readonly buildComplete = computed<boolean>(() => this.status()?.detail?.complete !== false);\n\n // Entities the build never reached — those still owed the AI function pass.\n // The number the incomplete warning quotes, and the same rows the scoreboard\n // below already chips one at a time.\n public readonly incompleteEntityCount = computed<number>(() =>\n (this.status()?.detail?.entities ?? [])\n .filter((entity) => entity.stages.functions !== 'done')\n .length,\n );\n\n // An artifact built before the catalog existed carries no tables. Everything\n // catalog-driven stays hidden rather than claiming \"0 excluded\", which would\n // be a lie — a rebuild fills it in.\n public readonly hasCatalog = computed<boolean>(() => !!this.status()?.detail?.tables?.length);\n\n // Tables with no model: the report AI can't see them at all. Add a model to\n // promote one to an entity.\n public readonly excludedTables = computed<SemanticBuildTable[]>(() =>\n this._tables().filter((table) => table.classification === 'excluded'),\n );\n\n // Link tables that bridged nothing — a composite primary key made them a\n // junction, but they were folded into no relationship, so neither they nor\n // what they link are reachable.\n public readonly unlinkedJunctions = computed<SemanticBuildTable[]>(() =>\n this._tables().filter((table) => table.classification === 'junction' && !!table.reason),\n );\n\n // Everything the build cached, entities and standalone code classes together,\n // in one list ordered by the name a reader recognizes. Two arrays on the wire\n // because they are genuinely different shapes; one list on screen because\n // \"what did the build read?\" is a single question.\n public readonly units = computed<SemanticUnitView[]>(() => {\n const detail = this.status()?.detail;\n if (!detail) {\n return [];\n }\n\n const entities = (detail.entities ?? []).map((entity) => ({\n key: entity.key,\n name: this._displayName(entity.model, entity.key),\n hasTable: true,\n entity,\n model: entity.model,\n functionCount: entity.functionCount,\n }));\n\n const classes = (detail.classes ?? []).map((unit: SemanticBuildClass) => ({\n key: unit.key,\n name: this._displayName(unit.model, unit.key),\n hasTable: false,\n entity: null,\n model: unit.model,\n functionCount: unit.functionCount,\n }));\n\n return [...entities, ...classes]\n .sort((a, b) => a.name.localeCompare(b.name));\n });\n\n // The filter matches the display name, the class and the entity key, so\n // hunting by any of the three works.\n public readonly filteredUnits = computed<SemanticUnitView[]>(() => {\n const filter = this.filter().trim().toLowerCase();\n if (!filter) {\n return this.units();\n }\n\n return this.units().filter((unit) =>\n `${unit.name} ${unit.model ?? ''} ${unit.key}`.toLowerCase().includes(filter));\n });\n\n // The Coverage line. Assembled here because the catalog parts drop out\n // entirely on a pre-catalog artifact, which reads badly as template branches.\n public readonly coverage = computed<string>(() => {\n const detail = this.status()?.detail;\n if (!detail) {\n return '';\n }\n\n const parts = [`${detail.entityCount} entities`, `${detail.classCount} code classes`];\n\n if (this.hasCatalog()) {\n parts.push(detail.unlinkedJunctionCount\n ? `${detail.junctionCount} junctions (${detail.unlinkedJunctionCount} not linked)`\n : `${detail.junctionCount} junctions`);\n }\n\n parts.push(`${detail.functionCount} code functions`);\n\n if (this.hasCatalog()) {\n parts.push(`${detail.excludedCount} tables excluded`);\n }\n\n return parts.join(' · ');\n });\n\n // The table catalog, or [] when the status hasn't loaded or the artifact\n // predates it.\n private readonly _tables = computed<SemanticBuildTable[]>(() => this.status()?.detail?.tables ?? []);\n\n // Guards the outcome message to fire exactly once per run — whether the stream\n // completes (build finished, possibly failed) or errors outright.\n private _buildFinalized = false;\n\n private readonly _dialog = inject(MatDialog);\n private readonly _reportData = inject(ReportData);\n private readonly _process = inject(FsProcess);\n private readonly _prompt = inject(FsPrompt);\n private readonly _message = inject(FsMessage);\n private readonly _destroyRef = inject(DestroyRef);\n\n constructor() {\n this._init();\n }\n\n // Confirm before kicking off a build — a rebuild replaces the current\n // semantic database, so it should never fire on a stray click.\n public build(): void {\n const rebuild = this.rebuild();\n\n this._prompt.confirm({\n title: rebuild ? 'Rebuild semantic database' : 'Build semantic database',\n template: rebuild\n ? 'Rebuild the semantic database? It runs in the background and replaces the current one when it finishes.'\n : 'Build the semantic database? It runs in the background.',\n commitLabel: rebuild ? 'Rebuild' : 'Build',\n })\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe(() => this._runBuild());\n }\n\n public stopBuild(): void {\n this._prompt.confirm({\n title: 'Stop build',\n template: 'Stop the running build? The current semantic database stays in place until a build finishes.',\n commitLabel: 'Stop',\n })\n .pipe(\n switchMap(() => this._reportData.semanticBuildStop()),\n takeUntilDestroyed(this._destroyRef),\n )\n .subscribe(() => {\n this.building.set(false);\n this._message.success('Stopping the build…');\n this._refreshStatus();\n });\n }\n\n // Run the semantic-database build. The live feed streams into the FsProcess\n // dock (bottom-right), whose subscription survives this dialog closing — so\n // dismissing the dialog never interrupts a running build.\n private _runBuild(): void {\n this.building.set(true);\n this._buildFinalized = false;\n\n const target$ = this._reportData.semanticBuild()\n .pipe(\n // A hard stream/transport failure (the build couldn't even start)\n // finalizes here — completed$ won't fire in that case.\n tap({ error: (error) => this._finalizeBuild(error) }),\n filter((event) =>\n event?.type === StreamEventType.Data\n && SemanticDatabaseComponent.LOG_KINDS.includes(event.data?.kind)\n && typeof event.data.line === 'string'),\n map((event) => event.data.line as string),\n );\n\n this._process\n .run('Semantic database build', target$)\n .completed$\n .pipe(\n take(1),\n takeUntilDestroyed(this._destroyRef),\n )\n .subscribe(() => this._finalizeBuild(null));\n }\n\n /**\n * Wrap up one build run exactly once. On a hard stream error, surface the\n * actual server-side reason pulled off the broken stream — the generic\n * \"could not run\" line only when the failure carried no server text at all;\n * otherwise refresh the status and announce how the build actually ended. A\n * failed build always names its reason on the row (the backend records one for\n * every way a run can die, fatals included), and that reason must surface\n * instead of the run silently doing nothing.\n */\n private _finalizeBuild(streamError: unknown): void {\n if (this._buildFinalized) {\n return;\n }\n this._buildFinalized = true;\n\n this.building.set(false);\n\n if (streamError) {\n const detail = this._streamErrorDetail(streamError);\n\n this._message.error(detail\n ? `The semantic database build failed — ${detail}`\n : 'The semantic database build could not run — the connection to the server was lost.');\n this._refreshStatus();\n\n return;\n }\n\n this._loadStatus()\n .subscribe((status: SemanticBuildStatus) => this._announceOutcome(status));\n }\n\n /**\n * The real reason a broken build stream broke, from what the server actually\n * sent. A structured error frame arrives as {message} on the error body; a\n * mid-stream crash dumps raw text into the stream (the stream interceptor\n * hands it back as statusText), where the frames are JSON lines and the\n * first non-JSON lines are the error and its location. '' when the failure\n * carried no server text at all (transport down / server unreachable).\n */\n private _streamErrorDetail(streamError: unknown): string {\n const error = streamError as { error?: { message?: string }; statusText?: string };\n\n if (error?.error?.message) {\n return error.error.message;\n }\n\n const statusText = error?.statusText;\n if (!statusText || statusText === 'Unknown Error') {\n return '';\n }\n\n const lines = statusText.split('\\n')\n .map((line) => line.trim())\n .filter((line) => {\n if (!line) {\n return false;\n }\n\n try {\n JSON.parse(line);\n\n return false;\n } catch {\n return true;\n }\n });\n\n return lines.slice(0, 2).join(' — ').substring(0, 300);\n }\n\n /**\n * Tell the operator how the build ended: a failed/stopped build surfaces its\n * reason (so an AI connection problem is never silent), a completed one\n * confirms success.\n */\n private _announceOutcome(status: SemanticBuildStatus): void {\n const build = status?.build;\n if (build?.state === 'F' || build?.state === 'K') {\n this._message.error(build.message || 'The semantic database build did not finish.');\n } else if (build?.state === 'C') {\n this._message.success('Semantic database build complete.');\n }\n }\n\n public pendingColor(): string {\n return SemanticDatabaseComponent.PENDING_COLOR;\n }\n\n /**\n * The build stages this row is still owed, or [] when it is fully built. A\n * stopped or interrupted build is the only way to get a non-empty list.\n */\n public pendingStages(unit: SemanticUnitView): string[] {\n const stages = unit.entity?.stages;\n\n return stages\n ? Object.keys(stages).filter((stage) => stages[stage] !== 'done')\n : [];\n }\n\n public setFilter(value: string): void {\n this.filter.set(value);\n }\n\n /**\n * Open the child dialog listing one group of a unit's cached functions — an\n * entity's model or handler class, or a standalone class's code. The dialog\n * fetches fresh on open, so the tab never holds function payloads.\n */\n public openFunctions(unit: SemanticUnitView, source: SemanticFunctionSource): void {\n this._dialog.open(EntityFunctionsComponent, {\n width: '700px',\n maxWidth: '95vw',\n maxHeight: '85vh',\n autoFocus: false,\n data: { entityKey: unit.key, source },\n });\n }\n\n private _init(): void {\n this._refreshStatus();\n }\n\n /**\n * What a reader recognizes the unit by: its class's short name, minus the\n * `Model` suffix that every model carries and none of them are distinguished\n * by. Falls back to the cache key for a unit whose class could not be\n * resolved, so a row never renders nameless.\n */\n private _displayName(model: string | null, key: string): string {\n if (!model) {\n return key;\n }\n\n const shortName = model.split('\\\\').pop();\n\n return shortName.length > SemanticDatabaseComponent.NAME_SUFFIX.length\n && shortName.endsWith(SemanticDatabaseComponent.NAME_SUFFIX)\n ? shortName.slice(0, -SemanticDatabaseComponent.NAME_SUFFIX.length)\n : shortName;\n }\n\n private _refreshStatus(): void {\n this._loadStatus()\n .subscribe();\n }\n\n // Fetch the status into the tab. A failure flags statusError and completes\n // quietly, so the tab settles and callers never see the error.\n private _loadStatus(): Observable<SemanticBuildStatus> {\n return this._reportData.semanticBuildStatus()\n .pipe(\n tap((status: SemanticBuildStatus) => {\n this.statusError.set(false);\n this.status.set(status);\n }),\n catchError(() => {\n this.statusError.set(true);\n\n return EMPTY;\n }),\n takeUntilDestroyed(this._destroyRef),\n );\n }\n}\n","<div class=\"fs-column tab-body\">\n <p class=\"hint\">\n The semantic database is what the report AI uses to understand your data —\n tables, relationships and the calculations in code. Rebuild it after\n significant application updates. The build runs in the background; progress\n appears in the dock at the bottom right and this dialog can be closed while\n it runs.\n </p>\n\n <!-- A failed status load settles the skeleton too, so the tab says what\n happened instead of loading forever. -->\n @if (statusError()) {\n <fs-message-warning>\n The build status could not be loaded, so the last build and its coverage\n can't be shown. You can still run a build.\n </fs-message-warning>\n }\n\n <div *fsSkeleton=\"status() || statusError()\">\n @if (status(); as buildStatus) {\n <div class=\"build-status\">\n @if (buildStatus.detail.generatedAt) {\n <div class=\"stat\">\n <span class=\"label\">Last built</span>\n <fs-date\n [date]=\"buildStatus.detail.generatedAt\"\n format=\"date-time\">\n </fs-date>\n </div>\n <div class=\"stat\">\n <span class=\"label\">Coverage</span>\n <span>{{ coverage() }}</span>\n </div>\n } @else {\n <fs-message-warning>\n The semantic database has not been built yet — the report AI can't\n answer data questions until it is. Run the first build.\n </fs-message-warning>\n }\n @if (buildStatus.build) {\n <div class=\"stat\">\n <span class=\"label\">Last build run</span>\n <span>\n {{ buildStateLabel() }}\n @if (buildStatus.build.message) {\n — {{ buildStatus.build.message }}\n }\n </span>\n </div>\n }\n\n <!-- Everything above is true about what was published, and on its own it\n reads as a finished build: the structural half publishes BEFORE the\n AI function pass, so a run that died in that pass still stamps a\n date and still fills in the whole coverage line. This is the only\n line that says the build never got to the end. -->\n @if (buildStatus.detail.generatedAt && !buildComplete()) {\n <fs-message-warning>\n The last build did not finish, so this semantic database is incomplete —\n {{ incompleteEntityCount() }} of {{ buildStatus.detail.entityCount }}\n entities have no code-function knowledge. The report AI answers from what\n is here and cannot see the rest. Rebuild to complete it.\n </fs-message-warning>\n }\n </div>\n\n <!-- Everything the build read, in one list: entities (a table + a model +\n a handler) and standalone code classes (domain logic with no table).\n The AI reads code from both, so splitting them into two sections\n would hide half of what was built. Each row drills into its shape,\n enum values, computed fields and cached function counts — the counts\n link into the functions dialog. -->\n @if (units().length) {\n <h2>Included ({{ units().length }})</h2>\n <div class=\"subheading\">\n Everything the report AI was built from. Entities can be queried;\n code classes are logic it reads and translates into SQL.\n </div>\n\n <input\n class=\"unit-filter\"\n type=\"search\"\n placeholder=\"Filter by name, class or key…\"\n [value]=\"filter()\"\n (input)=\"setFilter($any($event.target).value)\">\n\n <mat-accordion class=\"entities\">\n @for (unit of filteredUnits(); track unit.key) {\n <mat-expansion-panel>\n <mat-expansion-panel-header>\n <mat-panel-title>{{ unit.name }}</mat-panel-title>\n <mat-panel-description>\n <div class=\"stage-chips\">\n @if (!unit.hasTable) {\n <fs-chip size=\"tiny\" matTooltip=\"Domain logic with no table — read, never queried\">\n code\n </fs-chip>\n }\n <!-- Silence means built. A chip here means an interrupted\n build left this row owing content. -->\n @for (stage of pendingStages(unit); track stage) {\n <fs-chip\n size=\"tiny\"\n [backgroundColor]=\"pendingColor()\"\n color=\"#ffffff\"\n matTooltip=\"Needs building\">\n {{ stage }}\n </fs-chip>\n }\n </div>\n </mat-panel-description>\n </mat-expansion-panel-header>\n\n <!-- Deferred: the body only exists once expanded. -->\n <ng-template matExpansionPanelContent>\n <div class=\"entity-detail\">\n @if (unit.model) {\n <div class=\"stat\">\n <span class=\"label\">Class</span>\n <span>{{ unit.model }}</span>\n </div>\n }\n @if (unit.entity; as entity) {\n <div class=\"stat\">\n <span class=\"label\">Table</span>\n <span>{{ entity.table }}</span>\n </div>\n <!-- The handle the report AI addresses this entity by in\n describe_entity / compile_query. -->\n <div class=\"stat\">\n <span class=\"label\">Entity key</span>\n <span>{{ entity.key }}</span>\n </div>\n <div class=\"stat\">\n <span class=\"label\">Columns</span>\n <span>{{ entity.columns }}</span>\n </div>\n <div class=\"stat\">\n <span class=\"label\">Relationships</span>\n <span>{{ entity.relationships }}</span>\n </div>\n @if (entity.enums.length) {\n <div class=\"stat\">\n <span class=\"label\">Enumeration values</span>\n <div class=\"pair-list\">\n @for (enumColumn of entity.enums; track enumColumn.column) {\n <div class=\"pair-row\">\n <span class=\"pair-name\">{{ enumColumn.column }}</span>\n <span>{{ enumColumn.values.join(', ') }}</span>\n </div>\n }\n </div>\n </div>\n }\n @if (entity.computedFields.length) {\n <div class=\"stat\">\n <span class=\"label\">Computed fields</span>\n <span>{{ entity.computedFields.join(', ') }}</span>\n </div>\n }\n <div class=\"stat\">\n <span class=\"label\">Model functions</span>\n @if (entity.modelFunctionCount) {\n <a\n class=\"count-link\"\n (click)=\"openFunctions(unit, 'model')\">\n {{ entity.modelFunctionCount }}\n </a>\n } @else {\n <span>0</span>\n }\n </div>\n <div class=\"stat\">\n <span class=\"label\">Handler functions</span>\n @if (entity.handlerFunctionCount) {\n <a\n class=\"count-link\"\n (click)=\"openFunctions(unit, 'handler')\">\n {{ entity.handlerFunctionCount }}\n </a>\n } @else {\n <span>0</span>\n }\n </div>\n } @else {\n <div class=\"stat\">\n <span class=\"label\">Code functions</span>\n @if (unit.functionCount) {\n <a\n class=\"count-link\"\n (click)=\"openFunctions(unit, 'class')\">\n {{ unit.functionCount }}\n </a>\n } @else {\n <span>0</span>\n }\n </div>\n }\n </div>\n </ng-template>\n </mat-expansion-panel>\n }\n </mat-accordion>\n\n @if (!filteredUnits().length) {\n <div class=\"subheading\">Nothing matches “{{ filter() }}”.</div>\n }\n }\n\n <!-- The other half of the picture: tables the AI can't reach. Excluded\n ones have no model; unlinked junctions have a composite primary key\n but were folded into no relationship, so nothing can navigate to\n them. Both are invisible by omission — no error, just a capability\n that silently isn't there. Collapsed by default: the excluded list is\n long and mostly framework plumbing. -->\n @if (hasCatalog()) {\n <h2>Not in the semantic database</h2>\n <div class=\"subheading\">\n Tables the report AI can't see. Give one a model to promote it to an\n entity, then rebuild.\n </div>\n <mat-accordion class=\"catalog\">\n @if (excludedTables().length) {\n <mat-expansion-panel>\n <mat-expansion-panel-header>\n <mat-panel-title>\n Tables excluded ({{ excludedTables().length }})\n </mat-panel-title>\n </mat-expansion-panel-header>\n\n <!-- Deferred: the body only exists once expanded. -->\n <ng-template matExpansionPanelContent>\n <div class=\"pair-list\">\n @for (table of excludedTables(); track table.table) {\n <div class=\"pair-row\">\n <span class=\"pair-name\">{{ table.table }}</span>\n <span>{{ table.reason }}</span>\n </div>\n }\n </div>\n </ng-template>\n </mat-expansion-panel>\n }\n @if (unlinkedJunctions().length) {\n <mat-expansion-panel>\n <mat-expansion-panel-header>\n <mat-panel-title>\n Junctions not linked ({{ unlinkedJunctions().length }})\n </mat-panel-title>\n </mat-expansion-panel-header>\n\n <ng-template matExpansionPanelContent>\n <p class=\"small\">\n Link tables the build couldn't fold into a relationship — so\n neither they nor what they link can be reported on.\n </p>\n <div class=\"pair-list\">\n @for (table of unlinkedJunctions(); track table.table) {\n <div class=\"pair-row\">\n <span class=\"pair-name\">{{ table.table }}</span>\n <span>{{ table.reason }}</span>\n </div>\n }\n </div>\n </ng-template>\n </mat-expansion-panel>\n }\n </mat-accordion>\n }\n }\n </div>\n</div>\n","import { ChangeDetectionStrategy, Component, DestroyRef, computed, inject, signal, viewChild } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FormsModule } from '@angular/forms';\n\nimport { MatButton } from '@angular/material/button';\nimport { MatDialog, MatDialogActions, MatDialogClose, MatDialogContent, MatDialogRef } from '@angular/material/dialog';\nimport { MatTabsModule } from '@angular/material/tabs';\n\nimport { FsDialogModule } from '@firestitch/dialog';\nimport { FsFormModule } from '@firestitch/form';\nimport { FsMarkdownEditorConfig } from '@firestitch/markdown-editor';\nimport { FsMessage } from '@firestitch/message';\nimport { FsSkeletonModule } from '@firestitch/skeleton';\nimport { FsTabsModule } from '@firestitch/tabs';\n\nimport { switchMap, tap } from 'rxjs/operators';\n\nimport { ReportData } from '../../data/report.data';\nimport { ReportInstructions, ReportSettings } from '../../interfaces/report.interface';\nimport { InstructionHistoryComponent } from '../instruction-history/instruction-history.component';\nimport { AiKnowledgeComponent } from './components/ai-knowledge/ai-knowledge.component';\nimport { GeneralComponent } from './components/general/general.component';\nimport { SemanticDatabaseComponent } from './components/semantic-database/semantic-database.component';\n\n\n// Matches the backend cap (ReportsView::INSTRUCTIONS_MAX_LENGTH) — the document\n// rides along on every agent turn, so it is a prompt-budget guard.\nconst MAX_LENGTH = 50000;\n\n// Seeded into the editor (client-side, unsaved) when no version exists yet, so\n// the operator sees the intended shape of the document.\nconst SCAFFOLD = [\n '# Glossary',\n '',\n '*Terms your team uses and what they mean in the data — e.g. \"active accounts\" are accounts with an order in the last 90 days.*',\n '',\n '# Business rules',\n '',\n '*Rules the AI should apply when building or explaining reports.*',\n '',\n '# Special cases',\n '',\n '*Known exceptions and data quirks the AI cannot infer on its own.*',\n '',\n].join('\\n');\n\n\n// Global report settings, opened from the reports listing's gear. A thin shell:\n// the dialog frame, the tab group, and a per-tab footer. Each tab is its own\n// component —\n// AI Knowledge — the operator-authored markdown document appended to the\n// report agent's system instructions on every chat turn. Its footer carries a\n// View History button opening the version-history dialog (restores happen\n// there; the shell refreshes on close).\n// Semantic Database — the build scoreboard the AI is built from, with a\n// self-contained Build action.\n// General — report-module settings (the semantic-build concurrency).\n// The shell owns the shared data (the instructions document, the settings for\n// General) plus the tab-aware save; everything else lives in the children.\n@Component({\n templateUrl: './global-settings.component.html',\n styleUrls: ['./global-settings.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n FormsModule,\n FsDialogModule,\n FsFormModule,\n FsSkeletonModule,\n FsTabsModule,\n MatButton,\n MatDialogActions,\n MatDialogClose,\n MatDialogContent,\n MatTabsModule,\n AiKnowledgeComponent,\n GeneralComponent,\n SemanticDatabaseComponent,\n ],\n})\nexport class GlobalSettingsComponent {\n\n public selectedTab = 'knowledge';\n\n // The Semantic Database tab component, so the shared footer can drive its\n // Build/Rebuild/Stop action inline next to Close (the build state lives there).\n public readonly semanticDatabase = viewChild(SemanticDatabaseComponent);\n\n // The editor's draft, held on the shell so switching tabs never loses an edit\n // — seeded from the current version (or the scaffold).\n public readonly content = signal<string>('');\n\n public readonly editorConfig: FsMarkdownEditorConfig = {\n maxLength: MAX_LENGTH,\n placeholder: 'Terminology, business rules and special cases the report AI should know…',\n };\n\n // Both null until loaded — the form waits behind the skeleton until each is in.\n public readonly instructions = signal<ReportInstructions | null>(null);\n public readonly settings = signal<ReportSettings | null>(null);\n\n // The General tab's concurrency draft (bound to its field), seeded from settings.\n public readonly concurrency = signal<number>(0);\n\n // Gate the whole form on both loads, so every tab's fields are ready to render.\n public readonly loaded = computed<boolean>(() => !!this.instructions() && !!this.settings());\n\n private readonly _dialogRef = inject<MatDialogRef<GlobalSettingsComponent>>(MatDialogRef);\n private readonly _dialog = inject(MatDialog);\n private readonly _reportData = inject(ReportData);\n private readonly _message = inject(FsMessage);\n private readonly _destroyRef = inject(DestroyRef);\n\n constructor() {\n this._init();\n }\n\n // The footer Save is shared, so it saves whatever the current tab owns: the\n // General tab persists its settings (and stays open); AI Knowledge saves a new\n // document version and closes.\n public save = () => {\n if (this.selectedTab === 'general') {\n return this._reportData.saveSettings({ semanticBuildConcurrency: this.concurrency() })\n .pipe(\n tap((settings: ReportSettings) => {\n this._applySettings(settings);\n this._message.success('Settings saved');\n }),\n );\n }\n\n return this._reportData.saveInstructions(this.content())\n .pipe(\n tap((instructions: ReportInstructions) => {\n this._message.success('AI knowledge saved');\n this._dialogRef.close(instructions);\n }),\n );\n };\n\n // Open the version-history dialog. Restores happen inside it, so when it\n // closes (however it closes) re-fetch the document: a restore changed the\n // current version and must reseed the editor; otherwise just refresh the\n // version list without touching an unsaved draft.\n public openHistory(): void {\n const currentId = this.instructions()?.instructions?.id;\n\n this._dialog.open(InstructionHistoryComponent, {\n width: '800px',\n maxWidth: '95vw',\n maxHeight: '85vh',\n autoFocus: false,\n data: { versions: this.instructions()?.versions ?? [] },\n })\n .afterClosed()\n .pipe(\n switchMap(() => this._reportData.instructions()),\n takeUntilDestroyed(this._destroyRef),\n )\n .subscribe((instructions: ReportInstructions) => {\n if (instructions.instructions?.id !== currentId) {\n this._applyInstructions(instructions);\n } else {\n this.instructions.set(instructions);\n }\n });\n }\n\n private _init(): void {\n this._reportData.instructions()\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe((instructions: ReportInstructions) => this._applyInstructions(instructions));\n\n this._reportData.settings()\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe((settings: ReportSettings) => this._applySettings(settings));\n }\n\n private _applyInstructions(instructions: ReportInstructions): void {\n this.instructions.set(instructions);\n this.content.set(instructions.instructions?.content ?? SCAFFOLD);\n }\n\n private _applySettings(settings: ReportSettings): void {\n this.settings.set(settings);\n this.concurrency.set(settings.semanticBuildConcurrency);\n }\n}\n","<form\n *fsSkeletonForm=\"loaded()\"\n fsForm\n [submit]=\"save\">\n <fs-dialog>\n <fs-dialog-title>\n Report Settings\n </fs-dialog-title>\n <mat-dialog-content>\n <mat-tab-group [(selected)]=\"selectedTab\">\n <mat-tab\n label=\"AI Knowledge\"\n name=\"knowledge\">\n <fs-ai-report-global-settings-ai-knowledge\n [content]=\"content()\"\n (contentChange)=\"content.set($event)\"\n [config]=\"editorConfig\">\n </fs-ai-report-global-settings-ai-knowledge>\n </mat-tab>\n <mat-tab\n label=\"Semantic Database\"\n name=\"build\">\n <fs-ai-report-global-settings-semantic-database>\n </fs-ai-report-global-settings-semantic-database>\n </mat-tab>\n <mat-tab\n label=\"General\"\n name=\"general\">\n <fs-ai-report-global-settings-general\n [concurrency]=\"concurrency()\"\n (concurrencyChange)=\"concurrency.set($event)\"\n [min]=\"settings()!.semanticBuildConcurrencyMin\"\n [max]=\"settings()!.semanticBuildConcurrencyMax\">\n </fs-ai-report-global-settings-general>\n </mat-tab>\n </mat-tab-group>\n </mat-dialog-content>\n <mat-dialog-actions>\n <!-- The footer follows the selected tab. AI Knowledge projects its own\n Save | View History | Cancel row (fs-form-dialog-actions renders\n projected content after Save/Cancel, so the default pair can't keep\n View History beside Save); General uses the default Save/Cancel; the\n Semantic Database tab is a read/run surface, so it gets a primary\n Close plus its Build/Rebuild/Stop action. -->\n <fs-form-dialog-actions [save]=\"selectedTab === 'general'\">\n @if (selectedTab === 'knowledge') {\n <button\n type=\"submit\"\n mat-button\n color=\"primary\">\n Save\n </button>\n <button\n type=\"button\"\n mat-button\n (click)=\"openHistory()\">\n View History\n </button>\n <button\n type=\"button\"\n mat-button\n [mat-dialog-close]=\"null\">\n Cancel\n </button>\n }\n @if (selectedTab === 'build') {\n <button\n type=\"button\"\n mat-button\n color=\"primary\"\n [mat-dialog-close]=\"undefined\">\n Close\n </button>\n }\n @if (selectedTab === 'build' && semanticDatabase(); as db) {\n @if (db.buildActive()) {\n <button\n type=\"button\"\n mat-button\n color=\"warn\"\n (click)=\"db.stopBuild()\">\n Stop Build\n </button>\n } @else {\n <!-- Never gated on the status load: a status response that fails\n must not take the Build action away with it. -->\n <button\n type=\"button\"\n mat-button\n (click)=\"db.build()\">\n {{ db.rebuild() ? 'Rebuild' : 'Build' }}\n </button>\n }\n }\n </fs-form-dialog-actions>\n </mat-dialog-actions>\n </fs-dialog>\n</form>\n","import {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n OnInit,\n effect,\n inject,\n input,\n signal,\n viewChild,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ActivatedRoute, Router, RouterLink } from '@angular/router';\n\nimport { MatDialog } from '@angular/material/dialog';\nimport { MatIconModule } from '@angular/material/icon';\n\nimport { FsChipModule } from '@firestitch/chip';\nimport { FilterConfig, FsFilterModule, ItemType } from '@firestitch/filter';\nimport { FsMessage } from '@firestitch/message';\nimport { FsPrompt } from '@firestitch/prompt';\nimport { FsSkeletonModule } from '@firestitch/skeleton';\nimport {\n FlatItemNode,\n FsTreeComponent,\n FsTreeModule,\n ITreeChangeReorder,\n ITreeConfig,\n TreeActionType,\n TreeDragMode,\n} from '@firestitch/tree';\n\nimport { Observable, switchMap } from 'rxjs';\n\nimport { ReportData } from '../../data/report.data';\nimport { GlobalSettingsComponent } from '../../dialogs/global-settings/global-settings.component';\nimport {\n ReportFolder,\n ReportListItem,\n ReportNode,\n ReportNodeType,\n ReportState,\n ReportTree,\n} from '../../interfaces/report.interface';\n\n\n// The reports listing — an fs-tree of folders and the reports filed into them.\n// Rows link out through a URL pattern (a ':id' token → the report id; a leading\n// '/' makes it absolute, otherwise it's relative to this component's route).\n// Create prompts for a title, creates the report, then routes to it. The gear\n// opens the global Report Settings dialog (AI knowledge document +\n// semantic-database build), which lives in this package. No routing is\n// hard-coded here.\n//\n// Folders nest; reports are always leaves — canDrop enforces it here, and the\n// backend enforces it structurally by keeping the tree in its own table. A\n// report in no folder is a root node, which is where every report sat before\n// folders existed, so nothing had to be migrated or bucketed as \"uncategorized\".\n//\n// Folders and reports are both soft-deletable, and a folder deletes whatever it\n// holds. Only the folder's own row is written: everything under it drops out of\n// the listing because it sits under a deleted folder, and comes back with it.\n// \"Show Deleted\" shows the WHOLE tree — live and deleted together, each deleted\n// row where it was filed — and on anything deleted the kebab offers Restore\n// instead. Restoring also restores any deleted folder above the row, so it lands\n// back where it was rather than at the root.\n//\n// Every folder starts collapsed; the tree remembers what was opened across its\n// own reloads (a rename, a move, the Show Deleted toggle) and across a search.\n@Component({\n selector: 'fs-ai-reports',\n templateUrl: './fs-ai-reports.component.html',\n styleUrls: ['./fs-ai-reports.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n FsChipModule,\n FsFilterModule,\n FsSkeletonModule,\n FsTreeModule,\n MatIconModule,\n RouterLink,\n ],\n})\nexport class FsAiReportsComponent implements OnInit {\n\n // API base for the reports endpoints; override to mount elsewhere.\n public readonly basePath = input<string>('reports');\n\n // Where a row links to; ':id' is replaced with the report id. Default takes\n // you to <current route>/:id. Absolute when it starts with '/'.\n public readonly openPattern = input<string>(':id');\n\n // Where a freshly-created report routes to; same ':id' pattern rules.\n public readonly createPattern = input<string>(':id');\n\n // Null until the first load resolves — that is what gates *fsSkeleton.\n public readonly nodes = signal<ReportNode[]>(null);\n\n public treeConfig: ITreeConfig<ReportNode[]>;\n public filterConfig: FilterConfig;\n\n // Template-side handle on the enum, so a row can tell a folder from a report.\n public readonly nodeType = ReportNodeType;\n\n private readonly _tree = viewChild(FsTreeComponent);\n\n private _reportData = inject(ReportData);\n private _router = inject(Router);\n private _route = inject(ActivatedRoute);\n private _prompt = inject(FsPrompt);\n private _message = inject(FsMessage);\n private _dialog = inject(MatDialog);\n private _destroyRef = inject(DestroyRef);\n\n // The filter bar's current query — carries `state` when Show Deleted is on.\n private _query: Record<string, unknown> = {};\n\n // The folders that were open when a search started; null while no search is\n // running. The search opens every match's path over the top of them, and\n // clearing it puts these back.\n private _expandedBeforeSearch: string[] | null = null;\n\n constructor() {\n effect(() => {\n this._reportData.basePath = this.basePath();\n });\n }\n\n public ngOnInit(): void {\n // Set before the first fetch rather than waiting on the effect above, which\n // does not run until after the initial change detection pass.\n this._reportData.basePath = this.basePath();\n\n this._initFilterConfig();\n this._initTreeConfig();\n this._load();\n }\n\n // routerLink commands for a report row (built from openPattern).\n public openLink(report: ReportListItem): unknown[] {\n return this._patternCommands(this.openPattern(), report.id);\n }\n\n // Prompt for a title, create the report — filed under reportFolderId when a\n // folder's kebab asked, at the root otherwise — then route to it (createPattern).\n public createReport(reportFolderId: number = null): void {\n this._prompt.input({\n title: 'Create Report',\n label: 'Title',\n commitLabel: 'Create',\n required: true,\n })\n .pipe(\n switchMap((name: string) => this._reportData.create(name, reportFolderId)),\n takeUntilDestroyed(this._destroyRef),\n )\n .subscribe((report: ReportListItem) => {\n const pattern = this.createPattern();\n this._router.navigate(\n this._patternCommands(pattern, report.id),\n pattern.startsWith('/') ? {} : { relativeTo: this._route },\n );\n });\n }\n\n // The global Report Settings dialog: the AI knowledge document and the\n // semantic-database build. A running build streams into the FsProcess dock,\n // which survives the dialog closing.\n public openSettings(): void {\n this._dialog.open(GlobalSettingsComponent, {\n width: '900px',\n maxWidth: '95vw',\n maxHeight: '90vh',\n autoFocus: false,\n });\n }\n\n private _initFilterConfig(): void {\n this.filterConfig = {\n items: [\n {\n name: 'keyword',\n type: ItemType.Keyword,\n label: 'Search',\n },\n // A checkbox rather than the usual Status select with a \"Show Deleted\"\n // isolate. Isolating the deleted rows would strand them: a deleted\n // report in a live folder arrives without the folder it sits in, and a\n // tree cannot place a node whose parent it never received. So the\n // toggle asks for everything, and the rows mark what is deleted.\n {\n name: 'state',\n type: ItemType.Checkbox,\n label: 'Show Deleted',\n checked: [ReportState.Active, ReportState.Deleted].join(','),\n },\n ],\n actions: [\n {\n icon: 'unfold_more',\n tooltip: 'Expand all',\n primary: false,\n click: () => this._tree()?.expandAll(),\n },\n {\n icon: 'unfold_less',\n tooltip: 'Collapse all',\n primary: false,\n click: () => this._tree()?.collapseAll(),\n },\n {\n icon: 'settings',\n tooltip: 'Report settings',\n primary: false,\n click: () => this.openSettings(),\n },\n {\n label: 'New Folder',\n primary: false,\n click: () => this._createFolder(null),\n },\n {\n label: 'Create',\n primary: true,\n click: () => this.createReport(),\n },\n ],\n // The two items are answered in different places, and each only when it\n // changed. The keyword drives the tree's own search, which is the whole\n // point of searching a tree — it reveals a match nested inside collapsed\n // folders rather than only filtering what is already on screen. `state` is\n // the Show Deleted toggle, and only the server can answer that. Running the\n // search on a toggle would clear it, and clearing collapses the tree.\n change: (query) => {\n const keywordChanged = String(query?.keyword ?? '') !== String(this._query.keyword ?? '');\n const stateChanged = String(query?.state ?? '') !== String(this._query.state ?? '');\n this._query = { ...query };\n\n if (keywordChanged) {\n this._search(query?.keyword);\n }\n\n if (stateChanged) {\n this._load();\n }\n },\n };\n }\n\n private _initTreeConfig(): void {\n // No expandLevel: every folder starts collapsed.\n this.treeConfig = {\n data: [],\n childrenName: 'children',\n draggable: true,\n // The whole row is the grip and the handle stays hidden; a press only\n // becomes a drag once the pointer moves, so the kebab, the chevron and the\n // report link all stay clickable.\n dragMode: TreeDragMode.Node,\n // Anything deleted is restored before it is moved — the backend refuses\n // to edit a deleted row, and a drag would only snap back.\n canDrag: (node: FlatItemNode) => !this._isDeletedNode(node),\n // canDrop is asked about the node being DRAGGED, so only `toParent`\n // describes the destination — reading node.level/node.parent here would\n // describe where it came from. A report can never be a parent because its\n // type says so, and that single test is the whole \"folders nest, reports\n // are leaves\" rule on this side. A deleted folder is no destination\n // either: whatever landed in it would vanish from the live listing.\n canDrop: (node: FlatItemNode, fromParent: FlatItemNode, toParent: FlatItemNode) => {\n return !toParent || (this._isFolderNode(toParent) && !this._isDeletedNode(toParent));\n },\n changeReorder: (event: ITreeChangeReorder) => this._move(event),\n nodeClass: (node: FlatItemNode) => node.data?.type,\n // Match on the name only. The library's default matcher stringifies the\n // whole node, so it would hit ids, the literal type word, and everything\n // else riding on the row.\n filterItem: (node, query) => {\n return String(node.data?.name ?? '')\n .toLowerCase()\n .includes(String(query ?? '').toLowerCase());\n },\n actions: [\n {\n type: TreeActionType.Menu,\n icon: 'more_vert',\n items: [\n {\n label: 'Rename',\n show: (node: FlatItemNode) => !this._isDeletedNode(node),\n click: (node: FlatItemNode) => this._rename(node),\n },\n {\n label: 'New report',\n show: (node: FlatItemNode) => this._isFolderNode(node) && !this._isDeletedNode(node),\n click: (node: FlatItemNode) => this.createReport(node.data?.id),\n },\n {\n label: 'New folder',\n show: (node: FlatItemNode) => this._isFolderNode(node) && !this._isDeletedNode(node),\n click: (node: FlatItemNode) => this._createFolder(node.data?.id),\n },\n {\n label: 'Delete',\n show: (node: FlatItemNode) => !this._isDeletedNode(node),\n click: (node: FlatItemNode) => this._delete(node),\n },\n // On every deleted row, including a live one that is only hidden by\n // a deleted folder above it — restoring that brings the folder back.\n {\n label: 'Restore',\n show: (node: FlatItemNode) => this._isDeletedNode(node),\n click: (node: FlatItemNode) => this._restore(node),\n },\n ],\n },\n ],\n };\n }\n\n private _isFolderNode(node: FlatItemNode): boolean {\n return node?.data?.type === ReportNodeType.Folder;\n }\n\n private _isDeletedNode(node: FlatItemNode): boolean {\n return !!node?.data?.deleted;\n }\n\n // Drive the tree's built-in search: it collapses everything, hides every node,\n // then unhides each match and walks its ancestors open, so a report several\n // folders deep surfaces with its path expanded. Clearing collapses everything\n // again, so the folders that were open before the search are put back.\n private _search(keyword: string): void {\n const tree = this._tree();\n if (!tree) {\n return;\n }\n\n if (keyword) {\n this._expandedBeforeSearch ??= this._expandedKeys();\n tree.search(keyword);\n return;\n }\n\n tree.clearSearch();\n this._expandKeys(this._expandedBeforeSearch ?? []);\n this._expandedBeforeSearch = null;\n }\n\n private _load(): void {\n // Only the Show Deleted toggle is the server's to answer — the keyword is\n // the tree's own search — and an unchecked toggle sends nothing, leaving the\n // backend's active-only default in charge.\n const query = this._query.state ? { state: this._query.state } : {};\n\n this._reportData.tree(query)\n .pipe(\n takeUntilDestroyed(this._destroyRef),\n )\n .subscribe((reportTree: ReportTree) => {\n const nodes = this._buildNodes(reportTree);\n this.nodes.set(nodes);\n\n // The tree reads `config` once, in its own ngOnInit. The first load\n // lands before it exists, so the data has to arrive through the config;\n // every later one has to go through the instance or nothing changes.\n this.treeConfig = { ...this.treeConfig, data: nodes };\n\n const tree = this._tree();\n if (!tree) {\n return;\n }\n\n // setData() rebuilds every node collapsed, so a rename or a move would\n // otherwise slam shut every folder somebody had opened. Keys are stable\n // across loads ('f:12'), so what was open is reopened by key — and a\n // folder that no longer comes back simply is not.\n const expandedKeys = this._expandedKeys();\n tree.setData(nodes);\n this._expandKeys(expandedKeys);\n\n const keyword = String(this._query.keyword ?? '');\n if (keyword) {\n tree.search(keyword);\n }\n });\n }\n\n // The keys of every open folder, walked through the tree's public node API.\n private _expandedKeys(): string[] {\n const tree = this._tree();\n if (!tree) {\n return [];\n }\n\n const walk = (parent: FlatItemNode): string[] => tree.getNodes(parent)\n .filter((node: FlatItemNode) => node.isExpanded())\n .flatMap((node: FlatItemNode) => [node.data?.key, ...walk(node)]);\n\n return walk(null);\n }\n\n private _expandKeys(keys: string[]): void {\n const tree = this._tree();\n if (!tree || !keys.length) {\n return;\n }\n\n const open = new Set(keys);\n const walk = (parent: FlatItemNode): void => {\n tree.getNodes(parent)\n .filter((node: FlatItemNode) => open.has(node.data?.key))\n .forEach((node: FlatItemNode) => {\n node.expand();\n walk(node);\n });\n };\n\n walk(null);\n }\n\n // Flat API rows → the nested shape fs-tree renders. Folders come before\n // reports at every level, each already name-ordered by the backend.\n //\n // `deleted` is inherited downward: a deleted folder hides everything below it\n // without the rows below being deleted themselves, and that is only visible\n // from here, where the parent is in hand. The backend applies the same rule\n // when it filters (ReportFolderModel::getDeletedFolderIds()).\n private _buildNodes(reportTree: ReportTree): ReportNode[] {\n const folders = reportTree?.folders ?? [];\n const reports = reportTree?.reports ?? [];\n\n const build = (parentId: number | null, parentDeleted: boolean): ReportNode[] => {\n const folderNodes: ReportNode[] = folders\n .filter((folder: ReportFolder) => (folder.parentReportFolderId ?? null) === parentId)\n .map((folder: ReportFolder) => {\n const stateDeleted = folder.state === ReportState.Deleted;\n const deleted = parentDeleted || stateDeleted;\n\n return {\n key: `f:${folder.id}`,\n id: folder.id,\n name: folder.name,\n type: ReportNodeType.Folder,\n children: build(folder.id, deleted),\n stateDeleted,\n deleted,\n };\n });\n\n const reportNodes: ReportNode[] = reports\n .filter((report: ReportListItem) => (report.reportFolderId ?? null) === parentId)\n .map((report: ReportListItem) => {\n const stateDeleted = report.state === ReportState.Deleted;\n\n return {\n key: `r:${report.id}`,\n id: report.id,\n name: report.name,\n type: ReportNodeType.Report,\n children: [],\n report,\n stateDeleted,\n deleted: parentDeleted || stateDeleted,\n };\n });\n\n return [...folderNodes, ...reportNodes];\n };\n\n return build(null, false);\n }\n\n // A drop moved a node under a new parent, or out to the root. The tree has\n // already moved it on screen, so both outcomes reload: a success to pick up\n // the server's ordering, a failure to put the row back where it really is.\n private _move(event: ITreeChangeReorder): void {\n const node: ReportNode = event.node?.data;\n if (!node) {\n return;\n }\n\n const parentReportFolderId: number = event.toParent?.data?.id ?? null;\n\n if (event.toParent && !event.toParent.isExpanded()) {\n event.toParent.expand();\n }\n\n const save$: Observable<unknown> = node.type === ReportNodeType.Folder\n ? this._reportData.updateFolder(node.id, { parentReportFolderId })\n : this._reportData.moveReport(node.id, parentReportFolderId);\n\n save$\n .pipe(\n takeUntilDestroyed(this._destroyRef),\n )\n .subscribe({\n next: () => {\n this._message.success('Saved changes');\n this._load();\n },\n error: () => this._load(),\n });\n }\n\n private _createFolder(parentReportFolderId: number): void {\n this._prompt.input({\n title: 'New Folder',\n label: 'Name',\n commitLabel: 'Create',\n required: true,\n })\n .pipe(\n switchMap((name: string) => this._reportData.createFolder(name, parentReportFolderId)),\n takeUntilDestroyed(this._destroyRef),\n )\n .subscribe(() => {\n this._message.success('Created folder');\n this._load();\n });\n }\n\n private _rename(node: FlatItemNode): void {\n const data: ReportNode = node?.data;\n if (!data) {\n return;\n }\n\n const folder = data.type === ReportNodeType.Folder;\n\n this._prompt.input({\n title: folder ? 'Rename Folder' : 'Rename Report',\n label: 'Name',\n default: data.name,\n commitLabel: 'Save',\n required: true,\n })\n .pipe(\n switchMap((name: string) => (folder\n ? this._reportData.updateFolder(data.id, { name })\n : this._reportData.rename(data.id, name))),\n takeUntilDestroyed(this._destroyRef),\n )\n .subscribe(() => {\n this._message.success('Saved changes');\n this._load();\n });\n }\n\n // A folder deletes with everything in it, so the confirm says what that is —\n // and that it all comes back from Show Deleted, which is what makes it safe to\n // offer.\n private _delete(node: FlatItemNode): void {\n const data: ReportNode = node?.data;\n if (!data) {\n return;\n }\n\n const folder = data.type === ReportNodeType.Folder;\n\n this._prompt.confirm({\n title: 'Confirm',\n template: folder\n ? this._deleteFolderMessage(data)\n : 'Are you sure you would like to delete this report?',\n })\n .pipe(\n switchMap(() => (folder\n ? this._reportData.deleteFolder(data.id)\n : this._reportData.delete(data.id))),\n takeUntilDestroyed(this._destroyRef),\n )\n .subscribe(() => {\n this._message.success(folder ? 'Deleted folder' : 'Deleted report');\n this._load();\n });\n }\n\n // Counted from the node already on screen, live rows only: in Show Deleted\n // mode the folder can also hold rows that are gone already, and those are not\n // leaving with it.\n private _deleteFolderMessage(folder: ReportNode): string {\n const count = (node: ReportNode): { folders: number; reports: number } => node.children\n .filter((child) => !child.deleted)\n .reduce((total, child) => {\n const below = count(child);\n\n return {\n folders: total.folders + below.folders + (child.type === ReportNodeType.Folder ? 1 : 0),\n reports: total.reports + below.reports + (child.type === ReportNodeType.Report ? 1 : 0),\n };\n }, { folders: 0, reports: 0 });\n\n const { folders, reports } = count(folder);\n const contents = [\n folders ? `${folders} ${folders === 1 ? 'folder' : 'folders'}` : '',\n reports ? `${reports} ${reports === 1 ? 'report' : 'reports'}` : '',\n ].filter(Boolean);\n\n const inside = contents.length ? ` and the ${contents.join(' and ')} inside it` : '';\n\n return `Are you sure you would like to delete the folder \"${folder.name}\"${inside}? It can be restored from Show Deleted.`;\n }\n\n // Both endpoints also restore any deleted folder above the row, so a row that\n // is live itself but hidden by a deleted folder is restored by the same call.\n private _restore(node: FlatItemNode): void {\n const data: ReportNode = node?.data;\n if (!data) {\n return;\n }\n\n const folder = data.type === ReportNodeType.Folder;\n\n (folder\n ? this._reportData.undeleteFolder(data.id)\n : this._reportData.undelete(data.id))\n .pipe(\n takeUntilDestroyed(this._destroyRef),\n )\n .subscribe(() => {\n this._message.success(folder ? 'Restored folder' : 'Restored report');\n this._load();\n });\n }\n\n // Turn a ':id' pattern into router commands. Relative unless it starts\n // with '/', in which case the first segment carries the leading slash.\n private _patternCommands(pattern: string, id: number): unknown[] {\n const absolute = pattern.startsWith('/');\n const segments: unknown[] = pattern.split('/')\n .filter((segment) => segment.length > 0)\n .map((segment) => (segment === ':id' ? id : segment));\n\n if (!segments.length) {\n return [id];\n }\n\n if (absolute) {\n segments[0] = `/${segments[0]}`;\n }\n\n return segments;\n }\n}\n","<fs-filter [config]=\"filterConfig\"></fs-filter>\n\n<ng-container *fsSkeleton=\"nodes()\">\n <fs-tree [config]=\"treeConfig\">\n <ng-template\n fsTreeNode\n let-data=\"data\">\n <div\n class=\"fs-row.gap-sm.align-center node-row\"\n [class.deleted]=\"data.deleted\">\n <mat-icon class=\"node-icon\">\n {{ data.type === nodeType.Folder ? 'folder' : 'insert_chart_outlined' }}\n </mat-icon>\n\n @if (data.type === nodeType.Folder || data.deleted) {\n <!-- A deleted report can't be opened (the backend only assembles\n live ones, and one under a deleted folder is not on the live\n listing), so in Show Deleted mode the name is plain text —\n restore it from the row menu first. -->\n <span class=\"node-name\">{{ data.name }}</span>\n } @else {\n <a\n class=\"node-name\"\n [routerLink]=\"openLink(data.report)\">\n {{ data.name }}\n </a>\n }\n\n <!-- Only on the row somebody deleted. Everything under a deleted\n folder is muted with it, but was not deleted itself. -->\n @if (data.stateDeleted) {\n <fs-chip size=\"tiny\">Deleted</fs-chip>\n }\n </div>\n </ng-template>\n </fs-tree>\n\n @if (!nodes().length) {\n <p class=\"small tree-empty\">\n No reports yet. Create one, or add a folder to group them.\n </p>\n }\n</ng-container>\n","import { Injectable } from '@angular/core';\n\nimport { FsAiChatData } from '@firestitch/ai';\n\n\n// The parent's own parameter types, so the override always matches the\n// @firestitch/ai build it extends (a linked build carries its own\n// @firestitch/api, whose RequestConfig is a different type).\ntype ChatStreamBody = Parameters<FsAiChatData['chatStream']>[1];\ntype ChatStreamConfig = Parameters<FsAiChatData['chatStream']>[2];\ntype ChatStream = ReturnType<FsAiChatData['chatStream']>;\n\n\n// The report view's chat gateway: the stock one, plus fields read at the\n// moment each turn is sent and merged into that turn's body only. The chat's\n// requestData can't carry them, because it is also the key of the conversation\n// list, and a change there reloads the list and drops the open conversation.\n//\n// It relies on FsAiChatData.chatStream(basePath, body, config) being the one\n// path a turn takes. Nothing else is overridden, so the conversation list and\n// the create never see these fields. It stands in for a per-turn input on\n// fs-ai-chat itself, and can be removed when @firestitch/ai ships one.\n@Injectable()\nexport class ReportAiChatData extends FsAiChatData {\n\n // Set by the host view. A function, so it is read at send time.\n public turnData: () => Record<string, unknown> = () => ({});\n\n public override chatStream(basePath: string, body: ChatStreamBody, config: ChatStreamConfig = {}): ChatStream {\n return super.chatStream(basePath, { ...body, ...this.turnData() }, config);\n }\n}\n","import {\n CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, Component,\n DestroyRef, ElementRef, NgZone, ViewChild, computed, effect, inject, input, output, signal, untracked,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ActivatedRoute, Params, Router } from '@angular/router';\n\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatDialog } from '@angular/material/dialog';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatTooltipModule } from '@angular/material/tooltip';\n\nimport { FilterConfig, FsFilterModule, IFilterConfigItem } from '@firestitch/filter';\nimport { FsMenuModule } from '@firestitch/menu';\nimport { FsProcess } from '@firestitch/process';\n\nimport { Subject, merge } from 'rxjs';\nimport { auditTime, switchMap, takeUntil, tap } from 'rxjs/operators';\n\nimport { provideEchartsCore } from 'ngx-echarts';\n\nimport { FsAiChatComponent, FsAiChatData, FsAiChatResponse } from '@firestitch/ai';\n\nimport { ReportCanvasComponent } from '../../components/report-canvas/report-canvas.component';\nimport { ReportAiChatData } from '../../data/report-ai-chat.data';\nimport { ReportData } from '../../data/report.data';\nimport { ComponentSettingsComponent, ComponentSettingsResult } from '../../dialogs/component-settings/component-settings.component';\nimport { ReportSettingsComponent, ReportSettingsResult } from '../../dialogs/report-settings/report-settings.component';\nimport { ReportExportCollectorService } from '../../export/report-export-collector.service';\nimport { ReportExportService } from '../../export/report-export.service';\nimport { ReportPdfService } from '../../export/report-pdf.service';\nimport { ReportPptxService } from '../../export/report-pptx.service';\nimport { getTimezoneLabel } from '../../format';\nimport { ReportChatViewerState } from '../../interfaces/report-chat-viewer-state.interface';\nimport {\n ChartGranularity, Report, ReportChatResponse,\n ReportComponent as ReportComponentModel, ReportFilterGroup,\n} from '../../interfaces/report.interface';\nimport {\n GROUP_BY_ITEM, filterItemForGroup, groupByFilterItem, groupBySignature, groupValuesFromQuery,\n isGranularityOffered,\n} from '../../report-filter-items';\nimport { buildReportUrlParams, readReportUrlParams } from '../../report-url-state';\nimport { ReportFilterStateService, defaultSignature } from '../../services/report-filter-state.service';\n\n\n// A single report: the AI chat on the left, the report canvas on the right,\n// under an H2 title + settings gear. The host supplies [reportId] (from its\n// route) and switches reports through its own routes — this component never\n// picks one.\n@Component({\n selector: 'fs-ai-report',\n templateUrl: './fs-ai-report.component.html',\n styleUrls: ['./fs-ai-report.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n schemas: [CUSTOM_ELEMENTS_SCHEMA],\n providers: [\n // Session filter state is per-open-report, not app-global; the export\n // services resolve filters through it, so they live at the same level.\n ReportFilterStateService,\n ReportExportCollectorService,\n ReportPptxService,\n ReportPdfService,\n ReportExportService,\n // fs-ai-chat sits in this template, so it resolves its gateway here: the\n // report one, which adds the viewer's state to each turn it sends.\n ReportAiChatData,\n { provide: FsAiChatData, useExisting: ReportAiChatData },\n // Tree-shaken ECharts core + the 'report' house theme, loaded lazily.\n provideEchartsCore({ echarts: () => import('../../theme/echarts').then((module) => module.default) }),\n ],\n imports: [\n FsFilterModule,\n FsMenuModule,\n FsAiChatComponent,\n MatButtonModule,\n MatIconModule,\n MatTooltipModule,\n ReportCanvasComponent,\n ],\n})\nexport class FsAiReportComponent {\n\n // The report this view is focused on — supplied by the host from the route.\n public readonly reportId = input<number | null>(null);\n\n // API base for the reports + chat endpoints; override to mount elsewhere.\n public readonly basePath = input<string>('reports');\n\n // The query param that carries the open page's id. Deep linking is on by\n // default; a host that mounts several reports on one route, or wants no URL\n // writes at all, sets this to null to turn it off.\n public readonly pageQueryParam = input<string | null>('page');\n\n // Whether the viewer's filters, group-by grain and list sorts live in the URL\n // (g<groupId>, groupBy, s<componentId>; see report-url-state.ts), so a\n // refresh or a shared link opens the report as it was seen. On by default; a\n // host that mounts several reports on one route, or uses query keys shaped\n // like g<n> or s<n> itself, turns it off.\n public readonly urlState = input<boolean>(true);\n\n // The report was deleted from its settings dialog — the host routes back to\n // the listing.\n public readonly deleted = output<number>();\n\n // The report was renamed (settings, or the agent) — the host can refresh a\n // breadcrumb / document title.\n public readonly renamed = output<Report>();\n\n // The viewer moved to another page. This view writes the URL itself (right\n // after this fires) — this is for hosts that track the open page for their\n // own reasons.\n public readonly pageChanged = output<number | null>();\n\n public readonly report = signal<Report | null>(null);\n public readonly editMode = signal(false);\n\n // The toolbar's zone indicator ('New York (EDT)'): the zone every date in\n // this report is filtered and grouped in. Empty when the server is too old\n // to send the effective zone, and the indicator is not shown.\n public readonly timezoneLabel = computed(() => {\n const effectiveTimezone = this.report()?.effectiveTimezone;\n\n return effectiveTimezone ? getTimezoneLabel(effectiveTimezone) : '';\n });\n\n // The page the canvas should open on, read from the URL once per report.\n // Cleared as soon as the canvas reports back, so a later in-app page change\n // is never fought by a stale value.\n public readonly pageId = signal<number | null>(null);\n\n // The page the chat is bound to: the one on screen. A report conversation\n // belongs to exactly one page, so this both scopes the conversation list and\n // becomes the new conversation's page. A signal because it feeds\n // [requestData] — changing it is what reloads the panel onto the new page's\n // conversations. Null until the canvas reports which page it opened on, which\n // keeps the chat from listing against a page guess.\n public readonly chatPageId = signal<number | null>(null);\n\n // What the chat sends with every conversation call: the report, and the page\n // it is bound to.\n //\n // reportPageId is OMITTED, not sent as null, while the open page is unknown.\n // The backend reads a PRESENT reportPageId of 0/null as \"the report's earlier,\n // page-less conversations\", so sending null before the canvas has reported in\n // would ask for the wrong list — and, worse, would bind a conversation started\n // in that window to no page at all.\n //\n // The chat is also held closed ([ready] in the template) until the page is\n // known, so this partial context is never actually sent: on a fresh load the\n // report has to arrive and the canvas has to render before any page exists,\n // and a list fetched in that window would be the whole report's conversations\n // — the unscoped list, shown and auto-selected before the real one lands.\n public readonly chatRequestData = computed<Record<string, unknown>>(() => {\n const reportPageId = this.chatPageId();\n\n return reportPageId === null\n ? { reportId: this.reportId() }\n : { reportId: this.reportId(), reportPageId };\n });\n\n // The report-level filter toolbar (fs-filter). Rebuilt whenever the loaded\n // report (and thus its groups) changes.\n public readonly reportFilterConfig = signal<FilterConfig | null>(null);\n\n // Gates the toolbar fs-filter so it isn't rendered when there is nothing to\n // put in it — no report-level filters and no group-by control.\n public readonly reportHasFilters = computed(() => {\n return this._reportGroups().length > 0 || !!this._groupByItem();\n });\n\n // fs-filter reads its config only once (at init). The template keys the\n // toolbar fs-filter on this signature so it's recreated (and re-reads the\n // rebuilt config) whenever the report-level filter set changes.\n public readonly reportFilterKey = computed(() => {\n return [\n // The effective zone is part of it too: a zone change re-resolves relative\n // presets, and the bar must be recreated to show the new days.\n this._filterState.timezone(),\n // The stored default is part of the signature: saving a new default in report\n // settings rebuilds the config, but without a key change fs-filter keeps\n // rendering the values it was created with until a full page reload.\n groupBySignature(this.report()),\n ...this._reportGroups().map((group) => `${group.id}:${group.level}:${group.label}:${defaultSignature(group)}`),\n ].join('|');\n });\n\n @ViewChild('split', { static: true })\n private _split!: ElementRef<HTMLDivElement>;\n\n @ViewChild('chatPanel', { static: true, read: ElementRef })\n private _chatPanel!: ElementRef<HTMLElement>;\n\n // Only the canvas knows which page is on screen, and a page-scoped export\n // has to ask it.\n @ViewChild(ReportCanvasComponent)\n private _canvas?: ReportCanvasComponent;\n\n private _reportData = inject(ReportData);\n private _reportAiChatData = inject(ReportAiChatData);\n private _router = inject(Router);\n private _route = inject(ActivatedRoute);\n private _filterState = inject(ReportFilterStateService);\n private _exportService = inject(ReportExportService);\n private _collector = inject(ReportExportCollectorService);\n private _process = inject(FsProcess);\n private _dialog = inject(MatDialog);\n private _destroyRef = inject(DestroyRef);\n private _zone = inject(NgZone);\n\n // The report whose URL state has been read. The URL is read only on a\n // report's first load; a reload after a chat or dialog edit keeps the state\n // in memory, which is newer than anything the URL holds.\n private _restoredReportId: number | null = null;\n\n // Whether the canvas has reported the open page for this report. Until it\n // has, the page param in the URL is the deep link still being honored, and\n // the URL writer leaves it alone.\n private _pageReported = false;\n\n // The canvas moved to another page. Merged into the single URL writer.\n private _pageWrite$ = new Subject<void>();\n\n constructor() {\n // Each chat turn carries what the viewer has on screen. Only the function\n // is set here; it is called when a turn is sent.\n this._reportAiChatData.turnData = () => ({ viewerState: this._chatViewerState() });\n\n // The ONE writer of this view's query params. Page moves and viewer-state\n // changes both funnel here, and auditTime(0) folds a burst (a bar re-sets\n // every group it shows) into a single write. Every write carries the whole\n // state, so a write that supersedes another loses nothing.\n merge(this._filterState.urlChanges(), this._pageWrite$)\n .pipe(\n auditTime(0),\n tap(() => this._writeUrl()),\n takeUntilDestroyed(this._destroyRef),\n )\n .subscribe();\n\n // Point the shared data gateway at the configured base first (before any\n // load below reads it).\n effect(() => {\n this._reportData.basePath = this.basePath();\n });\n\n // (Re)load whenever the host switches the report id.\n effect(() => {\n const reportId = this.reportId();\n\n // Seed the open page from the URL for this report. Read per load rather\n // than once at construction: the host may swap reports on the same route,\n // and each arrival carries its own ?page=.\n const pageId = this._pageIdFromUrl();\n\n // Only the report id and the page param re-run this. The view state below\n // is written here and read by the config build, so it stays untracked.\n untracked(() => {\n this.editMode.set(false);\n\n // A new report's pages are not this report's pages — drop the binding\n // until its canvas says which page it landed on.\n this.chatPageId.set(null);\n this.pageId.set(pageId);\n this._pageReported = false;\n\n if (reportId != null) {\n this._loadReport(reportId);\n } else {\n // Forget the restored report, so a host that comes back to it reads\n // the URL again.\n this._restoredReportId = null;\n this.report.set(null);\n this._buildReportConfig();\n }\n });\n });\n\n this._buildReportConfig();\n }\n\n public toggleEditMode(): void {\n this.editMode.update((editMode) => !editMode);\n }\n\n // The edit tools live in this toolbar, but the canvas owns what they act on\n // (the active page, the header/footer bands, which layer is live).\n public get isMasterMode(): boolean {\n return this._canvas?.masterMode() ?? false;\n }\n\n public addText(): void {\n this._canvas?.addText();\n }\n\n public toggleMasterMode(): void {\n this._canvas?.toggleMasterMode();\n }\n\n // Report settings — name, page size, orientation, layout mode, delete. The\n // dialog performs the delete itself; we react to what it reports back.\n public reportSettings(): void {\n const report = this.report();\n if (!report) {\n return;\n }\n\n const reportId = report.id;\n\n this._dialog.open<ReportSettingsComponent, unknown, ReportSettingsResult>(ReportSettingsComponent, {\n data: { report },\n width: '460px',\n })\n .afterClosed()\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe((result) => {\n if (result?.action === 'deleted') {\n this.deleted.emit(reportId);\n\n return;\n }\n\n if (result?.action === 'saved') {\n this._loadReport(reportId, true);\n }\n });\n }\n\n // Component settings — title, exact geometry, and the diagnostic views\n // (SQL, config, filter wiring).\n public componentSettings(component: ReportComponentModel): void {\n const report = this.report();\n if (!report) {\n return;\n }\n\n const reportId = report.id;\n\n const dialogRef = this._dialog.open<ComponentSettingsComponent, unknown, ComponentSettingsResult>(\n ComponentSettingsComponent,\n {\n data: { report, component },\n width: '640px',\n },\n );\n\n // Filter add/remove/level changes persist immediately inside the dialog (no\n // \"save\") and can leave it by an exit that carries no result, so they are\n // announced as they land. The reload waits for the close so the canvas isn't\n // re-rendering underneath an open dialog.\n let filtersChanged = false;\n dialogRef.componentInstance.filtersChanged\n .pipe(takeUntil(dialogRef.afterClosed()))\n .subscribe(() => filtersChanged = true);\n\n dialogRef.afterClosed()\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe((result) => {\n // The dialog confirms + performs the delete itself. The component is\n // gone from the report, so reload rather than patching it out locally —\n // its filters went with it, which the report bar has to be rebuilt for.\n if (result?.deleted) {\n this._loadReport(reportId);\n\n return;\n }\n\n // The report's filter groups changed, so the report bar and the\n // on-component strips have to be rebuilt from a fresh report.\n if (filtersChanged) {\n this._loadReport(reportId);\n\n return;\n }\n\n // Nothing else in the dialog touches the query — title and padding are\n // presentation. Repaint the one component it was opened for and leave\n // every other component's data, and its query, alone.\n if (result?.settings) {\n this._canvas?.applyComponentSettings(component.id, result.settings);\n }\n });\n }\n\n // The canvas moved to another page: reflect it in the URL so a refresh or a\n // shared link comes back here (the write itself is _writeUrl's).\n public onCanvasPageChanged(pageId: number | null): void {\n // The deep link has been consumed; from here the canvas owns the page.\n this.pageId.set(null);\n this.chatPageId.set(pageId);\n this._pageReported = true;\n this.pageChanged.emit(pageId);\n this._pageWrite$.next();\n }\n\n // The canvas changed the report's structure (added a page) — re-fetch so the\n // new page renders; the canvas lands the view on it.\n public onCanvasReportChanged(): void {\n const report = this.report();\n if (report) {\n this._loadReport(report.id);\n }\n }\n\n // Export the report to PowerPoint, entirely client-side (native editable\n // charts; page = slide). The dock shows progress until the file saves.\n public exportPowerpoint(): void {\n const report = this.report();\n if (!report) {\n return;\n }\n\n this._process.run(\n 'Exporting PowerPoint',\n this._exportService.powerpoint(report),\n );\n }\n\n // Export to PDF, entirely client-side (offscreen ECharts at 3×; page = PDF page).\n public exportPdf(): void {\n const report = this.report();\n if (!report) {\n return;\n }\n\n this._process.run(\n 'Exporting PDF',\n this._exportService.pdf(report),\n );\n }\n\n // The whole report as files in one action: the server writes one CSV per\n // component, each what the screen shows (a chart or KPI as drawn, at the\n // viewer's group-by grain; a list in full), and zips them foldered by page\n // with an Export Notes.txt that records the filters as the bar reads them.\n // Lists use their saved default sort; a header click is carried only by a\n // component's own CSV export. `thisPage` narrows it to the page the canvas is\n // showing. Unlike the PDF/PowerPoint exports the files are written\n // server-side, so they are not capped by what a slide can hold.\n public exportData(thisPage = false): void {\n const report = this.report();\n if (!report) {\n return;\n }\n\n const pageId = thisPage ? this._canvas?.activePage?.id ?? null : null;\n const filters = this._filterState.resolveForReport(report, pageId);\n const frequency = this._filterState.frequency();\n\n this._process.download(\n 'Exporting data',\n this._collector.getFilterSummary(report)\n .pipe(\n switchMap((lines) => this._reportData.exportReport(\n report.id,\n filters,\n pageId,\n frequency,\n lines,\n )),\n ),\n );\n }\n\n // React to each chat turn (fs-chat handles the request + persistence); we\n // only care about the report side effects this context's backend flags.\n public onChatResponse(response: FsAiChatResponse): void {\n const reportId = this.reportId();\n if (reportId == null) {\n return;\n }\n\n const reportResponse = response as FsAiChatResponse & ReportChatResponse;\n\n // A structural change or a rename both re-fetch the report (session filter\n // values survive); a rename additionally notifies the host so it can\n // refresh a breadcrumb / title.\n if (reportResponse.reportChanged || reportResponse.reportRenamed) {\n this._loadReport(reportId, !!reportResponse.reportRenamed);\n }\n }\n\n // Drag the divider between the chat and canvas panes (pointer-capture loop\n // outside Angular).\n public onResizeStart(event: PointerEvent): void {\n event.preventDefault();\n\n const handle = event.target as HTMLElement;\n handle.setPointerCapture(event.pointerId);\n this._split.nativeElement.classList.add('resizing');\n\n this._zone.runOutsideAngular(() => {\n const move = (e: PointerEvent) => this._resizeTo(e.clientX);\n const end = () => {\n handle.releasePointerCapture(event.pointerId);\n handle.removeEventListener('pointermove', move);\n handle.removeEventListener('pointerup', end);\n handle.removeEventListener('pointercancel', end);\n this._split.nativeElement.classList.remove('resizing');\n };\n\n handle.addEventListener('pointermove', move);\n handle.addEventListener('pointerup', end);\n handle.addEventListener('pointercancel', end);\n });\n }\n\n // What the viewer has on screen as a chat turn sends it. The canvas\n // selection counts only in edit mode: it is drawn only then, and it is kept\n // (not cleared) when edit mode is left.\n private _chatViewerState(): ReportChatViewerState {\n return {\n granularity: this._filterState.frequency(),\n selectedComponentId: this.editMode() ? this._canvas?.selectedComponentId() ?? null : null,\n filters: this._filterState.viewerFilters(),\n };\n }\n\n private _resizeTo(clientX: number): void {\n const rect = this._split.nativeElement.getBoundingClientRect();\n if (rect.width === 0) {\n return;\n }\n\n const ratio = (clientX - rect.left) / rect.width;\n const clamped = Math.min(0.8, Math.max(0.2, ratio));\n this._chatPanel.nativeElement.style.flexBasis = `${clamped * 100}%`;\n }\n\n // The page id sitting in the URL right now, or null when deep linking is off\n // or the value is not a usable id.\n private _pageIdFromUrl(): number | null {\n const param = this.pageQueryParam();\n if (!param) {\n return null;\n }\n\n const pageId = Number(this._route.snapshot.queryParamMap.get(param));\n\n return Number.isFinite(pageId) && pageId > 0 ? pageId : null;\n }\n\n // Writes the open page and the viewer state into the URL in one go. Only\n // the keys this view owns are touched ('merge'), and replaceUrl keeps the\n // writes out of the browser history: Back leaves the report rather than\n // walking every page and filter visited.\n private _writeUrl(): void {\n const report = this.report();\n\n // A report still on screen while the host's next one loads must not write\n // its state over the new report's URL.\n if (!report || report.id !== this.reportId()) {\n return;\n }\n\n const queryParams: Params = this.urlState()\n ? buildReportUrlParams(this._filterState.urlSnapshot(report), this._route.snapshot.queryParamMap)\n : {};\n\n const pageParam = this.pageQueryParam();\n if (pageParam && this._pageReported) {\n queryParams[pageParam] = this.chatPageId();\n }\n\n if (!Object.keys(queryParams).length) {\n return;\n }\n\n this._router.navigate([], {\n relativeTo: this._route,\n queryParams,\n queryParamsHandling: 'merge',\n replaceUrl: true,\n });\n }\n\n private _loadReport(reportId: number, emitRenamed = false): void {\n this._reportData.get(reportId)\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe((report: Report) => {\n // The URL is read once per report, on its first load; every later load\n // keeps the state in memory.\n const restore = this.urlState() && reportId !== this._restoredReportId\n ? readReportUrlParams(this._route.snapshot.queryParamMap)\n : null;\n this._restoredReportId = reportId;\n\n this.report.set(report);\n this._filterState.init(report, restore);\n this._buildReportConfig();\n\n if (emitRenamed) {\n this.renamed.emit(report);\n }\n });\n }\n\n // Report-level filter groups in their saved order — the ones that render in\n // the toolbar (component-level groups render on their components).\n private _reportGroups(): ReportFilterGroup[] {\n return (this.report()?.filterGroups ?? [])\n .filter((group) => group.level === 'report' || group.level === 'both')\n .sort((a, b) => a.order - b.order);\n }\n\n // (Re)build the toolbar fs-filter config — the report-level filter items and\n // then the group-by control.\n private _buildReportConfig(): void {\n const report = this.report();\n const reportId = report?.id ?? null;\n\n // Drop a grain the control no longer offers — the agent can narrow the list\n // mid-session, and an override the viewer can't see is worse than none.\n if (report && !isGranularityOffered(report, this._filterState.frequency())) {\n this._filterState.setFrequency(null);\n }\n\n const items = reportId\n ? this._reportGroups().map((group) =>\n filterItemForGroup(group, this._reportData, reportId, this._filterState.value(group.id)))\n : [];\n\n // The group-by control leads the bar, ahead of every filter: it sets the\n // grain the whole report is read at, so it is the first thing a viewer\n // decides. It is not a filter group — it re-buckets rows rather than\n // narrowing them — so it is placed here rather than ordered among them.\n const groupByItem = this._groupByItem();\n if (groupByItem) {\n items.unshift(groupByItem);\n }\n\n this.reportFilterConfig.set({\n // fs-filter never touches the URL or persists filter state: its keys are\n // not namespaced, it writes outside the router, and it would freeze a\n // rolling range as two dates. ReportFilterStateService owns the values,\n // and _writeUrl is the one writer of the URL.\n queryParam: false,\n persist: false,\n items,\n change: (query) => {\n for (const { groupId, value } of groupValuesFromQuery(query ?? {}, this._reportGroups())) {\n this._filterState.setValue(groupId, value);\n }\n // Not a filter group — the grain is read straight off the query.\n this._filterState.setFrequency((query?.[GROUP_BY_ITEM] as ChartGranularity) || null);\n },\n });\n }\n\n // The report's group-by control as an fs-filter item, or null when the report\n // has none to show. Seeded from the session state so the grain the viewer\n // picked survives the report being re-fetched after a chat edit.\n private _groupByItem(): IFilterConfigItem | null {\n const report = this.report();\n\n return report\n ? groupByFilterItem(report, this._filterState.frequency())\n : null;\n }\n}\n","<div class=\"fs-ai-report fs-column\">\n\n <div class=\"fs-ai-report__header fs-row.align-center\">\n <h2 class=\"fs-ai-report__title fs-flex\">{{ report()?.name }}</h2>\n\n @if (report()) {\n <!-- Report-level filters, inline with the toolbar actions. fs-filter\n reads its config once at init, so it's keyed on the filter\n signature: when the report-level filter set changes the block is\n recreated and re-reads the rebuilt config. -->\n @if (reportHasFilters()) {\n @for (key of [reportFilterKey()]; track key) {\n <fs-filter\n class=\"fs-ai-report__filters\"\n [config]=\"reportFilterConfig()\">\n </fs-filter>\n }\n }\n\n <!-- What layout editing can add or switch to, and the way out of it.\n One style for all three — outlined, icon and text. \"Header & footer\"\n is a toggle: it keeps its label and turns gray while it is on. -->\n @if (editMode()) {\n <div class=\"fs-ai-report__edit-tools fs-row.align-center.gap-xs\">\n <button\n mat-stroked-button\n type=\"button\"\n matTooltip=\"Add a block of text\"\n (click)=\"addText()\">\n <mat-icon>title</mat-icon>\n Add text\n </button>\n <button\n mat-stroked-button\n type=\"button\"\n class=\"fs-ai-report__master\"\n [class.active]=\"isMasterMode\"\n [matTooltip]=\"isMasterMode ? 'Back to editing this page' : 'Edit the header and footer shown on every page'\"\n (click)=\"toggleMasterMode()\">\n <mat-icon>web_asset</mat-icon>\n Header & footer\n </button>\n <button\n mat-stroked-button\n type=\"button\"\n (click)=\"toggleEditMode()\">\n <mat-icon>check</mat-icon>\n Done editing\n </button>\n </div>\n }\n\n <!-- The zone every date in this report is filtered and grouped in, the\n same for every viewer. Shown only when the server sends it; a click\n opens Report settings, where it is changed. -->\n @if (report()?.effectiveTimezone; as effectiveTimezone) {\n <button\n mat-button\n type=\"button\"\n class=\"fs-ai-report__timezone\"\n [matTooltip]=\"'Dates are filtered and grouped in ' + effectiveTimezone + ' for everyone. Change it in Report settings.'\"\n (click)=\"reportSettings()\">\n <mat-icon>schedule</mat-icon>\n {{ timezoneLabel() }}\n </button>\n }\n\n <!-- One icon for both states: it reads as pressed while editing rather\n than swapping to something else. -->\n <button\n mat-icon-button\n type=\"button\"\n class=\"fs-ai-report__toggle\"\n [class.active]=\"editMode()\"\n [matTooltip]=\"editMode() ? 'Done editing' : 'Edit layout'\"\n (click)=\"toggleEditMode()\">\n <mat-icon>dashboard_customize</mat-icon>\n </button>\n\n <button\n mat-icon-button\n type=\"button\"\n matTooltip=\"Export\"\n [fsMenuTriggerFor]=\"exportMenu\">\n <mat-icon>download</mat-icon>\n </button>\n <fs-menu #exportMenu>\n <ng-template\n fs-menu-item\n (click)=\"exportPowerpoint()\">\n Export PowerPoint\n </ng-template>\n <ng-template\n fs-menu-item\n (click)=\"exportPdf()\">\n Export PDF\n </ng-template>\n <ng-template\n fs-menu-item\n (click)=\"exportData()\">\n Export Raw Data\n </ng-template>\n @if ((report()?.pages?.length ?? 0) > 1) {\n <ng-template\n fs-menu-item\n (click)=\"exportData(true)\">\n Export Raw Data (This Page)\n </ng-template>\n }\n </fs-menu>\n\n <button\n mat-icon-button\n type=\"button\"\n matTooltip=\"Report settings\"\n (click)=\"reportSettings()\">\n <mat-icon>settings</mat-icon>\n </button>\n }\n </div>\n\n <div\n #split\n class=\"fs-ai-report__split fs-row.align-start\">\n <fs-ai-chat\n #chatPanel\n class=\"chat\"\n [basePath]=\"basePath()\"\n [requestData]=\"chatRequestData()\"\n [ready]=\"chatPageId() !== null\"\n (response)=\"onChatResponse($event)\">\n </fs-ai-chat>\n\n <div\n class=\"resizer\"\n (pointerdown)=\"onResizeStart($event)\">\n </div>\n\n <div class=\"viewer fs-flex fs-column\">\n @if (report()) {\n <app-report-canvas\n [report]=\"report()\"\n [editMode]=\"editMode()\"\n [pageId]=\"pageId()\"\n (componentSettings)=\"componentSettings($event)\"\n (reportChanged)=\"onCanvasReportChanged()\"\n (pageChanged)=\"onCanvasPageChanged($event)\">\n </app-report-canvas>\n }\n </div>\n </div>\n</div>\n","/*\n * Public API Surface of @firestitch/reports\n *\n * The AI-built report viewer/editor, its data gateway, session filter state and\n * renderer components. The host app only needs ReportComponent (route it) —\n * everything else is internal wiring. The AI chat is provided by @firestitch/ai.\n */\nexport { ReportComponent } from './app/reports/views/report/report.component';\n// Split, routing-free surface: a reports listing and a single-report view. The\n// host routes between them and passes [reportId] into FsAiReportComponent.\nexport { FsAiReportsComponent } from './app/reports/views/reports/fs-ai-reports.component';\nexport { FsAiReportComponent } from './app/reports/views/report/fs-ai-report.component';\nexport { ReportData } from './app/reports/data/report.data';\nexport { ReportService } from './app/reports/services/report.service';\nexport { ReportFilterStateService } from './app/reports/services/report-filter-state.service';\nexport * from './app/reports/interfaces/report.interface';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["rxFilter","TOKENS","map","i1","i2","switchMap","tap","i3","i4","i6","i9","MatOption","TITLE_H"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAk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