@formancy/report-render-pdf 0.1.0 → 0.3.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chart-draw-CUcWXjN9.mjs","names":["setZrenderPlatform","PieSeries","held"],"sources":["../src/chart-measure.ts","../src/chart-svg.ts","../src/chart-arcs.ts","../src/chart-draw.ts"],"sourcesContent":["import { platformApi } from 'zrender/lib/core/platform.js'\nimport type { ChartFace, ChartFaces } from './chart-faces.js'\nimport type { FaceWidths } from './engine.js'\n\n/**\n * zrender's platform for one chart's layout (0058). ECharts measures every\n * word it places through zrender's `platformApi.measureText`, and pdfmake\n * prints the word where ECharts placed it, so the measurer answers in the\n * width pdfmake prints the word in: the engine's (`Engine.widths`), in the\n * face, weight and size the chart's style names (`chart-faces.ts`). zrender\n * asks the width of 国 for a font's line (contain/text.js\n * `getLineHeight`), answered with the face's line, pdfmake's, never the\n * width PDFKit gives it, which in a face without the character is its\n * .notdef glyph's. A chart's words are never 国: the report prints no Han\n * character (`refusedCharacter`, 0043).\n *\n * A font string the measurer was not handed is refused: a width for it\n * would be one of a face nobody chose, as zrender's own 12px sans-serif is,\n * which a pie's default label layout measures in. A canvas and an image are\n * refused too: the layout into an SVG string needs neither, and a canvas\n * would measure in the browser's fonts, an image be fetched by its address.\n *\n * zrender's platform is one for the process or the page, which a host's\n * own ECharts measures through as well. ECharts' layout is synchronous, so\n * the measurer, set for one layout and put back after it, whether the\n * layout returned or threw, is never seen by another layout, in Node or in\n * a page; a layout that returns a promise, which would measure after its\n * measurer was put back, is refused. Nothing of the measurer, the render's\n * widths least of all, outlives the layout. What does is zrender's: it\n * keeps the widths it was answered, process-wide, by the whole font string,\n * which names a face by the bytes it embeds (`ChartFace.font`), so a width\n * it kept is the width of those bytes -- and by the words themselves, up to\n * 500 words for each of 100 font strings (contain/text.js), so a chart's\n * categories, legend entries and title stay in the process after its\n * render, and nothing zrender exports clears them.\n *\n * Imported by the drawing alone, which a document with a chart loads\n * (`chart-draw.ts`), so that it is in the chunk that carries ECharts.\n */\n\n/**\n * zrender's platform, as far as a layout's measuring reads and replaces it:\n * three functions, none of which reads `this` -- zrender's own name\n * `platformApi` (core/platform.js) -- so that each is taken and put back\n * as the function it is.\n */\nexport interface Platform {\n measureText(this: void, text: string, font?: string): { width: number }\n createCanvas(this: void): unknown\n loadImage(this: void, src: string, onload: () => void, onerror: () => void): unknown\n}\n\n/** zrender's platform, the one ECharts measures through, as `Platform` views it. */\nexport const platform: Platform = platformApi\n\n/** `to`'s three functions set as zrender's. */\nfunction set(to: Platform): void {\n platform.measureText = to.measureText\n platform.createCanvas = to.createCanvas\n platform.loadImage = to.loadImage\n}\n\n/**\n * What `lay` returns, run with the three functions `replace` makes of\n * those that stand -- which it may call, as a wrapper does -- set as\n * zrender's, and the three that stood put back after it, also when it\n * throws: the one place zrender's platform is replaced, for a render's\n * layout and for the tests that look on.\n */\nexport function withPlatform<T>(replace: (standing: Platform) => Platform, lay: () => T): T {\n const standing: Platform = { measureText: platform.measureText, createCanvas: platform.createCanvas, loadImage: platform.loadImage }\n set(replace(standing))\n try {\n return lay()\n } finally {\n set(standing)\n }\n}\n\n/** zrender's probe for a font's line: the width of this character, which it takes as a line's height. */\nconst LINE_PROBE = '国'\n\n/** The font string zrender measures `face`'s words in: style, weight, size in pixels and family, joined as ECharts' `getFont` and zrender's `Text` join them. */\nconst fontOf = ({ font }: ChartFace): string => `${font.fontStyle} ${font.fontWeight} ${String(font.fontSize)}px ${font.fontFamily}`\n\n/**\n * What `lay` returns, run with zrender's `measureText` answering in\n * `faces` by `widths` -- 国 with the face's line -- and `createCanvas` and\n * `loadImage` refusing; the three put back as they were after it, also\n * when it throws. `lay` is the whole of one synchronous layout: a measure\n * it left for later would be answered by whatever stands then, so a\n * promise it returns is refused, once the three are back, and its outcome\n * left unread, so that a rejection of it is not left unhandled.\n */\nexport function withMeasurer<T>(faces: ChartFaces, widths: FaceWidths, lay: () => T): T {\n const handed = new Map((faces.title === undefined ? [faces.words] : [faces.words, faces.title]).map((face) => [fontOf(face), face]))\n const measurer: Platform = {\n measureText: (text, font) => {\n const face = font === undefined ? undefined : handed.get(font)\n if (face === undefined) throw new Error(`a chart's layout measured text in a font it was not handed: ${font === undefined ? 'none' : `'${font}'`}`)\n return { width: text === LINE_PROBE ? face.line : widths.width(face.family, face.face, face.size, text) }\n },\n createCanvas: () => {\n throw new Error(\"a chart's layout asked for a canvas\")\n },\n loadImage: () => {\n throw new Error(\"a chart's layout asked for an image\")\n },\n }\n const laid = withPlatform(() => measurer, lay)\n if (isThenable(laid)) {\n laid.then(undefined, () => undefined)\n throw new Error(\"a chart's layout returned a promise, and would measure after its measurer was put back\")\n }\n return laid\n}\n\n/** Whether `value` is a promise, or anything else that settles later. */\nfunction isThenable(value: unknown): value is PromiseLike<unknown> {\n return (typeof value === 'object' || typeof value === 'function') && value !== null && typeof (value as { then?: unknown }).then === 'function'\n}\n","import { RenderRefusal, type AxisChart, type PieChart } from '@formancy/report-runtime'\nimport type { ChartFace, ChartFaces } from './chart-faces.js'\nimport { AXIS, GRID, type ChartWord } from './chart-option.js'\nimport type { FaceWidths } from './engine.js'\nimport { PDF_A_NESTING } from './svg-pdfa.js'\n\n/**\n * The SVG ECharts writes of a chart, held to what ECharts 6.1.0 was seen to\n * write and read back (0058). ECharts lays a chart out and draws its marks,\n * and pdfmake prints each of its words where ECharts placed it: the drawing\n * pdfmake's SVG converter is handed holds no word, no style sheet and no\n * clip. Each `<text>` is taken out and read back as the box pdfmake prints\n * its word in, and the one `<style>` ECharts writes, of hover rules that\n * print nothing, is removed.\n *\n * So is every clip it writes, which ECharts 6.1.0 writes of a line series\n * alone (`chart-svg.test.ts`): it clips a bar by working out each one, and\n * a pie and a legend not at all. It clips every line series to its plot,\n * whatever its `clip` says: to the plot widened by half the line's width,\n * or, with `clip: false`, as the option sets it, by the plot's longer side\n * (LineView.js `createLineClipPath`); and svg-to-pdfkit draws a clip path\n * as a group the size of the page under a luminosity soft mask, which a\n * reader composites for each series. It cuts nothing: every value stands\n * inside the ticks (`check-chart.ts`), and what a clip holds is stroked\n * with bevelled joins and butt ends, which stand no farther from a line's\n * points than half its width, and is refused stroked otherwise. Each clip\n * is still held as it is written, a path it defines once in zrender's\n * black, before it is taken out with every `clip-path` that names it; the\n * line is drawn as ECharts wrote it, inside the chart's box, which the\n * converter clips it to.\n *\n * A pie's arcs alone are not as ECharts wrote them: the drawing writes them\n * again before they are read (`chart-arcs.ts`). zrender writes a slice's\n * arc between ends rounded to a tenth of a point, and the converter draws\n * an arc on the circle through its ends: in the renders measured on\n * 2026-11-13, up to 5 pt off the pie's near half a turn and 69 pt near a\n * whole one, or no circle at all, and nothing drawn. Written again, each\n * is arcs of at most a quarter turn on the pie's own circle, in the\n * grammar ECharts writes an arc in, so that the reader holds them, and\n * every number of them the converter is handed, as it holds ECharts' own.\n *\n * The drawing is ECharts', made of the runtime's words, and read as\n * untrusted: it is held whole before anything of it is used, and refused\n * as `unsupported`, naming the chart and quoting nothing of the drawing,\n * where it holds\n *\n * - an element or an attribute `CHART_DRAWN` does not list, an element\n * inside one ECharts does not write it in, a value ECharts does not\n * write an attribute with, or a `<text>` or the `<svg>` without what\n * reading it needs, or a shape without its fill, which zrender always\n * writes and SVG paints black where it is left out;\n * - a comment, a DOCTYPE or a processing instruction; or CDATA but in the\n * one style sheet, a child of the `<svg>`, every selector of whose rules\n * ends in `:hover`;\n * - an entity or a character reference but the five zrender's `encodeHTML`\n * writes, `&amp; &lt; &gt; &quot; &#39;`, or a character it escapes,\n * unescaped;\n * - a number that is not finite, or past the box by more than the box's\n * longer side -- of a path, each point it reaches as the converter takes\n * it, a relative step's from the point before it and never the step, and\n * an arc's radius, every arc a circle's (`reached`): every number the\n * converter writes of a chart is then far under what a PDF/A holds\n * (`svg-pdfa.ts`'s `SVG_INTEGER_BOUND`);\n * - groups nested deeper than a PDF/A nests the graphics state;\n * - a `fill` or a `stroke` the option did not name -- the block's, the\n * grid's, the axis's or the words' -- `none` and `transparent` aside, or\n * in a clip path anything but zrender's black, a mask that paints\n * nothing; or a clip by a path it does not define once;\n * - a stroke inside a clip but with bevelled joins and butt ends, a\n * join written or not, since SVG mitres one it is not told of: the\n * condition on which the clip, taken out, cut nothing;\n * - a `<text>` turned or scaled, which the option never asks for;\n * - a `<text>` whose word, its entities read, is not one of the words the\n * layout prints not yet placed, in its face; or a word the layout prints\n * that no `<text>` holds. An empty `<text>` is no word.\n *\n * A word's box is where pdfmake prints it, which is where zrender laid it\n * out: as wide as the word's advance in its face (`FaceWidths.width`), its\n * left by its anchor -- its start, its middle or its end -- at its\n * translation and its own x; `dominant-baseline: central`, as zrender lays\n * it out and svg-to-pdfkit reads it, is the centre of the face's line at\n * its translation and its own y, so that its top is half a line above, and\n * its baseline the face's ascent below its top.\n *\n * Two words of one text in one face print alike, but are not one word: a\n * tick's label and a value's stand apart, and the layout's rules read\n * which is which. They are told apart by the order ECharts 6.1.0 writes a\n * chart's words in (`WRITTEN`).\n */\n\n/** A number as zrender writes one: JavaScript's own spelling of a double -- a sign, digits, a point and digits, an exponent. */\nconst NUMBER = String.raw`-?\\d+(?:\\.\\d+)?(?:e[+-]?\\d+)?`\n\n/** A fill or a stroke as zrender writes one: a hex colour, or nothing. */\nconst PAINT = '#[0-9a-f]{3}|#[0-9a-f]{6}|none|transparent'\n\n/** A translation as zrender writes one, to four places. */\nconst TRANSLATE = String.raw`translate\\(${NUMBER} ${NUMBER}\\)`\n\n/**\n * Each element of the drawing as ECharts 6.1.0 writes it: its attributes,\n * each with the values it is written with, those it is never written\n * without that the drawing is read by, and what it is written inside, the\n * `<svg>` inside nothing.\n */\nconst VOCABULARY: Readonly<\n Record<string, { readonly attributes: Readonly<Record<string, string>>; readonly required?: readonly string[]; readonly inside: readonly string[] }>\n> = {\n svg: {\n attributes: {\n width: NUMBER,\n height: NUMBER,\n xmlns: String.raw`http://www\\.w3\\.org/2000/svg`,\n 'xmlns:xlink': String.raw`http://www\\.w3\\.org/1999/xlink`,\n version: String.raw`1\\.1`,\n baseProfile: 'full',\n viewBox: `${NUMBER} ${NUMBER} ${NUMBER} ${NUMBER}`,\n },\n required: ['width', 'height', 'viewBox'],\n inside: [],\n },\n // A shape zrender always writes with its fill, `none` where it fills nothing (svg/mapStyleToAttrs.js): one without paints black.\n rect: { attributes: { width: NUMBER, height: NUMBER, x: NUMBER, y: NUMBER, fill: PAINT }, required: ['fill'], inside: ['svg', 'g'] },\n path: {\n attributes: {\n // As zrender's path writer writes one (svg/SVGPathRebuilder.js): a move, then moves, lines, a rectangle's sides relative,\n // curves, arcs and closes, each its letter and its numbers, a space between them; an arc a circle's, unturned, as ECharts\n // draws every one (`arc`, its radius twice) and the drawing writes a pie's again (`chart-arcs.ts`), its flags 0 or 1. Or\n // nothing at all, which ECharts writes for a line series with no value at any category beside one that has (ECPolyline),\n // and the converter draws as nothing.\n d: String.raw`(?:M${NUMBER} ${NUMBER}(?:[MLl]${NUMBER} ${NUMBER}|C${NUMBER}(?: ${NUMBER}){5}|Q${NUMBER}(?: ${NUMBER}){3}|A(?<radius>${NUMBER}) \\k<radius> 0 [01] [01] ${NUMBER} ${NUMBER}|Z)*)?`,\n // A path moved, or a line's marker scaled and moved.\n transform: String.raw`${TRANSLATE}|matrix\\(${NUMBER}(?:,${NUMBER}){5}\\)`,\n fill: PAINT,\n stroke: PAINT,\n 'stroke-width': NUMBER,\n 'stroke-linecap': 'butt|round|square',\n 'stroke-linejoin': 'miter|round|bevel',\n 'stroke-miterlimit': NUMBER,\n 'pointer-events': 'visible',\n class: String.raw`zr\\d+-cls-\\d+`,\n ecmeta_series_index: String.raw`\\d+`,\n ecmeta_data_index: String.raw`\\d+`,\n ecmeta_ssr_type: 'chart|legend',\n ecmeta_silent: 'true',\n },\n required: ['fill'],\n inside: ['svg', 'g', 'clipPath'],\n },\n text: {\n attributes: {\n 'dominant-baseline': 'central',\n 'text-anchor': 'start|middle|end',\n // A word's face as zrender writes a separate font (svg/graphic.js `brushSVGTSpan`), its family as `ChartFace.font` names it.\n style: String.raw`font-size:${NUMBER}px;font-family:[\\w-]+, f[0-9a-f]{64};(?:font-style:italic;)?(?:font-weight:bold;)?`,\n 'xml:space': 'preserve',\n x: NUMBER,\n y: NUMBER,\n // Moved, and never turned or scaled: the option turns no word.\n transform: TRANSLATE,\n fill: PAINT,\n },\n required: ['dominant-baseline', 'text-anchor', 'style'],\n inside: ['svg', 'g'],\n },\n g: { attributes: { 'clip-path': String.raw`url\\(#[A-Za-z][\\w-]*\\)` }, inside: ['svg', 'g'] },\n defs: { attributes: {}, inside: ['svg'] },\n clipPath: { attributes: { id: String.raw`[A-Za-z][\\w-]*` }, inside: ['defs'] },\n style: { attributes: {}, inside: ['svg'] },\n}\n\n/** An element's vocabulary as the reader holds a drawing to it: each attribute's values a whole match. */\ninterface Vocabulary {\n readonly values: ReadonlyMap<string, RegExp>\n readonly required: readonly string[]\n readonly inside: ReadonlySet<string>\n}\n\n/** `VOCABULARY`, as the reader holds a drawing to it. */\nconst ELEMENTS: ReadonlyMap<string, Vocabulary> = new Map(\n Object.entries(VOCABULARY).map(([element, { attributes, required = [], inside }]) => [\n element,\n {\n values: new Map(Object.entries(attributes).map(([attribute, pattern]) => [attribute, new RegExp(`^(?:${pattern})$`)])),\n required,\n inside: new Set(inside),\n },\n ]),\n)\n\n/**\n * What ECharts 6.1.0 writes for a bar, a line and a pie, as the spike that\n * chose how a chart is drawn listed it (0058): each element and its\n * attributes, less the spike's `fill-opacity`, which only ECharts' theme's\n * title and legend backgrounds were written with and the option's\n * transparent ones are not; `chart-svg.test.ts` holds the list to what the\n * three kinds are drawn with. svg-content.ts's `DRAWN` is an asset's, and\n * neither borrows the other's.\n */\nexport const CHART_DRAWN: ReadonlyMap<string, ReadonlySet<string>> = new Map([...ELEMENTS].map(([element, { values }]) => [element, new Set(values.keys())]))\n\n/** Whether `d` is a path as ECharts writes one, which the reader holds (`VOCABULARY`). */\nexport const heldPath = (d: string): boolean => ELEMENTS.get('path')?.values.get('d')?.test(d) === true\n\n/** The attributes whose numbers are coordinates or lengths in the drawing, each held to the box; a path's are the points it reaches (`reached`). */\nconst MEASURES: ReadonlySet<string> = new Set(['width', 'height', 'x', 'y', 'stroke-width', 'stroke-miterlimit', 'viewBox', 'transform'])\n\n/** Every number in an attribute's value, each read by `matchAll`, which reads a copy. */\nconst NUMBERS = new RegExp(NUMBER, 'g')\n\n/**\n * The order ECharts 6.1.0 writes a chart's words in, by the kind of word\n * its key names: the value axis's title, the category axis's, the ticks',\n * the categories', the values' series by series, the legend's and the\n * chart's title, each kind in its own order (`chart-svg.test.ts`).\n */\nconst WRITTEN: readonly string[] = ['valueTitle', 'categoryTitle', 'tick', 'category', 'value', 'legend', 'title']\n\n/** One word a chart prints, in the face it prints in, and the box pdfmake prints it in, in points from the chart's top left. */\nexport interface PlacedWord extends ChartWord {\n readonly face: ChartFace\n /** The box's left and top, its width the word's advance and its height the face's line. */\n readonly x: number\n readonly top: number\n readonly width: number\n readonly height: number\n}\n\n/** An element of the drawing as read: its name, its attributes as written, the elements it holds, and a `<text>`'s word as written. */\ninterface Element {\n readonly name: string\n readonly attributes: ReadonlyMap<string, string>\n readonly children: Element[]\n written: string\n}\n\n/** What refuses the drawing of a chart, saying what the drawing does, never quoting it. */\ntype Refuse = (what: string) => never\n\n/**\n * `svg` held to CHART_DRAWN and returned without its `<text>` elements and\n * without the one `<style>` of hover rules ECharts writes (0058: no word\n * and no stylesheet reaches the converter); its words read back where\n * pdfmake will draw them; `printed` the words this layout prints, each\n * placed once (none of them empty: an empty word prints nothing).\n */\nexport function readChartSvg(\n svg: string,\n chart: AxisChart | PieChart,\n printed: readonly ChartWord[],\n faces: ChartFaces,\n widths: FaceWidths,\n): { readonly svg: string; readonly words: readonly PlacedWord[] } {\n const refuse: Refuse = (what) => {\n throw new RenderRefusal(\n 'unsupported',\n `ECharts' drawing of the chart ${chart.id} ${what}: the renderer hands pdfmake's SVG converter only what ECharts 6.1.0 was seen to write, and prints only the words the runtime resolved, each once`,\n chart.id,\n )\n }\n const drawing = parse(svg, refuse)\n hold(drawing, chart, faces, refuse)\n return { svg: serialised(drawing), words: placed(drawing, printed, faces, widths, refuse) }\n}\n\n/** `svg` read as markup into its one `<svg>`, each element held to `ELEMENTS`, its one style sheet read and left out: anything but elements, attributes, words and that sheet refused. */\nfunction parse(svg: string, refuse: Refuse): Element {\n const open: Element[] = []\n let root: Element | undefined\n let sheets = 0\n let at = 0\n while (at < svg.length) {\n const next = svg.indexOf('<', at)\n held(open.at(-1), svg.slice(at, next < 0 ? svg.length : next), refuse)\n if (next < 0) break\n at = next\n if (svg.startsWith('<!--', at)) refuse('holds a comment')\n if (svg.startsWith('<![CDATA[', at)) refuse('holds CDATA outside its one style sheet')\n if (svg.startsWith('<!', at)) refuse('holds a DOCTYPE or a declaration')\n if (svg.startsWith('<?', at)) refuse('holds a processing instruction')\n if (svg.startsWith('</', at)) {\n const end = /<\\/([A-Za-z][\\w:.-]*)>/y\n end.lastIndex = at\n const [, name] = end.exec(svg) ?? refuse('holds markup that is no end tag')\n if (open.pop()?.name !== name) refuse('holds an end tag that ends no element it opened')\n at = end.lastIndex\n continue\n }\n const start = /<([A-Za-z][\\w:.-]*)((?:\\s+[^\\s=/>]+=\"[^\"]*\")*)\\s*(\\/?)>/y\n start.lastIndex = at\n const [, name = '', written = '', closed = ''] = start.exec(svg) ?? refuse('holds markup that is no element')\n at = start.lastIndex\n const parent = open.at(-1)\n const vocabulary = ELEMENTS.get(name) ?? refuse('holds an element ECharts writes none of')\n const element: Element = { name, attributes: attributesOf(vocabulary, name, written, refuse), children: [], written: '' }\n if (name === 'svg' ? root !== undefined : !vocabulary.inside.has(parent?.name ?? ''))\n refuse(parent === undefined ? 'holds an element outside its <svg>' : `holds an element inside its <${parent.name}>`)\n if (closed !== '') refuse('holds an element closed as it opens')\n if (name === 'style') {\n sheets += 1\n if (sheets > 1) refuse('holds a style sheet but its one of hover rules')\n at = hoverRules(svg, at, refuse)\n continue\n }\n if (parent === undefined) root = element\n else parent.children.push(element)\n open.push(element)\n }\n if (root === undefined || open.length > 0) refuse('holds an element left open, or no <svg>')\n return root\n}\n\n/** What stands between two tags, as `parent` holds it: a word inside a `<text>`, and only whitespace anywhere else. */\nfunction held(parent: Element | undefined, between: string, refuse: Refuse): void {\n if (parent?.name === 'text') parent.written = between\n else if (!/^[ \\t\\r\\n]*$/.test(between)) refuse('holds text outside a word')\n}\n\n/** The attributes written in `written`, each one `element`, a `name`, is written with, once, of a value it is written with, and none it is read by left out. */\nfunction attributesOf(element: Vocabulary, name: string, written: string, refuse: Refuse): ReadonlyMap<string, string> {\n const attributes = new Map<string, string>()\n for (const [, attribute = '', value = ''] of written.matchAll(/\\s+([^\\s=]+)=\"([^\"]*)\"/g)) {\n const values = element.values.get(attribute) ?? refuse(`holds an attribute ECharts does not write its <${name}> with`)\n if (attributes.has(attribute)) refuse(`holds an attribute written twice on its <${name}>`)\n if (!values.test(value))\n refuse(\n name === 'text' && attribute === 'transform'\n ? 'holds a word turned or scaled'\n : `holds a value ECharts does not write an attribute of its <${name}> with`,\n )\n attributes.set(attribute, value)\n }\n if (element.required.some((attribute) => !attributes.has(attribute))) refuse(`holds its <${name}> without an attribute it is read by`)\n return attributes\n}\n\n/**\n * Where the style sheet whose content starts at `at` ends: ECharts writes\n * one, a CDATA section of rules every selector of which ends in `:hover`,\n * which prints nothing and is left out. Any other is refused.\n */\nfunction hoverRules(svg: string, at: number, refuse: Refuse): number {\n const end = svg.indexOf('</style>', at)\n // A selector starts at its first character that is not whitespace, so that each rule is read one way only, and a sheet that does not match fails at once.\n const sheet = /^\\s*<!\\[CDATA\\[((?:\\s*[^\\s{}<>;@][^{}<>;@]*\\{[^{}<>]*\\})*)\\s*\\]\\]>\\s*$/.exec(svg.slice(at, end))\n if (end < 0 || sheet === null) refuse('holds a style sheet but its one of hover rules')\n const [, rules = ''] = sheet\n for (const [, selectors = ''] of rules.matchAll(/([^{}]+)\\{/g))\n if (!selectors.split(',').every((selector) => /\\S:hover$/.test(selector.trim()))) refuse('holds a style sheet with a rule but of hovering')\n return end + '</style>'.length\n}\n\n/** Whether `element` strokes: a `stroke` written that paints. */\nconst stroked = ({ attributes }: Element): boolean => !['none', 'transparent', undefined].includes(attributes.get('stroke'))\n\n/** `drawing` held, element by element, to its box, the nesting a PDF/A holds and the colours the option names, each clip to a path it defines once, and what a clip holds to the strokes it cuts nothing of. */\nfunction hold(drawing: Element, chart: AxisChart | PieChart, faces: ChartFaces, refuse: Refuse): void {\n const reach = Math.max(chart.width, chart.height)\n const painted = new Set([...namedColours(chart, faces), 'none', 'transparent'])\n const masks = new Set(['#000', 'none'])\n const clips: string[] = []\n const clipped: string[] = []\n const walk = (element: Element, depth: number, masked: boolean, inClip: boolean): void => {\n // The converter saves the graphics state as it starts, and once for each element it draws inside the one before.\n if (depth + 1 > PDF_A_NESTING) refuse(`holds groups nested deeper than the ${String(PDF_A_NESTING)} graphics states a PDF/A holds`)\n for (const [attribute, value] of element.attributes) {\n const measures = attribute === 'd' ? reached(value) : MEASURES.has(attribute) ? [...value.matchAll(NUMBERS)].map(([number]) => Number(number)) : []\n for (const measure of measures) {\n if (!Number.isFinite(measure)) refuse('holds a number that is not finite')\n if (measure < -reach || measure > 2 * reach)\n refuse(`holds a number past its box by more than its size, ${String(chart.width)} by ${String(chart.height)} points`)\n }\n if ((attribute === 'fill' || attribute === 'stroke') && !(masked ? masks : painted).has(value))\n refuse(masked ? 'paints a clip path' : 'holds a colour the option did not name')\n if (attribute === 'clip-path') clipped.push(value.slice('url(#'.length, -')'.length))\n if (attribute === 'id') clips.push(value)\n }\n if (\n inClip &&\n stroked(element) &&\n !(element.attributes.get('stroke-linejoin') === 'bevel' && (element.attributes.get('stroke-linecap') ?? 'butt') === 'butt')\n )\n refuse('strokes a path inside a clip otherwise than with bevelled joins and butt ends, and the clip is not drawn')\n for (const child of element.children) walk(child, depth + 1, masked || element.name === 'clipPath', inClip || element.attributes.has('clip-path'))\n }\n walk(drawing, 1, false, false)\n const box = [String(chart.width), String(chart.height), `0 0 ${String(chart.width)} ${String(chart.height)}`]\n if (['width', 'height', 'viewBox'].some((attribute, index) => drawing.attributes.get(attribute) !== box[index])) refuse('is of another size than its box')\n if (new Set(clips).size !== clips.length || clipped.some((id) => !clips.includes(id))) refuse('clips by a path it does not define once')\n}\n\n/**\n * The measures of `d`, a path held to `VOCABULARY`, as the converter takes\n * them (`pathParts`): each point it moves, draws or curves to -- a\n * relative line's, and never its step, which ECharts takes back across the\n * whole of a title's or a legend's background -- each curve's control\n * points, and an arc's radius, its turn and its flags no measure. The\n * converter draws an arc as curves on the circle through its ends, of its\n * radius or of half the line between them where that is longer, so that\n * every number it writes of one is within a few of the box's sizes when\n * the radius and the ends are held to the box.\n */\nfunction reached(d: string): number[] {\n return pathParts(d).flatMap(({ command, numbers, to }) =>\n command === 'Z' ? [] : [...(command === 'A' ? numbers.slice(0, 1) : numbers.slice(0, -2)).map(Number), ...to],\n )\n}\n\n/** A part of a path: where it stands in its `d`, as written; its command and its numbers as written; and the points it runs from and to. */\nexport interface PathPart {\n readonly index: number\n readonly written: string\n readonly command: string\n readonly numbers: readonly string[]\n readonly from: readonly [number, number]\n readonly to: readonly [number, number]\n}\n\n/**\n * The parts of `d`, a path in `VOCABULARY`'s grammar, each from the point\n * the converter takes it from (svg-to-pdfkit's `SvgShape`, `source.js`) to\n * the point it reaches: a relative line's the point before it moved by its\n * step; a close's the one its path last moved to, which the part after it\n * starts from.\n */\nexport function pathParts(d: string): PathPart[] {\n const parts: PathPart[] = []\n // Never read: a path starts with a move.\n let at: readonly [number, number] = [0, 0]\n let start = at\n for (const { 0: written, 1: command = '', 2: given = '', index } of d.matchAll(/([MLlCQAZ])([^MLlCQAZ]*)/g)) {\n const from = at\n const numbers = command === 'Z' ? [] : given.split(' ')\n const [x = 0, y = 0] = numbers.slice(-2).map(Number)\n at = command === 'Z' ? start : command === 'l' ? [from[0] + x, from[1] + y] : [x, y]\n if (command === 'M') start = at\n parts.push({ index, written, command, numbers, from, to: at })\n }\n return parts\n}\n\n/** The colours the option names for `chart` in `faces`: each series' or slice's and each legend entry's, the grid's, the axis's and the words'. */\nfunction namedColours(chart: AxisChart | PieChart, faces: ChartFaces): string[] {\n const marks = chart.chart === 'pie' ? chart.slices.map(({ color }) => color) : chart.series.map(({ color }) => color)\n const words = faces.title === undefined ? [faces.words] : [faces.words, faces.title]\n return [...marks, ...chart.legend.map(({ color }) => color), GRID.color, AXIS.color, ...words.map(({ font }) => font.color)]\n}\n\n/** `drawing` as the converter is handed it: every element, attribute and value as read, but its words and every clip, which 6.1.0 writes of a line series alone. */\nfunction serialised({ name, attributes, children }: Element): string {\n const written = [...attributes]\n .filter(([attribute]) => attribute !== 'clip-path')\n .map(([attribute, value]) => ` ${attribute}=\"${value}\"`)\n .join('')\n return `<${name}${written}>${children\n .filter((child) => child.name !== 'text' && child.name !== 'clipPath')\n .map(serialised)\n .join('')}</${name}>`\n}\n\n/** Every `<text>` of `element`, in the order the drawing writes them. */\nconst textsOf = (element: Element): Element[] => (element.name === 'text' ? [element] : element.children.flatMap(textsOf))\n\n/** `word` as zrender's `encodeHTML` writes it (core/dom.js): its & < > \" and ' as the five entities, an apostrophe as a numeric reference. */\nconst escaped = (word: string): string =>\n word.replaceAll('&', '&amp;').replaceAll('<', '&lt;').replaceAll('>', '&gt;').replaceAll('\"', '&quot;').replaceAll(\"'\", '&#39;')\n\n/** `written`, a word as zrender writes it, read: the five entities read, the ampersand's last, and refused where it is not what zrender writes of what they read as. */\nfunction wordOf(written: string, refuse: Refuse): string {\n if (/&(?!(?:amp|lt|gt|quot|#39);)/.test(written)) refuse('holds an entity or a character reference but the five zrender writes')\n const word = written.replaceAll('&lt;', '<').replaceAll('&gt;', '>').replaceAll('&quot;', '\"').replaceAll('&#39;', \"'\").replaceAll('&amp;', '&')\n if (escaped(word) !== written) refuse('holds a word with a character zrender escapes, unescaped')\n return word\n}\n\n/** Whether `text`, a `<text>` held to `ELEMENTS`, is written in `face`. */\nfunction writtenIn(text: Element, { font }: ChartFace): boolean {\n const italic = font.fontStyle === 'italic' ? 'font-style:italic;' : ''\n const bold = font.fontWeight === 'bold' ? 'font-weight:bold;' : ''\n return text.attributes.get('style') === `font-size:${String(font.fontSize)}px;font-family:${font.fontFamily};${italic}${bold}`\n}\n\n/**\n * Each of `printed` in the box its `<text>` places it in, in the order\n * `printed` lists them: each `<text>` the first of the words of its text\n * and in its face not yet placed, in the order ECharts writes them.\n */\nfunction placed(drawing: Element, printed: readonly ChartWord[], faces: ChartFaces, widths: FaceWidths, refuse: Refuse): PlacedWord[] {\n const faceOf = (word: ChartWord): ChartFace => {\n const face = word.title ? faces.title : faces.words\n if (face === undefined) throw new Error(\"a chart's title was read with no face to print it in\")\n return face\n }\n const rank = ({ key }: ChartWord): number => WRITTEN.indexOf(key.replace(/\\/.*$/, ''))\n const waiting = new Map<string, ChartWord[]>()\n for (const word of [...printed].sort((a, b) => rank(a) - rank(b))) {\n const queue = waiting.get(word.text)\n if (queue === undefined) waiting.set(word.text, [word])\n else queue.push(word)\n }\n const boxes = new Map<ChartWord, PlacedWord>()\n for (const text of textsOf(drawing)) {\n const word = wordOf(text.written, refuse)\n if (word === '') continue\n const queue = waiting.get(word) ?? []\n const index = queue.findIndex((each) => writtenIn(text, faceOf(each)))\n const chosen = index < 0 ? undefined : queue.splice(index, 1)[0]\n if (chosen === undefined) refuse('holds a word the runtime did not resolve, one more often than it did, or one in another face than its own')\n boxes.set(chosen, boxOf(chosen, faceOf(chosen), text, widths))\n }\n const words = printed.flatMap((word) => boxes.get(word) ?? [])\n if (words.length < printed.length) refuse(`leaves out ${String(printed.length - words.length)} of the ${String(printed.length)} words its layout prints`)\n return words\n}\n\n/** `word`'s box in `face` as `text` places it: its left by its anchor at its translation and its own x, its top half its line above its line's centre. */\nfunction boxOf(word: ChartWord, face: ChartFace, text: Element, widths: FaceWidths): PlacedWord {\n const [, moveX = '0', moveY = '0'] = /^translate\\((\\S+) (\\S+)\\)$/.exec(text.attributes.get('transform') ?? '') ?? []\n const width = widths.width(face.family, face.face, face.size, word.text)\n const anchor = text.attributes.get('text-anchor')\n const left = Number(moveX) + Number(text.attributes.get('x') ?? 0) - (anchor === 'middle' ? width / 2 : anchor === 'end' ? width : 0)\n const centre = Number(moveY) + Number(text.attributes.get('y') ?? 0)\n return { ...word, face, x: left, top: centre - face.line / 2, width, height: face.line }\n}\n","import type { PieCircle } from './chart-option.js'\nimport { heldPath, pathParts, type PathPart } from './chart-svg.js'\n\n/**\n * A pie's slices drawn on the pie's own circle (0058). zrender writes the\n * arc of a slice as one SVG arc, its ends and its radius rounded to a\n * tenth of a point (svg/SVGPathRebuilder.js), and svg-to-pdfkit draws an\n * arc on the circle it works out again through those two ends (SVG 1.1\n * F.6.5, `SvgShape.A` in pdfmake's copy). Through ends a tenth off, that\n * circle stands off the pie's near half a turn, and turns about the ends\n * near a whole one; where both ends round to one point it is no circle,\n * and the arc is left out (F.6.2). Measured on 2026-11-13, as zrender\n * writes them: a slice of 0.4938 of a pie 257.5 pt in radius printed 5 pt\n * off its circle, the larger slice of 9998 and 2 on a circle 57 pt from\n * the pie's, and a pie of 9999 and 1 at 160.23 pt nothing at all.\n *\n * So every arc of a slice is written again before the drawing is read\n * (`chart-svg.ts`), in two pieces or more, each of at most a quarter turn\n * about the pie's own centre and of its own radius -- the circle ECharts\n * is handed (`pieCircle`) -- from and to the very points zrender wrote, so\n * that two neighbours still meet where zrender put their common end; each\n * point between is on the circle, written as JavaScript writes a double.\n * An arc turns as far as its ends stand apart about the centre, the way\n * its sweep flag says, within the half of a turn its large-arc flag says,\n * which zrender sets from the slice's exact sweep: a large arc whose ends\n * meet is the whole turn zrender drew, a small one whose ends meet turns\n * nothing, out to the circle and back, and one whose ends rounding crossed\n * turns back the little they crossed. A slice the reader would refuse as\n * ECharts wrote it, or with an arc of any radius but the pie's to\n * zrender's rounding, is left so, for the reader to judge as written.\n *\n * Each slice stays one path, a slice of no share is still none\n * (`chart-option.ts`), and no other path is touched: a legend's swatch,\n * and a bar or a line chart, are ECharts' own.\n *\n * The bound, by its reason. zrender rounds a point to a tenth, at most\n * half a tenth's diagonal, 0.1 · √2 / 2 ≈ 0.0707 pt, from where it\n * belongs. Each arc the converter is handed has an end on the pie's\n * circle, and its other end on it too, or zrender's, that close to it; the\n * converter draws it on the circle of the pie's radius through both,\n * which to first order is the pie's circle turned about the end on it, so\n * that no point of an arc of a quarter turn or less stands farther off\n * than its other end. One arc between two rounded ends, as zrender writes\n * a quarter, has no end to turn about: its middle stood 0.10003 pt off.\n * The converter draws at most a sixth of a turn as one cubic, which stands\n * outside its arc by up to 2.4 · 10^-5 of the radius, 0.0062 pt on the\n * widest pie, 257.64 pt in radius. Every point of a slice's outline stands\n * within 0.0707 pt of its share's sector on the pie's circle, and the\n * cubic's own, and every point of the sector within as much of the\n * outline (`chart-arcs.test.ts`). Measured on 2026-11-13, read back by\n * PDF.js, each curve sampled: at most 0.0718 pt, either way, over 90,428\n * slices with arcs of 22,955 pies the renderer drew, of radii 0.12 to\n * 257.64 pt -- among them each pie found printed more than 0.5 pt off its\n * circle, or blank, as zrender writes it -- 688 of them past 0.0707 pt,\n * by 0.0011 at most, inside the cubic's share; and 0.0707 pt on the\n * quarter above.\n *\n * Three kinds of slice are drawn otherwise. One within 10^-4 of a radian\n * of a whole turn zrender writes as a whole circle, with no line to the\n * centre, its arcs written again as any other's: it stood within 0.053 pt\n * of the pie's circle. One of 10^-4 of a radian or less\n * zrender writes with no arc at all, a line from its start to the centre\n * (graphic/helper/roundSector.js): it stands within 0.0707 pt and its own\n * arc's length, at most 10^-4 of the radius, 0.026 pt on the widest pie,\n * of its sector -- 0.07205 pt at most, measured, for an arc of 0.0115 pt.\n * And one whose arc is shorter than a tenth's diagonal, 0.1 · √2 ≈ 0.141\n * pt, may have its two ends rounded into one point: it draws no more of\n * its arc than a hair out to the circle and back, and may draw no curve,\n * while every point of its sector stands within 0.0707 pt of the outline\n * drawn.\n * A slice whose arc is shorter than 0.141 pt may so draw no curve at all.\n */\n\n/** Radians: a whole turn, and the most an arc of a slice turns once written again. */\nconst TURN = 2 * Math.PI\nconst QUARTER = TURN / 4\n\n/**\n * Points: how far the radius zrender writes of a slice's arc stands from\n * the pie's: half a tenth, to which it rounds, and the doubles' own error\n * in that, which reached 1.1 · 10^-14 over 28,904 arcs (measured on\n * 2026-11-13).\n */\nconst RADIUS_ROUNDING = 0.05 + 1e-9\n\n/** A slice as zrender writes it: a `<path>` written as the chart's own, its `d` first. Any other path is not the pie's. */\nconst SLICE = /<path d=\"([^\"]*)\"(?=[^>]*\\secmeta_ssr_type=\"chart\")/g\n\n/** `svg`, ECharts' drawing of a pie on `circle`, with every arc of its slices written again on it. */\nexport function pieArcs(svg: string, circle: PieCircle): string {\n return svg.replace(SLICE, (_, d: string) => `<path d=\"${arcsOf(d, circle)}\"`)\n}\n\n/**\n * `d`, a slice's path, each of its arcs written again on `circle`, from\n * the point the converter takes it from (`pathParts`), and everything else\n * as written. A path the reader would refuse is left as written, for it to\n * refuse: written again, it could pass. So is a path with an arc of any\n * radius but the pie's, to zrender's rounding: written again, an arc past\n * the box would pass, and one on another circle, as a donut's inner arc,\n * be moved onto the pie's.\n */\nfunction arcsOf(d: string, circle: PieCircle): string {\n if (!heldPath(d)) return d\n const arcs = pathParts(d).filter(({ command }) => command === 'A')\n if (arcs.some(({ numbers: [radius] }) => Math.abs(Number(radius) - circle.radius) > RADIUS_ROUNDING)) return d\n let written = ''\n let after = 0\n for (const arc of arcs) {\n written += d.slice(after, arc.index) + quarters(arc, circle)\n after = arc.index + arc.written.length\n }\n return written + d.slice(after)\n}\n\n/**\n * An arc of a slice as two arcs or more, each of at most a quarter turn on\n * `circle`, ending where it ends: its turn about the centre the one, among\n * those its ends allow, nearest the middle of the half its large-arc flag\n * says, three quarters of a turn or a quarter. Every number of a path the\n * reader holds reads as a double, so that every angle and every turn here\n * is one.\n */\nfunction quarters({ from, to, numbers }: PathPart, { centre: [cx, cy], radius }: PieCircle): string {\n const [, , , large, sweep] = numbers\n // The way the angle grows on the page, whose y runs down: a sweep flag of 1 is clockwise.\n const way = sweep === '1' ? 1 : -1\n const angle = ([px, py]: readonly [number, number]): number => Math.atan2(py - cy, px - cx)\n const begins = angle(from)\n const apart = way * (angle(to) - begins)\n const middle = large === '1' ? 3 * QUARTER : QUARTER\n const turn = apart + TURN * Math.round((middle - apart) / TURN)\n // Two at least, so that each the converter draws has an end on the circle.\n const count = Math.max(2, Math.ceil(Math.abs(turn) / QUARTER))\n // An arc turned back runs against its flag.\n const flag = turn < 0 === (way === 1) ? 0 : 1\n return Array.from({ length: count }, (_, index) => {\n const along = begins + (way * turn * (index + 1)) / count\n const end = index + 1 === count ? numbers.slice(5).join(' ') : `${String(cx + radius * Math.cos(along))} ${String(cy + radius * Math.sin(along))}`\n return `A${String(radius)} ${String(radius)} 0 0 ${String(flag)} ${end}`\n }).join('')\n}\n","import { RenderRefusal, type AxisChart, type PieChart } from '@formancy/report-runtime'\nimport { BarChart, LineChart, PieChart as PieSeries } from 'echarts/charts'\nimport { GridComponent, LegendComponent, TitleComponent } from 'echarts/components'\nimport { init, setPlatformAPI, use, type EChartsType } from 'echarts/core'\nimport { SVGRenderer } from 'echarts/renderers'\nimport { setPlatformAPI as setZrenderPlatform } from 'zrender/lib/core/platform.js'\nimport type { ChartFaces } from './chart-faces.js'\nimport { held, named, points, tooLarge, type Plot } from './chart-held.js'\nimport { withMeasurer } from './chart-measure.js'\nimport { pieArcs } from './chart-arcs.js'\nimport { barWidth, chartOption, chartWords, pieCircle, POINT_RADIUS, VALUE_LABEL_DISTANCE, type ChartLayout } from './chart-option.js'\nimport { readChartSvg, type PlacedWord } from './chart-svg.js'\nimport type { FaceWidths } from './engine.js'\n\n/**\n * A chart laid out by ECharts, and refused where its words would meet,\n * leave its box or stand in its plot, or its ticks, its categories or its\n * bars would be too close or too thin to read (0058). ECharts lays the\n * chart out; the drawing reads where it put things and only snaps what\n * ECharts chose, and pdfmake prints every word in the box the drawing\n * reads back (`chart-svg.ts`).\n *\n * A bar or a line chart is laid out three times, every tick labelled in\n * the first two:\n *\n * 1. **The bands.** Across the whole box, read for where the title and\n * the legend stand, which no plot moves: the band at the top is the\n * title's line and a gap under it, with a value label's line and its\n * distance from its mark where values are labelled, or a line's\n * marker's radius where they are not, which no clip of ECharts' holds\n * and the box's would cut; the band at the foot is the legend's rows\n * and a gap above them. A bar below zero\n * labelled under its end has its room between the plot's foot and the\n * category labels, which the option stands that much further down\n * (`chart-option.ts`), and ECharts fits with them.\n * 2. **The plot.** ECharts fits the plot, and its axes' words, between the\n * bands and the box's sides; the plot is read by `convertToPixel` at\n * the lowest tick's place and the highest's, and half a slot past the\n * first and the last categories' middles.\n * 3. **Drawn.** The plot's top on the first half point at or below\n * ECharts', and its height the most that fits above ECharts' foot with\n * every interval between ticks a whole number of points, so that every\n * gridline stands on its tick (zrender moves a thin line to a half\n * point); every `tickEvery`-th tick labelled from the lowest, the\n * fewest that set their labels `TICK_CLEARANCE` lines apart.\n *\n * Bars under `MIN_BAR_WIDTH` are refused in whichever layout first lays\n * them out, before its words are read: ECharts draws a bar under 1 point\n * at 1, and leaves undrawn the bars, and their labels, a group so widened\n * pushes past its slot. Between the second layout and the third, a plot\n * too short for two tick labels that far apart, and a category label\n * wider than its slot less half a line, are refused: a label is never\n * turned, and a tick, a category or a bar is never dropped. A pie is laid\n * out twice: the bands, then drawn in the largest square centred between\n * them, refused where that square is narrower than `MIN_PIE_DIAMETER`, the\n * arcs of its slices written again on its circle before its drawing is\n * read (`chart-arcs.ts`). Every layout is ECharts' own under\n * the render's measurer (`chart-measure.ts`), disposed after it is read.\n *\n * The drawn layout's words are then held: two that meet, one past the\n * box, or one in the plot that is not a value's label, refuse the chart\n * (`chart-held.ts`, the rule an empty chart's words are held to as well).\n * Every refusal here is `content-too-large`, naming the chart and its box\n * and the sizes that do not fit, and quoting no word; the drawing's reader\n * refuses what ECharts wrote that it does not hold to as `unsupported`. A\n * font the measurer was not handed, a canvas or an image asked for, and a\n * formatter asked for what the block does not have are the option's\n * errors, thrown as they are: an invariant of the renderer's, which no\n * report can cause.\n *\n * The one module that imports ECharts' code, which a document holding a\n * chart loads the first time it draws one; its components are registered\n * at the first draw, never at import.\n */\n\n/** Lines: printed tick labels stand at least this far apart, middle to middle. Chosen, as a table's padding is. */\nexport const TICK_CLEARANCE = 1.25\n\n/**\n * Points: the narrowest a bar is drawn: the least width, to the quarter\n * point, at which every bar of a bar chart is a run of at least one pixel\n * of its colour (each channel within 8) with a white pixel (each channel\n * at least 247) between it and the next, in the page PDF.js draws at the\n * density of the Studio's Preview at 100 % on a screen of device pixel\n * ratio 2: 96/72 CSS pixels to the point times 2, 8/3 device pixels to the\n * point.\n *\n * Measured on 2026-11-13 on a Mac (Apple M2), Node 22.23.4, pdfjs-dist\n * 6.4.299, which draws on @napi-rs/canvas 1.0.11, and ECharts 6.1.0: bar\n * charts laid out by ECharts at the option's gaps and drawn by `renderPdf`,\n * 3960 of them: widths of 0.25 to 5 points in quarter points, each with one,\n * two and eight series, three tick sets (the width of the value axis'\n * labels, which moves the plot) and 22 left margins, twenty across one\n * device pixel from 40 points and the starters' 56.69 and 42.52. The pixel\n * rows judged are those inside the bars, which no gridline or axis line\n * crosses. 3.25 failed on 17 of 198 charts, 3.5 and every width above it,\n * to 5, on none.\n *\n * Why it holds wherever a chart stands: zrender writes every coordinate to\n * 0.1 point, so a gap the SVG writes is a multiple of 0.1 point, at least\n * a quarter of the bar less 0.15 (two edges each off by 0.05, and a width\n * by 0.05); at 3.5 that is 0.8 point, 2.13 pixels, and two pixels always\n * hold a whole pixel the bars leave white, wherever they stand. At 3.25 it\n * is 0.7 point, 1.87 pixels, and the failures above are those. The gap is\n * what sets the least: a bar of one series stands a category gap, a\n * quarter of a bar, from the next, in the next slot; a bar of a group\n * stands BAR_GAP of a bar from the next in its own slot, the same gap\n * while BAR_GAP is BAR_CATEGORY_GAP over its complement (held in\n * `chart-draw.test.ts`), and a group's category gap is wider.\n *\n * Other densities, by the same sweep (132 charts to a width, from 0.25 to\n * 10, 20 offsets across a device pixel and the starters' margins, one, two\n * and eight series, two tick sets), the least width at which none failed:\n * 6.25 at 4/3 pixels to the point (100 % on ratio 1), 4.25 at 2 (75 % on\n * ratio 2), 8.25 at 1; each is where the gap's least is two pixels, and\n * one quarter point below it some chart failed. Never under ECharts' own\n * least, 1, at which it widens the bar and drops its neighbours.\n */\nexport const MIN_BAR_WIDTH = 3.5\n\n/**\n * Points: the narrowest a pie is drawn, its square's side: the least\n * diameter, to the quarter point, at which a pie whose first slice is one\n * percent of it, its seven others sharing the rest in report-spec's\n * palette, shows every slice along its rim as a run of at least one pixel\n * of its own colour (each channel within 8), that slice among them, its\n * neighbours told apart, in the page PDF.js draws at the density of the\n * Studio's Preview at 100 % on a screen of device pixel ratio 2, 8/3\n * device pixels to the point, as `MIN_BAR_WIDTH`: so that a slice whose\n * share prints as 1.0 % or more shows as its own colour. The rim is the\n * band one pixel wide of the outermost pixels wholly inside the pie's\n * circle; taken in turn from noon, clockwise, its pixels of a palette\n * colour make eight runs, each of its own slice's colour and inside that\n * slice's sector, so that no slice is missing, split by another's colour\n * or run into its neighbour's. A pixel of no palette colour, a blend of\n * two slices, breaks no run and makes none.\n *\n * Measured on 2026-11-16 on a Mac (Apple M2), Node 22.23.4, pdfjs-dist\n * 6.4.299 on @napi-rs/canvas 1.0.11, and ECharts 6.1.0, at a load of 2.2\n * to 4.1: pies drawn by `renderPdf` in a box of their diameter, with no\n * title and no legend, of 20 to 50 points in quarter points, each at 22\n * places: twenty across one device pixel from 40 points, its left and its\n * top each at every twentieth of one, and the starters' margins, 56.69\n * and 42.52 points in from the left and 56.69 down. Below 24.75 some\n * diameter failed at up to 10 of the 22, 24.5 at 1; 24.75 and every\n * diameter above it, to 50, at none. At 400 places, every pair of\n * twentieths of a pixel, from 23 to 31 points: 24.5 failed at 33, 24.75\n * to 31 at none. A pie of eight equal slices, measured the same way the\n * day before, told them apart from 3.25 points, which leaves a slice\n * under about an eighth of the pie under a pixel of its rim: Daniel ruled\n * for the slice of one percent. A smaller share is a thinner slice, as a\n * smaller value is a shorter bar, and is held to nothing.\n */\nexport const MIN_PIE_DIAMETER = 24.75\n\n/** Lines: what the bands keep between the title, or the legend, and the plot's words. Chosen. */\nexport const BAND_GAP = 0.5\n\n/** A chart drawn: the drawing pdfmake's converter is handed, without its words, and every word in the box pdfmake prints it in. */\nexport interface DrawnChart {\n readonly svg: string\n readonly words: readonly PlacedWord[]\n}\n\n/** The bands a plot is laid out between, in points from the box's top and from its foot. */\ntype Bands = NonNullable<ChartLayout['bands']>\n\nlet registered = false\n\n/**\n * ECharts' components, registered once, at the first draw; and refused\n * where ECharts resolves another zrender than the renderer's, whose\n * platform the measurer replaces (`chart-measure.ts`): through another,\n * ECharts would measure every word in widths nobody chose, unseen. Both\n * copies' `setPlatformAPI` is one function only where they are one copy.\n */\nfunction register(chart: AxisChart | PieChart): void {\n if (setPlatformAPI !== setZrenderPlatform)\n throw new RenderRefusal(\n 'unsupported',\n `${named(chart)}cannot be laid out: ECharts measures through another copy of zrender than the one the renderer measures it with`,\n chart.id,\n )\n if (registered) return\n use([BarChart, LineChart, PieSeries, GridComponent, LegendComponent, TitleComponent, SVGRenderer])\n registered = true\n}\n\n/**\n * `chart` laid out by ECharts in `layout`, its words measured in `faces`\n * by `widths`; a bar or a line chart's plot read (`plotOf`) and its bars\n * held to `MIN_BAR_WIDTH`, and then its words read back. A pie has no\n * plot to read: its square is the layout's own, and once it has one, its\n * slices' arcs are written again on its circle (`pieArcs`).\n */\nfunction layOut(chart: AxisChart, faces: ChartFaces, widths: FaceWidths, layout: ChartLayout): { readonly drawing: DrawnChart; readonly plot: Plot }\nfunction layOut(chart: AxisChart | PieChart, faces: ChartFaces, widths: FaceWidths, layout: ChartLayout): { readonly drawing: DrawnChart }\nfunction layOut(\n chart: AxisChart | PieChart,\n faces: ChartFaces,\n widths: FaceWidths,\n layout: ChartLayout,\n): { readonly drawing: DrawnChart; readonly plot?: Plot } {\n const option = chartOption(chart, faces, layout)\n const { svg, plot } = withMeasurer(faces, widths, (): { readonly svg: string; readonly plot?: Plot } => {\n const laid = init(null, null, { renderer: 'svg', ssr: true, width: chart.width, height: chart.height })\n try {\n laid.setOption(option)\n const written = laid.renderToSVGString()\n if (chart.chart === 'pie') return { svg: layout.plot === undefined ? written : pieArcs(written, pieCircle(layout.plot)) }\n const read = plotOf(chart, laid)\n thickEnough(chart, read)\n return { svg: written, plot: read }\n } finally {\n laid.dispose()\n }\n })\n const drawing = readChartSvg(svg, chart, chartWords(chart, layout), faces, widths)\n return plot === undefined ? { drawing } : { drawing, plot }\n}\n\n/**\n * `chart` drawn in `faces` by `widths`: laid out by ECharts as the module\n * says, its words held to the rules, and refused, naming it, where they\n * do not hold. Synchronous, for a chart that is not empty, whose words\n * and title `faces` and `widths` measure.\n */\nexport function drawChart(chart: AxisChart | PieChart, faces: ChartFaces, widths: FaceWidths): DrawnChart {\n register(chart)\n const { line } = faces.words\n const bands = bandsOf(chart, layOut(chart, faces, widths, { tickEvery: 1 }).drawing.words, line)\n if (chart.chart === 'pie') {\n const square = squareOf(chart, bands)\n const { svg, words } = layOut(chart, faces, widths, { tickEvery: 1, bands, plot: square }).drawing\n return { svg, words: held(chart, words, square) }\n }\n if (bands.top + bands.bottom >= chart.height) tooLarge(chart, 'has no room for its plot: its title and its legend would stand in it')\n const fitted = layOut(chart, faces, widths, { tickEvery: 1, bands })\n const plot = snapped(chart, fitted.plot)\n const tickEvery = tickEveryOf(chart, plot, line)\n fitsAcross(chart, plot, fitted.drawing.words, line)\n const { svg, words } = layOut(chart, faces, widths, { tickEvery, bands, plot }).drawing\n return { svg, words: held(chart, words, plot) }\n}\n\n/**\n * The bands `chart` is laid out between, from `words`, those of a layout\n * across the whole box, in faces whose words' line is `line`: the title's\n * box and a gap under it, and the legend's highest row and a gap above\n * it; and where values are labelled, room above the plot for a label of a\n * bar or a point at the highest tick, its line and its distance from its\n * mark. Where a line's are not, room for its marker at the highest tick,\n * `POINT_RADIUS` above its place: ECharts leaves only half a tick label's\n * line above the plot, which in a face of a short line is less, and the\n * marker would stand past the box, where the converter cuts it. The label\n * of a bar below zero at the lowest tick stands between the plot's foot\n * and the category labels, in room the option keeps there; a marker at\n * the lowest tick stands in the category labels' margin, which ECharts\n * keeps with every label empty.\n */\nfunction bandsOf(chart: AxisChart | PieChart, words: readonly PlacedWord[], line: number): Bands {\n const gap = BAND_GAP * line\n const title = words.find(({ key }) => key === 'title')\n const legend = words.filter(({ key }) => key.startsWith('legend/')).map(({ top }) => top)\n const labelled = chart.chart !== 'pie' && chart.valueLabels\n const marked = chart.chart === 'line' ? POINT_RADIUS : 0\n return {\n top: (title === undefined ? 0 : title.top + title.height + gap) + (labelled ? line + VALUE_LABEL_DISTANCE : marked),\n bottom: legend.length === 0 ? 0 : chart.height - Math.min(...legend) + gap,\n }\n}\n\n/** A pie's square: the largest centred between `bands`, refused where they leave none, or one narrower than `MIN_PIE_DIAMETER`. */\nfunction squareOf(chart: PieChart, bands: Bands): Plot {\n const room = chart.height - bands.top - bands.bottom\n if (room <= 0) tooLarge(chart, 'has no room for its pie: its title and its legend would stand in it')\n const side = Math.min(chart.width, room)\n if (side < MIN_PIE_DIAMETER)\n tooLarge(chart, `has a pie ${points(side)} points across, narrower than the ${String(MIN_PIE_DIAMETER)} points a pie is drawn at least`)\n return { left: (chart.width - side) / 2, top: bands.top + (room - side) / 2, width: side, height: side }\n}\n\n/**\n * The plot ECharts laid `chart` out in: its foot and its top at the\n * lowest tick's place and the highest's, and its sides half a slot past\n * the first and the last categories' middles, a slot being the plot's\n * width over the categories. Of a chart of one category, whose one middle\n * says nothing of its slot, each side is where the plot ends: found, to a\n * billionth of a point, as the last point `containPixel` says the plot\n * holds.\n */\nfunction plotOf(chart: AxisChart, laid: EChartsType): Plot {\n const foot = laid.convertToPixel({ yAxisIndex: 0 }, 0)\n const top = laid.convertToPixel({ yAxisIndex: 0 }, chart.ticks.length - 1)\n const categories = chart.categories.length\n const first = laid.convertToPixel({ xAxisIndex: 0 }, 'c0')\n if (categories > 1) {\n const last = laid.convertToPixel({ xAxisIndex: 0 }, `c${String(categories - 1)}`)\n const slot = (last - first) / (categories - 1)\n return { left: first - slot / 2, top, width: slot * categories, height: foot - top }\n }\n const middle = (foot + top) / 2\n const side = (outside: number): number => {\n let [held, past] = [first, outside]\n while (Math.abs(past - held) > 1e-9) {\n const between = (held + past) / 2\n if (laid.containPixel({ gridIndex: 0 }, [between, middle])) held = between\n else past = between\n }\n return held\n }\n const [left, right] = [side(-1), side(chart.width + 1)]\n return { left, top, width: right - left, height: foot - top }\n}\n\n/**\n * `fitted` snapped: its top moved down to the first half point at or\n * below it, and its height cut to the most that fits above its foot with\n * every interval between ticks a whole number of points, so that every\n * tick stands on a half point, where zrender leaves a thin gridline. The\n * plot only shrinks, and stays where ECharts fitted its words. Its sides\n * as ECharts laid them.\n */\nfunction snapped(chart: AxisChart, fitted: Plot): Plot {\n const intervals = chart.ticks.length - 1\n const top = Math.ceil(fitted.top - 0.5) + 0.5\n const room = fitted.top + fitted.height - top\n return { left: fitted.left, top, width: fitted.width, height: Math.max(0, Math.floor(room / intervals)) * intervals }\n}\n\n/**\n * Every how many ticks `chart` labels on `plot`, from the lowest: the\n * fewest that set two labels `TICK_CLEARANCE` lines of `line` apart. A\n * plot on which no two can stand that far apart -- the lowest and the\n * highest -- is refused, naming its height.\n */\nfunction tickEveryOf(chart: AxisChart, plot: Plot, line: number): number {\n const intervals = chart.ticks.length - 1\n const pitch = plot.height / intervals\n const tickEvery = Array.from({ length: intervals }, (_, index) => index + 1).find((every) => every * pitch >= TICK_CLEARANCE * line)\n if (tickEvery === undefined)\n tooLarge(\n chart,\n `has a plot ${points(plot.height)} points tall, too short to label two of its ${String(chart.ticks.length)} ticks ${String(TICK_CLEARANCE)} lines apart`,\n )\n return tickEvery\n}\n\n/**\n * `chart`'s category labels, as `words` place them, refused where one is\n * wider than its slot on `plot` less half a `line`: each prints across,\n * centred under its slot, and is never turned, so that two that fit stand\n * half a line apart or more. The drawn layout's words are held apart\n * besides, these among them.\n */\nfunction fitsAcross(chart: AxisChart, plot: Plot, words: readonly PlacedWord[], line: number): void {\n const slot = plot.width / chart.categories.length\n if (words.some(({ key, width }) => key.startsWith('category/') && width > slot - line / 2))\n tooLarge(chart, `has category labels too wide for their slots of ${points(slot)} points across, and never turned`)\n}\n\n/** `chart`'s bars on `plot`, refused where ECharts would lay them out narrower than `MIN_BAR_WIDTH`, by the width it gives a bar in a slot of it (`barWidth`). */\nfunction thickEnough(chart: AxisChart, plot: Plot): void {\n if (chart.chart !== 'bar') return\n const width = barWidth(plot.width / chart.categories.length, chart.series.length)\n if (width < MIN_BAR_WIDTH) tooLarge(chart, `has bars ${points(width)} points wide, narrower than the ${String(MIN_BAR_WIDTH)} points a bar is drawn at least`)\n}\n"],"mappings":";;;;;;;;;AAqDA,MAAa,WAAqB;;AAGlC,SAAS,IAAI,IAAoB;CAC/B,SAAS,cAAc,GAAG;CAC1B,SAAS,eAAe,GAAG;CAC3B,SAAS,YAAY,GAAG;AAC1B;;;;;;;;AASA,SAAgB,aAAgB,SAA2C,KAAiB;CAC1F,MAAM,WAAqB;EAAE,aAAa,SAAS;EAAa,cAAc,SAAS;EAAc,WAAW,SAAS;CAAU;CACnI,IAAI,QAAQ,QAAQ,CAAC;CACrB,IAAI;EACF,OAAO,IAAI;CACb,UAAU;EACR,IAAI,QAAQ;CACd;AACF;;AAGA,MAAM,aAAa;;AAGnB,MAAM,UAAU,EAAE,WAA8B,GAAG,KAAK,UAAU,GAAG,KAAK,WAAW,GAAG,OAAO,KAAK,QAAQ,EAAE,KAAK,KAAK;;;;;;;;;;AAWxH,SAAgB,aAAgB,OAAmB,QAAoB,KAAiB;CACtF,MAAM,SAAS,IAAI,KAAK,MAAM,UAAU,KAAA,IAAY,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,OAAO,MAAM,KAAK,EAAA,CAAG,KAAK,SAAS,CAAC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  import { REFUSAL_CODES, RefusalCode, RenderRefusal, ResolvedDocument, ResolvedDocument as ResolvedDocument$1 } from "@formancy/report-runtime";
3
- //#region src/node.d.ts
4
3
  /**
5
4
  * Renders `document` to a PDF, or rejects with a `RenderRefusal` saying why
6
5
  * it was not printed: `too-many-pages`, `content-too-large`,
@@ -9,6 +8,5 @@ import { REFUSAL_CODES, RefusalCode, RenderRefusal, ResolvedDocument, ResolvedDo
9
8
  * the same bytes.
10
9
  */
11
10
  export declare function renderPdf(document: ResolvedDocument$1, options: RenderOptions): Promise<Uint8Array>;
12
- //#endregion
13
11
  export { REFUSAL_CODES, type RefusalCode, type RenderOptions, RenderRefusal, type ResolvedDocument };
14
12
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":["ResolvedDocument"],"sources":["../src/node.ts"],"mappings":";;;;;;;;;;wBAkDgB,UAAU,UAAUA,oBAAkB,SAAS,gBAAgB,QAAQ"}
1
+ {"version":3,"file":"index.d.mts","names":["ResolvedDocument"],"sources":["../src/node.ts"],"mappings":";;;;;;;;;wBAYgB,UAAU,UAAUA,oBAAkB,SAAS,gBAAgB,QAAQ"}
package/dist/index.mjs CHANGED
@@ -1,16 +1,26 @@
1
- import { i as glyphsOnce, r as collect, t as render } from "./render-Bs7DXIYJ.mjs";
1
+ import { b as registerHostFonts, g as faceWidths, h as FACES, m as BILL_FACES, p as LIBERATION_SANS, t as render, v as glyphsOnce, x as written } from "./render-D4q7IZ7I.mjs";
2
2
  import { createRequire } from "node:module";
3
3
  import { readFile } from "node:fs/promises";
4
4
  import path from "node:path";
5
+ import { fileURLToPath } from "node:url";
5
6
  import pdfmake from "pdfmake";
6
7
  import { REFUSAL_CODES, RenderRefusal } from "@formancy/report-runtime";
7
- //#region src/node.ts
8
+ // src/node-engine.ts
8
9
  /**
9
- * The renderer in Node: pdfmake's Node build, reading Roboto 3.014 from the
10
- * four font files in pdfmake's own package -- which the dependency-licence
11
- * guard reads as OFL-1.1 (0006) -- and no other file, and no address at all.
12
- * The renderer reads the same four files once, for the characters they have
13
- * glyphs for (`glyphs.ts`).
10
+ * The renderer's engine in Node, in a module of its own: `node.ts`, which
11
+ * `index.ts` exports from, then leaves the published types importing nothing
12
+ * of pdfmake's (the install gate type-checks them without it). It is
13
+ * pdfmake's Node build, reading Roboto 3.014 from the
14
+ * four font files in pdfmake's own package, and Liberation Sans 2.1.5, for
15
+ * a QR-bill's slip, from the two in this package's `fonts` directory -- all
16
+ * of which the dependency-licence guard reads as OFL-1.1 (0006) -- and no
17
+ * other file, and no address at all; but for a PDF/A -- an e-invoice's
18
+ * PDF/A-3b, or the PDF/A-2b a host asks for (0057) -- whose output intent
19
+ * PDFKit reads from its own `data/sRGB_IEC61966_2_1.icc` with `fs`, past
20
+ * pdfmake's policy (pdfkit.js 5265), a profile the guard holds to its
21
+ * reviewed digest (0031). The renderer reads the same files once, for the
22
+ * characters they have glyphs for (`glyphs.ts`): Roboto's for the first
23
+ * document, Liberation Sans's for the first with a bill.
14
24
  *
15
25
  * pdfmake is one configuration per process. It is set again before every
16
26
  * document, in the same synchronous step as `createPdf`, which reads it, so
@@ -22,24 +32,51 @@ import { REFUSAL_CODES, RenderRefusal } from "@formancy/report-runtime";
22
32
  const require = createRequire(import.meta.url);
23
33
  const pdfmakeDirectory = path.dirname(require.resolve("pdfmake/package.json"));
24
34
  const roboto = (file) => path.join(pdfmakeDirectory, "fonts", "Roboto", file).split(path.sep).join("/");
25
- const FONTS = { Roboto: {
26
- normal: roboto("Roboto-Regular.ttf"),
27
- bold: roboto("Roboto-Medium.ttf"),
28
- italics: roboto("Roboto-Italic.ttf"),
29
- bolditalics: roboto("Roboto-MediumItalic.ttf")
30
- } };
31
- const FONT_FILES = new Set(Object.values(FONTS.Roboto));
32
- async function run(definition) {
33
- pdfmake.setFonts(FONTS);
34
- pdfmake.setUrlAccessPolicy(() => false);
35
- pdfmake.setLocalAccessPolicy((file) => FONT_FILES.has(file));
36
- return collect(await pdfmake.createPdf(definition).getStream());
35
+ /** One of this package's own fonts, in its `fonts` directory, which stands beside `dist` as beside `src`. */
36
+ const own = (file) => fileURLToPath(new URL(`../fonts/${file}`, import.meta.url)).split(path.sep).join("/");
37
+ const FONTS = {
38
+ Roboto: {
39
+ normal: roboto("Roboto-Regular.ttf"),
40
+ bold: roboto("Roboto-Medium.ttf"),
41
+ italics: roboto("Roboto-Italic.ttf"),
42
+ bolditalics: roboto("Roboto-MediumItalic.ttf")
43
+ },
44
+ [LIBERATION_SANS]: {
45
+ normal: own("LiberationSans-Regular.ttf"),
46
+ bold: own("LiberationSans-Bold.ttf")
47
+ }
48
+ };
49
+ const FONT_FILES = /* @__PURE__ */ new Set([...Object.values(FONTS.Roboto), ...Object.values(FONTS[LIBERATION_SANS])]);
50
+ /** pdfmake's virtual file system in Node, where a host face's bytes go for a render; the Roboto and Liberation files are paths, read from disk, so nothing of theirs is here. */
51
+ const virtualfs = pdfmake.virtualfs;
52
+ /**
53
+ * What `use` makes of the document pdfmake makes of `definition`, with
54
+ * `host`'s faces in pdfmake's virtual files and pdfmake configured in the
55
+ * same synchronous step as `createPdf`; the faces removed after, whether
56
+ * it answered or threw.
57
+ */
58
+ async function withDocument(definition, host, use) {
59
+ const cleanup = registerHostFonts(virtualfs, host);
60
+ try {
61
+ pdfmake.setFonts({
62
+ ...FONTS,
63
+ ...host.families
64
+ });
65
+ pdfmake.setUrlAccessPolicy(() => false);
66
+ pdfmake.setLocalAccessPolicy((file) => FONT_FILES.has(file));
67
+ return await use(pdfmake.createPdf(definition).getStream());
68
+ } finally {
69
+ cleanup();
70
+ }
37
71
  }
38
- /** pdfmake in Node, and the glyphs of the very font files it embeds. */
72
+ /** pdfmake in Node, and the glyphs of the very font files it embeds; exported for its tests alone, since `index.ts`, the entry, exports `renderPdf` and nothing of this. */
39
73
  const engine = {
40
- run,
41
- glyphs: glyphsOnce(async (face) => new Uint8Array(await readFile(FONTS.Roboto[face])))
74
+ run: (definition, host, finish) => withDocument(definition, host, (document) => written(document, finish)),
75
+ widths: (host, faces) => withDocument({ content: [] }, host, (document) => faceWidths(document, faces)),
76
+ glyphs: glyphsOnce(FACES, async (face) => new Uint8Array(await readFile(FONTS.Roboto[face]))),
77
+ billGlyphs: glyphsOnce(BILL_FACES, async (face) => new Uint8Array(await readFile(FONTS[LIBERATION_SANS][face])))
42
78
  };
79
+ // src/node.ts
43
80
  /**
44
81
  * Renders `document` to a PDF, or rejects with a `RenderRefusal` saying why
45
82
  * it was not printed: `too-many-pages`, `content-too-large`,
@@ -50,7 +87,6 @@ const engine = {
50
87
  function renderPdf(document, options) {
51
88
  return render(engine, document, options);
52
89
  }
53
- //#endregion
54
90
  export { REFUSAL_CODES, RenderRefusal, renderPdf };
55
91
 
56
92
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/node.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises'\nimport { createRequire } from 'node:module'\nimport path from 'node:path'\nimport pdfmake from 'pdfmake'\nimport type { TDocumentDefinitions } from 'pdfmake/interfaces.js'\nimport type { ResolvedDocument } from '@formancy/report-runtime'\nimport { collect, glyphsOnce, type Engine, type PdfStream } from './engine.js'\nimport type { RenderOptions } from './options.js'\nimport { render } from './render.js'\n\n/**\n * The renderer in Node: pdfmake's Node build, reading Roboto 3.014 from the\n * four font files in pdfmake's own package -- which the dependency-licence\n * guard reads as OFL-1.1 (0006) -- and no other file, and no address at all.\n * The renderer reads the same four files once, for the characters they have\n * glyphs for (`glyphs.ts`).\n *\n * pdfmake is one configuration per process. It is set again before every\n * document, in the same synchronous step as `createPdf`, which reads it, so\n * that nothing else in the process that configures pdfmake can change the\n * fonts or the access policies a render runs with. The cost runs the other\n * way too: a host that uses pdfmake for something of its own finds this\n * configuration in place after every report.\n */\n\nconst require = createRequire(import.meta.url)\nconst pdfmakeDirectory = path.dirname(require.resolve('pdfmake/package.json'))\nconst roboto = (file: string): string => path.join(pdfmakeDirectory, 'fonts', 'Roboto', file).split(path.sep).join('/')\nconst FONTS = {\n Roboto: { normal: roboto('Roboto-Regular.ttf'), bold: roboto('Roboto-Medium.ttf'), italics: roboto('Roboto-Italic.ttf'), bolditalics: roboto('Roboto-MediumItalic.ttf') },\n}\nconst FONT_FILES: ReadonlySet<string> = new Set(Object.values(FONTS.Roboto))\n\nasync function run(definition: TDocumentDefinitions): Promise<Uint8Array> {\n pdfmake.setFonts(FONTS)\n pdfmake.setUrlAccessPolicy(() => false)\n pdfmake.setLocalAccessPolicy((file) => FONT_FILES.has(file))\n return collect((await pdfmake.createPdf(definition).getStream()) as unknown as PdfStream)\n}\n\n/** pdfmake in Node, and the glyphs of the very font files it embeds. */\nconst engine: Engine = { run, glyphs: glyphsOnce(async (face) => new Uint8Array(await readFile(FONTS.Roboto[face]))) }\n\n/**\n * Renders `document` to a PDF, or rejects with a `RenderRefusal` saying why\n * it was not printed: `too-many-pages`, `content-too-large`,\n * `invalid-asset`, `cancelled` or `unsupported`. A refused render returns\n * nothing, never a truncated or partial PDF. The same document renders to\n * the same bytes.\n */\nexport function renderPdf(document: ResolvedDocument, options: RenderOptions): Promise<Uint8Array> {\n return render(engine, document, options)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAyBA,MAAM,UAAU,cAAc,YAAY,GAAG;AAC7C,MAAM,mBAAmB,KAAK,QAAQ,QAAQ,QAAQ,sBAAsB,CAAC;AAC7E,MAAM,UAAU,SAAyB,KAAK,KAAK,kBAAkB,SAAS,UAAU,IAAI,CAAC,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG;AACtH,MAAM,QAAQ,EACZ,QAAQ;CAAE,QAAQ,OAAO,oBAAoB;CAAG,MAAM,OAAO,mBAAmB;CAAG,SAAS,OAAO,mBAAmB;CAAG,aAAa,OAAO,yBAAyB;AAAE,EAC1K;AACA,MAAM,aAAkC,IAAI,IAAI,OAAO,OAAO,MAAM,MAAM,CAAC;AAE3E,eAAe,IAAI,YAAuD;CACxE,QAAQ,SAAS,KAAK;CACtB,QAAQ,yBAAyB,KAAK;CACtC,QAAQ,sBAAsB,SAAS,WAAW,IAAI,IAAI,CAAC;CAC3D,OAAO,QAAS,MAAM,QAAQ,UAAU,UAAU,CAAC,CAAC,UAAU,CAA0B;AAC1F;;AAGA,MAAM,SAAiB;CAAE;CAAK,QAAQ,WAAW,OAAO,SAAS,IAAI,WAAW,MAAM,SAAS,MAAM,OAAO,KAAK,CAAC,CAAC;AAAE;;;;;;;;AASrH,SAAgB,UAAU,UAA4B,SAA6C;CACjG,OAAO,OAAO,QAAQ,UAAU,OAAO;AACzC"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/node-engine.ts","../src/node.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises'\nimport { createRequire } from 'node:module'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport pdfmake from 'pdfmake'\nimport type { TDocumentDefinitions } from 'pdfmake/interfaces.js'\nimport { BILL_FACES, FACES, faceWidths, glyphsOnce, registerHostFonts, written, type Engine, type VirtualFs } from './engine.js'\nimport type { HostFontFiles } from './host-fonts.js'\nimport { LIBERATION_SANS } from './style.js'\n\n/**\n * The renderer's engine in Node, in a module of its own: `node.ts`, which\n * `index.ts` exports from, then leaves the published types importing nothing\n * of pdfmake's (the install gate type-checks them without it). It is\n * pdfmake's Node build, reading Roboto 3.014 from the\n * four font files in pdfmake's own package, and Liberation Sans 2.1.5, for\n * a QR-bill's slip, from the two in this package's `fonts` directory -- all\n * of which the dependency-licence guard reads as OFL-1.1 (0006) -- and no\n * other file, and no address at all; but for a PDF/A -- an e-invoice's\n * PDF/A-3b, or the PDF/A-2b a host asks for (0057) -- whose output intent\n * PDFKit reads from its own `data/sRGB_IEC61966_2_1.icc` with `fs`, past\n * pdfmake's policy (pdfkit.js 5265), a profile the guard holds to its\n * reviewed digest (0031). The renderer reads the same files once, for the\n * characters they have glyphs for (`glyphs.ts`): Roboto's for the first\n * document, Liberation Sans's for the first with a bill.\n *\n * pdfmake is one configuration per process. It is set again before every\n * document, in the same synchronous step as `createPdf`, which reads it, so\n * that nothing else in the process that configures pdfmake can change the\n * fonts or the access policies a render runs with. The cost runs the other\n * way too: a host that uses pdfmake for something of its own finds this\n * configuration in place after every report.\n */\n\nconst require = createRequire(import.meta.url)\nconst pdfmakeDirectory = path.dirname(require.resolve('pdfmake/package.json'))\nconst roboto = (file: string): string => path.join(pdfmakeDirectory, 'fonts', 'Roboto', file).split(path.sep).join('/')\n/** One of this package's own fonts, in its `fonts` directory, which stands beside `dist` as beside `src`. */\nconst own = (file: string): string =>\n fileURLToPath(new URL(`../fonts/${file}`, import.meta.url))\n .split(path.sep)\n .join('/')\nconst FONTS = {\n Roboto: {\n normal: roboto('Roboto-Regular.ttf'),\n bold: roboto('Roboto-Medium.ttf'),\n italics: roboto('Roboto-Italic.ttf'),\n bolditalics: roboto('Roboto-MediumItalic.ttf'),\n },\n [LIBERATION_SANS]: { normal: own('LiberationSans-Regular.ttf'), bold: own('LiberationSans-Bold.ttf') },\n}\nconst FONT_FILES: ReadonlySet<string> = new Set([...Object.values(FONTS.Roboto), ...Object.values(FONTS[LIBERATION_SANS])])\n\n/** pdfmake's virtual file system in Node, where a host face's bytes go for a render; the Roboto and Liberation files are paths, read from disk, so nothing of theirs is here. */\nconst virtualfs = (pdfmake as unknown as { readonly virtualfs: VirtualFs }).virtualfs\n\n/**\n * What `use` makes of the document pdfmake makes of `definition`, with\n * `host`'s faces in pdfmake's virtual files and pdfmake configured in the\n * same synchronous step as `createPdf`; the faces removed after, whether\n * it answered or threw.\n */\nasync function withDocument<T>(definition: TDocumentDefinitions, host: HostFontFiles, use: (document: Promise<unknown>) => Promise<T>): Promise<T> {\n const cleanup = registerHostFonts(virtualfs, host)\n try {\n pdfmake.setFonts({ ...FONTS, ...host.families })\n pdfmake.setUrlAccessPolicy(() => false)\n pdfmake.setLocalAccessPolicy((file) => FONT_FILES.has(file))\n return await use(pdfmake.createPdf(definition).getStream())\n } finally {\n cleanup()\n }\n}\n\n/** pdfmake in Node, and the glyphs of the very font files it embeds; exported for its tests alone, since `index.ts`, the entry, exports `renderPdf` and nothing of this. */\nexport const engine: Engine = {\n run: (definition, host, finish) => withDocument(definition, host, (document) => written(document, finish)),\n widths: (host, faces) => withDocument({ content: [] }, host, (document) => faceWidths(document, faces)),\n glyphs: glyphsOnce(FACES, async (face) => new Uint8Array(await readFile(FONTS.Roboto[face]))),\n billGlyphs: glyphsOnce(BILL_FACES, async (face) => new Uint8Array(await readFile(FONTS[LIBERATION_SANS][face]))),\n}\n","import type { ResolvedDocument } from '@formancy/report-runtime'\nimport { engine } from './node-engine.js'\nimport type { RenderOptions } from './options.js'\nimport { render } from './render.js'\n\n/**\n * Renders `document` to a PDF, or rejects with a `RenderRefusal` saying why\n * it was not printed: `too-many-pages`, `content-too-large`,\n * `invalid-asset`, `cancelled` or `unsupported`. A refused render returns\n * nothing, never a truncated or partial PDF. The same document renders to\n * the same bytes.\n */\nexport function renderPdf(document: ResolvedDocument, options: RenderOptions): Promise<Uint8Array> {\n return render(engine, document, options)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAM,UAAU,cAAc,YAAY,GAAG;AAC7C,MAAM,mBAAmB,KAAK,QAAQ,QAAQ,QAAQ,sBAAsB,CAAC;AAC7E,MAAM,UAAU,SAAyB,KAAK,KAAK,kBAAkB,SAAS,UAAU,IAAI,CAAC,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG;;AAEtH,MAAM,OAAO,SACX,cAAc,IAAI,IAAI,YAAY,QAAQ,YAAY,GAAG,CAAC,CAAC,CACxD,MAAM,KAAK,GAAG,CAAC,CACf,KAAK,GAAG;AACb,MAAM,QAAQ;CACZ,QAAQ;EACN,QAAQ,OAAO,oBAAoB;EACnC,MAAM,OAAO,mBAAmB;EAChC,SAAS,OAAO,mBAAmB;EACnC,aAAa,OAAO,yBAAyB;CAC/C;EACC,kBAAkB;EAAE,QAAQ,IAAI,4BAA4B;EAAG,MAAM,IAAI,yBAAyB;CAAE;AACvG;AACA,MAAM,6BAAkC,IAAI,IAAI,CAAC,GAAG,OAAO,OAAO,MAAM,MAAM,GAAG,GAAG,OAAO,OAAO,MAAM,gBAAgB,CAAC,CAAC;;AAG1H,MAAM,YAAa,QAAyD;;;;;;;AAQ5E,eAAe,aAAgB,YAAkC,MAAqB,KAA6D;CACjJ,MAAM,UAAU,kBAAkB,WAAW,IAAI;CACjD,IAAI;EACF,QAAQ,SAAS;GAAE,GAAG;GAAO,GAAG,KAAK;EAAS,CAAC;EAC/C,QAAQ,yBAAyB,KAAK;EACtC,QAAQ,sBAAsB,SAAS,WAAW,IAAI,IAAI,CAAC;EAC3D,OAAO,MAAM,IAAI,QAAQ,UAAU,UAAU,CAAC,CAAC,UAAU,CAAC;CAC5D,UAAU;EACR,QAAQ;CACV;AACF;;AAGA,MAAa,SAAiB;CAC5B,MAAM,YAAY,MAAM,WAAW,aAAa,YAAY,OAAO,aAAa,QAAQ,UAAU,MAAM,CAAC;CACzG,SAAS,MAAM,UAAU,aAAa,EAAE,SAAS,CAAC,EAAE,GAAG,OAAO,aAAa,WAAW,UAAU,KAAK,CAAC;CACtG,QAAQ,WAAW,OAAO,OAAO,SAAS,IAAI,WAAW,MAAM,SAAS,MAAM,OAAO,KAAK,CAAC,CAAC;CAC5F,YAAY,WAAW,YAAY,OAAO,SAAS,IAAI,WAAW,MAAM,SAAS,MAAM,gBAAgB,CAAC,KAAK,CAAC,CAAC;AACjH;;;;;;;;;ACpEA,SAAgB,UAAU,UAA4B,SAA6C;CACjG,OAAO,OAAO,QAAQ,UAAU,OAAO;AACzC"}
@@ -1,4 +1,3 @@
1
- //#region src/options.d.ts
2
1
  /**
3
2
  * What a caller passes `renderPdf`, in a module of its own: the package's
4
3
  * published types import nothing of pdfmake's, whose types are a
@@ -18,7 +17,18 @@ interface RenderOptions {
18
17
  * once runs it in a worker it can terminate.
19
18
  */
20
19
  readonly signal?: AbortSignal;
20
+ /**
21
+ * Asks for the final render drawn as a PDF/A-2b, an archival PDF the
22
+ * Swiss EPR admits, which embeds no file; `'2b'` is the one value, and any
23
+ * other is a `RangeError`. A Factur-X e-invoice, which is drawn as the
24
+ * PDF/A-3b that embeds its XML, an XRechnung's copy and a preview the
25
+ * runtime labels so are refused with it as `unsupported`, each to be
26
+ * rendered without it (0057). In Node, PDFKit reads the sRGB profile its
27
+ * output intent embeds from its own `data/sRGB_IEC61966_2_1.icc` on disk,
28
+ * so a host that bundles the Node entry ships that file beside it; the
29
+ * browser build carries the same bytes.
30
+ */
31
+ readonly pdfa?: '2b';
21
32
  }
22
- //#endregion
23
33
  export { RenderOptions as t };
24
- //# sourceMappingURL=options-wLxIWA87.d.mts.map
34
+ //# sourceMappingURL=options-B7fd-ZYd.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options-B7fd-ZYd.d.mts","names":[],"sources":["../src/options.ts"],"mappings":";;;;;UAKiB;;WAEN;;;;;;;;;;;WAWA,SAAS;;;;;;;;;;;;WAYT"}