var f = Object.defineProperty;
var c = (n, t, e) => t in n ? f(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
var o = (n, t, e) => c(n, typeof t != "symbol" ? t + "" : t, e);
import { isArray as r } from "lodash";
class p {
  /**
   * 注册组件Ref
   * @param id
   * @returns
   */
  static registerRef(t) {
    return (e) => {
      if (r(this.componentRefs) && e && t) {
        const s = this.componentRefs.find(
          (i) => i.id === t
        );
        s ? s.ref = e : this.componentRefs.push({ id: t, ref: e });
      }
    };
  }
  /**
   * 获取组件Ref
   * @param id
   * @returns
   */
  static getComponentRef(t) {
    return this.componentRefs.find((e) => e.id === t);
  }
  /**
   * 清除组件Ref
   */
  static clearComponentRefs() {
    this.componentRefs = [];
  }
  /**
   * 获取下一个元素
   * @param arr 数组
   * @param target 目标元素
   * @returns 下一个元素
   */
  static getNextElement(t, e) {
    if (!Array.isArray(t) || !t.length || typeof e != "string")
      return null;
    const s = t.indexOf(e);
    if (s === -1)
      return null;
    const i = (s + 1) % t.length;
    return t[i];
  }
}
o(p, "componentRefs", []);
export {
  p as SHJUtils
};
