antd-mobile
Version:
<div align="center">
1,521 lines (1,520 loc) • 882 kB
JavaScript
import * as React$1 from "react";
import React__default, { useContext, useRef, useMemo, useEffect, useState, useCallback, useLayoutEffect as useLayoutEffect$1, forwardRef, useImperativeHandle, memo, isValidElement, createContext, cloneElement } from "react";
import * as ReactDOM from "react-dom";
import { unstable_batchedUpdates, createPortal, findDOMNode } from "react-dom";
const canUseDom$1 = !!(typeof window !== "undefined" && typeof document !== "undefined" && window.document && window.document.createElement);
if (canUseDom$1) {
document.addEventListener("touchstart", () => {
}, true);
}
var __assign = function() {
__assign = Object.assign || function __assign2(t) {
for (var s, i2 = 1, n2 = arguments.length; i2 < n2; i2++) {
s = arguments[i2];
for (var p in s)
if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function __rest(s, e2) {
var t = {};
for (var p in s)
if (Object.prototype.hasOwnProperty.call(s, p) && e2.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i2 = 0, p = Object.getOwnPropertySymbols(s); i2 < p.length; i2++) {
if (e2.indexOf(p[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i2]))
t[p[i2]] = s[p[i2]];
}
return t;
}
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) {
return value instanceof P ? value : new P(function(resolve) {
resolve(value);
});
}
return new (P || (P = Promise))(function(resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e2) {
reject(e2);
}
}
function rejected(value) {
try {
step(generator["throw"](value));
} catch (e2) {
reject(e2);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function() {
if (t[0] & 1)
throw t[1];
return t[1];
}, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
return this;
}), g;
function verb(n2) {
return function(v) {
return step([n2, v]);
};
}
function step(op) {
if (f)
throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _)
try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
return t;
if (y = 0, t)
op = [op[0] & 2, t.value];
switch (op[0]) {
case 0:
case 1:
t = op;
break;
case 4:
_.label++;
return { value: op[1], done: false };
case 5:
_.label++;
y = op[1];
op = [0];
continue;
case 7:
op = _.ops.pop();
_.trys.pop();
continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
_ = 0;
continue;
}
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
_.label = op[1];
break;
}
if (op[0] === 6 && _.label < t[1]) {
_.label = t[1];
t = op;
break;
}
if (t && _.label < t[2]) {
_.label = t[2];
_.ops.push(op);
break;
}
if (t[2])
_.ops.pop();
_.trys.pop();
continue;
}
op = body.call(thisArg, _);
} catch (e2) {
op = [6, e2];
y = 0;
} finally {
f = t = 0;
}
if (op[0] & 5)
throw op[1];
return { value: op[0] ? op[1] : void 0, done: true };
}
}
function __values(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i2 = 0;
if (m)
return m.call(o);
if (o && typeof o.length === "number")
return {
next: function() {
if (o && i2 >= o.length)
o = void 0;
return { value: o && o[i2++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function __read(o, n2) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m)
return o;
var i2 = m.call(o), r, ar = [], e2;
try {
while ((n2 === void 0 || n2-- > 0) && !(r = i2.next()).done)
ar.push(r.value);
} catch (error) {
e2 = { error };
} finally {
try {
if (r && !r.done && (m = i2["return"]))
m.call(i2);
} finally {
if (e2)
throw e2.error;
}
}
return ar;
}
function __spreadArray(to2, from, pack) {
if (pack || arguments.length === 2)
for (var i2 = 0, l = from.length, ar; i2 < l; i2++) {
if (ar || !(i2 in from)) {
if (!ar)
ar = Array.prototype.slice.call(from, 0, i2);
ar[i2] = from[i2];
}
}
return to2.concat(ar || Array.prototype.slice.call(from));
}
typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
var e2 = new Error(message);
return e2.name = "SuppressedError", e2.error = error, e2.suppressed = suppressed, e2;
};
const typeTemplate$1 = "${label}不是一个有效的${type}";
const zhCN = {
locale: "zh-CH",
common: {
confirm: "确定",
cancel: "取消",
loading: "加载中",
close: "关闭"
},
Calendar: {
title: "日期选择",
confirm: "确认",
start: "开始",
end: "结束",
today: "今日",
markItems: ["一", "二", "三", "四", "五", "六", "日"],
yearAndMonth: "${year}年${month}月"
},
Cascader: {
placeholder: "请选择"
},
Dialog: {
ok: "我知道了"
},
DatePicker: {
tillNow: "至今"
},
ErrorBlock: {
default: {
title: "页面遇到一些小问题",
description: "待会来试试"
},
busy: {
title: "前方拥堵",
description: "刷新试试"
},
disconnected: {
title: "网络有点忙",
description: "动动手指帮忙修复"
},
empty: {
title: "没有找到你需要的东西",
description: "找找其他的吧"
}
},
Form: {
required: "必填",
optional: "选填",
defaultValidateMessages: {
default: "字段验证错误${label}",
required: "请输入${label}",
enum: "${label}必须是其中一个[${enum}]",
whitespace: "${label}不能为空字符",
date: {
format: "${label}日期格式无效",
parse: "${label}不能转换为日期",
invalid: "${label}是一个无效日期"
},
types: {
string: typeTemplate$1,
method: typeTemplate$1,
array: typeTemplate$1,
object: typeTemplate$1,
number: typeTemplate$1,
date: typeTemplate$1,
boolean: typeTemplate$1,
integer: typeTemplate$1,
float: typeTemplate$1,
regexp: typeTemplate$1,
email: typeTemplate$1,
url: typeTemplate$1,
hex: typeTemplate$1
},
string: {
len: "${label}须为${len}个字符",
min: "${label}最少${min}个字符",
max: "${label}最多${max}个字符",
range: "${label}须在${min}-${max}字符之间"
},
number: {
len: "${label}必须等于${len}",
min: "${label}最小值为${min}",
max: "${label}最大值为${max}",
range: "${label}须在${min}-${max}之间"
},
array: {
len: "须为${len}个${label}",
min: "最少${min}个${label}",
max: "最多${max}个${label}",
range: "${label}数量须在${min}-${max}之间"
},
pattern: {
mismatch: "${label}与模式不匹配${pattern}"
}
}
},
ImageUploader: {
uploading: "上传中...",
upload: "上传"
},
InfiniteScroll: {
noMore: "没有更多了",
failedToLoad: "加载失败",
retry: "重新加载"
},
Input: {
clear: "清除"
},
Mask: {
name: "背景蒙层"
},
Modal: {
ok: "我知道了"
},
PasscodeInput: {
name: "密码输入框"
},
PullToRefresh: {
pulling: "下拉刷新",
canRelease: "释放立即刷新",
complete: "刷新成功"
},
SearchBar: {
name: "搜索框"
},
Slider: {
name: "滑动输入条"
},
Stepper: {
decrease: "减少",
increase: "增加"
},
Switch: {
name: "开关"
},
Selector: {
name: "选择组"
}
};
const zhCN$1 = zhCN;
const defaultConfigRef = {
current: {
locale: zhCN$1
}
};
function setDefaultConfig(config2) {
defaultConfigRef.current = config2;
}
function getDefaultConfig() {
return defaultConfigRef.current;
}
const ConfigContext = React__default.createContext(null);
const ConfigProvider = (props) => {
const {
children
} = props, config2 = __rest(props, ["children"]);
const parentConfig = useConfig();
return React__default.createElement(ConfigContext.Provider, {
value: Object.assign(Object.assign({}, parentConfig), config2)
}, children);
};
function useConfig() {
var _a;
return (_a = useContext(ConfigContext)) !== null && _a !== void 0 ? _a : getDefaultConfig();
}
function attachPropertiesToComponent(component, properties) {
const ret = component;
for (const key in properties) {
if (properties.hasOwnProperty(key)) {
ret[key] = properties[key];
}
}
return ret;
}
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
function getDefaultExportFromCjs(x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
}
var classnames = { exports: {} };
/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
(function(module) {
(function() {
var hasOwn = {}.hasOwnProperty;
function classNames2() {
var classes = [];
for (var i2 = 0; i2 < arguments.length; i2++) {
var arg = arguments[i2];
if (!arg)
continue;
var argType = typeof arg;
if (argType === "string" || argType === "number") {
classes.push(arg);
} else if (Array.isArray(arg)) {
if (arg.length) {
var inner = classNames2.apply(null, arg);
if (inner) {
classes.push(inner);
}
}
} else if (argType === "object") {
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
classes.push(arg.toString());
continue;
}
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
classes.push(key);
}
}
}
}
return classes.join(" ");
}
if (module.exports) {
classNames2.default = classNames2;
module.exports = classNames2;
} else {
window.classNames = classNames2;
}
})();
})(classnames);
var classnamesExports = classnames.exports;
const classNames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
function withNativeProps(props, element) {
const p = Object.assign({}, element.props);
if (props.className) {
p.className = classNames(element.props.className, props.className);
}
if (props.style) {
p.style = Object.assign(Object.assign({}, p.style), props.style);
}
if (props.tabIndex !== void 0) {
p.tabIndex = props.tabIndex;
}
for (const key in props) {
if (!props.hasOwnProperty(key))
continue;
if (key.startsWith("data-") || key.startsWith("aria-")) {
p[key] = props[key];
}
}
return React__default.cloneElement(element, p);
}
function mergeProps(...items) {
const ret = {};
items.forEach((item) => {
if (item) {
Object.keys(item).forEach((key) => {
if (item[key] !== void 0) {
ret[key] = item[key];
}
});
}
});
return ret;
}
function mergeProp(defaultProp, ...propList) {
for (let i2 = propList.length - 1; i2 >= 0; i2 -= 1) {
if (propList[i2] !== void 0) {
return propList[i2];
}
}
return defaultProp;
}
var createUpdateEffect = function(hook) {
return function(effect, deps) {
var isMounted = useRef(false);
hook(function() {
return function() {
isMounted.current = false;
};
}, []);
hook(function() {
if (!isMounted.current) {
isMounted.current = true;
} else {
return effect();
}
}, deps);
};
};
var isFunction = function(value) {
return typeof value === "function";
};
var isNumber = function(value) {
return typeof value === "number";
};
var isDev = true;
const isDev$1 = isDev;
function useMemoizedFn(fn) {
if (isDev$1) {
if (!isFunction(fn)) {
console.error("useMemoizedFn expected parameter is a function, got ".concat(typeof fn));
}
}
var fnRef = useRef(fn);
fnRef.current = useMemo(function() {
return fn;
}, [fn]);
var memoizedFn = useRef();
if (!memoizedFn.current) {
memoizedFn.current = function() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return fnRef.current.apply(this, args);
};
}
return memoizedFn.current;
}
const useUpdateEffect = createUpdateEffect(useEffect);
function depsAreSame(oldDeps, deps) {
if (oldDeps === deps)
return true;
for (var i2 = 0; i2 < oldDeps.length; i2++) {
if (!Object.is(oldDeps[i2], deps[i2]))
return false;
}
return true;
}
function useLatest(value) {
var ref = useRef(value);
ref.current = value;
return ref;
}
var useUnmount = function(fn) {
if (isDev$1) {
if (!isFunction(fn)) {
console.error("useUnmount expected parameter is a function, got ".concat(typeof fn));
}
}
var fnRef = useLatest(fn);
useEffect(function() {
return function() {
fnRef.current();
};
}, []);
};
const useUnmount$1 = useUnmount;
function isObject$4(value) {
var type4 = typeof value;
return value != null && (type4 == "object" || type4 == "function");
}
var isObject_1 = isObject$4;
var freeGlobal$1 = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
var _freeGlobal = freeGlobal$1;
var freeGlobal = _freeGlobal;
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
var root$2 = freeGlobal || freeSelf || Function("return this")();
var _root = root$2;
var root$1 = _root;
var now$1 = function() {
return root$1.Date.now();
};
var now_1 = now$1;
var reWhitespace = /\s/;
function trimmedEndIndex$1(string3) {
var index2 = string3.length;
while (index2-- && reWhitespace.test(string3.charAt(index2))) {
}
return index2;
}
var _trimmedEndIndex = trimmedEndIndex$1;
var trimmedEndIndex = _trimmedEndIndex;
var reTrimStart = /^\s+/;
function baseTrim$1(string3) {
return string3 ? string3.slice(0, trimmedEndIndex(string3) + 1).replace(reTrimStart, "") : string3;
}
var _baseTrim = baseTrim$1;
var root = _root;
var Symbol$3 = root.Symbol;
var _Symbol = Symbol$3;
var Symbol$2 = _Symbol;
var objectProto$1 = Object.prototype;
var hasOwnProperty = objectProto$1.hasOwnProperty;
var nativeObjectToString$1 = objectProto$1.toString;
var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
function getRawTag$1(value) {
var isOwn = hasOwnProperty.call(value, symToStringTag$1), tag = value[symToStringTag$1];
try {
value[symToStringTag$1] = void 0;
var unmasked = true;
} catch (e2) {
}
var result = nativeObjectToString$1.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag$1] = tag;
} else {
delete value[symToStringTag$1];
}
}
return result;
}
var _getRawTag = getRawTag$1;
var objectProto = Object.prototype;
var nativeObjectToString = objectProto.toString;
function objectToString$1(value) {
return nativeObjectToString.call(value);
}
var _objectToString = objectToString$1;
var Symbol$1 = _Symbol, getRawTag = _getRawTag, objectToString = _objectToString;
var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : void 0;
function baseGetTag$1(value) {
if (value == null) {
return value === void 0 ? undefinedTag : nullTag;
}
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
}
var _baseGetTag = baseGetTag$1;
function isObjectLike$1(value) {
return value != null && typeof value == "object";
}
var isObjectLike_1 = isObjectLike$1;
var baseGetTag = _baseGetTag, isObjectLike = isObjectLike_1;
var symbolTag = "[object Symbol]";
function isSymbol$1(value) {
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
}
var isSymbol_1 = isSymbol$1;
var baseTrim = _baseTrim, isObject$3 = isObject_1, isSymbol = isSymbol_1;
var NAN = 0 / 0;
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
var reIsBinary = /^0b[01]+$/i;
var reIsOctal = /^0o[0-7]+$/i;
var freeParseInt = parseInt;
function toNumber$1(value) {
if (typeof value == "number") {
return value;
}
if (isSymbol(value)) {
return NAN;
}
if (isObject$3(value)) {
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
value = isObject$3(other) ? other + "" : other;
}
if (typeof value != "string") {
return value === 0 ? value : +value;
}
value = baseTrim(value);
var isBinary = reIsBinary.test(value);
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
}
var toNumber_1 = toNumber$1;
var isObject$2 = isObject_1, now = now_1, toNumber = toNumber_1;
var FUNC_ERROR_TEXT$1 = "Expected a function";
var nativeMax = Math.max, nativeMin = Math.min;
function debounce$1(func, wait, options) {
var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
if (typeof func != "function") {
throw new TypeError(FUNC_ERROR_TEXT$1);
}
wait = toNumber(wait) || 0;
if (isObject$2(options)) {
leading = !!options.leading;
maxing = "maxWait" in options;
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
trailing = "trailing" in options ? !!options.trailing : trailing;
}
function invokeFunc(time) {
var args = lastArgs, thisArg = lastThis;
lastArgs = lastThis = void 0;
lastInvokeTime = time;
result = func.apply(thisArg, args);
return result;
}
function leadingEdge(time) {
lastInvokeTime = time;
timerId = setTimeout(timerExpired, wait);
return leading ? invokeFunc(time) : result;
}
function remainingWait(time) {
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
}
function shouldInvoke(time) {
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
}
function timerExpired() {
var time = now();
if (shouldInvoke(time)) {
return trailingEdge(time);
}
timerId = setTimeout(timerExpired, remainingWait(time));
}
function trailingEdge(time) {
timerId = void 0;
if (trailing && lastArgs) {
return invokeFunc(time);
}
lastArgs = lastThis = void 0;
return result;
}
function cancel() {
if (timerId !== void 0) {
clearTimeout(timerId);
}
lastInvokeTime = 0;
lastArgs = lastCallTime = lastThis = timerId = void 0;
}
function flush2() {
return timerId === void 0 ? result : trailingEdge(now());
}
function debounced() {
var time = now(), isInvoking = shouldInvoke(time);
lastArgs = arguments;
lastThis = this;
lastCallTime = time;
if (isInvoking) {
if (timerId === void 0) {
return leadingEdge(lastCallTime);
}
if (maxing) {
clearTimeout(timerId);
timerId = setTimeout(timerExpired, wait);
return invokeFunc(lastCallTime);
}
}
if (timerId === void 0) {
timerId = setTimeout(timerExpired, wait);
}
return result;
}
debounced.cancel = cancel;
debounced.flush = flush2;
return debounced;
}
var debounce_1 = debounce$1;
const debounce$2 = /* @__PURE__ */ getDefaultExportFromCjs(debounce_1);
var isBrowser$2 = !!(typeof window !== "undefined" && window.document && window.document.createElement);
const isBrowser$3 = isBrowser$2;
var debounce = debounce_1, isObject$1 = isObject_1;
var FUNC_ERROR_TEXT = "Expected a function";
function throttle$1(func, wait, options) {
var leading = true, trailing = true;
if (typeof func != "function") {
throw new TypeError(FUNC_ERROR_TEXT);
}
if (isObject$1(options)) {
leading = "leading" in options ? !!options.leading : leading;
trailing = "trailing" in options ? !!options.trailing : trailing;
}
return debounce(func, wait, {
"leading": leading,
"maxWait": wait,
"trailing": trailing
});
}
var throttle_1 = throttle$1;
const throttle$2 = /* @__PURE__ */ getDefaultExportFromCjs(throttle_1);
var useMount = function(fn) {
if (isDev$1) {
if (!isFunction(fn)) {
console.error('useMount: parameter `fn` expected to be a function, but got "'.concat(typeof fn, '".'));
}
}
useEffect(function() {
fn === null || fn === void 0 ? void 0 : fn();
}, []);
};
const useMount$1 = useMount;
var useUpdate = function() {
var _a = __read(useState({}), 2), setState = _a[1];
return useCallback(function() {
return setState({});
}, []);
};
const useUpdate$1 = useUpdate;
function getTargetElement(target, defaultElement) {
if (!isBrowser$3) {
return void 0;
}
if (!target) {
return defaultElement;
}
var targetElement;
if (isFunction(target)) {
targetElement = target();
} else if ("current" in target) {
targetElement = target.current;
} else {
targetElement = target;
}
return targetElement;
}
var checkIfAllInShadow = function(targets) {
return targets.every(function(item) {
var targetElement = getTargetElement(item);
if (!targetElement)
return false;
if (targetElement.getRootNode() instanceof ShadowRoot)
return true;
});
};
var getShadow = function(node) {
if (!node) {
return document;
}
return node.getRootNode();
};
var getDocumentOrShadow = function(target) {
if (!target || !document.getRootNode) {
return document;
}
var targets = Array.isArray(target) ? target : [target];
if (checkIfAllInShadow(targets)) {
return getShadow(getTargetElement(targets[0]));
}
return document;
};
const getDocumentOrShadow$1 = getDocumentOrShadow;
var createEffectWithTarget = function(useEffectType) {
var useEffectWithTarget2 = function(effect, deps, target) {
var hasInitRef = useRef(false);
var lastElementRef = useRef([]);
var lastDepsRef = useRef([]);
var unLoadRef = useRef();
useEffectType(function() {
var _a;
var targets = Array.isArray(target) ? target : [target];
var els = targets.map(function(item) {
return getTargetElement(item);
});
if (!hasInitRef.current) {
hasInitRef.current = true;
lastElementRef.current = els;
lastDepsRef.current = deps;
unLoadRef.current = effect();
return;
}
if (els.length !== lastElementRef.current.length || !depsAreSame(els, lastElementRef.current) || !depsAreSame(deps, lastDepsRef.current)) {
(_a = unLoadRef.current) === null || _a === void 0 ? void 0 : _a.call(unLoadRef);
lastElementRef.current = els;
lastDepsRef.current = deps;
unLoadRef.current = effect();
}
});
useUnmount$1(function() {
var _a;
(_a = unLoadRef.current) === null || _a === void 0 ? void 0 : _a.call(unLoadRef);
hasInitRef.current = false;
});
};
return useEffectWithTarget2;
};
const createEffectWithTarget$1 = createEffectWithTarget;
var useEffectWithTarget$1 = createEffectWithTarget$1(useEffect);
const useEffectWithTarget$2 = useEffectWithTarget$1;
function useClickAway(onClickAway, target, eventName) {
if (eventName === void 0) {
eventName = "click";
}
var onClickAwayRef = useLatest(onClickAway);
useEffectWithTarget$2(function() {
var handler = function(event) {
var targets = Array.isArray(target) ? target : [target];
if (targets.some(function(item) {
var targetElement = getTargetElement(item);
return !targetElement || targetElement.contains(event.target);
})) {
return;
}
onClickAwayRef.current(event);
};
var documentOrShadow = getDocumentOrShadow$1(target);
var eventNames = Array.isArray(eventName) ? eventName : [eventName];
eventNames.forEach(function(event) {
return documentOrShadow.addEventListener(event, handler);
});
return function() {
eventNames.forEach(function(event) {
return documentOrShadow.removeEventListener(event, handler);
});
};
}, Array.isArray(eventName) ? eventName : [eventName], target);
}
var dayjs_min = { exports: {} };
(function(module, exports) {
!function(t, e2) {
module.exports = e2();
}(commonjsGlobal, function() {
var t = 1e3, e2 = 6e4, n2 = 36e5, r = "millisecond", i2 = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
var e3 = ["th", "st", "nd", "rd"], n3 = t2 % 100;
return "[" + t2 + (e3[(n3 - 20) % 10] || e3[n3] || e3[0]) + "]";
} }, m = function(t2, e3, n3) {
var r2 = String(t2);
return !r2 || r2.length >= e3 ? t2 : "" + Array(e3 + 1 - r2.length).join(n3) + t2;
}, v = { s: m, z: function(t2) {
var e3 = -t2.utcOffset(), n3 = Math.abs(e3), r2 = Math.floor(n3 / 60), i3 = n3 % 60;
return (e3 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i3, 2, "0");
}, m: function t2(e3, n3) {
if (e3.date() < n3.date())
return -t2(n3, e3);
var r2 = 12 * (n3.year() - e3.year()) + (n3.month() - e3.month()), i3 = e3.clone().add(r2, c), s2 = n3 - i3 < 0, u2 = e3.clone().add(r2 + (s2 ? -1 : 1), c);
return +(-(r2 + (n3 - i3) / (s2 ? i3 - u2 : u2 - i3)) || 0);
}, a: function(t2) {
return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
}, p: function(t2) {
return { M: c, y: h, w: o, d: a, D: d, h: u, m: s, s: i2, ms: r, Q: f }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
}, u: function(t2) {
return void 0 === t2;
} }, g = "en", D = {};
D[g] = M;
var p = function(t2) {
return t2 instanceof b;
}, S = function t2(e3, n3, r2) {
var i3;
if (!e3)
return g;
if ("string" == typeof e3) {
var s2 = e3.toLowerCase();
D[s2] && (i3 = s2), n3 && (D[s2] = n3, i3 = s2);
var u2 = e3.split("-");
if (!i3 && u2.length > 1)
return t2(u2[0]);
} else {
var a2 = e3.name;
D[a2] = e3, i3 = a2;
}
return !r2 && i3 && (g = i3), i3 || !r2 && g;
}, w = function(t2, e3) {
if (p(t2))
return t2.clone();
var n3 = "object" == typeof e3 ? e3 : {};
return n3.date = t2, n3.args = arguments, new b(n3);
}, O = v;
O.l = S, O.i = p, O.w = function(t2, e3) {
return w(t2, { locale: e3.$L, utc: e3.$u, x: e3.$x, $offset: e3.$offset });
};
var b = function() {
function M2(t2) {
this.$L = S(t2.locale, null, true), this.parse(t2);
}
var m2 = M2.prototype;
return m2.parse = function(t2) {
this.$d = function(t3) {
var e3 = t3.date, n3 = t3.utc;
if (null === e3)
return /* @__PURE__ */ new Date(NaN);
if (O.u(e3))
return /* @__PURE__ */ new Date();
if (e3 instanceof Date)
return new Date(e3);
if ("string" == typeof e3 && !/Z$/i.test(e3)) {
var r2 = e3.match($);
if (r2) {
var i3 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
return n3 ? new Date(Date.UTC(r2[1], i3, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i3, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
}
}
return new Date(e3);
}(t2), this.$x = t2.x || {}, this.init();
}, m2.init = function() {
var t2 = this.$d;
this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
}, m2.$utils = function() {
return O;
}, m2.isValid = function() {
return !(this.$d.toString() === l);
}, m2.isSame = function(t2, e3) {
var n3 = w(t2);
return this.startOf(e3) <= n3 && n3 <= this.endOf(e3);
}, m2.isAfter = function(t2, e3) {
return w(t2) < this.startOf(e3);
}, m2.isBefore = function(t2, e3) {
return this.endOf(e3) < w(t2);
}, m2.$g = function(t2, e3, n3) {
return O.u(t2) ? this[e3] : this.set(n3, t2);
}, m2.unix = function() {
return Math.floor(this.valueOf() / 1e3);
}, m2.valueOf = function() {
return this.$d.getTime();
}, m2.startOf = function(t2, e3) {
var n3 = this, r2 = !!O.u(e3) || e3, f2 = O.p(t2), l2 = function(t3, e4) {
var i3 = O.w(n3.$u ? Date.UTC(n3.$y, e4, t3) : new Date(n3.$y, e4, t3), n3);
return r2 ? i3 : i3.endOf(a);
}, $2 = function(t3, e4) {
return O.w(n3.toDate()[t3].apply(n3.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e4)), n3);
}, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
switch (f2) {
case h:
return r2 ? l2(1, 0) : l2(31, 11);
case c:
return r2 ? l2(1, M3) : l2(0, M3 + 1);
case o:
var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
case a:
case d:
return $2(v2 + "Hours", 0);
case u:
return $2(v2 + "Minutes", 1);
case s:
return $2(v2 + "Seconds", 2);
case i2:
return $2(v2 + "Milliseconds", 3);
default:
return this.clone();
}
}, m2.endOf = function(t2) {
return this.startOf(t2, false);
}, m2.$set = function(t2, e3) {
var n3, o2 = O.p(t2), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n3 = {}, n3[a] = f2 + "Date", n3[d] = f2 + "Date", n3[c] = f2 + "Month", n3[h] = f2 + "FullYear", n3[u] = f2 + "Hours", n3[s] = f2 + "Minutes", n3[i2] = f2 + "Seconds", n3[r] = f2 + "Milliseconds", n3)[o2], $2 = o2 === a ? this.$D + (e3 - this.$W) : e3;
if (o2 === c || o2 === h) {
var y2 = this.clone().set(d, 1);
y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
} else
l2 && this.$d[l2]($2);
return this.init(), this;
}, m2.set = function(t2, e3) {
return this.clone().$set(t2, e3);
}, m2.get = function(t2) {
return this[O.p(t2)]();
}, m2.add = function(r2, f2) {
var d2, l2 = this;
r2 = Number(r2);
var $2 = O.p(f2), y2 = function(t2) {
var e3 = w(l2);
return O.w(e3.date(e3.date() + Math.round(t2 * r2)), l2);
};
if ($2 === c)
return this.set(c, this.$M + r2);
if ($2 === h)
return this.set(h, this.$y + r2);
if ($2 === a)
return y2(1);
if ($2 === o)
return y2(7);
var M3 = (d2 = {}, d2[s] = e2, d2[u] = n2, d2[i2] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
return O.w(m3, this);
}, m2.subtract = function(t2, e3) {
return this.add(-1 * t2, e3);
}, m2.format = function(t2) {
var e3 = this, n3 = this.$locale();
if (!this.isValid())
return n3.invalidDate || l;
var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i3 = O.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n3.weekdays, c6 = n3.months, f2 = n3.meridiem, h2 = function(t3, n4, i4, s3) {
return t3 && (t3[n4] || t3(e3, r2)) || i4[n4].slice(0, s3);
}, d2 = function(t3) {
return O.s(s2 % 12 || 12, t3, "0");
}, $2 = f2 || function(t3, e4, n4) {
var r3 = t3 < 12 ? "AM" : "PM";
return n4 ? r3.toLowerCase() : r3;
};
return r2.replace(y, function(t3, r3) {
return r3 || function(t4) {
switch (t4) {
case "YY":
return String(e3.$y).slice(-2);
case "YYYY":
return O.s(e3.$y, 4, "0");
case "M":
return a2 + 1;
case "MM":
return O.s(a2 + 1, 2, "0");
case "MMM":
return h2(n3.monthsShort, a2, c6, 3);
case "MMMM":
return h2(c6, a2);
case "D":
return e3.$D;
case "DD":
return O.s(e3.$D, 2, "0");
case "d":
return String(e3.$W);
case "dd":
return h2(n3.weekdaysMin, e3.$W, o2, 2);
case "ddd":
return h2(n3.weekdaysShort, e3.$W, o2, 3);
case "dddd":
return o2[e3.$W];
case "H":
return String(s2);
case "HH":
return O.s(s2, 2, "0");
case "h":
return d2(1);
case "hh":
return d2(2);
case "a":
return $2(s2, u2, true);
case "A":
return $2(s2, u2, false);
case "m":
return String(u2);
case "mm":
return O.s(u2, 2, "0");
case "s":
return String(e3.$s);
case "ss":
return O.s(e3.$s, 2, "0");
case "SSS":
return O.s(e3.$ms, 3, "0");
case "Z":
return i3;
}
return null;
}(t3) || i3.replace(":", "");
});
}, m2.utcOffset = function() {
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
}, m2.diff = function(r2, d2, l2) {
var $2, y2 = this, M3 = O.p(d2), m3 = w(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e2, g2 = this - m3, D2 = function() {
return O.m(y2, m3);
};
switch (M3) {
case h:
$2 = D2() / 12;
break;
case c:
$2 = D2();
break;
case f:
$2 = D2() / 3;
break;
case o:
$2 = (g2 - v2) / 6048e5;
break;
case a:
$2 = (g2 - v2) / 864e5;
break;
case u:
$2 = g2 / n2;
break;
case s:
$2 = g2 / e2;
break;
case i2:
$2 = g2 / t;
break;
default:
$2 = g2;
}
return l2 ? $2 : O.a($2);
}, m2.daysInMonth = function() {
return this.endOf(c).$D;
}, m2.$locale = function() {
return D[this.$L];
}, m2.locale = function(t2, e3) {
if (!t2)
return this.$L;
var n3 = this.clone(), r2 = S(t2, e3, true);
return r2 && (n3.$L = r2), n3;
}, m2.clone = function() {
return O.w(this.$d, this);
}, m2.toDate = function() {
return new Date(this.valueOf());
}, m2.toJSON = function() {
return this.isValid() ? this.toISOString() : null;
}, m2.toISOString = function() {
return this.$d.toISOString();
}, m2.toString = function() {
return this.$d.toUTCString();
}, M2;
}(), _ = b.prototype;
return w.prototype = _, [["$ms", r], ["$s", i2], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach(function(t2) {
_[t2[1]] = function(e3) {
return this.$g(e3, t2[0], t2[1]);
};
}), w.extend = function(t2, e3) {
return t2.$i || (t2(e3, b, w), t2.$i = true), w;
}, w.locale = S, w.isDayjs = p, w.unix = function(t2) {
return w(1e3 * t2);
}, w.en = D[g], w.Ls = D, w.p = {}, w;
});
})(dayjs_min);
var dayjs_minExports = dayjs_min.exports;
const dayjs = /* @__PURE__ */ getDefaultExportFromCjs(dayjs_minExports);
function useDebounceFn(fn, options) {
var _a;
if (isDev$1) {
if (!isFunction(fn)) {
console.error("useDebounceFn expected parameter is a function, got ".concat(typeof fn));
}
}
var fnRef = useLatest(fn);
var wait = (_a = options === null || options === void 0 ? void 0 : options.wait) !== null && _a !== void 0 ? _a : 1e3;
var debounced = useMemo(function() {
return debounce$2(function() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return fnRef.current.apply(fnRef, __spreadArray([], __read(args), false));
}, wait, options);
}, []);
useUnmount$1(function() {
debounced.cancel();
});
return {
run: debounced,
cancel: debounced.cancel,
flush: debounced.flush
};
}
function useDebounceEffect(effect, deps, options) {
var _a = __read(useState({}), 2), flag = _a[0], setFlag = _a[1];
var run = useDebounceFn(function() {
setFlag({});
}, options).run;
useEffect(function() {
return run();
}, deps);
useUpdateEffect(effect, [flag]);
}
function useGetState(initialState) {
var _a = __read(useState(initialState), 2), state = _a[0], setState = _a[1];
var stateRef = useRef(state);
stateRef.current = state;
var getState = useCallback(function() {
return stateRef.current;
}, []);
return [state, setState, getState];
}
(function() {
if (typeof window !== "object") {
return;
}
if ("IntersectionObserver" in window && "IntersectionObserverEntry" in window && "intersectionRatio" in window.IntersectionObserverEntry.prototype) {
if (!("isIntersecting" in window.IntersectionObserverEntry.prototype)) {
Object.defineProperty(
window.IntersectionObserverEntry.prototype,
"isIntersecting",
{
get: function() {
return this.intersectionRatio > 0;
}
}
);
}
return;
}
function getFrameElement(doc) {
try {
return doc.defaultView && doc.defaultView.frameElement || null;
} catch (e2) {
return null;
}
}
var document2 = function(startDoc) {
var doc = startDoc;
var frame = getFrameElement(doc);
while (frame) {
doc = frame.ownerDocument;
frame = getFrameElement(doc);
}
return doc;
}(window.document);
var registry = [];
var crossOriginUpdater = null;
var crossOriginRect = null;
function IntersectionObserverEntry(entry) {
this.time = entry.time;
this.target = entry.target;
this.rootBounds = ensureDOMRect(entry.rootBounds);
this.boundingClientRect = ensureDOMRect(entry.boundingClientRect);
this.intersectionRect = ensureDOMRect(entry.intersectionRect || getEmptyRect());
this.isIntersecting = !!entry.intersectionRect;
var targetRect = this.boundingClientRect;
var targetArea = targetRect.width * targetRect.height;
var intersectionRect = this.intersectionRect;
var intersectionArea = intersectionRect.width * intersectionRect.height;
if (targetArea) {
this.intersectionRatio = Number((intersectionArea / targetArea).toFixed(4));
} else {
this.intersectionRatio = this.isIntersecting ? 1 : 0;
}
}
function IntersectionObserver2(callback, opt_options) {
var options = opt_options || {};
if (typeof callback != "function") {
throw new Error("callback must be a function");
}
if (options.root && options.root.nodeType != 1 && options.root.nodeType != 9) {
throw new Error("root must be a Document or Element");
}
this._checkForIntersections = throttle2(
this._checkForIntersections.bind(this),
this.THROTTLE_TIMEOUT
);
this._callback = callback;
this._observationTargets = [];
this._queuedEntries = [];
this._rootMarginValues = this._parseRootMargin(options.rootMargin);
this.thresholds = this._initThresholds(options.threshold);
this.root = options.root || null;
this.rootMargin = this._rootMarginValues.map(function(margin) {
return margin.value + margin.unit;
}).join(" ");
this._monitoringDocuments = [];
this._monitoringUnsubscribes = [];
}
IntersectionObserver2.prototype.THROTTLE_TIMEOUT = 100;
IntersectionObserver2.prototype.POLL_INTERVAL = null;
IntersectionObserver2.prototype.USE_MUTATION_OBSERVER = true;
IntersectionObserver2._setupCrossOriginUpdater = function() {
if (!crossOriginUpdater) {
crossOriginUpdater = function(boundingClientRect, intersectionRect) {
if (!boundingClientRect || !intersectionRect) {
crossOriginRect = getEmptyRect();
} else {
crossOriginRect = convertFromParentRect(boundingClientRect, intersectionRect);
}
registry.forEach(function(observer) {
observer._checkForIntersections();
});
};
}
return crossOriginUpdater;
};
IntersectionObserver2._resetCrossOriginUpdater = function() {
crossOriginUpdater = null;
crossOriginRect = null;
};
IntersectionObserver2.prototype.observe = function(target) {
var isTargetAlreadyObserved = this._observationTargets.some(function(item) {
return item.element == target;
});
if (isTargetAlreadyObserved) {
return;
}
if (!(target && target.nodeType == 1)) {
throw new Error("target must be an Element");
}
this._registerInstance();
this._observationTargets.push({ element: target, entry: null });
this._monitorIntersections(target.ownerDocument);
this._checkForIntersections();
};
IntersectionObserver2.prototype.unobserve = function(target) {
this._observationTargets = this._observationTargets.filter(function(item) {
return item.element != target;
});
this._unmonitorIntersections(target.ownerDocument);
if (this._observationTargets.length == 0) {
this._unregisterInstance();
}
};
IntersectionObserver2.prototype.disconnect = function() {
this._observationTargets = [];
this._unmonitorAllIntersections();
this._unregisterInstance();
};
IntersectionObserver2.prototype.takeRecords = function() {
var records = this._queuedEntries.slice();
this._queuedEntries = [];
return records;
};
IntersectionObserver2.prototype._initThresholds = function(opt_threshold) {
var threshold = opt_threshold || [0];
if (!Array.isArray(threshold))
threshold = [threshold];
return threshold.sort().filter(function(t, i2, a) {
if (typeof t != "number" || isNaN(t) || t < 0 || t > 1) {
throw new Error("threshold must be a number between 0 and 1 inclusively");
}
return t !== a[i2 - 1];
});
};
IntersectionObserver2.prototype._parseRootMargin = function(opt_rootMargin) {
var marginString = opt_rootMargin || "0px";
var margins = marginString.split(/\s+/).map(function(margin) {
var parts = /^(-?\d*\.?\d+)(px|%)$/.exec(margin);
if (!parts) {
throw new Error("rootMargin must be specified in pixels or percent");
}
return { value: parseFloat(parts[1]), unit: parts[2] };
});
margins[1] = margins[1] || margins[0];
margins[2] = margins[2] || margins[0];
margins[3] = margins[3] || margins[1];
return margins;
};
IntersectionObserver2.prototype._monitorIntersections = function(doc) {
var win = doc.defaultView;
if (!win) {
return;
}
if (this._monitoringDocuments.indexOf(doc) != -1) {
return;
}
var callback = this._checkForIntersections;
var monitoringInterval = null;
var domObserver = null;
if (this.POLL_INTERVAL) {
monitoringInterval = win.setInterval(callback, this.POLL_INTERVAL);
} else {
addEvent(win, "resize", callback, true);
addEvent(doc, "scroll", callback, true);
if (this.USE_MUTATION_OBSERVER && "MutationObserver" in win) {
domObserver = new win.MutationObserver(callback);
domObserver.observe(doc, {
attributes: true,
childList: true,
characterData: true,
subtree: true
});
}
}
this._monitoringDocuments.push(doc);
this._monitoringUnsubscribes.push(function() {
var win2 = doc.defaultView;
if (win2) {
if (monitoringInterval) {
win2.clearInterval(monitoringInterval);
}
removeEvent(win2, "resize", callback, true);
}
removeEvent(doc, "scroll", callback, true);
if (domObserver) {
domObserver.disconnect();
}
});
var rootDoc = this.root && (this.root.ownerDocument || this.root) || document2;
if (doc != rootDoc) {
var frame = getFrameElement(doc);
if (frame) {
this._monitorIntersections(frame.ownerDocument);
}
}
};
IntersectionObserver2.prototype._unmonitorIntersections = function(doc) {
var index2 = this._monitoringDocuments.indexOf(doc);
if (index2 == -1) {
return;
}
var rootDoc = this.root && (this.root.ownerDocument || this.root) || document2;
var hasDependentTargets = this._observationTargets.some(function(item) {
var itemDoc = item.element.ownerDocument;
if (itemDoc == doc) {
return true;
}
while (itemDoc && itemDoc != rootDoc) {
var frame2 = getFrameElement(itemDoc);
itemDoc = frame2 && frame2.ownerDocument;
if (itemDoc == doc) {
return true;
}
}
return false;
});
if (hasDependentTargets) {
return;
}
var unsubscribe = this._monitoringUnsubscribes[index2];
this._monitoringDocuments.splice(index2, 1);
this._monitoringUnsubscribes.splice(index2, 1);
unsubscribe();
if (doc != rootDoc) {
var frame = getFrameElement(doc);
if (frame) {
this._unmonitorIntersections(frame.ownerDocument);
}
}
};
IntersectionObserver2.prototype._unmonitorAllIntersections = function() {
var unsubscribes = this._monitoringUnsubscribes.slice(0);
this._monitoringDocuments.length = 0;
this._monitoringUnsubscribes.length = 0;
for (var i2 = 0; i2 < unsubscribes.length; i2++) {
unsubscribes[i2]();
}
};
IntersectionObserver2.prototype._checkForIntersections = function() {
if (!this.root && crossOriginUpdater && !crossOriginRect) {
return;
}
var rootIsInDom = this._rootIsInDom();
var rootRect = rootIsInDom ? this._getRootRect() : getEmptyRect();
this._observationTargets.forEach(function(item) {
var target = item.element;
var targetRect = getBoundingClientRect2(target);
var rootContainsTarget = this._rootContainsTarget(target);
var oldEntry = item.entry;
var intersectionRect = rootIsInDom && rootContainsTarget && this._computeTargetAndRootIntersection(target, targetRect, rootRect);
var rootBounds = null;
if (!this._rootContainsTarget(target)) {
rootBounds = getEmptyRect();
} else if (!crossOriginUpdater || this.root) {
rootBounds = rootRect;
}
var newEntry = item.entry = new IntersectionObserverEntry({
time: now2(),
target,
boundingClientRect: targetRect,
rootBounds,
intersectionRect
});
if (!oldEntry) {
this._queuedEntries.push(newEntry);
} else if (rootIsInDom && rootContainsTarget) {
if (this._hasCrossedThreshold(oldEntry, newEntry)) {
this._queuedEntries.push(newEntry);
}
} else {
if (oldEntry && oldEntry.isIntersecting) {
this._queuedEntries.push(newEntry);
}
}
}, this);
if (this._queuedEntries.length) {
this._callback(this.takeRecords(), this);
}
};
IntersectionObserver2.prototype._computeTargetAndRootIntersection = function(target, targetRect, rootRect) {
if (window.getComputedStyle(target).display == "none")
return;
var intersectionRect = targetRect;
var parent = getParentNode2(target);
var atRoot = false;
while (!atRoot && parent) {
var parentRect = null;
var parentComputedStyle = parent.nodeType == 1 ? window.getComputedStyle(parent) : {};
if (parentComputedStyle.display == "none")
return null;
if (parent == this.root || parent.nodeType == /* DOCUMENT */
9) {
atRoot = true;
if (parent == this.root || parent == document2) {
if (crossOriginUpdater && !this.root) {
if (!crossOriginRect || crossOriginRect.width == 0 && crossOriginRect.height == 0) {
parent = null;
parentRect = null;
intersectionRect = null;
} else {
parentRect = crossOriginRect;