{"version":3,"sources":["../../../src/reduceDictionaryContent/buildMask.ts"],"sourcesContent":["import { deepTransformNode, Dictionary, type Plugins } from '@intlayer/core';\n\nconst passTypedNodePlugin: Plugins = {\n  id: 'pass-typed-node-plugin',\n  canHandle: (node) =>\n    typeof node === 'object' && typeof node?.nodeType === 'string',\n  transform: (node, props, deepTransformNode) =>\n    deepTransformNode(node[node.nodeType], props),\n};\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const buildMaskPlugin: Plugins = {\n  id: 'build-mask-plugin',\n  canHandle: (node) => typeof node === 'string' || typeof node === 'number',\n  transform: () => true,\n};\n\nexport const buildMask = (source: Dictionary): any => ({\n  ...source,\n  content: deepTransformNode(source.content, {\n    dictionaryKey: source.key,\n    keyPath: [],\n    plugins: [passTypedNodePlugin, buildMaskPlugin],\n  }),\n});\n"],"mappings":"AAAA,SAAS,yBAAmD;AAE5D,MAAM,sBAA+B;AAAA,EACnC,IAAI;AAAA,EACJ,WAAW,CAAC,SACV,OAAO,SAAS,YAAY,OAAO,MAAM,aAAa;AAAA,EACxD,WAAW,CAAC,MAAM,OAAOA,uBACvBA,mBAAkB,KAAK,KAAK,QAAQ,GAAG,KAAK;AAChD;AAGO,MAAM,kBAA2B;AAAA,EACtC,IAAI;AAAA,EACJ,WAAW,CAAC,SAAS,OAAO,SAAS,YAAY,OAAO,SAAS;AAAA,EACjE,WAAW,MAAM;AACnB;AAEO,MAAM,YAAY,CAAC,YAA6B;AAAA,EACrD,GAAG;AAAA,EACH,SAAS,kBAAkB,OAAO,SAAS;AAAA,IACzC,eAAe,OAAO;AAAA,IACtB,SAAS,CAAC;AAAA,IACV,SAAS,CAAC,qBAAqB,eAAe;AAAA,EAChD,CAAC;AACH;","names":["deepTransformNode"]}