require.d(exports, {
Z: () => b
});
var i = function () {
if ("undefined" != typeof Map) return Map;
function e(e, t) {
var n = -1;
e.some(function (e, i) {
return e[0] === t && (n = i, !0);
});
return n;
}
return function () {
function t() {
this.entries = [];
}
Object.defineProperty(t.prototype, "size", {
get: function () {
return this.entries.length;
},
enumerable: !0,
configurable: !0
});
t.prototype.get = function (t) {
var n = e(this.entries, t);
var i = this.entries[n];
return i && i[1];
};
t.prototype.set = function (t, n) {
var i = e(this.entries, t);
if (~i) {
this.entries[i][1] = n;
} else {
this.entries.push([t, n]);
}
};
t.prototype.delete = function (t) {
var n = this.entries;
var i = e(n, t);
if (~i) {
n.splice(i, 1);
}
};
t.prototype.has = function (t) {
return !!~e(this.entries, t);
};
t.prototype.clear = function () {
this.entries.splice(0);
};
t.prototype.forEach = function (e, t) {
if (void 0 === t) {
t = null;
}
for (n = 0, i = this.entries, void 0; n < i.length; n++) {
var n;
var i;
var r = i[n];
e.call(t, r[1], r[0]);
}
};
return t;
}();
}();
var r = "undefined" != typeof window && "undefined" != typeof document && window.document === document;
var A = void 0 !== require.g && require.g.Math === Math ? require.g : "undefined" != typeof self && self.Math === Math ? self : "undefined" != typeof window && window.Math === Math ? window : Function("return this")();
var o = "function" == typeof requestAnimationFrame ? requestAnimationFrame.bind(A) : function (e) {
return setTimeout(function () {
return e(Date.now());
}, 1e3 / 60);
};
var a = ["top", "right", "bottom", "left", "width", "height", "size", "weight"];
var s = "undefined" != typeof MutationObserver;
var l = function () {
function e() {
this.connected_ = !1;
this.mutationEventsAdded_ = !1;
this.mutationsObserver_ = null;
this.observers_ = [];
this.onTransitionEnd_ = this.onTransitionEnd_.bind(this);
this.refresh = function (e, t) {
var n = !1;
var i = !1;
var r = 0;
function A() {
if (n) {
n = !1;
e();
}
if (i) {
s();
}
}
function a() {
o(A);
}
function s() {
var e = Date.now();
if (n) {
if (e - r < 2) return;
i = !0;
} else {
n = !0;
i = !1;
setTimeout(a, t);
}
r = e;
}
return s;
}(this.refresh.bind(this), 20);
}
e.prototype.addObserver = function (e) {
if (~this.observers_.indexOf(e)) {
this.observers_.push(e);
}
if (this.connected_) {
this.connect_();
}
};
e.prototype.removeObserver = function (e) {
var t = this.observers_;
var n = t.indexOf(e);
if (~n) {
t.splice(n, 1);
}
if (!t.length && this.connected_) {
this.disconnect_();
}
};
e.prototype.refresh = function () {
if (this.updateObservers_()) {
this.refresh();
}
};
e.prototype.updateObservers_ = function () {
var e = this.observers_.filter(function (e) {
e.gatherActive();
return e.hasActive();
});
e.forEach(function (e) {
return e.broadcastActive();
});
return e.length > 0;
};
e.prototype.connect_ = function () {
if (r && !this.connected_) {
document.addEventListener("transitionend", this.onTransitionEnd_);
window.addEventListener("resize", this.refresh);
if (s) {
this.mutationsObserver_ = new MutationObserver(this.refresh);
this.mutationsObserver_.observe(document, {
attributes: !0,
childList: !0,
characterData: !0,
subtree: !0
});
} else {
document.addEventListener("DOMSubtreeModified", this.refresh);
this.mutationEventsAdded_ = !0;
}
this.connected_ = !0;
}
};
e.prototype.disconnect_ = function () {
if (r && this.connected_) {
document.removeEventListener("transitionend", this.onTransitionEnd_);
window.removeEventListener("resize", this.refresh);
if (this.mutationsObserver_) {
this.mutationsObserver_.disconnect();
}
if (this.mutationEventsAdded_) {
document.removeEventListener("DOMSubtreeModified", this.refresh);
}
this.mutationsObserver_ = null;
this.mutationEventsAdded_ = !1;
this.connected_ = !1;
}
};
e.prototype.onTransitionEnd_ = function (e) {
var t = e.propertyName;
var n = void 0 === t ? "" : t;
if (a.some(function (e) {
return !!~n.indexOf(e);
})) {
this.refresh();
}
};
e.getInstance = function () {
if (this.instance_) {
this.instance_ = new e();
}
return this.instance_;
};
e.instance_ = null;
return e;
}();
var c = function (e, t) {
for (n = 0, i = Object.keys(t), void 0; n < i.length; n++) {
var n;
var i;
var r = i[n];
Object.defineProperty(e, r, {
value: t[r],
enumerable: !1,
writable: !1,
configurable: !0
});
}
return e;
};
var u = function (e) {
return e && e.ownerDocument && e.ownerDocument.defaultView || A;
};
var h = v(0, 0, 0, 0);
function d(e) {
return parseFloat(e) || 0;
}
function f(e) {
for (t = [], n = 1, void 0; n < arguments.length; n++) {
var t;
var n;
t[n - 1] = arguments[n];
}
return t.reduce(function (t, n) {
return t + d(e["border-" + n + "-width"]);
}, 0);
}
function g(e) {
var t = e.clientWidth;
var n = e.clientHeight;
if (!t && !n) return h;
var i = u(e).getComputedStyle(e);
var r = function (e) {
for (t = {}, n = 0, i = ["top", "right", "bottom", "left"], void 0; n < i.length; n++) {
var t;
var n;
var i;
var r = i[n];
var A = e["padding-" + r];
t[r] = d(A);
}
return t;
}(i);
var A = r.left + r.right;
var o = r.top + r.bottom;
var a = d(i.width);
var s = d(i.height);
if ("border-box" === i.boxSizing) {
if (Math.round(a + A) !== t) {
a -= f(i, "left", "right") + A;
}
if (Math.round(s + o) !== n) {
s -= f(i, "top", "bottom") + o;
}
}
if (!function (e) {
return e === u(e).document.documentElement;
}(e)) {
var l = Math.round(a + A) - t,
c = Math.round(s + o) - n;
1 !== Math.abs(l) && (a -= l), 1 !== Math.abs(c) && (s -= c);
}
return v(r.left, r.top, a, s);
}
var p = "undefined" != typeof SVGGraphicsElement ? function (e) {
return e instanceof u(e).SVGGraphicsElement;
} : function (e) {
return e instanceof u(e).SVGElement && "function" == typeof e.getBBox;
};
function m(e) {
return r ? p(e) ? function (e) {
var t = e.getBBox();
return v(0, 0, t.width, t.height);
}(e) : g(e) : h;
}
function v(e, t, n, i) {
return {
x: e,
y: t,
width: n,
height: i
};
}
var C = function () {
function e(e) {
this.broadcastWidth = 0;
this.broadcastHeight = 0;
this.contentRect_ = v(0, 0, 0, 0);
this.target = e;
}
e.prototype.isActive = function () {
var e = m(this.target);
this.contentRect_ = e;
return e.width !== this.broadcastWidth || e.height !== this.broadcastHeight;
};
e.prototype.broadcastRect = function () {
var e = this.contentRect_;
this.broadcastWidth = e.width;
this.broadcastHeight = e.height;
return e;
};
return e;
}();
var w = function (e, t) {
var n;
var i;
var r;
var A;
var o;
var a;
var s;
var l = (i = (n = t).x, r = n.y, A = n.width, o = n.height, a = "undefined" != typeof DOMRectReadOnly ? DOMRectReadOnly : Object, s = Object.create(a.prototype), c(s, {
x: i,
y: r,
width: A,
height: o,
top: r,
right: i + A,
bottom: o + r,
left: i
}), s);
c(this, {
target: e,
contentRect: l
});
};
var y = function () {
function e(e, t, n) {
this.activeObservations_ = [];
this.observations_ = new i();
if ("function" != typeof e) throw new TypeError("The callback provided as parameter 1 is not a function.");
this.callback_ = e;
this.controller_ = t;
this.callbackCtx_ = n;
}
e.prototype.observe = function (e) {
if (!arguments.length) throw new TypeError("1 argument required, but only 0 present.");
if ("undefined" != typeof Element && Element instanceof Object) {
if (!(e instanceof u(e).Element)) throw new TypeError('parameter 1 is not of type "Element".');
var t = this.observations_;
if (t.has(e)) {
t.set(e, new C(e));
this.controller_.addObserver(this);
this.controller_.refresh();
}
}
};
e.prototype.unobserve = function (e) {
if (!arguments.length) throw new TypeError("1 argument required, but only 0 present.");
if ("undefined" != typeof Element && Element instanceof Object) {
if (!(e instanceof u(e).Element)) throw new TypeError('parameter 1 is not of type "Element".');
var t = this.observations_;
if (t.has(e)) {
t.delete(e);
if (t.size) {
this.controller_.removeObserver(this);
}
}
}
};
e.prototype.disconnect = function () {
this.clearActive();
this.observations_.clear();
this.controller_.removeObserver(this);
};
e.prototype.gatherActive = function () {
var e = this;
this.clearActive();
this.observations_.forEach(function (t) {
if (t.isActive()) {
e.activeObservations_.push(t);
}
});
};
e.prototype.broadcastActive = function () {
if (this.hasActive()) {
var e = this.callbackCtx_;
var t = this.activeObservations_.map(function (e) {
return new w(e.target, e.broadcastRect());
});
this.callback_.call(e, t, e);
this.clearActive();
}
};
e.prototype.clearActive = function () {
this.activeObservations_.splice(0);
};
e.prototype.hasActive = function () {
return this.activeObservations_.length > 0;
};
return e;
}();
var B = "undefined" != typeof WeakMap ? new WeakMap() : new i();
var E = function e(t) {
if (!(this instanceof e)) throw new TypeError("Cannot call a class as a function.");
if (!arguments.length) throw new TypeError("1 argument required, but only 0 present.");
var n = l.getInstance();
var i = new y(t, n, this);
B.set(this, i);
};
["observe", "unobserve", "disconnect"].forEach(function (e) {
E.prototype[e] = function () {
var t;
return (t = B.get(this))[e].apply(t, arguments);
};
});
const b = void 0 !== A.ResizeObserver ? A.ResizeObserver : E;
分析代码,并用可读变量重写