320 lines
10 KiB
JavaScript
320 lines
10 KiB
JavaScript
import {
|
|
_objectWithoutPropertiesLoose
|
|
} from "./chunk-4NTHFIFD.js";
|
|
import {
|
|
require_react
|
|
} from "./chunk-7ZNOTH45.js";
|
|
import {
|
|
_defineProperty,
|
|
init_defineProperty
|
|
} from "./chunk-R546NDVX.js";
|
|
import {
|
|
__toESM
|
|
} from "./chunk-V4OQ3NZ2.js";
|
|
|
|
// node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
|
|
function _arrayWithHoles(r) {
|
|
if (Array.isArray(r)) return r;
|
|
}
|
|
|
|
// node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
|
|
function _iterableToArrayLimit(r, l) {
|
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
if (null != t) {
|
|
var e, n, i, u, a = [], f = true, o = false;
|
|
try {
|
|
if (i = (t = t.call(r)).next, 0 === l) {
|
|
if (Object(t) !== t) return;
|
|
f = false;
|
|
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = true) ;
|
|
} catch (r2) {
|
|
o = true, n = r2;
|
|
} finally {
|
|
try {
|
|
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
} finally {
|
|
if (o) throw n;
|
|
}
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
|
|
// node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
|
|
function _arrayLikeToArray(r, a) {
|
|
(null == a || a > r.length) && (a = r.length);
|
|
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
return n;
|
|
}
|
|
|
|
// node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
|
|
function _unsupportedIterableToArray(r, a) {
|
|
if (r) {
|
|
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
var t = {}.toString.call(r).slice(8, -1);
|
|
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
}
|
|
}
|
|
|
|
// node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
|
|
function _nonIterableRest() {
|
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
}
|
|
|
|
// node_modules/@babel/runtime/helpers/esm/slicedToArray.js
|
|
function _slicedToArray(r, e) {
|
|
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
}
|
|
|
|
// node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
|
|
function _objectWithoutProperties(e, t) {
|
|
if (null == e) return {};
|
|
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
if (Object.getOwnPropertySymbols) {
|
|
var n = Object.getOwnPropertySymbols(e);
|
|
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
}
|
|
return i;
|
|
}
|
|
|
|
// node_modules/@babel/runtime/helpers/esm/objectSpread2.js
|
|
init_defineProperty();
|
|
function ownKeys(e, r) {
|
|
var t = Object.keys(e);
|
|
if (Object.getOwnPropertySymbols) {
|
|
var o = Object.getOwnPropertySymbols(e);
|
|
r && (o = o.filter(function(r2) {
|
|
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
})), t.push.apply(t, o);
|
|
}
|
|
return t;
|
|
}
|
|
function _objectSpread2(e) {
|
|
for (var r = 1; r < arguments.length; r++) {
|
|
var t = null != arguments[r] ? arguments[r] : {};
|
|
r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
|
|
_defineProperty(e, r2, t[r2]);
|
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
|
|
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
});
|
|
}
|
|
return e;
|
|
}
|
|
|
|
// node_modules/rc-util/es/Dom/canUseDom.js
|
|
function canUseDom() {
|
|
return !!(typeof window !== "undefined" && window.document && window.document.createElement);
|
|
}
|
|
|
|
// node_modules/rc-util/es/Dom/contains.js
|
|
function contains(root, n) {
|
|
if (!root) {
|
|
return false;
|
|
}
|
|
if (root.contains) {
|
|
return root.contains(n);
|
|
}
|
|
var node = n;
|
|
while (node) {
|
|
if (node === root) {
|
|
return true;
|
|
}
|
|
node = node.parentNode;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// node_modules/rc-util/es/Dom/dynamicCSS.js
|
|
var APPEND_ORDER = "data-rc-order";
|
|
var APPEND_PRIORITY = "data-rc-priority";
|
|
var MARK_KEY = "rc-util-key";
|
|
var containerCache = /* @__PURE__ */ new Map();
|
|
function getMark() {
|
|
var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, mark = _ref.mark;
|
|
if (mark) {
|
|
return mark.startsWith("data-") ? mark : "data-".concat(mark);
|
|
}
|
|
return MARK_KEY;
|
|
}
|
|
function getContainer(option) {
|
|
if (option.attachTo) {
|
|
return option.attachTo;
|
|
}
|
|
var head = document.querySelector("head");
|
|
return head || document.body;
|
|
}
|
|
function getOrder(prepend) {
|
|
if (prepend === "queue") {
|
|
return "prependQueue";
|
|
}
|
|
return prepend ? "prepend" : "append";
|
|
}
|
|
function findStyles(container) {
|
|
return Array.from((containerCache.get(container) || container).children).filter(function(node) {
|
|
return node.tagName === "STYLE";
|
|
});
|
|
}
|
|
function injectCSS(css) {
|
|
var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
if (!canUseDom()) {
|
|
return null;
|
|
}
|
|
var csp = option.csp, prepend = option.prepend, _option$priority = option.priority, priority = _option$priority === void 0 ? 0 : _option$priority;
|
|
var mergedOrder = getOrder(prepend);
|
|
var isPrependQueue = mergedOrder === "prependQueue";
|
|
var styleNode = document.createElement("style");
|
|
styleNode.setAttribute(APPEND_ORDER, mergedOrder);
|
|
if (isPrependQueue && priority) {
|
|
styleNode.setAttribute(APPEND_PRIORITY, "".concat(priority));
|
|
}
|
|
if (csp !== null && csp !== void 0 && csp.nonce) {
|
|
styleNode.nonce = csp === null || csp === void 0 ? void 0 : csp.nonce;
|
|
}
|
|
styleNode.innerHTML = css;
|
|
var container = getContainer(option);
|
|
var firstChild = container.firstChild;
|
|
if (prepend) {
|
|
if (isPrependQueue) {
|
|
var existStyle = (option.styles || findStyles(container)).filter(function(node) {
|
|
if (!["prepend", "prependQueue"].includes(node.getAttribute(APPEND_ORDER))) {
|
|
return false;
|
|
}
|
|
var nodePriority = Number(node.getAttribute(APPEND_PRIORITY) || 0);
|
|
return priority >= nodePriority;
|
|
});
|
|
if (existStyle.length) {
|
|
container.insertBefore(styleNode, existStyle[existStyle.length - 1].nextSibling);
|
|
return styleNode;
|
|
}
|
|
}
|
|
container.insertBefore(styleNode, firstChild);
|
|
} else {
|
|
container.appendChild(styleNode);
|
|
}
|
|
return styleNode;
|
|
}
|
|
function findExistNode(key) {
|
|
var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
var container = getContainer(option);
|
|
return (option.styles || findStyles(container)).find(function(node) {
|
|
return node.getAttribute(getMark(option)) === key;
|
|
});
|
|
}
|
|
function removeCSS(key) {
|
|
var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
var existNode = findExistNode(key, option);
|
|
if (existNode) {
|
|
var container = getContainer(option);
|
|
container.removeChild(existNode);
|
|
}
|
|
}
|
|
function syncRealContainer(container, option) {
|
|
var cachedRealContainer = containerCache.get(container);
|
|
if (!cachedRealContainer || !contains(document, cachedRealContainer)) {
|
|
var placeholderStyle = injectCSS("", option);
|
|
var parentNode = placeholderStyle.parentNode;
|
|
containerCache.set(container, parentNode);
|
|
container.removeChild(placeholderStyle);
|
|
}
|
|
}
|
|
function updateCSS(css, key) {
|
|
var originOption = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
var container = getContainer(originOption);
|
|
var styles = findStyles(container);
|
|
var option = _objectSpread2(_objectSpread2({}, originOption), {}, {
|
|
styles
|
|
});
|
|
syncRealContainer(container, option);
|
|
var existNode = findExistNode(key, option);
|
|
if (existNode) {
|
|
var _option$csp, _option$csp2;
|
|
if ((_option$csp = option.csp) !== null && _option$csp !== void 0 && _option$csp.nonce && existNode.nonce !== ((_option$csp2 = option.csp) === null || _option$csp2 === void 0 ? void 0 : _option$csp2.nonce)) {
|
|
var _option$csp3;
|
|
existNode.nonce = (_option$csp3 = option.csp) === null || _option$csp3 === void 0 ? void 0 : _option$csp3.nonce;
|
|
}
|
|
if (existNode.innerHTML !== css) {
|
|
existNode.innerHTML = css;
|
|
}
|
|
return existNode;
|
|
}
|
|
var newNode = injectCSS(css, option);
|
|
newNode.setAttribute(getMark(option), key);
|
|
return newNode;
|
|
}
|
|
|
|
// node_modules/rc-util/es/warning.js
|
|
var warned = {};
|
|
var preWarningFns = [];
|
|
var preMessage = function preMessage2(fn) {
|
|
preWarningFns.push(fn);
|
|
};
|
|
function warning(valid, message) {
|
|
if (!valid && console !== void 0) {
|
|
var finalMessage = preWarningFns.reduce(function(msg, preMessageFn) {
|
|
return preMessageFn(msg !== null && msg !== void 0 ? msg : "", "warning");
|
|
}, message);
|
|
if (finalMessage) {
|
|
console.error("Warning: ".concat(finalMessage));
|
|
}
|
|
}
|
|
}
|
|
function note(valid, message) {
|
|
if (!valid && console !== void 0) {
|
|
var finalMessage = preWarningFns.reduce(function(msg, preMessageFn) {
|
|
return preMessageFn(msg !== null && msg !== void 0 ? msg : "", "note");
|
|
}, message);
|
|
if (finalMessage) {
|
|
console.warn("Note: ".concat(finalMessage));
|
|
}
|
|
}
|
|
}
|
|
function resetWarned() {
|
|
warned = {};
|
|
}
|
|
function call(method, valid, message) {
|
|
if (!valid && !warned[message]) {
|
|
method(false, message);
|
|
warned[message] = true;
|
|
}
|
|
}
|
|
function warningOnce(valid, message) {
|
|
call(warning, valid, message);
|
|
}
|
|
function noteOnce(valid, message) {
|
|
call(note, valid, message);
|
|
}
|
|
warningOnce.preMessage = preMessage;
|
|
warningOnce.resetWarned = resetWarned;
|
|
warningOnce.noteOnce = noteOnce;
|
|
var warning_default = warningOnce;
|
|
|
|
// node_modules/rc-util/es/hooks/useMemo.js
|
|
var React = __toESM(require_react());
|
|
function useMemo(getValue, condition, shouldUpdate) {
|
|
var cacheRef = React.useRef({});
|
|
if (!("value" in cacheRef.current) || shouldUpdate(cacheRef.current.condition, condition)) {
|
|
cacheRef.current.value = getValue();
|
|
cacheRef.current.condition = condition;
|
|
}
|
|
return cacheRef.current.value;
|
|
}
|
|
|
|
export {
|
|
_arrayWithHoles,
|
|
_arrayLikeToArray,
|
|
_unsupportedIterableToArray,
|
|
_nonIterableRest,
|
|
_slicedToArray,
|
|
_objectWithoutProperties,
|
|
_objectSpread2,
|
|
canUseDom,
|
|
contains,
|
|
removeCSS,
|
|
updateCSS,
|
|
warning,
|
|
noteOnce,
|
|
warning_default,
|
|
useMemo
|
|
};
|
|
//# sourceMappingURL=chunk-KBMHTFOP.js.map
|