@shad0wz7/nestjs-pdf 3.0.0 → 3.0.1

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":"index.mjs","names":["#head","#tail","#size","BrowserType","regexIsDeepProp","isObject","isObject","fs","dotenv","__decorate","__decorate","resolve","fs","expand"],"sources":["../src/helpers/getRelativePath.helper.ts","../src/helpers/signature.helper.ts","../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js","../node_modules/.pnpm/p-limit@7.3.2/node_modules/p-limit/index.js","../src/helpers/deepMergePdfparams.ts","../src/helpers/tokens.ts","../src/puppeteer/browser/browser.service.ts","../src/puppeteer/engines/ejs/ejs.service.ts","../src/puppeteer/engines/eta/eta.service.ts","../src/puppeteer/engines/handlebars/handlebars.service.ts","../src/puppeteer/engines/mjml/mjml.service.ts","../src/puppeteer/engines/mustache/mustache.service.ts","../src/puppeteer/engines/nunjucks/nunjucks.service.ts","../src/puppeteer/engines/pug/pug.service.ts","../src/puppeteer/libs/requireService.utils.ts","../src/puppeteer/puppeteer.service.ts","../src/nestjs-pdf.service.ts","../node_modules/.pnpm/dotenv-expand@13.0.0/node_modules/dotenv-expand/lib/main.js","../node_modules/.pnpm/@nestjs+config@12.0.0_@nestjs+common@12.0.1_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/config.constants.js","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/_internal/isDeepKey.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/_internal/toKey.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/util/toString.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/util/toPath.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/object/get.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/_internal/isIndex.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/_internal/getTag.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/predicate/isArguments.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/object/has.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/predicate/isObject.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/predicate/isSymbol.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/_internal/isKey.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/util/eq.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/_internal/assignValue.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/_internal/isUnsafeToWriteProperty.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/object/updateWith.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/object/set.mjs","../node_modules/.pnpm/@nestjs+config@12.0.0_@nestjs+common@12.0.1_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/get-config-token.util.js","../node_modules/.pnpm/dotenv@17.4.2/node_modules/dotenv/lib/main.js","../node_modules/.pnpm/@nestjs+config@12.0.0_@nestjs+common@12.0.1_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/get-default-parser.util.js","../node_modules/.pnpm/@nestjs+config@12.0.0_@nestjs+common@12.0.1_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/config.service.js","../node_modules/.pnpm/@nestjs+config@12.0.0_@nestjs+common@12.0.1_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/config-host.module.js","../node_modules/.pnpm/@nestjs+config@12.0.0_@nestjs+common@12.0.1_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/create-config-factory.util.js","../node_modules/.pnpm/@nestjs+config@12.0.0_@nestjs+common@12.0.1_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/get-registration-token.util.js","../node_modules/.pnpm/@nestjs+config@12.0.0_@nestjs+common@12.0.1_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/merge-configs.util.js","../node_modules/.pnpm/@nestjs+config@12.0.0_@nestjs+common@12.0.1_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/validate-with-schema.util.js","../node_modules/.pnpm/@nestjs+config@12.0.0_@nestjs+common@12.0.1_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/config.module.js","../src/puppeteer/puppeteer.module.ts","../src/nestjs-pdf.module.ts"],"sourcesContent":["import { relative, resolve } from 'node:path';\n\n/**\n * Get the relative path to a value from the module directory.\n * @param moduleDir the path of the module, typically __dirname\n * @param relativeToModule the path to the value relative to the module directory\n * @returns the relative path from the current working directory to the value\n * @example\n * getRelativePathToValue(__dirname, './templates/my-template.hbs');\n * // returns 'context/pdf/templates/my-template.hbs' if the current working directory is '/\n */\nexport function getRelativePathToValue(\n moduleDir: string,\n relativeToModule: string,\n): string {\n const fullTemplatePath = resolve(moduleDir, relativeToModule);\n return relative(process.cwd(), fullTemplatePath);\n}\n","import {\n PDFArray,\n PDFDict,\n PDFDocument,\n PDFName,\n PDFNumber,\n PDFString,\n} from 'pdf-lib';\nimport type { TextItem } from 'pdfjs-dist/types/src/display/api';\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nlet pdfjsPromise: typeof import('pdfjs-dist/legacy/build/pdf.mjs') | undefined;\n\nasync function loadPdfjs() {\n if (!pdfjsPromise) {\n try {\n pdfjsPromise = await import('pdfjs-dist/legacy/build/pdf.mjs');\n } catch (error) {\n pdfjsPromise = undefined;\n throw new Error(\n [\n 'Failed to load pdfjs-dist.',\n 'If you use anchor-based signature placement in Node.js, make sure @napi-rs/canvas is installed.',\n 'Try: npm install @napi-rs/canvas',\n '',\n `Original error: ${error instanceof Error ? error.message : String(error)}`,\n ].join('\\n'),\n { cause: error },\n );\n }\n }\n return pdfjsPromise;\n}\n\nfunction toU8(input: Uint8Array | Buffer): Uint8Array {\n return new Uint8Array(input);\n}\n\nasync function findAnchorPosition(\n pdfBytes: Uint8Array,\n anchorText: string,\n): Promise<null | {\n pageIndex: number;\n x: number;\n y: number;\n pageWidth: number;\n pageHeight: number;\n}> {\n const pdfjsLib = await loadPdfjs();\n const loadingTask = pdfjsLib.getDocument({ data: pdfBytes });\n\n try {\n const pdf = await loadingTask.promise;\n\n for (let pageNum = 1; pageNum <= pdf.numPages; pageNum++) {\n const page = await pdf.getPage(pageNum);\n const viewport = page.getViewport({ scale: 1 });\n const textContent = await page.getTextContent();\n\n for (const itemRaw of textContent.items) {\n const item = itemRaw as TextItem;\n const str = item.str;\n if (!str?.includes(anchorText)) continue;\n\n const t = pdfjsLib.Util.transform(viewport.transform, item.transform);\n const [_a, _b, _c, _d, e, f] = t as Array<number>;\n\n const x = e;\n const y = viewport.height - f;\n\n return {\n pageIndex: pageNum - 1,\n x,\n y,\n pageWidth: viewport.width,\n pageHeight: viewport.height,\n };\n }\n }\n return null;\n } finally {\n await loadingTask.destroy();\n }\n}\n\nfunction addSignatureFieldAt(\n pdfDoc: PDFDocument,\n pageIndex: number,\n opts: {\n fieldName: string;\n x: number;\n y: number;\n width: number;\n height: number;\n },\n) {\n const { fieldName, x, y, width, height } = opts;\n const context = pdfDoc.context;\n\n const page = pdfDoc.getPages()[pageIndex];\n if (!page) throw new Error(`Page ${pageIndex} not found`);\n\n const rectArray = context.obj([\n PDFNumber.of(x),\n PDFNumber.of(y),\n PDFNumber.of(x + width),\n PDFNumber.of(y + height),\n ]);\n\n const widgetDict = context.obj({\n Type: PDFName.of('Annot'),\n Subtype: PDFName.of('Widget'),\n Rect: rectArray,\n F: PDFNumber.of(4),\n P: page.ref,\n });\n const widgetRef = context.register(widgetDict);\n\n const fieldDict = context.obj({\n FT: PDFName.of('Sig'),\n T: PDFString.of(fieldName),\n Ff: PDFNumber.of(0),\n Kids: context.obj([widgetRef]),\n });\n const fieldRef = context.register(fieldDict);\n\n widgetDict.set(PDFName.of('Parent'), fieldRef);\n\n let annots = page.node.lookupMaybe(PDFName.of('Annots'), PDFArray);\n if (!annots) {\n annots = context.obj([]);\n page.node.set(PDFName.of('Annots'), annots);\n }\n annots.push(widgetRef);\n\n let acroForm = pdfDoc.catalog.lookupMaybe(PDFName.of('AcroForm'), PDFDict);\n if (!acroForm) {\n acroForm = context.obj({\n Fields: context.obj([]),\n SigFlags: PDFNumber.of(3),\n });\n const acroFormRef = context.register(acroForm);\n pdfDoc.catalog.set(PDFName.of('AcroForm'), acroFormRef);\n }\n\n let fields = acroForm.lookupMaybe(PDFName.of('Fields'), PDFArray);\n if (!fields) {\n fields = context.obj([]);\n acroForm.set(PDFName.of('Fields'), fields);\n }\n fields.push(fieldRef);\n\n return { fieldRef, widgetRef };\n}\n\nexport async function addSignatureFieldUsingAnchor(\n pdf: Uint8Array | Buffer,\n fieldName = 'SignatureDebtor',\n anchorText = '__SIG_DEBTOR_ANCHOR__',\n) {\n const bytes = toU8(pdf);\n\n const anchor = await findAnchorPosition(bytes.slice(), anchorText);\n\n const pdfDoc = await PDFDocument.load(bytes);\n\n const sigWidth = 240;\n const sigHeight = 50;\n\n if (anchor) {\n const pageIndex = anchor.pageIndex;\n const page = pdfDoc.getPages()[pageIndex];\n const { width: pw, height: ph } = page.getSize();\n\n const padX = 40;\n const padY = 7;\n let x = anchor.x - sigWidth / 2 + padX;\n\n let y = anchor.y - sigHeight + padY;\n\n const margin = 10;\n\n x = Math.max(margin, Math.min(x, pw - sigWidth - margin));\n y = Math.max(margin, Math.min(y, ph - sigHeight - margin));\n\n addSignatureFieldAt(pdfDoc, anchor.pageIndex, {\n fieldName,\n x,\n y,\n width: sigWidth,\n height: sigHeight,\n });\n } else {\n const pages = pdfDoc.getPages();\n const pageIndex = pages.length - 1;\n const page = pages[pageIndex];\n const { width: pageWidth } = page.getSize();\n const x = (pageWidth - sigWidth) / 2;\n const y = 90;\n\n addSignatureFieldAt(pdfDoc, pageIndex, {\n fieldName,\n x,\n y,\n width: sigWidth,\n height: sigHeight,\n });\n }\n\n return await pdfDoc.save();\n}\n\n// Test helper to inject a mocked pdfjs implementation and avoid dynamic import in tests\n// This helper throws outside of tests to avoid exposing a test-only API in production.\nexport function __setPdfjsForTests(p: any) {\n if (process.env.NODE_ENV !== 'test') {\n throw new Error('__setPdfjsForTests is only available in test environment');\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n pdfjsPromise = p;\n}\n","/*\nHow it works:\n`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.\n*/\n\nclass Node {\n\tvalue;\n\tnext;\n\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n}\n\nexport default class Queue {\n\t#head;\n\t#tail;\n\t#size;\n\n\tconstructor() {\n\t\tthis.clear();\n\t}\n\n\tenqueue(value) {\n\t\tconst node = new Node(value);\n\n\t\tif (this.#head) {\n\t\t\tthis.#tail.next = node;\n\t\t\tthis.#tail = node;\n\t\t} else {\n\t\t\tthis.#head = node;\n\t\t\tthis.#tail = node;\n\t\t}\n\n\t\tthis.#size++;\n\t}\n\n\tdequeue() {\n\t\tconst current = this.#head;\n\t\tif (!current) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#head = this.#head.next;\n\t\tthis.#size--;\n\n\t\t// Clean up tail reference when queue becomes empty\n\t\tif (!this.#head) {\n\t\t\tthis.#tail = undefined;\n\t\t}\n\n\t\treturn current.value;\n\t}\n\n\tpeek() {\n\t\tif (!this.#head) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn this.#head.value;\n\n\t\t// TODO: Node.js 18.\n\t\t// return this.#head?.value;\n\t}\n\n\tclear() {\n\t\tthis.#head = undefined;\n\t\tthis.#tail = undefined;\n\t\tthis.#size = 0;\n\t}\n\n\tget size() {\n\t\treturn this.#size;\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tlet current = this.#head;\n\n\t\twhile (current) {\n\t\t\tyield current.value;\n\t\t\tcurrent = current.next;\n\t\t}\n\t}\n\n\t* drain() {\n\t\twhile (this.#head) {\n\t\t\tyield this.dequeue();\n\t\t}\n\t}\n}\n","import Queue from 'yocto-queue';\n\nexport default function pLimit(concurrency) {\n\tlet rejectOnClear = false;\n\n\tif (typeof concurrency === 'object') {\n\t\t({concurrency, rejectOnClear = false} = concurrency);\n\t}\n\n\tvalidateConcurrency(concurrency);\n\n\tif (typeof rejectOnClear !== 'boolean') {\n\t\tthrow new TypeError('Expected `rejectOnClear` to be a boolean');\n\t}\n\n\tconst queue = new Queue();\n\tlet activeCount = 0;\n\n\tconst resumeNext = () => {\n\t\t// Process the next queued function if we're under the concurrency limit\n\t\tif (activeCount < concurrency && queue.size > 0) {\n\t\t\tactiveCount++;\n\t\t\tqueue.dequeue().run();\n\t\t}\n\t};\n\n\tconst next = () => {\n\t\tactiveCount--;\n\t\tresumeNext();\n\t};\n\n\tconst run = async (function_, resolve, arguments_) => {\n\t\t// Execute the function and capture the result promise\n\t\tconst result = (async () => function_(...arguments_))();\n\n\t\t// Resolve immediately with the promise (don't wait for completion)\n\t\tresolve(result);\n\n\t\t// Wait for the function to complete (success or failure)\n\t\t// We catch errors here to prevent unhandled rejections,\n\t\t// but the original promise rejection is preserved for the caller\n\t\ttry {\n\t\t\tawait result;\n\t\t} catch {}\n\n\t\t// Decrement active count and process next queued function\n\t\tnext();\n\t};\n\n\tconst enqueue = (function_, resolve, reject, arguments_) => {\n\t\tconst queueItem = {reject};\n\n\t\t// Queue the internal resolve function instead of the run function\n\t\t// to preserve the asynchronous execution context.\n\t\tnew Promise(internalResolve => { // eslint-disable-line promise/param-names\n\t\t\tqueueItem.run = internalResolve;\n\t\t\tqueue.enqueue(queueItem);\n\t\t}).then(run.bind(undefined, function_, resolve, arguments_)); // eslint-disable-line promise/prefer-await-to-then\n\n\t\t// Start processing immediately if we haven't reached the concurrency limit\n\t\tif (activeCount < concurrency) {\n\t\t\tresumeNext();\n\t\t}\n\t};\n\n\tconst generator = (function_, ...arguments_) => new Promise((resolve, reject) => {\n\t\tenqueue(function_, resolve, reject, arguments_);\n\t});\n\n\tObject.defineProperties(generator, {\n\t\tactiveCount: {\n\t\t\tget: () => activeCount,\n\t\t},\n\t\tpendingCount: {\n\t\t\tget: () => queue.size,\n\t\t},\n\t\tclearQueue: {\n\t\t\tvalue() {\n\t\t\t\tif (!rejectOnClear) {\n\t\t\t\t\tqueue.clear();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst abortError = AbortSignal.abort().reason;\n\n\t\t\t\twhile (queue.size > 0) {\n\t\t\t\t\tqueue.dequeue().reject(abortError);\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\tconcurrency: {\n\t\t\tget: () => concurrency,\n\n\t\t\tset(newConcurrency) {\n\t\t\t\tvalidateConcurrency(newConcurrency);\n\t\t\t\tconcurrency = newConcurrency;\n\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\t// eslint-disable-next-line no-unmodified-loop-condition\n\t\t\t\t\twhile (activeCount < concurrency && queue.size > 0) {\n\t\t\t\t\t\tresumeNext();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\t\tmap: {\n\t\t\tasync value(iterable, function_) {\n\t\t\t\tconst promises = Array.from(iterable, (value, index) => generator(function_, value, index));\n\t\t\t\treturn Promise.all(promises);\n\t\t\t},\n\t\t},\n\t});\n\n\treturn generator;\n}\n\nexport function limitFunction(function_, options) {\n\tconst limit = pLimit(options);\n\n\tconst limitedFunction = (...arguments_) => limit(() => function_(...arguments_));\n\tObject.defineProperty(limitedFunction, 'clearQueue', {\n\t\tvalue: limit.clearQueue,\n\t});\n\n\treturn limitedFunction;\n}\n\nfunction validateConcurrency(concurrency) {\n\tif (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {\n\t\tthrow new TypeError('Expected `concurrency` to be a number from 1 and up');\n\t}\n}\n","import { deepmerge } from 'deepmerge-ts';\n\nimport { type PuppeteerParameters } from '../puppeteer/puppeteer-parameters.interface';\n\nexport function mergePuppeteerParameters(\n defaults: PuppeteerParameters,\n overrides?: PuppeteerParameters,\n): PuppeteerParameters {\n if (!overrides) {\n return { ...defaults };\n }\n\n return deepmerge(defaults, overrides);\n}\n","export const PDF_PARAMETERS = 'PDF_PARAMETERS' as const;\n","import { existsSync, promises, readFileSync, writeFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\n\nimport { Inject, Injectable, Logger, OnModuleDestroy } from '@nestjs/common';\nimport {\n Browser as BrowserType,\n BrowserPlatform,\n canDownload,\n detectBrowserPlatform,\n getInstalledBrowsers,\n install,\n resolveBuildId,\n} from '@puppeteer/browsers';\nimport { Browser, BrowserContext, launch } from 'puppeteer';\n\nimport type { PuppeteerParameters } from '../puppeteer-parameters.interface';\n\nexport enum BrowserTag {\n LATEST = 'latest',\n BETA = 'beta',\n DEV = 'dev',\n STABLE = 'stable',\n CANARY = 'canary',\n}\n\nexport type Headless = boolean | 'shell' | undefined;\n\nasync function sleep(ms: number) {\n await new Promise((r) => setTimeout(r, ms));\n}\n\nasync function rmWithRetries(dir: string, retries = 5): Promise<void> {\n for (let attempt = 1; attempt <= retries; attempt++) {\n try {\n await promises.rm(dir, { recursive: true, force: true });\n return;\n } catch (err: unknown) {\n const code = (err as NodeJS.ErrnoException)?.code;\n\n const retryable =\n code === 'EPERM' || code === 'EBUSY' || code === 'ENOTEMPTY';\n\n if (!retryable || attempt === retries) {\n throw err;\n }\n\n await sleep(50 * 2 ** (attempt - 1));\n }\n }\n}\n\nfunction isTargetClosedError(error: unknown): boolean {\n if (!(error instanceof Error)) return false;\n\n return (\n error.name === 'TargetCloseError' ||\n error.message.includes('Target closed') ||\n error.message.includes('Target.createTarget')\n );\n}\n\n@Injectable()\nexport class BrowserService implements OnModuleDestroy {\n private readonly cacheDir: string;\n private readonly options?: PuppeteerParameters;\n\n private _browserInstance: Browser | null = null;\n private browser: BrowserType;\n\n public activeJobs = 0;\n public totalJobs = 0;\n\n private recycleRequested = false;\n private recycling = false;\n\n private shuttingDown = false;\n /** Max time to wait for in-flight PDF jobs to finish before closing the browser on shutdown. */\n public shutdownDrainTimeoutMs = 15_000;\n\n private browserTag: BrowserTag;\n private useLockedBrowser: boolean;\n private buildId: string | undefined;\n\n constructor(@Inject('PDF_PARAMETERS') pdfParams: PuppeteerParameters) {\n this.cacheDir = resolve('.cache/puppeteer-browser');\n this.options = pdfParams;\n\n this.loadBuildId();\n this.loadBrowser();\n this.loadBrowserTag();\n this.loadUseLockedBrowser();\n }\n\n async onModuleDestroy() {\n this.shuttingDown = true;\n await this.waitForIdle(this.shutdownDrainTimeoutMs);\n\n if (this._browserInstance?.connected) {\n try {\n await this._browserInstance.close();\n } catch (error) {\n Logger.warn(\n `Failed to close browser on module destroy: ${\n error instanceof Error ? error.message : String(error)\n }`,\n );\n }\n }\n\n if (this.options?.cleanupBrowserCacheOnExit !== false) {\n await this.cleanupCacheBestEffort();\n }\n }\n\n /** Wait until no PDF job is in flight, or until the timeout elapses. */\n private async waitForIdle(timeoutMs: number): Promise<void> {\n const start = Date.now();\n while (this.activeJobs > 0 && Date.now() - start < timeoutMs) {\n await sleep(50);\n }\n\n if (this.activeJobs > 0) {\n Logger.warn(\n `Shutdown: ${this.activeJobs} PDF job(s) still running after ${timeoutMs}ms, closing the browser anyway`,\n );\n }\n }\n\n async getBrowserInstance(\n args: Array<string>,\n headless: boolean | 'shell' | undefined,\n executablePathBin: string | undefined,\n ) {\n if (!this._browserInstance?.connected) {\n this._browserInstance = await this.launchBrowser(\n args,\n headless,\n executablePathBin,\n );\n }\n\n return this._browserInstance;\n }\n\n async createContext(\n args: Array<string>,\n headless: Headless,\n executablePath?: string,\n ): Promise<BrowserContext> {\n const browser = await this.getBrowserInstance(\n args,\n headless,\n executablePath,\n );\n try {\n return await browser.createBrowserContext();\n } catch (error) {\n if (!isTargetClosedError(error)) {\n throw error;\n }\n\n Logger.warn(\n 'Puppeteer browser closed while creating a context, retrying once',\n );\n\n this._browserInstance = null;\n const freshBrowser = await this.getBrowserInstance(\n args,\n headless,\n executablePath,\n );\n return await freshBrowser.createBrowserContext();\n }\n }\n\n markJobStarted() {\n if (this.shuttingDown) {\n throw new Error('nestjs-pdf is shutting down, refusing new PDF jobs');\n }\n\n this.activeJobs += 1;\n this.totalJobs += 1;\n\n if (this.totalJobs >= 200) {\n this.recycleRequested = true;\n }\n }\n\n async markJobFinished() {\n this.activeJobs = Math.max(0, this.activeJobs - 1);\n await this.recycleBrowserIfNeeded();\n }\n\n async recycleBrowserIfNeeded() {\n if (!this.recycleRequested) return;\n if (this.recycling) return;\n if (this.activeJobs > 0) return;\n if (!this._browserInstance) return;\n\n this.recycling = true;\n\n try {\n if (this._browserInstance.connected) {\n await this._browserInstance.close();\n }\n\n this._browserInstance = null;\n this.totalJobs = 0;\n this.recycleRequested = false;\n\n Logger.log('Puppeteer browser recycled successfully');\n } catch (error) {\n Logger.warn(\n `Failed to recycle browser: ${\n error instanceof Error ? error.message : String(error)\n }`,\n );\n } finally {\n this.recycling = false;\n }\n }\n\n private async cleanupCacheBestEffort() {\n const logger = new Logger('NestJsPdf');\n const dir = this.cacheDir;\n try {\n if (!existsSync(dir)) return;\n\n logger.log(`Cleanup puppeteer cache: ${dir}`);\n\n await rmWithRetries(dir, 6);\n if (existsSync(dir)) {\n await sleep(100);\n await rmWithRetries(dir, 3);\n }\n\n logger.log('Cleanup done');\n } catch (err) {\n logger.error(\n `Cleanup failed for ${dir}`,\n err instanceof Error ? err.stack : String(err),\n );\n }\n try {\n const leftover = await promises.readdir(dir, { recursive: true });\n logger.warn(`Leftover files: ${leftover.slice(0, 20).join(', ')}...`);\n } catch {\n logger.log(`No leftover files in ${dir}`);\n }\n }\n\n async install(lock: boolean = false) {\n const browser: BrowserType = this.browser;\n const versionTag: BrowserTag = this.browserTag;\n\n const browserPlatform = detectBrowserPlatform() ?? BrowserPlatform.LINUX;\n\n let buildId: string;\n if (this.buildId === undefined) {\n buildId = await resolveBuildId(browser, browserPlatform, versionTag);\n } else {\n buildId = this.buildId;\n }\n\n Logger.log(\n `Browser ${browser} ${versionTag} build id: ${buildId}`,\n 'NestJsPdf',\n );\n\n if (await this.hasBrowserInstalled(browser, buildId)) {\n Logger.log('Browser already installed', 'NestJsPdf');\n if (lock) {\n this.writeLockFile(browser, buildId);\n }\n return;\n } else {\n Logger.log('Starting browser installation', 'NestJsPdf');\n\n const installOption = {\n cacheDir: this.cacheDir,\n browser: browser,\n buildId: buildId,\n baseUrl: this.options?.browserInstallBaseUrl ?? undefined,\n };\n\n if (await canDownload(installOption)) {\n Logger.log(\n `Installing ${installOption.browser} ${installOption.buildId}`,\n 'NestJsPdf',\n );\n const installedBrowser = await install(installOption);\n if (await this.hasBrowserInstalled(browser, buildId)) {\n Logger.log('Browser installed successfully', 'NestJsPdf');\n if (lock) {\n this.writeLockFile(browser, buildId);\n }\n return installedBrowser;\n } else {\n Logger.error('Browser installation failed', 'NestJsPdf');\n }\n } else {\n Logger.error(\n `Error, can't install ${installOption.browser} ${installOption.buildId}`,\n 'NestJsPdf',\n );\n }\n }\n return null;\n }\n\n private loadBrowser(): void {\n let browser: BrowserType;\n if (this.options?.browser === undefined) {\n browser = BrowserType.CHROMIUM;\n } else {\n browser = this.options.browser;\n }\n this.browser = browser;\n }\n\n public getBrowser(): BrowserType {\n return this.browser;\n }\n\n private loadBrowserTag(): void {\n let versionTag: BrowserTag;\n if (this.options?.browserTag === undefined) {\n if (this.browser === BrowserType.CHROMIUM) {\n versionTag = BrowserTag.LATEST;\n } else {\n versionTag = BrowserTag.STABLE;\n }\n } else {\n versionTag = this.options.browserTag;\n }\n this.browserTag = versionTag;\n }\n\n private loadBuildId(): void {\n let buildId: string | undefined;\n if (this.options?.buildId === undefined) {\n buildId = undefined;\n } else {\n buildId = this.options.buildId;\n }\n this.buildId = buildId;\n }\n\n public setBrowserTag(browserTag: BrowserTag): void {\n this.browserTag = browserTag;\n }\n\n public getBrowserTag(): BrowserTag {\n return this.browserTag;\n }\n\n getBuildId(): string | undefined {\n return this.buildId;\n }\n\n private loadUseLockedBrowser(): void {\n let useLockedBrowser: boolean;\n if (this.options?.useLockedBrowser === undefined) {\n useLockedBrowser = false;\n } else {\n useLockedBrowser = this.options.useLockedBrowser;\n }\n this.useLockedBrowser = useLockedBrowser;\n }\n\n async hasBrowserInstalled(browser: BrowserType, buildId: string) {\n const installedBrowserlist = await getInstalledBrowsers({\n cacheDir: this.cacheDir,\n });\n\n const installedBrowser = installedBrowserlist.find((insBrowser) => {\n return insBrowser.browser === browser && insBrowser.buildId === buildId;\n });\n return installedBrowser !== undefined;\n }\n\n async getExecutablePath(): Promise<string> {\n const browser: BrowserType = this.browser;\n const versionTag: BrowserTag = this.browserTag;\n const browserPlatform = detectBrowserPlatform() ?? BrowserPlatform.LINUX;\n let buildId: string | null = null;\n if (this.useLockedBrowser) {\n buildId = this.getLockedBuildId(browser);\n Logger.log(`Using locked browser ${buildId}`, 'NestJsPdf');\n }\n buildId ??= await resolveBuildId(browser, browserPlatform, versionTag);\n const installedBrowserlist = await getInstalledBrowsers({\n cacheDir: this.cacheDir,\n });\n const installedBrowser = installedBrowserlist.find((insBrowser) => {\n return insBrowser.browser === browser && insBrowser.buildId === buildId;\n });\n if (installedBrowser === undefined) {\n const newinstalledBrowser = await this.install();\n if (newinstalledBrowser === null || newinstalledBrowser === undefined) {\n throw new Error('Could not install browser');\n } else {\n return newinstalledBrowser.executablePath;\n }\n }\n return installedBrowser.executablePath;\n }\n\n private async launchBrowser(\n args: Array<string>,\n headless: Headless,\n executablePathBin: string | undefined,\n ) {\n const executablePath =\n executablePathBin ?? (await this.getExecutablePath());\n\n const browser = await launch({\n executablePath,\n headless,\n args,\n });\n\n browser.on('disconnected', () => {\n Logger.warn('Puppeteer browser disconnected');\n if (this._browserInstance === browser) {\n this._browserInstance = null;\n }\n });\n\n return browser;\n }\n\n private writeLockFile(browser: BrowserType, buildId: string) {\n const lockFile = resolve(this.cacheDir, `${browser}.lock`);\n const data = JSON.stringify({\n browser: browser,\n buildId: buildId,\n date: new Date().toISOString(),\n });\n writeFileSync(lockFile, data);\n\n Logger.log(`Browser ${browser} locked to build ${buildId}`, 'NestJsPdf');\n }\n\n getLockedBuildId(browser: BrowserType): string | null {\n const lockFile = resolve(this.cacheDir, `${browser}.lock`);\n if (existsSync(lockFile)) {\n const data = readFileSync(lockFile);\n const lock = JSON.parse(data.toString()) as {\n browser: Browser;\n buildId: string;\n date: string;\n };\n return lock.buildId;\n }\n return null;\n }\n}\n","import { Injectable } from '@nestjs/common';\nimport ejs, { type Data, type Options } from 'ejs';\n\nexport interface EjsOptions extends Omit<Options, 'async'> {\n async?: boolean;\n}\n\n@Injectable()\nexport class EjsService {\n async render(template: string, data: Data = {}, options?: EjsOptions) {\n try {\n return await ejs.render(template, data, {\n async: true,\n ...options,\n });\n } catch (error) {\n throw new Error(`EJS rendering failed: ${String(error)}`, {\n cause: error,\n });\n }\n }\n\n async renderFile(filePath: string, data: Data = {}, options?: EjsOptions) {\n try {\n return await ejs.renderFile(filePath, data, {\n async: true,\n ...options,\n });\n } catch (error) {\n throw new Error(`EJS file rendering failed: ${String(error)}`, {\n cause: error,\n });\n }\n }\n}\n","import { readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\n\nimport { Injectable } from '@nestjs/common';\nimport { Eta, EtaConfig } from 'eta';\n\nexport interface EtaOptions extends Partial<EtaConfig> {\n cache?: boolean;\n autoEscape?: boolean;\n varName?: string;\n views?: string;\n useWith?: boolean;\n plugins?: Array<any>;\n}\n\n@Injectable()\nexport class EtaService {\n private readonly eta: Eta;\n private readonly templateCache: Map<string, string> = new Map();\n private readonly maxCacheSize = 100;\n\n constructor() {\n this.eta = new Eta({\n cache: true,\n autoEscape: true,\n useWith: true,\n });\n }\n\n /**\n * Render an Eta template from a string\n * @param template The template string to render\n * @param data The data object to use for rendering\n * @param options Optional Eta rendering options\n * @returns The rendered HTML string\n */\n render(\n template: string,\n data: Record<string, unknown> = {},\n options?: EtaOptions,\n ): string {\n try {\n const eta =\n options && Object.keys(options).length > 0\n ? new Eta({\n cache: true,\n autoEscape: true,\n useWith: true,\n ...options,\n varName: options.varName ?? 'it',\n })\n : this.eta;\n\n return eta.renderString(template, data);\n } catch (error) {\n throw new Error(`Eta rendering failed: ${String(error)}`, {\n cause: error,\n });\n }\n }\n\n /**\n * Render an Eta template from a file\n * @param filePath The path to the template file\n * @param data The data object to use for rendering\n * @param options Optional Eta rendering options\n * @returns The rendered HTML string\n */\n renderFile(\n filePath: string,\n data: Record<string, unknown> = {},\n options?: EtaOptions,\n ): string {\n try {\n const resolvedPath = resolve(filePath);\n const useCache = options?.cache ?? true;\n let template = useCache\n ? this.templateCache.get(resolvedPath)\n : undefined;\n\n if (!template) {\n template = readFileSync(resolvedPath, 'utf-8');\n\n if (useCache && this.templateCache.size < this.maxCacheSize) {\n this.templateCache.set(resolvedPath, template);\n }\n }\n return this.render(template, data, options);\n } catch (error) {\n throw new Error(\n `Eta file rendering failed for ${filePath}: ${String(error)}`,\n {\n cause: error,\n },\n );\n }\n }\n\n /**\n * Clear the template cache\n */\n clearCache(): void {\n this.templateCache.clear();\n }\n\n /**\n * Get the current cache size\n * @returns The number of cached templates\n */\n getCacheSize(): number {\n return this.templateCache.size;\n }\n}\n","import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';\nimport { basename, extname, join, resolve, sep } from 'node:path';\n\nimport { Injectable } from '@nestjs/common';\nimport Handlebars from 'handlebars';\n\nexport type HandlebarsHelper = {\n name: string;\n fn: Handlebars.HelperDelegate;\n};\n\nexport interface HandlebarsOptions {\n /** Base directory (relative to `process.cwd()`) used to resolve files passed to `renderFile`. */\n templateDirectory?: string;\n /** Directory (relative to `process.cwd()`) whose files are each registered as a partial. */\n partialDirectory?: string;\n /**\n * Runtime options forwarded to the compiled template function.\n * `helpers` and `partials` are excluded on purpose: register helpers via\n * `helpers` and partials via `partialDirectory`.\n */\n templateOptions?: Omit<Handlebars.RuntimeOptions, 'helpers' | 'partials'>;\n /** Options forwarded to `Handlebars.compile`. */\n compileOptions?: CompileOptions;\n /** Custom helpers registered on the isolated Handlebars environment for this render. */\n helpers?: Array<HandlebarsHelper>;\n}\n\n@Injectable()\nexport class HandlebarsService {\n private cachedOptions?: HandlebarsOptions;\n private cachedEnv?: typeof Handlebars;\n\n render(\n template: string,\n parameters: unknown = {},\n options: HandlebarsOptions = {},\n ): string {\n try {\n const compiled = this.getEnv(options).compile(\n template,\n options.compileOptions,\n );\n return compiled(parameters, options.templateOptions);\n } catch (error) {\n throw new Error(`Handlebars rendering failed: ${String(error)}`, {\n cause: error,\n });\n }\n }\n\n renderFile(\n file: string,\n parameters: unknown = {},\n options: HandlebarsOptions = {},\n ): string {\n if (options.templateDirectory === undefined) {\n throw new Error(\n 'Handlebars file rendering failed: option `templateDirectory` is not set',\n );\n }\n\n const baseDir = resolve(process.cwd(), options.templateDirectory);\n const templatePath = resolve(baseDir, file);\n if (templatePath !== baseDir && !templatePath.startsWith(baseDir + sep)) {\n throw new Error(\n `Handlebars file rendering failed: ’${file}’ resolves outside \\`templateDirectory\\``,\n );\n }\n\n let template: string;\n try {\n template = readFileSync(templatePath, 'utf8');\n } catch (error) {\n throw new Error(`Handlebars file rendering failed: ${String(error)}`, {\n cause: error,\n });\n }\n\n return this.render(template, parameters, options);\n }\n\n /**\n * Build an isolated Handlebars environment with the given helpers/partials so\n * nothing leaks into the global Handlebars. Memoised for the common case where\n * the same options object is reused across calls (e.g. the module `hbsOptions`).\n */\n private getEnv(options: HandlebarsOptions): typeof Handlebars {\n if (this.cachedEnv && this.cachedOptions === options) {\n return this.cachedEnv;\n }\n\n const env = Handlebars.create();\n\n for (const helper of options.helpers ?? []) {\n env.registerHelper(helper.name, helper.fn);\n }\n this.registerPartials(env, options.partialDirectory);\n\n this.cachedOptions = options;\n this.cachedEnv = env;\n return env;\n }\n\n private registerPartials(\n env: typeof Handlebars,\n partialDirectory: string | undefined,\n ): void {\n if (partialDirectory === undefined) return;\n\n const partialPath = join(process.cwd(), partialDirectory);\n if (!existsSync(partialPath)) {\n throw new Error(\n `Handlebars partial directory does not exist: ${partialPath}`,\n );\n }\n\n for (const entry of readdirSync(partialPath)) {\n const filePath = join(partialPath, entry);\n if (!statSync(filePath).isFile()) continue;\n\n env.registerPartial(\n basename(entry, extname(entry)),\n readFileSync(filePath, 'utf8'),\n );\n }\n }\n}\n","import { readFileSync } from 'node:fs';\n\nimport { Injectable } from '@nestjs/common';\nimport mjml from 'mjml';\nimport { type MJMLParsingOptions } from 'mjml-core';\n\n@Injectable()\nexport class MjmlService {\n async render(\n template: string,\n options?: MJMLParsingOptions,\n ): Promise<string> {\n const { html } = await mjml(template, options);\n return html;\n }\n\n async renderFile(\n filePath: string,\n options?: MJMLParsingOptions,\n ): Promise<string> {\n const template = readFileSync(filePath, 'utf-8');\n return await this.render(template, options);\n }\n}\n","import { readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\n\nimport { Injectable } from '@nestjs/common';\nimport mustache, { EscapeFunction } from 'mustache';\n\nexport interface MustacheOptions {\n tags?: [string, string];\n escape?: EscapeFunction;\n}\n\n@Injectable()\nexport class MustacheService {\n private readonly templateCache: Map<string, string> = new Map();\n private readonly maxCacheSize = 100;\n\n /**\n * Render a Mustache template from a string\n * @param template The template string to render\n * @param data The data object to use for rendering\n * @param options Optional Mustache rendering options\n * @returns The rendered HTML string\n */\n render(\n template: string,\n data: Record<string, unknown> = {},\n options?: MustacheOptions,\n ): string {\n try {\n const tags = options?.tags ?? ['{{', '}}'];\n return mustache.render(template, data, undefined, {\n tags: tags,\n escape: options?.escape,\n });\n } catch (error) {\n throw new Error(`Mustache rendering failed: ${String(error)}`, {\n cause: error,\n });\n }\n }\n\n /**\n * Render a Mustache template from a file\n * @param filePath The path to the template file\n * @param data The data object to use for rendering\n * @param options Optional Mustache rendering options\n * @returns The rendered HTML string\n */\n renderFile(\n filePath: string,\n data: Record<string, unknown> = {},\n options?: MustacheOptions,\n ): string {\n try {\n const resolvedPath = resolve(filePath);\n let template = this.templateCache.get(resolvedPath);\n\n if (!template) {\n template = readFileSync(resolvedPath, 'utf-8');\n\n if (this.templateCache.size < this.maxCacheSize) {\n this.templateCache.set(resolvedPath, template);\n }\n }\n\n return this.render(template, data, options);\n } catch (error) {\n throw new Error(\n `Mustache file rendering failed for ${filePath}: ${String(error)}`,\n {\n cause: error,\n },\n );\n }\n }\n\n /**\n * Clear the template cache\n */\n clearCache(): void {\n this.templateCache.clear();\n }\n\n /**\n * Get the current cache size\n * @returns The number of cached templates\n */\n getCacheSize(): number {\n return this.templateCache.size;\n }\n}\n","import { Injectable } from '@nestjs/common';\nimport nunjucks, { type ConfigureOptions } from 'nunjucks';\n\nexport interface NunjucksOptions extends Partial<ConfigureOptions> {\n noCache?: boolean;\n watch?: boolean;\n throwOnUndefined?: boolean;\n trimBlocks?: boolean;\n lstripBlocks?: boolean;\n}\n\n@Injectable()\nexport class NunjucksService {\n constructor() {\n // Configure default Nunjucks environment\n nunjucks.configure({\n noCache: true,\n trimBlocks: true,\n lstripBlocks: true,\n });\n }\n\n render(\n template: string,\n data: Record<string, unknown> = {},\n options?: NunjucksOptions,\n ) {\n try {\n if (options) {\n const configOptions: Record<string, unknown> = {\n noCache: options.noCache ?? true,\n watch: options.watch ?? false,\n throwOnUndefined: options.throwOnUndefined ?? false,\n trimBlocks: options.trimBlocks ?? true,\n lstripBlocks: options.lstripBlocks ?? true,\n };\n nunjucks.configure(configOptions as ConfigureOptions);\n }\n return nunjucks.renderString(template, data);\n } catch (error) {\n throw new Error(`Nunjucks rendering failed: ${String(error)}`, {\n cause: error,\n });\n }\n }\n\n renderFile(\n filePath: string,\n data: Record<string, unknown> = {},\n options?: NunjucksOptions,\n ) {\n try {\n if (options) {\n const configOptions: Record<string, unknown> = {\n noCache: options.noCache ?? true,\n watch: options.watch ?? false,\n throwOnUndefined: options.throwOnUndefined ?? false,\n trimBlocks: options.trimBlocks ?? true,\n lstripBlocks: options.lstripBlocks ?? true,\n };\n nunjucks.configure(configOptions as ConfigureOptions);\n }\n return nunjucks.render(filePath, data);\n } catch (error) {\n throw new Error(`Nunjucks file rendering failed: ${String(error)}`, {\n cause: error,\n });\n }\n }\n}\n","import { readFileSync } from 'node:fs';\n\nimport { Injectable } from '@nestjs/common';\nimport pug, { type LocalsObject, type Options } from 'pug';\n\nexport type PugOptions = Options;\n\n@Injectable()\nexport class PugService {\n render(\n template: string,\n data: LocalsObject = {},\n options?: PugOptions,\n ): string {\n try {\n const compiledFn = pug.compile(template, {\n ...options,\n });\n return compiledFn(data);\n } catch (error) {\n throw new Error(`Pug rendering failed: ${String(error)}`, {\n cause: error,\n });\n }\n }\n\n renderFile(\n filePath: string,\n data: LocalsObject = {},\n options?: PugOptions,\n ): string {\n try {\n const template = readFileSync(filePath, 'utf-8');\n return this.render(template, data, options);\n } catch (error) {\n throw new Error(`Pug file rendering failed: ${String(error)}`, {\n cause: error,\n });\n }\n }\n}\n","export function requireService<T>(service: T | undefined, name: string): T {\n if (!service) {\n throw new Error(\n `${name} service is not available. If the problem persists, open an issue in the repo.`,\n );\n }\n\n return service;\n}\n","import { Inject, Injectable, Logger, Optional } from '@nestjs/common';\nimport { Data } from 'ejs';\nimport pLimit from 'p-limit';\nimport { LocalsObject } from 'pug';\nimport { PDFOptions } from 'puppeteer';\n\nimport { mergePuppeteerParameters } from '../helpers/deepMergePdfparams';\nimport { PDF_PARAMETERS } from '../helpers/tokens';\nimport { BrowserService } from './browser/browser.service';\nimport { EjsService } from './engines/ejs/ejs.service';\nimport { EtaService } from './engines/eta/eta.service';\nimport { HandlebarsService } from './engines/handlebars/handlebars.service';\nimport { MjmlService } from './engines/mjml/mjml.service';\nimport { MustacheService } from './engines/mustache/mustache.service';\nimport { NunjucksService } from './engines/nunjucks/nunjucks.service';\nimport { PugService } from './engines/pug/pug.service';\nimport { requireService } from './libs/requireService.utils';\nimport type { PuppeteerParameters } from './puppeteer-parameters.interface';\n\n@Injectable()\nexport class PuppeteerService {\n constructor(\n private readonly browserService: BrowserService,\n @Inject(PDF_PARAMETERS) private readonly options: PuppeteerParameters,\n @Optional() private readonly hbsService?: HandlebarsService,\n @Optional() private readonly mjmlService?: MjmlService,\n @Optional() private readonly pugService?: PugService,\n @Optional() private readonly ejsService?: EjsService,\n @Optional() private readonly nunjucksService?: NunjucksService,\n @Optional() private readonly etaService?: EtaService,\n @Optional() private readonly mustacheService?: MustacheService,\n ) {}\n\n private readonly limit = pLimit(3);\n\n async generatePdfFromHtml(\n html: string,\n options?: PuppeteerParameters,\n ): Promise<Uint8Array> {\n return this.limit(async () => {\n const mergePuppeteerOptions = mergePuppeteerParameters(\n this.options,\n options,\n );\n if (mergePuppeteerOptions.chromiumRevision !== undefined) {\n Logger.warn(\n 'Using `chromiumRevision` is no longer supported since the puppeteer update.',\n );\n }\n\n const headless: boolean | 'shell' =\n mergePuppeteerOptions.headless ?? true;\n\n const executablePath = mergePuppeteerOptions.executablePath || undefined;\n\n //src: https://www.bannerbear.com/blog/ways-to-speed-up-puppeteer-screenshots/\n const args = mergePuppeteerOptions.extraPuppeteerArgs || [\n '--autoplay-policy=user-gesture-required',\n '--disable-background-networking',\n '--disable-background-timer-throttling',\n '--disable-backgrounding-occluded-windows',\n '--disable-breakpad',\n '--disable-client-side-phishing-detection',\n '--disable-component-update',\n '--disable-default-apps',\n '--disable-dev-shm-usage',\n '--disable-domain-reliability',\n '--disable-extensions',\n '--disable-features=AudioServiceOutOfProcess',\n '--disable-hang-monitor',\n '--disable-ipc-flooding-protection',\n '--disable-notifications',\n '--disable-offer-store-unmasked-wallet-cards',\n '--disable-popup-blocking',\n '--disable-print-preview',\n '--disable-prompt-on-repost',\n '--disable-renderer-backgrounding',\n '--disable-setuid-sandbox',\n '--disable-speech-api',\n '--disable-sync',\n '--hide-scrollbars',\n '--ignore-gpu-blacklist',\n '--metrics-recording-only',\n '--mute-audio',\n '--no-default-browser-check',\n '--no-first-run',\n '--no-pings',\n '--password-store=basic',\n '--use-gl=swiftshader',\n '--use-mock-keychain',\n '--disable-accelerated-2d-canvas',\n '--no-zygote',\n '--disable-gpu',\n ];\n\n this.browserService.markJobStarted();\n let context: Awaited<ReturnType<BrowserService['createContext']>> | null =\n null;\n\n try {\n context = await this.browserService.createContext(\n args,\n headless,\n executablePath,\n );\n const page = await context.newPage();\n\n const pdfOptions: PDFOptions = mergePuppeteerOptions.pdfOptions ?? {\n format: 'A4',\n };\n\n await page.setContent(html, { waitUntil: 'domcontentloaded' });\n await page.emulateMediaType('screen');\n await page.waitForNetworkIdle({ idleTime: 500, timeout: 30000 });\n await page.evaluate(() => document.fonts.ready);\n\n return await page.pdf(pdfOptions);\n } catch (e) {\n Logger.error(e);\n throw e;\n } finally {\n if (context) {\n try {\n await context.close();\n } catch (error) {\n Logger.error(error);\n }\n }\n await this.browserService.markJobFinished();\n }\n });\n }\n\n async generatePdfFromTemplateHbsString(\n template: string,\n parameters: any = {},\n options?: PuppeteerParameters,\n ) {\n const hbsService = requireService(this.hbsService, 'Handlebars');\n const html = hbsService.render(\n template,\n parameters,\n options?.hbsOptions ?? this.options.hbsOptions,\n );\n return this.generatePdfFromHtml(html, options);\n }\n\n async generatePdfFromTemplateHbsFile(\n file: string,\n parameters: any = {},\n options?: PuppeteerParameters,\n ) {\n const hbsService = requireService(this.hbsService, 'Handlebars');\n const html = hbsService.renderFile(\n file,\n parameters,\n options?.hbsOptions ?? this.options.hbsOptions,\n );\n return this.generatePdfFromHtml(html, options);\n }\n\n async generatePdfFromMjmlString(\n template: string,\n options?: PuppeteerParameters,\n ) {\n const mjmlService = requireService(this.mjmlService, 'MJML');\n const html = await mjmlService.render(\n template,\n options?.mjmlOptions ?? this.options.mjmlOptions,\n );\n return this.generatePdfFromHtml(html, options);\n }\n\n async generatePdfFromMjmlFile(file: string, options?: PuppeteerParameters) {\n const mjmlService = requireService(this.mjmlService, 'MJML');\n const html = await mjmlService.renderFile(\n file,\n options?.mjmlOptions ?? this.options.mjmlOptions,\n );\n return this.generatePdfFromHtml(html, options);\n }\n\n async generatePdfFromPugString(\n template: string,\n data: LocalsObject = {},\n options?: PuppeteerParameters,\n ) {\n const pugService = requireService(this.pugService, 'Pug');\n const html = pugService.render(\n template,\n data,\n options?.pugOptions ?? this.options.pugOptions,\n );\n return this.generatePdfFromHtml(html, options);\n }\n\n async generatePdfFromPugFile(\n file: string,\n data: LocalsObject = {},\n options?: PuppeteerParameters,\n ) {\n const pugService = requireService(this.pugService, 'Pug');\n const html = pugService.renderFile(\n file,\n data,\n options?.pugOptions ?? this.options.pugOptions,\n );\n return this.generatePdfFromHtml(html, options);\n }\n\n async generatePdfFromEjsString(\n template: string,\n data: Data = {},\n options?: PuppeteerParameters,\n ) {\n const ejsService = requireService(this.ejsService, 'EJS');\n const html = await ejsService.render(\n template,\n data,\n options?.ejsOptions ?? this.options.ejsOptions,\n );\n return this.generatePdfFromHtml(html, options);\n }\n\n async generatePdfFromEjsFile(\n file: string,\n data: Data = {},\n options?: PuppeteerParameters,\n ) {\n const ejsService = requireService(this.ejsService, 'EJS');\n const html = await ejsService.renderFile(\n file,\n data,\n options?.ejsOptions ?? this.options.ejsOptions,\n );\n return this.generatePdfFromHtml(html, options);\n }\n\n async generatePdfFromNunjucksString(\n template: string,\n data: Record<string, unknown> = {},\n options?: PuppeteerParameters,\n ) {\n const nunjucksService = requireService(this.nunjucksService, 'Nunjucks');\n const html = nunjucksService.render(\n template,\n data,\n options?.nunjucksOptions ?? this.options.nunjucksOptions,\n );\n return this.generatePdfFromHtml(html, options);\n }\n\n async generatePdfFromNunjucksFile(\n file: string,\n data: Record<string, unknown> = {},\n options?: PuppeteerParameters,\n ) {\n const nunjucksService = requireService(this.nunjucksService, 'Nunjucks');\n const html = nunjucksService.renderFile(\n file,\n data,\n options?.nunjucksOptions ?? this.options.nunjucksOptions,\n );\n return this.generatePdfFromHtml(html, options);\n }\n\n async generatePdfFromEtaString(\n template: string,\n data: Record<string, unknown> = {},\n options?: PuppeteerParameters,\n ) {\n const etaService = requireService(this.etaService, 'Eta');\n const html = etaService.render(\n template,\n data,\n options?.etaOptions ?? this.options.etaOptions,\n );\n return this.generatePdfFromHtml(html, options);\n }\n\n async generatePdfFromEtaFile(\n file: string,\n data: Record<string, unknown> = {},\n options?: PuppeteerParameters,\n ) {\n const etaService = requireService(this.etaService, 'Eta');\n const html = etaService.renderFile(\n file,\n data,\n options?.etaOptions ?? this.options.etaOptions,\n );\n return this.generatePdfFromHtml(html, options);\n }\n\n async generatePdfFromMustacheString(\n template: string,\n data: Record<string, unknown> = {},\n options?: PuppeteerParameters,\n ) {\n const mustacheService = requireService(this.mustacheService, 'Mustache');\n const html = mustacheService.render(\n template,\n data,\n options?.mustacheOptions ?? this.options.mustacheOptions,\n );\n return this.generatePdfFromHtml(html, options);\n }\n\n async generatePdfFromMustacheFile(\n file: string,\n data: Record<string, unknown> = {},\n options?: PuppeteerParameters,\n ) {\n const mustacheService = requireService(this.mustacheService, 'Mustache');\n const html = mustacheService.renderFile(\n file,\n data,\n options?.mustacheOptions ?? this.options.mustacheOptions,\n );\n return this.generatePdfFromHtml(html, options);\n }\n}\n","import { Injectable } from '@nestjs/common';\nimport { Data } from 'ejs';\nimport { LocalsObject } from 'pug';\n\nimport { addSignatureFieldUsingAnchor } from './helpers/signature.helper';\nimport { PuppeteerService } from './puppeteer/puppeteer.service';\nimport { PuppeteerParameters } from './puppeteer/puppeteer-parameters.interface';\n\n@Injectable()\nexport class NestjsPdfService {\n constructor(private readonly puppeteerService: PuppeteerService) {}\n\n /**\n * @param html HTML string to convert to PDF\n * @param options PDF generation options (optional)\n * @returns PDF generated from the provided HTML\n * @description This method uses the Puppeteer service to generate a PDF from an HTML string. Generation options can be customized by passing a `PuppeteerParameters` object as the second argument. This allows you to control various aspects of PDF rendering, such as page size, margins, background display, etc. If no options are provided, the default parameters defined in the Puppeteer service will be used.\n */\n generatePdfFromHtml(html: string, options?: PuppeteerParameters) {\n return this.puppeteerService.generatePdfFromHtml(html, options);\n }\n\n /**\n * @param template Handlebars template string\n * @param parameters Data parameters to inject into the template\n * @param options PDF generation options (optional)\n * @returns PDF generated from the provided Handlebars template with parameters applied\n * @description This method generates a PDF from a Handlebars template provided as a string. The parameters to inject into the template are passed in the `parameters` object, which is used to render the template before converting it to PDF. PDF generation options can also be customized by passing a `PuppeteerParameters` object as the third argument. This allows you to control various aspects of PDF rendering, such as page size, margins, background display, etc. If no options are provided, the default parameters defined in the Puppeteer service will be used.\n */\n generatePdfFromTemplateHbsString(\n template: string,\n parameters: any = {},\n options?: PuppeteerParameters,\n ) {\n return this.puppeteerService.generatePdfFromTemplateHbsString(\n template,\n parameters,\n options,\n );\n }\n\n /**\n * @param file Path to the Handlebars template file\n * @param parameters Data parameters to inject into the template\n * @param options PDF generation options (optional)\n * @returns PDF generated from the Handlebars template at the provided file path with parameters applied\n * @description This method generates a PDF from a Handlebars template located at the specified file path. The file path is passed as a string in the `file` parameter. The parameters to inject into the template are passed in the `parameters` object, which is used to render the template before converting it to PDF. PDF generation options can also be customized by passing a `PuppeteerParameters` object as the third argument. This allows you to control various aspects of PDF rendering, such as page size, margins, background display, etc. If no options are provided, the default parameters defined in the Puppeteer service will be used.\n */\n generatePdfFromTemplateHbsFile(\n file: string,\n parameters: any = {},\n options?: PuppeteerParameters,\n ) {\n return this.puppeteerService.generatePdfFromTemplateHbsFile(\n file,\n parameters,\n options,\n );\n }\n\n /**\n * @param template MJML template string\n * @param options PDF generation options (optional)\n * @returns PDF generated from the provided MJML template\n * @description This method generates a PDF from an MJML template provided as a string. MJML (MJML Markup Language) is a markup language designed to reduce the pain of coding a responsive email. The template is first rendered to HTML using the MJML renderer, then converted to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the second argument.\n */\n generatePdfFromMjmlString(template: string, options?: PuppeteerParameters) {\n return this.puppeteerService.generatePdfFromMjmlString(template, options);\n }\n\n /**\n * @param file Path to the MJML template file\n * @param options PDF generation options (optional)\n * @returns PDF generated from the MJML template at the provided file path\n * @description This method generates a PDF from an MJML template located at the specified file path. The file path is passed as a string in the `file` parameter. The template is first rendered to HTML using the MJML renderer, then converted to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the second argument.\n */\n generatePdfFromMjmlFile(file: string, options?: PuppeteerParameters) {\n return this.puppeteerService.generatePdfFromMjmlFile(file, options);\n }\n\n /**\n * @param template EJS template string\n * @param data Data to inject into the template\n * @param options PDF generation options (optional)\n * @returns PDF generated from the provided EJS template with data applied\n * @description This method generates a PDF from an EJS (Embedded JavaScript) template provided as a string. EJS is a templating language with a simple, straightforward syntax. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.\n */\n generatePdfFromEjsString(\n template: string,\n data: Data = {},\n options?: PuppeteerParameters,\n ) {\n return this.puppeteerService.generatePdfFromEjsString(\n template,\n data,\n options,\n );\n }\n\n /**\n * @param file Path to the EJS template file\n * @param data Data to inject into the template\n * @param options PDF generation options (optional)\n * @returns PDF generated from the EJS template at the provided file path with data applied\n * @description This method generates a PDF from an EJS template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.\n */\n generatePdfFromEjsFile(\n file: string,\n data: Data = {},\n options?: PuppeteerParameters,\n ) {\n return this.puppeteerService.generatePdfFromEjsFile(file, data, options);\n }\n\n /**\n * @param template Pug template string\n * @param data Data to inject into the template\n * @param options PDF generation options (optional)\n * @returns PDF generated from the provided Pug template with data applied\n * @description This method generates a PDF from a Pug template provided as a string. Pug is a clean, whitespace-sensitive syntax for writing HTML. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.\n */\n generatePdfFromPugString(\n template: string,\n data: LocalsObject = {},\n options?: PuppeteerParameters,\n ) {\n return this.puppeteerService.generatePdfFromPugString(\n template,\n data,\n options,\n );\n }\n\n /**\n * @param file Path to the Pug template file\n * @param data Data to inject into the template\n * @param options PDF generation options (optional)\n * @returns PDF generated from the Pug template at the provided file path with data applied\n * @description This method generates a PDF from a Pug template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.\n */\n generatePdfFromPugFile(\n file: string,\n data: LocalsObject = {},\n options?: PuppeteerParameters,\n ) {\n return this.puppeteerService.generatePdfFromPugFile(file, data, options);\n }\n\n /**\n * @param template Nunjucks template string\n * @param data Data to inject into the template\n * @param options PDF generation options (optional)\n * @returns PDF generated from the provided Nunjucks template with data applied\n * @description This method generates a PDF from a Nunjucks template provided as a string. Nunjucks is a powerful templating language with support for inheritance, macros, and filters. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.\n */\n generatePdfFromNunjucksString(\n template: string,\n data: Record<string, unknown> = {},\n options?: PuppeteerParameters,\n ) {\n return this.puppeteerService.generatePdfFromNunjucksString(\n template,\n data,\n options,\n );\n }\n\n /**\n * @param file Path to the Nunjucks template file\n * @param data Data to inject into the template\n * @param options PDF generation options (optional)\n * @returns PDF generated from the Nunjucks template at the provided file path with data applied\n * @description This method generates a PDF from a Nunjucks template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.\n */\n generatePdfFromNunjucksFile(\n file: string,\n data: Record<string, unknown> = {},\n options?: PuppeteerParameters,\n ) {\n return this.puppeteerService.generatePdfFromNunjucksFile(\n file,\n data,\n options,\n );\n }\n\n /**\n * @param template Eta template string\n * @param data Data to inject into the template\n * @param options PDF generation options (optional)\n * @returns PDF generated from the provided Eta template with data applied\n * @description This method generates a PDF from an Eta template provided as a string. Eta is a fast and lightweight embedded templating language with a syntax similar to EJS but with better performance. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.\n */\n generatePdfFromEtaString(\n template: string,\n data: Record<string, unknown> = {},\n options?: PuppeteerParameters,\n ) {\n return this.puppeteerService.generatePdfFromEtaString(\n template,\n data,\n options,\n );\n }\n\n /**\n * @param file Path to the Eta template file\n * @param data Data to inject into the template\n * @param options PDF generation options (optional)\n * @returns PDF generated from the Eta template at the provided file path with data applied\n * @description This method generates a PDF from an Eta template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.\n */\n generatePdfFromEtaFile(\n file: string,\n data: Record<string, unknown> = {},\n options?: PuppeteerParameters,\n ) {\n return this.puppeteerService.generatePdfFromEtaFile(file, data, options);\n }\n\n /**\n * @param template Mustache template string\n * @param data Data to inject into the template\n * @param options PDF generation options (optional)\n * @returns PDF generated from the provided Mustache template with data applied\n * @description This method generates a PDF from a Mustache template provided as a string. Mustache is a logic-less template language that emphasizes readable and simple templates. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.\n */\n generatePdfFromMustacheString(\n template: string,\n data: Record<string, unknown> = {},\n options?: PuppeteerParameters,\n ) {\n return this.puppeteerService.generatePdfFromMustacheString(\n template,\n data,\n options,\n );\n }\n\n /**\n * @param file Path to the Mustache template file\n * @param data Data to inject into the template\n * @param options PDF generation options (optional)\n * @returns PDF generated from the Mustache template at the provided file path with data applied\n * @description This method generates a PDF from a Mustache template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.\n */\n generatePdfFromMustacheFile(\n file: string,\n data: Record<string, unknown> = {},\n options?: PuppeteerParameters,\n ) {\n return this.puppeteerService.generatePdfFromMustacheFile(\n file,\n data,\n options,\n );\n }\n\n /**\n * @param pdf The PDF bytes to modify\n * @param fieldName The name of the signature field to add (default: 'SignatureDebtor')\n * @param anchorText The text anchor to locate the signature field position (default: '__SIG_DEBTOR_ANCHOR__')\n * @returns Modified PDF with a signature field added at the anchor position\n * @description This method adds a signature field to a PDF using a text anchor as a reference for the field position. It uses the `addSignatureFieldUsingAnchor` function which finds the anchor in the PDF and inserts a signature field at that location. The signature field is named according to the `fieldName` parameter and the anchor is defined by `anchorText`.\n *\n * Usage example:\n * ```typescript\n * const modifiedPdf = await pdfService.addSignatureFieldSignatureDebtorRaw(\n * originalPdfBytes,\n * 'SignatureDebtor',\n * '__SIG_DEBTOR_ANCHOR__'\n * );\n * ```\n *\n * In this example, `originalPdfBytes` is a byte array representing the original PDF, `SignatureDebtor` is the name of the signature field to add, and `__SIG_DEBTOR_ANCHOR__` is the anchor text used to position the signature field in the PDF.\n *\n * If the anchor is not found, the signature field will be added at a default position (centered at the bottom of the last page).\n *\n * Note: Ensure that the input PDF contains the anchor defined by `anchorText` for the signature field to be positioned correctly. Otherwise, it will be added at a default position.\n */\n async addSignatureFieldSignatureDebtorRaw(\n pdf: Uint8Array | Buffer,\n fieldName: string = 'SignatureDebtor',\n anchorText: string = '__SIG_DEBTOR_ANCHOR__',\n ) {\n return await addSignatureFieldUsingAnchor(pdf, fieldName, anchorText);\n }\n}\n","'use strict'\n\nfunction _resolveEscapeSequences (value) {\n return value.replace(/\\\\\\$/g, '$')\n}\n\nfunction expandValue (value, processEnv, runningParsed) {\n const env = { ...runningParsed, ...processEnv } // process.env wins\n\n const regex = /(?<!\\\\)\\${([^{}]+)}|(?<!\\\\)\\$([A-Za-z_][A-Za-z0-9_]*)/g\n\n let result = value\n let match\n const seen = new Set() // self-referential checker\n\n while ((match = regex.exec(result)) !== null) {\n seen.add(result)\n\n const [template, bracedExpression, unbracedExpression] = match\n const expression = bracedExpression || unbracedExpression\n\n // match the operators `:+`, `+`, `:-`, and `-`\n const opRegex = /(:\\+|\\+|:-|-)/\n // find first match\n const opMatch = expression.match(opRegex)\n const splitter = opMatch ? opMatch[0] : null\n\n const r = expression.split(splitter)\n\n let defaultValue\n let value\n\n const key = r.shift()\n\n if ([':+', '+'].includes(splitter)) {\n defaultValue = env[key] ? r.join(splitter) : ''\n value = null\n } else {\n defaultValue = r.join(splitter)\n value = env[key]\n }\n\n if (value) {\n // self-referential check\n if (seen.has(value)) {\n result = result.replace(template, defaultValue)\n } else {\n result = result.replace(template, value)\n }\n } else {\n result = result.replace(template, defaultValue)\n }\n\n // if the result equaled what was in process.env and runningParsed then stop expanding\n if (result === runningParsed[key]) {\n break\n }\n\n regex.lastIndex = 0 // reset regex search position to re-evaluate after each replacement\n }\n\n return result\n}\n\nfunction expand (options) {\n // for use with progressive expansion\n const runningParsed = {}\n\n let processEnv = process.env\n if (options && options.processEnv != null) {\n processEnv = options.processEnv\n }\n\n // dotenv.config() ran before this so the assumption is process.env has already been set\n for (const key in options.parsed) {\n let value = options.parsed[key]\n\n // short-circuit scenario: process.env was already set prior to the file value\n if (processEnv[key] && processEnv[key] !== value) {\n value = processEnv[key]\n } else {\n value = expandValue(value, processEnv, runningParsed)\n }\n\n options.parsed[key] = _resolveEscapeSequences(value)\n\n // for use with progressive expansion\n runningParsed[key] = _resolveEscapeSequences(value)\n }\n\n for (const processKey in options.parsed) {\n processEnv[processKey] = options.parsed[processKey]\n }\n\n return options\n}\n\nmodule.exports.expand = expand\n","/**\n * Injection tokens\n */\nexport const CONFIGURATION_SERVICE_TOKEN = Symbol('CONFIG_SERVICE');\nexport const CONFIGURATION_TOKEN = 'CONFIGURATION_TOKEN';\nexport const CONFIGURATION_LOADER = 'CONFIGURATION_LOADER';\nexport const VALIDATED_ENV_LOADER = 'VALIDATED_ENV_LOADER';\nexport const PARTIAL_CONFIGURATION_KEY = 'PARTIAL_CONFIGURATION_KEY';\nexport const PARTIAL_CONFIGURATION_PROPNAME = 'KEY';\nexport const VALIDATED_ENV_PROPNAME = '_PROCESS_ENV_VALIDATED';\nexport const AS_PROVIDER_METHOD_KEY = 'asProvider';\n","//#region src/_internal/isUnsafeProperty.ts\n/**\n* Checks if a property key is unsafe to access or copy directly.\n*\n* This function is used in functions like `get`, `unset`, and `merge` to prevent\n* prototype pollution attacks by identifying `__proto__`, which modifies the object's\n* prototype chain. `constructor` and `prototype` stay accessible here because lodash\n* keeps reads of them unrestricted; write paths use `isUnsafeToWriteProperty` instead,\n* which also blocks those keys.\n*\n* @param key - The property key to check\n* @returns `true` if the property is unsafe to access directly, `false` otherwise\n* @internal\n*/\nfunction isUnsafeProperty(key) {\n\treturn key === \"__proto__\";\n}\n//#endregion\nexport { isUnsafeProperty };\n","//#region src/compat/_internal/isDeepKey.ts\n/** Matches any deep property path. Examples: `a.b`, `a[0]`, `a[\"b\"]` */\nconst regexIsDeepProp = /\\.|(\\[(?:[^[\\]]*|([\"'])(?:(?!\\2)[^\\\\]|\\\\.)*?\\2)\\])/;\n/**\n* Checks if a given key is a deep key.\n*\n* A deep key is a string that contains a dot (.) or square brackets with a property accessor.\n*\n* @param {PropertyKey} key - The key to check.\n* @returns {boolean} - Returns true if the key is a deep key, otherwise false.\n*\n* Examples:\n*\n* isDeepKey('a.b') // true\n* isDeepKey('a[b]') // true\n* isDeepKey('a') // false\n* isDeepKey(123) // false\n* isDeepKey('a.b.c') // true\n* isDeepKey('a[b][c]') // true\n* isDeepKey('a.') // false\n* isDeepKey('.a') // false\n* isDeepKey('a[b') // false\n* isDeepKey('a]b]') // false\n* isDeepKey('a][b') // false\n* isDeepKey('') // false\n* isDeepKey('a[0]') // true\n*\n*/\nfunction isDeepKey(key) {\n\tswitch (typeof key) {\n\t\tcase \"number\":\n\t\tcase \"symbol\": return false;\n\t\tcase \"string\":\n\t\t\tif (key === \"\" || key.startsWith(\".\") || key.endsWith(\".\")) return false;\n\t\t\treturn regexIsDeepProp.test(key);\n\t\tdefault: return false;\n\t}\n}\n//#endregion\nexport { isDeepKey };\n","//#region src/compat/_internal/toKey.ts\n/**\n* Converts `value` to a string key if it's not a string or symbol.\n*\n* @private\n* @param {unknown} value The value to inspect.\n* @returns {string|symbol} Returns the key.\n*/\nfunction toKey(value) {\n\tif (typeof value === \"string\" || typeof value === \"symbol\") return value;\n\tif (Object.is(value?.valueOf?.(), -0)) return \"-0\";\n\treturn String(value);\n}\n//#endregion\nexport { toKey };\n","//#region src/compat/util/toString.ts\n/**\n* Converts `value` to a string.\n*\n* An empty string is returned for `null` and `undefined` values.\n* The sign of `-0` is preserved.\n*\n* @param value - The value to convert.\n* @returns Returns the converted string.\n*\n* @example\n* toString(null) // returns ''\n* toString(undefined) // returns ''\n* toString(-0) // returns '-0'\n* toString([1, 2, -0]) // returns '1,2,-0'\n* toString([Symbol('a'), Symbol('b')]) // returns 'Symbol(a),Symbol(b)'\n*/\nfunction toString(value) {\n\tif (value == null) return \"\";\n\treturn baseToString(value);\n}\nfunction baseToString(value) {\n\tif (typeof value === \"string\") return value;\n\tif (Array.isArray(value)) return value.map(baseToString).join(\",\");\n\tconst result = String(value);\n\tif (result === \"0\" && Object.is(Number(value), -0)) return \"-0\";\n\treturn result;\n}\n//#endregion\nexport { toString };\n","import { toKey } from \"../_internal/toKey.mjs\";\nimport { toString } from \"./toString.mjs\";\n//#region src/compat/util/toPath.ts\n/**\n* Converts a deep key string into an array of path segments.\n*\n* This function takes a string representing a deep key (e.g., 'a.b.c' or 'a[b][c]') and breaks it down into an array of strings, each representing a segment of the path.\n*\n* @param deepKey - The deep key string to convert.\n* @returns An array of strings, each representing a segment of the path.\n*\n* Examples:\n*\n* toPath('a.b.c') // Returns ['a', 'b', 'c']\n* toPath('a[b][c]') // Returns ['a', 'b', 'c']\n* toPath('.a.b.c') // Returns ['', 'a', 'b', 'c']\n* toPath('a[\"b.c\"].d') // Returns ['a', 'b.c', 'd']\n* toPath('') // Returns []\n* toPath('.a[b].c.d[e][\"f.g\"].h') // Returns ['', 'a', 'b', 'c', 'd', 'e', 'f.g', 'h']\n*/\nfunction toPath(deepKey) {\n\tif (Array.isArray(deepKey)) return deepKey.map(toKey);\n\tif (typeof deepKey === \"symbol\") return [deepKey];\n\tdeepKey = toString(deepKey);\n\tconst result = [];\n\tconst length = deepKey.length;\n\tif (length === 0) return result;\n\tlet index = 0;\n\tlet key = \"\";\n\tlet quoteChar = \"\";\n\tlet bracket = false;\n\tlet bracketHadQuote = false;\n\tconst bracketNumberRegex = /^-?\\d+(?:\\.\\d+)?$/;\n\tif (deepKey.charCodeAt(0) === 46) result.push(\"\");\n\twhile (index < length) {\n\t\tconst char = deepKey[index];\n\t\tif (quoteChar) if (char === \"\\\\\" && index + 1 < length) {\n\t\t\tindex++;\n\t\t\tkey += deepKey[index];\n\t\t} else if (char === quoteChar) quoteChar = \"\";\n\t\telse key += char;\n\t\telse if (bracket) if (char === \"\\\"\" || char === \"'\") {\n\t\t\tquoteChar = char;\n\t\t\tbracketHadQuote = true;\n\t\t} else if (char === \"]\") {\n\t\t\tbracket = false;\n\t\t\tif (!bracketHadQuote && key.includes(\".\") && !bracketNumberRegex.test(key)) {\n\t\t\t\tconst segments = key.split(\".\");\n\t\t\t\tfor (let i = 0; i < segments.length; i++) if (segments[i] !== \"\") result.push(segments[i]);\n\t\t\t} else result.push(key);\n\t\t\tkey = \"\";\n\t\t} else key += char;\n\t\telse if (char === \"[\") {\n\t\t\tbracket = true;\n\t\t\tbracketHadQuote = false;\n\t\t\tif (key) {\n\t\t\t\tresult.push(key);\n\t\t\t\tkey = \"\";\n\t\t\t}\n\t\t} else if (char === \".\") {\n\t\t\tif (key) {\n\t\t\t\tresult.push(key);\n\t\t\t\tkey = \"\";\n\t\t\t}\n\t\t\tconst next = deepKey[index + 1];\n\t\t\tif (next === void 0 || next === \".\") result.push(\"\");\n\t\t} else key += char;\n\t\tindex++;\n\t}\n\tif (key) result.push(key);\n\treturn result;\n}\n//#endregion\nexport { toPath };\n","import { isUnsafeProperty } from \"../../_internal/isUnsafeProperty.mjs\";\nimport { isDeepKey } from \"../_internal/isDeepKey.mjs\";\nimport { toKey } from \"../_internal/toKey.mjs\";\nimport { toPath } from \"../util/toPath.mjs\";\n//#region src/compat/object/get.ts\n/**\n* Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n*\n* @param object - The object to query.\n* @param path - The path of the property to get.\n* @param [defaultValue] - The value returned if the resolved value is undefined.\n* @returns Returns the resolved value.\n*\n* @example\n* const object = { a: { b: { c: 1 } } };\n* get(object, 'a.b.c');\n* // => 1\n*\n* get(object, ['a', 'b', 'c']);\n* // => 1\n*\n* get(object, 'a.b.d', 'default');\n* // => 'default'\n*/\nfunction get(object, path, defaultValue) {\n\tif (object == null) return defaultValue;\n\tswitch (typeof path) {\n\t\tcase \"string\": {\n\t\t\tif (isUnsafeProperty(path)) return defaultValue;\n\t\t\tconst result = object[path];\n\t\t\tif (result === void 0) if (isDeepKey(path) && !Object.hasOwn(object, path)) return get(object, toPath(path), defaultValue);\n\t\t\telse return defaultValue;\n\t\t\treturn result;\n\t\t}\n\t\tcase \"number\":\n\t\tcase \"symbol\": {\n\t\t\tif (typeof path === \"number\") path = toKey(path);\n\t\t\tconst result = object[path];\n\t\t\tif (result === void 0) return defaultValue;\n\t\t\treturn result;\n\t\t}\n\t\tdefault: {\n\t\t\tif (Array.isArray(path)) return getWithPath(object, path, defaultValue);\n\t\t\tif (Object.is(path?.valueOf(), -0)) path = \"-0\";\n\t\t\telse path = String(path);\n\t\t\tif (isUnsafeProperty(path)) return defaultValue;\n\t\t\tconst result = object[path];\n\t\t\tif (result === void 0) return defaultValue;\n\t\t\treturn result;\n\t\t}\n\t}\n}\nfunction getWithPath(object, path, defaultValue) {\n\tif (path.length === 0) return defaultValue;\n\tlet current = object;\n\tfor (let index = 0; index < path.length; index++) {\n\t\tif (current == null) return defaultValue;\n\t\tif (isUnsafeProperty(path[index])) return defaultValue;\n\t\tcurrent = current[path[index]];\n\t}\n\tif (current === void 0) return defaultValue;\n\treturn current;\n}\n//#endregion\nexport { get };\n","//#region src/compat/_internal/isIndex.ts\nconst IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\\d*)$/;\nfunction isIndex(value, length = Number.MAX_SAFE_INTEGER) {\n\tswitch (typeof value) {\n\t\tcase \"number\": return Number.isInteger(value) && value >= 0 && value < length;\n\t\tcase \"symbol\": return false;\n\t\tcase \"string\": return IS_UNSIGNED_INTEGER.test(value);\n\t}\n}\n//#endregion\nexport { isIndex };\n","//#region src/compat/_internal/getTag.ts\n/**\n* Gets the `toStringTag` of `value`.\n*\n* @private\n* @param {T} value The value to query.\n* @returns {string} Returns the `Object.prototype.toString.call` result.\n*/\nfunction getTag(value) {\n\tif (value == null) return value === void 0 ? \"[object Undefined]\" : \"[object Null]\";\n\treturn Object.prototype.toString.call(value);\n}\n//#endregion\nexport { getTag };\n","import { getTag } from \"../_internal/getTag.mjs\";\n//#region src/compat/predicate/isArguments.ts\n/**\n* Checks if the given value is an arguments object.\n*\n* This function tests whether the provided value is an arguments object or not.\n* It returns `true` if the value is an arguments object, and `false` otherwise.\n*\n* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an arguments object.\n*\n* @param value - The value to test if it is an arguments object.\n* @returns `true` if the value is an arguments, `false` otherwise.\n*\n* @example\n* const args = (function() { return arguments; })();\n* const strictArgs = (function() { 'use strict'; return arguments; })();\n* const value = [1, 2, 3];\n*\n* console.log(isArguments(args)); // true\n* console.log(isArguments(strictArgs)); // true\n* console.log(isArguments(value)); // false\n*/\nfunction isArguments(value) {\n\treturn value !== null && typeof value === \"object\" && getTag(value) === \"[object Arguments]\";\n}\n//#endregion\nexport { isArguments };\n","import { isDeepKey } from \"../_internal/isDeepKey.mjs\";\nimport { toPath } from \"../util/toPath.mjs\";\nimport { isIndex } from \"../_internal/isIndex.mjs\";\nimport { isArguments } from \"../predicate/isArguments.mjs\";\n//#region src/compat/object/has.ts\n/**\n* Checks if a given path exists within an object.\n*\n* You can provide the path as a single property key, an array of property keys,\n* or a string representing a deep path.\n*\n* If the path is an index and the object is an array or an arguments object, the function will verify\n* if the index is valid and within the bounds of the array or arguments object, even if the array or\n* arguments object is sparse (i.e., not all indexes are defined).\n*\n* @param object - The object to query.\n* @param path - The path to check. This can be a single property key,\n* an array of property keys, or a string representing a deep path.\n* @returns Returns `true` if the path exists in the object, `false` otherwise.\n*\n* @example\n*\n* const obj = { a: { b: { c: 3 } } };\n*\n* has(obj, 'a'); // true\n* has(obj, ['a', 'b']); // true\n* has(obj, ['a', 'b', 'c']); // true\n* has(obj, 'a.b.c'); // true\n* has(obj, 'a.b.d'); // false\n* has(obj, ['a', 'b', 'c', 'd']); // false\n* has([], 0); // false\n* has([1, 2, 3], 2); // true\n* has([1, 2, 3], 5); // false\n*/\nfunction has(object, path) {\n\tlet resolvedPath;\n\tif (Array.isArray(path)) resolvedPath = path;\n\telse if (typeof path === \"string\" && isDeepKey(path) && !(path in Object(object))) resolvedPath = toPath(path);\n\telse resolvedPath = [path];\n\tif (resolvedPath.length === 0) return false;\n\tlet current = object;\n\tfor (let i = 0; i < resolvedPath.length; i++) {\n\t\tconst key = resolvedPath[i];\n\t\tif (current == null || !Object.hasOwn(current, key)) {\n\t\t\tif (!((Array.isArray(current) || isArguments(current)) && isIndex(key) && key < current.length)) return false;\n\t\t}\n\t\tcurrent = current[key];\n\t}\n\treturn true;\n}\n//#endregion\nexport { has };\n","//#region src/compat/predicate/isObject.ts\n/**\n* Checks if the given value is an object. An object is a value that is\n* not a primitive type (string, number, boolean, symbol, null, or undefined).\n*\n* This function tests whether the provided value is an object or not.\n* It returns `true` if the value is an object, and `false` otherwise.\n*\n* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an object value.\n*\n* @param value - The value to check if it is an object.\n* @returns `true` if the value is an object, `false` otherwise.\n*\n* @example\n* const value1 = {};\n* const value2 = [1, 2, 3];\n* const value3 = () => {};\n* const value4 = null;\n*\n* console.log(isObject(value1)); // true\n* console.log(isObject(value2)); // true\n* console.log(isObject(value3)); // true\n* console.log(isObject(value4)); // false\n*/\nfunction isObject(value) {\n\treturn value !== null && (typeof value === \"object\" || typeof value === \"function\");\n}\n//#endregion\nexport { isObject };\n","//#region src/compat/predicate/isSymbol.ts\n/**\n* Check whether a value is a symbol.\n*\n* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `symbol`.\n*\n* @param value The value to check.\n* @returns Returns `true` if `value` is a symbol, else `false`.\n* @example\n* isSymbol(Symbol.iterator);\n* // => true\n*\n* isSymbol('abc');\n* // => false\n*/\nfunction isSymbol(value) {\n\treturn typeof value === \"symbol\" || value instanceof Symbol;\n}\n//#endregion\nexport { isSymbol };\n","import { isSymbol } from \"../predicate/isSymbol.mjs\";\n//#region src/compat/_internal/isKey.ts\n/** Matches any deep property path. (e.g. `a.b[0].c`)*/\nconst regexIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/;\n/** Matches any word character (alphanumeric & underscore).*/\nconst regexIsPlainProp = /^\\w*$/;\n/**\n* Checks if `value` is a property name and not a property path. (It's ok that the `value` is not in the keys of the `object`)\n* @param {unknown} value The value to check.\n* @param {unknown} object The object to query.\n* @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n*\n* @example\n* isKey('a', { a: 1 });\n* // => true\n*\n* isKey('a.b', { a: { b: 2 } });\n* // => false\n*/\nfunction isKey(value, object) {\n\tif (Array.isArray(value)) return false;\n\tif (typeof value === \"number\" || typeof value === \"boolean\" || value == null || isSymbol(value)) return true;\n\treturn typeof value === \"string\" && (regexIsPlainProp.test(value) || !regexIsDeepProp.test(value)) || object != null && Object.hasOwn(object, value);\n}\n//#endregion\nexport { isKey };\n","//#region src/compat/util/eq.ts\n/**\n* Performs a `SameValueZero` comparison between two values to determine if they are equivalent.\n*\n* @param value The value to compare.\n* @param other The other value to compare.\n* @returns Returns `true` if the values are equivalent, else `false`.\n*\n* @example\n* eq(1, 1); // true\n* eq(0, -0); // true\n* eq(NaN, NaN); // true\n* eq('a', Object('a')); // false\n*/\nfunction eq(value, other) {\n\treturn value === other || Number.isNaN(value) && Number.isNaN(other);\n}\n//#endregion\nexport { eq };\n","import { eq } from \"../util/eq.mjs\";\n//#region src/compat/_internal/assignValue.ts\nconst assignValue = (object, key, value) => {\n\tconst objValue = object[key];\n\tif (!(Object.hasOwn(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) object[key] = value;\n};\n//#endregion\nexport { assignValue };\n","//#region src/_internal/isUnsafeToWriteProperty.ts\n/**\n* Checks if a property key is unsafe to write to.\n*\n* Writing through `__proto__`, `constructor`, or `prototype` can reach\n* `Object.prototype` and pollute every object, so write paths like `set`,\n* `update`, and `zipObjectDeep` abort when a path segment matches one of\n* these keys, matching lodash's behavior.\n*\n* Read paths like `get` and `unset` use `isUnsafeProperty` instead, which\n* only blocks `__proto__`; lodash keeps reads of `constructor` and\n* `prototype` unrestricted.\n*\n* @param key - The property key to check\n* @returns `true` if the property is unsafe to write to, `false` otherwise\n* @internal\n*/\nfunction isUnsafeToWriteProperty(key) {\n\treturn key === \"__proto__\" || key === \"constructor\" || key === \"prototype\";\n}\n//#endregion\nexport { isUnsafeToWriteProperty };\n","import { toKey } from \"../_internal/toKey.mjs\";\nimport { toPath } from \"../util/toPath.mjs\";\nimport { get } from \"./get.mjs\";\nimport { isObject } from \"../predicate/isObject.mjs\";\nimport { isIndex } from \"../_internal/isIndex.mjs\";\nimport { isKey } from \"../_internal/isKey.mjs\";\nimport { assignValue } from \"../_internal/assignValue.mjs\";\nimport { isUnsafeToWriteProperty } from \"../../_internal/isUnsafeToWriteProperty.mjs\";\n//#region src/compat/object/updateWith.ts\n/**\n* Updates the value at the specified path of the given object using an updater function and a customizer.\n* If any part of the path does not exist, it will be created.\n*\n* @template T - The type of the object.\n* @template R - The type of the return value.\n* @param obj - The object to modify.\n* @param path - The path of the property to update.\n* @param updater - The function to produce the updated value.\n* @param customizer - The function to customize the update process.\n* @returns The modified object.\n*\n* @example\n* const object = { 'a': [{ 'b': { 'c': 3 } }] };\n* updateWith(object, 'a[0].b.c', (n) => n * n);\n* // => { 'a': [{ 'b': { 'c': 9 } }] }\n*/\nfunction updateWith(obj, path, updater, customizer) {\n\tif (obj == null && !isObject(obj)) return obj;\n\tlet resolvedPath;\n\tif (isKey(path, obj)) resolvedPath = [path];\n\telse if (Array.isArray(path)) resolvedPath = path;\n\telse resolvedPath = toPath(path);\n\tconst updateValue = updater(get(obj, resolvedPath));\n\tlet current = obj;\n\tfor (let i = 0; i < resolvedPath.length && current != null; i++) {\n\t\tconst key = toKey(resolvedPath[i]);\n\t\tif (isUnsafeToWriteProperty(key)) return obj;\n\t\tlet newValue;\n\t\tif (i === resolvedPath.length - 1) newValue = updateValue;\n\t\telse {\n\t\t\tconst objValue = current[key];\n\t\t\tconst customizerResult = customizer?.(objValue, key, obj);\n\t\t\tnewValue = customizerResult !== void 0 ? customizerResult : isObject(objValue) ? objValue : isIndex(resolvedPath[i + 1]) ? [] : {};\n\t\t}\n\t\tassignValue(current, key, newValue);\n\t\tcurrent = current[key];\n\t}\n\treturn obj;\n}\n//#endregion\nexport { updateWith };\n","import { updateWith } from \"./updateWith.mjs\";\n//#region src/compat/object/set.ts\n/**\n* Sets the value at the specified path of the given object. If any part of the path does not exist, it will be created.\n*\n* @template T - The type of the object.\n* @param obj - The object to modify.\n* @param path - The path of the property to set.\n* @param value - The value to set.\n* @returns The modified object.\n*\n* @example\n* // Set a value in a nested object\n* const obj = { a: { b: { c: 3 } } };\n* set(obj, 'a.b.c', 4);\n* console.log(obj.a.b.c); // 4\n*\n* @example\n* // Set a value in an array\n* const arr = [1, 2, 3];\n* set(arr, 1, 4);\n* console.log(arr[1]); // 4\n*\n* @example\n* // Create non-existent path and set value\n* const obj = {};\n* set(obj, 'a.b.c', 4);\n* console.log(obj); // { a: { b: { c: 4 } } }\n*/\nfunction set(obj, path, value) {\n\treturn updateWith(obj, path, () => value, () => void 0);\n}\n//#endregion\nexport { set };\n","/**\n * @publicApi\n */\nexport function getConfigToken(token) {\n return `CONFIGURATION(${token.toString()})`;\n}\n","const fs = require('fs')\nconst path = require('path')\nconst os = require('os')\nconst crypto = require('crypto')\n\n// Array of tips to display randomly\nconst TIPS = [\n '◈ encrypted .env [www.dotenvx.com]',\n '◈ secrets for agents [www.dotenvx.com]',\n '⌁ auth for agents [www.vestauth.com]',\n '⌘ custom filepath { path: \\'/custom/path/.env\\' }',\n '⌘ enable debugging { debug: true }',\n '⌘ override existing { override: true }',\n '⌘ suppress logs { quiet: true }',\n '⌘ multiple files { path: [\\'.env.local\\', \\'.env\\'] }'\n]\n\n// Get a random tip from the tips array\nfunction _getRandomTip () {\n return TIPS[Math.floor(Math.random() * TIPS.length)]\n}\n\nfunction parseBoolean (value) {\n if (typeof value === 'string') {\n return !['false', '0', 'no', 'off', ''].includes(value.toLowerCase())\n }\n return Boolean(value)\n}\n\nfunction supportsAnsi () {\n return process.stdout.isTTY // && process.env.TERM !== 'dumb'\n}\n\nfunction dim (text) {\n return supportsAnsi() ? `\\x1b[2m${text}\\x1b[0m` : text\n}\n\nconst LINE = /(?:^|^)\\s*(?:export\\s+)?([\\w.-]+)(?:\\s*=\\s*?|:\\s+?)(\\s*'(?:\\\\'|[^'])*'|\\s*\"(?:\\\\\"|[^\"])*\"|\\s*`(?:\\\\`|[^`])*`|[^#\\r\\n]+)?\\s*(?:#.*)?(?:$|$)/mg\n\n// Parse src into an Object\nfunction parse (src) {\n const obj = {}\n\n // Convert buffer to string\n let lines = src.toString()\n\n // Convert line breaks to same format\n lines = lines.replace(/\\r\\n?/mg, '\\n')\n\n let match\n while ((match = LINE.exec(lines)) != null) {\n const key = match[1]\n\n // Default undefined or null to empty string\n let value = (match[2] || '')\n\n // Remove whitespace\n value = value.trim()\n\n // Check if double quoted\n const maybeQuote = value[0]\n\n // Remove surrounding quotes\n value = value.replace(/^(['\"`])([\\s\\S]*)\\1$/mg, '$2')\n\n // Expand newlines if double quoted\n if (maybeQuote === '\"') {\n value = value.replace(/\\\\n/g, '\\n')\n value = value.replace(/\\\\r/g, '\\r')\n }\n\n // Add to object\n obj[key] = value\n }\n\n return obj\n}\n\nfunction _parseVault (options) {\n options = options || {}\n\n const vaultPath = _vaultPath(options)\n options.path = vaultPath // parse .env.vault\n const result = DotenvModule.configDotenv(options)\n if (!result.parsed) {\n const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`)\n err.code = 'MISSING_DATA'\n throw err\n }\n\n // handle scenario for comma separated keys - for use with key rotation\n // example: DOTENV_KEY=\"dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=prod,dotenv://:key_7890@dotenvx.com/vault/.env.vault?environment=prod\"\n const keys = _dotenvKey(options).split(',')\n const length = keys.length\n\n let decrypted\n for (let i = 0; i < length; i++) {\n try {\n // Get full key\n const key = keys[i].trim()\n\n // Get instructions for decrypt\n const attrs = _instructions(result, key)\n\n // Decrypt\n decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key)\n\n break\n } catch (error) {\n // last key\n if (i + 1 >= length) {\n throw error\n }\n // try next key\n }\n }\n\n // Parse decrypted .env string\n return DotenvModule.parse(decrypted)\n}\n\nfunction _warn (message) {\n console.error(`⚠ ${message}`)\n}\n\nfunction _debug (message) {\n console.log(`┆ ${message}`)\n}\n\nfunction _log (message) {\n console.log(`◇ ${message}`)\n}\n\nfunction _dotenvKey (options) {\n // prioritize developer directly setting options.DOTENV_KEY\n if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {\n return options.DOTENV_KEY\n }\n\n // secondary infra already contains a DOTENV_KEY environment variable\n if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {\n return process.env.DOTENV_KEY\n }\n\n // fallback to empty string\n return ''\n}\n\nfunction _instructions (result, dotenvKey) {\n // Parse DOTENV_KEY. Format is a URI\n let uri\n try {\n uri = new URL(dotenvKey)\n } catch (error) {\n if (error.code === 'ERR_INVALID_URL') {\n const err = new Error('INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development')\n err.code = 'INVALID_DOTENV_KEY'\n throw err\n }\n\n throw error\n }\n\n // Get decrypt key\n const key = uri.password\n if (!key) {\n const err = new Error('INVALID_DOTENV_KEY: Missing key part')\n err.code = 'INVALID_DOTENV_KEY'\n throw err\n }\n\n // Get environment\n const environment = uri.searchParams.get('environment')\n if (!environment) {\n const err = new Error('INVALID_DOTENV_KEY: Missing environment part')\n err.code = 'INVALID_DOTENV_KEY'\n throw err\n }\n\n // Get ciphertext payload\n const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`\n const ciphertext = result.parsed[environmentKey] // DOTENV_VAULT_PRODUCTION\n if (!ciphertext) {\n const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`)\n err.code = 'NOT_FOUND_DOTENV_ENVIRONMENT'\n throw err\n }\n\n return { ciphertext, key }\n}\n\nfunction _vaultPath (options) {\n let possibleVaultPath = null\n\n if (options && options.path && options.path.length > 0) {\n if (Array.isArray(options.path)) {\n for (const filepath of options.path) {\n if (fs.existsSync(filepath)) {\n possibleVaultPath = filepath.endsWith('.vault') ? filepath : `${filepath}.vault`\n }\n }\n } else {\n possibleVaultPath = options.path.endsWith('.vault') ? options.path : `${options.path}.vault`\n }\n } else {\n possibleVaultPath = path.resolve(process.cwd(), '.env.vault')\n }\n\n if (fs.existsSync(possibleVaultPath)) {\n return possibleVaultPath\n }\n\n return null\n}\n\nfunction _resolveHome (envPath) {\n return envPath[0] === '~' ? path.join(os.homedir(), envPath.slice(1)) : envPath\n}\n\nfunction _configVault (options) {\n const debug = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || (options && options.debug))\n const quiet = parseBoolean(process.env.DOTENV_CONFIG_QUIET || (options && options.quiet))\n\n if (debug || !quiet) {\n _log('loading env from encrypted .env.vault')\n }\n\n const parsed = DotenvModule._parseVault(options)\n\n let processEnv = process.env\n if (options && options.processEnv != null) {\n processEnv = options.processEnv\n }\n\n DotenvModule.populate(processEnv, parsed, options)\n\n return { parsed }\n}\n\nfunction configDotenv (options) {\n const dotenvPath = path.resolve(process.cwd(), '.env')\n let encoding = 'utf8'\n let processEnv = process.env\n if (options && options.processEnv != null) {\n processEnv = options.processEnv\n }\n let debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || (options && options.debug))\n let quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || (options && options.quiet))\n\n if (options && options.encoding) {\n encoding = options.encoding\n } else {\n if (debug) {\n _debug('no encoding is specified (UTF-8 is used by default)')\n }\n }\n\n let optionPaths = [dotenvPath] // default, look for .env\n if (options && options.path) {\n if (!Array.isArray(options.path)) {\n optionPaths = [_resolveHome(options.path)]\n } else {\n optionPaths = [] // reset default\n for (const filepath of options.path) {\n optionPaths.push(_resolveHome(filepath))\n }\n }\n }\n\n // Build the parsed data in a temporary object (because we need to return it). Once we have the final\n // parsed data, we will combine it with process.env (or options.processEnv if provided).\n let lastError\n const parsedAll = {}\n for (const path of optionPaths) {\n try {\n // Specifying an encoding returns a string instead of a buffer\n const parsed = DotenvModule.parse(fs.readFileSync(path, { encoding }))\n\n DotenvModule.populate(parsedAll, parsed, options)\n } catch (e) {\n if (debug) {\n _debug(`failed to load ${path} ${e.message}`)\n }\n lastError = e\n }\n }\n\n const populated = DotenvModule.populate(processEnv, parsedAll, options)\n\n // handle user settings DOTENV_CONFIG_ options inside .env file(s)\n debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || debug)\n quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || quiet)\n\n if (debug || !quiet) {\n const keysCount = Object.keys(populated).length\n const shortPaths = []\n for (const filePath of optionPaths) {\n try {\n const relative = path.relative(process.cwd(), filePath)\n shortPaths.push(relative)\n } catch (e) {\n if (debug) {\n _debug(`failed to load ${filePath} ${e.message}`)\n }\n lastError = e\n }\n }\n\n _log(`injected env (${keysCount}) from ${shortPaths.join(',')} ${dim(`// tip: ${_getRandomTip()}`)}`)\n }\n\n if (lastError) {\n return { parsed: parsedAll, error: lastError }\n } else {\n return { parsed: parsedAll }\n }\n}\n\n// Populates process.env from .env file\nfunction config (options) {\n // fallback to original dotenv if DOTENV_KEY is not set\n if (_dotenvKey(options).length === 0) {\n return DotenvModule.configDotenv(options)\n }\n\n const vaultPath = _vaultPath(options)\n\n // dotenvKey exists but .env.vault file does not exist\n if (!vaultPath) {\n _warn(`you set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}`)\n\n return DotenvModule.configDotenv(options)\n }\n\n return DotenvModule._configVault(options)\n}\n\nfunction decrypt (encrypted, keyStr) {\n const key = Buffer.from(keyStr.slice(-64), 'hex')\n let ciphertext = Buffer.from(encrypted, 'base64')\n\n const nonce = ciphertext.subarray(0, 12)\n const authTag = ciphertext.subarray(-16)\n ciphertext = ciphertext.subarray(12, -16)\n\n try {\n const aesgcm = crypto.createDecipheriv('aes-256-gcm', key, nonce)\n aesgcm.setAuthTag(authTag)\n return `${aesgcm.update(ciphertext)}${aesgcm.final()}`\n } catch (error) {\n const isRange = error instanceof RangeError\n const invalidKeyLength = error.message === 'Invalid key length'\n const decryptionFailed = error.message === 'Unsupported state or unable to authenticate data'\n\n if (isRange || invalidKeyLength) {\n const err = new Error('INVALID_DOTENV_KEY: It must be 64 characters long (or more)')\n err.code = 'INVALID_DOTENV_KEY'\n throw err\n } else if (decryptionFailed) {\n const err = new Error('DECRYPTION_FAILED: Please check your DOTENV_KEY')\n err.code = 'DECRYPTION_FAILED'\n throw err\n } else {\n throw error\n }\n }\n}\n\n// Populate process.env with parsed values\nfunction populate (processEnv, parsed, options = {}) {\n const debug = Boolean(options && options.debug)\n const override = Boolean(options && options.override)\n const populated = {}\n\n if (typeof parsed !== 'object') {\n const err = new Error('OBJECT_REQUIRED: Please check the processEnv argument being passed to populate')\n err.code = 'OBJECT_REQUIRED'\n throw err\n }\n\n // Set process.env\n for (const key of Object.keys(parsed)) {\n if (Object.prototype.hasOwnProperty.call(processEnv, key)) {\n if (override === true) {\n processEnv[key] = parsed[key]\n populated[key] = parsed[key]\n }\n\n if (debug) {\n if (override === true) {\n _debug(`\"${key}\" is already defined and WAS overwritten`)\n } else {\n _debug(`\"${key}\" is already defined and was NOT overwritten`)\n }\n }\n } else {\n processEnv[key] = parsed[key]\n populated[key] = parsed[key]\n }\n }\n\n return populated\n}\n\nconst DotenvModule = {\n configDotenv,\n _configVault,\n _parseVault,\n config,\n decrypt,\n parse,\n populate\n}\n\nmodule.exports.configDotenv = DotenvModule.configDotenv\nmodule.exports._configVault = DotenvModule._configVault\nmodule.exports._parseVault = DotenvModule._parseVault\nmodule.exports.config = DotenvModule.config\nmodule.exports.decrypt = DotenvModule.decrypt\nmodule.exports.parse = DotenvModule.parse\nmodule.exports.populate = DotenvModule.populate\n\nmodule.exports = DotenvModule\n","import * as dotenv from 'dotenv';\nexport const getDefaultParser = () => dotenv.parse;\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nimport { Inject, Injectable, Optional } from '@nestjs/common';\nimport { isUndefined } from '@nestjs/common/utils/shared.utils.js';\nimport get from 'es-toolkit/compat/get';\nimport has from 'es-toolkit/compat/has';\nimport set from 'es-toolkit/compat/set';\nimport fs from 'fs';\nimport { Subject } from 'rxjs';\nimport { CONFIGURATION_TOKEN, VALIDATED_ENV_PROPNAME, } from './config.constants.js';\nimport { getDefaultParser } from './utils/index.js';\n/**\n * @publicApi\n */\nlet ConfigService = class ConfigService {\n set isCacheEnabled(value) {\n this._isCacheEnabled = value;\n }\n get isCacheEnabled() {\n return this._isCacheEnabled;\n }\n set skipProcessEnv(value) {\n this._skipProcessEnv = value;\n }\n get skipProcessEnv() {\n return this._skipProcessEnv;\n }\n constructor(internalConfig = {}) {\n this.internalConfig = internalConfig;\n this.cache = {};\n this._changes$ = new Subject();\n this._skipProcessEnv = false;\n this._isCacheEnabled = false;\n this.envFilePaths = [];\n this.parser = getDefaultParser();\n }\n /**\n * Returns a stream of configuration changes.\n * Each event contains the attribute path, the old value and the new value.\n */\n get changes$() {\n return this._changes$.asObservable();\n }\n /**\n * Get a configuration value (either custom configuration or process environment variable)\n * based on property path (you can use dot notation to traverse nested object, e.g. \"database.host\").\n * It returns a default value if the key does not exist.\n * @param propertyPath\n * @param defaultValueOrOptions\n */\n get(propertyPath, defaultValueOrOptions, options) {\n const internalValue = this.getFromInternalConfig(propertyPath);\n if (!isUndefined(internalValue)) {\n return internalValue;\n }\n const validatedEnvValue = this.getFromValidatedEnv(propertyPath);\n if (!isUndefined(validatedEnvValue)) {\n return validatedEnvValue;\n }\n const defaultValue = this.isGetOptionsObject(defaultValueOrOptions) &&\n !options\n ? undefined\n : defaultValueOrOptions;\n if (!this._skipProcessEnv) {\n const processEnvValue = this.getFromProcessEnv(propertyPath, defaultValue);\n if (!isUndefined(processEnvValue)) {\n return processEnvValue;\n }\n }\n return defaultValue;\n }\n /**\n * Get a configuration value (either custom configuration or process environment variable)\n * based on property path (you can use dot notation to traverse nested object, e.g. \"database.host\").\n * It returns a default value if the key does not exist.\n * If the default value is undefined an exception will be thrown.\n * @param propertyPath\n * @param defaultValueOrOptions\n */\n getOrThrow(propertyPath, defaultValueOrOptions, options) {\n // @ts-expect-error Bypass method overloads\n const value = this.get(propertyPath, defaultValueOrOptions, options);\n if (isUndefined(value)) {\n throw new TypeError(`Configuration key \"${propertyPath.toString()}\" does not exist`);\n }\n return value;\n }\n /**\n * Sets a configuration value based on property path.\n * @param propertyPath\n * @param value\n */\n set(propertyPath, value) {\n const oldValue = this.get(propertyPath);\n set(this.internalConfig, propertyPath, value);\n if (typeof propertyPath === 'string') {\n process.env[propertyPath] = String(value);\n this.updateInterpolatedEnv(propertyPath, String(value));\n }\n if (this.isCacheEnabled) {\n this.setInCacheIfDefined(propertyPath, value);\n }\n this._changes$.next({\n path: propertyPath,\n oldValue,\n newValue: value,\n });\n }\n /**\n * Sets env file paths from `config.module.ts` to parse.\n * @param paths\n */\n setEnvFilePaths(paths) {\n this.envFilePaths = paths;\n }\n /**\n * Sets parser from `config.module.ts`.\n * @param parser\n */\n setParser(parser) {\n this.parser = parser;\n }\n getFromCache(propertyPath, defaultValue) {\n const cachedValue = get(this.cache, propertyPath);\n return isUndefined(cachedValue)\n ? defaultValue\n : cachedValue;\n }\n getFromValidatedEnv(propertyPath) {\n const validatedEnvValue = get(this.internalConfig[VALIDATED_ENV_PROPNAME], propertyPath);\n return validatedEnvValue;\n }\n getFromProcessEnv(propertyPath, defaultValue) {\n if (this.isCacheEnabled &&\n has(this.cache, propertyPath)) {\n const cachedValue = this.getFromCache(propertyPath, defaultValue);\n return !isUndefined(cachedValue) ? cachedValue : defaultValue;\n }\n const processValue = get(process.env, propertyPath);\n this.setInCacheIfDefined(propertyPath, processValue);\n return processValue;\n }\n getFromInternalConfig(propertyPath) {\n const internalValue = get(this.internalConfig, propertyPath);\n return internalValue;\n }\n setInCacheIfDefined(propertyPath, value) {\n if (typeof value === 'undefined') {\n return;\n }\n set(this.cache, propertyPath, value);\n }\n isGetOptionsObject(options) {\n return options && options?.infer && Object.keys(options).length === 1;\n }\n updateInterpolatedEnv(propertyPath, value) {\n let config = {};\n for (const envFilePath of this.envFilePaths) {\n if (fs.existsSync(envFilePath)) {\n config = Object.assign(this.parser(fs.readFileSync(envFilePath)), config);\n }\n }\n const regex = new RegExp(`\\\\$\\\\{?${propertyPath}\\\\}?`, 'g');\n for (const [k, v] of Object.entries(config)) {\n if (regex.test(v)) {\n process.env[k] = v.replace(regex, value);\n }\n }\n }\n};\nConfigService = __decorate([\n Injectable(),\n __param(0, Optional()),\n __param(0, Inject(CONFIGURATION_TOKEN)),\n __metadata(\"design:paramtypes\", [Object])\n], ConfigService);\nexport { ConfigService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Global, Module } from '@nestjs/common';\nimport { CONFIGURATION_SERVICE_TOKEN, CONFIGURATION_TOKEN, } from './config.constants.js';\nimport { ConfigService } from './config.service.js';\n/**\n * @publicApi\n */\nlet ConfigHostModule = class ConfigHostModule {\n};\nConfigHostModule = __decorate([\n Global(),\n Module({\n providers: [\n {\n provide: CONFIGURATION_TOKEN,\n useFactory: () => ({}),\n },\n {\n provide: CONFIGURATION_SERVICE_TOKEN,\n useClass: ConfigService,\n },\n ],\n exports: [CONFIGURATION_TOKEN, CONFIGURATION_SERVICE_TOKEN],\n })\n], ConfigHostModule);\nexport { ConfigHostModule };\n","import { randomUUID } from 'crypto';\nimport { getConfigToken } from './get-config-token.util.js';\n/**\n * @publicApi\n */\nexport function createConfigProvider(factory) {\n return {\n provide: factory.KEY || getConfigToken(randomUUID()),\n useFactory: factory,\n inject: [],\n };\n}\n","import { PARTIAL_CONFIGURATION_KEY } from '../config.constants.js';\n/**\n * @publicApi\n */\nexport function getRegistrationToken(config) {\n return config[PARTIAL_CONFIGURATION_KEY];\n}\n","import set from 'es-toolkit/compat/set';\n/**\n * @publicApi\n */\nexport function mergeConfigObject(host, partial, token) {\n if (token) {\n set(host, token, partial);\n return partial;\n }\n Object.assign(host, partial);\n}\n","/**\n * Joi defaults to `allowUnknown: false` and `abortEarly: true`, which would\n * reject the unrelated variables that are always present in `process.env` and\n * report only the first failure. Previous versions of this package overrode\n * both, so they remain the defaults for Joi schemas unless the user opts out.\n */\nconst JOI_DEFAULT_LIBRARY_OPTIONS = {\n abortEarly: false,\n allowUnknown: true,\n};\n/**\n * Validates config using a Standard Schema (e.g. Zod, Arktype).\n * @see https://standardschema.dev/\n */\nexport async function validateWithStandardSchema(schema, config, options) {\n const result = await schema['~standard'].validate(config, getLibraryOptions(schema, options));\n // A falsy \"issues\" value indicates success, see https://standardschema.dev/\n if (result.issues) {\n return { error: new Error(formatIssues(result.issues)), value: config };\n }\n return { value: result.value };\n}\nfunction getLibraryOptions(schema, options) {\n if (schema['~standard'].vendor !== 'joi') {\n return options;\n }\n return {\n ...options,\n libraryOptions: {\n ...JOI_DEFAULT_LIBRARY_OPTIONS,\n ...options?.libraryOptions,\n },\n };\n}\nfunction formatIssues(issues) {\n return issues\n .map(issue => {\n const path = formatIssuePath(issue.path);\n return path ? `${path}: ${issue.message}` : issue.message;\n })\n .join('\\n');\n}\nfunction formatIssuePath(path) {\n return (path ?? [])\n .map(segment => typeof segment === 'object' && segment !== null\n ? String(segment.key)\n : String(segment))\n .join('.');\n}\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar ConfigModule_1;\nimport { Module } from '@nestjs/common';\nimport { isObject } from '@nestjs/common/utils/shared.utils.js';\nimport { expand } from 'dotenv-expand';\nimport * as fs from 'fs';\nimport { resolve } from 'path';\nimport { ConfigHostModule } from './config-host.module.js';\nimport { CONFIGURATION_LOADER, CONFIGURATION_SERVICE_TOKEN, CONFIGURATION_TOKEN, VALIDATED_ENV_LOADER, VALIDATED_ENV_PROPNAME, } from './config.constants.js';\nimport { ConfigService } from './config.service.js';\nimport { getDefaultParser } from './utils/index.js';\nimport { createConfigProvider } from './utils/create-config-factory.util.js';\nimport { getRegistrationToken } from './utils/get-registration-token.util.js';\nimport { mergeConfigObject } from './utils/merge-configs.util.js';\nimport { validateWithStandardSchema } from './utils/validate-with-schema.util.js';\n/**\n * @publicApi\n */\nlet ConfigModule = ConfigModule_1 = class ConfigModule {\n /**\n * This promise resolves when parser completes loading environment variables.\n * When \"ignoreEnvFile\" is set to true, then it will resolve immediately after the\n * \"ConfigModule#forRoot\" method is called.\n */\n static get envVariablesLoaded() {\n return this._envVariablesLoaded;\n }\n /**\n * Loads environment variables based on the \"ignoreEnvFile\" flag and \"envFilePath\" value.\n * Additionally, registers custom configurations globally.\n * @param options\n */\n static async forRoot(options = {}) {\n const envFilePaths = Array.isArray(options.envFilePath)\n ? options.envFilePath\n : [options.envFilePath || resolve(process.cwd(), '.env')];\n const parser = options.parser ?? getDefaultParser();\n let validatedEnvConfig = undefined;\n let config = options.ignoreEnvFile\n ? {}\n : this.loadEnvFile(envFilePaths, parser, options);\n if (!options.ignoreEnvVars && options.validatePredefined !== false) {\n config = options.override\n ? { ...process.env, ...config }\n : { ...config, ...process.env };\n }\n if (options.validate) {\n const validatedConfig = options.validate(config);\n validatedEnvConfig = validatedConfig;\n this.assignVariablesToProcess(validatedConfig, options.override);\n }\n else if (options.validationSchema) {\n const { error, value: validatedConfig } = await validateWithStandardSchema(options.validationSchema, config, options.validationOptions);\n if (error) {\n throw new Error(`Config validation error: ${error.message}`);\n }\n // Object schemas strip the properties they don't declare (e.g. Zod), so\n // the undeclared variables are merged back in to keep them available\n // through process.env and ConfigService.\n validatedEnvConfig = { ...config, ...validatedConfig };\n this.assignVariablesToProcess(validatedEnvConfig, options.override);\n }\n else {\n this.assignVariablesToProcess(config, options.override);\n }\n const isConfigToLoad = options.load && options.load.length;\n const configFactory = await Promise.all(options.load || []);\n const providers = configFactory\n .map(factory => createConfigProvider(factory))\n .filter(item => item);\n const configProviderTokens = providers.map(item => item.provide);\n const configServiceProvider = {\n provide: ConfigService,\n useFactory: (configService) => {\n const untypedConfigService = configService;\n if (options.cache) {\n untypedConfigService.isCacheEnabled = true;\n }\n if (options.skipProcessEnv) {\n untypedConfigService.skipProcessEnv = true;\n }\n configService.setEnvFilePaths(envFilePaths);\n configService.setParser(parser);\n return configService;\n },\n inject: [CONFIGURATION_SERVICE_TOKEN, ...configProviderTokens],\n };\n providers.push(configServiceProvider);\n if (validatedEnvConfig) {\n const validatedEnvConfigLoader = {\n provide: VALIDATED_ENV_LOADER,\n useFactory: (host) => {\n host[VALIDATED_ENV_PROPNAME] = validatedEnvConfig;\n },\n inject: [CONFIGURATION_TOKEN],\n };\n providers.push(validatedEnvConfigLoader);\n }\n this.environmentVariablesLoadedSignal();\n return {\n module: ConfigModule_1,\n global: options.isGlobal,\n providers: isConfigToLoad\n ? [\n ...providers,\n {\n provide: CONFIGURATION_LOADER,\n useFactory: (host, ...configurations) => {\n configurations.forEach((item, index) => this.mergePartial(host, item, providers[index]));\n },\n inject: [CONFIGURATION_TOKEN, ...configProviderTokens],\n },\n ]\n : providers,\n exports: [ConfigService, ...configProviderTokens],\n };\n }\n /**\n * Registers configuration object (partial registration).\n * @param config\n */\n static forFeature(config) {\n const configProvider = createConfigProvider(config);\n const serviceProvider = {\n provide: ConfigService,\n useFactory: (configService) => configService,\n inject: [CONFIGURATION_SERVICE_TOKEN, configProvider.provide],\n };\n return {\n module: ConfigModule_1,\n providers: [\n configProvider,\n serviceProvider,\n {\n provide: CONFIGURATION_LOADER,\n useFactory: (host, partialConfig) => {\n this.mergePartial(host, partialConfig, configProvider);\n },\n inject: [CONFIGURATION_TOKEN, configProvider.provide],\n },\n ],\n exports: [ConfigService, configProvider.provide],\n };\n }\n static loadEnvFile(envFilePaths, parser, options) {\n let config = {};\n for (const envFilePath of envFilePaths) {\n if (fs.existsSync(envFilePath)) {\n config = Object.assign(parser(fs.readFileSync(envFilePath)), config);\n if (options.expandVariables) {\n const expandOptions = typeof options.expandVariables === 'object'\n ? options.expandVariables\n : {};\n config =\n expand({ ...expandOptions, parsed: config }).parsed || config;\n }\n }\n }\n return config;\n }\n static assignVariablesToProcess(config, override) {\n if (!isObject(config)) {\n return;\n }\n const keys = override\n ? Object.keys(config)\n : Object.keys(config).filter(key => !(key in process.env));\n keys.forEach(key => {\n const value = config[key];\n if (typeof value === 'string') {\n process.env[key] = value;\n }\n else if (typeof value === 'boolean' || typeof value === 'number') {\n process.env[key] = `${value}`;\n }\n });\n }\n static mergePartial(host, item, provider) {\n const factoryRef = provider.useFactory;\n const token = getRegistrationToken(factoryRef);\n mergeConfigObject(host, item, token);\n }\n};\nConfigModule._envVariablesLoaded = new Promise(resolve => (ConfigModule_1.environmentVariablesLoadedSignal = resolve));\nConfigModule = ConfigModule_1 = __decorate([\n Module({\n imports: [ConfigHostModule],\n providers: [\n {\n provide: ConfigService,\n useExisting: CONFIGURATION_SERVICE_TOKEN,\n },\n ],\n exports: [ConfigHostModule, ConfigService],\n })\n], ConfigModule);\nexport { ConfigModule };\n","import {\n DynamicModule,\n Inject,\n InjectionToken,\n Module,\n ModuleMetadata,\n OnModuleInit,\n OptionalFactoryDependency,\n Provider,\n} from '@nestjs/common';\nimport { ConfigModule } from '@nestjs/config';\n\nimport { PDF_PARAMETERS } from '../helpers/tokens';\nimport { BrowserService } from './browser/browser.service';\nimport { EjsService } from './engines/ejs/ejs.service';\nimport { EtaService } from './engines/eta/eta.service';\nimport { HandlebarsService } from './engines/handlebars/handlebars.service';\nimport { MjmlService } from './engines/mjml/mjml.service';\nimport { MustacheService } from './engines/mustache/mustache.service';\nimport { NunjucksService } from './engines/nunjucks/nunjucks.service';\nimport { PugService } from './engines/pug/pug.service';\nimport { PuppeteerService } from './puppeteer.service';\nimport type { PuppeteerParameters } from './puppeteer-parameters.interface';\n\nexport interface PuppeteerModuleAsyncOptions extends Pick<\n ModuleMetadata,\n 'imports'\n> {\n inject?: Array<InjectionToken | OptionalFactoryDependency>;\n useFactory: (\n ...args: Array<any>\n ) => Promise<PuppeteerParameters> | PuppeteerParameters;\n}\n\n@Module({\n providers: [\n PuppeteerService,\n BrowserService,\n MjmlService,\n PugService,\n EjsService,\n NunjucksService,\n EtaService,\n MustacheService,\n ],\n exports: [\n PuppeteerService,\n MjmlService,\n PugService,\n EjsService,\n NunjucksService,\n EtaService,\n MustacheService,\n ],\n})\nexport class PuppeteerModule implements OnModuleInit {\n constructor(\n private readonly browserService: BrowserService,\n @Inject(PDF_PARAMETERS) private readonly pdfParams: PuppeteerParameters,\n ) {}\n\n async onModuleInit() {\n if (!this.pdfParams.executablePath) {\n await this.browserService.install(\n this.pdfParams.useLockedBrowser ?? false,\n );\n }\n }\n\n static forRoot(pdfParameters: PuppeteerParameters): DynamicModule {\n const providers: Array<Provider> = [\n {\n provide: PDF_PARAMETERS,\n useValue: pdfParameters,\n },\n HandlebarsService,\n MjmlService,\n PugService,\n EjsService,\n NunjucksService,\n EtaService,\n MustacheService,\n ];\n\n return {\n module: PuppeteerModule,\n imports: [ConfigModule.forRoot()],\n providers,\n exports: [\n PuppeteerService,\n MjmlService,\n PugService,\n EjsService,\n NunjucksService,\n EtaService,\n MustacheService,\n ],\n };\n }\n\n static forRootAsync(options: PuppeteerModuleAsyncOptions): DynamicModule {\n const pdfParamsProvider: Provider = {\n provide: PDF_PARAMETERS,\n inject: options.inject ?? [],\n useFactory: async (...args: Array<unknown>) =>\n options.useFactory(...args),\n };\n\n return {\n module: PuppeteerModule,\n imports: [...(options.imports ?? []), ConfigModule.forRoot()],\n providers: [\n pdfParamsProvider,\n PuppeteerService,\n BrowserService,\n HandlebarsService,\n MjmlService,\n PugService,\n EjsService,\n NunjucksService,\n EtaService,\n MustacheService,\n ],\n exports: [\n PuppeteerService,\n MjmlService,\n PugService,\n EjsService,\n NunjucksService,\n EtaService,\n MustacheService,\n ],\n };\n }\n}\n","import { DynamicModule, Module, ModuleMetadata } from '@nestjs/common';\n\nimport { NestjsPdfService } from './nestjs-pdf.service';\nimport { PuppeteerModule } from './puppeteer/puppeteer.module';\nimport { PuppeteerParameters } from './puppeteer/puppeteer-parameters.interface';\n\nexport interface PdfLibModuleAsyncOptions extends Pick<\n ModuleMetadata,\n 'imports'\n> {\n inject?: Array<any>;\n useFactory: (...args: Array<any>) => any;\n}\n\n@Module({})\nexport class NestjsPdfModule {\n static forRoot(options: PuppeteerParameters): DynamicModule {\n return {\n module: NestjsPdfModule,\n imports: [PuppeteerModule.forRoot(options)],\n providers: [NestjsPdfService],\n exports: [NestjsPdfService],\n };\n }\n\n static forRootAsync(options: PdfLibModuleAsyncOptions): DynamicModule {\n return {\n module: NestjsPdfModule,\n imports: [PuppeteerModule.forRootAsync(options)],\n providers: [NestjsPdfService],\n exports: [NestjsPdfService],\n };\n }\n}\n"],"x_google_ignoreList":[2,3,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,SAAgB,uBACd,WACA,kBACQ;CACR,MAAM,mBAAmB,QAAQ,WAAW,gBAAgB;CAC5D,OAAO,SAAS,QAAQ,IAAI,GAAG,gBAAgB;AACjD;;;ACNA,IAAI;AAEJ,eAAe,YAAY;CACzB,IAAI,CAAC,cACH,IAAI;EACF,eAAe,MAAM,OAAO;CAC9B,SAAS,OAAO;EACd,eAAe,KAAA;EACf,MAAM,IAAI,MACR;GACE;GACA;GACA;GACA;GACA,mBAAmB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EAC1E,CAAC,CAAC,KAAK,IAAI,GACX,EAAE,OAAO,MAAM,CACjB;CACF;CAEF,OAAO;AACT;AAEA,SAAS,KAAK,OAAwC;CACpD,OAAO,IAAI,WAAW,KAAK;AAC7B;AAEA,eAAe,mBACb,UACA,YAOC;CACD,MAAM,WAAW,MAAM,UAAU;CACjC,MAAM,cAAc,SAAS,YAAY,EAAE,MAAM,SAAS,CAAC;CAE3D,IAAI;EACF,MAAM,MAAM,MAAM,YAAY;EAE9B,KAAK,IAAI,UAAU,GAAG,WAAW,IAAI,UAAU,WAAW;GACxD,MAAM,OAAO,MAAM,IAAI,QAAQ,OAAO;GACtC,MAAM,WAAW,KAAK,YAAY,EAAE,OAAO,EAAE,CAAC;GAC9C,MAAM,cAAc,MAAM,KAAK,eAAe;GAE9C,KAAK,MAAM,WAAW,YAAY,OAAO;IACvC,MAAM,OAAO;IAEb,IAAI,CADQ,KAAK,KACP,SAAS,UAAU,GAAG;IA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A;GACF;GACA,SAAS;IACP;IACA;IACA;IACA;IACA;IACA;IACA;GACF;EACF;CACF;AACF;;CApGC,OAAO;EACN,WAAW;GACT;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF;EACA,SAAS;GACP;GACA;GACA;GACA;GACA;GACA;GACA;EACF;CACF,CAAC;CAII,gBAAA,GAAA,OAAO,cAAc,CAAA;;;;;;AC3CnB,IAAM,kBAAA,mBAAN,MAAM,gBAAgB;CAC3B,OAAO,QAAQ,SAA6C;EAC1D,OAAO;GACL,QAAA;GACA,SAAS,CAAC,gBAAgB,QAAQ,OAAO,CAAC;GAC1C,WAAW,CAAC,gBAAgB;GAC5B,SAAS,CAAC,gBAAgB;EAC5B;CACF;CAEA,OAAO,aAAa,SAAkD;EACpE,OAAO;GACL,QAAA;GACA,SAAS,CAAC,gBAAgB,aAAa,OAAO,CAAC;GAC/C,WAAW,CAAC,gBAAgB;GAC5B,SAAS,CAAC,gBAAgB;EAC5B;CACF;AACF;AAnBC,kBAAA,mBAAA,aAAA,CAAA,OAAO,CAAC,CAAC,CAAA,GAAA,eAAA"}
1
+ {"version":3,"file":"index.mjs","names":["BrowserType","regexIsDeepProp","isObject","isObject","fs","dotenv","__decorate","__decorate","resolve","fs","expand"],"sources":["../src/helpers/getRelativePath.helper.ts","../src/helpers/signature.helper.ts","../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js","../node_modules/.pnpm/p-limit@7.3.2/node_modules/p-limit/index.js","../src/helpers/deepMergePdfparams.ts","../src/helpers/tokens.ts","../src/puppeteer/browser/browser.service.ts","../src/puppeteer/engines/ejs/ejs.service.ts","../src/puppeteer/engines/eta/eta.service.ts","../src/puppeteer/engines/handlebars/handlebars.service.ts","../src/puppeteer/engines/mjml/mjml.service.ts","../src/puppeteer/engines/mustache/mustache.service.ts","../src/puppeteer/engines/nunjucks/nunjucks.service.ts","../src/puppeteer/engines/pug/pug.service.ts","../src/puppeteer/libs/requireService.utils.ts","../src/puppeteer/puppeteer.service.ts","../src/nestjs-pdf.service.ts","../node_modules/.pnpm/dotenv-expand@13.0.0/node_modules/dotenv-expand/lib/main.js","../node_modules/.pnpm/@nestjs+config@12.0.0_@nestjs+common@12.0.1_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/config.constants.js","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/_internal/isDeepKey.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/_internal/toKey.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/util/toString.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/util/toPath.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/object/get.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/_internal/isIndex.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/_internal/getTag.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/predicate/isArguments.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/object/has.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/predicate/isObject.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/predicate/isSymbol.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/_internal/isKey.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/util/eq.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/_internal/assignValue.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/_internal/isUnsafeToWriteProperty.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/object/updateWith.mjs","../node_modules/.pnpm/es-toolkit@1.51.0/node_modules/es-toolkit/dist/compat/object/set.mjs","../node_modules/.pnpm/@nestjs+config@12.0.0_@nestjs+common@12.0.1_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/get-config-token.util.js","../node_modules/.pnpm/dotenv@17.4.2/node_modules/dotenv/lib/main.js","../node_modules/.pnpm/@nestjs+config@12.0.0_@nestjs+common@12.0.1_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/get-default-parser.util.js","../node_modules/.pnpm/@nestjs+config@12.0.0_@nestjs+common@12.0.1_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/config.service.js","../node_modules/.pnpm/@nestjs+config@12.0.0_@nestjs+common@12.0.1_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/config-host.module.js","../node_modules/.pnpm/@nestjs+config@12.0.0_@nestjs+common@12.0.1_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/create-config-factory.util.js","../node_modules/.pnpm/@nestjs+config@12.0.0_@nestjs+common@12.0.1_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/get-registration-token.util.js","../node_modules/.pnpm/@nestjs+config@12.0.0_@nestjs+common@12.0.1_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/merge-configs.util.js","../node_modules/.pnpm/@nestjs+config@12.0.0_@nestjs+common@12.0.1_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/validate-with-schema.util.js","../node_modules/.pnpm/@nestjs+config@12.0.0_@nestjs+common@12.0.1_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/config.module.js","../src/puppeteer/puppeteer.module.ts","../src/nestjs-pdf.module.ts"],"sourcesContent":["import { relative, resolve } from 'node:path';\n\n/**\n * Get the relative path to a value from the module directory.\n * @param moduleDir the path of the module, typically __dirname\n * @param relativeToModule the path to the value relative to the module directory\n * @returns the relative path from the current working directory to the value\n * @example\n * getRelativePathToValue(__dirname, './templates/my-template.hbs');\n * // returns 'context/pdf/templates/my-template.hbs' if the current working directory is '/\n */\nexport function getRelativePathToValue(\n moduleDir: string,\n relativeToModule: string,\n): string {\n const fullTemplatePath = resolve(moduleDir, relativeToModule);\n return relative(process.cwd(), fullTemplatePath);\n}\n","import {\n PDFArray,\n PDFDict,\n PDFDocument,\n PDFName,\n PDFNumber,\n PDFString,\n} from 'pdf-lib';\nimport type { TextItem } from 'pdfjs-dist/types/src/display/api';\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nlet pdfjsPromise: typeof import('pdfjs-dist/legacy/build/pdf.mjs') | undefined;\n\nasync function loadPdfjs() {\n if (!pdfjsPromise) {\n try {\n pdfjsPromise = await import('pdfjs-dist/legacy/build/pdf.mjs');\n } catch (error) {\n pdfjsPromise = undefined;\n /* v8 ignore next -- import() rejections are always Error instances in practice */\n const reason = error instanceof Error ? error.message : String(error);\n throw new Error(\n [\n 'Failed to load pdfjs-dist.',\n 'If you use anchor-based signature placement in Node.js, make sure @napi-rs/canvas is installed.',\n 'Try: npm install @napi-rs/canvas',\n '',\n `Original error: ${reason}`,\n ].join('\\n'),\n { cause: error },\n );\n }\n }\n return pdfjsPromise;\n}\n\nfunction toU8(input: Uint8Array | Buffer): Uint8Array {\n return new Uint8Array(input);\n}\n\nasync function findAnchorPosition(\n pdfBytes: Uint8Array,\n anchorText: string,\n): Promise<null | {\n pageIndex: number;\n x: number;\n y: number;\n pageWidth: number;\n pageHeight: number;\n}> {\n const pdfjsLib = await loadPdfjs();\n const loadingTask = pdfjsLib.getDocument({ data: pdfBytes });\n\n try {\n const pdf = await loadingTask.promise;\n\n for (let pageNum = 1; pageNum <= pdf.numPages; pageNum++) {\n const page = await pdf.getPage(pageNum);\n const viewport = page.getViewport({ scale: 1 });\n const textContent = await page.getTextContent();\n\n for (const itemRaw of textContent.items) {\n const item = itemRaw as TextItem;\n const str = item.str;\n if (!str?.includes(anchorText)) continue;\n\n const t = pdfjsLib.Util.transform(viewport.transform, item.transform);\n const [_a, _b, _c, _d, e, f] = t as Array<number>;\n\n const x = e;\n const y = viewport.height - f;\n\n return {\n pageIndex: pageNum - 1,\n x,\n y,\n pageWidth: viewport.width,\n pageHeight: viewport.height,\n };\n }\n }\n return null;\n } finally {\n await loadingTask.destroy();\n }\n}\n\nfunction addSignatureFieldAt(\n pdfDoc: PDFDocument,\n pageIndex: number,\n opts: {\n fieldName: string;\n x: number;\n y: number;\n width: number;\n height: number;\n },\n) {\n const { fieldName, x, y, width, height } = opts;\n const context = pdfDoc.context;\n\n const page = pdfDoc.getPages()[pageIndex];\n\n const rectArray = context.obj([\n PDFNumber.of(x),\n PDFNumber.of(y),\n PDFNumber.of(x + width),\n PDFNumber.of(y + height),\n ]);\n\n const widgetDict = context.obj({\n Type: PDFName.of('Annot'),\n Subtype: PDFName.of('Widget'),\n Rect: rectArray,\n F: PDFNumber.of(4),\n P: page.ref,\n });\n const widgetRef = context.register(widgetDict);\n\n const fieldDict = context.obj({\n FT: PDFName.of('Sig'),\n T: PDFString.of(fieldName),\n Ff: PDFNumber.of(0),\n Kids: context.obj([widgetRef]),\n });\n const fieldRef = context.register(fieldDict);\n\n widgetDict.set(PDFName.of('Parent'), fieldRef);\n\n let annots = page.node.lookupMaybe(PDFName.of('Annots'), PDFArray);\n if (!annots) {\n annots = context.obj([]);\n page.node.set(PDFName.of('Annots'), annots);\n }\n annots.push(widgetRef);\n\n let acroForm = pdfDoc.catalog.lookupMaybe(PDFName.of('AcroForm'), PDFDict);\n if (!acroForm) {\n acroForm = context.obj({\n Fields: context.obj([]),\n SigFlags: PDFNumber.of(3),\n });\n const acroFormRef = context.register(acroForm);\n pdfDoc.catalog.set(PDFName.of('AcroForm'), acroFormRef);\n }\n\n let fields = acroForm.lookupMaybe(PDFName.of('Fields'), PDFArray);\n if (!fields) {\n fields = context.obj([]);\n acroForm.set(PDFName.of('Fields'), fields);\n }\n fields.push(fieldRef);\n\n return { fieldRef, widgetRef };\n}\n\nexport async function addSignatureFieldUsingAnchor(\n pdf: Uint8Array | Buffer,\n fieldName = 'SignatureDebtor',\n anchorText = '__SIG_DEBTOR_ANCHOR__',\n) {\n const bytes = toU8(pdf);\n\n const anchor = await findAnchorPosition(bytes.slice(), anchorText);\n\n const pdfDoc = await PDFDocument.load(bytes);\n\n const sigWidth = 240;\n const sigHeight = 50;\n\n if (anchor) {\n const pageIndex = anchor.pageIndex;\n const page = pdfDoc.getPages()[pageIndex];\n if (!page) throw new Error(`Page ${pageIndex} not found`);\n const { width: pw, height: ph } = page.getSize();\n\n const padX = 40;\n const padY = 7;\n let x = anchor.x - sigWidth / 2 + padX;\n\n let y = anchor.y - sigHeight + padY;\n\n const margin = 10;\n\n x = Math.max(margin, Math.min(x, pw - sigWidth - margin));\n y = Math.max(margin, Math.min(y, ph - sigHeight - margin));\n\n addSignatureFieldAt(pdfDoc, anchor.pageIndex, {\n fieldName,\n x,\n y,\n width: sigWidth,\n height: sigHeight,\n });\n } else {\n const pages = pdfDoc.getPages();\n const pageIndex = pages.length - 1;\n const page = pages.at(-1);\n /* v8 ignore next -- pdf-lib always produces at least one page on save/load; only a hand-crafted, malformed PDF could hit this */\n if (!page) throw new Error(`Page ${pageIndex} not found`);\n const { width: pageWidth } = page.getSize();\n const x = (pageWidth - sigWidth) / 2;\n const y = 90;\n\n addSignatureFieldAt(pdfDoc, pageIndex, {\n fieldName,\n x,\n y,\n width: sigWidth,\n height: sigHeight,\n });\n }\n\n return await pdfDoc.save();\n}\n\n// Test helper to inject a mocked pdfjs implementation and avoid dynamic import in tests\n// This helper throws outside of tests to avoid exposing a test-only API in production.\nexport function __setPdfjsForTests(p: any) {\n if (process.env.NODE_ENV !== 'test') {\n throw new Error('__setPdfjsForTests is only available in test environment');\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n pdfjsPromise = p;\n}\n","/*\nHow it works:\n`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.\n*/\n\nclass Node {\n\tvalue;\n\tnext;\n\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n}\n\nexport default class Queue {\n\t#head;\n\t#tail;\n\t#size;\n\n\tconstructor() {\n\t\tthis.clear();\n\t}\n\n\tenqueue(value) {\n\t\tconst node = new Node(value);\n\n\t\tif (this.#head) {\n\t\t\tthis.#tail.next = node;\n\t\t\tthis.#tail = node;\n\t\t} else {\n\t\t\tthis.#head = node;\n\t\t\tthis.#tail = node;\n\t\t}\n\n\t\tthis.#size++;\n\t}\n\n\tdequeue() {\n\t\tconst current = this.#head;\n\t\tif (!current) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#head = this.#head.next;\n\t\tthis.#size--;\n\n\t\t// Clean up tail reference when queue becomes empty\n\t\tif (!this.#head) {\n\t\t\tthis.#tail = undefined;\n\t\t}\n\n\t\treturn current.value;\n\t}\n\n\tpeek() {\n\t\tif (!this.#head) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn this.#head.value;\n\n\t\t// TODO: Node.js 18.\n\t\t// return this.#head?.value;\n\t}\n\n\tclear() {\n\t\tthis.#head = undefined;\n\t\tthis.#tail = undefined;\n\t\tthis.#size = 0;\n\t}\n\n\tget size() {\n\t\treturn this.#size;\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tlet current = this.#head;\n\n\t\twhile (current) {\n\t\t\tyield current.value;\n\t\t\tcurrent = current.next;\n\t\t}\n\t}\n\n\t* drain() {\n\t\twhile (this.#head) {\n\t\t\tyield this.dequeue();\n\t\t}\n\t}\n}\n","import Queue from 'yocto-queue';\n\nexport default function pLimit(concurrency) {\n\tlet rejectOnClear = false;\n\n\tif (typeof concurrency === 'object') {\n\t\t({concurrency, rejectOnClear = false} = concurrency);\n\t}\n\n\tvalidateConcurrency(concurrency);\n\n\tif (typeof rejectOnClear !== 'boolean') {\n\t\tthrow new TypeError('Expected `rejectOnClear` to be a boolean');\n\t}\n\n\tconst queue = new Queue();\n\tlet activeCount = 0;\n\n\tconst resumeNext = () => {\n\t\t// Process the next queued function if we're under the concurrency limit\n\t\tif (activeCount < concurrency && queue.size > 0) {\n\t\t\tactiveCount++;\n\t\t\tqueue.dequeue().run();\n\t\t}\n\t};\n\n\tconst next = () => {\n\t\tactiveCount--;\n\t\tresumeNext();\n\t};\n\n\tconst run = async (function_, resolve, arguments_) => {\n\t\t// Execute the function and capture the result promise\n\t\tconst result = (async () => function_(...arguments_))();\n\n\t\t// Resolve immediately with the promise (don't wait for completion)\n\t\tresolve(result);\n\n\t\t// Wait for the function to complete (success or failure)\n\t\t// We catch errors here to prevent unhandled rejections,\n\t\t// but the original promise rejection is preserved for the caller\n\t\ttry {\n\t\t\tawait result;\n\t\t} catch {}\n\n\t\t// Decrement active count and process next queued function\n\t\tnext();\n\t};\n\n\tconst enqueue = (function_, resolve, reject, arguments_) => {\n\t\tconst queueItem = {reject};\n\n\t\t// Queue the internal resolve function instead of the run function\n\t\t// to preserve the asynchronous execution context.\n\t\tnew Promise(internalResolve => { // eslint-disable-line promise/param-names\n\t\t\tqueueItem.run = internalResolve;\n\t\t\tqueue.enqueue(queueItem);\n\t\t}).then(run.bind(undefined, function_, resolve, arguments_)); // eslint-disable-line promise/prefer-await-to-then\n\n\t\t// Start processing immediately if we haven't reached the concurrency limit\n\t\tif (activeCount < concurrency) {\n\t\t\tresumeNext();\n\t\t}\n\t};\n\n\tconst generator = (function_, ...arguments_) => new Promise((resolve, reject) => {\n\t\tenqueue(function_, resolve, reject, arguments_);\n\t});\n\n\tObject.defineProperties(generator, {\n\t\tactiveCount: {\n\t\t\tget: () => activeCount,\n\t\t},\n\t\tpendingCount: {\n\t\t\tget: () => queue.size,\n\t\t},\n\t\tclearQueue: {\n\t\t\tvalue() {\n\t\t\t\tif (!rejectOnClear) {\n\t\t\t\t\tqueue.clear();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst abortError = AbortSignal.abort().reason;\n\n\t\t\t\twhile (queue.size > 0) {\n\t\t\t\t\tqueue.dequeue().reject(abortError);\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\tconcurrency: {\n\t\t\tget: () => concurrency,\n\n\t\t\tset(newConcurrency) {\n\t\t\t\tvalidateConcurrency(newConcurrency);\n\t\t\t\tconcurrency = newConcurrency;\n\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\t// eslint-disable-next-line no-unmodified-loop-condition\n\t\t\t\t\twhile (activeCount < concurrency && queue.size > 0) {\n\t\t\t\t\t\tresumeNext();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\t\tmap: {\n\t\t\tasync value(iterable, function_) {\n\t\t\t\tconst promises = Array.from(iterable, (value, index) => generator(function_, value, index));\n\t\t\t\treturn Promise.all(promises);\n\t\t\t},\n\t\t},\n\t});\n\n\treturn generator;\n}\n\nexport function limitFunction(function_, options) {\n\tconst limit = pLimit(options);\n\n\tconst limitedFunction = (...arguments_) => limit(() => function_(...arguments_));\n\tObject.defineProperty(limitedFunction, 'clearQueue', {\n\t\tvalue: limit.clearQueue,\n\t});\n\n\treturn limitedFunction;\n}\n\nfunction validateConcurrency(concurrency) {\n\tif (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {\n\t\tthrow new TypeError('Expected `concurrency` to be a number from 1 and up');\n\t}\n}\n","import { deepmerge } from 'deepmerge-ts';\n\nimport { type PuppeteerParameters } from '../puppeteer/puppeteer-parameters.interface';\n\nexport function mergePuppeteerParameters(\n defaults: PuppeteerParameters,\n overrides?: PuppeteerParameters,\n): PuppeteerParameters {\n if (!overrides) {\n return { ...defaults };\n }\n\n return deepmerge(defaults, overrides);\n}\n","export const PDF_PARAMETERS = 'PDF_PARAMETERS' as const;\n","import { existsSync, promises, readFileSync, writeFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\n\nimport { Inject, Injectable, Logger, OnModuleDestroy } from '@nestjs/common';\nimport {\n Browser as BrowserType,\n BrowserPlatform,\n canDownload,\n detectBrowserPlatform,\n getInstalledBrowsers,\n install,\n resolveBuildId,\n} from '@puppeteer/browsers';\nimport { Browser, BrowserContext, launch } from 'puppeteer';\n\nimport type { PuppeteerParameters } from '../puppeteer-parameters.interface';\n\nexport enum BrowserTag {\n LATEST = 'latest',\n BETA = 'beta',\n DEV = 'dev',\n STABLE = 'stable',\n CANARY = 'canary',\n}\n\nexport type Headless = boolean | 'shell' | undefined;\n\nasync function sleep(ms: number) {\n await new Promise((r) => setTimeout(r, ms));\n}\n\nasync function rmWithRetries(dir: string, retries = 5): Promise<void> {\n for (let attempt = 1; attempt <= retries; attempt++) {\n try {\n await promises.rm(dir, { recursive: true, force: true });\n return;\n } catch (err: unknown) {\n const code = (err as NodeJS.ErrnoException)?.code;\n\n const retryable =\n code === 'EPERM' || code === 'EBUSY' || code === 'ENOTEMPTY';\n\n if (!retryable || attempt === retries) {\n throw err;\n }\n\n await sleep(50 * 2 ** (attempt - 1));\n }\n }\n}\n\nfunction isTargetClosedError(error: unknown): boolean {\n if (!(error instanceof Error)) return false;\n\n return (\n error.name === 'TargetCloseError' ||\n error.message.includes('Target closed') ||\n error.message.includes('Target.createTarget')\n );\n}\n\n@Injectable()\nexport class BrowserService implements OnModuleDestroy {\n private readonly cacheDir: string;\n private readonly options?: PuppeteerParameters;\n\n private _browserInstance: Browser | null = null;\n private browser: BrowserType;\n\n public activeJobs = 0;\n public totalJobs = 0;\n\n private recycleRequested = false;\n private recycling = false;\n\n private shuttingDown = false;\n /** Max time to wait for in-flight PDF jobs to finish before closing the browser on shutdown. */\n public shutdownDrainTimeoutMs = 15_000;\n\n private browserTag: BrowserTag;\n private useLockedBrowser: boolean;\n private buildId: string | undefined;\n\n constructor(@Inject('PDF_PARAMETERS') pdfParams: PuppeteerParameters) {\n this.cacheDir = resolve('.cache/puppeteer-browser');\n this.options = pdfParams;\n\n this.loadBuildId();\n this.loadBrowser();\n this.loadBrowserTag();\n this.loadUseLockedBrowser();\n }\n\n async onModuleDestroy() {\n this.shuttingDown = true;\n await this.waitForIdle(this.shutdownDrainTimeoutMs);\n\n if (this._browserInstance?.connected) {\n try {\n await this._browserInstance.close();\n } catch (error) {\n Logger.warn(\n `Failed to close browser on module destroy: ${\n error instanceof Error ? error.message : String(error)\n }`,\n );\n }\n }\n\n if (this.options?.cleanupBrowserCacheOnExit !== false) {\n await this.cleanupCacheBestEffort();\n }\n }\n\n /** Wait until no PDF job is in flight, or until the timeout elapses. */\n private async waitForIdle(timeoutMs: number): Promise<void> {\n const start = Date.now();\n while (this.activeJobs > 0 && Date.now() - start < timeoutMs) {\n await sleep(50);\n }\n\n if (this.activeJobs > 0) {\n Logger.warn(\n `Shutdown: ${this.activeJobs} PDF job(s) still running after ${timeoutMs}ms, closing the browser anyway`,\n );\n }\n }\n\n async getBrowserInstance(\n args: Array<string>,\n headless: boolean | 'shell' | undefined,\n executablePathBin: string | undefined,\n ) {\n if (!this._browserInstance?.connected) {\n this._browserInstance = await this.launchBrowser(\n args,\n headless,\n executablePathBin,\n );\n }\n\n return this._browserInstance;\n }\n\n async createContext(\n args: Array<string>,\n headless: Headless,\n executablePath?: string,\n ): Promise<BrowserContext> {\n const browser = await this.getBrowserInstance(\n args,\n headless,\n executablePath,\n );\n try {\n return await browser.createBrowserContext();\n } catch (error) {\n if (!isTargetClosedError(error)) {\n throw error;\n }\n\n Logger.warn(\n 'Puppeteer browser closed while creating a context, retrying once',\n );\n\n this._browserInstance = null;\n const freshBrowser = await this.getBrowserInstance(\n args,\n headless,\n executablePath,\n );\n return await freshBrowser.createBrowserContext();\n }\n }\n\n markJobStarted() {\n if (this.shuttingDown) {\n throw new Error('nestjs-pdf is shutting down, refusing new PDF jobs');\n }\n\n this.activeJobs += 1;\n this.totalJobs += 1;\n\n if (this.totalJobs >= 200) {\n this.recycleRequested = true;\n }\n }\n\n async markJobFinished() {\n this.activeJobs = Math.max(0, this.activeJobs - 1);\n await this.recycleBrowserIfNeeded();\n }\n\n async recycleBrowserIfNeeded() {\n if (!this.recycleRequested) return;\n if (this.recycling) return;\n if (this.activeJobs > 0) return;\n if (!this._browserInstance) return;\n\n this.recycling = true;\n\n try {\n if (this._browserInstance.connected) {\n await this._browserInstance.close();\n }\n\n this._browserInstance = null;\n this.totalJobs = 0;\n this.recycleRequested = false;\n\n Logger.log('Puppeteer browser recycled successfully');\n } catch (error) {\n Logger.warn(\n `Failed to recycle browser: ${\n error instanceof Error ? error.message : String(error)\n }`,\n );\n } finally {\n this.recycling = false;\n }\n }\n\n private async cleanupCacheBestEffort() {\n const logger = new Logger('NestJsPdf');\n const dir = this.cacheDir;\n try {\n if (!existsSync(dir)) return;\n\n logger.log(`Cleanup puppeteer cache: ${dir}`);\n\n await rmWithRetries(dir, 6);\n if (existsSync(dir)) {\n await sleep(100);\n await rmWithRetries(dir, 3);\n }\n\n logger.log('Cleanup done');\n } catch (err) {\n logger.error(\n `Cleanup failed for ${dir}`,\n err instanceof Error ? err.stack : String(err),\n );\n }\n try {\n const leftover = await promises.readdir(dir, { recursive: true });\n logger.warn(`Leftover files: ${leftover.slice(0, 20).join(', ')}...`);\n } catch {\n logger.log(`No leftover files in ${dir}`);\n }\n }\n\n async install(lock: boolean = false) {\n const browser: BrowserType = this.browser;\n const versionTag: BrowserTag = this.browserTag;\n\n const browserPlatform = detectBrowserPlatform() ?? BrowserPlatform.LINUX;\n\n let buildId: string;\n if (this.buildId === undefined) {\n buildId = await resolveBuildId(browser, browserPlatform, versionTag);\n } else {\n buildId = this.buildId;\n }\n\n Logger.log(\n `Browser ${browser} ${versionTag} build id: ${buildId}`,\n 'NestJsPdf',\n );\n\n if (await this.hasBrowserInstalled(browser, buildId)) {\n Logger.log('Browser already installed', 'NestJsPdf');\n if (lock) {\n this.writeLockFile(browser, buildId);\n }\n return;\n } else {\n Logger.log('Starting browser installation', 'NestJsPdf');\n\n const installOption = {\n cacheDir: this.cacheDir,\n browser: browser,\n buildId: buildId,\n baseUrl: this.options?.browserInstallBaseUrl ?? undefined,\n };\n\n if (await canDownload(installOption)) {\n Logger.log(\n `Installing ${installOption.browser} ${installOption.buildId}`,\n 'NestJsPdf',\n );\n const installedBrowser = await install(installOption);\n if (await this.hasBrowserInstalled(browser, buildId)) {\n Logger.log('Browser installed successfully', 'NestJsPdf');\n if (lock) {\n this.writeLockFile(browser, buildId);\n }\n return installedBrowser;\n } else {\n Logger.error('Browser installation failed', 'NestJsPdf');\n }\n } else {\n Logger.error(\n `Error, can't install ${installOption.browser} ${installOption.buildId}`,\n 'NestJsPdf',\n );\n }\n }\n return null;\n }\n\n private loadBrowser(): void {\n let browser: BrowserType;\n if (this.options?.browser === undefined) {\n browser = BrowserType.CHROMIUM;\n } else {\n browser = this.options.browser;\n }\n this.browser = browser;\n }\n\n public getBrowser(): BrowserType {\n return this.browser;\n }\n\n private loadBrowserTag(): void {\n let versionTag: BrowserTag;\n if (this.options?.browserTag === undefined) {\n if (this.browser === BrowserType.CHROMIUM) {\n versionTag = BrowserTag.LATEST;\n } else {\n versionTag = BrowserTag.STABLE;\n }\n } else {\n versionTag = this.options.browserTag;\n }\n this.browserTag = versionTag;\n }\n\n private loadBuildId(): void {\n let buildId: string | undefined;\n if (this.options?.buildId === undefined) {\n buildId = undefined;\n } else {\n buildId = this.options.buildId;\n }\n this.buildId = buildId;\n }\n\n public setBrowserTag(browserTag: BrowserTag): void {\n this.browserTag = browserTag;\n }\n\n public getBrowserTag(): BrowserTag {\n return this.browserTag;\n }\n\n getBuildId(): string | undefined {\n return this.buildId;\n }\n\n private loadUseLockedBrowser(): void {\n let useLockedBrowser: boolean;\n if (this.options?.useLockedBrowser === undefined) {\n useLockedBrowser = false;\n } else {\n useLockedBrowser = this.options.useLockedBrowser;\n }\n this.useLockedBrowser = useLockedBrowser;\n }\n\n async hasBrowserInstalled(browser: BrowserType, buildId: string) {\n const installedBrowserlist = await getInstalledBrowsers({\n cacheDir: this.cacheDir,\n });\n\n const installedBrowser = installedBrowserlist.find((insBrowser) => {\n return insBrowser.browser === browser && insBrowser.buildId === buildId;\n });\n return installedBrowser !== undefined;\n }\n\n async getExecutablePath(): Promise<string> {\n const browser: BrowserType = this.browser;\n const versionTag: BrowserTag = this.browserTag;\n const browserPlatform = detectBrowserPlatform() ?? BrowserPlatform.LINUX;\n let buildId: string | null = null;\n if (this.useLockedBrowser) {\n buildId = this.getLockedBuildId(browser);\n Logger.log(`Using locked browser ${buildId}`, 'NestJsPdf');\n }\n buildId ??= await resolveBuildId(browser, browserPlatform, versionTag);\n const installedBrowserlist = await getInstalledBrowsers({\n cacheDir: this.cacheDir,\n });\n const installedBrowser = installedBrowserlist.find((insBrowser) => {\n return insBrowser.browser === browser && insBrowser.buildId === buildId;\n });\n if (installedBrowser === undefined) {\n const newinstalledBrowser = await this.install();\n if (newinstalledBrowser === null || newinstalledBrowser === undefined) {\n throw new Error('Could not install browser');\n } else {\n return newinstalledBrowser.executablePath;\n }\n }\n return installedBrowser.executablePath;\n }\n\n private async launchBrowser(\n args: Array<string>,\n headless: Headless,\n executablePathBin: string | undefined,\n ) {\n const executablePath =\n executablePathBin ?? (await this.getExecutablePath());\n\n const browser = await launch({\n executablePath,\n headless,\n args,\n });\n\n browser.on('disconnected', () => {\n Logger.warn('Puppeteer browser disconnected');\n if (this._browserInstance === browser) {\n this._browserInstance = null;\n }\n });\n\n return browser;\n }\n\n private writeLockFile(browser: BrowserType, buildId: string) {\n const lockFile = resolve(this.cacheDir, `${browser}.lock`);\n const data = JSON.stringify({\n browser: browser,\n buildId: buildId,\n date: new Date().toISOString(),\n });\n writeFileSync(lockFile, data);\n\n Logger.log(`Browser ${browser} locked to build ${buildId}`, 'NestJsPdf');\n }\n\n getLockedBuildId(browser: BrowserType): string | null {\n const lockFile = resolve(this.cacheDir, `${browser}.lock`);\n if (existsSync(lockFile)) {\n const data = readFileSync(lockFile);\n const lock = JSON.parse(data.toString()) as {\n browser: Browser;\n buildId: string;\n date: string;\n };\n return lock.buildId;\n }\n return null;\n }\n}\n","import { Injectable } from '@nestjs/common';\nimport ejs, { type Data, type Options } from 'ejs';\n\nexport interface EjsOptions extends Omit<Options, 'async'> {\n async?: boolean;\n}\n\n@Injectable()\nexport class EjsService {\n async render(template: string, data: Data = {}, options?: EjsOptions) {\n try {\n return await ejs.render(template, data, {\n async: true,\n ...options,\n });\n } catch (error) {\n throw new Error(`EJS rendering failed: ${String(error)}`, {\n cause: error,\n });\n }\n }\n\n async renderFile(filePath: string, data: Data = {}, options?: EjsOptions) {\n try {\n return await ejs.renderFile(filePath, data, {\n async: true,\n ...options,\n });\n } catch (error) {\n throw new Error(`EJS file rendering failed: ${String(error)}`, {\n cause: error,\n });\n }\n }\n}\n","import { readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\n\nimport { Injectable } from '@nestjs/common';\nimport { Eta, EtaConfig } from 'eta';\n\nexport interface EtaOptions extends Partial<EtaConfig> {\n cache?: boolean;\n autoEscape?: boolean;\n varName?: string;\n views?: string;\n useWith?: boolean;\n plugins?: Array<any>;\n}\n\n@Injectable()\nexport class EtaService {\n private readonly eta: Eta;\n private readonly templateCache: Map<string, string> = new Map();\n private readonly maxCacheSize = 100;\n\n constructor() {\n this.eta = new Eta({\n cache: true,\n autoEscape: true,\n useWith: true,\n });\n }\n\n /**\n * Render an Eta template from a string\n * @param template The template string to render\n * @param data The data object to use for rendering\n * @param options Optional Eta rendering options\n * @returns The rendered HTML string\n */\n render(\n template: string,\n data: Record<string, unknown> = {},\n options?: EtaOptions,\n ): string {\n try {\n const eta =\n options && Object.keys(options).length > 0\n ? new Eta({\n cache: true,\n autoEscape: true,\n useWith: true,\n ...options,\n varName: options.varName ?? 'it',\n })\n : this.eta;\n\n return eta.renderString(template, data);\n } catch (error) {\n throw new Error(`Eta rendering failed: ${String(error)}`, {\n cause: error,\n });\n }\n }\n\n /**\n * Render an Eta template from a file\n * @param filePath The path to the template file\n * @param data The data object to use for rendering\n * @param options Optional Eta rendering options\n * @returns The rendered HTML string\n */\n renderFile(\n filePath: string,\n data: Record<string, unknown> = {},\n options?: EtaOptions,\n ): string {\n try {\n const resolvedPath = resolve(filePath);\n const useCache = options?.cache ?? true;\n let template = useCache\n ? this.templateCache.get(resolvedPath)\n : undefined;\n\n if (!template) {\n template = readFileSync(resolvedPath, 'utf-8');\n\n if (useCache && this.templateCache.size < this.maxCacheSize) {\n this.templateCache.set(resolvedPath, template);\n }\n }\n return this.render(template, data, options);\n } catch (error) {\n throw new Error(\n `Eta file rendering failed for ${filePath}: ${String(error)}`,\n {\n cause: error,\n },\n );\n }\n }\n\n /**\n * Clear the template cache\n */\n clearCache(): void {\n this.templateCache.clear();\n }\n\n /**\n * Get the current cache size\n * @returns The number of cached templates\n */\n getCacheSize(): number {\n return this.templateCache.size;\n }\n}\n","import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';\nimport { basename, extname, join, resolve, sep } from 'node:path';\n\nimport { Injectable } from '@nestjs/common';\nimport Handlebars from 'handlebars';\n\nexport type HandlebarsHelper = {\n name: string;\n fn: Handlebars.HelperDelegate;\n};\n\nexport interface HandlebarsOptions {\n /** Base directory (relative to `process.cwd()`) used to resolve files passed to `renderFile`. */\n templateDirectory?: string;\n /** Directory (relative to `process.cwd()`) whose files are each registered as a partial. */\n partialDirectory?: string;\n /**\n * Runtime options forwarded to the compiled template function.\n * `helpers` and `partials` are excluded on purpose: register helpers via\n * `helpers` and partials via `partialDirectory`.\n */\n templateOptions?: Omit<Handlebars.RuntimeOptions, 'helpers' | 'partials'>;\n /** Options forwarded to `Handlebars.compile`. */\n compileOptions?: CompileOptions;\n /** Custom helpers registered on the isolated Handlebars environment for this render. */\n helpers?: Array<HandlebarsHelper>;\n}\n\n@Injectable()\nexport class HandlebarsService {\n private cachedOptions?: HandlebarsOptions;\n private cachedEnv?: typeof Handlebars;\n\n render(\n template: string,\n parameters: unknown = {},\n options: HandlebarsOptions = {},\n ): string {\n try {\n const compiled = this.getEnv(options).compile(\n template,\n options.compileOptions,\n );\n return compiled(parameters, options.templateOptions);\n } catch (error) {\n throw new Error(`Handlebars rendering failed: ${String(error)}`, {\n cause: error,\n });\n }\n }\n\n renderFile(\n file: string,\n parameters: unknown = {},\n options: HandlebarsOptions = {},\n ): string {\n if (options.templateDirectory === undefined) {\n throw new Error(\n 'Handlebars file rendering failed: option `templateDirectory` is not set',\n );\n }\n\n const baseDir = resolve(process.cwd(), options.templateDirectory);\n const templatePath = resolve(baseDir, file);\n if (templatePath !== baseDir && !templatePath.startsWith(baseDir + sep)) {\n throw new Error(\n `Handlebars file rendering failed: ’${file}’ resolves outside \\`templateDirectory\\``,\n );\n }\n\n let template: string;\n try {\n template = readFileSync(templatePath, 'utf8');\n } catch (error) {\n throw new Error(`Handlebars file rendering failed: ${String(error)}`, {\n cause: error,\n });\n }\n\n return this.render(template, parameters, options);\n }\n\n /**\n * Build an isolated Handlebars environment with the given helpers/partials so\n * nothing leaks into the global Handlebars. Memoised for the common case where\n * the same options object is reused across calls (e.g. the module `hbsOptions`).\n */\n private getEnv(options: HandlebarsOptions): typeof Handlebars {\n if (this.cachedEnv && this.cachedOptions === options) {\n return this.cachedEnv;\n }\n\n const env = Handlebars.create();\n\n for (const helper of options.helpers ?? []) {\n env.registerHelper(helper.name, helper.fn);\n }\n this.registerPartials(env, options.partialDirectory);\n\n this.cachedOptions = options;\n this.cachedEnv = env;\n return env;\n }\n\n private registerPartials(\n env: typeof Handlebars,\n partialDirectory: string | undefined,\n ): void {\n if (partialDirectory === undefined) return;\n\n const partialPath = join(process.cwd(), partialDirectory);\n if (!existsSync(partialPath)) {\n throw new Error(\n `Handlebars partial directory does not exist: ${partialPath}`,\n );\n }\n\n for (const entry of readdirSync(partialPath)) {\n const filePath = join(partialPath, entry);\n if (!statSync(filePath).isFile()) continue;\n\n env.registerPartial(\n basename(entry, extname(entry)),\n readFileSync(filePath, 'utf8'),\n );\n }\n }\n}\n","import { readFileSync } from 'node:fs';\n\nimport { Injectable } from '@nestjs/common';\nimport mjml from 'mjml';\nimport { type MJMLParsingOptions } from 'mjml-core';\n\n@Injectable()\nexport class MjmlService {\n async render(\n template: string,\n options?: MJMLParsingOptions,\n ): Promise<string> {\n const { html } = await mjml(template, options);\n return html;\n }\n\n async renderFile(\n filePath: string,\n options?: MJMLParsingOptions,\n ): Promise<string> {\n const template = readFileSync(filePath, 'utf-8');\n return await this.render(template, options);\n }\n}\n","import { readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\n\nimport { Injectable } from '@nestjs/common';\nimport mustache, { EscapeFunction } from 'mustache';\n\nexport interface MustacheOptions {\n tags?: [string, string];\n escape?: EscapeFunction;\n}\n\n@Injectable()\nexport class MustacheService {\n private readonly templateCache: Map<string, string> = new Map();\n private readonly maxCacheSize = 100;\n\n /**\n * Render a Mustache template from a string\n * @param template The template string to render\n * @param data The data object to use for rendering\n * @param options Optional Mustache rendering options\n * @returns The rendered HTML string\n */\n render(\n template: string,\n data: Record<string, unknown> = {},\n options?: MustacheOptions,\n ): string {\n try {\n const tags = options?.tags ?? ['{{', '}}'];\n return mustache.render(template, data, undefined, {\n tags: tags,\n escape: options?.escape,\n });\n } catch (error) {\n throw new Error(`Mustache rendering failed: ${String(error)}`, {\n cause: error,\n });\n }\n }\n\n /**\n * Render a Mustache template from a file\n * @param filePath The path to the template file\n * @param data The data object to use for rendering\n * @param options Optional Mustache rendering options\n * @returns The rendered HTML string\n */\n renderFile(\n filePath: string,\n data: Record<string, unknown> = {},\n options?: MustacheOptions,\n ): string {\n try {\n const resolvedPath = resolve(filePath);\n let template = this.templateCache.get(resolvedPath);\n\n if (!template) {\n template = readFileSync(resolvedPath, 'utf-8');\n\n if (this.templateCache.size < this.maxCacheSize) {\n this.templateCache.set(resolvedPath, template);\n }\n }\n\n return this.render(template, data, options);\n } catch (error) {\n throw new Error(\n `Mustache file rendering failed for ${filePath}: ${String(error)}`,\n {\n cause: error,\n },\n );\n }\n }\n\n /**\n * Clear the template cache\n */\n clearCache(): void {\n this.templateCache.clear();\n }\n\n /**\n * Get the current cache size\n * @returns The number of cached templates\n */\n getCacheSize(): number {\n return this.templateCache.size;\n }\n}\n","import { Injectable } from '@nestjs/common';\nimport nunjucks, { type ConfigureOptions } from 'nunjucks';\n\nexport interface NunjucksOptions extends Partial<ConfigureOptions> {\n noCache?: boolean;\n watch?: boolean;\n throwOnUndefined?: boolean;\n trimBlocks?: boolean;\n lstripBlocks?: boolean;\n}\n\n@Injectable()\nexport class NunjucksService {\n constructor() {\n // Configure default Nunjucks environment\n nunjucks.configure({\n noCache: true,\n trimBlocks: true,\n lstripBlocks: true,\n });\n }\n\n render(\n template: string,\n data: Record<string, unknown> = {},\n options?: NunjucksOptions,\n ) {\n try {\n if (options) {\n const configOptions: Record<string, unknown> = {\n noCache: options.noCache ?? true,\n watch: options.watch ?? false,\n throwOnUndefined: options.throwOnUndefined ?? false,\n trimBlocks: options.trimBlocks ?? true,\n lstripBlocks: options.lstripBlocks ?? true,\n };\n nunjucks.configure(configOptions as ConfigureOptions);\n }\n return nunjucks.renderString(template, data);\n } catch (error) {\n throw new Error(`Nunjucks rendering failed: ${String(error)}`, {\n cause: error,\n });\n }\n }\n\n renderFile(\n filePath: string,\n data: Record<string, unknown> = {},\n options?: NunjucksOptions,\n ) {\n try {\n if (options) {\n const configOptions: Record<string, unknown> = {\n noCache: options.noCache ?? true,\n watch: options.watch ?? false,\n throwOnUndefined: options.throwOnUndefined ?? false,\n trimBlocks: options.trimBlocks ?? true,\n lstripBlocks: options.lstripBlocks ?? true,\n };\n nunjucks.configure(configOptions as ConfigureOptions);\n }\n return nunjucks.render(filePath, data);\n } catch (error) {\n throw new Error(`Nunjucks file rendering failed: ${String(error)}`, {\n cause: error,\n });\n }\n }\n}\n","import { readFileSync } from 'node:fs';\n\nimport { Injectable } from '@nestjs/common';\nimport pug, { type LocalsObject, type Options } from 'pug';\n\nexport type PugOptions = Options;\n\n@Injectable()\nexport class PugService {\n render(\n template: string,\n data: LocalsObject = {},\n options?: PugOptions,\n ): string {\n try {\n const compiledFn = pug.compile(template, {\n ...options,\n });\n return compiledFn(data);\n } catch (error) {\n throw new Error(`Pug rendering failed: ${String(error)}`, {\n cause: error,\n });\n }\n }\n\n renderFile(\n filePath: string,\n data: LocalsObject = {},\n options?: PugOptions,\n ): string {\n try {\n const template = readFileSync(filePath, 'utf-8');\n return this.render(template, data, options);\n } catch (error) {\n throw new Error(`Pug file rendering failed: ${String(error)}`, {\n cause: error,\n });\n }\n }\n}\n","export function requireService<T>(service: T | undefined, name: string): T {\n if (!service) {\n throw new Error(\n `${name} service is not available. If the problem persists, open an issue in the repo.`,\n );\n }\n\n return service;\n}\n","import { Inject, Injectable, Logger, Optional } from '@nestjs/common';\nimport { Data } from 'ejs';\nimport pLimit from 'p-limit';\nimport { LocalsObject } from 'pug';\nimport { PDFOptions } from 'puppeteer';\n\nimport { mergePuppeteerParameters } from '../helpers/deepMergePdfparams';\nimport { PDF_PARAMETERS } from '../helpers/tokens';\nimport { BrowserService } from './browser/browser.service';\nimport { EjsService } from './engines/ejs/ejs.service';\nimport { EtaService } from './engines/eta/eta.service';\nimport { HandlebarsService } from './engines/handlebars/handlebars.service';\nimport { MjmlService } from './engines/mjml/mjml.service';\nimport { MustacheService } from './engines/mustache/mustache.service';\nimport { NunjucksService } from './engines/nunjucks/nunjucks.service';\nimport { PugService } from './engines/pug/pug.service';\nimport { requireService } from './libs/requireService.utils';\nimport type { PuppeteerParameters } from './puppeteer-parameters.interface';\n\n@Injectable()\nexport class PuppeteerService {\n constructor(\n private readonly browserService: BrowserService,\n @Inject(PDF_PARAMETERS) private readonly options: PuppeteerParameters,\n @Optional() private readonly hbsService?: HandlebarsService,\n @Optional() private readonly mjmlService?: MjmlService,\n @Optional() private readonly pugService?: PugService,\n @Optional() private readonly ejsService?: EjsService,\n @Optional() private readonly nunjucksService?: NunjucksService,\n @Optional() private readonly etaService?: EtaService,\n @Optional() private readonly mustacheService?: MustacheService,\n ) {}\n\n private readonly limit = pLimit(3);\n\n async generatePdfFromHtml(\n html: string,\n options?: PuppeteerParameters,\n ): Promise<Uint8Array> {\n return this.limit(async () => {\n const mergePuppeteerOptions = mergePuppeteerParameters(\n this.options,\n options,\n );\n if (mergePuppeteerOptions.chromiumRevision !== undefined) {\n Logger.warn(\n 'Using `chromiumRevision` is no longer supported since the puppeteer update.',\n );\n }\n\n const headless: boolean | 'shell' =\n mergePuppeteerOptions.headless ?? true;\n\n const executablePath = mergePuppeteerOptions.executablePath || undefined;\n\n //src: https://www.bannerbear.com/blog/ways-to-speed-up-puppeteer-screenshots/\n const args = mergePuppeteerOptions.extraPuppeteerArgs || [\n '--autoplay-policy=user-gesture-required',\n '--disable-background-networking',\n '--disable-background-timer-throttling',\n '--disable-backgrounding-occluded-windows',\n '--disable-breakpad',\n '--disable-client-side-phishing-detection',\n '--disable-component-update',\n '--disable-default-apps',\n '--disable-dev-shm-usage',\n '--disable-domain-reliability',\n '--disable-extensions',\n '--disable-features=AudioServiceOutOfProcess',\n '--disable-hang-monitor',\n '--disable-ipc-flooding-protection',\n '--disable-notifications',\n '--disable-offer-store-unmasked-wallet-cards',\n '--disable-popup-blocking',\n '--disable-print-preview',\n '--disable-prompt-on-repost',\n '--disable-renderer-backgrounding',\n '--disable-setuid-sandbox',\n '--disable-speech-api',\n '--disable-sync',\n '--hide-scrollbars',\n '--ignore-gpu-blacklist',\n '--metrics-recording-only',\n '--mute-audio',\n '--no-default-browser-check',\n '--no-first-run',\n '--no-pings',\n '--password-store=basic',\n '--use-gl=swiftshader',\n '--use-mock-keychain',\n '--disable-accelerated-2d-canvas',\n '--no-zygote',\n '--disable-gpu',\n ];\n\n this.browserService.markJobStarted();\n let context: Awaited<ReturnType<BrowserService['createContext']>> | null =\n null;\n\n try {\n context = await this.browserService.createContext(\n args,\n headless,\n executablePath,\n );\n const page = await context.newPage();\n\n const pdfOptions: PDFOptions = mergePuppeteerOptions.pdfOptions ?? {\n format: 'A4',\n };\n\n await page.setContent(html, { waitUntil: 'domcontentloaded' });\n await page.emulateMediaType('screen');\n await page.waitForNetworkIdle({ idleTime: 500, timeout: 30000 });\n // Executes inside the browser page context via Puppeteer, not in Node — unreachable by unit tests.\n /* v8 ignore next */\n await page.evaluate(() => document.fonts.ready);\n\n return await page.pdf(pdfOptions);\n } catch (e) {\n Logger.error(e);\n throw e;\n } finally {\n if (context) {\n try {\n await context.close();\n } catch (error) {\n Logger.error(error);\n }\n }\n await this.browserService.markJobFinished();\n }\n });\n }\n\n async generatePdfFromTemplateHbsString(\n template: string,\n parameters: any = {},\n options?: PuppeteerParameters,\n ) {\n const hbsService = requireService(this.hbsService, 'Handlebars');\n const html = hbsService.render(\n template,\n parameters,\n options?.hbsOptions ?? this.options.hbsOptions,\n );\n return this.generatePdfFromHtml(html, options);\n }\n\n async generatePdfFromTemplateHbsFile(\n file: string,\n parameters: any = {},\n options?: PuppeteerParameters,\n ) {\n const hbsService = requireService(this.hbsService, 'Handlebars');\n const html = hbsService.renderFile(\n file,\n parameters,\n options?.hbsOptions ?? this.options.hbsOptions,\n );\n return this.generatePdfFromHtml(html, options);\n }\n\n async generatePdfFromMjmlString(\n template: string,\n options?: PuppeteerParameters,\n ) {\n const mjmlService = requireService(this.mjmlService, 'MJML');\n const html = await mjmlService.render(\n template,\n options?.mjmlOptions ?? this.options.mjmlOptions,\n );\n return this.generatePdfFromHtml(html, options);\n }\n\n async generatePdfFromMjmlFile(file: string, options?: PuppeteerParameters) {\n const mjmlService = requireService(this.mjmlService, 'MJML');\n const html = await mjmlService.renderFile(\n file,\n options?.mjmlOptions ?? this.options.mjmlOptions,\n );\n return this.generatePdfFromHtml(html, options);\n }\n\n async generatePdfFromPugString(\n template: string,\n data: LocalsObject = {},\n options?: PuppeteerParameters,\n ) {\n const pugService = requireService(this.pugService, 'Pug');\n const html = pugService.render(\n template,\n data,\n options?.pugOptions ?? this.options.pugOptions,\n );\n return this.generatePdfFromHtml(html, options);\n }\n\n async generatePdfFromPugFile(\n file: string,\n data: LocalsObject = {},\n options?: PuppeteerParameters,\n ) {\n const pugService = requireService(this.pugService, 'Pug');\n const html = pugService.renderFile(\n file,\n data,\n options?.pugOptions ?? this.options.pugOptions,\n );\n return this.generatePdfFromHtml(html, options);\n }\n\n async generatePdfFromEjsString(\n template: string,\n data: Data = {},\n options?: PuppeteerParameters,\n ) {\n const ejsService = requireService(this.ejsService, 'EJS');\n const html = await ejsService.render(\n template,\n data,\n options?.ejsOptions ?? this.options.ejsOptions,\n );\n return this.generatePdfFromHtml(html, options);\n }\n\n async generatePdfFromEjsFile(\n file: string,\n data: Data = {},\n options?: PuppeteerParameters,\n ) {\n const ejsService = requireService(this.ejsService, 'EJS');\n const html = await ejsService.renderFile(\n file,\n data,\n options?.ejsOptions ?? this.options.ejsOptions,\n );\n return this.generatePdfFromHtml(html, options);\n }\n\n async generatePdfFromNunjucksString(\n template: string,\n data: Record<string, unknown> = {},\n options?: PuppeteerParameters,\n ) {\n const nunjucksService = requireService(this.nunjucksService, 'Nunjucks');\n const html = nunjucksService.render(\n template,\n data,\n options?.nunjucksOptions ?? this.options.nunjucksOptions,\n );\n return this.generatePdfFromHtml(html, options);\n }\n\n async generatePdfFromNunjucksFile(\n file: string,\n data: Record<string, unknown> = {},\n options?: PuppeteerParameters,\n ) {\n const nunjucksService = requireService(this.nunjucksService, 'Nunjucks');\n const html = nunjucksService.renderFile(\n file,\n data,\n options?.nunjucksOptions ?? this.options.nunjucksOptions,\n );\n return this.generatePdfFromHtml(html, options);\n }\n\n async generatePdfFromEtaString(\n template: string,\n data: Record<string, unknown> = {},\n options?: PuppeteerParameters,\n ) {\n const etaService = requireService(this.etaService, 'Eta');\n const html = etaService.render(\n template,\n data,\n options?.etaOptions ?? this.options.etaOptions,\n );\n return this.generatePdfFromHtml(html, options);\n }\n\n async generatePdfFromEtaFile(\n file: string,\n data: Record<string, unknown> = {},\n options?: PuppeteerParameters,\n ) {\n const etaService = requireService(this.etaService, 'Eta');\n const html = etaService.renderFile(\n file,\n data,\n options?.etaOptions ?? this.options.etaOptions,\n );\n return this.generatePdfFromHtml(html, options);\n }\n\n async generatePdfFromMustacheString(\n template: string,\n data: Record<string, unknown> = {},\n options?: PuppeteerParameters,\n ) {\n const mustacheService = requireService(this.mustacheService, 'Mustache');\n const html = mustacheService.render(\n template,\n data,\n options?.mustacheOptions ?? this.options.mustacheOptions,\n );\n return this.generatePdfFromHtml(html, options);\n }\n\n async generatePdfFromMustacheFile(\n file: string,\n data: Record<string, unknown> = {},\n options?: PuppeteerParameters,\n ) {\n const mustacheService = requireService(this.mustacheService, 'Mustache');\n const html = mustacheService.renderFile(\n file,\n data,\n options?.mustacheOptions ?? this.options.mustacheOptions,\n );\n return this.generatePdfFromHtml(html, options);\n }\n}\n","import { Injectable } from '@nestjs/common';\nimport { Data } from 'ejs';\nimport { LocalsObject } from 'pug';\n\nimport { addSignatureFieldUsingAnchor } from './helpers/signature.helper';\nimport { PuppeteerService } from './puppeteer/puppeteer.service';\nimport { PuppeteerParameters } from './puppeteer/puppeteer-parameters.interface';\n\n@Injectable()\nexport class NestjsPdfService {\n constructor(private readonly puppeteerService: PuppeteerService) {}\n\n /**\n * @param html HTML string to convert to PDF\n * @param options PDF generation options (optional)\n * @returns PDF generated from the provided HTML\n * @description This method uses the Puppeteer service to generate a PDF from an HTML string. Generation options can be customized by passing a `PuppeteerParameters` object as the second argument. This allows you to control various aspects of PDF rendering, such as page size, margins, background display, etc. If no options are provided, the default parameters defined in the Puppeteer service will be used.\n */\n generatePdfFromHtml(html: string, options?: PuppeteerParameters) {\n return this.puppeteerService.generatePdfFromHtml(html, options);\n }\n\n /**\n * @param template Handlebars template string\n * @param parameters Data parameters to inject into the template\n * @param options PDF generation options (optional)\n * @returns PDF generated from the provided Handlebars template with parameters applied\n * @description This method generates a PDF from a Handlebars template provided as a string. The parameters to inject into the template are passed in the `parameters` object, which is used to render the template before converting it to PDF. PDF generation options can also be customized by passing a `PuppeteerParameters` object as the third argument. This allows you to control various aspects of PDF rendering, such as page size, margins, background display, etc. If no options are provided, the default parameters defined in the Puppeteer service will be used.\n */\n generatePdfFromTemplateHbsString(\n template: string,\n parameters: any = {},\n options?: PuppeteerParameters,\n ) {\n return this.puppeteerService.generatePdfFromTemplateHbsString(\n template,\n parameters,\n options,\n );\n }\n\n /**\n * @param file Path to the Handlebars template file\n * @param parameters Data parameters to inject into the template\n * @param options PDF generation options (optional)\n * @returns PDF generated from the Handlebars template at the provided file path with parameters applied\n * @description This method generates a PDF from a Handlebars template located at the specified file path. The file path is passed as a string in the `file` parameter. The parameters to inject into the template are passed in the `parameters` object, which is used to render the template before converting it to PDF. PDF generation options can also be customized by passing a `PuppeteerParameters` object as the third argument. This allows you to control various aspects of PDF rendering, such as page size, margins, background display, etc. If no options are provided, the default parameters defined in the Puppeteer service will be used.\n */\n generatePdfFromTemplateHbsFile(\n file: string,\n parameters: any = {},\n options?: PuppeteerParameters,\n ) {\n return this.puppeteerService.generatePdfFromTemplateHbsFile(\n file,\n parameters,\n options,\n );\n }\n\n /**\n * @param template MJML template string\n * @param options PDF generation options (optional)\n * @returns PDF generated from the provided MJML template\n * @description This method generates a PDF from an MJML template provided as a string. MJML (MJML Markup Language) is a markup language designed to reduce the pain of coding a responsive email. The template is first rendered to HTML using the MJML renderer, then converted to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the second argument.\n */\n generatePdfFromMjmlString(template: string, options?: PuppeteerParameters) {\n return this.puppeteerService.generatePdfFromMjmlString(template, options);\n }\n\n /**\n * @param file Path to the MJML template file\n * @param options PDF generation options (optional)\n * @returns PDF generated from the MJML template at the provided file path\n * @description This method generates a PDF from an MJML template located at the specified file path. The file path is passed as a string in the `file` parameter. The template is first rendered to HTML using the MJML renderer, then converted to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the second argument.\n */\n generatePdfFromMjmlFile(file: string, options?: PuppeteerParameters) {\n return this.puppeteerService.generatePdfFromMjmlFile(file, options);\n }\n\n /**\n * @param template EJS template string\n * @param data Data to inject into the template\n * @param options PDF generation options (optional)\n * @returns PDF generated from the provided EJS template with data applied\n * @description This method generates a PDF from an EJS (Embedded JavaScript) template provided as a string. EJS is a templating language with a simple, straightforward syntax. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.\n */\n generatePdfFromEjsString(\n template: string,\n data: Data = {},\n options?: PuppeteerParameters,\n ) {\n return this.puppeteerService.generatePdfFromEjsString(\n template,\n data,\n options,\n );\n }\n\n /**\n * @param file Path to the EJS template file\n * @param data Data to inject into the template\n * @param options PDF generation options (optional)\n * @returns PDF generated from the EJS template at the provided file path with data applied\n * @description This method generates a PDF from an EJS template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.\n */\n generatePdfFromEjsFile(\n file: string,\n data: Data = {},\n options?: PuppeteerParameters,\n ) {\n return this.puppeteerService.generatePdfFromEjsFile(file, data, options);\n }\n\n /**\n * @param template Pug template string\n * @param data Data to inject into the template\n * @param options PDF generation options (optional)\n * @returns PDF generated from the provided Pug template with data applied\n * @description This method generates a PDF from a Pug template provided as a string. Pug is a clean, whitespace-sensitive syntax for writing HTML. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.\n */\n generatePdfFromPugString(\n template: string,\n data: LocalsObject = {},\n options?: PuppeteerParameters,\n ) {\n return this.puppeteerService.generatePdfFromPugString(\n template,\n data,\n options,\n );\n }\n\n /**\n * @param file Path to the Pug template file\n * @param data Data to inject into the template\n * @param options PDF generation options (optional)\n * @returns PDF generated from the Pug template at the provided file path with data applied\n * @description This method generates a PDF from a Pug template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.\n */\n generatePdfFromPugFile(\n file: string,\n data: LocalsObject = {},\n options?: PuppeteerParameters,\n ) {\n return this.puppeteerService.generatePdfFromPugFile(file, data, options);\n }\n\n /**\n * @param template Nunjucks template string\n * @param data Data to inject into the template\n * @param options PDF generation options (optional)\n * @returns PDF generated from the provided Nunjucks template with data applied\n * @description This method generates a PDF from a Nunjucks template provided as a string. Nunjucks is a powerful templating language with support for inheritance, macros, and filters. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.\n */\n generatePdfFromNunjucksString(\n template: string,\n data: Record<string, unknown> = {},\n options?: PuppeteerParameters,\n ) {\n return this.puppeteerService.generatePdfFromNunjucksString(\n template,\n data,\n options,\n );\n }\n\n /**\n * @param file Path to the Nunjucks template file\n * @param data Data to inject into the template\n * @param options PDF generation options (optional)\n * @returns PDF generated from the Nunjucks template at the provided file path with data applied\n * @description This method generates a PDF from a Nunjucks template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.\n */\n generatePdfFromNunjucksFile(\n file: string,\n data: Record<string, unknown> = {},\n options?: PuppeteerParameters,\n ) {\n return this.puppeteerService.generatePdfFromNunjucksFile(\n file,\n data,\n options,\n );\n }\n\n /**\n * @param template Eta template string\n * @param data Data to inject into the template\n * @param options PDF generation options (optional)\n * @returns PDF generated from the provided Eta template with data applied\n * @description This method generates a PDF from an Eta template provided as a string. Eta is a fast and lightweight embedded templating language with a syntax similar to EJS but with better performance. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.\n */\n generatePdfFromEtaString(\n template: string,\n data: Record<string, unknown> = {},\n options?: PuppeteerParameters,\n ) {\n return this.puppeteerService.generatePdfFromEtaString(\n template,\n data,\n options,\n );\n }\n\n /**\n * @param file Path to the Eta template file\n * @param data Data to inject into the template\n * @param options PDF generation options (optional)\n * @returns PDF generated from the Eta template at the provided file path with data applied\n * @description This method generates a PDF from an Eta template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.\n */\n generatePdfFromEtaFile(\n file: string,\n data: Record<string, unknown> = {},\n options?: PuppeteerParameters,\n ) {\n return this.puppeteerService.generatePdfFromEtaFile(file, data, options);\n }\n\n /**\n * @param template Mustache template string\n * @param data Data to inject into the template\n * @param options PDF generation options (optional)\n * @returns PDF generated from the provided Mustache template with data applied\n * @description This method generates a PDF from a Mustache template provided as a string. Mustache is a logic-less template language that emphasizes readable and simple templates. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.\n */\n generatePdfFromMustacheString(\n template: string,\n data: Record<string, unknown> = {},\n options?: PuppeteerParameters,\n ) {\n return this.puppeteerService.generatePdfFromMustacheString(\n template,\n data,\n options,\n );\n }\n\n /**\n * @param file Path to the Mustache template file\n * @param data Data to inject into the template\n * @param options PDF generation options (optional)\n * @returns PDF generated from the Mustache template at the provided file path with data applied\n * @description This method generates a PDF from a Mustache template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.\n */\n generatePdfFromMustacheFile(\n file: string,\n data: Record<string, unknown> = {},\n options?: PuppeteerParameters,\n ) {\n return this.puppeteerService.generatePdfFromMustacheFile(\n file,\n data,\n options,\n );\n }\n\n /**\n * @param pdf The PDF bytes to modify\n * @param fieldName The name of the signature field to add (default: 'SignatureDebtor')\n * @param anchorText The text anchor to locate the signature field position (default: '__SIG_DEBTOR_ANCHOR__')\n * @returns Modified PDF with a signature field added at the anchor position\n * @description This method adds a signature field to a PDF using a text anchor as a reference for the field position. It uses the `addSignatureFieldUsingAnchor` function which finds the anchor in the PDF and inserts a signature field at that location. The signature field is named according to the `fieldName` parameter and the anchor is defined by `anchorText`.\n *\n * Usage example:\n * ```typescript\n * const modifiedPdf = await pdfService.addSignatureFieldSignatureDebtorRaw(\n * originalPdfBytes,\n * 'SignatureDebtor',\n * '__SIG_DEBTOR_ANCHOR__'\n * );\n * ```\n *\n * In this example, `originalPdfBytes` is a byte array representing the original PDF, `SignatureDebtor` is the name of the signature field to add, and `__SIG_DEBTOR_ANCHOR__` is the anchor text used to position the signature field in the PDF.\n *\n * If the anchor is not found, the signature field will be added at a default position (centered at the bottom of the last page).\n *\n * Note: Ensure that the input PDF contains the anchor defined by `anchorText` for the signature field to be positioned correctly. Otherwise, it will be added at a default position.\n */\n async addSignatureFieldSignatureDebtorRaw(\n pdf: Uint8Array | Buffer,\n fieldName: string = 'SignatureDebtor',\n anchorText: string = '__SIG_DEBTOR_ANCHOR__',\n ) {\n return await addSignatureFieldUsingAnchor(pdf, fieldName, anchorText);\n }\n}\n","'use strict'\n\nfunction _resolveEscapeSequences (value) {\n return value.replace(/\\\\\\$/g, '$')\n}\n\nfunction expandValue (value, processEnv, runningParsed) {\n const env = { ...runningParsed, ...processEnv } // process.env wins\n\n const regex = /(?<!\\\\)\\${([^{}]+)}|(?<!\\\\)\\$([A-Za-z_][A-Za-z0-9_]*)/g\n\n let result = value\n let match\n const seen = new Set() // self-referential checker\n\n while ((match = regex.exec(result)) !== null) {\n seen.add(result)\n\n const [template, bracedExpression, unbracedExpression] = match\n const expression = bracedExpression || unbracedExpression\n\n // match the operators `:+`, `+`, `:-`, and `-`\n const opRegex = /(:\\+|\\+|:-|-)/\n // find first match\n const opMatch = expression.match(opRegex)\n const splitter = opMatch ? opMatch[0] : null\n\n const r = expression.split(splitter)\n\n let defaultValue\n let value\n\n const key = r.shift()\n\n if ([':+', '+'].includes(splitter)) {\n defaultValue = env[key] ? r.join(splitter) : ''\n value = null\n } else {\n defaultValue = r.join(splitter)\n value = env[key]\n }\n\n if (value) {\n // self-referential check\n if (seen.has(value)) {\n result = result.replace(template, defaultValue)\n } else {\n result = result.replace(template, value)\n }\n } else {\n result = result.replace(template, defaultValue)\n }\n\n // if the result equaled what was in process.env and runningParsed then stop expanding\n if (result === runningParsed[key]) {\n break\n }\n\n regex.lastIndex = 0 // reset regex search position to re-evaluate after each replacement\n }\n\n return result\n}\n\nfunction expand (options) {\n // for use with progressive expansion\n const runningParsed = {}\n\n let processEnv = process.env\n if (options && options.processEnv != null) {\n processEnv = options.processEnv\n }\n\n // dotenv.config() ran before this so the assumption is process.env has already been set\n for (const key in options.parsed) {\n let value = options.parsed[key]\n\n // short-circuit scenario: process.env was already set prior to the file value\n if (processEnv[key] && processEnv[key] !== value) {\n value = processEnv[key]\n } else {\n value = expandValue(value, processEnv, runningParsed)\n }\n\n options.parsed[key] = _resolveEscapeSequences(value)\n\n // for use with progressive expansion\n runningParsed[key] = _resolveEscapeSequences(value)\n }\n\n for (const processKey in options.parsed) {\n processEnv[processKey] = options.parsed[processKey]\n }\n\n return options\n}\n\nmodule.exports.expand = expand\n","/**\n * Injection tokens\n */\nexport const CONFIGURATION_SERVICE_TOKEN = Symbol('CONFIG_SERVICE');\nexport const CONFIGURATION_TOKEN = 'CONFIGURATION_TOKEN';\nexport const CONFIGURATION_LOADER = 'CONFIGURATION_LOADER';\nexport const VALIDATED_ENV_LOADER = 'VALIDATED_ENV_LOADER';\nexport const PARTIAL_CONFIGURATION_KEY = 'PARTIAL_CONFIGURATION_KEY';\nexport const PARTIAL_CONFIGURATION_PROPNAME = 'KEY';\nexport const VALIDATED_ENV_PROPNAME = '_PROCESS_ENV_VALIDATED';\nexport const AS_PROVIDER_METHOD_KEY = 'asProvider';\n","//#region src/_internal/isUnsafeProperty.ts\n/**\n* Checks if a property key is unsafe to access or copy directly.\n*\n* This function is used in functions like `get`, `unset`, and `merge` to prevent\n* prototype pollution attacks by identifying `__proto__`, which modifies the object's\n* prototype chain. `constructor` and `prototype` stay accessible here because lodash\n* keeps reads of them unrestricted; write paths use `isUnsafeToWriteProperty` instead,\n* which also blocks those keys.\n*\n* @param key - The property key to check\n* @returns `true` if the property is unsafe to access directly, `false` otherwise\n* @internal\n*/\nfunction isUnsafeProperty(key) {\n\treturn key === \"__proto__\";\n}\n//#endregion\nexport { isUnsafeProperty };\n","//#region src/compat/_internal/isDeepKey.ts\n/** Matches any deep property path. Examples: `a.b`, `a[0]`, `a[\"b\"]` */\nconst regexIsDeepProp = /\\.|(\\[(?:[^[\\]]*|([\"'])(?:(?!\\2)[^\\\\]|\\\\.)*?\\2)\\])/;\n/**\n* Checks if a given key is a deep key.\n*\n* A deep key is a string that contains a dot (.) or square brackets with a property accessor.\n*\n* @param {PropertyKey} key - The key to check.\n* @returns {boolean} - Returns true if the key is a deep key, otherwise false.\n*\n* Examples:\n*\n* isDeepKey('a.b') // true\n* isDeepKey('a[b]') // true\n* isDeepKey('a') // false\n* isDeepKey(123) // false\n* isDeepKey('a.b.c') // true\n* isDeepKey('a[b][c]') // true\n* isDeepKey('a.') // false\n* isDeepKey('.a') // false\n* isDeepKey('a[b') // false\n* isDeepKey('a]b]') // false\n* isDeepKey('a][b') // false\n* isDeepKey('') // false\n* isDeepKey('a[0]') // true\n*\n*/\nfunction isDeepKey(key) {\n\tswitch (typeof key) {\n\t\tcase \"number\":\n\t\tcase \"symbol\": return false;\n\t\tcase \"string\":\n\t\t\tif (key === \"\" || key.startsWith(\".\") || key.endsWith(\".\")) return false;\n\t\t\treturn regexIsDeepProp.test(key);\n\t\tdefault: return false;\n\t}\n}\n//#endregion\nexport { isDeepKey };\n","//#region src/compat/_internal/toKey.ts\n/**\n* Converts `value` to a string key if it's not a string or symbol.\n*\n* @private\n* @param {unknown} value The value to inspect.\n* @returns {string|symbol} Returns the key.\n*/\nfunction toKey(value) {\n\tif (typeof value === \"string\" || typeof value === \"symbol\") return value;\n\tif (Object.is(value?.valueOf?.(), -0)) return \"-0\";\n\treturn String(value);\n}\n//#endregion\nexport { toKey };\n","//#region src/compat/util/toString.ts\n/**\n* Converts `value` to a string.\n*\n* An empty string is returned for `null` and `undefined` values.\n* The sign of `-0` is preserved.\n*\n* @param value - The value to convert.\n* @returns Returns the converted string.\n*\n* @example\n* toString(null) // returns ''\n* toString(undefined) // returns ''\n* toString(-0) // returns '-0'\n* toString([1, 2, -0]) // returns '1,2,-0'\n* toString([Symbol('a'), Symbol('b')]) // returns 'Symbol(a),Symbol(b)'\n*/\nfunction toString(value) {\n\tif (value == null) return \"\";\n\treturn baseToString(value);\n}\nfunction baseToString(value) {\n\tif (typeof value === \"string\") return value;\n\tif (Array.isArray(value)) return value.map(baseToString).join(\",\");\n\tconst result = String(value);\n\tif (result === \"0\" && Object.is(Number(value), -0)) return \"-0\";\n\treturn result;\n}\n//#endregion\nexport { toString };\n","import { toKey } from \"../_internal/toKey.mjs\";\nimport { toString } from \"./toString.mjs\";\n//#region src/compat/util/toPath.ts\n/**\n* Converts a deep key string into an array of path segments.\n*\n* This function takes a string representing a deep key (e.g., 'a.b.c' or 'a[b][c]') and breaks it down into an array of strings, each representing a segment of the path.\n*\n* @param deepKey - The deep key string to convert.\n* @returns An array of strings, each representing a segment of the path.\n*\n* Examples:\n*\n* toPath('a.b.c') // Returns ['a', 'b', 'c']\n* toPath('a[b][c]') // Returns ['a', 'b', 'c']\n* toPath('.a.b.c') // Returns ['', 'a', 'b', 'c']\n* toPath('a[\"b.c\"].d') // Returns ['a', 'b.c', 'd']\n* toPath('') // Returns []\n* toPath('.a[b].c.d[e][\"f.g\"].h') // Returns ['', 'a', 'b', 'c', 'd', 'e', 'f.g', 'h']\n*/\nfunction toPath(deepKey) {\n\tif (Array.isArray(deepKey)) return deepKey.map(toKey);\n\tif (typeof deepKey === \"symbol\") return [deepKey];\n\tdeepKey = toString(deepKey);\n\tconst result = [];\n\tconst length = deepKey.length;\n\tif (length === 0) return result;\n\tlet index = 0;\n\tlet key = \"\";\n\tlet quoteChar = \"\";\n\tlet bracket = false;\n\tlet bracketHadQuote = false;\n\tconst bracketNumberRegex = /^-?\\d+(?:\\.\\d+)?$/;\n\tif (deepKey.charCodeAt(0) === 46) result.push(\"\");\n\twhile (index < length) {\n\t\tconst char = deepKey[index];\n\t\tif (quoteChar) if (char === \"\\\\\" && index + 1 < length) {\n\t\t\tindex++;\n\t\t\tkey += deepKey[index];\n\t\t} else if (char === quoteChar) quoteChar = \"\";\n\t\telse key += char;\n\t\telse if (bracket) if (char === \"\\\"\" || char === \"'\") {\n\t\t\tquoteChar = char;\n\t\t\tbracketHadQuote = true;\n\t\t} else if (char === \"]\") {\n\t\t\tbracket = false;\n\t\t\tif (!bracketHadQuote && key.includes(\".\") && !bracketNumberRegex.test(key)) {\n\t\t\t\tconst segments = key.split(\".\");\n\t\t\t\tfor (let i = 0; i < segments.length; i++) if (segments[i] !== \"\") result.push(segments[i]);\n\t\t\t} else result.push(key);\n\t\t\tkey = \"\";\n\t\t} else key += char;\n\t\telse if (char === \"[\") {\n\t\t\tbracket = true;\n\t\t\tbracketHadQuote = false;\n\t\t\tif (key) {\n\t\t\t\tresult.push(key);\n\t\t\t\tkey = \"\";\n\t\t\t}\n\t\t} else if (char === \".\") {\n\t\t\tif (key) {\n\t\t\t\tresult.push(key);\n\t\t\t\tkey = \"\";\n\t\t\t}\n\t\t\tconst next = deepKey[index + 1];\n\t\t\tif (next === void 0 || next === \".\") result.push(\"\");\n\t\t} else key += char;\n\t\tindex++;\n\t}\n\tif (key) result.push(key);\n\treturn result;\n}\n//#endregion\nexport { toPath };\n","import { isUnsafeProperty } from \"../../_internal/isUnsafeProperty.mjs\";\nimport { isDeepKey } from \"../_internal/isDeepKey.mjs\";\nimport { toKey } from \"../_internal/toKey.mjs\";\nimport { toPath } from \"../util/toPath.mjs\";\n//#region src/compat/object/get.ts\n/**\n* Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.\n*\n* @param object - The object to query.\n* @param path - The path of the property to get.\n* @param [defaultValue] - The value returned if the resolved value is undefined.\n* @returns Returns the resolved value.\n*\n* @example\n* const object = { a: { b: { c: 1 } } };\n* get(object, 'a.b.c');\n* // => 1\n*\n* get(object, ['a', 'b', 'c']);\n* // => 1\n*\n* get(object, 'a.b.d', 'default');\n* // => 'default'\n*/\nfunction get(object, path, defaultValue) {\n\tif (object == null) return defaultValue;\n\tswitch (typeof path) {\n\t\tcase \"string\": {\n\t\t\tif (isUnsafeProperty(path)) return defaultValue;\n\t\t\tconst result = object[path];\n\t\t\tif (result === void 0) if (isDeepKey(path) && !Object.hasOwn(object, path)) return get(object, toPath(path), defaultValue);\n\t\t\telse return defaultValue;\n\t\t\treturn result;\n\t\t}\n\t\tcase \"number\":\n\t\tcase \"symbol\": {\n\t\t\tif (typeof path === \"number\") path = toKey(path);\n\t\t\tconst result = object[path];\n\t\t\tif (result === void 0) return defaultValue;\n\t\t\treturn result;\n\t\t}\n\t\tdefault: {\n\t\t\tif (Array.isArray(path)) return getWithPath(object, path, defaultValue);\n\t\t\tif (Object.is(path?.valueOf(), -0)) path = \"-0\";\n\t\t\telse path = String(path);\n\t\t\tif (isUnsafeProperty(path)) return defaultValue;\n\t\t\tconst result = object[path];\n\t\t\tif (result === void 0) return defaultValue;\n\t\t\treturn result;\n\t\t}\n\t}\n}\nfunction getWithPath(object, path, defaultValue) {\n\tif (path.length === 0) return defaultValue;\n\tlet current = object;\n\tfor (let index = 0; index < path.length; index++) {\n\t\tif (current == null) return defaultValue;\n\t\tif (isUnsafeProperty(path[index])) return defaultValue;\n\t\tcurrent = current[path[index]];\n\t}\n\tif (current === void 0) return defaultValue;\n\treturn current;\n}\n//#endregion\nexport { get };\n","//#region src/compat/_internal/isIndex.ts\nconst IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\\d*)$/;\nfunction isIndex(value, length = Number.MAX_SAFE_INTEGER) {\n\tswitch (typeof value) {\n\t\tcase \"number\": return Number.isInteger(value) && value >= 0 && value < length;\n\t\tcase \"symbol\": return false;\n\t\tcase \"string\": return IS_UNSIGNED_INTEGER.test(value);\n\t}\n}\n//#endregion\nexport { isIndex };\n","//#region src/compat/_internal/getTag.ts\n/**\n* Gets the `toStringTag` of `value`.\n*\n* @private\n* @param {T} value The value to query.\n* @returns {string} Returns the `Object.prototype.toString.call` result.\n*/\nfunction getTag(value) {\n\tif (value == null) return value === void 0 ? \"[object Undefined]\" : \"[object Null]\";\n\treturn Object.prototype.toString.call(value);\n}\n//#endregion\nexport { getTag };\n","import { getTag } from \"../_internal/getTag.mjs\";\n//#region src/compat/predicate/isArguments.ts\n/**\n* Checks if the given value is an arguments object.\n*\n* This function tests whether the provided value is an arguments object or not.\n* It returns `true` if the value is an arguments object, and `false` otherwise.\n*\n* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an arguments object.\n*\n* @param value - The value to test if it is an arguments object.\n* @returns `true` if the value is an arguments, `false` otherwise.\n*\n* @example\n* const args = (function() { return arguments; })();\n* const strictArgs = (function() { 'use strict'; return arguments; })();\n* const value = [1, 2, 3];\n*\n* console.log(isArguments(args)); // true\n* console.log(isArguments(strictArgs)); // true\n* console.log(isArguments(value)); // false\n*/\nfunction isArguments(value) {\n\treturn value !== null && typeof value === \"object\" && getTag(value) === \"[object Arguments]\";\n}\n//#endregion\nexport { isArguments };\n","import { isDeepKey } from \"../_internal/isDeepKey.mjs\";\nimport { toPath } from \"../util/toPath.mjs\";\nimport { isIndex } from \"../_internal/isIndex.mjs\";\nimport { isArguments } from \"../predicate/isArguments.mjs\";\n//#region src/compat/object/has.ts\n/**\n* Checks if a given path exists within an object.\n*\n* You can provide the path as a single property key, an array of property keys,\n* or a string representing a deep path.\n*\n* If the path is an index and the object is an array or an arguments object, the function will verify\n* if the index is valid and within the bounds of the array or arguments object, even if the array or\n* arguments object is sparse (i.e., not all indexes are defined).\n*\n* @param object - The object to query.\n* @param path - The path to check. This can be a single property key,\n* an array of property keys, or a string representing a deep path.\n* @returns Returns `true` if the path exists in the object, `false` otherwise.\n*\n* @example\n*\n* const obj = { a: { b: { c: 3 } } };\n*\n* has(obj, 'a'); // true\n* has(obj, ['a', 'b']); // true\n* has(obj, ['a', 'b', 'c']); // true\n* has(obj, 'a.b.c'); // true\n* has(obj, 'a.b.d'); // false\n* has(obj, ['a', 'b', 'c', 'd']); // false\n* has([], 0); // false\n* has([1, 2, 3], 2); // true\n* has([1, 2, 3], 5); // false\n*/\nfunction has(object, path) {\n\tlet resolvedPath;\n\tif (Array.isArray(path)) resolvedPath = path;\n\telse if (typeof path === \"string\" && isDeepKey(path) && !(path in Object(object))) resolvedPath = toPath(path);\n\telse resolvedPath = [path];\n\tif (resolvedPath.length === 0) return false;\n\tlet current = object;\n\tfor (let i = 0; i < resolvedPath.length; i++) {\n\t\tconst key = resolvedPath[i];\n\t\tif (current == null || !Object.hasOwn(current, key)) {\n\t\t\tif (!((Array.isArray(current) || isArguments(current)) && isIndex(key) && key < current.length)) return false;\n\t\t}\n\t\tcurrent = current[key];\n\t}\n\treturn true;\n}\n//#endregion\nexport { has };\n","//#region src/compat/predicate/isObject.ts\n/**\n* Checks if the given value is an object. An object is a value that is\n* not a primitive type (string, number, boolean, symbol, null, or undefined).\n*\n* This function tests whether the provided value is an object or not.\n* It returns `true` if the value is an object, and `false` otherwise.\n*\n* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an object value.\n*\n* @param value - The value to check if it is an object.\n* @returns `true` if the value is an object, `false` otherwise.\n*\n* @example\n* const value1 = {};\n* const value2 = [1, 2, 3];\n* const value3 = () => {};\n* const value4 = null;\n*\n* console.log(isObject(value1)); // true\n* console.log(isObject(value2)); // true\n* console.log(isObject(value3)); // true\n* console.log(isObject(value4)); // false\n*/\nfunction isObject(value) {\n\treturn value !== null && (typeof value === \"object\" || typeof value === \"function\");\n}\n//#endregion\nexport { isObject };\n","//#region src/compat/predicate/isSymbol.ts\n/**\n* Check whether a value is a symbol.\n*\n* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `symbol`.\n*\n* @param value The value to check.\n* @returns Returns `true` if `value` is a symbol, else `false`.\n* @example\n* isSymbol(Symbol.iterator);\n* // => true\n*\n* isSymbol('abc');\n* // => false\n*/\nfunction isSymbol(value) {\n\treturn typeof value === \"symbol\" || value instanceof Symbol;\n}\n//#endregion\nexport { isSymbol };\n","import { isSymbol } from \"../predicate/isSymbol.mjs\";\n//#region src/compat/_internal/isKey.ts\n/** Matches any deep property path. (e.g. `a.b[0].c`)*/\nconst regexIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/;\n/** Matches any word character (alphanumeric & underscore).*/\nconst regexIsPlainProp = /^\\w*$/;\n/**\n* Checks if `value` is a property name and not a property path. (It's ok that the `value` is not in the keys of the `object`)\n* @param {unknown} value The value to check.\n* @param {unknown} object The object to query.\n* @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n*\n* @example\n* isKey('a', { a: 1 });\n* // => true\n*\n* isKey('a.b', { a: { b: 2 } });\n* // => false\n*/\nfunction isKey(value, object) {\n\tif (Array.isArray(value)) return false;\n\tif (typeof value === \"number\" || typeof value === \"boolean\" || value == null || isSymbol(value)) return true;\n\treturn typeof value === \"string\" && (regexIsPlainProp.test(value) || !regexIsDeepProp.test(value)) || object != null && Object.hasOwn(object, value);\n}\n//#endregion\nexport { isKey };\n","//#region src/compat/util/eq.ts\n/**\n* Performs a `SameValueZero` comparison between two values to determine if they are equivalent.\n*\n* @param value The value to compare.\n* @param other The other value to compare.\n* @returns Returns `true` if the values are equivalent, else `false`.\n*\n* @example\n* eq(1, 1); // true\n* eq(0, -0); // true\n* eq(NaN, NaN); // true\n* eq('a', Object('a')); // false\n*/\nfunction eq(value, other) {\n\treturn value === other || Number.isNaN(value) && Number.isNaN(other);\n}\n//#endregion\nexport { eq };\n","import { eq } from \"../util/eq.mjs\";\n//#region src/compat/_internal/assignValue.ts\nconst assignValue = (object, key, value) => {\n\tconst objValue = object[key];\n\tif (!(Object.hasOwn(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) object[key] = value;\n};\n//#endregion\nexport { assignValue };\n","//#region src/_internal/isUnsafeToWriteProperty.ts\n/**\n* Checks if a property key is unsafe to write to.\n*\n* Writing through `__proto__`, `constructor`, or `prototype` can reach\n* `Object.prototype` and pollute every object, so write paths like `set`,\n* `update`, and `zipObjectDeep` abort when a path segment matches one of\n* these keys, matching lodash's behavior.\n*\n* Read paths like `get` and `unset` use `isUnsafeProperty` instead, which\n* only blocks `__proto__`; lodash keeps reads of `constructor` and\n* `prototype` unrestricted.\n*\n* @param key - The property key to check\n* @returns `true` if the property is unsafe to write to, `false` otherwise\n* @internal\n*/\nfunction isUnsafeToWriteProperty(key) {\n\treturn key === \"__proto__\" || key === \"constructor\" || key === \"prototype\";\n}\n//#endregion\nexport { isUnsafeToWriteProperty };\n","import { toKey } from \"../_internal/toKey.mjs\";\nimport { toPath } from \"../util/toPath.mjs\";\nimport { get } from \"./get.mjs\";\nimport { isObject } from \"../predicate/isObject.mjs\";\nimport { isIndex } from \"../_internal/isIndex.mjs\";\nimport { isKey } from \"../_internal/isKey.mjs\";\nimport { assignValue } from \"../_internal/assignValue.mjs\";\nimport { isUnsafeToWriteProperty } from \"../../_internal/isUnsafeToWriteProperty.mjs\";\n//#region src/compat/object/updateWith.ts\n/**\n* Updates the value at the specified path of the given object using an updater function and a customizer.\n* If any part of the path does not exist, it will be created.\n*\n* @template T - The type of the object.\n* @template R - The type of the return value.\n* @param obj - The object to modify.\n* @param path - The path of the property to update.\n* @param updater - The function to produce the updated value.\n* @param customizer - The function to customize the update process.\n* @returns The modified object.\n*\n* @example\n* const object = { 'a': [{ 'b': { 'c': 3 } }] };\n* updateWith(object, 'a[0].b.c', (n) => n * n);\n* // => { 'a': [{ 'b': { 'c': 9 } }] }\n*/\nfunction updateWith(obj, path, updater, customizer) {\n\tif (obj == null && !isObject(obj)) return obj;\n\tlet resolvedPath;\n\tif (isKey(path, obj)) resolvedPath = [path];\n\telse if (Array.isArray(path)) resolvedPath = path;\n\telse resolvedPath = toPath(path);\n\tconst updateValue = updater(get(obj, resolvedPath));\n\tlet current = obj;\n\tfor (let i = 0; i < resolvedPath.length && current != null; i++) {\n\t\tconst key = toKey(resolvedPath[i]);\n\t\tif (isUnsafeToWriteProperty(key)) return obj;\n\t\tlet newValue;\n\t\tif (i === resolvedPath.length - 1) newValue = updateValue;\n\t\telse {\n\t\t\tconst objValue = current[key];\n\t\t\tconst customizerResult = customizer?.(objValue, key, obj);\n\t\t\tnewValue = customizerResult !== void 0 ? customizerResult : isObject(objValue) ? objValue : isIndex(resolvedPath[i + 1]) ? [] : {};\n\t\t}\n\t\tassignValue(current, key, newValue);\n\t\tcurrent = current[key];\n\t}\n\treturn obj;\n}\n//#endregion\nexport { updateWith };\n","import { updateWith } from \"./updateWith.mjs\";\n//#region src/compat/object/set.ts\n/**\n* Sets the value at the specified path of the given object. If any part of the path does not exist, it will be created.\n*\n* @template T - The type of the object.\n* @param obj - The object to modify.\n* @param path - The path of the property to set.\n* @param value - The value to set.\n* @returns The modified object.\n*\n* @example\n* // Set a value in a nested object\n* const obj = { a: { b: { c: 3 } } };\n* set(obj, 'a.b.c', 4);\n* console.log(obj.a.b.c); // 4\n*\n* @example\n* // Set a value in an array\n* const arr = [1, 2, 3];\n* set(arr, 1, 4);\n* console.log(arr[1]); // 4\n*\n* @example\n* // Create non-existent path and set value\n* const obj = {};\n* set(obj, 'a.b.c', 4);\n* console.log(obj); // { a: { b: { c: 4 } } }\n*/\nfunction set(obj, path, value) {\n\treturn updateWith(obj, path, () => value, () => void 0);\n}\n//#endregion\nexport { set };\n","/**\n * @publicApi\n */\nexport function getConfigToken(token) {\n return `CONFIGURATION(${token.toString()})`;\n}\n","const fs = require('fs')\nconst path = require('path')\nconst os = require('os')\nconst crypto = require('crypto')\n\n// Array of tips to display randomly\nconst TIPS = [\n '◈ encrypted .env [www.dotenvx.com]',\n '◈ secrets for agents [www.dotenvx.com]',\n '⌁ auth for agents [www.vestauth.com]',\n '⌘ custom filepath { path: \\'/custom/path/.env\\' }',\n '⌘ enable debugging { debug: true }',\n '⌘ override existing { override: true }',\n '⌘ suppress logs { quiet: true }',\n '⌘ multiple files { path: [\\'.env.local\\', \\'.env\\'] }'\n]\n\n// Get a random tip from the tips array\nfunction _getRandomTip () {\n return TIPS[Math.floor(Math.random() * TIPS.length)]\n}\n\nfunction parseBoolean (value) {\n if (typeof value === 'string') {\n return !['false', '0', 'no', 'off', ''].includes(value.toLowerCase())\n }\n return Boolean(value)\n}\n\nfunction supportsAnsi () {\n return process.stdout.isTTY // && process.env.TERM !== 'dumb'\n}\n\nfunction dim (text) {\n return supportsAnsi() ? `\\x1b[2m${text}\\x1b[0m` : text\n}\n\nconst LINE = /(?:^|^)\\s*(?:export\\s+)?([\\w.-]+)(?:\\s*=\\s*?|:\\s+?)(\\s*'(?:\\\\'|[^'])*'|\\s*\"(?:\\\\\"|[^\"])*\"|\\s*`(?:\\\\`|[^`])*`|[^#\\r\\n]+)?\\s*(?:#.*)?(?:$|$)/mg\n\n// Parse src into an Object\nfunction parse (src) {\n const obj = {}\n\n // Convert buffer to string\n let lines = src.toString()\n\n // Convert line breaks to same format\n lines = lines.replace(/\\r\\n?/mg, '\\n')\n\n let match\n while ((match = LINE.exec(lines)) != null) {\n const key = match[1]\n\n // Default undefined or null to empty string\n let value = (match[2] || '')\n\n // Remove whitespace\n value = value.trim()\n\n // Check if double quoted\n const maybeQuote = value[0]\n\n // Remove surrounding quotes\n value = value.replace(/^(['\"`])([\\s\\S]*)\\1$/mg, '$2')\n\n // Expand newlines if double quoted\n if (maybeQuote === '\"') {\n value = value.replace(/\\\\n/g, '\\n')\n value = value.replace(/\\\\r/g, '\\r')\n }\n\n // Add to object\n obj[key] = value\n }\n\n return obj\n}\n\nfunction _parseVault (options) {\n options = options || {}\n\n const vaultPath = _vaultPath(options)\n options.path = vaultPath // parse .env.vault\n const result = DotenvModule.configDotenv(options)\n if (!result.parsed) {\n const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`)\n err.code = 'MISSING_DATA'\n throw err\n }\n\n // handle scenario for comma separated keys - for use with key rotation\n // example: DOTENV_KEY=\"dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=prod,dotenv://:key_7890@dotenvx.com/vault/.env.vault?environment=prod\"\n const keys = _dotenvKey(options).split(',')\n const length = keys.length\n\n let decrypted\n for (let i = 0; i < length; i++) {\n try {\n // Get full key\n const key = keys[i].trim()\n\n // Get instructions for decrypt\n const attrs = _instructions(result, key)\n\n // Decrypt\n decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key)\n\n break\n } catch (error) {\n // last key\n if (i + 1 >= length) {\n throw error\n }\n // try next key\n }\n }\n\n // Parse decrypted .env string\n return DotenvModule.parse(decrypted)\n}\n\nfunction _warn (message) {\n console.error(`⚠ ${message}`)\n}\n\nfunction _debug (message) {\n console.log(`┆ ${message}`)\n}\n\nfunction _log (message) {\n console.log(`◇ ${message}`)\n}\n\nfunction _dotenvKey (options) {\n // prioritize developer directly setting options.DOTENV_KEY\n if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {\n return options.DOTENV_KEY\n }\n\n // secondary infra already contains a DOTENV_KEY environment variable\n if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {\n return process.env.DOTENV_KEY\n }\n\n // fallback to empty string\n return ''\n}\n\nfunction _instructions (result, dotenvKey) {\n // Parse DOTENV_KEY. Format is a URI\n let uri\n try {\n uri = new URL(dotenvKey)\n } catch (error) {\n if (error.code === 'ERR_INVALID_URL') {\n const err = new Error('INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development')\n err.code = 'INVALID_DOTENV_KEY'\n throw err\n }\n\n throw error\n }\n\n // Get decrypt key\n const key = uri.password\n if (!key) {\n const err = new Error('INVALID_DOTENV_KEY: Missing key part')\n err.code = 'INVALID_DOTENV_KEY'\n throw err\n }\n\n // Get environment\n const environment = uri.searchParams.get('environment')\n if (!environment) {\n const err = new Error('INVALID_DOTENV_KEY: Missing environment part')\n err.code = 'INVALID_DOTENV_KEY'\n throw err\n }\n\n // Get ciphertext payload\n const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`\n const ciphertext = result.parsed[environmentKey] // DOTENV_VAULT_PRODUCTION\n if (!ciphertext) {\n const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`)\n err.code = 'NOT_FOUND_DOTENV_ENVIRONMENT'\n throw err\n }\n\n return { ciphertext, key }\n}\n\nfunction _vaultPath (options) {\n let possibleVaultPath = null\n\n if (options && options.path && options.path.length > 0) {\n if (Array.isArray(options.path)) {\n for (const filepath of options.path) {\n if (fs.existsSync(filepath)) {\n possibleVaultPath = filepath.endsWith('.vault') ? filepath : `${filepath}.vault`\n }\n }\n } else {\n possibleVaultPath = options.path.endsWith('.vault') ? options.path : `${options.path}.vault`\n }\n } else {\n possibleVaultPath = path.resolve(process.cwd(), '.env.vault')\n }\n\n if (fs.existsSync(possibleVaultPath)) {\n return possibleVaultPath\n }\n\n return null\n}\n\nfunction _resolveHome (envPath) {\n return envPath[0] === '~' ? path.join(os.homedir(), envPath.slice(1)) : envPath\n}\n\nfunction _configVault (options) {\n const debug = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || (options && options.debug))\n const quiet = parseBoolean(process.env.DOTENV_CONFIG_QUIET || (options && options.quiet))\n\n if (debug || !quiet) {\n _log('loading env from encrypted .env.vault')\n }\n\n const parsed = DotenvModule._parseVault(options)\n\n let processEnv = process.env\n if (options && options.processEnv != null) {\n processEnv = options.processEnv\n }\n\n DotenvModule.populate(processEnv, parsed, options)\n\n return { parsed }\n}\n\nfunction configDotenv (options) {\n const dotenvPath = path.resolve(process.cwd(), '.env')\n let encoding = 'utf8'\n let processEnv = process.env\n if (options && options.processEnv != null) {\n processEnv = options.processEnv\n }\n let debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || (options && options.debug))\n let quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || (options && options.quiet))\n\n if (options && options.encoding) {\n encoding = options.encoding\n } else {\n if (debug) {\n _debug('no encoding is specified (UTF-8 is used by default)')\n }\n }\n\n let optionPaths = [dotenvPath] // default, look for .env\n if (options && options.path) {\n if (!Array.isArray(options.path)) {\n optionPaths = [_resolveHome(options.path)]\n } else {\n optionPaths = [] // reset default\n for (const filepath of options.path) {\n optionPaths.push(_resolveHome(filepath))\n }\n }\n }\n\n // Build the parsed data in a temporary object (because we need to return it). Once we have the final\n // parsed data, we will combine it with process.env (or options.processEnv if provided).\n let lastError\n const parsedAll = {}\n for (const path of optionPaths) {\n try {\n // Specifying an encoding returns a string instead of a buffer\n const parsed = DotenvModule.parse(fs.readFileSync(path, { encoding }))\n\n DotenvModule.populate(parsedAll, parsed, options)\n } catch (e) {\n if (debug) {\n _debug(`failed to load ${path} ${e.message}`)\n }\n lastError = e\n }\n }\n\n const populated = DotenvModule.populate(processEnv, parsedAll, options)\n\n // handle user settings DOTENV_CONFIG_ options inside .env file(s)\n debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || debug)\n quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || quiet)\n\n if (debug || !quiet) {\n const keysCount = Object.keys(populated).length\n const shortPaths = []\n for (const filePath of optionPaths) {\n try {\n const relative = path.relative(process.cwd(), filePath)\n shortPaths.push(relative)\n } catch (e) {\n if (debug) {\n _debug(`failed to load ${filePath} ${e.message}`)\n }\n lastError = e\n }\n }\n\n _log(`injected env (${keysCount}) from ${shortPaths.join(',')} ${dim(`// tip: ${_getRandomTip()}`)}`)\n }\n\n if (lastError) {\n return { parsed: parsedAll, error: lastError }\n } else {\n return { parsed: parsedAll }\n }\n}\n\n// Populates process.env from .env file\nfunction config (options) {\n // fallback to original dotenv if DOTENV_KEY is not set\n if (_dotenvKey(options).length === 0) {\n return DotenvModule.configDotenv(options)\n }\n\n const vaultPath = _vaultPath(options)\n\n // dotenvKey exists but .env.vault file does not exist\n if (!vaultPath) {\n _warn(`you set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}`)\n\n return DotenvModule.configDotenv(options)\n }\n\n return DotenvModule._configVault(options)\n}\n\nfunction decrypt (encrypted, keyStr) {\n const key = Buffer.from(keyStr.slice(-64), 'hex')\n let ciphertext = Buffer.from(encrypted, 'base64')\n\n const nonce = ciphertext.subarray(0, 12)\n const authTag = ciphertext.subarray(-16)\n ciphertext = ciphertext.subarray(12, -16)\n\n try {\n const aesgcm = crypto.createDecipheriv('aes-256-gcm', key, nonce)\n aesgcm.setAuthTag(authTag)\n return `${aesgcm.update(ciphertext)}${aesgcm.final()}`\n } catch (error) {\n const isRange = error instanceof RangeError\n const invalidKeyLength = error.message === 'Invalid key length'\n const decryptionFailed = error.message === 'Unsupported state or unable to authenticate data'\n\n if (isRange || invalidKeyLength) {\n const err = new Error('INVALID_DOTENV_KEY: It must be 64 characters long (or more)')\n err.code = 'INVALID_DOTENV_KEY'\n throw err\n } else if (decryptionFailed) {\n const err = new Error('DECRYPTION_FAILED: Please check your DOTENV_KEY')\n err.code = 'DECRYPTION_FAILED'\n throw err\n } else {\n throw error\n }\n }\n}\n\n// Populate process.env with parsed values\nfunction populate (processEnv, parsed, options = {}) {\n const debug = Boolean(options && options.debug)\n const override = Boolean(options && options.override)\n const populated = {}\n\n if (typeof parsed !== 'object') {\n const err = new Error('OBJECT_REQUIRED: Please check the processEnv argument being passed to populate')\n err.code = 'OBJECT_REQUIRED'\n throw err\n }\n\n // Set process.env\n for (const key of Object.keys(parsed)) {\n if (Object.prototype.hasOwnProperty.call(processEnv, key)) {\n if (override === true) {\n processEnv[key] = parsed[key]\n populated[key] = parsed[key]\n }\n\n if (debug) {\n if (override === true) {\n _debug(`\"${key}\" is already defined and WAS overwritten`)\n } else {\n _debug(`\"${key}\" is already defined and was NOT overwritten`)\n }\n }\n } else {\n processEnv[key] = parsed[key]\n populated[key] = parsed[key]\n }\n }\n\n return populated\n}\n\nconst DotenvModule = {\n configDotenv,\n _configVault,\n _parseVault,\n config,\n decrypt,\n parse,\n populate\n}\n\nmodule.exports.configDotenv = DotenvModule.configDotenv\nmodule.exports._configVault = DotenvModule._configVault\nmodule.exports._parseVault = DotenvModule._parseVault\nmodule.exports.config = DotenvModule.config\nmodule.exports.decrypt = DotenvModule.decrypt\nmodule.exports.parse = DotenvModule.parse\nmodule.exports.populate = DotenvModule.populate\n\nmodule.exports = DotenvModule\n","import * as dotenv from 'dotenv';\nexport const getDefaultParser = () => dotenv.parse;\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nimport { Inject, Injectable, Optional } from '@nestjs/common';\nimport { isUndefined } from '@nestjs/common/utils/shared.utils.js';\nimport get from 'es-toolkit/compat/get';\nimport has from 'es-toolkit/compat/has';\nimport set from 'es-toolkit/compat/set';\nimport fs from 'fs';\nimport { Subject } from 'rxjs';\nimport { CONFIGURATION_TOKEN, VALIDATED_ENV_PROPNAME, } from './config.constants.js';\nimport { getDefaultParser } from './utils/index.js';\n/**\n * @publicApi\n */\nlet ConfigService = class ConfigService {\n set isCacheEnabled(value) {\n this._isCacheEnabled = value;\n }\n get isCacheEnabled() {\n return this._isCacheEnabled;\n }\n set skipProcessEnv(value) {\n this._skipProcessEnv = value;\n }\n get skipProcessEnv() {\n return this._skipProcessEnv;\n }\n constructor(internalConfig = {}) {\n this.internalConfig = internalConfig;\n this.cache = {};\n this._changes$ = new Subject();\n this._skipProcessEnv = false;\n this._isCacheEnabled = false;\n this.envFilePaths = [];\n this.parser = getDefaultParser();\n }\n /**\n * Returns a stream of configuration changes.\n * Each event contains the attribute path, the old value and the new value.\n */\n get changes$() {\n return this._changes$.asObservable();\n }\n /**\n * Get a configuration value (either custom configuration or process environment variable)\n * based on property path (you can use dot notation to traverse nested object, e.g. \"database.host\").\n * It returns a default value if the key does not exist.\n * @param propertyPath\n * @param defaultValueOrOptions\n */\n get(propertyPath, defaultValueOrOptions, options) {\n const internalValue = this.getFromInternalConfig(propertyPath);\n if (!isUndefined(internalValue)) {\n return internalValue;\n }\n const validatedEnvValue = this.getFromValidatedEnv(propertyPath);\n if (!isUndefined(validatedEnvValue)) {\n return validatedEnvValue;\n }\n const defaultValue = this.isGetOptionsObject(defaultValueOrOptions) &&\n !options\n ? undefined\n : defaultValueOrOptions;\n if (!this._skipProcessEnv) {\n const processEnvValue = this.getFromProcessEnv(propertyPath, defaultValue);\n if (!isUndefined(processEnvValue)) {\n return processEnvValue;\n }\n }\n return defaultValue;\n }\n /**\n * Get a configuration value (either custom configuration or process environment variable)\n * based on property path (you can use dot notation to traverse nested object, e.g. \"database.host\").\n * It returns a default value if the key does not exist.\n * If the default value is undefined an exception will be thrown.\n * @param propertyPath\n * @param defaultValueOrOptions\n */\n getOrThrow(propertyPath, defaultValueOrOptions, options) {\n // @ts-expect-error Bypass method overloads\n const value = this.get(propertyPath, defaultValueOrOptions, options);\n if (isUndefined(value)) {\n throw new TypeError(`Configuration key \"${propertyPath.toString()}\" does not exist`);\n }\n return value;\n }\n /**\n * Sets a configuration value based on property path.\n * @param propertyPath\n * @param value\n */\n set(propertyPath, value) {\n const oldValue = this.get(propertyPath);\n set(this.internalConfig, propertyPath, value);\n if (typeof propertyPath === 'string') {\n process.env[propertyPath] = String(value);\n this.updateInterpolatedEnv(propertyPath, String(value));\n }\n if (this.isCacheEnabled) {\n this.setInCacheIfDefined(propertyPath, value);\n }\n this._changes$.next({\n path: propertyPath,\n oldValue,\n newValue: value,\n });\n }\n /**\n * Sets env file paths from `config.module.ts` to parse.\n * @param paths\n */\n setEnvFilePaths(paths) {\n this.envFilePaths = paths;\n }\n /**\n * Sets parser from `config.module.ts`.\n * @param parser\n */\n setParser(parser) {\n this.parser = parser;\n }\n getFromCache(propertyPath, defaultValue) {\n const cachedValue = get(this.cache, propertyPath);\n return isUndefined(cachedValue)\n ? defaultValue\n : cachedValue;\n }\n getFromValidatedEnv(propertyPath) {\n const validatedEnvValue = get(this.internalConfig[VALIDATED_ENV_PROPNAME], propertyPath);\n return validatedEnvValue;\n }\n getFromProcessEnv(propertyPath, defaultValue) {\n if (this.isCacheEnabled &&\n has(this.cache, propertyPath)) {\n const cachedValue = this.getFromCache(propertyPath, defaultValue);\n return !isUndefined(cachedValue) ? cachedValue : defaultValue;\n }\n const processValue = get(process.env, propertyPath);\n this.setInCacheIfDefined(propertyPath, processValue);\n return processValue;\n }\n getFromInternalConfig(propertyPath) {\n const internalValue = get(this.internalConfig, propertyPath);\n return internalValue;\n }\n setInCacheIfDefined(propertyPath, value) {\n if (typeof value === 'undefined') {\n return;\n }\n set(this.cache, propertyPath, value);\n }\n isGetOptionsObject(options) {\n return options && options?.infer && Object.keys(options).length === 1;\n }\n updateInterpolatedEnv(propertyPath, value) {\n let config = {};\n for (const envFilePath of this.envFilePaths) {\n if (fs.existsSync(envFilePath)) {\n config = Object.assign(this.parser(fs.readFileSync(envFilePath)), config);\n }\n }\n const regex = new RegExp(`\\\\$\\\\{?${propertyPath}\\\\}?`, 'g');\n for (const [k, v] of Object.entries(config)) {\n if (regex.test(v)) {\n process.env[k] = v.replace(regex, value);\n }\n }\n }\n};\nConfigService = __decorate([\n Injectable(),\n __param(0, Optional()),\n __param(0, Inject(CONFIGURATION_TOKEN)),\n __metadata(\"design:paramtypes\", [Object])\n], ConfigService);\nexport { ConfigService };\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nimport { Global, Module } from '@nestjs/common';\nimport { CONFIGURATION_SERVICE_TOKEN, CONFIGURATION_TOKEN, } from './config.constants.js';\nimport { ConfigService } from './config.service.js';\n/**\n * @publicApi\n */\nlet ConfigHostModule = class ConfigHostModule {\n};\nConfigHostModule = __decorate([\n Global(),\n Module({\n providers: [\n {\n provide: CONFIGURATION_TOKEN,\n useFactory: () => ({}),\n },\n {\n provide: CONFIGURATION_SERVICE_TOKEN,\n useClass: ConfigService,\n },\n ],\n exports: [CONFIGURATION_TOKEN, CONFIGURATION_SERVICE_TOKEN],\n })\n], ConfigHostModule);\nexport { ConfigHostModule };\n","import { randomUUID } from 'crypto';\nimport { getConfigToken } from './get-config-token.util.js';\n/**\n * @publicApi\n */\nexport function createConfigProvider(factory) {\n return {\n provide: factory.KEY || getConfigToken(randomUUID()),\n useFactory: factory,\n inject: [],\n };\n}\n","import { PARTIAL_CONFIGURATION_KEY } from '../config.constants.js';\n/**\n * @publicApi\n */\nexport function getRegistrationToken(config) {\n return config[PARTIAL_CONFIGURATION_KEY];\n}\n","import set from 'es-toolkit/compat/set';\n/**\n * @publicApi\n */\nexport function mergeConfigObject(host, partial, token) {\n if (token) {\n set(host, token, partial);\n return partial;\n }\n Object.assign(host, partial);\n}\n","/**\n * Joi defaults to `allowUnknown: false` and `abortEarly: true`, which would\n * reject the unrelated variables that are always present in `process.env` and\n * report only the first failure. Previous versions of this package overrode\n * both, so they remain the defaults for Joi schemas unless the user opts out.\n */\nconst JOI_DEFAULT_LIBRARY_OPTIONS = {\n abortEarly: false,\n allowUnknown: true,\n};\n/**\n * Validates config using a Standard Schema (e.g. Zod, Arktype).\n * @see https://standardschema.dev/\n */\nexport async function validateWithStandardSchema(schema, config, options) {\n const result = await schema['~standard'].validate(config, getLibraryOptions(schema, options));\n // A falsy \"issues\" value indicates success, see https://standardschema.dev/\n if (result.issues) {\n return { error: new Error(formatIssues(result.issues)), value: config };\n }\n return { value: result.value };\n}\nfunction getLibraryOptions(schema, options) {\n if (schema['~standard'].vendor !== 'joi') {\n return options;\n }\n return {\n ...options,\n libraryOptions: {\n ...JOI_DEFAULT_LIBRARY_OPTIONS,\n ...options?.libraryOptions,\n },\n };\n}\nfunction formatIssues(issues) {\n return issues\n .map(issue => {\n const path = formatIssuePath(issue.path);\n return path ? `${path}: ${issue.message}` : issue.message;\n })\n .join('\\n');\n}\nfunction formatIssuePath(path) {\n return (path ?? [])\n .map(segment => typeof segment === 'object' && segment !== null\n ? String(segment.key)\n : String(segment))\n .join('.');\n}\n","var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar ConfigModule_1;\nimport { Module } from '@nestjs/common';\nimport { isObject } from '@nestjs/common/utils/shared.utils.js';\nimport { expand } from 'dotenv-expand';\nimport * as fs from 'fs';\nimport { resolve } from 'path';\nimport { ConfigHostModule } from './config-host.module.js';\nimport { CONFIGURATION_LOADER, CONFIGURATION_SERVICE_TOKEN, CONFIGURATION_TOKEN, VALIDATED_ENV_LOADER, VALIDATED_ENV_PROPNAME, } from './config.constants.js';\nimport { ConfigService } from './config.service.js';\nimport { getDefaultParser } from './utils/index.js';\nimport { createConfigProvider } from './utils/create-config-factory.util.js';\nimport { getRegistrationToken } from './utils/get-registration-token.util.js';\nimport { mergeConfigObject } from './utils/merge-configs.util.js';\nimport { validateWithStandardSchema } from './utils/validate-with-schema.util.js';\n/**\n * @publicApi\n */\nlet ConfigModule = ConfigModule_1 = class ConfigModule {\n /**\n * This promise resolves when parser completes loading environment variables.\n * When \"ignoreEnvFile\" is set to true, then it will resolve immediately after the\n * \"ConfigModule#forRoot\" method is called.\n */\n static get envVariablesLoaded() {\n return this._envVariablesLoaded;\n }\n /**\n * Loads environment variables based on the \"ignoreEnvFile\" flag and \"envFilePath\" value.\n * Additionally, registers custom configurations globally.\n * @param options\n */\n static async forRoot(options = {}) {\n const envFilePaths = Array.isArray(options.envFilePath)\n ? options.envFilePath\n : [options.envFilePath || resolve(process.cwd(), '.env')];\n const parser = options.parser ?? getDefaultParser();\n let validatedEnvConfig = undefined;\n let config = options.ignoreEnvFile\n ? {}\n : this.loadEnvFile(envFilePaths, parser, options);\n if (!options.ignoreEnvVars && options.validatePredefined !== false) {\n config = options.override\n ? { ...process.env, ...config }\n : { ...config, ...process.env };\n }\n if (options.validate) {\n const validatedConfig = options.validate(config);\n validatedEnvConfig = validatedConfig;\n this.assignVariablesToProcess(validatedConfig, options.override);\n }\n else if (options.validationSchema) {\n const { error, value: validatedConfig } = await validateWithStandardSchema(options.validationSchema, config, options.validationOptions);\n if (error) {\n throw new Error(`Config validation error: ${error.message}`);\n }\n // Object schemas strip the properties they don't declare (e.g. Zod), so\n // the undeclared variables are merged back in to keep them available\n // through process.env and ConfigService.\n validatedEnvConfig = { ...config, ...validatedConfig };\n this.assignVariablesToProcess(validatedEnvConfig, options.override);\n }\n else {\n this.assignVariablesToProcess(config, options.override);\n }\n const isConfigToLoad = options.load && options.load.length;\n const configFactory = await Promise.all(options.load || []);\n const providers = configFactory\n .map(factory => createConfigProvider(factory))\n .filter(item => item);\n const configProviderTokens = providers.map(item => item.provide);\n const configServiceProvider = {\n provide: ConfigService,\n useFactory: (configService) => {\n const untypedConfigService = configService;\n if (options.cache) {\n untypedConfigService.isCacheEnabled = true;\n }\n if (options.skipProcessEnv) {\n untypedConfigService.skipProcessEnv = true;\n }\n configService.setEnvFilePaths(envFilePaths);\n configService.setParser(parser);\n return configService;\n },\n inject: [CONFIGURATION_SERVICE_TOKEN, ...configProviderTokens],\n };\n providers.push(configServiceProvider);\n if (validatedEnvConfig) {\n const validatedEnvConfigLoader = {\n provide: VALIDATED_ENV_LOADER,\n useFactory: (host) => {\n host[VALIDATED_ENV_PROPNAME] = validatedEnvConfig;\n },\n inject: [CONFIGURATION_TOKEN],\n };\n providers.push(validatedEnvConfigLoader);\n }\n this.environmentVariablesLoadedSignal();\n return {\n module: ConfigModule_1,\n global: options.isGlobal,\n providers: isConfigToLoad\n ? [\n ...providers,\n {\n provide: CONFIGURATION_LOADER,\n useFactory: (host, ...configurations) => {\n configurations.forEach((item, index) => this.mergePartial(host, item, providers[index]));\n },\n inject: [CONFIGURATION_TOKEN, ...configProviderTokens],\n },\n ]\n : providers,\n exports: [ConfigService, ...configProviderTokens],\n };\n }\n /**\n * Registers configuration object (partial registration).\n * @param config\n */\n static forFeature(config) {\n const configProvider = createConfigProvider(config);\n const serviceProvider = {\n provide: ConfigService,\n useFactory: (configService) => configService,\n inject: [CONFIGURATION_SERVICE_TOKEN, configProvider.provide],\n };\n return {\n module: ConfigModule_1,\n providers: [\n configProvider,\n serviceProvider,\n {\n provide: CONFIGURATION_LOADER,\n useFactory: (host, partialConfig) => {\n this.mergePartial(host, partialConfig, configProvider);\n },\n inject: [CONFIGURATION_TOKEN, configProvider.provide],\n },\n ],\n exports: [ConfigService, configProvider.provide],\n };\n }\n static loadEnvFile(envFilePaths, parser, options) {\n let config = {};\n for (const envFilePath of envFilePaths) {\n if (fs.existsSync(envFilePath)) {\n config = Object.assign(parser(fs.readFileSync(envFilePath)), config);\n if (options.expandVariables) {\n const expandOptions = typeof options.expandVariables === 'object'\n ? options.expandVariables\n : {};\n config =\n expand({ ...expandOptions, parsed: config }).parsed || config;\n }\n }\n }\n return config;\n }\n static assignVariablesToProcess(config, override) {\n if (!isObject(config)) {\n return;\n }\n const keys = override\n ? Object.keys(config)\n : Object.keys(config).filter(key => !(key in process.env));\n keys.forEach(key => {\n const value = config[key];\n if (typeof value === 'string') {\n process.env[key] = value;\n }\n else if (typeof value === 'boolean' || typeof value === 'number') {\n process.env[key] = `${value}`;\n }\n });\n }\n static mergePartial(host, item, provider) {\n const factoryRef = provider.useFactory;\n const token = getRegistrationToken(factoryRef);\n mergeConfigObject(host, item, token);\n }\n};\nConfigModule._envVariablesLoaded = new Promise(resolve => (ConfigModule_1.environmentVariablesLoadedSignal = resolve));\nConfigModule = ConfigModule_1 = __decorate([\n Module({\n imports: [ConfigHostModule],\n providers: [\n {\n provide: ConfigService,\n useExisting: CONFIGURATION_SERVICE_TOKEN,\n },\n ],\n exports: [ConfigHostModule, ConfigService],\n })\n], ConfigModule);\nexport { ConfigModule };\n","import {\n DynamicModule,\n Inject,\n InjectionToken,\n Module,\n ModuleMetadata,\n OnModuleInit,\n OptionalFactoryDependency,\n Provider,\n} from '@nestjs/common';\nimport { ConfigModule } from '@nestjs/config';\n\nimport { PDF_PARAMETERS } from '../helpers/tokens';\nimport { BrowserService } from './browser/browser.service';\nimport { EjsService } from './engines/ejs/ejs.service';\nimport { EtaService } from './engines/eta/eta.service';\nimport { HandlebarsService } from './engines/handlebars/handlebars.service';\nimport { MjmlService } from './engines/mjml/mjml.service';\nimport { MustacheService } from './engines/mustache/mustache.service';\nimport { NunjucksService } from './engines/nunjucks/nunjucks.service';\nimport { PugService } from './engines/pug/pug.service';\nimport { PuppeteerService } from './puppeteer.service';\nimport type { PuppeteerParameters } from './puppeteer-parameters.interface';\n\nexport interface PuppeteerModuleAsyncOptions extends Pick<\n ModuleMetadata,\n 'imports'\n> {\n inject?: Array<InjectionToken | OptionalFactoryDependency>;\n useFactory: (\n ...args: Array<any>\n ) => Promise<PuppeteerParameters> | PuppeteerParameters;\n}\n\n@Module({\n providers: [\n PuppeteerService,\n BrowserService,\n MjmlService,\n PugService,\n EjsService,\n NunjucksService,\n EtaService,\n MustacheService,\n ],\n exports: [\n PuppeteerService,\n MjmlService,\n PugService,\n EjsService,\n NunjucksService,\n EtaService,\n MustacheService,\n ],\n})\nexport class PuppeteerModule implements OnModuleInit {\n constructor(\n private readonly browserService: BrowserService,\n @Inject(PDF_PARAMETERS) private readonly pdfParams: PuppeteerParameters,\n ) {}\n\n async onModuleInit() {\n if (!this.pdfParams.executablePath) {\n await this.browserService.install(\n this.pdfParams.useLockedBrowser ?? false,\n );\n }\n }\n\n static forRoot(pdfParameters: PuppeteerParameters): DynamicModule {\n const providers: Array<Provider> = [\n {\n provide: PDF_PARAMETERS,\n useValue: pdfParameters,\n },\n HandlebarsService,\n MjmlService,\n PugService,\n EjsService,\n NunjucksService,\n EtaService,\n MustacheService,\n ];\n\n return {\n module: PuppeteerModule,\n imports: [ConfigModule.forRoot()],\n providers,\n exports: [\n PuppeteerService,\n MjmlService,\n PugService,\n EjsService,\n NunjucksService,\n EtaService,\n MustacheService,\n ],\n };\n }\n\n static forRootAsync(options: PuppeteerModuleAsyncOptions): DynamicModule {\n const pdfParamsProvider: Provider = {\n provide: PDF_PARAMETERS,\n inject: options.inject ?? [],\n useFactory: async (...args: Array<unknown>) =>\n options.useFactory(...args),\n };\n\n return {\n module: PuppeteerModule,\n imports: [...(options.imports ?? []), ConfigModule.forRoot()],\n providers: [\n pdfParamsProvider,\n PuppeteerService,\n BrowserService,\n HandlebarsService,\n MjmlService,\n PugService,\n EjsService,\n NunjucksService,\n EtaService,\n MustacheService,\n ],\n exports: [\n PuppeteerService,\n MjmlService,\n PugService,\n EjsService,\n NunjucksService,\n EtaService,\n MustacheService,\n ],\n };\n }\n}\n","import { DynamicModule, Module, ModuleMetadata } from '@nestjs/common';\n\nimport { NestjsPdfService } from './nestjs-pdf.service';\nimport { PuppeteerModule } from './puppeteer/puppeteer.module';\nimport { PuppeteerParameters } from './puppeteer/puppeteer-parameters.interface';\n\nexport interface PdfLibModuleAsyncOptions extends Pick<\n ModuleMetadata,\n 'imports'\n> {\n inject?: Array<any>;\n useFactory: (...args: Array<any>) => any;\n}\n\n@Module({})\nexport class NestjsPdfModule {\n static forRoot(options: PuppeteerParameters): DynamicModule {\n return {\n module: NestjsPdfModule,\n imports: [PuppeteerModule.forRoot(options)],\n providers: [NestjsPdfService],\n exports: [NestjsPdfService],\n };\n }\n\n static forRootAsync(options: PdfLibModuleAsyncOptions): DynamicModule {\n return {\n module: NestjsPdfModule,\n imports: [PuppeteerModule.forRootAsync(options)],\n providers: [NestjsPdfService],\n exports: [NestjsPdfService],\n };\n }\n}\n"],"x_google_ignoreList":[2,3,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,SAAgB,uBACd,WACA,kBACQ;CACR,MAAM,mBAAmB,QAAQ,WAAW,gBAAgB;CAC5D,OAAO,SAAS,QAAQ,IAAI,GAAG,gBAAgB;AACjD;;;ACNA,IAAI;AAEJ,eAAe,YAAY;CACzB,IAAI,CAAC,cACH,IAAI;EACF,eAAe,MA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