{"version":3,"file":"enrichment.mjs","sources":["../../../../src/lib/form/enrichment.mts"],"sourcesContent":["import type { EnrichFields } from '../shared/types.mjs';\n\n/**\n * Options for enrichment functions\n */\nexport interface EnrichmentOptions {\n  /**\n   * Enrichment functions mapped by field name\n   */\n  enrich?: EnrichFields;\n}\n\n/**\n * Creates an enrichment object for the named group\n * @param name The name of the form field group\n * @param options Optional enrichment functions\n *\n * @returns A function that enriches the field values based on the provided options\n */\nexport function createEnrichField(name: string, options?: EnrichmentOptions): (value: unknown) => Record<string, unknown> {\n  return (value: unknown) =>\n    Object.entries(options?.enrich?.[name] ?? {}).reduce(\n      (a, [key, fn]) => {\n        a[key] = fn(value);\n        return a;\n      },\n      {} as Record<string, unknown>,\n    );\n}\n"],"names":["createEnrichField","name","options","value","a","key","fn"],"mappings":"AAmBO,SAASA,EAAkBC,GAAcC,GAA0E;AACxH,SAAO,CAACC,MACN,OAAO,QAAQD,GAAS,SAASD,CAAI,KAAK,CAAA,CAAE,EAAE;AAAA,IAC5C,CAACG,GAAG,CAACC,GAAKC,CAAE,OACVF,EAAEC,CAAG,IAAIC,EAAGH,CAAK,GACVC;AAAA,IAET,CAAA;AAAA,EAAC;AAEP;"}