import { defineComponent as oe, $prefix as ne, $props as ie, setup as Ce, createComponent as ae, deduplicateCssClass as Ie, stringifyCssClass as He, hooks as Y, parseVnode as Oe, isEmptyVnode as Be, mergeClass as pe, $setup as Ue, h as $e } from "@opentiny/vue-common";
function ue(o, t) {
  var e = Object.keys(o);
  if (Object.getOwnPropertySymbols) {
    var r = Object.getOwnPropertySymbols(o);
    t && (r = r.filter(function(n) {
      return Object.getOwnPropertyDescriptor(o, n).enumerable;
    })), e.push.apply(e, r);
  }
  return e;
}
function A(o) {
  for (var t = 1; t < arguments.length; t++) {
    var e = arguments[t] != null ? arguments[t] : {};
    t % 2 ? ue(Object(e), !0).forEach(function(r) {
      Je(o, r, e[r]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(o, Object.getOwnPropertyDescriptors(e)) : ue(Object(e)).forEach(function(r) {
      Object.defineProperty(o, r, Object.getOwnPropertyDescriptor(e, r));
    });
  }
  return o;
}
function Ke(o, t) {
  if (typeof o != "object" || !o)
    return o;
  var e = o[Symbol.toPrimitive];
  if (e !== void 0) {
    var r = e.call(o, t || "default");
    if (typeof r != "object")
      return r;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return (t === "string" ? String : Number)(o);
}
function ke(o) {
  var t = Ke(o, "string");
  return typeof t == "symbol" ? t : String(t);
}
function G(o) {
  "@babel/helpers - typeof";
  return G = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
    return typeof t;
  } : function(t) {
    return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
  }, G(o);
}
function ze(o, t) {
  if (!(o instanceof t))
    throw new TypeError("Cannot call a class as a function");
}
function fe(o, t) {
  for (var e = 0; e < t.length; e++) {
    var r = t[e];
    r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(o, ke(r.key), r);
  }
}
function We(o, t, e) {
  return t && fe(o.prototype, t), e && fe(o, e), Object.defineProperty(o, "prototype", {
    writable: !1
  }), o;
}
function Je(o, t, e) {
  return t = ke(t), t in o ? Object.defineProperty(o, t, {
    value: e,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : o[t] = e, o;
}
function Ze(o, t) {
  if (o) {
    if (typeof o == "string")
      return ce(o, t);
    var e = Object.prototype.toString.call(o).slice(8, -1);
    if (e === "Object" && o.constructor && (e = o.constructor.name), e === "Map" || e === "Set")
      return Array.from(o);
    if (e === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))
      return ce(o, t);
  }
}
function ce(o, t) {
  (t == null || t > o.length) && (t = o.length);
  for (var e = 0, r = new Array(t); e < t; e++)
    r[e] = o[e];
  return r;
}
function Xe(o, t) {
  var e = typeof Symbol < "u" && o[Symbol.iterator] || o["@@iterator"];
  if (!e) {
    if (Array.isArray(o) || (e = Ze(o)) || t && o && typeof o.length == "number") {
      e && (o = e);
      var r = 0, n = function() {
      };
      return {
        s: n,
        n: function() {
          return r >= o.length ? {
            done: !0
          } : {
            done: !1,
            value: o[r++]
          };
        },
        e: function(l) {
          throw l;
        },
        f: n
      };
    }
    throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
  }
  var i = !0, a = !1, s;
  return {
    s: function() {
      e = e.call(o);
    },
    n: function() {
      var l = e.next();
      return i = l.done, l;
    },
    e: function(l) {
      a = !0, s = l;
    },
    f: function() {
      try {
        !i && e.return != null && e.return();
      } finally {
        if (a)
          throw s;
      }
    }
  };
}
function de(o, t, e, r) {
  var n, i = 0;
  typeof t != "boolean" && (r = e, e = t, t = void 0);
  function a() {
    var l = this, u = (/* @__PURE__ */ new Date()).valueOf() - i, c = arguments;
    function d() {
      i = (/* @__PURE__ */ new Date()).valueOf(), e.apply(l, c);
    }
    function f() {
      n = void 0;
    }
    r && !n && d(), n && clearTimeout(n);
    var p = r === void 0;
    p && u > o ? d() : t !== !0 && (n = setTimeout(r ? f : d, p ? o - u : o));
  }
  function s() {
    n && (clearTimeout(n), n = null);
  }
  return a._cancel = s, a;
}
function Qe(o, t, e) {
  return e === void 0 ? de(o, t, !1) : de(o, e, t !== !1);
}
var qe = Object.prototype.toString, Ye = Object.prototype.hasOwnProperty, Ge = Ye.toString;
Ge.call(Object);
var et = {
  "[object Error]": "error",
  "[object Object]": "object",
  "[object RegExp]": "regExp",
  "[object Date]": "date",
  "[object Array]": "array",
  "[object Function]": "function",
  "[object AsyncFunction]": "asyncFunction",
  "[object String]": "string",
  "[object Number]": "number",
  "[object Boolean]": "boolean"
}, tt = function(t) {
  return t == null;
}, rt = function(t) {
  return tt(t) ? String(t) : et[qe.call(t)] || "object";
}, ot = {
  viewportWindow: null
  // 获取真实视口的window，解决在微前端中某些bug
};
const nt = ot;
var Ne = typeof window > "u", E = function(t, e, r) {
  var n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1;
  t && e && r && t.addEventListener(e, r, n);
}, B = function(t, e, r) {
  var n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1;
  t && e && t.removeEventListener(e, r, n);
}, F = function(t) {
  var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
  if (t) {
    var r = e.split(" ").filter(function(n) {
      return n;
    });
    r.forEach(function(n) {
      return t.classList.add(n);
    });
  }
}, R = function(t, e) {
  if (!(!t || !e)) {
    var r = e.split(" ").filter(function(n) {
      return n;
    });
    r.forEach(function(n) {
      return t.classList.remove(n);
    });
  }
}, Te = function o(t) {
  if (Ne)
    return !1;
  if (t) {
    var e = getComputedStyle(t);
    if (e.getPropertyValue("position") === "fixed") {
      if (e.getPropertyValue("display") === "none")
        return !0;
      if (t.parentNode !== document.body)
        return o(t.parentNode);
    } else
      return t.offsetParent === null;
  }
  return !1;
}, it = function(t) {
  var e = t.api, r = t.state, n = t.props;
  return function(i) {
    var a = 200, s = i && i.type === "mouseenter" ? a : 0;
    if (n.visible === "auto") {
      var l = r.referenceElm, u = l.clientWidth, c = l.scrollWidth;
      if (c <= u)
        return;
    }
    e.setExpectedState(!0), e.handleShowPopper(s);
  };
}, at = function(t) {
  return function() {
    t.setExpectedState(!1), t.debounceClose();
  };
}, st = function(t) {
  var e = t.api, r = t.state;
  return function() {
    r.focusing = !0, e.show();
  };
}, lt = function(t) {
  var e = t.api, r = t.state;
  return function() {
    r.focusing = !1, e.hide();
  };
}, pt = function(t) {
  var e = t.api, r = t.state;
  return function() {
    r.focusing = !1, e.show();
  };
}, ut = function(t) {
  var e = t.props, r = t.state;
  return function(n) {
    !r.expectedState || e.manual || (clearTimeout(r.timeout), r.timeout = window.setTimeout(function() {
      r.showPopper = !0;
    }, e.openDelay || n), e.hideAfter > 0 && (r.timeoutPending = window.setTimeout(function() {
      r.showPopper = !1;
    }, e.hideAfter)));
  };
}, ft = function(t) {
  var e = t.api, r = t.props, n = t.state;
  return function() {
    r.enterable && n.expectedState || r.manual || (clearTimeout(n.timeout), n.timeoutPending && clearTimeout(n.timeoutPending), n.showPopper = !1, r.disabled && e.doDestroy());
  };
}, ct = function(t) {
  var e = t.props, r = t.api, n = t.state, i = t.popperVmRef;
  return function(a) {
    if (!e.manual) {
      var s = n.referenceElm, l = i.popper;
      !l || !s || l.contains(a.target) || s.contains(a.target) || n.showPopper && (r.setExpectedState(!1), r.debounceClose());
    }
  };
}, dt = function(t) {
  var e = t.state;
  return function(r) {
    e.expectedState === !1 && clearTimeout(e.timeoutPending), e.expectedState = r;
  };
}, mt = function(t) {
  var e = t.state, r = t.api, n = t.vm;
  return function() {
    var i = e.referenceElm;
    e.showPopper = !1, i && i.nodeType === 1 && (B(document, "click", r.handleDocumentClick), B(i, "mouseenter", r.show), B(i, "mouseleave", r.hide), B(i, "focus", r.focusHandler), B(i, "blur", r.handleBlur), B(i, "click", r.removeFocusing)), n.popperVM && (typeof n.popperVM.$destroy == "function" && n.popperVM.$destroy(), n.popperVM = null);
  };
}, ht = function(t) {
  var e = t.api, r = t.props;
  return Qe(r.closeDelay, function() {
    e.handleClosePopper();
  });
}, vt = function(t) {
  return function(e) {
    e ? F(t.referenceElm, "focusing") : R(t.referenceElm, "focusing");
  };
}, bt = function(t) {
  var e = t.slots, r = t.api;
  return function() {
    if (!e.default || !e.default().length) {
      r.handleFocus();
      return;
    }
    var n = e.default()[0];
    n = n.elm || n.el, n && n.focus ? n.focus() : r.handleFocus();
  };
}, yt = function(t) {
  var e = t.api, r = t.state, n = t.vm;
  return function(i) {
    var a = null;
    n.$el.nodeType === 8 ? a = i : n.$el.nodeType === 1 && (a = n.$el), !(!a || a.nodeType === 8 || r.referenceElm) && (r.referenceElm = a, a.setAttribute("aria-describedby", r.tooltipId), a.setAttribute("tabindex", r.tabindex.toString()), E(document, "click", e.handleDocumentClick), E(a, "mouseenter", e.show), E(a, "mouseleave", e.hide), E(a, "focus", e.focusHandler), E(a, "blur", e.handleBlur), E(a, "click", e.removeFocusing));
  };
}, gt = function(t) {
  var e = t.state, r = t.popperVmRef;
  return function(n) {
    var i = Xe(n), a;
    try {
      for (i.s(); !(a = i.n()).done; ) {
        var s = a.value;
        s.type === "attributes" && s.attributeName === "x-placement" && (e.xPlacement = r.popper.getAttribute("x-placement") || "bottom");
      }
    } catch (l) {
      i.e(l);
    } finally {
      i.f();
    }
  };
}, wt = function(t) {
  var e = t.vm, r = t.nextTick, n = t.popperVmRef;
  return function(i) {
    r(function() {
      return e.bindEvent(i);
    });
    var a = e.popperVM;
    e.$refs.popper ? n.popper = e.$refs.popper : n.popper = a.$el, r(function() {
      e.modelValue && e.updatePopper();
    });
  };
}, xt = {
  Backspace: 8,
  Tab: 9,
  Clear: 12,
  Enter: 13,
  Shift: 16,
  Control: 17,
  Alt: 18,
  CapsLock: 20,
  Escape: 27,
  Space: 32,
  PageUp: 33,
  PageDown: 34,
  End: 35,
  Home: 36,
  ArrowLeft: 37,
  ArrowUp: 38,
  ArrowRight: 39,
  ArrowDown: 40,
  Insert: 45,
  Delete: 46,
  Colon: 58,
  Semicolon: 59,
  LessThan: 60,
  Equals: 61,
  GreaterThan: 62,
  QuestionMark: 63,
  AtMark: 64,
  KeyA: 65,
  KeyB: 66,
  KeyC: 67,
  KeyD: 68,
  KeyE: 69,
  KeyF: 70,
  KeyG: 71,
  KeyH: 72,
  KeyI: 73,
  KeyJ: 74,
  KeyK: 75,
  KeyL: 76,
  KeyM: 77,
  KeyN: 78,
  KeyO: 79,
  KeyP: 80,
  KeyQ: 81,
  KeyR: 82,
  KeyS: 83,
  KeyT: 84,
  KeyU: 85,
  KeyV: 86,
  KeyW: 87,
  KeyX: 88,
  KeyY: 89,
  KeyZ: 90,
  Digit0: 48,
  Digit1: 49,
  Digit2: 50,
  Digit3: 51,
  Digit4: 52,
  Digit5: 53,
  Digit6: 54,
  Digit7: 55,
  Digit8: 56,
  Digit9: 57,
  F1: 112,
  F2: 113,
  F3: 114,
  F4: 115,
  F5: 116,
  F6: 117,
  F7: 118,
  F8: 119,
  F9: 120,
  F10: 121,
  F11: 122,
  F12: 123,
  NumLock: 144,
  Numpad0: 96,
  Numpad1: 97,
  Numpad2: 98,
  Numpad3: 99,
  Numpad4: 100,
  Numpad5: 101,
  Numpad6: 102,
  Numpad7: 103,
  Numpad8: 104,
  Numpad9: 105,
  NumpadMultiply: 106,
  NumpadAdd: 107,
  NumpadEnter: 13,
  NumpadSubtract: 109,
  NumpadDecimal: 110,
  NumpadDivide: 111,
  NumpadComma: 190
}, se = typeof window > "u", L = {}, M = {
  leave: "v-modal-leave",
  enter: "v-modal-enter",
  modal: "v-modal"
}, _t = function(t, e) {
  for (var r = t.length - 1; r >= 0; r--)
    if (t[r].id === e) {
      t.splice(r, 1);
      break;
    }
}, ee, x = {
  step: 2,
  zIndex: 2e3,
  globalScroll: !1,
  // 是否打开全局滚动监听
  modalFade: !0,
  modalStack: [],
  modalDom: null,
  // 当前model挂载的div.
  hasModal: !1,
  // 当前是否有Modal
  popLockClass: "popup-parent--hidden",
  oldBodyBorder: "",
  viewportWindow: null,
  fixBodyBorder: function() {
    var t = window.innerWidth - document.documentElement.clientWidth;
    t && (this.oldBodyBorder = document.documentElement.style.borderRight, document.body.style.borderRight = "".concat(t, "px solid transparent"));
  },
  resetBodyBorder: function() {
    document.body.style.borderRight = this.oldBodyBorder, this.oldBodyBorder = "";
  },
  /** 全局反注册 */
  deregister: function(t) {
    t && (L[t] = null, delete L[t]);
  },
  /** 返回全局实例 */
  getInstance: function(t) {
    return L[t];
  },
  /** 全局注册   仅vue-popup.ts中使用，instance就是vm, 把vm注册到 vm._popupId 这个键值上 */
  register: function(t, e) {
    t && e && (L[t] = e);
  },
  nextZIndex: function() {
    var t = x.zIndex;
    return x.zIndex += x.step, t;
  },
  /** 打开遮罩层， 仅vue-popup.ts中使用。 dom = vm.$el 或者 undefined (appendtoBody时)  */
  openModal: function(t, e, r, n, i) {
    if (!se && !(!t || e === void 0)) {
      this.modalFade = i;
      for (var a = 0, s = this.modalStack.length; a < s; a++) {
        var l = this.modalStack[a];
        if (l.id === t)
          return;
      }
      var u = ee();
      if (F(u, M.modal), this.modalFade && !x.hasModal && F(u, M.enter), n) {
        var c = n.trim().split(/\s+/);
        c.forEach(function(f) {
          return F(u, f);
        });
      }
      setTimeout(function() {
        R(u, M.enter);
      }, 200), e && (u.style.zIndex = e.toString()), u.style.display = "", u.tabIndex = 0;
      var d;
      r && r.parentNode && r.parentNode.nodeType !== 11 ? d = r.parentNode : d = document.body, d.appendChild(u), this.modalStack.push({
        id: t,
        zIndex: e,
        modalClass: n
      });
    }
  },
  /** 点击背景遮罩层时，调用栈顶的popup，调用它的close() */
  doOnModalClick: function() {
    var t = x.modalStack, e = t[t.length - 1];
    if (e) {
      var r = x.getInstance(e.id);
      r && r.closeOnClickModal && typeof r.close == "function" && r.close();
    }
  },
  closeModal: function(t) {
    var e = this.modalStack, r = ee();
    if (e.length > 0) {
      var n = e[e.length - 1];
      if (n.id === t) {
        if (n.modalClass) {
          var i = n.modalClass.trim().split(/\s+/);
          i.forEach(function(s) {
            return R(r, s);
          });
        }
        e.pop();
        var a = e.length;
        a > 0 && (r.style.zIndex = e[a - 1].zIndex.toString());
      } else
        _t(e, t);
    }
    e.length === 0 && (this.modalFade && F(r, M.leave), R(document.body, this.popLockClass), this.resetBodyBorder(), setTimeout(function() {
      e.length === 0 && (r.parentNode && r.parentNode.removeChild(r), r.style.display = "none", x.modalDom = null), R(r, M.leave);
    }, 200));
  }
};
ee = function() {
  if (se)
    return null;
  var t = x.modalDom;
  return t ? x.hasModal = !0 : (x.hasModal = !1, t = document.createElement("div"), x.modalDom = t, t.addEventListener("touchmove", function(e) {
    e.preventDefault(), e.stopPropagation();
  }, {
    passive: !0
  }), E(t, "click", function() {
    x.doOnModalClick();
  })), t;
};
se || E(window, "keydown", function(o) {
  if (o.keyCode === xt.Escape) {
    var t = x.modalStack;
    if (t.length > 0) {
      var e = t[t.length - 1];
      if (!e)
        return;
      var r = x.getInstance(e.id);
      r && r.closeOnPressEscape && (r.handleClose ? r.handleClose("esc") : r.handleAction ? r.handleAction("cancel") : r.close());
    }
  }
});
const H = x;
var St = ["left", "right", "top", "bottom"], Ae = ["shift", "offset", "preventOverflow", "keepTogether", "arrow", "flip", "applyStyle"], Et = {
  arrowOffset: 0,
  arrowElement: "[x-arrow]",
  boundariesElement: "viewport",
  boundariesPadding: 5,
  flipBehavior: "flip",
  // 全局没有修改过它，所以它一直是flip
  forceAbsolute: !1,
  gpuAcceleration: !0,
  offset: 0,
  placement: "bottom",
  preventOverflowOrder: St,
  modifiers: Ae,
  // 此处是string数组， 构造函数调用之后转为函数数组
  updateHiddenPopperOnScroll: !1
  // 滚动过程中是否更新隐藏的弹出层位置
}, U = function(t, e) {
  var r = function(i) {
    return i !== "" && !isNaN(parseFloat(i)) && isFinite(i);
  };
  Object.keys(e).forEach(function(n) {
    var i = "";
    ~["width", "height", "top", "right", "bottom", "left"].indexOf(n) && r(e[n]) && (i = "px"), t.style[n] = e[n] + i;
  });
}, W = function(t) {
  var e = t.offsetParent;
  return e === window.document.body || !e ? window.document.documentElement : e;
}, V = function(t, e) {
  if (!(!t || t.nodeType !== 1)) {
    var r = window.getComputedStyle(t, null);
    return r[e];
  }
}, Pt = function o(t) {
  return t === window.document.body ? !1 : V(t, "position") === "fixed" ? !0 : t.parentNode ? o(t.parentNode) : !1;
}, te = function(t) {
  var e = t.getBoundingClientRect();
  return {
    left: e.left,
    top: e.top,
    right: e.right,
    bottom: e.bottom,
    width: e.right - e.left,
    height: e.bottom - e.top
  };
}, Me = function(t) {
  var e = ["scroll", "auto"];
  return e.includes(V(t, "overflow")) || e.includes(V(t, "overflow-x")) || e.includes(V(t, "overflow-y"));
}, Ct = function(t) {
  var e = document.createElement("div");
  U(e, {
    opacity: 0,
    position: "fixed",
    width: 1,
    height: 1,
    top: 0,
    left: 0,
    "z-index": "-99"
  }), t.appendChild(e);
  var r = te(e);
  return t.removeChild(e), r;
}, J = function o(t) {
  var e = t.parentNode;
  return e ? e === window.document ? window.document.body.scrollTop || window.document.body.scrollLeft ? window.document.body : window.document.documentElement : Me(e) ? e : o(e) : t;
}, Ot = function(t, e, r, n) {
  var i = te(t), a = i.top, s = i.left, l = i.width, u = i.height;
  if (r) {
    if (n.parentElement) {
      var c = Ct(n.parentElement), d = c.top, f = c.left;
      a -= d, s -= f;
    }
    return {
      top: a,
      left: s,
      bottom: a + u,
      right: s + l,
      width: l,
      height: u
    };
  }
  var p = te(e), v = {
    top: a - p.top,
    left: s - p.left,
    bottom: a - p.top + u,
    right: s - p.left + l,
    width: l,
    height: u
  };
  return v;
}, Bt = function(t) {
  return t === document.body ? Math.max(document.documentElement.scrollTop, document.body.scrollTop) : t.scrollTop;
}, kt = function(t) {
  return t === document.body ? Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) : t.scrollLeft;
}, Nt = function(t, e) {
  var r = Math.max(t.scrollHeight, t.offsetHeight, e.clientHeight, e.scrollHeight, e.offsetHeight), n = Math.max(t.scrollWidth, t.offsetWidth, e.clientWidth, e.scrollWidth, e.offsetWidth);
  return {
    width: n,
    height: r
  };
}, Z = function(t) {
  var e = t.style.display, r = t.style.visibility;
  t.style.display = "block", t.style.visibility = "hidden";
  var n = window.getComputedStyle(t), i = parseFloat(n.marginTop) + parseFloat(n.marginBottom), a = parseFloat(n.marginLeft) + parseFloat(n.marginRight), s = {
    width: t.offsetWidth + a,
    height: t.offsetHeight + i
  };
  return t.style.display = e, t.style.visibility = r, s;
}, me = function(t) {
  var e = {
    left: "right",
    right: "left",
    bottom: "top",
    top: "bottom"
  };
  return t.replace(/left|right|bottom|top/g, function(r) {
    return e[r];
  });
}, D = function(t) {
  var e = A({}, t);
  return e.right = e.left + e.width, e.bottom = e.top + e.height, e;
}, Tt = function o(t) {
  var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [], r = t.parentNode;
  return r ? (Me(r) && e.push(r), V(r, "position") === "fixed" ? e : o(r, e)) : e;
}, he = function(t) {
  var e = {
    width: t.offsetWidth,
    height: t.offsetHeight,
    left: t.offsetLeft,
    top: t.offsetTop,
    right: 0,
    bottom: 0
  };
  return e.right = e.left + e.width, e.bottom = e.top + e.height, e;
}, ve = function(t) {
  t.stopPropagation();
}, re;
Ne || (re = new ResizeObserver(function(o) {
  o.forEach(function(t) {
    t.target.popperVm && t.contentRect.height > 50 && t.target.popperVm.update();
  });
}));
var At = /* @__PURE__ */ function() {
  function o(t, e, r) {
    var n = this;
    ze(this, o), this.modifiers = {}, this.popperOuterSize = null, this._reference = t, this._popper = e, this.state = {}, this._options = A(A({}, Et), r), this._options.modifierFns = Ae.map(function(i) {
      return n[i];
    }), this._popper.setAttribute("x-placement", this._options.placement), this.state.position = this._getPopperPositionByRefernce(this._reference), U(this._popper, {
      position: this.state.position,
      top: 0
    }), this._popper && (this._popper.popperVm = this, re && re.observe(this._popper)), this.update(), this._setupEventListeners();
  }
  return We(o, [{
    key: "destroy",
    value: function() {
      return this._popper.removeAttribute("x-placement"), this._popper.style.display = "none", this._removeEventListeners(), this._options.removeOnDestroy && this._popper.remove(), this;
    }
  }, {
    key: "onUpdate",
    value: function(e) {
      return this.state.updateCallback = e, this;
    }
  }, {
    key: "update",
    value: function() {
      var e = {
        instance: this,
        styles: {}
      };
      this.stopEventBubble(), this.popperOuterSize = null, e.placement = e._originalPlacement = this._options.placement, e.offsets = this._getRefPopOffsets(this._popper, this._reference, e.placement), e.boundaries = this._getBoundaries(e, this._options.boundariesPadding, this._options.boundariesElement), e = this.runModifiers(e, this._options.modifierFns), typeof this.state.updateCallback == "function" && this.state.updateCallback(e);
    }
    // 阻止popper的mousewheel等事件冒泡。 通过 onxxx 绑定，是为了避免重复绑定事件
  }, {
    key: "stopEventBubble",
    value: function() {
      this._popper && (this._popper.onmousewheel || (this._popper.onmousewheel = ve), this._popper.onwheel || (this._popper.onwheel = ve));
    }
    /** 按顺序执行Modifiers， 如果传入终点modifier,则执行到指定位置 */
  }, {
    key: "runModifiers",
    value: function(e, r, n) {
      var i = this, a = r.slice(), s = this._options;
      return n !== void 0 && (a = this._options.modifierFns.slice(0, s.modifierFns.findIndex(function(l) {
        return l === n;
      }))), a.forEach(function(l) {
        rt(l) === "function" && (e = l.call(i, e));
      }), e;
    }
    // 此时才把offsets.popper 赋值给popper dom,  offsets.array赋值给array dom
  }, {
    key: "applyStyle",
    value: function(e) {
      var r = {
        position: e.offsets.popper.position
      }, n = Math.round(e.offsets.popper.left), i = Math.round(e.offsets.popper.top);
      return this._options.gpuAcceleration ? (r.transform = "translate3d(".concat(n, "px, ").concat(i, "px, 0)"), Object.assign(r, {
        top: 0,
        left: 0
      })) : Object.assign(r, {
        top: i,
        left: n
      }), Object.assign(r, e.styles), U(this._popper, r), this._popper.setAttribute("x-placement", e.placement), e.offsets.arrow && U(e.arrowElement, e.offsets.arrow), e;
    }
    // 判断 placement是不是2段式的，是则处理一下偏移。 修改data.offsets.popper的值
  }, {
    key: "shift",
    value: function(e) {
      var r = e.placement, n = r.split("-")[0], i = r.split("-")[1];
      if (i) {
        var a = e.offsets.reference, s = a.top, l = a.left, u = a.height, c = a.width, d = D(e.offsets.popper), f = {
          y: {
            start: {
              top: s
            },
            end: {
              top: s + u - d.height
            }
          },
          x: {
            start: {
              left: l
            },
            end: {
              left: l + c - d.width
            }
          }
        }, p = ~["bottom", "top"].indexOf(n) ? "x" : "y";
        e.offsets.popper = Object.assign(d, f[p][i]);
      }
      return e;
    }
    // 校正popper的位置在boundaries 的内部
  }, {
    key: "preventOverflow",
    value: function(e) {
      if (this._options.ignoreBoundaries)
        return e;
      var r = this._options.preventOverflowOrder, n = D(e.offsets.popper), i = {
        top: function() {
          var s = n.top;
          return s < e.boundaries.top && (s = Math.max(s, e.boundaries.top)), {
            top: s
          };
        },
        right: function() {
          var s = n.left;
          return n.right > e.boundaries.right && (s = Math.min(s, e.boundaries.right - n.width)), {
            left: s
          };
        },
        bottom: function() {
          var s = n.top;
          return n.bottom > e.boundaries.bottom && (s = Math.min(s, e.boundaries.bottom - n.height)), {
            top: s
          };
        },
        left: function() {
          var s = n.left;
          return n.left < e.boundaries.left && (s = Math.max(s, e.boundaries.left)), {
            left: s
          };
        }
      };
      return r.forEach(function(a) {
        e.offsets.popper = Object.assign(n, i[a]());
      }), e;
    }
    // 校正popper的位置在reference的边上。 如果2个分离了，重新调整popper的位置。 可能是担心 modifiers.offset 带来的副作用吧
  }, {
    key: "keepTogether",
    value: function(e) {
      var r = D(e.offsets.popper), n = e.offsets.reference;
      return r.right < Math.floor(n.left) && (e.offsets.popper.left = Math.floor(n.left) - r.width), r.left > Math.floor(n.right) && (e.offsets.popper.left = Math.floor(n.right)), r.bottom < Math.floor(n.top) && (e.offsets.popper.top = Math.floor(n.top) - r.height), r.top > Math.floor(n.bottom) && (e.offsets.popper.top = Math.floor(n.bottom)), e;
    }
    // 根据flip的策略，计算当前应该显示的位置。 空间不够要计算出flip的位置。 可能是担心preventOverflow 时，造成pop, reference会重叠。 重叠了就要flip一下
  }, {
    key: "flip",
    value: function(e) {
      var r = this;
      if (e.flipped && e.placement === e._originalPlacement)
        return e;
      var n = e.placement.split("-"), i = n[0], a = me(i), s = n[1] || "", l = [i, a];
      return l.forEach(function(u, c) {
        if (!(i !== u || l.length === c + 1)) {
          i = e.placement.split("-")[0], a = me(i);
          var d = D(e.offsets.popper), f = ~["right", "bottom"].indexOf(i), p = Math.floor(e.offsets.reference[i]), v = Math.floor(d[a]);
          (f && p > v || !f && p < v) && (e.flipped = !0, e.placement = l[c + 1], s && (e.placement += "-".concat(s)), e.offsets.popper = r._getRefPopOffsets(r._popper, r._reference, e.placement).popper, e = r.runModifiers(e, r._options.modifierFns, r.flip));
        }
      }), e;
    }
    // 根据入参option上的offset, 给data.offset.popper进行校正
  }, {
    key: "offset",
    value: function(e) {
      var r = this._options.offset, n = e.offsets.popper;
      return ~e.placement.indexOf("left") ? n.top -= r : ~e.placement.indexOf("right") ? n.top += r : ~e.placement.indexOf("top") ? n.left -= r : ~e.placement.indexOf("bottom") && (n.left += r), e;
    }
    // 计算arrow的位置,保存在data.offsets.arrow ={top,left}
  }, {
    key: "arrow",
    value: function(e) {
      var r = this._options.arrowElement, n = this._options.arrowOffset;
      if (typeof r == "string" && (r = this._popper.querySelector(r)), !r || !this._popper.contains(r))
        return e;
      var i = {}, a = e.placement.split("-")[0], s = D(e.offsets.popper), l = e.offsets.reference, u = ~["left", "right"].indexOf(a), c = u ? "height" : "width", d = u ? "bottom" : "right", f = u ? "left" : "top", p = u ? "top" : "left", v = this.popperOuterSize ? this.popperOuterSize : this.popperOuterSize = Z(this._popper), b = Z(r), _ = b[c];
      l[d] - _ < s[p] && (e.offsets.popper[p] -= s[p] - (l[d] - _)), l[p] + _ > s[d] && (e.offsets.popper[p] += l[p] + _ - s[d]);
      var m = l[p] + (n || l[c] / 2 - _ / 2), g = m - s[p];
      g = Math.max(Math.min(s[c] - _ - 8, g), 8), i[p] = g, i[f] = "";
      var P = this._options.placement.split("-");
      return this._options.adjustArrow && ~["top", "bottom"].indexOf(P[0]) && p === "left" && (P[1] === "start" ? i.left = 8 : P[1] || (i.left = (v.width - b.width) / 2)), e.offsets.arrow = i, e.arrowElement = r, e;
    }
    /** 判断 reference 的 offsetParent 元素是fix还是abs, 这个值会赋值给popper 的dom */
  }, {
    key: "_getPopperPositionByRefernce",
    value: function(e) {
      if (this._options.forceAbsolute)
        return "absolute";
      var r = Pt(e);
      return r ? "fixed" : "absolute";
    }
    /** 实时计算一下popper, reference的 位置信息， 用于 */
  }, {
    key: "_getRefPopOffsets",
    value: function(e, r, n) {
      n = n.split("-")[0];
      var i = {
        position: this.state.position
      }, a = i.position === "fixed", s = Ot(r, W(e), a, e), l = this.popperOuterSize ? this.popperOuterSize : this.popperOuterSize = Z(e), u = l.width, c = l.height;
      return ~["right", "left"].indexOf(n) ? (i.top = s.top + s.height / 2 - c / 2, n === "left" ? i.left = s.left - u : i.left = s.right) : (i.left = s.left + s.width / 2 - u / 2, n === "top" ? i.top = s.top - c : i.top = s.bottom), i.width = u, i.height = c, {
        popper: i,
        reference: s
      };
    }
  }, {
    key: "_setupEventListeners",
    value: function() {
      var e = this;
      if (this.state.updateBoundFn = this.update.bind(this), this.state.scrollUpdate = function() {
        if (e._options.updateHiddenPopperOnScroll)
          e.state.updateBoundFn();
        else {
          if (Te(e._reference))
            return;
          e.state.updateBoundFn();
        }
      }, E(window, "resize", this.state.updateBoundFn), this._options.boundariesElement !== "window") {
        var r, n, i, a = this._options.scrollParent || J(this._reference), s = [];
        if ((r = a) !== null && r !== void 0 && (n = r.dataset) !== null && n !== void 0 && (i = n.tag) !== null && i !== void 0 && i.includes("-form")) {
          s.push(a);
          var l = J(a);
          (l === window.document.body || l === window.document.documentElement) && (l = window), s.push(l);
        }
        if ((a === window.document.body || a === window.document.documentElement) && (a = window), this.state.scrollTarget = a, this._options.bubbling || H.globalScroll) {
          var u = Tt(this._reference);
          this.state.scrollTargets = u || [], u.forEach(function(c) {
            E(c, "scroll", e.state.scrollUpdate);
          });
        } else
          s.length ? (this.state.scrollTargets = s, s.forEach(function(c) {
            E(c, "scroll", e.state.scrollUpdate);
          })) : E(a, "scroll", this.state.scrollUpdate);
      }
    }
  }, {
    key: "_removeEventListeners",
    value: function() {
      var e = this;
      if (B(window, "resize", this.state.updateBoundFn), this._options.boundariesElement !== "window" && this.state.scrollTarget && (B(this.state.scrollTarget, "scroll", this.state.scrollUpdate), this.state.scrollTarget = null, this._options.bubbling || H.globalScroll)) {
        var r = this.state.scrollTargets || [];
        r.forEach(function(n) {
          B(n, "scroll", e.state.scrollUpdate);
        }), this.state.scrollTargets = null;
      }
      this.state.updateBoundFn = null, this.state.scrollUpdate = null;
    }
    /** 实时计算一下Boundary的位置 */
  }, {
    key: "_getBoundaries",
    value: function(e, r, n) {
      var i = {
        right: 0,
        left: 0,
        top: 0,
        bottom: 0
      };
      if (n === "window" || n === "body") {
        var a = window.document.body, s = window.document.documentElement, l = Nt(a, s), u = l.width, c = l.height;
        i = {
          top: 0,
          right: u,
          bottom: c,
          left: 0
        };
      } else if (n === "viewport") {
        var d = W(this._popper), f = J(this._popper), p = he(d), v = e.offsets.popper.position === "fixed", b = v || !this._options.appendToBody && ["right", "left"].includes(this._options.placement), _ = b ? 0 : Bt(f), m = b ? 0 : kt(f), g = nt.viewportWindow || H.viewportWindow || window;
        i = {
          top: 0 - (p.top - _),
          right: g.document.documentElement.clientWidth - (p.left - m),
          bottom: g.document.documentElement.clientHeight - (p.top - _),
          left: 0 - (p.left - m)
        };
      } else if (W(this._popper) === n) {
        var P = n.clientWidth, S = n.clientHeight;
        i = {
          right: P,
          bottom: S,
          top: 0,
          left: 0
        };
      } else
        i = he(n);
      return i.right -= r, i.left += r, i.bottom = i.bottom - r, i.top = i.top + r, i;
    }
  }]), o;
}();
const Mt = At;
var be = function(t) {
  return t.stopPropagation();
}, Dt = typeof window > "u", ye = function(t) {
  var e = t.state, r = t.props, n = t.vm, i = t.slots, a = e.referenceElm || r.reference || n.$refs.reference && n.$refs.reference.$el || n.$refs.reference;
  return !a && i.reference && i.reference()[0] && (e.referenceElm = i.reference()[0].elm || i.reference()[0].el, a = e.referenceElm), a;
}, Ft = function(t) {
  if (!(!t || !t.nodeType)) {
    var e = function(a) {
      return parseInt(window.getComputedStyle(a).zIndex, 10) || 0;
    }, r = e(t), n;
    do {
      if (t = t.parentNode, t)
        n = e(t);
      else
        break;
      r = n > r ? n : r;
    } while (t !== document.body);
    return r + 1 + "";
  }
};
const Rt = function(o) {
  var t = o.parent, e = o.emit, r = o.nextTick, n = o.onBeforeUnmount, i = o.onDeactivated, a = o.props, s = o.watch, l = o.reactive, u = o.vm, c = o.slots, d = o.toRefs, f = o.popperVmRef, p = l({
    popperJS: null,
    appended: !1,
    // arrow 是否添加
    popperElm: null,
    showPopper: a.manual ? !!a.modelValue : !1,
    referenceElm: null,
    currentPlacement: ""
  }), v = function(y) {
    if (!p.appended) {
      p.appended = !0;
      var h = document.createElement("div");
      h.setAttribute("x-arrow", ""), h.className = "popper__arrow", y.appendChild(h);
    }
  }, b = function(y) {
    var h = (a == null ? void 0 : a.popperOptions) || {}, k = h.followReferenceHide, N = k === void 0 ? !0 : k, $ = y._popper, K = y._reference;
    N && Te(K) && ($.style.display = "none");
  }, _ = function(y) {
    return a.zIndex === "relative" ? Ft(y) : H.nextZIndex();
  }, m = function(y) {
    if (!Dt && (p.currentPlacement = p.currentPlacement || a.placement, !!/^(top|bottom|left|right)(-start|-end)?$/g.test(p.currentPlacement))) {
      var h = a.popperOptions || {
        gpuAcceleration: !1
      };
      p.popperElm = p.popperElm || a.popper || u.$refs.popper || f.popper || y;
      var k = p.popperElm, N = ye({
        state: p,
        props: a,
        vm: u,
        slots: c
      });
      !k || !N || N.nodeType !== Node.ELEMENT_NODE || (a.visibleArrow && v(k), a.appendToBody || a.popperAppendToBody ? document.body.appendChild(p.popperElm) : (t && t.$el && t.$el.appendChild(p.popperElm), h.forceAbsolute = !0), h.placement = p.currentPlacement, h.offset = a.offset || 0, h.arrowOffset = a.arrowOffset || 0, h.adjustArrow = a.adjustArrow || !1, h.appendToBody = a.appendToBody || a.popperAppendToBody, p.popperJS = new Mt(N, k, h), e("created", p), typeof h.onUpdate == "function" && p.popperJS.onUpdate(h.onUpdate), p.popperJS._popper.style.zIndex = _(p.popperJS._reference), b(p.popperJS), E(p.popperElm, "click", be));
    }
  }, g = function(y) {
    y && y !== !0 && (p.popperElm = y);
    var h = p.popperJS;
    h ? (h._reference = ye({
      state: p,
      props: a,
      vm: u,
      slots: c
    }), h.update(), h._popper && y !== !0 && (h._popper.style.zIndex = _(h._reference), b(p.popperJS))) : m(y && y !== !0 ? y : void 0);
  }, P = function(y) {
    !p.popperJS || p.showPopper && !y || (p.popperJS.destroy(), p.popperJS = null);
  }, S = function(y) {
    y && p.popperElm && p.popperElm.parentNode === document.body && (B(p.popperElm, "click", be), p.popperElm.remove());
  };
  return s(function() {
    return p.showPopper;
  }, function(C) {
    a.disabled || (C && r(g), a.trigger === "manual" && e("update:modelValue", C));
  }), n(function() {
    r(function() {
      P(!0), (a.appendToBody || a.popperAppendToBody) && S("remove");
    });
  }), i(function() {
    P(!0), (a.appendToBody || a.popperAppendToBody) && S("remove");
  }), A({
    updatePopper: g,
    destroyPopper: S,
    doDestroy: P
  }, d(p));
};
var Vt = function() {
  var t = 4294967296;
  return window.crypto.getRandomValues(new window.Uint32Array(1))[0] / t;
}, jt = function() {
  var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 8;
  return t + Vt().toString().substr(2, e);
}, De = ["state", "bindEvent", "hide", "show", "doDestroy", "handleFocus", "debounceClose", "handleShowPopper", "handleClosePopper", "setExpectedState", "updatePopper", "focusHandler"], Lt = function(t) {
  var e = t.reactive, r = t.showPopper, n = t.popperElm, i = t.referenceElm, a = t.props, s = t.inject, l = t.popperJS, u = t.currentPlacement;
  return e({
    popperJS: l,
    showPopper: r,
    popperElm: n,
    referenceElm: i,
    currentPlacement: u,
    timeout: null,
    focusing: !1,
    expectedState: void 0,
    tooltipId: jt("tiny-tooltip-", 4),
    tabindex: a.tabindex,
    xPlacement: "bottom",
    showContent: s("showContent", null),
    tipsMaxWidth: s("tips-max-width", null)
  });
}, Fe = function(t, e, r) {
  var n = e.watch, i = e.toRefs, a = e.reactive, s = e.onBeforeUnmount, l = e.onDeactivated, u = e.onMounted, c = e.onUnmounted, d = e.inject, f = r.vm, p = r.emit, v = r.slots, b = r.nextTick, _ = r.parent, m = {}, g = {}, P = {
    emit: p,
    props: t,
    nextTick: b,
    toRefs: i,
    reactive: a,
    parent: _.$parent,
    vm: f,
    popperVmRef: g
  };
  Object.assign(P, {
    slots: v,
    onBeforeUnmount: s,
    onDeactivated: l,
    watch: n
  });
  var S = Rt(P), C = S.showPopper, y = S.updatePopper, h = S.popperElm, k = S.referenceElm, N = S.doDestroy, $ = S.popperJS, K = S.currentPlacement, w = Lt({
    reactive: a,
    showPopper: C,
    popperElm: h,
    referenceElm: k,
    props: t,
    inject: d,
    popperJS: $,
    currentPlacement: K
  });
  return Object.assign(m, {
    state: w,
    doDestroy: N,
    updatePopper: y,
    show: it({
      api: m,
      state: w,
      props: t
    }),
    hide: at(m),
    destroyed: mt({
      state: w,
      api: m,
      vm: f
    }),
    bindPopper: wt({
      vm: f,
      nextTick: b,
      popperVmRef: g
    }),
    watchFocusing: vt(w),
    removeFocusing: pt({
      api: m,
      state: w
    }),
    handleBlur: lt({
      api: m,
      state: w
    }),
    handleFocus: st({
      api: m,
      state: w
    }),
    debounceClose: ht({
      api: m,
      props: t
    }),
    setExpectedState: dt({
      state: w
    }),
    handleShowPopper: ut({
      props: t,
      state: w
    }),
    handleClosePopper: ft({
      api: m,
      props: t,
      state: w
    }),
    bindEvent: yt({
      api: m,
      state: w,
      vm: f
    }),
    focusHandler: bt({
      slots: v,
      api: m
    }),
    handleDocumentClick: ct({
      props: t,
      api: m,
      state: w,
      popperVmRef: g
    }),
    observeCallback: gt({
      state: w,
      popperVmRef: g
    })
  }), n(function() {
    return w.focusing;
  }, m.watchFocusing), n(function() {
    return t.modelValue;
  }, function(z) {
    return b(function() {
      return t.manual && (w.showPopper = z);
    });
  }), u(function() {
    if (m.bindPopper(), t.genArrowByHtml) {
      var z = {
        attributes: !0,
        childList: !1,
        subtree: !1
      };
      m.observer = new MutationObserver(m.observeCallback), m.observer.observe(g.popper, z);
    }
  }), f.$on("tooltip-update", m.bindPopper), c(function() {
    m.destroyed(), m.observer && m.observer.disconnect(), f.$off("tooltip-update");
  }), m;
};
const It = oe({
  name: ne + "Tooltip",
  componentName: "Tooltip",
  props: {
    ...ie,
    visible: {
      type: String,
      default: () => "always",
      validator: (o) => ["always", "auto"].includes(o)
    },
    adjustArrow: {
      type: Boolean,
      default: () => !1
    },
    appendToBody: {
      type: Boolean,
      default: () => !0
    },
    arrowOffset: {
      type: Number,
      default: () => 0
    },
    boundariesPadding: {
      type: Number,
      default: () => 5
    },
    closeDelay: {
      type: Number,
      default: () => 300
    },
    content: {
      type: [String, Object]
    },
    disabled: {
      type: Boolean
    },
    effect: {
      type: String,
      default: () => "dark"
    },
    enterable: {
      type: Boolean,
      default: () => !0
    },
    hideAfter: {
      type: Number,
      default: () => 0
    },
    manual: {
      type: Boolean
    },
    modelValue: {
      type: Boolean
    },
    offset: {
      default: () => 0
    },
    openDelay: {
      type: Number,
      default: () => 0
    },
    placement: {
      type: String,
      default: () => "bottom"
    },
    popper: {},
    popperClass: {
      type: String
    },
    popperOptions: {
      default: () => ({
        gpuAcceleration: !1,
        boundariesPadding: 10
      })
    },
    pre: {
      type: Boolean
    },
    reference: {},
    renderContent: {
      type: Function
    },
    tabindex: {
      type: Number,
      default: () => 0
    },
    transition: {
      type: String,
      default: () => "tiny-fade-in-linear"
    },
    type: {
      type: String,
      validator: (o) => !!~["normal", "warning", "error", "info", "success"].indexOf(o)
    },
    visibleArrow: {
      type: Boolean,
      default: () => !0
    },
    zIndex: {
      type: String,
      default: () => "next"
    },
    contentMaxHeight: {
      type: String
    }
  },
  setup(o, t) {
    return Ce({
      props: o,
      context: t,
      renderless: Fe,
      api: De
    });
  },
  render() {
    const o = arguments[0], t = (i) => {
      let a = i.slots.content && i.slots.content();
      if (a && (!Y.Comment || a[0].type !== Y.Comment))
        return a;
      let s;
      return i.renderContent ? s = i.renderContent(o, i.content) : i.pre ? s = i.content ? o("pre", i.content) : null : s = i.content, s;
    };
    if (!Object.prototype.hasOwnProperty.call(this, "popperVM")) {
      const i = {
        value: null
      };
      this.d({
        popperVM: {
          get: () => (i.value || (i.value = ae({
            el: document.createElement("div"),
            propsData: null,
            component: {
              render: () => {
                const a = t(this), s = typeof a == "string", l = {
                  attrs: {
                    name: this.transition
                  },
                  on: {
                    "after-leave": this.doDestroy
                  }
                }, u = "is-" + (this.type || this.effect || "dark"), c = () => this.setExpectedState(!0), d = () => {
                  this.setExpectedState(!1), this.debounceClose();
                };
                return this.$nextTick(() => {
                  !this.disabled && this.state.showPopper && a && this.updatePopper();
                }), o("transition", l, [o("div", {
                  ref: "popper",
                  attrs: {
                    id: this.state.tooltipId,
                    role: "tooltip",
                    "aria-hidden": this.disabled || !this.state.showPopper ? "true" : "false"
                  },
                  directives: [{
                    name: "show",
                    value: !this.disabled && this.state.showPopper && a
                  }],
                  class: ["tiny-tooltip", "tiny-tooltip__popper", u, this.popperClass, {
                    "tiny-tooltip__show-tips": this.state.showContent
                  }],
                  style: `max-width:${this.state.tipsMaxWidth}px`,
                  on: {
                    mouseenter: () => c(),
                    mouseleave: () => d()
                  }
                }, [s ? o("div", {
                  class: "tiny-tooltip__content-wrapper",
                  style: `max-height:${this.contentMaxHeight}`
                }, [a]) : a])]);
              }
            }
          })), i.value),
          set: (a) => i.value = a
        }
      });
    }
    const r = (() => {
      const i = this.slots.default && this.slots.default();
      if (!Array.isArray(i))
        return null;
      let a = null;
      for (let s = 0; s < i.length; s++) {
        const l = Oe(i[s]);
        if (!Be(l)) {
          a = l;
          break;
        }
      }
      return a;
    })();
    if (!r)
      return null;
    const n = r.data || r.props || (r.props = {});
    return n.class = Ie("tiny-tooltip " + He(n.class)), r;
  }
});
function Re(o, t, e, r, n, i, a, s) {
  var l = typeof o == "function" ? o.options : o;
  t && (l.render = t, l.staticRenderFns = e, l._compiled = !0), r && (l.functional = !0), i && (l._scopeId = "data-v-" + i);
  var u;
  if (a ? (u = function(f) {
    f = f || // cached call
    this.$vnode && this.$vnode.ssrContext || // stateful
    this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !f && typeof __VUE_SSR_CONTEXT__ < "u" && (f = __VUE_SSR_CONTEXT__), n && n.call(this, f), f && f._registeredComponents && f._registeredComponents.add(a);
  }, l._ssrRegister = u) : n && (u = s ? function() {
    n.call(
      this,
      (l.functional ? this.parent : this).$root.$options.shadowRoot
    );
  } : n), u)
    if (l.functional) {
      l._injectStyles = u;
      var c = l.render;
      l.render = function(p, v) {
        return u.call(v), c(p, v);
      };
    } else {
      var d = l.beforeCreate;
      l.beforeCreate = d ? [].concat(d, u) : [u];
    }
  return {
    exports: o,
    options: l
  };
}
let Ht, Ut;
const ge = {};
var $t = /* @__PURE__ */ Re(
  It,
  Ht,
  Ut,
  !1,
  Kt,
  null,
  null,
  null
);
function Kt(o) {
  for (let t in ge)
    this[t] = ge[t];
}
const we = /* @__PURE__ */ function() {
  return $t.exports;
}();
var O = {
  tooltip: "absolute bg-color-text-primary text-color-text-inverse shadow-none -left-[9999px] py-2 px-3 sm:py-1.5 sm:px-2 text-sm sm:text-xs leading-tight min-w-[theme(spacing.12)] max-w-[theme(spacing.80)] sm:max-w-[theme(spacing.112)] z-[2000] break-words rounded [&[x-placement^=top]]:mb-2.5 [&[x-placement^=bottom]]:mt-2.5 [&[x-placement^=right]]:ml-2.5 [&[x-placement^=left]]:mr-2.5",
  "tooltip-sm": "sm:bg-color-bg-1 sm:text-color-text-primary sm:shadow-md",
  arrow: 'drop-shadow-none absolute block w-0 h-0 border-[0.375rem] border-transparent border-solid after:absolute after:block after:w-0 after:h-0 after:border-[0.3125rem] after:border-transparent after:border-solid after:content-[""]',
  "placement-top": "-bottom-3 border-t-color-text-primary border-b-w-0 after:-bottom-1 after:-ml-1.5 after:border-t-color-text-primary after:border-b-w-0",
  "placement-bottom": "-top-3 border-t-w-0 border-b-color-text-primary after:-top-1 after:-ml-1.5 after:border-t-w-0 after:border-b-color-text-primary",
  "placement-right": "-left-3 border-r-color-text-primary border-l-w-0 after:-bottom-1 after:-left-1 after:border-r-color-text-primary after:border-l-w-0",
  "placement-left": "-right-1.5 border-l-color-text-primary border-r-0 after:-bottom-1 after:right-px after:-ml-1.5 after:border-l-color-text-primary after:border-r-0",
  "placement-top-sm": "sm:drop-shadow-[0_2px_2px_rgba(0,0,0,0.08)] sm:border-t-color-bg-1 sm:after:border-t-color-bg-1",
  "placement-bottom-sm": "sm:drop-shadow-[0_-2px_2px_rgba(0,0,0,0.08)] sm:border-b-color-bg-1 sm:after:border-b-color-bg-1",
  "placement-right-sm": "sm:drop-shadow-[-2px_0px_2px_rgba(0,0,0,0.08)] sm:border-r-color-bg-1 sm:after:border-r-color-bg-1",
  "placement-left-sm": "sm:drop-shadow-[2px_0_2px_rgba(0,0,0,0.08)] sm:border-l-color-bg-1 sm:after:border-l-color-bg-1",
  "placement-top-light": "border-t-color-bg-1 drop-shadow-[0_2px_2px_rgba(0,0,0,0.08)] after:border-t-color-bg-1",
  "placement-bottom-light": "border-b-color-bg-1 drop-shadow-[0_-2px_2px_rgba(0,0,0,0.08)] after:border-b-color-bg-1",
  "placement-left-light": "border-l-color-bg-1 drop-shadow-[2px_0_2px_rgba(0,0,0,0.08)] after:border-l-color-bg-1",
  "placement-right-light": "border-r-color-bg-1 drop-shadow-[-2px_0px_2px_rgba(0,0,0,0.08)] after:border-r-color-bg-1",
  "placement-top-dark": "border-t-color-text-primary after:border-t-color-text-primary",
  "placement-bottom-dark": "border-b-color-text-primary after:border-b-color-text-primary",
  "placement-left-dark": "border-l-color-text-primary after:border-l-color-text-primary",
  "placement-right-dark": "border-r-color-text-primary after:border-r-color-text-primary",
  "effect-dark": "bg-color-text-primary text-color-text-inverse shadow-none",
  "effect-light": "bg-color-bg-1 text-color-text-primary shadow-md",
  "is-warning": "text-color-text-inverse bg-color-warning border-color-warning",
  "is-error": "text-color-text-inverse bg-color-error border-color-error",
  "is-info": "text-color-text-inverse bg-color-info-secondary border-color-info-secondary",
  "is-success": "text-color-text-inverse bg-color-success border-color-success",
  "arrow-top-warning": "border-t-color-warning after:border-t-color-warning",
  "arrow-bottom-warning": "border-b-color-warning after:border-b-color-warning",
  "arrow-left-warning": "border-l-color-warning after:border-l-color-warning",
  "arrow-right-warning": "border-r-color-warning after:border-r-color-warning",
  "arrow-top-error": "border-t-color-error after:border-t-color-error",
  "arrow-bottom-error": "border-b-color-error after:border-b-color-error",
  "arrow-left-error": "border-l-color-error after:border-l-color-error",
  "arrow-right-error": "border-r-color-error after:border-r-color-error",
  "arrow-top-info": "border-t-color-info-secondary after:border-t-color-info-secondary",
  "arrow-bottom-info": "border-b-color-info-secondary after:border-b-color-info-secondary",
  "arrow-left-info": "border-l-color-info-secondary after:border-l-color-info-secondary",
  "arrow-right-info": "border-r-color-info-secondary after:border-r-color-info-secondary",
  "arrow-top-success": "border-t-color-success after:border-t-color-success",
  "arrow-bottom-success": "border-b-color-success after:border-b-color-success",
  "arrow-left-success": "border-l-color-success after:border-l-color-success",
  "arrow-right-success": "border-r-color-success after:border-r-color-success"
};
const zt = oe({
  name: ne + "Tooltip",
  componentName: "Tooltip",
  props: {
    ...ie,
    adjustArrow: {
      type: Boolean,
      default: () => !1
    },
    appendToBody: {
      type: Boolean,
      default: () => !0
    },
    arrowOffset: {
      type: Number,
      default: () => 0
    },
    boundariesPadding: {
      type: Number,
      default: () => 5
    },
    closeDelay: {
      type: Number,
      default: () => 100
    },
    content: {
      type: String
    },
    disabled: {
      type: Boolean
    },
    effect: {
      type: String,
      default: () => ""
    },
    enterable: {
      type: Boolean,
      default: () => !0
    },
    hideAfter: {
      type: Number,
      default: () => 0
    },
    manual: {
      type: Boolean
    },
    modelValue: {
      type: Boolean
    },
    offset: {
      default: () => 0
    },
    openDelay: {
      type: Number,
      default: () => 0
    },
    placement: {
      type: String,
      default: () => "bottom"
    },
    popper: {},
    popperClass: {
      type: String
    },
    popperOptions: {
      default: () => ({
        gpuAcceleration: !1,
        boundariesPadding: 10
      })
    },
    pre: {
      type: Boolean
    },
    reference: {},
    renderContent: {
      type: Function
    },
    tabindex: {
      type: Number,
      default: () => 0
    },
    transformOrigin: {
      type: [Boolean, String],
      default: () => !0
    },
    type: {
      type: String,
      validator: (o) => ~["normal", "warning", "error", "info", "success"].indexOf(o)
    },
    visibleArrow: {
      type: Boolean,
      default: () => !0
    },
    genArrowByHtml: {
      type: Boolean,
      default: () => !0
    },
    zIndex: {
      type: String,
      default: () => "next"
    }
  },
  setup(o, t) {
    return Ce({
      props: o,
      context: t,
      renderless: Fe,
      api: De
    });
  },
  render() {
    const o = arguments[0], t = (s) => {
      let l = s.slots.content && s.slots.content();
      if (l)
        return l;
      let u;
      return s.renderContent ? u = s.renderContent(o, s.content) : s.pre ? u = s.content ? o("pre", {
        class: "whitespace-pre-wrap"
      }, s.content) : null : u = s.content, u;
    };
    if (!Object.hasOwnProperty.call(this, "popperVM")) {
      const s = {
        value: null
      };
      this.d({
        popperVM: {
          get: () => (s.value || (s.value = ae({
            el: document.createElement("div"),
            component: {
              render: () => {
                let l = t(this), u = {
                  on: {
                    "after-leave": this.doDestroy
                  }
                }, c = () => this.setExpectedState(!0), d = () => {
                  this.setExpectedState(!1), this.debounceClose();
                };
                const f = this.state.xPlacement || "";
                return o("transition", u, [o("div", {
                  attrs: {
                    "data-tag": "tiny-tooltip",
                    id: this.state.tooltipId,
                    appendToBody: this.appendToBody,
                    role: "tooltip",
                    "aria-hidden": this.disabled || !this.state.showPopper ? "true" : "false"
                  },
                  ref: "popper",
                  directives: [{
                    name: "show",
                    value: !this.disabled && this.state.showPopper && l
                  }],
                  class: pe([O.tooltip, !this.effect && !this.type && O["tooltip-sm"], this.effect && O[`effect-${this.effect}`], this.type && O[`is-${this.type}`], this.disabled || !this.state.showPopper ? "hidden" : "", this.popperClass]),
                  on: {
                    mouseenter: () => c(),
                    mouseleave: () => d()
                  }
                }, [l, this.visibleArrow ? o("div", {
                  attrs: {
                    "x-arrow": !0
                  },
                  class: pe([O.arrow, O["placement-" + f.split("-")[0]], !this.effect && !this.type && O["placement-" + f.split("-")[0] + "-sm"], this.effect === "light" ? O["placement-" + f.split("-")[0] + "-light"] : "", this.effect === "dark" ? O["placement-" + f.split("-")[0] + "-dark"] : "", this.type ? O[`arrow-${f.split("-")[0]}-${this.type}`] : ""])
                }) : ""])]);
              }
            }
          })), s.value),
          set: (l) => s.value = l
        }
      });
    }
    const e = (s, l) => {
      const u = (p) => p && p.trim(), c = (p) => {
        const v = [];
        return p.forEach((b) => {
          b && typeof b == "string" ? v.push(u(b)) : b && typeof b == "object" && v.push(d(b));
        }), v.join(" ");
      }, d = (p) => {
        const v = [];
        return Object.keys(p).forEach((b) => {
          p[b] && v.push(b);
        }), v.join(" ");
      };
      let f = "";
      return s && (typeof s == "string" ? f = f + u(s) : Array.isArray(s) ? f = f + c(s) : typeof s == "object" && (f = f + d(s))), u(f.replace(l, ""));
    }, r = (s) => "tiny-tooltip " + e(s, /\btiny-tooltip\b/g), i = (() => {
      const s = this.slots.default && this.slots.default();
      if (!Array.isArray(s))
        return null;
      let l = null;
      for (let u = 0; u < s.length; u++) {
        const c = Oe(s[u]);
        if (!Be(c)) {
          l = c;
          break;
        }
      }
      return l;
    })();
    if (!i)
      return null;
    const a = i.data || i.props || (i.props = {});
    return a.class = r(a.class), i;
  }
});
let Wt, Jt;
const xe = {};
var Zt = /* @__PURE__ */ Re(
  zt,
  Wt,
  Jt,
  !1,
  Xt,
  null,
  null,
  null
);
function Xt(o) {
  for (let t in xe)
    this[t] = xe[t];
}
const Qt = /* @__PURE__ */ function() {
  return Zt.exports;
}();
var qt = function(t) {
  var e, r = (typeof process > "u" ? "undefined" : G(process)) === "object" ? (e = process.env) === null || e === void 0 ? void 0 : e.TINY_MODE : null;
  return (r || t) === "pc" ? we : (r || t) === "mobile-first" ? Qt : we;
}, Yt = A(A({}, ie), {}, {
  visible: {
    type: String,
    default: function() {
      return "always";
    },
    validator: function(t) {
      return ["always", "auto"].includes(t);
    }
  },
  adjustArrow: {
    type: Boolean,
    default: function() {
      return !1;
    }
  },
  appendToBody: {
    type: Boolean,
    default: function() {
      return !0;
    }
  },
  arrowOffset: {
    type: Number,
    default: function() {
      return 0;
    }
  },
  content: {
    type: [String, Object]
  },
  disabled: {
    type: Boolean
  },
  enterable: {
    type: Boolean,
    default: function() {
      return !0;
    }
  },
  hideAfter: {
    type: Number,
    default: function() {
      return 0;
    }
  },
  manual: {
    type: Boolean
  },
  modelValue: {
    type: Boolean
  },
  offset: {
    default: function() {
      return 0;
    }
  },
  effect: {
    type: String,
    default: function() {
      return "";
    }
  },
  openDelay: {
    type: Number,
    default: function() {
      return 0;
    }
  },
  closeDelay: {
    type: Number,
    default: function() {
      return 100;
    }
  },
  placement: {
    type: String,
    default: function() {
      return "bottom";
    }
  },
  popper: {},
  popperClass: {
    type: String
  },
  popperOptions: {
    default: function() {
      return {};
    }
  },
  pre: {
    type: Boolean
  },
  reference: {},
  renderContent: {
    type: Function
  },
  tabindex: {
    type: Number,
    default: function() {
      return 0;
    }
  },
  transition: {
    type: String,
    default: function() {
      return "tiny-fade-in-linear";
    }
  },
  type: {
    type: String,
    validator: function(t) {
      return !!~["normal", "warning", "error", "info", "success"].indexOf(t);
    }
  },
  visibleArrow: {
    type: Boolean,
    default: function() {
      return !0;
    }
  },
  genArrowByHtml: {
    type: Boolean,
    default: function() {
      return !0;
    }
  },
  zIndex: {
    type: String,
    default: function() {
      return "next";
    }
  },
  contentMaxHeight: {
    type: String
  }
});
const T = oe({
  name: ne + "Tooltip",
  componentName: "Tooltip",
  props: Yt,
  setup: function(t, e) {
    return Ue({
      props: t,
      context: e,
      template: qt
    });
  }
}), Gt = "3.20.0";
T.model = {
  prop: "modelValue",
  event: "update:modelValue"
};
T.install = function(o) {
  o.component(T.name, T);
};
T.version = Gt;
typeof window < "u" && window.Vue && T.install(window.Vue);
var er = 2, j = {
  value: null
}, X = Y.ref(""), tr = function(t) {
  return (t == null ? void 0 : t.textContent) && (t.scrollWidth > t.clientWidth || t.scrollHeight - t.clientHeight > er);
}, rr = function(t) {
  var e;
  return !!(!(t == null || (e = t.boundingValue) === null || e === void 0) && e.always);
}, Q = function(t) {
  var e;
  return (t == null || (e = t.boundingValue) === null || e === void 0 ? void 0 : e.effect) === "dark";
}, q = function(t) {
  var e;
  return ((e = t.boundingValue) === null || e === void 0 ? void 0 : e.placement) || "top";
}, Ve = function(t) {
  var e = t.currentTarget;
  if (e.boundingValue && (rr(e) || tr(e))) {
    var r, n;
    if (!j.value) {
      var i;
      X.value = ((i = e.boundingValue) === null || i === void 0 ? void 0 : i.content) || e.textContent, j.value = ae({
        el: document.createElement("div"),
        propsData: {
          renderContent: function() {
            return $e("span", {
              class: "tiny-directive-tip__content"
            }, X.value);
          },
          placement: q(e),
          effect: Q(e) ? "dark" : "light"
        },
        component: T
      });
    }
    var a = j.value, s = a.state.popperElm;
    X.value = ((r = e.boundingValue) === null || r === void 0 ? void 0 : r.content) || e.textContent, a.state.referenceElm = e, a.state.currentPlacement = q(e), s && s.classList.replace("is-".concat(Q(e) ? "light" : "dark"), "is-".concat(Q(e) ? "dark" : "light")), a.show(), (n = a.state.popperJS) !== null && n !== void 0 && n._options && (a.state.popperJS._options.placement = q(e)), a.updatePopper();
  }
}, je = function() {
  j.value && j.value.hide();
}, I = function(t, e) {
  var r, n = e.value, i = n === void 0 ? {} : n;
  t.boundingValue = i, i && !((r = t.boundingValue) !== null && r !== void 0 && r.listened) && (t.addEventListener("mouseenter", Ve), t.addEventListener("mouseleave", je), t.boundingValue.listened = !0);
}, _e = function(t) {
  var e;
  (e = t.boundingValue) !== null && e !== void 0 && e.listened && (t.removeEventListener("mouseenter", Ve), t.removeEventListener("mouseleave", je));
};
const sr = {
  bind: I,
  unbind: _e,
  update: I,
  beforeMount: I,
  unmounted: _e,
  updated: I
};
function Le(o, t) {
  for (var e = document.createTreeWalker(o, NodeFilter.SHOW_TEXT), r = []; e.nextNode(); ) {
    var n = e.currentNode;
    t(n) && r.push(n);
  }
  return r;
}
function or(o, t, e) {
  t.forEach(function(r) {
    var n = r.textContent, i = n.toLowerCase().indexOf(e.toLowerCase()), a = n.substring(0, i), s = n.substring(i + e.length);
    r.textContent = a;
    var l = document.createElement("span");
    l.classList.add("tiny-hl-query-node"), l.textContent = e;
    var u = document.createTextNode(s);
    r.after(l, u);
  }), t.length && le(o, e);
}
function nr(o) {
  var t = /* @__PURE__ */ new Set();
  o.forEach(function(e) {
    var r;
    return t.add((r = e.parentElement) === null || r === void 0 ? void 0 : r.parentElement);
  }), t.forEach(function(e) {
    e.innerText = e.textContent;
  });
}
function le(o, t) {
  if (t) {
    var e = Le(o, function(r) {
      if (r.parentElement.classList.contains("tiny-hl-query-node"))
        return !1;
      var n = r.textContent || "";
      return n.toLowerCase().includes(t.toLowerCase());
    });
    or(o, e, t);
  }
}
function ir(o) {
  var t = Le(o, function(e) {
    return e.parentElement.classList.contains("tiny-hl-query-node");
  });
  nr(t);
}
var Se = function(t, e) {
  t.classList.toggle("tiny-hl-query", !0);
  var r = e.value;
  le(t, r);
}, Ee = function(t) {
  ir(t);
}, Pe = function(t, e) {
  var r = e.value;
  le(t, r);
};
const lr = {
  mounted: Se,
  beforeUpdate: Ee,
  updated: Pe,
  // vue2周期
  inserted: Se,
  update: Ee,
  componentUpdated: Pe
};
export {
  sr as AutoTip,
  lr as HighlightQuery
};
