@formancy/report-render-pdf 0.2.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.
@@ -1 +1 @@
1
- {"version":3,"file":"bill-fonts-CFSgj0iW.mjs","names":["regular"],"sources":["../src/bill-fonts.ts"],"sourcesContent":["import bold from '../fonts/LiberationSans-Bold.ttf'\nimport regular from '../fonts/LiberationSans-Regular.ttf'\n\n/**\n * Liberation Sans 2.1.5's two faces as base64, for the browser entry's\n * virtual files: the bytes of the package's own `fonts` directory, which the\n * build writes into a chunk of their own (`font-plugin.ts`, in tsdown's\n * build and in Vitest's tests). The browser entry imports this module the first\n * time a document has a payment part, never before, so that a host that\n * never prints a bill never loads it.\n */\nexport const LIBERATION_SANS = { normal: regular, bold } as const\n"],"mappings":";;;;;;;;;;AAWA,MAAa,kBAAkB;CAAE,QAAQA;CAAS,MAAA;AAAK"}
1
+ {"version":3,"file":"bill-fonts-B61mmaVd.mjs","names":["regular"],"sources":["../src/bill-fonts.ts"],"sourcesContent":["import bold from '../fonts/LiberationSans-Bold.ttf'\nimport regular from '../fonts/LiberationSans-Regular.ttf'\n\n/**\n * Liberation Sans 2.1.5's two faces as base64, for the browser entry's\n * virtual files: the bytes of the package's own `fonts` directory, which the\n * build writes into a chunk of their own (`font-plugin.ts`, in tsdown's\n * build and in Vitest's tests). The browser entry imports this module the first\n * time a document has a payment part, never before, so that a host that\n * never prints a bill never loads it.\n */\nexport const LIBERATION_SANS = { normal: regular, bold } as const\n"],"mappings":";;;;;;;;;AAWA,MAAa,kBAAkB;CAAE,QAAQA;CAAS,MAAA;AAAK"}
@@ -1,12 +1,17 @@
1
- import { t as RenderOptions } from "./options-wLxIWA87.mjs";
1
+ import { t as RenderOptions } from "./options-B7fd-ZYd.mjs";
2
2
  import { REFUSAL_CODES, RefusalCode, RenderRefusal, ResolvedDocument, ResolvedDocument as ResolvedDocument$1 } from "@formancy/report-runtime";
3
- //#region src/browser.d.ts
3
+ /**
4
+ * The renderer in a browser: pdfmake's browser build, its fonts virtual
5
+ * files and every address denied, Liberation Sans a chunk of its own that
6
+ * only a document with a bill or a captioned code loads -- the engine,
7
+ * `browser-engine.ts`'s -- behind the same renderer as the Node entry
8
+ * (`render.ts`).
9
+ */
4
10
  /**
5
11
  * Renders `document` to a PDF in a browser, or rejects with a
6
12
  * `RenderRefusal` saying why it was not printed, exactly as the Node entry
7
13
  * does: the same refusals, the same pages.
8
14
  */
9
15
  export declare function renderPdf(document: ResolvedDocument$1, options: RenderOptions): Promise<Uint8Array>;
10
- //#endregion
11
16
  export { REFUSAL_CODES, type RefusalCode, type RenderOptions, RenderRefusal, type ResolvedDocument };
12
17
  //# sourceMappingURL=browser.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"browser.d.mts","names":["ResolvedDocument"],"sources":["../src/browser.ts"],"mappings":";;;;;;;;wBAqGgB,UAAU,UAAUA,oBAAkB,SAAS,gBAAgB,QAAQ"}
1
+ {"version":3,"file":"browser.d.mts","names":["ResolvedDocument"],"sources":["../src/browser.ts"],"mappings":";;;;;;;;;;;;;;wBAsBgB,UAAU,UAAUA,oBAAkB,SAAS,gBAAgB,QAAQ"}
package/dist/browser.mjs CHANGED
@@ -1,15 +1,16 @@
1
- import { a as FACES, c as loadOnce, i as BILL_FACES, l as written, n as LIBERATION_SANS, o as glyphsOf, r as fromBase64, s as glyphsOnce, t as render } from "./render-DkPoADDg.mjs";
1
+ import { _ as glyphsOf, b as registerHostFonts, f as fromBase64, g as faceWidths, h as FACES, m as BILL_FACES, p as LIBERATION_SANS, t as render, v as glyphsOnce, x as written, y as loadOnce } from "./render-D4q7IZ7I.mjs";
2
2
  import { REFUSAL_CODES, RenderRefusal } from "@formancy/report-runtime";
3
3
  import pdfmake from "pdfmake/build/pdfmake.js";
4
4
  import vfs from "pdfmake/build/vfs_fonts.js";
5
- //#region src/browser.ts
5
+ // src/browser-engine.ts
6
6
  /**
7
- * The renderer in a browser: pdfmake's browser build, with Roboto 3.014
8
- * from pdfmake's `vfs_fonts.js`, which carries the four font files of
7
+ * The renderer's engine in a browser: pdfmake's browser build, with Roboto
8
+ * 3.014 from pdfmake's `vfs_fonts.js`, which carries the four font files of
9
9
  * pdfmake's package as base64 -- the same bytes, which a test holds, so the
10
10
  * same OFL-1.1 fonts the dependency-licence guard reads (0006). Nothing here
11
11
  * touches a file system: the fonts are pdfmake's virtual files, and every
12
- * address is denied. An e-invoice's PDF/A output intent is the ICC profile
12
+ * address is denied. The output intent of a PDF/A -- an e-invoice's
13
+ * PDF/A-3b, or the PDF/A-2b a host asks for (0057) -- is the ICC profile
13
14
  * the browser build carries as base64 (`build/pdfmake.js` 20777), the very
14
15
  * bytes of PDFKit's file, which `browser.test.ts` holds.
15
16
  *
@@ -30,6 +31,10 @@ import vfs from "pdfmake/build/vfs_fonts.js";
30
31
  * renderer's own, so that a host's files of the same name and the renderer's
31
32
  * cannot replace each other, and they and the font table are set again
32
33
  * before every document, as in Node: pdfmake is one configuration per page.
34
+ *
35
+ * The engine stands apart from the browser entry (`browser.ts`), which
36
+ * renders with it, so that a test reaches it and nothing a host imports
37
+ * does; Node's is `node.ts`'s, which is not an entry (`index.ts` is).
33
38
  */
34
39
  const FILES = {
35
40
  normal: "Roboto-Regular.ttf",
@@ -52,7 +57,7 @@ let billFonts;
52
57
  * caption until the page reloaded (`loadOnce`).
53
58
  */
54
59
  const billGlyphs = loadOnce(async () => {
55
- const { LIBERATION_SANS: faces } = await import("./bill-fonts-CFSgj0iW.mjs");
60
+ const { LIBERATION_SANS: faces } = await import("./bill-fonts-B61mmaVd.mjs");
56
61
  const glyphs = await glyphsOf(BILL_FACES, async (face) => fromBase64(faces[face]));
57
62
  billFonts = faces;
58
63
  return glyphs;
@@ -79,18 +84,43 @@ const FONTS = {
79
84
  bold: own(BILL_FILES.bold)
80
85
  }
81
86
  };
82
- async function run(definition, finish) {
87
+ /** pdfmake's virtual file system in the browser build, where a host face's bytes go for a render, beside the Roboto and Liberation base64 the build carries. */
88
+ const virtualfs = pdfmake.virtualfs;
89
+ /**
90
+ * What `use` makes of the document pdfmake makes of `definition`, with the
91
+ * renderer's fonts and `host`'s faces in pdfmake's virtual files and
92
+ * pdfmake configured in the same synchronous step as `createPdf`; the host's
93
+ * faces removed after, whether it answered or threw.
94
+ */
95
+ async function withDocument(definition, host, use) {
83
96
  pdfmake.addVirtualFileSystem(fontFiles());
84
- pdfmake.setFonts(FONTS);
85
- pdfmake.setUrlAccessPolicy(() => false);
86
- return written(pdfmake.createPdf(definition).getStream(), finish);
97
+ const cleanup = registerHostFonts(virtualfs, host);
98
+ try {
99
+ pdfmake.setFonts({
100
+ ...FONTS,
101
+ ...host.families
102
+ });
103
+ pdfmake.setUrlAccessPolicy(() => false);
104
+ return await use(pdfmake.createPdf(definition).getStream());
105
+ } finally {
106
+ cleanup();
107
+ }
87
108
  }
88
109
  /** pdfmake's browser build, and the glyphs of the very virtual files it embeds. */
89
110
  const engine = {
90
- run,
111
+ run: (definition, host, finish) => withDocument(definition, host, (document) => written(document, finish)),
112
+ widths: (host, faces) => withDocument({ content: [] }, host, (document) => faceWidths(document, faces)),
91
113
  glyphs: glyphsOnce(FACES, (face) => Promise.resolve(fromBase64(vfs[FILES[face]]))),
92
114
  billGlyphs
93
115
  };
116
+ // src/browser.ts
117
+ /**
118
+ * The renderer in a browser: pdfmake's browser build, its fonts virtual
119
+ * files and every address denied, Liberation Sans a chunk of its own that
120
+ * only a document with a bill or a captioned code loads -- the engine,
121
+ * `browser-engine.ts`'s -- behind the same renderer as the Node entry
122
+ * (`render.ts`).
123
+ */
94
124
  /**
95
125
  * Renders `document` to a PDF in a browser, or rejects with a
96
126
  * `RenderRefusal` saying why it was not printed, exactly as the Node entry
@@ -99,7 +129,6 @@ const engine = {
99
129
  function renderPdf(document, options) {
100
130
  return render(engine, document, options);
101
131
  }
102
- //#endregion
103
132
  export { REFUSAL_CODES, RenderRefusal, renderPdf };
104
133
 
105
134
  //# sourceMappingURL=browser.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"browser.mjs","names":[],"sources":["../src/browser.ts"],"sourcesContent":["import pdfmake from 'pdfmake/build/pdfmake.js'\nimport vfs from 'pdfmake/build/vfs_fonts.js'\nimport type { TDocumentDefinitions } from 'pdfmake/interfaces.js'\nimport type { ResolvedDocument } from '@formancy/report-runtime'\nimport { fromBase64 } from './bytes.js'\nimport { BILL_FACES, FACES, glyphsOf, glyphsOnce, loadOnce, written, type Engine } from './engine.js'\nimport type { BillFace } from './glyphs.js'\nimport type { RenderOptions } from './options.js'\nimport type { Finish } from './pdfa.js'\nimport { render } from './render.js'\nimport { LIBERATION_SANS } from './style.js'\n\nexport { REFUSAL_CODES, RenderRefusal } from '@formancy/report-runtime'\nexport type { RefusalCode, ResolvedDocument } from '@formancy/report-runtime'\nexport type { RenderOptions } from './options.js'\n\n/**\n * The renderer in a browser: pdfmake's browser build, with Roboto 3.014\n * from pdfmake's `vfs_fonts.js`, which carries the four font files of\n * pdfmake's package as base64 -- the same bytes, which a test holds, so the\n * same OFL-1.1 fonts the dependency-licence guard reads (0006). Nothing here\n * touches a file system: the fonts are pdfmake's virtual files, and every\n * address is denied. An e-invoice's PDF/A output intent is the ICC profile\n * the browser build carries as base64 (`build/pdfmake.js` 20777), the very\n * bytes of PDFKit's file, which `browser.test.ts` holds.\n *\n * A QR-bill's slip and an EPC QR code's caption print in Liberation Sans\n * 2.1.5, whose two faces come as base64 in a module of their own\n * (`bill-fonts.ts`), the very bytes of this package's `fonts` directory,\n * which a test holds too. It is imported the first time a document has a\n * payment part or a captioned EPC QR code, and never otherwise: the build\n * makes it a chunk of its own, and an app's bundler loads that chunk only\n * when a bill or a caption asks for it. An import that failed is not kept:\n * the document it failed for fails, and the next one imports the chunk\n * again.\n *\n * Everything but the fonts and the build is the Node entry's own\n * (`render.ts`), so the two hand pdfmake the same definitions.\n *\n * The fonts go into pdfmake's virtual file system under names of the\n * renderer's own, so that a host's files of the same name and the renderer's\n * cannot replace each other, and they and the font table are set again\n * before every document, as in Node: pdfmake is one configuration per page.\n */\n\nconst FILES = { normal: 'Roboto-Regular.ttf', bold: 'Roboto-Medium.ttf', italics: 'Roboto-Italic.ttf', bolditalics: 'Roboto-MediumItalic.ttf' } as const\nconst BILL_FILES = { normal: 'LiberationSans-Regular.ttf', bold: 'LiberationSans-Bold.ttf' } as const\nconst own = (file: string): string => `formancy-report-render-pdf/${file}`\n\n/** Liberation Sans's faces as base64, once a document with a bill or a captioned code has loaded them. */\nlet billFonts: Readonly<Record<BillFace, string>> | undefined\n\n/**\n * Liberation Sans's glyphs, from the faces in the chunk that carries them:\n * imported by the first document with a bill or a captioned code and kept\n * once they have been read, and imported again by the next such document\n * after an import that failed, which would otherwise fail every bill and\n * caption until the page reloaded (`loadOnce`).\n */\nconst billGlyphs = loadOnce(async () => {\n const { LIBERATION_SANS: faces } = await import('./bill-fonts.js')\n const glyphs = await glyphsOf(BILL_FACES, async (face) => fromBase64(faces[face]))\n billFonts = faces\n return glyphs\n})\n\nfunction fontFiles(): Record<string, string> {\n const roboto = Object.values(FILES).map((file) => {\n const data = vfs[file]\n if (data === undefined) throw new Error(`pdfmake's vfs_fonts.js has no ${file}`)\n return [own(file), data] as const\n })\n const loaded = billFonts\n const liberation = loaded === undefined ? [] : BILL_FACES.map((face) => [own(BILL_FILES[face]), loaded[face]] as const)\n return Object.fromEntries([...roboto, ...liberation])\n}\n\nconst FONTS = {\n Roboto: { normal: own(FILES.normal), bold: own(FILES.bold), italics: own(FILES.italics), bolditalics: own(FILES.bolditalics) },\n [LIBERATION_SANS]: { normal: own(BILL_FILES.normal), bold: own(BILL_FILES.bold) },\n}\n\nasync function run(definition: TDocumentDefinitions, finish?: Finish): Promise<Uint8Array> {\n pdfmake.addVirtualFileSystem(fontFiles())\n pdfmake.setFonts(FONTS)\n pdfmake.setUrlAccessPolicy(() => false)\n return written(pdfmake.createPdf(definition).getStream(), finish)\n}\n\n/** pdfmake's browser build, and the glyphs of the very virtual files it embeds. */\nconst engine: Engine = {\n run,\n glyphs: glyphsOnce(FACES, (face) => Promise.resolve(fromBase64(vfs[FILES[face]] as string))),\n billGlyphs,\n}\n\n/**\n * Renders `document` to a PDF in a browser, or rejects with a\n * `RenderRefusal` saying why it was not printed, exactly as the Node entry\n * does: the same refusals, the same pages.\n */\nexport function renderPdf(document: ResolvedDocument, options: RenderOptions): Promise<Uint8Array> {\n return render(engine, document, options)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAM,QAAQ;CAAE,QAAQ;CAAsB,MAAM;CAAqB,SAAS;CAAqB,aAAa;AAA0B;AAC9I,MAAM,aAAa;CAAE,QAAQ;CAA8B,MAAM;AAA0B;AAC3F,MAAM,OAAO,SAAyB,8BAA8B;;AAGpE,IAAI;;;;;;;;AASJ,MAAM,aAAa,SAAS,YAAY;CACtC,MAAM,EAAE,iBAAiB,UAAU,MAAM,OAAO;CAChD,MAAM,SAAS,MAAM,SAAS,YAAY,OAAO,SAAS,WAAW,MAAM,KAAK,CAAC;CACjF,YAAY;CACZ,OAAO;AACT,CAAC;AAED,SAAS,YAAoC;CAC3C,MAAM,SAAS,OAAO,OAAO,KAAK,CAAC,CAAC,KAAK,SAAS;EAChD,MAAM,OAAO,IAAI;EACjB,IAAI,SAAS,KAAA,GAAW,MAAM,IAAI,MAAM,iCAAiC,MAAM;EAC/E,OAAO,CAAC,IAAI,IAAI,GAAG,IAAI;CACzB,CAAC;CACD,MAAM,SAAS;CACf,MAAM,aAAa,WAAW,KAAA,IAAY,CAAC,IAAI,WAAW,KAAK,SAAS,CAAC,IAAI,WAAW,KAAK,GAAG,OAAO,KAAK,CAAU;CACtH,OAAO,OAAO,YAAY,CAAC,GAAG,QAAQ,GAAG,UAAU,CAAC;AACtD;AAEA,MAAM,QAAQ;CACZ,QAAQ;EAAE,QAAQ,IAAI,MAAM,MAAM;EAAG,MAAM,IAAI,MAAM,IAAI;EAAG,SAAS,IAAI,MAAM,OAAO;EAAG,aAAa,IAAI,MAAM,WAAW;CAAE;EAC5H,kBAAkB;EAAE,QAAQ,IAAI,WAAW,MAAM;EAAG,MAAM,IAAI,WAAW,IAAI;CAAE;AAClF;AAEA,eAAe,IAAI,YAAkC,QAAsC;CACzF,QAAQ,qBAAqB,UAAU,CAAC;CACxC,QAAQ,SAAS,KAAK;CACtB,QAAQ,yBAAyB,KAAK;CACtC,OAAO,QAAQ,QAAQ,UAAU,UAAU,CAAC,CAAC,UAAU,GAAG,MAAM;AAClE;;AAGA,MAAM,SAAiB;CACrB;CACA,QAAQ,WAAW,QAAQ,SAAS,QAAQ,QAAQ,WAAW,IAAI,MAAM,MAAgB,CAAC,CAAC;CAC3F;AACF;;;;;;AAOA,SAAgB,UAAU,UAA4B,SAA6C;CACjG,OAAO,OAAO,QAAQ,UAAU,OAAO;AACzC"}
1
+ {"version":3,"file":"browser.mjs","names":[],"sources":["../src/browser-engine.ts","../src/browser.ts"],"sourcesContent":["import pdfmake from 'pdfmake/build/pdfmake.js'\nimport vfs from 'pdfmake/build/vfs_fonts.js'\nimport type { TDocumentDefinitions } from 'pdfmake/interfaces.js'\nimport { fromBase64 } from './bytes.js'\nimport { BILL_FACES, FACES, faceWidths, glyphsOf, glyphsOnce, loadOnce, registerHostFonts, written, type Engine, type VirtualFs } from './engine.js'\nimport type { BillFace } from './glyphs.js'\nimport type { HostFontFiles } from './host-fonts.js'\nimport { LIBERATION_SANS } from './style.js'\n\n/**\n * The renderer's engine in a browser: pdfmake's browser build, with Roboto\n * 3.014 from pdfmake's `vfs_fonts.js`, which carries the four font files of\n * pdfmake's package as base64 -- the same bytes, which a test holds, so the\n * same OFL-1.1 fonts the dependency-licence guard reads (0006). Nothing here\n * touches a file system: the fonts are pdfmake's virtual files, and every\n * address is denied. The output intent of a PDF/A -- an e-invoice's\n * PDF/A-3b, or the PDF/A-2b a host asks for (0057) -- is the ICC profile\n * the browser build carries as base64 (`build/pdfmake.js` 20777), the very\n * bytes of PDFKit's file, which `browser.test.ts` holds.\n *\n * A QR-bill's slip and an EPC QR code's caption print in Liberation Sans\n * 2.1.5, whose two faces come as base64 in a module of their own\n * (`bill-fonts.ts`), the very bytes of this package's `fonts` directory,\n * which a test holds too. It is imported the first time a document has a\n * payment part or a captioned EPC QR code, and never otherwise: the build\n * makes it a chunk of its own, and an app's bundler loads that chunk only\n * when a bill or a caption asks for it. An import that failed is not kept:\n * the document it failed for fails, and the next one imports the chunk\n * again.\n *\n * Everything but the fonts and the build is the Node entry's own\n * (`render.ts`), so the two hand pdfmake the same definitions.\n *\n * The fonts go into pdfmake's virtual file system under names of the\n * renderer's own, so that a host's files of the same name and the renderer's\n * cannot replace each other, and they and the font table are set again\n * before every document, as in Node: pdfmake is one configuration per page.\n *\n * The engine stands apart from the browser entry (`browser.ts`), which\n * renders with it, so that a test reaches it and nothing a host imports\n * does; Node's is `node.ts`'s, which is not an entry (`index.ts` is).\n */\n\nconst FILES = { normal: 'Roboto-Regular.ttf', bold: 'Roboto-Medium.ttf', italics: 'Roboto-Italic.ttf', bolditalics: 'Roboto-MediumItalic.ttf' } as const\nconst BILL_FILES = { normal: 'LiberationSans-Regular.ttf', bold: 'LiberationSans-Bold.ttf' } as const\nconst own = (file: string): string => `formancy-report-render-pdf/${file}`\n\n/** Liberation Sans's faces as base64, once a document with a bill or a captioned code has loaded them. */\nlet billFonts: Readonly<Record<BillFace, string>> | undefined\n\n/**\n * Liberation Sans's glyphs, from the faces in the chunk that carries them:\n * imported by the first document with a bill or a captioned code and kept\n * once they have been read, and imported again by the next such document\n * after an import that failed, which would otherwise fail every bill and\n * caption until the page reloaded (`loadOnce`).\n */\nconst billGlyphs = loadOnce(async () => {\n const { LIBERATION_SANS: faces } = await import('./bill-fonts.js')\n const glyphs = await glyphsOf(BILL_FACES, async (face) => fromBase64(faces[face]))\n billFonts = faces\n return glyphs\n})\n\nfunction fontFiles(): Record<string, string> {\n const roboto = Object.values(FILES).map((file) => {\n const data = vfs[file]\n if (data === undefined) throw new Error(`pdfmake's vfs_fonts.js has no ${file}`)\n return [own(file), data] as const\n })\n const loaded = billFonts\n const liberation = loaded === undefined ? [] : BILL_FACES.map((face) => [own(BILL_FILES[face]), loaded[face]] as const)\n return Object.fromEntries([...roboto, ...liberation])\n}\n\nconst FONTS = {\n Roboto: { normal: own(FILES.normal), bold: own(FILES.bold), italics: own(FILES.italics), bolditalics: own(FILES.bolditalics) },\n [LIBERATION_SANS]: { normal: own(BILL_FILES.normal), bold: own(BILL_FILES.bold) },\n}\n\n/** pdfmake's virtual file system in the browser build, where a host face's bytes go for a render, beside the Roboto and Liberation base64 the build carries. */\nconst virtualfs = (pdfmake as unknown as { readonly virtualfs: VirtualFs }).virtualfs\n\n/**\n * What `use` makes of the document pdfmake makes of `definition`, with the\n * renderer's fonts and `host`'s faces in pdfmake's virtual files and\n * pdfmake configured in the same synchronous step as `createPdf`; the host's\n * faces removed after, whether it answered or threw.\n */\nasync function withDocument<T>(definition: TDocumentDefinitions, host: HostFontFiles, use: (document: Promise<unknown>) => Promise<T>): Promise<T> {\n pdfmake.addVirtualFileSystem(fontFiles())\n const cleanup = registerHostFonts(virtualfs, host)\n try {\n pdfmake.setFonts({ ...FONTS, ...host.families })\n pdfmake.setUrlAccessPolicy(() => false)\n return await use(pdfmake.createPdf(definition).getStream())\n } finally {\n cleanup()\n }\n}\n\n/** pdfmake's browser build, and the glyphs of the very virtual files it embeds. */\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, (face) => Promise.resolve(fromBase64(vfs[FILES[face]] as string))),\n billGlyphs,\n}\n","import type { ResolvedDocument } from '@formancy/report-runtime'\nimport { engine } from './browser-engine.js'\nimport type { RenderOptions } from './options.js'\nimport { render } from './render.js'\n\nexport { REFUSAL_CODES, RenderRefusal } from '@formancy/report-runtime'\nexport type { RefusalCode, ResolvedDocument } from '@formancy/report-runtime'\nexport type { RenderOptions } from './options.js'\n\n/**\n * The renderer in a browser: pdfmake's browser build, its fonts virtual\n * files and every address denied, Liberation Sans a chunk of its own that\n * only a document with a bill or a captioned code loads -- the engine,\n * `browser-engine.ts`'s -- behind the same renderer as the Node entry\n * (`render.ts`).\n */\n\n/**\n * Renders `document` to a PDF in a browser, or rejects with a\n * `RenderRefusal` saying why it was not printed, exactly as the Node entry\n * does: the same refusals, the same pages.\n */\nexport function renderPdf(document: ResolvedDocument, options: RenderOptions): Promise<Uint8Array> {\n return render(engine, document, options)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAM,QAAQ;CAAE,QAAQ;CAAsB,MAAM;CAAqB,SAAS;CAAqB,aAAa;AAA0B;AAC9I,MAAM,aAAa;CAAE,QAAQ;CAA8B,MAAM;AAA0B;AAC3F,MAAM,OAAO,SAAyB,8BAA8B;;AAGpE,IAAI;;;;;;;;AASJ,MAAM,aAAa,SAAS,YAAY;CACtC,MAAM,EAAE,iBAAiB,UAAU,MAAM,OAAO;CAChD,MAAM,SAAS,MAAM,SAAS,YAAY,OAAO,SAAS,WAAW,MAAM,KAAK,CAAC;CACjF,YAAY;CACZ,OAAO;AACT,CAAC;AAED,SAAS,YAAoC;CAC3C,MAAM,SAAS,OAAO,OAAO,KAAK,CAAC,CAAC,KAAK,SAAS;EAChD,MAAM,OAAO,IAAI;EACjB,IAAI,SAAS,KAAA,GAAW,MAAM,IAAI,MAAM,iCAAiC,MAAM;EAC/E,OAAO,CAAC,IAAI,IAAI,GAAG,IAAI;CACzB,CAAC;CACD,MAAM,SAAS;CACf,MAAM,aAAa,WAAW,KAAA,IAAY,CAAC,IAAI,WAAW,KAAK,SAAS,CAAC,IAAI,WAAW,KAAK,GAAG,OAAO,KAAK,CAAU;CACtH,OAAO,OAAO,YAAY,CAAC,GAAG,QAAQ,GAAG,UAAU,CAAC;AACtD;AAEA,MAAM,QAAQ;CACZ,QAAQ;EAAE,QAAQ,IAAI,MAAM,MAAM;EAAG,MAAM,IAAI,MAAM,IAAI;EAAG,SAAS,IAAI,MAAM,OAAO;EAAG,aAAa,IAAI,MAAM,WAAW;CAAE;EAC5H,kBAAkB;EAAE,QAAQ,IAAI,WAAW,MAAM;EAAG,MAAM,IAAI,WAAW,IAAI;CAAE;AAClF;;AAGA,MAAM,YAAa,QAAyD;;;;;;;AAQ5E,eAAe,aAAgB,YAAkC,MAAqB,KAA6D;CACjJ,QAAQ,qBAAqB,UAAU,CAAC;CACxC,MAAM,UAAU,kBAAkB,WAAW,IAAI;CACjD,IAAI;EACF,QAAQ,SAAS;GAAE,GAAG;GAAO,GAAG,KAAK;EAAS,CAAC;EAC/C,QAAQ,yBAAyB,KAAK;EACtC,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,QAAQ,SAAS,QAAQ,QAAQ,WAAW,IAAI,MAAM,MAAgB,CAAC,CAAC;CAC3F;AACF;;;;;;;;;;;;;;ACrFA,SAAgB,UAAU,UAA4B,SAA6C;CACjG,OAAO,OAAO,QAAQ,UAAU,OAAO;AACzC"}