@uninspired/cookie-banner 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react/index.cjs +1994 -4061
- package/dist/react/index.js +1343 -3393
- package/dist/react/style.css +165 -18
- package/dist/script/index.cjs +1 -45
- package/dist/script/index.js +1561 -2091
- package/dist/script/style.css +1 -1
- package/package.json +2 -4
- package/dist/components/Banner/Banner.js +0 -38
- package/dist/components/Banner/index.js +0 -1
- package/dist/components/BannerItem/BannerItem.js +0 -24
- package/dist/components/BannerItem/index.js +0 -1
- package/dist/components/Button/Button.js +0 -6
- package/dist/components/Button/index.js +0 -1
- package/dist/components/Switch/Switch.js +0 -7
- package/dist/components/Switch/index.js +0 -1
- package/dist/components/Text/Text.js +0 -9
- package/dist/components/Text/index.js +0 -1
- package/dist/contexts/SelectionContext.js +0 -101
- package/dist/react.js +0 -1
- package/dist/script.js +0 -1
- package/dist/types/components/Banner/Banner.d.ts +0 -21
- package/dist/types/components/Banner/index.d.ts +0 -1
- package/dist/types/components/BannerItem/BannerItem.d.ts +0 -23
- package/dist/types/components/BannerItem/index.d.ts +0 -1
- package/dist/types/components/Button/Button.d.ts +0 -5
- package/dist/types/components/Button/index.d.ts +0 -1
- package/dist/types/components/Switch/Switch.d.ts +0 -5
- package/dist/types/components/Switch/index.d.ts +0 -1
- package/dist/types/components/Text/Text.d.ts +0 -8
- package/dist/types/components/Text/index.d.ts +0 -1
- package/dist/types/contexts/SelectionContext.d.ts +0 -23
- package/dist/types/react.d.ts +0 -1
- package/dist/types/script.d.ts +0 -1
- package/dist/types/utils/classes.d.ts +0 -2
- package/dist/types/utils/mountBanner.d.ts +0 -2
- package/dist/types/utils/scriptDefinition.d.ts +0 -35
- package/dist/types/utils/selection.d.ts +0 -3
- package/dist/utils/classes.js +0 -9
- package/dist/utils/mountBanner.js +0 -18
- package/dist/utils/scriptDefinition.js +0 -21
- package/dist/utils/selection.js +0 -2
package/dist/react/index.js
CHANGED
|
@@ -1,1183 +1,122 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import require$$0, { useMemo, useState, useEffect, useCallback, createContext, useContext } from "react";
|
|
2
|
+
import { Item, Trigger, Content, Root as Root$2 } from "@radix-ui/react-accordion";
|
|
3
|
+
import { ChevronDown, ChevronUp } from "lucide-react";
|
|
4
|
+
import { Root as Root$1, Trigger as Trigger$1, Content as Content$1 } from "@radix-ui/react-collapsible";
|
|
5
|
+
import { Root, Thumb } from "@radix-ui/react-switch";
|
|
6
|
+
var jsxRuntime = { exports: {} };
|
|
7
|
+
var reactJsxRuntime_production_min = {};
|
|
8
|
+
var hasRequiredReactJsxRuntime_production_min;
|
|
9
|
+
function requireReactJsxRuntime_production_min() {
|
|
10
|
+
if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
|
|
11
|
+
hasRequiredReactJsxRuntime_production_min = 1;
|
|
12
|
+
var f = require$$0, k = /* @__PURE__ */ Symbol.for("react.element"), l = /* @__PURE__ */ Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: true, ref: true, __self: true, __source: true };
|
|
13
|
+
function q(c, a, g) {
|
|
14
|
+
var b, d = {}, e = null, h = null;
|
|
15
|
+
void 0 !== g && (e = "" + g);
|
|
16
|
+
void 0 !== a.key && (e = "" + a.key);
|
|
17
|
+
void 0 !== a.ref && (h = a.ref);
|
|
18
|
+
for (b in a) m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
|
|
19
|
+
if (c && c.defaultProps) for (b in a = c.defaultProps, a) void 0 === d[b] && (d[b] = a[b]);
|
|
20
|
+
return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current };
|
|
10
21
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
t || (t = {});
|
|
16
|
-
var a, c, p = t;
|
|
17
|
-
if ("ref" in p) for (c in p = {}, t) "ref" == c ? a = t[c] : p[c] = t[c];
|
|
18
|
-
var l$1 = { type: e, props: p, key: n, ref: a, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --f, __i: -1, __u: 0, __source: i, __self: u2 };
|
|
19
|
-
if ("function" == typeof e && (a = e.defaultProps)) for (c in a) void 0 === p[c] && (p[c] = a[c]);
|
|
20
|
-
return l.vnode && l.vnode(l$1), l$1;
|
|
21
|
-
}
|
|
22
|
-
function cls(...classes2) {
|
|
23
|
-
return classes2.filter(Boolean).join(" ");
|
|
24
|
-
}
|
|
25
|
-
function clx(classes2) {
|
|
26
|
-
return Object.entries(classes2).filter(([, value]) => value).map(([key]) => key).join(" ");
|
|
22
|
+
reactJsxRuntime_production_min.Fragment = l;
|
|
23
|
+
reactJsxRuntime_production_min.jsx = q;
|
|
24
|
+
reactJsxRuntime_production_min.jsxs = q;
|
|
25
|
+
return reactJsxRuntime_production_min;
|
|
27
26
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
...rest
|
|
61
|
-
}) => {
|
|
62
|
-
const Component = as ?? "span";
|
|
63
|
-
return (
|
|
64
|
-
// @ts-ignore
|
|
65
|
-
/* @__PURE__ */ u(
|
|
66
|
-
Component,
|
|
67
|
-
{
|
|
68
|
-
className: cls(
|
|
69
|
-
classes$1.root,
|
|
70
|
-
classes$1[size],
|
|
71
|
-
classes$1[weight],
|
|
72
|
-
classes$1[color]
|
|
73
|
-
),
|
|
74
|
-
...rest
|
|
27
|
+
var reactJsxRuntime_development = {};
|
|
28
|
+
var hasRequiredReactJsxRuntime_development;
|
|
29
|
+
function requireReactJsxRuntime_development() {
|
|
30
|
+
if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
|
|
31
|
+
hasRequiredReactJsxRuntime_development = 1;
|
|
32
|
+
if (process.env.NODE_ENV !== "production") {
|
|
33
|
+
(function() {
|
|
34
|
+
var React = require$$0;
|
|
35
|
+
var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.element");
|
|
36
|
+
var REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal");
|
|
37
|
+
var REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
38
|
+
var REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode");
|
|
39
|
+
var REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler");
|
|
40
|
+
var REACT_PROVIDER_TYPE = /* @__PURE__ */ Symbol.for("react.provider");
|
|
41
|
+
var REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context");
|
|
42
|
+
var REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref");
|
|
43
|
+
var REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense");
|
|
44
|
+
var REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for("react.suspense_list");
|
|
45
|
+
var REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo");
|
|
46
|
+
var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
|
|
47
|
+
var REACT_OFFSCREEN_TYPE = /* @__PURE__ */ Symbol.for("react.offscreen");
|
|
48
|
+
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
49
|
+
var FAUX_ITERATOR_SYMBOL = "@@iterator";
|
|
50
|
+
function getIteratorFn(maybeIterable) {
|
|
51
|
+
if (maybeIterable === null || typeof maybeIterable !== "object") {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
55
|
+
if (typeof maybeIterator === "function") {
|
|
56
|
+
return maybeIterator;
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
75
59
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const footer = "_footer_1wsw7_103";
|
|
87
|
-
const legal = "_legal_1wsw7_110";
|
|
88
|
-
const actions = "_actions_1wsw7_113";
|
|
89
|
-
const classes = {
|
|
90
|
-
root,
|
|
91
|
-
noTarget,
|
|
92
|
-
collapsible,
|
|
93
|
-
header,
|
|
94
|
-
heading,
|
|
95
|
-
chevron,
|
|
96
|
-
open,
|
|
97
|
-
footer,
|
|
98
|
-
legal,
|
|
99
|
-
actions
|
|
100
|
-
};
|
|
101
|
-
function $constructor(name, initializer2, params) {
|
|
102
|
-
function init(inst, def) {
|
|
103
|
-
if (!inst._zod) {
|
|
104
|
-
Object.defineProperty(inst, "_zod", {
|
|
105
|
-
value: {
|
|
106
|
-
def,
|
|
107
|
-
constr: _,
|
|
108
|
-
traits: /* @__PURE__ */ new Set()
|
|
109
|
-
},
|
|
110
|
-
enumerable: false
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
if (inst._zod.traits.has(name)) {
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
inst._zod.traits.add(name);
|
|
117
|
-
initializer2(inst, def);
|
|
118
|
-
const proto = _.prototype;
|
|
119
|
-
const keys = Object.keys(proto);
|
|
120
|
-
for (let i = 0; i < keys.length; i++) {
|
|
121
|
-
const k = keys[i];
|
|
122
|
-
if (!(k in inst)) {
|
|
123
|
-
inst[k] = proto[k].bind(inst);
|
|
60
|
+
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
61
|
+
function error(format) {
|
|
62
|
+
{
|
|
63
|
+
{
|
|
64
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
65
|
+
args[_key2 - 1] = arguments[_key2];
|
|
66
|
+
}
|
|
67
|
+
printWarning("error", format, args);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
124
70
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
return inst?._zod?.traits?.has(name);
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
Object.defineProperty(_, "name", { value: name });
|
|
150
|
-
return _;
|
|
151
|
-
}
|
|
152
|
-
class $ZodAsyncError extends Error {
|
|
153
|
-
constructor() {
|
|
154
|
-
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
const globalConfig = {};
|
|
158
|
-
function config(newConfig) {
|
|
159
|
-
return globalConfig;
|
|
160
|
-
}
|
|
161
|
-
function jsonStringifyReplacer(_, value) {
|
|
162
|
-
if (typeof value === "bigint")
|
|
163
|
-
return value.toString();
|
|
164
|
-
return value;
|
|
165
|
-
}
|
|
166
|
-
function cached(getter) {
|
|
167
|
-
return {
|
|
168
|
-
get value() {
|
|
71
|
+
function printWarning(level, format, args) {
|
|
72
|
+
{
|
|
73
|
+
var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
74
|
+
var stack = ReactDebugCurrentFrame2.getStackAddendum();
|
|
75
|
+
if (stack !== "") {
|
|
76
|
+
format += "%s";
|
|
77
|
+
args = args.concat([stack]);
|
|
78
|
+
}
|
|
79
|
+
var argsWithFormat = args.map(function(item) {
|
|
80
|
+
return String(item);
|
|
81
|
+
});
|
|
82
|
+
argsWithFormat.unshift("Warning: " + format);
|
|
83
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
var enableScopeAPI = false;
|
|
87
|
+
var enableCacheElement = false;
|
|
88
|
+
var enableTransitionTracing = false;
|
|
89
|
+
var enableLegacyHidden = false;
|
|
90
|
+
var enableDebugTracing = false;
|
|
91
|
+
var REACT_MODULE_REFERENCE;
|
|
169
92
|
{
|
|
170
|
-
|
|
171
|
-
Object.defineProperty(this, "value", { value });
|
|
172
|
-
return value;
|
|
93
|
+
REACT_MODULE_REFERENCE = /* @__PURE__ */ Symbol.for("react.module.reference");
|
|
173
94
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
95
|
+
function isValidElementType(type) {
|
|
96
|
+
if (typeof type === "string" || typeof type === "function") {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) {
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
if (typeof type === "object" && type !== null) {
|
|
103
|
+
if (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 || // This needs to include all possible module reference object
|
|
104
|
+
// types supported by any Flight configuration anywhere since
|
|
105
|
+
// we don't know which Flight build this will end up being used
|
|
106
|
+
// with.
|
|
107
|
+
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) {
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return false;
|
|
189
112
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
Object.defineProperty(object2, key, {
|
|
198
|
-
value: v
|
|
199
|
-
// configurable: true,
|
|
200
|
-
});
|
|
201
|
-
},
|
|
202
|
-
configurable: true
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
|
|
206
|
-
};
|
|
207
|
-
function isObject(data) {
|
|
208
|
-
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
209
|
-
}
|
|
210
|
-
function isPlainObject(o) {
|
|
211
|
-
if (isObject(o) === false)
|
|
212
|
-
return false;
|
|
213
|
-
const ctor = o.constructor;
|
|
214
|
-
if (ctor === void 0)
|
|
215
|
-
return true;
|
|
216
|
-
if (typeof ctor !== "function")
|
|
217
|
-
return true;
|
|
218
|
-
const prot = ctor.prototype;
|
|
219
|
-
if (isObject(prot) === false)
|
|
220
|
-
return false;
|
|
221
|
-
if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) {
|
|
222
|
-
return false;
|
|
223
|
-
}
|
|
224
|
-
return true;
|
|
225
|
-
}
|
|
226
|
-
function escapeRegex(str) {
|
|
227
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
228
|
-
}
|
|
229
|
-
function clone(inst, def, params) {
|
|
230
|
-
const cl = new inst._zod.constr(def ?? inst._zod.def);
|
|
231
|
-
if (!def || params?.parent)
|
|
232
|
-
cl._zod.parent = inst;
|
|
233
|
-
return cl;
|
|
234
|
-
}
|
|
235
|
-
function normalizeParams(_params) {
|
|
236
|
-
return {};
|
|
237
|
-
}
|
|
238
|
-
function optionalKeys(shape) {
|
|
239
|
-
return Object.keys(shape).filter((k) => {
|
|
240
|
-
return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
function aborted(x, startIndex = 0) {
|
|
244
|
-
if (x.aborted === true)
|
|
245
|
-
return true;
|
|
246
|
-
for (let i = startIndex; i < x.issues.length; i++) {
|
|
247
|
-
if (x.issues[i]?.continue !== true) {
|
|
248
|
-
return true;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
return false;
|
|
252
|
-
}
|
|
253
|
-
function prefixIssues(path, issues) {
|
|
254
|
-
return issues.map((iss) => {
|
|
255
|
-
var _a;
|
|
256
|
-
(_a = iss).path ?? (_a.path = []);
|
|
257
|
-
iss.path.unshift(path);
|
|
258
|
-
return iss;
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
function unwrapMessage(message) {
|
|
262
|
-
return typeof message === "string" ? message : message?.message;
|
|
263
|
-
}
|
|
264
|
-
function finalizeIssue(iss, ctx, config2) {
|
|
265
|
-
const full = { ...iss, path: iss.path ?? [] };
|
|
266
|
-
if (!iss.message) {
|
|
267
|
-
const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
|
|
268
|
-
full.message = message;
|
|
269
|
-
}
|
|
270
|
-
delete full.inst;
|
|
271
|
-
delete full.continue;
|
|
272
|
-
if (!ctx?.reportInput) {
|
|
273
|
-
delete full.input;
|
|
274
|
-
}
|
|
275
|
-
return full;
|
|
276
|
-
}
|
|
277
|
-
const initializer = (inst, def) => {
|
|
278
|
-
inst.name = "$ZodError";
|
|
279
|
-
Object.defineProperty(inst, "_zod", {
|
|
280
|
-
value: inst._zod,
|
|
281
|
-
enumerable: false
|
|
282
|
-
});
|
|
283
|
-
Object.defineProperty(inst, "issues", {
|
|
284
|
-
value: def,
|
|
285
|
-
enumerable: false
|
|
286
|
-
});
|
|
287
|
-
inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
|
|
288
|
-
Object.defineProperty(inst, "toString", {
|
|
289
|
-
value: () => inst.message,
|
|
290
|
-
enumerable: false
|
|
291
|
-
});
|
|
292
|
-
};
|
|
293
|
-
const $ZodError = $constructor("$ZodError", initializer);
|
|
294
|
-
const $ZodRealError = $constructor("$ZodError", initializer, { Parent: Error });
|
|
295
|
-
const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
296
|
-
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
297
|
-
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
298
|
-
if (result instanceof Promise) {
|
|
299
|
-
throw new $ZodAsyncError();
|
|
300
|
-
}
|
|
301
|
-
if (result.issues.length) {
|
|
302
|
-
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
303
|
-
captureStackTrace(e, _params?.callee);
|
|
304
|
-
throw e;
|
|
305
|
-
}
|
|
306
|
-
return result.value;
|
|
307
|
-
};
|
|
308
|
-
const parse$1 = /* @__PURE__ */ _parse($ZodRealError);
|
|
309
|
-
const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
310
|
-
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
311
|
-
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
312
|
-
if (result instanceof Promise)
|
|
313
|
-
result = await result;
|
|
314
|
-
if (result.issues.length) {
|
|
315
|
-
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
316
|
-
captureStackTrace(e, params?.callee);
|
|
317
|
-
throw e;
|
|
318
|
-
}
|
|
319
|
-
return result.value;
|
|
320
|
-
};
|
|
321
|
-
const parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError);
|
|
322
|
-
const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
323
|
-
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
324
|
-
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
325
|
-
if (result instanceof Promise) {
|
|
326
|
-
throw new $ZodAsyncError();
|
|
327
|
-
}
|
|
328
|
-
return result.issues.length ? {
|
|
329
|
-
success: false,
|
|
330
|
-
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
331
|
-
} : { success: true, data: result.value };
|
|
332
|
-
};
|
|
333
|
-
const safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
334
|
-
const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
335
|
-
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
336
|
-
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
337
|
-
if (result instanceof Promise)
|
|
338
|
-
result = await result;
|
|
339
|
-
return result.issues.length ? {
|
|
340
|
-
success: false,
|
|
341
|
-
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
342
|
-
} : { success: true, data: result.value };
|
|
343
|
-
};
|
|
344
|
-
const safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
345
|
-
const string$1 = (params) => {
|
|
346
|
-
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
347
|
-
return new RegExp(`^${regex}$`);
|
|
348
|
-
};
|
|
349
|
-
const number = /^-?\d+(?:\.\d+)?$/;
|
|
350
|
-
const boolean$1 = /^(?:true|false)$/i;
|
|
351
|
-
const version = {
|
|
352
|
-
major: 4,
|
|
353
|
-
minor: 3,
|
|
354
|
-
patch: 6
|
|
355
|
-
};
|
|
356
|
-
const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
357
|
-
var _a;
|
|
358
|
-
inst ?? (inst = {});
|
|
359
|
-
inst._zod.def = def;
|
|
360
|
-
inst._zod.bag = inst._zod.bag || {};
|
|
361
|
-
inst._zod.version = version;
|
|
362
|
-
const checks = [...inst._zod.def.checks ?? []];
|
|
363
|
-
if (inst._zod.traits.has("$ZodCheck")) {
|
|
364
|
-
checks.unshift(inst);
|
|
365
|
-
}
|
|
366
|
-
for (const ch of checks) {
|
|
367
|
-
for (const fn of ch._zod.onattach) {
|
|
368
|
-
fn(inst);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
if (checks.length === 0) {
|
|
372
|
-
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
373
|
-
inst._zod.deferred?.push(() => {
|
|
374
|
-
inst._zod.run = inst._zod.parse;
|
|
375
|
-
});
|
|
376
|
-
} else {
|
|
377
|
-
const runChecks = (payload, checks2, ctx) => {
|
|
378
|
-
let isAborted = aborted(payload);
|
|
379
|
-
let asyncResult;
|
|
380
|
-
for (const ch of checks2) {
|
|
381
|
-
if (ch._zod.def.when) {
|
|
382
|
-
const shouldRun = ch._zod.def.when(payload);
|
|
383
|
-
if (!shouldRun)
|
|
384
|
-
continue;
|
|
385
|
-
} else if (isAborted) {
|
|
386
|
-
continue;
|
|
387
|
-
}
|
|
388
|
-
const currLen = payload.issues.length;
|
|
389
|
-
const _ = ch._zod.check(payload);
|
|
390
|
-
if (_ instanceof Promise && ctx?.async === false) {
|
|
391
|
-
throw new $ZodAsyncError();
|
|
392
|
-
}
|
|
393
|
-
if (asyncResult || _ instanceof Promise) {
|
|
394
|
-
asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
395
|
-
await _;
|
|
396
|
-
const nextLen = payload.issues.length;
|
|
397
|
-
if (nextLen === currLen)
|
|
398
|
-
return;
|
|
399
|
-
if (!isAborted)
|
|
400
|
-
isAborted = aborted(payload, currLen);
|
|
401
|
-
});
|
|
402
|
-
} else {
|
|
403
|
-
const nextLen = payload.issues.length;
|
|
404
|
-
if (nextLen === currLen)
|
|
405
|
-
continue;
|
|
406
|
-
if (!isAborted)
|
|
407
|
-
isAborted = aborted(payload, currLen);
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
if (asyncResult) {
|
|
411
|
-
return asyncResult.then(() => {
|
|
412
|
-
return payload;
|
|
413
|
-
});
|
|
414
|
-
}
|
|
415
|
-
return payload;
|
|
416
|
-
};
|
|
417
|
-
const handleCanaryResult = (canary, payload, ctx) => {
|
|
418
|
-
if (aborted(canary)) {
|
|
419
|
-
canary.aborted = true;
|
|
420
|
-
return canary;
|
|
421
|
-
}
|
|
422
|
-
const checkResult = runChecks(payload, checks, ctx);
|
|
423
|
-
if (checkResult instanceof Promise) {
|
|
424
|
-
if (ctx.async === false)
|
|
425
|
-
throw new $ZodAsyncError();
|
|
426
|
-
return checkResult.then((checkResult2) => inst._zod.parse(checkResult2, ctx));
|
|
427
|
-
}
|
|
428
|
-
return inst._zod.parse(checkResult, ctx);
|
|
429
|
-
};
|
|
430
|
-
inst._zod.run = (payload, ctx) => {
|
|
431
|
-
if (ctx.skipChecks) {
|
|
432
|
-
return inst._zod.parse(payload, ctx);
|
|
433
|
-
}
|
|
434
|
-
if (ctx.direction === "backward") {
|
|
435
|
-
const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
|
|
436
|
-
if (canary instanceof Promise) {
|
|
437
|
-
return canary.then((canary2) => {
|
|
438
|
-
return handleCanaryResult(canary2, payload, ctx);
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
|
-
return handleCanaryResult(canary, payload, ctx);
|
|
442
|
-
}
|
|
443
|
-
const result = inst._zod.parse(payload, ctx);
|
|
444
|
-
if (result instanceof Promise) {
|
|
445
|
-
if (ctx.async === false)
|
|
446
|
-
throw new $ZodAsyncError();
|
|
447
|
-
return result.then((result2) => runChecks(result2, checks, ctx));
|
|
448
|
-
}
|
|
449
|
-
return runChecks(result, checks, ctx);
|
|
450
|
-
};
|
|
451
|
-
}
|
|
452
|
-
defineLazy(inst, "~standard", () => ({
|
|
453
|
-
validate: (value) => {
|
|
454
|
-
try {
|
|
455
|
-
const r = safeParse(inst, value);
|
|
456
|
-
return r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
457
|
-
} catch (_) {
|
|
458
|
-
return safeParseAsync(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
|
|
459
|
-
}
|
|
460
|
-
},
|
|
461
|
-
vendor: "zod",
|
|
462
|
-
version: 1
|
|
463
|
-
}));
|
|
464
|
-
});
|
|
465
|
-
const $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
466
|
-
$ZodType.init(inst, def);
|
|
467
|
-
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$1(inst._zod.bag);
|
|
468
|
-
inst._zod.parse = (payload, _) => {
|
|
469
|
-
if (def.coerce)
|
|
470
|
-
try {
|
|
471
|
-
payload.value = String(payload.value);
|
|
472
|
-
} catch (_2) {
|
|
473
|
-
}
|
|
474
|
-
if (typeof payload.value === "string")
|
|
475
|
-
return payload;
|
|
476
|
-
payload.issues.push({
|
|
477
|
-
expected: "string",
|
|
478
|
-
code: "invalid_type",
|
|
479
|
-
input: payload.value,
|
|
480
|
-
inst
|
|
481
|
-
});
|
|
482
|
-
return payload;
|
|
483
|
-
};
|
|
484
|
-
});
|
|
485
|
-
const $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
486
|
-
$ZodType.init(inst, def);
|
|
487
|
-
inst._zod.pattern = boolean$1;
|
|
488
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
489
|
-
if (def.coerce)
|
|
490
|
-
try {
|
|
491
|
-
payload.value = Boolean(payload.value);
|
|
492
|
-
} catch (_) {
|
|
493
|
-
}
|
|
494
|
-
const input = payload.value;
|
|
495
|
-
if (typeof input === "boolean")
|
|
496
|
-
return payload;
|
|
497
|
-
payload.issues.push({
|
|
498
|
-
expected: "boolean",
|
|
499
|
-
code: "invalid_type",
|
|
500
|
-
input,
|
|
501
|
-
inst
|
|
502
|
-
});
|
|
503
|
-
return payload;
|
|
504
|
-
};
|
|
505
|
-
});
|
|
506
|
-
function handlePropertyResult(result, final, key, input, isOptionalOut) {
|
|
507
|
-
if (result.issues.length) {
|
|
508
|
-
if (isOptionalOut && !(key in input)) {
|
|
509
|
-
return;
|
|
510
|
-
}
|
|
511
|
-
final.issues.push(...prefixIssues(key, result.issues));
|
|
512
|
-
}
|
|
513
|
-
if (result.value === void 0) {
|
|
514
|
-
if (key in input) {
|
|
515
|
-
final.value[key] = void 0;
|
|
516
|
-
}
|
|
517
|
-
} else {
|
|
518
|
-
final.value[key] = result.value;
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
function normalizeDef(def) {
|
|
522
|
-
const keys = Object.keys(def.shape);
|
|
523
|
-
for (const k of keys) {
|
|
524
|
-
if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
|
|
525
|
-
throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
const okeys = optionalKeys(def.shape);
|
|
529
|
-
return {
|
|
530
|
-
...def,
|
|
531
|
-
keys,
|
|
532
|
-
keySet: new Set(keys),
|
|
533
|
-
numKeys: keys.length,
|
|
534
|
-
optionalKeys: new Set(okeys)
|
|
535
|
-
};
|
|
536
|
-
}
|
|
537
|
-
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
538
|
-
const unrecognized = [];
|
|
539
|
-
const keySet = def.keySet;
|
|
540
|
-
const _catchall = def.catchall._zod;
|
|
541
|
-
const t = _catchall.def.type;
|
|
542
|
-
const isOptionalOut = _catchall.optout === "optional";
|
|
543
|
-
for (const key in input) {
|
|
544
|
-
if (keySet.has(key))
|
|
545
|
-
continue;
|
|
546
|
-
if (t === "never") {
|
|
547
|
-
unrecognized.push(key);
|
|
548
|
-
continue;
|
|
549
|
-
}
|
|
550
|
-
const r = _catchall.run({ value: input[key], issues: [] }, ctx);
|
|
551
|
-
if (r instanceof Promise) {
|
|
552
|
-
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalOut)));
|
|
553
|
-
} else {
|
|
554
|
-
handlePropertyResult(r, payload, key, input, isOptionalOut);
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
if (unrecognized.length) {
|
|
558
|
-
payload.issues.push({
|
|
559
|
-
code: "unrecognized_keys",
|
|
560
|
-
keys: unrecognized,
|
|
561
|
-
input,
|
|
562
|
-
inst
|
|
563
|
-
});
|
|
564
|
-
}
|
|
565
|
-
if (!proms.length)
|
|
566
|
-
return payload;
|
|
567
|
-
return Promise.all(proms).then(() => {
|
|
568
|
-
return payload;
|
|
569
|
-
});
|
|
570
|
-
}
|
|
571
|
-
const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
572
|
-
$ZodType.init(inst, def);
|
|
573
|
-
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
574
|
-
if (!desc?.get) {
|
|
575
|
-
const sh = def.shape;
|
|
576
|
-
Object.defineProperty(def, "shape", {
|
|
577
|
-
get: () => {
|
|
578
|
-
const newSh = { ...sh };
|
|
579
|
-
Object.defineProperty(def, "shape", {
|
|
580
|
-
value: newSh
|
|
581
|
-
});
|
|
582
|
-
return newSh;
|
|
583
|
-
}
|
|
584
|
-
});
|
|
585
|
-
}
|
|
586
|
-
const _normalized = cached(() => normalizeDef(def));
|
|
587
|
-
defineLazy(inst._zod, "propValues", () => {
|
|
588
|
-
const shape = def.shape;
|
|
589
|
-
const propValues = {};
|
|
590
|
-
for (const key in shape) {
|
|
591
|
-
const field = shape[key]._zod;
|
|
592
|
-
if (field.values) {
|
|
593
|
-
propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
|
|
594
|
-
for (const v of field.values)
|
|
595
|
-
propValues[key].add(v);
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
return propValues;
|
|
599
|
-
});
|
|
600
|
-
const isObject$1 = isObject;
|
|
601
|
-
const catchall = def.catchall;
|
|
602
|
-
let value;
|
|
603
|
-
inst._zod.parse = (payload, ctx) => {
|
|
604
|
-
value ?? (value = _normalized.value);
|
|
605
|
-
const input = payload.value;
|
|
606
|
-
if (!isObject$1(input)) {
|
|
607
|
-
payload.issues.push({
|
|
608
|
-
expected: "object",
|
|
609
|
-
code: "invalid_type",
|
|
610
|
-
input,
|
|
611
|
-
inst
|
|
612
|
-
});
|
|
613
|
-
return payload;
|
|
614
|
-
}
|
|
615
|
-
payload.value = {};
|
|
616
|
-
const proms = [];
|
|
617
|
-
const shape = value.shape;
|
|
618
|
-
for (const key of value.keys) {
|
|
619
|
-
const el = shape[key];
|
|
620
|
-
const isOptionalOut = el._zod.optout === "optional";
|
|
621
|
-
const r = el._zod.run({ value: input[key], issues: [] }, ctx);
|
|
622
|
-
if (r instanceof Promise) {
|
|
623
|
-
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalOut)));
|
|
624
|
-
} else {
|
|
625
|
-
handlePropertyResult(r, payload, key, input, isOptionalOut);
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
if (!catchall) {
|
|
629
|
-
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
630
|
-
}
|
|
631
|
-
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
632
|
-
};
|
|
633
|
-
});
|
|
634
|
-
function handleUnionResults(results, final, inst, ctx) {
|
|
635
|
-
for (const result of results) {
|
|
636
|
-
if (result.issues.length === 0) {
|
|
637
|
-
final.value = result.value;
|
|
638
|
-
return final;
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
const nonaborted = results.filter((r) => !aborted(r));
|
|
642
|
-
if (nonaborted.length === 1) {
|
|
643
|
-
final.value = nonaborted[0].value;
|
|
644
|
-
return nonaborted[0];
|
|
645
|
-
}
|
|
646
|
-
final.issues.push({
|
|
647
|
-
code: "invalid_union",
|
|
648
|
-
input: final.value,
|
|
649
|
-
inst,
|
|
650
|
-
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
651
|
-
});
|
|
652
|
-
return final;
|
|
653
|
-
}
|
|
654
|
-
const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
655
|
-
$ZodType.init(inst, def);
|
|
656
|
-
defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
|
|
657
|
-
defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
|
|
658
|
-
defineLazy(inst._zod, "values", () => {
|
|
659
|
-
if (def.options.every((o) => o._zod.values)) {
|
|
660
|
-
return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
661
|
-
}
|
|
662
|
-
return void 0;
|
|
663
|
-
});
|
|
664
|
-
defineLazy(inst._zod, "pattern", () => {
|
|
665
|
-
if (def.options.every((o) => o._zod.pattern)) {
|
|
666
|
-
const patterns = def.options.map((o) => o._zod.pattern);
|
|
667
|
-
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
668
|
-
}
|
|
669
|
-
return void 0;
|
|
670
|
-
});
|
|
671
|
-
const single = def.options.length === 1;
|
|
672
|
-
const first = def.options[0]._zod.run;
|
|
673
|
-
inst._zod.parse = (payload, ctx) => {
|
|
674
|
-
if (single) {
|
|
675
|
-
return first(payload, ctx);
|
|
676
|
-
}
|
|
677
|
-
let async = false;
|
|
678
|
-
const results = [];
|
|
679
|
-
for (const option of def.options) {
|
|
680
|
-
const result = option._zod.run({
|
|
681
|
-
value: payload.value,
|
|
682
|
-
issues: []
|
|
683
|
-
}, ctx);
|
|
684
|
-
if (result instanceof Promise) {
|
|
685
|
-
results.push(result);
|
|
686
|
-
async = true;
|
|
687
|
-
} else {
|
|
688
|
-
if (result.issues.length === 0)
|
|
689
|
-
return result;
|
|
690
|
-
results.push(result);
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
if (!async)
|
|
694
|
-
return handleUnionResults(results, payload, inst, ctx);
|
|
695
|
-
return Promise.all(results).then((results2) => {
|
|
696
|
-
return handleUnionResults(results2, payload, inst, ctx);
|
|
697
|
-
});
|
|
698
|
-
};
|
|
699
|
-
});
|
|
700
|
-
const $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
701
|
-
def.inclusive = false;
|
|
702
|
-
$ZodUnion.init(inst, def);
|
|
703
|
-
const _super = inst._zod.parse;
|
|
704
|
-
defineLazy(inst._zod, "propValues", () => {
|
|
705
|
-
const propValues = {};
|
|
706
|
-
for (const option of def.options) {
|
|
707
|
-
const pv = option._zod.propValues;
|
|
708
|
-
if (!pv || Object.keys(pv).length === 0)
|
|
709
|
-
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
710
|
-
for (const [k, v] of Object.entries(pv)) {
|
|
711
|
-
if (!propValues[k])
|
|
712
|
-
propValues[k] = /* @__PURE__ */ new Set();
|
|
713
|
-
for (const val of v) {
|
|
714
|
-
propValues[k].add(val);
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
return propValues;
|
|
719
|
-
});
|
|
720
|
-
const disc = cached(() => {
|
|
721
|
-
const opts = def.options;
|
|
722
|
-
const map = /* @__PURE__ */ new Map();
|
|
723
|
-
for (const o of opts) {
|
|
724
|
-
const values = o._zod.propValues?.[def.discriminator];
|
|
725
|
-
if (!values || values.size === 0)
|
|
726
|
-
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
|
|
727
|
-
for (const v of values) {
|
|
728
|
-
if (map.has(v)) {
|
|
729
|
-
throw new Error(`Duplicate discriminator value "${String(v)}"`);
|
|
730
|
-
}
|
|
731
|
-
map.set(v, o);
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
return map;
|
|
735
|
-
});
|
|
736
|
-
inst._zod.parse = (payload, ctx) => {
|
|
737
|
-
const input = payload.value;
|
|
738
|
-
if (!isObject(input)) {
|
|
739
|
-
payload.issues.push({
|
|
740
|
-
code: "invalid_type",
|
|
741
|
-
expected: "object",
|
|
742
|
-
input,
|
|
743
|
-
inst
|
|
744
|
-
});
|
|
745
|
-
return payload;
|
|
746
|
-
}
|
|
747
|
-
const opt = disc.value.get(input?.[def.discriminator]);
|
|
748
|
-
if (opt) {
|
|
749
|
-
return opt._zod.run(payload, ctx);
|
|
750
|
-
}
|
|
751
|
-
if (def.unionFallback) {
|
|
752
|
-
return _super(payload, ctx);
|
|
753
|
-
}
|
|
754
|
-
payload.issues.push({
|
|
755
|
-
code: "invalid_union",
|
|
756
|
-
errors: [],
|
|
757
|
-
note: "No matching discriminator",
|
|
758
|
-
discriminator: def.discriminator,
|
|
759
|
-
input,
|
|
760
|
-
path: [def.discriminator],
|
|
761
|
-
inst
|
|
762
|
-
});
|
|
763
|
-
return payload;
|
|
764
|
-
};
|
|
765
|
-
});
|
|
766
|
-
const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
767
|
-
$ZodType.init(inst, def);
|
|
768
|
-
inst._zod.parse = (payload, ctx) => {
|
|
769
|
-
const input = payload.value;
|
|
770
|
-
if (!isPlainObject(input)) {
|
|
771
|
-
payload.issues.push({
|
|
772
|
-
expected: "record",
|
|
773
|
-
code: "invalid_type",
|
|
774
|
-
input,
|
|
775
|
-
inst
|
|
776
|
-
});
|
|
777
|
-
return payload;
|
|
778
|
-
}
|
|
779
|
-
const proms = [];
|
|
780
|
-
const values = def.keyType._zod.values;
|
|
781
|
-
if (values) {
|
|
782
|
-
payload.value = {};
|
|
783
|
-
const recordKeys = /* @__PURE__ */ new Set();
|
|
784
|
-
for (const key of values) {
|
|
785
|
-
if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
786
|
-
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
787
|
-
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
788
|
-
if (result instanceof Promise) {
|
|
789
|
-
proms.push(result.then((result2) => {
|
|
790
|
-
if (result2.issues.length) {
|
|
791
|
-
payload.issues.push(...prefixIssues(key, result2.issues));
|
|
792
|
-
}
|
|
793
|
-
payload.value[key] = result2.value;
|
|
794
|
-
}));
|
|
795
|
-
} else {
|
|
796
|
-
if (result.issues.length) {
|
|
797
|
-
payload.issues.push(...prefixIssues(key, result.issues));
|
|
798
|
-
}
|
|
799
|
-
payload.value[key] = result.value;
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
let unrecognized;
|
|
804
|
-
for (const key in input) {
|
|
805
|
-
if (!recordKeys.has(key)) {
|
|
806
|
-
unrecognized = unrecognized ?? [];
|
|
807
|
-
unrecognized.push(key);
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
if (unrecognized && unrecognized.length > 0) {
|
|
811
|
-
payload.issues.push({
|
|
812
|
-
code: "unrecognized_keys",
|
|
813
|
-
input,
|
|
814
|
-
inst,
|
|
815
|
-
keys: unrecognized
|
|
816
|
-
});
|
|
817
|
-
}
|
|
818
|
-
} else {
|
|
819
|
-
payload.value = {};
|
|
820
|
-
for (const key of Reflect.ownKeys(input)) {
|
|
821
|
-
if (key === "__proto__")
|
|
822
|
-
continue;
|
|
823
|
-
let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
824
|
-
if (keyResult instanceof Promise) {
|
|
825
|
-
throw new Error("Async schemas not supported in object keys currently");
|
|
826
|
-
}
|
|
827
|
-
const checkNumericKey = typeof key === "string" && number.test(key) && keyResult.issues.length;
|
|
828
|
-
if (checkNumericKey) {
|
|
829
|
-
const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
|
|
830
|
-
if (retryResult instanceof Promise) {
|
|
831
|
-
throw new Error("Async schemas not supported in object keys currently");
|
|
832
|
-
}
|
|
833
|
-
if (retryResult.issues.length === 0) {
|
|
834
|
-
keyResult = retryResult;
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
if (keyResult.issues.length) {
|
|
838
|
-
if (def.mode === "loose") {
|
|
839
|
-
payload.value[key] = input[key];
|
|
840
|
-
} else {
|
|
841
|
-
payload.issues.push({
|
|
842
|
-
code: "invalid_key",
|
|
843
|
-
origin: "record",
|
|
844
|
-
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
845
|
-
input: key,
|
|
846
|
-
path: [key],
|
|
847
|
-
inst
|
|
848
|
-
});
|
|
849
|
-
}
|
|
850
|
-
continue;
|
|
851
|
-
}
|
|
852
|
-
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
853
|
-
if (result instanceof Promise) {
|
|
854
|
-
proms.push(result.then((result2) => {
|
|
855
|
-
if (result2.issues.length) {
|
|
856
|
-
payload.issues.push(...prefixIssues(key, result2.issues));
|
|
857
|
-
}
|
|
858
|
-
payload.value[keyResult.value] = result2.value;
|
|
859
|
-
}));
|
|
860
|
-
} else {
|
|
861
|
-
if (result.issues.length) {
|
|
862
|
-
payload.issues.push(...prefixIssues(key, result.issues));
|
|
863
|
-
}
|
|
864
|
-
payload.value[keyResult.value] = result.value;
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
if (proms.length) {
|
|
869
|
-
return Promise.all(proms).then(() => payload);
|
|
870
|
-
}
|
|
871
|
-
return payload;
|
|
872
|
-
};
|
|
873
|
-
});
|
|
874
|
-
const $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
875
|
-
$ZodType.init(inst, def);
|
|
876
|
-
if (def.values.length === 0) {
|
|
877
|
-
throw new Error("Cannot create literal schema with no valid values");
|
|
878
|
-
}
|
|
879
|
-
const values = new Set(def.values);
|
|
880
|
-
inst._zod.values = values;
|
|
881
|
-
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
882
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
883
|
-
const input = payload.value;
|
|
884
|
-
if (values.has(input)) {
|
|
885
|
-
return payload;
|
|
886
|
-
}
|
|
887
|
-
payload.issues.push({
|
|
888
|
-
code: "invalid_value",
|
|
889
|
-
values: def.values,
|
|
890
|
-
input,
|
|
891
|
-
inst
|
|
892
|
-
});
|
|
893
|
-
return payload;
|
|
894
|
-
};
|
|
895
|
-
});
|
|
896
|
-
function handleOptionalResult(result, input) {
|
|
897
|
-
if (result.issues.length && input === void 0) {
|
|
898
|
-
return { issues: [], value: void 0 };
|
|
899
|
-
}
|
|
900
|
-
return result;
|
|
901
|
-
}
|
|
902
|
-
const $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
903
|
-
$ZodType.init(inst, def);
|
|
904
|
-
inst._zod.optin = "optional";
|
|
905
|
-
inst._zod.optout = "optional";
|
|
906
|
-
defineLazy(inst._zod, "values", () => {
|
|
907
|
-
return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, void 0]) : void 0;
|
|
908
|
-
});
|
|
909
|
-
defineLazy(inst._zod, "pattern", () => {
|
|
910
|
-
const pattern = def.innerType._zod.pattern;
|
|
911
|
-
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
|
|
912
|
-
});
|
|
913
|
-
inst._zod.parse = (payload, ctx) => {
|
|
914
|
-
if (def.innerType._zod.optin === "optional") {
|
|
915
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
916
|
-
if (result instanceof Promise)
|
|
917
|
-
return result.then((r) => handleOptionalResult(r, payload.value));
|
|
918
|
-
return handleOptionalResult(result, payload.value);
|
|
919
|
-
}
|
|
920
|
-
if (payload.value === void 0) {
|
|
921
|
-
return payload;
|
|
922
|
-
}
|
|
923
|
-
return def.innerType._zod.run(payload, ctx);
|
|
924
|
-
};
|
|
925
|
-
});
|
|
926
|
-
// @__NO_SIDE_EFFECTS__
|
|
927
|
-
function _string(Class, params) {
|
|
928
|
-
return new Class({
|
|
929
|
-
type: "string",
|
|
930
|
-
...normalizeParams()
|
|
931
|
-
});
|
|
932
|
-
}
|
|
933
|
-
// @__NO_SIDE_EFFECTS__
|
|
934
|
-
function _boolean(Class, params) {
|
|
935
|
-
return new Class({
|
|
936
|
-
type: "boolean",
|
|
937
|
-
...normalizeParams()
|
|
938
|
-
});
|
|
939
|
-
}
|
|
940
|
-
const ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => {
|
|
941
|
-
if (!inst._zod)
|
|
942
|
-
throw new Error("Uninitialized schema in ZodMiniType.");
|
|
943
|
-
$ZodType.init(inst, def);
|
|
944
|
-
inst.def = def;
|
|
945
|
-
inst.type = def.type;
|
|
946
|
-
inst.parse = (data, params) => parse$1(inst, data, params, { callee: inst.parse });
|
|
947
|
-
inst.safeParse = (data, params) => safeParse(inst, data, params);
|
|
948
|
-
inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
949
|
-
inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
|
|
950
|
-
inst.check = (...checks) => {
|
|
951
|
-
return inst.clone({
|
|
952
|
-
...def,
|
|
953
|
-
checks: [
|
|
954
|
-
...def.checks ?? [],
|
|
955
|
-
...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
|
|
956
|
-
]
|
|
957
|
-
}, { parent: true });
|
|
958
|
-
};
|
|
959
|
-
inst.with = inst.check;
|
|
960
|
-
inst.clone = (_def, params) => clone(inst, _def, params);
|
|
961
|
-
inst.brand = () => inst;
|
|
962
|
-
inst.register = ((reg, meta) => {
|
|
963
|
-
reg.add(inst, meta);
|
|
964
|
-
return inst;
|
|
965
|
-
});
|
|
966
|
-
inst.apply = (fn) => fn(inst);
|
|
967
|
-
});
|
|
968
|
-
const ZodMiniString = /* @__PURE__ */ $constructor("ZodMiniString", (inst, def) => {
|
|
969
|
-
$ZodString.init(inst, def);
|
|
970
|
-
ZodMiniType.init(inst, def);
|
|
971
|
-
});
|
|
972
|
-
// @__NO_SIDE_EFFECTS__
|
|
973
|
-
function string(params) {
|
|
974
|
-
return /* @__PURE__ */ _string(ZodMiniString);
|
|
975
|
-
}
|
|
976
|
-
const ZodMiniBoolean = /* @__PURE__ */ $constructor("ZodMiniBoolean", (inst, def) => {
|
|
977
|
-
$ZodBoolean.init(inst, def);
|
|
978
|
-
ZodMiniType.init(inst, def);
|
|
979
|
-
});
|
|
980
|
-
// @__NO_SIDE_EFFECTS__
|
|
981
|
-
function boolean(params) {
|
|
982
|
-
return /* @__PURE__ */ _boolean(ZodMiniBoolean);
|
|
983
|
-
}
|
|
984
|
-
const ZodMiniObject = /* @__PURE__ */ $constructor("ZodMiniObject", (inst, def) => {
|
|
985
|
-
$ZodObject.init(inst, def);
|
|
986
|
-
ZodMiniType.init(inst, def);
|
|
987
|
-
defineLazy(inst, "shape", () => def.shape);
|
|
988
|
-
});
|
|
989
|
-
// @__NO_SIDE_EFFECTS__
|
|
990
|
-
function object(shape, params) {
|
|
991
|
-
const def = {
|
|
992
|
-
type: "object",
|
|
993
|
-
shape: shape ?? {},
|
|
994
|
-
...normalizeParams()
|
|
995
|
-
};
|
|
996
|
-
return new ZodMiniObject(def);
|
|
997
|
-
}
|
|
998
|
-
const ZodMiniDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodMiniDiscriminatedUnion", (inst, def) => {
|
|
999
|
-
$ZodDiscriminatedUnion.init(inst, def);
|
|
1000
|
-
ZodMiniType.init(inst, def);
|
|
1001
|
-
});
|
|
1002
|
-
// @__NO_SIDE_EFFECTS__
|
|
1003
|
-
function discriminatedUnion(discriminator, options, params) {
|
|
1004
|
-
return new ZodMiniDiscriminatedUnion({
|
|
1005
|
-
type: "union",
|
|
1006
|
-
options,
|
|
1007
|
-
discriminator,
|
|
1008
|
-
...normalizeParams()
|
|
1009
|
-
});
|
|
1010
|
-
}
|
|
1011
|
-
const ZodMiniRecord = /* @__PURE__ */ $constructor("ZodMiniRecord", (inst, def) => {
|
|
1012
|
-
$ZodRecord.init(inst, def);
|
|
1013
|
-
ZodMiniType.init(inst, def);
|
|
1014
|
-
});
|
|
1015
|
-
// @__NO_SIDE_EFFECTS__
|
|
1016
|
-
function record(keyType, valueType, params) {
|
|
1017
|
-
return new ZodMiniRecord({
|
|
1018
|
-
type: "record",
|
|
1019
|
-
keyType,
|
|
1020
|
-
valueType,
|
|
1021
|
-
...normalizeParams()
|
|
1022
|
-
});
|
|
1023
|
-
}
|
|
1024
|
-
const ZodMiniLiteral = /* @__PURE__ */ $constructor("ZodMiniLiteral", (inst, def) => {
|
|
1025
|
-
$ZodLiteral.init(inst, def);
|
|
1026
|
-
ZodMiniType.init(inst, def);
|
|
1027
|
-
});
|
|
1028
|
-
// @__NO_SIDE_EFFECTS__
|
|
1029
|
-
function literal(value, params) {
|
|
1030
|
-
return new ZodMiniLiteral({
|
|
1031
|
-
type: "literal",
|
|
1032
|
-
values: Array.isArray(value) ? value : [value],
|
|
1033
|
-
...normalizeParams()
|
|
1034
|
-
});
|
|
1035
|
-
}
|
|
1036
|
-
const ZodMiniOptional = /* @__PURE__ */ $constructor("ZodMiniOptional", (inst, def) => {
|
|
1037
|
-
$ZodOptional.init(inst, def);
|
|
1038
|
-
ZodMiniType.init(inst, def);
|
|
1039
|
-
});
|
|
1040
|
-
// @__NO_SIDE_EFFECTS__
|
|
1041
|
-
function optional(innerType) {
|
|
1042
|
-
return new ZodMiniOptional({
|
|
1043
|
-
type: "optional",
|
|
1044
|
-
innerType
|
|
1045
|
-
});
|
|
1046
|
-
}
|
|
1047
|
-
const remoteScriptDefinitionSchema = /* @__PURE__ */ object({
|
|
1048
|
-
variant: /* @__PURE__ */ literal("remote"),
|
|
1049
|
-
type: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
|
|
1050
|
-
src: /* @__PURE__ */ string(),
|
|
1051
|
-
async: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
1052
|
-
defer: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
1053
|
-
crossorigin: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
|
|
1054
|
-
integrity: /* @__PURE__ */ optional(/* @__PURE__ */ string())
|
|
1055
|
-
});
|
|
1056
|
-
const inlineScriptDefinitionSchema = /* @__PURE__ */ object({
|
|
1057
|
-
variant: /* @__PURE__ */ literal("inline"),
|
|
1058
|
-
type: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
|
|
1059
|
-
async: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
1060
|
-
defer: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
1061
|
-
content: /* @__PURE__ */ string()
|
|
1062
|
-
});
|
|
1063
|
-
const scriptDefinitionSchema = /* @__PURE__ */ discriminatedUnion("variant", [
|
|
1064
|
-
remoteScriptDefinitionSchema,
|
|
1065
|
-
inlineScriptDefinitionSchema
|
|
1066
|
-
]);
|
|
1067
|
-
var jsxRuntime = { exports: {} };
|
|
1068
|
-
var reactJsxRuntime_production_min = {};
|
|
1069
|
-
var hasRequiredReactJsxRuntime_production_min;
|
|
1070
|
-
function requireReactJsxRuntime_production_min() {
|
|
1071
|
-
if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
|
|
1072
|
-
hasRequiredReactJsxRuntime_production_min = 1;
|
|
1073
|
-
var f2 = React__default, k = /* @__PURE__ */ Symbol.for("react.element"), l2 = /* @__PURE__ */ Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, n = f2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: true, ref: true, __self: true, __source: true };
|
|
1074
|
-
function q(c, a, g) {
|
|
1075
|
-
var b, d = {}, e = null, h = null;
|
|
1076
|
-
void 0 !== g && (e = "" + g);
|
|
1077
|
-
void 0 !== a.key && (e = "" + a.key);
|
|
1078
|
-
void 0 !== a.ref && (h = a.ref);
|
|
1079
|
-
for (b in a) m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
|
|
1080
|
-
if (c && c.defaultProps) for (b in a = c.defaultProps, a) void 0 === d[b] && (d[b] = a[b]);
|
|
1081
|
-
return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current };
|
|
1082
|
-
}
|
|
1083
|
-
reactJsxRuntime_production_min.Fragment = l2;
|
|
1084
|
-
reactJsxRuntime_production_min.jsx = q;
|
|
1085
|
-
reactJsxRuntime_production_min.jsxs = q;
|
|
1086
|
-
return reactJsxRuntime_production_min;
|
|
1087
|
-
}
|
|
1088
|
-
var reactJsxRuntime_development = {};
|
|
1089
|
-
var hasRequiredReactJsxRuntime_development;
|
|
1090
|
-
function requireReactJsxRuntime_development() {
|
|
1091
|
-
if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
|
|
1092
|
-
hasRequiredReactJsxRuntime_development = 1;
|
|
1093
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1094
|
-
(function() {
|
|
1095
|
-
var React2 = React__default;
|
|
1096
|
-
var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.element");
|
|
1097
|
-
var REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal");
|
|
1098
|
-
var REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
1099
|
-
var REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode");
|
|
1100
|
-
var REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler");
|
|
1101
|
-
var REACT_PROVIDER_TYPE = /* @__PURE__ */ Symbol.for("react.provider");
|
|
1102
|
-
var REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context");
|
|
1103
|
-
var REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref");
|
|
1104
|
-
var REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense");
|
|
1105
|
-
var REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for("react.suspense_list");
|
|
1106
|
-
var REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo");
|
|
1107
|
-
var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
|
|
1108
|
-
var REACT_OFFSCREEN_TYPE = /* @__PURE__ */ Symbol.for("react.offscreen");
|
|
1109
|
-
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
1110
|
-
var FAUX_ITERATOR_SYMBOL = "@@iterator";
|
|
1111
|
-
function getIteratorFn(maybeIterable) {
|
|
1112
|
-
if (maybeIterable === null || typeof maybeIterable !== "object") {
|
|
1113
|
-
return null;
|
|
1114
|
-
}
|
|
1115
|
-
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
1116
|
-
if (typeof maybeIterator === "function") {
|
|
1117
|
-
return maybeIterator;
|
|
1118
|
-
}
|
|
1119
|
-
return null;
|
|
1120
|
-
}
|
|
1121
|
-
var ReactSharedInternals = React2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
1122
|
-
function error(format) {
|
|
1123
|
-
{
|
|
1124
|
-
{
|
|
1125
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
1126
|
-
args[_key2 - 1] = arguments[_key2];
|
|
1127
|
-
}
|
|
1128
|
-
printWarning("error", format, args);
|
|
1129
|
-
}
|
|
1130
|
-
}
|
|
1131
|
-
}
|
|
1132
|
-
function printWarning(level, format, args) {
|
|
1133
|
-
{
|
|
1134
|
-
var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
1135
|
-
var stack = ReactDebugCurrentFrame2.getStackAddendum();
|
|
1136
|
-
if (stack !== "") {
|
|
1137
|
-
format += "%s";
|
|
1138
|
-
args = args.concat([stack]);
|
|
1139
|
-
}
|
|
1140
|
-
var argsWithFormat = args.map(function(item) {
|
|
1141
|
-
return String(item);
|
|
1142
|
-
});
|
|
1143
|
-
argsWithFormat.unshift("Warning: " + format);
|
|
1144
|
-
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
1145
|
-
}
|
|
1146
|
-
}
|
|
1147
|
-
var enableScopeAPI = false;
|
|
1148
|
-
var enableCacheElement = false;
|
|
1149
|
-
var enableTransitionTracing = false;
|
|
1150
|
-
var enableLegacyHidden = false;
|
|
1151
|
-
var enableDebugTracing = false;
|
|
1152
|
-
var REACT_MODULE_REFERENCE;
|
|
1153
|
-
{
|
|
1154
|
-
REACT_MODULE_REFERENCE = /* @__PURE__ */ Symbol.for("react.module.reference");
|
|
1155
|
-
}
|
|
1156
|
-
function isValidElementType(type) {
|
|
1157
|
-
if (typeof type === "string" || typeof type === "function") {
|
|
1158
|
-
return true;
|
|
1159
|
-
}
|
|
1160
|
-
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) {
|
|
1161
|
-
return true;
|
|
1162
|
-
}
|
|
1163
|
-
if (typeof type === "object" && type !== null) {
|
|
1164
|
-
if (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 || // This needs to include all possible module reference object
|
|
1165
|
-
// types supported by any Flight configuration anywhere since
|
|
1166
|
-
// we don't know which Flight build this will end up being used
|
|
1167
|
-
// with.
|
|
1168
|
-
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) {
|
|
1169
|
-
return true;
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
return false;
|
|
1173
|
-
}
|
|
1174
|
-
function getWrappedName(outerType, innerType, wrapperName) {
|
|
1175
|
-
var displayName = outerType.displayName;
|
|
1176
|
-
if (displayName) {
|
|
1177
|
-
return displayName;
|
|
1178
|
-
}
|
|
1179
|
-
var functionName = innerType.displayName || innerType.name || "";
|
|
1180
|
-
return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
113
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
114
|
+
var displayName = outerType.displayName;
|
|
115
|
+
if (displayName) {
|
|
116
|
+
return displayName;
|
|
117
|
+
}
|
|
118
|
+
var functionName = innerType.displayName || innerType.name || "";
|
|
119
|
+
return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
1181
120
|
}
|
|
1182
121
|
function getContextName(type) {
|
|
1183
122
|
return type.displayName || "Context";
|
|
@@ -1934,2307 +873,1295 @@ function requireReactJsxRuntime_development() {
|
|
|
1934
873
|
return element;
|
|
1935
874
|
}
|
|
1936
875
|
}
|
|
1937
|
-
function jsxWithValidationStatic(type, props, key) {
|
|
1938
|
-
{
|
|
1939
|
-
return jsxWithValidation(type, props, key, true);
|
|
1940
|
-
}
|
|
876
|
+
function jsxWithValidationStatic(type, props, key) {
|
|
877
|
+
{
|
|
878
|
+
return jsxWithValidation(type, props, key, true);
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
function jsxWithValidationDynamic(type, props, key) {
|
|
882
|
+
{
|
|
883
|
+
return jsxWithValidation(type, props, key, false);
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
var jsx = jsxWithValidationDynamic;
|
|
887
|
+
var jsxs = jsxWithValidationStatic;
|
|
888
|
+
reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
|
|
889
|
+
reactJsxRuntime_development.jsx = jsx;
|
|
890
|
+
reactJsxRuntime_development.jsxs = jsxs;
|
|
891
|
+
})();
|
|
892
|
+
}
|
|
893
|
+
return reactJsxRuntime_development;
|
|
894
|
+
}
|
|
895
|
+
var hasRequiredJsxRuntime;
|
|
896
|
+
function requireJsxRuntime() {
|
|
897
|
+
if (hasRequiredJsxRuntime) return jsxRuntime.exports;
|
|
898
|
+
hasRequiredJsxRuntime = 1;
|
|
899
|
+
if (process.env.NODE_ENV === "production") {
|
|
900
|
+
jsxRuntime.exports = /* @__PURE__ */ requireReactJsxRuntime_production_min();
|
|
901
|
+
} else {
|
|
902
|
+
jsxRuntime.exports = /* @__PURE__ */ requireReactJsxRuntime_development();
|
|
903
|
+
}
|
|
904
|
+
return jsxRuntime.exports;
|
|
905
|
+
}
|
|
906
|
+
var jsxRuntimeExports = /* @__PURE__ */ requireJsxRuntime();
|
|
907
|
+
function cls(...classes2) {
|
|
908
|
+
return classes2.filter(Boolean).join(" ");
|
|
909
|
+
}
|
|
910
|
+
function clx(classes2) {
|
|
911
|
+
return Object.entries(classes2).filter(([, value]) => value).map(([key]) => key).join(" ");
|
|
912
|
+
}
|
|
913
|
+
const root$4 = "_root_hw69b_1";
|
|
914
|
+
const neutral = "_neutral_hw69b_17";
|
|
915
|
+
const brand = "_brand_hw69b_30";
|
|
916
|
+
const ghost = "_ghost_hw69b_43";
|
|
917
|
+
const classes$4 = {
|
|
918
|
+
root: root$4,
|
|
919
|
+
neutral,
|
|
920
|
+
brand,
|
|
921
|
+
ghost
|
|
922
|
+
};
|
|
923
|
+
const Button = ({ variant = "neutral", ...rest }) => {
|
|
924
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: cls(classes$4.root, classes$4[variant]), ...rest });
|
|
925
|
+
};
|
|
926
|
+
const root$3 = "_root_14l5h_1";
|
|
927
|
+
const muted = "_muted_14l5h_4";
|
|
928
|
+
const body = "_body_14l5h_8";
|
|
929
|
+
const normal = "_normal_14l5h_14";
|
|
930
|
+
const bold = "_bold_14l5h_18";
|
|
931
|
+
const caption = "_caption_14l5h_23";
|
|
932
|
+
const classes$3 = {
|
|
933
|
+
root: root$3,
|
|
934
|
+
muted,
|
|
935
|
+
body,
|
|
936
|
+
normal,
|
|
937
|
+
bold,
|
|
938
|
+
caption
|
|
939
|
+
};
|
|
940
|
+
const Text = ({
|
|
941
|
+
as = "span",
|
|
942
|
+
size = "body",
|
|
943
|
+
weight = "normal",
|
|
944
|
+
color = "default",
|
|
945
|
+
...rest
|
|
946
|
+
}) => {
|
|
947
|
+
const Component = as ?? "span";
|
|
948
|
+
return (
|
|
949
|
+
// @ts-ignore
|
|
950
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
951
|
+
Component,
|
|
952
|
+
{
|
|
953
|
+
className: cls(
|
|
954
|
+
classes$3.root,
|
|
955
|
+
classes$3[size],
|
|
956
|
+
classes$3[weight],
|
|
957
|
+
classes$3[color]
|
|
958
|
+
),
|
|
959
|
+
...rest
|
|
960
|
+
}
|
|
961
|
+
)
|
|
962
|
+
);
|
|
963
|
+
};
|
|
964
|
+
const root$2 = "_root_2wcp0_53";
|
|
965
|
+
const open$1 = "_open_2wcp0_66";
|
|
966
|
+
const noTarget = "_noTarget_2wcp0_72";
|
|
967
|
+
const collapsible = "_collapsible_2wcp0_81";
|
|
968
|
+
const header$1 = "_header_2wcp0_84";
|
|
969
|
+
const heading = "_heading_2wcp0_91";
|
|
970
|
+
const chevron$1 = "_chevron_2wcp0_97";
|
|
971
|
+
const settings = "_settings_2wcp0_108";
|
|
972
|
+
const footer = "_footer_2wcp0_122";
|
|
973
|
+
const legal = "_legal_2wcp0_129";
|
|
974
|
+
const actions$1 = "_actions_2wcp0_132";
|
|
975
|
+
const classes$2 = {
|
|
976
|
+
root: root$2,
|
|
977
|
+
open: open$1,
|
|
978
|
+
noTarget,
|
|
979
|
+
collapsible,
|
|
980
|
+
header: header$1,
|
|
981
|
+
heading,
|
|
982
|
+
chevron: chevron$1,
|
|
983
|
+
settings,
|
|
984
|
+
footer,
|
|
985
|
+
legal,
|
|
986
|
+
actions: actions$1
|
|
987
|
+
};
|
|
988
|
+
const root$1 = "_root_mqtha_19";
|
|
989
|
+
const header = "_header_mqtha_24";
|
|
990
|
+
const label = "_label_mqtha_33";
|
|
991
|
+
const actions = "_actions_mqtha_39";
|
|
992
|
+
const chevron = "_chevron_mqtha_45";
|
|
993
|
+
const open = "_open_mqtha_51";
|
|
994
|
+
const description = "_description_mqtha_58";
|
|
995
|
+
const classes$1 = {
|
|
996
|
+
root: root$1,
|
|
997
|
+
header,
|
|
998
|
+
label,
|
|
999
|
+
actions,
|
|
1000
|
+
chevron,
|
|
1001
|
+
open,
|
|
1002
|
+
description
|
|
1003
|
+
};
|
|
1004
|
+
function $constructor(name, initializer2, params) {
|
|
1005
|
+
function init(inst, def) {
|
|
1006
|
+
if (!inst._zod) {
|
|
1007
|
+
Object.defineProperty(inst, "_zod", {
|
|
1008
|
+
value: {
|
|
1009
|
+
def,
|
|
1010
|
+
constr: _,
|
|
1011
|
+
traits: /* @__PURE__ */ new Set()
|
|
1012
|
+
},
|
|
1013
|
+
enumerable: false
|
|
1014
|
+
});
|
|
1015
|
+
}
|
|
1016
|
+
if (inst._zod.traits.has(name)) {
|
|
1017
|
+
return;
|
|
1018
|
+
}
|
|
1019
|
+
inst._zod.traits.add(name);
|
|
1020
|
+
initializer2(inst, def);
|
|
1021
|
+
const proto = _.prototype;
|
|
1022
|
+
const keys = Object.keys(proto);
|
|
1023
|
+
for (let i = 0; i < keys.length; i++) {
|
|
1024
|
+
const k = keys[i];
|
|
1025
|
+
if (!(k in inst)) {
|
|
1026
|
+
inst[k] = proto[k].bind(inst);
|
|
1941
1027
|
}
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
const Parent = params?.Parent ?? Object;
|
|
1031
|
+
class Definition extends Parent {
|
|
1032
|
+
}
|
|
1033
|
+
Object.defineProperty(Definition, "name", { value: name });
|
|
1034
|
+
function _(def) {
|
|
1035
|
+
var _a;
|
|
1036
|
+
const inst = params?.Parent ? new Definition() : this;
|
|
1037
|
+
init(inst, def);
|
|
1038
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
1039
|
+
for (const fn of inst._zod.deferred) {
|
|
1040
|
+
fn();
|
|
1041
|
+
}
|
|
1042
|
+
return inst;
|
|
1043
|
+
}
|
|
1044
|
+
Object.defineProperty(_, "init", { value: init });
|
|
1045
|
+
Object.defineProperty(_, Symbol.hasInstance, {
|
|
1046
|
+
value: (inst) => {
|
|
1047
|
+
if (params?.Parent && inst instanceof params.Parent)
|
|
1048
|
+
return true;
|
|
1049
|
+
return inst?._zod?.traits?.has(name);
|
|
1050
|
+
}
|
|
1051
|
+
});
|
|
1052
|
+
Object.defineProperty(_, "name", { value: name });
|
|
1053
|
+
return _;
|
|
1054
|
+
}
|
|
1055
|
+
class $ZodAsyncError extends Error {
|
|
1056
|
+
constructor() {
|
|
1057
|
+
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
const globalConfig = {};
|
|
1061
|
+
function config(newConfig) {
|
|
1062
|
+
return globalConfig;
|
|
1063
|
+
}
|
|
1064
|
+
function jsonStringifyReplacer(_, value) {
|
|
1065
|
+
if (typeof value === "bigint")
|
|
1066
|
+
return value.toString();
|
|
1067
|
+
return value;
|
|
1068
|
+
}
|
|
1069
|
+
function cached(getter) {
|
|
1070
|
+
return {
|
|
1071
|
+
get value() {
|
|
1072
|
+
{
|
|
1073
|
+
const value = getter();
|
|
1074
|
+
Object.defineProperty(this, "value", { value });
|
|
1075
|
+
return value;
|
|
1946
1076
|
}
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1077
|
+
}
|
|
1078
|
+
};
|
|
1079
|
+
}
|
|
1080
|
+
function cleanRegex(source) {
|
|
1081
|
+
const start = source.startsWith("^") ? 1 : 0;
|
|
1082
|
+
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
|
1083
|
+
return source.slice(start, end);
|
|
1084
|
+
}
|
|
1085
|
+
const EVALUATING = /* @__PURE__ */ Symbol("evaluating");
|
|
1086
|
+
function defineLazy(object2, key, getter) {
|
|
1087
|
+
let value = void 0;
|
|
1088
|
+
Object.defineProperty(object2, key, {
|
|
1089
|
+
get() {
|
|
1090
|
+
if (value === EVALUATING) {
|
|
1091
|
+
return void 0;
|
|
1092
|
+
}
|
|
1093
|
+
if (value === void 0) {
|
|
1094
|
+
value = EVALUATING;
|
|
1095
|
+
value = getter();
|
|
1096
|
+
}
|
|
1097
|
+
return value;
|
|
1098
|
+
},
|
|
1099
|
+
set(v) {
|
|
1100
|
+
Object.defineProperty(object2, key, {
|
|
1101
|
+
value: v
|
|
1102
|
+
// configurable: true,
|
|
1103
|
+
});
|
|
1104
|
+
},
|
|
1105
|
+
configurable: true
|
|
1106
|
+
});
|
|
1107
|
+
}
|
|
1108
|
+
const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
|
|
1109
|
+
};
|
|
1110
|
+
function isObject(data) {
|
|
1111
|
+
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
1112
|
+
}
|
|
1113
|
+
function isPlainObject(o) {
|
|
1114
|
+
if (isObject(o) === false)
|
|
1115
|
+
return false;
|
|
1116
|
+
const ctor = o.constructor;
|
|
1117
|
+
if (ctor === void 0)
|
|
1118
|
+
return true;
|
|
1119
|
+
if (typeof ctor !== "function")
|
|
1120
|
+
return true;
|
|
1121
|
+
const prot = ctor.prototype;
|
|
1122
|
+
if (isObject(prot) === false)
|
|
1123
|
+
return false;
|
|
1124
|
+
if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) {
|
|
1125
|
+
return false;
|
|
1953
1126
|
}
|
|
1954
|
-
return
|
|
1127
|
+
return true;
|
|
1955
1128
|
}
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1129
|
+
function escapeRegex(str) {
|
|
1130
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1131
|
+
}
|
|
1132
|
+
function clone(inst, def, params) {
|
|
1133
|
+
const cl = new inst._zod.constr(def ?? inst._zod.def);
|
|
1134
|
+
if (!def || params?.parent)
|
|
1135
|
+
cl._zod.parent = inst;
|
|
1136
|
+
return cl;
|
|
1137
|
+
}
|
|
1138
|
+
function normalizeParams(_params) {
|
|
1139
|
+
return {};
|
|
1140
|
+
}
|
|
1141
|
+
function optionalKeys(shape) {
|
|
1142
|
+
return Object.keys(shape).filter((k) => {
|
|
1143
|
+
return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
|
|
1144
|
+
});
|
|
1145
|
+
}
|
|
1146
|
+
function aborted(x, startIndex = 0) {
|
|
1147
|
+
if (x.aborted === true)
|
|
1148
|
+
return true;
|
|
1149
|
+
for (let i = startIndex; i < x.issues.length; i++) {
|
|
1150
|
+
if (x.issues[i]?.continue !== true) {
|
|
1151
|
+
return true;
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
return false;
|
|
1155
|
+
}
|
|
1156
|
+
function prefixIssues(path, issues) {
|
|
1157
|
+
return issues.map((iss) => {
|
|
1158
|
+
var _a;
|
|
1159
|
+
(_a = iss).path ?? (_a.path = []);
|
|
1160
|
+
iss.path.unshift(path);
|
|
1161
|
+
return iss;
|
|
1162
|
+
});
|
|
1163
|
+
}
|
|
1164
|
+
function unwrapMessage(message) {
|
|
1165
|
+
return typeof message === "string" ? message : message?.message;
|
|
1166
|
+
}
|
|
1167
|
+
function finalizeIssue(iss, ctx, config2) {
|
|
1168
|
+
const full = { ...iss, path: iss.path ?? [] };
|
|
1169
|
+
if (!iss.message) {
|
|
1170
|
+
const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
|
|
1171
|
+
full.message = message;
|
|
1172
|
+
}
|
|
1173
|
+
delete full.inst;
|
|
1174
|
+
delete full.continue;
|
|
1175
|
+
if (!ctx?.reportInput) {
|
|
1176
|
+
delete full.input;
|
|
1177
|
+
}
|
|
1178
|
+
return full;
|
|
1179
|
+
}
|
|
1180
|
+
const initializer = (inst, def) => {
|
|
1181
|
+
inst.name = "$ZodError";
|
|
1182
|
+
Object.defineProperty(inst, "_zod", {
|
|
1183
|
+
value: inst._zod,
|
|
1184
|
+
enumerable: false
|
|
1185
|
+
});
|
|
1186
|
+
Object.defineProperty(inst, "issues", {
|
|
1187
|
+
value: def,
|
|
1188
|
+
enumerable: false
|
|
1189
|
+
});
|
|
1190
|
+
inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
|
|
1191
|
+
Object.defineProperty(inst, "toString", {
|
|
1192
|
+
value: () => inst.message,
|
|
1193
|
+
enumerable: false
|
|
1194
|
+
});
|
|
1195
|
+
};
|
|
1196
|
+
const $ZodError = $constructor("$ZodError", initializer);
|
|
1197
|
+
const $ZodRealError = $constructor("$ZodError", initializer, { Parent: Error });
|
|
1198
|
+
const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
1199
|
+
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
1200
|
+
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
1201
|
+
if (result instanceof Promise) {
|
|
1202
|
+
throw new $ZodAsyncError();
|
|
1203
|
+
}
|
|
1204
|
+
if (result.issues.length) {
|
|
1205
|
+
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
1206
|
+
captureStackTrace(e, _params?.callee);
|
|
1207
|
+
throw e;
|
|
1208
|
+
}
|
|
1209
|
+
return result.value;
|
|
1210
|
+
};
|
|
1211
|
+
const parse = /* @__PURE__ */ _parse($ZodRealError);
|
|
1212
|
+
const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
1213
|
+
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
1214
|
+
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
1215
|
+
if (result instanceof Promise)
|
|
1216
|
+
result = await result;
|
|
1217
|
+
if (result.issues.length) {
|
|
1218
|
+
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
1219
|
+
captureStackTrace(e, params?.callee);
|
|
1220
|
+
throw e;
|
|
1221
|
+
}
|
|
1222
|
+
return result.value;
|
|
1223
|
+
};
|
|
1224
|
+
const parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError);
|
|
1225
|
+
const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
1226
|
+
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
1227
|
+
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
1228
|
+
if (result instanceof Promise) {
|
|
1229
|
+
throw new $ZodAsyncError();
|
|
1964
1230
|
}
|
|
1965
|
-
return
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1231
|
+
return result.issues.length ? {
|
|
1232
|
+
success: false,
|
|
1233
|
+
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
1234
|
+
} : { success: true, data: result.value };
|
|
1235
|
+
};
|
|
1236
|
+
const safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
1237
|
+
const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
1238
|
+
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
1239
|
+
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
1240
|
+
if (result instanceof Promise)
|
|
1241
|
+
result = await result;
|
|
1242
|
+
return result.issues.length ? {
|
|
1243
|
+
success: false,
|
|
1244
|
+
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
1245
|
+
} : { success: true, data: result.value };
|
|
1246
|
+
};
|
|
1247
|
+
const safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
1248
|
+
const string$1 = (params) => {
|
|
1249
|
+
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
1250
|
+
return new RegExp(`^${regex}$`);
|
|
1251
|
+
};
|
|
1252
|
+
const number = /^-?\d+(?:\.\d+)?$/;
|
|
1253
|
+
const boolean$1 = /^(?:true|false)$/i;
|
|
1254
|
+
const version = {
|
|
1255
|
+
major: 4,
|
|
1256
|
+
minor: 3,
|
|
1257
|
+
patch: 6
|
|
1258
|
+
};
|
|
1259
|
+
const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
1260
|
+
var _a;
|
|
1261
|
+
inst ?? (inst = {});
|
|
1262
|
+
inst._zod.def = def;
|
|
1263
|
+
inst._zod.bag = inst._zod.bag || {};
|
|
1264
|
+
inst._zod.version = version;
|
|
1265
|
+
const checks = [...inst._zod.def.checks ?? []];
|
|
1266
|
+
if (inst._zod.traits.has("$ZodCheck")) {
|
|
1267
|
+
checks.unshift(inst);
|
|
1981
1268
|
}
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
let defaultContexts = [];
|
|
1986
|
-
function createContext3(rootComponentName, defaultContext) {
|
|
1987
|
-
const BaseContext = React.createContext(defaultContext);
|
|
1988
|
-
const index = defaultContexts.length;
|
|
1989
|
-
defaultContexts = [...defaultContexts, defaultContext];
|
|
1990
|
-
const Provider = (props) => {
|
|
1991
|
-
const { scope, children, ...context } = props;
|
|
1992
|
-
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
1993
|
-
const value = React.useMemo(() => context, Object.values(context));
|
|
1994
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Context.Provider, { value, children });
|
|
1995
|
-
};
|
|
1996
|
-
Provider.displayName = rootComponentName + "Provider";
|
|
1997
|
-
function useContext2(consumerName, scope) {
|
|
1998
|
-
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
1999
|
-
const context = React.useContext(Context);
|
|
2000
|
-
if (context) return context;
|
|
2001
|
-
if (defaultContext !== void 0) return defaultContext;
|
|
2002
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
1269
|
+
for (const ch of checks) {
|
|
1270
|
+
for (const fn of ch._zod.onattach) {
|
|
1271
|
+
fn(inst);
|
|
2003
1272
|
}
|
|
2004
|
-
return [Provider, useContext2];
|
|
2005
|
-
}
|
|
2006
|
-
const createScope = () => {
|
|
2007
|
-
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
2008
|
-
return React.createContext(defaultContext);
|
|
2009
|
-
});
|
|
2010
|
-
return function useScope(scope) {
|
|
2011
|
-
const contexts = scope?.[scopeName] || scopeContexts;
|
|
2012
|
-
return React.useMemo(
|
|
2013
|
-
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
2014
|
-
[scope, contexts]
|
|
2015
|
-
);
|
|
2016
|
-
};
|
|
2017
|
-
};
|
|
2018
|
-
createScope.scopeName = scopeName;
|
|
2019
|
-
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
2020
|
-
}
|
|
2021
|
-
function composeContextScopes(...scopes) {
|
|
2022
|
-
const baseScope = scopes[0];
|
|
2023
|
-
if (scopes.length === 1) return baseScope;
|
|
2024
|
-
const createScope = () => {
|
|
2025
|
-
const scopeHooks = scopes.map((createScope2) => ({
|
|
2026
|
-
useScope: createScope2(),
|
|
2027
|
-
scopeName: createScope2.scopeName
|
|
2028
|
-
}));
|
|
2029
|
-
return function useComposedScopes(overrideScopes) {
|
|
2030
|
-
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
2031
|
-
const scopeProps = useScope(overrideScopes);
|
|
2032
|
-
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
2033
|
-
return { ...nextScopes2, ...currentScope };
|
|
2034
|
-
}, {});
|
|
2035
|
-
return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
2036
|
-
};
|
|
2037
|
-
};
|
|
2038
|
-
createScope.scopeName = baseScope.scopeName;
|
|
2039
|
-
return createScope;
|
|
2040
|
-
}
|
|
2041
|
-
function setRef(ref, value) {
|
|
2042
|
-
if (typeof ref === "function") {
|
|
2043
|
-
return ref(value);
|
|
2044
|
-
} else if (ref !== null && ref !== void 0) {
|
|
2045
|
-
ref.current = value;
|
|
2046
1273
|
}
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
const cleanups = refs.map((ref) => {
|
|
2052
|
-
const cleanup = setRef(ref, node);
|
|
2053
|
-
if (!hasCleanup && typeof cleanup == "function") {
|
|
2054
|
-
hasCleanup = true;
|
|
2055
|
-
}
|
|
2056
|
-
return cleanup;
|
|
1274
|
+
if (checks.length === 0) {
|
|
1275
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
1276
|
+
inst._zod.deferred?.push(() => {
|
|
1277
|
+
inst._zod.run = inst._zod.parse;
|
|
2057
1278
|
});
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
1279
|
+
} else {
|
|
1280
|
+
const runChecks = (payload, checks2, ctx) => {
|
|
1281
|
+
let isAborted = aborted(payload);
|
|
1282
|
+
let asyncResult;
|
|
1283
|
+
for (const ch of checks2) {
|
|
1284
|
+
if (ch._zod.def.when) {
|
|
1285
|
+
const shouldRun = ch._zod.def.when(payload);
|
|
1286
|
+
if (!shouldRun)
|
|
1287
|
+
continue;
|
|
1288
|
+
} else if (isAborted) {
|
|
1289
|
+
continue;
|
|
2067
1290
|
}
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
if (slottable) {
|
|
2083
|
-
const newElement = slottable.props.children;
|
|
2084
|
-
const newChildren = childrenArray.map((child) => {
|
|
2085
|
-
if (child === slottable) {
|
|
2086
|
-
if (React.Children.count(newElement) > 1) return React.Children.only(null);
|
|
2087
|
-
return React.isValidElement(newElement) ? newElement.props.children : null;
|
|
1291
|
+
const currLen = payload.issues.length;
|
|
1292
|
+
const _ = ch._zod.check(payload);
|
|
1293
|
+
if (_ instanceof Promise && ctx?.async === false) {
|
|
1294
|
+
throw new $ZodAsyncError();
|
|
1295
|
+
}
|
|
1296
|
+
if (asyncResult || _ instanceof Promise) {
|
|
1297
|
+
asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
1298
|
+
await _;
|
|
1299
|
+
const nextLen = payload.issues.length;
|
|
1300
|
+
if (nextLen === currLen)
|
|
1301
|
+
return;
|
|
1302
|
+
if (!isAborted)
|
|
1303
|
+
isAborted = aborted(payload, currLen);
|
|
1304
|
+
});
|
|
2088
1305
|
} else {
|
|
2089
|
-
|
|
1306
|
+
const nextLen = payload.issues.length;
|
|
1307
|
+
if (nextLen === currLen)
|
|
1308
|
+
continue;
|
|
1309
|
+
if (!isAborted)
|
|
1310
|
+
isAborted = aborted(payload, currLen);
|
|
2090
1311
|
}
|
|
2091
|
-
});
|
|
2092
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });
|
|
2093
|
-
}
|
|
2094
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
2095
|
-
});
|
|
2096
|
-
Slot2.displayName = `${ownerName}.Slot`;
|
|
2097
|
-
return Slot2;
|
|
2098
|
-
}
|
|
2099
|
-
// @__NO_SIDE_EFFECTS__
|
|
2100
|
-
function createSlotClone(ownerName) {
|
|
2101
|
-
const SlotClone = React.forwardRef((props, forwardedRef) => {
|
|
2102
|
-
const { children, ...slotProps } = props;
|
|
2103
|
-
if (React.isValidElement(children)) {
|
|
2104
|
-
const childrenRef = getElementRef$1(children);
|
|
2105
|
-
const props2 = mergeProps(slotProps, children.props);
|
|
2106
|
-
if (children.type !== React.Fragment) {
|
|
2107
|
-
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
2108
1312
|
}
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
2114
|
-
return SlotClone;
|
|
2115
|
-
}
|
|
2116
|
-
var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol("radix.slottable");
|
|
2117
|
-
function isSlottable(child) {
|
|
2118
|
-
return React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
2119
|
-
}
|
|
2120
|
-
function mergeProps(slotProps, childProps) {
|
|
2121
|
-
const overrideProps = { ...childProps };
|
|
2122
|
-
for (const propName in childProps) {
|
|
2123
|
-
const slotPropValue = slotProps[propName];
|
|
2124
|
-
const childPropValue = childProps[propName];
|
|
2125
|
-
const isHandler = /^on[A-Z]/.test(propName);
|
|
2126
|
-
if (isHandler) {
|
|
2127
|
-
if (slotPropValue && childPropValue) {
|
|
2128
|
-
overrideProps[propName] = (...args) => {
|
|
2129
|
-
const result = childPropValue(...args);
|
|
2130
|
-
slotPropValue(...args);
|
|
2131
|
-
return result;
|
|
2132
|
-
};
|
|
2133
|
-
} else if (slotPropValue) {
|
|
2134
|
-
overrideProps[propName] = slotPropValue;
|
|
1313
|
+
if (asyncResult) {
|
|
1314
|
+
return asyncResult.then(() => {
|
|
1315
|
+
return payload;
|
|
1316
|
+
});
|
|
2135
1317
|
}
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
return { ...slotProps, ...overrideProps };
|
|
2143
|
-
}
|
|
2144
|
-
function getElementRef$1(element) {
|
|
2145
|
-
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
2146
|
-
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
2147
|
-
if (mayWarn) {
|
|
2148
|
-
return element.ref;
|
|
2149
|
-
}
|
|
2150
|
-
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
2151
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
2152
|
-
if (mayWarn) {
|
|
2153
|
-
return element.props.ref;
|
|
2154
|
-
}
|
|
2155
|
-
return element.props.ref || element.ref;
|
|
2156
|
-
}
|
|
2157
|
-
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
2158
|
-
return function handleEvent(event) {
|
|
2159
|
-
originalEventHandler?.(event);
|
|
2160
|
-
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
2161
|
-
return ourEventHandler?.(event);
|
|
2162
|
-
}
|
|
2163
|
-
};
|
|
2164
|
-
}
|
|
2165
|
-
var useLayoutEffect2 = globalThis?.document ? React.useLayoutEffect : () => {
|
|
2166
|
-
};
|
|
2167
|
-
var useInsertionEffect = React[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
|
|
2168
|
-
function useControllableState({
|
|
2169
|
-
prop,
|
|
2170
|
-
defaultProp,
|
|
2171
|
-
onChange = () => {
|
|
2172
|
-
},
|
|
2173
|
-
caller
|
|
2174
|
-
}) {
|
|
2175
|
-
const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({
|
|
2176
|
-
defaultProp,
|
|
2177
|
-
onChange
|
|
2178
|
-
});
|
|
2179
|
-
const isControlled = prop !== void 0;
|
|
2180
|
-
const value = isControlled ? prop : uncontrolledProp;
|
|
2181
|
-
{
|
|
2182
|
-
const isControlledRef = React.useRef(prop !== void 0);
|
|
2183
|
-
React.useEffect(() => {
|
|
2184
|
-
const wasControlled = isControlledRef.current;
|
|
2185
|
-
if (wasControlled !== isControlled) {
|
|
2186
|
-
const from = wasControlled ? "controlled" : "uncontrolled";
|
|
2187
|
-
const to = isControlled ? "controlled" : "uncontrolled";
|
|
2188
|
-
console.warn(
|
|
2189
|
-
`${caller} is changing from ${from} to ${to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
|
|
2190
|
-
);
|
|
1318
|
+
return payload;
|
|
1319
|
+
};
|
|
1320
|
+
const handleCanaryResult = (canary, payload, ctx) => {
|
|
1321
|
+
if (aborted(canary)) {
|
|
1322
|
+
canary.aborted = true;
|
|
1323
|
+
return canary;
|
|
2191
1324
|
}
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
1325
|
+
const checkResult = runChecks(payload, checks, ctx);
|
|
1326
|
+
if (checkResult instanceof Promise) {
|
|
1327
|
+
if (ctx.async === false)
|
|
1328
|
+
throw new $ZodAsyncError();
|
|
1329
|
+
return checkResult.then((checkResult2) => inst._zod.parse(checkResult2, ctx));
|
|
1330
|
+
}
|
|
1331
|
+
return inst._zod.parse(checkResult, ctx);
|
|
1332
|
+
};
|
|
1333
|
+
inst._zod.run = (payload, ctx) => {
|
|
1334
|
+
if (ctx.skipChecks) {
|
|
1335
|
+
return inst._zod.parse(payload, ctx);
|
|
1336
|
+
}
|
|
1337
|
+
if (ctx.direction === "backward") {
|
|
1338
|
+
const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
|
|
1339
|
+
if (canary instanceof Promise) {
|
|
1340
|
+
return canary.then((canary2) => {
|
|
1341
|
+
return handleCanaryResult(canary2, payload, ctx);
|
|
1342
|
+
});
|
|
2201
1343
|
}
|
|
2202
|
-
|
|
2203
|
-
|
|
1344
|
+
return handleCanaryResult(canary, payload, ctx);
|
|
1345
|
+
}
|
|
1346
|
+
const result = inst._zod.parse(payload, ctx);
|
|
1347
|
+
if (result instanceof Promise) {
|
|
1348
|
+
if (ctx.async === false)
|
|
1349
|
+
throw new $ZodAsyncError();
|
|
1350
|
+
return result.then((result2) => runChecks(result2, checks, ctx));
|
|
1351
|
+
}
|
|
1352
|
+
return runChecks(result, checks, ctx);
|
|
1353
|
+
};
|
|
1354
|
+
}
|
|
1355
|
+
defineLazy(inst, "~standard", () => ({
|
|
1356
|
+
validate: (value) => {
|
|
1357
|
+
try {
|
|
1358
|
+
const r = safeParse(inst, value);
|
|
1359
|
+
return r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
1360
|
+
} catch (_) {
|
|
1361
|
+
return safeParseAsync(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
|
|
2204
1362
|
}
|
|
2205
1363
|
},
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
}
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
"img",
|
|
2239
|
-
"input",
|
|
2240
|
-
"label",
|
|
2241
|
-
"li",
|
|
2242
|
-
"nav",
|
|
2243
|
-
"ol",
|
|
2244
|
-
"p",
|
|
2245
|
-
"select",
|
|
2246
|
-
"span",
|
|
2247
|
-
"svg",
|
|
2248
|
-
"ul"
|
|
2249
|
-
];
|
|
2250
|
-
var Primitive = NODES.reduce((primitive, node) => {
|
|
2251
|
-
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
2252
|
-
const Node2 = React.forwardRef((props, forwardedRef) => {
|
|
2253
|
-
const { asChild, ...primitiveProps } = props;
|
|
2254
|
-
const Comp = asChild ? Slot2 : node;
|
|
2255
|
-
if (typeof window !== "undefined") {
|
|
2256
|
-
window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
|
|
2257
|
-
}
|
|
2258
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
2259
|
-
});
|
|
2260
|
-
Node2.displayName = `Primitive.${node}`;
|
|
2261
|
-
return { ...primitive, [node]: Node2 };
|
|
2262
|
-
}, {});
|
|
2263
|
-
function dispatchDiscreteCustomEvent(target, event) {
|
|
2264
|
-
if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));
|
|
2265
|
-
}
|
|
2266
|
-
function useStateMachine(initialState, machine) {
|
|
2267
|
-
return React.useReducer((state, event) => {
|
|
2268
|
-
const nextState = machine[state][event];
|
|
2269
|
-
return nextState ?? state;
|
|
2270
|
-
}, initialState);
|
|
2271
|
-
}
|
|
2272
|
-
var Presence = (props) => {
|
|
2273
|
-
const { present, children } = props;
|
|
2274
|
-
const presence = usePresence(present);
|
|
2275
|
-
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React.Children.only(children);
|
|
2276
|
-
const ref = useComposedRefs(presence.ref, getElementRef(child));
|
|
2277
|
-
const forceMount = typeof children === "function";
|
|
2278
|
-
return forceMount || presence.isPresent ? React.cloneElement(child, { ref }) : null;
|
|
2279
|
-
};
|
|
2280
|
-
Presence.displayName = "Presence";
|
|
2281
|
-
function usePresence(present) {
|
|
2282
|
-
const [node, setNode] = React.useState();
|
|
2283
|
-
const stylesRef = React.useRef(null);
|
|
2284
|
-
const prevPresentRef = React.useRef(present);
|
|
2285
|
-
const prevAnimationNameRef = React.useRef("none");
|
|
2286
|
-
const initialState = present ? "mounted" : "unmounted";
|
|
2287
|
-
const [state, send] = useStateMachine(initialState, {
|
|
2288
|
-
mounted: {
|
|
2289
|
-
UNMOUNT: "unmounted",
|
|
2290
|
-
ANIMATION_OUT: "unmountSuspended"
|
|
2291
|
-
},
|
|
2292
|
-
unmountSuspended: {
|
|
2293
|
-
MOUNT: "mounted",
|
|
2294
|
-
ANIMATION_END: "unmounted"
|
|
2295
|
-
},
|
|
2296
|
-
unmounted: {
|
|
2297
|
-
MOUNT: "mounted"
|
|
2298
|
-
}
|
|
2299
|
-
});
|
|
2300
|
-
React.useEffect(() => {
|
|
2301
|
-
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
2302
|
-
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
2303
|
-
}, [state]);
|
|
2304
|
-
useLayoutEffect2(() => {
|
|
2305
|
-
const styles = stylesRef.current;
|
|
2306
|
-
const wasPresent = prevPresentRef.current;
|
|
2307
|
-
const hasPresentChanged = wasPresent !== present;
|
|
2308
|
-
if (hasPresentChanged) {
|
|
2309
|
-
const prevAnimationName = prevAnimationNameRef.current;
|
|
2310
|
-
const currentAnimationName = getAnimationName(styles);
|
|
2311
|
-
if (present) {
|
|
2312
|
-
send("MOUNT");
|
|
2313
|
-
} else if (currentAnimationName === "none" || styles?.display === "none") {
|
|
2314
|
-
send("UNMOUNT");
|
|
2315
|
-
} else {
|
|
2316
|
-
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
2317
|
-
if (wasPresent && isAnimating) {
|
|
2318
|
-
send("ANIMATION_OUT");
|
|
2319
|
-
} else {
|
|
2320
|
-
send("UNMOUNT");
|
|
2321
|
-
}
|
|
1364
|
+
vendor: "zod",
|
|
1365
|
+
version: 1
|
|
1366
|
+
}));
|
|
1367
|
+
});
|
|
1368
|
+
const $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
1369
|
+
$ZodType.init(inst, def);
|
|
1370
|
+
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$1(inst._zod.bag);
|
|
1371
|
+
inst._zod.parse = (payload, _) => {
|
|
1372
|
+
if (def.coerce)
|
|
1373
|
+
try {
|
|
1374
|
+
payload.value = String(payload.value);
|
|
1375
|
+
} catch (_2) {
|
|
1376
|
+
}
|
|
1377
|
+
if (typeof payload.value === "string")
|
|
1378
|
+
return payload;
|
|
1379
|
+
payload.issues.push({
|
|
1380
|
+
expected: "string",
|
|
1381
|
+
code: "invalid_type",
|
|
1382
|
+
input: payload.value,
|
|
1383
|
+
inst
|
|
1384
|
+
});
|
|
1385
|
+
return payload;
|
|
1386
|
+
};
|
|
1387
|
+
});
|
|
1388
|
+
const $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
1389
|
+
$ZodType.init(inst, def);
|
|
1390
|
+
inst._zod.pattern = boolean$1;
|
|
1391
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1392
|
+
if (def.coerce)
|
|
1393
|
+
try {
|
|
1394
|
+
payload.value = Boolean(payload.value);
|
|
1395
|
+
} catch (_) {
|
|
2322
1396
|
}
|
|
2323
|
-
|
|
1397
|
+
const input = payload.value;
|
|
1398
|
+
if (typeof input === "boolean")
|
|
1399
|
+
return payload;
|
|
1400
|
+
payload.issues.push({
|
|
1401
|
+
expected: "boolean",
|
|
1402
|
+
code: "invalid_type",
|
|
1403
|
+
input,
|
|
1404
|
+
inst
|
|
1405
|
+
});
|
|
1406
|
+
return payload;
|
|
1407
|
+
};
|
|
1408
|
+
});
|
|
1409
|
+
function handlePropertyResult(result, final, key, input, isOptionalOut) {
|
|
1410
|
+
if (result.issues.length) {
|
|
1411
|
+
if (isOptionalOut && !(key in input)) {
|
|
1412
|
+
return;
|
|
2324
1413
|
}
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
node.style.animationFillMode = currentFillMode;
|
|
2341
|
-
}
|
|
2342
|
-
});
|
|
2343
|
-
}
|
|
2344
|
-
}
|
|
2345
|
-
};
|
|
2346
|
-
const handleAnimationStart = (event) => {
|
|
2347
|
-
if (event.target === node) {
|
|
2348
|
-
prevAnimationNameRef.current = getAnimationName(stylesRef.current);
|
|
2349
|
-
}
|
|
2350
|
-
};
|
|
2351
|
-
node.addEventListener("animationstart", handleAnimationStart);
|
|
2352
|
-
node.addEventListener("animationcancel", handleAnimationEnd);
|
|
2353
|
-
node.addEventListener("animationend", handleAnimationEnd);
|
|
2354
|
-
return () => {
|
|
2355
|
-
ownerWindow.clearTimeout(timeoutId);
|
|
2356
|
-
node.removeEventListener("animationstart", handleAnimationStart);
|
|
2357
|
-
node.removeEventListener("animationcancel", handleAnimationEnd);
|
|
2358
|
-
node.removeEventListener("animationend", handleAnimationEnd);
|
|
2359
|
-
};
|
|
2360
|
-
} else {
|
|
2361
|
-
send("ANIMATION_END");
|
|
1414
|
+
final.issues.push(...prefixIssues(key, result.issues));
|
|
1415
|
+
}
|
|
1416
|
+
if (result.value === void 0) {
|
|
1417
|
+
if (key in input) {
|
|
1418
|
+
final.value[key] = void 0;
|
|
1419
|
+
}
|
|
1420
|
+
} else {
|
|
1421
|
+
final.value[key] = result.value;
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
function normalizeDef(def) {
|
|
1425
|
+
const keys = Object.keys(def.shape);
|
|
1426
|
+
for (const k of keys) {
|
|
1427
|
+
if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
|
|
1428
|
+
throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
2362
1429
|
}
|
|
2363
|
-
}
|
|
1430
|
+
}
|
|
1431
|
+
const okeys = optionalKeys(def.shape);
|
|
2364
1432
|
return {
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
1433
|
+
...def,
|
|
1434
|
+
keys,
|
|
1435
|
+
keySet: new Set(keys),
|
|
1436
|
+
numKeys: keys.length,
|
|
1437
|
+
optionalKeys: new Set(okeys)
|
|
2370
1438
|
};
|
|
2371
1439
|
}
|
|
2372
|
-
function
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
1440
|
+
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
1441
|
+
const unrecognized = [];
|
|
1442
|
+
const keySet = def.keySet;
|
|
1443
|
+
const _catchall = def.catchall._zod;
|
|
1444
|
+
const t = _catchall.def.type;
|
|
1445
|
+
const isOptionalOut = _catchall.optout === "optional";
|
|
1446
|
+
for (const key in input) {
|
|
1447
|
+
if (keySet.has(key))
|
|
1448
|
+
continue;
|
|
1449
|
+
if (t === "never") {
|
|
1450
|
+
unrecognized.push(key);
|
|
1451
|
+
continue;
|
|
1452
|
+
}
|
|
1453
|
+
const r = _catchall.run({ value: input[key], issues: [] }, ctx);
|
|
1454
|
+
if (r instanceof Promise) {
|
|
1455
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalOut)));
|
|
1456
|
+
} else {
|
|
1457
|
+
handlePropertyResult(r, payload, key, input, isOptionalOut);
|
|
1458
|
+
}
|
|
2385
1459
|
}
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
useLayoutEffect2(() => {
|
|
2393
|
-
setId((reactId) => reactId ?? String(count$1++));
|
|
2394
|
-
}, [deterministicId]);
|
|
2395
|
-
return deterministicId || (id ? `radix-${id}` : "");
|
|
2396
|
-
}
|
|
2397
|
-
var COLLAPSIBLE_NAME = "Collapsible";
|
|
2398
|
-
var [createCollapsibleContext] = createContextScope(COLLAPSIBLE_NAME);
|
|
2399
|
-
var [CollapsibleProvider, useCollapsibleContext] = createCollapsibleContext(COLLAPSIBLE_NAME);
|
|
2400
|
-
var Collapsible = React.forwardRef(
|
|
2401
|
-
(props, forwardedRef) => {
|
|
2402
|
-
const {
|
|
2403
|
-
__scopeCollapsible,
|
|
2404
|
-
open: openProp,
|
|
2405
|
-
defaultOpen,
|
|
2406
|
-
disabled,
|
|
2407
|
-
onOpenChange,
|
|
2408
|
-
...collapsibleProps
|
|
2409
|
-
} = props;
|
|
2410
|
-
const [open2, setOpen] = useControllableState({
|
|
2411
|
-
prop: openProp,
|
|
2412
|
-
defaultProp: defaultOpen ?? false,
|
|
2413
|
-
onChange: onOpenChange,
|
|
2414
|
-
caller: COLLAPSIBLE_NAME
|
|
1460
|
+
if (unrecognized.length) {
|
|
1461
|
+
payload.issues.push({
|
|
1462
|
+
code: "unrecognized_keys",
|
|
1463
|
+
keys: unrecognized,
|
|
1464
|
+
input,
|
|
1465
|
+
inst
|
|
2415
1466
|
});
|
|
2416
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2417
|
-
CollapsibleProvider,
|
|
2418
|
-
{
|
|
2419
|
-
scope: __scopeCollapsible,
|
|
2420
|
-
disabled,
|
|
2421
|
-
contentId: useId(),
|
|
2422
|
-
open: open2,
|
|
2423
|
-
onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
2424
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2425
|
-
Primitive.div,
|
|
2426
|
-
{
|
|
2427
|
-
"data-state": getState$1(open2),
|
|
2428
|
-
"data-disabled": disabled ? "" : void 0,
|
|
2429
|
-
...collapsibleProps,
|
|
2430
|
-
ref: forwardedRef
|
|
2431
|
-
}
|
|
2432
|
-
)
|
|
2433
|
-
}
|
|
2434
|
-
);
|
|
2435
1467
|
}
|
|
2436
|
-
)
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
|
|
1468
|
+
if (!proms.length)
|
|
1469
|
+
return payload;
|
|
1470
|
+
return Promise.all(proms).then(() => {
|
|
1471
|
+
return payload;
|
|
1472
|
+
});
|
|
1473
|
+
}
|
|
1474
|
+
const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
1475
|
+
$ZodType.init(inst, def);
|
|
1476
|
+
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
1477
|
+
if (!desc?.get) {
|
|
1478
|
+
const sh = def.shape;
|
|
1479
|
+
Object.defineProperty(def, "shape", {
|
|
1480
|
+
get: () => {
|
|
1481
|
+
const newSh = { ...sh };
|
|
1482
|
+
Object.defineProperty(def, "shape", {
|
|
1483
|
+
value: newSh
|
|
1484
|
+
});
|
|
1485
|
+
return newSh;
|
|
2455
1486
|
}
|
|
2456
|
-
);
|
|
2457
|
-
}
|
|
2458
|
-
);
|
|
2459
|
-
CollapsibleTrigger.displayName = TRIGGER_NAME$1;
|
|
2460
|
-
var CONTENT_NAME$1 = "CollapsibleContent";
|
|
2461
|
-
var CollapsibleContent = React.forwardRef(
|
|
2462
|
-
(props, forwardedRef) => {
|
|
2463
|
-
const { forceMount, ...contentProps } = props;
|
|
2464
|
-
const context = useCollapsibleContext(CONTENT_NAME$1, props.__scopeCollapsible);
|
|
2465
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: ({ present }) => /* @__PURE__ */ jsxRuntimeExports.jsx(CollapsibleContentImpl, { ...contentProps, ref: forwardedRef, present }) });
|
|
1487
|
+
});
|
|
2466
1488
|
}
|
|
2467
|
-
);
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
const widthRef = React.useRef(0);
|
|
2478
|
-
const width = widthRef.current;
|
|
2479
|
-
const isOpen = context.open || isPresent;
|
|
2480
|
-
const isMountAnimationPreventedRef = React.useRef(isOpen);
|
|
2481
|
-
const originalStylesRef = React.useRef(void 0);
|
|
2482
|
-
React.useEffect(() => {
|
|
2483
|
-
const rAF = requestAnimationFrame(() => isMountAnimationPreventedRef.current = false);
|
|
2484
|
-
return () => cancelAnimationFrame(rAF);
|
|
2485
|
-
}, []);
|
|
2486
|
-
useLayoutEffect2(() => {
|
|
2487
|
-
const node = ref.current;
|
|
2488
|
-
if (node) {
|
|
2489
|
-
originalStylesRef.current = originalStylesRef.current || {
|
|
2490
|
-
transitionDuration: node.style.transitionDuration,
|
|
2491
|
-
animationName: node.style.animationName
|
|
2492
|
-
};
|
|
2493
|
-
node.style.transitionDuration = "0s";
|
|
2494
|
-
node.style.animationName = "none";
|
|
2495
|
-
const rect = node.getBoundingClientRect();
|
|
2496
|
-
heightRef.current = rect.height;
|
|
2497
|
-
widthRef.current = rect.width;
|
|
2498
|
-
if (!isMountAnimationPreventedRef.current) {
|
|
2499
|
-
node.style.transitionDuration = originalStylesRef.current.transitionDuration;
|
|
2500
|
-
node.style.animationName = originalStylesRef.current.animationName;
|
|
1489
|
+
const _normalized = cached(() => normalizeDef(def));
|
|
1490
|
+
defineLazy(inst._zod, "propValues", () => {
|
|
1491
|
+
const shape = def.shape;
|
|
1492
|
+
const propValues = {};
|
|
1493
|
+
for (const key in shape) {
|
|
1494
|
+
const field = shape[key]._zod;
|
|
1495
|
+
if (field.values) {
|
|
1496
|
+
propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
|
|
1497
|
+
for (const v of field.values)
|
|
1498
|
+
propValues[key].add(v);
|
|
2501
1499
|
}
|
|
2502
|
-
setIsPresent(present);
|
|
2503
|
-
}
|
|
2504
|
-
}, [context.open, present]);
|
|
2505
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2506
|
-
Primitive.div,
|
|
2507
|
-
{
|
|
2508
|
-
"data-state": getState$1(context.open),
|
|
2509
|
-
"data-disabled": context.disabled ? "" : void 0,
|
|
2510
|
-
id: context.contentId,
|
|
2511
|
-
hidden: !isOpen,
|
|
2512
|
-
...contentProps,
|
|
2513
|
-
ref: composedRefs,
|
|
2514
|
-
style: {
|
|
2515
|
-
[`--radix-collapsible-content-height`]: height ? `${height}px` : void 0,
|
|
2516
|
-
[`--radix-collapsible-content-width`]: width ? `${width}px` : void 0,
|
|
2517
|
-
...props.style
|
|
2518
|
-
},
|
|
2519
|
-
children: isOpen && children
|
|
2520
1500
|
}
|
|
2521
|
-
|
|
2522
|
-
});
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
const
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
);
|
|
2536
|
-
|
|
2537
|
-
const camelCase = toCamelCase(string2);
|
|
2538
|
-
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
|
|
2539
|
-
};
|
|
2540
|
-
var defaultAttributes = {
|
|
2541
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
2542
|
-
width: 24,
|
|
2543
|
-
height: 24,
|
|
2544
|
-
viewBox: "0 0 24 24",
|
|
2545
|
-
fill: "none",
|
|
2546
|
-
stroke: "currentColor",
|
|
2547
|
-
strokeWidth: 2,
|
|
2548
|
-
strokeLinecap: "round",
|
|
2549
|
-
strokeLinejoin: "round"
|
|
2550
|
-
};
|
|
2551
|
-
const hasA11yProp = (props) => {
|
|
2552
|
-
for (const prop in props) {
|
|
2553
|
-
if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
|
|
2554
|
-
return true;
|
|
1501
|
+
return propValues;
|
|
1502
|
+
});
|
|
1503
|
+
const isObject$1 = isObject;
|
|
1504
|
+
const catchall = def.catchall;
|
|
1505
|
+
let value;
|
|
1506
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1507
|
+
value ?? (value = _normalized.value);
|
|
1508
|
+
const input = payload.value;
|
|
1509
|
+
if (!isObject$1(input)) {
|
|
1510
|
+
payload.issues.push({
|
|
1511
|
+
expected: "object",
|
|
1512
|
+
code: "invalid_type",
|
|
1513
|
+
input,
|
|
1514
|
+
inst
|
|
1515
|
+
});
|
|
1516
|
+
return payload;
|
|
2555
1517
|
}
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
const
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
...rest
|
|
2569
|
-
}, ref) => createElement(
|
|
2570
|
-
"svg",
|
|
2571
|
-
{
|
|
2572
|
-
ref,
|
|
2573
|
-
...defaultAttributes,
|
|
2574
|
-
width: size,
|
|
2575
|
-
height: size,
|
|
2576
|
-
stroke: color,
|
|
2577
|
-
strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
|
|
2578
|
-
className: mergeClasses("lucide", className),
|
|
2579
|
-
...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
|
|
2580
|
-
...rest
|
|
2581
|
-
},
|
|
2582
|
-
[
|
|
2583
|
-
...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),
|
|
2584
|
-
...Array.isArray(children) ? children : [children]
|
|
2585
|
-
]
|
|
2586
|
-
)
|
|
2587
|
-
);
|
|
2588
|
-
const createLucideIcon = (iconName, iconNode) => {
|
|
2589
|
-
const Component = forwardRef(
|
|
2590
|
-
({ className, ...props }, ref) => createElement(Icon, {
|
|
2591
|
-
ref,
|
|
2592
|
-
iconNode,
|
|
2593
|
-
className: mergeClasses(
|
|
2594
|
-
`lucide-${toKebabCase(toPascalCase(iconName))}`,
|
|
2595
|
-
`lucide-${iconName}`,
|
|
2596
|
-
className
|
|
2597
|
-
),
|
|
2598
|
-
...props
|
|
2599
|
-
})
|
|
2600
|
-
);
|
|
2601
|
-
Component.displayName = toPascalCase(iconName);
|
|
2602
|
-
return Component;
|
|
2603
|
-
};
|
|
2604
|
-
const __iconNode = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
|
|
2605
|
-
const ChevronUp = createLucideIcon("chevron-up", __iconNode);
|
|
2606
|
-
const selectionSchema = /* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ boolean());
|
|
2607
|
-
const SelectionContext = createContext(null);
|
|
2608
|
-
const SelectionProvider = ({
|
|
2609
|
-
children,
|
|
2610
|
-
items,
|
|
2611
|
-
localStorageKey
|
|
2612
|
-
}) => {
|
|
2613
|
-
function getLsSelection(localStorageKey2) {
|
|
2614
|
-
const storedSelection = localStorage.getItem(localStorageKey2);
|
|
2615
|
-
if (!storedSelection) return null;
|
|
2616
|
-
const { success, data } = selectionSchema.safeParse(
|
|
2617
|
-
JSON.parse(storedSelection)
|
|
2618
|
-
);
|
|
2619
|
-
if (!success) return null;
|
|
2620
|
-
return data;
|
|
2621
|
-
}
|
|
2622
|
-
const defaultSelection = useMemo(
|
|
2623
|
-
() => Object.fromEntries(
|
|
2624
|
-
items.map((item) => [item.value, item.defaultSelected ?? false])
|
|
2625
|
-
),
|
|
2626
|
-
[items]
|
|
2627
|
-
);
|
|
2628
|
-
const [selection, setSelection] = useState(
|
|
2629
|
-
getLsSelection(localStorageKey) ?? defaultSelection
|
|
2630
|
-
);
|
|
2631
|
-
const [savedSelection, setSavedSelection] = useState(
|
|
2632
|
-
getLsSelection(localStorageKey)
|
|
2633
|
-
);
|
|
2634
|
-
function toggleSelection(key, value) {
|
|
2635
|
-
const newSelection = selection ? { ...selection, [key]: value } : { [key]: value };
|
|
2636
|
-
setSelection(newSelection);
|
|
2637
|
-
}
|
|
2638
|
-
useEffect(() => {
|
|
2639
|
-
let selectedValues = [];
|
|
2640
|
-
if (savedSelection !== null) {
|
|
2641
|
-
selectedValues = Object.entries(savedSelection).filter(([_, value]) => value).map(([key]) => key);
|
|
1518
|
+
payload.value = {};
|
|
1519
|
+
const proms = [];
|
|
1520
|
+
const shape = value.shape;
|
|
1521
|
+
for (const key of value.keys) {
|
|
1522
|
+
const el = shape[key];
|
|
1523
|
+
const isOptionalOut = el._zod.optout === "optional";
|
|
1524
|
+
const r = el._zod.run({ value: input[key], issues: [] }, ctx);
|
|
1525
|
+
if (r instanceof Promise) {
|
|
1526
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalOut)));
|
|
1527
|
+
} else {
|
|
1528
|
+
handlePropertyResult(r, payload, key, input, isOptionalOut);
|
|
1529
|
+
}
|
|
2642
1530
|
}
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
);
|
|
2646
|
-
for (const item of items) {
|
|
2647
|
-
const elem = document.head.querySelector(`#${item.value}`);
|
|
2648
|
-
if (!elem) continue;
|
|
2649
|
-
elem.remove();
|
|
1531
|
+
if (!catchall) {
|
|
1532
|
+
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
2650
1533
|
}
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
const { success, data: script } = scriptDefinitionSchema.safeParse(
|
|
2660
|
-
item.script
|
|
2661
|
-
);
|
|
2662
|
-
if (!success) {
|
|
2663
|
-
console.error(
|
|
2664
|
-
"CookieBanner: Invalid script definition for",
|
|
2665
|
-
item.value
|
|
2666
|
-
);
|
|
2667
|
-
continue;
|
|
2668
|
-
}
|
|
2669
|
-
elem.type = script.type ?? "text/javascript";
|
|
2670
|
-
elem.async = script.async ?? false;
|
|
2671
|
-
elem.defer = script.defer ?? false;
|
|
2672
|
-
switch (script.variant) {
|
|
2673
|
-
case "inline":
|
|
2674
|
-
elem.textContent = script.content;
|
|
2675
|
-
break;
|
|
2676
|
-
case "remote":
|
|
2677
|
-
elem.src = script.src;
|
|
2678
|
-
elem.crossOrigin = script.crossorigin ?? null;
|
|
2679
|
-
elem.integrity = script.integrity ?? "";
|
|
2680
|
-
break;
|
|
2681
|
-
}
|
|
2682
|
-
document.head.appendChild(elem);
|
|
1534
|
+
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
1535
|
+
};
|
|
1536
|
+
});
|
|
1537
|
+
function handleUnionResults(results, final, inst, ctx) {
|
|
1538
|
+
for (const result of results) {
|
|
1539
|
+
if (result.issues.length === 0) {
|
|
1540
|
+
final.value = result.value;
|
|
1541
|
+
return final;
|
|
2683
1542
|
}
|
|
2684
|
-
}, [savedSelection, items]);
|
|
2685
|
-
function saveSelection(newSelection) {
|
|
2686
|
-
setSavedSelection(newSelection);
|
|
2687
|
-
localStorage.setItem(localStorageKey, JSON.stringify(newSelection));
|
|
2688
1543
|
}
|
|
2689
|
-
const
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
setSelection(newSelection);
|
|
2694
|
-
saveSelection(newSelection);
|
|
2695
|
-
}, [items]);
|
|
2696
|
-
const onSave = useCallback(() => {
|
|
2697
|
-
saveSelection(selection);
|
|
2698
|
-
}, [selection]);
|
|
2699
|
-
const selectionTaken = useMemo(() => {
|
|
2700
|
-
if (!savedSelection) return false;
|
|
2701
|
-
const selectedKeys = Object.keys(savedSelection);
|
|
2702
|
-
const itemKeys = items.map((item) => item.value);
|
|
2703
|
-
return itemKeys.every((key) => selectedKeys.includes(key));
|
|
2704
|
-
}, [savedSelection, items]);
|
|
2705
|
-
return /* @__PURE__ */ u(
|
|
2706
|
-
SelectionContext.Provider,
|
|
2707
|
-
{
|
|
2708
|
-
value: {
|
|
2709
|
-
selection,
|
|
2710
|
-
toggleSelection,
|
|
2711
|
-
onDeclineAll,
|
|
2712
|
-
onSave,
|
|
2713
|
-
selectionTaken
|
|
2714
|
-
},
|
|
2715
|
-
children
|
|
2716
|
-
}
|
|
2717
|
-
);
|
|
2718
|
-
};
|
|
2719
|
-
function useSelection() {
|
|
2720
|
-
const context = useContext(SelectionContext);
|
|
2721
|
-
if (!context) {
|
|
2722
|
-
throw new Error("useSelection must be used within a SelectionProvider");
|
|
1544
|
+
const nonaborted = results.filter((r) => !aborted(r));
|
|
1545
|
+
if (nonaborted.length === 1) {
|
|
1546
|
+
final.value = nonaborted[0].value;
|
|
1547
|
+
return nonaborted[0];
|
|
2723
1548
|
}
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
callbackRef.current = callback;
|
|
1549
|
+
final.issues.push({
|
|
1550
|
+
code: "invalid_union",
|
|
1551
|
+
input: final.value,
|
|
1552
|
+
inst,
|
|
1553
|
+
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
2730
1554
|
});
|
|
2731
|
-
return
|
|
1555
|
+
return final;
|
|
2732
1556
|
}
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
1557
|
+
const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
1558
|
+
$ZodType.init(inst, def);
|
|
1559
|
+
defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
|
|
1560
|
+
defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
|
|
1561
|
+
defineLazy(inst._zod, "values", () => {
|
|
1562
|
+
if (def.options.every((o) => o._zod.values)) {
|
|
1563
|
+
return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
1564
|
+
}
|
|
1565
|
+
return void 0;
|
|
1566
|
+
});
|
|
1567
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
1568
|
+
if (def.options.every((o) => o._zod.pattern)) {
|
|
1569
|
+
const patterns = def.options.map((o) => o._zod.pattern);
|
|
1570
|
+
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
1571
|
+
}
|
|
1572
|
+
return void 0;
|
|
1573
|
+
});
|
|
1574
|
+
const single = def.options.length === 1;
|
|
1575
|
+
const first = def.options[0]._zod.run;
|
|
1576
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1577
|
+
if (single) {
|
|
1578
|
+
return first(payload, ctx);
|
|
1579
|
+
}
|
|
1580
|
+
let async = false;
|
|
1581
|
+
const results = [];
|
|
1582
|
+
for (const option of def.options) {
|
|
1583
|
+
const result = option._zod.run({
|
|
1584
|
+
value: payload.value,
|
|
1585
|
+
issues: []
|
|
1586
|
+
}, ctx);
|
|
1587
|
+
if (result instanceof Promise) {
|
|
1588
|
+
results.push(result);
|
|
1589
|
+
async = true;
|
|
1590
|
+
} else {
|
|
1591
|
+
if (result.issues.length === 0)
|
|
1592
|
+
return result;
|
|
1593
|
+
results.push(result);
|
|
2739
1594
|
}
|
|
2740
|
-
}
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
2748
|
-
var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
|
|
2749
|
-
var originalBodyPointerEvents;
|
|
2750
|
-
var DismissableLayerContext = React.createContext({
|
|
2751
|
-
layers: /* @__PURE__ */ new Set(),
|
|
2752
|
-
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
2753
|
-
branches: /* @__PURE__ */ new Set()
|
|
1595
|
+
}
|
|
1596
|
+
if (!async)
|
|
1597
|
+
return handleUnionResults(results, payload, inst, ctx);
|
|
1598
|
+
return Promise.all(results).then((results2) => {
|
|
1599
|
+
return handleUnionResults(results2, payload, inst, ctx);
|
|
1600
|
+
});
|
|
1601
|
+
};
|
|
2754
1602
|
});
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
|
|
2771
|
-
const layers = Array.from(context.layers);
|
|
2772
|
-
const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
|
|
2773
|
-
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
|
|
2774
|
-
const index = node ? layers.indexOf(node) : -1;
|
|
2775
|
-
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
2776
|
-
const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
2777
|
-
const pointerDownOutside = usePointerDownOutside((event) => {
|
|
2778
|
-
const target = event.target;
|
|
2779
|
-
const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
2780
|
-
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
2781
|
-
onPointerDownOutside?.(event);
|
|
2782
|
-
onInteractOutside?.(event);
|
|
2783
|
-
if (!event.defaultPrevented) onDismiss?.();
|
|
2784
|
-
}, ownerDocument);
|
|
2785
|
-
const focusOutside = useFocusOutside((event) => {
|
|
2786
|
-
const target = event.target;
|
|
2787
|
-
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
2788
|
-
if (isFocusInBranch) return;
|
|
2789
|
-
onFocusOutside?.(event);
|
|
2790
|
-
onInteractOutside?.(event);
|
|
2791
|
-
if (!event.defaultPrevented) onDismiss?.();
|
|
2792
|
-
}, ownerDocument);
|
|
2793
|
-
useEscapeKeydown((event) => {
|
|
2794
|
-
const isHighestLayer = index === context.layers.size - 1;
|
|
2795
|
-
if (!isHighestLayer) return;
|
|
2796
|
-
onEscapeKeyDown?.(event);
|
|
2797
|
-
if (!event.defaultPrevented && onDismiss) {
|
|
2798
|
-
event.preventDefault();
|
|
2799
|
-
onDismiss();
|
|
2800
|
-
}
|
|
2801
|
-
}, ownerDocument);
|
|
2802
|
-
React.useEffect(() => {
|
|
2803
|
-
if (!node) return;
|
|
2804
|
-
if (disableOutsidePointerEvents) {
|
|
2805
|
-
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
2806
|
-
originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
|
2807
|
-
ownerDocument.body.style.pointerEvents = "none";
|
|
2808
|
-
}
|
|
2809
|
-
context.layersWithOutsidePointerEventsDisabled.add(node);
|
|
2810
|
-
}
|
|
2811
|
-
context.layers.add(node);
|
|
2812
|
-
dispatchUpdate();
|
|
2813
|
-
return () => {
|
|
2814
|
-
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
|
|
2815
|
-
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
|
1603
|
+
const $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
1604
|
+
def.inclusive = false;
|
|
1605
|
+
$ZodUnion.init(inst, def);
|
|
1606
|
+
const _super = inst._zod.parse;
|
|
1607
|
+
defineLazy(inst._zod, "propValues", () => {
|
|
1608
|
+
const propValues = {};
|
|
1609
|
+
for (const option of def.options) {
|
|
1610
|
+
const pv = option._zod.propValues;
|
|
1611
|
+
if (!pv || Object.keys(pv).length === 0)
|
|
1612
|
+
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
1613
|
+
for (const [k, v] of Object.entries(pv)) {
|
|
1614
|
+
if (!propValues[k])
|
|
1615
|
+
propValues[k] = /* @__PURE__ */ new Set();
|
|
1616
|
+
for (const val of v) {
|
|
1617
|
+
propValues[k].add(val);
|
|
2816
1618
|
}
|
|
2817
|
-
};
|
|
2818
|
-
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
2819
|
-
React.useEffect(() => {
|
|
2820
|
-
return () => {
|
|
2821
|
-
if (!node) return;
|
|
2822
|
-
context.layers.delete(node);
|
|
2823
|
-
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
|
2824
|
-
dispatchUpdate();
|
|
2825
|
-
};
|
|
2826
|
-
}, [node, context]);
|
|
2827
|
-
React.useEffect(() => {
|
|
2828
|
-
const handleUpdate = () => force({});
|
|
2829
|
-
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
2830
|
-
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
2831
|
-
}, []);
|
|
2832
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2833
|
-
Primitive.div,
|
|
2834
|
-
{
|
|
2835
|
-
...layerProps,
|
|
2836
|
-
ref: composedRefs,
|
|
2837
|
-
style: {
|
|
2838
|
-
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
|
|
2839
|
-
...props.style
|
|
2840
|
-
},
|
|
2841
|
-
onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
2842
|
-
onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
2843
|
-
onPointerDownCapture: composeEventHandlers(
|
|
2844
|
-
props.onPointerDownCapture,
|
|
2845
|
-
pointerDownOutside.onPointerDownCapture
|
|
2846
|
-
)
|
|
2847
1619
|
}
|
|
2848
|
-
);
|
|
2849
|
-
}
|
|
2850
|
-
);
|
|
2851
|
-
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
2852
|
-
var BRANCH_NAME = "DismissableLayerBranch";
|
|
2853
|
-
var DismissableLayerBranch = React.forwardRef((props, forwardedRef) => {
|
|
2854
|
-
const context = React.useContext(DismissableLayerContext);
|
|
2855
|
-
const ref = React.useRef(null);
|
|
2856
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
2857
|
-
React.useEffect(() => {
|
|
2858
|
-
const node = ref.current;
|
|
2859
|
-
if (node) {
|
|
2860
|
-
context.branches.add(node);
|
|
2861
|
-
return () => {
|
|
2862
|
-
context.branches.delete(node);
|
|
2863
|
-
};
|
|
2864
1620
|
}
|
|
2865
|
-
|
|
2866
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, { ...props, ref: composedRefs });
|
|
2867
|
-
});
|
|
2868
|
-
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
2869
|
-
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
|
|
2870
|
-
const handlePointerDownOutside = useCallbackRef$1(onPointerDownOutside);
|
|
2871
|
-
const isPointerInsideReactTreeRef = React.useRef(false);
|
|
2872
|
-
const handleClickRef = React.useRef(() => {
|
|
1621
|
+
return propValues;
|
|
2873
1622
|
});
|
|
2874
|
-
|
|
2875
|
-
const
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
);
|
|
2884
|
-
};
|
|
2885
|
-
const eventDetail = { originalEvent: event };
|
|
2886
|
-
if (event.pointerType === "touch") {
|
|
2887
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
2888
|
-
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
|
2889
|
-
ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
|
|
2890
|
-
} else {
|
|
2891
|
-
handleAndDispatchPointerDownOutsideEvent2();
|
|
1623
|
+
const disc = cached(() => {
|
|
1624
|
+
const opts = def.options;
|
|
1625
|
+
const map = /* @__PURE__ */ new Map();
|
|
1626
|
+
for (const o of opts) {
|
|
1627
|
+
const values = o._zod.propValues?.[def.discriminator];
|
|
1628
|
+
if (!values || values.size === 0)
|
|
1629
|
+
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
|
|
1630
|
+
for (const v of values) {
|
|
1631
|
+
if (map.has(v)) {
|
|
1632
|
+
throw new Error(`Duplicate discriminator value "${String(v)}"`);
|
|
2892
1633
|
}
|
|
2893
|
-
|
|
2894
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
2895
|
-
}
|
|
2896
|
-
isPointerInsideReactTreeRef.current = false;
|
|
2897
|
-
};
|
|
2898
|
-
const timerId = window.setTimeout(() => {
|
|
2899
|
-
ownerDocument.addEventListener("pointerdown", handlePointerDown);
|
|
2900
|
-
}, 0);
|
|
2901
|
-
return () => {
|
|
2902
|
-
window.clearTimeout(timerId);
|
|
2903
|
-
ownerDocument.removeEventListener("pointerdown", handlePointerDown);
|
|
2904
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
2905
|
-
};
|
|
2906
|
-
}, [ownerDocument, handlePointerDownOutside]);
|
|
2907
|
-
return {
|
|
2908
|
-
// ensures we check React component tree (not just DOM tree)
|
|
2909
|
-
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
|
2910
|
-
};
|
|
2911
|
-
}
|
|
2912
|
-
function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
|
|
2913
|
-
const handleFocusOutside = useCallbackRef$1(onFocusOutside);
|
|
2914
|
-
const isFocusInsideReactTreeRef = React.useRef(false);
|
|
2915
|
-
React.useEffect(() => {
|
|
2916
|
-
const handleFocus = (event) => {
|
|
2917
|
-
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
2918
|
-
const eventDetail = { originalEvent: event };
|
|
2919
|
-
handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
2920
|
-
discrete: false
|
|
2921
|
-
});
|
|
1634
|
+
map.set(v, o);
|
|
2922
1635
|
}
|
|
2923
|
-
}
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
1636
|
+
}
|
|
1637
|
+
return map;
|
|
1638
|
+
});
|
|
1639
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1640
|
+
const input = payload.value;
|
|
1641
|
+
if (!isObject(input)) {
|
|
1642
|
+
payload.issues.push({
|
|
1643
|
+
code: "invalid_type",
|
|
1644
|
+
expected: "object",
|
|
1645
|
+
input,
|
|
1646
|
+
inst
|
|
1647
|
+
});
|
|
1648
|
+
return payload;
|
|
1649
|
+
}
|
|
1650
|
+
const opt = disc.value.get(input?.[def.discriminator]);
|
|
1651
|
+
if (opt) {
|
|
1652
|
+
return opt._zod.run(payload, ctx);
|
|
1653
|
+
}
|
|
1654
|
+
if (def.unionFallback) {
|
|
1655
|
+
return _super(payload, ctx);
|
|
1656
|
+
}
|
|
1657
|
+
payload.issues.push({
|
|
1658
|
+
code: "invalid_union",
|
|
1659
|
+
errors: [],
|
|
1660
|
+
note: "No matching discriminator",
|
|
1661
|
+
discriminator: def.discriminator,
|
|
1662
|
+
input,
|
|
1663
|
+
path: [def.discriminator],
|
|
1664
|
+
inst
|
|
1665
|
+
});
|
|
1666
|
+
return payload;
|
|
2930
1667
|
};
|
|
2931
|
-
}
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
}
|
|
2945
|
-
}
|
|
2946
|
-
var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
|
|
2947
|
-
var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
|
|
2948
|
-
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
2949
|
-
var FOCUS_SCOPE_NAME = "FocusScope";
|
|
2950
|
-
var FocusScope = React.forwardRef((props, forwardedRef) => {
|
|
2951
|
-
const {
|
|
2952
|
-
loop = false,
|
|
2953
|
-
trapped = false,
|
|
2954
|
-
onMountAutoFocus: onMountAutoFocusProp,
|
|
2955
|
-
onUnmountAutoFocus: onUnmountAutoFocusProp,
|
|
2956
|
-
...scopeProps
|
|
2957
|
-
} = props;
|
|
2958
|
-
const [container, setContainer] = React.useState(null);
|
|
2959
|
-
const onMountAutoFocus = useCallbackRef$1(onMountAutoFocusProp);
|
|
2960
|
-
const onUnmountAutoFocus = useCallbackRef$1(onUnmountAutoFocusProp);
|
|
2961
|
-
const lastFocusedElementRef = React.useRef(null);
|
|
2962
|
-
const composedRefs = useComposedRefs(forwardedRef, (node) => setContainer(node));
|
|
2963
|
-
const focusScope = React.useRef({
|
|
2964
|
-
paused: false,
|
|
2965
|
-
pause() {
|
|
2966
|
-
this.paused = true;
|
|
2967
|
-
},
|
|
2968
|
-
resume() {
|
|
2969
|
-
this.paused = false;
|
|
1668
|
+
});
|
|
1669
|
+
const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
1670
|
+
$ZodType.init(inst, def);
|
|
1671
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1672
|
+
const input = payload.value;
|
|
1673
|
+
if (!isPlainObject(input)) {
|
|
1674
|
+
payload.issues.push({
|
|
1675
|
+
expected: "record",
|
|
1676
|
+
code: "invalid_type",
|
|
1677
|
+
input,
|
|
1678
|
+
inst
|
|
1679
|
+
});
|
|
1680
|
+
return payload;
|
|
2970
1681
|
}
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
if (
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
if (
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
1682
|
+
const proms = [];
|
|
1683
|
+
const values = def.keyType._zod.values;
|
|
1684
|
+
if (values) {
|
|
1685
|
+
payload.value = {};
|
|
1686
|
+
const recordKeys = /* @__PURE__ */ new Set();
|
|
1687
|
+
for (const key of values) {
|
|
1688
|
+
if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
1689
|
+
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
1690
|
+
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
1691
|
+
if (result instanceof Promise) {
|
|
1692
|
+
proms.push(result.then((result2) => {
|
|
1693
|
+
if (result2.issues.length) {
|
|
1694
|
+
payload.issues.push(...prefixIssues(key, result2.issues));
|
|
1695
|
+
}
|
|
1696
|
+
payload.value[key] = result2.value;
|
|
1697
|
+
}));
|
|
1698
|
+
} else {
|
|
1699
|
+
if (result.issues.length) {
|
|
1700
|
+
payload.issues.push(...prefixIssues(key, result.issues));
|
|
1701
|
+
}
|
|
1702
|
+
payload.value[key] = result.value;
|
|
1703
|
+
}
|
|
2981
1704
|
}
|
|
2982
|
-
}
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
if (
|
|
2986
|
-
|
|
2987
|
-
|
|
1705
|
+
}
|
|
1706
|
+
let unrecognized;
|
|
1707
|
+
for (const key in input) {
|
|
1708
|
+
if (!recordKeys.has(key)) {
|
|
1709
|
+
unrecognized = unrecognized ?? [];
|
|
1710
|
+
unrecognized.push(key);
|
|
2988
1711
|
}
|
|
2989
|
-
}
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
1712
|
+
}
|
|
1713
|
+
if (unrecognized && unrecognized.length > 0) {
|
|
1714
|
+
payload.issues.push({
|
|
1715
|
+
code: "unrecognized_keys",
|
|
1716
|
+
input,
|
|
1717
|
+
inst,
|
|
1718
|
+
keys: unrecognized
|
|
1719
|
+
});
|
|
1720
|
+
}
|
|
1721
|
+
} else {
|
|
1722
|
+
payload.value = {};
|
|
1723
|
+
for (const key of Reflect.ownKeys(input)) {
|
|
1724
|
+
if (key === "__proto__")
|
|
1725
|
+
continue;
|
|
1726
|
+
let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
1727
|
+
if (keyResult instanceof Promise) {
|
|
1728
|
+
throw new Error("Async schemas not supported in object keys currently");
|
|
2994
1729
|
}
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
return () => {
|
|
3001
|
-
document.removeEventListener("focusin", handleFocusIn2);
|
|
3002
|
-
document.removeEventListener("focusout", handleFocusOut2);
|
|
3003
|
-
mutationObserver.disconnect();
|
|
3004
|
-
};
|
|
3005
|
-
}
|
|
3006
|
-
}, [trapped, container, focusScope.paused]);
|
|
3007
|
-
React.useEffect(() => {
|
|
3008
|
-
if (container) {
|
|
3009
|
-
focusScopesStack.add(focusScope);
|
|
3010
|
-
const previouslyFocusedElement = document.activeElement;
|
|
3011
|
-
const hasFocusedCandidate = container.contains(previouslyFocusedElement);
|
|
3012
|
-
if (!hasFocusedCandidate) {
|
|
3013
|
-
const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
|
|
3014
|
-
container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
3015
|
-
container.dispatchEvent(mountEvent);
|
|
3016
|
-
if (!mountEvent.defaultPrevented) {
|
|
3017
|
-
focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });
|
|
3018
|
-
if (document.activeElement === previouslyFocusedElement) {
|
|
3019
|
-
focus(container);
|
|
1730
|
+
const checkNumericKey = typeof key === "string" && number.test(key) && keyResult.issues.length;
|
|
1731
|
+
if (checkNumericKey) {
|
|
1732
|
+
const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
|
|
1733
|
+
if (retryResult instanceof Promise) {
|
|
1734
|
+
throw new Error("Async schemas not supported in object keys currently");
|
|
3020
1735
|
}
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
return () => {
|
|
3024
|
-
container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
3025
|
-
setTimeout(() => {
|
|
3026
|
-
const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
|
|
3027
|
-
container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
3028
|
-
container.dispatchEvent(unmountEvent);
|
|
3029
|
-
if (!unmountEvent.defaultPrevented) {
|
|
3030
|
-
focus(previouslyFocusedElement ?? document.body, { select: true });
|
|
1736
|
+
if (retryResult.issues.length === 0) {
|
|
1737
|
+
keyResult = retryResult;
|
|
3031
1738
|
}
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
const container2 = event.currentTarget;
|
|
3046
|
-
const [first, last] = getTabbableEdges(container2);
|
|
3047
|
-
const hasTabbableElementsInside = first && last;
|
|
3048
|
-
if (!hasTabbableElementsInside) {
|
|
3049
|
-
if (focusedElement === container2) event.preventDefault();
|
|
3050
|
-
} else {
|
|
3051
|
-
if (!event.shiftKey && focusedElement === last) {
|
|
3052
|
-
event.preventDefault();
|
|
3053
|
-
if (loop) focus(first, { select: true });
|
|
3054
|
-
} else if (event.shiftKey && focusedElement === first) {
|
|
3055
|
-
event.preventDefault();
|
|
3056
|
-
if (loop) focus(last, { select: true });
|
|
1739
|
+
}
|
|
1740
|
+
if (keyResult.issues.length) {
|
|
1741
|
+
if (def.mode === "loose") {
|
|
1742
|
+
payload.value[key] = input[key];
|
|
1743
|
+
} else {
|
|
1744
|
+
payload.issues.push({
|
|
1745
|
+
code: "invalid_key",
|
|
1746
|
+
origin: "record",
|
|
1747
|
+
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
1748
|
+
input: key,
|
|
1749
|
+
path: [key],
|
|
1750
|
+
inst
|
|
1751
|
+
});
|
|
3057
1752
|
}
|
|
1753
|
+
continue;
|
|
1754
|
+
}
|
|
1755
|
+
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
1756
|
+
if (result instanceof Promise) {
|
|
1757
|
+
proms.push(result.then((result2) => {
|
|
1758
|
+
if (result2.issues.length) {
|
|
1759
|
+
payload.issues.push(...prefixIssues(key, result2.issues));
|
|
1760
|
+
}
|
|
1761
|
+
payload.value[keyResult.value] = result2.value;
|
|
1762
|
+
}));
|
|
1763
|
+
} else {
|
|
1764
|
+
if (result.issues.length) {
|
|
1765
|
+
payload.issues.push(...prefixIssues(key, result.issues));
|
|
1766
|
+
}
|
|
1767
|
+
payload.value[keyResult.value] = result.value;
|
|
3058
1768
|
}
|
|
3059
1769
|
}
|
|
3060
|
-
},
|
|
3061
|
-
[loop, trapped, focusScope.paused]
|
|
3062
|
-
);
|
|
3063
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
|
|
3064
|
-
});
|
|
3065
|
-
FocusScope.displayName = FOCUS_SCOPE_NAME;
|
|
3066
|
-
function focusFirst(candidates, { select = false } = {}) {
|
|
3067
|
-
const previouslyFocusedElement = document.activeElement;
|
|
3068
|
-
for (const candidate of candidates) {
|
|
3069
|
-
focus(candidate, { select });
|
|
3070
|
-
if (document.activeElement !== previouslyFocusedElement) return;
|
|
3071
|
-
}
|
|
3072
|
-
}
|
|
3073
|
-
function getTabbableEdges(container) {
|
|
3074
|
-
const candidates = getTabbableCandidates(container);
|
|
3075
|
-
const first = findVisible(candidates, container);
|
|
3076
|
-
const last = findVisible(candidates.reverse(), container);
|
|
3077
|
-
return [first, last];
|
|
3078
|
-
}
|
|
3079
|
-
function getTabbableCandidates(container) {
|
|
3080
|
-
const nodes = [];
|
|
3081
|
-
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
3082
|
-
acceptNode: (node) => {
|
|
3083
|
-
const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
|
|
3084
|
-
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
|
|
3085
|
-
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
3086
|
-
}
|
|
3087
|
-
});
|
|
3088
|
-
while (walker.nextNode()) nodes.push(walker.currentNode);
|
|
3089
|
-
return nodes;
|
|
3090
|
-
}
|
|
3091
|
-
function findVisible(elements, container) {
|
|
3092
|
-
for (const element of elements) {
|
|
3093
|
-
if (!isHidden(element, { upTo: container })) return element;
|
|
3094
|
-
}
|
|
3095
|
-
}
|
|
3096
|
-
function isHidden(node, { upTo }) {
|
|
3097
|
-
if (getComputedStyle(node).visibility === "hidden") return true;
|
|
3098
|
-
while (node) {
|
|
3099
|
-
if (upTo !== void 0 && node === upTo) return false;
|
|
3100
|
-
if (getComputedStyle(node).display === "none") return true;
|
|
3101
|
-
node = node.parentElement;
|
|
3102
|
-
}
|
|
3103
|
-
return false;
|
|
3104
|
-
}
|
|
3105
|
-
function isSelectableInput(element) {
|
|
3106
|
-
return element instanceof HTMLInputElement && "select" in element;
|
|
3107
|
-
}
|
|
3108
|
-
function focus(element, { select = false } = {}) {
|
|
3109
|
-
if (element && element.focus) {
|
|
3110
|
-
const previouslyFocusedElement = document.activeElement;
|
|
3111
|
-
element.focus({ preventScroll: true });
|
|
3112
|
-
if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
|
|
3113
|
-
element.select();
|
|
3114
|
-
}
|
|
3115
|
-
}
|
|
3116
|
-
var focusScopesStack = createFocusScopesStack();
|
|
3117
|
-
function createFocusScopesStack() {
|
|
3118
|
-
let stack = [];
|
|
3119
|
-
return {
|
|
3120
|
-
add(focusScope) {
|
|
3121
|
-
const activeFocusScope = stack[0];
|
|
3122
|
-
if (focusScope !== activeFocusScope) {
|
|
3123
|
-
activeFocusScope?.pause();
|
|
3124
|
-
}
|
|
3125
|
-
stack = arrayRemove(stack, focusScope);
|
|
3126
|
-
stack.unshift(focusScope);
|
|
3127
|
-
},
|
|
3128
|
-
remove(focusScope) {
|
|
3129
|
-
stack = arrayRemove(stack, focusScope);
|
|
3130
|
-
stack[0]?.resume();
|
|
3131
1770
|
}
|
|
1771
|
+
if (proms.length) {
|
|
1772
|
+
return Promise.all(proms).then(() => payload);
|
|
1773
|
+
}
|
|
1774
|
+
return payload;
|
|
3132
1775
|
};
|
|
3133
|
-
}
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
updatedArray.splice(index, 1);
|
|
1776
|
+
});
|
|
1777
|
+
const $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
1778
|
+
$ZodType.init(inst, def);
|
|
1779
|
+
if (def.values.length === 0) {
|
|
1780
|
+
throw new Error("Cannot create literal schema with no valid values");
|
|
3139
1781
|
}
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
React.useEffect(() => {
|
|
3148
|
-
const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
|
|
3149
|
-
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
|
|
3150
|
-
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
|
|
3151
|
-
count++;
|
|
3152
|
-
return () => {
|
|
3153
|
-
if (count === 1) {
|
|
3154
|
-
document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
|
|
3155
|
-
}
|
|
3156
|
-
count--;
|
|
3157
|
-
};
|
|
3158
|
-
}, []);
|
|
3159
|
-
}
|
|
3160
|
-
function createFocusGuard() {
|
|
3161
|
-
const element = document.createElement("span");
|
|
3162
|
-
element.setAttribute("data-radix-focus-guard", "");
|
|
3163
|
-
element.tabIndex = 0;
|
|
3164
|
-
element.style.outline = "none";
|
|
3165
|
-
element.style.opacity = "0";
|
|
3166
|
-
element.style.position = "fixed";
|
|
3167
|
-
element.style.pointerEvents = "none";
|
|
3168
|
-
return element;
|
|
3169
|
-
}
|
|
3170
|
-
var __assign = function() {
|
|
3171
|
-
__assign = Object.assign || function __assign2(t) {
|
|
3172
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
3173
|
-
s = arguments[i];
|
|
3174
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
1782
|
+
const values = new Set(def.values);
|
|
1783
|
+
inst._zod.values = values;
|
|
1784
|
+
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
1785
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1786
|
+
const input = payload.value;
|
|
1787
|
+
if (values.has(input)) {
|
|
1788
|
+
return payload;
|
|
3175
1789
|
}
|
|
3176
|
-
|
|
1790
|
+
payload.issues.push({
|
|
1791
|
+
code: "invalid_value",
|
|
1792
|
+
values: def.values,
|
|
1793
|
+
input,
|
|
1794
|
+
inst
|
|
1795
|
+
});
|
|
1796
|
+
return payload;
|
|
3177
1797
|
};
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
3183
|
-
t[p] = s[p];
|
|
3184
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
3185
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
3186
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
3187
|
-
t[p[i]] = s[p[i]];
|
|
3188
|
-
}
|
|
3189
|
-
return t;
|
|
3190
|
-
}
|
|
3191
|
-
function __spreadArray(to, from, pack) {
|
|
3192
|
-
if (pack || arguments.length === 2) for (var i = 0, l2 = from.length, ar; i < l2; i++) {
|
|
3193
|
-
if (ar || !(i in from)) {
|
|
3194
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
3195
|
-
ar[i] = from[i];
|
|
3196
|
-
}
|
|
3197
|
-
}
|
|
3198
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
3199
|
-
}
|
|
3200
|
-
var zeroRightClassName = "right-scroll-bar-position";
|
|
3201
|
-
var fullWidthClassName = "width-before-scroll-bar";
|
|
3202
|
-
var noScrollbarsClassName = "with-scroll-bars-hidden";
|
|
3203
|
-
var removedBarSizeVariable = "--removed-body-scroll-bar-size";
|
|
3204
|
-
function assignRef(ref, value) {
|
|
3205
|
-
if (typeof ref === "function") {
|
|
3206
|
-
ref(value);
|
|
3207
|
-
} else if (ref) {
|
|
3208
|
-
ref.current = value;
|
|
1798
|
+
});
|
|
1799
|
+
function handleOptionalResult(result, input) {
|
|
1800
|
+
if (result.issues.length && input === void 0) {
|
|
1801
|
+
return { issues: [], value: void 0 };
|
|
3209
1802
|
}
|
|
3210
|
-
return
|
|
3211
|
-
}
|
|
3212
|
-
function useCallbackRef(initialValue, callback) {
|
|
3213
|
-
var ref = useState(function() {
|
|
3214
|
-
return {
|
|
3215
|
-
// value
|
|
3216
|
-
value: initialValue,
|
|
3217
|
-
// last callback
|
|
3218
|
-
callback,
|
|
3219
|
-
// "memoized" public interface
|
|
3220
|
-
facade: {
|
|
3221
|
-
get current() {
|
|
3222
|
-
return ref.value;
|
|
3223
|
-
},
|
|
3224
|
-
set current(value) {
|
|
3225
|
-
var last = ref.value;
|
|
3226
|
-
if (last !== value) {
|
|
3227
|
-
ref.value = value;
|
|
3228
|
-
ref.callback(value, last);
|
|
3229
|
-
}
|
|
3230
|
-
}
|
|
3231
|
-
}
|
|
3232
|
-
};
|
|
3233
|
-
})[0];
|
|
3234
|
-
ref.callback = callback;
|
|
3235
|
-
return ref.facade;
|
|
1803
|
+
return result;
|
|
3236
1804
|
}
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
});
|
|
1805
|
+
const $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
1806
|
+
$ZodType.init(inst, def);
|
|
1807
|
+
inst._zod.optin = "optional";
|
|
1808
|
+
inst._zod.optout = "optional";
|
|
1809
|
+
defineLazy(inst._zod, "values", () => {
|
|
1810
|
+
return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, void 0]) : void 0;
|
|
3244
1811
|
});
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
assignRef(ref, current_1);
|
|
3259
|
-
}
|
|
3260
|
-
});
|
|
1812
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
1813
|
+
const pattern = def.innerType._zod.pattern;
|
|
1814
|
+
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
|
|
1815
|
+
});
|
|
1816
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1817
|
+
if (def.innerType._zod.optin === "optional") {
|
|
1818
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
1819
|
+
if (result instanceof Promise)
|
|
1820
|
+
return result.then((r) => handleOptionalResult(r, payload.value));
|
|
1821
|
+
return handleOptionalResult(result, payload.value);
|
|
1822
|
+
}
|
|
1823
|
+
if (payload.value === void 0) {
|
|
1824
|
+
return payload;
|
|
3261
1825
|
}
|
|
3262
|
-
|
|
3263
|
-
}
|
|
3264
|
-
|
|
1826
|
+
return def.innerType._zod.run(payload, ctx);
|
|
1827
|
+
};
|
|
1828
|
+
});
|
|
1829
|
+
// @__NO_SIDE_EFFECTS__
|
|
1830
|
+
function _string(Class, params) {
|
|
1831
|
+
return new Class({
|
|
1832
|
+
type: "string",
|
|
1833
|
+
...normalizeParams()
|
|
1834
|
+
});
|
|
3265
1835
|
}
|
|
3266
|
-
|
|
3267
|
-
|
|
1836
|
+
// @__NO_SIDE_EFFECTS__
|
|
1837
|
+
function _boolean(Class, params) {
|
|
1838
|
+
return new Class({
|
|
1839
|
+
type: "boolean",
|
|
1840
|
+
...normalizeParams()
|
|
1841
|
+
});
|
|
3268
1842
|
}
|
|
3269
|
-
|
|
3270
|
-
if (
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
buffer.push(item);
|
|
3288
|
-
return function() {
|
|
3289
|
-
buffer = buffer.filter(function(x) {
|
|
3290
|
-
return x !== item;
|
|
3291
|
-
});
|
|
3292
|
-
};
|
|
3293
|
-
},
|
|
3294
|
-
assignSyncMedium: function(cb) {
|
|
3295
|
-
assigned = true;
|
|
3296
|
-
while (buffer.length) {
|
|
3297
|
-
var cbs = buffer;
|
|
3298
|
-
buffer = [];
|
|
3299
|
-
cbs.forEach(cb);
|
|
3300
|
-
}
|
|
3301
|
-
buffer = {
|
|
3302
|
-
push: function(x) {
|
|
3303
|
-
return cb(x);
|
|
3304
|
-
},
|
|
3305
|
-
filter: function() {
|
|
3306
|
-
return buffer;
|
|
3307
|
-
}
|
|
3308
|
-
};
|
|
3309
|
-
},
|
|
3310
|
-
assignMedium: function(cb) {
|
|
3311
|
-
assigned = true;
|
|
3312
|
-
var pendingQueue = [];
|
|
3313
|
-
if (buffer.length) {
|
|
3314
|
-
var cbs = buffer;
|
|
3315
|
-
buffer = [];
|
|
3316
|
-
cbs.forEach(cb);
|
|
3317
|
-
pendingQueue = buffer;
|
|
3318
|
-
}
|
|
3319
|
-
var executeQueue = function() {
|
|
3320
|
-
var cbs2 = pendingQueue;
|
|
3321
|
-
pendingQueue = [];
|
|
3322
|
-
cbs2.forEach(cb);
|
|
3323
|
-
};
|
|
3324
|
-
var cycle = function() {
|
|
3325
|
-
return Promise.resolve().then(executeQueue);
|
|
3326
|
-
};
|
|
3327
|
-
cycle();
|
|
3328
|
-
buffer = {
|
|
3329
|
-
push: function(x) {
|
|
3330
|
-
pendingQueue.push(x);
|
|
3331
|
-
cycle();
|
|
3332
|
-
},
|
|
3333
|
-
filter: function(filter) {
|
|
3334
|
-
pendingQueue = pendingQueue.filter(filter);
|
|
3335
|
-
return buffer;
|
|
3336
|
-
}
|
|
3337
|
-
};
|
|
3338
|
-
}
|
|
1843
|
+
const ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => {
|
|
1844
|
+
if (!inst._zod)
|
|
1845
|
+
throw new Error("Uninitialized schema in ZodMiniType.");
|
|
1846
|
+
$ZodType.init(inst, def);
|
|
1847
|
+
inst.def = def;
|
|
1848
|
+
inst.type = def.type;
|
|
1849
|
+
inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
|
|
1850
|
+
inst.safeParse = (data, params) => safeParse(inst, data, params);
|
|
1851
|
+
inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
1852
|
+
inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
|
|
1853
|
+
inst.check = (...checks) => {
|
|
1854
|
+
return inst.clone({
|
|
1855
|
+
...def,
|
|
1856
|
+
checks: [
|
|
1857
|
+
...def.checks ?? [],
|
|
1858
|
+
...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
|
|
1859
|
+
]
|
|
1860
|
+
}, { parent: true });
|
|
3339
1861
|
};
|
|
3340
|
-
|
|
1862
|
+
inst.with = inst.check;
|
|
1863
|
+
inst.clone = (_def, params) => clone(inst, _def, params);
|
|
1864
|
+
inst.brand = () => inst;
|
|
1865
|
+
inst.register = ((reg, meta) => {
|
|
1866
|
+
reg.add(inst, meta);
|
|
1867
|
+
return inst;
|
|
1868
|
+
});
|
|
1869
|
+
inst.apply = (fn) => fn(inst);
|
|
1870
|
+
});
|
|
1871
|
+
const ZodMiniString = /* @__PURE__ */ $constructor("ZodMiniString", (inst, def) => {
|
|
1872
|
+
$ZodString.init(inst, def);
|
|
1873
|
+
ZodMiniType.init(inst, def);
|
|
1874
|
+
});
|
|
1875
|
+
// @__NO_SIDE_EFFECTS__
|
|
1876
|
+
function string(params) {
|
|
1877
|
+
return /* @__PURE__ */ _string(ZodMiniString);
|
|
3341
1878
|
}
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
return
|
|
1879
|
+
const ZodMiniBoolean = /* @__PURE__ */ $constructor("ZodMiniBoolean", (inst, def) => {
|
|
1880
|
+
$ZodBoolean.init(inst, def);
|
|
1881
|
+
ZodMiniType.init(inst, def);
|
|
1882
|
+
});
|
|
1883
|
+
// @__NO_SIDE_EFFECTS__
|
|
1884
|
+
function boolean(params) {
|
|
1885
|
+
return /* @__PURE__ */ _boolean(ZodMiniBoolean);
|
|
3349
1886
|
}
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
medium.useMedium(exported);
|
|
3364
|
-
return SideCar$1;
|
|
1887
|
+
const ZodMiniObject = /* @__PURE__ */ $constructor("ZodMiniObject", (inst, def) => {
|
|
1888
|
+
$ZodObject.init(inst, def);
|
|
1889
|
+
ZodMiniType.init(inst, def);
|
|
1890
|
+
defineLazy(inst, "shape", () => def.shape);
|
|
1891
|
+
});
|
|
1892
|
+
// @__NO_SIDE_EFFECTS__
|
|
1893
|
+
function object(shape, params) {
|
|
1894
|
+
const def = {
|
|
1895
|
+
type: "object",
|
|
1896
|
+
shape: shape ?? {},
|
|
1897
|
+
...normalizeParams()
|
|
1898
|
+
};
|
|
1899
|
+
return new ZodMiniObject(def);
|
|
3365
1900
|
}
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
};
|
|
3370
|
-
var RemoveScroll = React.forwardRef(function(props, parentRef) {
|
|
3371
|
-
var ref = React.useRef(null);
|
|
3372
|
-
var _a = React.useState({
|
|
3373
|
-
onScrollCapture: nothing,
|
|
3374
|
-
onWheelCapture: nothing,
|
|
3375
|
-
onTouchMoveCapture: nothing
|
|
3376
|
-
}), callbacks = _a[0], setCallbacks = _a[1];
|
|
3377
|
-
var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noRelative = props.noRelative, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? "div" : _b, gapMode = props.gapMode, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
|
|
3378
|
-
var SideCar2 = sideCar;
|
|
3379
|
-
var containerRef = useMergeRefs([ref, parentRef]);
|
|
3380
|
-
var containerProps = __assign(__assign({}, rest), callbacks);
|
|
3381
|
-
return React.createElement(
|
|
3382
|
-
React.Fragment,
|
|
3383
|
-
null,
|
|
3384
|
-
enabled && React.createElement(SideCar2, { sideCar: effectCar, removeScrollBar, shards, noRelative, noIsolation, inert, setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode }),
|
|
3385
|
-
forwardProps ? React.cloneElement(React.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef })) : React.createElement(Container, __assign({}, containerProps, { className, ref: containerRef }), children)
|
|
3386
|
-
);
|
|
1901
|
+
const ZodMiniDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodMiniDiscriminatedUnion", (inst, def) => {
|
|
1902
|
+
$ZodDiscriminatedUnion.init(inst, def);
|
|
1903
|
+
ZodMiniType.init(inst, def);
|
|
3387
1904
|
});
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
};
|
|
3397
|
-
var getNonce = function() {
|
|
3398
|
-
if (typeof __webpack_nonce__ !== "undefined") {
|
|
3399
|
-
return __webpack_nonce__;
|
|
3400
|
-
}
|
|
3401
|
-
return void 0;
|
|
3402
|
-
};
|
|
3403
|
-
function makeStyleTag() {
|
|
3404
|
-
if (!document)
|
|
3405
|
-
return null;
|
|
3406
|
-
var tag = document.createElement("style");
|
|
3407
|
-
tag.type = "text/css";
|
|
3408
|
-
var nonce = getNonce();
|
|
3409
|
-
if (nonce) {
|
|
3410
|
-
tag.setAttribute("nonce", nonce);
|
|
3411
|
-
}
|
|
3412
|
-
return tag;
|
|
1905
|
+
// @__NO_SIDE_EFFECTS__
|
|
1906
|
+
function discriminatedUnion(discriminator, options, params) {
|
|
1907
|
+
return new ZodMiniDiscriminatedUnion({
|
|
1908
|
+
type: "union",
|
|
1909
|
+
options,
|
|
1910
|
+
discriminator,
|
|
1911
|
+
...normalizeParams()
|
|
1912
|
+
});
|
|
3413
1913
|
}
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
1914
|
+
const ZodMiniRecord = /* @__PURE__ */ $constructor("ZodMiniRecord", (inst, def) => {
|
|
1915
|
+
$ZodRecord.init(inst, def);
|
|
1916
|
+
ZodMiniType.init(inst, def);
|
|
1917
|
+
});
|
|
1918
|
+
// @__NO_SIDE_EFFECTS__
|
|
1919
|
+
function record(keyType, valueType, params) {
|
|
1920
|
+
return new ZodMiniRecord({
|
|
1921
|
+
type: "record",
|
|
1922
|
+
keyType,
|
|
1923
|
+
valueType,
|
|
1924
|
+
...normalizeParams()
|
|
1925
|
+
});
|
|
3420
1926
|
}
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
1927
|
+
const ZodMiniLiteral = /* @__PURE__ */ $constructor("ZodMiniLiteral", (inst, def) => {
|
|
1928
|
+
$ZodLiteral.init(inst, def);
|
|
1929
|
+
ZodMiniType.init(inst, def);
|
|
1930
|
+
});
|
|
1931
|
+
// @__NO_SIDE_EFFECTS__
|
|
1932
|
+
function literal(value, params) {
|
|
1933
|
+
return new ZodMiniLiteral({
|
|
1934
|
+
type: "literal",
|
|
1935
|
+
values: Array.isArray(value) ? value : [value],
|
|
1936
|
+
...normalizeParams()
|
|
1937
|
+
});
|
|
3424
1938
|
}
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
useStyle(styles, dynamic);
|
|
3463
|
-
return null;
|
|
3464
|
-
};
|
|
3465
|
-
return Sheet;
|
|
3466
|
-
};
|
|
3467
|
-
var zeroGap = {
|
|
3468
|
-
left: 0,
|
|
3469
|
-
top: 0,
|
|
3470
|
-
right: 0,
|
|
3471
|
-
gap: 0
|
|
3472
|
-
};
|
|
3473
|
-
var parse = function(x) {
|
|
3474
|
-
return parseInt(x || "", 10) || 0;
|
|
3475
|
-
};
|
|
3476
|
-
var getOffset = function(gapMode) {
|
|
3477
|
-
var cs = window.getComputedStyle(document.body);
|
|
3478
|
-
var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
|
|
3479
|
-
var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
|
|
3480
|
-
var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
|
|
3481
|
-
return [parse(left), parse(top), parse(right)];
|
|
3482
|
-
};
|
|
3483
|
-
var getGapWidth = function(gapMode) {
|
|
3484
|
-
if (gapMode === void 0) {
|
|
3485
|
-
gapMode = "margin";
|
|
3486
|
-
}
|
|
3487
|
-
if (typeof window === "undefined") {
|
|
3488
|
-
return zeroGap;
|
|
3489
|
-
}
|
|
3490
|
-
var offsets = getOffset(gapMode);
|
|
3491
|
-
var documentWidth = document.documentElement.clientWidth;
|
|
3492
|
-
var windowWidth = window.innerWidth;
|
|
3493
|
-
return {
|
|
3494
|
-
left: offsets[0],
|
|
3495
|
-
top: offsets[1],
|
|
3496
|
-
right: offsets[2],
|
|
3497
|
-
gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0])
|
|
3498
|
-
};
|
|
3499
|
-
};
|
|
3500
|
-
var Style = styleSingleton();
|
|
3501
|
-
var lockAttribute = "data-scroll-locked";
|
|
3502
|
-
var getStyles = function(_a, allowRelative, gapMode, important) {
|
|
3503
|
-
var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
|
|
3504
|
-
if (gapMode === void 0) {
|
|
3505
|
-
gapMode = "margin";
|
|
3506
|
-
}
|
|
3507
|
-
return "\n .".concat(noScrollbarsClassName, " {\n overflow: hidden ").concat(important, ";\n padding-right: ").concat(gap, "px ").concat(important, ";\n }\n body[").concat(lockAttribute, "] {\n overflow: hidden ").concat(important, ";\n overscroll-behavior: contain;\n ").concat([
|
|
3508
|
-
allowRelative && "position: relative ".concat(important, ";"),
|
|
3509
|
-
gapMode === "margin" && "\n padding-left: ".concat(left, "px;\n padding-top: ").concat(top, "px;\n padding-right: ").concat(right, "px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(gap, "px ").concat(important, ";\n "),
|
|
3510
|
-
gapMode === "padding" && "padding-right: ".concat(gap, "px ").concat(important, ";")
|
|
3511
|
-
].filter(Boolean).join(""), "\n }\n \n .").concat(zeroRightClassName, " {\n right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " {\n margin-right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(zeroRightClassName, " .").concat(zeroRightClassName, " {\n right: 0 ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " .").concat(fullWidthClassName, " {\n margin-right: 0 ").concat(important, ";\n }\n \n body[").concat(lockAttribute, "] {\n ").concat(removedBarSizeVariable, ": ").concat(gap, "px;\n }\n");
|
|
3512
|
-
};
|
|
3513
|
-
var getCurrentUseCounter = function() {
|
|
3514
|
-
var counter = parseInt(document.body.getAttribute(lockAttribute) || "0", 10);
|
|
3515
|
-
return isFinite(counter) ? counter : 0;
|
|
3516
|
-
};
|
|
3517
|
-
var useLockAttribute = function() {
|
|
3518
|
-
React.useEffect(function() {
|
|
3519
|
-
document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
|
|
3520
|
-
return function() {
|
|
3521
|
-
var newCounter = getCurrentUseCounter() - 1;
|
|
3522
|
-
if (newCounter <= 0) {
|
|
3523
|
-
document.body.removeAttribute(lockAttribute);
|
|
3524
|
-
} else {
|
|
3525
|
-
document.body.setAttribute(lockAttribute, newCounter.toString());
|
|
3526
|
-
}
|
|
3527
|
-
};
|
|
3528
|
-
}, []);
|
|
3529
|
-
};
|
|
3530
|
-
var RemoveScrollBar = function(_a) {
|
|
3531
|
-
var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? "margin" : _b;
|
|
3532
|
-
useLockAttribute();
|
|
3533
|
-
var gap = React.useMemo(function() {
|
|
3534
|
-
return getGapWidth(gapMode);
|
|
3535
|
-
}, [gapMode]);
|
|
3536
|
-
return React.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? "!important" : "") });
|
|
1939
|
+
const ZodMiniOptional = /* @__PURE__ */ $constructor("ZodMiniOptional", (inst, def) => {
|
|
1940
|
+
$ZodOptional.init(inst, def);
|
|
1941
|
+
ZodMiniType.init(inst, def);
|
|
1942
|
+
});
|
|
1943
|
+
// @__NO_SIDE_EFFECTS__
|
|
1944
|
+
function optional(innerType) {
|
|
1945
|
+
return new ZodMiniOptional({
|
|
1946
|
+
type: "optional",
|
|
1947
|
+
innerType
|
|
1948
|
+
});
|
|
1949
|
+
}
|
|
1950
|
+
const remoteScriptDefinitionSchema = /* @__PURE__ */ object({
|
|
1951
|
+
variant: /* @__PURE__ */ literal("remote"),
|
|
1952
|
+
type: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
|
|
1953
|
+
src: /* @__PURE__ */ string(),
|
|
1954
|
+
async: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
1955
|
+
defer: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
1956
|
+
crossorigin: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
|
|
1957
|
+
integrity: /* @__PURE__ */ optional(/* @__PURE__ */ string())
|
|
1958
|
+
});
|
|
1959
|
+
const inlineScriptDefinitionSchema = /* @__PURE__ */ object({
|
|
1960
|
+
variant: /* @__PURE__ */ literal("inline"),
|
|
1961
|
+
type: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
|
|
1962
|
+
async: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
1963
|
+
defer: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
1964
|
+
content: /* @__PURE__ */ string()
|
|
1965
|
+
});
|
|
1966
|
+
const scriptDefinitionSchema = /* @__PURE__ */ discriminatedUnion("variant", [
|
|
1967
|
+
remoteScriptDefinitionSchema,
|
|
1968
|
+
inlineScriptDefinitionSchema
|
|
1969
|
+
]);
|
|
1970
|
+
const root = "_root_dibqz_1";
|
|
1971
|
+
const thumb = "_thumb_dibqz_38";
|
|
1972
|
+
const classes = {
|
|
1973
|
+
root,
|
|
1974
|
+
"switch": "_switch_dibqz_8",
|
|
1975
|
+
thumb
|
|
3537
1976
|
};
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
passiveSupported = true;
|
|
3544
|
-
return true;
|
|
3545
|
-
}
|
|
3546
|
-
});
|
|
3547
|
-
window.addEventListener("test", options, options);
|
|
3548
|
-
window.removeEventListener("test", options, options);
|
|
3549
|
-
} catch (err) {
|
|
3550
|
-
passiveSupported = false;
|
|
3551
|
-
}
|
|
3552
|
-
}
|
|
3553
|
-
var nonPassive = passiveSupported ? { passive: false } : false;
|
|
3554
|
-
var alwaysContainsScroll = function(node) {
|
|
3555
|
-
return node.tagName === "TEXTAREA";
|
|
1977
|
+
const Switch = ({ label: label2, id, ...rest }) => {
|
|
1978
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: classes.root, children: [
|
|
1979
|
+
label2 && /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: classes.label, as: "label", htmlFor: id, children: label2 }),
|
|
1980
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Root, { className: classes.switch, ...rest, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Thumb, { className: classes.thumb }) })
|
|
1981
|
+
] });
|
|
3556
1982
|
};
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
1983
|
+
const selectionSchema = /* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ boolean());
|
|
1984
|
+
const SelectionContext = createContext(null);
|
|
1985
|
+
const SelectionProvider = ({
|
|
1986
|
+
children,
|
|
1987
|
+
items,
|
|
1988
|
+
localStorageKey
|
|
1989
|
+
}) => {
|
|
1990
|
+
function getLsSelection(localStorageKey2) {
|
|
1991
|
+
const storedSelection = localStorage.getItem(localStorageKey2);
|
|
1992
|
+
if (!storedSelection) return null;
|
|
1993
|
+
const { success, data } = selectionSchema.safeParse(
|
|
1994
|
+
JSON.parse(storedSelection)
|
|
1995
|
+
);
|
|
1996
|
+
if (!success) return null;
|
|
1997
|
+
return data;
|
|
3560
1998
|
}
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
1999
|
+
const defaultSelection = useMemo(
|
|
2000
|
+
() => Object.fromEntries(
|
|
2001
|
+
items.map((item) => [item.value, item.defaultSelected ?? false])
|
|
2002
|
+
),
|
|
2003
|
+
[items]
|
|
3566
2004
|
);
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
return elementCanBeScrolled(node, "overflowY");
|
|
3570
|
-
};
|
|
3571
|
-
var elementCouldBeHScrolled = function(node) {
|
|
3572
|
-
return elementCanBeScrolled(node, "overflowX");
|
|
3573
|
-
};
|
|
3574
|
-
var locationCouldBeScrolled = function(axis, node) {
|
|
3575
|
-
var ownerDocument = node.ownerDocument;
|
|
3576
|
-
var current = node;
|
|
3577
|
-
do {
|
|
3578
|
-
if (typeof ShadowRoot !== "undefined" && current instanceof ShadowRoot) {
|
|
3579
|
-
current = current.host;
|
|
3580
|
-
}
|
|
3581
|
-
var isScrollable = elementCouldBeScrolled(axis, current);
|
|
3582
|
-
if (isScrollable) {
|
|
3583
|
-
var _a = getScrollVariables(axis, current), scrollHeight = _a[1], clientHeight = _a[2];
|
|
3584
|
-
if (scrollHeight > clientHeight) {
|
|
3585
|
-
return true;
|
|
3586
|
-
}
|
|
3587
|
-
}
|
|
3588
|
-
current = current.parentNode;
|
|
3589
|
-
} while (current && current !== ownerDocument.body);
|
|
3590
|
-
return false;
|
|
3591
|
-
};
|
|
3592
|
-
var getVScrollVariables = function(_a) {
|
|
3593
|
-
var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
|
|
3594
|
-
return [
|
|
3595
|
-
scrollTop,
|
|
3596
|
-
scrollHeight,
|
|
3597
|
-
clientHeight
|
|
3598
|
-
];
|
|
3599
|
-
};
|
|
3600
|
-
var getHScrollVariables = function(_a) {
|
|
3601
|
-
var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
|
|
3602
|
-
return [
|
|
3603
|
-
scrollLeft,
|
|
3604
|
-
scrollWidth,
|
|
3605
|
-
clientWidth
|
|
3606
|
-
];
|
|
3607
|
-
};
|
|
3608
|
-
var elementCouldBeScrolled = function(axis, node) {
|
|
3609
|
-
return axis === "v" ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
|
|
3610
|
-
};
|
|
3611
|
-
var getScrollVariables = function(axis, node) {
|
|
3612
|
-
return axis === "v" ? getVScrollVariables(node) : getHScrollVariables(node);
|
|
3613
|
-
};
|
|
3614
|
-
var getDirectionFactor = function(axis, direction) {
|
|
3615
|
-
return axis === "h" && direction === "rtl" ? -1 : 1;
|
|
3616
|
-
};
|
|
3617
|
-
var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
|
|
3618
|
-
var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
|
|
3619
|
-
var delta = directionFactor * sourceDelta;
|
|
3620
|
-
var target = event.target;
|
|
3621
|
-
var targetInLock = endTarget.contains(target);
|
|
3622
|
-
var shouldCancelScroll = false;
|
|
3623
|
-
var isDeltaPositive = delta > 0;
|
|
3624
|
-
var availableScroll = 0;
|
|
3625
|
-
var availableScrollTop = 0;
|
|
3626
|
-
do {
|
|
3627
|
-
if (!target) {
|
|
3628
|
-
break;
|
|
3629
|
-
}
|
|
3630
|
-
var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
|
|
3631
|
-
var elementScroll = scroll_1 - capacity - directionFactor * position;
|
|
3632
|
-
if (position || elementScroll) {
|
|
3633
|
-
if (elementCouldBeScrolled(axis, target)) {
|
|
3634
|
-
availableScroll += elementScroll;
|
|
3635
|
-
availableScrollTop += position;
|
|
3636
|
-
}
|
|
3637
|
-
}
|
|
3638
|
-
var parent_1 = target.parentNode;
|
|
3639
|
-
target = parent_1 && parent_1.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? parent_1.host : parent_1;
|
|
3640
|
-
} while (
|
|
3641
|
-
// portaled content
|
|
3642
|
-
!targetInLock && target !== document.body || // self content
|
|
3643
|
-
targetInLock && (endTarget.contains(target) || endTarget === target)
|
|
2005
|
+
const [selection, setSelection] = useState(
|
|
2006
|
+
getLsSelection(localStorageKey) ?? defaultSelection
|
|
3644
2007
|
);
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
} else if (!isDeltaPositive && (Math.abs(availableScrollTop) < 1 || false)) {
|
|
3648
|
-
shouldCancelScroll = true;
|
|
3649
|
-
}
|
|
3650
|
-
return shouldCancelScroll;
|
|
3651
|
-
};
|
|
3652
|
-
var getTouchXY = function(event) {
|
|
3653
|
-
return "changedTouches" in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
|
|
3654
|
-
};
|
|
3655
|
-
var getDeltaXY = function(event) {
|
|
3656
|
-
return [event.deltaX, event.deltaY];
|
|
3657
|
-
};
|
|
3658
|
-
var extractRef = function(ref) {
|
|
3659
|
-
return ref && "current" in ref ? ref.current : ref;
|
|
3660
|
-
};
|
|
3661
|
-
var deltaCompare = function(x, y) {
|
|
3662
|
-
return x[0] === y[0] && x[1] === y[1];
|
|
3663
|
-
};
|
|
3664
|
-
var generateStyle = function(id) {
|
|
3665
|
-
return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n");
|
|
3666
|
-
};
|
|
3667
|
-
var idCounter = 0;
|
|
3668
|
-
var lockStack = [];
|
|
3669
|
-
function RemoveScrollSideCar(props) {
|
|
3670
|
-
var shouldPreventQueue = React.useRef([]);
|
|
3671
|
-
var touchStartRef = React.useRef([0, 0]);
|
|
3672
|
-
var activeAxis = React.useRef();
|
|
3673
|
-
var id = React.useState(idCounter++)[0];
|
|
3674
|
-
var Style2 = React.useState(styleSingleton)[0];
|
|
3675
|
-
var lastProps = React.useRef(props);
|
|
3676
|
-
React.useEffect(function() {
|
|
3677
|
-
lastProps.current = props;
|
|
3678
|
-
}, [props]);
|
|
3679
|
-
React.useEffect(function() {
|
|
3680
|
-
if (props.inert) {
|
|
3681
|
-
document.body.classList.add("block-interactivity-".concat(id));
|
|
3682
|
-
var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);
|
|
3683
|
-
allow_1.forEach(function(el) {
|
|
3684
|
-
return el.classList.add("allow-interactivity-".concat(id));
|
|
3685
|
-
});
|
|
3686
|
-
return function() {
|
|
3687
|
-
document.body.classList.remove("block-interactivity-".concat(id));
|
|
3688
|
-
allow_1.forEach(function(el) {
|
|
3689
|
-
return el.classList.remove("allow-interactivity-".concat(id));
|
|
3690
|
-
});
|
|
3691
|
-
};
|
|
3692
|
-
}
|
|
3693
|
-
return;
|
|
3694
|
-
}, [props.inert, props.lockRef.current, props.shards]);
|
|
3695
|
-
var shouldCancelEvent = React.useCallback(function(event, parent) {
|
|
3696
|
-
if ("touches" in event && event.touches.length === 2 || event.type === "wheel" && event.ctrlKey) {
|
|
3697
|
-
return !lastProps.current.allowPinchZoom;
|
|
3698
|
-
}
|
|
3699
|
-
var touch = getTouchXY(event);
|
|
3700
|
-
var touchStart = touchStartRef.current;
|
|
3701
|
-
var deltaX = "deltaX" in event ? event.deltaX : touchStart[0] - touch[0];
|
|
3702
|
-
var deltaY = "deltaY" in event ? event.deltaY : touchStart[1] - touch[1];
|
|
3703
|
-
var currentAxis;
|
|
3704
|
-
var target = event.target;
|
|
3705
|
-
var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? "h" : "v";
|
|
3706
|
-
if ("touches" in event && moveDirection === "h" && target.type === "range") {
|
|
3707
|
-
return false;
|
|
3708
|
-
}
|
|
3709
|
-
var selection = window.getSelection();
|
|
3710
|
-
var anchorNode = selection && selection.anchorNode;
|
|
3711
|
-
var isTouchingSelection = anchorNode ? anchorNode === target || anchorNode.contains(target) : false;
|
|
3712
|
-
if (isTouchingSelection) {
|
|
3713
|
-
return false;
|
|
3714
|
-
}
|
|
3715
|
-
var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
3716
|
-
if (!canBeScrolledInMainDirection) {
|
|
3717
|
-
return true;
|
|
3718
|
-
}
|
|
3719
|
-
if (canBeScrolledInMainDirection) {
|
|
3720
|
-
currentAxis = moveDirection;
|
|
3721
|
-
} else {
|
|
3722
|
-
currentAxis = moveDirection === "v" ? "h" : "v";
|
|
3723
|
-
canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
3724
|
-
}
|
|
3725
|
-
if (!canBeScrolledInMainDirection) {
|
|
3726
|
-
return false;
|
|
3727
|
-
}
|
|
3728
|
-
if (!activeAxis.current && "changedTouches" in event && (deltaX || deltaY)) {
|
|
3729
|
-
activeAxis.current = currentAxis;
|
|
3730
|
-
}
|
|
3731
|
-
if (!currentAxis) {
|
|
3732
|
-
return true;
|
|
3733
|
-
}
|
|
3734
|
-
var cancelingAxis = activeAxis.current || currentAxis;
|
|
3735
|
-
return handleScroll(cancelingAxis, parent, event, cancelingAxis === "h" ? deltaX : deltaY);
|
|
3736
|
-
}, []);
|
|
3737
|
-
var shouldPrevent = React.useCallback(function(_event) {
|
|
3738
|
-
var event = _event;
|
|
3739
|
-
if (!lockStack.length || lockStack[lockStack.length - 1] !== Style2) {
|
|
3740
|
-
return;
|
|
3741
|
-
}
|
|
3742
|
-
var delta = "deltaY" in event ? getDeltaXY(event) : getTouchXY(event);
|
|
3743
|
-
var sourceEvent = shouldPreventQueue.current.filter(function(e) {
|
|
3744
|
-
return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta);
|
|
3745
|
-
})[0];
|
|
3746
|
-
if (sourceEvent && sourceEvent.should) {
|
|
3747
|
-
if (event.cancelable) {
|
|
3748
|
-
event.preventDefault();
|
|
3749
|
-
}
|
|
3750
|
-
return;
|
|
3751
|
-
}
|
|
3752
|
-
if (!sourceEvent) {
|
|
3753
|
-
var shardNodes = (lastProps.current.shards || []).map(extractRef).filter(Boolean).filter(function(node) {
|
|
3754
|
-
return node.contains(event.target);
|
|
3755
|
-
});
|
|
3756
|
-
var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
|
|
3757
|
-
if (shouldStop) {
|
|
3758
|
-
if (event.cancelable) {
|
|
3759
|
-
event.preventDefault();
|
|
3760
|
-
}
|
|
3761
|
-
}
|
|
3762
|
-
}
|
|
3763
|
-
}, []);
|
|
3764
|
-
var shouldCancel = React.useCallback(function(name, delta, target, should) {
|
|
3765
|
-
var event = { name, delta, target, should, shadowParent: getOutermostShadowParent(target) };
|
|
3766
|
-
shouldPreventQueue.current.push(event);
|
|
3767
|
-
setTimeout(function() {
|
|
3768
|
-
shouldPreventQueue.current = shouldPreventQueue.current.filter(function(e) {
|
|
3769
|
-
return e !== event;
|
|
3770
|
-
});
|
|
3771
|
-
}, 1);
|
|
3772
|
-
}, []);
|
|
3773
|
-
var scrollTouchStart = React.useCallback(function(event) {
|
|
3774
|
-
touchStartRef.current = getTouchXY(event);
|
|
3775
|
-
activeAxis.current = void 0;
|
|
3776
|
-
}, []);
|
|
3777
|
-
var scrollWheel = React.useCallback(function(event) {
|
|
3778
|
-
shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
3779
|
-
}, []);
|
|
3780
|
-
var scrollTouchMove = React.useCallback(function(event) {
|
|
3781
|
-
shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
3782
|
-
}, []);
|
|
3783
|
-
React.useEffect(function() {
|
|
3784
|
-
lockStack.push(Style2);
|
|
3785
|
-
props.setCallbacks({
|
|
3786
|
-
onScrollCapture: scrollWheel,
|
|
3787
|
-
onWheelCapture: scrollWheel,
|
|
3788
|
-
onTouchMoveCapture: scrollTouchMove
|
|
3789
|
-
});
|
|
3790
|
-
document.addEventListener("wheel", shouldPrevent, nonPassive);
|
|
3791
|
-
document.addEventListener("touchmove", shouldPrevent, nonPassive);
|
|
3792
|
-
document.addEventListener("touchstart", scrollTouchStart, nonPassive);
|
|
3793
|
-
return function() {
|
|
3794
|
-
lockStack = lockStack.filter(function(inst) {
|
|
3795
|
-
return inst !== Style2;
|
|
3796
|
-
});
|
|
3797
|
-
document.removeEventListener("wheel", shouldPrevent, nonPassive);
|
|
3798
|
-
document.removeEventListener("touchmove", shouldPrevent, nonPassive);
|
|
3799
|
-
document.removeEventListener("touchstart", scrollTouchStart, nonPassive);
|
|
3800
|
-
};
|
|
3801
|
-
}, []);
|
|
3802
|
-
var removeScrollBar = props.removeScrollBar, inert = props.inert;
|
|
3803
|
-
return React.createElement(
|
|
3804
|
-
React.Fragment,
|
|
3805
|
-
null,
|
|
3806
|
-
inert ? React.createElement(Style2, { styles: generateStyle(id) }) : null,
|
|
3807
|
-
removeScrollBar ? React.createElement(RemoveScrollBar, { noRelative: props.noRelative, gapMode: props.gapMode }) : null
|
|
2008
|
+
const [savedSelection, setSavedSelection] = useState(
|
|
2009
|
+
getLsSelection(localStorageKey)
|
|
3808
2010
|
);
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
while (node !== null) {
|
|
3813
|
-
if (node instanceof ShadowRoot) {
|
|
3814
|
-
shadowParent = node.host;
|
|
3815
|
-
node = node.host;
|
|
3816
|
-
}
|
|
3817
|
-
node = node.parentNode;
|
|
3818
|
-
}
|
|
3819
|
-
return shadowParent;
|
|
3820
|
-
}
|
|
3821
|
-
const SideCar = exportSidecar(effectCar, RemoveScrollSideCar);
|
|
3822
|
-
var ReactRemoveScroll = React.forwardRef(function(props, ref) {
|
|
3823
|
-
return React.createElement(RemoveScroll, __assign({}, props, { ref, sideCar: SideCar }));
|
|
3824
|
-
});
|
|
3825
|
-
ReactRemoveScroll.classNames = RemoveScroll.classNames;
|
|
3826
|
-
var getDefaultParent = function(originalTarget) {
|
|
3827
|
-
if (typeof document === "undefined") {
|
|
3828
|
-
return null;
|
|
3829
|
-
}
|
|
3830
|
-
var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
|
|
3831
|
-
return sampleTarget.ownerDocument.body;
|
|
3832
|
-
};
|
|
3833
|
-
var counterMap = /* @__PURE__ */ new WeakMap();
|
|
3834
|
-
var uncontrolledNodes = /* @__PURE__ */ new WeakMap();
|
|
3835
|
-
var markerMap = {};
|
|
3836
|
-
var lockCount = 0;
|
|
3837
|
-
var unwrapHost = function(node) {
|
|
3838
|
-
return node && (node.host || unwrapHost(node.parentNode));
|
|
3839
|
-
};
|
|
3840
|
-
var correctTargets = function(parent, targets) {
|
|
3841
|
-
return targets.map(function(target) {
|
|
3842
|
-
if (parent.contains(target)) {
|
|
3843
|
-
return target;
|
|
3844
|
-
}
|
|
3845
|
-
var correctedTarget = unwrapHost(target);
|
|
3846
|
-
if (correctedTarget && parent.contains(correctedTarget)) {
|
|
3847
|
-
return correctedTarget;
|
|
3848
|
-
}
|
|
3849
|
-
console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing");
|
|
3850
|
-
return null;
|
|
3851
|
-
}).filter(function(x) {
|
|
3852
|
-
return Boolean(x);
|
|
3853
|
-
});
|
|
3854
|
-
};
|
|
3855
|
-
var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) {
|
|
3856
|
-
var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
3857
|
-
if (!markerMap[markerName]) {
|
|
3858
|
-
markerMap[markerName] = /* @__PURE__ */ new WeakMap();
|
|
2011
|
+
function toggleSelection(key, value) {
|
|
2012
|
+
const newSelection = selection ? { ...selection, [key]: value } : { [key]: value };
|
|
2013
|
+
setSelection(newSelection);
|
|
3859
2014
|
}
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
var keep = function(el) {
|
|
3865
|
-
if (!el || elementsToKeep.has(el)) {
|
|
3866
|
-
return;
|
|
2015
|
+
useEffect(() => {
|
|
2016
|
+
let selectedValues = [];
|
|
2017
|
+
if (savedSelection !== null) {
|
|
2018
|
+
selectedValues = Object.entries(savedSelection).filter(([_, value]) => value).map(([key]) => key);
|
|
3867
2019
|
}
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
2020
|
+
const mountedItems = items.filter(
|
|
2021
|
+
(item) => selectedValues.includes(item.value)
|
|
2022
|
+
);
|
|
2023
|
+
for (const item of items) {
|
|
2024
|
+
const elem = document.head.querySelector(`#${item.value}`);
|
|
2025
|
+
if (!elem) continue;
|
|
2026
|
+
elem.remove();
|
|
3875
2027
|
}
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
var counterValue = (counterMap.get(node) || 0) + 1;
|
|
3884
|
-
var markerValue = (markerCounter.get(node) || 0) + 1;
|
|
3885
|
-
counterMap.set(node, counterValue);
|
|
3886
|
-
markerCounter.set(node, markerValue);
|
|
3887
|
-
hiddenNodes.push(node);
|
|
3888
|
-
if (counterValue === 1 && alreadyHidden) {
|
|
3889
|
-
uncontrolledNodes.set(node, true);
|
|
3890
|
-
}
|
|
3891
|
-
if (markerValue === 1) {
|
|
3892
|
-
node.setAttribute(markerName, "true");
|
|
3893
|
-
}
|
|
3894
|
-
if (!alreadyHidden) {
|
|
3895
|
-
node.setAttribute(controlAttribute, "true");
|
|
3896
|
-
}
|
|
3897
|
-
} catch (e) {
|
|
3898
|
-
console.error("aria-hidden: cannot operate on ", node, e);
|
|
3899
|
-
}
|
|
2028
|
+
for (const item of mountedItems) {
|
|
2029
|
+
const elem = document.createElement("script");
|
|
2030
|
+
elem.id = item.value;
|
|
2031
|
+
if (!item.script) {
|
|
2032
|
+
if (!item.required)
|
|
2033
|
+
console.warn("CookieBanner: Missing script for", item.value);
|
|
2034
|
+
continue;
|
|
3900
2035
|
}
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
counterMap.set(node, counterValue);
|
|
3911
|
-
markerCounter.set(node, markerValue);
|
|
3912
|
-
if (!counterValue) {
|
|
3913
|
-
if (!uncontrolledNodes.has(node)) {
|
|
3914
|
-
node.removeAttribute(controlAttribute);
|
|
3915
|
-
}
|
|
3916
|
-
uncontrolledNodes.delete(node);
|
|
2036
|
+
const { success, data: script } = scriptDefinitionSchema.safeParse(
|
|
2037
|
+
item.script
|
|
2038
|
+
);
|
|
2039
|
+
if (!success) {
|
|
2040
|
+
console.error(
|
|
2041
|
+
"CookieBanner: Invalid script definition for",
|
|
2042
|
+
item.value
|
|
2043
|
+
);
|
|
2044
|
+
continue;
|
|
3917
2045
|
}
|
|
3918
|
-
|
|
3919
|
-
|
|
2046
|
+
elem.type = script.type ?? "text/javascript";
|
|
2047
|
+
elem.async = script.async ?? false;
|
|
2048
|
+
elem.defer = script.defer ?? false;
|
|
2049
|
+
switch (script.variant) {
|
|
2050
|
+
case "inline":
|
|
2051
|
+
elem.textContent = script.content;
|
|
2052
|
+
break;
|
|
2053
|
+
case "remote":
|
|
2054
|
+
elem.src = script.src;
|
|
2055
|
+
elem.crossOrigin = script.crossorigin ?? null;
|
|
2056
|
+
elem.integrity = script.integrity ?? "";
|
|
2057
|
+
break;
|
|
3920
2058
|
}
|
|
3921
|
-
|
|
3922
|
-
lockCount--;
|
|
3923
|
-
if (!lockCount) {
|
|
3924
|
-
counterMap = /* @__PURE__ */ new WeakMap();
|
|
3925
|
-
counterMap = /* @__PURE__ */ new WeakMap();
|
|
3926
|
-
uncontrolledNodes = /* @__PURE__ */ new WeakMap();
|
|
3927
|
-
markerMap = {};
|
|
2059
|
+
document.head.appendChild(elem);
|
|
3928
2060
|
}
|
|
3929
|
-
};
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
markerName = "data-aria-hidden";
|
|
3934
|
-
}
|
|
3935
|
-
var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
3936
|
-
var activeParentNode = getDefaultParent(originalTarget);
|
|
3937
|
-
if (!activeParentNode) {
|
|
3938
|
-
return function() {
|
|
3939
|
-
return null;
|
|
3940
|
-
};
|
|
2061
|
+
}, [savedSelection, items]);
|
|
2062
|
+
function saveSelection(newSelection) {
|
|
2063
|
+
setSavedSelection(newSelection);
|
|
2064
|
+
localStorage.setItem(localStorageKey, JSON.stringify(newSelection));
|
|
3941
2065
|
}
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
const {
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
const contentRef = React.useRef(null);
|
|
3959
|
-
const [open2, setOpen] = useControllableState({
|
|
3960
|
-
prop: openProp,
|
|
3961
|
-
defaultProp: defaultOpen ?? false,
|
|
3962
|
-
onChange: onOpenChange,
|
|
3963
|
-
caller: DIALOG_NAME
|
|
3964
|
-
});
|
|
2066
|
+
const onDeclineAll = useCallback(() => {
|
|
2067
|
+
const newSelection = Object.fromEntries(
|
|
2068
|
+
items.map((item) => [item.value, false])
|
|
2069
|
+
);
|
|
2070
|
+
setSelection(newSelection);
|
|
2071
|
+
saveSelection(newSelection);
|
|
2072
|
+
}, [items]);
|
|
2073
|
+
const onSave = useCallback(() => {
|
|
2074
|
+
saveSelection(selection);
|
|
2075
|
+
}, [selection]);
|
|
2076
|
+
const selectionTaken = useMemo(() => {
|
|
2077
|
+
if (!savedSelection) return false;
|
|
2078
|
+
const selectedKeys = Object.keys(savedSelection);
|
|
2079
|
+
const itemKeys = items.map((item) => item.value);
|
|
2080
|
+
return itemKeys.every((key) => selectedKeys.includes(key));
|
|
2081
|
+
}, [savedSelection, items]);
|
|
3965
2082
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3966
|
-
|
|
2083
|
+
SelectionContext.Provider,
|
|
3967
2084
|
{
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
onOpenChange: setOpen,
|
|
3976
|
-
onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
3977
|
-
modal,
|
|
2085
|
+
value: {
|
|
2086
|
+
selection,
|
|
2087
|
+
toggleSelection,
|
|
2088
|
+
onDeclineAll,
|
|
2089
|
+
onSave,
|
|
2090
|
+
selectionTaken
|
|
2091
|
+
},
|
|
3978
2092
|
children
|
|
3979
2093
|
}
|
|
3980
2094
|
);
|
|
3981
2095
|
};
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
const { __scopeDialog, ...triggerProps } = props;
|
|
3987
|
-
const context = useDialogContext(TRIGGER_NAME, __scopeDialog);
|
|
3988
|
-
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
3989
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3990
|
-
Primitive.button,
|
|
3991
|
-
{
|
|
3992
|
-
type: "button",
|
|
3993
|
-
"aria-haspopup": "dialog",
|
|
3994
|
-
"aria-expanded": context.open,
|
|
3995
|
-
"aria-controls": context.contentId,
|
|
3996
|
-
"data-state": getState(context.open),
|
|
3997
|
-
...triggerProps,
|
|
3998
|
-
ref: composedTriggerRef,
|
|
3999
|
-
onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
|
|
4000
|
-
}
|
|
4001
|
-
);
|
|
4002
|
-
}
|
|
4003
|
-
);
|
|
4004
|
-
DialogTrigger.displayName = TRIGGER_NAME;
|
|
4005
|
-
var PORTAL_NAME = "DialogPortal";
|
|
4006
|
-
var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME, {
|
|
4007
|
-
forceMount: void 0
|
|
4008
|
-
});
|
|
4009
|
-
var OVERLAY_NAME = "DialogOverlay";
|
|
4010
|
-
var DialogOverlay = React.forwardRef(
|
|
4011
|
-
(props, forwardedRef) => {
|
|
4012
|
-
const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);
|
|
4013
|
-
const { forceMount = portalContext.forceMount, ...overlayProps } = props;
|
|
4014
|
-
const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);
|
|
4015
|
-
return context.modal ? /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntimeExports.jsx(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;
|
|
4016
|
-
}
|
|
4017
|
-
);
|
|
4018
|
-
DialogOverlay.displayName = OVERLAY_NAME;
|
|
4019
|
-
var Slot = /* @__PURE__ */ createSlot("DialogOverlay.RemoveScroll");
|
|
4020
|
-
var DialogOverlayImpl = React.forwardRef(
|
|
4021
|
-
(props, forwardedRef) => {
|
|
4022
|
-
const { __scopeDialog, ...overlayProps } = props;
|
|
4023
|
-
const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
|
|
4024
|
-
return (
|
|
4025
|
-
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
|
|
4026
|
-
// ie. when `Overlay` and `Content` are siblings
|
|
4027
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ReactRemoveScroll, { as: Slot, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4028
|
-
Primitive.div,
|
|
4029
|
-
{
|
|
4030
|
-
"data-state": getState(context.open),
|
|
4031
|
-
...overlayProps,
|
|
4032
|
-
ref: forwardedRef,
|
|
4033
|
-
style: { pointerEvents: "auto", ...overlayProps.style }
|
|
4034
|
-
}
|
|
4035
|
-
) })
|
|
4036
|
-
);
|
|
4037
|
-
}
|
|
4038
|
-
);
|
|
4039
|
-
var CONTENT_NAME = "DialogContent";
|
|
4040
|
-
var DialogContent = React.forwardRef(
|
|
4041
|
-
(props, forwardedRef) => {
|
|
4042
|
-
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);
|
|
4043
|
-
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
4044
|
-
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
4045
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsxRuntimeExports.jsx(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsxRuntimeExports.jsx(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });
|
|
4046
|
-
}
|
|
4047
|
-
);
|
|
4048
|
-
DialogContent.displayName = CONTENT_NAME;
|
|
4049
|
-
var DialogContentModal = React.forwardRef(
|
|
4050
|
-
(props, forwardedRef) => {
|
|
4051
|
-
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
4052
|
-
const contentRef = React.useRef(null);
|
|
4053
|
-
const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
|
|
4054
|
-
React.useEffect(() => {
|
|
4055
|
-
const content = contentRef.current;
|
|
4056
|
-
if (content) return hideOthers(content);
|
|
4057
|
-
}, []);
|
|
4058
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4059
|
-
DialogContentImpl,
|
|
4060
|
-
{
|
|
4061
|
-
...props,
|
|
4062
|
-
ref: composedRefs,
|
|
4063
|
-
trapFocus: context.open,
|
|
4064
|
-
disableOutsidePointerEvents: true,
|
|
4065
|
-
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
4066
|
-
event.preventDefault();
|
|
4067
|
-
context.triggerRef.current?.focus();
|
|
4068
|
-
}),
|
|
4069
|
-
onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
|
|
4070
|
-
const originalEvent = event.detail.originalEvent;
|
|
4071
|
-
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
4072
|
-
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
4073
|
-
if (isRightClick) event.preventDefault();
|
|
4074
|
-
}),
|
|
4075
|
-
onFocusOutside: composeEventHandlers(
|
|
4076
|
-
props.onFocusOutside,
|
|
4077
|
-
(event) => event.preventDefault()
|
|
4078
|
-
)
|
|
4079
|
-
}
|
|
4080
|
-
);
|
|
2096
|
+
function useSelection() {
|
|
2097
|
+
const context = useContext(SelectionContext);
|
|
2098
|
+
if (!context) {
|
|
2099
|
+
throw new Error("useSelection must be used within a SelectionProvider");
|
|
4081
2100
|
}
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
2101
|
+
return context;
|
|
2102
|
+
}
|
|
2103
|
+
const BannerItem = ({
|
|
2104
|
+
value,
|
|
2105
|
+
label: label2,
|
|
2106
|
+
sublabel,
|
|
2107
|
+
required = false,
|
|
2108
|
+
description: description2,
|
|
2109
|
+
openItem
|
|
2110
|
+
}) => {
|
|
2111
|
+
const { toggleSelection, selection } = useSelection();
|
|
2112
|
+
const selected = useMemo(
|
|
2113
|
+
() => selection?.[value] ?? false,
|
|
2114
|
+
[selection, value]
|
|
2115
|
+
);
|
|
2116
|
+
useEffect(() => {
|
|
2117
|
+
toggleSelection(value, selected);
|
|
2118
|
+
}, [value, selected]);
|
|
2119
|
+
const checked = useMemo(
|
|
2120
|
+
() => required ? true : selected,
|
|
2121
|
+
[required, selected]
|
|
2122
|
+
);
|
|
2123
|
+
const onCheckedChange = useMemo(
|
|
2124
|
+
() => (checked2) => required ? () => {
|
|
2125
|
+
} : toggleSelection(value, checked2),
|
|
2126
|
+
[required, toggleSelection, value]
|
|
2127
|
+
);
|
|
2128
|
+
const disabled = useMemo(() => required, [required]);
|
|
2129
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(Item, { value, className: classes$1.root, children: [
|
|
2130
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: classes$1.header, children: [
|
|
2131
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: classes$1.label, children: [
|
|
2132
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Text, { weight: "bold", children: label2 }),
|
|
2133
|
+
sublabel && /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { size: "caption", color: "muted", children: sublabel })
|
|
2134
|
+
] }) }),
|
|
2135
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: classes$1.actions, children: [
|
|
2136
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2137
|
+
Switch,
|
|
2138
|
+
{
|
|
2139
|
+
checked,
|
|
2140
|
+
onCheckedChange,
|
|
2141
|
+
disabled
|
|
4111
2142
|
}
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
2143
|
+
),
|
|
2144
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2145
|
+
ChevronDown,
|
|
2146
|
+
{
|
|
2147
|
+
size: 16,
|
|
2148
|
+
className: clx({
|
|
2149
|
+
[classes$1.chevron]: true,
|
|
2150
|
+
[classes$1.open]: openItem === value
|
|
2151
|
+
})
|
|
4117
2152
|
}
|
|
4118
|
-
}
|
|
4119
|
-
}
|
|
4120
|
-
);
|
|
4121
|
-
}
|
|
4122
|
-
);
|
|
4123
|
-
var DialogContentImpl = React.forwardRef(
|
|
4124
|
-
(props, forwardedRef) => {
|
|
4125
|
-
const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
|
|
4126
|
-
const context = useDialogContext(CONTENT_NAME, __scopeDialog);
|
|
4127
|
-
const contentRef = React.useRef(null);
|
|
4128
|
-
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
4129
|
-
useFocusGuards();
|
|
4130
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
4131
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4132
|
-
FocusScope,
|
|
4133
|
-
{
|
|
4134
|
-
asChild: true,
|
|
4135
|
-
loop: true,
|
|
4136
|
-
trapped: trapFocus,
|
|
4137
|
-
onMountAutoFocus: onOpenAutoFocus,
|
|
4138
|
-
onUnmountAutoFocus: onCloseAutoFocus,
|
|
4139
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4140
|
-
DismissableLayer,
|
|
4141
|
-
{
|
|
4142
|
-
role: "dialog",
|
|
4143
|
-
id: context.contentId,
|
|
4144
|
-
"aria-describedby": context.descriptionId,
|
|
4145
|
-
"aria-labelledby": context.titleId,
|
|
4146
|
-
"data-state": getState(context.open),
|
|
4147
|
-
...contentProps,
|
|
4148
|
-
ref: composedRefs,
|
|
4149
|
-
onDismiss: () => context.onOpenChange(false)
|
|
4150
|
-
}
|
|
4151
|
-
)
|
|
4152
|
-
}
|
|
4153
|
-
),
|
|
4154
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
4155
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TitleWarning, { titleId: context.titleId }),
|
|
4156
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(DescriptionWarning, { contentRef, descriptionId: context.descriptionId })
|
|
2153
|
+
) })
|
|
4157
2154
|
] })
|
|
4158
|
-
] })
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
var TITLE_NAME = "DialogTitle";
|
|
4162
|
-
var DialogTitle = React.forwardRef(
|
|
4163
|
-
(props, forwardedRef) => {
|
|
4164
|
-
const { __scopeDialog, ...titleProps } = props;
|
|
4165
|
-
const context = useDialogContext(TITLE_NAME, __scopeDialog);
|
|
4166
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
|
|
4167
|
-
}
|
|
4168
|
-
);
|
|
4169
|
-
DialogTitle.displayName = TITLE_NAME;
|
|
4170
|
-
var DESCRIPTION_NAME = "DialogDescription";
|
|
4171
|
-
var DialogDescription = React.forwardRef(
|
|
4172
|
-
(props, forwardedRef) => {
|
|
4173
|
-
const { __scopeDialog, ...descriptionProps } = props;
|
|
4174
|
-
const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
|
|
4175
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
|
|
4176
|
-
}
|
|
4177
|
-
);
|
|
4178
|
-
DialogDescription.displayName = DESCRIPTION_NAME;
|
|
4179
|
-
var CLOSE_NAME = "DialogClose";
|
|
4180
|
-
var DialogClose = React.forwardRef(
|
|
4181
|
-
(props, forwardedRef) => {
|
|
4182
|
-
const { __scopeDialog, ...closeProps } = props;
|
|
4183
|
-
const context = useDialogContext(CLOSE_NAME, __scopeDialog);
|
|
4184
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4185
|
-
Primitive.button,
|
|
2155
|
+
] }),
|
|
2156
|
+
description2 && /* @__PURE__ */ jsxRuntimeExports.jsx(Content, { className: classes$1.description, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2157
|
+
Text,
|
|
4186
2158
|
{
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
ref: forwardedRef,
|
|
4190
|
-
onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
|
|
2159
|
+
size: "caption",
|
|
2160
|
+
dangerouslySetInnerHTML: { __html: description2 }
|
|
4191
2161
|
}
|
|
4192
|
-
)
|
|
4193
|
-
}
|
|
4194
|
-
);
|
|
4195
|
-
DialogClose.displayName = CLOSE_NAME;
|
|
4196
|
-
function getState(open2) {
|
|
4197
|
-
return open2 ? "open" : "closed";
|
|
4198
|
-
}
|
|
4199
|
-
var TITLE_WARNING_NAME = "DialogTitleWarning";
|
|
4200
|
-
var [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, {
|
|
4201
|
-
contentName: CONTENT_NAME,
|
|
4202
|
-
titleName: TITLE_NAME,
|
|
4203
|
-
docsSlug: "dialog"
|
|
4204
|
-
});
|
|
4205
|
-
var TitleWarning = ({ titleId }) => {
|
|
4206
|
-
const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
|
|
4207
|
-
const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
|
|
4208
|
-
|
|
4209
|
-
If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
4210
|
-
|
|
4211
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
|
|
4212
|
-
React.useEffect(() => {
|
|
4213
|
-
if (titleId) {
|
|
4214
|
-
const hasTitle = document.getElementById(titleId);
|
|
4215
|
-
if (!hasTitle) console.error(MESSAGE);
|
|
4216
|
-
}
|
|
4217
|
-
}, [MESSAGE, titleId]);
|
|
4218
|
-
return null;
|
|
2162
|
+
) })
|
|
2163
|
+
] });
|
|
4219
2164
|
};
|
|
4220
|
-
var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
|
|
4221
|
-
var DescriptionWarning = ({ contentRef, descriptionId }) => {
|
|
4222
|
-
const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
|
|
4223
|
-
const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
|
|
4224
|
-
React.useEffect(() => {
|
|
4225
|
-
const describedById = contentRef.current?.getAttribute("aria-describedby");
|
|
4226
|
-
if (descriptionId && describedById) {
|
|
4227
|
-
const hasDescription = document.getElementById(descriptionId);
|
|
4228
|
-
if (!hasDescription) console.warn(MESSAGE);
|
|
4229
|
-
}
|
|
4230
|
-
}, [MESSAGE, contentRef, descriptionId]);
|
|
4231
|
-
return null;
|
|
4232
|
-
};
|
|
4233
|
-
var Root = Dialog;
|
|
4234
|
-
var Content = DialogContent;
|
|
4235
|
-
var Title = DialogTitle;
|
|
4236
|
-
var Description = DialogDescription;
|
|
4237
|
-
var Close = DialogClose;
|
|
4238
2165
|
const BannerContent = ({
|
|
4239
2166
|
noTarget: noTarget2 = true,
|
|
4240
2167
|
heading: heading2 = "We use cookies.",
|
|
@@ -4244,54 +2171,77 @@ const BannerContent = ({
|
|
|
4244
2171
|
saveLabel = "Save selection",
|
|
4245
2172
|
declineLabel = "Decline all",
|
|
4246
2173
|
defaultSettingsOpen = true,
|
|
4247
|
-
privacyPolicy
|
|
4248
|
-
|
|
2174
|
+
privacyPolicy,
|
|
2175
|
+
items
|
|
4249
2176
|
}) => {
|
|
4250
2177
|
const { onSave, onDeclineAll, selectionTaken } = useSelection();
|
|
2178
|
+
const [openItem, setOpenItem] = useState(void 0);
|
|
4251
2179
|
const [settingsOpen, setSettingsOpen] = useState(defaultSettingsOpen);
|
|
4252
|
-
return /* @__PURE__ */
|
|
4253
|
-
|
|
2180
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2181
|
+
"div",
|
|
4254
2182
|
{
|
|
4255
|
-
className:
|
|
4256
|
-
|
|
2183
|
+
className: clx({
|
|
2184
|
+
[classes$2.root]: true,
|
|
2185
|
+
[classes$2.noTarget]: noTarget2,
|
|
2186
|
+
[classes$2.open]: !selectionTaken
|
|
2187
|
+
}),
|
|
2188
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4257
2189
|
Root$1,
|
|
4258
2190
|
{
|
|
4259
2191
|
open: settingsOpen,
|
|
4260
2192
|
onOpenChange: setSettingsOpen,
|
|
4261
|
-
className: classes.collapsible,
|
|
2193
|
+
className: classes$2.collapsible,
|
|
4262
2194
|
children: [
|
|
4263
|
-
/* @__PURE__ */
|
|
4264
|
-
/* @__PURE__ */
|
|
4265
|
-
/* @__PURE__ */
|
|
4266
|
-
/* @__PURE__ */
|
|
2195
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: classes$2.header, children: [
|
|
2196
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: classes$2.heading, children: [
|
|
2197
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Text, { weight: "bold", children: heading2 }),
|
|
2198
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Text, { size: "caption", color: "muted", children: subheading })
|
|
4267
2199
|
] }),
|
|
4268
|
-
/* @__PURE__ */
|
|
2200
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Trigger$1, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", children: [
|
|
4269
2201
|
settingsOpen ? hideLabel : selectLabel,
|
|
4270
2202
|
" ",
|
|
4271
|
-
/* @__PURE__ */
|
|
2203
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4272
2204
|
ChevronUp,
|
|
4273
2205
|
{
|
|
4274
2206
|
size: 12,
|
|
4275
2207
|
className: clx({
|
|
4276
|
-
[classes.chevron]: true,
|
|
4277
|
-
[classes.open]: settingsOpen
|
|
2208
|
+
[classes$2.chevron]: true,
|
|
2209
|
+
[classes$2.open]: settingsOpen
|
|
4278
2210
|
})
|
|
4279
2211
|
}
|
|
4280
2212
|
)
|
|
4281
2213
|
] }) })
|
|
4282
2214
|
] }),
|
|
4283
|
-
/* @__PURE__ */
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
2215
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2216
|
+
Content$1,
|
|
2217
|
+
{
|
|
2218
|
+
className: clx({
|
|
2219
|
+
[classes$2.settings]: true
|
|
2220
|
+
}),
|
|
2221
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2222
|
+
Root$2,
|
|
2223
|
+
{
|
|
2224
|
+
type: "single",
|
|
2225
|
+
collapsible: true,
|
|
2226
|
+
value: openItem,
|
|
2227
|
+
onValueChange: setOpenItem,
|
|
2228
|
+
children: items.map((item) => /* @__PURE__ */ jsxRuntimeExports.jsx(BannerItem, { ...item, openItem }, item.value))
|
|
2229
|
+
}
|
|
2230
|
+
)
|
|
2231
|
+
}
|
|
2232
|
+
),
|
|
2233
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: classes$2.footer, children: [
|
|
2234
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classes$2.legal, children: privacyPolicy && /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { size: "caption", children: /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: privacyPolicy.url, target: "_blank", children: privacyPolicy.label }) }) }),
|
|
2235
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: classes$2.actions, children: [
|
|
2236
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "neutral", onClick: () => onDeclineAll(), children: declineLabel }),
|
|
2237
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "brand", onClick: () => onSave(), children: saveLabel })
|
|
4288
2238
|
] })
|
|
4289
2239
|
] })
|
|
4290
2240
|
]
|
|
4291
2241
|
}
|
|
4292
2242
|
)
|
|
4293
2243
|
}
|
|
4294
|
-
)
|
|
2244
|
+
);
|
|
4295
2245
|
};
|
|
4296
2246
|
const Banner = ({
|
|
4297
2247
|
localStorageKey = "cb-selection",
|
|
@@ -4307,7 +2257,7 @@ const Banner = ({
|
|
|
4307
2257
|
})),
|
|
4308
2258
|
[items]
|
|
4309
2259
|
);
|
|
4310
|
-
return /* @__PURE__ */
|
|
2260
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(SelectionProvider, { items: selectionItems, localStorageKey, children: /* @__PURE__ */ jsxRuntimeExports.jsx(BannerContent, { items, ...rest }) });
|
|
4311
2261
|
};
|
|
4312
2262
|
export {
|
|
4313
2263
|
Banner
|