"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getExtensionLozengeData = void 0;
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
var getExtensionLozengeData = exports.getExtensionLozengeData = function getExtensionLozengeData(_ref) {
  var node = _ref.node,
    type = _ref.type;
  if (!node.attrs.parameters) {
    return;
  }
  var macroMetadata = node.attrs.parameters.macroMetadata;
  // EDITOR-4007: guard against non-array placeholder to prevent `TypeError: ... forEach is not a function`.
  var hasValidPlaceholder = (0, _expValEquals.expValEquals)('platform_editor_macro_placeholder_array_guard', 'isEnabled', true) ? macroMetadata && Array.isArray(macroMetadata.placeholder) : macroMetadata && macroMetadata.placeholder;
  if (hasValidPlaceholder) {
    var placeholderData;
    // Ignored via go/ees005
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    macroMetadata.placeholder.forEach(function (placeholder) {
      if (placeholder.type === type && placeholder.data && placeholder.data.url) {
        placeholderData = placeholder.data;
      }
    });
    return placeholderData;
  }
  return;
};