226 lines
7.3 KiB
JavaScript
226 lines
7.3 KiB
JavaScript
/*
|
|
* Extracted from browser-delivered Turbopack chunk: 334606b5978d0903.36ee2c232b.js
|
|
* Module id: 673135
|
|
* For reading/searching only; this factory depends on the original Turbopack runtime.
|
|
*/
|
|
|
|
const moduleFactory = (e) => {
|
|
"use strict";
|
|
e.i(23741);
|
|
var t = e.i(552659),
|
|
r = e.i(358379),
|
|
n = e.i(111558),
|
|
a = e.i(490210);
|
|
e.i(992734);
|
|
var i = e.i(389524),
|
|
o = r.createContext(null),
|
|
l = e.i(935492),
|
|
s = e.i(33419),
|
|
u = [],
|
|
c = e.i(470360),
|
|
f = "rc-util-locker-".concat(Date.now()),
|
|
d = 0,
|
|
p = function (e) {
|
|
return (
|
|
!1 !== e &&
|
|
((0, a.default)() && e
|
|
? "string" == typeof e
|
|
? document.querySelector(e)
|
|
: "function" == typeof e
|
|
? e()
|
|
: e
|
|
: null)
|
|
);
|
|
},
|
|
m = r.forwardRef(function (e, m) {
|
|
var h,
|
|
v,
|
|
g,
|
|
b = e.open,
|
|
y = e.autoLock,
|
|
x = e.getContainer,
|
|
w = (e.debug, e.autoDestroy),
|
|
k = void 0 === w || w,
|
|
C = e.children,
|
|
E = r.useState(b),
|
|
j = (0, t.default)(E, 2),
|
|
P = j[0],
|
|
F = j[1],
|
|
_ = P || b;
|
|
r.useEffect(
|
|
function () {
|
|
(k || b) && F(b);
|
|
},
|
|
[b, k],
|
|
);
|
|
var S = r.useState(function () {
|
|
return p(x);
|
|
}),
|
|
N = (0, t.default)(S, 2),
|
|
O = N[0],
|
|
A = N[1];
|
|
r.useEffect(function () {
|
|
var e = p(x);
|
|
A(null != e ? e : null);
|
|
});
|
|
var M = (function (e, n) {
|
|
var i = r.useState(function () {
|
|
return (0, a.default)() ? document.createElement("div") : null;
|
|
}),
|
|
c = (0, t.default)(i, 1)[0],
|
|
f = r.useRef(!1),
|
|
d = r.useContext(o),
|
|
p = r.useState(u),
|
|
m = (0, t.default)(p, 2),
|
|
h = m[0],
|
|
v = m[1],
|
|
g =
|
|
d ||
|
|
(f.current
|
|
? void 0
|
|
: function (e) {
|
|
v(function (t) {
|
|
return [e].concat((0, l.default)(t));
|
|
});
|
|
});
|
|
function b() {
|
|
c.parentElement || document.body.appendChild(c), (f.current = !0);
|
|
}
|
|
function y() {
|
|
var e;
|
|
null == (e = c.parentElement) || e.removeChild(c),
|
|
(f.current = !1);
|
|
}
|
|
return (
|
|
(0, s.default)(
|
|
function () {
|
|
return e ? (d ? d(b) : b()) : y(), y;
|
|
},
|
|
[e],
|
|
),
|
|
(0, s.default)(
|
|
function () {
|
|
h.length &&
|
|
(h.forEach(function (e) {
|
|
return e();
|
|
}),
|
|
v(u));
|
|
},
|
|
[h],
|
|
),
|
|
[c, g]
|
|
);
|
|
})(_ && !O, 0),
|
|
T = (0, t.default)(M, 2),
|
|
$ = T[0],
|
|
I = T[1],
|
|
R = null != O ? O : $;
|
|
(h = !!(
|
|
y &&
|
|
b &&
|
|
(0, a.default)() &&
|
|
(R === $ || R === document.body)
|
|
)),
|
|
(v = r.useState(function () {
|
|
return (d += 1), "".concat(f, "_").concat(d);
|
|
})),
|
|
(g = (0, t.default)(v, 1)[0]),
|
|
(0, s.default)(
|
|
function () {
|
|
if (h) {
|
|
var e,
|
|
t = ((e = document.body),
|
|
"u" < typeof document || !e || !(e instanceof Element)
|
|
? { width: 0, height: 0 }
|
|
: (function (e) {
|
|
var t,
|
|
r,
|
|
n = "rc-scrollbar-measure-".concat(
|
|
Math.random().toString(36).substring(7),
|
|
),
|
|
a = document.createElement("div");
|
|
a.id = n;
|
|
var i = a.style;
|
|
if (
|
|
((i.position = "absolute"),
|
|
(i.left = "0"),
|
|
(i.top = "0"),
|
|
(i.width = "100px"),
|
|
(i.height = "100px"),
|
|
(i.overflow = "scroll"),
|
|
e)
|
|
) {
|
|
var o = getComputedStyle(e);
|
|
(i.scrollbarColor = o.scrollbarColor),
|
|
(i.scrollbarWidth = o.scrollbarWidth);
|
|
var l = getComputedStyle(e, "::-webkit-scrollbar"),
|
|
s = parseInt(l.width, 10),
|
|
u = parseInt(l.height, 10);
|
|
try {
|
|
var f = s ? "width: ".concat(l.width, ";") : "",
|
|
d = u ? "height: ".concat(l.height, ";") : "";
|
|
(0, c.updateCSS)(
|
|
"\n#"
|
|
.concat(n, "::-webkit-scrollbar {\n")
|
|
.concat(f, "\n")
|
|
.concat(d, "\n}"),
|
|
n,
|
|
);
|
|
} catch (e) {
|
|
console.error(e), (t = s), (r = u);
|
|
}
|
|
}
|
|
document.body.appendChild(a);
|
|
var p =
|
|
e && t && !isNaN(t)
|
|
? t
|
|
: a.offsetWidth - a.clientWidth,
|
|
m =
|
|
e && r && !isNaN(r)
|
|
? r
|
|
: a.offsetHeight - a.clientHeight;
|
|
return (
|
|
document.body.removeChild(a),
|
|
(0, c.removeCSS)(n),
|
|
{ width: p, height: m }
|
|
);
|
|
})(e)).width,
|
|
r =
|
|
document.body.scrollHeight >
|
|
(window.innerHeight ||
|
|
document.documentElement.clientHeight) &&
|
|
window.innerWidth > document.body.offsetWidth;
|
|
(0, c.updateCSS)(
|
|
"\nhtml body {\n overflow-y: hidden;\n ".concat(
|
|
r ? "width: calc(100% - ".concat(t, "px);") : "",
|
|
"\n}",
|
|
),
|
|
g,
|
|
);
|
|
} else (0, c.removeCSS)(g);
|
|
return function () {
|
|
(0, c.removeCSS)(g);
|
|
};
|
|
},
|
|
[h, g],
|
|
);
|
|
var D = null;
|
|
C && (0, i.supportRef)(C) && m && (D = C.ref);
|
|
var V = (0, i.useComposeRef)(D, m);
|
|
if (!_ || !(0, a.default)() || void 0 === O) return null;
|
|
var L = !1 === R,
|
|
B = C;
|
|
return (
|
|
m && (B = r.cloneElement(C, { ref: V })),
|
|
r.createElement(
|
|
o.Provider,
|
|
{ value: I },
|
|
L ? B : (0, n.createPortal)(B, R),
|
|
)
|
|
);
|
|
});
|
|
e.s(["default", 0, m], 673135);
|
|
};
|
|
|
|
export default moduleFactory;
|