{"version":3,"sources":["../../src/mergeDictionaries.ts"],"sourcesContent":["import merge, { type Options } from 'deepmerge';\n\n// Custom array merge function that merges objects by 'key'\nexport const mergeByKey = <T extends { key: string }>(key: keyof T) => {\n  return (target: T[], source: T[], options?: Options): T[] => {\n    const destination: T[] = [];\n\n    // Create a map for quick lookup\n    const sourceMap = new Map<string, T>();\n    source.forEach((item) => {\n      sourceMap.set(item[key] as string, item);\n    });\n\n    target.forEach((targetItem) => {\n      const sourceItem = sourceMap.get(targetItem[key] as string);\n      if (sourceItem) {\n        // Merge the two items and assert the type\n        const mergedItem = merge(targetItem, sourceItem, options) as T;\n        destination.push(mergedItem);\n        // Remove the item from the source map to avoid duplicates\n        sourceMap.delete(targetItem[key] as string);\n      } else {\n        destination.push(targetItem);\n      }\n    });\n\n    // Add remaining items from source\n    sourceMap.forEach((item) => {\n      destination.push(item);\n    });\n\n    return destination;\n  };\n};\n"],"mappings":"AAAA,OAAO,WAA6B;AAG7B,MAAM,aAAa,CAA4B,QAAiB;AACrE,SAAO,CAAC,QAAa,QAAa,YAA2B;AAC3D,UAAM,cAAmB,CAAC;AAG1B,UAAM,YAAY,oBAAI,IAAe;AACrC,WAAO,QAAQ,CAAC,SAAS;AACvB,gBAAU,IAAI,KAAK,GAAG,GAAa,IAAI;AAAA,IACzC,CAAC;AAED,WAAO,QAAQ,CAAC,eAAe;AAC7B,YAAM,aAAa,UAAU,IAAI,WAAW,GAAG,CAAW;AAC1D,UAAI,YAAY;AAEd,cAAM,aAAa,MAAM,YAAY,YAAY,OAAO;AACxD,oBAAY,KAAK,UAAU;AAE3B,kBAAU,OAAO,WAAW,GAAG,CAAW;AAAA,MAC5C,OAAO;AACL,oBAAY,KAAK,UAAU;AAAA,MAC7B;AAAA,IACF,CAAC;AAGD,cAAU,QAAQ,CAAC,SAAS;AAC1B,kBAAY,KAAK,IAAI;AAAA,IACvB,CAAC;AAED,WAAO;AAAA,EACT;AACF;","names":[]}