import { PureComponent as Q } from "react";
import "../../../../../../../prop-types@15.8.1/node_modules/prop-types/index.js";
import X from "../../../../../../../classnames@2.3.1/node_modules/classnames/index.js";
import { typeToPathMap as F } from "./icon_map.js";
import { icon as _ } from "./assets/empty.js";
import { enqueueStateChange as Y } from "../../services/react.js";
import { isNamedColor as M } from "./named_colors.js";
import { COLORS as Ee } from "./named_colors.js";
import { euiIconStyles as Z } from "./icon.styles.js";
import { createElement as D } from "../../../../../../../@emotion_react@11.9.3_hszxbvtkrbiogp66pfduqrogei/node_modules/@emotion/react/dist/emotion-react.browser.esm.js";
import { htmlIdGenerator as ee } from "../../services/accessibility/html_id_generator.js";
import { p as a } from "../../../../../../../../../_virtual/index3.js";
import { withEuiTheme as te } from "../../services/theme/hooks.js";
function h(e) {
  return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? h = function(o) {
    return typeof o;
  } : h = function(o) {
    return o && typeof Symbol == "function" && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
  }, h(e);
}
var oe = ["type", "size", "color", "className", "tabIndex", "title", "onIconLoad", "theme", "style"];
function v() {
  return v = Object.assign || function(e) {
    for (var t = 1; t < arguments.length; t++) {
      var o = arguments[t];
      for (var r in o)
        Object.prototype.hasOwnProperty.call(o, r) && (e[r] = o[r]);
    }
    return e;
  }, v.apply(this, arguments);
}
function j(e, t) {
  var o = Object.keys(e);
  if (Object.getOwnPropertySymbols) {
    var r = Object.getOwnPropertySymbols(e);
    t && (r = r.filter(function(n) {
      return Object.getOwnPropertyDescriptor(e, n).enumerable;
    })), o.push.apply(o, r);
  }
  return o;
}
function ne(e) {
  for (var t = 1; t < arguments.length; t++) {
    var o = arguments[t] != null ? arguments[t] : {};
    t % 2 ? j(Object(o), !0).forEach(function(r) {
      k(e, r, o[r]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(o)) : j(Object(o)).forEach(function(r) {
      Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(o, r));
    });
  }
  return e;
}
function re(e, t) {
  if (e == null)
    return {};
  var o = ie(e, t), r, n;
  if (Object.getOwnPropertySymbols) {
    var i = Object.getOwnPropertySymbols(e);
    for (n = 0; n < i.length; n++)
      r = i[n], !(t.indexOf(r) >= 0) && (!Object.prototype.propertyIsEnumerable.call(e, r) || (o[r] = e[r]));
  }
  return o;
}
function ie(e, t) {
  if (e == null)
    return {};
  var o = {}, r = Object.keys(e), n, i;
  for (i = 0; i < r.length; i++)
    n = r[i], !(t.indexOf(n) >= 0) && (o[n] = e[n]);
  return o;
}
function ae(e, t) {
  if (!(e instanceof t))
    throw new TypeError("Cannot call a class as a function");
}
function z(e, t) {
  for (var o = 0; o < t.length; o++) {
    var r = t[o];
    r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r);
  }
}
function le(e, t, o) {
  return t && z(e.prototype, t), o && z(e, o), e;
}
function se(e, t) {
  if (typeof t != "function" && t !== null)
    throw new TypeError("Super expression must either be null or a function");
  e.prototype = Object.create(t && t.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), t && S(e, t);
}
function S(e, t) {
  return S = Object.setPrototypeOf || function(r, n) {
    return r.__proto__ = n, r;
  }, S(e, t);
}
function pe(e) {
  var t = ue();
  return function() {
    var r = A(e), n;
    if (t) {
      var i = A(this).constructor;
      n = Reflect.construct(r, arguments, i);
    } else
      n = r.apply(this, arguments);
    return ce(this, n);
  };
}
function ce(e, t) {
  if (t && (h(t) === "object" || typeof t == "function"))
    return t;
  if (t !== void 0)
    throw new TypeError("Derived constructors may only return object or undefined");
  return b(e);
}
function b(e) {
  if (e === void 0)
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  return e;
}
function ue() {
  if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
    return !1;
  if (typeof Proxy == "function")
    return !0;
  try {
    return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    })), !0;
  } catch {
    return !1;
  }
}
function A(e) {
  return A = Object.setPrototypeOf ? Object.getPrototypeOf : function(o) {
    return o.__proto__ || Object.getPrototypeOf(o);
  }, A(e);
}
function k(e, t, o) {
  return t in e ? Object.defineProperty(e, t, { value: o, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = o, e;
}
var de = function(t) {
  return typeof t != "string" ? !1 : t === "dataVisualizer" ? !0 : t.indexOf("data:") === 0 ? !1 : t.endsWith("App") || t.endsWith("Job");
};
function I(e) {
  return typeof e == "string" && F.hasOwnProperty(e);
}
function fe(e) {
  if (e != null)
    return I(e) ? c.hasOwnProperty(e) ? c[e] : void 0 : e;
}
var ge = ee(), c = {}, we = function(t) {
  for (var o in t)
    t.hasOwnProperty(o) && (c[o] = t[o]);
}, B = /* @__PURE__ */ function(e) {
  se(o, e);
  var t = pe(o);
  function o(r) {
    var n;
    ae(this, o), n = t.call(this, r), k(b(n), "isMounted", !0), k(b(n), "loadIconComponent", function(s) {
      if (c.hasOwnProperty(s)) {
        n.setState({
          isLoading: !1,
          neededLoading: !1,
          icon: c[s]
        }), n.onIconLoad();
        return;
      }
      import(
        /* webpackChunkName: "icon.[request]" */
        // It's important that we don't use a template string here, it
        // stops webpack from building a dynamic require context.
        // eslint-disable-next-line prefer-template
        "./assets/" + F[s]
      ).then(function(l) {
        var d = l.icon;
        c[s] = d, Y(function() {
          n.isMounted && n.props.type === s && n.setState({
            icon: d,
            iconTitle: s,
            isLoading: !1
          }, n.onIconLoad);
        });
      });
    }), k(b(n), "onIconLoad", function() {
      var s = n.props.onIconLoad;
      s && s();
    });
    var i = r.type, u = fe(i);
    return n.state = {
      icon: u,
      iconTitle: void 0,
      isLoading: !1,
      neededLoading: !1
    }, n;
  }
  return le(o, [{
    key: "componentDidMount",
    value: function() {
      var n = this.props.type;
      I(n) && this.state.icon == null ? (this.setState({
        neededLoading: !0,
        isLoading: !0
      }), this.loadIconComponent(n)) : this.onIconLoad();
    }
  }, {
    key: "componentDidUpdate",
    value: function(n) {
      var i = this.props.type;
      i !== n.type && (I(i) ? (this.setState({
        neededLoading: c.hasOwnProperty(i),
        isLoading: !0
      }), this.loadIconComponent(i)) : this.setState({
        icon: i,
        neededLoading: !0,
        isLoading: !1
      }));
    }
  }, {
    key: "componentWillUnmount",
    value: function() {
      this.isMounted = !1;
    }
  }, {
    key: "render",
    value: function() {
      var n = this.props, i = n.type, u = n.size, s = u === void 0 ? "m" : u, l = n.color, d = n.className, f = n.tabIndex, g = n.title;
      n.onIconLoad;
      var N = n.theme, x = n.style, P = re(n, oe), O = this.state, m = O.isLoading, w = O.neededLoading, q = O.iconTitle, W = !m && w, C = l && !M(l), T = C ? ne({
        color: l
      }, x) : x, V = de(i), U = l && l !== "default", G = i === "logoElastic" && (l === "ghost" || l === "text"), L = X("euiIcon", d), p = Z(N), E = [p.euiIcon, p[s], l && M(l) && p[l], C && p.customColor, G && p.logoElasticOutline, V && !U && p.app, m && p.isLoading, !m && w && p.isLoaded], y = this.state.icon || _, H = f == null || f === -1 ? "false" : "true";
      if (typeof y == "string")
        return D("img", v({
          alt: g || "",
          src: y,
          className: L,
          css: E,
          tabIndex: f
        }, P));
      var J = y, K = y === _ || !(this.props["aria-label"] || this.props["aria-labelledby"] || this.props.title), $ = K && {
        "aria-hidden": !0
      }, R;
      return !this.props["aria-label"] && !this.props["aria-labelledby"] && g && (R = {
        titleId: ge()
      }), D(J, v({
        className: L,
        style: T,
        css: E,
        tabIndex: f,
        focusable: H,
        role: "img",
        title: g,
        "data-icon-type": q,
        "data-is-loaded": W || void 0,
        "data-is-loading": m || void 0
      }, R, P, $));
    }
  }]), o;
}(Q);
B.propTypes = {
  className: a.exports.string,
  "aria-label": a.exports.string,
  "data-test-subj": a.exports.string,
  type: a.exports.oneOfType([a.exports.oneOf(["accessibility", "addDataApp", "advancedSettingsApp", "agentApp", "aggregate", "alert", "analyzeEvent", "annotation", "apmApp", "apmTrace", "appSearchApp", "apps", "arrowDown", "arrowLeft", "arrowRight", "arrowUp", "arrowStart", "arrowEnd", "asterisk", "auditbeatApp", "beaker", "bell", "bellSlash", "bolt", "boxesHorizontal", "boxesVertical", "branch", "branchUser", "broom", "brush", "bug", "bullseye", "calendar", "canvasApp", "casesApp", "check", "checkInCircleFilled", "cheer", "classificationJob", "clock", "cloudDrizzle", "cloudStormy", "cloudSunny", "cluster", "codeApp", "color", "compute", "console", "consoleApp", "container", "continuityAbove", "continuityAboveBelow", "continuityBelow", "continuityWithin", "controlsHorizontal", "controlsVertical", "copy", "copyClipboard", "createAdvancedJob", "createMultiMetricJob", "createPopulationJob", "createSingleMetricJob", "cross", "crossClusterReplicationApp", "crossInACircleFilled", "crosshairs", "currency", "cut", "dashboardApp", "dataVisualizer", "database", "desktop", "devToolsApp", "discoverApp", "document", "documentEdit", "documentation", "documents", "dot", "doubleArrowLeft", "doubleArrowRight", "download", "editorAlignCenter", "editorAlignLeft", "editorAlignRight", "editorBold", "editorChecklist", "editorCodeBlock", "editorComment", "editorDistributeHorizontal", "editorDistributeVertical", "editorHeading", "editorItalic", "editorItemAlignBottom", "editorItemAlignCenter", "editorItemAlignLeft", "editorItemAlignMiddle", "editorItemAlignRight", "editorItemAlignTop", "editorLink", "editorOrderedList", "editorPositionBottomLeft", "editorPositionBottomRight", "editorPositionTopLeft", "editorPositionTopRight", "editorRedo", "editorStrike", "editorTable", "editorUnderline", "editorUndo", "editorUnorderedList", "email", "empty", "emsApp", "eql", "eraser", "exit", "expand", "expandMini", "exportAction", "eye", "eyeClosed", "faceHappy", "faceNeutral", "faceSad", "filebeatApp", "filter", "flag", "fleetApp", "fold", "folderCheck", "folderClosed", "folderExclamation", "folderOpen", "frameNext", "framePrevious", "fullScreen", "fullScreenExit", "function", "gear", "gisApp", "glasses", "globe", "grab", "grabHorizontal", "graphApp", "grid", "grokApp", "heart", "heartbeatApp", "heatmap", "help", "home", "iInCircle", "image", "importAction", "indexClose", "indexEdit", "indexFlush", "indexManagementApp", "indexMapping", "indexOpen", "indexPatternApp", "indexRollupApp", "indexRuntime", "indexSettings", "inputOutput", "inspect", "invert", "ip", "keyboard", "kqlField", "kqlFunction", "kqlOperand", "kqlSelector", "kqlValue", "kubernetesNode", "kubernetesPod", "layers", "lensApp", "lettering", "lineDashed", "lineDotted", "lineSolid", "link", "list", "listAdd", "lock", "lockOpen", "logoAWS", "logoAWSMono", "logoAerospike", "logoApache", "logoAppSearch", "logoAzure", "logoAzureMono", "logoBeats", "logoBusinessAnalytics", "logoCeph", "logoCloud", "logoCloudEnterprise", "logoCode", "logoCodesandbox", "logoCouchbase", "logoDocker", "logoDropwizard", "logoElastic", "logoElasticStack", "logoElasticsearch", "logoEnterpriseSearch", "logoEtcd", "logoGCP", "logoGCPMono", "logoGithub", "logoGmail", "logoGolang", "logoGoogleG", "logoHAproxy", "logoIBM", "logoIBMMono", "logoKafka", "logoKibana", "logoKubernetes", "logoLogging", "logoLogstash", "logoMaps", "logoMemcached", "logoMetrics", "logoMongodb", "logoMySQL", "logoNginx", "logoObservability", "logoOsquery", "logoPhp", "logoPostgres", "logoPrometheus", "logoRabbitmq", "logoRedis", "logoSecurity", "logoSiteSearch", "logoSketch", "logoSlack", "logoUptime", "logoWebhook", "logoWindows", "logoWorkplaceSearch", "logsApp", "logstashFilter", "logstashIf", "logstashInput", "logstashOutput", "logstashQueue", "machineLearningApp", "magnet", "magnifyWithExclamation", "magnifyWithMinus", "magnifyWithPlus", "managementApp", "mapMarker", "memory", "menu", "menuDown", "menuLeft", "menuRight", "menuUp", "merge", "metricbeatApp", "metricsApp", "minimize", "minus", "minusInCircle", "minusInCircleFilled", "mobile", "monitoringApp", "moon", "namespace", "nested", "node", "notebookApp", "number", "offline", "online", "outlierDetectionJob", "package", "packetbeatApp", "pageSelect", "pagesSelect", "paperClip", "partial", "pause", "payment", "pencil", "percent", "pin", "pinFilled", "pipelineApp", "play", "playFilled", "plus", "plusInCircle", "plusInCircleFilled", "popout", "push", "questionInCircle", "quote", "recentlyViewedApp", "refresh", "regressionJob", "reporter", "reportingApp", "returnKey", "save", "savedObjectsApp", "scale", "search", "searchProfilerApp", "securityAnalyticsApp", "securityApp", "securitySignal", "securitySignalDetected", "securitySignalResolved", "sessionViewer", "shard", "share", "snowflake", "sortDown", "sortLeft", "sortRight", "sortUp", "sortable", "spacesApp", "sqlApp", "starEmpty", "starEmptySpace", "starFilled", "starFilledSpace", "starMinusEmpty", "starMinusFilled", "starPlusEmpty", "starPlusFilled", "stats", "stop", "stopFilled", "stopSlash", "storage", "string", "submodule", "sun", "swatchInput", "symlink", "tableDensityCompact", "tableDensityExpanded", "tableDensityNormal", "tableOfContents", "tag", "tear", "temperature", "timeline", "timelionApp", "timeRefresh", "timeslider", "training", "trash", "unfold", "unlink", "upgradeAssistantApp", "uptimeApp", "user", "userAvatar", "users", "usersRolesApp", "vector", "videoPlayer", "visArea", "visAreaStacked", "visBarHorizontal", "visBarHorizontalStacked", "visBarVertical", "visBarVerticalStacked", "visGauge", "visGoal", "visLine", "visMapCoordinate", "visMapRegion", "visMetric", "visPie", "visTable", "visTagCloud", "visText", "visTimelion", "visVega", "visVisualBuilder", "visualizeApp", "watchesApp", "wordWrap", "wordWrapDisabled", "workplaceSearchApp", "wrench", "tokenClass", "tokenProperty", "tokenEnum", "tokenVariable", "tokenMethod", "tokenAnnotation", "tokenException", "tokenInterface", "tokenParameter", "tokenField", "tokenElement", "tokenFunction", "tokenBoolean", "tokenString", "tokenArray", "tokenNumber", "tokenConstant", "tokenObject", "tokenEvent", "tokenKey", "tokenNull", "tokenStruct", "tokenPackage", "tokenOperator", "tokenEnumMember", "tokenRepo", "tokenSymbol", "tokenFile", "tokenModule", "tokenNamespace", "tokenDate", "tokenIP", "tokenNested", "tokenAlias", "tokenShape", "tokenGeo", "tokenRange", "tokenBinary", "tokenJoin", "tokenPercolator", "tokenFlattened", "tokenRankFeature", "tokenRankFeatures", "tokenKeyword", "tokenTag", "tokenCompletionSuggester", "tokenDenseVector", "tokenText", "tokenTokenCount", "tokenSearchType", "tokenHistogram"]).isRequired, a.exports.string.isRequired, a.exports.elementType.isRequired]).isRequired,
  color: a.exports.oneOfType([a.exports.string.isRequired, a.exports.any.isRequired]),
  size: a.exports.any,
  title: a.exports.string,
  titleId: a.exports.string,
  "aria-labelledby": a.exports.string,
  onIconLoad: a.exports.func
};
te(B);
export {
  Ee as COLORS,
  B as EuiIconClass,
  we as appendIconComponentCache
};
//# sourceMappingURL=icon.js.map
