import { isObject as i, isNumber as r } from "lodash";
function d(t, c) {
  const e = {};
  for (const s in t)
    if (!i(t[s])) {
      const n = a(s);
      ["fontSize", "width", "height", "borderWidth", "borderRadius", "gap", "-webkit-text-stroke-width", "letterSpacing", "maxHeight", "marginRight"].includes(s) && r(t[s]) ? e[(c ? `--${c}-` : "") + n] = `${t[s]}px` : e[(c ? `--${c}-` : "") + n] = t[s];
    }
  return e;
}
function a(t) {
  return t.replace(/([a-zA-Z])(?=[A-Z])/g, "$1-").toLowerCase();
}
const h = (t) => {
  if (t && t.startsWith("SHJ-")) {
    let c = !1;
    if (document.fonts.forEach((e) => {
      e.family === t && (c = !0);
    }), !c) {
      const e = t.slice(4, t.lastIndexOf("-")), s = e.slice(0, e.lastIndexOf("-")), n = t.slice(t.lastIndexOf("-") + 1, t.length), o = new FontFace(t, `url(https://lganv-1304359499.cos.ap-beijing.myqcloud.com/lg_cos_static/fonts/${s}/${e}.${n})`);
      document.fonts.add(o), o.load().then(() => {
      }).catch(() => {
      });
    }
  }
};
export {
  h as autoInstallFont,
  a as camelCaseToDash,
  d as jsonToCssStyle
};
