import { jsx as i } from "react/jsx-runtime";
import { useState as p } from "react";
import { joinURL as a } from "ufo";
import u from "../Img/index.js";
import { isUrl as c } from "../Util/index.js";
import d from "../Avatar/index.js";
function E({ appInfo: r, size: t = 32, ...m }) {
  const [e, l] = p(!1);
  if (e || !(r.appUrl || r.appLogo))
    return /* @__PURE__ */ i(d, { did: r.appPid, size: t });
  let o = r.appLogo || "";
  return c(o) || (o = a(r.appUrl || "", o)), /* @__PURE__ */ i(
    u,
    {
      src: o,
      alt: r.appName || "Blocklet Icon",
      width: t,
      height: t,
      ...m,
      onError: () => l(!0)
    }
  );
}
export {
  E as default
};
