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AAM,GAAG,cAAc,OAAQ,EAC/C,GAGF,MAAO,CACL,KAAM,0CACN,QAAS,CACP,iBAAA,CAAkB,GAChB,MAAM,EAAS,EAAK,KAAK,OAAO,MAC5B,EAAY,IAAI,EAGtB,EAEA,cAAA,CAAe,EAAM,GACnB,GAAI,EAAM,aAAa,EAAK,KAAK,SAC3B,GAAY,EAAgB,IAAI,EAAK,KAAK,OAAO,MAAO,CAC1D,MAAM,EAAK,+BAA+B,GACtC,GACF,EACE,EAAK,KAAK,OAAO,KACjB,EACA,EACA,EACA,EAAM,MAGZ,CAEF,GAAI,EAAM,mBAAmB,EAAK,KAAK,SACjC,GAAY,EAAgB,IAAI,EAAK,KAAK,OAAO,SAAS,MAAO,CACnE,MAAM,EAAK,+BAA+B,GACtC,GACF,EACE,EAAK,KAAK,OAAO,SAAS,KAC1B,EACA,EACA,EACA,EAAM,MAGZ,CAEJ,GAGN","file":"/npm/babel-plugin-react-wrapped-display-name@1.0.0/lib/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/babel-plugin-react-wrapped-display-name@1.0.0/lib/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","const defaultWrappersConfig = {\n  memo: ['React', wrapped => `Memo(${wrapped})`],\n  forwardRef: ['React', wrapped => `ForwardRef(${wrapped})`],\n};\n\n\nconst normalizeOptions = options => ({\n  wrappers:\n    typeof options.wrappers === 'undefined'\n      ? true\n      : Boolean(options.wrappers),\n  wrappersConfig:\n    Object.assign({}, defaultWrappersConfig, options.wrappersConfig)\n    || defaultWrappersConfig,\n});\n\nconst findContainer = (path, t) => (path.node.body\n  ? path : findContainer(path.parentPath, t));\n\nconst findCandidateNameForExpression = (path) => {\n  let id;\n  path.find((currentPath) => {\n    if (currentPath.isAssignmentExpression()) {\n      id = currentPath.node.left;\n    } else if (currentPath.isObjectProperty()) {\n      id = currentPath.node.key;\n    } else if (currentPath.isVariableDeclarator()) {\n      // eslint-disable-next-line prefer-destructuring\n      id = currentPath.node.id;\n    } else if (currentPath.isStatement()) {\n      return true;\n    }\n\n    return Boolean(id);\n  });\n  return id;\n};\n\nmodule.exports = function displayNamePlugin(babel, options = {}) {\n  const {\n    wrappers,\n    wrappersConfig,\n  } = normalizeOptions(options);\n\n  const { types } = babel;\n\n  const [wrapperCreators, importNames] = Object.entries(wrappersConfig)\n    .reduce(\n      ([accWrapperCreators, accImportNames], [specifier, [importName]]) => [\n        accWrapperCreators.concat(specifier),\n        accImportNames.concat(importName),\n      ],\n      [[], []],\n    )\n    .map(items => new Set(items));\n\n  const setWrapperNameAfter = (wrapper, path, state, nameNodeId, t) => {\n    const displayName = wrappersConfig[wrapper][1](nameNodeId.name);\n\n    let args;\n    path.find((currentPath) => {\n      if (currentPath.isCallExpression()) {\n        args = currentPath.node.arguments;\n        return true;\n      }\n      return false;\n    });\n\n    if (args && displayName) {\n      const nodes = t.expressionStatement(\n        t.assignmentExpression(\n          '=',\n          t.memberExpression(nameNodeId, t.identifier('displayName')),\n          t.stringLiteral(displayName),\n        ),\n      );\n      findContainer(path, t).pushContainer('body', nodes);\n    }\n  };\n\n  return {\n    name: 'babel-plugin-react-wrapped-display-name',\n    visitor: {\n      ImportDeclaration(path) {\n        const source = path.node.source.value;\n        if (importNames.has(source)) {\n          //\n        }\n      },\n\n      CallExpression(path, state) {\n        if (types.isIdentifier(path.node.callee)) {\n          if (wrappers && wrapperCreators.has(path.node.callee.name)) {\n            const id = findCandidateNameForExpression(path);\n            if (id) {\n              setWrapperNameAfter(\n                path.node.callee.name,\n                path,\n                state,\n                id,\n                babel.types,\n              );\n            }\n          }\n        }\n        if (types.isMemberExpression(path.node.callee)) {\n          if (wrappers && wrapperCreators.has(path.node.callee.property.name)) {\n            const id = findCandidateNameForExpression(path);\n            if (id) {\n              setWrapperNameAfter(\n                path.node.callee.property.name,\n                path,\n                state,\n                id,\n                babel.types,\n              );\n            }\n          }\n        }\n      },\n    },\n  };\n};\n"]}