710 lines
25 KiB
JavaScript
710 lines
25 KiB
JavaScript
import {
|
|
require_react
|
|
} from "./chunk-R7JHQV4C.js";
|
|
import {
|
|
__toESM
|
|
} from "./chunk-PLDDJCW6.js";
|
|
|
|
// node_modules/.pnpm/universal-cookie@8.0.1/node_modules/universal-cookie/esm/index.mjs
|
|
var dist = {};
|
|
var hasRequiredDist;
|
|
function requireDist() {
|
|
if (hasRequiredDist) return dist;
|
|
hasRequiredDist = 1;
|
|
Object.defineProperty(dist, "__esModule", { value: true });
|
|
dist.parse = parse;
|
|
dist.serialize = serialize;
|
|
const cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
|
|
const cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
|
|
const domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
|
|
const pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
|
|
const __toString = Object.prototype.toString;
|
|
const NullObject = (() => {
|
|
const C = function() {
|
|
};
|
|
C.prototype = /* @__PURE__ */ Object.create(null);
|
|
return C;
|
|
})();
|
|
function parse(str, options) {
|
|
const obj = new NullObject();
|
|
const len = str.length;
|
|
if (len < 2)
|
|
return obj;
|
|
const dec = options?.decode || decode;
|
|
let index = 0;
|
|
do {
|
|
const eqIdx = str.indexOf("=", index);
|
|
if (eqIdx === -1)
|
|
break;
|
|
const colonIdx = str.indexOf(";", index);
|
|
const endIdx = colonIdx === -1 ? len : colonIdx;
|
|
if (eqIdx > endIdx) {
|
|
index = str.lastIndexOf(";", eqIdx - 1) + 1;
|
|
continue;
|
|
}
|
|
const keyStartIdx = startIndex(str, index, eqIdx);
|
|
const keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
|
|
const key = str.slice(keyStartIdx, keyEndIdx);
|
|
if (obj[key] === void 0) {
|
|
let valStartIdx = startIndex(str, eqIdx + 1, endIdx);
|
|
let valEndIdx = endIndex(str, endIdx, valStartIdx);
|
|
const value = dec(str.slice(valStartIdx, valEndIdx));
|
|
obj[key] = value;
|
|
}
|
|
index = endIdx + 1;
|
|
} while (index < len);
|
|
return obj;
|
|
}
|
|
function startIndex(str, index, max) {
|
|
do {
|
|
const code = str.charCodeAt(index);
|
|
if (code !== 32 && code !== 9)
|
|
return index;
|
|
} while (++index < max);
|
|
return max;
|
|
}
|
|
function endIndex(str, index, min) {
|
|
while (index > min) {
|
|
const code = str.charCodeAt(--index);
|
|
if (code !== 32 && code !== 9)
|
|
return index + 1;
|
|
}
|
|
return min;
|
|
}
|
|
function serialize(name, val, options) {
|
|
const enc = options?.encode || encodeURIComponent;
|
|
if (!cookieNameRegExp.test(name)) {
|
|
throw new TypeError(`argument name is invalid: ${name}`);
|
|
}
|
|
const value = enc(val);
|
|
if (!cookieValueRegExp.test(value)) {
|
|
throw new TypeError(`argument val is invalid: ${val}`);
|
|
}
|
|
let str = name + "=" + value;
|
|
if (!options)
|
|
return str;
|
|
if (options.maxAge !== void 0) {
|
|
if (!Number.isInteger(options.maxAge)) {
|
|
throw new TypeError(`option maxAge is invalid: ${options.maxAge}`);
|
|
}
|
|
str += "; Max-Age=" + options.maxAge;
|
|
}
|
|
if (options.domain) {
|
|
if (!domainValueRegExp.test(options.domain)) {
|
|
throw new TypeError(`option domain is invalid: ${options.domain}`);
|
|
}
|
|
str += "; Domain=" + options.domain;
|
|
}
|
|
if (options.path) {
|
|
if (!pathValueRegExp.test(options.path)) {
|
|
throw new TypeError(`option path is invalid: ${options.path}`);
|
|
}
|
|
str += "; Path=" + options.path;
|
|
}
|
|
if (options.expires) {
|
|
if (!isDate(options.expires) || !Number.isFinite(options.expires.valueOf())) {
|
|
throw new TypeError(`option expires is invalid: ${options.expires}`);
|
|
}
|
|
str += "; Expires=" + options.expires.toUTCString();
|
|
}
|
|
if (options.httpOnly) {
|
|
str += "; HttpOnly";
|
|
}
|
|
if (options.secure) {
|
|
str += "; Secure";
|
|
}
|
|
if (options.partitioned) {
|
|
str += "; Partitioned";
|
|
}
|
|
if (options.priority) {
|
|
const priority = typeof options.priority === "string" ? options.priority.toLowerCase() : void 0;
|
|
switch (priority) {
|
|
case "low":
|
|
str += "; Priority=Low";
|
|
break;
|
|
case "medium":
|
|
str += "; Priority=Medium";
|
|
break;
|
|
case "high":
|
|
str += "; Priority=High";
|
|
break;
|
|
default:
|
|
throw new TypeError(`option priority is invalid: ${options.priority}`);
|
|
}
|
|
}
|
|
if (options.sameSite) {
|
|
const sameSite = typeof options.sameSite === "string" ? options.sameSite.toLowerCase() : options.sameSite;
|
|
switch (sameSite) {
|
|
case true:
|
|
case "strict":
|
|
str += "; SameSite=Strict";
|
|
break;
|
|
case "lax":
|
|
str += "; SameSite=Lax";
|
|
break;
|
|
case "none":
|
|
str += "; SameSite=None";
|
|
break;
|
|
default:
|
|
throw new TypeError(`option sameSite is invalid: ${options.sameSite}`);
|
|
}
|
|
}
|
|
return str;
|
|
}
|
|
function decode(str) {
|
|
if (str.indexOf("%") === -1)
|
|
return str;
|
|
try {
|
|
return decodeURIComponent(str);
|
|
} catch (e) {
|
|
return str;
|
|
}
|
|
}
|
|
function isDate(val) {
|
|
return __toString.call(val) === "[object Date]";
|
|
}
|
|
return dist;
|
|
}
|
|
var distExports = requireDist();
|
|
function hasDocumentCookie() {
|
|
const testingValue = typeof global === "undefined" ? void 0 : global.TEST_HAS_DOCUMENT_COOKIE;
|
|
if (typeof testingValue === "boolean") {
|
|
return testingValue;
|
|
}
|
|
return typeof document === "object" && typeof document.cookie === "string";
|
|
}
|
|
function parseCookies(cookies) {
|
|
if (typeof cookies === "string") {
|
|
return distExports.parse(cookies);
|
|
} else if (typeof cookies === "object" && cookies !== null) {
|
|
return cookies;
|
|
} else {
|
|
return {};
|
|
}
|
|
}
|
|
function readCookie(value, options = {}) {
|
|
const cleanValue = cleanupCookieValue(value);
|
|
if (!options.doNotParse) {
|
|
try {
|
|
return JSON.parse(cleanValue);
|
|
} catch (e) {
|
|
}
|
|
}
|
|
return value;
|
|
}
|
|
function cleanupCookieValue(value) {
|
|
if (value && value[0] === "j" && value[1] === ":") {
|
|
return value.substr(2);
|
|
}
|
|
return value;
|
|
}
|
|
var Cookies = class {
|
|
constructor(cookies, defaultSetOptions = {}) {
|
|
this.changeListeners = [];
|
|
this.HAS_DOCUMENT_COOKIE = false;
|
|
this.update = () => {
|
|
if (!this.HAS_DOCUMENT_COOKIE) {
|
|
return;
|
|
}
|
|
const previousCookies = this.cookies;
|
|
this.cookies = distExports.parse(document.cookie);
|
|
this._checkChanges(previousCookies);
|
|
};
|
|
const domCookies = typeof document === "undefined" ? "" : document.cookie;
|
|
this.cookies = parseCookies(cookies || domCookies);
|
|
this.defaultSetOptions = defaultSetOptions;
|
|
this.HAS_DOCUMENT_COOKIE = hasDocumentCookie();
|
|
}
|
|
_emitChange(params) {
|
|
for (let i = 0; i < this.changeListeners.length; ++i) {
|
|
this.changeListeners[i](params);
|
|
}
|
|
}
|
|
_checkChanges(previousCookies) {
|
|
const names = new Set(Object.keys(previousCookies).concat(Object.keys(this.cookies)));
|
|
names.forEach((name) => {
|
|
if (previousCookies[name] !== this.cookies[name]) {
|
|
this._emitChange({
|
|
name,
|
|
value: readCookie(this.cookies[name])
|
|
});
|
|
}
|
|
});
|
|
}
|
|
_startPolling() {
|
|
this.pollingInterval = setInterval(this.update, 300);
|
|
}
|
|
_stopPolling() {
|
|
if (this.pollingInterval) {
|
|
clearInterval(this.pollingInterval);
|
|
}
|
|
}
|
|
get(name, options = {}) {
|
|
if (!options.doNotUpdate) {
|
|
this.update();
|
|
}
|
|
return readCookie(this.cookies[name], options);
|
|
}
|
|
getAll(options = {}) {
|
|
if (!options.doNotUpdate) {
|
|
this.update();
|
|
}
|
|
const result = {};
|
|
for (let name in this.cookies) {
|
|
result[name] = readCookie(this.cookies[name], options);
|
|
}
|
|
return result;
|
|
}
|
|
set(name, value, options) {
|
|
if (options) {
|
|
options = Object.assign(Object.assign({}, this.defaultSetOptions), options);
|
|
} else {
|
|
options = this.defaultSetOptions;
|
|
}
|
|
const stringValue = typeof value === "string" ? value : JSON.stringify(value);
|
|
this.cookies = Object.assign(Object.assign({}, this.cookies), { [name]: stringValue });
|
|
if (this.HAS_DOCUMENT_COOKIE) {
|
|
document.cookie = distExports.serialize(name, stringValue, options);
|
|
}
|
|
this._emitChange({ name, value, options });
|
|
}
|
|
remove(name, options) {
|
|
const finalOptions = options = Object.assign(Object.assign(Object.assign({}, this.defaultSetOptions), options), { expires: new Date(1970, 1, 1, 0, 0, 1), maxAge: 0 });
|
|
this.cookies = Object.assign({}, this.cookies);
|
|
delete this.cookies[name];
|
|
if (this.HAS_DOCUMENT_COOKIE) {
|
|
document.cookie = distExports.serialize(name, "", finalOptions);
|
|
}
|
|
this._emitChange({ name, value: void 0, options });
|
|
}
|
|
addChangeListener(callback) {
|
|
this.changeListeners.push(callback);
|
|
if (this.HAS_DOCUMENT_COOKIE && this.changeListeners.length === 1) {
|
|
if (typeof window === "object" && "cookieStore" in window) {
|
|
window.cookieStore.addEventListener("change", this.update);
|
|
} else {
|
|
this._startPolling();
|
|
}
|
|
}
|
|
}
|
|
removeChangeListener(callback) {
|
|
const idx = this.changeListeners.indexOf(callback);
|
|
if (idx >= 0) {
|
|
this.changeListeners.splice(idx, 1);
|
|
}
|
|
if (this.HAS_DOCUMENT_COOKIE && this.changeListeners.length === 0) {
|
|
if (typeof window === "object" && "cookieStore" in window) {
|
|
window.cookieStore.removeEventListener("change", this.update);
|
|
} else {
|
|
this._stopPolling();
|
|
}
|
|
}
|
|
}
|
|
removeAllChangeListeners() {
|
|
while (this.changeListeners.length > 0) {
|
|
this.removeChangeListener(this.changeListeners[0]);
|
|
}
|
|
}
|
|
};
|
|
|
|
// node_modules/.pnpm/react-cookie@8.0.1_@types+react@19.1.10_react@19.1.1/node_modules/react-cookie/esm/index.mjs
|
|
var React = __toESM(require_react(), 1);
|
|
var import_react = __toESM(require_react(), 1);
|
|
var CookiesContext = React.createContext(null);
|
|
var { Provider, Consumer } = CookiesContext;
|
|
var CookiesProvider = (props) => {
|
|
const cookies = React.useMemo(() => {
|
|
if (props.cookies) {
|
|
return props.cookies;
|
|
} else {
|
|
return new Cookies(void 0, props.defaultSetOptions);
|
|
}
|
|
}, [props.cookies, props.defaultSetOptions]);
|
|
return React.createElement(Provider, { value: cookies }, props.children);
|
|
};
|
|
function __rest(s, e) {
|
|
var t = {};
|
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
t[p] = s[p];
|
|
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
t[p[i]] = s[p[i]];
|
|
}
|
|
return t;
|
|
}
|
|
function getDefaultExportFromCjs(x) {
|
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
}
|
|
var reactIs = { exports: {} };
|
|
var reactIs_development = {};
|
|
var hasRequiredReactIs_development;
|
|
function requireReactIs_development() {
|
|
if (hasRequiredReactIs_development) return reactIs_development;
|
|
hasRequiredReactIs_development = 1;
|
|
if (true) {
|
|
(function() {
|
|
var hasSymbol = typeof Symbol === "function" && Symbol.for;
|
|
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103;
|
|
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106;
|
|
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 60107;
|
|
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for("react.strict_mode") : 60108;
|
|
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 60114;
|
|
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 60109;
|
|
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 60110;
|
|
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for("react.async_mode") : 60111;
|
|
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for("react.concurrent_mode") : 60111;
|
|
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 60112;
|
|
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 60113;
|
|
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for("react.suspense_list") : 60120;
|
|
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 60115;
|
|
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 60116;
|
|
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for("react.block") : 60121;
|
|
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for("react.fundamental") : 60117;
|
|
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for("react.responder") : 60118;
|
|
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for("react.scope") : 60119;
|
|
function isValidElementType(type) {
|
|
return typeof type === "string" || typeof type === "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === "object" && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
|
}
|
|
function typeOf(object) {
|
|
if (typeof object === "object" && object !== null) {
|
|
var $$typeof = object.$$typeof;
|
|
switch ($$typeof) {
|
|
case REACT_ELEMENT_TYPE:
|
|
var type = object.type;
|
|
switch (type) {
|
|
case REACT_ASYNC_MODE_TYPE:
|
|
case REACT_CONCURRENT_MODE_TYPE:
|
|
case REACT_FRAGMENT_TYPE:
|
|
case REACT_PROFILER_TYPE:
|
|
case REACT_STRICT_MODE_TYPE:
|
|
case REACT_SUSPENSE_TYPE:
|
|
return type;
|
|
default:
|
|
var $$typeofType = type && type.$$typeof;
|
|
switch ($$typeofType) {
|
|
case REACT_CONTEXT_TYPE:
|
|
case REACT_FORWARD_REF_TYPE:
|
|
case REACT_LAZY_TYPE:
|
|
case REACT_MEMO_TYPE:
|
|
case REACT_PROVIDER_TYPE:
|
|
return $$typeofType;
|
|
default:
|
|
return $$typeof;
|
|
}
|
|
}
|
|
case REACT_PORTAL_TYPE:
|
|
return $$typeof;
|
|
}
|
|
}
|
|
return void 0;
|
|
}
|
|
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
var Element = REACT_ELEMENT_TYPE;
|
|
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
var Fragment = REACT_FRAGMENT_TYPE;
|
|
var Lazy = REACT_LAZY_TYPE;
|
|
var Memo = REACT_MEMO_TYPE;
|
|
var Portal = REACT_PORTAL_TYPE;
|
|
var Profiler = REACT_PROFILER_TYPE;
|
|
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
var Suspense = REACT_SUSPENSE_TYPE;
|
|
var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
|
function isAsyncMode(object) {
|
|
{
|
|
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
hasWarnedAboutDeprecatedIsAsyncMode = true;
|
|
console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.");
|
|
}
|
|
}
|
|
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
|
}
|
|
function isConcurrentMode(object) {
|
|
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
}
|
|
function isContextConsumer(object) {
|
|
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
}
|
|
function isContextProvider(object) {
|
|
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
}
|
|
function isElement(object) {
|
|
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
}
|
|
function isForwardRef(object) {
|
|
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
}
|
|
function isFragment(object) {
|
|
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
}
|
|
function isLazy(object) {
|
|
return typeOf(object) === REACT_LAZY_TYPE;
|
|
}
|
|
function isMemo(object) {
|
|
return typeOf(object) === REACT_MEMO_TYPE;
|
|
}
|
|
function isPortal(object) {
|
|
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
}
|
|
function isProfiler(object) {
|
|
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
}
|
|
function isStrictMode(object) {
|
|
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
}
|
|
function isSuspense(object) {
|
|
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
}
|
|
reactIs_development.AsyncMode = AsyncMode;
|
|
reactIs_development.ConcurrentMode = ConcurrentMode;
|
|
reactIs_development.ContextConsumer = ContextConsumer;
|
|
reactIs_development.ContextProvider = ContextProvider;
|
|
reactIs_development.Element = Element;
|
|
reactIs_development.ForwardRef = ForwardRef;
|
|
reactIs_development.Fragment = Fragment;
|
|
reactIs_development.Lazy = Lazy;
|
|
reactIs_development.Memo = Memo;
|
|
reactIs_development.Portal = Portal;
|
|
reactIs_development.Profiler = Profiler;
|
|
reactIs_development.StrictMode = StrictMode;
|
|
reactIs_development.Suspense = Suspense;
|
|
reactIs_development.isAsyncMode = isAsyncMode;
|
|
reactIs_development.isConcurrentMode = isConcurrentMode;
|
|
reactIs_development.isContextConsumer = isContextConsumer;
|
|
reactIs_development.isContextProvider = isContextProvider;
|
|
reactIs_development.isElement = isElement;
|
|
reactIs_development.isForwardRef = isForwardRef;
|
|
reactIs_development.isFragment = isFragment;
|
|
reactIs_development.isLazy = isLazy;
|
|
reactIs_development.isMemo = isMemo;
|
|
reactIs_development.isPortal = isPortal;
|
|
reactIs_development.isProfiler = isProfiler;
|
|
reactIs_development.isStrictMode = isStrictMode;
|
|
reactIs_development.isSuspense = isSuspense;
|
|
reactIs_development.isValidElementType = isValidElementType;
|
|
reactIs_development.typeOf = typeOf;
|
|
})();
|
|
}
|
|
return reactIs_development;
|
|
}
|
|
var hasRequiredReactIs;
|
|
function requireReactIs() {
|
|
if (hasRequiredReactIs) return reactIs.exports;
|
|
hasRequiredReactIs = 1;
|
|
if (false) {
|
|
reactIs.exports = requireReactIs_production_min();
|
|
} else {
|
|
reactIs.exports = requireReactIs_development();
|
|
}
|
|
return reactIs.exports;
|
|
}
|
|
var hoistNonReactStatics_cjs;
|
|
var hasRequiredHoistNonReactStatics_cjs;
|
|
function requireHoistNonReactStatics_cjs() {
|
|
if (hasRequiredHoistNonReactStatics_cjs) return hoistNonReactStatics_cjs;
|
|
hasRequiredHoistNonReactStatics_cjs = 1;
|
|
var reactIs2 = requireReactIs();
|
|
var REACT_STATICS = {
|
|
childContextTypes: true,
|
|
contextType: true,
|
|
contextTypes: true,
|
|
defaultProps: true,
|
|
displayName: true,
|
|
getDefaultProps: true,
|
|
getDerivedStateFromError: true,
|
|
getDerivedStateFromProps: true,
|
|
mixins: true,
|
|
propTypes: true,
|
|
type: true
|
|
};
|
|
var KNOWN_STATICS = {
|
|
name: true,
|
|
length: true,
|
|
prototype: true,
|
|
caller: true,
|
|
callee: true,
|
|
arguments: true,
|
|
arity: true
|
|
};
|
|
var FORWARD_REF_STATICS = {
|
|
"$$typeof": true,
|
|
render: true,
|
|
defaultProps: true,
|
|
displayName: true,
|
|
propTypes: true
|
|
};
|
|
var MEMO_STATICS = {
|
|
"$$typeof": true,
|
|
compare: true,
|
|
defaultProps: true,
|
|
displayName: true,
|
|
propTypes: true,
|
|
type: true
|
|
};
|
|
var TYPE_STATICS = {};
|
|
TYPE_STATICS[reactIs2.ForwardRef] = FORWARD_REF_STATICS;
|
|
TYPE_STATICS[reactIs2.Memo] = MEMO_STATICS;
|
|
function getStatics(component) {
|
|
if (reactIs2.isMemo(component)) {
|
|
return MEMO_STATICS;
|
|
}
|
|
return TYPE_STATICS[component["$$typeof"]] || REACT_STATICS;
|
|
}
|
|
var defineProperty = Object.defineProperty;
|
|
var getOwnPropertyNames = Object.getOwnPropertyNames;
|
|
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
var getPrototypeOf = Object.getPrototypeOf;
|
|
var objectPrototype = Object.prototype;
|
|
function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
|
|
if (typeof sourceComponent !== "string") {
|
|
if (objectPrototype) {
|
|
var inheritedComponent = getPrototypeOf(sourceComponent);
|
|
if (inheritedComponent && inheritedComponent !== objectPrototype) {
|
|
hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
|
|
}
|
|
}
|
|
var keys = getOwnPropertyNames(sourceComponent);
|
|
if (getOwnPropertySymbols) {
|
|
keys = keys.concat(getOwnPropertySymbols(sourceComponent));
|
|
}
|
|
var targetStatics = getStatics(targetComponent);
|
|
var sourceStatics = getStatics(sourceComponent);
|
|
for (var i = 0; i < keys.length; ++i) {
|
|
var key = keys[i];
|
|
if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
|
|
var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
|
|
try {
|
|
defineProperty(targetComponent, key, descriptor);
|
|
} catch (e) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return targetComponent;
|
|
}
|
|
hoistNonReactStatics_cjs = hoistNonReactStatics;
|
|
return hoistNonReactStatics_cjs;
|
|
}
|
|
var hoistNonReactStatics_cjsExports = requireHoistNonReactStatics_cjs();
|
|
var hoistStatics = getDefaultExportFromCjs(hoistNonReactStatics_cjsExports);
|
|
function withCookies(WrappedComponent) {
|
|
const name = WrappedComponent.displayName || WrappedComponent.name;
|
|
class CookieWrapper extends React.Component {
|
|
constructor() {
|
|
super(...arguments);
|
|
this.onChange = () => {
|
|
this.forceUpdate();
|
|
};
|
|
}
|
|
listen() {
|
|
this.props.cookies.addChangeListener(this.onChange);
|
|
}
|
|
unlisten(cookies) {
|
|
(cookies || this.props.cookies).removeChangeListener(this.onChange);
|
|
}
|
|
componentDidMount() {
|
|
this.listen();
|
|
}
|
|
componentDidUpdate(prevProps) {
|
|
if (prevProps.cookies !== this.props.cookies) {
|
|
this.unlisten(prevProps.cookies);
|
|
this.listen();
|
|
}
|
|
}
|
|
componentWillUnmount() {
|
|
this.unlisten();
|
|
}
|
|
render() {
|
|
const _a = this.props, { forwardedRef, cookies } = _a, restProps = __rest(_a, ["forwardedRef", "cookies"]);
|
|
const allCookies = cookies.getAll({ doNotUpdate: true });
|
|
return React.createElement(WrappedComponent, Object.assign({}, restProps, { ref: forwardedRef, cookies, allCookies }));
|
|
}
|
|
}
|
|
CookieWrapper.displayName = `withCookies(${name})`;
|
|
CookieWrapper.WrappedComponent = WrappedComponent;
|
|
const ForwardedComponent = React.forwardRef((props, ref) => {
|
|
return React.createElement(Consumer, null, (cookies) => React.createElement(CookieWrapper, Object.assign({ cookies }, props, { forwardedRef: ref })));
|
|
});
|
|
ForwardedComponent.displayName = CookieWrapper.displayName;
|
|
ForwardedComponent.WrappedComponent = CookieWrapper.WrappedComponent;
|
|
return hoistStatics(ForwardedComponent, WrappedComponent);
|
|
}
|
|
function isInBrowser() {
|
|
return typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
}
|
|
function useCookies(dependencies, options) {
|
|
const cookies = (0, import_react.useContext)(CookiesContext);
|
|
if (!cookies) {
|
|
throw new Error("Missing <CookiesProvider>");
|
|
}
|
|
const defaultOptions = { doNotUpdate: true };
|
|
const getOptions = Object.assign(Object.assign({}, defaultOptions), options);
|
|
const [allCookies, setCookies] = (0, import_react.useState)(() => cookies.getAll(getOptions));
|
|
if (isInBrowser()) {
|
|
(0, import_react.useLayoutEffect)(() => {
|
|
function onChange() {
|
|
if (!cookies) {
|
|
throw new Error("Missing <CookiesProvider>");
|
|
}
|
|
const newCookies = cookies.getAll(getOptions);
|
|
if (shouldUpdate(dependencies || null, newCookies, allCookies)) {
|
|
setCookies(newCookies);
|
|
}
|
|
}
|
|
cookies.addChangeListener(onChange);
|
|
return () => {
|
|
cookies.removeChangeListener(onChange);
|
|
};
|
|
}, [cookies, allCookies]);
|
|
}
|
|
const setCookie = (0, import_react.useMemo)(() => cookies.set.bind(cookies), [cookies]);
|
|
const removeCookie = (0, import_react.useMemo)(() => cookies.remove.bind(cookies), [cookies]);
|
|
const updateCookies = (0, import_react.useMemo)(() => cookies.update.bind(cookies), [cookies]);
|
|
return [allCookies, setCookie, removeCookie, updateCookies];
|
|
}
|
|
function shouldUpdate(dependencies, newCookies, oldCookies) {
|
|
if (!dependencies) {
|
|
return true;
|
|
}
|
|
for (let dependency of dependencies) {
|
|
if (newCookies[dependency] !== oldCookies[dependency]) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
export {
|
|
Cookies,
|
|
CookiesProvider,
|
|
useCookies,
|
|
withCookies
|
|
};
|
|
/*! Bundled license information:
|
|
|
|
react-cookie/esm/index.mjs:
|
|
(** @license React v16.13.1
|
|
* react-is.production.min.js
|
|
*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*)
|
|
|
|
react-cookie/esm/index.mjs:
|
|
(** @license React v16.13.1
|
|
* react-is.development.js
|
|
*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*)
|
|
*/
|
|
//# sourceMappingURL=react-cookie.js.map
|