@firestitch/report 18.8.0 → 18.9.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.
- package/app/reports/components/component-text/component-text.component.d.ts +47 -2
- package/app/reports/components/component-text/value-embed.plugin.d.ts +67 -0
- package/app/reports/components/report-canvas/report-canvas.component.d.ts +34 -9
- package/app/reports/components/report-component/report-component.component.d.ts +10 -1
- package/app/reports/data/report.data.d.ts +2 -1
- package/app/reports/dialogs/component-settings/component-settings.component.d.ts +8 -0
- package/app/reports/enums/report-value-formula.enum.d.ts +6 -0
- package/app/reports/export/report-export-collector.service.d.ts +24 -0
- package/app/reports/export/report-export.service.d.ts +3 -1
- package/app/reports/export/report-pdf.service.d.ts +18 -2
- package/app/reports/export/report-pptx.service.d.ts +15 -2
- package/app/reports/export/report-text-layout.service.d.ts +35 -0
- package/app/reports/format.d.ts +5 -1
- package/app/reports/interfaces/report.interface.d.ts +22 -3
- package/app/reports/layout.d.ts +2 -0
- package/app/reports/services/report-filter-state.service.d.ts +1 -1
- package/app/reports/text.d.ts +50 -0
- package/app/reports/theme/palette.d.ts +2 -0
- package/app/reports/values.d.ts +17 -0
- package/esm2022/app/reports/components/component-text/component-text.component.mjs +213 -16
- package/esm2022/app/reports/components/component-text/value-embed.plugin.mjs +484 -0
- package/esm2022/app/reports/components/report-canvas/report-canvas.component.mjs +260 -34
- package/esm2022/app/reports/components/report-component/report-component.component.mjs +65 -19
- package/esm2022/app/reports/data/report.data.mjs +19 -1
- package/esm2022/app/reports/dialogs/component-settings/component-settings.component.mjs +134 -23
- package/esm2022/app/reports/enums/report-value-formula.enum.mjs +14 -0
- package/esm2022/app/reports/export/report-export-collector.service.mjs +170 -44
- package/esm2022/app/reports/export/report-export.service.mjs +57 -19
- package/esm2022/app/reports/export/report-pdf.service.mjs +339 -96
- package/esm2022/app/reports/export/report-pptx.service.mjs +316 -88
- package/esm2022/app/reports/export/report-text-layout.service.mjs +241 -0
- package/esm2022/app/reports/format.mjs +41 -10
- package/esm2022/app/reports/interfaces/report.interface.mjs +1 -1
- package/esm2022/app/reports/kpi-card.mjs +19 -6
- package/esm2022/app/reports/layout.mjs +11 -1
- package/esm2022/app/reports/option-builder.mjs +18 -5
- package/esm2022/app/reports/output-notes.mjs +57 -11
- package/esm2022/app/reports/services/report-filter-state.service.mjs +19 -10
- package/esm2022/app/reports/text.mjs +293 -85
- package/esm2022/app/reports/theme/palette.mjs +7 -2
- package/esm2022/app/reports/values.mjs +183 -0
- package/esm2022/app/reports/views/report/fs-ai-report.component.mjs +4 -1
- package/esm2022/app/reports/views/report/report.component.mjs +4 -1
- package/esm2022/public_api.mjs +2 -1
- package/fesm2022/{firestitch-report-echarts-qCBE3LqM.mjs → firestitch-report-echarts-DBMOHmBF.mjs} +2 -2
- package/fesm2022/{firestitch-report-echarts-qCBE3LqM.mjs.map → firestitch-report-echarts-DBMOHmBF.mjs.map} +1 -1
- package/fesm2022/{firestitch-report-firestitch-report-DbsWbE-j.mjs → firestitch-report-firestitch-report-CqbXT1gh.mjs} +3492 -1028
- package/fesm2022/firestitch-report-firestitch-report-CqbXT1gh.mjs.map +1 -0
- package/fesm2022/firestitch-report.mjs +1 -1
- package/package.json +1 -1
- package/public_api.d.ts +1 -0
- package/fesm2022/firestitch-report-firestitch-report-DbsWbE-j.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firestitch-report-firestitch-report-CqbXT1gh.mjs","sources":["../../src/app/reports/data/report.data.ts","../../src/app/reports/layout.ts","../../src/app/reports/consts/report-week.const.ts","../../src/app/reports/enums/report-list-column-format.enum.ts","../../src/app/reports/enums/report-number-units.enum.ts","../../src/app/reports/enums/report-value-format.enum.ts","../../src/app/reports/format.ts","../../src/app/reports/interfaces/report.interface.ts","../../src/app/reports/list-config.ts","../../src/app/reports/report-filter-items.ts","../../src/app/reports/report-url-state.ts","../../src/app/reports/enums/report-value-formula.enum.ts","../../src/app/reports/text.ts","../../src/app/reports/values.ts","../../src/app/reports/services/report-filter-state.service.ts","../../src/app/reports/dialogs/list-columns/list-columns.component.ts","../../src/app/reports/dialogs/list-columns/list-columns.component.html","../../src/app/reports/enums/report-change-polarity.enum.ts","../../src/app/reports/enums/report-kpi-trend.enum.ts","../../src/app/reports/kpi-card.ts","../../src/app/reports/enums/report-chart-color.enum.ts","../../src/app/reports/enums/report-chart-data-labels.enum.ts","../../src/app/reports/enums/report-chart-date-label.enum.ts","../../src/app/reports/enums/report-chart-line-style.enum.ts","../../src/app/reports/enums/report-chart-mark-stat.enum.ts","../../src/app/reports/theme/palette.ts","../../src/app/reports/theme/typography.ts","../../src/app/reports/option-builder.ts","../../src/app/reports/output-notes.ts","../../src/app/reports/components/component-note/component-note.component.ts","../../src/app/reports/components/component-note/component-note.component.html","../../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/components/sparkline/sparkline.component.ts","../../src/app/reports/components/component-kpi/components/sparkline/sparkline.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/pipes/report-number.pipe.ts","../../src/app/reports/pipes/report-output.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/value-embed.plugin.ts","../../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-locale-patch.ts","../../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-text-layout.service.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 ReportLocales,\n ReportPageValue,\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, timezone,\n // locale, currency, styles, headerFooter } — styles carry the\n // report's typographic config (e.g. heading size), headerFooter the\n // header/footer band depths in inches. The page size is in inches and\n // width/height go together. locale (a BCP 47 tag) and currency (an ISO 4217\n // code) are each sent only to change them; '' returns the report to the\n // default, and the currency only names what the amounts are in.\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) 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).\n public savePositions(\n reportId: number,\n positions: ({ componentId: number } & Partial<{ x: number; y: number; w: number; h: 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 // The numbers of a page's values — or the master's, for the header and\n // footer — in one request: a row per value that page reads, shown by some\n // text or read by a formula it shows (ReportPageValue). `filters` carries\n // the resolved values for every value of the layer together; each value the\n // server reads picks out its own. `isExport` is componentData's.\n //\n // The server reads one statement per distinct query (values sharing a\n // query and its filters are folded into one; a formula runs none) and may\n // stream a keepAlive pulse before each, so a slow page never sits silent\n // until the connection drops. The body stays one JSON with the rows at data.values,\n // which FsApi reads with the 'values' key, as exportComponent's streamed\n // response is read.\n public pageValues(\n reportId: number,\n pageId: number,\n filters: ResolvedFilterValue[] = [],\n isExport = false,\n config: RequestConfig = {},\n ): Observable<ReportPageValue[]> {\n return this._api.post(\n this._path(`${reportId}/pages/${pageId}/values`),\n { filters, export: isExport },\n {\n key: 'values',\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 // The locales and currencies a report can be written in, for the report\n // settings' Locale and Currency selects: the default locale, each offered\n // locale with the currency a report in it uses when it names none, and every\n // currency code. Only a server that sends effectiveLocale has this route.\n public locales(config: RequestConfig = {}): Observable<ReportLocales> {\n return this._api.get(\n this._path('locales'),\n {},\n {\n key: 'locales',\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 { ReportComponent } from './interfaces/report.interface';\n\n\n// Default content padding around a component's body, inches (1/8\").\nexport const DEFAULT_COMPONENT_PADDING = 0.125;\n\n// A component's content padding as a CSS padding: each edge in inches (a CSS\n// inch is 96px, the canvas's own), DEFAULT_COMPONENT_PADDING unless set. The\n// canvas pads a component's body with it, and the export measure\n// (ReportTextLayoutService) its offscreen copy of a text block, so the two\n// boxes are one.\nexport function componentPaddingCss(component: ReportComponent): string {\n const padding = component.config?.padding;\n const edge = (value: number | undefined) => `${value ?? DEFAULT_COMPONENT_PADDING}in`;\n\n return `${edge(padding?.top)} ${edge(padding?.right)} ${edge(padding?.bottom)} ${edge(padding?.left)}`;\n}\n\n// Default report heading size, points (1/72\"). Applies to component titles.\nexport const DEFAULT_HEADING_SIZE = 16;\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","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","// How a list column's cells are shown: a list column's `format`. date renders\n// a raw timestamp as a day in the report's zone and locale; number, percent\n// and currency format the value as a KPI measure does (ReportValueFormat). A\n// column without a format prints its value as it came.\n//\n// Mirrors the server's ListColumnFormatEnum value for value.\nexport enum ReportListColumnFormat {\n Date = 'date',\n Number = 'number',\n Percent = 'percent',\n Currency = 'currency',\n}\n","// How a formatted number is abbreviated: a number slot's `units`. thousands\n// writes 1,200 as 1.2K and millions 3,400,000 as 3.4M; auto picks by size\n// (once per chart on a value axis, per value everywhere else); none, like no\n// units at all, writes the full number. Units never apply to a percent.\n//\n// Mirrors the server's NumberUnitsEnum value for value.\nexport enum ReportNumberUnits {\n None = 'none',\n Thousands = 'thousands',\n Millions = 'millions',\n Auto = 'auto',\n}\n","// How a measure's value is shown: a chart measure's and a KPI measure's\n// `format`. The data stays raw; only the renderers format it. percent takes a\n// 0-1 ratio (0.3 reads 30%) when the report's percentFormat is 'ratio', and\n// currency labels the amount in the report's currency (nothing is converted).\n//\n// Mirrors the server's ValueFormatEnum value for value.\nexport enum ReportValueFormat {\n Number = 'number',\n Percent = 'percent',\n Currency = 'currency',\n}\n","import { addDays, isValid, parseISO } from 'date-fns';\nimport { formatInTimeZone, toZonedTime } from 'date-fns-tz';\n\nimport { ReportListColumnFormat } from './enums/report-list-column-format.enum';\nimport { ReportNumberUnits } from './enums/report-number-units.enum';\nimport { ReportValueFormat } from './enums/report-value-format.enum';\nimport {\n ChartGranularity,\n ChartMeasure,\n ComparisonAgainst,\n ComparisonNoteCode,\n ComparisonOffset,\n ComparisonWindow,\n ComponentComparison,\n KpiNoteCode,\n NumberFormatSpec,\n OutputMeta,\n OutputRole,\n Report,\n ReportCurrencyCode,\n ReportFormatContext,\n ReportLocaleTag,\n WindowMeta,\n WindowNoteCode,\n} from './interfaces/report.interface';\n\n\n// What a report reads when the server names no usable locale or currency: an\n// older server that sends neither, or a value this browser's Intl cannot use.\n// Never the browser's own locale, so every viewer of a report sees the same text.\nexport const REPORT_FALLBACK_LOCALE: ReportLocaleTag = 'en-US';\nexport const REPORT_FALLBACK_CURRENCY: ReportCurrencyCode = 'USD';\n\nexport const DEFAULT_FORMAT_CONTEXT: Readonly<ReportFormatContext> = Object.freeze({\n locale: REPORT_FALLBACK_LOCALE,\n currency: REPORT_FALLBACK_CURRENCY,\n ratioPercent: true,\n});\n\nconst CURRENCY_PATTERN = /^[A-Z]{3}$/;\n\n\n// The server's resolved locale as one this browser can format in. A malformed\n// tag ('en_CA') makes supportedLocalesOf throw, and one Intl has no data for\n// ('xx-YY') comes back empty; both read the fallback.\nexport function resolveReportLocale(tag: string | null | undefined): ReportLocaleTag {\n if (!tag) {\n return REPORT_FALLBACK_LOCALE;\n }\n\n try {\n return Intl.NumberFormat.supportedLocalesOf([tag])[0] ?? REPORT_FALLBACK_LOCALE;\n } catch {\n return REPORT_FALLBACK_LOCALE;\n }\n}\n\n// The server's resolved currency as one Intl can label. The server decides\n// which codes name money; this only guards against a code Intl cannot take at\n// all. It is never checked against the runtime's own currency list, which\n// differs between browsers and leaves out codes the server offers (VEF, MRO),\n// so every viewer labels a report's money the same way.\nexport function resolveReportCurrency(code: string | null | undefined): ReportCurrencyCode {\n if (!code || !CURRENCY_PATTERN.test(code)) {\n return REPORT_FALLBACK_CURRENCY;\n }\n\n try {\n numberFormat(REPORT_FALLBACK_LOCALE, { style: 'currency', currency: code });\n\n return code;\n } catch {\n return REPORT_FALLBACK_CURRENCY;\n }\n}\n\n// The one place a report's format context is built: the server's effective\n// locale and currency (absent on an older server, which then reads en-US/USD)\n// and whether its percent measures arrive as 0-1 ratios.\nexport function resolveFormatContext(\n report: Pick<Report, 'effectiveLocale' | 'effectiveCurrency' | 'percentFormat'>,\n): ReportFormatContext {\n return {\n locale: resolveReportLocale(report.effectiveLocale),\n currency: resolveReportCurrency(report.effectiveCurrency),\n ratioPercent: report.percentFormat === 'ratio',\n };\n}\n\n\n// Building an Intl formatter is far slower than using one, and a chart formats\n// every tick and tooltip value, so each distinct locale + options (+ zone) is\n// built once and reused.\nconst NUMBER_FORMATS = new Map<string, Intl.NumberFormat>();\nconst DATE_FORMATS = new Map<string, Intl.DateTimeFormat>();\n\nexport function numberFormat(locale: string, options: Intl.NumberFormatOptions): Intl.NumberFormat {\n const key = `${locale}|${JSON.stringify(options)}`;\n let formatter = NUMBER_FORMATS.get(key);\n\n if (!formatter) {\n formatter = new Intl.NumberFormat(locale, options);\n NUMBER_FORMATS.set(key, formatter);\n }\n\n return formatter;\n}\n\n// No zone formats in the browser's own zone, which is right for a calendar day\n// parsed as local midnight: the day printed is the day stored.\nexport function dateFormat(\n locale: string,\n options: Intl.DateTimeFormatOptions,\n timeZone?: string,\n): Intl.DateTimeFormat {\n const key = `${locale}|${JSON.stringify(options)}|${timeZone ?? ''}`;\n let formatter = DATE_FORMATS.get(key);\n\n if (!formatter) {\n formatter = new Intl.DateTimeFormat(locale, { ...options, timeZone });\n DATE_FORMATS.set(key, formatter);\n }\n\n return formatter;\n}\n\n\n// Number formatting: the one engine behind every numeric slot (a chart\n// measure, a KPI measure, a list column, a cross-tab's cells), so a format\n// means the same thing on screen, in the PDF and in PowerPoint. The data stays\n// raw; only what is shown changes. The rules:\n// - Empty: null, undefined, '', '-' and a non-finite number print the caller's\n// `empty` ('—' unless it names another).\n// - Numeric: a finite number, or a string that spells one plainly ('1234.50',\n// '-3e2'). Anything else ('$1,234', an id with letters, ' ') prints as it\n// came, since a column the SQL already formatted is text.\n// - Styles: number is a plain decimal; currency is the report's currency\n// written in its locale with its symbol (USD reads '$1,235' in en-US and\n// 'US$1,235' in en-CA; EUR reads '1 235 €' in fr-FR); percent takes a 0-1\n// ratio (0.3 reads 30%), or, from an older server that sends percent values\n// already x100, a decimal with a % sign. Precision or units without a format\n// mean number.\n// - Decimals: a precision pins both the minimum and the maximum, so a column\n// of rates lines up. Without one: at most one for a percent and for an\n// abbreviated value (1.2K), whole units for currency, the locale's default\n// for a number.\n// - Units: thousands and millions divide and add a K or M after the digits\n// ('$1.2K', '1,2K $'); auto picks per value by size, and a value that would\n// round to 1000K reads 1M. Units never apply to a percent.\n// - Negatives keep the locale's leading minus. A negative that rounds to zero\n// prints as zero, never '-0'.\n// - Rounding is Intl's, on the digits shown. Every value is written in the\n// context's locale, never the browser's.\n\n// The most decimals a precision pins: the server's schema bound.\nconst MAX_PRECISION = 6;\n// At most one decimal for a percent, and for an abbreviated value (1.2K).\nconst PERCENT_DECIMALS = 1;\nconst SCALED_DECIMALS = 1;\n// Money shows whole units unless a precision asks for decimals.\nconst CURRENCY_DECIMALS = 0;\n// A currency axis whose ticks need decimals shows cents, not tenths.\nconst CURRENCY_AXIS_DECIMALS = 2;\n// What a missing value prints unless the caller names its own.\nconst EMPTY_VALUE = '—';\n// The tick count a value axis aims for, as ECharts' splitNumber default.\nconst AXIS_TICKS = 5;\n\n// A change's sign: a plus on a positive value, nothing on zero.\nconst SIGNED: Intl.NumberFormatOptions = { signDisplay: 'exceptZero' };\n\nconst NUMERIC_PATTERN = /^\\s*[-+]?(\\d+\\.?\\d*|\\.\\d+)([eE][-+]?\\d+)?\\s*$/;\n// The formatToParts types that carry a number's digits and separators.\nconst NUMBER_PARTS = new Set<Intl.NumberFormatPartTypes>(['integer', 'group', 'decimal', 'fraction']);\nconst DIGIT_PARTS = new Set<Intl.NumberFormatPartTypes>(['integer', 'fraction']);\n\n// A numeric format's units once decided: auto is resolved to one of these.\nexport type ResolvedUnits = ReportNumberUnits.None | ReportNumberUnits.Thousands | ReportNumberUnits.Millions;\n\ninterface UnitScale {\n divisor: number;\n suffix: string;\n // The PowerPoint/Excel scaling commas: each one divides by 1,000.\n commas: string;\n}\n\nconst UNIT_SCALES = new Map<ResolvedUnits, UnitScale>([\n [ReportNumberUnits.Thousands, { divisor: 1e3, suffix: 'K', commas: ',' }],\n [ReportNumberUnits.Millions, { divisor: 1e6, suffix: 'M', commas: ',,' }],\n]);\n\nexport interface FormatNumberOptions {\n // What an empty value prints: '—' for a KPI or a tooltip, '' for a cell.\n empty?: string;\n // Units already decided for the whole chart, in place of the spec's own.\n units?: ResolvedUnits;\n // Decimals already decided for the whole chart, pinned as min and max. null\n // leaves the spec's own.\n decimals?: number | null;\n // Writes a plus before a positive value, as a change reads ('+12%'). Zero,\n // and a value whose shown digits are all zero, stays unsigned.\n signed?: boolean;\n}\n\n// How a chart's value axis writes its ticks, decided once per chart.\nexport interface ChartNumberFormat {\n units: ResolvedUnits;\n // Pinned decimals, or null for a plain number whose ticks keep their own.\n decimals: number | null;\n}\n\n// The value as a finite number when it is one or plainly spells one, else\n// null.\nexport function toFiniteNumber(value: unknown): number | null {\n if (typeof value === 'number') {\n return Number.isFinite(value) ? value : null;\n }\n\n if (typeof value !== 'string' || !NUMERIC_PATTERN.test(value)) {\n return null;\n }\n\n const numeric = Number(value);\n\n return Number.isFinite(numeric) ? numeric : null;\n}\n\n// Whether a slot asks to be formatted at all. A slot without these keys, or a\n// list column whose format is date, keeps its own rendering. Units none is the\n// same as no units key, as it is on the server.\nexport function hasNumberFormat(spec?: NumberFormatSpec | null): boolean {\n if (!spec || spec.format === ReportListColumnFormat.Date) {\n return false;\n }\n\n return valueFormat(spec) !== null\n || (spec.precision ?? null) !== null\n || ((spec.units ?? ReportNumberUnits.None) !== ReportNumberUnits.None);\n}\n\n// The units a value is written in. auto decides by the magnitude: a million\n// and up reads M, a thousand and up K, unless the value would then round to\n// 1000K at these decimals, which reads 1M instead.\nexport function resolveUnits(\n units: ReportNumberUnits | null | undefined,\n magnitude: number,\n decimals: number,\n): ResolvedUnits {\n switch (units) {\n case ReportNumberUnits.Thousands:\n case ReportNumberUnits.Millions:\n return units;\n case ReportNumberUnits.Auto:\n return autoUnits(Math.abs(magnitude), decimals);\n default:\n return ReportNumberUnits.None;\n }\n}\n\nfunction autoUnits(magnitude: number, decimals: number): ResolvedUnits {\n if (magnitude >= 1e6) {\n return ReportNumberUnits.Millions;\n }\n\n if (magnitude < 1e3) {\n return ReportNumberUnits.None;\n }\n\n return roundTo(magnitude / 1e3, decimals) >= 1000\n ? ReportNumberUnits.Millions\n : ReportNumberUnits.Thousands;\n}\n\n// The value rounded as Intl rounds it for display, so the K-to-M promotion\n// agrees with the digits actually shown.\nfunction roundTo(value: number, decimals: number): number {\n const digits = clampDecimals(decimals) ?? 0;\n\n // A fixed locale only so Number() can parse the rounded digits back.\n return Number(numberFormat(REPORT_FALLBACK_LOCALE, {\n useGrouping: false,\n minimumFractionDigits: 0,\n maximumFractionDigits: digits,\n }).format(value));\n}\n\n// One value, written by the rules above.\nexport function formatNumber(\n value: unknown,\n spec: NumberFormatSpec | null | undefined,\n context: ReportFormatContext,\n options: FormatNumberOptions = {},\n): string {\n if (isEmptyValue(value)) {\n return options.empty ?? EMPTY_VALUE;\n }\n\n const numeric = toFiniteNumber(value);\n if (numeric === null) {\n return String(value);\n }\n\n const style = resolveStyle(spec);\n const precision = clampDecimals(spec?.precision);\n const units = style === ReportValueFormat.Percent\n ? ReportNumberUnits.None\n : options.units ?? resolveUnits(spec?.units, numeric, precision ?? SCALED_DECIMALS);\n const scale = UNIT_SCALES.get(units);\n const decimals = clampDecimals(options.decimals) ?? precision;\n const formatter = numberFormat(context.locale, {\n ...styleOptions(style, context, decimals, !!scale),\n ...(options.signed ? SIGNED : {}),\n });\n const text = writeNumber(formatter, (numeric === 0 ? 0 : numeric) / (scale?.divisor ?? 1), scale?.suffix);\n\n return style === ReportValueFormat.Percent && !context.ratioPercent ? `${text}%` : text;\n}\n\nfunction isEmptyValue(value: unknown): boolean {\n return value === null\n || value === undefined\n || value === ''\n || value === '-'\n || (typeof value === 'number' && !Number.isFinite(value));\n}\n\n// The value format a slot names, or null when it names none (or only date).\nfunction valueFormat(spec: NumberFormatSpec | null | undefined): ReportValueFormat | null {\n return Object.values(ReportValueFormat).find((format) => format === spec?.format) ?? null;\n}\n\nfunction resolveStyle(spec: NumberFormatSpec | null | undefined): ReportValueFormat {\n return valueFormat(spec) ?? ReportValueFormat.Number;\n}\n\n// A usable decimal count, or null. A stored value outside the schema's bounds\n// is brought inside them rather than thrown on by Intl.\nfunction clampDecimals(decimals: number | null | undefined): number | null {\n return typeof decimals === 'number' && Number.isFinite(decimals)\n ? Math.min(MAX_PRECISION, Math.max(0, Math.round(decimals)))\n : null;\n}\n\nfunction styleOptions(\n style: ReportValueFormat,\n context: ReportFormatContext,\n decimals: number | null,\n scaled: boolean,\n): Intl.NumberFormatOptions {\n const fractionDigits = fractionDigitOptions(decimals, defaultDecimals(style, scaled));\n\n switch (style) {\n case ReportValueFormat.Currency:\n return { ...currencyOptions(context.currency), ...fractionDigits };\n case ReportValueFormat.Percent:\n return context.ratioPercent ? { style: 'percent', ...fractionDigits } : fractionDigits;\n default:\n return fractionDigits;\n }\n}\n\nfunction currencyOptions(currency: ReportCurrencyCode): Intl.NumberFormatOptions {\n return { style: 'currency', currency, currencyDisplay: 'symbol' };\n}\n\n// The most decimals a style shows when nothing pins them; null leaves Intl's\n// own default.\nfunction defaultDecimals(style: ReportValueFormat, scaled: boolean): number | null {\n if (scaled) {\n return SCALED_DECIMALS;\n }\n\n switch (style) {\n case ReportValueFormat.Percent:\n return PERCENT_DECIMALS;\n case ReportValueFormat.Currency:\n return CURRENCY_DECIMALS;\n default:\n return null;\n }\n}\n\n// Pinned decimals set both bounds. Otherwise a maximum also sets the minimum\n// to zero, so no engine throws on a maximum below a currency's own minimum.\nfunction fractionDigitOptions(pinned: number | null, maximum: number | null): Intl.NumberFormatOptions {\n if (pinned !== null) {\n return { minimumFractionDigits: pinned, maximumFractionDigits: pinned };\n }\n\n return maximum === null ? {} : { minimumFractionDigits: 0, maximumFractionDigits: maximum };\n}\n\n// The formatted value, with the units letter after its digits. A negative\n// whose shown digits are all zero is written as zero, so no '-0' appears.\nfunction writeNumber(formatter: Intl.NumberFormat, value: number, suffix?: string): string {\n if (value >= 0 && !suffix) {\n return formatter.format(value);\n }\n\n const parts = formatter.formatToParts(value);\n\n if (value < 0 && !hasNonZeroDigit(formatter, parts)) {\n return writeNumber(formatter, 0, suffix);\n }\n\n if (!suffix) {\n return parts.map((part) => part.value).join('');\n }\n\n const last = parts.reduce((found, part, index) => NUMBER_PARTS.has(part.type) ? index : found, -1);\n\n return [\n ...parts.slice(0, last + 1).map((part) => part.value),\n suffix,\n ...parts.slice(last + 1).map((part) => part.value),\n ].join('');\n}\n\n// Compared with the locale's own zero, so a numbering system other than\n// 0-9 is read correctly.\nfunction hasNonZeroDigit(formatter: Intl.NumberFormat, parts: Intl.NumberFormatPart[]): boolean {\n const zero = formatter.formatToParts(0).find((part) => part.type === 'integer')?.value ?? '0';\n\n return parts.some((part) => DIGIT_PARTS.has(part.type)\n && Array.from(part.value).some((character) => character !== zero));\n}\n\n\n// Output values: a column the server marks in ComponentData.outputs (a\n// compared value, a rank, a share) written by what it is. The data stays raw;\n// every number still goes through formatNumber. The rules:\n// - The format: a slot's own explicit format always wins. Otherwise a current,\n// prior or change column takes its source measure's format; a percent change\n// is a percent; a rank is a whole number; a share is a percent to 1 decimal.\n// An own precision or units still applies over those defaults.\n// - Signs: a change and a percent change are signed ('+579', '-31.1%'),\n// unless the caller's `signed` says otherwise.\n// - Points: a change of a percent-format value, and any share change, is a\n// difference of two rates, so it prints in percentage points, signed and to\n// 1 decimal unless a precision pins others: 0.1 reads '+10.0 pp' ('+10.0'\n// when the caller's `pointsUnit` is false).\n// - Missing: a missing prior, or a change or percent change left empty by\n// one, prints '—' titled with the floor ('No baseline: no data before\n// Mar 3, 2026'), or for a rank or a share with the period the row was\n// absent from ('No rank in the prior period'); a percent change over a prior of 0 prints 'n/a' titled\n// 'Prior was 0'. Any other missing value prints '—' (or the caller's empty).\n// - Rank change: prior minus current, so a rise is positive: '▲ 2', '▼ 1',\n// '–' for none, and 'new' for an empty change whose prior rank is missing\n// or not passed (a row always has a current rank, so only the prior lacks).\n// A percent change and a share are 0-1 fractions whatever the report's\n// percentFormat: the server computes them, never a stored value.\n\n// A missing comparison value prints EMPTY_VALUE whatever the caller's empty.\nconst NOT_APPLICABLE_VALUE = 'n/a';\nconst NEW_RANK_VALUE = 'new';\nconst RANK_UNCHANGED_VALUE = '–';\nconst RANK_UP_MARK = '▲';\nconst RANK_DOWN_MARK = '▼';\nconst POINTS_SUFFIX = 'pp';\nconst NO_PRIOR_RANK_TITLE = 'No rank in the prior period';\nconst NO_PRIOR_SHARE_TITLE = 'No share in the prior period';\n// Percentage points and a share are written to one decimal unless pinned.\nconst POINTS_DECIMALS = 1;\nconst SHARE_DECIMALS = 1;\n\nconst RANK_DEFAULT_SPEC: Readonly<NumberFormatSpec> = Object.freeze({ format: ReportValueFormat.Number, precision: 0 });\nconst SHARE_DEFAULT_SPEC: Readonly<NumberFormatSpec> = Object.freeze({\n format: ReportValueFormat.Percent,\n precision: SHARE_DECIMALS,\n});\nconst PERCENT_CHANGE_DEFAULT_SPEC: Readonly<NumberFormatSpec> = Object.freeze({ format: ReportValueFormat.Percent });\n\nexport interface OutputValueOptions {\n // The source measure's format (OutputMeta.measure's slot), which a current,\n // prior or change column takes when its own slot names none.\n measureSpec?: NumberFormatSpec | null;\n // The row's prior value in the same lane (see laneOutputAlias), for a change\n // or a percent change: it tells a missing baseline ('—') from a zero one\n // ('n/a'), and a new rank from an unranked row. Leave it out when unknown.\n prior?: unknown;\n // ComponentData.comparison.floor: the first day with data, named in the\n // no-baseline title.\n floor?: string | null;\n // What a missing current or plain value prints ('' for a cell). A missing\n // comparison value always prints '—'.\n empty?: string;\n // Whether the value prints a plus when positive, over its role's default (a\n // change and a percent change are signed, nothing else is). A formula value\n // sets it from its own `signed`, so it can drop a change's sign or ask a\n // plain output for one.\n signed?: boolean;\n // Whether a change in percentage points ends in ' pp'. Omitted reads true.\n // A value inside text passes false: the words around its token carry the\n // unit ('pts', 'days faster').\n pointsUnit?: boolean;\n}\n\n// An output value as shown, and why it reads so when that is not obvious\n// (null otherwise): for a tooltip or a title attribute.\nexport interface FormattedOutputValue {\n text: string;\n title: string | null;\n}\n\n// One output value, written by the rules above. Without output metadata (a\n// plain measure column, an older server) it is formatNumber with the slot's\n// own format.\nexport function formatOutputValue(\n value: unknown,\n output: OutputMeta | null | undefined,\n spec: NumberFormatSpec | null | undefined,\n context: ReportFormatContext,\n options: OutputValueOptions = {},\n): FormattedOutputValue {\n if (!output) {\n return plainOutput(formatNumber(value, spec, context, { empty: options.empty }));\n }\n\n if (output.kind === 'rank' && output.role === 'change') {\n return formatRankChange(value, spec, context, options);\n }\n\n const role = output.role;\n const effective = outputFormatSpec(output, spec, options.measureSpec);\n\n if (isEmptyValue(value)) {\n return missingOutput(output, context, options);\n }\n\n const signed = options.signed ?? (role === 'change' || role === 'percent_change');\n\n if (role === 'change' && isPointsChange(output, effective)) {\n return plainOutput(formatPoints(value, output, effective, context, options.pointsUnit ?? true, signed));\n }\n\n const ratioContext = role === 'percent_change' || output.kind === 'share'\n ? { ...context, ratioPercent: true }\n : context;\n\n return plainOutput(formatNumber(value, effective, ratioContext, { signed }));\n}\n\n// The alias of the output that plays `role` in the same lane as `alias`: the\n// same measure and kind, and (for a prior, change or percent change) the same\n// prior lane. A measure compares against one lane only (two compares on one\n// value are two measures), so a current value's lane is whichever one its\n// measure's prior columns carry, lane 2 as readily as lane 1. A change column\n// finds its prior this way to pass as OutputValueOptions.prior. null when the\n// server sends no such column.\nexport function laneOutputAlias(\n outputs: Record<string, OutputMeta> | null | undefined,\n alias: string,\n role: OutputRole,\n): string | null {\n const source = outputs?.[alias];\n\n if (!source) {\n return null;\n }\n\n const anyLane = source.role === 'current' || source.offset === null;\n const found = Object.entries(outputs ?? {}).find(([, meta]) => meta.measure === source.measure\n && meta.kind === source.kind\n && meta.role === role\n && (role === 'current' || (anyLane ? meta.offset !== null : meta.offset === source.offset)));\n\n return found ? found[0] : null;\n}\n\nfunction plainOutput(text: string): FormattedOutputValue {\n return { text, title: null };\n}\n\n// The format an output is written in: the slot's own explicit format, else\n// the default for what it holds, with any own precision or units over it.\nfunction outputFormatSpec(\n output: OutputMeta,\n own: NumberFormatSpec | null | undefined,\n measureSpec: NumberFormatSpec | null | undefined,\n): NumberFormatSpec | null {\n if (valueFormat(own) !== null) {\n return own;\n }\n\n if (output.kind === 'rank') {\n return withOwnDigits(RANK_DEFAULT_SPEC, own);\n }\n\n if (output.kind === 'share') {\n return withOwnDigits(SHARE_DEFAULT_SPEC, own);\n }\n\n if (output.role === 'percent_change') {\n return withOwnDigits(PERCENT_CHANGE_DEFAULT_SPEC, own);\n }\n\n return measureSpec ? withOwnDigits(measureSpec, own) : own ?? null;\n}\n\n// The base format with the slot's own precision and units over it.\nfunction withOwnDigits(base: NumberFormatSpec, own: NumberFormatSpec | null | undefined): NumberFormatSpec {\n return {\n ...base,\n ...((own?.precision ?? null) !== null ? { precision: own.precision } : {}),\n ...((own?.units ?? null) !== null ? { units: own.units } : {}),\n };\n}\n\n// A change between two rates: a share's, or a percent-format value's.\nfunction isPointsChange(output: OutputMeta, spec: NumberFormatSpec | null): boolean {\n return output.kind === 'share' || resolveStyle(spec) === ReportValueFormat.Percent;\n}\n\n// A rate change in percentage points. A share and a 0-1 percent are scaled\n// x100; an older server's percent values already are. `unit` writes the ' pp'\n// after the digits, and `signed` the plus before a rise.\nfunction formatPoints(\n value: unknown,\n output: OutputMeta,\n spec: NumberFormatSpec | null,\n context: ReportFormatContext,\n unit: boolean,\n signed: boolean,\n): string {\n const numeric = toFiniteNumber(value);\n if (numeric === null) {\n return String(value);\n }\n\n const points = output.kind === 'share' || context.ratioPercent ? numeric * 100 : numeric;\n const decimals = clampDecimals(spec?.precision) ?? POINTS_DECIMALS;\n const text = formatNumber(points, { format: ReportValueFormat.Number }, context, { decimals, signed });\n\n return unit ? `${text} ${POINTS_SUFFIX}` : text;\n}\n\n// A missing output value. A missing prior, or a delta a missing prior left\n// empty, has no baseline; a percent change over a zero prior has none to\n// divide by.\nfunction missingOutput(\n output: OutputMeta,\n context: ReportFormatContext,\n options: OutputValueOptions,\n): FormattedOutputValue {\n const role = output.role;\n\n if (role === 'prior') {\n return { text: EMPTY_VALUE, title: missingPriorTitle(output, options.floor, context.locale) };\n }\n\n if (role === 'change' || role === 'percent_change') {\n const prior = options.prior;\n\n if (role === 'percent_change' && toFiniteNumber(prior) === 0) {\n return { text: NOT_APPLICABLE_VALUE, title: 'Prior was 0' };\n }\n\n return {\n text: EMPTY_VALUE,\n title: prior !== undefined && isEmptyValue(prior)\n ? missingPriorTitle(output, options.floor, context.locale)\n : null,\n };\n }\n\n return plainOutput(options.empty ?? EMPTY_VALUE);\n}\n\n// Why a prior is missing. A value's prior is missing when its window ends\n// before the data starts. A rank's or a share's is missing when the row had\n// no rank or share in the prior period, whatever the floor.\nfunction missingPriorTitle(\n output: OutputMeta,\n floor: string | null | undefined,\n locale: ReportLocaleTag,\n): string {\n if (output.kind === 'rank') {\n return NO_PRIOR_RANK_TITLE;\n }\n\n if (output.kind === 'share') {\n return NO_PRIOR_SHARE_TITLE;\n }\n\n return noBaselineTitle(floor, locale);\n}\n\nfunction noBaselineTitle(floor: string | null | undefined, locale: ReportLocaleTag): string {\n const day = floor ? formatDay(floor, locale) : '';\n\n return day ? `No baseline: no data before ${day}` : 'No baseline';\n}\n\n// A rank change: prior rank minus current, so moving up is positive.\nfunction formatRankChange(\n value: unknown,\n spec: NumberFormatSpec | null | undefined,\n context: ReportFormatContext,\n options: OutputValueOptions,\n): FormattedOutputValue {\n if (isEmptyValue(value)) {\n return isEmptyValue(options.prior)\n ? { text: NEW_RANK_VALUE, title: NO_PRIOR_RANK_TITLE }\n : plainOutput(EMPTY_VALUE);\n }\n\n const numeric = toFiniteNumber(value);\n if (numeric === null) {\n return plainOutput(String(value));\n }\n\n const rankSpec = valueFormat(spec) !== null ? spec : withOwnDigits(RANK_DEFAULT_SPEC, spec);\n const places = formatNumber(Math.abs(numeric), rankSpec, context);\n\n if (places === formatNumber(0, rankSpec, context)) {\n return plainOutput(RANK_UNCHANGED_VALUE);\n }\n\n return plainOutput(`${numeric > 0 ? RANK_UP_MARK : RANK_DOWN_MARK} ${places}`);\n}\n\n\n// A chart's value axis takes a format only when every measure on it agrees on\n// the style (each measure's format, number when it names none) and at least\n// one of them names a format. The first measure that does gives the axis its\n// precision and units. Otherwise null: the axis keeps its default ticks on\n// screen and in PowerPoint, and each series still formats its own tooltips.\nexport function axisNumberFormat(measures: ChartMeasure[]): NumberFormatSpec | null {\n const style = measures.length ? resolveStyle(measures[0]) : null;\n\n if (style === null || measures.some((measure) => resolveStyle(measure) !== style)) {\n return null;\n }\n\n const formatted = measures.find((measure) => hasNumberFormat(measure));\n\n return formatted ? numberFormatSpec(formatted) : null;\n}\n\nfunction numberFormatSpec(spec: NumberFormatSpec): NumberFormatSpec {\n return {\n ...(spec.format !== undefined ? { format: spec.format } : {}),\n ...(spec.precision !== undefined ? { precision: spec.precision } : {}),\n ...(spec.units !== undefined ? { units: spec.units } : {}),\n };\n}\n\n// How a chart's value axis writes its ticks: the units decided once from the\n// axis peak, and the decimals the precision pins, else as many as the axis's\n// tick step needs (a percent axis up to 0.12% steps by 0.02%, two decimals).\n// Pinned decimals keep the ticks distinct, and PowerPoint can only pin them.\nexport function resolveChartNumberFormat(\n spec: NumberFormatSpec,\n peak: number,\n context: ReportFormatContext,\n): ChartNumberFormat {\n const style = resolveStyle(spec);\n const precision = clampDecimals(spec.precision);\n const units = style === ReportValueFormat.Percent\n ? ReportNumberUnits.None\n : resolveUnits(spec.units, peak, precision ?? SCALED_DECIMALS);\n\n return { units, decimals: precision ?? axisDecimals(style, units, peak, context) };\n}\n\n// The decimals the axis's nice tick step needs. A plain, unabbreviated number\n// pins none (null): its ticks keep their own decimals. An unscaled currency\n// axis that needs decimals shows cents, and a K/M axis keeps its step's\n// decimals ('$0.5M', not '$0.50M').\nfunction axisDecimals(\n style: ReportValueFormat,\n units: ResolvedUnits,\n peak: number,\n context: ReportFormatContext,\n): number | null {\n const scale = UNIT_SCALES.get(units);\n\n if (style === ReportValueFormat.Number && !scale) {\n return null;\n }\n\n const shownPeak = style === ReportValueFormat.Percent && context.ratioPercent\n ? Math.abs(peak) * 100\n : Math.abs(peak) / (scale?.divisor ?? 1);\n const step = niceStep(shownPeak / AXIS_TICKS);\n const decimals = step > 0 ? clampDecimals(-Math.floor(Math.log10(step))) ?? 0 : 0;\n\n return style === ReportValueFormat.Currency && decimals > 0 && !scale ? CURRENCY_AXIS_DECIMALS : decimals;\n}\n\n// ECharts' nice(): the round number (1, 2, 3, 5 or 10 times a power of ten) a\n// rough tick step snaps to.\nfunction niceStep(rough: number): number {\n if (!(rough > 0) || !Number.isFinite(rough)) {\n return 0;\n }\n\n const exponent = Math.floor(Math.log10(rough));\n const power = Math.pow(10, exponent);\n const fraction = rough / power;\n let nice = 10;\n if (fraction < 1.5) {\n nice = 1;\n } else if (fraction < 2.5) {\n nice = 2;\n } else if (fraction < 4) {\n nice = 3;\n } else if (fraction < 7) {\n nice = 5;\n }\n\n return nice * power;\n}\n\n// PowerPoint's number format code for a formatted value axis, matching the\n// screen's ticks: '#,##0.0%' (percent), '\"$\"#,##0' (currency),\n// '#,##0.0,\"K\"' (thousands), '#,##0\" $\"' (fr-CA currency). A plain number\n// whose decimals are not pinned keeps chartAxisFormatCode's code. The code's\n// separators follow the opening machine's locale; the currency symbol and its\n// side follow the report's.\nexport function numberFormatCode(\n spec: NumberFormatSpec,\n context: ReportFormatContext,\n chart: ChartNumberFormat,\n series: (number | null)[][],\n stacked: boolean,\n): string {\n const style = resolveStyle(spec);\n const scale = style === ReportValueFormat.Percent ? undefined : UNIT_SCALES.get(chart.units);\n\n if (style === ReportValueFormat.Number && !scale && chart.decimals === null) {\n return chartAxisFormatCode(series, stacked);\n }\n\n const decimals = chart.decimals ?? 0;\n const digits = `#,##0${decimals > 0 ? `.${'0'.repeat(decimals)}` : ''}`;\n\n if (style === ReportValueFormat.Percent) {\n return `${digits}${context.ratioPercent ? '%' : '\"%\"'}`;\n }\n\n const scaled = `${digits}${scale?.commas ?? ''}`;\n const unit = scale?.suffix ?? '';\n\n if (style !== ReportValueFormat.Currency) {\n return unit ? `${scaled}\"${unit}\"` : scaled;\n }\n\n const symbol = currencySymbol(context);\n\n return symbol.prefix\n ? `\"${symbol.text}\"${scaled}${unit ? `\"${unit}\"` : ''}`\n : `${scaled}\"${unit}${symbol.text}\"`;\n}\n\n// The currency symbol as the locale writes it beside a number, with the space\n// between them, and which side it sits on: '$' before in en-US, ' $' after in\n// fr-CA. Quotes are dropped, as a format code cannot hold them.\ninterface CurrencySymbol {\n prefix: boolean;\n text: string;\n}\n\nconst CURRENCY_SYMBOLS = new Map<string, CurrencySymbol>();\n\nfunction currencySymbol(context: ReportFormatContext): CurrencySymbol {\n const key = `${context.locale}|${context.currency}`;\n let symbol = CURRENCY_SYMBOLS.get(key);\n\n if (!symbol) {\n const parts = numberFormat(context.locale, currencyOptions(context.currency)).formatToParts(1);\n const currency = parts.findIndex((part) => part.type === 'currency');\n const first = parts.findIndex((part) => NUMBER_PARTS.has(part.type));\n const last = parts.reduce((found, part, index) => NUMBER_PARTS.has(part.type) ? index : found, -1);\n const prefix = currency < first;\n const text = (prefix ? parts.slice(Math.max(currency, 0), first) : parts.slice(last + 1))\n .map((part) => part.value)\n .join('')\n .replace(/\"/g, '');\n\n symbol = { prefix, text };\n CURRENCY_SYMBOLS.set(key, symbol);\n }\n\n return symbol;\n}\n\n\n// Every decimal a number has, grouped, in the locale: what ECharts prints by\n// default (its addCommas), but in the report's locale, so a chart's axis and\n// tooltip read like the rest of the report. 1234.5 reads 1,234.5 in en-US and\n// 1 234,5 in fr-CA. A non-numeric string is shown as it came, and anything\n// else non-numeric as '-', as ECharts shows it. As there, an infinite value\n// reads 'Infinity' and negative zero (a tick a float error leaves just below\n// zero) reads '0'.\nconst PLAIN_NUMBER: Intl.NumberFormatOptions = { maximumFractionDigits: 20 };\n\nexport function formatPlainNumber(value: unknown, locale: ReportLocaleTag): string {\n const numeric = typeof value === 'number'\n ? value\n : typeof value === 'string' && value.trim() !== '' ? Number(value) : NaN;\n\n if (Number.isNaN(numeric)) {\n return typeof value === 'string' ? value : '-';\n }\n\n if (!Number.isFinite(numeric)) {\n return String(numeric);\n }\n\n return numberFormat(locale, PLAIN_NUMBER).format(numeric === 0 ? 0 : numeric);\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 is chartValuePeak's.\nexport function chartAxisFormatCode(series: (number | null)[][], stacked: boolean): string {\n return chartValuePeak(series, stacked) >= AXIS_SEPARATOR_THRESHOLD ? '#,##0' : 'General';\n}\n\n// The largest magnitude a chart's value axis has to reach. A missing value\n// counts as 0. A stacked chart's peak is its tallest stack: the largest sum,\n// per category, of every series' absolute value.\nexport function chartValuePeak(series: (number | null)[][], stacked: boolean): number {\n const magnitudes = series.map((values) => values.map((value) => Math.abs(value ?? 0)));\n\n return 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\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\n// The date shapes a report writes, each in the report's locale.\n// 'Jan 5, 2026' / '5 janv. 2026': a date cell, a filter bound.\nexport const DAY_SHORT: Intl.DateTimeFormatOptions = { year: 'numeric', month: 'short', day: 'numeric' };\n// 'January 5, 2026' / '5 janvier 2026': an export cover's date line.\nexport const DAY_LONG: Intl.DateTimeFormatOptions = { year: 'numeric', month: 'long', day: 'numeric' };\n// 'January' / 'janvier': a monthly period label (its year is added apart).\nexport const MONTH_LONG: Intl.DateTimeFormatOptions = { month: 'long' };\n// 'January 2026' / 'janvier 2026': a monthly period label written in full.\nexport const MONTH_YEAR: Intl.DateTimeFormatOptions = { year: 'numeric', month: 'long' };\n// 'Jan 5' / '5 janv.': a daily or weekly period label.\nexport const MONTH_DAY: Intl.DateTimeFormatOptions = { month: 'short', day: 'numeric' };\n\n// A date in the locale. With a zone, the day it falls on there; without one,\n// the browser's zone, which keeps a calendar day parsed as local midnight\n// unshifted. It never throws, since a pipe or an export calls it per cell: an\n// invalid Date reads '', a malformed locale ('en_CA') reads the fallback\n// locale, and an unknown zone reads UTC, which still names a real day.\nexport function formatLocalDate(\n date: Date,\n locale: ReportLocaleTag,\n options: Intl.DateTimeFormatOptions,\n timeZone?: string,\n): string {\n if (Number.isNaN(date.getTime())) {\n return '';\n }\n\n try {\n return writeDate(dateFormat(locale, options, timeZone), date);\n } catch {\n return formatFallbackDate(date, resolveReportLocale(locale), options, timeZone);\n }\n}\n\nfunction formatFallbackDate(\n date: Date,\n locale: ReportLocaleTag,\n options: Intl.DateTimeFormatOptions,\n timeZone?: string,\n): string {\n try {\n return writeDate(dateFormat(locale, options, timeZone), date);\n } catch {\n return writeDate(dateFormat(locale, options, 'UTC'), date);\n }\n}\n\n// Intl writes a year below 1000 with only the digits it has ('Jan 1, 1'); a\n// date's year is always written with four ('Jan 1, 0001'), so a sentinel day\n// still reads as a date. Only such a year pays for formatToParts.\nfunction writeDate(formatter: Intl.DateTimeFormat, date: Date): string {\n if (date.getUTCFullYear() > 1000) {\n return formatter.format(date);\n }\n\n return formatter.formatToParts(date)\n .map((part) => part.type === 'year' ? part.value.padStart(4, '0') : part.value)\n .join('');\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.\n// The day is written in the report's locale: 'Jan 5, 2026' in en-US, '5 janv.\n// 2026' in fr-CA.\nexport function formatReportDate(\n value: unknown,\n timezone: string,\n locale: ReportLocaleTag,\n): 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) ? formatLocalDate(day, locale, DAY_SHORT) : 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\n return isValid(instant) ? formatLocalDate(instant, locale, DAY_SHORT, timezone) : text;\n}\n\n\n// The time of day an instant falls at in the report's zone: '2:23 PM' in\n// en-US, '14 h 23' in fr-CA.\nexport const TIME_SHORT: Intl.DateTimeFormatOptions = { hour: 'numeric', minute: '2-digit' };\n\n// A window's inclusive days, as the server sends them: 'yyyy-MM-dd' calendar\n// days already in the report's zone. Like a date cell they are read as local\n// midnight and written with NO zone, so a viewer in any zone sees the days\n// sent. Both days: Intl's range in the locale ('Sep 1 – 30, 2026' in en-US,\n// '1–30 sept. 2026' in fr-CA, one date when they are the same day). One day:\n// an open window ('Since Sep 1, 2026', 'Through Sep 30, 2026'). Neither, or\n// days that are not real ones: ''.\nexport function formatDayRange(\n start: string | null | undefined,\n end: string | null | undefined,\n locale: ReportLocaleTag,\n options: Intl.DateTimeFormatOptions = DAY_SHORT,\n): string {\n const first = parseDay(start);\n const last = parseDay(end);\n\n if (first && last) {\n return writeDayRange(first, last, locale, options);\n }\n\n if (first) {\n return `Since ${formatLocalDate(first, locale, options)}`;\n }\n\n return last ? `Through ${formatLocalDate(last, locale, options)}` : '';\n}\n\n// The time a window ending today is cut at: the server's UTC\n// 'yyyy-MM-dd HH:mm:ss' instant, as a time of day in the report's zone. ''\n// for none, or for a value of another shape.\nexport function formatThroughTime(\n through: string | null | undefined,\n timezone: string,\n locale: ReportLocaleTag,\n): string {\n const dateTime = through ? DATE_TIME_PATTERN.exec(through) : null;\n const instant = dateTime ? parseISO(`${dateTime[1]}T${dateTime[2]}Z`) : null;\n\n return instant && isValid(instant) ? formatLocalDate(instant, locale, TIME_SHORT, timezone) : '';\n}\n\n// A comparison or timeframe window in one line: its days, and the time it is\n// cut at when it ends today on a date-and-time column ('Oct 1 – 2, 2026,\n// until 2:23 PM').\nexport function formatDayWindow(\n meta: { start: string | null; end: string | null; through?: string | null },\n timezone: string,\n locale: ReportLocaleTag,\n): string {\n const days = formatDayRange(meta.start, meta.end, locale);\n const time = formatThroughTime(meta.through, timezone, locale);\n\n return days && time ? `${days}, until ${time}` : days;\n}\n\n// Whether a comparison is read on one day: a comparison of values read at\n// the end of each period, with no time axis of its own (a KPI, a one-row\n// list), whose value is read today and whose prior is read at the end of\n// the period before. Its two windows are those periods, back to back, and\n// each value is read on its window's last day, so the windows are written as\n// those days (formatReadingDay). A spine of several periods sets each period\n// against an earlier one, and its windows are spans like any other\n// comparison's.\nexport function isReadOnOneDay(comparison: ComponentComparison | null | undefined): boolean {\n const current = comparison?.current;\n const prior = comparison?.priors?.[0];\n\n if (comparison?.mode !== 'period_end' || !current || !prior) {\n return false;\n }\n\n const priorEnd = parseDay(prior.end);\n const currentStart = parseDay(current.start);\n\n return !!priorEnd && !!currentStart && addDays(priorEnd, 1).getTime() === currentStart.getTime();\n}\n\n// The day a value is read on: 'on Sep 15, 2026' ('On …' to open a line), as\n// a chart's tooltip names a prior point read at the end of its period. ''\n// for a day that is not a real one.\nexport function formatReadingDay(\n window: Pick<ComparisonWindow, 'end'>,\n locale: ReportLocaleTag,\n lead = false,\n): string {\n const day = formatDay(window.end, locale);\n\n if (!day) {\n return '';\n }\n\n return lead ? `On ${day}` : `on ${day}`;\n}\n\n// One 'yyyy-MM-dd' day in the locale, written with no zone: 'Sep 1, 2026'.\nfunction formatDay(day: string, locale: ReportLocaleTag): string {\n const date = parseDay(day);\n\n return date ? formatLocalDate(date, locale, DAY_SHORT) : '';\n}\n\n// A 'yyyy-MM-dd' day as local midnight, or null when it is not a real day.\nfunction parseDay(day: string | null | undefined): Date | null {\n if (!day || !DATE_ONLY_PATTERN.test(day)) {\n return null;\n }\n\n const date = parseISO(day);\n\n return isValid(date) ? date : null;\n}\n\n// Intl's range writes the shared month and year once. A malformed locale\n// reads the fallback; a runtime that cannot write ranges joins two dates.\nfunction writeDayRange(first: Date, last: Date, locale: ReportLocaleTag, options: Intl.DateTimeFormatOptions): string {\n const [from, to] = first <= last ? [first, last] : [last, first];\n\n for (const tag of [locale, resolveReportLocale(locale)]) {\n try {\n return dateFormat(tag, options).formatRange(from, to);\n } catch {\n // The next locale, then the joined dates.\n }\n }\n\n return `${formatLocalDate(from, locale, options)} – ${formatLocalDate(to, locale, options)}`;\n}\n\n\n// English names for a locale and a currency, for the settings selects. The\n// interface stays English whatever the report's locale: 'fr-CA' reads\n// 'Canadian French', 'CAD' reads 'Canadian Dollar'. A runtime without the\n// names shows the code.\nexport function localeName(tag: ReportLocaleTag): string {\n return displayName('language', tag);\n}\n\nexport function currencyName(code: ReportCurrencyCode): string {\n return displayName('currency', code);\n}\n\nfunction displayName(type: 'language' | 'currency', code: string): string {\n try {\n return new Intl.DisplayNames(['en'], { type }).of(code) ?? code;\n } catch {\n return code;\n }\n}\n\n\n// Comparison, window and KPI wording. The server sends codes and fields,\n// never sentences (a window's description is for the agent and the exports'\n// notes, not the screen); the interface words them here, in English like\n// every other label, with any day written in the report's locale.\n\nconst GRANULARITY_UNITS: Record<ChartGranularity, { one: string; many: string }> = {\n day: { one: 'day', many: 'days' },\n week: { one: 'week', many: 'weeks' },\n month: { one: 'month', many: 'months' },\n quarter: { one: 'quarter', many: 'quarters' },\n year: { one: 'year', many: 'years' },\n};\n\n// What a prior lane is called: always so for a named period, and for the\n// previous period when the server names no unit for it.\nconst AGAINST_PHRASES: Record<ComparisonAgainst, string> = {\n previous_period: 'previous period',\n previous_week: 'previous week',\n previous_month: 'previous month',\n previous_quarter: 'previous quarter',\n previous_year: 'previous year',\n range: 'custom range',\n};\n\n// A prior lane's label, from its offset rather than from the measure, so a\n// chart regrouped by the viewer says what it now compares. A named period\n// reads by its name whatever shift carries it ('vs previous quarter' for 3\n// months, 'vs previous year' for 364 days or 52 weeks, 'vs custom range').\n// Only the previous period is worded from its unit and count: 'vs previous\n// week', 'vs previous 3 months', 'vs previous 8 days' (a day-length shift).\nexport function comparisonOffsetLabel(offset: ComparisonOffset): string {\n return `vs ${offsetPhrase(offset)}`;\n}\n\nfunction offsetPhrase(offset: ComparisonOffset): string {\n if (offset.against !== 'previous_period' || !offset.unit || !offset.count) {\n return AGAINST_PHRASES[offset.against] ?? AGAINST_PHRASES.previous_period;\n }\n\n return offset.count === 1\n ? `previous ${GRANULARITY_UNITS[offset.unit].one}`\n : `previous ${offset.count} ${GRANULARITY_UNITS[offset.unit].many}`;\n}\n\n// One comparison note as a sentence. The comparison, when given, names the\n// period compared with (its first prior lane).\nexport function comparisonNoteText(\n code: ComparisonNoteCode,\n comparison?: ComponentComparison | null,\n): string {\n const offset = comparison?.offsets?.[0] ?? null;\n const compared = offset ? `Compared with the ${offsetPhrase(offset)}` : null;\n\n switch (code) {\n case 'no_window':\n return 'Pick a date range to see the comparison.';\n case 'unit_inferred':\n return compared\n ? `${compared}, judged from the dates picked.`\n : 'The period compared with was judged from the dates picked.';\n case 'window_in_future':\n return 'The date range starts after today, so there is nothing to compare yet.';\n case 'other_date_filter':\n return 'A date filter on another column also applies to both periods.';\n case 'grain_followed':\n return compared\n ? `${compared}, following the grouping picked.`\n : 'The comparison follows the grouping picked.';\n default:\n return '';\n }\n}\n\n// What a windowed value is: 'Rolling 3-month total', 'Month-to-date total',\n// 'Running total since the start of the data', then its days when the server\n// sends them ('Rolling 7-day average, Sep 24 – 30, 2026'). granularity is the\n// grouping the rows are drawn at (ComponentData.granularity), which names a\n// rolling window authored in periods of the axis.\nexport function windowText(\n meta: WindowMeta,\n locale: ReportLocaleTag,\n granularity?: ChartGranularity | null,\n): string {\n const days = formatDayRange(meta.start, meta.end, locale);\n const phrase = windowPhrase(meta, granularity ?? null);\n\n return days ? `${phrase}, ${days}` : phrase;\n}\n\nfunction windowPhrase(meta: WindowMeta, granularity: ChartGranularity | null): string {\n const value = meta.average ? 'average' : 'total';\n\n switch (meta.kind) {\n case 'running':\n return meta.fromBeginning ? `Running ${value} since the start of the data` : `Running ${value}`;\n case 'to_date': {\n const reset = meta.resetEvery ? GRANULARITY_UNITS[meta.resetEvery].one : null;\n\n return reset ? `${capitalize(reset)}-to-date ${value}` : `To-date ${value}`;\n }\n case 'rolling': {\n const unit = meta.unit ?? granularity;\n const span = meta.periods ? `${meta.periods}-${unit ? GRANULARITY_UNITS[unit].one : 'period'} ` : '';\n\n return `Rolling ${span}${value}`;\n }\n default:\n return capitalize(value);\n }\n}\n\n// One window note as a sentence.\nexport function windowNoteText(\n code: WindowNoteCode,\n meta: WindowMeta,\n locale: ReportLocaleTag,\n granularity?: ChartGranularity | null,\n): string {\n switch (code) {\n case 'snapped_start': {\n const start = meta.start ? formatDay(meta.start, locale) : '';\n\n return start\n ? `The start was moved to ${start}, the start of its period, so the first period is whole.`\n : 'The start was moved to the start of its period, so the first period is whole.';\n }\n case 'span_converted':\n return spanConvertedText(meta, granularity ?? null);\n case 'grain_too_coarse':\n return 'The grouping is coarser than the window, so it has no values at this grouping.';\n case 'equal_grain_plain':\n return 'At this grouping each window is a single period, so the values are the plain ones.';\n case 'own_filter_caps_lead_in':\n return 'The query\\'s own date condition starts the window, so earlier rows are not counted.';\n case 'week_by_monday':\n return 'A week that spans two periods counts toward the period its Monday falls in.';\n case 'incomplete_head':\n return 'The first periods are blank because there are not enough earlier rows to fill a whole window.';\n default:\n return '';\n }\n}\n\n// '3 months are shown as 13 weeks at this grouping.'\nfunction spanConvertedText(meta: WindowMeta, granularity: ChartGranularity | null): string {\n if (!meta.periods || !meta.unit || !meta.drawnPeriods) {\n return 'The window\\'s span was converted to the grouping shown.';\n }\n\n const authored = unitCount(meta.periods, meta.unit);\n const drawn = granularity\n ? unitCount(meta.drawnPeriods, granularity)\n : `${meta.drawnPeriods} ${meta.drawnPeriods === 1 ? 'period' : 'periods'}`;\n\n return `${authored} ${meta.periods === 1 ? 'is' : 'are'} shown as ${drawn} at this grouping.`;\n}\n\nfunction unitCount(count: number, unit: ChartGranularity): string {\n return `${count} ${count === 1 ? GRANULARITY_UNITS[unit].one : GRANULARITY_UNITS[unit].many}`;\n}\n\n// Why a KPI's delta reads as it does, as a sentence. The baseline is named\n// by what the value is compared against: the same period last year for a\n// year-on-year comparison, else the period before.\nexport function kpiNoteText(code: KpiNoteCode, against?: ComparisonAgainst | null): string {\n const baseline = kpiBaselineText(against);\n\n switch (code) {\n case 'no_prior_data':\n return `No baseline: ${baseline} has no data.`;\n case 'up_from_zero':\n return `New: ${baseline} was 0.`;\n case 'no_change':\n return `No change from ${baseline}.`;\n case 'no_data_either':\n return 'No data in either period.';\n case 'sign_change':\n return 'The value crossed zero, so there is no percent change.';\n default:\n return '';\n }\n}\n\n// The window a KPI's value is compared with, as a noun phrase. An unknown or\n// missing comparison reads as neutral wording rather than a wrong period.\nfunction kpiBaselineText(against: ComparisonAgainst | null | undefined): string {\n switch (against) {\n case 'previous_period':\n return 'the previous period';\n case 'previous_week':\n return 'the previous week';\n case 'previous_month':\n return 'the previous month';\n case 'previous_quarter':\n return 'the previous quarter';\n case 'previous_year':\n return 'the same period last year';\n default:\n return 'the comparison period';\n }\n}\n\nfunction capitalize(text: string): string {\n return text.charAt(0).toUpperCase() + text.slice(1);\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","// 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\nimport { ReportChangePolarity } from '../enums/report-change-polarity.enum';\nimport { ReportChartColor } from '../enums/report-chart-color.enum';\nimport { ReportChartDataLabels } from '../enums/report-chart-data-labels.enum';\nimport { ReportChartDateLabel } from '../enums/report-chart-date-label.enum';\nimport { ReportChartLineStyle } from '../enums/report-chart-line-style.enum';\nimport { ReportChartMarkStat } from '../enums/report-chart-mark-stat.enum';\nimport { ReportListColumnFormat } from '../enums/report-list-column-format.enum';\nimport { ReportNumberUnits } from '../enums/report-number-units.enum';\nimport { ReportValueFormat } from '../enums/report-value-format.enum';\nimport { ReportValueFormula } from '../enums/report-value-formula.enum';\n\n// A BCP 47 language tag naming how numbers and dates are written, e.g. 'fr-CA'.\n// The set is open (the server's provider decides which it offers), so this is a\n// named alias rather than a union.\nexport type ReportLocaleTag = string;\n\n// An ISO 4217 currency code, e.g. 'CAD'. Open for the same reason.\nexport type ReportCurrencyCode = string;\n\nexport interface Report {\n id: number;\n name: string;\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 // The report's own stored locale. null = the report follows the default.\n locale?: ReportLocaleTag | null;\n // The locale every number and date of this report is written in, resolved\n // server-side (the report's own, else the application's default, else\n // en-US). Absent on older servers, whose reports then read en-US. Resolve it\n // for rendering through resolveFormatContext() (format.ts), never directly.\n effectiveLocale?: ReportLocaleTag;\n // The report's own stored currency. null = the report follows the default.\n currency?: ReportCurrencyCode | null;\n // The currency money amounts are labeled in, resolved like effectiveLocale\n // (falling back to the locale's own currency, then USD). A label only:\n // amounts are never converted.\n effectiveCurrency?: ReportCurrencyCode;\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 // The values the header and footer text shows, as ReportPage.values.\n values?: ReportComponent[];\n}\n\n// How the open report writes its numbers and dates, resolved once per report\n// (resolveFormatContext) and read by the viewer, the PDF and PowerPoint alike.\n// Never the browser's locale.\nexport interface ReportFormatContext {\n locale: ReportLocaleTag;\n currency: ReportCurrencyCode;\n // Whether a percent measure arrives as a 0-1 ratio (the report's\n // percentFormat). An older server sends it already x100.\n ratioPercent: boolean;\n}\n\n// One locale the server offers, with the currency a report in it uses when it\n// names none of its own.\nexport interface ReportLocaleOption {\n locale: ReportLocaleTag;\n defaultCurrency: ReportCurrencyCode;\n}\n\n// GET reports/locales: what the report settings' Locale and Currency selects\n// offer.\nexport interface ReportLocales {\n defaultLocale: ReportLocaleTag;\n options: ReportLocaleOption[];\n currencies: ReportCurrencyCode[];\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 // Every active value of the page, in id order: those its text shows and\n // those no text shows any more (kept until a text, value or page delete, so\n // a chip pasted back still names one). Never drawn, and never in\n // `components`. Optional because older servers omit it.\n values?: ReportComponent[];\n}\n\n// 'text' is authored rich text with no query behind it — it never fetches data.\n// 'value' is one number shown inside a text block's words ({{value.key}}); it\n// has a query but no place of its own on the page.\nexport type ReportComponentType = 'chart' | 'list' | 'kpi' | 'text' | 'value';\n\nexport interface ReportComponent {\n id: number;\n type: ReportComponentType;\n title: string | null;\n // Geometry in INCHES: absolute position on the page canvas.\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 // 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 & ValueConfig & ComponentLayoutConfig\n & 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// A value's key: what its token in a text block's html names, unique within\n// the page. Its number is formatted by config.measure (KpiConfig), as on a KPI.\n// A formula value has no query: `formula` names what it works out of the\n// page's query values, and its measure holds only the format keys its author\n// gave (format, precision, units).\nexport interface ValueConfig {\n key?: string;\n formula?: ValueFormulaConfig | null;\n}\n\n// A formula value's operation and operands: `of` names query values on the\n// same page (the master for a header or footer) by key, 2 of them, or 2 to 10\n// for a sum. `signed` absent reads true for a change and a percent change,\n// false for a ratio and a sum.\nexport interface ValueFormulaConfig {\n op: ReportValueFormula;\n of: string[];\n signed?: boolean | null;\n}\n\n// One row of POST pages/:id/values: a value's number for the filters sent.\n// There is one row per value the layer reads, in id order: one some text on\n// that page shows, or an operand of a formula some text shows. `value` is\n// raw, as the query returned it or the server worked it out (null when there\n// is no row or the result is null); formatting is the viewer's, through the\n// value's measure. `error` is that value's own failure, and the page's other\n// values are read regardless.\n// `role` is the comparison role the number plays: a query value's comparison\n// output's, change or percent_change for those formulas, else null.\nexport interface ReportPageValue {\n id: number;\n key: string;\n value: number | string | null;\n error: string | null;\n role?: OutputRole | null;\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. Title and\n// padding are not part of what the component queries, so a change to them\n// repaints without re-running anything. A derived KPI's card keys are sent\n// too: the server computes the target's progress and the sparkline's points\n// with the data, so a change to them reloads it.\nexport interface ComponentSettings {\n title: string;\n padding: ComponentPadding;\n kpi?: KpiCardSettings;\n}\n\n// A KPI's card keys. The dialog sends them (null removes a key, increaseIs\n// null reads good), and ComponentSettings.kpi carries them as the server\n// saved them, read back from the config it returns.\nexport interface KpiCardSettings {\n increaseIs: ReportChangePolarity | null;\n target: KpiTargetConfig | null;\n sparkline: KpiSparklineConfig | null;\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 // dateLabel writes a time axis's period labels short ('May', the default),\n // long ('May 2026') or numeric ('2026-05'); a category axis ignores it.\n xAxis?: {\n column: string;\n kind?: 'category' | 'time';\n granularity?: ChartGranularity;\n label?: string;\n dateLabel?: ReportChartDateLabel;\n };\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 // Stacks the primary axis's bar and area series as shares of each\n // category's total, so every stack reaches 100%. The viewer computes the\n // shares from the rows it receives, after the filters ran; the rows and the\n // CSV keep the raw values. The value axis then always runs 0 to 100% (from\n // -100% when a share is negative).\n percentStacked?: boolean;\n // Values printed beside the points of a bar, line or area series: every\n // point (all), each series' latest point (last), or every point whose label\n // fits without overlapping another (auto). Omitted or none, no labels. A\n // pie, a donut and a waterfall never print them.\n dataLabels?: ReportChartDataLabels;\n // The primary value axis's title and range. Every series is plotted against\n // it unless its measure is secondary.\n valueAxis?: ChartValueAxis;\n // The second value axis, on the right, that secondary measures plot against.\n secondaryAxis?: ChartValueAxis;\n // Labeled lines across the plot at a constant value, or bands between two\n // values, at most 5. Vertical axis charts and waterfalls only.\n references?: ChartReference[];\n legend?: LegendPosition;\n sort?: ReportSort;\n limit?: number;\n}\n\n// A value axis's title and range. Each bound left out is picked from the data,\n// and the tick step without an interval. Its ticks take the number format of\n// the measures plotted against it.\nexport interface ChartValueAxis {\n label?: string;\n min?: number;\n max?: number;\n interval?: number;\n}\n\n// A reference drawn across a chart's plot: a line at `value`, or with `to` a\n// band between the two, labeled with `label`. The value is one the user or\n// the model states, never one read off the data. secondary plots it against\n// the second value axis, when the chart has one.\nexport interface ChartReference {\n value: number;\n label: string;\n to?: number;\n secondary?: boolean;\n}\n\n// How one numeric slot is shown: a chart measure, a KPI measure, a list column\n// or a cross-tab's cells. The data stays raw (it sorts and exports as a\n// number); only the renderers format it, the same way on screen, in the PDF\n// and in PowerPoint (format.ts). All three keys are optional, and precision or\n// units without a format mean number.\n//\n// Formatting is opt-in: a list column or cross-tab cell without these keys\n// prints its value as it came, and a chart without them keeps its plain\n// locale-grouped axis and tooltips. A KPI without them prints a plain number.\nexport interface NumberFormatSpec {\n // percent takes a 0-1 ratio (0.3 reads 30%) when the report's percentFormat\n // is 'ratio'; an older server leaves it out and sends x100. currency labels\n // the amount in the report's currency, written in its locale.\n format?: ReportValueFormat | ReportListColumnFormat;\n // How many decimal places the value is shown to (0-6). Fixed rather than\n // maximum: a column of rates is unreadable when each one shows a different\n // number of decimals. For percent it counts the decimals of the percentage\n // (precision 1 shows 0.3 as 30.0%). Omitted leaves the format's own default:\n // at most one decimal for percent (and for an abbreviated 1.2K), whole units\n // for currency, the locale's default for a number.\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.\n precision?: number;\n // Abbreviates to thousands (1.2K) or millions (3.4M), or picks by size.\n units?: ReportNumberUnits;\n}\n\nexport interface ChartMeasure extends NumberFormatSpec {\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).\n type?: AxisChartType;\n // A chart measure's format shows on its tooltips, and on the value axis\n // when every measure sharing the axis agrees on it. A KPI's measure formats\n // its one value.\n format?: ReportValueFormat;\n // Plots this measure against the second value axis, on the right, for a\n // quantity on another scale. Omitted or false, it shares the primary axis.\n // A vertical axis chart only, with at least one measure left on the primary\n // axis.\n secondary?: boolean;\n // The palette color this measure's series is drawn in. Omitted, the series\n // takes the palette color of its position. A color on the first measure\n // turns off a category bar chart's default color per bar (isColorBy).\n color?: ReportChartColor;\n // How a line series' line is drawn. Omitted, solid.\n line?: ReportChartLineStyle;\n // Whether a line or area series draws a dot on each point. Omitted, true.\n markers?: boolean;\n // A line across the plot at this series' average, median, lowest or highest\n // value over the points on screen. Vertical axis charts only.\n markLine?: ReportChartMarkStat;\n}\n\n// One authored column of a plain list.\nexport interface ListColumn extends NumberFormatSpec {\n column: string;\n label?: string;\n // date keeps the column a RAW timestamp, so the report timezone and its\n // dateRange filters keep working, and the viewer renders it as a day in the\n // report's zone and locale. number, percent and currency format the value as\n // a KPI measure does. Without a format the value prints as it came.\n format?: ReportListColumnFormat;\n // A column the SQL already formatted is text, so it names `sortColumn`: the\n // raw numeric alias the query also outputs, which the server orders by\n // instead.\n sortColumn?: string;\n // false keeps the cell on one line. Omitted, a long value wraps.\n wrap?: boolean;\n}\n\nexport interface ListConfig {\n columns?: ListColumn[];\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 // The authored order, most important first. A list saved before multi-key\n // sorting stores one object, so read it through listSortTerms() only.\n sort?: ReportSort | ReportSort[];\n // How many leading columns stay in view while the list scrolls sideways\n // (0-3). Unset, a cross-tab pins its row-key column and a plain list none.\n pinnedColumns?: number | null;\n pageSize?: number;\n // true adds a totals row under the list: the server runs the measures again\n // over every row the filters keep, without grouping, and a cross-tab totals\n // each column.\n totals?: boolean;\n // A cross-tab only: how every cell of the grid is formatted, with a KPI\n // measure's keys. The row key column stays as it came.\n cellFormat?: NumberFormatSpec & { format?: ReportValueFormat };\n}\n\nexport interface KpiConfig {\n measure?: ChartMeasure;\n // Whether a rise in the value is good news, bad news or neither: it picks\n // the delta's color and decides when a target is met (good: at or above it;\n // bad: at or below it; neutral: never judged). Omitted or null reads good.\n increaseIs?: ReportChangePolarity | null;\n // A number the user gave for the value to reach, never one read off the\n // data. The server sends the progress toward it with the data.\n target?: KpiTargetConfig | null;\n // A small trend line of the value over its last periods, drawn under it.\n sparkline?: KpiSparklineConfig | null;\n}\n\n// A KPI's target: the value, and an optional caption for it ('Goal').\nexport interface KpiTargetConfig {\n value: number;\n label?: string | null;\n}\n\n// A KPI's sparkline: how wide each point's period is (null reads month) and\n// how many periods it draws, 2 to 60 (null reads 12).\nexport interface KpiSparklineConfig {\n granularity?: ChartGranularity | null;\n periods?: number | null;\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, and the data request names the period it covers (see\n // ResolvedFilterValue.preset). Any date picked by the viewer, a picker\n // shortcut included, is stored without it.\n preset?: string;\n}\n\n// A relative date range the server resolves against today in the report's\n// zone: the names a FilterGroupDefault.relative and a timeframe's range take.\n// Mirrors the server's ReportRelativeRangeEnum value for value\n// (ReportRelativeRangeEnumTest pins the days each one covers).\nexport type ReportRelativeRange =\n | 'thisWeek'\n | 'lastWeek'\n | 'last7Days'\n | 'last30Days'\n | 'last3Months'\n | 'last6Months'\n | 'last12Months'\n | 'thisMonth'\n | 'thisQuarter'\n | 'thisYear'\n | 'yearToDate';\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 // q<componentId> -> a list's search box text, as typed.\n listSearches: Map<number, string>;\n // h<componentId> -> the columns a viewer hid on a list, still encoded\n // (decodeColumnList).\n listHidden: 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's\n // first term.\n listSorts: Map<number, ReportSort>;\n // A list's search box text, by component id. A list with an empty box is\n // left out.\n listSearches: Map<number, string>;\n // The config column names a viewer hid on a plain list, by component id. A\n // list showing every column is left out.\n listHidden: Map<number, string[]>;\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 // dateRange only: the relative range start and end still are, sent only\n // while they are exactly that range resolved today in the report's zone. It\n // tells the server which period the days cover (on the first days of a\n // quarter, thisMonth and thisQuarter are the same days), so a comparison\n // shifts by the right unit. start and end stay the window; a server that\n // does not know the key ignores it.\n preset?: ReportRelativeRange;\n}\n\n// Per-component interaction state sent with the data request: lists send\n// sort/paging and the text in their search box; time-series charts send the\n// grain picked on the report's group-by control, which overrides the authored\n// granularity for that request only. The wire key stays `frequency` — it is the\n// bucketing frequency the server applies.\nexport interface ComponentDataState {\n sort?: ReportSort;\n page?: number;\n pageSize?: number;\n frequency?: ChartGranularity;\n // A list's search box text. The server trims it, cuts it to its own maximum\n // length and matches it against every text column the list shows.\n search?: string;\n // The config column names a viewer hid on a plain list. Sent with a CSV\n // export only (the screen hides them itself): the file leaves them out. The\n // server ignores it on a cross-tab, and when it would hide every column.\n hiddenColumns?: string[];\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 // Page 1 of a searched list whose search could not apply (the list has no\n // text column to search): why the rows are not narrowed. Absent otherwise.\n searchNote?: string | null;\n // Page 1 of a list with config.totals on: its totals row, as raw values\n // keyed like the columns (a plain list's measure aliases; a cross-tab's\n // pivot cell columns, the row-key column absent), or null with totalsNote\n // saying why there is none. Absent on every other page and list.\n totals?: Record<string, unknown> | null;\n totalsNote?: string | null;\n // The window of days the component reads, when its query has a timeframe.\n // Absent otherwise, and from older servers.\n timeframe?: ComponentTimeframe | null;\n // The current and prior windows of a component whose measures compare\n // against an earlier period. Absent when no measure compares. Sent on every\n // list page and on chart and KPI data.\n comparison?: ComponentComparison | null;\n // What each compared, windowed, ranked or shared output column is, by alias.\n // Plain measure columns are left out.\n outputs?: Record<string, OutputMeta>;\n // A cross-tab only: the measure alias each pivot cell column holds, so a\n // cell takes its measure's output meaning. Never sent for a sql-mode list.\n cellMeasures?: Record<string, string>;\n // How each windowed output column (running, to-date or rolling) was\n // computed, by alias.\n windows?: Record<string, WindowMeta>;\n // A KPI with a comparison, a target or a sparkline: every number the card\n // shows beside its value, decided by the server.\n kpi?: ComponentKpi | null;\n // The time-axis value of the bucket containing today, written as the rows\n // write it, when that bucket is not finished yet; null otherwise. A chart\n // marks it as partial.\n partialPeriod?: string | null;\n}\n\n// Where a component's timeframe window came from: a viewer dateRange bound to\n// the timeframe column (which replaces the authored range, never narrows\n// it), the authored relative range, the authored fixed days, or nothing (an\n// open window).\nexport type TimeframeSource = 'filter' | 'range' | 'fixed' | 'none';\n\n// The window a component's timeframe resolved to. start and end are\n// inclusive 'yyyy-MM-dd' days in the report's zone, written without a zone.\n// through is the UTC 'yyyy-MM-dd HH:mm:ss' instant a window on a datetime\n// column is cut at; it reads as a time in the report zone. It is set only when\n// a comparison cuts a window that ends today: a timeframe on its own reads\n// whole days, so a window ending today without a comparison sends null.\nexport interface ComponentTimeframe {\n column: string;\n start: string | null;\n end: string | null;\n through: string | null;\n range: ReportRelativeRange | null;\n source: TimeframeSource;\n}\n\n// How a comparison is laid out: one value per window (range), a prior series\n// beside a time axis (series), or each period's value read at its end, set\n// against the value at the end of an earlier period (period_end).\nexport type ComparisonMode = 'range' | 'series' | 'period_end';\n\n// to_date compares like with like (the first 2 days of a month against the\n// first 2 days of the one before); full compares whole periods.\nexport type ComparisonAlign = 'to_date' | 'full';\n\n// What a measure is compared against. Mirrors the server's\n// ComparisonAgainstEnum value for value.\nexport type ComparisonAgainst =\n | 'previous_period'\n | 'previous_week'\n | 'previous_month'\n | 'previous_quarter'\n | 'previous_year'\n | 'range';\n\n// Why a comparison reads as it does. The server sends codes, never\n// sentences; the viewer words them.\n// - no_window: no date range to compare yet;\n// - unit_inferred: the period unit was inferred from the days, not named;\n// - window_in_future: the window starts after today;\n// - other_date_filter: a date filter on another column also applies;\n// - grain_followed: the prior follows the group-by grain picked on the report.\nexport type ComparisonNoteCode =\n | 'no_window'\n | 'unit_inferred'\n | 'window_in_future'\n | 'other_date_filter'\n | 'grain_followed';\n\n// One comparison window: inclusive 'yyyy-MM-dd' days in the report's zone,\n// and the UTC instant it is cut at when it ends today on a datetime column.\n// In series mode it is the span the chart shows.\nexport interface ComparisonWindow {\n start: string;\n end: string;\n through: string | null;\n}\n\n// How far back one prior lane sits. A custom range has no unit or count, and\n// neither does previous_period when there is no current window to measure\n// (no_window, window_in_future); a shift by the window's length is unit day\n// with the length as the count; a previous year is 364 days on a day axis and\n// 52 weeks on a week axis.\nexport interface ComparisonOffset {\n against: ComparisonAgainst;\n unit: ChartGranularity | null;\n count: number | null;\n}\n\n// A component's comparison: the zone its days are in, the current window\n// (null when there is no window to compare yet, or when a time axis runs\n// over all the data, which has no first day to name) and up to 2 prior\n// lanes: offsets[i] describes lane i + 1, and priors[i] its window. With no\n// current window priors is empty, while offsets still names every lane.\n// floor is the 'yyyy-MM-dd' day of the first row the query's own conditions\n// keep (viewer filters aside): a prior window wholly before it has no data\n// rather than a zero.\nexport interface ComponentComparison {\n mode: ComparisonMode;\n timezone: string;\n align: ComparisonAlign;\n current: ComparisonWindow | null;\n priors: ComparisonWindow[];\n offsets: ComparisonOffset[];\n floor: string | null;\n notes: ComparisonNoteCode[];\n}\n\n// What an output column holds: a measure's value, its rank or its share.\nexport type OutputKind = 'value' | 'rank' | 'share';\n\n// Which side of a comparison an output column is: the current value, the\n// prior one, their difference, or the difference as a 0-1 fraction of the\n// prior. null for an output that is not compared.\nexport type OutputRole = 'current' | 'prior' | 'change' | 'percent_change';\n\n// How tied values rank: 1, 1, 3 (competition) or 1, 1, 2 (dense).\nexport type OutputRankMethod = 'competition' | 'dense';\n\n// A rank output: how ties rank, which end ranks 1 (desc: the largest), and\n// the dimension outputs it restarts within (none: the whole result).\nexport interface OutputRank {\n method: OutputRankMethod;\n direction: 'asc' | 'desc';\n within: string[];\n}\n\n// A share output: the dimension outputs whose total it is a share of (none:\n// the whole result).\nexport interface OutputShare {\n within: string[];\n}\n\n// The meaning of one compared, windowed, ranked or shared output column.\n// measure is the source measure's alias, whose format the column inherits;\n// offset is the prior lane a prior, change or percent change belongs to (its\n// window is comparison.priors[offset - 1]). Unless the config formats it, a\n// share prints as a percent to 1 decimal and a rank as a whole number.\nexport interface OutputMeta {\n measure: string;\n kind: OutputKind;\n role: OutputRole | null;\n offset: number | null;\n window: boolean;\n rank: OutputRank | null;\n share: OutputShare | null;\n}\n\n// A window over the rows: a running total, a total to date within each\n// period (month to date), or a rolling span of periods.\nexport type WindowKind = 'running' | 'to_date' | 'rolling';\n\n// Why a window reads as it does. Codes only; the viewer words them.\nexport type WindowNoteCode =\n | 'snapped_start'\n | 'span_converted'\n | 'grain_too_coarse'\n | 'equal_grain_plain'\n | 'own_filter_caps_lead_in'\n | 'week_by_monday'\n | 'incomplete_head';\n\n// How one windowed output column was computed. periods and unit size a\n// rolling window (drawnPeriods is that span counted in the grain the rows\n// are drawn at); resetEvery restarts a to-date window; average makes the\n// window an average rather than a total; fromBeginning\n// runs a total from the first row ever rather than from the first row shown.\n// start, end and leadIn are 'yyyy-MM-dd' report-zone days: the rows shown,\n// and the earlier day the window reads from so its first rows are whole.\n// description is the server's English for the agent and the exports; the\n// viewer composes its own words from the fields.\nexport interface WindowMeta {\n kind: WindowKind;\n periods: number | null;\n unit: ChartGranularity | null;\n drawnPeriods: number | null;\n resetEvery: ChartGranularity | null;\n average: boolean;\n fromBeginning: boolean;\n dateColumn: string | null;\n start: string | null;\n end: string | null;\n leadIn: string | null;\n notes: WindowNoteCode[];\n description: string;\n}\n\n// Which delta a KPI card shows: the difference, or the percent change.\nexport type KpiDeltaShow = 'change' | 'percent_change';\n\n// Why a KPI's delta reads as it does:\n// - no_prior_data: the prior window has no value;\n// - up_from_zero: the prior was 0, so there is no percent change;\n// - no_change: both are 0;\n// - no_data_either: neither window has a value;\n// - sign_change: the value crossed zero, so there is no percent change.\nexport type KpiNoteCode =\n | 'no_prior_data'\n | 'up_from_zero'\n | 'no_change'\n | 'no_data_either'\n | 'sign_change';\n\n// A KPI's progress toward its configured target. progress is value / target\n// (null when the target is 0); met follows the config's increaseIs (null\n// when it is neutral).\nexport interface ComponentKpiTarget {\n value: number;\n label: string | null;\n progress: number | null;\n met: boolean | null;\n}\n\n// One sparkline point: the period, written as a time-axis value, and the\n// value in it (null when a non-additive measure has no rows there).\nexport interface ComponentKpiSparklinePoint {\n period: string;\n value: number | null;\n}\n\n// A KPI's sparkline points, oldest first. partial says the last period is\n// not finished yet.\nexport interface ComponentKpiSparkline {\n granularity: ChartGranularity;\n partial: boolean;\n points: ComponentKpiSparklinePoint[];\n}\n\n// Every number a KPI card shows beside its value. show names the delta to\n// print, decided by the server. When value is null the card shows a dash and\n// no comparison.\nexport interface ComponentKpi {\n value: number | null;\n prior: number | null;\n change: number | null;\n percentChange: number | null;\n show: KpiDeltaShow;\n note: KpiNoteCode | null;\n target: ComponentKpiTarget | null;\n sparkline: ComponentKpiSparkline | 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 { laneOutputAlias } from './format';\nimport {\n ComponentData,\n ListColumn,\n ListConfig,\n NumberFormatSpec,\n OutputMeta,\n ReportSort,\n} from './interfaces/report.interface';\n\n\n// The most leading columns a list can keep in view while it scrolls sideways.\n// Mirrors the server's ListConfig::MAX_PINNED_COLUMNS, which refuses more.\nexport const MAX_PINNED_COLUMNS = 3;\n\n// A list's authored sort, most important first. A list sort is a list of\n// terms, but a list saved before multi-key sorting stores one object and is\n// never rewritten, so both shapes are read here. This is the one reader of a\n// list's config.sort: the config type intersects the chart and list configs,\n// so a direct `config.sort.column` still compiles and silently misreads an\n// array. A term without a column orders nothing and is dropped.\nexport function listSortTerms(config: ListConfig | null | undefined): ReportSort[] {\n const sort = config?.sort;\n\n if (!sort) {\n return [];\n }\n\n return (Array.isArray(sort) ? sort : [sort])\n .filter((term) => !!term?.column);\n}\n\n// The columns a viewer can hide on a list, by name: a plain list's configured\n// columns. A cross-tab offers none, since its columns are pivot values that\n// come and go with the data.\nexport function listHideableColumns(config: ListConfig | null | undefined): string[] {\n return config?.pivotBy?.column\n ? []\n : (config?.columns ?? []).map((column) => column.column);\n}\n\n// The hidden column names a list honors: only columns it can hide, each once,\n// in the list's own order, and none at all when they would hide every column\n// (a list always shows one, and the server ignores such a CSV list too). The\n// filter state, the screen and every export read this one rule.\nexport function listHiddenColumns(config: ListConfig | null | undefined, names: readonly string[]): string[] {\n const hideable = listHideableColumns(config);\n const hidden = hideable.filter((name) => names.includes(name));\n\n return hidden.length < hideable.length ? hidden : [];\n}\n\n// How many leading columns stay in view while a wide list scrolls sideways.\n// Unset, a cross-tab pins its row-key column and a plain list pins none. A\n// cross-tab pins at most that one column, since the rest are pivot values; a\n// stored config that asks for more is clamped here, as the server refuses it\n// only on save.\nexport function listPinnedColumns(config: ListConfig | null | undefined): number {\n const crossTab = !!config?.pivotBy?.column;\n const pinned = config?.pinnedColumns ?? (crossTab ? 1 : 0);\n\n return Math.min(Math.max(Math.floor(Number(pinned) || 0), 0), crossTab ? 1 : MAX_PINNED_COLUMNS);\n}\n\n// The classes a list column carries on its header, cells and footer. fs-list\n// copies a column's classes once, when it builds the column, so they are\n// static: `report-pin-{index}` names the column's place among the pinned ones\n// (its left offset is a CSS variable the list measures), `report-pin-last`\n// draws the separator after the last pinned column, and `report-nowrap` keeps\n// the column's cells on one line.\nexport function columnClasses(column: ListColumn, index: number, pinned: number): string {\n const classes: string[] = [];\n\n if (index < pinned) {\n classes.push('report-pinned', `report-pin-${index}`);\n\n if (index === pinned - 1) {\n classes.push('report-pin-last');\n }\n }\n\n if (column.wrap === false) {\n classes.push('report-nowrap');\n }\n\n return classes.join(' ');\n}\n\n// The label a list's totals row writes, on screen and in the PDF and deck.\nexport const LIST_TOTAL_LABEL = 'Total';\n\n// The column of a totals row that carries LIST_TOTAL_LABEL, among the columns\n// shown, in order: the first one, unless it holds a total itself, in which\n// case the row has no label. A cross-tab's first column is its row key, which\n// never holds one.\nexport function listTotalsLabelColumn(\n columns: readonly ListColumn[],\n totals: Record<string, unknown> | null | undefined,\n): string | null {\n const first = columns[0];\n\n return first && totals?.[first.column] === undefined ? first.column : null;\n}\n\n// How a list column that holds a compared, windowed, ranked or shared output\n// is written (format.ts formatOutputValue): what it holds, the format of its\n// source measure's column, which a prior or a change takes when it names none,\n// the alias of the prior in its lane, whose value in the same row tells a\n// missing baseline from a zero one, and the first day with data.\nexport interface ListOutputColumn {\n output: OutputMeta;\n measureSpec: NumberFormatSpec | null;\n priorAlias: string | null;\n floor: string | null;\n}\n\n// The output columns among a list's columns, by column name, from the\n// metadata its data carries. A cross-tab cell column takes its measure's\n// meaning through cellMeasures; its cells all share the grid's cellFormat and\n// have no prior beside them, since a cross-tab never compares. A column with\n// no output metadata (a plain measure or dimension, an older server) is left\n// out and written as before.\nexport function listOutputColumns(\n columns: readonly ListColumn[],\n data: Pick<ComponentData, 'outputs' | 'cellMeasures' | 'comparison'> | null | undefined,\n authored: readonly ListColumn[],\n): Record<string, ListOutputColumn> {\n const outputs = data?.outputs ?? {};\n const resolved: Record<string, ListOutputColumn> = {};\n\n columns.forEach((column) => {\n const cellMeasure = data?.cellMeasures?.[column.column];\n const alias = cellMeasure ?? column.column;\n const output = outputs[alias];\n\n if (output) {\n resolved[column.column] = {\n output,\n measureSpec: authored.find((source) => source.column === output.measure) ?? null,\n priorAlias: cellMeasure ? null : listPriorAlias(outputs, alias, output),\n floor: data?.comparison?.floor ?? null,\n };\n }\n });\n\n return resolved;\n}\n\n// A change's or a percent change's prior in the same lane; null for any other\n// output.\nfunction listPriorAlias(outputs: Record<string, OutputMeta>, alias: string, output: OutputMeta): string | null {\n return output.role === 'change' || output.role === 'percent_change'\n ? laneOutputAlias(outputs, alias, 'prior')\n : null;\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 { DAY_SHORT, formatLocalDate } from './format';\nimport {\n ChartGranularity, FilterGroupValue, GRANULARITY_OPTIONS, Report, ReportFilterGroup, ReportFilterOption,\n ReportLocaleTag,\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.\n//\n// The day is written in the report's locale, as its date cells are: 'Jan 5,\n// 2026' in en-US, '5 janv. 2026' in fr-CA.\nexport function dateBoundLabel(value: Date | string | null | undefined, locale: ReportLocaleTag): 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) : formatLocalDate(date, locale, DAY_SHORT);\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// The query key of a list's search box in its component header. Fixed rather\n// than derived from an id because a header holds at most one, and it is NOT a\n// filter group: its text narrows that list alone, so it is read straight off\n// the change query and travels as the list's own `state.search`.\nexport const LIST_SEARCH_ITEM = 'listSearch';\n\n// The longest search the server applies (ReportQueryRunner::MAX_SEARCH_LENGTH).\n// The viewer cuts the text to it too, so the URL, the request and the export\n// title all carry the text that was actually searched.\nexport const LIST_SEARCH_MAX_LENGTH = 100;\n\n// The fs-filter config item for a list's search box, seeded with the text the\n// viewer last searched. fs-filter shows one search box per bar (its last\n// keyword item), so the caller adds this only to a header with no keyword\n// group of its own.\nexport function listSearchItem(value: string | null): IFilterConfigItem {\n return {\n type: ItemType.Keyword,\n name: LIST_SEARCH_ITEM,\n label: 'Search',\n default: value ?? undefined,\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 { 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&q31=north&h31=notes,total\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// - q<componentId>: the text in a list's search box.\n// - h<componentId>: the columns a viewer hid on a list (encodeColumnList).\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// The prefix of a list's search key.\nexport const LIST_SEARCH_PARAM_PREFIX = 'q';\n\n// The prefix of a list's hidden-columns key.\nexport const LIST_HIDDEN_PARAM_PREFIX = 'h';\n\n// The prefixes of the keys this codec owns, each followed by an id.\nconst OWNED_PREFIXES = [\n GROUP_PARAM_PREFIX, LIST_SORT_PARAM_PREFIX, LIST_SEARCH_PARAM_PREFIX, LIST_HIDDEN_PARAM_PREFIX,\n];\n\n// A key this codec owns: a group value, or a list's sort, search or hidden\n// columns. Any such key the snapshot no longer carries is removed from the\n// URL, so a host must not keep its own state under a key of this shape (one\n// of the prefixes above, then digits).\nexport const OWNED_PARAM = new RegExp(`^[${OWNED_PREFIXES.join('')}]\\\\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 const listSearches = new Map<number, string>();\n const listHidden = new Map<number, string>();\n // Each owned prefix names the map its keys go to; a prefix with no entry\n // here is never read as some other kind of state.\n const byPrefix: Record<string, Map<number, string>> = {\n [GROUP_PARAM_PREFIX]: groups,\n [LIST_SORT_PARAM_PREFIX]: listSorts,\n [LIST_SEARCH_PARAM_PREFIX]: listSearches,\n [LIST_HIDDEN_PARAM_PREFIX]: listHidden,\n };\n\n for (const key of params.keys) {\n if (OWNED_PARAM.test(key)) {\n byPrefix[key.charAt(0)]?.set(Number(key.slice(1)), params.get(key) ?? '');\n }\n }\n\n return { groups, listSorts, listSearches, listHidden, groupBy: params.get(GROUP_BY_ITEM) };\n}\n\n// A list's hidden column names as one param value. A name is a query's output\n// alias, which can hold a comma, so each is percent-encoded before the join.\nexport function encodeColumnList(names: readonly string[]): string {\n return names.map((name) => encodeURIComponent(name)).join(',');\n}\n\n// The column names of a hidden-columns param, in its order. Empty items are\n// dropped, and an item that does not decode (a hand-edited '%') is kept as\n// written. Whether a name is a column of the list is the caller's check.\nexport function decodeColumnList(raw: string): string[] {\n return raw.split(',')\n .filter((item) => item !== '')\n .map((item) => {\n try {\n return decodeURIComponent(item);\n } catch {\n return item;\n }\n });\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 // The text as typed: the router percent-encodes it in the URL.\n snapshot.listSearches.forEach((search, componentId) => {\n params[`${LIST_SEARCH_PARAM_PREFIX}${componentId}`] = search;\n });\n\n snapshot.listHidden.forEach((names, componentId) => {\n params[`${LIST_HIDDEN_PARAM_PREFIX}${componentId}`] = encodeColumnList(names);\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","// What a formula value works out of the query values it reads on its page\n// (config.formula.of): change is a - b, percent_change (a - b) / |b| as a 0-1\n// fraction, ratio a / b, and sum adds 2 to 10 values. The server evaluates\n// it; the viewer only formats the number.\n//\n// Mirrors the server's ValueFormulaEnum value for value.\nexport enum ReportValueFormula {\n Change = 'change',\n PercentChange = 'percent_change',\n Ratio = 'ratio',\n Sum = 'sum',\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. A table may sit at the top level of a block: table,\n// thead, tbody, tfoot, tr, th and td, a width on the table, and on a cell\n// text-align, vertical-align, background-color, a width and a colspan or\n// rowspan. Its grid lines, padding and margin are never stored: every renderer\n// draws them from the TEXT_TABLE_* constants below. Transparent, currentcolor\n// and the CSS-wide keywords (inherit, initial, …) are not colors, so the\n// server drops them and hexColor reads them as no color. Everything here only\n// 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// A table's grid lines: their color, and their width in points (0.75pt is one\n// pixel on the canvas). The html never stores borders or padding\n// (ReportTextHtml drops them), so the canvas, the editor and both exports all\n// draw this one look.\nexport const TEXT_TABLE_BORDER_COLOR = '#cbd2d9';\nexport const TEXT_TABLE_BORDER_WIDTH = 0.75;\n// The space between a cell's grid lines and its words, in points.\nexport const TEXT_TABLE_CELL_PADDING = { vertical: 2, horizontal: 4 };\n// The space above and below a table, between it and the words around it, in\n// points.\nexport const TEXT_TABLE_MARGIN = 4;\n\n// A live value a block shows inline, written {{value.<key>}} in its html: what\n// the value is, and its formatted text once loaded. Values belong to the page\n// the block sits on (the master for a header or footer block), so the key is\n// unique within that page.\nexport interface TextValue {\n name: string;\n // Absent while loading, and when the value's query failed.\n text?: string;\n // Its number has been asked for and has not arrived yet.\n loading?: boolean;\n // A formula's operand keys, lowercase: the values it reads, which the page\n // reads too while the formula is shown.\n reads?: string[];\n}\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 // The page's values, by lowercase key.\n values?: Record<string, TextValue>;\n // The report page whose values the block shows: the page it sits on, or the\n // master for a header or footer block. It is also the editor's clipboard\n // scope, so a copied chip pastes back as a chip only on that page.\n valuePageId?: number | null;\n}\n\n// A value token: {{value.total_visits}}. Keys are lowercase letters, digits and\n// underscores, starting with a letter.\nexport const VALUE_TOKEN_PATTERN = /\\{\\{\\s*value\\.([a-z][a-z0-9_]*)\\s*\\}\\}/gi;\n\n// What a value with no number reads as — it failed, it is not on this page, or\n// its query found nothing — so a block never prints a raw token.\nexport const VALUE_EMPTY_TEXT = '—';\n\n// What a value reads as while its number is on its way (on screen only: an\n// export waits for every number).\nexport const VALUE_LOADING_TEXT = '…';\n\nexport function valueToken(key: string): string {\n return `{{value.${key}}}`;\n}\n\n// What a value reads as in a block, viewed or edited: its formatted number,\n// the ellipsis while that loads, else the em dash.\nexport function valueText(value: TextValue | undefined): string {\n return value?.text ?? (value?.loading ? VALUE_LOADING_TEXT : VALUE_EMPTY_TEXT);\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// One cell of a table in a block. Its words are paragraphs like any others: a\n// <br> in a cell starts a new one, and a header cell's runs are bold. Each\n// paragraph carries the cell's alignment unless it has its own, so every\n// renderer reads alignment and weight from the paragraphs.\nexport interface TextTableCell {\n paragraphs: TextParagraph[];\n colSpan: number;\n // Cut at the last row of the cell's section, as a browser draws it.\n rowSpan: number;\n // Where the cell sits in the grid (tableGrid), 0-based: its top row and its\n // left column.\n row: number;\n column: number;\n // Its text-align, else centered for a header cell and left for any other.\n align: 'left' | 'center' | 'right' | 'justify';\n valign?: 'top' | 'middle' | 'bottom';\n // Its background, #rrggbb.\n fill?: string;\n}\n\n// A table's row. Rows come in the order a browser draws them: the head, the\n// body, then the foot.\nexport interface TextTableRow {\n section: 'head' | 'body' | 'foot';\n cells: TextTableCell[];\n}\n\nexport interface TextTable {\n rows: TextTableRow[];\n // How many columns the grid has: the widest right edge of any cell.\n columns: number;\n}\n\n// A block as the exports draw it: its words, split at each table it holds.\nexport type TextBlock =\n | { kind: 'text'; paragraphs: TextParagraph[] }\n | { kind: 'table'; table: TextTable };\n\n// What a table's cells are joined by where it reads as lines of text.\nconst TABLE_CELL_SEPARATOR = ' · ';\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. A {{value.<key>}} token reads\n// as its formatted number, the ellipsis while that loads, else the em dash.\nexport function fillTextTokens(html: string, context: TextTokenContext): string {\n return html\n .replace(VALUE_TOKEN_PATTERN, (match, key: string) => escapeHtml(\n valueText(context.values?.[key.toLowerCase()]),\n ))\n .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 what the exports draw: the words between its tables\n// as paragraphs of styled runs, and each table as a grid of cells. Tokens are\n// filled first so a page number is just text by then. There is a text part for\n// every run of nodes splitAtTables finds, even one that holds no words, so the\n// nth text part is the nth run the export's DOM measure finds.\nexport function textBlocks(html: string, context: TextTokenContext): TextBlock[] {\n const document = new DOMParser().parseFromString(`<body>${fillTextTokens(html, context)}</body>`, 'text/html');\n const blocks = splitAtTables(document.body).map((part): TextBlock => {\n if (!Array.isArray(part)) {\n return { kind: 'table', table: parseTable(part) };\n }\n\n const fragment = document.createDocumentFragment();\n const paragraphs: TextParagraph[] = [];\n fragment.append(...part);\n walkBlocks(fragment, paragraphs, null);\n\n return { kind: 'text', paragraphs };\n });\n\n trimBlankEnd(blocks);\n\n return blocks;\n}\n\n// The block as paragraphs alone, for anything that draws no grid: a table reads\n// as a line per row, its cells' words joined by ' · '.\nexport function textParagraphs(html: string, context: TextTokenContext): TextParagraph[] {\n return blockParagraphs(textBlocks(html, context));\n}\n\n// Blocks textBlocks already walked, as textParagraphs reads them.\nexport function blockParagraphs(blocks: TextBlock[]): TextParagraph[] {\n return blocks.flatMap((block) => block.kind === 'text'\n ? block.paragraphs\n : block.table.rows.map(rowParagraph));\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\n// A block's top-level nodes split at each table: each table on its own, and\n// each run of the nodes between them as a list. A table sits only at the top\n// level (ReportTextHtml flattens any other), so this is the whole split.\n// textBlocks and the export's measure of the rendered block both split here.\nexport function splitAtTables(parent: Node): (Node[] | HTMLTableElement)[] {\n const parts: (Node[] | HTMLTableElement)[] = [];\n let run: Node[] | null = null;\n\n parent.childNodes.forEach((node) => {\n if (node.nodeName === 'TABLE') {\n parts.push(node as HTMLTableElement);\n run = null;\n } else if (run) {\n run.push(node);\n } else {\n run = [node];\n parts.push(run);\n }\n });\n\n return parts;\n}\n\n// A table as a grid of cells, each holding its words as paragraphs. Rows come\n// as a browser draws them, the head first and the foot last, whatever order the\n// html writes its sections in.\nexport function parseTable(element: HTMLTableElement): TextTable {\n const rows = Array.from(element.rows, (row): TextTableRow => ({\n section: tableSection(row),\n cells: Array.from(row.cells, tableCell),\n }));\n\n return tableGrid({ rows, columns: 0 });\n}\n\n// Where each cell sits, by the HTML table algorithm: a cell takes the first\n// column of its row that no cell spanning down from a row above holds. A rowspan\n// stops at the last row of its section, as a browser draws it, and the grid is\n// as wide as the widest right edge of any cell.\nexport function tableGrid(table: TextTable): TextTable {\n const taken: boolean[][] = table.rows.map(() => []);\n let columns = 0;\n\n const rows = table.rows.map((row, index): TextTableRow => {\n const sectionEnd = rowSectionEnd(table.rows, index);\n let column = 0;\n\n const cells = row.cells.map((cell): TextTableCell => {\n while (taken[index][column]) {\n column++;\n }\n\n const placed = { ...cell, row: index, column, rowSpan: Math.min(cell.rowSpan, sectionEnd - index) };\n occupy(taken, placed);\n column += placed.colSpan;\n columns = Math.max(columns, column);\n\n return placed;\n });\n\n return { ...row, cells };\n });\n\n return { rows, columns };\n}\n\nfunction tableSection(row: HTMLTableRowElement): TextTableRow['section'] {\n const section = row.parentElement?.nodeName;\n\n return section === 'THEAD' ? 'head' : section === 'TFOOT' ? 'foot' : 'body';\n}\n\n// One th or td. A header cell's runs are bold, and every paragraph takes the\n// cell's text-align unless it has its own: the default look centers a header\n// cell and puts any other on the left.\nfunction tableCell(cell: HTMLTableCellElement): TextTableCell {\n const header = cell.nodeName === 'TH';\n const align = cellAlign(cell.style.textAlign) ?? (header ? 'center' : 'left');\n const valign = cell.style.verticalAlign;\n const paragraphs: TextParagraph[] = [];\n\n walkBlocks(cell, paragraphs, null, header ? { bold: true } : {});\n\n return {\n paragraphs: paragraphs.map((paragraph) => ({ ...paragraph, align: paragraph.align ?? align })),\n colSpan: Math.max(1, cell.colSpan),\n rowSpan: Math.max(1, cell.rowSpan),\n row: 0,\n column: 0,\n align,\n valign: valign === 'top' || valign === 'middle' || valign === 'bottom' ? valign : undefined,\n fill: cell.style.backgroundColor ? hexColor(cell.style.backgroundColor) : undefined,\n };\n}\n\nfunction cellAlign(value: string): TextTableCell['align'] | undefined {\n return value === 'left' || value === 'center' || value === 'right' || value === 'justify' ? value : undefined;\n}\n\n// The index just past the last row of the section the row at index sits in.\nfunction rowSectionEnd(rows: TextTableRow[], index: number): number {\n let end = index + 1;\n while (end < rows.length && rows[end].section === rows[index].section) {\n end++;\n }\n\n return end;\n}\n\n// Mark the grid slots a placed cell covers.\nfunction occupy(taken: boolean[][], cell: TextTableCell): void {\n for (let row = cell.row; row < cell.row + cell.rowSpan; row++) {\n for (let column = cell.column; column < cell.column + cell.colSpan; column++) {\n taken[row][column] = true;\n }\n }\n}\n\n// A table row as one line of text: its cells in order, a cell's own lines\n// joined by a space.\nfunction rowParagraph(row: TextTableRow): TextParagraph {\n return {\n runs: row.cells.flatMap((cell, index) => [\n ...(index ? [{ text: TABLE_CELL_SEPARATOR }] : []),\n ...cell.paragraphs.flatMap((paragraph, line) => [...(line ? [{ text: ' ' }] : []), ...paragraph.runs]),\n ]),\n };\n}\n\n// An empty paragraph is a blank line the canvas draws (<p><br></p>, or an empty\n// <p>), so one at the start of the block keeps the words below it where the\n// canvas puts them. At the end of the whole block it draws nothing, and is\n// dropped so it never counts as running past the box. An empty paragraph\n// before a table is not at the end.\nfunction trimBlankEnd(blocks: TextBlock[]): void {\n const last = blocks[blocks.length - 1];\n\n while (last?.kind === 'text' && last.paragraphs.length && !last.paragraphs[last.paragraphs.length - 1].runs.length) {\n last.paragraphs.pop();\n }\n}\n\n// base is the style every run starts from: bold for a header cell's words.\nfunction walkBlocks(\n parent: Node,\n paragraphs: TextParagraph[],\n list: 'bullet' | 'number' | null,\n base: Partial<TextRun> = {},\n): void {\n // Loose inline content between blocks (text straight under the block, an\n // <li> or a cell) is gathered into a paragraph of its own.\n let loose: TextParagraph | null = null;\n const flush = () => {\n if (loose && isShown(loose)) {\n paragraphs.push(loose);\n }\n loose = null;\n };\n\n parent.childNodes.forEach((node) => {\n const name = node.nodeName.toLowerCase();\n\n if (name === 'ul' || name === 'ol' || name === 'li' || name === 'p' || /^h[1-3]$/.test(name)) {\n flush();\n walkBlock(node as HTMLElement, paragraphs, list, base);\n\n return;\n }\n\n loose = loose ?? { runs: [] };\n walkInline(node, base, loose, paragraphs, true);\n });\n\n flush();\n}\n\n// Whether loose content's last line shows anything. Whitespace alone between\n// blocks is not drawn, and a line a <br> ended was pushed when it ended, so a\n// trailing <br> adds no empty line after it.\nfunction isShown(loose: TextParagraph): boolean {\n return loose.runs.some((run) => /[^ \\t\\n\\r\\f]/.test(run.text));\n}\n\nfunction walkBlock(\n element: HTMLElement,\n paragraphs: TextParagraph[],\n list: 'bullet' | 'number' | null,\n base: Partial<TextRun>,\n): void {\n const name = element.nodeName.toLowerCase();\n\n if (name === 'ul' || name === 'ol') {\n walkBlocks(element, paragraphs, name === 'ul' ? 'bullet' : 'number', base);\n } else if (name === 'li') {\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(element, nested, list, base);\n const [first, ...rest] = nested.length ? nested : [item];\n paragraphs.push({ ...first, bullet: list ?? 'bullet' }, ...rest);\n } else {\n walkParagraph(element, paragraphs, base);\n }\n}\n\n// A p or a heading. A <br> ends a line, so its last line is pushed only when it\n// holds words or no <br> came before it: <p><br></p> is one blank line,\n// <p>a<br></p> one line and <p>a<br>b</p> two, as a browser draws them.\nfunction walkParagraph(element: HTMLElement, paragraphs: TextParagraph[], base: Partial<TextRun>): void {\n const name = element.nodeName.toLowerCase();\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 style: Partial<TextRun> = heading\n ? { ...base, bold: true, fontSize: HEADING_TEXT_SIZES[heading] }\n : base;\n\n const breaks = walkInline(element, style, paragraph, paragraphs);\n if (paragraph.runs.length || !breaks) {\n paragraphs.push(paragraph);\n }\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.\n// Returns how many lines a <br> ended.\nfunction walkInline(\n node: Node,\n style: Partial<TextRun>,\n paragraph: TextParagraph,\n paragraphs: TextParagraph[],\n isSelf = false,\n): number {\n const nodes = isSelf ? [node] : Array.from(node.childNodes);\n\n return nodes.reduce((breaks, child) => breaks + walkInlineNode(child, style, paragraph, paragraphs), 0);\n}\n\nfunction walkInlineNode(\n node: Node,\n style: Partial<TextRun>,\n paragraph: TextParagraph,\n paragraphs: TextParagraph[],\n): number {\n if (node.nodeType === Node.TEXT_NODE) {\n const text = node.textContent ?? '';\n if (text) {\n paragraph.runs.push({ ...style, text });\n }\n\n return 0;\n }\n\n if (node.nodeType !== Node.ELEMENT_NODE) {\n return 0;\n }\n\n const element = node as HTMLElement;\n\n if (element.nodeName.toLowerCase() === 'br') {\n paragraphs.push({ ...paragraph, runs: [...paragraph.runs] });\n paragraph.runs.length = 0;\n\n return 1;\n }\n\n return walkInline(element, { ...style, ...inlineStyle(element) }, paragraph, paragraphs);\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 // What is no color leaves the color the run inherits.\n const css = element.style;\n const color = css.color ? hexColor(css.color) : undefined;\n const highlight = css.backgroundColor ? hexColor(css.backgroundColor) : undefined;\n if (color) {\n style.color = color;\n }\n if (highlight) {\n style.highlight = highlight;\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. A value that is no color of its\n// own (inherit, currentcolor, a typo) or paints nothing (transparent, an alpha\n// of 0) is undefined, so an export never paints it black.\nlet colorContext: CanvasRenderingContext2D | null = null;\n\nfunction hexColor(value: string): string | undefined {\n colorContext = colorContext ?? document.createElement('canvas').getContext('2d');\n if (!colorContext || /^\\s*currentcolor\\s*$/i.test(value)) {\n return undefined;\n }\n\n // A value the canvas cannot read leaves the color set before it, so it reads\n // back one way over black and another over white. (currentcolor reads as\n // black over both, hence the check above.)\n const resolved = resolveColor(colorContext, '#000000', value);\n if (resolved !== resolveColor(colorContext, '#ffffff', value)) {\n return undefined;\n }\n\n if (resolved.startsWith('#')) {\n return resolved;\n }\n\n // rgba(...) for a translucent color — drop the alpha, keep the hue.\n const [red, green, blue, alpha] = resolved.match(/[\\d.]+/g)?.map(Number) ?? [];\n\n return blue === undefined || alpha === 0\n ? undefined\n : `#${[red, green, blue].map((channel) => Math.round(channel).toString(16).padStart(2, '0')).join('')}`;\n}\n\n// What the canvas reads value as, set over seed.\nfunction resolveColor(context: CanvasRenderingContext2D, seed: string, value: string): string {\n context.fillStyle = seed;\n context.fillStyle = value;\n\n return String(context.fillStyle);\n}\n\nexport function escapeHtml(value: string): string {\n return value\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"');\n}\n","import { ReportValueFormula } from './enums/report-value-formula.enum';\nimport { formatOutputValue } from './format';\nimport {\n NumberFormatSpec,\n OutputMeta,\n Report,\n ReportComponent,\n ReportFormatContext,\n ReportPageValue,\n ValueFormulaConfig,\n} from './interfaces/report.interface';\nimport { TextValue, VALUE_EMPTY_TEXT, VALUE_TOKEN_PATTERN } from './text';\n\n\n// Live values inside text blocks: which values a page's text shows, and what\n// each token reads as. A value belongs to a page (the master for a header or\n// footer) and is listed in its `values`, never in its components. Pure, so the\n// canvas and both exports fill a block's tokens the same way.\n\n// No value keys: what a text block is told other blocks show when nothing\n// says otherwise. Shared, and typed read-only so no caller fills it.\nexport const NO_VALUE_KEYS: ReadonlySet<string> = Object.freeze(new Set<string>());\n\n// The keys an html's {{value.<key>}} tokens name: lowercased, each once, in\n// the order they first appear.\nexport function valueKeys(html: string | null | undefined): string[] {\n const keys = Array.from((html ?? '').matchAll(VALUE_TOKEN_PATTERN), (match) => match[1].toLowerCase());\n\n return [...new Set(keys)];\n}\n\n// The key a value's tokens name, as they are compared: lowercase.\nexport function valueKey(component: ReportComponent): string {\n return String(component.config?.key ?? '').toLowerCase();\n}\n\n// The keys a formula value reads (config.formula.of), as they are compared:\n// lowercase. None for a query value.\nexport function operandKeys(value: ReportComponent): string[] {\n const of = value.config?.formula?.of;\n\n return Array.isArray(of) ? of.map((key) => String(key).toLowerCase()) : [];\n}\n\n// The values some text shows, in id order: what the server reads for the\n// page. A key held by two values (a race between two writes) is the newest\n// one's, as server-side.\nexport function shownValues(values: ReportComponent[], texts: ReportComponent[]): ReportComponent[] {\n const shown = new Set(texts.flatMap((text) => valueKeys(text.config?.html)));\n const ordered = byId(values);\n const newest = new Map(ordered.map((value) => [valueKey(value), value]));\n\n return ordered.filter((value) => shown.has(valueKey(value)) && newest.get(valueKey(value)) === value);\n}\n\n// The keys a layer reads when its text shows `shown`: those keys, and the\n// operands of each shown formula, one level deep. It mirrors the server's\n// ReportTextValues::getReadKeys, and is used only for the editor's notice: the\n// server's own read set decides which numbers come back.\nexport function readKeys(shown: Iterable<string>, values: Record<string, TextValue>): Set<string> {\n const keys = new Set(shown);\n\n // Over a copy of the shown keys, so an operand added here is not expanded.\n [...keys].forEach((key) => {\n (values[key]?.reads ?? []).forEach((read) => keys.add(read));\n });\n\n return keys;\n}\n\n// What each of a layer's values reads as, by key, for its text's tokens and\n// chips. Every value is listed, shown or not, so a pasted chip keeps its name.\n// A value reads as loading until the layer's numbers have arrived (`results`\n// is null until then) and while a request still on its way asks for it\n// (`loading`, by id): a number on screen is always the current request's. A\n// value with no row, or whose row failed, has no text (the em dash).\nexport function textValues(\n values: ReportComponent[],\n results: { rows: ReadonlyMap<number, ReportPageValue> } | null,\n format: ReportFormatContext,\n loading: ReadonlySet<number> = new Set(),\n): Record<string, TextValue> {\n const filled: Record<string, TextValue> = {};\n\n byId(values).forEach((value) => {\n const key = valueKey(value);\n const name = value.title || key;\n const row = results?.rows.get(value.id);\n const reads = formulaReads(value);\n\n if (!results || loading.has(value.id)) {\n filled[key] = { name, loading: true, ...reads };\n } else if (row && !row.error) {\n filled[key] = { name, text: formatValueText(value, row, values, format), ...reads };\n } else {\n filled[key] = { name, ...reads };\n }\n });\n\n return filled;\n}\n\n// A value's number as its token reads it, on the canvas and in both exports,\n// through the formatOutputValue KPI cards and list cells use. A query value\n// that shows a comparison output, and a formula, are written by their role: a\n// change or a percent change is signed (unless the formula's `signed` says\n// otherwise), and a change in points carries no ' pp', as the words around\n// the token carry the unit. A change or a sum with no format of its own takes\n// its first operand's, and a ratio reads a percent format as a 0-1 fraction.\n// A row with an error reads as the em dash.\nexport function formatValueText(\n value: ReportComponent,\n row: ReportPageValue,\n layerValues: ReportComponent[],\n ctx: ReportFormatContext,\n): string {\n if (row.error) {\n return VALUE_EMPTY_TEXT;\n }\n\n const formula = value.config?.formula ?? null;\n const output: OutputMeta | null = row.role || formula\n ? {\n measure: valueKey(value),\n kind: 'value',\n role: row.role ?? null,\n offset: null,\n window: false,\n rank: null,\n share: null,\n }\n : null;\n const context = formula?.op === ReportValueFormula.Ratio ? { ...ctx, ratioPercent: true } : ctx;\n\n return formatOutputValue(row.value, output, value.config?.measure, context, {\n empty: VALUE_EMPTY_TEXT,\n measureSpec: operandSpec(formula, layerValues),\n signed: formula?.signed ?? undefined,\n pointsUnit: false,\n }).text;\n}\n\n// The keys of the values that came back without a number to show: no row for\n// them, or a row with an error. What an export's gate names as failed.\nexport function failedValueKeys(\n values: ReportComponent[],\n rows: ReadonlyMap<number, ReportPageValue>,\n): string[] {\n const failed = values\n .filter((value) => {\n const row = rows.get(value.id);\n\n return !row || !!row.error;\n })\n .map(valueKey);\n\n return [...new Set(failed)];\n}\n\n// Whether two token value sets read the same, so a recomputed set that changed\n// nothing a token shows does not repaint every block.\nexport function sameTextValues(\n a: Record<string, TextValue> | undefined,\n b: Record<string, TextValue> | undefined,\n): boolean {\n if (a === b) {\n return true;\n }\n\n if (!a || !b) {\n return false;\n }\n\n const keys = Object.keys(a);\n\n return keys.length === Object.keys(b).length\n && keys.every((key) => {\n const other = b[key];\n\n return !!other\n && a[key].name === other.name\n && a[key].text === other.text\n && !!a[key].loading === !!other.loading\n && (a[key].reads ?? []).join(',') === (other.reads ?? []).join(',');\n });\n}\n\n// Every component of the report, values included: what owns a filter. A value\n// is never drawn, but its filters are the report's like any other.\nexport function reportComponents(report: Report | null): ReportComponent[] {\n if (!report) {\n return [];\n }\n\n return [\n ...(report.pages ?? []).flatMap((page) => [...(page.components ?? []), ...(page.values ?? [])]),\n ...(report.master?.components ?? []),\n ...(report.master?.values ?? []),\n ];\n}\n\n// The value keys each layer holds, by page id and master id. A key that leaves\n// its layer between two loads of the report is a value that was deleted.\nexport function layerValueKeys(report: Report | null): Map<number, Set<string>> {\n const layers = new Map<number, Set<string>>();\n\n (report?.pages ?? []).forEach((page) => {\n layers.set(page.id, new Set((page.values ?? []).map(valueKey)));\n });\n\n if (report?.master) {\n layers.set(report.master.id, new Set((report.master.values ?? []).map(valueKey)));\n }\n\n return layers;\n}\n\n// Whether a component is drawn on the canvas. A value only ever reads inside\n// text, so one that leaks into a layer's components is still never drawn.\nexport function isDrawn(component: ReportComponent): boolean {\n return component.type !== 'value';\n}\n\nfunction byId(values: ReportComponent[]): ReportComponent[] {\n return [...values].sort((a, b) => a.id - b.id);\n}\n\n// A formula value's operand keys, lowercase, as its TextValue carries them.\n// Nothing for a query value.\nfunction formulaReads(value: ReportComponent): Pick<TextValue, 'reads'> {\n return Array.isArray(value.config?.formula?.of) ? { reads: operandKeys(value) } : {};\n}\n\n// The format a change or a sum is written in when it names none of its own:\n// its first operand's measure, from the newest value on the layer holding that\n// key. Nothing for any other value, whose own format is all it reads.\nfunction operandSpec(\n formula: ValueFormulaConfig | null,\n layerValues: ReportComponent[],\n): NumberFormatSpec | undefined {\n if (formula?.op !== ReportValueFormula.Change && formula?.op !== ReportValueFormula.Sum) {\n return undefined;\n }\n\n const first = String(formula.of?.[0] ?? '').toLowerCase();\n\n return byId(layerValues).filter((value) => valueKey(value) === first).pop()?.config?.measure;\n}\n","import { Injectable, signal } from '@angular/core';\n\nimport { Observable, Subject } from 'rxjs';\nimport { map, 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 {\n DEFAULT_FORMAT_CONTEXT, getZonedNow, resolveFormatContext, resolveReportTimezone,\n} 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 ReportFormatContext,\n ReportRelativeRange,\n ReportSort,\n ReportUrlParams,\n ReportUrlSnapshot,\n ResolvedFilterValue,\n} from '../interfaces/report.interface';\nimport { listHiddenColumns, listSortTerms } from '../list-config';\nimport { dateBoundString, LIST_SEARCH_MAX_LENGTH } from '../report-filter-items';\nimport { decodeColumnList, decodeFilterValue, decodeSort } from '../report-url-state';\nimport { reportComponents } from '../values';\n\n\n// Every relative range name the server knows. A record rather than a list, so\n// the build fails when ReportRelativeRange gains a name this misses.\nconst RELATIVE_RANGES: Record<ReportRelativeRange, true> = {\n thisWeek: true,\n lastWeek: true,\n last7Days: true,\n last30Days: true,\n last3Months: true,\n last6Months: true,\n last12Months: true,\n thisMonth: true,\n thisQuarter: true,\n thisYear: true,\n yearToDate: true,\n};\n\n\n// Whether a stored preset name is one the server resolves (ReportRelativeRange).\nfunction isRelativeRange(name: string): name is ReportRelativeRange {\n return Object.prototype.hasOwnProperty.call(RELATIVE_RANGES, name);\n}\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 a value read off a filter bar is the value already stored for its\n// group: the same calendar days, the same select values in the same order and\n// the same trimmed text. A bar re-reads every group it shows on any change, so\n// this is what tells the group that changed from the ones that did not.\nexport function sameFilterValue(\n a: FilterGroupValue | null | undefined,\n b: FilterGroupValue | null | undefined,\n): boolean {\n if (!a || !b) {\n return !a && !b;\n }\n\n const values = (value: FilterGroupValue) => (value.values ?? []).map(String);\n\n return sameDays(a, b)\n && values(a).join('\\u0000') === values(b).join('\\u0000')\n && values(a).length === values(b).length\n && (a.value ?? '').trim() === (b.value ?? '').trim();\n}\n\n\n// The groups a bar re-read that it now shows with a value other than the one\n// it last reported, recording each new value in `lastReported`. A bar is\n// compared with itself, never with the stored value: a group shown in two bars\n// (level 'both') can be changed in the other one, and this bar is not\n// repainted, so its stale value must not be set back when the viewer changes\n// another of its items (the list search box, say).\nexport function movedGroupValues(\n lastReported: Map<number, FilterGroupValue | null>,\n reported: { groupId: number; value: FilterGroupValue | null }[],\n): { groupId: number; value: FilterGroupValue | null }[] {\n return reported.filter(({ groupId, value }) => {\n if (sameFilterValue(lastReported.get(groupId), value)) {\n return false;\n }\n\n lastReported.set(groupId, value);\n\n return true;\n });\n}\n\n\n// A list's search text as the server applies it: trimmed, then cut to\n// LIST_SEARCH_MAX_LENGTH characters (code points, as the server counts them).\nexport function listSearchText(text: string): string {\n return [...text.trim()].slice(0, LIST_SEARCH_MAX_LENGTH).join('');\n}\n\n\n// Whether two lists of column names are the same names in the same order.\nfunction sameNames(a: readonly string[], b: readonly string[]): boolean {\n return a.length === b.length && a.every((name, index) => name === b[index]);\n}\n\n\n// Whether two hidden-column maps hide the same columns on the same lists.\nfunction sameHidden(\n a: ReadonlyMap<number, readonly string[]>,\n b: ReadonlyMap<number, readonly string[]>,\n): boolean {\n return a.size === b.size\n && [...a].every(([componentId, names]) => sameNames(names, b.get(componentId) ?? []));\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, searches and hidden columns):\n// urlSnapshot() says what differs from the authored defaults, init() restores\n// it, and urlChanges() tells the host's 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 // How the open report writes its numbers and dates (resolveFormatContext):\n // its locale, its currency and whether percents arrive as ratios. Every KPI,\n // chart, date cell and export reads it here. Compared by value, so a reload\n // of an unchanged report re-renders nothing.\n public readonly formatContext = signal<ReportFormatContext>(DEFAULT_FORMAT_CONTEXT, {\n equal: (a, b) => a.locale === b.locale\n && a.currency === b.currency\n && a.ratioPercent === b.ratioPercent,\n });\n\n // The config columns a viewer hid on each plain list (listHiddenColumns),\n // by component id; a list showing every column has no entry. A signal, so a\n // list hides and shows its columns in place: the rows do not change, so\n // nothing refetches. Compared by value, so a reload that keeps every column\n // repaints nothing.\n public readonly listHidden = signal<ReadonlyMap<number, readonly string[]>>(new Map(), {\n equal: sameHidden,\n });\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 // Each list's search box text (listSearchText), by component id. A list with\n // an empty box has no entry. Held here for the same reasons as the sorts, and\n // because the box lives in the component header, not in the list.\n private _listSearches = new Map<number, string>();\n\n // The open report's lists, by component id, so a filter toggle can tell\n // which of them lose their search box (listSearchable).\n private _lists = new Map<number, ReportComponent>();\n\n // Whether the server answers a list search. List search and effectiveLocale\n // ship in the same framework change set, so a server that sends no\n // effectiveLocale has neither, and its lists show no search box.\n private _serverSearches = false;\n\n // Emits the id of the list whose search text changed.\n private _listSearchChanged$ = new Subject<number>();\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 this.formatContext.set(resolveFormatContext(report));\n // Before any search restore: listSearchable reads it.\n this._serverSearches = report.effectiveLocale !== undefined;\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 this._lists = new Map(this._listComponents(report).map((component) => [component.id, component]));\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 when it is the viewer's own: a sort that is the\n // list's authored first term is the list's default, not a choice, so it\n // clears the entry instead (the rule the URL snapshot applies). Otherwise a\n // list's first fetch would record its seeded authored term, and a list the\n // agent re-sorts later in the session would keep sending the old term\n // first. Deliberately emits no change: the list sets this from the fetch\n // that already ran with that sort, so a notification would only make it\n // refetch the same rows. Only the URL hears about it.\n public setListSort(component: ReportComponent, sort: ReportSort | null): void {\n if (sort && !sameSort(sort, listSortTerms(component.config)[0] ?? null)) {\n this._listSorts.set(component.id, sort);\n } else {\n this._listSorts.delete(component.id);\n }\n\n this._urlChanged$.next();\n }\n\n // The text a list is searched by, or null when its search box is empty.\n public listSearch(componentId: number): string | null {\n return this._listSearches.get(componentId) ?? null;\n }\n\n // Whether a list shows the search box over its text columns: it does when the\n // server answers a list search (see _serverSearches), unless one of its live\n // filters belongs to a keyword group its header shows. A bar shows one search\n // box (its last keyword item), and that one is the author's. The header, the\n // URL restore, the pruning, the data request state and the exports all read\n // this one rule, so no search narrows a list whose screen has no box showing\n // it, and no export titles a search the server did not apply.\n public listSearchable(component: ReportComponent): boolean {\n return this._serverSearches\n && component.type === 'list'\n && !(component.filters ?? []).some((filter) => {\n const group = this._groups.get(filter.filterGroupId);\n\n return filter.enabled\n && !this._sessionDisabled.has(filter.id)\n && group?.type === 'keyword'\n && (group.level === 'component' || group.level === 'both');\n });\n }\n\n // Records a list's search box text (listSearchText); an empty box clears\n // it. The header calls this on every change of any of its items, so the\n // list and the URL hear about it only when the stored text actually changed.\n public setListSearch(componentId: number, text: string): void {\n const search = listSearchText(text);\n\n if (search === (this._listSearches.get(componentId) ?? '')) {\n return;\n }\n\n if (search) {\n this._listSearches.set(componentId, search);\n } else {\n this._listSearches.delete(componentId);\n }\n\n this._listSearchChanged$.next(componentId);\n this._urlChanged$.next();\n }\n\n // The config column names a viewer hid on a list; none when it shows them all.\n public hiddenColumns(componentId: number): readonly string[] {\n return this.listHidden().get(componentId) ?? [];\n }\n\n // Records the columns a viewer hid on a list, kept to listHiddenColumns:\n // names the list cannot hide are dropped, and none (or every column) clears\n // the entry. Only the URL hears about it, and only on a real change.\n public setHiddenColumns(componentId: number, names: readonly string[]): void {\n const hidden = listHiddenColumns(this._lists.get(componentId)?.config, names);\n\n if (sameNames(hidden, this.hiddenColumns(componentId))) {\n return;\n }\n\n const next = new Map(this.listHidden());\n\n if (hidden.length) {\n next.set(componentId, hidden);\n } else {\n next.delete(componentId);\n }\n\n this.listHidden.set(next);\n this._urlChanged$.next();\n }\n\n // Fires whenever one list's search text changes, so that list refetches.\n public listSearchChanges(componentId: number): Observable<void> {\n return this._listSearchChanged$.asObservable()\n .pipe(\n rxFilter((id) => id === componentId),\n map(() => undefined),\n );\n }\n\n // Fires whenever the viewer state the URL carries may have changed: a group\n // value, the grain, a list sort, search or hidden columns, or a (re)load of\n // 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 const listSearches = new Map<number, string>();\n const listHidden = new Map<number, string[]>();\n\n for (const component of this._listComponents(report)) {\n const sort = this._listSorts.get(component.id);\n const search = this._listSearches.get(component.id);\n const hidden = this.hiddenColumns(component.id);\n\n if (sort && !sameSort(sort, listSortTerms(component.config)[0] ?? null)) {\n listSorts.set(component.id, sort);\n }\n\n if (search) {\n listSearches.set(component.id, search);\n }\n\n if (hidden.length) {\n listHidden.set(component.id, [...hidden]);\n }\n }\n\n return { groups, listSorts, listSearches, listHidden, 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 // Turning a keyword filter back on takes its list's search box away, and\n // the search with it. The list refetches on the group change below.\n this._dropUnsearchable();\n\n this._changed$.next(groupId);\n this._urlChanged$.next();\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 // Notifications relevant to ANY of a set of components that comes and goes\n // (a page's values): a change to a group one of their filters belongs to.\n // Unlike changesFor, the set is read on each event rather than captured at\n // subscribe, so one subscription follows the set as the report reloads. A\n // full re-init (null) is not passed on: init() runs on a report\n // (re)load, and a caller of this checks on that reload itself whether the\n // filter values its components are read with moved.\n public changesForAny(components: () => ReportComponent[]): Observable<number> {\n return this._changed$.asObservable()\n .pipe(\n rxFilter((groupId): groupId is number => groupId !== null\n && components().some((component) => (component.filters ?? [])\n .some((filter) => filter.filterGroupId === 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. A date range also names the relative range it\n // still is (_livePreset), so the server knows which period the days cover;\n // the days stay the window either way. Component data, the report and page\n // exports and the chat's viewer filters all read their fields here, so all\n // three carry it.\n private _resolvedFields(value: FilterGroupValue): Omit<ResolvedFilterValue, 'filterId'> | null {\n const fields: Omit<ResolvedFilterValue, 'filterId'> = {};\n const preset = this._livePreset(value);\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 (preset) {\n fields.preset = preset;\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 // The relative range a date value still is: the preset name it carries,\n // while its days are that range resolved today in the report's zone. A\n // value whose days the viewer changed, or one seeded before midnight that\n // is now a day behind, names none, and the server reads its days alone.\n private _livePreset(value: FilterGroupValue): ReportRelativeRange | null {\n if (!value.preset || !isRelativeRange(value.preset)) {\n return null;\n }\n\n const range = this._relativeRange(value.preset);\n\n return range && sameDays(value, range) ? value.preset : 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 this._restoreListSearches(report, restore);\n this._restoreListHidden(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 // The URL's list searches, each kept only for a list the report has that\n // shows a search box (listSearchable). The text is read as listSearchText,\n // and an empty one is no search.\n private _restoreListSearches(report: Report, restore: ReportUrlParams): void {\n const lists = new Map(this._listComponents(report).map((component) => [component.id, component]));\n\n restore.listSearches.forEach((raw, componentId) => {\n const component = lists.get(componentId);\n const search = listSearchText(raw);\n\n if (component && this.listSearchable(component) && search) {\n this._listSearches.set(componentId, search);\n }\n });\n }\n\n // The URL's hidden columns, each list's kept to listHiddenColumns: only the\n // configured columns of a plain list the report has, and none when they\n // would hide every column.\n private _restoreListHidden(restore: ReportUrlParams): void {\n const next = new Map(this.listHidden());\n\n restore.listHidden.forEach((raw, componentId) => {\n const hidden = listHiddenColumns(this._lists.get(componentId)?.config, decodeColumnList(raw));\n\n if (hidden.length) {\n next.set(componentId, hidden);\n }\n });\n\n this.listHidden.set(next);\n }\n\n // Drops the search of every list that no longer shows a search box: one\n // the report no longer has, or one whose header now has a keyword group.\n private _dropUnsearchable(): void {\n this._listSearches.forEach((search, componentId) => {\n const component = this._lists.get(componentId);\n\n if (!component || !this.listSearchable(component)) {\n this._listSearches.delete(componentId);\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 // A list search goes with its list (or when the component is no longer a\n // list), and when the list gains a keyword group and so loses its box.\n // Hidden columns keep only the names their list still has as columns (the\n // agent can remove or rename one, or turn the list into a cross-tab), and go\n // when what is left would hide every column.\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 this._listSorts.forEach((sort, componentId) => {\n const component = this._lists.get(componentId);\n\n if (!component || !this._sortableColumns(component).includes(sort.column)) {\n this._listSorts.delete(componentId);\n }\n });\n\n // Values included: one is never drawn, but its filters are the report's\n // like any other component's, and so are their session toggles.\n const filterIds = new Set(reportComponents(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 this._dropUnsearchable();\n\n const hidden = new Map<number, readonly string[]>();\n\n this.listHidden().forEach((names, componentId) => {\n const kept = listHiddenColumns(this._lists.get(componentId)?.config, names);\n\n if (kept.length) {\n hidden.set(componentId, kept);\n }\n });\n\n this.listHidden.set(hidden);\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 private _listComponents(report: Report): ReportComponent[] {\n return reportComponents(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","import { ChangeDetectionStrategy, Component, computed, inject, signal } from '@angular/core';\n\nimport { MatButton } from '@angular/material/button';\nimport { MatCheckbox } from '@angular/material/checkbox';\nimport {\n MAT_DIALOG_DATA, MatDialogActions, MatDialogClose, MatDialogContent, MatDialogRef,\n} from '@angular/material/dialog';\n\nimport { FsDialogModule } from '@firestitch/dialog';\n\n\nexport interface ListColumnsDialogData {\n // The list's configured columns, in order, each with the heading it shows.\n columns: { column: string; label: string }[];\n // The names of the columns the viewer has hidden.\n hidden: string[];\n}\n\n\n// Which of a plain list's columns the viewer sees. One checkbox per column,\n// and the last one still checked is disabled, so the list always keeps a\n// column. Done closes with the hidden names, in the list's order; Cancel\n// closes with nothing. Nothing here is validated, so there is no fsForm.\n@Component({\n templateUrl: './list-columns.component.html',\n styleUrls: ['./list-columns.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n MatButton,\n MatCheckbox,\n MatDialogActions,\n MatDialogClose,\n MatDialogContent,\n FsDialogModule,\n ],\n})\nexport class ListColumnsComponent {\n\n public readonly data = inject<ListColumnsDialogData>(MAT_DIALOG_DATA);\n\n public readonly columns = this.data.columns;\n\n public readonly hidden = signal<ReadonlySet<string>>(new Set(this.data.hidden));\n\n // How many columns are still checked.\n public readonly shownCount = computed(() => this.columns\n .filter((column) => !this.hidden().has(column.column))\n .length);\n\n private readonly _dialogRef = inject<MatDialogRef<ListColumnsComponent, string[]>>(MatDialogRef);\n\n // Whether a column's box is the last one checked, which cannot be cleared.\n public isLastShown(name: string): boolean {\n return this.shownCount() === 1 && !this.hidden().has(name);\n }\n\n public toggle(name: string, shown: boolean): void {\n this.hidden.update((hidden) => {\n const next = new Set(hidden);\n\n if (shown) {\n next.delete(name);\n } else {\n next.add(name);\n }\n\n return next;\n });\n }\n\n public done(): void {\n this._dialogRef.close(this.columns\n .map((column) => column.column)\n .filter((name) => this.hidden().has(name)));\n }\n}\n","<fs-dialog>\n <fs-dialog-title>\n Columns\n </fs-dialog-title>\n <mat-dialog-content>\n <div class=\"fs-column.gap-xs\">\n @for (column of columns; track column.column) {\n <mat-checkbox\n class=\"column-option\"\n [checked]=\"!hidden().has(column.column)\"\n [disabled]=\"isLastShown(column.column)\"\n (change)=\"toggle(column.column, $event.checked)\">\n {{ column.label }}\n </mat-checkbox>\n }\n </div>\n </mat-dialog-content>\n <mat-dialog-actions>\n <button\n type=\"button\"\n mat-button\n color=\"primary\"\n (click)=\"done()\">\n Done\n </button>\n <button\n type=\"button\"\n mat-button\n [mat-dialog-close]=\"undefined\">\n Cancel\n </button>\n </mat-dialog-actions>\n</fs-dialog>\n","// Whether a rise in a KPI's value is good news (revenue), bad news (refunds)\n// or neither. It colors the delta and judges whether a target is met.\n//\n// Mirrors the server's ChangePolarityEnum value for value.\nexport enum ReportChangePolarity {\n Good = 'good',\n Bad = 'bad',\n Neutral = 'neutral',\n}\n","// Which way a KPI's change points, as shown: up, down, or flat when the\n// change rounds to zero at the digits the card prints. A flat change draws no\n// arrow.\nexport enum ReportKpiTrend {\n Up = 'up',\n Down = 'down',\n Flat = 'flat',\n}\n","import { ReportChangePolarity } from './enums/report-change-polarity.enum';\nimport { ReportKpiTrend } from './enums/report-kpi-trend.enum';\nimport { ReportValueFormat } from './enums/report-value-format.enum';\nimport {\n formatDayRange, formatDayWindow, formatNumber, formatOutputValue, formatReadingDay, isReadOnOneDay,\n} from './format';\nimport {\n ChartGranularity,\n ComparisonWindow,\n ComponentComparison,\n ComponentData,\n ComponentKpi,\n KpiCardSettings,\n KpiConfig,\n OutputMeta,\n ReportFormatContext,\n ReportLocaleTag,\n} from './interfaces/report.interface';\n\n\n// A sparkline's period and length when its config names neither: monthly,\n// over 12 periods (the server's defaults).\nexport const KPI_SPARKLINE_DEFAULT_GRANULARITY: ChartGranularity = 'month';\nexport const KPI_SPARKLINE_DEFAULT_PERIODS = 12;\n\n\n// What a KPI card shows, decided from its config and its data. The server\n// sends every number (the value, the prior, the change, the target's progress,\n// the sparkline's points) and the note codes; this only formats them and\n// picks the arrow and the color. Pure, so the exports can draw the same card.\n//\n// Without a `kpi` key (a KPI with no comparison, target or sparkline, or an\n// older server) the card is the value and its label, as it always was, plus\n// the timeframe's days when the data has a timeframe.\n\n// The report the card is drawn for: its number format, and the zone a\n// timeframe's cut time reads in (a comparison names its own).\nexport interface KpiCardContext {\n format: ReportFormatContext;\n timezone: string;\n}\n\n// The delta row: the change as shown, the arrow it points (none when the\n// shown change rounds to zero), the color it means under the config's\n// increaseIs, and what it is compared with ('vs $1,139 (Aug 1 – 31, 2026)').\nexport interface KpiCardDelta {\n text: string;\n trend: ReportKpiTrend;\n tone: ReportChangePolarity;\n compared: string;\n}\n\n// The target line: its caption and value ('Goal: 150'), the progress the\n// server computed ('37% of target', '' without one), how much of the bar to\n// fill (0-1, null for no bar) and the bar's color.\nexport interface KpiCardTarget {\n text: string;\n progress: string;\n fill: number | null;\n tone: ReportChangePolarity;\n}\n\n// The sparkline's values, oldest first, and whether the last period is not\n// finished yet.\nexport interface KpiCardSparkline {\n values: (number | null)[];\n partial: boolean;\n}\n\nexport interface KpiCardView {\n value: string;\n label: string;\n delta: KpiCardDelta | null;\n window: string;\n target: KpiCardTarget | null;\n sparkline: KpiCardSparkline | null;\n}\n\n// The sparkline drawn in a 0-100 box on both axes (y down): one polyline per\n// run of values without a gap, a dot for a value with an empty period on both\n// sides, and the last point's marker, hollow when its period is partial.\nexport interface KpiSparklinePoint {\n x: number;\n y: number;\n}\n\nexport interface KpiSparklineGeometry {\n lines: string[];\n dots: KpiSparklinePoint[];\n last: (KpiSparklinePoint & { hollow: boolean }) | null;\n}\n\nconst EMPTY_VALUE = '—';\nconst TARGET_CAPTION = 'Target';\nconst PROGRESS_SPEC = Object.freeze({ format: ReportValueFormat.Percent, precision: 0 });\nconst SPARKLINE_BOX = 100;\n\nexport function kpiCardView(\n config: KpiConfig | null | undefined,\n data: ComponentData | null | undefined,\n context: KpiCardContext,\n): KpiCardView {\n const measure = config?.measure;\n const kpi = data?.kpi ?? null;\n\n return {\n value: formatNumber(kpi ? kpi.value : rowValue(config, data), measure, context.format, { empty: EMPTY_VALUE }),\n label: measure?.label ?? '',\n delta: kpiDelta(config, data, context),\n window: windowLine(data, context),\n target: kpiTarget(config, kpi, context.format),\n sparkline: kpi?.sparkline\n ? { values: (kpi.sparkline.points ?? []).map((point) => point.value), partial: !!kpi.sparkline.partial }\n : null,\n };\n}\n\n// The polyline runs, lone dots and last marker for the values, scaled so the\n// lowest value sits on the bottom edge and the highest on the top one (a flat\n// series runs through the middle).\nexport function kpiSparklineGeometry(values: (number | null)[], partial: boolean): KpiSparklineGeometry {\n const numbers = values.filter((value): value is number => value !== null);\n\n if (!numbers.length) {\n return { lines: [], dots: [], last: null };\n }\n\n const low = Math.min(...numbers);\n const high = Math.max(...numbers);\n const points = values.map((value, index) => value === null ? null : {\n x: values.length === 1 ? SPARKLINE_BOX / 2 : index * SPARKLINE_BOX / (values.length - 1),\n y: high === low ? SPARKLINE_BOX / 2 : (high - value) * SPARKLINE_BOX / (high - low),\n });\n const runs = sparklineRuns(points);\n const lastPoint = points[points.length - 1];\n\n return {\n lines: runs.filter((run) => run.length > 1).map((run) => run.map((point) => `${point.x},${point.y}`).join(' ')),\n dots: runs.filter((run) => run.length === 1 && run[0] !== lastPoint).map((run) => run[0]),\n last: lastPoint ? { ...lastPoint, hollow: partial } : null,\n };\n}\n\nfunction sparklineRuns(points: (KpiSparklinePoint | null)[]): KpiSparklinePoint[][] {\n return points.reduce<KpiSparklinePoint[][]>((runs, point, index) => {\n if (point) {\n if (index === 0 || !points[index - 1]) {\n runs.push([]);\n }\n\n runs[runs.length - 1].push(point);\n }\n\n return runs;\n }, []);\n}\n\n// The one row's value, as the card has always read it: the measure's column,\n// or the row's first column when the config names none.\nfunction rowValue(config: KpiConfig | null | undefined, data: ComponentData | null | undefined): unknown {\n const row = data?.rows?.[0];\n const column = config?.measure?.column ?? Object.keys(row ?? {})[0];\n\n return row?.[column];\n}\n\n// A delta needs a value and a comparison that ran. A missing value shows only\n// the dash; a missing prior shows a dash for the delta, and the note says why.\nfunction kpiDelta(\n config: KpiConfig | null | undefined,\n data: ComponentData | null | undefined,\n context: KpiCardContext,\n): KpiCardDelta | null {\n const kpi = data?.kpi;\n\n if (!kpi || kpi.value === null || !data.comparison || (kpi.prior === null && kpi.note === null)) {\n return null;\n }\n\n const output = deltaOutput(kpi, config);\n const amount = output.role === 'percent_change' ? kpi.percentChange : kpi.change;\n const compared = comparedText(config, data, context);\n\n if (amount === null) {\n return { text: EMPTY_VALUE, trend: ReportKpiTrend.Flat, tone: ReportChangePolarity.Neutral, compared };\n }\n\n const options = { measureSpec: config?.measure ?? null };\n const text = formatOutputValue(amount, output, null, context.format, options).text;\n const zero = formatOutputValue(0, output, null, context.format, options).text;\n const trend = text === zero ? ReportKpiTrend.Flat : (amount > 0 ? ReportKpiTrend.Up : ReportKpiTrend.Down);\n\n return { text, trend, tone: deltaTone(trend, config?.increaseIs), compared };\n}\n\n// The delta the server named, as an output column: the percent change, or the\n// change (in points for a percent measure) when it named that or has no\n// percent change to give (a prior of 0, or a change across zero).\nfunction deltaOutput(kpi: ComponentKpi, config: KpiConfig | null | undefined): OutputMeta {\n const percent = kpi.show === 'percent_change' && kpi.percentChange !== null;\n\n return {\n measure: config?.measure?.column ?? '',\n kind: 'value',\n role: percent ? 'percent_change' : 'change',\n offset: 1,\n window: false,\n rank: null,\n share: null,\n };\n}\n\n// Good news is green and bad news red, whichever way the value moved; a flat\n// change, or a value whose direction means neither, is slate.\nfunction deltaTone(trend: ReportKpiTrend, increaseIs: ReportChangePolarity | null | undefined): ReportChangePolarity {\n const polarity = increaseIs ?? ReportChangePolarity.Good;\n\n if (trend === ReportKpiTrend.Flat || polarity === ReportChangePolarity.Neutral) {\n return ReportChangePolarity.Neutral;\n }\n\n const rise = trend === ReportKpiTrend.Up;\n\n return rise === (polarity === ReportChangePolarity.Good) ? ReportChangePolarity.Good : ReportChangePolarity.Bad;\n}\n\n// 'vs $1,139 (Aug 1 – 31, 2026)': the prior value and its window, either\n// alone when the other is missing. A value read on one day is compared with\n// the value on the prior window's last day: 'vs 20 (on Aug 31, 2026)', or\n// 'vs Aug 31, 2026' with no prior value.\nfunction comparedText(\n config: KpiConfig | null | undefined,\n data: ComponentData,\n context: KpiCardContext,\n): string {\n const comparison = data.comparison;\n const prior = comparison.priors?.[0];\n const value = data.kpi.prior === null ? '' : formatNumber(data.kpi.prior, config?.measure, context.format);\n const days = prior ? priorWindowText(comparison, prior, context.format.locale, !!value) : '';\n\n if (value && days) {\n return `vs ${value} (${days})`;\n }\n\n return value || days ? `vs ${value || days}` : '';\n}\n\n// The prior window in the compared text: its days, or the day its value is\n// read on ('on Aug 31, 2026' beside the value, the bare day without one).\nfunction priorWindowText(\n comparison: ComponentComparison,\n prior: ComparisonWindow,\n locale: ReportLocaleTag,\n withValue: boolean,\n): string {\n if (!isReadOnOneDay(comparison)) {\n return formatDayWindow(prior, comparison.timezone, locale);\n }\n\n return withValue ? formatReadingDay(prior, locale) : formatDayRange(prior.end, prior.end, locale);\n}\n\n// The days the value covers: the comparison's current window, else the\n// timeframe's. A value read on one day names that day ('On Sep 15, 2026').\n// '' when the data has neither.\nfunction windowLine(data: ComponentData | null | undefined, context: KpiCardContext): string {\n const comparison = data?.comparison;\n\n if (comparison?.current) {\n return isReadOnOneDay(comparison)\n ? formatReadingDay(comparison.current, context.format.locale, true)\n : formatDayWindow(comparison.current, comparison.timezone, context.format.locale);\n }\n\n return data?.timeframe ? formatDayWindow(data.timeframe, context.timezone, context.format.locale) : '';\n}\n\n// The target as the server sent it back: its value in the measure's format,\n// and the progress toward it, never computed here. A met target fills green.\nfunction kpiTarget(\n config: KpiConfig | null | undefined,\n kpi: ComponentKpi | null,\n format: ReportFormatContext,\n): KpiCardTarget | null {\n const target = kpi?.target;\n\n if (!target) {\n return null;\n }\n\n const progress = target.progress;\n\n return {\n text: `${target.label || TARGET_CAPTION}: ${formatNumber(target.value, config?.measure, format)}`,\n progress: progress === null ? '' : `${formatNumber(progress, PROGRESS_SPEC, { ...format, ratioPercent: true })} of target`,\n fill: progress === null ? null : Math.min(1, Math.max(0, progress)),\n tone: target.met ? ReportChangePolarity.Good : ReportChangePolarity.Neutral,\n };\n}\n\n\n// A KPI's card keys as its config holds them; an absent key reads null.\nexport function kpiCardSettings(config: KpiConfig | null | undefined): KpiCardSettings {\n return {\n increaseIs: config?.increaseIs ?? null,\n target: config?.target ?? null,\n sparkline: config?.sparkline ?? null,\n };\n}\n\n// Whether two sets of card keys draw the same card. Good and an absent\n// increaseIs are one, as are a null granularity and month, null periods and\n// 12, and an empty target label and none.\nexport function sameKpiCardSettings(a: KpiCardSettings, b: KpiCardSettings): boolean {\n return JSON.stringify(normalizedCardSettings(a)) === JSON.stringify(normalizedCardSettings(b));\n}\n\nfunction normalizedCardSettings(settings: KpiCardSettings): KpiCardSettings {\n const { increaseIs, target, sparkline } = settings;\n\n return {\n increaseIs: increaseIs === ReportChangePolarity.Good ? null : (increaseIs ?? null),\n target: target ? { value: target.value, label: target.label || null } : null,\n sparkline: sparkline\n ? {\n granularity: sparkline.granularity ?? KPI_SPARKLINE_DEFAULT_GRANULARITY,\n periods: sparkline.periods ?? KPI_SPARKLINE_DEFAULT_PERIODS,\n }\n : null,\n };\n}\n","// A chart measure's named color. The names follow the report chart palette in\n// order (REPORT_CHART_COLOR_BY_NAME), so blue is the first series' default\n// color and gray the tenth's.\n//\n// Mirrors the server's ChartColorEnum value for value, in the same order.\nexport enum ReportChartColor {\n Blue = 'blue',\n Orange = 'orange',\n Red = 'red',\n Teal = 'teal',\n Green = 'green',\n Yellow = 'yellow',\n Purple = 'purple',\n Pink = 'pink',\n Brown = 'brown',\n Gray = 'gray',\n}\n","// Which points of a chart's series print their value beside them: none, every\n// point, only each series' last point, or every point with the overlapping\n// labels hidden (auto). Axis charts only.\n//\n// Mirrors the server's ChartDataLabelsEnum value for value.\nexport enum ReportChartDataLabels {\n None = 'none',\n All = 'all',\n Last = 'last',\n Auto = 'auto',\n}\n","// How a time axis writes its period labels: short ('May', with the year on a\n// second line when the data spans years), long ('May 2026', in the report's\n// locale) or numeric ('2026-05', the same in every locale). A category axis\n// prints its values as they are.\n//\n// Mirrors the server's ChartDateLabelEnum value for value.\nexport enum ReportChartDateLabel {\n Short = 'short',\n Long = 'long',\n Numeric = 'numeric',\n}\n","// How a line series' line is drawn; the server refuses a non-solid line on\n// an area series. The values are ECharts'\n// lineStyle.type values, so the screen takes them as they are.\n//\n// Mirrors the server's ChartLineStyleEnum value for value.\nexport enum ReportChartLineStyle {\n Solid = 'solid',\n Dashed = 'dashed',\n Dotted = 'dotted',\n}\n","// The statistic of a series a chart measure draws as a horizontal line across\n// the plot: its average, median, lowest or highest value.\n//\n// Mirrors the server's ChartMarkStatEnum value for value.\nexport enum ReportChartMarkStat {\n Average = 'average',\n Median = 'median',\n Min = 'min',\n Max = 'max',\n}\n","import { ReportChangePolarity } from '../enums/report-change-polarity.enum';\nimport { ReportChartColor } from '../enums/report-chart-color.enum';\nimport { 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 measure's named color is the palette entry at the name's position, so a\n// measure colored blue looks exactly like the first series left to the theme.\nexport const REPORT_CHART_COLOR_BY_NAME: Record<ReportChartColor, string> = {\n [ReportChartColor.Blue]: REPORT_CHART_COLORS[0],\n [ReportChartColor.Orange]: REPORT_CHART_COLORS[1],\n [ReportChartColor.Red]: REPORT_CHART_COLORS[2],\n [ReportChartColor.Teal]: REPORT_CHART_COLORS[3],\n [ReportChartColor.Green]: REPORT_CHART_COLORS[4],\n [ReportChartColor.Yellow]: REPORT_CHART_COLORS[5],\n [ReportChartColor.Purple]: REPORT_CHART_COLORS[6],\n [ReportChartColor.Pink]: REPORT_CHART_COLORS[7],\n [ReportChartColor.Brown]: REPORT_CHART_COLORS[8],\n [ReportChartColor.Gray]: REPORT_CHART_COLORS[9],\n};\n\n// Reference lines and bands are drawn in one neutral slate, apart from every\n// series color, so a target never reads as another series.\nexport const REPORT_REFERENCE_COLOR = '52606d';\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\n// The slate of a tile's small print in both exports: a KPI's label, its\n// window and target lines, a component's notes.\nexport const REPORT_MUTED_TEXT_COLOR = '7b8794';\n\n// A KPI's change is colored by what it means rather than by its sign: green\n// when it is good news, red when it is bad news, slate when it is neither (a\n// flat change, or a value whose increaseIs is neutral). The same three colors\n// draw a target's progress (green once met). The card exposes each as a CSS\n// variable a host page can override: --report-kpi-good-color,\n// --report-kpi-bad-color and --report-kpi-neutral-color, set on any element\n// around the report.\nexport const REPORT_KPI_CHANGE_COLORS: Record<ReportChangePolarity, string> = {\n [ReportChangePolarity.Good]: REPORT_CHART_COLORS[4],\n [ReportChangePolarity.Bad]: REPORT_CHART_COLORS[2],\n [ReportChangePolarity.Neutral]: REPORT_MUTED_TEXT_COLOR,\n};\n\n// The track a KPI target's progress bar fills, in both exports.\nexport const REPORT_KPI_TRACK_COLOR = 'e4e7eb';\n\n// A KPI's sparkline takes the first series color, as a one-measure chart of\n// the same values would (--report-kpi-sparkline-color overrides it).\nexport const REPORT_KPI_SPARKLINE_COLOR = REPORT_CHART_COLORS[0];\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// The size a chart's data labels (the values printed beside its points) are\n// drawn in: a step under the axis labels, so they never outweigh the axes.\nexport const REPORT_DATA_LABEL_FONT_SIZE = 10;\n// The size, in pixels, a KPI card's value is drawn in on screen: the one large\n// number on the tile. Its label, change and other lines take the FsStyle\n// .small text or the body size.\nexport const REPORT_KPI_VALUE_FONT_SIZE = 34;\n","import type { EChartsOption, LegendComponentOption, SeriesOption, TooltipComponentFormatterCallbackParams } from 'echarts';\n\nimport {\n addDays,\n addMonths,\n addQuarters,\n addWeeks,\n addYears,\n endOfMonth,\n formatISO,\n isLastDayOfMonth,\n isValid,\n max as latestOf,\n min as earliestOf,\n parseISO,\n startOfDay,\n} from 'date-fns';\n\nimport { ReportChartColor } from './enums/report-chart-color.enum';\nimport { ReportChartDataLabels } from './enums/report-chart-data-labels.enum';\nimport { ReportChartDateLabel } from './enums/report-chart-date-label.enum';\nimport { ReportChartLineStyle } from './enums/report-chart-line-style.enum';\nimport { ReportChartMarkStat } from './enums/report-chart-mark-stat.enum';\nimport { ReportListColumnFormat } from './enums/report-list-column-format.enum';\nimport { ReportNumberUnits } from './enums/report-number-units.enum';\nimport { ReportValueFormat } from './enums/report-value-format.enum';\nimport {\n axisNumberFormat,\n ChartNumberFormat,\n chartValuePeak,\n comparisonOffsetLabel,\n DAY_SHORT,\n dateFormat,\n formatDayRange,\n formatDayWindow,\n formatLocalDate,\n FormattedOutputValue,\n formatNumber,\n formatOutputValue,\n formatPlainNumber,\n hasNumberFormat,\n laneOutputAlias,\n MONTH_DAY,\n MONTH_LONG,\n MONTH_YEAR,\n resolveChartNumberFormat,\n windowText,\n} from './format';\nimport {\n AxisChartType,\n ChartConfig,\n ChartGranularity,\n ChartMeasure,\n ChartReference,\n ChartValueAxis,\n ComparisonOffset,\n ComparisonWindow,\n ComponentComparison,\n ComponentData,\n GRANULARITY_OPTIONS,\n LegendPosition,\n ListColumn,\n ListConfig,\n NumberFormatSpec,\n OutputMeta,\n OutputRole,\n ReportComponent,\n ReportFormatContext,\n ReportLocaleTag,\n WaterfallStepKind,\n WindowMeta,\n} from './interfaces/report.interface';\nimport { escapeHtml } from './text';\nimport {\n REPORT_CHART_COLOR_BY_NAME,\n REPORT_CHART_COLORS,\n REPORT_CHART_COLORS_CSS,\n REPORT_REFERENCE_COLOR,\n REPORT_WATERFALL_COLORS,\n} from './theme/palette';\nimport { REPORT_AXIS_LABEL_FONT_SIZE, REPORT_CHART_FONT_FAMILY, REPORT_DATA_LABEL_FONT_SIZE } from './theme/typography';\n\n\n// Room for an axis title. ECharts 5's containLabel keeps the TICK labels inside\n// the grid but not the axis name, so without this a vertical chart's category\n// title runs off the bottom edge or under a bottom legend, and its value title\n// above the plot runs off the top or under a top 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// The letter a quarter label starts with, by language subtag. French writes the\n// second quarter 'T2' (trimestre); every other language reads 'Q2'.\nconst QUARTER_PREFIXES = new Map<string, string>([['fr', 'T']]);\nconst QUARTER_PREFIX = 'Q';\n// A 100% stacked chart's value axis: whole percentages, a gridline every 25%,\n// up to 100%. Its tooltip gives each share to one decimal.\nconst PERCENT_AXIS_FORMAT: NumberFormatSpec = { format: ReportValueFormat.Percent, precision: 0 };\nconst PERCENT_SHARE_FORMAT: NumberFormatSpec = { format: ReportValueFormat.Percent, precision: 1 };\nexport const PERCENT_AXIS_MAX = 1;\nexport const PERCENT_AXIS_INTERVAL = 0.25;\n// A reference band's fill: the reference slate, faint enough that the series\n// drawn across it stay readable.\nconst REFERENCE_BAND_FILL = 'rgba(82, 96, 109, 0.08)';\n// A reference's or statistic line's label sits on a light box, so it stays\n// readable where it crosses a bar or a line.\nconst MARK_LABEL_BOX = { backgroundColor: 'rgba(255, 255, 255, 0.85)', padding: [1, 3], borderRadius: 2 };\n// The room an axis stretched to a reference leaves above it, for its label:\n// the bound is the round number at or past the reference plus this share.\nconst REFERENCE_HEADROOM = 1.05;\n\n// How a chart marks what the server says of its numbers (ComponentData's\n// comparison, outputs, windows and partialPeriod). The words are interface\n// text, English in every report locale.\n// - The heading of a period not over yet ('September 2026 (to date)').\nconst PARTIAL_PERIOD_TEXT = 'to date';\n// - A compared series' name: its measure's, then its role and lane ('Revenue\n// change (vs previous week)'). A prior keeps the measure's name alone.\nconst ROLE_NAME_SUFFIXES: Record<Exclude<OutputRole, 'current'>, string> = {\n prior: '',\n change: ' change',\n percent_change: ' % change',\n};\n// - A prior series' bars: its current series' color, faded, with a dashed\n// edge. Its line is dashed (PRIOR_LINE_STYLE) unless its measure names one.\nconst PRIOR_BAR_OPACITY = 0.45;\nconst PRIOR_LINE_STYLE = ReportChartLineStyle.Dashed;\n// - The period not over yet: its bar hatched in light stripes, its point on a\n// line drawn larger with a dashed edge, and, when it is the last one, the\n// line's last segment dashed.\nconst PARTIAL_LINE_STYLE = ReportChartLineStyle.Dashed;\nconst PARTIAL_BAR_DECAL = {\n symbol: 'none',\n dashArrayX: [1, 0],\n dashArrayY: [3, 5],\n rotation: -Math.PI / 4,\n color: 'rgba(255, 255, 255, 0.6)',\n};\nconst PARTIAL_POINT_MARK = { symbol: 'emptyCircle', symbolSize: 9, itemStyle: { borderType: 'dashed' } };\n// - A value axis of ranks only: rank 1 at the top, whole steps, from 1.\nconst RANK_AXIS_FORMAT: NumberFormatSpec = { format: ReportValueFormat.Number, precision: 0 };\n// (Shared with the PowerPoint export, whose rank axes start there too.)\nexport const RANK_AXIS_MIN = 1;\n// - A value axis of 0-1 fractions only (shares, percent changes) is a\n// percent axis, its decimals decided by its peak.\nconst FRACTION_AXIS_FORMAT: NumberFormatSpec = { format: ReportValueFormat.Percent };\n// - Between a tooltip value and what it covers.\nconst TOOLTIP_DETAIL_SEPARATOR = ' · ';\n// - The prior a tooltip value is compared with, when the chart does not plot\n// it ('vs 50% (Sep 1 – 2, 2026)').\nconst COMPARED_PRIOR_PREFIX = 'vs';\n\n// The words a statistic line's label starts with. They are interface text,\n// English in every report locale; only the value after them follows it.\nexport const STAT_LABEL: Record<ReportChartMarkStat, string> = {\n [ReportChartMarkStat.Average]: 'Average',\n [ReportChartMarkStat.Median]: 'Median',\n [ReportChartMarkStat.Min]: 'Minimum',\n [ReportChartMarkStat.Max]: 'Maximum',\n};\n\n// Which edge of the plot an axis title sits on. The category axis's is below a\n// vertical chart and to the left of a horizontal one; the value axis's is above\n// a vertical chart and below a horizontal one.\ntype AxisTitleSide = 'top' | 'bottom' | 'left';\n\n// Which value axis a series is plotted against: 0 the primary, 1 the second\n// axis on the right.\nexport type ValueAxisIndex = 0 | 1;\n\n// What valueAxisOption adds for one axis. `index` is the axis of a two-axis\n// chart it builds: the second one's title is aligned to read leftward from the\n// right edge. `percentMin` makes it a 100% stacked chart's share axis, from\n// that bound (0, or -1 when a share is negative) up to 100%, whatever range\n// the config pins. `reach` is the span of the references plotted against it,\n// which the axis stretches to when the data falls short of them. `rank`\n// inverts it.\ninterface ValueAxisExtras {\n index?: ValueAxisIndex;\n percentMin?: number;\n reach?: ReferenceReach;\n // Every series on the axis plots a rank: it runs from rank 1 at the top in\n // whole steps.\n rank?: boolean;\n}\n\n// A reference as the chart draws it: its lower and upper edge (the same value\n// for a line), whether it is a band, and the value axis it is plotted against.\n// Shared with the PowerPoint export, which draws each edge as a constant line.\nexport interface DrawnReference {\n label: string;\n low: number;\n high: number;\n band: boolean;\n axisIndex: ValueAxisIndex;\n}\n\n// The lowest and highest edge of the references on one value axis.\ninterface ReferenceReach {\n low: number;\n high: number;\n}\n\n// What ECharts hands a value axis's min and max callbacks: the extent of the\n// data plotted against it.\ninterface AxisExtent {\n min: number;\n max: number;\n}\n\n// One point of a 100% stacked series: its share of the category's total,\n// which ECharts plots and stacks, and the value it came from.\ninterface ShareDataItem {\n value: number | null;\n raw: number | null;\n}\n\n// A point that prints its own data label: a 'last' series' latest point,\n// keeping the raw value a 100% stacked point carries.\ninterface LabeledDataItem<P extends DataLabelPosition> {\n value: number | null;\n raw?: number | null;\n label: DataLabel<P>;\n}\n\ntype SeriesDataItem<P extends DataLabelPosition> = number | null | ShareDataItem | LabeledDataItem<P>;\n\n// What a data label's formatter is handed: the point's plotted value, its\n// data item as given (a number, or an object carrying the raw value), and its\n// index.\ninterface DataLabelParams {\n value?: unknown;\n data?: unknown;\n dataIndex?: number;\n}\n\nexport type DataLabelFormatter = (params: DataLabelParams) => string;\n\n// Where a data label sits: 'outside' past an unstacked bar's end, on the side\n// its sign points to; 'inside' a stacked bar; 'top' above a line or area\n// point. ECharts takes 'outside' on a bar only.\nexport type DataLabelPosition = 'top' | 'inside' | 'outside';\n\n// One ECharts label, as a series or a single point prints it.\nexport interface DataLabel<P extends DataLabelPosition = DataLabelPosition> {\n show: true;\n position: P;\n fontSize: number;\n formatter: DataLabelFormatter;\n}\n\n// A series' data labels as dataLabelOption decides them, before buildSeries\n// places them by what the series draws: the label's text and size, whether\n// labels that would overlap are hidden ('auto'), and whether only the latest\n// point prints one ('last').\nexport interface SeriesDataLabels {\n text: Omit<DataLabel, 'position'>;\n hideOverlap: boolean;\n lastOnly: boolean;\n}\n\n// A series' data labels placed: `series` is spread over the series (its\n// label, and for 'auto' the overlap hiding), and `data` is its points, the\n// latest non-empty one carrying the label for 'last'.\ninterface PlacedDataLabels<P extends DataLabelPosition> {\n series: { label?: DataLabel<P>; labelLayout?: { hideOverlap: boolean } };\n data: SeriesDataItem<P>[];\n}\n\n// A value axis's number format, decided once for the axis: the format the\n// measures plotted against it agree on (axisNumberFormat), with the units and\n// decimals its peak calls for, and the context its ticks are written in (an\n// axis of 0-1 fractions reads them as ratios whatever the report's\n// percentFormat). null is a plain axis. Its ticks and its series' data labels\n// both write in it.\ninterface ValueAxisFormat {\n spec: NumberFormatSpec;\n chart: ChartNumberFormat;\n context: ReportFormatContext;\n}\n\n// The shares a 100% stacked chart draws, by the index of the extracted series\n// they replace.\nexport type PercentShares = Map<number, (number | null)[]>;\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: ''}, a color on\n// the measure or a config.legend of 'hidden' — still wins, so a caller that\n// wants one flat color 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 // A measure given its own color asks for one flat color.\n if (measureColorHex(config.measures?.[0])) {\n return false;\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). Its\n// `measure` is the one it plots, whose number format its tooltip uses and\n// whose display keys (color, axis) it follows, and `measureIndex` that\n// measure's position: the first measure, 0, for every series of a splitBy or\n// colorBy chart.\nexport interface ExtractedChartSeries {\n categories: string[];\n series: ExtractedChartSeriesItem[];\n}\n\nexport interface ExtractedChartSeriesItem {\n name: string;\n values: (number | null)[];\n type?: AxisChartType;\n measure: ChartMeasure;\n measureIndex: number;\n}\n\nexport function extractChartSeries(component: ReportComponent, data: ComponentData): ExtractedChartSeries {\n const config = component.config as ChartConfig;\n const { xColumn, groupColumn } = chartColumns(config, data);\n const measures = chartMeasures(config, data);\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 series.push({\n name: String(groupValue ?? '—'),\n values: categoryValues(data.rows, xColumn, rawCategories, measure.column, (row) => row[groupColumn] === groupValue),\n type: measure.type,\n measure,\n measureIndex: 0,\n });\n }\n } else {\n for (const [measureIndex, measure] of measures.entries()) {\n series.push({\n name: comparedSeriesName(measure, measures, data) ?? measure.label ?? measure.column,\n values: categoryValues(data.rows, xColumn, rawCategories, measure.column),\n type: measure.type,\n measure,\n measureIndex,\n });\n }\n }\n\n return { categories, series };\n}\n\n// The column a chart's categories come from, and the one that splits its\n// first measure into a series per value, if any. colorBy emits one series per\n// category too (so each bar carries its own color + legend entry), but the\n// bars are overlapped to full width in buildAxisOption rather than laid\n// side-by-side. splitBy wins if both are set.\nfunction chartColumns(config: ChartConfig, data: ComponentData): { xColumn: string; groupColumn: string | undefined } {\n return {\n xColumn: config.xAxis?.column ?? data.columns[0],\n groupColumn: config.splitBy?.column || colorByColumn(config),\n };\n}\n\n// One column's values by category, from the rows `match` keeps (all of them\n// when it is left out). A category with no row has no value.\nfunction categoryValues(\n rows: Record<string, unknown>[],\n xColumn: string,\n rawCategories: unknown[],\n column: string,\n match?: (row: Record<string, unknown>) => boolean,\n): (number | null)[] {\n const byCategory = new Map<unknown, unknown>();\n for (const row of rows) {\n if (!match || match(row)) {\n byCategory.set(row[xColumn], row[column]);\n }\n }\n\n return rawCategories.map((category) => numeric(byCategory.get(category)));\n}\n\n// A compared series' name, worded from its lane's offset rather than from its\n// own label, so a chart the viewer regrouped says what it now compares:\n// 'Revenue (vs previous week)', 'Revenue change (vs previous week)', 'Revenue\n// % change (vs previous year)'. The measure is named as its current value's\n// series is. null for any other series, which keeps its own name, and for\n// data without the comparison keys.\nfunction comparedSeriesName(measure: ChartMeasure, measures: ChartMeasure[], data: ComponentData): string | null {\n const output = data.outputs?.[measure.column];\n const offset = output?.offset ? data.comparison?.offsets?.[output.offset - 1] : undefined;\n\n if (!output || !offset || !output.role || output.role === 'current') {\n return null;\n }\n\n const current = currentOutputAlias(data.outputs, measure.column);\n const label = measures.find((candidate) => candidate.column === current)?.label ?? current;\n\n return `${label}${ROLE_NAME_SUFFIXES[output.role]} (${comparisonOffsetLabel(offset)})`;\n}\n\n// The column an output's current value is in: its lane's current output, else\n// for a rank or a share the uncompared one of the same measure, else the\n// measure's own column (a windowed value's source).\nfunction currentOutputAlias(outputs: Record<string, OutputMeta>, alias: string): string {\n const output = outputs[alias];\n const uncompared = output.kind === 'value'\n ? undefined\n : Object.keys(outputs).find((key) => outputs[key].measure === output.measure\n && outputs[key].kind === output.kind\n && outputs[key].role === null);\n\n return laneOutputAlias(outputs, alias, 'current') ?? uncompared ?? output.measure;\n}\n\n// A series' own color as CSS hex: its measure's named color, or undefined when\n// it names none (or a name the palette does not know) and the theme colors it\n// by its position.\nexport function seriesColor(series: ExtractedChartSeriesItem): string | undefined {\n const hex = namedColorHex(series);\n\n return hex ? `#${hex}` : undefined;\n}\n\n// A series' color as the bare hex PowerPoint takes: its measure's named color,\n// else the palette color of its position, as the screen's theme picks it.\nexport function seriesHex(series: ExtractedChartSeriesItem, index: number): string {\n return namedColorHex(series) ?? REPORT_CHART_COLORS[index % REPORT_CHART_COLORS.length];\n}\n\nfunction namedColorHex(series: ExtractedChartSeriesItem): string | undefined {\n return measureColorHex(series.measure);\n}\n\n// A measure's named color as bare hex, or undefined when it names none or a\n// name the palette does not know. The name is read through the enum, so a\n// stored name such as '__proto__' never reaches the lookup object.\nfunction measureColorHex(measure: ChartMeasure | undefined): string | undefined {\n const color = Object.values(ReportChartColor).find((name) => name === measure?.color);\n\n return color ? REPORT_CHART_COLOR_BY_NAME[color] : undefined;\n}\n\n// A measure's line style when it names one ECharts knows, else undefined and\n// the line is solid.\nexport function measureLineStyle(measure: ChartMeasure | undefined): ReportChartLineStyle | undefined {\n return Object.values(ReportChartLineStyle).find((style) => style === measure?.line);\n}\n\n// A measure's statistic line when it names one the viewer knows, else\n// undefined and it draws none.\nexport function measureMarkStat(measure: ChartMeasure | undefined): ReportChartMarkStat | undefined {\n return Object.values(ReportChartMarkStat).find((stat) => stat === measure?.markLine);\n}\n\n// A series' statistic over its points that have a value: their mean, their\n// median (the mean of the two middle values when the count is even), the\n// lowest or the highest. null when no point has a value. Shared with the\n// PowerPoint export so both media draw the line at the same height.\nexport function seriesStat(values: (number | null)[], stat: ReportChartMarkStat): number | null {\n const present = values.filter((value): value is number => typeof value === 'number' && Number.isFinite(value));\n\n if (!present.length) {\n return null;\n }\n\n switch (stat) {\n case ReportChartMarkStat.Average:\n return present.reduce((sum, value) => sum + value, 0) / present.length;\n case ReportChartMarkStat.Median: {\n const sorted = [...present].sort((a, b) => a - b);\n const middle = Math.floor(sorted.length / 2);\n\n return sorted.length % 2 ? sorted[middle] : (sorted[middle - 1] + sorted[middle]) / 2;\n }\n case ReportChartMarkStat.Min:\n return Math.min(...present);\n case ReportChartMarkStat.Max:\n return Math.max(...present);\n default:\n return null;\n }\n}\n\n// Whether a chart draws statistic lines. A horizontal chart's values run\n// along x, and PowerPoint cannot draw a line beside horizontal bars, so\n// neither medium draws one there.\nexport function drawsStatLines(config: ChartConfig): boolean {\n return config.orientation !== 'horizontal';\n}\n\n// A colorBy chart's one value per category: series i holds category i's bar.\n// PowerPoint draws these as its one series, and a statistic line is taken\n// over them.\nexport function colorByValues(extracted: ExtractedChartSeries): (number | null)[] {\n return extracted.categories.map((_, index) => extracted.series[index]?.values[index] ?? null);\n}\n\n// The references a chart draws. A vertical axis chart and a waterfall draw\n// them; a pie has no value axis, and a horizontal chart is left without them\n// as PowerPoint cannot draw a line beside horizontal bars. An entry without a\n// finite value is skipped, and one whose `to` is missing or equal to its value\n// is a line. secondary reaches the second value axis only on a chart that has\n// one (twoAxes). Shared with the PowerPoint export.\nexport function chartReferences(config: ChartConfig, twoAxes: boolean): DrawnReference[] {\n const chartType = config.chartType ?? 'bar';\n const references: (ChartReference | null | undefined)[] = Array.isArray(config.references) ? config.references : [];\n\n if (config.orientation === 'horizontal' || chartType === 'pie' || chartType === 'donut') {\n return [];\n }\n\n return references.flatMap((reference): DrawnReference[] => {\n const value = axisNumber(reference?.value);\n\n if (!reference || value === undefined) {\n return [];\n }\n\n const to = axisNumber(reference.to);\n const label = typeof reference.label === 'string' ? reference.label : '';\n const axisIndex: ValueAxisIndex = twoAxes && reference.secondary === true ? 1 : 0;\n\n return [to !== undefined && to !== value\n ? { label, low: Math.min(value, to), high: Math.max(value, to), band: true, axisIndex }\n : { label, low: value, high: value, band: false, axisIndex }];\n });\n}\n\n// Each series as its share of its category's total: per category, the\n// denominator is the sum of every series' absolute value there, so the\n// magnitudes of a category's shares add up to 1. A mixed-sign category's\n// negative values take negative shares, drawn below zero. A missing value\n// stays missing, and a category whose total is zero has no shares. Shared by\n// the screen, the PDF and PowerPoint, so a 100% stack reads the same in each.\nexport function percentShares(values: (number | null)[][]): (number | null)[][] {\n const length = Math.max(0, ...values.map((series) => series.length));\n const totals = Array.from({ length }, (_, index) => values\n .reduce((sum, series) => sum + Math.abs(series[index] ?? 0), 0));\n\n return values.map((series) => series.map((value, index) => (\n value === null || !totals[index] ? null : value / totals[index]\n )));\n}\n\n// The shares a 100% stacked chart draws in place of its values, or null when\n// the chart is not one. The primary axis's bar and area series take them,\n// each type's series sharing among themselves, as each type stacks apart.\n// Lines and secondary-axis series keep their values. A pie, a waterfall and a\n// colorBy chart (one series per category, each of which would be 100%) are\n// never 100% stacked, nor is a chart with no bar or area on its primary axis.\nexport function percentStackedShares(extracted: ExtractedChartSeries, config: ChartConfig): PercentShares | null {\n const chartType = config.chartType ?? 'bar';\n\n if (config.percentStacked !== true\n || chartType === 'pie' || chartType === 'donut' || chartType === 'waterfall'\n || isColorBy(config)) {\n return null;\n }\n\n const types = seriesTypes(extracted, chartType);\n const axisIndexes = seriesAxisIndexes(extracted, config);\n const shares: PercentShares = new Map();\n\n for (const type of ['bar', 'area'] as const) {\n const indexes = types\n .map((seriesType, index) => (seriesType === type && axisIndexes[index] === 0 ? index : -1))\n .filter((index) => index >= 0);\n const typeShares = percentShares(indexes.map((index) => extracted.series[index].values));\n indexes.forEach((seriesIndex, position) => shares.set(seriesIndex, typeShares[position]));\n }\n\n return shares.size ? shares : null;\n}\n\n// Where a 100% stacked chart's value axis starts: at -100% when any share is\n// negative, else at zero.\nexport function percentAxisMin(shares: PercentShares): number {\n return [...shares.values()].some((series) => series.some((share) => (share ?? 0) < 0)) ? -1 : 0;\n}\n\n// The measures a chart plots: its configured ones, else the query's last\n// column, unformatted.\nfunction chartMeasures(config: ChartConfig, data: ComponentData): ChartMeasure[] {\n return config.measures?.length\n ? config.measures\n : [{ column: data.columns[data.columns.length - 1] }];\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// The value axis each extracted series is plotted against: 1 when its measure\n// is secondary, 0 otherwise. A second axis is drawn only on a vertical chart\n// that keeps at least one series on the primary axis, so a combination the\n// server refuses (a horizontal chart, every measure secondary, the one measure\n// of a splitBy or colorBy chart) plots everything on the primary axis. Shared\n// with the PowerPoint export so both media put each series on the same axis.\nexport function seriesAxisIndexes(extracted: ExtractedChartSeries, config: ChartConfig): ValueAxisIndex[] {\n const secondary = extracted.series.map((series) => !!series.measure.secondary);\n const twoAxes = config.orientation !== 'horizontal' && secondary.includes(true) && secondary.includes(false);\n\n return secondary.map((isSecondary) => (twoAxes && isSecondary ? 1 : 0));\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.\n//\n// Every number and period the chart writes (value-axis ticks, tooltip values,\n// period labels) is in the context's locale, never the browser's. A measure\n// with number-format keys formats its tooltips, and the value axis when every\n// measure on it agrees (axisNumberFormat); without them the axis and tooltips\n// keep the plain locale-grouped number.\nexport function buildChartOption(\n component: ReportComponent,\n data: ComponentData,\n context: ReportFormatContext,\n): 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', context);\n }\n\n if (chartType === 'waterfall') {\n return buildWaterfallOption(component, data, context);\n }\n\n return buildAxisOption(component, data, chartType, context);\n}\n\nfunction buildAxisOption(\n component: ReportComponent,\n data: ComponentData,\n chartType: AxisChartType,\n context: ReportFormatContext,\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, and on a two-axis chart only with the\n // series on its own axis.\n //\n // A 100% stacked chart (percentStackedShares) plots its primary bars and\n // areas as shares, each type in its own stack, and leaves every other series\n // unstacked on its own values.\n //\n // What the server says of the numbers (chartAnnotations) marks them: a\n // prior series dashed in its current series' color, the period not over yet\n // hatched or dashed, ranks on an inverted axis, fractions on a percent axis,\n // and the tooltip naming each prior's days and each window. Data without\n // those keys draws exactly as before.\n const axisIndexes = seriesAxisIndexes(extracted, config);\n const twoAxes = axisIndexes.includes(1);\n const shares = percentStackedShares(extracted, config);\n const references = chartReferences(config, twoAxes);\n const annotations = chartAnnotations(config, data, extracted, colorBy);\n const axisFormats = valueAxisFormats(\n config,\n annotations ? annotatedAxisSeries(extracted, annotations) : extracted,\n axisIndexes,\n annotations && !shares ? annotatedAxisContexts(annotations, axisIndexes, context) : [context, context],\n !!shares,\n references,\n );\n const rankAxes = annotations && !shares ? rankAxisFlags(annotations.outputs, axisIndexes) : [false, false];\n // A series' statistic line is taken over the points it plots. On a colorBy\n // chart each series holds one bar, so the one line is taken over the bars\n // together and hangs off the first series (colorByStatLine).\n const statLines = drawsStatLines(config) && !colorBy;\n const series: SeriesOption[] = extracted.series.map((extractedSeries, index) => {\n const seriesShares = shares?.get(index);\n let stack: string | undefined;\n if (seriesShares) {\n stack = stackKey(types[index], combo, 0);\n } else if (config.stacked && !shares) {\n stack = stackKey(types[index], combo, twoAxes ? axisIndexes[index] : undefined);\n }\n\n // An output series (a compared, windowed, ranked or shared value) writes\n // its tooltip, data labels and statistic line by what it holds.\n const write = annotations && !seriesShares && annotations.outputs[index]\n ? outputWriter(annotations, index, extractedSeries.measure, context)\n : null;\n const stat = statLines ? measureMarkStat(extractedSeries.measure) : undefined;\n const markLine = stat && statMarkLine(\n seriesShares ?? extractedSeries.values,\n stat,\n seriesShares ? shareWriter(context) : write ?? measureWriter(extractedSeries.measure, context),\n );\n const option = buildSeries(\n extractedSeries,\n seriesShares ? shareData(extractedSeries.values, seriesShares) : extractedSeries.values,\n {\n type: types[index],\n stack,\n overlap: colorBy && index === 0,\n combo,\n tooltip: write ? { valueFormatter: write } : seriesTooltip(extractedSeries.measure, context),\n axisIndex: twoAxes ? axisIndexes[index] : undefined,\n // A colorBy chart's bars take the palette by category, as in\n // PowerPoint, whatever color the measure names.\n color: colorBy ? undefined : annotations?.colors?.[index] ?? seriesColor(extractedSeries),\n labels: dataLabelOption(config.dataLabels, write\n ? outputLabelFormatter(write)\n : dataLabelFormatter(\n extractedSeries.measure,\n axisFormats[axisIndexes[index]] ?? null,\n !!seriesShares,\n context,\n )),\n },\n );\n const marked = annotations ? markSeries(option, annotations, index, extractedSeries.measure) : option;\n\n return markLine ? { ...marked, markLine } as SeriesOption : marked;\n });\n\n if (colorBy && drawsStatLines(config) && series.length) {\n series[0] = colorByStatLine(series[0], extracted, context, annotations?.outputs[0]\n ? outputWriter(annotations, 0, extracted.series[0].measure, context)\n : undefined);\n }\n\n // Drawn after the measure series, so a tooltip reads a series by its index.\n const segments = annotations ? partialSegments(series, annotations) : [];\n const percentMin = shares ? percentAxisMin(shares) : undefined;\n const categoryAxis = categoryAxisOption(config, data, extracted.categories, horizontal, context.locale);\n // An axis of rate changes alone reads in percentage points, as its values do.\n const axisLabels = ([0, 1] as const).map((axisIndex) => (annotations && !shares\n ? pointsAxisLabel(annotations, extracted, axisIndexes, axisIndex, context)\n : null) ?? valueAxisLabel(axisFormats[axisIndex] ?? null, context));\n const valueAxis = twoAxes\n ? twoValueAxesOption(config, axisLabels, context, percentMin, references, rankAxes)\n : valueAxisOption(config.valueAxis, horizontal, percentMin === undefined\n ? axisLabels[0]\n : percentAxisLabel(context), { percentMin, reach: referenceReach(references, 0), rank: rankAxes[0] });\n\n const legendPosition = resolveLegendPosition(config, series.length, colorBy);\n const valueTitles = [config.valueAxis, twoAxes ? config.secondaryAxis : undefined];\n const granularity = bucketGranularity(data);\n\n return {\n grid: axisGrid(legendPosition, categoryTitleSide(config, horizontal), valueTitleSide(valueTitles, horizontal)),\n legend: referenceLegend(legendOption(legendPosition), series, references),\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. A 100%\n // stacked chart's tooltip gives each share and the value it came from. A\n // chart with the server's annotations names what each value covers.\n tooltip: shares\n ? {\n trigger: 'axis',\n formatter: (params: TooltipComponentFormatterCallbackParams) => percentTooltip(\n params,\n extracted,\n shares,\n granularity,\n chartDateLabel(config),\n context,\n ),\n }\n : annotatedChartTooltip(annotations && !colorBy ? {\n extracted,\n annotations,\n owners: segments.map((segment) => segment.owner),\n granularity,\n dateLabel: chartDateLabel(config),\n context,\n } : null) ?? { trigger: colorBy ? 'item' : 'axis' },\n xAxis: horizontal ? valueAxis : categoryAxis,\n yAxis: horizontal ? categoryAxis : valueAxis,\n series: [...series, ...segments.map((segment) => segment.series), ...referenceCarriers(references, extracted.categories)],\n };\n}\n\n// What the server says of the series an axis chart plots, read from the\n// data's comparison, outputs, windows and partialPeriod by each series'\n// measure column. chartAnnotations is null when the data carries none of\n// those keys, and the chart draws exactly as before.\ninterface ChartAnnotations {\n outputs: (OutputMeta | null)[];\n windows: (WindowMeta | null)[];\n // The chart measure an output takes its measure's format from: its current\n // value's, when the chart plots it.\n measureSpecs: (ChartMeasure | undefined)[];\n // A change or percent change series' prior values by category, which tell\n // a missing baseline from a zero one; null for any other series.\n priors: ((number | null)[] | null)[];\n // The lane prior a current, change or percent change series is compared\n // with, when the chart does not plot that prior itself: its tooltip line\n // names the prior's value and days. null for any other series.\n lanePriors: (LanePrior | null)[];\n // Every series' own CSS color, so a prior series and a partial segment can\n // share another's; null on a colorBy chart, which colors by category.\n colors: string[] | null;\n priorSeries: boolean[];\n comparison: ComponentComparison | null;\n // The category of the period not over yet, or null.\n partialIndex: number | null;\n}\n\n// A series' lane prior: its output, its values by category, and a key that\n// names it once in a tooltip (the prior column, and on a splitBy chart the\n// group).\ninterface LanePrior {\n key: string;\n output: OutputMeta;\n values: (number | null)[];\n}\n\n// The keys of a built axis series that the annotations read and replace.\ninterface DrawnSeries {\n type?: string;\n stack?: string;\n data?: SeriesDataItem<DataLabelPosition>[];\n itemStyle?: Record<string, unknown>;\n lineStyle?: Record<string, unknown>;\n}\n\n// A dashed last segment (partialSegments), drawn after the measure series,\n// and the index of the series it continues.\ninterface PartialSegment {\n series: SeriesOption;\n owner: number;\n}\n\n// What an annotated chart's axis tooltip reads. owners holds, by position,\n// the series each partial segment continues.\ninterface AnnotatedTooltipSource {\n extracted: ExtractedChartSeries;\n annotations: ChartAnnotations;\n owners: number[];\n granularity: ChartGranularity | null;\n dateLabel: ReportChartDateLabel;\n context: ReportFormatContext;\n}\n\nfunction chartAnnotations(\n config: ChartConfig,\n data: ComponentData,\n extracted: ExtractedChartSeries,\n colorBy: boolean,\n): ChartAnnotations | null {\n if (!data.comparison && !data.outputs && !data.windows && (data.partialPeriod ?? null) === null) {\n return null;\n }\n\n const columns = extracted.series.map((series) => series.measure.column);\n const outputs = columns.map((column) => data.outputs?.[column] ?? null);\n const currents = columns.map((column, index) => (outputs[index] ? currentOutputAlias(data.outputs, column) : null));\n const measures = chartMeasures(config, data);\n // A prior series' current series, by index; -1 for any other.\n const sources = currents.map((current, index) => (outputs[index]?.role === 'prior' ? columns.indexOf(current) : -1));\n const partialIndex = (data.partialPeriod ?? null) === null ? -1 : extracted.categories.indexOf(String(data.partialPeriod));\n const lanes = lanePriorValues(config, data, extracted, outputs);\n\n return {\n outputs,\n windows: columns.map((column) => data.windows?.[column] ?? null),\n measureSpecs: currents.map((current) => measures.find((measure) => measure.column === current)),\n priors: lanes.map((lane, index) => (isDeltaRole(outputs[index]?.role) ? lane?.prior.values ?? null : null)),\n lanePriors: lanes.map((lane) => (lane && !columns.includes(lane.alias) ? lane.prior : null)),\n colors: colorBy ? null : annotatedColors(extracted, sources),\n priorSeries: outputs.map((output) => output?.role === 'prior'),\n comparison: data.comparison ?? null,\n partialIndex: partialIndex < 0 ? null : partialIndex,\n };\n}\n\n// A current, change or percent change series' lane prior, by category: its\n// lane's prior column in the same rows (the same group's on a splitBy chart),\n// and that column's alias.\nfunction lanePriorValues(\n config: ChartConfig,\n data: ComponentData,\n extracted: ExtractedChartSeries,\n outputs: (OutputMeta | null)[],\n): ({ alias: string; prior: LanePrior } | null)[] {\n const { xColumn, groupColumn } = chartColumns(config, data);\n const rawCategories = uniqueValues(data.rows, xColumn);\n const groups = groupColumn ? uniqueValues(data.rows, groupColumn) : [];\n\n return extracted.series.map((series, index) => {\n const role = outputs[index]?.role;\n const alias = role === 'current' || isDeltaRole(role)\n ? laneOutputAlias(data.outputs, series.measure.column, 'prior')\n : null;\n const output = alias ? data.outputs?.[alias] : undefined;\n\n if (!alias || !output) {\n return null;\n }\n\n const match = groupColumn ? (row: Record<string, unknown>) => row[groupColumn] === groups[index] : undefined;\n\n return {\n alias,\n prior: {\n key: groupColumn ? `${alias}\\u0000${index}` : alias,\n output,\n values: categoryValues(data.rows, xColumn, rawCategories, alias, match),\n },\n };\n });\n}\n\nfunction isDeltaRole(role: OutputRole | null | undefined): boolean {\n return role === 'change' || role === 'percent_change';\n}\n\n// Each series' color as the theme would hand it out: its measure's named\n// color, else the next palette color among the series without one. A prior\n// series that names no color takes its current series' color (sources) and\n// no palette color of its own.\nfunction annotatedColors(extracted: ExtractedChartSeries, sources: number[]): string[] {\n let slot = 0;\n const own = extracted.series.map((series, index) => {\n const named = seriesColor(series);\n\n if (named || sources[index] >= 0) {\n return named ?? null;\n }\n\n return REPORT_CHART_COLORS_CSS[slot++ % REPORT_CHART_COLORS_CSS.length];\n });\n\n return own.map((color, index) => color ?? own[sources[index]] as string);\n}\n\n// A series' marks: a prior drawn in its current series' color family, dashed,\n// and the period not over yet hatched (a bar) or ringed (a point).\nfunction markSeries(\n option: SeriesOption,\n annotations: ChartAnnotations,\n index: number,\n measure: ChartMeasure,\n): SeriesOption {\n const prior = annotations.priorSeries[index] ? priorStyle(option, measure, annotations.colors?.[index]) : option;\n\n return annotations.partialIndex === null ? prior : markPartialPoint(prior, annotations.partialIndex);\n}\n\n// A prior's bars are faded with a dashed edge; its line is dashed unless its\n// measure names a line style.\nfunction priorStyle(option: SeriesOption, measure: ChartMeasure, color: string | undefined): SeriesOption {\n const drawn = option as DrawnSeries;\n\n if (drawn.type === 'bar') {\n return {\n ...option,\n itemStyle: {\n ...drawn.itemStyle,\n opacity: PRIOR_BAR_OPACITY,\n borderWidth: 1,\n borderType: 'dashed',\n ...(color ? { borderColor: color } : {}),\n },\n } as SeriesOption;\n }\n\n return { ...option, lineStyle: { ...drawn.lineStyle, type: measureLineStyle(measure) ?? PRIOR_LINE_STYLE } } as SeriesOption;\n}\n\n// The point of the period not over yet, when it has a value.\nfunction markPartialPoint(option: SeriesOption, partialIndex: number): SeriesOption {\n const drawn = option as DrawnSeries;\n const data = [...(drawn.data ?? [])];\n const item = data[partialIndex];\n\n if (item === undefined || pointValue(item) === null) {\n return option;\n }\n\n const mark = drawn.type === 'bar' ? { itemStyle: { decal: PARTIAL_BAR_DECAL } } : PARTIAL_POINT_MARK;\n data[partialIndex] = (typeof item === 'object' ? { ...item, ...mark } : { value: item, ...mark }) as SeriesDataItem<DataLabelPosition>;\n\n return { ...option, data } as SeriesOption;\n}\n\n// A line or area series whose last period is not over yet draws its last\n// segment dashed: the series stops one point short, and a segment series\n// carries its last two points, dashed, in its color and under its name, so\n// the one legend entry toggles both. A stacked series keeps its line whole (a\n// segment would stack on top of it), and a gap stays a gap. Replaces each\n// such series in `series` and returns the segments.\nfunction partialSegments(series: SeriesOption[], annotations: ChartAnnotations): PartialSegment[] {\n const last = annotations.partialIndex;\n const segments: PartialSegment[] = [];\n\n series.forEach((option, owner) => {\n const drawn = option as DrawnSeries;\n const data = drawn.data ?? [];\n const color = annotations.colors?.[owner];\n\n if (last === null || last < 1 || last !== data.length - 1 || drawn.type !== 'line' || drawn.stack || !color\n || pointValue(data[last - 1]) === null || pointValue(data[last]) === null) {\n return;\n }\n\n series[owner] = { ...option, data: [...data.slice(0, last), null] } as SeriesOption;\n segments.push({ owner, series: segmentSeries(option, color, last) });\n });\n\n return segments;\n}\n\n// The dashed segment from the point before the last to the last one, which\n// keeps its marks and its data label. The point before it is drawn, and\n// labeled, by the series itself.\nfunction segmentSeries(option: SeriesOption, color: string, last: number): SeriesOption {\n const drawn = option as DrawnSeries;\n const data = drawn.data ?? [];\n\n return {\n ...option,\n markLine: undefined,\n lineStyle: { ...drawn.lineStyle, color, type: PARTIAL_LINE_STYLE },\n data: data.map((item, index) => {\n if (index === last) {\n return item;\n }\n\n return index === last - 1 ? { value: pointValue(item), symbol: 'none', label: { show: false } } : null;\n }),\n } as SeriesOption;\n}\n\n// A point's plotted value, whether it is a bare number or an object.\nfunction pointValue(item: SeriesDataItem<DataLabelPosition> | undefined): number | null {\n if (item === null || item === undefined) {\n return null;\n }\n\n return typeof item === 'number' ? item : item.value;\n}\n\n// How an output series writes a value: formatOutputValue's rules (a signed\n// change, points, '—' with the no-baseline title, ranks and shares) with its\n// measure's format and the comparison's floor. Given the point's index (a\n// tooltip, a data label), a change reads its prior there, which tells a\n// missing baseline from a zero one. The title says why a value reads '—' or\n// 'n/a'.\nfunction outputValue(\n annotations: ChartAnnotations,\n index: number,\n measure: ChartMeasure,\n context: ReportFormatContext,\n): (value: unknown, dataIndex?: number) => FormattedOutputValue {\n const output = annotations.outputs[index];\n const priors = annotations.priors[index];\n\n return (value, dataIndex) => formatOutputValue(Array.isArray(value) ? value[0] : value, output, measure, context, {\n measureSpec: annotations.measureSpecs[index],\n floor: annotations.comparison?.floor ?? null,\n ...(priors && dataIndex !== undefined ? { prior: priors[dataIndex] ?? null } : {}),\n });\n}\n\n// An output value's text alone, for a series' own tooltip and its data labels.\nfunction outputWriter(\n annotations: ChartAnnotations,\n index: number,\n measure: ChartMeasure,\n context: ReportFormatContext,\n): (value: unknown, dataIndex?: number) => string {\n const write = outputValue(annotations, index, measure, context);\n\n return (value, dataIndex) => write(value, dataIndex).text;\n}\n\nfunction outputLabelFormatter(write: (value: unknown, dataIndex?: number) => string): DataLabelFormatter {\n return (params) => write(dataLabelValue(params), params.dataIndex);\n}\n\n// The chart's series as its value axes read them: an output series whose\n// slot names no format takes its output's (outputAxisMeasure).\nfunction annotatedAxisSeries(extracted: ExtractedChartSeries, annotations: ChartAnnotations): ExtractedChartSeries {\n return {\n ...extracted,\n series: extracted.series.map((series, index) => ({\n ...series,\n measure: outputAxisMeasure(series.measure, annotations.outputs[index], annotations.measureSpecs[index]),\n })),\n };\n}\n\n// The format an output's axis reads when its slot names none: a rank's whole\n// numbers, a 0-1 fraction's percent, and a compared or windowed value its\n// measure's format. The slot's own precision and units still apply.\nfunction outputAxisMeasure(\n measure: ChartMeasure,\n output: OutputMeta | null,\n measureSpec: ChartMeasure | undefined,\n): ChartMeasure {\n if (!output || namesValueFormat(measure)) {\n return measure;\n }\n\n let base: NumberFormatSpec | null = measureSpec && hasNumberFormat(measureSpec) ? formatKeys(measureSpec) : null;\n if (output.kind === 'rank') {\n base = RANK_AXIS_FORMAT;\n } else if (isFractionOutput(output)) {\n base = FRACTION_AXIS_FORMAT;\n }\n\n return base\n ? { ...measure, ...base, ...formatKeys({ precision: measure.precision, units: measure.units }) } as ChartMeasure\n : measure;\n}\n\nfunction namesValueFormat(spec: NumberFormatSpec): boolean {\n return Object.values(ReportValueFormat).some((format) => format === spec.format);\n}\n\n// A spec's number-format keys that are set.\nfunction formatKeys(spec: NumberFormatSpec): NumberFormatSpec {\n return {\n ...((spec.format ?? null) !== null ? { format: spec.format } : {}),\n ...((spec.precision ?? null) !== null ? { precision: spec.precision } : {}),\n ...((spec.units ?? null) !== null ? { units: spec.units } : {}),\n };\n}\n\n// Each value axis's context: one that plots only 0-1 fractions reads them as\n// ratios, whatever the report's percentFormat says of its stored values.\nfunction annotatedAxisContexts(\n annotations: ChartAnnotations,\n axisIndexes: ValueAxisIndex[],\n context: ReportFormatContext,\n): ReportFormatContext[] {\n return ([0, 1] as const).map((axisIndex) => (everyOnAxis(annotations.outputs, axisIndexes, axisIndex, isFractionOutput)\n ? { ...context, ratioPercent: true }\n : context));\n}\n\n// Which value axes, by index, plot nothing but ranks.\nfunction rankAxisFlags(outputs: (OutputMeta | null)[], axisIndexes: ValueAxisIndex[]): boolean[] {\n return ([0, 1] as const).map((axisIndex) => everyOnAxis(outputs, axisIndexes, axisIndex, isRankPosition));\n}\n\n// How a chart that plots a prior series colors each series, for the\n// PowerPoint export: every series' color as bare hex, a prior taking its\n// current series' color and no palette color of its own (annotatedColors),\n// and which series are priors, which a line draws dashed. null when the chart\n// plots no prior series, and on a colorBy chart; its series keep seriesHex.\nexport function priorSeriesStyles(\n config: ChartConfig,\n data: ComponentData,\n extracted: ExtractedChartSeries,\n): { colors: string[]; priors: boolean[] } | null {\n const annotations = chartAnnotations(config, data, extracted, isColorBy(config));\n\n if (!annotations?.colors || !annotations.priorSeries.some((prior) => prior)) {\n return null;\n }\n\n return {\n colors: annotations.colors.map((color) => color.replace('#', '')),\n priors: annotations.priorSeries,\n };\n}\n\n// Which value axes, by index, plot nothing but ranks, which the chart draws\n// inverted with rank 1 at the top. Shared with the PowerPoint export.\nexport function rankValueAxes(extracted: ExtractedChartSeries, data: ComponentData, config: ChartConfig): boolean[] {\n return rankAxisFlags(\n extracted.series.map((series) => data.outputs?.[series.measure.column] ?? null),\n seriesAxisIndexes(extracted, config),\n );\n}\n\n// Whether an axis has series and every one of them passes the test.\nfunction everyOnAxis(\n outputs: (OutputMeta | null)[],\n axisIndexes: ValueAxisIndex[],\n axisIndex: ValueAxisIndex,\n test: (output: OutputMeta) => boolean,\n): boolean {\n const onAxis = outputs.filter((_, index) => axisIndexes[index] === axisIndex);\n\n return onAxis.length > 0 && onAxis.every((output) => !!output && test(output));\n}\n\n// A share and a percent change are 0-1 fractions, whatever percentFormat says.\nfunction isFractionOutput(output: OutputMeta): boolean {\n return output.kind === 'share' || output.role === 'percent_change';\n}\n\n// A value axis's tick labels when every series on it is a change of a rate\n// (a share's, or a percent-format value's): signed percentage points, as the\n// series' tooltips and data labels write them ('+5.0 pp'). null for any other\n// axis.\nfunction pointsAxisLabel(\n annotations: ChartAnnotations,\n extracted: ExtractedChartSeries,\n axisIndexes: ValueAxisIndex[],\n axisIndex: ValueAxisIndex,\n context: ReportFormatContext,\n): ValueAxisLabel | null {\n const onAxis = extracted.series\n .map((_, index) => index)\n .filter((index) => axisIndexes[index] === axisIndex);\n const points = onAxis.length > 0 && onAxis.every((index) => isPointsChange(\n annotations.outputs[index],\n outputAxisMeasure(extracted.series[index].measure, annotations.outputs[index], annotations.measureSpecs[index]),\n ));\n\n if (!points) {\n return null;\n }\n\n const write = outputWriter(annotations, onAxis[0], extracted.series[onAxis[0]].measure, context);\n\n return { formatter: (value: number) => write(value) };\n}\n\n// A change of a rate, which prints in percentage points: a share's change, or\n// the change of a value whose format (its slot's, else its measure's) is a\n// percent.\nfunction isPointsChange(output: OutputMeta | null, axisMeasure: ChartMeasure): boolean {\n return !!output && output.role === 'change' && output.kind !== 'rank'\n && (output.kind === 'share' || axisMeasure.format === ReportValueFormat.Percent);\n}\n\n// A rank, current or prior; a rank change is a difference, not a position.\nfunction isRankPosition(output: OutputMeta): boolean {\n return output.kind === 'rank' && output.role !== 'change';\n}\n\nfunction annotatedChartTooltip(source: AnnotatedTooltipSource | null) {\n return source\n ? {\n trigger: 'axis' as const,\n formatter: (params: TooltipComponentFormatterCallbackParams) => annotatedTooltip(params, source),\n }\n : null;\n}\n\n// The period, with 'to date' when it is not over yet, then each series shown\n// (a legend can hide some): its value written by what it is, and what it\n// covers. A partial segment speaks for its series. Names and values come from\n// the data and the config, and ECharts sets the tooltip as HTML, so both are\n// escaped.\nfunction annotatedTooltip(params: TooltipComponentFormatterCallbackParams, source: AnnotatedTooltipSource): string {\n const items = Array.isArray(params) ? params : [params];\n const dataIndex = items[0]?.dataIndex ?? 0;\n const count = source.extracted.series.length;\n const markers = new Map<number, string>();\n\n for (const item of items) {\n const seriesIndex = item.seriesIndex ?? -1;\n const owner = seriesIndex < count ? seriesIndex : source.owners[seriesIndex - count];\n\n if (owner !== undefined && owner >= 0 && !markers.has(owner)) {\n markers.set(owner, typeof item.marker === 'string' ? item.marker : '');\n }\n }\n\n const namedPriors = new Set<string>();\n const lines = [...markers.entries()]\n .sort(([first], [second]) => first - second)\n .map(([index, marker]) => annotatedTooltipLine(source, index, dataIndex, marker, namedPriors));\n\n return [annotatedTooltipHeading(source, dataIndex), ...lines].join('<br/>');\n}\n\nfunction annotatedTooltipHeading(source: AnnotatedTooltipSource, dataIndex: number): string {\n const category = source.extracted.categories[dataIndex] ?? '';\n const period = source.granularity\n ? formatPeriodLabel(category, source.granularity, true, source.context.locale, source.dateLabel)\n : category;\n\n return escapeHtml(dataIndex === source.annotations.partialIndex ? `${period} (${PARTIAL_PERIOD_TEXT})` : period);\n}\n\n// '● Revenue (vs previous month): $813 · Aug 1 – 15, 2026', and why a value\n// reads '—' or 'n/a' when it does ('No baseline: no data before Jun 10, 2026').\n// A value compared with a prior the chart does not plot names that prior\n// once, on the first line shown that is compared with it: 'Rate % change (vs\n// previous month): -10% · vs 50% (Sep 1 – 2, 2026)'. namedPriors holds the\n// priors already named.\nfunction annotatedTooltipLine(\n source: AnnotatedTooltipSource,\n index: number,\n dataIndex: number,\n marker: string,\n namedPriors: Set<string>,\n): string {\n const series = source.extracted.series[index];\n const value = series.values[dataIndex] ?? null;\n const formatted = source.annotations.outputs[index]\n ? outputValue(source.annotations, index, series.measure, source.context)(value, dataIndex)\n : { text: seriesTooltip(series.measure, source.context).valueFormatter(value), title: null };\n const lanePrior = source.annotations.lanePriors[index];\n const compared = lanePrior && !namedPriors.has(lanePrior.key)\n ? comparedPriorDetail(source, index, lanePrior, dataIndex)\n : '';\n if (lanePrior) {\n namedPriors.add(lanePrior.key);\n }\n\n const parts = [formatted.text, seriesDetail(source, index, dataIndex), compared, formatted.title ?? ''];\n\n return `${marker} ${escapeHtml(series.name)}: ${escapeHtml(parts.filter((part) => !!part).join(TOOLTIP_DETAIL_SEPARATOR))}`;\n}\n\n// The prior a value is compared with, when the chart does not plot it: its\n// value in its measure's format, and its days ('vs 50% (Sep 1 – 2, 2026)').\n// The measure's format is the current series' when the chart plots it, else\n// a change slot's own explicit format (a change is in its measure's units).\nfunction comparedPriorDetail(\n source: AnnotatedTooltipSource,\n index: number,\n lanePrior: LanePrior,\n dataIndex: number,\n): string {\n const annotations = source.annotations;\n const measure = source.extracted.series[index].measure;\n const measureSpec = annotations.measureSpecs[index]\n ?? (annotations.outputs[index]?.role !== 'percent_change' && namesValueFormat(measure) ? measure : null);\n const text = formatOutputValue(lanePrior.values[dataIndex] ?? null, lanePrior.output, null, source.context, {\n measureSpec,\n floor: annotations.comparison?.floor ?? null,\n }).text;\n const window = priorDetail(source, lanePrior.output, dataIndex);\n\n return window ? `${COMPARED_PRIOR_PREFIX} ${text} (${window})` : `${COMPARED_PRIOR_PREFIX} ${text}`;\n}\n\n// What a series' value covers, when the server says: a prior's days, or a\n// windowed value's window ('Rolling 3-month total'), whose days the note\n// under the chart names.\nfunction seriesDetail(source: AnnotatedTooltipSource, index: number, dataIndex: number): string {\n const output = source.annotations.outputs[index];\n const window = source.annotations.windows[index];\n\n if (output?.role === 'prior') {\n return priorDetail(source, output, dataIndex);\n }\n\n return window ? windowText({ ...window, start: null, end: null }, source.context.locale, source.granularity) : '';\n}\n\n// A prior value's days. A range comparison compares every point with the\n// same window. A series comparison compares each period with the period its\n// lane's offset back; a period_end comparison reads the value at the end of that\n// period ('on Aug 31, 2026').\nfunction priorDetail(source: AnnotatedTooltipSource, output: OutputMeta, dataIndex: number): string {\n const comparison = source.annotations.comparison;\n const lane = (output.offset ?? 1) - 1;\n const offset = comparison?.offsets?.[lane];\n const locale = source.context.locale;\n\n if (!comparison || !offset) {\n return '';\n }\n\n if (comparison.mode === 'range' || !source.granularity) {\n const prior = comparison.priors?.[lane];\n\n return prior ? formatDayWindow(prior, comparison.timezone, locale) : '';\n }\n\n const partial = dataIndex === source.annotations.partialIndex && comparison.align === 'to_date';\n const today = partial ? zoneToday(comparison.timezone) : null;\n const window = priorPeriodWindow(source.extracted.categories[dataIndex] ?? '', source.granularity, offset, today);\n\n if (!window) {\n return '';\n }\n\n if (comparison.mode === 'period_end') {\n return `on ${formatDayRange(window.end, window.end, locale)}`;\n }\n\n return formatDayWindow(\n { ...withinLaneSpan(window, comparison.priors?.[lane]), through: partial ? comparison.current?.through ?? null : null },\n comparison.timezone,\n locale,\n );\n}\n\n// A series lane reads the span shown moved back by its offset (the server's\n// comparison.priors[lane]), so the earlier copy of a period the span starts\n// or ends inside holds only the days within it: a span from Mar 15 sets\n// March against Feb 15 – 28, not the whole of February.\nfunction withinLaneSpan(\n window: { start: string; end: string },\n span: ComparisonWindow | undefined,\n): { start: string; end: string } {\n if (!span) {\n return window;\n }\n\n const start = window.start < span.start ? span.start : window.start;\n const end = window.end > span.end ? span.end : window.end;\n\n return start <= end ? { start, end } : window;\n}\n\n// The days one period of the axis is compared with: the period moved back by\n// the lane's offset. A period not over yet, compared to date, runs only to\n// today moved back (priorToDateEnd). null for a category that is not a day,\n// or an offset without a unit (a custom range).\nfunction priorPeriodWindow(\n category: string,\n granularity: ChartGranularity,\n offset: ComparisonOffset,\n today: Date | null,\n): { start: string; end: string } | null {\n const start = parseISO(category);\n const unit = offset.unit;\n const count = offset.count;\n\n if (!isValid(start) || !unit || !count) {\n return null;\n }\n\n const back = (date: Date) => addPeriods(date, unit, -count);\n const fullEnd = addDays(back(addPeriods(start, granularity, 1)), -1);\n const end = today ? earliestOf([fullEnd, priorToDateEnd(today, start, back, unit)]) : fullEnd;\n\n return { start: calendarDay(back(start)), end: calendarDay(latestOf([end, back(start)])) };\n}\n\n// Today, kept inside the period, moved back by the offset; when today is the\n// last day of its month, the last day of the month it lands in (the\n// server's end-of-month rule: Sep 30 compares with Aug 31, not Aug 30).\nfunction priorToDateEnd(\n today: Date,\n periodStart: Date,\n back: (date: Date) => Date,\n unit: ChartGranularity,\n): Date {\n const day = latestOf([startOfDay(today), periodStart]);\n const moved = back(day);\n\n return isLastDayOfMonth(day) && unit !== 'day' && unit !== 'week' ? endOfMonth(moved) : moved;\n}\n\nfunction addPeriods(date: Date, unit: ChartGranularity, count: number): Date {\n switch (unit) {\n case 'day':\n return addDays(date, count);\n case 'week':\n return addWeeks(date, count);\n case 'quarter':\n return addQuarters(date, count);\n case 'year':\n return addYears(date, count);\n default:\n return addMonths(date, count);\n }\n}\n\nfunction calendarDay(date: Date): string {\n return formatISO(date, { representation: 'date' });\n}\n\n// Today's calendar day in the report's zone, as local midnight. The server\n// marks which period holds today (partialPeriod) but not the day itself; the\n// prior of that period is clipped at the same day. An unknown zone reads the\n// browser's own day.\nfunction zoneToday(timezone: string): Date {\n try {\n const parts = dateFormat('en-US', { year: 'numeric', month: 'numeric', day: 'numeric' }, timezone)\n .formatToParts(new Date());\n const part = (type: Intl.DateTimeFormatPartTypes) => Number(parts.find((found) => found.type === type)?.value);\n const today = new Date(part('year'), part('month') - 1, part('day'));\n\n if (isValid(today)) {\n return today;\n }\n } catch {\n // An unknown zone: the browser's day below.\n }\n\n return startOfDay(new Date());\n}\n\n// A colorBy chart's statistic line: one line over every bar, hung off the\n// first series and drawn in the reference slate, as no one category's color\n// speaks for the others.\nfunction colorByStatLine(\n first: SeriesOption,\n extracted: ExtractedChartSeries,\n context: ReportFormatContext,\n write?: (value: number) => string,\n): SeriesOption {\n const measure = extracted.series[0]?.measure;\n const stat = measureMarkStat(measure);\n const markLine = stat && statMarkLine(\n colorByValues(extracted),\n stat,\n write ?? measureWriter(measure, context),\n `#${REPORT_REFERENCE_COLOR}`,\n );\n\n return markLine ? { ...first, markLine } as SeriesOption : first;\n}\n\n// A series' statistic line across the plot, labeled with the statistic and\n// its value ('Average: 1,234.5'), or undefined when no point has a value. It\n// takes the series' color unless it is given one.\nfunction statMarkLine(\n values: (number | null)[],\n stat: ReportChartMarkStat,\n write: (value: number) => string,\n color?: string,\n) {\n const value = seriesStat(values, stat);\n\n if (value === null) {\n return undefined;\n }\n\n const text = `${STAT_LABEL[stat]}: ${write(value)}`;\n\n return {\n silent: true,\n symbol: 'none',\n lineStyle: { type: 'dashed' as const, width: 1, ...(color ? { color } : {}) },\n label: { formatter: () => text, position: 'insideEndTop' as const, fontSize: REPORT_DATA_LABEL_FONT_SIZE, ...MARK_LABEL_BOX },\n data: [{ yAxis: value }],\n };\n}\n\n// A statistic's value in its measure's number format, in the report locale.\nfunction measureWriter(measure: ChartMeasure | undefined, context: ReportFormatContext): (value: number) => string {\n return (value) => formatNumber(value, measure, context);\n}\n\n// A 100% stacked series' statistic is a share, written as its tooltip writes\n// one.\nfunction shareWriter(context: ReportFormatContext): (value: number) => string {\n const ratioContext = { ...context, ratioPercent: true };\n\n return (value) => formatNumber(value, PERCENT_SHARE_FORMAT, ratioContext);\n}\n\n// The series that carry a chart's references, one per value axis that has\n// any: an empty line (every point null, so it draws nothing and stretches no\n// axis) whose markLine draws the reference lines and whose markArea fills the\n// bands. It is silent, left out of the tooltip and, by referenceLegend, out of\n// the legend. It has no name, so no measure series' legend entry (whatever its\n// name, '' included) toggles it.\n//\n// Labels are functions, as a string formatter is a template that would read\n// '{b}' or '{c}' in a label as a placeholder. ECharts draws a markArea under\n// the bars and a markLine over them, so a band's label rides an invisible\n// markLine on its upper edge, inside its top left corner, where the first bar\n// would otherwise cover it.\nfunction referenceCarriers(references: DrawnReference[], categories: string[]): SeriesOption[] {\n const color = `#${REPORT_REFERENCE_COLOR}`;\n\n return ([0, 1] as const).flatMap((axisIndex): SeriesOption[] => {\n const onAxis = references.filter((reference) => reference.axisIndex === axisIndex);\n const lines = onAxis.filter((reference) => !reference.band);\n const bands = onAxis.filter((reference) => reference.band);\n\n if (!onAxis.length) {\n return [];\n }\n\n return [{\n type: 'line',\n data: categories.map(() => null),\n yAxisIndex: axisIndex,\n silent: true,\n tooltip: { show: false },\n markLine: {\n silent: true,\n symbol: 'none',\n lineStyle: { color, type: 'dashed', width: 1 },\n label: { position: 'insideEndTop', color, fontSize: REPORT_DATA_LABEL_FONT_SIZE, ...MARK_LABEL_BOX },\n data: [\n ...lines.map((reference) => ({ yAxis: reference.low, label: { formatter: () => reference.label } })),\n ...bands.map((reference) => ({\n yAxis: reference.high,\n // Zero width, not zero opacity: a markLine's label takes the\n // line's opacity.\n lineStyle: { width: 0 },\n label: { position: 'insideStartBottom', formatter: () => reference.label },\n })),\n ],\n },\n ...(bands.length ? {\n markArea: {\n silent: true,\n itemStyle: { color: REFERENCE_BAND_FILL },\n data: bands.map((reference) => [{ yAxis: reference.low }, { yAxis: reference.high }]),\n },\n } : {}),\n } as SeriesOption];\n });\n}\n\n// The largest magnitude a value axis's references reach, which its number\n// format counts toward its peak, as the axis stretches to them; 0 when it\n// has none.\nexport function referencePeak(references: DrawnReference[], axisIndex: ValueAxisIndex): number {\n const reach = referenceReach(references, axisIndex);\n\n return reach ? Math.max(Math.abs(reach.low), Math.abs(reach.high)) : 0;\n}\n\n// The legend of a chart with references names its measure series alone, so\n// a carrier never shows as a blank entry. Without references it is left as it\n// was.\nfunction referenceLegend(\n legend: LegendComponentOption,\n series: SeriesOption[],\n references: DrawnReference[],\n): LegendComponentOption {\n return references.length\n ? { ...legend, data: series.map((item) => String(item.name ?? '')) }\n : legend;\n}\n\n// The span of the references on one value axis, or undefined when it has\n// none.\nfunction referenceReach(references: DrawnReference[], axisIndex: ValueAxisIndex): ReferenceReach | undefined {\n const onAxis = references.filter((reference) => reference.axisIndex === axisIndex);\n\n return onAxis.length\n ? { low: Math.min(...onAxis.map((reference) => reference.low)), high: Math.max(...onAxis.map((reference) => reference.high)) }\n : undefined;\n}\n\n// ECharts leaves a markLine or markArea out of an axis's extent, so a\n// reference beyond the data would fall off the plot. An axis bound the config\n// does not pin reaches past the furthest reference, to a round number with\n// room for its label (beyondReference), when the data (and the zero a value\n// axis always shows) falls short of it, and is left to ECharts otherwise: a\n// callback returning undefined keeps the bound automatic. Past the data and\n// zero, a reference beyond the max is above zero and one beyond the min below\n// it.\nfunction reachMin(reach: ReferenceReach | undefined) {\n return reach\n ? (extent: AxisExtent) => (reach.low < Math.min(extent.min, 0) ? -beyondReference(-reach.low) : undefined)\n : undefined;\n}\n\nfunction reachMax(reach: ReferenceReach | undefined) {\n return reach\n ? (extent: AxisExtent) => (reach.high > Math.max(extent.max, 0) ? beyondReference(reach.high) : undefined)\n : undefined;\n}\n\n// The bound an axis takes past a reference of this (positive) magnitude: the\n// smallest round number at or above it plus REFERENCE_HEADROOM. The steps are\n// finer than ECharts' tick steps, so a reference just past the data does not\n// double the axis (110 gives 120, not 200). The tolerance keeps a float error\n// from skipping a round number the value already is.\nconst NICE_STEPS = [1, 1.2, 1.5, 2, 2.5, 3, 4, 5, 6, 8, 10];\nconst NICE_TOLERANCE = 1e-9;\n\nfunction beyondReference(magnitude: number): number {\n const target = magnitude * REFERENCE_HEADROOM;\n const power = Math.pow(10, Math.floor(Math.log10(target)));\n const step = NICE_STEPS.find((candidate) => candidate * power >= target * (1 - NICE_TOLERANCE)) ?? 10;\n\n // Rounded back to the power's own digits, so 1.2 x 0.1 reads 0.12, not\n // 0.12000000000000001.\n return Number((step * power).toPrecision(12));\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.\n//\n// A bucketed axis also names its period in the axis tooltip's header: ECharts\n// heads it with the raw category ('2026-01-01') unless the axis pointer's label\n// has a formatter, so it reads 'January 2026' instead, always with its year.\n// The axis's dateLabel style writes both its tick labels and that header.\nfunction categoryAxisOption(\n config: ChartConfig,\n data: ComponentData,\n categories: string[],\n horizontal: boolean,\n locale: ReportLocaleTag,\n) {\n const granularity = bucketGranularity(data);\n const dateLabel = chartDateLabel(config);\n const periodLabel = periodAxisLabel(granularity, categories, locale, dateLabel);\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 ...(granularity ? {\n axisPointer: {\n label: {\n formatter: (params: { value: unknown }) => formatPeriodLabel(\n String(params.value),\n granularity,\n true,\n locale,\n dateLabel,\n ),\n },\n },\n } : {}),\n };\n\n if (!horizontal) {\n // The gap clears the year's second line when the labels print one.\n const secondLine = granularity && dateLabel === ReportChartDateLabel.Short && spansMultipleYears(categories);\n\n return {\n ...axis,\n nameGap: secondLine ? 40 : 28,\n ...periodLabel,\n };\n }\n\n // Period labels, short, long or numeric ('May', 'Q2', 'May 2026'), are\n // bounded in length and never cut; only a plain category is truncated. The labels are cut here rather than by ECharts' own\n // truncation, so the title's gap is measured on exactly the text the axis\n // 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, locale, dateLabel);\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 value axes' title side, or null when none of them has a title. A\n// vertical chart's titles sit above the plot, at the top of each axis line, so\n// room is made once for both; a horizontal chart's sits below.\nfunction valueTitleSide(axes: (ChartValueAxis | undefined)[], horizontal: boolean): AxisTitleSide | null {\n if (!axes.some((axis) => axis?.label)) {\n return null;\n }\n\n return horizontal ? 'bottom' : 'top';\n}\n\n// The tick labels as the axis shows them: a bucket's primary period label\n// ('May', 'Q2', 'May 2026'), otherwise the category itself. The year a\n// multi-year axis prints under a short period is left out, as it is never the\n// wider line.\nfunction displayedCategoryLabels(\n categories: string[],\n granularity: ChartGranularity | null,\n locale: ReportLocaleTag,\n dateLabel: ReportChartDateLabel,\n): string[] {\n return granularity\n ? categories.map((category) => periodLabelParts(category, granularity, locale, dateLabel)?.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(\n component: ReportComponent,\n data: ComponentData,\n context: ReportFormatContext,\n): EChartsOption {\n const config = component.config as ChartConfig;\n const waterfall = extractWaterfall(component, data);\n const horizontal = config.orientation === 'horizontal';\n const categories = waterfall.steps.map((step) => step.category);\n const categoryAxis = categoryAxisOption(config, data, categories, horizontal, context.locale);\n // The one measure's format writes the axis and the tooltip. The axis has to\n // reach the furthest point the running total gets to, on either side of\n // zero, or the furthest reference.\n const spec = config.measures?.[0];\n const references = chartReferences(config, false);\n const valueAxis = valueAxisOption(config.valueAxis, horizontal, valueAxisLabel(resolveValueAxisFormat(\n spec && hasNumberFormat(spec) ? spec : null,\n () => Math.max(referencePeak(references, 0), ...waterfall.steps.map((step) => Math.abs(step.start + (step.change ?? 0)))),\n context,\n ), context), { reach: referenceReach(references, 0) });\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(\n legendPosition,\n categoryTitleSide(config, horizontal),\n valueTitleSide([config.valueAxis], horizontal),\n ),\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 chartDateLabel(config),\n spec,\n context,\n ),\n },\n xAxis: horizontal ? valueAxis : categoryAxis,\n yAxis: horizontal ? categoryAxis : valueAxis,\n series: [...waterfallSeries(waterfall), ...referenceCarriers(references, categories)],\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. Periods and amounts are written in the report's\n// locale, amounts in the measure's number format (a plain number without one);\n// the words ('Running total') stay English.\nfunction waterfallTooltip(\n waterfall: ExtractedWaterfall,\n index: number,\n granularity: ChartGranularity | null,\n dateLabel: ReportChartDateLabel,\n spec: NumberFormatSpec | undefined,\n context: ReportFormatContext,\n): string {\n const step = waterfall.steps[index];\n const category = escapeHtml(granularity\n ? formatPeriodLabel(step.category, granularity, true, context.locale, dateLabel)\n : step.category);\n const name = escapeHtml(waterfall.name);\n const amount = (value: number | null) => formatNumber(value, spec ?? {}, context);\n\n if (step.kind === 'total') {\n return `${category}<br/>${name}: ${amount(step.change)}`;\n }\n\n const sign = (step.change ?? 0) > 0 ? '+' : '';\n\n return `${category}<br/>${name}: ${sign}${amount(step.change)}`\n + `<br/>Running total: ${amount(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 and value axes' titles on their\n// sides, which containLabel does not reserve (it covers the tick labels only).\nfunction axisGrid(\n position: LegendPosition,\n categoryTitle: AxisTitleSide | null,\n valueTitle: AxisTitleSide | null,\n): EChartsOption['grid'] {\n return [categoryTitle, valueTitle].reduce<AxisGridRoom>(\n (grid, side) => (side ? { ...grid, [side]: grid[side] + AXIS_NAME_ROOM } : grid),\n legendGrid(position),\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\n// The stack a stacked series joins. On a two-axis chart (axisIndex set) each\n// type stacks per axis; otherwise a combo stacks per type and a single-type\n// chart stacks everything together.\nfunction stackKey(type: AxisChartType, combo: boolean, axisIndex: ValueAxisIndex | undefined): string {\n if (axisIndex !== undefined) {\n return `total-${type}-${axisIndex}`;\n }\n\n return combo ? `total-${type}` : 'total';\n}\n\n// How buildSeries draws one series: its drawn type, the stack it joins, whether\n// it lays the colorBy overlap, whether the chart is a combo, its tooltip, its\n// value axis on a two-axis chart, its own CSS color (undefined leaves it to\n// the theme's palette by position), and its data labels (null prints none).\ninterface SeriesLayout {\n type: AxisChartType;\n stack: string | undefined;\n overlap: boolean;\n combo: boolean;\n tooltip: SeriesTooltip;\n axisIndex: ValueAxisIndex | undefined;\n color: string | undefined;\n labels: SeriesDataLabels | null;\n}\n\n// One series of an axis chart. A measure's display keys only add what they\n// change, so a series that sets none is drawn by the theme as before: its own\n// color (the bar, the line, the area under it and its legend key all follow\n// itemStyle), its line style and its markers, shown on every point unless\n// markers is false. Data labels come last, on the series or on its latest\n// point.\nfunction buildSeries(\n series: ExtractedChartSeriesItem,\n values: (number | null | ShareDataItem)[],\n layout: SeriesLayout,\n): SeriesOption {\n // On a two-axis chart every series names its value axis.\n const axis = layout.axisIndex === undefined ? {} : { yAxisIndex: layout.axisIndex };\n const color = layout.color;\n const itemStyle = color ? { itemStyle: { color } } : {};\n\n if (layout.type === 'bar') {\n // 'outside' follows each bar's sign: past a positive bar's end and below\n // (or left of) a negative one's, where 'top' would sit at the zero line.\n const { series: labels, data } = placeDataLabels(layout.labels, layout.stack ? 'inside' : 'outside', values);\n\n return {\n name: series.name,\n type: 'bar',\n data,\n stack: layout.stack,\n tooltip: layout.tooltip,\n ...axis,\n ...itemStyle,\n barMaxWidth: 48,\n // colorBy: overlap the per-category series so each bar renders full-width.\n ...(layout.overlap ? { barGap: '-100%', barCategoryGap: '20%' } : {}),\n ...labels,\n };\n }\n\n const lineType = measureLineStyle(series.measure);\n const lineStyle = color || lineType\n ? { lineStyle: { ...(color ? { color } : {}), ...(lineType ? { type: lineType } : {}) } }\n : {};\n const { series: labels, data } = placeDataLabels(layout.labels, 'top', values);\n\n return {\n name: series.name,\n type: 'line',\n data,\n stack: layout.stack,\n tooltip: layout.tooltip,\n ...axis,\n ...itemStyle,\n ...lineStyle,\n ...(series.measure.markers === false ? { showSymbol: false } : {}),\n smooth: true,\n symbolSize: 6,\n areaStyle: layout.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 ...(layout.combo ? { z: 3 } : {}),\n ...labels,\n };\n}\n\n// A 100% stacked series' points: each share, plotted and stacked, with the\n// value it came from.\nfunction shareData(values: (number | null)[], shares: (number | null)[]): ShareDataItem[] {\n return values.map((raw, index) => ({ value: shares[index] ?? null, raw }));\n}\n\n// What a series prints beside its points (A2 data labels): every point\n// ('all'), every point whose label fits without overlapping another ('auto',\n// LabelLayout's hideOverlap), or only its latest point ('last'). none, an\n// absent mode or one the viewer does not know prints nothing, and the series\n// is left as it was. A colorBy chart's series each hold one bar, so 'last'\n// labels every bar there, as 'all' does.\n//\n// Where the label sits depends on what the series draws, so buildSeries\n// places it (placeDataLabels).\nexport function dataLabelOption(\n mode: ReportChartDataLabels | undefined,\n formatter: DataLabelFormatter,\n): SeriesDataLabels | null {\n const text = { show: true as const, fontSize: REPORT_DATA_LABEL_FONT_SIZE, formatter };\n\n switch (mode) {\n case ReportChartDataLabels.All:\n return { text, hideOverlap: false, lastOnly: false };\n case ReportChartDataLabels.Auto:\n return { text, hideOverlap: true, lastOnly: false };\n case ReportChartDataLabels.Last:\n return { text, hideOverlap: false, lastOnly: true };\n default:\n return null;\n }\n}\n\n// A series' data labels at `position`: on the series ('all', and with the\n// overlap hiding 'auto'), or on its latest non-empty point alone ('last').\n// No labels leave the series and its points as they were.\nfunction placeDataLabels<P extends DataLabelPosition>(\n labels: SeriesDataLabels | null,\n position: P,\n values: (number | null | ShareDataItem)[],\n): PlacedDataLabels<P> {\n if (!labels) {\n return { series: {}, data: values };\n }\n\n const label: DataLabel<P> = { ...labels.text, position };\n\n if (labels.lastOnly) {\n return { series: {}, data: labelLastPoint(values, label) };\n }\n\n return {\n series: { label, ...(labels.hideOverlap ? { labelLayout: { hideOverlap: true } } : {}) },\n data: values,\n };\n}\n\n// A series' points with its latest non-empty point carrying the label. A\n// series with no value anywhere is left as it was.\nfunction labelLastPoint<P extends DataLabelPosition>(\n values: (number | null | ShareDataItem)[],\n label: DataLabel<P>,\n): SeriesDataItem<P>[] {\n const last = values.reduce<number>((found, item, index) => (pointValue(item) === null ? found : index), -1);\n\n return values.map((item, index): SeriesDataItem<P> => {\n if (index !== last) {\n return item;\n }\n\n return isShareDataItem(item) ? { ...item, label } : { value: item, label };\n });\n}\n\nfunction isShareDataItem(item: number | null | ShareDataItem): item is ShareDataItem {\n return item !== null && typeof item === 'object';\n}\n\n// How a series' data labels write a value. A 100% stacked series prints its\n// share as a whole percentage, as the share axis's ticks do. A series on an\n// axis with a number format prints its value in its measure's format, at the\n// units and decimals the axis decided, so a label reads like the ticks beside\n// it. Any other prints the plain locale-grouped number its tooltip shows. A\n// share point's raw value is what a label reads when it carries one.\nfunction dataLabelFormatter(\n measure: ChartMeasure,\n axisFormat: ValueAxisFormat | null,\n share: boolean,\n context: ReportFormatContext,\n): DataLabelFormatter {\n if (share) {\n const percent = wholePercentFormatter(context);\n\n return (params) => percent(params.value);\n }\n\n if (axisFormat) {\n const options = { units: axisFormat.chart.units, decimals: axisFormat.chart.decimals };\n\n return (params) => formatNumber(dataLabelValue(params), measure, context, options);\n }\n\n return (params) => formatPlainNumber(dataLabelValue(params), context.locale);\n}\n\n// The value a data label writes: the raw value its point carries, else the\n// plotted one.\nfunction dataLabelValue(params: DataLabelParams): unknown {\n const data = params.data;\n const raw = data !== null && typeof data === 'object' ? (data as { raw?: unknown }).raw : undefined;\n\n return raw ?? params.value;\n}\n\n// A 100% stacked chart's tooltip: the category, then each series on its own\n// line, a share as its percentage to one decimal followed by the value it came\n// from in its measure's format ('25.0% (1)'), and any other series by its own\n// value. The category and the series names come from the data and the config,\n// and ECharts sets the tooltip as HTML, so both are escaped.\nfunction percentTooltip(\n params: TooltipComponentFormatterCallbackParams,\n extracted: ExtractedChartSeries,\n shares: PercentShares,\n granularity: ChartGranularity | null,\n dateLabel: ReportChartDateLabel,\n context: ReportFormatContext,\n): string {\n const items = Array.isArray(params) ? params : [params];\n const dataIndex = items[0]?.dataIndex ?? 0;\n const category = extracted.categories[dataIndex] ?? '';\n const heading = escapeHtml(granularity\n ? formatPeriodLabel(category, granularity, true, context.locale, dateLabel)\n : category);\n const ratioContext = { ...context, ratioPercent: true };\n\n const lines = items.map((item) => {\n const series = extracted.series[item.seriesIndex ?? -1];\n const marker = typeof item.marker === 'string' ? item.marker : '';\n const label = `${marker} ${escapeHtml(item.seriesName ?? series?.name ?? '')}`;\n const value = seriesTooltip(series?.measure, context).valueFormatter(series?.values[item.dataIndex] ?? null);\n const share = shares.get(item.seriesIndex ?? -1)?.[item.dataIndex] ?? null;\n\n return share === null\n ? `${label}: ${value}`\n : `${label}: ${formatNumber(share, PERCENT_SHARE_FORMAT, ratioContext)} (${value})`;\n });\n\n return [heading, ...lines].join('<br/>');\n}\n\n// A value axis: its title and range from the config, its tick labels from\n// valueAxisLabel. A vertical chart's title sits above the axis line, reading\n// away from the plot's edge; a horizontal chart's is centered below the ticks.\n// A bound or interval that is not a usable number is left to ECharts. A 100%\n// stacked chart's share axis (extras.percentMin) has its own fixed range.\nfunction valueAxisOption(\n axis: ChartValueAxis | undefined,\n horizontal: boolean,\n axisLabel: ValueAxisLabel,\n extras: ValueAxisExtras = {},\n) {\n const range = extras.percentMin === undefined\n ? valueAxisRange(axis)\n : { min: extras.percentMin, max: PERCENT_AXIS_MAX, interval: PERCENT_AXIS_INTERVAL };\n\n return {\n type: 'value' as const,\n name: axis?.label || undefined,\n nameLocation: horizontal ? 'middle' as const : 'end' as const,\n nameGap: horizontal ? 28 : 10,\n nameTextStyle: horizontal ? undefined : { align: extras.index === 1 ? 'right' as const : 'left' as const },\n // A pinned bound wins; one left open reaches the references (reachMin),\n // or on a rank axis starts at rank 1.\n min: range.min ?? (extras.rank ? RANK_AXIS_MIN : reachMin(extras.reach)),\n max: range.max ?? reachMax(extras.reach),\n interval: range.interval,\n axisLabel,\n ...(extras.rank ? { inverse: true, minInterval: 1 } : {}),\n };\n}\n\n// The part of a value axis's range the config pins. A bound that is not a\n// finite number, or an interval that is not a positive one, is left out, and\n// the chart picks it from the data. Shared with the PowerPoint export so both\n// media draw the same range.\nexport function valueAxisRange(axis: ChartValueAxis | undefined): { min?: number; max?: number; interval?: number } {\n const interval = axisNumber(axis?.interval);\n\n return {\n min: axisNumber(axis?.min),\n max: axisNumber(axis?.max),\n interval: interval !== undefined && interval > 0 ? interval : undefined,\n };\n}\n\n// A two-axis chart's value axes: the primary on the left, the second on the\n// right without gridlines of its own. Each axis's ticks take the format of the\n// measures plotted against it (axisLabels). Without a range on either axis the\n// second axis aligns its ticks to the primary's gridlines.\n//\n// On a 100% stacked chart (percentMin set) the primary axis is the share axis,\n// whose range is fixed, and the second axis's series are not stacked. An axis\n// of ranks alone (rankAxes) is inverted, and the axes then keep their own\n// ticks, so a rank axis steps by whole ranks.\nfunction twoValueAxesOption(\n config: ChartConfig,\n axisLabels: ValueAxisLabel[],\n context: ReportFormatContext,\n percentMin: number | undefined,\n references: DrawnReference[],\n rankAxes: boolean[],\n) {\n const percent = percentMin !== undefined;\n const label = (axisIndex: ValueAxisIndex) => axisLabels[axisIndex];\n\n return [\n valueAxisOption(config.valueAxis, false, percent ? percentAxisLabel(context) : label(0), {\n index: 0,\n percentMin,\n reach: referenceReach(references, 0),\n rank: rankAxes[0],\n }),\n {\n ...valueAxisOption(config.secondaryAxis, false, label(1), {\n index: 1,\n reach: referenceReach(references, 1),\n rank: rankAxes[1],\n }),\n position: 'right' as const,\n splitLine: { show: false },\n alignTicks: !percent && !rankAxes[0] && !rankAxes[1]\n && !hasAxisRange(config.valueAxis) && !hasAxisRange(config.secondaryAxis),\n },\n ];\n}\n\n// Whether the config pins any of an axis's range: a bound or a tick interval.\nfunction hasAxisRange(axis: ChartValueAxis | undefined): boolean {\n return Object.values(valueAxisRange(axis)).some((value) => value !== undefined);\n}\n\n// A configured bound or interval when it is a finite number, else undefined.\nfunction axisNumber(value: unknown): number | undefined {\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined;\n}\n\n// A value axis's tick labels.\ninterface ValueAxisLabel {\n formatter: (value: number) => string;\n}\n\n// Tick labels written in the locale. ECharts' own ticks are grouped en-US\n// whatever the page's language.\n//\n// With a number format, the units and decimals decided once for the whole\n// axis (resolveValueAxisFormat) write every tick alike ('1.5K', '2.0K', never\n// '2K'). Without one, or when it leaves the ticks an unscaled number with no\n// pinned decimals (format 'number', or precision-less units none), each tick\n// is a plain locale-grouped number keeping its own decimals, so a 0.0002 tick\n// never rounds to '0'.\nfunction valueAxisLabel(format: ValueAxisFormat | null, context: ReportFormatContext): ValueAxisLabel {\n if (!format || (format.chart.units === ReportNumberUnits.None && format.chart.decimals === null)) {\n return { formatter: (value: number) => formatPlainNumber(value, context.locale) };\n }\n\n const options = { units: format.chart.units, decimals: format.chart.decimals };\n\n return {\n formatter: (value: number) => formatNumber(value, format.spec, format.context, options),\n };\n}\n\n// An axis's format from the spec its measures agree on, with the units and\n// decimals decided from its peak. Without a spec the axis is plain, and the\n// peak is never computed.\nfunction resolveValueAxisFormat(\n spec: NumberFormatSpec | null,\n peak: () => number,\n context: ReportFormatContext,\n): ValueAxisFormat | null {\n return spec ? { spec, chart: resolveChartNumberFormat(spec, peak(), context), context } : null;\n}\n\n// Each value axis's format, by axis index. A chart with one value axis takes\n// the format the plotted series' measures agree on (a splitBy or colorBy chart\n// plots only its first measure), from the peak of all its series. On a two-axis chart each axis takes the format of the measures\n// plotted against it, from the peak of its own series, which are never\n// stacked with a 100% stacked chart's shares. A reference past the data\n// stretches its axis, so it counts toward the peak (referencePeak); a 100%\n// stacked chart's references are shares, which the raw values' peak leaves\n// out. contexts holds each axis's context (annotatedAxisContexts).\nfunction valueAxisFormats(\n config: ChartConfig,\n extracted: ExtractedChartSeries,\n axisIndexes: ValueAxisIndex[],\n contexts: ReportFormatContext[],\n percent: boolean,\n references: DrawnReference[],\n): (ValueAxisFormat | null)[] {\n const reach = (axisIndex: ValueAxisIndex) => (percent && axisIndex === 0 ? 0 : referencePeak(references, axisIndex));\n\n if (!axisIndexes.includes(1)) {\n return [resolveValueAxisFormat(\n axisNumberFormat(extracted.series.map((series) => series.measure)),\n () => Math.max(chartValuePeak(extracted.series.map((series) => series.values), !!config.stacked), reach(0)),\n contexts[0],\n )];\n }\n\n return ([0, 1] as const).map((axisIndex) => {\n const onAxis = extracted.series.filter((_, index) => axisIndexes[index] === axisIndex);\n\n return resolveValueAxisFormat(\n axisNumberFormat(onAxis.map((series) => series.measure)),\n () => Math.max(chartValuePeak(onAxis.map((series) => series.values), !!config.stacked && !percent), reach(axisIndex)),\n contexts[axisIndex],\n );\n });\n}\n\n// A 100% stacked chart's share axis ticks: whole percentages in the locale\n// ('25%', '25 %' in fr-CA). The shares are ratios whatever the report's\n// percentFormat says of its stored values.\nfunction percentAxisLabel(context: ReportFormatContext): ValueAxisLabel {\n return { formatter: wholePercentFormatter(context) };\n}\n\n// A share as a whole percentage in the locale, for the share axis's ticks and\n// its series' data labels.\nfunction wholePercentFormatter(context: ReportFormatContext): (value: unknown) => string {\n const ratioContext = { ...context, ratioPercent: true };\n\n return (value: unknown) => formatNumber(value, PERCENT_AXIS_FORMAT, ratioContext);\n}\n\n// What a series' tooltip writes beside its name.\ninterface SeriesTooltip {\n valueFormatter: (value: unknown) => string;\n}\n\n// A series' tooltip value in its measure's number format, per value ('—' when\n// empty). A measure without one writes it as the plain value axis does. A\n// value can arrive as an array (a [value, ...] data item), whose first entry\n// is the value.\nfunction seriesTooltip(measure: ChartMeasure | undefined, context: ReportFormatContext): SeriesTooltip {\n if (!hasNumberFormat(measure)) {\n return { valueFormatter: (value: unknown) => formatPlainNumber(value, context.locale) };\n }\n\n return {\n valueFormatter: (value: unknown) => formatNumber(Array.isArray(value) ? value[0] : value, measure, context),\n };\n}\n\nfunction buildPieOption(\n component: ReportComponent,\n data: ComponentData,\n donut: boolean,\n context: ReportFormatContext,\n): 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 tooltip: seriesTooltip(extracted.series[0]?.measure, context),\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 time axis's date label style when its config names one the viewer knows,\n// else short.\nexport function chartDateLabel(config: ChartConfig | undefined): ReportChartDateLabel {\n return Object.values(ReportChartDateLabel).find((style) => style === config?.xAxis?.dateLabel)\n ?? ReportChartDateLabel.Short;\n}\n\n// A bucket's period-start split into its primary label and its year. A year\n// reads \"2025\" in every style. Short, in the locale: day/week read \"May 1\"\n// ('1 mai' in fr-CA), month \"May\" ('mai'), quarter \"Q2\" ('T2' in French).\n// Long carries its year, in the locale: \"May 1, 2026\", \"May 2026\" ('mai\n// 2026'), \"Q2 2026\". Numeric is the same in every locale: \"2026-05-01\",\n// \"2026-05\", \"2026-Q2\". Returns null for a value that isn't a parseable date\n// (left as-is by callers).\nfunction periodLabelParts(\n value: string,\n granularity: ChartGranularity,\n locale: ReportLocaleTag,\n dateLabel: ReportChartDateLabel = ReportChartDateLabel.Short,\n): { 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 if (granularity === 'year') {\n return { primary: year, year };\n }\n\n return { primary: periodPrimaryLabel(date, granularity, locale, dateLabel), year };\n}\n\n// A period's label in the style asked for, the year aside (see\n// periodLabelParts).\nfunction periodPrimaryLabel(\n date: Date,\n granularity: Exclude<ChartGranularity, 'year'>,\n locale: ReportLocaleTag,\n dateLabel: ReportChartDateLabel,\n): string {\n const year = String(date.getFullYear());\n const quarter = Math.floor(date.getMonth() / 3) + 1;\n\n if (dateLabel === ReportChartDateLabel.Numeric) {\n const month = String(date.getMonth() + 1).padStart(2, '0');\n const day = String(date.getDate()).padStart(2, '0');\n switch (granularity) {\n case 'quarter':\n return `${year}-Q${quarter}`;\n case 'month':\n return `${year}-${month}`;\n default: // day, week — the bucket start\n return `${year}-${month}-${day}`;\n }\n }\n\n const long = dateLabel === ReportChartDateLabel.Long;\n switch (granularity) {\n case 'quarter':\n return long\n ? `${quarterPrefix(locale)}${quarter} ${year}`\n : `${quarterPrefix(locale)}${quarter}`;\n case 'month':\n return formatLocalDate(date, locale, long ? MONTH_YEAR : MONTH_LONG);\n default: // day, week — the bucket start as a month and day\n return formatLocalDate(date, locale, long ? DAY_SHORT : MONTH_DAY);\n }\n}\n\n// Whether a period label leaves its year to be added apart: only a short one\n// does, a long or numeric label already carries it.\nfunction periodYearApart(granularity: ChartGranularity, dateLabel: ReportChartDateLabel): boolean {\n return granularity !== 'year' && dateLabel === ReportChartDateLabel.Short;\n}\n\nfunction quarterPrefix(locale: ReportLocaleTag): string {\n return QUARTER_PREFIXES.get(locale.split('-')[0].toLowerCase()) ?? QUARTER_PREFIX;\n}\n\n// A compact single-line period label — for media that can't do a styled\n// second line, e.g. PowerPoint. A short label has its year appended only when\n// the data spans years; a long or numeric one always carries it.\nexport function formatPeriodLabel(\n value: string,\n granularity: ChartGranularity,\n multiYear: boolean,\n locale: ReportLocaleTag,\n dateLabel: ReportChartDateLabel = ReportChartDateLabel.Short,\n): string {\n const parts = periodLabelParts(value, granularity, locale, dateLabel);\n if (!parts) {\n return value;\n }\n\n return multiYear && periodYearApart(granularity, dateLabel) ? `${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\" ('janvier 2026' in fr-CA), as the chart's x-axis labels it.\nexport function pivotHeadings(\n config: ListConfig,\n data: ComponentData,\n locale: ReportLocaleTag,\n): 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, locale) : column;\n });\n}\n\n// A cross-tab's columns as the grid and the exports draw them: each headed by\n// pivotHeadings(), and every pivot-value column formatted by the one\n// config.cellFormat. The row key column stays as it came. `numeric` marks the\n// columns whose cells are formatted numbers, which are right-aligned.\nexport function pivotColumnSpecs(\n config: ListConfig,\n data: ComponentData,\n locale: ReportLocaleTag,\n): (ListColumn & { numeric: boolean })[] {\n const headings = pivotHeadings(config, data, locale);\n const cellFormat = config.cellFormat;\n const numeric = hasNumberFormat(cellFormat);\n const cells: Pick<ListColumn, 'format' | 'precision' | 'units'> = numeric && cellFormat\n ? { format: listColumnFormat(cellFormat.format), precision: cellFormat.precision, units: cellFormat.units }\n : {};\n\n return (data.columns ?? []).map((column, index) => index === 0\n ? { column, label: headings[index], numeric: false }\n : { column, label: headings[index], ...cells, numeric });\n}\n\n// A number format's style as a list column's format: the two enums share\n// their number values.\nfunction listColumnFormat(format: NumberFormatSpec['format']): ReportListColumnFormat | undefined {\n return Object.values(ReportListColumnFormat).find((value) => value === format);\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, and neither does a long or numeric label,\n// which carries its year). Empty for a non-time axis (labels as-is).\nfunction periodAxisLabel(\n granularity: ChartGranularity | null,\n categories: string[],\n locale: ReportLocaleTag,\n dateLabel: ReportChartDateLabel,\n): { 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, locale, dateLabel);\n if (!parts) {\n return value;\n }\n\n return multiYear && periodYearApart(granularity, dateLabel)\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 {\n comparisonNoteText,\n comparisonOffsetLabel,\n formatDayRange,\n formatDayWindow,\n formatReadingDay,\n isReadOnOneDay,\n kpiNoteText,\n windowNoteText,\n windowText,\n} from './format';\nimport {\n ComparisonOffset,\n ComparisonWindow,\n ComponentComparison,\n ComponentData,\n ComponentKpi,\n OutputMeta,\n OutputRole,\n ReportLocaleTag,\n WindowMeta,\n} from './interfaces/report.interface';\n\n\n// The notes a component shows about the numbers it draws: which days a\n// comparison compares, why it reads as it does, and how its windowed values\n// were computed. The server sends windows, fields and codes; every sentence is\n// worded here, through format.ts, in English with the days in the report's\n// locale. A component whose data carries none of those keys has no note.\n\n// The ComponentData keys a note reads.\nexport type ComponentNoteData = Pick<\n ComponentData,\n 'comparison' | 'timeframe' | 'outputs' | 'cellMeasures' | 'windows' | 'granularity' | 'kpi'\n>;\n\n// The report the note is written for: its locale, and the zone a timeframe's\n// cut time reads in (a comparison names its own).\nexport interface ComponentNoteContext {\n locale: ReportLocaleTag;\n timezone: string;\n}\n\n// Which parts of the note a component shows. Omitted, a part is shown, except\n// the window descriptions, which a chart's tooltips and a list's headers carry\n// instead.\nexport interface ComponentNoteParts {\n // The days the component reads: its comparison's current and prior windows,\n // else its timeframe's days.\n windows?: boolean;\n // What each windowed value is ('Rolling 3-month total, Sep 1 – 30, 2026').\n windowDescriptions?: boolean;\n // Why the windowed values read as they do.\n windowNotes?: boolean;\n}\n\n// Between the current window and each prior one on the windows line.\nconst WINDOWS_SEPARATOR = ' · ';\n\n// Ranks and shares are computed after the viewer's filters, never before.\nconst FILTERED_ROWS_SENTENCE = 'Computed over the rows the filters keep.';\n\nconst ROLE_LEADS: Record<OutputRole, string> = {\n current: 'Value',\n prior: 'Prior value',\n change: 'Change',\n percent_change: 'Percent change',\n};\n\n// The note's lines, in order: the windows, then the comparison's notes and a\n// KPI's delta note, then the windowed values' descriptions and notes. A line is never repeated (two\n// windowed values often share a note). Empty when the data has none of the\n// keys, or none of the parts asked for.\nexport function componentNoteLines(\n data: ComponentNoteData | null | undefined,\n context: ComponentNoteContext,\n parts: ComponentNoteParts = {},\n): string[] {\n if (!data) {\n return [];\n }\n\n const lines = [\n parts.windows === false ? '' : componentWindowsLine(data, context),\n ...comparisonNotes(data.comparison),\n kpiNote(data.kpi, data.comparison),\n ...(parts.windowDescriptions ? windowDescriptions(data, context.locale) : []),\n ...(parts.windowNotes === false ? [] : windowNotes(data, context.locale)),\n ];\n\n return [...new Set(lines.filter((line) => !!line))];\n}\n\n// What one output column holds, for its header's tooltip: the windows a\n// compared value covers, a rank's or a share's scope, and how a windowed value\n// was computed. A cross-tab cell column reads its measure's meaning through\n// cellMeasures. '' for a plain column.\nexport function outputColumnNote(\n column: string,\n data: ComponentNoteData | null | undefined,\n locale: ReportLocaleTag,\n): string {\n const alias = data?.cellMeasures?.[column] ?? column;\n const output = data?.outputs?.[alias];\n\n if (!output) {\n return '';\n }\n\n return [\n comparisonSentence(output, data.comparison, locale),\n rankSentence(output, data.outputs),\n shareSentence(output, data.outputs),\n windowSentences(data.windows?.[alias], locale, data),\n ]\n .filter((sentence) => !!sentence)\n .join(' ');\n}\n\n// 'Sep 1 – 15, 2026 · vs previous month: Aug 1 – 15, 2026'. A comparison\n// with no current window yet has no line (its no_window note says so); a\n// component without a comparison shows its timeframe's days. '' when the data\n// has neither. The note's first line, and the PDF and PowerPoint exports'\n// subtitle under a chart's or a list's title.\nexport function componentWindowsLine(data: ComponentNoteData, context: ComponentNoteContext): string {\n const comparison = data.comparison;\n\n if (comparison) {\n return comparison.current ? comparisonWindowsLine(comparison, comparison.current, context.locale) : '';\n }\n\n return data.timeframe ? formatDayWindow(data.timeframe, context.timezone, context.locale) : '';\n}\n\n// Read on one day, the line names the days the values are read on: 'On Sep\n// 15, 2026 · vs previous month: Aug 31, 2026'.\nfunction comparisonWindowsLine(\n comparison: ComponentComparison,\n currentWindow: ComparisonWindow,\n locale: ReportLocaleTag,\n): string {\n if (isReadOnOneDay(comparison)) {\n const priors = (comparison.offsets ?? []).map((offset, index) => {\n const prior = comparison.priors?.[index];\n const day = prior ? formatDayRange(prior.end, prior.end, locale) : '';\n\n return day ? `${comparisonOffsetLabel(offset)}: ${day}` : comparisonOffsetLabel(offset);\n });\n\n return [formatReadingDay(currentWindow, locale, true), ...priors]\n .filter((part) => !!part)\n .join(WINDOWS_SEPARATOR);\n }\n\n const current = formatDayWindow(currentWindow, comparison.timezone, locale);\n const priors = (comparison.offsets ?? []).map((offset, index) => {\n return priorWindowText(offset, comparison.priors?.[index], comparison.timezone, locale);\n });\n\n return [current, ...priors]\n .filter((part) => !!part)\n .join(WINDOWS_SEPARATOR);\n}\n\n// One prior lane: 'vs previous month: Aug 1 – 15, 2026', or its label alone\n// when the server sends no window for it.\nfunction priorWindowText(\n offset: ComparisonOffset,\n prior: ComparisonWindow | undefined,\n timezone: string,\n locale: ReportLocaleTag,\n): string {\n const label = comparisonOffsetLabel(offset);\n const days = prior ? formatDayWindow(prior, timezone, locale) : '';\n\n return days ? `${label}: ${days}` : label;\n}\n\nfunction comparisonNotes(comparison: ComponentComparison | null | undefined): string[] {\n return (comparison?.notes ?? []).map((code) => comparisonNoteText(code, comparison));\n}\n\n// Why a KPI card's delta reads as it does ('No baseline: the previous period\n// has no data.'), naming the baseline by what the first lane compares against.\nfunction kpiNote(\n kpi: ComponentKpi | null | undefined,\n comparison: ComponentComparison | null | undefined,\n): string {\n return kpi?.note ? kpiNoteText(kpi.note, comparison?.offsets?.[0]?.against) : '';\n}\n\n// One line per windowed value, named by its column when there are several.\nfunction windowDescriptions(data: ComponentNoteData, locale: ReportLocaleTag): string[] {\n const windows = Object.entries(data.windows ?? {});\n\n return windows.map(([alias, meta]) => {\n const text = windowText(meta, locale, data.granularity);\n\n return windows.length > 1 ? `${alias}: ${text}` : text;\n });\n}\n\nfunction windowNotes(data: ComponentNoteData, locale: ReportLocaleTag): string[] {\n return Object.values(data.windows ?? {})\n .flatMap((meta) => (meta.notes ?? []).map((code) => windowNoteText(code, meta, locale, data.granularity)));\n}\n\n// A compared column's windows. In range mode every row compares the same two\n// windows, so they are named, and read on one day the days the values are\n// read on are; over a series or a spine of periods each row compares its own\n// period, so only the lane is.\nfunction comparisonSentence(\n output: OutputMeta,\n comparison: ComponentComparison | null | undefined,\n locale: ReportLocaleTag,\n): string {\n if (!output.role || !comparison) {\n return '';\n }\n\n const offset = comparison.offsets?.[(output.offset ?? 1) - 1] ?? null;\n const current = comparison.current ? formatDayWindow(comparison.current, comparison.timezone, locale) : '';\n const priorWindow = comparison.priors?.[(output.offset ?? 1) - 1];\n const prior = priorWindow ? formatDayWindow(priorWindow, comparison.timezone, locale) : '';\n\n if (comparison.mode === 'range' && current && (output.role === 'current' || prior)) {\n return rangeSentence(output.role, current, prior, offset);\n }\n\n if (isReadOnOneDay(comparison) && comparison.current && priorWindow) {\n return readingDaySentence(output.role, comparison.current, priorWindow, offset, locale);\n }\n\n return output.role === 'current' || !offset ? '' : `${ROLE_LEADS[output.role]} ${comparisonOffsetLabel(offset)}.`;\n}\n\nfunction rangeSentence(role: OutputRole, current: string, prior: string, offset: ComparisonOffset | null): string {\n switch (role) {\n case 'current':\n return `Value for ${current}.`;\n case 'prior':\n return offset ? `Prior value for ${prior} (${comparisonOffsetLabel(offset)}).` : `Prior value for ${prior}.`;\n default:\n return `${ROLE_LEADS[role]} from ${prior} to ${current}.`;\n }\n}\n\n// A column of a comparison read on one day, named by the days its values are\n// read on: 'Prior value on Aug 31, 2026 (vs previous month).'\nfunction readingDaySentence(\n role: OutputRole,\n currentWindow: ComparisonWindow,\n priorWindow: ComparisonWindow,\n offset: ComparisonOffset | null,\n locale: ReportLocaleTag,\n): string {\n const current = formatReadingDay(currentWindow, locale);\n const prior = formatReadingDay(priorWindow, locale);\n\n switch (role) {\n case 'current':\n return `Value ${current}.`;\n case 'prior':\n return offset ? `Prior value ${prior} (${comparisonOffsetLabel(offset)}).` : `Prior value ${prior}.`;\n default:\n return `${ROLE_LEADS[role]} from the value ${prior} to the value ${current}.`;\n }\n}\n\n// 'Rank by Revenue, 1 being the largest, within each Region. Tied values share\n// a rank (1, 1, 3).' A measure written as its own rank ranks by the value it\n// would otherwise show, so it names no other measure ('Rank, 1 being the\n// largest, across all rows.').\nfunction rankSentence(output: OutputMeta, outputs: Record<string, OutputMeta> | null | undefined): string {\n const rank = output.kind === 'rank' ? output.rank : null;\n\n if (!rank) {\n return '';\n }\n\n const end = rank.direction === 'asc' ? 'smallest' : 'largest';\n const scope = rank.within?.length ? `within each ${joinNames(rank.within)}` : 'across all rows';\n const ties = rank.method === 'dense' ? '1, 1, 2' : '1, 1, 3';\n const by = isOwnOutput(output, outputs) ? '' : ` by ${output.measure}`;\n\n return `Rank${by}, 1 being the ${end}, ${scope}. Tied values share a rank (${ties}). `\n + FILTERED_ROWS_SENTENCE;\n}\n\n// 'Share of the total Revenue within each Region.' A measure written as its\n// own share names no other measure ('Share of the total within each\n// Region.', 'Share of the total across all rows.').\nfunction shareSentence(output: OutputMeta, outputs: Record<string, OutputMeta> | null | undefined): string {\n const share = output.kind === 'share' ? output.share : null;\n\n if (!share) {\n return '';\n }\n\n if (isOwnOutput(output, outputs)) {\n const scope = share.within?.length ? `within each ${joinNames(share.within)}` : 'across all rows';\n\n return `Share of the total ${scope}. ${FILTERED_ROWS_SENTENCE}`;\n }\n\n const scope = share.within?.length ? ` within each ${joinNames(share.within)}` : '';\n\n return `Share of the total ${output.measure}${scope}. ${FILTERED_ROWS_SENTENCE}`;\n}\n\n// Whether a rank or a share is its measure's own output: the server writes a\n// measure with a rank or a share as that rank or share, so its measure is a\n// column of the same kind (itself, or for a prior or a change the current\n// column), never a value of its own to name.\nfunction isOwnOutput(output: OutputMeta, outputs: Record<string, OutputMeta> | null | undefined): boolean {\n return outputs?.[output.measure]?.kind === output.kind;\n}\n\n// A windowed column: what it is, then why it reads as it does.\nfunction windowSentences(\n meta: WindowMeta | undefined,\n locale: ReportLocaleTag,\n data: ComponentNoteData,\n): string {\n if (!meta) {\n return '';\n }\n\n const notes = (meta.notes ?? []).map((code) => windowNoteText(code, meta, locale, data.granularity));\n\n return [`${windowText(meta, locale, data.granularity)}.`, ...notes].join(' ');\n}\n\n// 'Region', 'Region and Channel', 'Region, Channel and Plan'.\nfunction joinNames(names: string[]): string {\n return names.length > 1\n ? `${names.slice(0, -1).join(', ')} and ${names[names.length - 1]}`\n : names.join('');\n}\n","import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';\n\nimport { ComponentNoteData, componentNoteLines } from '../../output-notes';\nimport { ReportFilterStateService } from '../../services/report-filter-state.service';\n\n\n// The small print under a chart or a KPI and above a list: which days a\n// comparison compares, why it reads as it does, and how its windowed values\n// were computed (output-notes.ts words it). Shared by the chart, KPI and list\n// components; it renders nothing when the data carries none of those keys, so\n// a component without them looks exactly as it did.\n@Component({\n selector: 'app-report-component-note',\n templateUrl: './component-note.component.html',\n styleUrls: ['./component-note.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n})\nexport class ComponentNoteComponent {\n\n public readonly data = input<ComponentNoteData | null>(null);\n\n // The comparison's (or the timeframe's) days. A component that prints its\n // own window line turns it off.\n public readonly windows = input(true);\n\n // What each windowed value is: for a component with no tooltip or header to\n // carry it, as a KPI.\n public readonly windowDescriptions = input(false);\n\n // Why the windowed values read as they do. A list puts them in its column\n // headers' tooltips instead.\n public readonly windowNotes = input(true);\n\n public readonly lines = computed(() => componentNoteLines(\n this.data(),\n { locale: this._filterState.formatContext().locale, timezone: this._filterState.timezone() },\n { windows: this.windows(), windowDescriptions: this.windowDescriptions(), windowNotes: this.windowNotes() },\n ));\n\n private readonly _filterState = inject(ReportFilterStateService);\n}\n","<!-- One line each, cut to the tile's width; the title holds the whole line. -->\n@for (line of lines(); track line) {\n <div\n class=\"note-line small\"\n [attr.title]=\"line\">\n {{ line }}\n </div>\n}\n","import { ChangeDetectionStrategy, Component, computed, inject, input } 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';\nimport { ReportFilterStateService } from '../../services/report-filter-state.service';\nimport { ComponentNoteComponent } from '../component-note/component-note.component';\n\n\n// ECharts host for a chart component. Pure rendering: the parent owns the\n// data fetch; this maps (component config, rows, the open report's format\n// context) → option and exposes the chart instance for resize + the future\n// image exports (getDataURL needs the canvas renderer registered in\n// theme/echarts.ts). The shared note under the plot names the days a\n// comparison compares and why windowed series read as they do; the series'\n// tooltips describe the windows themselves.\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 ComponentNoteComponent,\n NgxEchartsDirective,\n ],\n})\nexport class ComponentChartComponent {\n\n public readonly component = input.required<ReportComponent>();\n public readonly data = input<ComponentData | null>(null);\n\n public readonly options = computed<EChartsOption | null>(() => {\n const data = this.data();\n\n return data\n ? buildChartOption(this.component(), data, this._filterState.formatContext())\n : null;\n });\n\n private _chart: ECharts | null = null;\n private readonly _filterState = inject(ReportFilterStateService);\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<app-report-component-note [data]=\"data()\"></app-report-component-note>\n","import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';\n\nimport { kpiSparklineGeometry } from '../../../../kpi-card';\n\n\n// A KPI's trend over its last periods: a line that stretches to the card's\n// width, broken where a period has no value, with the last point marked\n// (hollow while its period is still running). The markers are drawn over the\n// line rather than in it, so they stay round however the line is stretched.\n@Component({\n selector: 'app-component-kpi-sparkline',\n templateUrl: './sparkline.component.html',\n styleUrls: ['./sparkline.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n})\nexport class SparklineComponent {\n\n public readonly values = input<(number | null)[]>([]);\n public readonly partial = input(false);\n\n public readonly geometry = computed(() => kpiSparklineGeometry(this.values(), this.partial()));\n}\n","<svg\n class=\"sparkline-lines\"\n viewBox=\"0 0 100 100\"\n preserveAspectRatio=\"none\">\n @for (line of geometry().lines; track $index) {\n <polyline [attr.points]=\"line\"></polyline>\n }\n</svg>\n@for (dot of geometry().dots; track $index) {\n <span\n class=\"sparkline-marker\"\n [style.left.%]=\"dot.x\"\n [style.top.%]=\"dot.y\">\n </span>\n}\n@if (geometry().last; as last) {\n <span\n class=\"sparkline-marker\"\n [class.hollow]=\"last.hollow\"\n [style.left.%]=\"last.x\"\n [style.top.%]=\"last.y\">\n </span>\n}\n","import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';\n\nimport { ReportChangePolarity } from '../../enums/report-change-polarity.enum';\nimport { ReportKpiTrend } from '../../enums/report-kpi-trend.enum';\nimport { ComponentData, KpiConfig, ReportComponent } from '../../interfaces/report.interface';\nimport { kpiCardView } from '../../kpi-card';\nimport { componentNoteLines } from '../../output-notes';\nimport { ReportFilterStateService } from '../../services/report-filter-state.service';\nimport { REPORT_KPI_CHANGE_COLORS, REPORT_KPI_SPARKLINE_COLOR } from '../../theme/palette';\nimport { REPORT_KPI_VALUE_FONT_SIZE } from '../../theme/typography';\nimport { DEFAULT_TEXT_COLOR } from '../../text';\nimport { ComponentNoteComponent } from '../component-note/component-note.component';\n\nimport { SparklineComponent } from './components/sparkline/sparkline.component';\n\n\n// A single big number: the component's measure aggregated over all (filtered)\n// rows server-side, in the open report's format context (its locale, its\n// currency, and whether a percent arrives as a 0-1 ratio or, from an older\n// server, already x100). With a comparison, a target or a sparkline the server\n// sends every other number the card shows too (ComponentData.kpi); kpi-card.ts\n// decides what each line says, and this only lays them out, in order: the\n// value and its label, the delta, the days, the target and the trend, then the\n// note.\n//\n// The palette's colors and the value's size arrive as custom properties from\n// the same constants the exports draw with. A host page overrides a color by\n// setting --report-kpi-good-color, --report-kpi-bad-color,\n// --report-kpi-neutral-color or --report-kpi-sparkline-color around the report.\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 imports: [\n ComponentNoteComponent,\n SparklineComponent,\n ],\n host: {\n '[style.--report-kpi-value-size]': 'tokens.valueSize',\n '[style.--report-kpi-text-default]': 'tokens.text',\n '[style.--report-kpi-good-default]': 'tokens.good',\n '[style.--report-kpi-bad-default]': 'tokens.bad',\n '[style.--report-kpi-neutral-default]': 'tokens.neutral',\n '[style.--report-kpi-sparkline-default]': 'tokens.sparkline',\n },\n})\nexport class ComponentKpiComponent {\n\n public readonly component = input.required<ReportComponent>();\n public readonly data = input<ComponentData | null>(null);\n\n public readonly ReportKpiTrend = ReportKpiTrend;\n\n public readonly tokens = {\n valueSize: `${REPORT_KPI_VALUE_FONT_SIZE}px`,\n text: DEFAULT_TEXT_COLOR,\n good: `#${REPORT_KPI_CHANGE_COLORS[ReportChangePolarity.Good]}`,\n bad: `#${REPORT_KPI_CHANGE_COLORS[ReportChangePolarity.Bad]}`,\n neutral: `#${REPORT_KPI_CHANGE_COLORS[ReportChangePolarity.Neutral]}`,\n sparkline: `#${REPORT_KPI_SPARKLINE_COLOR}`,\n };\n\n // Read off the component on every data change rather than through a memo of\n // the config: a settings save repaints the same component object with new\n // KPI keys, then reloads its data.\n public readonly view = computed(() => kpiCardView(\n (this.component().config ?? {}) as KpiConfig,\n this.data(),\n { format: this._filterState.formatContext(), timezone: this._filterState.timezone() },\n ));\n\n // The note sits under the card only when it has something to say, so an\n // empty one takes no room.\n public readonly hasNote = computed(() => componentNoteLines(\n this.data(),\n { locale: this._filterState.formatContext().locale, timezone: this._filterState.timezone() },\n { windows: false, windowDescriptions: true },\n ).length > 0);\n\n private readonly _filterState = inject(ReportFilterStateService);\n}\n","@let card = view();\n<div class=\"kpi fs-column.gap-xs.align-center.justify-center\">\n <div class=\"kpi-value\">{{ card.value }}</div>\n @if (card.label) {\n <div class=\"kpi-label small\">{{ card.label }}</div>\n }\n @if (card.delta; as delta) {\n <div class=\"kpi-delta fs-row.gap-xs.align-baseline.justify-center.wrap\">\n <span\n class=\"kpi-change\"\n [attr.data-tone]=\"delta.tone\">\n @if (delta.trend !== ReportKpiTrend.Flat) {\n <svg\n class=\"kpi-arrow\"\n [class.down]=\"delta.trend === ReportKpiTrend.Down\"\n viewBox=\"0 0 10 10\">\n <polygon points=\"5,1 9.5,9 0.5,9\"></polygon>\n </svg>\n }\n {{ delta.text }}\n </span>\n @if (delta.compared) {\n <span class=\"small\">{{ delta.compared }}</span>\n }\n </div>\n }\n @if (card.window) {\n <div class=\"kpi-line small\">{{ card.window }}</div>\n }\n @if (card.target; as target) {\n <div class=\"kpi-target fs-column.gap-xs.align-center\">\n <div class=\"kpi-line small\">\n {{ target.text }}\n @if (target.progress) {\n · {{ target.progress }}\n }\n </div>\n @if (target.fill !== null) {\n <div\n class=\"kpi-progress\"\n [attr.data-tone]=\"target.tone\">\n <div\n class=\"kpi-progress-fill\"\n [style.width.%]=\"target.fill * 100\">\n </div>\n </div>\n }\n </div>\n }\n @if (card.sparkline; as sparkline) {\n <app-component-kpi-sparkline\n class=\"kpi-sparkline\"\n [values]=\"sparkline.values\"\n [partial]=\"sparkline.partial\">\n </app-component-kpi-sparkline>\n }\n <!-- The card prints its own days, so the note leaves them out. A KPI has no\n tooltip, so its note also says what a windowed value is. -->\n @if (hasNote()) {\n <app-report-component-note\n [data]=\"data()\"\n [windows]=\"false\"\n [windowDescriptions]=\"true\">\n </app-report-component-note>\n }\n</div>\n","import { Pipe, PipeTransform } from '@angular/core';\n\nimport { formatReportDate } from '../format';\nimport { ReportLocaleTag } from '../interfaces/report.interface';\n\n\n// A report row's date cell as the calendar day in the report's zone, written in\n// the report's locale. Use it in place of Angular's DatePipe, which reads a\n// 'YYYY-MM-DD HH:MM:SS' value as the browser's local wall time instead of the\n// UTC instant it is, and writes in the browser's language.\n@Pipe({\n name: 'fsReportDate',\n standalone: true,\n})\nexport class ReportDatePipe implements PipeTransform {\n\n public transform(value: unknown, timezone: string, locale: ReportLocaleTag): string {\n return formatReportDate(value, timezone, locale);\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\nimport { formatNumber, hasNumberFormat } from '../format';\nimport { NumberFormatSpec, ReportFormatContext } from '../interfaces/report.interface';\n\n\n// A list cell in its column's number format, in the report's locale and\n// currency; an empty value reads ''. A column without number-format keys\n// prints its value as it came, as a cell always has, so an id or a year is\n// never grouped ('2,026').\n@Pipe({\n name: 'fsReportNumber',\n standalone: true,\n})\nexport class ReportNumberPipe implements PipeTransform {\n\n public transform(value: unknown, column: NumberFormatSpec, context: ReportFormatContext): string {\n if (hasNumberFormat(column)) {\n return formatNumber(value, column, context, { empty: '' });\n }\n\n return value === null || value === undefined ? '' : String(value);\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\nimport { FormattedOutputValue, formatOutputValue } from '../format';\nimport { ListColumn, ReportFormatContext } from '../interfaces/report.interface';\nimport { ListOutputColumn } from '../list-config';\n\n\n// A list cell (or a totals cell) of an output column, written by what it holds:\n// a prior or a change in its measure's format, a signed percent change, a\n// change of a rate in points, a rank as a whole number, a share as a percent.\n// It reads the whole row, since a change looks up its prior beside it to tell\n// a missing baseline ('—') from a zero one ('n/a'). An empty value reads ''.\n@Pipe({\n name: 'fsReportOutput',\n standalone: true,\n})\nexport class ReportOutputPipe implements PipeTransform {\n\n public transform(\n row: Record<string, unknown> | null | undefined,\n column: ListColumn,\n output: ListOutputColumn,\n context: ReportFormatContext,\n ): FormattedOutputValue {\n return formatOutputValue(row?.[column.column], output.output, column, context, {\n measureSpec: output.measureSpec,\n prior: output.priorAlias && row ? row[output.priorAlias] : undefined,\n floor: output.floor,\n empty: '',\n });\n }\n}\n","import { NgTemplateOutlet } from '@angular/common';\nimport {\n AfterRenderRef,\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n Injector,\n OnInit,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { MatTooltip } from '@angular/material/tooltip';\n\nimport { FsListComponent, FsListConfig, FsListModule, PaginationStrategy } from '@firestitch/list';\n\nimport { Observable, map, merge, tap } from 'rxjs';\n\nimport { ReportData } from '../../data/report.data';\nimport { ReportListColumnFormat } from '../../enums/report-list-column-format.enum';\nimport { formatPlainNumber, hasNumberFormat } from '../../format';\nimport {\n ComponentData,\n ComponentDataState,\n ListColumn,\n ListConfig,\n ReportComponent,\n ReportSort,\n} from '../../interfaces/report.interface';\nimport {\n LIST_TOTAL_LABEL,\n ListOutputColumn,\n columnClasses,\n listOutputColumns,\n listPinnedColumns,\n listSortTerms,\n listTotalsLabelColumn,\n} from '../../list-config';\nimport { pivotColumnSpecs } from '../../option-builder';\nimport { ComponentNoteData, outputColumnNote } from '../../output-notes';\nimport { ReportDatePipe } from '../../pipes/report-date.pipe';\nimport { ReportNumberPipe } from '../../pipes/report-number.pipe';\nimport { ReportOutputPipe } from '../../pipes/report-output.pipe';\nimport { ReportFilterStateService } from '../../services/report-filter-state.service';\nimport { ComponentNoteComponent } from '../component-note/component-note.component';\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//\n// A list whose query compares, windows, ranks or shares says so: the shared\n// note above it names the windows a comparison compares, each such column's\n// header tooltip says what it holds, and its cells (totals included, which the\n// server computes) are written by what they hold.\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 ComponentNoteComponent,\n FsListModule,\n MatTooltip,\n NgTemplateOutlet,\n ReportDatePipe,\n ReportNumberPipe,\n ReportOutputPipe,\n ],\n})\nexport class ComponentListComponent implements OnInit {\n\n public readonly reportId = input.required<number>();\n public readonly component = input.required<ReportComponent>();\n\n public readonly listComponent = viewChild(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. `numeric` marks a column whose cells are\n // formatted numbers, decided once here rather than per cell, so the column\n // and its header are right-aligned.\n public columns = signal<(ListColumn & { numeric: boolean })[]>([]);\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 // Why the search box did not narrow the rows (the list has no text column to\n // search), from the latest page 1; null when the search applied or none was\n // made.\n public readonly searchNote = signal<string | null>(null);\n\n // config.totals, read once at init: a list with totals renders its columns\n // with a footer template, which fs-list reads only when it builds them.\n public readonly showTotals = signal(false);\n\n // The totals row from the latest page 1, raw values keyed like the columns;\n // null when the list has none, or the server says why in totalsNote.\n public readonly totals = signal<Record<string, unknown> | null>(null);\n\n public readonly totalsNote = signal<string | null>(null);\n\n // The latest page 1's comparison windows, timeframe and output metadata, for\n // the note above the list, the header tooltips and the output cells; null\n // until it arrives, and empty of every key for a list that has none.\n public readonly noteData = signal<ComponentNoteData | null>(null);\n\n // How many rows the list shows (load more appends) out of how many its\n // filters keep. A cross-tab counts grid rows.\n public readonly rowCount = signal<{ shown: number; total: number } | null>(null);\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 // The open report's format context: date cells, number cells and a\n // cross-tab's period headings are written in its locale (and money in its\n // currency). Injected here for the same reason.\n public readonly formatContext = inject(ReportFilterStateService).formatContext;\n\n public readonly ReportListColumnFormat = ReportListColumnFormat;\n\n // How many leading columns stay in view while the list scrolls sideways.\n public readonly pinned = computed(() => listPinnedColumns(this.component().config));\n\n public readonly columnClasses = columnClasses;\n\n // The config columns the viewer hid on this list (the Columns dialog, or the\n // URL). fs-list hides and shows them in place through [show], so the rows\n // already fetched stand.\n public readonly hidden = computed(() => new Set(this._filterState.hiddenColumns(this.component().id)));\n\n public readonly totalLabel = LIST_TOTAL_LABEL;\n\n // The columns that hold a compared, windowed, ranked or shared output, by\n // name; the rest are written as before.\n public readonly outputColumns = computed<Record<string, ListOutputColumn>>(() => listOutputColumns(\n this.columns(),\n this.noteData(),\n ((this.component().config ?? {}) as ListConfig).columns ?? [],\n ));\n\n // Each column's header tooltip: what an output column holds ('' for any\n // other).\n public readonly columnNotes = computed<Record<string, string>>(() => {\n const locale = this.formatContext().locale;\n\n return Object.fromEntries(this.columns()\n .map((column) => [column.column, outputColumnNote(column.column, this.noteData(), locale)]));\n });\n\n // The column whose footer cell reads 'Total': the first one shown, unless\n // it holds a total itself.\n public readonly totalsLabelColumn = computed(() => listTotalsLabelColumn(\n this.columns().filter((column) => !this.hidden().has(column.column)),\n this.totals(),\n ));\n\n // The line under the list: its row count, then why it has no totals and why\n // its search narrowed nothing. The digits are written in the report's\n // locale, never the app's.\n public readonly caption = computed(() => {\n const count = this.rowCount();\n const locale = this.formatContext().locale;\n const parts: string[] = [];\n\n if (count) {\n const total = formatPlainNumber(count.total, locale);\n parts.push(count.shown < count.total\n ? `Showing ${formatPlainNumber(count.shown, locale)} of ${total}`\n : `${total} row(s)`);\n }\n\n return [...parts, this.totalsNote(), this.searchNote()]\n .filter((part): part is string => !!part)\n .join(' · ');\n });\n\n private _reportData = inject(ReportData);\n private _filterState = inject(ReportFilterStateService);\n private _destroyRef = inject(DestroyRef);\n private _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private _injector = inject(Injector);\n private _pinOffsetsRef: AfterRenderRef | null = null;\n\n constructor() {\n // Hiding or showing a column moves the pinned columns after it.\n effect(() => {\n this.hidden();\n untracked(() => this._schedulePinOffsets());\n });\n }\n\n public ngOnInit(): void {\n const component = this.component();\n const config = (component.config ?? {}) as ListConfig;\n this.pivoted.set(!!config.pivotBy?.column);\n this.showTotals.set(config.totals === true);\n this.columns.set((config.columns ?? []).map((column) => ({ ...column, numeric: hasNumberFormat(column) })));\n\n this._initListConfig(config);\n this._observePinOffsets();\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 // So does a change of the text in its search box (in the component header).\n merge(this._filterState.changesFor(component), this._filterState.listSearchChanges(component.id))\n .pipe(\n tap(() => this.listComponent()?.reload()),\n takeUntilDestroyed(this._destroyRef),\n )\n .subscribe();\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 // fs-list holds one sorting column, so it shows the authored sort's first\n // term; the request sends only that term and the server appends the rest.\n const sort: ReportSort | undefined = this._filterState.listSort(this.component().id)\n ?? listSortTerms(config)[0];\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 const component = this.component();\n this._filterState.setListSort(component, state.sort ?? null);\n\n const search = this._filterState.listSearch(component.id);\n if (search) {\n state.search = search;\n }\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(component);\n\n return this._reportData\n .componentData(this.reportId(), 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 // Only page 1 carries the notes and the totals; a load-more page\n // leaves them as they are.\n if (state.page === 1) {\n this.searchNote.set(data.searchNote ?? null);\n this.totals.set(data.totals ?? null);\n this.totalsNote.set(data.totalsNote ?? null);\n this.noteData.set(this._noteData(data));\n this._alignOutputColumns(data);\n }\n\n // The server's page size when it sends one (it clamps the request),\n // the size the paging below hands fs-list too.\n const size = data.paging?.pageSize ?? state.pageSize;\n const shown = (state.page - 1) * size + (data.rows?.length ?? 0);\n this.rowCount.set({ shown, total: data.paging?.total ?? shown });\n\n // New rows can widen a pinned column, which moves the ones after it.\n this._schedulePinOffsets();\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 by pivotColumnSpecs(): the same\n // headings and cell format the PDF and PowerPoint exports use. A cell column\n // whose measure is a rank or a share (cellMeasures names it) holds numbers\n // whether or not the grid names a cell format.\n private _pivotColumns(data: ComponentData): (ListColumn & { numeric: boolean })[] {\n const config = (this.component().config ?? {}) as ListConfig;\n const outputCells = Object.keys(listOutputColumns(\n (data.columns ?? []).slice(1).map((column) => ({ column })),\n data,\n [],\n ));\n\n return pivotColumnSpecs(config, data, this.formatContext().locale)\n .map((column) => ({ ...column, numeric: column.numeric || outputCells.includes(column.column) }));\n }\n\n private _noteData(data: ComponentData): ComponentNoteData {\n return {\n comparison: data.comparison,\n timeframe: data.timeframe,\n outputs: data.outputs,\n cellMeasures: data.cellMeasures,\n windows: data.windows,\n granularity: data.granularity,\n };\n }\n\n // A plain list's columns are built before any data arrives, so an output\n // column that names no format of its own (a rank, a share, a prior that takes\n // its measure's format) learns it holds numbers from page 1. fs-list reads a\n // column's alignment only when it builds the column, so a column whose\n // alignment changes is rebuilt (the template tracks columns by both).\n private _alignOutputColumns(data: ComponentData): void {\n if (this.pivoted() || !data.outputs) {\n return;\n }\n\n const columns = this.columns();\n const aligned = columns.map((column) => ({\n ...column,\n numeric: hasNumberFormat(column) || !!data.outputs[column.column],\n }));\n\n if (aligned.some((column, index) => column.numeric !== columns[index].numeric)) {\n this.columns.set(aligned);\n }\n }\n\n // A tile resize reflows the table's auto layout, so the pinned columns'\n // widths, and with them their offsets, change.\n private _observePinOffsets(): void {\n if (this.pinned() < 2 || typeof ResizeObserver === 'undefined') {\n return;\n }\n\n const observer = new ResizeObserver(() => this._schedulePinOffsets());\n observer.observe(this._elementRef.nativeElement);\n this._destroyRef.onDestroy(() => observer.disconnect());\n }\n\n // Measures the pinned offsets once the next render has laid the table out.\n // One pending measurement covers every request made before it runs. Only\n // afterNextRender exists in every Angular version this library runs on.\n private _schedulePinOffsets(): void {\n if (this.pinned() < 2 || this._pinOffsetsRef) {\n return;\n }\n\n this._pinOffsetsRef = afterNextRender(() => {\n this._pinOffsetsRef = null;\n this._updatePinOffsets();\n }, { injector: this._injector });\n }\n\n // Each pinned column sticks at the summed width of the visible pinned\n // columns before it. A hidden column renders no header, so the next pinned\n // one takes its place. A variable is written only when its value changed,\n // which keeps a resize from restyling the table for nothing.\n private _updatePinOffsets(): void {\n const host = this._elementRef.nativeElement;\n let left = 0;\n\n for (let index = 0; index < this.pinned(); index++) {\n const header = host.querySelector<HTMLElement>(`thead th.report-pin-${index}`);\n\n if (!header) {\n continue;\n }\n\n const name = `--report-pin-left-${index}`;\n const value = `${Math.round(left * 100) / 100}px`;\n\n if (host.style.getPropertyValue(name) !== value) {\n host.style.setProperty(name, value);\n }\n\n left += header.getBoundingClientRect().width;\n }\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<!-- The windows a comparison compares, and why it reads as it does. A\n windowed column's own notes are in its header's tooltip. -->\n<app-report-component-note\n [data]=\"noteData()\"\n [windowNotes]=\"false\">\n</app-report-component-note>\n\n<!-- fs-list reads a column's footer template once, as a direct child of\n fs-list-column, so a list with totals renders its columns in a branch of\n their own rather than wrapping the footer in an @if. Its header template too,\n which every column carries: an output column's tooltip says what it holds.\n Columns are tracked by alignment as well as name, since fs-list reads a\n column's alignment only when it builds the column. -->\n<fs-list\n [config]=\"listConfig\"\n [class.report-totals-empty]=\"!totals()\">\n @if (showTotals()) {\n @for (column of columns(); track column.column + ':' + column.numeric) {\n <fs-list-column\n [name]=\"column.column\"\n [title]=\"column.label || column.column\"\n [show]=\"!hidden().has(column.column)\"\n [sortable]=\"!pivoted() || $first\"\n [align]=\"column.numeric ? 'right' : 'left'\"\n [class]=\"columnClasses(column, $index, pinned())\">\n <ng-template fs-list-header>\n <ng-container\n [ngTemplateOutlet]=\"headerTpl\"\n [ngTemplateOutletContext]=\"{ column: column }\">\n </ng-container>\n </ng-template>\n <ng-template\n fs-list-cell\n let-row=\"row\">\n <ng-container\n [ngTemplateOutlet]=\"cellTpl\"\n [ngTemplateOutletContext]=\"{ $implicit: row[column.column], row: row, column: column }\">\n </ng-container>\n </ng-template>\n <ng-template fs-list-footer>\n @if (totals()?.[column.column] !== undefined) {\n <ng-container\n [ngTemplateOutlet]=\"cellTpl\"\n [ngTemplateOutletContext]=\"{ $implicit: totals()?.[column.column], row: totals(), column: column }\">\n </ng-container>\n } @else if (column.column === totalsLabelColumn()) {\n {{ totalLabel }}\n }\n </ng-template>\n </fs-list-column>\n }\n } @else {\n @for (column of columns(); track column.column + ':' + column.numeric) {\n <fs-list-column\n [name]=\"column.column\"\n [title]=\"column.label || column.column\"\n [show]=\"!hidden().has(column.column)\"\n [sortable]=\"!pivoted() || $first\"\n [align]=\"column.numeric ? 'right' : 'left'\"\n [class]=\"columnClasses(column, $index, pinned())\">\n <ng-template fs-list-header>\n <ng-container\n [ngTemplateOutlet]=\"headerTpl\"\n [ngTemplateOutletContext]=\"{ column: column }\">\n </ng-container>\n </ng-template>\n <ng-template\n fs-list-cell\n let-row=\"row\">\n <ng-container\n [ngTemplateOutlet]=\"cellTpl\"\n [ngTemplateOutletContext]=\"{ $implicit: row[column.column], row: row, column: column }\">\n </ng-container>\n </ng-template>\n </fs-list-column>\n }\n }\n</fs-list>\n\n@if (caption()) {\n <div class=\"list-caption small\">\n {{ caption() }}\n </div>\n}\n\n<!-- A column's heading, with what an output column holds as its tooltip (an\n empty one never shows). -->\n<ng-template\n #headerTpl\n let-column=\"column\">\n <span [matTooltip]=\"columnNotes()[column.column] ?? ''\">{{ column.label || column.column }}</span>\n</ng-template>\n\n<!-- One cell, in the body and the totals row alike: an output column by what\n it holds (its row gives a change its prior), a date column as a day in the\n report's zone and locale, any other through its number format. -->\n<ng-template\n #cellTpl\n let-value\n let-row=\"row\"\n let-column=\"column\">\n @if (outputColumns()[column.column]; as output) {\n @if (row | fsReportOutput: column : output : formatContext(); as cell) {\n <span [attr.title]=\"cell.title\">{{ cell.text }}</span>\n }\n } @else if (column.format === ReportListColumnFormat.Date) {\n {{ value | fsReportDate: timezone() : formatContext().locale }}\n } @else {\n {{ value | fsReportNumber: column : formatContext() }}\n }\n</ng-template>\n","import { Plugin, PluginConfig } from '@firestitch/html-editor';\n\nimport { TextValue, VALUE_TOKEN_PATTERN, valueText, valueToken } from '../../text';\n\n\n// How a value chip is marked in the editor. The names follow the embeds of\n// @firestitch/markdown-editor. Attributes rather than a class: the report keeps\n// Froala on inline styles (useClasses: false), and a chip never reaches storage\n// anyway — it turns back into its {{value.key}} token on the way out.\nconst TYPE_ATTRIBUTE = 'data-embed-type';\nconst KEY_ATTRIBUTE = 'data-embed-key';\nconst MISSING_ATTRIBUTE = 'data-embed-missing';\nconst CHIP_SELECTOR = `[${KEY_ATTRIBUTE}]`;\nconst VALUE_TYPE = 'value';\n\n// The page a copy came from, on the clipboard beside its text: values belong\n// to their page, so a value pasted onto another one doesn't come with it.\nconst SCOPE_TYPE = 'application/x-fs-report-value-scope';\n\n// What Froala must keep on a chip when it cleans html it is handed.\nexport const VALUE_EMBED_ATTRIBUTES = [TYPE_ATTRIBUTE, KEY_ATTRIBUTE, MISSING_ATTRIBUTE, 'contenteditable'];\n\n// A brief ring around the chips an edit was stopped at.\nconst FLASH: Keyframe[] = [{ boxShadow: '0 0 0 2px #e15759' }, { boxShadow: '0 0 0 2px transparent' }];\nconst FLASH_MS = 700;\n\n// Commands that would build what the server rewrites (ReportTextHtml): a table\n// is kept only between paragraphs, and a cell holds words and values only.\nconst TABLE_INSERT_COMMANDS = ['insertTable', 'tableInsert'];\nconst NO_TABLE_INSIDE = 'li, td, th';\nconst CELL_COMMANDS = ['formatUL', 'formatOL', 'paragraphFormat'];\nconst CELL = 'td, th';\n\n// Undo and redo restore a step; they remove nothing of their own.\nconst HISTORY_COMMANDS = ['undo', 'redo'];\n\n// Keys that, pressed alone, edit nothing.\nconst MODIFIER_KEYS = ['Shift', 'Control', 'Alt', 'AltGraph', 'Meta'];\n\n// The cells of a table selected as cells (Froala's own marking).\nconst SELECTED_CELL = '.fr-selected-cell';\n\n// An edit that would have removed values, and was stopped.\nexport interface ValueEmbedBlock {\n count: number;\n // Present when the edit was on a selection: removes the selection, values\n // and all — the deliberate way through.\n removeSelection?: () => void;\n}\n\n// An edit that took the last chip of some values out of the block: deleting\n// a row, a column or a table, or emptying cells. Allowed, values and all.\nexport interface ValueEmbedRemoval {\n // The keys the block's chips named before the edit, and after it.\n before: string[];\n after: string[];\n // The editor's own undo, which brings the chips back.\n undo: () => void;\n}\n\nexport interface ValueEmbedPluginConfig extends PluginConfig {\n // The element the editor sits in. html-editor registers a plugin with Froala\n // globally, so Froala hands it every editor built afterwards; it works only\n // for the one inside this element.\n host: () => HTMLElement;\n // The page's values, by key. One whose number is still on its way is listed\n // with loading: true; a key not listed is no value of the page.\n values: () => Record<string, TextValue>;\n // The page the block's values belong to.\n scope: () => string;\n // Label chips with the value's name instead of its number.\n showNames: () => boolean;\n click: (key: string, chip: HTMLElement) => void;\n blocked: (block: ValueEmbedBlock) => void;\n removed: (removal: ValueEmbedRemoval) => void;\n // A key was pressed or a command is about to run: what was said about the\n // last edit no longer applies.\n changed: () => void;\n // A command was refused, and why.\n refused: (text: string) => void;\n}\n\n// Live values inside a text block's editor.\n//\n// Stored html carries a value as a {{value.key}} token. While editing, each\n// token is a chip: one character to the cursor, labeled with the value, and\n// reporting a click. Froala's html.get hands back tokens again, so the draft\n// and the saved html never hold a chip.\n//\n// A chip can't be deleted by editing: Backspace or Delete beside it, and any\n// deleting, typing over, cutting, pasting over or dragging of a selection that\n// holds one, is stopped and reported. It is taken out on purpose by selecting\n// it and pressing Delete, then taking the stopped selection's\n// removeSelection(); a value that was deleted leaves through removeKey().\n//\n// A table is the exception: deleting a row, a column or the table, or\n// emptying several selected cells, goes through with the chips in it, and is\n// reported as removed() when it took a value's last chip, with the undo that\n// brings them back.\nexport class ValueEmbedPlugin extends Plugin {\n\n // The base class's config, typed for this plugin.\n public declare config: ValueEmbedPluginConfig;\n\n // The editor this plugin serves; null until it is built, and after it is gone.\n private _editor: any = null;\n // Set while a deliberate removal runs, so the guards let it through.\n private _removing = false;\n // Listeners on the editable element, captured so each runs before Froala's\n // own handler for the same event.\n private _domListeners: [string, EventListener][] = [];\n // The page the paste under way was copied on ('' when not from a block).\n private _pasteScope = '';\n // How many chips each key had as the command under way started; null for\n // one that removes nothing of its own (undo, redo).\n private _before: Map<string, number> | null = null;\n\n constructor(config: ValueEmbedPluginConfig) {\n super();\n this.config = config;\n }\n\n public initialize(): void {\n if (!this.config.host().contains(this.editor.el)) {\n return;\n }\n\n const editor = this.editor;\n const el: HTMLElement = editor.el;\n this._editor = editor;\n\n editor.events.on('html.set', () => this._toChips());\n editor.events.on('paste.after', () => this._toChips(true));\n this._watchCommands(editor);\n editor.events.on('html.get', (html: string) => this._toTokens(html));\n // First in Froala's chain, so its own Backspace handling never runs on a\n // stopped key.\n editor.events.on('keydown', (event: KeyboardEvent) => this._onKeydown(event), true);\n editor.events.on('paste.before', (event: ClipboardEvent) => {\n this._pasteScope = event?.clipboardData?.getData(SCOPE_TYPE) ?? '';\n\n return this._guardSelection(event);\n });\n // A press on a chip opens its popover; Froala's floating toolbar, which\n // pops up on any press in the text and sits above every overlay, stays\n // away for it.\n editor.events.on('toolbar.show', (event?: Event) => (this._onChip(event) ? false : undefined), true);\n // Only while it is still this editor: reopening a block builds the next\n // one before the last is torn down.\n editor.events.on('destroy', () => {\n if (this._editor === editor) {\n this.destroy();\n }\n });\n\n this._domListeners = [\n ['beforeinput', (event) => this._onBeforeInput(event as InputEvent)],\n ['cut', (event) => this._guardSelection(event)],\n ['dragstart', (event) => this._guardSelection(event)],\n ['copy', (event) => this._onCopy(event as ClipboardEvent)],\n ['click', (event) => this._onClick(event as MouseEvent)],\n ];\n this._domListeners.forEach(([name, listener]) => el.addEventListener(name, listener, true));\n\n this._toChips();\n }\n\n public destroy(): void {\n const el: HTMLElement | undefined = this._editor?.el;\n this._domListeners.forEach(([name, listener]) => el?.removeEventListener(name, listener, true));\n this._domListeners = [];\n this._editor = null;\n }\n\n // Relabel every chip: the values arrived or changed, or names were toggled.\n public refresh(): void {\n this._chips().forEach((chip) => this._label(chip));\n }\n\n // Put Froala's floating toolbar and a table's popup away, when either is\n // already up as a chip's popover opens: they sit above every overlay.\n public hideToolbar(): void {\n this._editor?.toolbar.hide();\n this._editor?.popups.hide('table.edit');\n }\n\n // The editor's own undo of the last step: what puts back the chips an edit\n // took out.\n public undo(): void {\n this._editor?.commands.undo();\n }\n\n // Take a value out of the text, wherever it appears — it was deleted.\n public removeKey(key: string): void {\n this._chips()\n .filter((chip) => chip.getAttribute(KEY_ATTRIBUTE) === key)\n .forEach((chip) => this.remove(chip));\n }\n\n // Take one chip out of the text.\n public remove(chip: HTMLElement): void {\n if (!this._editor?.el.contains(chip)) {\n return;\n }\n\n // The cursor goes back where the chip was — whatever asked for the\n // removal (a dialog, a popover) took the focus, and without it an Undo\n // straight after would never reach the editor.\n const caret = document.createRange();\n caret.setStartBefore(chip);\n caret.collapse(true);\n\n this._editor.undo.saveStep();\n chip.remove();\n this._editor.el.focus();\n const selection = this._selection();\n selection.removeAllRanges();\n selection.addRange(caret);\n this._changed();\n }\n\n private _chips(): HTMLElement[] {\n return this._editor\n ? Array.from(this._editor.el.querySelectorAll(CHIP_SELECTOR))\n : [];\n }\n\n // How many chips each key has in the block.\n private _chipCounts(): Map<string, number> {\n const counts = new Map<string, number>();\n this._chips().forEach((chip) => {\n const key = chip.getAttribute(KEY_ATTRIBUTE);\n counts.set(key, (counts.get(key) ?? 0) + 1);\n });\n\n return counts;\n }\n\n // Tell the host when an edit took the last chip of some key out of the\n // block, given the counts from before it.\n private _reportRemoved(before: Map<string, number> | null): void {\n if (!before || !this._editor) {\n return;\n }\n\n const after = this._chipCounts();\n if ([...before.keys()].some((key) => !after.has(key))) {\n this.config.removed({\n before: [...before.keys()],\n after: [...after.keys()],\n undo: () => this.undo(),\n });\n }\n }\n\n // A toolbar command sees tokens, not chips: Clear formatting unwraps every\n // span, a chip included, which would leave a typed number behind. Around a\n // token it formats plain text, and the chip comes back inside whatever\n // formatting the token was given.\n private _watchCommands(editor: any): void {\n editor.events.on('commands.before', (command: string) => this._onCommandBefore(command));\n editor.events.on('commands.after', () => {\n this._toChips();\n this._reportRemoved(this._before);\n this._before = null;\n });\n // Undo and redo restore a step as Froala saved it: the one before a\n // command holds tokens, as the command saw them. Neither fires\n // commands.after: Froala's commands.undo() — Ctrl+Z, and undo() here —\n // runs the undo directly.\n editor.events.on('commands.undo', () => this._toChips());\n editor.events.on('commands.redo', () => this._toChips());\n }\n\n // Every command starts a new edit. One that would build what the server\n // rewrites is refused (returning false cancels it); any other runs on\n // tokens, its chip counts kept to see what it removed.\n private _onCommandBefore(command: string): false | void {\n this.config.changed();\n\n if (TABLE_INSERT_COMMANDS.includes(command) && this._caretIn(NO_TABLE_INSIDE)) {\n this.config.refused('A table goes between paragraphs, never inside a list or another table.');\n\n return false;\n }\n\n if (CELL_COMMANDS.includes(command) && this._caretIn(CELL)) {\n this.config.refused('A table cell holds words and values; a list or a heading goes outside the table.');\n\n return false;\n }\n\n this._before = HISTORY_COMMANDS.includes(command) ? null : this._chipCounts();\n this._toTokenText();\n }\n\n // Whether the caret sits inside an element of this editor that `selector`\n // matches.\n private _caretIn(selector: string): boolean {\n const container: Element | null = this._editor.selection.element()?.closest?.(selector) ?? null;\n\n return !!container && this._editor.el.contains(container);\n }\n\n // Turn every {{value.key}} token in the editor's text into a chip. For a\n // paste, a token only stays when it was copied on this page and the page has\n // the value; otherwise it goes, and just the text around it is pasted.\n private _toChips(pasted = false): void {\n const el: HTMLElement | undefined = this._editor?.el;\n if (!el) {\n return;\n }\n\n const walker = document.createTreeWalker(el, NodeFilter.SHOW_TEXT);\n const texts: Text[] = [];\n while (walker.nextNode()) {\n const text = walker.currentNode as Text;\n if (text.data.includes('{{') && !text.parentElement?.closest(CHIP_SELECTOR)) {\n texts.push(text);\n }\n }\n\n texts.forEach((text) => this._splitText(text, pasted));\n }\n\n private _keepsPasted(key: string): boolean {\n return this._pasteScope === this.config.scope() && !!this.config.values()[key];\n }\n\n private _splitText(text: Text, pasted: boolean): void {\n const matches = Array.from(text.data.matchAll(VALUE_TOKEN_PATTERN));\n if (!matches.length) {\n return;\n }\n\n // Only non-empty text around the chips, so a selection counted in child\n // nodes keeps its place.\n const fragment = document.createDocumentFragment();\n const appendText = (value: string) => {\n if (value) {\n fragment.append(value);\n }\n };\n let consumed = 0;\n matches.forEach((match) => {\n const key = match[1].toLowerCase();\n appendText(text.data.slice(consumed, match.index));\n if (!pasted || this._keepsPasted(key)) {\n fragment.append(this._createChip(key));\n }\n consumed = match.index + match[0].length;\n });\n appendText(text.data.slice(consumed));\n\n text.replaceWith(fragment);\n }\n\n // Every chip in the editor back to its token, as text.\n private _toTokenText(): void {\n this._chips().forEach((chip) => chip.replaceWith(valueToken(chip.getAttribute(KEY_ATTRIBUTE))));\n }\n\n private _createChip(key: string): HTMLElement {\n const chip = document.createElement('span');\n chip.setAttribute(TYPE_ATTRIBUTE, VALUE_TYPE);\n chip.setAttribute(KEY_ATTRIBUTE, key);\n chip.setAttribute('contenteditable', 'false');\n this._label(chip);\n\n return chip;\n }\n\n // A chip reads as the value does in the viewed block — its number, the\n // ellipsis while that loads, else the em dash — so opening the editor moves\n // no word; or as its name, when names are toggled on. A key with no value on\n // the page reads as the key itself, marked missing.\n private _label(chip: HTMLElement): void {\n const key = chip.getAttribute(KEY_ATTRIBUTE);\n const value = this.config.values()[key];\n\n chip.textContent = !value\n ? key\n : this.config.showNames() ? value.name : valueText(value);\n chip.title = value?.name ?? key;\n chip.toggleAttribute(MISSING_ATTRIBUTE, !value);\n }\n\n // The html Froala hands out, with every chip back to its token.\n private _toTokens(html: string): string {\n if (!html.includes(KEY_ATTRIBUTE)) {\n return html;\n }\n\n const template = document.createElement('template');\n template.innerHTML = html;\n template.content.querySelectorAll(CHIP_SELECTOR).forEach((chip) => {\n chip.replaceWith(valueToken(chip.getAttribute(KEY_ATTRIBUTE)));\n });\n\n return template.innerHTML;\n }\n\n private _onKeydown(event: KeyboardEvent): boolean | void {\n // Any key but a lone modifier starts a new edit.\n if (!MODIFIER_KEYS.includes(event.key)) {\n this.config.changed();\n }\n\n const deleting = event.key === 'Backspace' || event.key === 'Delete';\n\n // Deleting across several selected cells goes through, values and all:\n // Froala saves an undo step and empties the cells, and what that took is\n // reported once they are empty.\n if (deleting && this._editor.el.querySelectorAll(SELECTED_CELL).length > 1) {\n const before = this._chipCounts();\n setTimeout(() => this._reportRemoved(before));\n\n return undefined;\n }\n\n const range = this._range();\n if (!range) {\n return;\n }\n\n if (range.collapsed) {\n if (!deleting) {\n return;\n }\n\n const chip = this._adjacentChip(event.key === 'Backspace', this._granularity(event));\n\n return chip ? this._block(event, [chip], null) : undefined;\n }\n\n // A selection is replaced by a deleting key, Enter, a typed character or\n // a cut.\n const typing = event.key.length === 1 && !event.ctrlKey && !event.metaKey;\n const cutting = (event.ctrlKey || event.metaKey) && event.key.toLowerCase() === 'x';\n if (!deleting && !typing && !cutting && event.key !== 'Enter') {\n return;\n }\n\n const chips = this._chipsIn(range);\n\n return chips.length ? this._block(event, chips, range) : undefined;\n }\n\n // The same rule for edits that arrive without a key Froala sees: a phone\n // keyboard, an input method, a spell-check replacement.\n private _onBeforeInput(event: InputEvent): void {\n const range = this._range();\n if (this._removing || !range) {\n return;\n }\n\n if (range.collapsed) {\n const backward = event.inputType.endsWith('Backward');\n if (event.inputType.startsWith('delete')) {\n const chip = this._adjacentChip(backward, event.inputType.includes('Word') ? 'word' : 'character');\n if (chip) {\n this._block(event, [chip], null);\n }\n }\n\n return;\n }\n\n const chips = this._chipsIn(range);\n if (chips.length) {\n this._block(event, chips, range);\n }\n }\n\n // Cut, drag and paste-over: stopped when the selection holds a value.\n private _guardSelection(event: Event): boolean | void {\n const range = this._range();\n if (this._removing || !range || range.collapsed) {\n return;\n }\n\n const chips = this._chipsIn(range);\n\n return chips.length ? this._block(event, chips, range) : undefined;\n }\n\n // Copying a value copies its token, and the page it was copied on, so\n // pasting it back on this page — in this block or another — makes it a chip\n // again.\n private _onCopy(event: ClipboardEvent): void {\n const range = this._range();\n if (!range || range.collapsed || !this._chipsIn(range).length) {\n return;\n }\n\n const holder = document.createElement('div');\n holder.append(range.cloneContents());\n holder.querySelectorAll(CHIP_SELECTOR).forEach((chip) => {\n chip.replaceWith(valueToken(chip.getAttribute(KEY_ATTRIBUTE)));\n });\n\n event.clipboardData.setData('text/plain', this._plainText(holder));\n event.clipboardData.setData('text/html', holder.innerHTML);\n event.clipboardData.setData(SCOPE_TYPE, this.config.scope());\n event.preventDefault();\n }\n\n // What copied html reads as in plain text: a paragraph on its own lines, a\n // table's cells tab-separated and its rows on lines of their own. That is\n // the browser's innerText, which only text laid out on the page has — so\n // the holder is put offscreen (not hidden: hidden text has none) while it is\n // read.\n private _plainText(holder: HTMLElement): string {\n holder.style.cssText = 'position: fixed; left: -10000px; top: 0';\n document.body.append(holder);\n const text = holder.innerText;\n holder.remove();\n\n return text;\n }\n\n private _onClick(event: MouseEvent): void {\n const chip = (event.target as Element)?.closest?.(CHIP_SELECTOR) as HTMLElement | null;\n if (!chip || !this._editor?.el.contains(chip)) {\n return;\n }\n\n event.preventDefault();\n // A press in a table cell can open the table's popup on mouseup, just\n // before this click; a chip in a cell shows only its own popover.\n this._editor.popups.hide('table.edit');\n this.config.click(chip.getAttribute(KEY_ATTRIBUTE), chip);\n }\n\n private _onChip(event?: Event): boolean {\n return !!(event?.target as Element | undefined)?.closest?.(CHIP_SELECTOR);\n }\n\n private _block(event: Event, chips: HTMLElement[], range: Range | null): false {\n event.preventDefault();\n event.stopPropagation();\n chips.forEach((chip) => chip.animate(FLASH, FLASH_MS));\n\n this.config.blocked({\n count: chips.length,\n ...(range ? { removeSelection: () => this._removeRange(range) } : {}),\n });\n\n return false;\n }\n\n private _removeRange(range: Range): void {\n if (!this._editor) {\n return;\n }\n\n const selection = this._selection();\n this._editor.el.focus();\n selection.removeAllRanges();\n selection.addRange(range);\n\n this._editor.undo.saveStep();\n this._removing = true;\n // The browser's own delete, so two paragraphs a selection spans join the\n // way they would for a plain Delete.\n document.execCommand('delete');\n this._removing = false;\n this._changed();\n }\n\n // An edit made here rather than typed: record it for undo, and tell\n // html-editor so the draft follows.\n private _changed(): void {\n this._editor.undo.saveStep();\n this._editor.events.trigger('contentChanged');\n }\n\n private _selection(): Selection {\n return this._editor.el.ownerDocument.getSelection();\n }\n\n // The selection, when it is inside this editor.\n private _range(): Range | null {\n const selection = this._editor ? this._selection() : null;\n if (!selection?.rangeCount) {\n return null;\n }\n\n const range = selection.getRangeAt(0);\n\n return this._editor.el.contains(range.commonAncestorContainer) ? range : null;\n }\n\n private _chipsIn(range: Range): HTMLElement[] {\n return this._chips().filter((chip) => range.intersectsNode(chip));\n }\n\n // The chip a collapsed cursor would delete into: stretch the selection by\n // what the key deletes, see what it covers, and put it back. Letting the\n // browser stretch it handles every shape the html takes — a chip inside a\n // bold span, at a line's end, beside an empty text node.\n private _adjacentChip(backward: boolean, granularity: string): HTMLElement | null {\n const selection = this._selection();\n const range = selection.getRangeAt(0).cloneRange();\n\n selection.modify('extend', backward ? 'backward' : 'forward', granularity);\n const chip = selection.rangeCount\n ? this._chipsIn(selection.getRangeAt(0))[0] ?? null\n : null;\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n return chip;\n }\n\n // How far a deleting key reaches: a word with Ctrl/Alt, to the line's start\n // with Cmd on a Mac, one character otherwise.\n private _granularity(event: KeyboardEvent): string {\n if (event.metaKey) {\n return 'lineboundary';\n }\n\n return event.ctrlKey || event.altKey ? 'word' : 'character';\n }\n}\n","import {\n ChangeDetectionStrategy, Component, DestroyRef, ElementRef, computed, effect, inject, input, output, signal,\n untracked, viewChild,\n} from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { MatButton, MatIconButton } from '@angular/material/button';\nimport { MatIcon } from '@angular/material/icon';\nimport { MatTooltip } from '@angular/material/tooltip';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\n\nimport { FsHtmlEditorComponent, FsHtmlEditorConfig } from '@firestitch/html-editor';\nimport { FsPopoverDirective, FsPopoverRef } from '@firestitch/popover';\n\nimport {\n DEFAULT_TEXT_COLOR, DEFAULT_TEXT_SIZE, HEADING_TEXT_SIZES, TEXT_TABLE_BORDER_COLOR, TEXT_TABLE_BORDER_WIDTH,\n TEXT_TABLE_CELL_PADDING, TEXT_TABLE_MARGIN, TextTokenContext, TextValue, fillTextTokens,\n} from '../../text';\nimport { NO_VALUE_KEYS, readKeys } from '../../values';\n\nimport {\n VALUE_EMBED_ATTRIBUTES, ValueEmbedBlock, ValueEmbedPlugin, ValueEmbedRemoval,\n} from './value-embed.plugin';\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. A table keeps its rows, cells and spans, and a cell its\n// alignment, fill and width; its borders and padding are never stored, so\n// every renderer draws the one grid in text.ts (TEXT_TABLE_*).\nconst ALLOWED_TAGS = [\n 'p', 'h1', 'h2', 'h3', 'br', 'strong', 'em', 'u', 's', 'span', 'a', 'ul', 'ol', 'li',\n 'table', 'thead', 'tbody', 'tfoot', 'tr', 'th', 'td',\n];\nconst ALLOWED_STYLES = [\n 'color', 'background-color', 'font-size', 'font-weight', 'font-style', 'text-decoration', 'font-family', 'text-align',\n 'vertical-align', 'width',\n];\n\n// With useClasses: false, Froala's html.get copies every stylesheet declaration\n// that matches an element into its inline style, then lays the element's own\n// inline style back over it. So an ignored property never loses what the user\n// set; it only keeps the canvas's, Froala's and the host app's css out of the\n// saved html. Listed: every property the server keeps and the shorthands that\n// set one (otherwise Froala's grey header fill would be saved as the user's),\n// then everything else those stylesheets set on a block's elements, so a block\n// opened and closed untouched saves nothing new. Names match exactly, so a\n// rule's longhands are listed too: the browser spells Froala's table\n// `border: none` as border-width/-style/-color/-image, and the host app's\n// headings set margin-top and margin-bottom. Froala also outlines a table the\n// pointer is over, with a class that is still on it when the html is read.\nconst IGNORED_SHEET_STYLES = [\n 'color', 'background', 'background-color', 'font', 'font-family', 'font-size', 'font-style', 'font-weight',\n 'text-decoration', 'text-align', 'vertical-align', 'width',\n 'height', 'min-width', 'max-width', 'margin', 'margin-top', 'margin-bottom', 'padding', 'padding-left',\n 'border', 'border-width', 'border-style', 'border-color', 'border-image', 'border-collapse', 'empty-cells',\n 'outline', 'position', 'display', 'list-style', 'line-height', 'user-select',\n];\n\n// Froala's own toolbars and popups live on the body, not in the block, and so\n// does a value chip's popover (an overlay); a press on any of them is still part\n// of editing the block.\nconst EDITOR_CHROME = '.fr-toolbar, .fr-popup, .fr-dropdown-menu, .fr-modal, .fr-tooltip, .cdk-overlay-container';\n\n// The toolbar toggle between a chip's number and its name.\nconst VALUE_NAMES_BUTTON = 'valueNames';\n\n// How long a notice under the open block stays up.\nconst VALUE_BLOCK_NOTICE_MS = 6000;\n\n// What the notice under the open block says, one at a time: an edit was\n// stopped because it would have removed values; an edit left values that no\n// text reads any more, with the undo that puts them back; or a command was\n// refused.\ntype TextNotice =\n | { kind: 'blocked'; block: ValueEmbedBlock }\n | { kind: 'unused'; count: number; undo: () => void }\n | { kind: 'message'; text: string };\n\n// A clicked value chip's popover is an fs-popover, which attaches to an element\n// of this component's own template — the chip belongs to the editor. So it\n// opens from an invisible anchor laid over the chip, in the block's own\n// (unscaled) pixels.\ninterface ValuePopoverAnchor {\n key: string;\n chip: HTMLElement;\n left: number;\n top: number;\n width: number;\n height: number;\n}\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. The\n// exception is a live value ({{value.key}}): it edits as a chip, which no stray\n// keystroke removes; selecting it and pressing Delete offers to take it out\n// (ValueEmbedPlugin). Deleting a table's rows, columns or cells does take the\n// chips in them, and a notice under the block counts the values that leaves\n// unused, with an Undo.\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 MatButton,\n MatIconButton,\n MatIcon,\n MatTooltip,\n FsHtmlEditorComponent,\n FsPopoverDirective,\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 // A table's grid comes from them the same way.\n '[style.--text-table-border]': 'tableLook.border',\n '[style.--text-table-padding]': 'tableLook.padding',\n '[style.--text-table-margin]': 'tableLook.margin',\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 value keys the other text blocks of this block's layer show. Asked\n // for when an edit takes the last chip of a value out of this block, as a\n // value another block still shows is not left unused; a function, as a\n // saved block's html changes without any input changing.\n public readonly shownElsewhere = input<() => ReadonlySet<string>>(() => NO_VALUE_KEYS);\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 // A value's settings were asked for from its popover, by the value's key.\n // The host opens the value's settings dialog, where it can also be deleted\n // (then removeValue()).\n public readonly valueSettings = output<string>();\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 tableLook = {\n border: `${TEXT_TABLE_BORDER_WIDTH}pt solid ${TEXT_TABLE_BORDER_COLOR}`,\n padding: `${TEXT_TABLE_CELL_PADDING.vertical}pt ${TEXT_TABLE_CELL_PADDING.horizontal}pt`,\n margin: `${TEXT_TABLE_MARGIN}pt`,\n };\n\n // Chips label values with their names instead of their numbers.\n public readonly showValueNames = signal(false);\n\n // The notice under the open block. A new one replaces it.\n public readonly notice = signal<TextNotice | null>(null);\n\n // The chip whose popover was opened last, and what the popover says about it.\n public readonly valuePopover = signal<ValuePopoverAnchor | null>(null);\n public readonly valuePopoverValue = computed<TextValue | null>(() => {\n const key = this.valuePopover()?.key;\n\n return key ? this.tokens().values?.[key] ?? null : null;\n });\n\n public readonly valueEmbeds = new ValueEmbedPlugin({\n name: 'reportValueEmbeds',\n host: () => this._host.nativeElement,\n values: () => this.tokens().values ?? {},\n scope: () => String(this.tokens().valuePageId ?? ''),\n showNames: () => this.showValueNames(),\n click: (key, chip) => this._openValuePopover(key, chip),\n blocked: (block) => this._showNotice({ kind: 'blocked', block }),\n removed: (removal) => this._onValuesRemoved(removal),\n changed: () => this.dismissNotice(),\n refused: (text) => this._showNotice({ kind: 'message', text }),\n });\n\n public readonly editorConfig: FsHtmlEditorConfig = {\n floating: true,\n autofocus: true,\n placeholder: 'Type here',\n plugins: [this.valueEmbeds],\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 name: VALUE_NAMES_BUTTON,\n title: 'Show value names',\n svgKey: 'textMore',\n click: () => this.showValueNames.update((names) => !names),\n },\n ],\n froalaConfig: {\n toolbarButtons: [\n 'paragraphFormat', 'fontSize', '|',\n 'bold', 'italic', 'underline', 'strikeThrough', 'textColor', '|',\n 'align', 'formatUL', 'formatOL', 'insertTable', '|',\n 'insertLink', 'insertField', VALUE_NAMES_BUTTON, 'clearFormatting',\n ],\n // A table's popup offers only what the server keeps: no table or cell\n // styles (classes) and no footer row.\n tableEditButtons: [\n 'tableHeader', 'tableRemove', 'tableRows', 'tableColumns', '-',\n 'tableCells', 'tableCellBackground', 'tableCellVerticalAlign', 'tableCellHorizontalAlign',\n ],\n tableDefaultWidth: '100%',\n // Both are positioned in screen space inside the canvas's CSS scale, so\n // they land off the table; rows and columns are added from the table's\n // popup instead.\n tableResizer: false,\n tableInsertHelper: false,\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', 'colspan', 'rowspan', ...VALUE_EMBED_ATTRIBUTES],\n htmlAllowedStyleProps: ALLOWED_STYLES,\n htmlIgnoreCSSProperties: IGNORED_SHEET_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 // A paste is its words only: a pasted table flattens to text.\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 _valuePopoverAnchor = viewChild('valuePopoverAnchor', { read: ElementRef });\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 private _noticeTimer: ReturnType<typeof setTimeout> | null = null;\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 // Chips follow the page's values and the names toggle.\n effect(() => {\n this.tokens();\n this.showValueNames();\n untracked(() => this.valueEmbeds.refresh());\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(() => {\n document.removeEventListener('pointerdown', onPress, true);\n this._clearNoticeTimer();\n });\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 // Take a value out of the text: its settings dialog deleted it.\n public removeValue(key: string): void {\n this.valueEmbeds.removeKey(key);\n }\n\n // Only for a value the page has: a chip naming no value there has no\n // settings to open.\n public openValueSettings(popover: FsPopoverRef): void {\n popover.close();\n const key = this.valuePopover()?.key;\n if (key && this.tokens().values?.[key]) {\n this.valueSettings.emit(key);\n }\n }\n\n public removeBlockedSelection(): void {\n const notice = this.notice();\n if (notice?.kind === 'blocked') {\n notice.block.removeSelection?.();\n }\n this.dismissNotice();\n }\n\n // Put back the values an edit left unused: the editor's own undo of it.\n public undoValuesUnused(): void {\n const notice = this.notice();\n if (notice?.kind === 'unused') {\n notice.undo();\n }\n this.dismissNotice();\n }\n\n public dismissNotice(): void {\n this._clearNoticeTimer();\n this.notice.set(null);\n }\n\n private _openValuePopover(key: string, chip: HTMLElement): void {\n const host = this._host.nativeElement;\n const hostRect = host.getBoundingClientRect();\n const chipRect = chip.getBoundingClientRect();\n // The canvas is CSS-scaled; the anchor sits in the block's own pixels.\n const scale = host.offsetWidth ? hostRect.width / host.offsetWidth : 1;\n\n this.valueEmbeds.hideToolbar();\n this.valuePopover.set({\n key,\n chip,\n left: (chipRect.left - hostRect.left) / scale,\n top: (chipRect.top - hostRect.top) / scale,\n width: chipRect.width / scale,\n height: chipRect.height / scale,\n });\n\n // fs-popover opens on a click on its element: once the anchor has moved\n // over the chip, click it.\n setTimeout(() => this._valuePopoverAnchor()?.nativeElement.click());\n }\n\n private _showNotice(notice: TextNotice): void {\n this._clearNoticeTimer();\n this.notice.set(notice);\n this._noticeTimer = setTimeout(() => this.notice.set(null), VALUE_BLOCK_NOTICE_MS);\n }\n\n private _clearNoticeTimer(): void {\n if (this._noticeTimer) {\n clearTimeout(this._noticeTimer);\n this._noticeTimer = null;\n }\n }\n\n // An edit took the last chip of some values out of this block. Counted are\n // the values the layer no longer reads: shown by no block, this one or\n // another, nor read by a formula one of them shows. They are not deleted:\n // saving html never deletes a value.\n private _onValuesRemoved(removal: ValueEmbedRemoval): void {\n const elsewhere = [...this.shownElsewhere()()];\n const values = this.tokens().values ?? {};\n const before = readKeys([...removal.before, ...elsewhere], values);\n const after = readKeys([...removal.after, ...elsewhere], values);\n const count = [...before].filter((key) => !after.has(key) && !!values[key]).length;\n\n if (count > 0) {\n this._showNotice({ kind: 'unused', count, undo: removal.undo });\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 this.dismissNotice();\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\n <!-- One notice at a time: an edit stopped because it would have removed\n values, an edit that left values no text reads, or a refused command.\n mousedown keeps the editor's focus and selection, so Undo reaches it. -->\n @if (notice(); as current) {\n <div\n class=\"value-notice fs-row.gap-sm\"\n (pointerdown)=\"$event.stopPropagation()\"\n (mousedown)=\"$event.preventDefault()\">\n @switch (current.kind) {\n @case ('blocked') {\n @if (current.block.removeSelection) {\n <span>\n This selection includes {{ current.block.count }} {{ current.block.count === 1 ? 'value' : 'values' }}.\n </span>\n <button\n mat-button\n color=\"primary\"\n type=\"button\"\n (click)=\"removeBlockedSelection()\">\n Remove text and {{ current.block.count === 1 ? 'value' : current.block.count + ' values' }}\n </button>\n } @else {\n <span>To take a value out, select it, then press Delete.</span>\n }\n }\n @case ('unused') {\n <span>{{ current.count }} {{ current.count === 1 ? 'value' : 'values' }} moved to Not used</span>\n <button\n mat-button\n color=\"primary\"\n type=\"button\"\n (click)=\"undoValuesUnused()\">\n Undo\n </button>\n }\n @case ('message') {\n <span>{{ current.text }}</span>\n }\n }\n <button\n mat-button\n type=\"button\"\n (click)=\"dismissNotice()\">\n Dismiss\n </button>\n </div>\n }\n} @else {\n <div\n class=\"text-content\"\n [innerHTML]=\"displayHtml()\">\n </div>\n}\n\n<!-- A clicked value chip's popover: an fs-popover on an invisible anchor laid\n over the chip (the chip itself belongs to the editor). Outside the editing\n block, so a popover still open when editing ends closes the usual way. -->\n<span\n #valuePopoverAnchor\n class=\"value-popover-anchor\"\n aria-hidden=\"true\"\n fsPopover\n trigger=\"click\"\n wrapperClass=\"value-popover-wrapper\"\n [template]=\"valuePopoverTemplate\"\n [indication]=\"false\"\n [maxWidth]=\"320\"\n [style.left.px]=\"valuePopover()?.left\"\n [style.top.px]=\"valuePopover()?.top\"\n [style.width.px]=\"valuePopover()?.width\"\n [style.height.px]=\"valuePopover()?.height\">\n</span>\n<ng-template\n #valuePopoverTemplate\n let-popover=\"popover\">\n <!-- What the value is, and its settings (where it can also be deleted); a\n chip naming no value on the page has no settings. -->\n <div class=\"value-popover fs-row\">\n <div class=\"fs-flex\">\n <div class=\"value-popover-name\">{{ valuePopoverValue()?.name ?? valuePopover()?.key }}</div>\n @if (!valuePopoverValue()) {\n <div class=\"small\">Not a value on this page</div>\n }\n </div>\n @if (valuePopoverValue()) {\n <button\n mat-icon-button\n type=\"button\"\n class=\"value-popover-settings\"\n matTooltip=\"Settings\"\n (click)=\"openValueSettings(popover)\">\n <mat-icon>settings</mat-icon>\n </button>\n }\n </div>\n</ng-template>\n","import {\n ChangeDetectionStrategy, Component, DestroyRef, ElementRef,\n EventEmitter, HostBinding, Input, NgZone, OnChanges, OnInit, Output, SimpleChanges, ViewChild, inject,\n input, output, signal, viewChild,\n} from '@angular/core';\n\n\nimport { MatIconButton } from '@angular/material/button';\nimport { MatDialog } from '@angular/material/dialog';\nimport { MatIcon } from '@angular/material/icon';\nimport { MatTooltip } from '@angular/material/tooltip';\n\nimport { FilterConfig, FsFilterModule } from '@firestitch/filter';\nimport { FsMenuModule } from '@firestitch/menu';\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 { ListColumnsComponent, ListColumnsDialogData } from '../../dialogs/list-columns/list-columns.component';\nimport {\n ComponentData,\n ComponentDataState,\n ComponentSettings,\n KpiConfig,\n ReportComponent as ReportComponentModel,\n ReportFilterGroup,\n} from '../../interfaces/report.interface';\nimport { kpiCardSettings, sameKpiCardSettings } from '../../kpi-card';\nimport { componentPaddingCss } from '../../layout';\nimport { listHideableColumns } from '../../list-config';\nimport {\n LIST_SEARCH_ITEM, filterItemForGroup, groupValuesFromQuery, listSearchItem,\n} from '../../report-filter-items';\nimport { movedGroupValues, 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 { NO_VALUE_KEYS, isDrawn, valueKeys } from '../../values';\nimport { CanvasSnapper, PX_PER_INCH } from '../report-canvas/report-canvas.component';\n\n\n// Resize handles, named by compass direction.\nconst HANDLES = ['nw', 'n', 'ne', 'e', 'se', 's', 'sw', 'w'] as const;\ntype Handle = typeof HANDLES[number];\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: 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// 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 MatTooltip,\n FsFilterModule,\n FsMenuModule,\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 // 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 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 // The value keys the other text blocks of a text's layer show, read by the\n // canvas when the text's editor asks.\n public readonly valueKeysElsewhere = input<((text: ReportComponentModel) => ReadonlySet<string>) | null>(null);\n\n // A text block was deleted from its menu — the canvas drops it.\n public readonly removed = output<number>();\n\n // A value's settings were asked for from its chip in the text, by the\n // value's key. The canvas opens them.\n public readonly valueSettings = output<string>();\n\n // The text's html was saved. Emitted on the response, so the server already\n // holds the html when the canvas reads the values it shows.\n public readonly textSaved = output<string>();\n\n // Deleting the text also deleted the values no other text on its page reads,\n // by id. The canvas has the report reloaded.\n public readonly valuesRemoved = 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 // A text block's html as last saved here; null until then, so the block\n // shows its stored html.\n public readonly textHtml = signal<string | null>(null);\n\n // What the other text blocks of this text's layer show, for its editor's\n // notice. Stable, so the text block's input never changes; it asks when an\n // edit takes a value's last chip out.\n public readonly shownElsewhere = (): ReadonlySet<string> =>\n this.valueKeysElsewhere()?.(this.component) ?? NO_VALUE_KEYS;\n\n @ViewChild(ComponentChartComponent)\n public chartComponent: ComponentChartComponent;\n\n // 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, plus a list's search box. 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 readonly _text = viewChild(ComponentTextComponent);\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 _dialog = inject(MatDialog);\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, and a value is\n // never drawn (it reads inside text).\n if (this.component.type !== 'list' && !this.isText && isDrawn(this.component)) {\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 // A new component object carries its own stored html.\n if (changes.component && !changes.component.firstChange) {\n this.textHtml.set(null);\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 // Take a deleted value's chips out of the text's open editor.\n public removeValue(key: string): void {\n this._text()?.removeValue(key);\n }\n\n // The editor closed with changed html. Kept locally at once so the block\n // re-renders what was typed, then replaced by what the server stored: it\n // rebuilds the html from its allowlist and drops any value token its page has\n // no value for, so the block never holds a token the server doesn't.\n public onTextSaved(html: string): void {\n this._setTextHtml(html);\n this._reportData.updateComponent(this.reportId, this.component.id, { html })\n .pipe(\n map((response) => (typeof response?.config?.html === 'string' ? response.config.html as string : html)),\n tap((stored) => {\n this._setTextHtml(stored);\n this.textSaved.emit(stored);\n }),\n takeUntilDestroyed(this._destroyRef),\n )\n .subscribe();\n }\n\n // The server deletes the text and then every value on its page that no other\n // text shows, and answers with their ids.\n public deleteText(): void {\n const valuesNote = valueKeys(this.component.config?.html).length\n ? ' Values no other text on this page uses are deleted with it.'\n : '';\n\n this._prompt.confirm({\n title: 'Confirm',\n template: `Are you sure you would like to delete this text?${valuesNote}`,\n })\n .pipe(\n switchMap(() => this._reportData.deleteComponent(this.reportId, this.component.id)),\n tap((response: { removedValues?: number[] }) => {\n if (response?.removedValues?.length) {\n this.valuesRemoved.emit(response.removedValues);\n }\n this.removed.emit(this.component.id);\n }),\n takeUntilDestroyed(this._destroyRef),\n )\n .subscribe();\n }\n\n public get truncated(): boolean {\n return !!this.data()?.truncated;\n }\n\n // Content padding (the canvas zoom scales the page as a whole). Each edge\n // defaults to 1/8\".\n public get bodyPadding(): string {\n return componentPaddingCss(this.component);\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 // Whether the menu offers Columns: a plain list with more than one\n // configured column. A cross-tab's columns come and go with the data.\n public get hidesColumns(): boolean {\n return this.component.type === 'list' && listHideableColumns(this.component.config).length > 1;\n }\n\n // Which of a plain list's columns show. The choice is the viewer's (kept in\n // the URL, never saved to the report), and the list hides the columns in\n // place, with no refetch.\n public chooseColumns(): void {\n const columns = (this.component.config?.columns ?? [])\n .map((column) => ({ column: column.column, label: column.label || column.column }));\n\n this._dialog.open<ListColumnsComponent, ListColumnsDialogData, string[]>(ListColumnsComponent, {\n data: { columns, hidden: [...this._filterState.hiddenColumns(this.component.id)] },\n width: '400px',\n maxWidth: '95vw',\n autoFocus: false,\n })\n .afterClosed()\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe((hidden) => {\n // Cancel closes with nothing, which changes nothing.\n if (hidden) {\n this._filterState.setHiddenColumns(this.component.id, hidden);\n }\n });\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. A KPI's card\n // keys are different: settings.kpi carries the keys the server saved (never\n // the ones the dialog sent), and the server sends the target's progress and\n // the sparkline's points with the data, so a change to them reloads it.\n public applySettings(settings: ComponentSettings): void {\n const cardChanged = !!settings.kpi\n && !sameKpiCardSettings(settings.kpi, kpiCardSettings(this.component.config as KpiConfig));\n\n this.component.title = settings.title;\n this.component.config = { ...this.component.config, padding: settings.padding, ...(settings.kpi ?? {}) };\n\n this._buildFilterConfig();\n\n if (cardChanged) {\n this._refresh$.next();\n }\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, search and hidden columns for a list. A note the\n // server returns (the file was cut) is shown before the download starts, so a\n // short file never passes for 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 isList = this.component.type === 'list';\n const sort = isList ? this._filterState.listSort(this.component.id) : null;\n if (sort) {\n state.sort = sort;\n }\n\n // A searched list exports only the rows the search leaves, as on screen.\n const search = isList ? this._filterState.listSearch(this.component.id) : null;\n if (search) {\n state.search = search;\n }\n\n // The columns the viewer hid stay out of the file, as off the screen.\n const hiddenColumns = isList ? this._filterState.hiddenColumns(this.component.id) : [];\n if (hiddenColumns.length) {\n state.hiddenColumns = [...hiddenColumns];\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 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 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 //\n // A list also gets a search box over its text columns, unless its header\n // shows a keyword group (ReportFilterStateService.listSearchable, which also\n // drops a search kept from before such a group appeared).\n //\n // `reported` is what this header last reported for each of its groups,\n // starting from the values it is built with. A change sets only the groups\n // whose header value moved (movedGroupValues): fs-filter reports every item\n // on any change, and a group shown in the report bar too may have changed\n // there since, without this header being repainted.\n private _setTextHtml(html: string): void {\n this.component.config = { ...this.component.config, html };\n this.textHtml.set(html);\n }\n\n private _buildFilterConfig(): void {\n const groups = this.componentFilterGroups;\n const listSearch = this._filterState.listSearchable(this.component);\n const reported = new Map(groups.map((group) => [group.id, this._filterState.value(group.id) ?? null]));\n\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: [\n ...groups.map((group) =>\n filterItemForGroup(group, this._reportData, this.reportId, this._filterState.value(group.id))),\n ...(listSearch ? [listSearchItem(this._filterState.listSearch(this.component.id))] : []),\n ],\n // Typing in the search box must not refetch through the groups, nor set\n // a stale group value back, and a group change must not refetch through\n // the search.\n change: (query) => {\n const values = groupValuesFromQuery(query ?? {}, this.componentFilterGroups);\n\n for (const { groupId, value } of movedGroupValues(reported, values)) {\n this._filterState.setValue(groupId, value);\n }\n\n if (listSearch) {\n this._filterState.setListSearch(this.component.id, String(query?.[LIST_SEARCH_ITEM] ?? ''));\n }\n },\n });\n }\n\n private _origin = { x: 0, y: 0, w: 0, h: 0 };\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) => 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 };\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);\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 // 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 [fsMenuTriggerFor]=\"menu\"\n (pointerdown)=\"$event.stopPropagation()\"\n (mousedown)=\"stopCanvasPan($event)\">\n <mat-icon>more_vert</mat-icon>\n </button>\n <!-- Beside its trigger, inside the same block: an fs-menu that finds no\n trigger of its own draws one. -->\n <fs-menu #menu>\n <ng-template\n fs-menu-item\n [hidden]=\"!isText\"\n (click)=\"editText()\">\n <mat-icon>edit</mat-icon>\n <span>Edit text</span>\n </ng-template>\n <ng-template\n fs-menu-item\n [hidden]=\"!isText\"\n (click)=\"deleteText()\">\n <mat-icon>delete</mat-icon>\n <span>Delete</span>\n </ng-template>\n <ng-template\n fs-menu-item\n [hidden]=\"isText\"\n (click)=\"settings()\">\n <mat-icon>tune</mat-icon>\n <span>Settings</span>\n </ng-template>\n <ng-template\n fs-menu-item\n [hidden]=\"isText\"\n (click)=\"exportCsv()\">\n <mat-icon>download</mat-icon>\n <span>Export CSV</span>\n </ng-template>\n <ng-template\n fs-menu-item\n [hidden]=\"!hidesColumns\"\n (click)=\"chooseColumns()\">\n <mat-icon>view_column</mat-icon>\n <span>Columns</span>\n </ng-template>\n </fs-menu>\n }\n <div class=\"component-body\">\n @if (isText) {\n <app-report-component-text\n [html]=\"textHtml() ?? component.config?.html ?? ''\"\n [tokens]=\"tokens()\"\n [editing]=\"textEditing()\"\n [shownElsewhere]=\"shownElsewhere\"\n (saved)=\"onTextSaved($event)\"\n (editEnded)=\"textEditing.set(false)\"\n (valueSettings)=\"valueSettings.emit($event)\">\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 </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 @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}","import {\n AfterViewInit, ChangeDetectionStrategy, Component, DestroyRef,\n ElementRef, EventEmitter, Input, OnChanges, Output, QueryList, SimpleChanges, ViewChild, ViewChildren,\n WritableSignal, computed, inject, signal,\n} from '@angular/core';\nimport { takeUntilDestroyed, toObservable } 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 {\n Observable, Subject, catchError, debounceTime, map, merge, of, switchMap, tap,\n} from 'rxjs';\n\nimport { ReportData } from '../../data/report.data';\nimport {\n ComponentSettings, Report, ReportComponent, ReportFilterGroup, ReportHeaderFooter, ReportMaster, ReportPage,\n ReportPageValue, ResolvedFilterValue,\n} from '../../interfaces/report.interface';\nimport { DEFAULT_HEADING_SIZE } from '../../layout';\nimport { ReportFilterStateService } from '../../services/report-filter-state.service';\nimport { TextTokenContext } from '../../text';\nimport {\n isDrawn, layerValueKeys, sameTextValues, shownValues, textValues, valueKey, valueKeys,\n} from '../../values';\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// One layer's values request (a page, or the master), read when it is sent:\n// the layer, the values its text shows at that moment (what reads as loading\n// until it lands) and the filter values of every value on the layer.\ninterface LayerValuesRequest {\n pageId: number | null;\n shown: ReportComponent[];\n filters: ResolvedFilterValue[];\n // Everything the layer's numbers depend on: the request, and how each value\n // it reads is defined. A reload of the report that leaves it as it was asks\n // for nothing.\n signature: string;\n}\n\n// One layer's numbers as they last arrived, by value id, and the request they\n// answer — results for another page are not this page's.\ninterface LayerValues {\n pageId: number | null;\n signature: string;\n rows: ReadonlyMap<number, ReportPageValue>;\n}\n\n// A layer whose values the canvas reads: the active page, or the master.\ninterface ValueLayer {\n // The layer as it stands, or null when none of its numbers are needed.\n source: () => ReportPage | ReportMaster | null;\n // Asks for its numbers again.\n reload$: Subject<void>;\n // Its numbers as they last arrived.\n results: WritableSignal<LayerValues | null>;\n // The request on its way, null once it has landed. A value it asks for\n // reads as loading until then, so a number on screen is never one read for\n // an earlier request (another filter, the value as it was).\n pending: WritableSignal<LayerValuesRequest | null>;\n}\n\n// Whether two token contexts fill every token the same, so recomputing one\n// that changed nothing a token shows hands back the object the blocks have.\nfunction sameTokens(a: TextTokenContext, b: TextTokenContext): boolean {\n return a.pageNumber === b.pageNumber\n && a.pageName === b.pageName\n && a.reportName === b.reportName\n && a.valuePageId === b.valuePageId\n && sameTextValues(a.values, b.values);\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// Components are absolutely positioned; dragging gets smart alignment guides\n// (edges + centers of siblings and the page) with snapping.\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//\n// Live values: a text block shows numbers inline ({{value.key}}). A value is\n// never drawn; it belongs to the page whose text shows it (the master for a\n// header or footer) and is listed in that layer's `values`. The canvas reads\n// the numbers one request per layer — the active page's and the master's —\n// and hands them to every block of the layer with the page tokens. Which\n// values a request reads is the server's call alone: the ones the text shows,\n// and the operands of the formulas among them.\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\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 activePageId = computed(() => this.pages()[this.activePageIndex()]?.id ?? null);\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 components each layer draws. A value only reads inside text, so one\n // that leaked into a layer's components is still never drawn.\n public readonly activePageComponents = computed(\n () => (this.pages()[this.activePageIndex()]?.components ?? []).filter(isDrawn),\n );\n\n public readonly masterComponents = computed(\n () => (this._report()?.master?.components ?? []).filter(isDrawn),\n );\n\n // What a text block's tokens fill with on the page on screen: {{page.number}},\n // {{page.name}} and {{report.name}} (the master's footer numbers each page by\n // its position), and the values of the block's layer — the active page's for\n // a page block, the master's for a header or footer block, whose id is also\n // the editor's clipboard scope. The same object is handed back until\n // something a token shows changes: every text block takes it as an input,\n // and a fresh object would make each of them repaint its html.\n public readonly pageTokens = computed(\n () => this._tokenContext(this._pageValueComponents(), this._pageValues, this.activePageId()),\n { equal: sameTokens },\n );\n\n public readonly masterTokens = computed(\n () => this._tokenContext(this._masterValueComponents(), this._masterValues, this._report()?.master?.id ?? null),\n { equal: sameTokens },\n );\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 // The value keys the other text blocks of a text's layer show (the master's\n // for a header or footer block), for its editor's notice: a value another\n // block still shows is not left unused. Read when asked: saving a block\n // writes its html into its component in place, which no signal sees.\n // Stable, as the snapper is.\n public readonly valueKeysElsewhere = (text: ReportComponent): ReadonlySet<string> => {\n const layer = this._isMasterComponent(text) ? this.report?.master : this.activePage;\n\n return new Set((layer?.components ?? [])\n .filter((component) => component.type === 'text' && component.id !== text.id)\n .flatMap((component) => valueKeys(component.config?.html)));\n };\n\n private _reportData = inject(ReportData);\n private _filterState = inject(ReportFilterStateService);\n private _prompt = inject(FsPrompt);\n private _message = inject(FsMessage);\n private _destroyRef = inject(DestroyRef);\n private _fitted = false;\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 // The report input as a signal, for the token contexts and the master's\n // drawn components. Notifies on every set: a reload hands over a new report\n // even when nothing a token shows moved, and a deleted header or footer\n // block is spliced out of the same report.\n private _report = signal<Report | null>(null, { equal: () => false });\n\n // The values each layer's text can show (shown or not).\n private _pageValueComponents = computed(() => this.pages()[this.activePageIndex()]?.values ?? []);\n private _masterValueComponents = computed(() => this._report()?.master?.values ?? []);\n\n // The master's numbers are needed while some page shows the header and\n // footer, or while they are being edited.\n private _masterNeeded = computed(() => this.masterMode() || this.pages().some((page) => !page.masterHidden));\n\n // The two layers whose values are read, each on its own stream.\n private _pageValues = this._valueLayer(() => this.activePage);\n private _masterValues = this._valueLayer(() => (this._masterNeeded() ? this.report?.master ?? null : null));\n\n // Bumped when a value is renamed in place, which no signal sees.\n private _valuesRevision = signal(0);\n\n // The value keys each layer held at the last report load, by page id and\n // master id, so a reload can tell which values were deleted.\n private _valueKeysByLayer = new Map<number, Set<string>>();\n\n constructor() {\n this._init();\n }\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 // A (re)loaded report may have gained, lost or changed values, and any\n // text may now show different ones: read again each layer whose numbers\n // that moves.\n if (changes.report) {\n this._report.set(this.report);\n this._dropRemovedValueChips();\n this._reloadIfChanged(this._pageValues);\n this._reloadIfChanged(this._masterValues);\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 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 // 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 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. That covers the block alone: the\n // delete also takes the values only it showed, which come back as\n // valuesRemoved, and that asks the host to reload the report.\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._report.set(this.report);\n this._message.success('Deleted text');\n }\n\n // A text block's html was saved. Saving never deletes a value, but it can\n // show one the layer has no number for: a chip pasted back from a value no\n // text showed, which the server did not read. Its layer is read again so the\n // number comes in; an edit that shows only values already read asks nothing.\n public onTextSaved(text: ReportComponent, html: string): void {\n const isMaster = this._isMasterComponent(text);\n const layer = isMaster ? this._masterValues : this._pageValues;\n const layerId = isMaster ? (this.report?.master?.id ?? null) : this.activePageId();\n const results = layer.results();\n const rows = results?.pageId === layerId ? results.rows : null;\n const values = isMaster ? this._masterValueComponents() : this._pageValueComponents();\n const unread = shownValues(values, [{ ...text, config: { ...text.config, html } }])\n .some((value) => !rows?.has(value.id));\n\n if (unread) {\n layer.reload$.next();\n }\n }\n\n // A chip's gear: open the settings of the value it names, from the block's\n // own layer, through the same output as any component's settings.\n public openValueSettings(text: ReportComponent, key: string): void {\n const values = this._isMasterComponent(text) ? this._masterValueComponents() : this._pageValueComponents();\n // The newest value holds a key, as it does in the text's tokens.\n const value = values.filter((candidate) => valueKey(candidate) === key).pop();\n\n if (value) {\n this.componentSettings.emit(value);\n }\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 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. A value\n // is never drawn: its title is its Name, which its chips and tokens read.\n public applyComponentSettings(componentId: number, settings: ComponentSettings): void {\n const rendered = this._renderedComponents\n .find((candidate) => candidate.component.id === componentId);\n\n if (rendered) {\n rendered.applySettings(settings);\n\n return;\n }\n\n const value = [...this._pageValueComponents(), ...this._masterValueComponents()]\n .find((candidate) => candidate.id === componentId);\n\n // The server keeps the old Name for a blank one.\n if (value && settings.title?.trim()) {\n value.title = settings.title.trim();\n this._valuesRevision.update((revision) => revision + 1);\n }\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 drag/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 // ----- values ---------------------------------------------------------------\n\n // Each layer reads its values' numbers on its own stream: again when a\n // report reload changes what they depend on (ngOnChanges), when a saved text\n // shows a value it has no number for, when a filter any of its values\n // follows changes (an operand no text shows moves the formula that reads\n // it), and when it comes on screen — the active page when another page does,\n // the master when a page shows it or it is edited.\n private _init(): void {\n this._watchValues(this._pageValues, toObservable(this.activePageId));\n this._watchValues(this._masterValues, toObservable(this._masterNeeded));\n }\n\n private _valueLayer(source: () => ReportPage | ReportMaster | null): ValueLayer {\n return {\n source,\n reload$: new Subject<void>(),\n results: signal<LayerValues | null>(null),\n pending: signal<LayerValuesRequest | null>(null),\n };\n }\n\n // Triggers landing together (a reload that also changes the page) make one\n // request, and a newer request drops the one still in flight.\n private _watchValues(layer: ValueLayer, onScreen$: Observable<unknown>): void {\n merge(\n layer.reload$,\n onScreen$,\n this._filterState.changesForAny(() => layer.source()?.values ?? []).pipe(debounceTime(300)),\n )\n .pipe(\n debounceTime(0),\n map(() => this._layerRequest(layer.source())),\n tap((request) => layer.pending.set(request)),\n switchMap((request) => this._loadValues(request)),\n tap((loaded) => {\n layer.results.set(loaded);\n layer.pending.set(null);\n }),\n takeUntilDestroyed(this._destroyRef),\n )\n .subscribe();\n }\n\n // A reload of the report reads a layer's numbers again only when something\n // they depend on moved: a rename, or an edit to a tile, hands over a new\n // report and leaves every number as it was. Compared with the request on its\n // way, else the one whose numbers are on screen.\n private _reloadIfChanged(layer: ValueLayer): void {\n const last = layer.pending() ?? layer.results();\n\n if (this._layerRequest(layer.source()).signature !== last?.signature) {\n layer.reload$.next();\n }\n }\n\n // Read when the request is sent, not when it was asked for: an edit may have\n // just changed which values the layer's text shows. The filter values of\n // every value on the layer go out, shown or not: the server decides which\n // values it reads, and applies to each only the entries naming its own\n // filters, so an operand only a formula reads is filtered as if it were\n // shown. A value's Name is left out of the signature: a rename moves no\n // number.\n private _layerRequest(layer: ReportPage | ReportMaster | null): LayerValuesRequest {\n const pageId = layer?.id ?? null;\n const values = layer?.values ?? [];\n const shown = this._shownValues(layer);\n const filters = values.flatMap((component) => this._filterState.resolveForComponent(component));\n\n return {\n pageId,\n shown,\n filters,\n signature: JSON.stringify([\n pageId,\n shown.map((value) => value.id),\n values.map((value) => ({ ...value, title: null })),\n filters,\n ]),\n };\n }\n\n // The values a layer's text shows. Its request also reads the operands of\n // the formulas among them, but only the shown ones read as loading while it\n // is on its way, and a layer that shows none asks for nothing.\n private _shownValues(layer: ReportPage | ReportMaster | null): ReportComponent[] {\n const texts = (layer?.components ?? []).filter((component) => component.type === 'text');\n\n return shownValues(layer?.values ?? [], texts);\n }\n\n // One layer's numbers, by value id. A layer whose text shows no value asks\n // for nothing. A failed request reads as no numbers (each value an em dash)\n // rather than an error dialog: the words around them still read.\n private _loadValues({ pageId, shown, filters, signature }: LayerValuesRequest): Observable<LayerValues> {\n const loaded = (rows: ReportPageValue[]): LayerValues => ({\n pageId,\n signature,\n rows: new Map(rows.map((row) => [row.id, row])),\n });\n\n if (pageId === null || !shown.length) {\n return of(loaded([]));\n }\n\n return this._reportData.pageValues(this.report.id, pageId, filters, false, { handlers: false })\n .pipe(\n map((rows) => loaded(rows ?? [])),\n catchError(() => of(loaded([]))),\n );\n }\n\n // The tokens of one layer's blocks. Numbers read for another page are not\n // this one's, so until its own arrive its values read as loading; so does a\n // value the request on its way asks for, until it lands.\n private _tokenContext(\n values: ReportComponent[],\n layer: ValueLayer,\n valuePageId: number | null,\n ): TextTokenContext {\n // Read so a rename, patched into the value in place, recomputes the names.\n this._valuesRevision();\n\n const index = this.activePageIndex();\n const page = this.pages()[index];\n const results = layer.results();\n const pending = layer.pending();\n\n return {\n pageNumber: index + 1,\n pageName: page ? this.pageLabel(page, index) : '',\n reportName: this._report()?.name ?? '',\n values: textValues(\n values,\n results?.pageId === valuePageId ? results : null,\n this._filterState.formatContext(),\n new Set(pending?.pageId === valuePageId ? pending.shown.map((value) => value.id) : []),\n ),\n valuePageId,\n };\n }\n\n // Take a deleted value's chips out of an open editor. Saving html never\n // deletes a value, so a key leaves its layer only when the value is deleted\n // (its dialog, the assistant), when a text delete or an assistant write\n // sweeps the page's unused values, or with its page. Hosts reload the report\n // after each, and this is what follows that reload into the editor. Only the\n // layers on screen have rendered blocks; other pages are left alone.\n private _dropRemovedValueChips(): void {\n const next = layerValueKeys(this.report);\n const masterId = this.report?.master?.id ?? null;\n const texts = (this._renderedComponents?.toArray() ?? []).filter((rendered) => rendered.isText);\n\n this._valueKeysByLayer.forEach((keys, layerId) => {\n const isMaster = layerId === masterId;\n if (!isMaster && layerId !== this.activePageId()) {\n return;\n }\n\n const removed = [...keys].filter((key) => !next.get(layerId)?.has(key));\n texts\n .filter((rendered) => this._isMasterComponent(rendered.component) === isMaster)\n .forEach((rendered) => removed.forEach((key) => rendered.removeValue(key)));\n });\n\n this._valueKeysByLayer = next;\n }\n\n // Header and footer blocks are the master's; every other block is the page's.\n private _isMasterComponent(component: ReportComponent): boolean {\n return (this.report?.master?.components ?? []).some((candidate) => candidate.id === component.id);\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._isMasterComponent(moving);\n const siblings = isMaster ? this.masterComponents() : this.activePageComponents();\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) {\n <div\n class=\"page\"\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.--canvas-zoom]=\"zoom()\"\n [style.--report-heading-size.px]=\"headingSizePx\">\n <!-- The header and footer: the master's components, drawn under the\n page's own. -->\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 [zoom]=\"zoom()\"\n [snapper]=\"snapper\"\n [tokens]=\"masterTokens()\"\n [valueKeysElsewhere]=\"valueKeysElsewhere\"\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 (valueSettings)=\"openValueSettings(component, $event)\"\n (textSaved)=\"onTextSaved(component, $event)\"\n (valuesRemoved)=\"reportChanged.emit()\">\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 @for (component of activePageComponents(); track component.id) {\n <app-report-component\n [reportId]=\"report.id\"\n [component]=\"component\"\n [groups]=\"groups\"\n [editMode]=\"isPageEditing\"\n [zoom]=\"zoom()\"\n [snapper]=\"snapper\"\n [tokens]=\"pageTokens()\"\n [valueKeysElsewhere]=\"valueKeysElsewhere\"\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 (valueSettings)=\"openValueSettings(component, $event)\"\n (textSaved)=\"onTextSaved(component, $event)\"\n (valuesRemoved)=\"reportChanged.emit()\">\n </app-report-component>\n }\n\n <div\n #guides\n class=\"guides\">\n </div>\n\n @if (!activePageComponents().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 {\n ChangeDetectionStrategy, Component, DestroyRef, EventEmitter, OnInit, computed, inject, signal,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { AbstractControl, FormsModule } from '@angular/forms';\n\nimport { MAT_DIALOG_DATA, MatDialogActions, MatDialogClose, MatDialogContent, MatDialogRef, MatDialogTitle } from '@angular/material/dialog';\nimport { MatFormField, MatHint, MatLabel, MatSuffix } from '@angular/material/form-field';\nimport { MatButton } from '@angular/material/button';\nimport { MatInput } from '@angular/material/input';\nimport { MatOption, MatSelect } from '@angular/material/select';\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 { ReportChangePolarity } from '../../enums/report-change-polarity.enum';\nimport { ReportValueFormat } from '../../enums/report-value-format.enum';\nimport { ReportValueFormula } from '../../enums/report-value-formula.enum';\nimport { resolveFormatContext } from '../../format';\nimport {\n KPI_SPARKLINE_DEFAULT_GRANULARITY,\n KPI_SPARKLINE_DEFAULT_PERIODS,\n kpiCardSettings,\n sameKpiCardSettings,\n} from '../../kpi-card';\nimport {\n ChartGranularity,\n ComponentSettings,\n GRANULARITY_OPTIONS,\n KpiCardSettings,\n KpiConfig,\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';\nimport { escapeHtml } from '../../text';\nimport { operandKeys, reportComponents, valueKey } from '../../values';\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// What the settings endpoint returns for the component: its id and, from a\n// server that saves a KPI's card keys, the whole config as saved.\ninterface ComponentSettingsResponse {\n id: number;\n config?: Record<string, unknown> | null;\n}\n\n\n// What a rise in a KPI's value means, for the Increase is select.\nconst KPI_CHANGE_POLARITY_OPTIONS: { value: ReportChangePolarity; name: string }[] = [\n { value: ReportChangePolarity.Good, name: 'Good news — a rise shows green' },\n { value: ReportChangePolarity.Bad, name: 'Bad news — a rise shows red' },\n { value: ReportChangePolarity.Neutral, name: 'Neither — no color' },\n];\n\n// A KPI sparkline's periods stay within 2 to 60.\nconst KPI_SPARKLINE_MIN_PERIODS = 2;\nconst KPI_SPARKLINE_MAX_PERIODS = 60;\n\n// A percent KPI's target is entered as the percent shown (15 for 15%) and\n// stored as the 0-1 ratio its value arrives in; the server refuses a stored\n// target above 100, which is 10,000% here.\nconst KPI_PERCENT_TARGET_MAX = 10000;\n\n// How a formula value's Settings tab writes out what it works out, in its\n// operands' names.\nconst FORMULA_LINES: Record<ReportValueFormula, (names: string[]) => string> = {\n [ReportValueFormula.Change]: (names) => names.join(' − '),\n [ReportValueFormula.PercentChange]: ([a, b]) => `% change of ${a} over ${b}`,\n [ReportValueFormula.Ratio]: (names) => names.join(' ÷ '),\n [ReportValueFormula.Sum]: (names) => names.join(' + '),\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 (a value: just its name, since it\n// sits inside a text block's words and has no box), and on a derived KPI its card:\n// what a rise means, a target and a sparkline (number formats stay with\n// the AI). Position/size are tuned by dragging on the canvas; height\n// 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. A value has no component\n// to show a filter on, so it gets the report bar toggle only.\n// SQL / Config — read-only diagnostics.\n// A formula value has no Filters or SQL tab: the server works it out of other\n// values on its page, so it runs no statement and follows the filters of the\n// values it reads. Its Settings tab says what it works out, under its name.\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 MatHint,\n MatLabel,\n MatSuffix,\n MatButton,\n MatInput,\n MatOption,\n MatSelect,\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 // ---- KPI card state (a derived KPI only) ----\n public readonly kpiPolarityOptions = KPI_CHANGE_POLARITY_OPTIONS;\n public readonly granularityOptions = GRANULARITY_OPTIONS;\n public readonly sparklineMinPeriods = KPI_SPARKLINE_MIN_PERIODS;\n public readonly sparklineMaxPeriods = KPI_SPARKLINE_MAX_PERIODS;\n public readonly kpiCard = signal(false);\n // A value inside a text block: no box, so no padding.\n public readonly isValue = signal(false);\n // A formula value: no statement, columns or filters of its own.\n public readonly isFormula = signal(false);\n // What a formula works out, in its operands' names; empty for any other\n // component.\n public readonly formulaLine = computed(() => (this.isFormula() ? this._formulaLine() : ''));\n public readonly increaseIs = signal<ReportChangePolarity>(ReportChangePolarity.Good);\n // The target as typed: fsMaskNumber hands back the unmasked string. Empty\n // means no target. A percent KPI's is in percent (targetPercent).\n public readonly targetValue = signal<number | string | null>(null);\n public readonly targetLabel = signal('');\n public readonly targetPercent = signal(false);\n public readonly hasTarget = computed(() => this._number(this.targetValue()) !== null);\n public readonly sparkline = signal(false);\n public readonly sparklineGranularity = signal<ChartGranularity>(KPI_SPARKLINE_DEFAULT_GRANULARITY);\n public readonly sparklinePeriods = signal<number | string>(KPI_SPARKLINE_DEFAULT_PERIODS);\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 this.isValue.set(this.component.type === 'value');\n this.isFormula.set(!!this.component.config?.formula);\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._seedKpiCard();\n\n this._seedFilters(this.report, this.component.id);\n\n // A formula has no statement to compile and no columns to filter on, and\n // the server would refuse both requests.\n if (!this.isFormula()) {\n this._loadColumns();\n this._loadSql();\n }\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 // A value's confirm also says what goes with it: the server takes its\n // tokens out of every text on its page, not just the one it was opened from,\n // and deletes the formulas that read it (_dependentsNote).\n //\n // The prompt renders its template as html, so every name in it is escaped.\n public delete(): void {\n this._prompt.confirm(this.isValue()\n ? {\n title: 'Delete Value',\n template: `Delete the value \"${escapeHtml(this.component.title || valueKey(this.component))}\"? It is also taken out of every text on this page. This cannot be undone.${this._dependentsNote()}`,\n }\n : {\n title: 'Delete Component',\n template: `Are you sure you would like to delete \"${escapeHtml(this.component.title || 'this component')}\"? This cannot be undone.`,\n })\n .pipe(\n switchMap(() => this._reportData.deleteComponent(this.report.id, this.component.id)),\n tap(() => {\n this._message.success(this.isValue() ? 'Value deleted' : 'Component deleted');\n this._dialogRef.close({ deleted: true });\n }),\n takeUntilDestroyed(this._destroyRef),\n )\n .subscribe();\n }\n\n // A percent target's bound, in the percent it is typed in. It reads the\n // control, which fsForm validates before ngModelChange updates the signal.\n public validateTarget = (control: AbstractControl): void => {\n const value = this._number(control.value);\n\n if (this.targetPercent() && value !== null && value > KPI_PERCENT_TARGET_MAX) {\n throw new Error('A percent target can be at most 10,000%');\n }\n };\n\n public save = () => {\n const settings: ComponentSettings = {\n // The server trims a title; a value's Name is what its chips show, so it\n // goes as the server keeps it.\n title: this.isValue() ? this.title.trim() : 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 // The card keys go as config keys beside the padding (increaseIs, target\n // and sparkline, null to remove one), and only when they changed, so a\n // title edit never touches them.\n const kpi = this.kpiCard() ? this._kpiCardSettings() : null;\n const kpiChanged = !!kpi\n && !sameKpiCardSettings(kpi, kpiCardSettings(this.component.config as KpiConfig));\n\n return this._reportData.updateComponent(this.report.id, this.component.id, {\n title: settings.title,\n ...(this.isValue() ? {} : { padding: settings.padding }),\n ...(kpiChanged ? kpi : {}),\n })\n .pipe(\n tap((response: ComponentSettingsResponse) => {\n // The card is drawn from the keys the server saved, read back from\n // the config it returns. A server that returns no config did not\n // save them, so the card keeps what it had and the dialog says so.\n const saved = kpiChanged ? this._savedKpiCard(response) : null;\n\n if (kpiChanged && !saved) {\n this._message.warning('Component saved, but the server did not save the card settings');\n } else {\n this._message.success(this.isValue() ? 'Value saved' : 'Component saved');\n }\n\n this._dialogRef.close({ settings: saved ? { ...settings, kpi: saved } : 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. A value has the report bar toggle only, with its own rules\n // (_setValueExposure).\n public setExposure(row: FilterRow, target: 'report' | 'component', on: boolean): void {\n if (this.isValue()) {\n if (target === 'report') {\n this._setValueExposure(row, on);\n }\n\n return;\n }\n\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 // A value's report bar toggle, the only one it has. Its filter's group is\n // report-wide and may be shared (the report's Period, say), and a value has\n // no strip of its own, so this never lowers a group's level: off unlinks\n // this value alone and the group keeps its other members, and on raises a\n // strip-only group to both, keeping its strips, or adds the value to a new\n // report-level group.\n private _setValueExposure(row: FilterRow, on: boolean): void {\n row.report = on;\n\n const existing = this._filters.find((filter) => filter.filterColumn === row.column);\n\n if (!on) {\n if (existing) {\n this._run(this._reportData.deleteFilter(this.report.id, existing.id));\n }\n\n return;\n }\n\n if (!existing) {\n this._run(this._reportData.addFilter(this.report.id, this.component.id, {\n filterColumn: row.column,\n label: row.label,\n level: 'report',\n }));\n } else if (this._groupsById.get(existing.filterGroupId)?.level === 'component') {\n this._run(this._reportData.updateFilterGroup(this.report.id, existing.filterGroupId, { level: 'both' }));\n }\n }\n\n // What a formula works out, naming each operand as its chips do. An op this\n // viewer does not know reads nothing.\n private _formulaLine(): string {\n const formula = this.component.config?.formula;\n const line = formula ? FORMULA_LINES[formula.op] : undefined;\n const values = this._layerValues();\n\n return line ? line(operandKeys(this.component).map((key) => this._valueName(values, key))) : '';\n }\n\n // The sentence a query value's delete confirm ends with when formulas on its\n // layer read it: the server deletes those with it. Empty when none does, and\n // for a formula, whose operands stay.\n private _dependentsNote(): string {\n if (this.isFormula()) {\n return '';\n }\n\n const key = valueKey(this.component);\n const names = this._layerValues()\n .filter((value) => operandKeys(value).includes(key))\n .map((value) => escapeHtml(value.title || valueKey(value)));\n\n return names.length ? ` The values worked out from it are deleted too: ${names.join(', ')}.` : '';\n }\n\n // The values of the layer this value belongs to: the page whose values hold\n // it, else the master's (a header or footer value).\n private _layerValues(): ReportComponent[] {\n const page = (this.report.pages ?? [])\n .find((candidate) => (candidate.values ?? []).some((value) => value.id === this.component.id));\n\n return (page ?? this.report.master)?.values ?? [];\n }\n\n // What a value is called where its chips show it: its name, else its key.\n // The newest value holds a key, as it does in the text's tokens.\n private _valueName(values: ReportComponent[], key: string): string {\n const value = values.filter((candidate) => valueKey(candidate) === key).pop();\n\n return value?.title || key;\n }\n\n // A derived KPI's card keys, from its config. A sql-mode KPI cannot carry\n // them, so it gets no card fields.\n private _seedKpiCard(): void {\n const config = (this.component.config ?? {}) as KpiConfig;\n\n this.kpiCard.set(this.component.type === 'kpi' && !this.component.sql);\n this.increaseIs.set(config.increaseIs ?? ReportChangePolarity.Good);\n this.targetPercent.set(config.measure?.format === ReportValueFormat.Percent\n && resolveFormatContext(this.report).ratioPercent);\n this.targetValue.set(this._targetShown(config.target?.value ?? null));\n this.targetLabel.set(config.target?.label ?? '');\n this.sparkline.set(!!config.sparkline);\n this.sparklineGranularity.set(config.sparkline?.granularity ?? KPI_SPARKLINE_DEFAULT_GRANULARITY);\n this.sparklinePeriods.set(config.sparkline?.periods ?? KPI_SPARKLINE_DEFAULT_PERIODS);\n }\n\n // The card keys the server saved, from the config its response carries;\n // null when it carries none (a server that does not save them).\n private _savedKpiCard(response: ComponentSettingsResponse | null | undefined): KpiCardSettings | null {\n const config = response?.config;\n\n return config && typeof config === 'object' ? kpiCardSettings(config as KpiConfig) : null;\n }\n\n // Good is what an absent increaseIs reads, so it is saved as absent.\n private _kpiCardSettings(): KpiCardSettings {\n const target = this._number(this.targetValue());\n const label = this.targetLabel().trim();\n\n return {\n increaseIs: this.increaseIs() === ReportChangePolarity.Good ? null : this.increaseIs(),\n target: target === null ? null : { value: this._targetStored(target), label: label || null },\n sparkline: this.sparkline()\n ? { granularity: this.sparklineGranularity(), periods: this._number(this.sparklinePeriods()) }\n : null,\n };\n }\n\n // A stored ratio as the percent typed, rounded so 0.15 reads 15 and not\n // 15.000000000000002.\n private _targetShown(value: number | null): number | null {\n if (value === null || !this.targetPercent()) {\n return value;\n }\n\n return Math.round(value * 100 * 1e6) / 1e6;\n }\n\n private _targetStored(value: number): number {\n return this.targetPercent() ? value / 100 : value;\n }\n\n // A typed number, or null when the field is empty.\n private _number(value: number | string | null): number | null {\n if (value === null || value === '') {\n return null;\n }\n\n const number = typeof value === 'number' ? value : parseFloat(value);\n\n return Number.isFinite(number) ? number : null;\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. A\n // value's rows never read as on a component: it has no strip, whatever\n // level a group it shares is at.\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: !this.isValue() && (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 // The component's filters and the groups they sit in, from the report as\n // last loaded. A value is listed in its page's values, not its components.\n private _seedFilters(report: Report, componentId: number): void {\n this._groupsById = new Map((report.filterGroups ?? []).map((group) => [group.id, group]));\n\n const component = reportComponents(report)\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 || (isValue() ? 'Value' : '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 {{ isValue() ? 'Name' : 'Title' }}\n </mat-label>\n <input\n matInput\n [(ngModel)]=\"title\"\n name=\"title\"\n [fsFormRequired]=\"isValue()\">\n </mat-form-field>\n <!-- A formula value is read-only beyond its name: what it works\n out is the AI's to change. A formula this viewer cannot\n read has no line, and no row. -->\n @if (formulaLine()) {\n <fs-label-field>\n <fs-label>\n Formula\n </fs-label>\n {{ formulaLine() }}\n <fs-label-message>\n Worked out on the server; it follows the filters of the values it reads.\n </fs-label-message>\n </fs-label-field>\n }\n <!-- A value sits inside a text block's words: no box, no padding. -->\n @if (!isValue()) {\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 }\n <!-- A derived KPI's card: what a rise means, a target and a\n sparkline. The server computes the progress and the points. -->\n @if (kpiCard()) {\n <div class=\"subheading-2\">\n Card\n </div>\n <mat-form-field class=\"full-width\">\n <mat-label>\n Increase is\n </mat-label>\n <mat-select\n [ngModel]=\"increaseIs()\"\n (ngModelChange)=\"increaseIs.set($event)\"\n name=\"increaseIs\">\n @for (option of kpiPolarityOptions; track option.value) {\n <mat-option [value]=\"option.value\">\n {{ option.name }}\n </mat-option>\n }\n </mat-select>\n <mat-hint>\n Colors the change and decides when the target is met.\n </mat-hint>\n </mat-form-field>\n <mat-form-field class=\"full-width\">\n <mat-label>\n Target\n </mat-label>\n <input\n matInput\n fsMaskNumber\n [scale]=\"6\"\n [signed]=\"true\"\n [ngModel]=\"targetValue()\"\n (ngModelChange)=\"targetValue.set($event)\"\n name=\"targetValue\"\n [validate]=\"validateTarget\">\n @if (targetPercent()) {\n <div matTextSuffix>\n %\n </div>\n }\n <mat-hint>\n The value to reach. Leave empty for no target.\n </mat-hint>\n </mat-form-field>\n @if (hasTarget()) {\n <mat-form-field class=\"full-width\">\n <mat-label>\n Target label\n </mat-label>\n <input\n matInput\n [ngModel]=\"targetLabel()\"\n (ngModelChange)=\"targetLabel.set($event)\"\n name=\"targetLabel\">\n <mat-hint>\n Shown before the target, such as Goal. Empty reads Target.\n </mat-hint>\n </mat-form-field>\n }\n <fs-label-field>\n <mat-slide-toggle\n [ngModel]=\"sparkline()\"\n (ngModelChange)=\"sparkline.set($event)\"\n name=\"sparkline\">\n Sparkline\n </mat-slide-toggle>\n <mat-hint>\n A small trend line of the value over its last periods.\n </mat-hint>\n </fs-label-field>\n @if (sparkline()) {\n <mat-form-field class=\"full-width\">\n <mat-label>\n Sparkline period\n </mat-label>\n <mat-select\n [ngModel]=\"sparklineGranularity()\"\n (ngModelChange)=\"sparklineGranularity.set($event)\"\n name=\"sparklineGranularity\">\n @for (option of granularityOptions; track option.value) {\n <mat-option [value]=\"option.value\">\n {{ option.name }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n <mat-form-field class=\"full-width\">\n <mat-label>\n Sparkline periods\n </mat-label>\n <input\n matInput\n fsMaskNumber\n [scale]=\"0\"\n [ngModel]=\"sparklinePeriods()\"\n (ngModelChange)=\"sparklinePeriods.set($event)\"\n name=\"sparklinePeriods\"\n [fsFormRequired]=\"true\"\n [fsFormInteger]=\"true\"\n [fsFormMin]=\"sparklineMinPeriods\"\n [fsFormMax]=\"sparklineMaxPeriods\">\n <mat-hint>\n How many periods the line covers, {{ sparklineMinPeriods }} to {{ sparklineMaxPeriods }}.\n </mat-hint>\n </mat-form-field>\n }\n }\n </div>\n </mat-tab>\n <!-- A formula runs no statement and follows the filters of the values\n it reads, so it has neither a Filters nor an SQL tab. -->\n @if (!isFormula()) {\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 A value sits inside text and has no component to show a\n control on, so it gets the report bar column only. -->\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 @if (!isValue()) {\n <th class=\"filter-col-toggle\">\n This component\n </th>\n }\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 @if (!isValue()) {\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 }\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 }\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 { Report } from '../../interfaces/report.interface';\n\n\n// The locale and currency keys for the report settings PUT: each is sent only\n// when the dialog's value differs from the report's stored one ('' = follows\n// the default). An untouched dialog sends neither, so a report that follows the\n// default is never pinned to it, and a stored value the server no longer offers\n// is never sent back to be refused: renaming such a report still saves. A\n// changed value is sent as it is, and '' returns the report to the default.\nexport function reportLocalePatch(\n report: Pick<Report, 'locale' | 'currency'>,\n locale: string,\n currency: string,\n): { locale?: string; currency?: string } {\n return {\n ...(locale !== (report.locale ?? '') ? { locale } : {}),\n ...(currency !== (report.currency ?? '') ? { currency } : {}),\n };\n}\n","import { ChangeDetectionStrategy, Component, DestroyRef, OnInit, computed, 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 { FsSkeletonModule } from '@firestitch/skeleton';\nimport { FsTabsModule } from '@firestitch/tabs';\n\nimport { TimezoneSelectComponent } from '../../components/timezone-select/timezone-select.component';\n\nimport { Observable, forkJoin, of } from 'rxjs';\nimport { catchError, finalize, switchMap, tap } from 'rxjs/operators';\n\nimport { ReportData } from '../../data/report.data';\nimport { ReportValueFormat } from '../../enums/report-value-format.enum';\nimport {\n DAY_SHORT,\n REPORT_FALLBACK_CURRENCY,\n currencyName,\n formatLocalDate,\n formatNumber,\n localeName,\n resolveReportCurrency,\n resolveReportLocale,\n} from '../../format';\nimport {\n FilterGroupDefault,\n Report,\n ReportFilterGroup,\n ReportLocales,\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\nimport { reportLocalePatch } from './report-locale-patch';\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// One entry of the Locale or Currency select. '' is the explicit Default.\ninterface LocaleSelectOption {\n value: string;\n label: string;\n}\n\n// The day the Locale hint writes, a fixed calendar day so the example never\n// changes under the operator.\nconst EXAMPLE_DAY = new Date(2026, 0, 5);\nconst EXAMPLE_AMOUNT = 1234.5;\n\n// 'Canadian French (fr-CA)', 'Canadian Dollar (CAD)': English names whatever\n// the report's locale, with the code that is stored.\nfunction localeLabel(tag: string): string {\n return `${localeName(tag)} (${tag})`;\n}\n\nfunction currencyLabel(code: string): string {\n return `${currencyName(code)} (${code})`;\n}\n\n\n// Report settings, in three tabs:\n// Settings — name + page setup (size in inches, header/footer band depths).\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 FsSkeletonModule,\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 // 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 locales and currencies the server offers. null until loaded, and\n // never loaded from a server too old to send effectiveLocale: there the\n // selects stay hidden and the report reads en-US/USD.\n public readonly locales = signal<ReportLocales | null>(null);\n // The report's own locale and currency, '' when it follows the default. Save\n // sends each only when it differs from the stored value.\n public readonly locale = signal('');\n public readonly currency = signal('');\n // The whole form waits behind one skeleton until the filter rows are built\n // and the locale request has settled, so the Settings tab never shows\n // without its Locale and Currency selects. A failed locale request settles\n // too: the two selects stay hidden (locales() is still null) and every other\n // setting stays editable.\n public readonly ready = computed(() => this._filtersReady() && (!this._serverHasLocale || this._localesSettled()));\n\n // An explicit Default ('') naming the locale it stands for, then each offered\n // locale. A stored locale the server no longer offers is listed first, so\n // the select still shows what the report holds.\n public readonly localeOptions = computed<LocaleSelectOption[]>(() => {\n const locales = this.locales();\n if (!locales) {\n return [];\n }\n\n const offered = locales.options.map((option) => option.locale);\n\n return [\n ...this._storedOption(this._data.report.locale, offered, localeLabel),\n { value: '', label: `Default — ${localeName(locales.defaultLocale)}` },\n ...offered.map((tag) => ({ value: tag, label: localeLabel(tag) })),\n ];\n });\n\n // An explicit Default ('') naming the currency the selected locale uses when\n // the report names none, then every currency. A stored code the server no\n // longer offers is listed first.\n public readonly currencyOptions = computed<LocaleSelectOption[]>(() => {\n const locales = this.locales();\n if (!locales) {\n return [];\n }\n\n return [\n ...this._storedOption(this._data.report.currency, locales.currencies, currencyLabel),\n { value: '', label: `Default — ${currencyLabel(this._defaultCurrency())}` },\n ...locales.currencies.map((code) => ({ value: code, label: currencyLabel(code) })),\n ];\n });\n\n // How the report will write an amount and a day once saved: the selected\n // locale and currency, or the defaults they fall back to, e.g.\n // '1 234,50 $ · 5 janv. 2026' in fr-CA.\n public readonly formatExample = computed(() => {\n const locale = resolveReportLocale(this._appliedLocale());\n const currency = resolveReportCurrency(this._appliedCurrency());\n\n return [\n formatNumber(\n EXAMPLE_AMOUNT,\n { format: ReportValueFormat.Currency, precision: 2 },\n { locale, currency, ratioPercent: true },\n ),\n formatLocalDate(EXAMPLE_DAY, locale, DAY_SHORT),\n ].join(' · ');\n });\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 // Only a server that resolves a report's locale offers the locale list.\n private readonly _serverHasLocale = this._data.report.effectiveLocale !== undefined;\n // True once the locale request has answered, with the list or an error.\n private readonly _localesSettled = signal(false);\n // True once the filter rows are published (see _buildFilterRows).\n private readonly _filtersReady = signal(false);\n\n // The locale the report would be written in: the selected one when the\n // server offers it, else the default (a stored locale it no longer offers\n // falls back to the default, as it does on the server).\n private readonly _appliedLocale = computed(() => {\n const locales = this.locales();\n const locale = this.locale();\n\n return locales?.options.some((option) => option.locale === locale)\n ? locale\n : locales?.defaultLocale ?? '';\n });\n\n // The currency a report in the applied locale uses when it names none.\n private readonly _defaultCurrency = computed(() => {\n const locale = this._appliedLocale();\n\n return this.locales()?.options.find((option) => option.locale === locale)?.defaultCurrency\n ?? REPORT_FALLBACK_CURRENCY;\n });\n\n // The currency the report would label money in: the selected one when the\n // server offers it, else the default.\n private readonly _appliedCurrency = computed(() => {\n const currency = this.currency();\n\n return this.locales()?.currencies.includes(currency)\n ? currency\n : this._defaultCurrency();\n });\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.timezone = report.timezone ?? report.effectiveTimezone ?? '';\n this.headingSize = report.config?.styles?.heading?.size ?? DEFAULT_HEADING_SIZE;\n this.locale.set(report.locale ?? '');\n this.currency.set(report.currency ?? '');\n\n this._buildFilterRows(report);\n\n if (this._serverHasLocale) {\n this._reportData.locales()\n .pipe(\n tap((locales) => this.locales.set(locales)),\n catchError(() => of(null)),\n finalize(() => this._localesSettled.set(true)),\n takeUntilDestroyed(this._destroyRef),\n )\n .subscribe();\n }\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 ...this._timezoneSetting(),\n ...reportLocalePatch(this._data.report, this.locale(), this.currency()),\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 // The stored value as its own option when the server no longer offers it, so\n // the select names it instead of showing blank. Left as it is, it is never\n // sent (see reportLocalePatch), and the report reads the default meanwhile.\n private _storedOption(\n stored: string | null | undefined,\n offered: string[],\n label: (value: string) => string,\n ): LocaleSelectOption[] {\n return stored && !offered.includes(stored) ? [{ value: stored, label: label(stored) }] : [];\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._publishFilterRows(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. When an option\n // list fails to load, the rows publish unresolved: each chip names its id,\n // and an untouched row still saves the stored default unchanged.\n forkJoin(seeded.map((entry) => resolveOptionValues(entry.options$, entry.values)))\n .pipe(\n catchError(() => of(seeded.map((entry) => entry.values.map((value) => ({ name: String(value), value }))))),\n tap((resolved) => {\n resolved.forEach((values, index) => seeded[index].row.values = values);\n this._publishFilterRows(rows);\n }),\n takeUntilDestroyed(this._destroyRef),\n )\n .subscribe();\n }\n\n private _publishFilterRows(rows: FilterDefaultRow[]): void {\n this.filterRows.set(rows);\n this._filtersReady.set(true);\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 <!-- One skeleton over the whole body until the locale list is in. -->\n <ng-container *fsSkeletonForm=\"ready() || null\">\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 <fs-ai-report-timezone-select [(timezone)]=\"timezone\"></fs-ai-report-timezone-select>\n <!--\n How numbers and dates are written (formatting only: no text is\n translated) and which currency money is labeled in. Hidden on a\n server too old to resolve a report's locale.\n -->\n @if (locales()) {\n <mat-form-field class=\"full-width\">\n <mat-label>\n Locale\n </mat-label>\n <mat-select\n [ngModel]=\"locale()\"\n (ngModelChange)=\"locale.set($event)\"\n name=\"locale\">\n @for (option of localeOptions(); track option.value) {\n <mat-option [value]=\"option.value\">\n {{ option.label }}\n </mat-option>\n }\n </mat-select>\n <mat-hint>\n {{ formatExample() }}\n </mat-hint>\n </mat-form-field>\n <mat-form-field class=\"full-width\">\n <mat-label>\n Currency\n </mat-label>\n <mat-select\n [ngModel]=\"currency()\"\n (ngModelChange)=\"currency.set($event)\"\n name=\"currency\">\n @for (option of currencyOptions(); track option.value) {\n <mat-option [value]=\"option.value\">\n {{ option.label }}\n </mat-option>\n }\n </mat-select>\n <mat-hint>\n Names the currency amounts are in; it does not convert them.\n </mat-hint>\n </mat-form-field>\n }\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 </ng-container>\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 { Observable, forkJoin, from, map, of } from 'rxjs';\nimport { catchError, mergeMap, toArray } from 'rxjs/operators';\n\nimport { ReportData } from '../data/report.data';\nimport { ReportListColumnFormat } from '../enums/report-list-column-format.enum';\nimport {\n DAY_LONG,\n formatLocalDate,\n formatNumber,\n formatOutputValue,\n formatReportDate,\n hasNumberFormat,\n resolveReportTimezone,\n} from '../format';\nimport {\n ComponentData,\n ComponentDataState,\n GRANULARITY_OPTIONS,\n ListColumn,\n ListConfig,\n Report,\n ReportComponent,\n ReportFilterGroup,\n ReportFormatContext,\n ReportLocaleTag,\n ReportMaster,\n ReportPage,\n ReportPageValue,\n} from '../interfaces/report.interface';\nimport { KpiCardView } from '../kpi-card';\nimport {\n LIST_TOTAL_LABEL,\n ListOutputColumn,\n listHiddenColumns,\n listOutputColumns,\n listTotalsLabelColumn,\n} from '../list-config';\nimport { pivotColumnSpecs } from '../option-builder';\nimport { componentNoteLines, componentWindowsLine } from '../output-notes';\nimport { dateBoundLabel, loadGroupOptions, resolveOptionValues } from '../report-filter-items';\nimport { ReportFilterStateService } from '../services/report-filter-state.service';\nimport { TextTokenContext, TextValue, textPlain } from '../text';\nimport {\n failedValueKeys, isDrawn, shownValues, textValues, valueKeys,\n} from '../values';\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 // The text a list was searched by when it was fetched; absent when its\n // search box was empty, and for every other component.\n search?: string;\n // The config columns a viewer hid on a plain list, which its table leaves\n // out (listColumns); empty for every other component.\n hiddenColumns: string[];\n}\n\nexport interface CollectedPage {\n page: ReportPage;\n components: CollectedComponent[];\n // What the page's text blocks fill their {{value.<key>}} tokens with, by key\n // (textValues), and the keys of the values its text shows whose numbers did\n // not come back: the request failed, or the value's own query did.\n values: Record<string, TextValue>;\n failedValues: string[];\n}\n\nexport interface CollectedReport {\n report: Report;\n pages: CollectedPage[];\n // The header and footer's values, as a page's: read once for the whole\n // file, since every page that shows the master shows the same numbers.\n masterValues: Record<string, TextValue>;\n masterFailedValues: string[];\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 and\n // the currency the server resolved for the report. Each is left out when the\n // server does not send it, rather than a guess that would be wrong whenever\n // the default applies.\n contextLines: string[];\n // How the open report writes its numbers and dates (its locale, currency\n // and percent form), read once so every page of the file agrees.\n formatContext: ReportFormatContext;\n}\n\n// A text block whose words do not fit its box in a built file: the block, the\n// page the overflow gate names it under (HEADER_FOOTER_NAME for a header or\n// footer block) and the start of its text, so the reader can find it.\nexport interface TextOverflow {\n componentId: number;\n page: string;\n snippet: string;\n}\n\n// A file built and not yet saved. Whether text fits its box is known only once\n// the file is built, so the export asks about the overflows between the build\n// and the save: `overflowNote` says what this format does with such text, and\n// `save` writes the file.\nexport interface BuiltExport {\n overflows: TextOverflow[];\n overflowNote: string;\n save: () => void | Promise<void>;\n}\n\n// One exported list column: the cell key, its heading and its format, and\n// whether its cells are formatted numbers, which every export right-aligns\n// (header included) as the screen does. A column that holds a compared,\n// windowed, ranked or shared output carries how it is written (output), and\n// holds numbers whether or not it names a format.\nexport type ExportListColumn = ListColumn & { numeric: boolean; output?: ListOutputColumn };\n\n// How tall each part of an exported KPI card is, in the renderer's unit\n// (points in the PDF, inches in the deck). A note is one line.\nexport interface KpiExportHeights {\n value: number;\n label: number;\n delta: number;\n window: number;\n target: number;\n sparkline: number;\n note: number;\n}\n\n// The parts of a KPI card an export draws: the value and its label always,\n// the rest when the card has them and the tile has room (kpiExportParts).\n// scale shrinks the rows and their text when the parts that always stay still\n// stand taller than the tile (scaledKpiHeights): 1 when they fit.\nexport interface KpiExportParts {\n delta: boolean;\n window: boolean;\n target: boolean;\n sparkline: boolean;\n notes: string[];\n scale: number;\n}\n\n// How far a KPI card's rows shrink to fit a short tile. A tile shorter still\n// lets the card run past its foot rather than print it unreadably small.\nconst KPI_EXPORT_MIN_SCALE = 0.5;\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 the export gates call the header and footer: when a value they show\n// came back without its number, and when one of their text blocks does not\n// fit its box.\nexport const HEADER_FOOTER_NAME = 'Header & footer';\n\n// How much of a text block's words the export gates quote to name a block that\n// does not fit its box.\nconst OVERFLOW_SNIPPET_LENGTH = 40;\n\n// One request in an export's queue: a tile's data, or the numbers of the\n// values one layer's text reads, read together. A values job's pageIndex is\n// null for the header and footer (the master); `values` is every value of the\n// layer, which names its tokens and whose filter values the request carries,\n// and `components` the ones its text shows, whose numbers the failure gate\n// requires.\ntype CollectJob =\n | { kind: 'component'; pageIndex: number; component: ReportComponent }\n | {\n kind: 'values';\n pageIndex: number | null;\n pageId: number;\n values: ReportComponent[];\n components: ReportComponent[];\n };\n\n// One layer's values as the file prints them.\ntype CollectedValues = Pick<CollectedPage, 'values' | 'failedValues'>;\n\n// What a job came back with, and the page it is filed under.\ntype CollectResult =\n | { kind: 'component'; pageIndex: number; item: CollectedComponent }\n | { kind: 'values'; pageIndex: number | null; collected: CollectedValues };\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// A component's title as an exported file prints it. A searched list says so,\n// since its table holds only the matching rows: 'Orders (matching \"north\")'.\n// An untitled one reads 'Matching \"north\"'. '' when there is nothing to print.\n// Shared by the PDF and the deck, continuation pages included.\nexport function exportTitle(component: ReportComponent, search?: string | null): string {\n const title = component.title ?? '';\n\n if (!search) {\n return title;\n }\n\n return title ? `${title} (matching \"${search}\")` : `Matching \"${search}\"`;\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// A text block that does not fit its box in a built file, as the overflow gate\n// names it: under its page (HEADER_FOOTER_NAME for a header or footer block)\n// and by the start of its words, on one line. Shared by the PDF and the deck.\nexport function textOverflow(component: ReportComponent, page: string, tokens: TextTokenContext): TextOverflow {\n const text = textPlain(component.config?.html ?? '', tokens).replace(/\\s+/g, ' ').trim();\n\n return {\n componentId: component.id,\n page,\n snippet: text.length > OVERFLOW_SNIPPET_LENGTH ? `${text.slice(0, OVERFLOW_SNIPPET_LENGTH).trimEnd()}…` : text,\n };\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 always leads (the PowerPoint marks that line as written in the\n// report's locale). It is today in the report's zone, the same day its filters\n// resolve \"today\" to, written in the report's locale.\nexport function coverLines(collected: CollectedReport): string[] {\n return [\n formatLocalDate(\n new Date(),\n collected.formatContext.locale,\n DAY_LONG,\n resolveReportTimezone(collected.report),\n ),\n ...collected.filterSummary,\n ...collected.contextLines,\n ];\n}\n\n// An exported list cell, reading like the on-screen cell, through the same\n// functions as the screen: a date column renders in the report's zone and\n// locale, and a column with number-format keys (a cross-tab's cells through\n// its cellFormat) in the report's locale and currency. Any other value goes\n// out verbatim, and an empty one as ''. CSV never comes through here: its\n// values stay raw.\n//\n// An output column is written by what it holds, as the screen's cell is\n// (formatOutputValue): a signed change, a percent change, a change of a rate\n// in points, a rank, a share. Its row gives a change the prior beside it, so\n// a missing baseline ('—') reads apart from a zero one ('n/a').\nexport function exportCell(\n value: unknown,\n column: ListColumn & { output?: ListOutputColumn },\n timezone: string,\n context: ReportFormatContext,\n row?: Record<string, unknown> | null,\n): string {\n const output = column.output;\n\n if (output) {\n return formatOutputValue(value, output.output, column, context, {\n measureSpec: output.measureSpec,\n prior: output.priorAlias && row ? row[output.priorAlias] : undefined,\n floor: output.floor,\n empty: '',\n }).text;\n }\n\n if (value === null || value === undefined) {\n return '';\n }\n\n if (column.format === ReportListColumnFormat.Date) {\n return formatReportDate(value, timezone, context.locale);\n }\n\n return hasNumberFormat(column) ? formatNumber(value, column, context, { empty: '' }) : String(value);\n}\n\n// The columns an exported list table draws. A cross-tab's arrive with its\n// rows (the row key first, then one per pivot value), since only the result\n// knows the pivot values, and are built by pivotColumnSpecs() as on screen:\n// headed by its periods in the report's locale, each pivot value formatted by\n// cellFormat. A plain list draws its configured columns but the ones the\n// viewer hid (`hidden`, kept to listHiddenColumns, so never all of them),\n// else every column the query returned, as it came. Output columns (the\n// data's outputs, a cross-tab cell through cellMeasures) carry how they are\n// written; without those keys the columns are exactly as before.\nexport function listColumns(\n component: ReportComponent,\n data: ComponentData,\n locale: ReportLocaleTag,\n hidden: readonly string[] = [],\n): ExportListColumn[] {\n const config = (component.config ?? {}) as ListConfig;\n\n if (config.pivotBy?.column) {\n return withOutputColumns(pivotColumnSpecs(config, data, locale), data, []);\n }\n\n if (config.columns?.length) {\n const hiddenNames = listHiddenColumns(config, hidden);\n\n return withOutputColumns(\n config.columns\n .filter((column) => !hiddenNames.includes(column.column))\n .map((column) => ({ ...column, numeric: hasNumberFormat(column) })),\n data,\n config.columns,\n );\n }\n\n return withOutputColumns(data.columns.map((column) => ({ column, numeric: false })), data, []);\n}\n\n// The columns with their output metadata attached (listOutputColumns, as the\n// screen's list resolves it): an output column holds numbers and is written\n// by what it holds. Unchanged when the data has no outputs.\nfunction withOutputColumns(\n columns: ExportListColumn[],\n data: ComponentData,\n authored: readonly ListColumn[],\n): ExportListColumn[] {\n if (!data.outputs) {\n return columns;\n }\n\n const outputs = listOutputColumns(columns, data, authored);\n\n return columns.map((column) => (outputs[column.column]\n ? { ...column, numeric: true, output: outputs[column.column] }\n : column));\n}\n\n// The heading over each column of listColumns(): a plain list's configured\n// label, else its column; a cross-tab's heading from pivotColumnSpecs().\nexport function listHeadings(\n component: ReportComponent,\n data: ComponentData,\n locale: ReportLocaleTag,\n hidden: readonly string[] = [],\n): string[] {\n return listColumns(component, data, locale, hidden).map((column) => column.label || column.column);\n}\n\n// An exported list's totals row, one cell per column of listColumns(): each\n// total written like its column's cells, and LIST_TOTAL_LABEL in the first\n// column when that column holds no total (a cross-tab's row key). null when\n// the list has no totals. The CSV never carries one: its rows stay raw.\nexport function listTotalsRow(\n data: ComponentData,\n columns: readonly ExportListColumn[],\n timezone: string,\n context: ReportFormatContext,\n): string[] | null {\n const totals = data.totals;\n\n if (!totals) {\n return null;\n }\n\n const label = listTotalsLabelColumn(columns, totals);\n\n return columns.map((column) => (column.column === label\n ? LIST_TOTAL_LABEL\n : exportCell(totals[column.column], column, timezone, context, totals)));\n}\n\n// The subtitle under a chart's or a list's title: the days it reads, and the\n// days each comparison lane reads ('Sep 1 – 15, 2026 · vs previous month:\n// Aug 1 – 15, 2026'), as the screen's note opens with. '' without a\n// comparison or a timeframe, and for a KPI, whose card prints its own window\n// line.\nexport function exportWindowsLine(item: CollectedComponent, timezone: string, locale: ReportLocaleTag): string {\n if (!item.data || item.component.type === 'kpi') {\n return '';\n }\n\n return componentWindowsLine(item.data, { locale, timezone });\n}\n\n// The note lines under a component's box: why a comparison reads as it does,\n// a KPI's delta note, and what each windowed value is and why. The days are\n// left out (the subtitle or the KPI card prints them), and the window\n// descriptions are in, since a file has no tooltip or header to carry them.\n// Empty when the data has none of the keys.\nexport function exportNoteLines(item: CollectedComponent, timezone: string, locale: ReportLocaleTag): string[] {\n return componentNoteLines(item.data, { locale, timezone }, { windows: false, windowDescriptions: true });\n}\n\n// Whether a KPI card has more to draw than its value and label. Without, both\n// exports draw the tile exactly as they always have.\nexport function kpiCardHasExtras(view: KpiCardView, notes: readonly string[]): boolean {\n return !!(view.delta || view.window || view.target || view.sparkline || notes.length);\n}\n\n// Which parts of a KPI card fit a tile `available` tall. A short tile sheds the\n// sparkline first, then the target line, then the notes; the value, its label\n// and the delta row always stay, and the window line stays whenever the card\n// shows a comparison (its days are what the delta is measured over). The\n// sparkline needs values to draw. When what stays is still too tall, every\n// row shrinks by the same scale, down to KPI_EXPORT_MIN_SCALE; by then the\n// sparkline, the target and the notes are gone.\nexport function kpiExportParts(\n view: KpiCardView,\n notes: readonly string[],\n available: number,\n heights: KpiExportHeights,\n): KpiExportParts {\n const parts: KpiExportParts = {\n delta: !!view.delta,\n window: !!view.window,\n target: !!view.target,\n sparkline: !!view.sparkline?.values.some((value) => value !== null),\n notes: [...notes],\n scale: 1,\n };\n const height = () => kpiExportHeight(view, parts, heights);\n\n if (height() > available) {\n parts.sparkline = false;\n }\n\n if (height() > available) {\n parts.target = false;\n }\n\n while (height() > available && parts.notes.length) {\n parts.notes.pop();\n }\n\n if (height() > available && !parts.delta) {\n parts.window = false;\n }\n\n if (height() > available) {\n parts.scale = Math.max(KPI_EXPORT_MIN_SCALE, Math.max(0, available) / height());\n }\n\n return parts;\n}\n\n// The heights scaled by the parts' scale: what the renderer lays the card\n// out with, its text sized by the same scale.\nexport function scaledKpiHeights(heights: KpiExportHeights, scale: number): KpiExportHeights {\n return {\n value: heights.value * scale,\n label: heights.label * scale,\n delta: heights.delta * scale,\n window: heights.window * scale,\n target: heights.target * scale,\n sparkline: heights.sparkline * scale,\n note: heights.note * scale,\n };\n}\n\n// How tall the card's drawn parts stand together, in the heights' unit.\nexport function kpiExportHeight(view: KpiCardView, parts: KpiExportParts, heights: KpiExportHeights): number {\n return heights.value\n + (view.label ? heights.label : 0)\n + (parts.delta ? heights.delta : 0)\n + (parts.window ? heights.window : 0)\n + (parts.target ? heights.target : 0)\n + (parts.sparkline ? heights.sparkline : 0)\n + parts.notes.length * heights.note;\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, or whose text shows a value that came back without its number, then\n// HEADER_FOOTER_NAME when the header or footer shows one on a page that shows\n// the master — what the failure gate names to the user, and what makes \"some\n// of this file is missing\" a fact the caller can act on rather than a thing\n// they notice 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 const names = collected.pages\n .map((page, index) => ({ page, number: index + 1 }))\n .filter(({ page }) => page.components.some(isFailed)\n || showsFailedValue(page.components.map((item) => item.component), page.failedValues))\n .map(({ page, number }) => page.page.name || `Page ${number}`);\n const master = collected.report.master;\n const showsMaster = collected.pages.some(({ page }) => !page.masterHidden);\n\n if (master && showsMaster && showsFailedValue(master.components, collected.masterFailedValues)) {\n names.push(HEADER_FOOTER_NAME);\n }\n\n return names;\n}\n\n// Whether any of the text blocks shows one of the failed value keys.\nfunction showsFailedValue(components: ReportComponent[], failed: readonly string[]): boolean {\n const shown = new Set(components\n .filter((component) => component.type === 'text')\n .flatMap((component) => valueKeys(component.config?.html)));\n\n return failed.some((key) => shown.has(key));\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), and the numbers of the values their text reads, fetched fresh with\n// the viewer's current filter state.\n//\n// A failed component resolves to a null `data`, and a failed value to a key in\n// its page's failedValues, rather than failing the whole collection — but that\n// is so the caller can REPORT what failed, not so it can be ignored: see\n// failedPageNames() and the failure 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 jobs = this._jobs(report);\n const formatContext = this._filterState.formatContext();\n\n // Released a few at a time rather than all at once, a page's values in the\n // same queue as the tiles, so they never add to the queries already\n // running. mergeMap completes out of order, so each result carries the job\n // it came from and the rows are filed by index — the deck's page order\n // can't depend on which query happened to finish first.\n const all$ = jobs.length\n ? from(jobs.map((job, index) => ({ job, index })))\n .pipe(\n mergeMap(\n ({ job, index }) => this._runJob(report, job, listRows, formatContext)\n .pipe(map((result) => ({ result, index }))),\n EXPORT_CONCURRENCY,\n ),\n toArray(),\n )\n : of([] as { result: CollectResult; 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 report,\n ...this._file(report, collected, formatContext),\n filterSummary,\n contextLines: this._contextLines(report),\n formatContext,\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. Dates are\n // written in the report's locale, so the notes name the period as the cover\n // does.\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 // Every request the export makes, in page order: each page's tiles, then the\n // values its text shows; the header and footer's values last, when some page\n // shows the master. Text blocks have nothing to fetch of their own — they\n // ride through with no data, and their tokens are filled from their layer's\n // values. A value is read only through its layer's request, never as a tile.\n // The header/footer blocks (report.master) are read by the renderers\n // straight off the report.\n private _jobs(report: Report): CollectJob[] {\n const jobs: CollectJob[] = [];\n\n report.pages.forEach((page, pageIndex) => {\n page.components\n .filter(isDrawn)\n .forEach((component) => jobs.push({ kind: 'component', pageIndex, component }));\n jobs.push(...this._valuesJobs(page, pageIndex));\n });\n\n if (report.master && report.pages.some((page) => !page.masterHidden)) {\n jobs.push(...this._valuesJobs(report.master, null));\n }\n\n return jobs;\n }\n\n // A layer's one values job, or none when its text shows no value.\n private _valuesJobs(layer: ReportPage | ReportMaster, pageIndex: number | null): CollectJob[] {\n const texts = layer.components.filter((component) => component.type === 'text');\n const values = layer.values ?? [];\n const shown = shownValues(values, texts);\n\n return shown.length\n ? [{ kind: 'values', pageIndex, pageId: layer.id, values, components: shown }]\n : [];\n }\n\n // One queued job, its result tagged with the page it is filed under.\n private _runJob(\n report: Report,\n job: CollectJob,\n listRows: number,\n formatContext: ReportFormatContext,\n ): Observable<CollectResult> {\n if (job.kind === 'component') {\n return this._componentData(report, job.component, listRows)\n .pipe(map((item): CollectResult => ({ kind: 'component', pageIndex: job.pageIndex, item })));\n }\n\n return this._pageValues(report, job.pageId, job.values, job.components, formatContext)\n .pipe(map((collected): CollectResult => ({ kind: 'values', pageIndex: job.pageIndex, collected })));\n }\n\n private _componentData(report: Report, component: ReportComponent, listRows: number): Observable<CollectedComponent> {\n if (component.type === 'text') {\n return of({ component, data: null, hiddenColumns: [] });\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 and search, so the table reads in the\n // screen's order and holds the screen's rows.\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 search = component.type === 'list'\n ? this._filterState.listSearch(component.id) ?? undefined\n : undefined;\n const state: ComponentDataState = component.type === 'list'\n ? { page: 1, pageSize: listRows, sort: this._filterState.listSort(component.id) ?? undefined, search }\n : (isTimeSeries && frequency ? { frequency } : {});\n // The table leaves out the columns the viewer hid. The rows are fetched\n // whole, as the screen fetches them, and the renderers drop the cells.\n const hiddenColumns = [...this._filterState.hiddenColumns(component.id)];\n\n // handlers: false keeps the app's global error dialog out of this. A failed\n // tile is reported once, by the failure gate, naming the pages it cost —\n // never as ten stacked modals carrying the database's own wording.\n //\n // A search the server could not apply (searchNote: the list has no text\n // column) narrowed nothing, so the item does not carry it.\n return this._reportData.componentData(report.id, component.id, filters, state, true, { handlers: false })\n .pipe(\n map((data: ComponentData): CollectedComponent => (search && !data?.searchNote\n ? { component, data, search, hiddenColumns }\n : { component, data, hiddenColumns })),\n catchError(() => of({ component, data: null, hiddenColumns })),\n );\n }\n\n // One layer's values, read in one request, as its text's tokens print them.\n // The request carries the filter values of every value on the layer, as the\n // canvas's does: the server decides which values it reads (the shown ones\n // and the operands of the formulas among them) and applies to each only the\n // entries naming its own filters. handlers: false keeps the error dialog out\n // of it, as for a tile. A failed request reads as no rows, so every value\n // the text shows failed and the failure gate names its page; one value's\n // own error fails only that value, and a failed operand fails the formula\n // that reads it.\n private _pageValues(\n report: Report,\n pageId: number,\n values: ReportComponent[],\n shown: ReportComponent[],\n formatContext: ReportFormatContext,\n ): Observable<CollectedValues> {\n const filters = values.flatMap((component) => this._filterState.resolveForComponent(component));\n\n return this._reportData.pageValues(report.id, pageId, filters, true, { handlers: false })\n .pipe(\n map((rows) => new Map((rows ?? []).map((row) => [row.id, row]))),\n catchError(() => of(new Map<number, ReportPageValue>())),\n map((rows) => ({\n values: textValues(values, { rows }, formatContext),\n failedValues: failedValueKeys(shown, rows),\n })),\n );\n }\n\n // The results filed by page in job order. A layer with no values job (its\n // text shows no value) has no numbers to wait for: its values read as the\n // em dash, and none of them failed.\n private _file(\n report: Report,\n results: { result: CollectResult; index: number }[],\n formatContext: ReportFormatContext,\n ): Pick<CollectedReport, 'pages' | 'masterValues' | 'masterFailedValues'> {\n const unread = (values: ReportComponent[] | undefined): CollectedValues => ({\n values: textValues(values ?? [], { rows: new Map() }, formatContext),\n failedValues: [],\n });\n const pages: CollectedPage[] = report.pages.map((page) => ({ page, components: [], ...unread(page.values) }));\n let master = unread(report.master?.values);\n\n [...results]\n .sort((a, b) => a.index - b.index)\n .forEach(({ result }) => {\n if (result.kind === 'component') {\n pages[result.pageIndex].components.push(result.item);\n } else if (result.pageIndex === null) {\n master = result.collected;\n } else {\n Object.assign(pages[result.pageIndex], result.collected);\n }\n });\n\n return { pages, masterValues: master.values, masterFailedValues: master.failedValues };\n }\n\n // The zone the server resolved, as its IANA id, and the currency it says\n // the report's money is in (a label: nothing is converted). Only the\n // server's values are printed: the browser's zone (resolveReportTimezone's\n // fallback for an older server) is not what the numbers were measured in,\n // and an older server names no currency at all.\n private _contextLines(report: Report): string[] {\n return [\n ...(report.effectiveTimezone ? [`Timezone: ${report.effectiveTimezone}`] : []),\n ...(report.effectiveCurrency ? [`Currency: ${report.effectiveCurrency}`] : []),\n ];\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, this._filterState.formatContext().locale) ?? '…';\n }\n}\n","import { ComponentData, ReportComponent, ReportFormatContext } 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. Its numbers and periods are written\n// in the report's format context, as on screen.\nexport async function renderChartImage(\n component: ReportComponent,\n data: ComponentData,\n width: number,\n height: number,\n context: ReportFormatContext,\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, context),\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 {\n ApplicationRef, ComponentRef, EnvironmentInjector, Injectable, Injector, afterNextRender, createComponent, inject,\n} from '@angular/core';\n\nimport { ComponentTextComponent } from '../components/component-text/component-text.component';\nimport { PX_PER_INCH } from '../components/report-canvas/report-canvas.component';\nimport { ReportComponent } from '../interfaces/report.interface';\nimport { componentPaddingCss } from '../layout';\nimport { TextTokenContext, fillTextTokens, parseTable, splitAtTables } from '../text';\n\n\n// Where a stretch of a block's words sits: the top of its first line and the\n// bottom of its last.\nexport interface TextSegmentLayout {\n top: number;\n bottom: number;\n}\n\n// Where a table sits in its block, and how tall its rows and how wide its\n// columns are.\nexport interface TextTableLayout {\n top: number;\n left: number;\n width: number;\n height: number;\n // A row's height, in the order textBlocks lists the rows: the head first and\n // the foot last.\n rowHeights: number[];\n // A grid column's width (tableGrid), left to right. Together they are the\n // table's width.\n columnWidths: number[];\n}\n\n// A text block as the canvas lays it out. Everything is in inches, measured\n// from the top left of the block's content box (inside its padding).\nexport interface TextBlockLayout {\n contentWidth: number;\n contentHeight: number;\n // How far down the block's words and tables reach.\n usedHeight: number;\n // They reach past the bottom of the box, where the canvas cuts them off.\n overflow: boolean;\n // One per text part of textBlocks, in order: null for a part that draws\n // nothing.\n segments: (TextSegmentLayout | null)[];\n // One per table part of textBlocks, in order.\n tables: TextTableLayout[];\n}\n\n// How far past the bottom of its box a block may reach and still fit: two\n// pixels, so the rounding of the last line's edge never counts as overflow.\n// The deck keeps a table's row on the same terms.\nexport const OVERFLOW_SLACK = 2 / PX_PER_INCH;\n\n// Where the canvas puts each part of a text block, for the exports. A\n// browser wraps the words and sizes a table's columns by its own layout, which\n// neither jsPDF nor PowerPoint reproduces. So the block is rendered offscreen\n// with the canvas's own component, at the canvas's 96px per inch and unscaled,\n// and the exports place what they draw where it sat: a table at its top, in\n// its column widths and row heights, and the words between tables at theirs.\n// It also tells whether the block runs past the bottom of its box.\n//\n// Provided beside the export services, so the block renders under the same\n// injector the canvas's blocks do.\n@Injectable()\nexport class ReportTextLayoutService {\n\n private readonly _appRef = inject(ApplicationRef);\n private readonly _environmentInjector = inject(EnvironmentInjector);\n private readonly _injector = inject(Injector);\n private readonly _layouts = new Map<string, Promise<TextBlockLayout>>();\n\n // A block is measured once per size, padding and filled html: an export that\n // draws it twice, or a second export with the same numbers, reads the same\n // layout, which nothing changes.\n public async measure(component: ReportComponent, tokens: TextTokenContext): Promise<TextBlockLayout> {\n const html = component.config?.html ?? '';\n const key = [\n component.id,\n component.w,\n component.h,\n JSON.stringify(component.config?.padding ?? null),\n fillTextTokens(html, tokens),\n ].join('|');\n\n let layout = this._layouts.get(key);\n if (!layout) {\n layout = this._render(component, html, tokens);\n this._layouts.set(key, layout);\n // A measure that failed is tried again next time.\n layout.catch(() => this._layouts.delete(key));\n }\n\n return layout;\n }\n\n private async _render(component: ReportComponent, html: string, tokens: TextTokenContext): Promise<TextBlockLayout> {\n const text = createComponent(ComponentTextComponent, {\n environmentInjector: this._environmentInjector,\n elementInjector: this._injector,\n });\n const box = blockBox(component, text.location.nativeElement);\n\n try {\n text.setInput('html', html);\n text.setInput('tokens', tokens);\n text.setInput('editing', false);\n document.body.append(box);\n await this._rendered(text);\n // Laid out first, so a font the words ask for is loading by the time\n // fonts.ready is read.\n box.getBoundingClientRect();\n await document.fonts.ready;\n\n return measureBlock(text.location.nativeElement.querySelector('.text-content'));\n } finally {\n // Destroying the block also takes it off the application.\n text.destroy();\n box.remove();\n }\n }\n\n // The block is rendered by the application's own change detection, as any\n // view attached to it: its inputs mark it for the next render, which draws\n // it before the callback runs. Not whenStable(): that also waits out\n // whatever else the host app has under way (its requests and, under\n // zone.js, its timers), and never resolves while a timer repeats.\n private _rendered(text: ComponentRef<ComponentTextComponent>): Promise<void> {\n return new Promise((resolve) => {\n afterNextRender(() => resolve(), { injector: this._environmentInjector });\n this._appRef.attachView(text.hostView);\n });\n }\n}\n\n// The block's box as the canvas draws it (the component box): its size, a\n// 1px border and the block's padding (componentPaddingCss) around a body the\n// text fills. Fixed far off to the left, and hidden, so it is never seen.\nfunction blockBox(component: ReportComponent, text: HTMLElement): HTMLElement {\n const box = document.createElement('div');\n const body = document.createElement('div');\n\n Object.assign(box.style, {\n position: 'fixed',\n left: '-10000px',\n top: '0',\n visibility: 'hidden',\n width: `${component.w * PX_PER_INCH}px`,\n height: `${component.h * PX_PER_INCH}px`,\n boxSizing: 'border-box',\n border: '1px solid transparent',\n padding: componentPaddingCss(component),\n });\n body.style.height = '100%';\n body.append(text);\n box.append(body);\n\n return box;\n}\n\n// Split the rendered block at its tables, as textBlocks splits the same html,\n// so the nth segment is the nth text part and the nth table the nth table\n// part. How far the block reaches is the bottom of its last part that draws\n// anything.\nfunction measureBlock(content: HTMLElement): TextBlockLayout {\n const box = content.getBoundingClientRect();\n const parts = splitAtTables(content);\n const segments: (TextSegmentLayout | null)[] = [];\n const tables: TextTableLayout[] = [];\n let usedHeight = 0;\n\n parts.forEach((part, index) => {\n if (Array.isArray(part)) {\n const segment = measureSegment(drawnNodes(part, index === parts.length - 1), box);\n segments.push(segment);\n usedHeight = segment?.bottom ?? usedHeight;\n } else {\n const table = measureTable(part, box);\n tables.push(table);\n usedHeight = table.top + table.height;\n }\n });\n\n const contentHeight = inches(box.height);\n\n return {\n contentWidth: inches(box.width),\n contentHeight,\n usedHeight,\n overflow: usedHeight > contentHeight + OVERFLOW_SLACK,\n segments,\n tables,\n };\n}\n\n// The nodes of a run between tables that the exports draw. Whitespace between\n// blocks draws nothing anywhere. A blank line at the start of a block is\n// drawn, on the canvas and by textBlocks alike, but textBlocks drops the blank\n// lines at the very end of a block, so they are not measured either: a\n// trailing empty paragraph never makes a block overflow.\nfunction drawnNodes(nodes: Node[], blockEnd: boolean): Node[] {\n const skipsLast = blockEnd ? isBlank : isVoid;\n let start = 0;\n let end = nodes.length;\n\n while (start < end && isVoid(nodes[start])) {\n start++;\n }\n while (end > start && skipsLast(nodes[end - 1])) {\n end--;\n }\n\n const drawn = nodes.slice(start, end);\n if (blockEnd && drawn.length) {\n trimBlankLines(drawn[drawn.length - 1]);\n }\n\n return drawn;\n}\n\n// Take the blank lines off the end of the block's last node, as textBlocks\n// drops them: the elements that hold no text after its last words, down its\n// last children — the <br>s of <p>b<br><br></p>, a list's empty last item.\n// Whitespace is passed over and left, so a paragraph never turns into an\n// empty one, which the canvas draws as a line. The block is the measure's own\n// copy, thrown away once measured, and nothing above what is taken off moves.\nfunction trimBlankLines(node: Node): void {\n let child = node.lastChild;\n while (child && isBlank(child)) {\n const previous = child.previousSibling;\n if (!isVoid(child)) {\n child.remove();\n }\n child = previous;\n }\n\n if (child) {\n trimBlankLines(child);\n }\n}\n\n// Whitespace between blocks, or a comment.\nfunction isVoid(node: Node): boolean {\n return node.nodeType === Node.TEXT_NODE\n ? !/[^ \\t\\n\\r\\f]/.test(node.textContent ?? '')\n : node.nodeType !== Node.ELEMENT_NODE;\n}\n\n// A node that draws no words: whitespace, or an element with no text in it,\n// such as the empty line <p><br></p>.\nfunction isBlank(node: Node): boolean {\n return isVoid(node) || !node.textContent;\n}\n\n// From before its first node to after its last. null for a run that draws\n// nothing.\nfunction measureSegment(nodes: Node[], box: DOMRect): TextSegmentLayout | null {\n if (!nodes.length) {\n return null;\n }\n\n const range = document.createRange();\n range.setStartBefore(nodes[0]);\n range.setEndAfter(nodes[nodes.length - 1]);\n const rect = range.getBoundingClientRect();\n\n return { top: inches(rect.top - box.top), bottom: inches(rect.bottom - box.top) };\n}\n\nfunction measureTable(table: HTMLTableElement, box: DOMRect): TextTableLayout {\n const rect = table.getBoundingClientRect();\n\n return {\n top: inches(rect.top - box.top),\n left: inches(rect.left - box.left),\n width: inches(rect.width),\n height: inches(rect.height),\n rowHeights: Array.from(table.rows, (row) => inches(row.getBoundingClientRect().height)),\n columnWidths: columnWidths(table, rect.width).map(inches),\n };\n}\n\n// A grid column is as wide as a cell that spans only it. A column that only\n// spanning cells cross shares what the others leave of the table's width, and\n// all of them are scaled to add up to it exactly. The cells come in the same\n// order as the grid's (parseTable reads the same rows), so the nth cell of a\n// row is the nth cell of that grid row.\nfunction columnWidths(table: HTMLTableElement, width: number): number[] {\n const grid = parseTable(table);\n const widths: (number | null)[] = Array.from({ length: grid.columns }, () => null);\n\n grid.rows.forEach((row, rowIndex) => row.cells.forEach((cell, cellIndex) => {\n if (cell.colSpan === 1 && widths[cell.column] === null) {\n widths[cell.column] = table.rows[rowIndex].cells[cellIndex].getBoundingClientRect().width;\n }\n }));\n\n const known = widths.filter((value): value is number => value !== null);\n const share = Math.max(0, width - sum(known)) / Math.max(1, widths.length - known.length);\n const filled = widths.map((value) => value ?? share);\n const total = sum(filled);\n\n return filled.map((value) => total ? value * width / total : width / filled.length);\n}\n\nfunction sum(values: number[]): number {\n return values.reduce((total, value) => total + value, 0);\n}\n\nfunction inches(pixels: number): number {\n return pixels / PX_PER_INCH;\n}\n","import { Injectable, inject } from '@angular/core';\n\nimport { ReportKpiTrend } from '../enums/report-kpi-trend.enum';\nimport { resolveReportTimezone } from '../format';\nimport {\n ComponentData,\n KpiConfig,\n Report,\n ReportComponent,\n ReportFormatContext,\n ReportHeaderFooter,\n ReportPage,\n} from '../interfaces/report.interface';\nimport {\n KpiCardDelta, KpiCardTarget, KpiSparklinePoint, kpiCardView, kpiSparklineGeometry,\n} from '../kpi-card';\nimport { DEFAULT_COMPONENT_PADDING } from '../layout';\nimport {\n DEFAULT_TEXT_COLOR, DEFAULT_TEXT_SIZE, TEXT_TABLE_BORDER_COLOR, TEXT_TABLE_BORDER_WIDTH, TEXT_TABLE_CELL_PADDING,\n TEXT_TABLE_MARGIN, TextParagraph, TextRun, TextTable, TextTableCell, TextTokenContext, TextValue, textBlocks,\n} from '../text';\nimport {\n REPORT_KPI_CHANGE_COLORS, REPORT_KPI_SPARKLINE_COLOR, REPORT_KPI_TRACK_COLOR, REPORT_MUTED_TEXT_COLOR,\n} from '../theme/palette';\nimport { isDrawn } from '../values';\nimport { renderChartImage } from './offscreen-chart';\nimport {\n BuiltExport, CollectedComponent, CollectedPage, CollectedReport, HEADER_FOOTER_NAME, KpiExportHeights, TextOverflow,\n coverLines, emptyLabel, exportCell, exportNoteLines, exportTitle, exportWindowsLine, kpiCardHasExtras,\n kpiExportHeight, kpiExportParts, listColumns, listHeadings, listTotalsRow, moreRowsNotice, scaledKpiHeights,\n textOverflow,\n} from './report-export-collector.service';\nimport { ReportTextLayoutService, TextTableLayout } from './report-text-layout.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// The small print a component may carry, points: the days it reads under its\n// title (a subtitle line), its notes at the foot of its box (a line each), and\n// the lines of a KPI card under its value. A chart's or a list's notes give\n// way before its body would shrink under MIN_BODY_H.\nconst SMALL_SIZE = 7.5;\nconst SUBTITLE_H = 11;\nconst NOTE_LINE_H = 10;\nconst MIN_BODY_H = 40;\nconst MUTED_COLOR = `#${REPORT_MUTED_TEXT_COLOR}`;\n\n// A KPI card's parts, top to bottom, points (kpiExportParts sheds the\n// sparkline, then the target, then the notes on a short tile). The value's\n// baseline sits KPI_VALUE_BASELINE under its top.\nconst KPI_HEIGHTS: KpiExportHeights = {\n value: 30,\n label: 13,\n delta: 13,\n window: NOTE_LINE_H,\n target: NOTE_LINE_H + 6,\n sparkline: 28,\n note: NOTE_LINE_H,\n};\nconst KPI_VALUE_BASELINE = 23;\nconst KPI_DELTA_SIZE = 9;\n// The delta's triangle: its side, and the gap before the change.\nconst KPI_ARROW = 6;\nconst KPI_ARROW_GAP = 3;\n// The target's progress bar, and the track it fills.\nconst KPI_BAR_W = 120;\nconst KPI_BAR_H = 3;\nconst KPI_TRACK_COLOR = `#${REPORT_KPI_TRACK_COLOR}`;\n// The sparkline's widest box, its top and bottom inset, and its dots' radius.\nconst KPI_SPARKLINE_W = 140;\nconst KPI_SPARKLINE_INSET = 3;\nconst KPI_DOT_R = 1.5;\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 the export's overflow gate says the PDF does with a text block that does\n// not fit its box.\nconst PDF_OVERFLOW_NOTE = 'The PDF cuts it off at the bottom of its box.';\n\n// What every drawing step of one export shares, built once in build().\n// Sizes are points.\ninterface PdfExportContext {\n doc: any;\n autoTable: any;\n jsPDF: any;\n report: Report;\n timezone: string;\n formatContext: ReportFormatContext;\n pageW: number;\n pageH: number;\n orientation: 'landscape' | 'portrait';\n // What the header and footer's value tokens fill with, the same on every\n // page, continuation pages included (_pdfValues).\n masterValues: Record<string, TextValue>;\n // The text blocks cut off at the bottom of their box, by component id, so a\n // header or footer block cut on every page is listed once.\n textOverflows: Map<number, TextOverflow>;\n}\n\n// A word of a wrapped line (_wrap): its run, its text with any trailing space,\n// its font size and its width, points.\ninterface PdfWord {\n run: TextRun;\n text: string;\n size: number;\n width: number;\n}\n\n// Where a text block's words are drawn, points: the left edge and width they\n// wrap to, the top of the first line, and the bottom no line may run past. A\n// text table's cell draws its words the same way, inside its padding.\ninterface PdfTextBox {\n left: number;\n top: number;\n width: number;\n bottom: number;\n}\n\n// Where the next part of a text block starts, and whether the part just drawn\n// was cut off at the bottom of its box.\ninterface PdfTextCursor {\n cursorY: number;\n cut: boolean;\n}\n\n// A text table's cell as autoTable takes it. It prints no text of its own: the\n// cell's words (textCell) are drawn into it once its grid lines and fill are\n// (_drawTextCell).\ninterface PdfTextCellInput {\n content: string;\n colSpan: number;\n rowSpan: number;\n textCell: TextTableCell;\n styles: Record<string, unknown>;\n}\n\n// Fixed column widths, by column index, in points, and the right alignment of\n// a column of formatted numbers.\ntype PdfColumnStyles = Record<number, { cellWidth: number; halign?: 'right' }>;\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 and alignments are the ones the on-page table was drawn with,\n// so the table reads as one across pages.\ninterface PdfTableOverflow {\n component: ReportComponent;\n // The text the list was searched by, for the continuation title.\n search?: string;\n head: string[];\n numeric: boolean[];\n rows: string[][];\n omitted: number;\n // The list's totals row, which closes the last continuation page.\n foot: string[] | null;\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//\n// A text block's tables are drawn by autoTable too, from the line its words\n// reach, in the column widths the canvas gives them (ReportTextLayoutService).\n// A text block is cut at the bottom of its box, as the canvas clips it, and\n// build() hands the file back unsaved with the blocks it cut, so the export\n// can ask about them before it saves.\n@Injectable()\nexport class ReportPdfService {\n\n private readonly _textLayout = inject(ReportTextLayoutService);\n\n public async build(collected: CollectedReport): Promise<BuiltExport> {\n const context = await this._context(collected);\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 = await this._renderContinuation(context, collectedPage.page, index, pageNumber, overflow);\n }\n }\n\n return {\n overflows: [...context.textOverflows.values()],\n overflowNote: PDF_OVERFLOW_NOTE,\n save: () => {\n context.doc.save(`${this._slug(collected.report.name)}.pdf`);\n },\n };\n }\n\n private async _context(collected: CollectedReport): Promise<PdfExportContext> {\n const report = collected.report;\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 formatContext: collected.formatContext,\n pageW,\n pageH,\n orientation,\n masterValues: this._pdfValues(collected.masterValues),\n textOverflows: new Map(),\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. The page's text fills its value tokens with the page's values.\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 tokens = this._tokens(report, collectedPage.page, index, pageNumber);\n const pageTokens = { ...tokens, values: this._pdfValues(collectedPage.values) };\n\n doc.addPage([context.pageW, context.pageH], context.orientation);\n await this._renderMaster(context, collectedPage.page, tokens);\n\n for (const item of collectedPage.components) {\n if (item.component.type !== 'text') {\n await this._renderComponent(context, item, overflows);\n } else if (await this._renderText(context, item.component, pageTokens)) {\n this._recordOverflow(context, item.component, tokens.pageName, pageTokens);\n }\n }\n }\n\n // The header and footer, their value tokens filled with the master's values\n // whichever page they sit on: a report page or a continuation page.\n private async _renderMaster(context: PdfExportContext, page: ReportPage, tokens: TextTokenContext): Promise<void> {\n if (page.masterHidden) {\n return;\n }\n\n const masterTokens = { ...tokens, values: context.masterValues };\n\n for (const component of (context.report.master?.components ?? []).filter(isDrawn)) {\n if (await this._renderText(context, component, masterTokens)) {\n this._recordOverflow(context, component, HEADER_FOOTER_NAME, masterTokens);\n }\n }\n }\n\n // Lists a text block that was cut, under the page the export's overflow gate\n // names it by. A block cut again on a later page (a header or footer) keeps\n // the first entry.\n private _recordOverflow(\n context: PdfExportContext,\n component: ReportComponent,\n page: string,\n tokens: TextTokenContext,\n ): void {\n if (!context.textOverflows.has(component.id)) {\n context.textOverflows.set(component.id, textOverflow(component, page, 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).map((line) => this._pdfText(line)), 40, pageH * 0.35 + 26);\n }\n\n // A text block, laid out by hand: jsPDF draws strings, not rich text, so the\n // words between its tables are drawn line by line (_drawParagraphs) and each\n // table by autoTable from the line the words above it reach\n // (_drawTextTable). Only a block with a table is measured, for the edges\n // and column widths the canvas gives its tables. Whatever runs past\n // the block's height is left off — the canvas clips the block there too.\n // Returns whether anything was.\n private async _renderText(\n context: PdfExportContext,\n component: ReportComponent,\n tokens: TextTokenContext,\n ): Promise<boolean> {\n const box = this._textBox(component);\n const blocks = textBlocks(component.config?.html ?? '', tokens);\n const layout = blocks.some((block) => block.kind === 'table')\n ? await this._textLayout.measure(component, tokens)\n : null;\n let cursorY = box.top;\n let tableIndex = 0;\n // The cursor sits on a table's bottom margin, nothing drawn since: the\n // next table's top margin is the same space, as two block margins that\n // meet collapse into one on the canvas.\n let onMargin = false;\n\n for (const block of blocks) {\n const drawn = block.kind === 'text'\n ? this._drawParagraphs(context.doc, block.paragraphs, box, cursorY)\n : this._drawTextTable(\n context, block.table, layout?.tables[tableIndex++] ?? null, box,\n onMargin ? cursorY : cursorY + TEXT_TABLE_MARGIN,\n );\n\n if (drawn.cut) {\n return true;\n }\n\n cursorY = drawn.cursorY;\n onMargin = block.kind === 'table' || (onMargin && !block.paragraphs.length);\n }\n\n return false;\n }\n\n // Where a text block's words go: inside its padding, each edge 1/8\" unless\n // set.\n private _textBox(component: ReportComponent): PdfTextBox {\n const padding = component.config?.padding;\n const inset = (value: number | undefined) => (value ?? DEFAULT_COMPONENT_PADDING) * PT;\n\n return {\n left: component.x * PT + inset(padding?.left),\n top: component.y * PT + inset(padding?.top),\n width: component.w * PT - inset(padding?.left) - inset(padding?.right),\n bottom: (component.y + component.h) * PT - inset(padding?.bottom),\n };\n }\n\n // Paragraphs drawn line by line from cursorY down: each one's runs are broken\n // into words, wrapped to the box's width and drawn word by word in their own\n // font, size and color, a list item's marker hung in its indent. The first\n // line that would run past the box's bottom ends the drawing, cut.\n private _drawParagraphs(doc: any, paragraphs: TextParagraph[], box: PdfTextBox, cursorY: number): PdfTextCursor {\n let y = cursorY;\n let listNumber = 0;\n\n for (const paragraph of paragraphs) {\n listNumber = paragraph.bullet === 'number' ? listNumber + 1 : 0;\n const indent = paragraph.bullet ? LIST_INDENT : 0;\n const lines = this._wrap(doc, paragraph, box.width - indent);\n\n for (const [lineIndex, line] of lines.entries()) {\n const size = this._lineSize(paragraph, line);\n if (y + size * TEXT_LINE_HEIGHT > box.bottom + 0.5) {\n return { cursorY: y, cut: true };\n }\n\n if (lineIndex === 0 && paragraph.bullet) {\n this._font(doc, line[0]?.run ?? { text: '' }, size);\n doc.text(paragraph.bullet === 'number' ? `${listNumber}.` : '•', box.left, y + size);\n }\n\n this._drawLine(doc, line, paragraph.align, box.left + indent, box.width - indent, y + size);\n y += size * TEXT_LINE_HEIGHT;\n }\n\n // An empty paragraph is still a line.\n if (!lines.length) {\n y += DEFAULT_TEXT_SIZE * TEXT_LINE_HEIGHT;\n }\n }\n\n return { cursorY: y, cut: false };\n }\n\n // How far _drawParagraphs takes its cursor down drawing the paragraphs whole\n // at a width.\n private _paragraphsHeight(doc: any, paragraphs: TextParagraph[], width: number): number {\n return paragraphs.reduce((height, paragraph) => {\n const lines = this._wrap(doc, paragraph, width - (paragraph.bullet ? LIST_INDENT : 0));\n\n return height + (lines.length\n ? lines.reduce((sum, line) => sum + this._lineSize(paragraph, line) * TEXT_LINE_HEIGHT, 0)\n : DEFAULT_TEXT_SIZE * TEXT_LINE_HEIGHT);\n }, 0);\n }\n\n // A line's font size: its largest word's, and never under its paragraph's\n // first run's.\n private _lineSize(paragraph: TextParagraph, line: PdfWord[]): number {\n return Math.max(...line.map((word) => word.size), paragraph.runs[0]?.fontSize ?? DEFAULT_TEXT_SIZE);\n }\n\n // One wrapped line on its baseline, aligned within the width from left.\n private _drawLine(\n doc: any,\n line: PdfWord[],\n align: TextParagraph['align'],\n left: number, width: number, baseline: number,\n ): void {\n const lineWidth = line.reduce((sum, word) => sum + word.width, 0);\n let x = left + this._alignOffset(align, width, lineWidth);\n\n for (const word of line) {\n this._drawWord(doc, word, x, baseline);\n x += word.width;\n }\n }\n\n // A table in a text block, drawn by autoTable from top (_renderText puts it\n // TEXT_TABLE_MARGIN under the line the words above it reach), in the one\n // look every renderer draws (TEXT_TABLE_* in text.ts). Its left edge, width\n // and column widths are the canvas's (layout), else the box's width split\n // evenly. A row is as tall as its cells' words wrapped as _drawParagraphs\n // wraps them, and the words are drawn into each cell once autoTable has\n // drawn its grid lines and fill (_drawTextCell), so they keep their runs'\n // fonts and colors. Only the rows the box holds are drawn, and a table that\n // loses any is cut. The cursor it leaves is TEXT_TABLE_MARGIN under it.\n private _drawTextTable(\n context: PdfExportContext,\n table: TextTable,\n layout: TextTableLayout | null,\n box: PdfTextBox,\n top: number,\n ): PdfTextCursor {\n if (top >= box.bottom) {\n return { cursorY: top, cut: true };\n }\n\n const left = box.left + (layout?.left ?? 0) * PT;\n const width = layout ? layout.width * PT : box.width;\n const columnWidths = layout?.columnWidths.length === table.columns\n ? layout.columnWidths.map((columnWidth) => columnWidth * PT)\n : Array.from({ length: table.columns }, () => width / table.columns);\n const body = table.rows.map((row) => row.cells.map((cell) => this._textCellInput(context.doc, cell, columnWidths)));\n const options = this._textTableOptions(context, columnWidths, left, top, width, box.bottom);\n const fit = this._textTableFit(context, { ...options, body });\n\n if (fit) {\n this._drawTable(context, { ...options, body: this._keptRows(body, fit) });\n }\n\n return {\n cursorY: fit ? context.doc.lastAutoTable.finalY + TEXT_TABLE_MARGIN : top,\n cut: fit < table.rows.length,\n };\n }\n\n // A text table's cell as autoTable takes it: its spans and fill and, when it\n // is one row tall, the height its words need at the width it spans. A cell\n // that spans rows shares theirs.\n private _textCellInput(doc: any, cell: TextTableCell, columnWidths: number[]): PdfTextCellInput {\n const padding = TEXT_TABLE_CELL_PADDING;\n const width = columnWidths\n .slice(cell.column, cell.column + cell.colSpan)\n .reduce((sum, columnWidth) => sum + columnWidth, 0) - 2 * padding.horizontal;\n\n return {\n content: '',\n colSpan: cell.colSpan,\n rowSpan: cell.rowSpan,\n textCell: cell,\n styles: {\n ...(cell.fill ? { fillColor: cell.fill } : {}),\n ...(cell.rowSpan === 1\n ? { minCellHeight: this._paragraphsHeight(doc, cell.paragraphs, width) + 2 * padding.vertical }\n : {}),\n },\n };\n }\n\n // The autoTable options a text table's dry run and its draw share. Every\n // column is listed and fixed at its width: autoTable would otherwise count\n // the columns of the first row, which may be narrower than the grid. A row\n // is never split at the box's bottom: it fits whole or moves past it. bottom\n // is the box's.\n private _textTableOptions(\n context: PdfExportContext,\n columnWidths: number[],\n left: number, top: number, width: number, bottom: number,\n ): Record<string, unknown> {\n const padding = TEXT_TABLE_CELL_PADDING;\n\n return {\n theme: 'plain',\n columns: columnWidths.map((_, index) => ({ dataKey: index })),\n startY: top,\n margin: { left, right: context.pageW - left - width, bottom: context.pageH - bottom },\n tableWidth: width,\n columnStyles: Object.fromEntries(columnWidths.map((cellWidth, index) => [index, { cellWidth }])),\n rowPageBreak: 'avoid',\n styles: {\n font: 'helvetica',\n fontStyle: 'normal',\n fontSize: DEFAULT_TEXT_SIZE,\n cellPadding: {\n top: padding.vertical, right: padding.horizontal, bottom: padding.vertical, left: padding.horizontal,\n },\n lineColor: TEXT_TABLE_BORDER_COLOR,\n lineWidth: TEXT_TABLE_BORDER_WIDTH,\n valign: 'middle',\n textColor: DEFAULT_TEXT_COLOR,\n },\n didDrawCell: (hook: any) => this._drawTextCell(hook),\n };\n }\n\n // How many of a text table's rows its box holds: the rows autoTable draws\n // whole on the first page when it lays the table out on a scratch document\n // of the same page size, as _measure does for a list. A row taller than a\n // page is split across pages rather than moved, so it does not count.\n private _textTableFit(context: PdfExportContext, options: Record<string, unknown>): number {\n const scratch = this._scratchDocument(context);\n let fit = 0;\n\n context.autoTable(scratch, {\n ...options,\n didDrawCell: (hook: any) => {\n if (scratch.getCurrentPageInfo().pageNumber === 1 && !hook.row.spansMultiplePages) {\n fit = Math.max(fit, hook.row.index + 1);\n }\n },\n });\n\n return fit;\n }\n\n // The first `fit` rows, a cell that spans down past the last of them cut\n // there.\n private _keptRows(body: PdfTextCellInput[][], fit: number): PdfTextCellInput[][] {\n return body.slice(0, fit).map((row) => row.map((input) => {\n const rowSpan = Math.min(input.rowSpan, fit - input.textCell.row);\n\n return rowSpan === input.rowSpan ? input : { ...input, rowSpan };\n }));\n }\n\n // A text table cell's words, drawn once autoTable has drawn the cell: inside\n // its padding, wrapped to its width and placed by its vertical alignment, the\n // middle unless set. Lines past the cell are left off.\n private _drawTextCell(hook: any): void {\n const cell: TextTableCell | undefined = hook.cell.raw?.textCell;\n if (!cell) {\n return;\n }\n\n const { x, y, width, height } = hook.cell;\n const box: PdfTextBox = {\n left: x + hook.cell.padding('left'),\n top: y + hook.cell.padding('top'),\n width: width - hook.cell.padding('horizontal'),\n bottom: y + height - hook.cell.padding('bottom'),\n };\n const spare = Math.max(0, box.bottom - box.top - this._paragraphsHeight(hook.doc, cell.paragraphs, box.width));\n const offset = cell.valign === 'top' ? 0 : (cell.valign === 'bottom' ? spare : spare / 2);\n\n this._drawParagraphs(hook.doc, cell.paragraphs, box, box.top + offset);\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. A\n // no-break space is part of its word, never a break between two: a number\n // grouped with one (fr-CA's thousands, or a narrow space _pdfText turned\n // into one) stays on one line.\n private _wrap(doc: any, paragraph: TextParagraph, width: number): PdfWord[][] {\n const lines: PdfWord[][] = [];\n let line: PdfWord[] = [];\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]|\\u00a0)+[^\\S\\u00a0]*|[^\\S\\u00a0]+/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: PdfWord, 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 ): Promise<void> {\n const { doc } = context;\n const component = item.component;\n // Geometry is stored in inches; the PDF draws in points.\n const x = component.x * PT;\n const y = component.y * PT;\n const w = component.w * PT;\n const h = component.h * PT;\n\n const title = exportTitle(component, item.search);\n if (title) {\n this._componentTitle(doc, title, x, y, w);\n }\n\n // A chart or list that compares or has a timeframe names its days under\n // the title, and its notes sit at the foot of its box; a KPI card draws\n // both itself. Neither takes room from a component without those keys.\n const locale = context.formatContext.locale;\n const subtitle = this._pdfText(exportWindowsLine(item, context.timezone, locale));\n const notes = component.type === 'kpi' ? [] : exportNoteLines(item, context.timezone, locale);\n const top = y + TITLE_H + (subtitle ? SUBTITLE_H : 0);\n const room = Math.max(20, y + h - top);\n const kept = notes.slice(0, Math.max(0, Math.floor((room - MIN_BODY_H) / NOTE_LINE_H)));\n\n if (subtitle) {\n this._smallLine(doc, subtitle, x, y + TITLE_H, w, 'left', 'normal');\n }\n\n const bodyY = top;\n const bodyH = Math.max(20, room - kept.length * NOTE_LINE_H);\n\n kept.forEach((line, index) => {\n this._smallLine(doc, this._pdfText(line), x, bodyY + bodyH + index * NOTE_LINE_H, w, 'left', 'italic');\n });\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, context.formatContext);\n doc.addImage(image, 'PNG', x, bodyY, w, bodyH);\n break;\n }\n case 'list':\n this._renderTable(context, item, x, bodyY, w, bodyH, overflows);\n break;\n case 'kpi':\n this._renderKpi(context, item, x, bodyY, w, bodyH);\n break;\n }\n }\n\n // One line of small grey print, cut to the width with an ellipsis: a\n // subtitle, a note or a line of a KPI card. y is the line's top; the line is\n // NOTE_LINE_H tall, times the scale a short KPI tile shrinks its lines by.\n private _smallLine(\n doc: any,\n text: string,\n x: number, y: number, w: number,\n align: 'left' | 'center',\n style: 'normal' | 'italic',\n scale = 1,\n ): void {\n doc.setFont('helvetica', style);\n doc.setFontSize(SMALL_SIZE * scale);\n doc.setTextColor(MUTED_COLOR);\n doc.text(this._fit(doc, text, w), align === 'center' ? x + w / 2 : x, y + SMALL_SIZE * scale, { align });\n }\n\n // The text, ellipsized to the width in the doc's current font.\n private _fit(doc: any, text: string, width: number): string {\n if (doc.getTextWidth(text) <= width) {\n return text;\n }\n\n let cut = text;\n while (cut.length > 1 && doc.getTextWidth(`${cut}…`) > width) {\n cut = cut.slice(0, -1);\n }\n\n return `${cut.trimEnd()}…`;\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(MUTED_COLOR);\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 // A totals row closes the table once: in the box when every row fits it,\n // else after the last continuation row. Points throughout.\n private _renderTable(\n context: PdfExportContext,\n item: CollectedComponent,\n x: number, y: number, w: number, h: number,\n overflows: PdfTableOverflow[],\n ): void {\n const { component, search, hiddenColumns } = item;\n const data = item.data as ComponentData;\n const head = listHeadings(component, data, context.formatContext.locale, hiddenColumns)\n .map((heading) => this._pdfText(heading));\n const { cells, numeric, foot } = this._tableCells(context, component, data, hiddenColumns);\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, numeric, foot, x, y, w, bottom);\n\n if (fit === cells.length && omitted === 0) {\n this._drawTable(\n context,\n this._tableOptions(context, head, numeric, cells, x, y, w, bottom, columnStyles, foot),\n );\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, search, head, numeric, rows: cells.slice(kept), omitted, foot, 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, numeric, 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, in the report's\n // zone, locale and currency, which columns hold formatted numbers, and the\n // totals row (null without one). The columns the viewer hid are left out.\n private _tableCells(\n context: PdfExportContext,\n component: ReportComponent,\n data: ComponentData,\n hiddenColumns: readonly string[],\n ): { cells: string[][]; numeric: boolean[]; foot: string[] | null } {\n const columns = listColumns(component, data, context.formatContext.locale, hiddenColumns);\n const cells = data.rows.map((row) => columns.map((column) => this._pdfText(\n exportCell(row[column.column], column, context.timezone, context.formatContext, row),\n )));\n const foot = listTotalsRow(data, columns, context.timezone, context.formatContext);\n\n return {\n cells,\n numeric: columns.map((column) => column.numeric),\n foot: foot ? foot.map((cell) => this._pdfText(cell)) : null,\n };\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 //\n // A column of formatted numbers is right-aligned, its heading and total\n // too: the body through columnStyles, which autoTable applies to body cells\n // only, and the heading and total through the didParseCell hook, on every\n // page the heading repeats. A totals row (foot) prints once, under the\n // table's last row, bold on the border gray.\n private _tableOptions(\n context: PdfExportContext,\n head: string[],\n numeric: boolean[],\n body: PdfTableCell[][],\n x: number, startY: number, w: number, bottom: number,\n columnStyles?: PdfColumnStyles,\n foot?: string[] | null,\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 ...(foot\n ? {\n foot: [foot],\n showFoot: 'lastPage',\n footStyles: { fillColor: '#e4e7eb', textColor: '#1f2933', fontStyle: 'bold' },\n }\n : {}),\n didParseCell: (hook: any) => {\n if ((hook.section === 'head' || hook.section === 'foot') && numeric[hook.column.index]) {\n hook.cell.styles.halign = 'right';\n }\n },\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 // Left-aligned whatever the first column is: a spanned cell otherwise\n // takes columnStyles[0], right-aligned when that column is numeric.\n styles: {\n fontStyle: 'italic',\n textColor: MUTED_COLOR,\n halign: 'left',\n ...(singleLine ? { overflow: 'ellipsize' } : {}),\n },\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 // with each numeric column's right alignment merged in, so the on-page\n // table and its continuation pages carry both. The totals row is laid out\n // too, so the widths hold it, and a table whose rows fit the box but whose\n // totals row does not moves its last row on. fit 0 means not even one\n // body row fits under the head (or the head itself did not fit): autoTable\n // 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 numeric: boolean[],\n foot: string[] | null,\n x: number, y: number, w: number, bottom: number,\n ): { fit: number; columnStyles: PdfColumnStyles } {\n const scratch = this._scratchDocument(context);\n let fit = 0;\n\n context.autoTable(scratch, {\n ...this._tableOptions(context, head, numeric, cells, x, y, w, bottom, undefined, foot),\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] = numeric[index]\n ? { cellWidth: column.width, halign: 'right' }\n : { 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 // A blank document of the export's page size, for laying a table out to see\n // what fits before the real one is drawn on.\n private _scratchDocument(context: PdfExportContext): any {\n return new context.jsPDF({\n unit: 'pt',\n format: [context.pageW, context.pageH],\n orientation: context.orientation,\n });\n }\n\n // Draws an on-page table (a list's, or a text block's), then removes any\n // page the draw added. That should never happen: the measured fit, the\n // identical column widths and a single-line notice keep the table inside its\n // box. The check exists so a stray page can never catch the report page's\n // 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 async _renderContinuation(\n context: PdfExportContext,\n page: ReportPage,\n index: number,\n pageNumber: number,\n overflow: PdfTableOverflow,\n ): Promise<number> {\n const { doc } = context;\n const bands = page.masterHidden ? NO_BANDS : context.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 // The document's pages the table draws on, in order.\n const pages: number[] = [];\n\n doc.addPage([context.pageW, context.pageH], context.orientation);\n context.autoTable(doc, {\n ...this._tableOptions(\n context, overflow.head, overflow.numeric, body, x, top + TITLE_H, w, bottom, overflow.columnStyles,\n overflow.foot,\n ),\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 pages.push(doc.getCurrentPageInfo().pageNumber);\n this._componentTitle(doc, this._continuedTitle(overflow.component, overflow.search), x, top, w);\n },\n });\n\n await this._renderContinuationMasters(context, page, index, pageNumber, pages);\n\n return pageNumber + pages.length;\n }\n\n // The header and footer of each continuation page, numbered on from\n // pageNumber. They go on once the table is drawn, since a text block with a\n // table is measured before it is drawn, which autoTable's page hook cannot\n // wait for; they sit in the bands, clear of the table.\n private async _renderContinuationMasters(\n context: PdfExportContext,\n page: ReportPage,\n index: number,\n pageNumber: number,\n pages: number[],\n ): Promise<void> {\n const { doc, report } = context;\n\n for (const [offset, documentPage] of pages.entries()) {\n doc.setPage(documentPage);\n await this._renderMaster(context, page, this._tokens(report, page, index, pageNumber + offset + 1));\n }\n\n doc.setPage(doc.getNumberOfPages());\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, search?: string): string {\n const title = exportTitle(component, search);\n\n return title ? `${title} (continued)` : 'Continued';\n }\n\n // A KPI tile: the card the screen draws (kpi-card.ts decides every line),\n // stacked and centered in the body. A card with only its value and label\n // keeps the tile's long-standing layout.\n private _renderKpi(\n context: PdfExportContext,\n item: CollectedComponent,\n x: number, y: number, w: number, h: number,\n ): void {\n const { doc } = context;\n const config = item.component.config as KpiConfig;\n const view = kpiCardView(config, item.data, { format: context.formatContext, timezone: context.timezone });\n const value = this._pdfText(view.value);\n const notes = exportNoteLines(item, context.timezone, context.formatContext.locale);\n\n if (!kpiCardHasExtras(view, notes)) {\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 (view.label) {\n doc.setFont('helvetica', 'normal');\n doc.setFontSize(9);\n doc.setTextColor(MUTED_COLOR);\n doc.text(view.label, x + w / 2, y + h / 2 + 16, { align: 'center' });\n }\n\n return;\n }\n\n // A tile too short for the card's lines shrinks them all alike.\n const parts = kpiExportParts(view, notes, h, KPI_HEIGHTS);\n const heights = scaledKpiHeights(KPI_HEIGHTS, parts.scale);\n let top = y + Math.max(0, (h - kpiExportHeight(view, parts, heights)) / 2);\n\n doc.setFont('helvetica', 'bold');\n doc.setFontSize(26 * parts.scale);\n doc.setTextColor('#1f2933');\n doc.text(value, x + w / 2, top + KPI_VALUE_BASELINE * parts.scale, { align: 'center' });\n top += heights.value;\n\n if (view.label) {\n doc.setFont('helvetica', 'normal');\n doc.setFontSize(9 * parts.scale);\n doc.setTextColor(MUTED_COLOR);\n doc.text(this._fit(doc, this._pdfText(view.label), w), x + w / 2, top + 9 * parts.scale, { align: 'center' });\n top += heights.label;\n }\n\n if (parts.delta && view.delta) {\n this._kpiDelta(doc, view.delta, x, top, w, parts.scale);\n top += heights.delta;\n }\n\n if (parts.window) {\n this._smallLine(doc, this._pdfText(view.window), x, top, w, 'center', 'normal', parts.scale);\n top += heights.window;\n }\n\n if (parts.target && view.target) {\n this._kpiTarget(doc, view.target, x, top, w);\n top += heights.target;\n }\n\n if (parts.sparkline && view.sparkline) {\n this._kpiSparkline(doc, view.sparkline.values, view.sparkline.partial, x, top, w);\n top += heights.sparkline;\n }\n\n for (const line of parts.notes) {\n this._smallLine(doc, this._pdfText(line), x, top, w, 'center', 'italic');\n top += heights.note;\n }\n }\n\n // The delta row, centered as one group: a triangle pointing the way the\n // value moved (none when the shown change rounds to zero) and the change in\n // the color of what it means, then what it is compared with in grey.\n private _kpiDelta(doc: any, delta: KpiCardDelta, x: number, top: number, w: number, scale = 1): void {\n const color = `#${REPORT_KPI_CHANGE_COLORS[delta.tone]}`;\n const change = this._pdfText(delta.text);\n const size = KPI_DELTA_SIZE * scale;\n const side = KPI_ARROW * scale;\n const arrow = delta.trend === ReportKpiTrend.Flat ? 0 : side + KPI_ARROW_GAP * scale;\n\n doc.setFont('helvetica', 'bold');\n doc.setFontSize(size);\n const changeWidth = doc.getTextWidth(change);\n\n doc.setFont('helvetica', 'normal');\n const compared = delta.compared\n ? this._fit(doc, ` ${this._pdfText(delta.compared)}`, Math.max(0, w - arrow - changeWidth))\n : '';\n const width = arrow + changeWidth + (compared ? doc.getTextWidth(compared) : 0);\n const baseline = top + size;\n let left = x + Math.max(0, (w - width) / 2);\n\n if (arrow) {\n const up = delta.trend === ReportKpiTrend.Up;\n const tip = up ? baseline - side : baseline;\n const base = up ? baseline : baseline - side;\n\n doc.setFillColor(color);\n doc.triangle(left, base, left + side, base, left + side / 2, tip, 'F');\n left += arrow;\n }\n\n doc.setFont('helvetica', 'bold');\n doc.setTextColor(color);\n doc.text(change, left, baseline);\n\n if (compared) {\n doc.setFont('helvetica', 'normal');\n doc.setTextColor(MUTED_COLOR);\n doc.text(compared, left + changeWidth, baseline);\n }\n }\n\n // The target line ('Goal: $1,000 · 56% of target') and, when the server sent\n // the progress, a bar filled that far: green once the target is met.\n private _kpiTarget(doc: any, target: KpiCardTarget, x: number, top: number, w: number): void {\n const text = target.progress ? `${target.text} · ${target.progress}` : target.text;\n\n this._smallLine(doc, this._pdfText(text), x, top, w, 'center', 'normal');\n\n if (target.fill === null) {\n return;\n }\n\n const barW = Math.min(w * 0.6, KPI_BAR_W);\n const barX = x + (w - barW) / 2;\n const barY = top + NOTE_LINE_H + 1;\n\n doc.setFillColor(KPI_TRACK_COLOR);\n doc.rect(barX, barY, barW, KPI_BAR_H, 'F');\n\n if (target.fill > 0) {\n doc.setFillColor(`#${REPORT_KPI_CHANGE_COLORS[target.tone]}`);\n doc.rect(barX, barY, barW * target.fill, KPI_BAR_H, 'F');\n }\n }\n\n // The sparkline in a box under the card's lines, as the screen draws it\n // (kpiSparklineGeometry, a 0-100 box): a vector line per run of values, a\n // dot for a lone value, and the last point's marker, hollow while its period\n // is partial.\n private _kpiSparkline(\n doc: any,\n values: (number | null)[],\n partial: boolean,\n x: number, top: number, w: number,\n ): void {\n const geometry = kpiSparklineGeometry(values, partial);\n const boxW = Math.min(w * 0.7, KPI_SPARKLINE_W);\n const boxH = KPI_HEIGHTS.sparkline - 2 * KPI_SPARKLINE_INSET;\n const left = x + (w - boxW) / 2;\n const at = (point: KpiSparklinePoint) => ({\n x: left + point.x * boxW / 100,\n y: top + KPI_SPARKLINE_INSET + point.y * boxH / 100,\n });\n const color = `#${REPORT_KPI_SPARKLINE_COLOR}`;\n\n doc.setDrawColor(color);\n doc.setFillColor(color);\n doc.setLineWidth(1);\n\n for (const line of geometry.lines) {\n const points = line.split(' ').map((pair) => {\n const [px, py] = pair.split(',').map(Number);\n\n return at({ x: px, y: py });\n });\n const steps = points.slice(1).map((point, index) => [point.x - points[index].x, point.y - points[index].y]);\n\n doc.lines(steps, points[0].x, points[0].y, [1, 1], 'S', false);\n }\n\n for (const dot of geometry.dots) {\n const point = at(dot);\n doc.circle(point.x, point.y, KPI_DOT_R, 'F');\n }\n\n if (geometry.last) {\n const point = at(geometry.last);\n\n if (geometry.last.hollow) {\n doc.setFillColor('#ffffff');\n doc.circle(point.x, point.y, KPI_DOT_R, 'FD');\n } else {\n doc.circle(point.x, point.y, KPI_DOT_R, 'F');\n }\n }\n }\n\n // A formatted value as jsPDF can draw it. Its standard fonts write text in\n // WinAnsi, which has the no-break space (U+00A0, fr-CA's digit grouping) but\n // not the narrow one (U+202F, which other locales group and space with), the\n // thin and hair spaces (U+2009, U+200A, which Intl puts around a date\n // range's dash: 'Sep 1 – 30, 2026'), the minus sign (U+2212, some locales'\n // negative sign) or a rank change's triangles: each would print as stray\n // glyphs. The narrow space becomes a no-break space, so a number still never\n // wraps across a line; the thin and hair spaces a plain space; the minus\n // sign a hyphen; and a rank's rise a plus sign and its fall a hyphen\n // ('▲ 2' reads '+2').\n private _pdfText(text: string): string {\n return text\n .replace(/\\u202F/g, '\\u00A0')\n .replace(/[\\u2009\\u200A]/g, ' ')\n .replace(/\\u2212/g, '-')\n .replace(/\\u25B2\\s?/g, '+')\n .replace(/\\u25BC\\s?/g, '-');\n }\n\n // A layer's values with each number as jsPDF can draw it (_pdfText), so a\n // value grouped with narrow spaces reads, and wraps, like any other number.\n private _pdfValues(values: Record<string, TextValue>): Record<string, TextValue> {\n return Object.fromEntries(Object.entries(values).map(([key, value]) => [\n key,\n value.text === undefined ? value : { ...value, text: this._pdfText(value.text) },\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 { ReportChartDataLabels } from '../enums/report-chart-data-labels.enum';\nimport { ReportChartDateLabel } from '../enums/report-chart-date-label.enum';\nimport { ReportChartLineStyle } from '../enums/report-chart-line-style.enum';\nimport { ReportChartMarkStat } from '../enums/report-chart-mark-stat.enum';\nimport { ReportKpiTrend } from '../enums/report-kpi-trend.enum';\nimport { ReportListColumnFormat } from '../enums/report-list-column-format.enum';\nimport {\n axisNumberFormat,\n chartAxisFormatCode,\n chartValuePeak,\n hasNumberFormat,\n numberFormatCode,\n resolveChartNumberFormat,\n resolveReportTimezone,\n} from '../format';\nimport {\n ChartConfig,\n ChartGranularity,\n ChartMeasure,\n ChartValueAxis,\n ComponentData,\n LegendPosition,\n KpiConfig,\n NumberFormatSpec,\n Report,\n ReportComponent,\n ReportFormatContext,\n ReportLocaleTag,\n ReportPage,\n WaterfallStepKind,\n} from '../interfaces/report.interface';\nimport { KpiCardDelta, KpiCardTarget, kpiCardView, kpiSparklineGeometry } from '../kpi-card';\nimport { DEFAULT_COMPONENT_PADDING } from '../layout';\nimport { listTotalsLabelColumn } from '../list-config';\nimport {\n DEFAULT_TEXT_COLOR, DEFAULT_TEXT_SIZE, TEXT_TABLE_BORDER_COLOR, TEXT_TABLE_BORDER_WIDTH, TEXT_TABLE_CELL_PADDING,\n TextBlock, TextParagraph, TextRun, TextTable, TextTableCell, TextTokenContext, blockParagraphs, textBlocks,\n} from '../text';\nimport { isDrawn } from '../values';\nimport {\n chartDateLabel,\n chartReferences,\n colorByValues,\n DrawnReference,\n drawsStatLines,\n ExtractedChartSeries,\n extractChartSeries,\n extractWaterfall,\n formatPeriodLabel,\n isColorBy,\n measureLineStyle,\n measureMarkStat,\n PERCENT_AXIS_INTERVAL,\n PERCENT_AXIS_MAX,\n percentAxisMin,\n PercentShares,\n percentStackedShares,\n priorSeriesStyles,\n RANK_AXIS_MIN,\n rankValueAxes,\n referencePeak,\n resolveLegendPosition,\n seriesAxisIndexes,\n seriesHex,\n seriesStat,\n seriesTypes,\n spansMultipleYears,\n STAT_LABEL,\n ValueAxisIndex,\n valueAxisRange,\n WaterfallStep,\n} from '../option-builder';\nimport {\n REPORT_CHART_COLORS,\n REPORT_KPI_CHANGE_COLORS,\n REPORT_KPI_SPARKLINE_COLOR,\n REPORT_KPI_TRACK_COLOR,\n REPORT_MUTED_TEXT_COLOR,\n REPORT_REFERENCE_COLOR,\n REPORT_WATERFALL_COLORS,\n} from '../theme/palette';\nimport {\n BuiltExport, CollectedComponent, CollectedReport, HEADER_FOOTER_NAME, KpiExportHeights, TextOverflow, coverLines,\n emptyLabel, exportCell, exportNoteLines, exportTitle, exportWindowsLine, kpiCardHasExtras, kpiExportHeight,\n kpiExportParts, listColumns, listHeadings, listTotalsRow, moreRowsNotice, scaledKpiHeights, textOverflow,\n} from './report-export-collector.service';\nimport {\n OVERFLOW_SLACK, ReportTextLayoutService, TextBlockLayout, TextSegmentLayout, TextTableLayout,\n} from './report-text-layout.service';\n\n\n// Component title strip height on the slide, inches.\nconst TITLE_H = 0.28;\n\n// The small print a component may carry, inches: the days it reads under its\n// title (a subtitle line), its notes at the foot of its box (a line each), and\n// the lines of a KPI card under its value. A chart's or a list's notes give\n// way before its body would shrink under MIN_BODY_H.\nconst SMALL_FONT_SIZE = 8;\nconst SUBTITLE_H = 0.18;\nconst NOTE_LINE_H = 0.16;\nconst MIN_BODY_H = 0.6;\nconst MUTED_COLOR = REPORT_MUTED_TEXT_COLOR;\n\n// A KPI card's parts, top to bottom, inches (kpiExportParts sheds the\n// sparkline, then the target, then the notes on a short tile).\nconst KPI_TARGET_TEXT_H = 0.18;\nconst KPI_BAR_GAP = 0.02;\nconst KPI_BAR_H = 0.05;\nconst KPI_HEIGHTS: KpiExportHeights = {\n value: 0.48,\n label: 0.22,\n delta: 0.22,\n window: 0.18,\n target: KPI_TARGET_TEXT_H + KPI_BAR_GAP + KPI_BAR_H + 0.03,\n sparkline: 0.42,\n note: NOTE_LINE_H,\n};\n// The size of the delta, window and target lines.\nconst KPI_LINE_FONT_SIZE = 9;\n// The delta's triangle: its side, and the gap before the change.\nconst KPI_ARROW = 0.09;\nconst KPI_ARROW_GAP = 0.04;\n// A character's average width as a share of its font size, for placing the\n// triangle beside text PowerPoint lays out.\nconst PPTX_CHAR_WIDTH = 0.42;\n// The target's progress bar, and the track it fills.\nconst KPI_BAR_W = 1.7;\nconst KPI_TRACK_COLOR = REPORT_KPI_TRACK_COLOR;\n// The sparkline's widest box, and its series name in the data sheet when the\n// measure has no label.\nconst KPI_SPARKLINE_W = 2;\nconst KPI_SPARKLINE_NAME = 'Trend';\n\n// A rank axis drawn top-down keeps its category labels under the plot: at the\n// axis's high end, which a reversed axis puts at the bottom. Ranks up to this\n// many are stepped one at a time.\nconst PPTX_RANK_CATEGORY_LABEL_POS = 'high';\nconst PPTX_RANK_WHOLE_STEP_PEAK = 10;\nconst PPTX_RANK_FORMAT_CODE = '0';\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, unless the chart draws\n// references, which only the legend can name in PowerPoint.\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// The axis label and title sizes every chart with axes shares, whichever axis\n// they land on.\nconst AXIS_FONT_SIZES = { catAxisLabelFontSize: 9, valAxisLabelFontSize: 9, valAxisTitleFontSize: 10 } as const;\n\n// A line style as PowerPoint's preset dash (a:prstDash). pptxgenjs writes it\n// on line series only, so an area is never dashed.\nconst PPTX_LINE_DASH: Record<ReportChartLineStyle, string> = {\n [ReportChartLineStyle.Solid]: 'solid',\n [ReportChartLineStyle.Dashed]: 'dash',\n [ReportChartLineStyle.Dotted]: 'sysDot',\n};\n\n// A line's markers, as on screen: a dot the screen's size on each point.\nconst PPTX_LINE_SYMBOL_SIZE = 6;\n\n// A 100% stacked chart's share axis: whole percentages. The shares are\n// ratios, so '0%' is right whatever the report's percentFormat.\nconst PPTX_PERCENT_FORMAT_CODE = '0%';\n\n// The size of a chart's data labels, a step under the axis labels, as on\n// screen.\nconst PPTX_DATA_LABEL_FONT_SIZE = 8;\n\n// The most categories an 'auto' data-labeled chart labels in PowerPoint,\n// which cannot hide the labels that overlap: past this many, it labels none.\nexport const PPTX_AUTO_LABEL_MAX_POINTS = 24;\n\n// A reference or statistic line's width in points: a hairline beside the\n// series, as on screen.\nconst PPTX_CONSTANT_LINE_SIZE = 1;\n\n// What the upper edge of a reference band is called in the data sheet and the\n// legend, after the band's own label on its lower edge.\nconst PPTX_BAND_UPPER_SUFFIX = ' (upper)';\n\n// What the export's overflow gate says the deck does with a text block that\n// does not fit its box.\nconst PPTX_OVERFLOW_NOTE = 'In the PowerPoint it runs past the bottom of its box, and table rows past it are '\n + 'left out.';\n\n// The shortest text box a text block's words get between its tables, inches,\n// however close the canvas sets their top and bottom.\nconst TEXT_SEGMENT_MIN_H = 0.05;\n\n// A text table's cell margins, top, right, bottom and left, in points: the\n// padding every renderer draws (TEXT_TABLE_CELL_PADDING). pptxgenjs 3.12 reads\n// a margin list as points when its first value is at least 1, and as inches\n// otherwise.\nconst TEXT_TABLE_CELL_MARGIN = [\n TEXT_TABLE_CELL_PADDING.vertical,\n TEXT_TABLE_CELL_PADDING.horizontal,\n TEXT_TABLE_CELL_PADDING.vertical,\n TEXT_TABLE_CELL_PADDING.horizontal,\n];\n\n// Where the legend of a chart with reference or statistic lines sits when\n// the config does not pin it: the one place PowerPoint names those lines.\nconst PPTX_CONSTANT_LEGEND: LegendPosition = 'top';\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// One native chart of a PowerPoint chart: the type it draws, which of the\n// chart data's series it holds (by index), whether they plot against the\n// secondary value axis, and the options laid over the chart's for it alone.\ninterface PptxEntry {\n type: string;\n indexes: number[];\n secondary: boolean;\n options: Record<string, unknown>;\n}\n\n// A line PowerPoint draws at one value the whole width of the plot, as a\n// series of its own: a reference line, one edge of a reference band, or a\n// measure's statistic line. pptxgenjs has no markLine or markArea.\ninterface PptxConstantLine {\n name: string;\n value: number;\n color: string;\n secondary: boolean;\n}\n\n// The options of one run of PowerPoint text. PowerPoint proofs every run in its\n// language, and pptxgenjs writes en-US for a run that names none. A run whose\n// whole text is a value written in the report's locale (a KPI value, a date\n// cell, the cover's date) passes that locale, so a French date is not marked\n// as misspelled English. Authored and interface text (titles, labels,\n// headings, filter lines, notices) passes none and keeps the default, so an\n// English title in a French report is never proofed as French.\nexport function pptxRunOptions(\n options: Record<string, unknown>,\n valueLocale?: ReportLocaleTag,\n): Record<string, unknown> {\n return valueLocale ? { ...options, lang: valueLocale } : options;\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//\n// A text block's words and tables are placed where the canvas lays them out\n// (ReportTextLayoutService). Words that do not fit a block's box run on past\n// its bottom, and table rows past it are left out, so build() hands the deck\n// back unsaved with the blocks that do not fit, and the export can ask about\n// them before it saves.\n@Injectable()\nexport class ReportPptxService {\n\n private readonly _textLayout = inject(ReportTextLayoutService);\n\n public async build(collected: CollectedReport): Promise<BuiltExport> {\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 // The text blocks that do not fit their box, by component id, so a header\n // or footer block is listed once, not once per slide.\n const overflows = new Map<number, TextOverflow>();\n\n for (const index of collected.pages.keys()) {\n await this._renderPage(pptx, collected, index, overflows);\n }\n\n return {\n overflows: [...overflows.values()],\n overflowNote: PPTX_OVERFLOW_NOTE,\n save: async () => {\n await pptx.writeFile({ fileName: `${this._slug(report.name)}.pptx` });\n },\n };\n }\n\n // One report page's slide. The header and footer first, so the page's own\n // components sit on top of them exactly as on the canvas. Each layer's text\n // fills its value tokens with that layer's values: the master's or the\n // page's.\n private async _renderPage(\n pptx: any,\n collected: CollectedReport,\n index: number,\n overflows: Map<number, TextOverflow>,\n ): Promise<void> {\n const report = collected.report;\n const collectedPage = collected.pages[index];\n const slide = pptx.addSlide();\n const tokens = this._tokens(report, collectedPage.page, index);\n const pageTokens = { ...tokens, values: collectedPage.values };\n const timezone = resolveReportTimezone(report);\n\n if (!collectedPage.page.masterHidden) {\n await this._renderMaster(slide, collected, tokens, overflows);\n }\n\n for (const item of collectedPage.components) {\n if (item.component.type !== 'text') {\n this._renderComponent(pptx, slide, item, timezone, collected.formatContext);\n } else if (await this._renderText(slide, item.component, pageTokens)) {\n this._recordOverflow(overflows, item.component, tokens.pageName, pageTokens);\n }\n }\n }\n\n // The header and footer, their value tokens filled with the master's values.\n private async _renderMaster(\n slide: any,\n collected: CollectedReport,\n tokens: TextTokenContext,\n overflows: Map<number, TextOverflow>,\n ): Promise<void> {\n const masterTokens = { ...tokens, values: collected.masterValues };\n\n for (const component of (collected.report.master?.components ?? []).filter(isDrawn)) {\n if (await this._renderText(slide, component, masterTokens)) {\n this._recordOverflow(overflows, component, HEADER_FOOTER_NAME, masterTokens);\n }\n }\n }\n\n // Lists a text block that does not fit its box, under the page the export's\n // overflow gate names it by. A block listed on an earlier slide (a header or\n // footer) keeps that entry.\n private _recordOverflow(\n overflows: Map<number, TextOverflow>,\n component: ReportComponent,\n page: string,\n tokens: TextTokenContext,\n ): void {\n if (!overflows.has(component.id)) {\n overflows.set(component.id, textOverflow(component, page, tokens));\n }\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 // coverLines() leads with the export date, the one line written in the\n // report's locale; the filter and context lines are interface text.\n const lines = coverLines(collected);\n const runs = lines.map((line, index) => ({\n text: line,\n options: pptxRunOptions(\n { breakLine: index < lines.length - 1 },\n index === 0 ? collected.formatContext.locale : undefined,\n ),\n }));\n\n slide.addText(runs, {\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 native PowerPoint text, editable in the deck, each run\n // carrying its own bold/italic/color/size. The block is measured as the\n // canvas lays it out (ReportTextLayoutService). A block without a table is\n // ONE text box (_addTextBox). A block with tables is a stack inside its\n // padding (_renderTextStack). Returns whether anything runs past the bottom\n // of the box or was left out.\n private async _renderText(slide: any, component: ReportComponent, tokens: TextTokenContext): Promise<boolean> {\n const html = component.config?.html ?? '';\n const blocks = textBlocks(html, tokens);\n const layout = await this._textLayout.measure(component, tokens);\n const textCount = blocks.filter((block) => block.kind === 'text').length;\n const tableCount = blocks.length - textCount;\n\n // The measure finds a block's parts one for one with textBlocks, unless the\n // canvas rendered the html differently. A block whose parts it did not\n // find falls back to the one text box, its tables read as lines of text.\n if (!tableCount || layout.tables.length !== tableCount || layout.segments.length !== textCount) {\n this._addTextBox(slide, component, blockParagraphs(blocks));\n\n return layout.overflow;\n }\n\n return this._renderTextStack(slide, component, blocks, layout) || layout.overflow;\n }\n\n // The words as ONE text box over the whole block. Its inset is the block's\n // padding, so the words land where they sat on screen.\n private _addTextBox(slide: any, component: ReportComponent, paragraphs: TextParagraph[]): void {\n const runs = this._paragraphRuns(paragraphs);\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: component.x, y: component.y, w: component.w, h: component.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 // A block with tables as a stack inside its padding: a text box for the\n // words before, between and after its tables, and a native table for each\n // table, each at the top the canvas gives it. PowerPoint spaces lines a\n // little differently from the canvas, so placing every part afresh keeps\n // that drift from adding up down the block. Returns whether any part was\n // left out.\n private _renderTextStack(\n slide: any,\n component: ReportComponent,\n blocks: TextBlock[],\n layout: TextBlockLayout,\n ): boolean {\n const padding = component.config?.padding;\n const x = component.x + (padding?.left ?? DEFAULT_COMPONENT_PADDING);\n const y = component.y + (padding?.top ?? DEFAULT_COMPONENT_PADDING);\n let segmentIndex = 0;\n let tableIndex = 0;\n let flagged = false;\n\n for (const block of blocks) {\n const leftOut = block.kind === 'text'\n ? this._addTextSegment(slide, block.paragraphs, layout.segments[segmentIndex++], layout, x, y)\n : this._addTextTable(slide, block.table, layout.tables[tableIndex++], layout, x, y);\n\n flagged = flagged || leftOut;\n }\n\n return flagged;\n }\n\n // The words between two tables (or before the first, or after the last) as\n // a text box from the top of their first line to the bottom of their last,\n // as wide as the block's content. A stretch that draws nothing is skipped,\n // and one that starts below the box is left out. Returns whether it was.\n private _addTextSegment(\n slide: any,\n paragraphs: TextParagraph[],\n segment: TextSegmentLayout | null,\n layout: TextBlockLayout,\n x: number, y: number,\n ): boolean {\n if (!segment || !paragraphs.some((paragraph) => paragraph.runs.length)) {\n return false;\n }\n\n if (segment.top >= layout.contentHeight) {\n return true;\n }\n\n slide.addText(this._paragraphRuns(paragraphs), {\n x, y: y + segment.top, w: layout.contentWidth, h: Math.max(TEXT_SEGMENT_MIN_H, segment.bottom - segment.top),\n margin: 0,\n valign: 'top',\n fontFace: 'Arial',\n fit: 'none',\n });\n\n return false;\n }\n\n // A table as a native, editable PowerPoint table where the canvas puts it,\n // in its column widths and row heights, in the one look every renderer\n // draws (TEXT_TABLE_* in text.ts). Only the rows that end inside the box are\n // kept. Returns whether any row was left out.\n private _addTextTable(\n slide: any,\n table: TextTable,\n tableLayout: TextTableLayout,\n layout: TextBlockLayout,\n x: number, y: number,\n ): boolean {\n const kept = this._keptRows(tableLayout, layout.contentHeight);\n\n if (kept) {\n slide.addTable(this._tableRows(table, kept), {\n x: x + tableLayout.left,\n y: y + tableLayout.top,\n w: tableLayout.width,\n colW: tableLayout.columnWidths,\n rowH: tableLayout.rowHeights.slice(0, kept),\n autoPage: false,\n fontFace: 'Arial',\n fontSize: DEFAULT_TEXT_SIZE,\n color: DEFAULT_TEXT_COLOR.replace('#', ''),\n border: { type: 'solid', pt: TEXT_TABLE_BORDER_WIDTH, color: TEXT_TABLE_BORDER_COLOR.replace('#', '') },\n margin: TEXT_TABLE_CELL_MARGIN,\n });\n }\n\n return kept < table.rows.length;\n }\n\n // How many of a table's rows, from the top, end inside the box.\n private _keptRows(tableLayout: TextTableLayout, contentHeight: number): number {\n let bottom = tableLayout.top;\n let kept = 0;\n\n for (const rowHeight of tableLayout.rowHeights) {\n bottom += rowHeight;\n if (bottom > contentHeight + OVERFLOW_SLACK) {\n break;\n }\n\n kept++;\n }\n\n return kept;\n }\n\n // The kept rows as pptxgenjs cells, each row in grid order. A PowerPoint\n // table is a full grid, and pptxgenjs counts its columns on the first row\n // and slips a merged cell's continuation into the row below at that cell's\n // place in its own row. So a cell is written in its top left slot only, a\n // slot no cell holds gets an empty cell, and a cell's spans end where they\n // would reach past the kept rows or into a slot another cell holds\n // (claimSlots).\n private _tableRows(table: TextTable, kept: number): any[][] {\n const slots: (TextTableCell | null)[][] = Array.from({ length: kept }, () => Array(table.columns).fill(null));\n table.rows.slice(0, kept).forEach((row) => row.cells.forEach((cell) => claimSlots(slots, cell)));\n\n return slots.map((row, rowIndex) => row.flatMap((cell, column) => {\n if (!cell) {\n return [{ text: '' }];\n }\n\n return cell.row === rowIndex && cell.column === column ? [this._tableCell(cell)] : [];\n }));\n }\n\n // A text table's cell: its words, its spans, its fill and its alignment. A\n // header cell's runs are already bold (parseTable), so a run its html sets\n // in a normal weight stays that way.\n private _tableCell(cell: TextTableCell): Record<string, unknown> {\n const runs = this._paragraphRuns(cell.paragraphs);\n\n return {\n // An empty cell still needs its one empty paragraph.\n text: runs.length ? runs : '',\n options: {\n colspan: cell.colSpan,\n rowspan: cell.rowSpan,\n fill: cell.fill ? { color: cell.fill.replace('#', '') } : undefined,\n align: cell.align,\n valign: cell.valign ?? 'middle',\n margin: TEXT_TABLE_CELL_MARGIN,\n },\n };\n }\n\n // Paragraphs as the runs of one native text body, each run in its own\n // style, a line break after each paragraph but the last. An empty paragraph\n // is a blank line. Text boxes and table cells take the same runs.\n private _paragraphRuns(paragraphs: TextParagraph[]): any[] {\n return paragraphs.flatMap((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 runs: TextRun[] = paragraph.runs.length ? paragraph.runs : [{ text: '' }];\n\n return runs.map((run, runIndex) => ({\n text: run.text,\n options: this._runOptions(run, paragraphOptions, runIndex === runs.length - 1 && !isLast),\n }));\n });\n }\n\n // One run's options: its own style over its paragraph's alignment and\n // bullet, and a line break when it ends a paragraph that is not the last.\n private _runOptions(\n run: TextRun,\n paragraphOptions: Record<string, unknown>,\n breakLine: boolean,\n ): Record<string, unknown> {\n return {\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,\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 context: ReportFormatContext,\n ): void {\n const component = item.component;\n // Geometry is in inches — PowerPoint's native unit.\n const { x, y, w, h } = component;\n\n const title = exportTitle(component, item.search);\n if (title) {\n slide.addText(title, {\n x, y, w, h: TITLE_H,\n fontSize: 10, bold: true, color: '1F2933', valign: 'top',\n });\n }\n\n // A chart or list that compares or has a timeframe names its days under\n // the title, and its notes sit at the foot of its box; a KPI card draws\n // both itself. Neither takes room from a component without those keys.\n const subtitle = exportWindowsLine(item, timezone, context.locale);\n const notes = component.type === 'kpi' ? [] : exportNoteLines(item, timezone, context.locale);\n const top = y + TITLE_H + (subtitle ? SUBTITLE_H : 0);\n const room = Math.max(0.3, y + h - top);\n const kept = notes.slice(0, Math.max(0, Math.floor((room - MIN_BODY_H) / NOTE_LINE_H)));\n\n if (subtitle) {\n slide.addText(this._fitEstimate(subtitle, SMALL_FONT_SIZE, w), {\n x, y: y + TITLE_H, w, h: SUBTITLE_H,\n fontSize: SMALL_FONT_SIZE, color: MUTED_COLOR, valign: 'top', margin: 0, fit: 'none',\n });\n }\n\n const bodyY = top;\n const bodyH = Math.max(0.3, room - kept.length * NOTE_LINE_H);\n\n if (kept.length) {\n const noteLines = kept.map((note) => this._fitEstimate(note, SMALL_FONT_SIZE, w));\n\n slide.addText(this._lineRuns(noteLines, { italic: true }), {\n x, y: bodyY + bodyH, w, h: kept.length * NOTE_LINE_H,\n fontSize: SMALL_FONT_SIZE, color: MUTED_COLOR, valign: 'top', margin: 0, fit: 'none',\n });\n }\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: MUTED_COLOR, 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, context, x, bodyY, w, bodyH);\n break;\n case 'list':\n this._renderTable(slide, component, item.data, item.hiddenColumns, timezone, context, x, bodyY, w, bodyH);\n break;\n case 'kpi':\n this._renderKpi(pptx, slide, item, timezone, context, x, bodyY, w, bodyH);\n break;\n }\n }\n\n // Lines of one text box, each its own paragraph.\n private _lineRuns(lines: readonly string[], options: Record<string, unknown> = {}): any[] {\n return lines.map((line, index) => ({ text: line, options: { ...options, breakLine: index < lines.length - 1 } }));\n }\n\n private _renderChart(\n pptx: any,\n slide: any,\n component: ReportComponent,\n data: ComponentData,\n context: ReportFormatContext,\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, context, 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(\n extracted.categories,\n data.granularity,\n context.locale,\n chartDateLabel(config),\n );\n // A 100% stacked chart's primary bars and areas plot the shares the screen\n // draws, stacked: PowerPoint's own percentStacked grouping is dropped on an\n // area chart, so one rule covers both. The data sheet holds the shares;\n // the CSV keeps the raw values.\n const shares = percentStackedShares(extracted, config);\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 measureData = colorBy\n ? [{\n name: config.measures?.[0]?.label ?? config.colorBy?.label ?? '',\n labels,\n values: colorByValues(extracted),\n }]\n : (pie ? extracted.series.slice(0, 1) : extracted.series)\n .map((series, index) => ({\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) : (shares?.get(index) ?? series.values),\n }));\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 // The value axis of each chartData entry; a pie and a colorBy chart have\n // one series on the one axis.\n const axisIndexes = pie || colorBy ? [0 as ValueAxisIndex] : seriesAxisIndexes(extracted, config);\n const twoAxes = axisIndexes.includes(1);\n const references = chartReferences(config, twoAxes);\n const formatCodes = pie ? [] : this._measureFormatCodes(config, extracted, axisIndexes, context, shares, references);\n // A value axis that plots nothing but ranks reads top-down, rank 1 at the\n // top, as on screen (a 100% stacked chart's primary axis is its shares).\n const rankAxes = pie || colorBy || shares ? [false, false] : rankValueAxes(extracted, data, config);\n const rankPeaks = ([0, 1] as const).map((axisIndex) => chartValuePeak(\n extracted.series.filter((_, index) => axisIndexes[index] === axisIndex).map((series) => series.values),\n false,\n ));\n\n // References and statistic lines follow the measures in the chart data,\n // each a constant series of its own.\n const constants = pie\n ? []\n : [\n ...this._referenceLines(references),\n ...this._statLines(config, extracted, axisIndexes, shares, colorBy, measureData[0]?.name ?? ''),\n ];\n const legendPosition = this._legendPosition(config, colorBy, extracted.series.length, constants.length);\n const chartData = [\n ...measureData,\n ...constants.map((line) => ({ name: line.name, labels, values: labels.map(() => line.value) })),\n ];\n\n // Series colors are per entry (_entryPlan), never chart-level, where a\n // multi-type chart's every entry would inherit them.\n const options = {\n x, y, w, h,\n showLegend: legendPosition !== 'hidden',\n legendPos: PPTX_LEGEND_POS[legendPosition],\n legendFontSize: 9,\n barDir: config.orientation === 'horizontal' ? 'bar' : 'col',\n barGrouping: config.stacked || shares ? 'stacked' : 'clustered',\n holeSize: chartType === 'donut' ? 55 : undefined,\n ...(twoAxes\n ? this._twoAxesOptions(config, formatCodes, shares, rankAxes, rankPeaks)\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 // a two-axis chart's value axes carry their own format codes. A 100%\n // stacked chart's one value axis is the share axis.\n ...(pie || twoAxes ? {} : (shares ? this._percentAxisOptions(shares) : {\n valAxisLabelFormatCode: formatCodes[0],\n })),\n ...(pie ? {} : this._categoryOrderOptions(config, dataTypes)),\n ...(twoAxes || !rankAxes[0] ? {} : {\n ...this._rankAxisOptions(config.valueAxis, rankPeaks[0]),\n catAxisLabelPos: PPTX_RANK_CATEGORY_LABEL_POS,\n }),\n dataBorder: { pt: 0, color: 'FFFFFF' },\n };\n\n const priorStyles = pie ? null : priorSeriesStyles(config, data, extracted);\n const entries = [\n ...this._entryPlan(dataTypes, extracted, config, axisIndexes, shares, chartData.length, priorStyles)\n .map((entry) => this._withDataLabels(entry, config, formatCodes, shares, labels.length)),\n ...constants.map((line, index) => this._constantEntry(line, measureData.length + index, chartData.length)),\n ];\n\n this._addChart(slide, typeMap, entries, chartData, options);\n }\n\n // Where the legend sits, as on screen (resolveLegendPosition), with two\n // differences. A single-series colorBy chart can't carry a per-category\n // legend in a native PowerPoint bar chart, so the category axis labels\n // identify each bar instead. And a reference or statistic line is named in\n // the legend alone, where the screen labels it on the line, so a chart that\n // draws one shows the legend whenever the config does not pin it. A pinned\n // position, 'hidden' included, still wins.\n private _legendPosition(\n config: ChartConfig,\n colorBy: boolean,\n seriesCount: number,\n constantCount: number,\n ): LegendPosition {\n if (constantCount) {\n return config.legend ?? PPTX_CONSTANT_LEGEND;\n }\n\n return colorBy ? 'hidden' : resolveLegendPosition(config, seriesCount);\n }\n\n // Each reference (chartReferences) as constant lines: a line at its value,\n // or a band's lower edge under its label and its upper edge under the label\n // with PPTX_BAND_UPPER_SUFFIX. A chart draws the ones the screen draws: none\n // on a horizontal chart or a pie.\n private _referenceLines(references: DrawnReference[]): PptxConstantLine[] {\n return references.flatMap((reference) => {\n const line = { name: reference.label, value: reference.low, color: REPORT_REFERENCE_COLOR, secondary: reference.axisIndex === 1 };\n\n return reference.band\n ? [line, { ...line, name: `${reference.label}${PPTX_BAND_UPPER_SUFFIX}`, value: reference.high }]\n : [line];\n });\n }\n\n // Each measure's statistic line, taken over the values the series plots\n // (its shares on a 100% stacked chart), named after the series ('Visits\n // average') and drawn in its color on its axis. A colorBy chart's one line\n // is taken over its collapsed bars and drawn in the reference slate, as on\n // screen. A series with no value draws none, and a horizontal chart none.\n private _statLines(\n config: ChartConfig,\n extracted: ExtractedChartSeries,\n axisIndexes: ValueAxisIndex[],\n shares: PercentShares | null,\n colorBy: boolean,\n colorByName: string,\n ): PptxConstantLine[] {\n if (!drawsStatLines(config)) {\n return [];\n }\n\n const line = (\n name: string,\n values: (number | null)[],\n stat: ReportChartMarkStat,\n color: string,\n secondary: boolean,\n ): PptxConstantLine[] => {\n const value = seriesStat(values, stat);\n const statName = STAT_LABEL[stat];\n\n return value === null\n ? []\n : [{ name: name ? `${name} ${statName.toLowerCase()}` : statName, value, color, secondary }];\n };\n\n if (colorBy) {\n const stat = measureMarkStat(extracted.series[0]?.measure);\n\n return stat ? line(colorByName, colorByValues(extracted), stat, REPORT_REFERENCE_COLOR, false) : [];\n }\n\n return extracted.series.flatMap((series, index) => {\n const stat = measureMarkStat(series.measure);\n\n return stat\n ? line(series.name, shares?.get(index) ?? series.values, stat, seriesHex(series, index), axisIndexes[index] === 1)\n : [];\n });\n }\n\n // A constant line's own entry: dashed, without markers or data labels, on\n // its value axis. Its colors run the length of the chart's data, as a\n // measure line's do (_entryPlan), so no marker ever takes a random color.\n private _constantEntry(line: PptxConstantLine, index: number, totalData: number): PptxEntry {\n return {\n type: 'line',\n indexes: [index],\n secondary: line.secondary,\n options: {\n chartColors: Array<string>(totalData).fill(line.color),\n lineDash: PPTX_LINE_DASH[ReportChartLineStyle.Dashed],\n lineDataSymbol: 'none',\n lineSize: PPTX_CONSTANT_LINE_SIZE,\n showValue: false,\n ...(line.secondary ? { secondaryValAxis: true, secondaryCatAxis: true } : {}),\n },\n };\n }\n\n // The number format code of the measures plotted on each value axis, by\n // axis index, matching the screen's ticks (_valueAxisCode): a one-axis chart\n // takes the format its plotted series' measures agree on, as on screen. A 100% stacked\n // chart's share axis is drawn in PPTX_PERCENT_FORMAT_CODE instead; these\n // codes still write the raw values of the series beside its shares. The\n // references on an axis count toward its peak, as on screen\n // (referencePeak), except a 100% stacked chart's, which are shares.\n private _measureFormatCodes(\n config: ChartConfig,\n extracted: ExtractedChartSeries,\n axisIndexes: ValueAxisIndex[],\n context: ReportFormatContext,\n shares: PercentShares | null,\n references: DrawnReference[],\n ): string[] {\n const reach = (axisIndex: ValueAxisIndex) => (shares && axisIndex === 0 ? 0 : referencePeak(references, axisIndex));\n\n if (!axisIndexes.includes(1)) {\n const values = extracted.series.map((series) => series.values);\n const spec = axisNumberFormat(extracted.series.map((series) => series.measure));\n\n return [this._valueAxisCode(spec, values, !!config.stacked, context, reach(0))];\n }\n\n return ([0, 1] as const).map((axisIndex) => {\n const onAxis = extracted.series.filter((_, index) => axisIndexes[index] === axisIndex);\n\n return this._valueAxisCode(\n axisNumberFormat(onAxis.map((series) => series.measure)),\n onAxis.map((series) => series.values),\n !!config.stacked && !shares,\n context,\n reach(axisIndex),\n );\n });\n }\n\n // A measure entry with its data labels (config.dataLabels), set on the\n // entry alone: on a chart of several entries a chart-level key would reach\n // every one of them. Never called for a reference or statistic line.\n //\n // 'all' labels every point. PowerPoint cannot hide overlapping labels, so\n // 'auto' labels every point up to PPTX_AUTO_LABEL_MAX_POINTS categories\n // and none past that. pptxgenjs cannot label a single point, so 'last'\n // labels none (a documented gap), except on a colorBy chart: there every\n // bar is its own series' latest point on screen, so 'last' labels every\n // bar of the one collapsed series, as 'all' does.\n //\n // A label is written in its axis's format code ('0%' for a share). A\n // stacked bar's sits in the middle of its segment and a line's above its\n // point. A clustered bar keeps PowerPoint's default, outside its end, which\n // pptxgenjs would drop on a one-entry chart if named; an area takes no\n // position at all, and pptxgenjs does not strip one from a combo's area.\n private _withDataLabels(\n entry: PptxEntry,\n config: ChartConfig,\n formatCodes: string[],\n shares: PercentShares | null,\n categoryCount: number,\n ): PptxEntry {\n const mode = config.dataLabels;\n const show = mode === ReportChartDataLabels.All\n || (mode === ReportChartDataLabels.Auto && categoryCount <= PPTX_AUTO_LABEL_MAX_POINTS)\n || (mode === ReportChartDataLabels.Last && isColorBy(config));\n const chartType = config.chartType ?? 'bar';\n\n if (!show || chartType === 'pie' || chartType === 'donut') {\n return entry;\n }\n\n const share = !!shares?.has(entry.indexes[0]);\n const stacked = entry.type === 'bar' && (shares ? share : !!config.stacked);\n const position = this._dataLabelPosition(entry.type, stacked);\n\n return {\n ...entry,\n options: {\n ...entry.options,\n showValue: true,\n dataLabelFormatCode: share ? PPTX_PERCENT_FORMAT_CODE : formatCodes[entry.secondary ? 1 : 0],\n dataLabelFontSize: PPTX_DATA_LABEL_FONT_SIZE,\n ...(position ? { dataLabelPosition: position } : {}),\n },\n };\n }\n\n // A 100% stacked chart's share axis, as on screen: from 0 (-100% when a\n // share is negative) to 100%, a gridline every 25%, in whole percentages.\n private _percentAxisOptions(shares: PercentShares): Record<string, unknown> {\n return {\n valAxisMinVal: percentAxisMin(shares),\n valAxisMaxVal: PERCENT_AXIS_MAX,\n valAxisMajorUnit: PERCENT_AXIS_INTERVAL,\n valAxisLabelFormatCode: PPTX_PERCENT_FORMAT_CODE,\n };\n }\n\n // A two-axis chart's axes, each in its own object: pptxgenjs builds the\n // second value and category axes from the chart's options with these laid\n // over them, so a value-axis key left at the chart level would reach both.\n // The primary value axis is on the left with the category axis under it;\n // the second is on the right, without gridlines of its own, and its\n // category axis is hidden. Each value axis is titled only by its own label\n // and formatted by the measures plotted against it, as on screen. On a 100%\n // stacked chart the primary axis is the share axis, and the second axis's\n // series are not stacked.\n private _twoAxesOptions(\n config: ChartConfig,\n formatCodes: string[],\n shares: PercentShares | null,\n rankAxes: boolean[],\n rankPeaks: number[],\n ): Record<string, unknown> {\n const valueAxis = (axisIndex: ValueAxisIndex) => {\n const axis = axisIndex === 1 ? config.secondaryAxis : config.valueAxis;\n const range = this._valueAxisRangeOptions(axis, axis?.label);\n const rank = rankAxes[axisIndex] ? this._rankAxisOptions(axis, rankPeaks[axisIndex]) : {};\n\n if (shares && axisIndex === 0) {\n return { ...range, ...this._percentAxisOptions(shares) };\n }\n\n return { ...range, valAxisLabelFormatCode: formatCodes[axisIndex], ...rank };\n };\n // The category labels stay under the plot when the primary value axis is\n // a rank axis drawn top-down.\n const category = rankAxes[0]\n ? { ...this._categoryTitleOptions(config), catAxisLabelPos: PPTX_RANK_CATEGORY_LABEL_POS }\n : this._categoryTitleOptions(config);\n\n return {\n ...AXIS_FONT_SIZES,\n valAxes: [valueAxis(0), { ...valueAxis(1), valGridLine: { style: 'none' } }],\n catAxes: [category, { catAxisHidden: true }],\n };\n }\n\n // A rank axis, as on screen: reversed ('maxMin'), so rank 1 is at the top,\n // starting at rank 1 unless the config pins a bound, and labeled in whole\n // ranks. Few ranks are stepped one at a time when the config pins no\n // interval, so no tick falls between two ranks.\n private _rankAxisOptions(axis: ChartValueAxis | undefined, peak: number): Record<string, unknown> {\n const range = valueAxisRange(axis);\n const wholeSteps = range.interval === undefined && peak <= PPTX_RANK_WHOLE_STEP_PEAK;\n\n return {\n valAxisOrientation: 'maxMin',\n valAxisMinVal: range.min ?? RANK_AXIS_MIN,\n valAxisLabelFormatCode: PPTX_RANK_FORMAT_CODE,\n ...(wholeSteps ? { valAxisMajorUnit: 1 } : {}),\n };\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 // The value axis's number format code, matching the screen's ticks: with an\n // axis format (axisNumberFormat, or a waterfall's formatted measure) the\n // units and decimals the screen decides from the same peak; without one,\n // the code for the screen's plain ticks. The peak is the series' or the\n // furthest reference on the axis (reach), whichever is larger; the format\n // helpers read it off a one-point series.\n private _valueAxisCode(\n spec: NumberFormatSpec | null,\n values: (number | null)[][],\n stacked: boolean,\n context: ReportFormatContext,\n reach: number,\n ): string {\n const peak = Math.max(chartValuePeak(values, stacked), reach);\n const peakSeries = [[peak]];\n\n if (!spec) {\n return chartAxisFormatCode(peakSeries, false);\n }\n\n const chart = resolveChartNumberFormat(spec, peak, context);\n\n return numberFormatCode(spec, context, chart, peakSeries, false);\n }\n\n // One native chart when the plan is a single entry, its options laid over\n // the chart's. Otherwise pptxgenjs's multi-type chart, where every entry's\n // own options are laid over the chart's.\n private _addChart(\n slide: any,\n typeMap: Record<string, any>,\n entries: PptxEntry[],\n chartData: unknown[],\n options: Record<string, unknown>,\n ): void {\n if (entries.length === 1) {\n const entry = entries[0];\n slide.addChart(typeMap[entry.type], entry.indexes.map((index) => chartData[index]), { ...options, ...entry.options });\n\n return;\n }\n\n slide.addChart(entries.map((entry) => ({\n type: typeMap[entry.type],\n data: entry.indexes.map((index) => chartData[index]),\n options: entry.options,\n })), options);\n }\n\n // How a chart's series (dataTypes, one per chartData entry) are cut into\n // native charts, and the colors each draws in.\n //\n // A pie's slices and a colorBy chart's collapsed bars are one series colored\n // point by point, so their one entry keeps the whole palette. Every other\n // entry is handed exactly its own series' colors (seriesHex), so a lone bar\n // series is one color, as on screen, rather than a color per bar.\n //\n // Bars share one entry per value axis, since separate bar charts on one axis\n // overlap instead of clustering, and areas likewise, since they stack only\n // inside one area chart. Each line gets an entry of its own, so its line\n // options are its own. pptxgenjs colors a line by its place in its entry but\n // fills its markers by its place across every entry's data, and with a\n // random color past the end of the list, so a line's list is its one color\n // the whole length of the chart's data (totalData, which counts the\n // constant lines after the measures too).\n //\n // An entry on the second value axis (seriesAxisIndexes) plots against the\n // second value and category axes.\n //\n // A line entry draws its measure's line style (PPTX_LINE_DASH) and its\n // markers, or none. On a 100% stacked chart only the share entries stack;\n // a bar or area entry on the second axis is drawn side by side, as on\n // screen.\n //\n // A chart that plots a prior series colors it as the screen does\n // (priorStyles): in its current series' color, and dashed when it is a line\n // whose measure names no line style of its own.\n private _entryPlan(\n dataTypes: string[],\n extracted: ExtractedChartSeries,\n config: ChartConfig,\n axisIndexes: ValueAxisIndex[],\n shares: PercentShares | null,\n totalData: number,\n priorStyles: { colors: string[]; priors: boolean[] } | null,\n ): PptxEntry[] {\n const chartType = config.chartType ?? 'bar';\n if (chartType === 'pie' || chartType === 'donut' || isColorBy(config)) {\n return [{ type: dataTypes[0], indexes: [0], secondary: false, options: { chartColors: REPORT_CHART_COLORS } }];\n }\n\n const entries: PptxEntry[] = [];\n const perAxis = new Map<string, PptxEntry>();\n dataTypes.forEach((type, index) => {\n const secondary = axisIndexes[index] === 1;\n const key = `${type}-${secondary}`;\n let entry = type === 'line' ? undefined : perAxis.get(key);\n\n if (!entry) {\n entry = { type, indexes: [], secondary, options: {} };\n entries.push(entry);\n perAxis.set(key, entry);\n }\n\n entry.indexes.push(index);\n });\n\n const hex = (index: number) => {\n if (!extracted.series[index]) {\n return REPORT_CHART_COLORS[index % REPORT_CHART_COLORS.length];\n }\n\n return priorStyles?.colors[index] ?? seriesHex(extracted.series[index], index);\n };\n\n return entries.map((entry) => ({\n ...entry,\n options: {\n chartColors: entry.type === 'line'\n ? Array<string>(totalData).fill(hex(entry.indexes[0]))\n : entry.indexes.map(hex),\n ...(entry.type === 'line'\n ? this._lineOptions(extracted.series[entry.indexes[0]]?.measure, !!priorStyles?.priors[entry.indexes[0]])\n : {}),\n ...(shares && entry.type !== 'line' && !shares.has(entry.indexes[0])\n ? { barGrouping: entry.type === 'area' ? 'standard' : 'clustered' }\n : {}),\n ...(entry.secondary ? { secondaryValAxis: true, secondaryCatAxis: true } : {}),\n },\n }));\n }\n\n // Where a data label sits: PowerPoint's dLblPos code, or undefined to leave\n // it out (_withDataLabels says why).\n private _dataLabelPosition(type: string, stackedBar: boolean): string | undefined {\n if (type === 'line') {\n return 't';\n }\n\n return stackedBar ? 'ctr' : undefined;\n }\n\n // A line entry's dash and markers. A style PowerPoint has no dash for is\n // drawn solid, and a prior's line dashed unless its measure names a style.\n private _lineOptions(measure: ChartMeasure | undefined, prior = false): Record<string, unknown> {\n const style = measureLineStyle(measure) ?? (prior ? ReportChartLineStyle.Dashed : undefined);\n\n return {\n lineDash: style ? PPTX_LINE_DASH[style] : PPTX_LINE_DASH[ReportChartLineStyle.Solid],\n lineDataSymbol: measure?.markers === false ? 'none' : 'circle',\n lineDataSymbolSize: PPTX_LINE_SYMBOL_SIZE,\n };\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 context: ReportFormatContext,\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 measure = config.measures?.[0];\n const labels = this._categoryLabels(\n waterfall.steps.map((step) => step.category),\n data.granularity,\n context.locale,\n chartDateLabel(config),\n );\n const series = this._waterfallSeries(waterfall.steps);\n // The references are constant lines beside the stacked bars, on the one\n // value axis. Without any the chart is the one stacked bar chart, without\n // a legend; with them the legend names them (_legendPosition), as it\n // alone can, beside the steps' kinds.\n const references = chartReferences(config, false);\n const constants = this._referenceLines(references);\n const legendPosition: LegendPosition = constants.length ? config.legend ?? PPTX_CONSTANT_LEGEND : 'hidden';\n const chartData = [\n ...series.map((entry) => ({ name: entry.name, labels, values: entry.values })),\n ...constants.map((line) => ({ name: line.name, labels, values: labels.map(() => line.value) })),\n ];\n const entries: PptxEntry[] = [\n {\n type: 'bar',\n indexes: series.map((_, index) => index),\n secondary: false,\n options: { chartColors: series.map((entry) => entry.color), barGrouping: 'stacked' },\n },\n ...constants.map((line, index) => this._constantEntry(line, series.length + index, chartData.length)),\n ];\n\n this._addChart(slide, { bar: pptx.ChartType.bar, line: pptx.ChartType.line }, entries, chartData, {\n x, y, w, h,\n showLegend: legendPosition !== 'hidden',\n legendPos: PPTX_LEGEND_POS[legendPosition],\n legendFontSize: 9,\n barDir: config.orientation === 'horizontal' ? 'bar' : 'col',\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 (or the furthest reference); the pieces it is cut into\n // never stack past that. The one measure's format writes it, as on\n // screen.\n valAxisLabelFormatCode: this._valueAxisCode(\n measure && hasNumberFormat(measure) ? measure : null,\n [waterfall.steps.map((step) => step.start + (step.change ?? 0))],\n false,\n context,\n referencePeak(references, 0),\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, in the report's locale and\n // the axis's date label style (a short label takes its year only when the\n // data spans years); PowerPoint can't do a styled second line, so it's\n // inline.\n private _categoryLabels(\n categories: string[],\n granularity: ChartGranularity | null | undefined,\n locale: ReportLocaleTag,\n dateLabel: ReportChartDateLabel,\n ): string[] {\n if (!granularity) {\n return categories;\n }\n\n const multiYear = spansMultipleYears(categories);\n\n return categories.map((category) => formatPeriodLabel(category, granularity, multiYear, locale, dateLabel));\n }\n\n // The axis label and title settings of a chart with one value axis, and that\n // axis's range (valueAxis). A pie has no value axis to title. Without a\n // valueAxis.label the value axis is titled by the first measure's label, as\n // decks always have been; the screen shows only an explicit title. An\n // explicit empty label suppresses that fallback, as it does on screen, and\n // a 100% stacked chart's share axis is never titled with one series' name.\n private _axisTextOptions(config: ChartConfig, pie: boolean): Record<string, unknown> {\n return {\n ...AXIS_FONT_SIZES,\n ...this._categoryTitleOptions(config),\n ...(pie\n ? { showValAxisTitle: false }\n : this._valueAxisRangeOptions(\n config.valueAxis,\n config.valueAxis?.label ?? (config.percentStacked === true ? undefined : config.measures?.[0]?.label),\n )),\n };\n }\n\n private _categoryTitleOptions(config: ChartConfig): Record<string, unknown> {\n return {\n showCatAxisTitle: !!config.xAxis?.label,\n catAxisTitle: config.xAxis?.label,\n catAxisTitleFontSize: 10,\n };\n }\n\n // One value axis's title and the range the config pins (valueAxisRange, as\n // on screen). Every key is set, even when empty, so on a two-axis chart\n // nothing is inherited from the chart's options.\n private _valueAxisRangeOptions(axis: ChartValueAxis | undefined, title: string | undefined): Record<string, unknown> {\n const range = valueAxisRange(axis);\n\n return {\n showValAxisTitle: !!title,\n valAxisTitle: title || undefined,\n valAxisMinVal: range.min,\n valAxisMaxVal: range.max,\n valAxisMajorUnit: range.interval,\n };\n }\n\n // A list's table, without the columns the viewer hid. A totals row closes\n // it, bold on the border gray, in a row kept free for it.\n private _renderTable(\n slide: any,\n component: ReportComponent,\n data: ComponentData,\n hiddenColumns: readonly string[],\n timezone: string,\n context: ReportFormatContext,\n x: number, y: number, w: number, h: number,\n ): void {\n const columns = listColumns(component, data, context.locale, hiddenColumns);\n const totals = listTotalsRow(data, columns, timezone, context);\n\n const cap = Math.max(2, Math.floor(h / SLIDE_ROW_H) - 1 - (totals ? 1 : 0));\n const rows = data.rows.slice(0, cap);\n const remaining = (data.paging?.total ?? data.rows.length) - rows.length;\n\n // A column of formatted numbers is right-aligned, its heading too, as on\n // screen.\n const align = (index: number) => (columns[index]?.numeric ? { align: 'right' } : {});\n\n const header = listHeadings(component, data, context.locale, hiddenColumns).map((heading, index) => ({\n text: heading,\n options: { bold: true, color: 'FFFFFF', fill: { color: '4E79A7' }, ...align(index) },\n }));\n\n // A date or formatted-number cell is a value written in the report's\n // locale; every other cell prints the query's text as it came.\n const valueLocale = (index: number) => {\n const column = columns[index];\n\n return column.numeric || column.format === ReportListColumnFormat.Date ? context.locale : undefined;\n };\n\n const body = rows.map((row) => columns.map((column, index) => ({\n text: exportCell(row[column.column], column, timezone, context, row),\n options: pptxRunOptions(align(index), valueLocale(index)),\n })));\n\n if (remaining > 0) {\n body.push([{\n text: moreRowsNotice(remaining),\n options: { colspan: columns.length, italic: true, color: MUTED_COLOR } as any,\n }]);\n }\n\n // The label is interface text, so it keeps the default proofing language.\n if (totals) {\n const labelColumn = listTotalsLabelColumn(columns, data.totals);\n\n body.push(totals.map((text, index) => ({\n text,\n options: pptxRunOptions(\n { bold: true, fill: { color: 'E4E7EB' }, ...align(index) },\n columns[index].column === labelColumn ? undefined : valueLocale(index),\n ),\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 // A KPI tile: the card the screen draws (kpi-card.ts decides every line),\n // as native text boxes and shapes stacked and centered in the body. A card\n // with only its value and label keeps the tile's long-standing single text\n // box.\n private _renderKpi(\n pptx: any,\n slide: any,\n item: CollectedComponent,\n timezone: string,\n context: ReportFormatContext,\n x: number, y: number, w: number, h: number,\n ): void {\n const config = item.component.config as KpiConfig;\n const view = kpiCardView(config, item.data, { format: context, timezone });\n const notes = exportNoteLines(item, timezone, context.locale);\n\n if (!kpiCardHasExtras(view, notes)) {\n slide.addText([\n {\n text: view.value,\n options: pptxRunOptions({ fontSize: 28, bold: true, color: '1F2933', breakLine: true }, context.locale),\n },\n { text: view.label, options: { fontSize: 10, color: MUTED_COLOR } },\n ], {\n x, y, w, h,\n align: 'center',\n valign: 'middle',\n });\n\n return;\n }\n\n // A tile too short for the card's lines shrinks them all alike.\n const parts = kpiExportParts(view, notes, h, KPI_HEIGHTS);\n const heights = scaledKpiHeights(KPI_HEIGHTS, parts.scale);\n const lineFontSize = KPI_LINE_FONT_SIZE * parts.scale;\n let top = y + Math.max(0, (h - kpiExportHeight(view, parts, heights)) / 2);\n const line = (runs: any[] | string, rowH: number, options: Record<string, unknown>) => {\n slide.addText(runs, {\n x, y: top, w, h: rowH,\n align: 'center', valign: 'middle', margin: 0, fit: 'none', ...options,\n });\n top += rowH;\n };\n\n line(\n [{ text: view.value, options: pptxRunOptions({ bold: true, color: '1F2933' }, context.locale) }],\n heights.value,\n { fontSize: 28 * parts.scale },\n );\n\n if (view.label) {\n line(view.label, heights.label, { fontSize: 10 * parts.scale, color: MUTED_COLOR });\n }\n\n if (parts.delta && view.delta) {\n this._kpiDelta(pptx, slide, view.delta, context, x, top, w, parts.scale);\n top += heights.delta;\n }\n\n if (parts.window) {\n const days = this._fitEstimate(view.window, lineFontSize, w);\n\n line([{ text: days, options: pptxRunOptions({}, context.locale) }], heights.window, {\n fontSize: lineFontSize, color: MUTED_COLOR,\n });\n }\n\n if (parts.target && view.target) {\n this._kpiTarget(pptx, slide, view.target, x, top, w);\n top += heights.target;\n }\n\n if (parts.sparkline && view.sparkline) {\n this._kpiSparkline(pptx, slide, item, view.sparkline.values, view.label, x, top, w);\n top += heights.sparkline;\n }\n\n if (parts.notes.length) {\n const fitted = parts.notes.map((note) => this._fitEstimate(note, SMALL_FONT_SIZE, w));\n\n line(this._lineRuns(fitted, { italic: true }), parts.notes.length * heights.note, {\n fontSize: SMALL_FONT_SIZE, color: MUTED_COLOR,\n });\n }\n }\n\n // The delta row: the change in the color of what it means and what it is\n // compared with in grey, as one centered text box, with a triangle beside\n // it pointing the way the value moved (none when the shown change rounds to\n // zero). PowerPoint lays the text out itself, so the triangle sits where\n // the text's estimated width puts its start.\n private _kpiDelta(\n pptx: any,\n slide: any,\n delta: KpiCardDelta,\n context: ReportFormatContext,\n x: number, top: number, w: number,\n scale = 1,\n ): void {\n const color = REPORT_KPI_CHANGE_COLORS[delta.tone];\n const fontSize = KPI_LINE_FONT_SIZE * scale;\n const rowH = KPI_HEIGHTS.delta * scale;\n const side = KPI_ARROW * scale;\n const arrow = delta.trend === ReportKpiTrend.Flat ? 0 : side + KPI_ARROW_GAP * scale;\n const changeW = this._estimatedWidth(delta.text, fontSize);\n const compared = delta.compared\n ? this._fitEstimate(` ${delta.compared}`, fontSize, w - arrow - changeW)\n : '';\n const textW = Math.min(w - arrow, changeW + this._estimatedWidth(compared, fontSize));\n const runs = [\n { text: delta.text, options: pptxRunOptions({ bold: true, color }, context.locale) },\n ...(compared ? [{ text: compared, options: { color: MUTED_COLOR } }] : []),\n ];\n\n slide.addText(runs, {\n x: x + arrow, y: top, w: Math.max(0.1, w - arrow), h: rowH,\n fontSize, align: 'center', valign: 'middle', margin: 0, fit: 'none',\n });\n\n if (arrow) {\n slide.addShape(pptx.ShapeType.triangle, {\n x: Math.max(x, x + (w - arrow - textW) / 2),\n y: top + (rowH - side) / 2,\n w: side,\n h: side,\n fill: { color },\n line: { color, width: 0 },\n flipV: delta.trend === ReportKpiTrend.Down,\n });\n }\n }\n\n // About how wide a line of text runs, inches: PowerPoint lays it out, so\n // only an estimate from its average character width is to hand.\n private _estimatedWidth(text: string, fontSize: number): number {\n return text.length * fontSize * PPTX_CHAR_WIDTH / 72;\n }\n\n // The text cut with an ellipsis to about the width, so a line that would\n // wrap past its row stays one line.\n private _fitEstimate(text: string, fontSize: number, width: number): string {\n if (this._estimatedWidth(text, fontSize) <= width) {\n return text;\n }\n\n const chars = Math.max(0, Math.floor(width * 72 / (fontSize * PPTX_CHAR_WIDTH)) - 1);\n\n return chars ? `${text.slice(0, chars).trimEnd()}…` : '';\n }\n\n // The target line ('Goal: $1,000 · 56% of target') and, when the server sent\n // the progress, a bar filled that far: green once the target is met.\n private _kpiTarget(pptx: any, slide: any, target: KpiCardTarget, x: number, top: number, w: number): void {\n const text = target.progress ? `${target.text} · ${target.progress}` : target.text;\n\n slide.addText(this._fitEstimate(text, KPI_LINE_FONT_SIZE, w), {\n x, y: top, w, h: KPI_TARGET_TEXT_H,\n fontSize: KPI_LINE_FONT_SIZE, color: MUTED_COLOR, align: 'center', valign: 'middle', margin: 0, fit: 'none',\n });\n\n if (target.fill === null) {\n return;\n }\n\n const barW = Math.min(w * 0.6, KPI_BAR_W);\n const barX = x + (w - barW) / 2;\n const barY = top + KPI_TARGET_TEXT_H + KPI_BAR_GAP;\n const bar = (width: number, color: string) => slide.addShape(pptx.ShapeType.rect, {\n x: barX, y: barY, w: width, h: KPI_BAR_H, fill: { color }, line: { color, width: 0 },\n });\n\n bar(barW, KPI_TRACK_COLOR);\n\n if (target.fill > 0) {\n bar(barW * target.fill, REPORT_KPI_CHANGE_COLORS[target.tone]);\n }\n }\n\n // The sparkline as a native line chart with its axes, gridlines and legend\n // hidden, scaled from its lowest value to its highest as on screen, its\n // periods and values in the chart's data sheet. A gap stays a gap. Markers\n // show only when a value stands alone between gaps (the last one too),\n // which a line cannot draw.\n private _kpiSparkline(\n pptx: any,\n slide: any,\n item: CollectedComponent,\n values: (number | null)[],\n label: string,\n x: number, top: number, w: number,\n ): void {\n const numbers = values.filter((value): value is number => value !== null);\n const low = Math.min(...numbers);\n const high = Math.max(...numbers);\n const pad = high === low ? Math.max(1, Math.abs(high)) : 0;\n const boxW = Math.min(w * 0.7, KPI_SPARKLINE_W);\n const geometry = kpiSparklineGeometry(values, false);\n // kpiSparklineGeometry keeps the last point out of the dots, as the\n // screen marks it apart; a last value after a gap is a lone point too.\n const lastStandsAlone = values[values.length - 1] !== null\n && (values.length === 1 || values[values.length - 2] === null);\n const periods = item.data?.kpi?.sparkline?.points?.map((point) => point.period) ?? [];\n const color = REPORT_KPI_SPARKLINE_COLOR;\n\n this._addChart(slide, { line: pptx.ChartType.line }, [{\n type: 'line',\n indexes: [0],\n secondary: false,\n options: {\n chartColors: [color],\n lineSize: 1.5,\n lineDataSymbol: geometry.dots.length || lastStandsAlone ? 'circle' : 'none',\n lineDataSymbolSize: 4,\n },\n }], [{\n name: label || KPI_SPARKLINE_NAME,\n labels: values.map((_, index) => periods[index] ?? String(index + 1)),\n values,\n }], {\n x: x + (w - boxW) / 2, y: top, w: boxW, h: KPI_HEIGHTS.sparkline,\n showLegend: false,\n showTitle: false,\n catAxisHidden: true,\n valAxisHidden: true,\n catAxisLineShow: false,\n valAxisLineShow: false,\n showCatAxisTitle: false,\n showValAxisTitle: false,\n valGridLine: { style: 'none' },\n catGridLine: { style: 'none' },\n valAxisMinVal: low - pad,\n valAxisMaxVal: high + pad,\n ...BLANKS_AS_GAPS,\n });\n }\n\n private _slug(name: string): string {\n return name.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '') || 'report';\n }\n}\n\n// Gives a text table's cell the grid slots it covers from its top left: as\n// many columns as are free in its top row, and as many rows down as are free\n// across those columns, at most its own spans. A slot is free until a cell\n// placed before it holds it, and the grid holds only the kept rows. So a span\n// the box cuts ends at the last kept row, and one the html makes overlap\n// another cell (which a browser draws on top of it) ends where they meet.\nfunction claimSlots(slots: (TextTableCell | null)[][], cell: TextTableCell): void {\n const free = (row: number, column: number) => row < slots.length && column < slots[row].length && !slots[row][column];\n const columns = (count: number) => Array.from({ length: count }, (_, offset) => cell.column + offset);\n let colSpan = 0;\n let rowSpan = 0;\n\n while (colSpan < cell.colSpan && free(cell.row, cell.column + colSpan)) {\n colSpan++;\n }\n while (colSpan && rowSpan < cell.rowSpan && columns(colSpan).every((column) => free(cell.row + rowSpan, column))) {\n rowSpan++;\n }\n\n const claimed = { ...cell, colSpan, rowSpan };\n for (let row = cell.row; row < cell.row + rowSpan; row++) {\n slots[row].fill(claimed, cell.column, cell.column + colSpan);\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 { escapeHtml } from '../text';\nimport {\n BuiltExport, CollectedReport, ReportExportCollectorService, failedPageNames,\n} 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 at an export gate. Retry, offered only when the export\n// is incomplete, re-runs the whole collection — the queries that failed were\n// killed on a clock, not on anything about the data, so a second attempt\n// against a warmed database genuinely often succeeds. Download keeps going.\nconst RETRY = 'retry';\nconst DOWNLOAD = 'download';\n\n// Runs a report export end to end: collect every tile and value, refuse to\n// write a file that is missing any of them without saying so, build it, refuse\n// to save one whose text does not fit its boxes without saying so, then save.\n//\n// The gates are 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//\n// Failures are decided before the build, which is the expensive part (every\n// chart drawn offscreen, every text block measured), so neither a Retry nor a\n// Cancel pays for one. Text that does not fit its box is known only after it:\n// the build is what measures 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.build(collected));\n }\n\n public powerpoint(report: Report): Observable<unknown> {\n return this._run(report, PPTX_LIST_ROWS, (collected) => this._pptxService.build(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 build: (collected: CollectedReport) => Promise<BuiltExport>,\n ): Observable<unknown> {\n return this._collector.collect(report, listRows)\n .pipe(\n switchMap((collected) => this._failureGate(collected)\n .pipe(\n switchMap((choice) => choice === RETRY\n ? this._run(report, listRows, build)\n : this._buildAndSave(collected, build)),\n )),\n );\n }\n\n // Builds the file, then saves it once the overflow gate lets it through.\n private _buildAndSave(\n collected: CollectedReport,\n build: (collected: CollectedReport) => Promise<BuiltExport>,\n ): Observable<unknown> {\n return from(build(collected))\n .pipe(\n switchMap((built) => this._overflowGate(built)\n .pipe(\n switchMap(() => from(Promise.resolve(built.save()))),\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 // builds and no error surfaces — they know what they just declined.\n private _failureGate(collected: CollectedReport): Observable<string> {\n const failed = failedPageNames(collected).map(escapeHtml);\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 or values 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 // Resolves to DOWNLOAD when every text block fits its box in the built file,\n // or the user accepted one that does not. There is no Retry: the words are\n // the report's own, so a second attempt would build the same file. Each block\n // is named by its page and the start of its words, and the note says what\n // this format does with the rest. Cancelling ends the export quietly, as at\n // the failure gate, and the built file is dropped unsaved.\n private _overflowGate(built: BuiltExport): Observable<string> {\n if (!built.overflows.length) {\n return of(DOWNLOAD);\n }\n\n // A block with no words to quote (an empty table, say) is named by its\n // page alone, not by an empty pair of quotes.\n const blocks = built.overflows\n .map((overflow) => `<strong>${escapeHtml(overflow.page)}</strong>`\n + (overflow.snippet ? ` (“${escapeHtml(overflow.snippet)}”)` : ''));\n\n return this._prompt.confirm({\n title: 'Text does not fit',\n template: `Some text does not fit its box: ${blocks.join(', ')}. ${built.overflowNote}`,\n buttons: [\n { label: 'Download Anyway', value: DOWNLOAD, color: 'primary' },\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 { ReportTextLayoutService } from '../../export/report-text-layout.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 ReportTextLayoutService,\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. The picker list and structure both\n // reload on save (a page resize re-renders the 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() }} ·\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 { ReportTextLayoutService } from '../../export/report-text-layout.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 ReportTextLayoutService,\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, 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';\nexport * from './app/reports/enums/report-value-format.enum';\nexport * from './app/reports/enums/report-value-formula.enum';\nexport * from './app/reports/enums/report-list-column-format.enum';\nexport * from './app/reports/enums/report-number-units.enum';\nexport * from './app/reports/enums/report-chart-data-labels.enum';\nexport * from './app/reports/enums/report-chart-color.enum';\nexport * from './app/reports/enums/report-chart-line-style.enum';\nexport * from './app/reports/enums/report-chart-mark-stat.enum';\nexport * from './app/reports/enums/report-chart-date-label.enum';\nexport * from './app/reports/enums/report-change-polarity.enum';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["EMPTY_VALUE","isPointsChange","TOKENS","rxFilter","i1","priorWindowText","earliestOf","latestOf","map","switchMap","tap","i3","i4","MatOption","i2","catchError","i5","i9","TITLE_H","SUBTITLE_H","NOTE_LINE_H","MIN_BODY_H","MUTED_COLOR","KPI_HEIGHTS","KPI_ARROW","KPI_ARROW_GAP","KPI_BAR_W","KPI_BAR_H","KPI_TRACK_COLOR","KPI_SPARKLINE_W","i6"],"mapp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